aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMatthew Hoops2011-12-12 15:25:28 -0500
committerMatthew Hoops2011-12-12 15:25:28 -0500
commit00279659b22cbd5db739d5351e83a9fc2a2ae408 (patch)
tree497f06f46820043cbdf1725652b8f0073223e24a /engines
parentd932df79bed5aac97e17c0920a5e75cb5ce733ee (diff)
parentd1628feb761acc9f4607f64de3eb620fea53bcc9 (diff)
downloadscummvm-rg350-00279659b22cbd5db739d5351e83a9fc2a2ae408.tar.gz
scummvm-rg350-00279659b22cbd5db739d5351e83a9fc2a2ae408.tar.bz2
scummvm-rg350-00279659b22cbd5db739d5351e83a9fc2a2ae408.zip
Merge remote branch 'upstream/master' into pegasus
Conflicts: video/qt_decoder.cpp
Diffstat (limited to 'engines')
-rw-r--r--engines/advancedDetector.cpp8
-rw-r--r--engines/advancedDetector.h8
-rw-r--r--engines/agi/cycle.cpp7
-rw-r--r--engines/agi/detection.cpp2
-rw-r--r--engines/agi/detection_tables.h20
-rw-r--r--engines/agi/graphics.cpp4
-rw-r--r--engines/agi/op_cmd.cpp6
-rw-r--r--engines/agi/opcodes.cpp4
-rw-r--r--engines/agi/saveload.cpp4
-rw-r--r--engines/agi/sound_2gs.cpp10
-rw-r--r--engines/agi/sound_2gs.h2
-rw-r--r--engines/agi/text.cpp4
-rw-r--r--engines/agi/words.cpp10
-rw-r--r--engines/agos/agos.h1
-rw-r--r--engines/agos/animation.cpp8
-rw-r--r--engines/agos/detection.cpp2
-rw-r--r--engines/agos/detection_tables.h250
-rw-r--r--engines/agos/draw.cpp2
-rw-r--r--engines/agos/installshield_cab.cpp1
-rw-r--r--engines/agos/midi.cpp6
-rw-r--r--engines/agos/res.cpp7
-rw-r--r--engines/agos/res_snd.cpp4
-rw-r--r--engines/agos/saveload.cpp9
-rw-r--r--engines/agos/sound.cpp6
-rw-r--r--engines/agos/subroutine.cpp1
-rw-r--r--engines/cge/bitmap.cpp16
-rw-r--r--engines/cge/bitmap.h1
-rw-r--r--engines/cge/cge.cpp14
-rw-r--r--engines/cge/cge.h9
-rw-r--r--engines/cge/cge_main.cpp76
-rw-r--r--engines/cge/cge_main.h5
-rw-r--r--engines/cge/console.cpp14
-rw-r--r--engines/cge/console.h1
-rw-r--r--engines/cge/detection.cpp38
-rw-r--r--engines/cge/events.cpp158
-rw-r--r--engines/cge/events.h43
-rw-r--r--engines/cge/fileio.cpp1
-rw-r--r--engines/cge/snail.cpp52
-rw-r--r--engines/cge/snail.h3
-rw-r--r--engines/cge/talk.cpp75
-rw-r--r--engines/cge/talk.h4
-rw-r--r--engines/cge/text.cpp18
-rw-r--r--engines/cge/vga13h.cpp24
-rw-r--r--engines/cge/vga13h.h6
-rw-r--r--engines/cge/walk.cpp8
-rw-r--r--engines/cge/walk.h1
-rw-r--r--engines/cine/cine.cpp4
-rw-r--r--engines/cine/detection.cpp2
-rw-r--r--engines/cine/detection_tables.h68
-rw-r--r--engines/cine/main_loop.cpp2
-rw-r--r--engines/cine/saveload.cpp2
-rw-r--r--engines/cine/sound.cpp269
-rw-r--r--engines/cine/various.cpp5
-rw-r--r--engines/composer/composer.cpp169
-rw-r--r--engines/composer/composer.h39
-rw-r--r--engines/composer/detection.cpp24
-rw-r--r--engines/composer/graphics.cpp73
-rw-r--r--engines/composer/resource.cpp68
-rw-r--r--engines/composer/resource.h22
-rw-r--r--engines/composer/scripting.cpp260
-rw-r--r--engines/cruise/cruise_main.cpp8
-rw-r--r--engines/cruise/detection.cpp26
-rw-r--r--engines/cruise/gfxModule.cpp2
-rw-r--r--engines/cruise/mainDraw.cpp4
-rw-r--r--engines/cruise/overlay.cpp6
-rw-r--r--engines/cruise/saveload.cpp1
-rw-r--r--engines/cruise/volume.cpp4
-rw-r--r--engines/draci/detection.cpp10
-rw-r--r--engines/draci/draci.cpp3
-rw-r--r--engines/draci/saveload.cpp2
-rw-r--r--engines/drascula/converse.cpp2
-rw-r--r--engines/drascula/detection.cpp30
-rw-r--r--engines/drascula/drascula.cpp4
-rw-r--r--engines/drascula/graphics.cpp5
-rw-r--r--engines/drascula/interface.cpp11
-rw-r--r--engines/drascula/saveload.cpp2
-rw-r--r--engines/drascula/sound.cpp33
-rw-r--r--engines/drascula/talk.cpp30
-rw-r--r--engines/dreamweb/backdrop.cpp142
-rw-r--r--engines/dreamweb/detection.cpp4
-rw-r--r--engines/dreamweb/detection_tables.h20
-rw-r--r--engines/dreamweb/dreambase.h217
-rw-r--r--engines/dreamweb/dreamgen.cpp13464
-rw-r--r--engines/dreamweb/dreamgen.h2522
-rw-r--r--engines/dreamweb/dreamweb.cpp311
-rw-r--r--engines/dreamweb/dreamweb.h43
-rw-r--r--engines/dreamweb/keypad.cpp267
-rw-r--r--engines/dreamweb/module.mk7
-rw-r--r--engines/dreamweb/monitor.cpp347
-rw-r--r--engines/dreamweb/object.cpp266
-rw-r--r--engines/dreamweb/pathfind.cpp218
-rw-r--r--engines/dreamweb/people.cpp789
-rw-r--r--engines/dreamweb/print.cpp181
-rw-r--r--engines/dreamweb/runtime.h192
-rw-r--r--engines/dreamweb/saveload.cpp589
-rw-r--r--engines/dreamweb/segment.h227
-rw-r--r--engines/dreamweb/sound.cpp294
-rw-r--r--engines/dreamweb/sprite.cpp1387
-rw-r--r--engines/dreamweb/structs.h86
-rw-r--r--engines/dreamweb/stubs.cpp4501
-rw-r--r--engines/dreamweb/stubs.h759
-rw-r--r--engines/dreamweb/talk.cpp38
-rw-r--r--engines/dreamweb/use.cpp1271
-rw-r--r--engines/dreamweb/vgafades.cpp255
-rw-r--r--engines/dreamweb/vgagrafx.cpp247
-rw-r--r--engines/engine.cpp12
-rw-r--r--engines/engine.h5
-rw-r--r--engines/engines.mk10
-rw-r--r--engines/game.cpp12
-rw-r--r--engines/game.h6
-rw-r--r--engines/gob/detection.cpp2
-rw-r--r--engines/gob/detection_tables.h706
-rw-r--r--engines/gob/draw_v1.cpp4
-rw-r--r--engines/gob/draw_v2.cpp4
-rw-r--r--engines/gob/iniconfig.cpp2
-rw-r--r--engines/gob/inter_playtoons.cpp2
-rw-r--r--engines/gob/inter_v1.cpp2
-rw-r--r--engines/gob/inter_v2.cpp2
-rw-r--r--engines/gob/inter_v7.cpp2
-rw-r--r--engines/gob/map.cpp2
-rw-r--r--engines/groovie/detection.cpp35
-rw-r--r--engines/groovie/roq.cpp4
-rw-r--r--engines/groovie/script.cpp6
-rw-r--r--engines/hugo/detection.cpp12
-rw-r--r--engines/hugo/game.h2
-rw-r--r--engines/hugo/object_v1d.cpp16
-rw-r--r--engines/hugo/object_v1w.cpp20
-rw-r--r--engines/hugo/object_v2d.cpp20
-rw-r--r--engines/hugo/object_v3d.cpp20
-rw-r--r--engines/hugo/parser.cpp2
-rw-r--r--engines/hugo/route.cpp32
-rw-r--r--engines/hugo/schedule.cpp7
-rw-r--r--engines/kyra/debugger.cpp14
-rw-r--r--engines/kyra/debugger.h5
-rw-r--r--engines/kyra/detection_tables.h184
-rw-r--r--engines/kyra/gui.cpp4
-rw-r--r--engines/kyra/gui.h5
-rw-r--r--engines/kyra/gui_lol.cpp21
-rw-r--r--engines/kyra/gui_lol.h2
-rw-r--r--engines/kyra/items_lol.cpp40
-rw-r--r--engines/kyra/kyra_hof.cpp14
-rw-r--r--engines/kyra/kyra_lok.cpp10
-rw-r--r--engines/kyra/kyra_lok.h6
-rw-r--r--engines/kyra/kyra_mr.cpp9
-rw-r--r--engines/kyra/kyra_v1.cpp6
-rw-r--r--engines/kyra/kyra_v1.h50
-rw-r--r--engines/kyra/lol.cpp83
-rw-r--r--engines/kyra/lol.h10
-rw-r--r--engines/kyra/scene_lok.cpp2
-rw-r--r--engines/kyra/scene_mr.cpp4
-rw-r--r--engines/kyra/scene_v1.cpp53
-rw-r--r--engines/kyra/script_hof.cpp3
-rw-r--r--engines/kyra/script_lol.cpp53
-rw-r--r--engines/kyra/script_mr.cpp2
-rw-r--r--engines/kyra/sequences_lok.cpp4
-rw-r--r--engines/kyra/sequences_lol.cpp2
-rw-r--r--engines/kyra/sound.cpp145
-rw-r--r--engines/kyra/sound.h58
-rw-r--r--engines/kyra/sound_adlib.cpp528
-rw-r--r--engines/kyra/sound_adlib.h26
-rw-r--r--engines/kyra/sound_lol.cpp4
-rw-r--r--engines/lastexpress/data/scene.h4
-rw-r--r--engines/lastexpress/data/snd.cpp2
-rw-r--r--engines/lastexpress/detection.cpp20
-rw-r--r--engines/lastexpress/entities/abbot.cpp2
-rw-r--r--engines/lastexpress/entities/august.cpp2
-rw-r--r--engines/lastexpress/entities/francois.cpp2
-rw-r--r--engines/lastexpress/entities/mertens.cpp2
-rw-r--r--engines/lastexpress/game/action.cpp2
-rw-r--r--engines/lastexpress/game/entities.cpp21
-rw-r--r--engines/lastexpress/game/savegame.cpp4
-rw-r--r--engines/lure/decode.cpp323
-rw-r--r--engines/lure/detection.cpp20
-rw-r--r--engines/lure/hotspots.cpp1
-rw-r--r--engines/lure/res.cpp2
-rw-r--r--engines/lure/room.cpp2
-rw-r--r--engines/lure/scripts.cpp2
-rw-r--r--engines/lure/sound.cpp10
-rw-r--r--engines/m4/actor.cpp199
-rw-r--r--engines/m4/actor.h114
-rw-r--r--engines/m4/animation.cpp535
-rw-r--r--engines/m4/animation.h127
-rw-r--r--engines/m4/assets.cpp650
-rw-r--r--engines/m4/assets.h212
-rw-r--r--engines/m4/burger_data.h82
-rw-r--r--engines/m4/compression.cpp190
-rw-r--r--engines/m4/compression.h77
-rw-r--r--engines/m4/console.cpp428
-rw-r--r--engines/m4/console.h83
-rw-r--r--engines/m4/converse.cpp1239
-rw-r--r--engines/m4/converse.h214
-rw-r--r--engines/m4/detection.cpp422
-rw-r--r--engines/m4/dialogs.cpp560
-rw-r--r--engines/m4/dialogs.h80
-rw-r--r--engines/m4/events.cpp365
-rw-r--r--engines/m4/events.h132
-rw-r--r--engines/m4/font.cpp291
-rw-r--r--engines/m4/font.h119
-rw-r--r--engines/m4/globals.cpp554
-rw-r--r--engines/m4/globals.h346
-rw-r--r--engines/m4/graphics.cpp1361
-rw-r--r--engines/m4/graphics.h270
-rw-r--r--engines/m4/gui.cpp1215
-rw-r--r--engines/m4/gui.h453
-rw-r--r--engines/m4/hotspot.cpp283
-rw-r--r--engines/m4/hotspot.h126
-rw-r--r--engines/m4/m4.cpp606
-rw-r--r--engines/m4/m4.h252
-rw-r--r--engines/m4/m4_menus.cpp724
-rw-r--r--engines/m4/m4_menus.h103
-rw-r--r--engines/m4/m4_scene.cpp326
-rw-r--r--engines/m4/m4_scene.h84
-rw-r--r--engines/m4/m4_views.cpp344
-rw-r--r--engines/m4/m4_views.h115
-rw-r--r--engines/m4/mads_anim.cpp745
-rw-r--r--engines/m4/mads_anim.h110
-rw-r--r--engines/m4/mads_logic.cpp1038
-rw-r--r--engines/m4/mads_logic.h117
-rw-r--r--engines/m4/mads_menus.cpp1173
-rw-r--r--engines/m4/mads_menus.h179
-rw-r--r--engines/m4/mads_player.cpp789
-rw-r--r--engines/m4/mads_player.h113
-rw-r--r--engines/m4/mads_scene.cpp1272
-rw-r--r--engines/m4/mads_scene.h195
-rw-r--r--engines/m4/mads_views.cpp1632
-rw-r--r--engines/m4/mads_views.h494
-rw-r--r--engines/m4/midi.cpp256
-rw-r--r--engines/m4/module.mk49
-rw-r--r--engines/m4/rails.cpp358
-rw-r--r--engines/m4/rails.h97
-rw-r--r--engines/m4/resource.cpp530
-rw-r--r--engines/m4/resource.h147
-rw-r--r--engines/m4/saveload.cpp166
-rw-r--r--engines/m4/scene.cpp208
-rw-r--r--engines/m4/scene.h120
-rw-r--r--engines/m4/script.cpp1389
-rw-r--r--engines/m4/script.h463
-rw-r--r--engines/m4/scripttab.h135
-rw-r--r--engines/m4/sound.cpp276
-rw-r--r--engines/m4/sound.h110
-rw-r--r--engines/m4/sprite.cpp207
-rw-r--r--engines/m4/sprite.h121
-rw-r--r--engines/m4/viewmgr.cpp444
-rw-r--r--engines/m4/viewmgr.h204
-rw-r--r--engines/m4/woodscript.cpp398
-rw-r--r--engines/m4/woodscript.h348
-rw-r--r--engines/m4/ws_machine.cpp423
-rw-r--r--engines/m4/ws_sequence.cpp768
-rw-r--r--engines/made/database.cpp14
-rw-r--r--engines/made/database.h14
-rw-r--r--engines/made/detection.cpp59
-rw-r--r--engines/made/graphics.cpp7
-rw-r--r--engines/made/graphics.h9
-rw-r--r--engines/made/made.cpp34
-rw-r--r--engines/made/made.h27
-rw-r--r--engines/made/music.cpp7
-rw-r--r--engines/made/music.h6
-rw-r--r--engines/made/pmvplayer.cpp10
-rw-r--r--engines/made/pmvplayer.h22
-rw-r--r--engines/made/redreader.cpp3
-rw-r--r--engines/made/redreader.h9
-rw-r--r--engines/made/resource.cpp16
-rw-r--r--engines/made/resource.h22
-rw-r--r--engines/made/screen.cpp24
-rw-r--r--engines/made/screen.h11
-rw-r--r--engines/made/screenfx.cpp5
-rw-r--r--engines/made/screenfx.h13
-rw-r--r--engines/made/script.cpp8
-rw-r--r--engines/made/script.h3
-rw-r--r--engines/made/scriptfuncs.cpp22
-rw-r--r--engines/made/scriptfuncs.h10
-rw-r--r--engines/made/sound.cpp6
-rw-r--r--engines/made/sound.h3
-rw-r--r--engines/mohawk/bitmap.cpp2
-rw-r--r--engines/mohawk/detection_tables.h438
-rw-r--r--engines/mohawk/graphics.cpp15
-rw-r--r--engines/mohawk/livingbooks.cpp303
-rw-r--r--engines/mohawk/livingbooks.h65
-rw-r--r--engines/mohawk/livingbooks_code.cpp475
-rw-r--r--engines/mohawk/livingbooks_code.h49
-rw-r--r--engines/mohawk/livingbooks_lbx.cpp141
-rw-r--r--engines/mohawk/livingbooks_lbx.h (renamed from engines/m4/saveload.h)37
-rw-r--r--engines/mohawk/module.mk1
-rw-r--r--engines/mohawk/myst_stacks/myst.cpp2
-rw-r--r--engines/mohawk/myst_stacks/stoneship.cpp6
-rw-r--r--engines/mohawk/video.cpp9
-rw-r--r--engines/mohawk/video.h1
-rw-r--r--engines/parallaction/detection.cpp21
-rw-r--r--engines/parallaction/graphics.cpp24
-rw-r--r--engines/parallaction/parallaction_br.cpp2
-rw-r--r--engines/parallaction/saveload.cpp2
-rw-r--r--engines/pegasus/detection.cpp4
-rw-r--r--engines/queen/queen.cpp6
-rw-r--r--engines/queen/talk.cpp7
-rw-r--r--engines/saga/detection.cpp2
-rw-r--r--engines/saga/detection_tables.h53
-rw-r--r--engines/saga/gfx.cpp2
-rw-r--r--engines/saga/isomap.cpp2
-rw-r--r--engines/saga/saveload.cpp2
-rw-r--r--engines/saga/scene.cpp2
-rw-r--r--engines/sci/console.cpp33
-rw-r--r--engines/sci/detection.cpp6
-rw-r--r--engines/sci/detection_tables.h745
-rw-r--r--engines/sci/engine/kernel.cpp34
-rw-r--r--engines/sci/engine/kernel.h7
-rw-r--r--engines/sci/engine/kernel_tables.h82
-rw-r--r--engines/sci/engine/kfile.cpp57
-rw-r--r--engines/sci/engine/kgraphics.cpp368
-rw-r--r--engines/sci/engine/klists.cpp12
-rw-r--r--engines/sci/engine/kmovement.cpp110
-rw-r--r--engines/sci/engine/ksound.cpp7
-rw-r--r--engines/sci/engine/kstring.cpp10
-rw-r--r--engines/sci/engine/kvideo.cpp94
-rw-r--r--engines/sci/engine/object.cpp7
-rw-r--r--engines/sci/engine/savegame.cpp17
-rw-r--r--engines/sci/engine/script.cpp27
-rw-r--r--engines/sci/engine/script.h18
-rw-r--r--engines/sci/engine/scriptdebug.cpp14
-rw-r--r--engines/sci/engine/seg_manager.cpp32
-rw-r--r--engines/sci/engine/seg_manager.h7
-rw-r--r--engines/sci/engine/segment.cpp6
-rw-r--r--engines/sci/engine/selector.cpp2
-rw-r--r--engines/sci/engine/selector.h2
-rw-r--r--engines/sci/engine/state.cpp8
-rw-r--r--engines/sci/engine/static_selectors.cpp21
-rw-r--r--engines/sci/engine/vm.cpp37
-rw-r--r--engines/sci/engine/vm.h22
-rw-r--r--engines/sci/engine/vm_types.h20
-rw-r--r--engines/sci/engine/workarounds.cpp6
-rw-r--r--engines/sci/event.cpp13
-rw-r--r--engines/sci/graphics/animate.cpp16
-rw-r--r--engines/sci/graphics/cache.cpp4
-rw-r--r--engines/sci/graphics/cache.h2
-rw-r--r--engines/sci/graphics/compare.cpp35
-rw-r--r--engines/sci/graphics/compare.h2
-rw-r--r--engines/sci/graphics/controls16.cpp (renamed from engines/sci/graphics/controls.cpp)35
-rw-r--r--engines/sci/graphics/controls16.h (renamed from engines/sci/graphics/controls.h)10
-rw-r--r--engines/sci/graphics/controls32.cpp204
-rw-r--r--engines/sci/graphics/controls32.h (renamed from engines/m4/staticres.h)49
-rw-r--r--engines/sci/graphics/coordadjuster.cpp16
-rw-r--r--engines/sci/graphics/coordadjuster.h4
-rw-r--r--engines/sci/graphics/cursor.cpp12
-rw-r--r--engines/sci/graphics/frameout.cpp444
-rw-r--r--engines/sci/graphics/frameout.h15
-rw-r--r--engines/sci/graphics/paint.h2
-rw-r--r--engines/sci/graphics/paint16.cpp31
-rw-r--r--engines/sci/graphics/paint16.h2
-rw-r--r--engines/sci/graphics/paint32.h2
-rw-r--r--engines/sci/graphics/palette.cpp32
-rw-r--r--engines/sci/graphics/palette.h2
-rw-r--r--engines/sci/graphics/picture.cpp50
-rw-r--r--engines/sci/graphics/picture.h5
-rw-r--r--engines/sci/graphics/text32.cpp315
-rw-r--r--engines/sci/graphics/text32.h30
-rw-r--r--engines/sci/graphics/view.cpp28
-rw-r--r--engines/sci/graphics/view.h2
-rw-r--r--engines/sci/module.mk4
-rw-r--r--engines/sci/resource.cpp22
-rw-r--r--engines/sci/resource.h2
-rw-r--r--engines/sci/resource_audio.cpp9
-rw-r--r--engines/sci/sci.cpp28
-rw-r--r--engines/sci/sci.h11
-rw-r--r--engines/sci/sound/drivers/adlib.cpp2
-rw-r--r--engines/sci/sound/drivers/amigamac.cpp55
-rw-r--r--engines/sci/sound/drivers/fmtowns.cpp652
-rw-r--r--engines/sci/sound/drivers/mididriver.h1
-rw-r--r--engines/sci/sound/midiparser_sci.cpp15
-rw-r--r--engines/sci/sound/music.cpp38
-rw-r--r--engines/sci/sound/music.h1
-rw-r--r--engines/sci/sound/soundcmd.cpp29
-rw-r--r--engines/scumm/debugger.cpp2
-rw-r--r--engines/scumm/detection.cpp13
-rw-r--r--engines/scumm/detection.h2
-rw-r--r--engines/scumm/detection_tables.h262
-rw-r--r--engines/scumm/he/script_v80he.cpp39
-rw-r--r--engines/scumm/he/script_v90he.cpp3
-rw-r--r--engines/scumm/he/sound_he.cpp20
-rw-r--r--engines/scumm/he/sprite_he.cpp7
-rw-r--r--engines/scumm/imuse/imuse_player.cpp1
-rw-r--r--engines/scumm/input.cpp17
-rw-r--r--engines/scumm/object.cpp2
-rw-r--r--engines/scumm/palette.cpp2
-rw-r--r--engines/scumm/player_towns.cpp9
-rw-r--r--engines/scumm/player_v2a.cpp244
-rw-r--r--engines/scumm/player_v2a.h2
-rw-r--r--engines/scumm/saveload.cpp31
-rw-r--r--engines/scumm/saveload.h2
-rw-r--r--engines/scumm/scumm-md5.h3
-rw-r--r--engines/scumm/scumm.cpp7
-rw-r--r--engines/scumm/smush/channel.cpp10
-rw-r--r--engines/scumm/sound.cpp116
-rw-r--r--engines/scumm/sound.h5
-rw-r--r--engines/sky/detection.cpp22
-rw-r--r--engines/sky/music/adlibmusic.cpp3
-rw-r--r--engines/sky/music/adlibmusic.h2
-rw-r--r--engines/sky/music/gmmusic.cpp2
-rw-r--r--engines/sky/music/gmmusic.h2
-rw-r--r--engines/sky/music/mt32music.cpp2
-rw-r--r--engines/sky/music/mt32music.h2
-rw-r--r--engines/sky/music/musicbase.cpp64
-rw-r--r--engines/sky/music/musicbase.h6
-rw-r--r--engines/sky/sky.cpp4
-rw-r--r--engines/sword1/animation.cpp15
-rw-r--r--engines/sword1/animation.h5
-rw-r--r--engines/sword1/detection.cpp24
-rw-r--r--engines/sword1/logic.cpp6
-rw-r--r--engines/sword1/sound.cpp39
-rw-r--r--engines/sword1/sound.h10
-rw-r--r--engines/sword1/staticres.cpp2
-rw-r--r--engines/sword1/sword1.h2
-rw-r--r--engines/sword1/swordres.h592
-rw-r--r--engines/sword2/console.cpp2
-rw-r--r--engines/sword2/sword2.cpp2
-rw-r--r--engines/sword25/detection.cpp2
-rw-r--r--engines/sword25/detection_tables.h38
-rw-r--r--engines/sword25/gfx/image/renderedimage.cpp4
-rw-r--r--engines/sword25/gfx/renderobject.h2
-rw-r--r--engines/teenagent/actor.cpp4
-rw-r--r--engines/teenagent/animation.h2
-rw-r--r--engines/teenagent/callbacks.cpp46
-rw-r--r--engines/teenagent/console.cpp64
-rw-r--r--engines/teenagent/console.h3
-rw-r--r--engines/teenagent/detection.cpp6
-rw-r--r--engines/teenagent/inventory.cpp6
-rw-r--r--engines/teenagent/music.cpp3
-rw-r--r--engines/teenagent/music.h2
-rw-r--r--engines/teenagent/objects.cpp26
-rw-r--r--engines/teenagent/objects.h14
-rw-r--r--engines/teenagent/pack.cpp2
-rw-r--r--engines/teenagent/pack.h9
-rw-r--r--engines/teenagent/scene.cpp241
-rw-r--r--engines/teenagent/scene.h80
-rw-r--r--engines/teenagent/surface.cpp6
-rw-r--r--engines/teenagent/surface.h5
-rw-r--r--engines/teenagent/surface_list.cpp4
-rw-r--r--engines/teenagent/surface_list.h6
-rw-r--r--engines/teenagent/teenagent.cpp73
-rw-r--r--engines/teenagent/teenagent.h2
-rw-r--r--engines/testbed/detection.cpp2
-rw-r--r--engines/tinsel/actors.cpp13
-rw-r--r--engines/tinsel/actors.h2
-rw-r--r--engines/tinsel/config.cpp6
-rw-r--r--engines/tinsel/detection_tables.h65
-rw-r--r--engines/tinsel/graphics.cpp6
-rw-r--r--engines/tinsel/music.cpp1
-rw-r--r--engines/tinsel/pcode.cpp2
-rw-r--r--engines/tinsel/pcode.h2
-rw-r--r--engines/tinsel/saveload.cpp7
-rw-r--r--engines/tinsel/savescn.cpp4
-rw-r--r--engines/toltecs/animation.cpp164
-rw-r--r--engines/toltecs/animation.h (renamed from engines/m4/staticres.cpp)74
-rw-r--r--engines/toltecs/detection.cpp306
-rw-r--r--engines/toltecs/menu.cpp613
-rw-r--r--engines/toltecs/menu.h167
-rw-r--r--engines/toltecs/microtiles.cpp215
-rw-r--r--engines/toltecs/microtiles.h61
-rw-r--r--engines/toltecs/module.mk28
-rw-r--r--engines/toltecs/movie.cpp290
-rw-r--r--engines/toltecs/movie.h59
-rw-r--r--engines/toltecs/music.cpp145
-rw-r--r--engines/toltecs/music.h (renamed from engines/m4/midi.h)46
-rw-r--r--engines/toltecs/palette.cpp231
-rw-r--r--engines/toltecs/palette.h85
-rw-r--r--engines/toltecs/render.cpp311
-rw-r--r--engines/toltecs/render.h99
-rw-r--r--engines/toltecs/resource.cpp128
-rw-r--r--engines/toltecs/resource.h85
-rw-r--r--engines/toltecs/saveload.cpp233
-rw-r--r--engines/toltecs/screen.cpp808
-rw-r--r--engines/toltecs/screen.h251
-rw-r--r--engines/toltecs/script.cpp1108
-rw-r--r--engines/toltecs/script.h184
-rw-r--r--engines/toltecs/segmap.cpp408
-rw-r--r--engines/toltecs/segmap.h116
-rw-r--r--engines/toltecs/sound.cpp224
-rw-r--r--engines/toltecs/sound.h77
-rw-r--r--engines/toltecs/sprite.cpp509
-rw-r--r--engines/toltecs/toltecs.cpp641
-rw-r--r--engines/toltecs/toltecs.h215
-rw-r--r--engines/toon/anim.cpp2
-rw-r--r--engines/toon/anim.h2
-rw-r--r--engines/toon/audio.cpp6
-rw-r--r--engines/toon/audio.h6
-rw-r--r--engines/toon/character.cpp8
-rw-r--r--engines/toon/character.h10
-rw-r--r--engines/toon/detection.cpp14
-rw-r--r--engines/toon/font.cpp6
-rw-r--r--engines/toon/font.h6
-rw-r--r--engines/toon/hotspot.cpp2
-rw-r--r--engines/toon/hotspot.h2
-rw-r--r--engines/toon/movie.cpp2
-rw-r--r--engines/toon/movie.h2
-rw-r--r--engines/toon/picture.cpp2
-rw-r--r--engines/toon/picture.h2
-rw-r--r--engines/toon/resource.cpp20
-rw-r--r--engines/toon/resource.h20
-rw-r--r--engines/toon/text.cpp2
-rw-r--r--engines/toon/text.h2
-rw-r--r--engines/toon/toon.cpp94
-rw-r--r--engines/toon/toon.h10
-rw-r--r--engines/touche/detection.cpp18
-rw-r--r--engines/touche/resource.cpp10
-rw-r--r--engines/tsage/blue_force/blueforce_dialogs.cpp67
-rw-r--r--engines/tsage/blue_force/blueforce_dialogs.h14
-rw-r--r--engines/tsage/blue_force/blueforce_logic.cpp390
-rw-r--r--engines/tsage/blue_force/blueforce_logic.h69
-rw-r--r--engines/tsage/blue_force/blueforce_scenes0.cpp305
-rw-r--r--engines/tsage/blue_force/blueforce_scenes0.h9
-rw-r--r--engines/tsage/blue_force/blueforce_scenes1.cpp2898
-rw-r--r--engines/tsage/blue_force/blueforce_scenes1.h349
-rw-r--r--engines/tsage/blue_force/blueforce_scenes2.cpp197
-rw-r--r--engines/tsage/blue_force/blueforce_scenes2.h14
-rw-r--r--engines/tsage/blue_force/blueforce_scenes3.cpp719
-rw-r--r--engines/tsage/blue_force/blueforce_scenes3.h51
-rw-r--r--engines/tsage/blue_force/blueforce_scenes4.cpp527
-rw-r--r--engines/tsage/blue_force/blueforce_scenes4.h51
-rw-r--r--engines/tsage/blue_force/blueforce_scenes5.cpp171
-rw-r--r--engines/tsage/blue_force/blueforce_scenes5.h8
-rw-r--r--engines/tsage/blue_force/blueforce_scenes6.cpp56
-rw-r--r--engines/tsage/blue_force/blueforce_scenes6.h3
-rw-r--r--engines/tsage/blue_force/blueforce_scenes7.cpp66
-rw-r--r--engines/tsage/blue_force/blueforce_scenes7.h13
-rw-r--r--engines/tsage/blue_force/blueforce_scenes8.cpp2343
-rw-r--r--engines/tsage/blue_force/blueforce_scenes8.h350
-rw-r--r--engines/tsage/blue_force/blueforce_scenes9.cpp2741
-rw-r--r--engines/tsage/blue_force/blueforce_scenes9.h316
-rw-r--r--engines/tsage/blue_force/blueforce_speakers.cpp53
-rw-r--r--engines/tsage/blue_force/blueforce_speakers.h15
-rw-r--r--engines/tsage/converse.cpp119
-rw-r--r--engines/tsage/converse.h14
-rw-r--r--engines/tsage/core.cpp510
-rw-r--r--engines/tsage/core.h61
-rw-r--r--engines/tsage/debugger.cpp307
-rw-r--r--engines/tsage/debugger.h28
-rw-r--r--engines/tsage/detection.cpp3
-rw-r--r--engines/tsage/detection_tables.h38
-rw-r--r--engines/tsage/dialogs.cpp236
-rw-r--r--engines/tsage/dialogs.h41
-rw-r--r--engines/tsage/events.cpp57
-rw-r--r--engines/tsage/events.h18
-rw-r--r--engines/tsage/globals.cpp186
-rw-r--r--engines/tsage/globals.h83
-rw-r--r--engines/tsage/graphics.cpp50
-rw-r--r--engines/tsage/graphics.h2
-rw-r--r--engines/tsage/module.mk9
-rw-r--r--engines/tsage/resources.cpp23
-rw-r--r--engines/tsage/resources.h6
-rw-r--r--engines/tsage/ringworld/ringworld_demo.cpp8
-rw-r--r--engines/tsage/ringworld/ringworld_demo.h2
-rw-r--r--engines/tsage/ringworld/ringworld_dialogs.cpp238
-rw-r--r--engines/tsage/ringworld/ringworld_dialogs.h39
-rw-r--r--engines/tsage/ringworld/ringworld_logic.cpp114
-rw-r--r--engines/tsage/ringworld/ringworld_logic.h27
-rw-r--r--engines/tsage/ringworld/ringworld_scenes1.cpp2
-rw-r--r--engines/tsage/ringworld/ringworld_scenes10.cpp28
-rw-r--r--engines/tsage/ringworld/ringworld_scenes10.h14
-rw-r--r--engines/tsage/ringworld/ringworld_scenes3.cpp6
-rw-r--r--engines/tsage/ringworld/ringworld_scenes5.cpp22
-rw-r--r--engines/tsage/ringworld/ringworld_scenes5.h8
-rw-r--r--engines/tsage/ringworld/ringworld_scenes6.cpp4
-rw-r--r--engines/tsage/ringworld/ringworld_scenes8.cpp46
-rw-r--r--engines/tsage/ringworld/ringworld_scenes8.h2
-rw-r--r--engines/tsage/ringworld2/ringworld2_dialogs.cpp447
-rw-r--r--engines/tsage/ringworld2/ringworld2_dialogs.h91
-rw-r--r--engines/tsage/ringworld2/ringworld2_logic.cpp1037
-rw-r--r--engines/tsage/ringworld2/ringworld2_logic.h289
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes0.cpp2256
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes0.h285
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes2.cpp2507
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes2.h389
-rw-r--r--engines/tsage/ringworld2/ringworld2_speakers.cpp738
-rw-r--r--engines/tsage/ringworld2/ringworld2_speakers.h209
-rw-r--r--engines/tsage/saveload.cpp10
-rw-r--r--engines/tsage/saveload.h2
-rw-r--r--engines/tsage/scenes.cpp45
-rw-r--r--engines/tsage/scenes.h5
-rw-r--r--engines/tsage/sound.cpp24
-rw-r--r--engines/tsage/sound.h16
-rw-r--r--engines/tsage/staticres.cpp43
-rw-r--r--engines/tsage/staticres.h38
-rw-r--r--engines/tsage/tsage.cpp29
-rw-r--r--engines/tsage/tsage.h5
-rw-r--r--engines/tsage/user_interface.cpp (renamed from engines/tsage/blue_force/blueforce_ui.cpp)169
-rw-r--r--engines/tsage/user_interface.h (renamed from engines/tsage/blue_force/blueforce_ui.h)15
-rw-r--r--engines/tucker/detection.cpp16
-rw-r--r--engines/tucker/locations.cpp11
586 files changed, 48001 insertions, 53255 deletions
diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
index d864fe8b52..081a97b9f1 100644
--- a/engines/advancedDetector.cpp
+++ b/engines/advancedDetector.cpp
@@ -104,7 +104,7 @@ void AdvancedMetaEngine::updateGameDescriptor(GameDescriptor &desc, const ADGame
if (_flags & kADFlagUseExtraAsHint)
desc["extra"] = realDesc->extra;
- desc.setGUIOptions(realDesc->guioptions | _guioptions);
+ desc.setGUIOptions(realDesc->guioptions + _guioptions);
desc.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(realDesc->language));
if (realDesc->flags & ADGF_ADDENGLISH)
@@ -207,7 +207,7 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine)
}
Common::FSNode dir(path);
Common::FSList files;
- if (!dir.isDirectory() || !dir.getChildren(files, Common::FSNode::kListAll)) {
+ if (!dir.isDirectory() || !dir.getChildren(files, Common::FSNode::kListAll, true)) {
warning("Game data path does not exist or is not a directory (%s)", path.c_str());
return Common::kNoGameDataFoundError;
}
@@ -257,7 +257,7 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine)
if (agdDesc->flags & ADGF_ADDENGLISH)
lang += " " + getGameGUIOptionsDescriptionLanguage(Common::EN_ANY);
- Common::updateGameGUIOptions(agdDesc->guioptions | _guioptions, lang);
+ Common::updateGameGUIOptions(agdDesc->guioptions + _guioptions, lang);
GameDescriptor gameDescriptor = toGameDescriptor(*agdDesc, _gameids);
@@ -568,7 +568,7 @@ AdvancedMetaEngine::AdvancedMetaEngine(const void *descs, uint descItemSize, con
_md5Bytes = 5000;
_singleid = NULL;
_flags = 0;
- _guioptions = Common::GUIO_NONE;
+ _guioptions = GUIO_NONE;
_maxScanDepth = 1;
_directoryGlobs = NULL;
}
diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h
index c5bfdbd26b..c31c8bd66e 100644
--- a/engines/advancedDetector.h
+++ b/engines/advancedDetector.h
@@ -88,7 +88,7 @@ struct ADGameDescription {
*/
uint32 flags;
- uint32 guioptions;
+ const char *guioptions;
};
/**
@@ -101,7 +101,7 @@ typedef Common::Array<const ADGameDescription *> ADGameDescList;
* terminate a list to be passed to the AdvancedDetector API.
*/
#define AD_TABLE_END_MARKER \
- { NULL, NULL, { { NULL, 0, NULL, 0 } }, Common::UNK_LANG, Common::kPlatformUnknown, ADGF_NO_FLAGS, Common::GUIO_NONE }
+ { NULL, NULL, { { NULL, 0, NULL, 0 } }, Common::UNK_LANG, Common::kPlatformUnknown, ADGF_NO_FLAGS, GUIO0() }
struct ADFileBasedFallback {
/**
@@ -181,11 +181,11 @@ protected:
uint32 _flags;
/**
- * A bitmask of game GUI options which will be added to each
+ * A list of game GUI options which will be added to each
* entry in addition to per-game options. Refer to GameGUIOption
* enum for the list.
*/
- uint32 _guioptions;
+ Common::String _guioptions;
/**
* Maximum depth of directories to look up.
diff --git a/engines/agi/cycle.cpp b/engines/agi/cycle.cpp
index 9cbab1f3c4..99649fb437 100644
--- a/engines/agi/cycle.cpp
+++ b/engines/agi/cycle.cpp
@@ -200,10 +200,11 @@ int AgiEngine::mainCycle() {
// vars in every interpreter cycle.
//
// We run AGIMOUSE always as a side effect
- if (getFeatures() & GF_AGIMOUSE || true) {
+ //if (getFeatures() & GF_AGIMOUSE) {
_game.vars[28] = _mouse.x / 2;
_game.vars[29] = _mouse.y;
- }
+ //}
+
if (key == KEY_PRIORITY) {
_sprites->eraseBoth();
_debug.priority = !_debug.priority;
@@ -315,7 +316,7 @@ int AgiEngine::playGame() {
_game.lineUserInput = 22;
// We run AGIMOUSE always as a side effect
- if (getFeatures() & GF_AGIMOUSE || true)
+ //if (getFeatures() & GF_AGIMOUSE)
debug(1, "Using AGI Mouse 1.0 protocol");
if (getFeatures() & GF_AGIPAL)
diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp
index 21b1831261..982dce8405 100644
--- a/engines/agi/detection.cpp
+++ b/engines/agi/detection.cpp
@@ -150,7 +150,7 @@ class AgiMetaEngine : public AdvancedMetaEngine {
public:
AgiMetaEngine() : AdvancedMetaEngine(Agi::gameDescriptions, sizeof(Agi::AGIGameDescription), agiGames) {
_singleid = "agi";
- _guioptions = Common::GUIO_NOSPEECH;
+ _guioptions = GUIO1(GUIO_NOSPEECH);
}
virtual const char *getName() const {
diff --git a/engines/agi/detection_tables.h b/engines/agi/detection_tables.h
index f0cd422ed6..ab0e9a1fe4 100644
--- a/engines/agi/detection_tables.h
+++ b/engines/agi/detection_tables.h
@@ -22,8 +22,6 @@
namespace Agi {
-using Common::GUIO_NONE;
-
#define GAME_LVFPN(id,extra,fname,md5,size,lang,ver,features,gid,platform,interp) { \
{ \
id, \
@@ -32,7 +30,7 @@ using Common::GUIO_NONE;
lang, \
platform, \
ADGF_NO_FLAGS, \
- GUIO_NONE \
+ GUIO0() \
}, \
gid, \
interp, \
@@ -48,7 +46,7 @@ using Common::GUIO_NONE;
lang, \
platform, \
ADGF_USEEXTRAASTITLE, \
- GUIO_NONE \
+ GUIO0() \
}, \
gid, \
interp, \
@@ -132,7 +130,7 @@ static const AGIGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GID_BC,
GType_V1,
@@ -153,7 +151,7 @@ static const AGIGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GID_BC,
GType_V1,
@@ -174,7 +172,7 @@ static const AGIGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GID_BC,
GType_V1,
@@ -254,7 +252,7 @@ static const AGIGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GID_GOLDRUSH,
GType_V3,
@@ -572,7 +570,7 @@ static const AGIGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GID_SQ2,
GType_V2,
@@ -861,7 +859,7 @@ static const AGIGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_USEEXTRAASTITLE,
- GUIO_NONE
+ GUIO0()
},
GID_FANMADE,
GType_V3,
@@ -889,7 +887,7 @@ static AGIGameDescription g_fallbackDesc = {
Common::UNK_LANG,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GID_FANMADE,
GType_V2,
diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp
index 074e5570d5..4bb3877f7d 100644
--- a/engines/agi/graphics.cpp
+++ b/engines/agi/graphics.cpp
@@ -1083,7 +1083,7 @@ void GfxMgr::putPixelsA(int x, int y, int n, uint8 *p) {
// Choose the correct screen to read from. If AGI256 or AGI256-2 is used and we're not trying to show the priority information,
// then choose the 256 color screen, otherwise choose the 16 color screen (Which also has the priority information).
- p += _vm->getFeatures() & (GF_AGI256 | GF_AGI256_2) && !_vm->_debug.priority ? FROM_SBUF16_TO_SBUF256_OFFSET : 0;
+ p += ((_vm->getFeatures() & (GF_AGI256 | GF_AGI256_2)) && !_vm->_debug.priority) ? FROM_SBUF16_TO_SBUF256_OFFSET : 0;
if (_vm->_renderMode == Common::kRenderCGA) {
for (x *= 2; n--; p++, x += 2) {
@@ -1091,7 +1091,7 @@ void GfxMgr::putPixelsA(int x, int y, int n, uint8 *p) {
*(uint16 *)&_agiScreen[x + y * GFX_WIDTH] = (q >> rShift) & 0x0f0f;
}
} else {
- const uint16 mask = _vm->getFeatures() & (GF_AGI256 | GF_AGI256_2) && !_vm->_debug.priority ? 0xffff : 0x0f0f;
+ const uint16 mask = ((_vm->getFeatures() & (GF_AGI256 | GF_AGI256_2)) && !_vm->_debug.priority) ? 0xffff : 0x0f0f;
for (x *= 2; n--; p++, x += 2) {
register uint16 q = ((uint16)*p << 8) | *p;
*(uint16 *)&_agiScreen[x + y * GFX_WIDTH] = (q >> rShift) & mask;
diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index 72f60e2516..41d9cc3ac9 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -1622,15 +1622,15 @@ void cmdPrintAtV(AgiGame *state, uint8 *p) {
void cmdPushScript(AgiGame *state, uint8 *p) {
// We run AGIMOUSE always as a side effect
- if (getFeatures() & GF_AGIMOUSE || true) {
+ //if (getFeatures() & GF_AGIMOUSE || true) {
state->vars[27] = state->_vm->_mouse.button;
state->vars[28] = state->_vm->_mouse.x / 2;
state->vars[29] = state->_vm->_mouse.y;
- } else {
+ /*} else {
if (getVersion() >= 0x2915) {
debug(0, "push.script");
}
- }
+ }*/
}
void cmdSetPriBase(AgiGame *state, uint8 *p) {
diff --git a/engines/agi/opcodes.cpp b/engines/agi/opcodes.cpp
index d1baab93e1..29fb860635 100644
--- a/engines/agi/opcodes.cpp
+++ b/engines/agi/opcodes.cpp
@@ -360,7 +360,7 @@ AgiInstruction insV2[] = {
void AgiEngine::setupOpcodes() {
if (getVersion() >= 0x2000) {
- for (int i = 0; i <= ARRAYSIZE(insV2Test); ++i)
+ for (int i = 0; i < ARRAYSIZE(insV2Test); ++i)
_agiCondCommands[i] = insV2Test[i].func;
for (int i = 0; i < ARRAYSIZE(insV2); ++i)
_agiCommands[i] = insV2[i].func;
@@ -368,7 +368,7 @@ void AgiEngine::setupOpcodes() {
logicNamesTest = insV2Test;
logicNamesCmd = insV2;
} else {
- for (int i = 0; i <= ARRAYSIZE(insV1Test); ++i)
+ for (int i = 0; i < ARRAYSIZE(insV1Test); ++i)
_agiCondCommands[i] = insV1Test[i].func;
for (int i = 0; i < ARRAYSIZE(insV1); ++i)
_agiCommands[i] = insV1[i].func;
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp
index 3cebbf50c8..1bcabd507f 100644
--- a/engines/agi/saveload.cpp
+++ b/engines/agi/saveload.cpp
@@ -300,7 +300,7 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) {
_game.state = (State)in->readByte();
in->read(loadId, 8);
- if (strcmp(loadId, _game.id) && checkId) {
+ if (strcmp(loadId, _game.id) != 0 && checkId) {
delete in;
warning("This save seems to be from a different AGI game (save from %s, running %s), not loaded", loadId, _game.id);
return errBadFileOpen;
@@ -331,7 +331,7 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) {
warning("Since your game was only detected via the fallback detector, there is no possibility to assure the save is compatible with your game version");
debug(0, "The game used for saving is \"%s\".", md5);
- } else if (strcmp(md5, getGameMD5())) {
+ } else if (strcmp(md5, getGameMD5()) != 0) {
warning("Game was saved with different gamedata - you may encounter problems");
debug(0, "Your game is \"%s\" and save is \"%s\".", getGameMD5(), md5);
diff --git a/engines/agi/sound_2gs.cpp b/engines/agi/sound_2gs.cpp
index c5cfa125d6..b15950f31d 100644
--- a/engines/agi/sound_2gs.cpp
+++ b/engines/agi/sound_2gs.cpp
@@ -719,7 +719,10 @@ bool SoundGen2GS::loadInstrumentHeaders(Common::String &exePath, const IIgsExeIn
}
// Read the whole executable file into memory
- Common::SharedPtr<Common::SeekableReadStream> data(file.readStream(file.size()));
+ // CHECKME: Why do we read the file into memory first? It does not seem to be
+ // kept outside of this function. Is the processing of the data too slow
+ // otherwise?
+ Common::ScopedPtr<Common::SeekableReadStream> data(file.readStream(file.size()));
file.close();
// Check that we got enough data to be able to parse the instruments
@@ -769,8 +772,11 @@ bool SoundGen2GS::loadWaveFile(Common::String &wavePath, const IIgsExeInfo &exeI
Common::File file;
// Open the wave file and read it into memory
+ // CHECKME: Why do we read the file into memory first? It does not seem to be
+ // kept outside of this function. Is the processing of the data too slow
+ // otherwise?
file.open(wavePath);
- Common::SharedPtr<Common::SeekableReadStream> uint8Wave(file.readStream(file.size()));
+ Common::ScopedPtr<Common::SeekableReadStream> uint8Wave(file.readStream(file.size()));
file.close();
// Check that we got the whole wave file
diff --git a/engines/agi/sound_2gs.h b/engines/agi/sound_2gs.h
index 89ffc3fe11..404f4a47a1 100644
--- a/engines/agi/sound_2gs.h
+++ b/engines/agi/sound_2gs.h
@@ -247,7 +247,7 @@ private:
void midiNoteOff(int channel, int note, int velocity);
void midiNoteOn(int channel, int note, int velocity);
double midiKeyToFreq(int key, double finetune);
- IIgsInstrumentHeader* getInstrument(uint8 program) { return &_instruments[_progToInst->map(program)]; };
+ IIgsInstrumentHeader* getInstrument(uint8 program) { return &_instruments[_progToInst->map(program)]; }
IIgsGenerator* allocateGenerator() { IIgsGenerator* g = &_generators[_nextGen++]; _nextGen %= 16; return g; }
bool _disableMidi; ///< Disable MIDI if loading instruments fail
diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp
index 502db4bdba..3247862e32 100644
--- a/engines/agi/text.cpp
+++ b/engines/agi/text.cpp
@@ -224,7 +224,8 @@ void AgiEngine::printTextConsole(const char *msg, int x, int y, int len, int fg,
* Based on GBAGI implementation with permission from the author
*/
char *AgiEngine::wordWrapString(const char *s, int *len) {
- char *outStr, *msgBuf, maxWidth = *len;
+ char *outStr, *msgBuf;
+ int maxWidth = *len;
const char *pWord;
int lnLen, wLen;
@@ -239,7 +240,6 @@ char *AgiEngine::wordWrapString(const char *s, int *len) {
while (*s) {
pWord = s;
- wLen = 0;
while (*s != '\0' && *s != ' ' && *s != '\n' && *s != '\r')
s++;
diff --git a/engines/agi/words.cpp b/engines/agi/words.cpp
index ec6928f8ed..1001c66b20 100644
--- a/engines/agi/words.cpp
+++ b/engines/agi/words.cpp
@@ -120,6 +120,7 @@ void AgiEngine::unloadWords() {
*/
int AgiEngine::findWord(const char *word, int *flen) {
int c;
+ int result = -1;
debugC(2, kDebugLevelScripts, "find_word(%s)", word);
@@ -130,15 +131,18 @@ int AgiEngine::findWord(const char *word, int *flen) {
*flen = 0;
Common::Array<AgiWord*> &a = _game.words[c];
+
for (int i = 0; i < (int)a.size(); i++) {
int wlen = strlen(a[i]->word);
- if (!strncmp(a[i]->word, word, wlen) && (word[wlen] == 0 || word[wlen] == 0x20)) {
+ // Keep looking till we find the word itself, or the whole phrase.
+ // Try to find the best match (i.e. the longest matching phrase).
+ if (!strncmp(a[i]->word, word, wlen) && (word[wlen] == 0 || word[wlen] == 0x20) && wlen >= *flen) {
*flen = wlen;
- return a[i]->id;
+ result = a[i]->id;
}
}
- return -1;
+ return result;
}
void AgiEngine::dictionaryWords(char *msg) {
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index cf75842cdd..03feafa70f 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -197,6 +197,7 @@ public:
void registerArchive(const Common::String &filename, int priority);
#endif
+ bool hasFile(const Common::String &name);
Common::SeekableReadStream *open(const Common::String &filename);
private:
diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp
index d9d6b71a2a..db2cff328c 100644
--- a/engines/agos/animation.cpp
+++ b/engines/agos/animation.cpp
@@ -525,25 +525,25 @@ MoviePlayer *makeMoviePlayer(AGOSEngine_Feeble *vm, const char *name) {
memcpy(shortName, baseName, 6);
sprintf(filename, "%s~1.dxa", shortName);
- if (Common::File::exists(filename)) {
+ if (vm->_archives.hasFile(filename)) {
memset(baseName, 0, sizeof(baseName));
memcpy(baseName, filename, 8);
}
sprintf(filename, "%s~1.smk", shortName);
- if (Common::File::exists(filename)) {
+ if (vm->_archives.hasFile(filename)) {
memset(baseName, 0, sizeof(baseName));
memcpy(baseName, filename, 8);
}
}
sprintf(filename, "%s.dxa", baseName);
- if (Common::File::exists(filename)) {
+ if (vm->_archives.hasFile(filename)) {
return new MoviePlayerDXA(vm, baseName);
}
sprintf(filename, "%s.smk", baseName);
- if (Common::File::exists(filename)) {
+ if (vm->_archives.hasFile(filename)) {
return new MoviePlayerSMK(vm, baseName);
}
diff --git a/engines/agos/detection.cpp b/engines/agos/detection.cpp
index 116e66820a..13559c2f4f 100644
--- a/engines/agos/detection.cpp
+++ b/engines/agos/detection.cpp
@@ -93,7 +93,7 @@ using namespace AGOS;
class AgosMetaEngine : public AdvancedMetaEngine {
public:
AgosMetaEngine() : AdvancedMetaEngine(AGOS::gameDescriptions, sizeof(AGOS::AGOSGameDescription), agosGames) {
- _guioptions = Common::GUIO_NOLAUNCHLOAD;
+ _guioptions = GUIO1(GUIO_NOLAUNCHLOAD);
_maxScanDepth = 2;
_directoryGlobs = directoryGlobs;
}
diff --git a/engines/agos/detection_tables.h b/engines/agos/detection_tables.h
index a7a384a496..7fe6df5f17 100644
--- a/engines/agos/detection_tables.h
+++ b/engines/agos/detection_tables.h
@@ -22,12 +22,6 @@
namespace AGOS {
-using Common::GUIO_NONE;
-using Common::GUIO_NOMIDI;
-using Common::GUIO_NOMUSIC;
-using Common::GUIO_NOSPEECH;
-using Common::GUIO_NOSUBTITLES;
-
static const AGOSGameDescription gameDescriptions[] = {
// Personal Nightmare 1.1 - English Amiga
{
@@ -44,7 +38,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_PN,
@@ -67,7 +61,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAtariST,
ADGF_DEMO,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_PN,
@@ -90,7 +84,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAtariST,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_PN,
@@ -113,7 +107,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_PN,
@@ -136,7 +130,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAmiga,
ADGF_DEMO,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_ELVIRA1,
@@ -157,7 +151,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_ELVIRA1,
@@ -178,7 +172,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_ELVIRA1,
@@ -199,7 +193,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_ELVIRA1,
@@ -222,7 +216,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAtariST,
ADGF_DEMO,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_ELVIRA1,
@@ -245,7 +239,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAtariST,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_ELVIRA1,
@@ -268,7 +262,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAtariST,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_ELVIRA1,
@@ -291,7 +285,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_ELVIRA1,
@@ -314,7 +308,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_ELVIRA1,
@@ -337,7 +331,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_ELVIRA1,
@@ -360,7 +354,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_ELVIRA1,
@@ -383,7 +377,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_ELVIRA1,
@@ -409,7 +403,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_ELVIRA2,
@@ -435,7 +429,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_ELVIRA2,
@@ -461,7 +455,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_ELVIRA2,
@@ -487,7 +481,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_ELVIRA2,
@@ -513,7 +507,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_ELVIRA2,
@@ -539,7 +533,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAtariST,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_ELVIRA2,
@@ -565,7 +559,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformAtariST,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_ELVIRA2,
@@ -592,7 +586,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_ELVIRA2,
@@ -618,7 +612,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_ELVIRA2,
@@ -644,7 +638,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_ELVIRA2,
@@ -670,7 +664,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_ELVIRA2,
@@ -696,7 +690,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_ELVIRA2,
@@ -722,7 +716,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_ELVIRA2,
@@ -748,7 +742,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_ELVIRA2,
@@ -774,7 +768,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_ELVIRA2,
@@ -801,7 +795,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_WW,
@@ -828,7 +822,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_WW,
@@ -851,7 +845,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_WW,
@@ -880,7 +874,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_WW,
@@ -909,7 +903,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_WW,
@@ -938,7 +932,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_WW,
@@ -967,7 +961,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_WW,
@@ -991,7 +985,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAcorn,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_SIMON1,
@@ -1016,7 +1010,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAcorn,
ADGF_DEMO,
- GUIO_NOSUBTITLES
+ GUIO1(GUIO_NOSUBTITLES)
},
GType_SIMON1,
@@ -1041,7 +1035,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAcorn,
ADGF_CD,
- GUIO_NOSUBTITLES
+ GUIO1(GUIO_NOSUBTITLES)
},
GType_SIMON1,
@@ -1065,7 +1059,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_SIMON1,
@@ -1089,7 +1083,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAmiga,
ADGF_DEMO,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_SIMON1,
@@ -1113,7 +1107,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_SIMON1,
@@ -1137,7 +1131,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_SIMON1,
@@ -1161,7 +1155,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_SIMON1,
@@ -1185,7 +1179,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH | GUIO_NOMIDI
+ GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)
},
GType_SIMON1,
@@ -1209,7 +1203,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAmiga,
ADGF_CD,
- GUIO_NOSUBTITLES | GUIO_NOMIDI
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOMIDI)
},
GType_SIMON1,
@@ -1233,7 +1227,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAmiga,
ADGF_CD,
- GUIO_NOSUBTITLES | GUIO_NOMIDI
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOMIDI)
},
GType_SIMON1,
@@ -1257,7 +1251,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_SIMON1,
@@ -1281,7 +1275,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_SIMON1,
@@ -1305,7 +1299,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::CZ_CZE,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_SIMON1,
@@ -1329,7 +1323,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::RU_RUS,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_SIMON1,
@@ -1353,7 +1347,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_SIMON1,
@@ -1377,7 +1371,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::CZ_CZE,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_SIMON1,
@@ -1401,7 +1395,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::RU_RUS,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_SIMON1,
@@ -1425,7 +1419,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_SIMON1,
@@ -1449,7 +1443,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_SIMON1,
@@ -1473,7 +1467,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_SIMON1,
@@ -1497,7 +1491,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_SIMON1,
@@ -1522,7 +1516,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- GUIO_NOSUBTITLES
+ GUIO1(GUIO_NOSUBTITLES)
},
GType_SIMON1,
@@ -1547,7 +1541,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NOSUBTITLES
+ GUIO1(GUIO_NOSUBTITLES)
},
GType_SIMON1,
@@ -1572,7 +1566,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NOSUBTITLES
+ GUIO1(GUIO_NOSUBTITLES)
},
GType_SIMON1,
@@ -1597,7 +1591,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::RU_RUS,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GType_SIMON1,
@@ -1622,7 +1616,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GType_SIMON1,
@@ -1647,7 +1641,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES
+ GUIO1(GUIO_NOSUBTITLES)
},
GType_SIMON1,
@@ -1672,7 +1666,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::HE_ISR,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GType_SIMON1,
@@ -1697,7 +1691,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GType_SIMON1,
@@ -1723,7 +1717,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformWindows,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GType_SIMON1,
@@ -1748,7 +1742,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GType_SIMON1,
@@ -1773,7 +1767,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_CD,
- GUIO_NOSUBTITLES
+ GUIO1(GUIO_NOSUBTITLES)
},
GType_SIMON1,
@@ -1798,7 +1792,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformWindows,
ADGF_CD,
- GUIO_NOSUBTITLES
+ GUIO1(GUIO_NOSUBTITLES)
},
GType_SIMON1,
@@ -1823,7 +1817,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_SIMON2,
@@ -1848,7 +1842,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::RU_RUS,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_SIMON2,
@@ -1873,7 +1867,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_SIMON2,
@@ -1898,7 +1892,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_SIMON2,
@@ -1923,7 +1917,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_SIMON2,
@@ -1948,7 +1942,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- GUIO_NONE
+ GUIO0()
},
GType_SIMON2,
@@ -1973,7 +1967,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DEMO,
- GUIO_NONE
+ GUIO0()
},
GType_SIMON2,
@@ -1998,7 +1992,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DEMO,
- GUIO_NONE
+ GUIO0()
},
GType_SIMON2,
@@ -2023,7 +2017,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GType_SIMON2,
@@ -2048,7 +2042,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GType_SIMON2,
@@ -2073,7 +2067,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GType_SIMON2,
@@ -2098,7 +2092,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GType_SIMON2,
@@ -2123,7 +2117,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GType_SIMON2,
@@ -2148,7 +2142,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::HE_ISR,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GType_SIMON2,
@@ -2174,7 +2168,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformWindows,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GType_SIMON2,
@@ -2199,7 +2193,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GType_SIMON2,
@@ -2224,7 +2218,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::CZ_CZE,
Common::kPlatformWindows,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GType_SIMON2,
@@ -2249,7 +2243,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GType_SIMON2,
@@ -2274,7 +2268,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GType_SIMON2,
@@ -2299,7 +2293,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformWindows,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GType_SIMON2,
@@ -2324,7 +2318,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::PL_POL,
Common::kPlatformWindows,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GType_SIMON2,
@@ -2346,7 +2340,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- GUIO_NOSUBTITLES | GUIO_NOMUSIC
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOMUSIC, GUIO_NOASPECT)
},
GType_FF,
@@ -2367,7 +2361,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DEMO,
- GUIO_NOSUBTITLES | GUIO_NOMUSIC
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOMUSIC, GUIO_NOASPECT)
},
GType_FF,
@@ -2391,7 +2385,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOMUSIC
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOMUSIC, GUIO_NOASPECT)
},
GType_FF,
@@ -2415,7 +2409,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOMUSIC
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOMUSIC, GUIO_NOASPECT)
},
GType_FF,
@@ -2439,7 +2433,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOMUSIC
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOMUSIC, GUIO_NOASPECT)
},
GType_FF,
@@ -2463,7 +2457,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOMUSIC
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOMUSIC, GUIO_NOASPECT)
},
GType_FF,
@@ -2487,7 +2481,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOMUSIC
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOMUSIC, GUIO_NOASPECT)
},
GType_FF,
@@ -2511,7 +2505,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOMUSIC
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOMUSIC, GUIO_NOASPECT)
},
GType_FF,
@@ -2532,7 +2526,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOMUSIC
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOMUSIC, GUIO_NOASPECT)
},
GType_FF,
@@ -2555,7 +2549,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOMUSIC
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOMUSIC, GUIO_NOASPECT)
},
GType_FF,
@@ -2578,7 +2572,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::PL_POL,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOMUSIC
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOMUSIC, GUIO_NOASPECT)
},
GType_FF,
@@ -2599,7 +2593,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOMUSIC
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOMUSIC, GUIO_NOASPECT)
},
GType_FF,
@@ -2622,7 +2616,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOMUSIC
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOMUSIC, GUIO_NOASPECT)
},
GType_FF,
@@ -2645,7 +2639,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOMUSIC
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOMUSIC, GUIO_NOASPECT)
},
GType_FF,
@@ -2668,7 +2662,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOMUSIC
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOMUSIC, GUIO_NOASPECT)
},
GType_FF,
@@ -2691,7 +2685,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOMUSIC
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOMUSIC, GUIO_NOASPECT)
},
GType_FF,
@@ -2714,7 +2708,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::PL_POL,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOMUSIC
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOMUSIC, GUIO_NOASPECT)
},
GType_FF,
@@ -2737,7 +2731,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOMUSIC
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOMUSIC, GUIO_NOASPECT)
},
GType_FF,
@@ -2758,7 +2752,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOMUSIC
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOMUSIC, GUIO_NOASPECT)
},
GType_PP,
@@ -2779,7 +2773,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOMUSIC
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOMUSIC, GUIO_NOASPECT)
},
GType_PP,
@@ -2800,7 +2794,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOASPECT)
},
GType_PP,
@@ -2821,7 +2815,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOASPECT)
},
GType_PP,
@@ -2842,7 +2836,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOASPECT)
},
GType_PP,
@@ -2863,7 +2857,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOASPECT)
},
GType_PP,
@@ -2884,7 +2878,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOASPECT)
},
GType_PP,
@@ -2905,7 +2899,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOASPECT)
},
GType_PP,
@@ -2926,7 +2920,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOASPECT)
},
GType_PP,
@@ -2947,7 +2941,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::PL_POL,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOASPECT)
},
GType_PP,
@@ -2968,7 +2962,7 @@ static const AGOSGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOASPECT)
},
GType_PP,
diff --git a/engines/agos/draw.cpp b/engines/agos/draw.cpp
index 9fc5cedbf9..cf3a12ceb8 100644
--- a/engines/agos/draw.cpp
+++ b/engines/agos/draw.cpp
@@ -776,7 +776,7 @@ void AGOSEngine::setMoveRect(uint16 x, uint16 y, uint16 width, uint16 height) {
void AGOSEngine::displayScreen() {
if (_fastFadeInFlag == 0 && _paletteFlag == 1) {
_paletteFlag = 0;
- if (memcmp(_displayPalette, _currentPalette, sizeof(_currentPalette))) {
+ if (memcmp(_displayPalette, _currentPalette, sizeof(_currentPalette)) != 0) {
memcpy(_currentPalette, _displayPalette, sizeof(_displayPalette));
_system->getPaletteManager()->setPalette(_displayPalette, 0, 256);
}
diff --git a/engines/agos/installshield_cab.cpp b/engines/agos/installshield_cab.cpp
index f7b49a64c5..ac4e40d1d1 100644
--- a/engines/agos/installshield_cab.cpp
+++ b/engines/agos/installshield_cab.cpp
@@ -162,7 +162,6 @@ InstallShieldCabinet::InstallShieldCabinet(const Common::String &filename) : _in
}
bool InstallShieldCabinet::hasFile(const Common::String &name) {
- warning("hasFile: Filename %s", name.c_str());
return _map.contains(name);
}
diff --git a/engines/agos/midi.cpp b/engines/agos/midi.cpp
index 431f080bf2..b3ade91107 100644
--- a/engines/agos/midi.cpp
+++ b/engines/agos/midi.cpp
@@ -478,7 +478,7 @@ void MidiPlayer::loadMultipleSMF(Common::File *in, bool sfx) {
// Make sure there's a MThd
in->read(buf, 4);
- if (memcmp(buf, "MThd", 4)) {
+ if (memcmp(buf, "MThd", 4) != 0) {
warning("Expected MThd but found '%c%c%c%c' instead", buf[0], buf[1], buf[2], buf[3]);
return;
}
@@ -487,7 +487,7 @@ void MidiPlayer::loadMultipleSMF(Common::File *in, bool sfx) {
// Now skip all the MTrk blocks
while (true) {
in->read(buf, 4);
- if (memcmp(buf, "MTrk", 4))
+ if (memcmp(buf, "MTrk", 4) != 0)
break;
in->seek(in->readUint32BE(), SEEK_CUR);
}
@@ -524,7 +524,7 @@ void MidiPlayer::loadXMIDI(Common::File *in, bool sfx) {
memcpy(buf, &buf[2], 2);
in->read(&buf[2], 2);
}
- if (memcmp(buf, "CAT ", 4)) {
+ if (memcmp(buf, "CAT ", 4) != 0) {
error("Could not find 'CAT ' tag to determine resource size");
}
size += 4 + in->readUint32BE();
diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp
index 69447f4b83..62197340d2 100644
--- a/engines/agos/res.cpp
+++ b/engines/agos/res.cpp
@@ -47,6 +47,13 @@ void ArchiveMan::registerArchive(const Common::String &filename, int priority) {
}
#endif
+bool ArchiveMan::hasFile(const Common::String &name) {
+ if (_fallBack && SearchMan.hasFile(name))
+ return true;
+
+ return Common::SearchSet::hasFile(name);
+}
+
Common::SeekableReadStream *ArchiveMan::open(const Common::String &filename) {
if (_fallBack && SearchMan.hasFile(filename)) {
return SearchMan.createReadStreamForMember(filename);
diff --git a/engines/agos/res_snd.cpp b/engines/agos/res_snd.cpp
index b5612d710d..e9a7ea4de9 100644
--- a/engines/agos/res_snd.cpp
+++ b/engines/agos/res_snd.cpp
@@ -495,7 +495,7 @@ void AGOSEngine::loadSound(uint16 sound, int16 pan, int16 vol, uint16 type) {
}
if (getPlatform() == Common::kPlatformAmiga)
- sprintf(filename, "sfx%d.wav", file);
+ sprintf(filename, "sfx%u.wav", file);
else
sprintf(filename, "effects.wav");
@@ -606,7 +606,7 @@ void AGOSEngine::loadVoice(uint speechId) {
}
if (getPlatform() == Common::kPlatformAmiga)
- sprintf(filename, "sp%d.wav", file);
+ sprintf(filename, "sp%u.wav", file);
else
sprintf(filename, "speech.wav");
diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp
index 6779eabdbf..920dbb0a0d 100644
--- a/engines/agos/saveload.cpp
+++ b/engines/agos/saveload.cpp
@@ -1390,6 +1390,15 @@ bool AGOSEngine_Elvira2::loadGame(const char *filename, bool restartMode) {
_videoLockOut &= ~0x100;
+ // The floppy disk versions of Simon the Sorcerer 2 block changing
+ // to scrolling rooms, if the copy protection fails. But the copy
+ // protection flags are never set in the CD version.
+ // Setting this copy protection flag, allows saved games to be shared
+ // between all versions of Simon the Sorcerer 2.
+ if (getGameType() == GType_SIMON2) {
+ setBitFlag(135, 1);
+ }
+
return true;
}
diff --git a/engines/agos/sound.cpp b/engines/agos/sound.cpp
index 11a1cd792e..4917aefa4d 100644
--- a/engines/agos/sound.cpp
+++ b/engines/agos/sound.cpp
@@ -606,8 +606,6 @@ void Sound::playVoice(uint sound) {
_voice->playSound(sound, sound + 1, Audio::Mixer::kMusicSoundType, &_voiceHandle, true, -1500);
else
_voice->playSound(sound, sound, Audio::Mixer::kMusicSoundType, &_voiceHandle, true);
- } else if (_vm->getGameType() == GType_FF || _vm->getGameId() == GID_SIMON1CD32) {
- _voice->playSound(sound, Audio::Mixer::kSpeechSoundType, &_voiceHandle, false);
} else {
_voice->playSound(sound, Audio::Mixer::kSpeechSoundType, &_voiceHandle, false);
}
@@ -799,12 +797,12 @@ void Sound::switchVoiceFile(const GameSpecificSettings *gss, uint disc) {
Common::File *file = new Common::File();
if (!_hasVoiceFile) {
- sprintf(filename, "%s%d", gss->speech_filename, disc);
+ sprintf(filename, "%s%u", gss->speech_filename, disc);
_voice = makeCompressedSound(_mixer, file, filename);
_hasVoiceFile = (_voice != 0);
}
if (!_hasVoiceFile) {
- sprintf(filename, "%s%d.wav", gss->speech_filename, disc);
+ sprintf(filename, "%s%u.wav", gss->speech_filename, disc);
file->open(filename);
if (file->isOpen() == false) {
error("switchVoiceFile: Can't load voice file %s", filename);
diff --git a/engines/agos/subroutine.cpp b/engines/agos/subroutine.cpp
index 10c1c1aaf9..45cb370057 100644
--- a/engines/agos/subroutine.cpp
+++ b/engines/agos/subroutine.cpp
@@ -558,7 +558,6 @@ restart:
while ((byte *)sl != (byte *)sub) {
_currentLine = sl;
if (checkIfToRunSubroutineLine(sl, sub)) {
- result = 0;
_codePtr = (byte *)sl;
if (sub->id)
_codePtr += 2;
diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp
index 39bafc5e98..4b5034756c 100644
--- a/engines/cge/bitmap.cpp
+++ b/engines/cge/bitmap.cpp
@@ -136,7 +136,7 @@ Bitmap &Bitmap::operator=(const Bitmap &bmp) {
} else {
uint16 vsiz = (uint8 *)bmp._b - (uint8 *)v0;
uint16 siz = vsiz + _h * sizeof(HideDesc);
- uint8 *v1 = (uint8 *)malloc(sizeof(uint8) * siz);
+ uint8 *v1 = new uint8[siz];
assert(v1 != NULL);
memcpy(v1, v0, siz);
_b = (HideDesc *)((_v = v1) + vsiz);
@@ -154,20 +154,6 @@ char *Bitmap::forceExt(char *buf, const char *name, const char *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()");
diff --git a/engines/cge/bitmap.h b/engines/cge/bitmap.h
index aa6282705c..e7179f3b0b 100644
--- a/engines/cge/bitmap.h
+++ b/engines/cge/bitmap.h
@@ -77,7 +77,6 @@ public:
void show(int16 x, int16 y);
void xShow(int16 x, int16 y);
bool solidAt(int16 x, int16 y);
- uint16 moveVmap(uint8 *buf);
};
diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp
index 4ed2932cd9..34e7d3f2f9 100644
--- a/engines/cge/cge.cpp
+++ b/engines/cge/cge.cpp
@@ -53,9 +53,8 @@ CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription)
_oldLev = 0;
_pocPtr = 0;
_bitmapPalette = NULL;
-
-
-
+ _quitFlag = false;
+ _showBoundariesFl = false;
}
void CGEEngine::initSceneValues() {
@@ -91,7 +90,7 @@ void CGEEngine::init() {
_font = new Font(this, "CGE");
_text = new Text(this, "CGE");
_talk = NULL;
- _vga = new Vga();
+ _vga = new Vga(this);
_sys = new System(this);
_pocLight = new PocLight(this);
for (int i = 0; i < kPocketNX; i++)
@@ -144,7 +143,6 @@ void CGEEngine::deinit() {
DebugMan.clearAllDebugChannels();
delete _console;
- _midiPlayer->killMidi();
// Delete engine objects
delete _vga;
@@ -161,8 +159,9 @@ void CGEEngine::deinit() {
delete _keyboard;
delete _mouse;
delete _eventManager;
- delete _fx;
delete _sound;
+ delete _fx;
+ delete _midiPlayer;
delete _font;
delete _commandHandler;
delete _commandHandlerTurbo;
@@ -214,7 +213,8 @@ bool CGEEngine::canLoadGameStateCurrently() {
}
bool CGEEngine::canSaveGameStateCurrently() {
- return (_startupMode == 0) && _mouse->_active;
+ return (_startupMode == 0) && _mouse->_active &&
+ _commandHandler->idle() && !_hero->_flags._hide;
}
} // End of namespace CGE
diff --git a/engines/cge/cge.h b/engines/cge/cge.h
index 2ce154a4fb..d324b293fa 100644
--- a/engines/cge/cge.h
+++ b/engines/cge/cge.h
@@ -73,8 +73,9 @@ class Talk;
#define kPathMax 128
#define kCryptSeed 0xA5
#define kMaxFile 128
-#define kMapXCnt 40
-#define kMapZCnt 20
+#define kMapXCnt 40
+#define kMapZCnt 20
+#define kMapTop 80
// our engine debug channels
enum {
@@ -140,6 +141,8 @@ public:
virtual Common::Error saveGameState(int slot, const Common::String &desc);
static const int _maxSceneArr[5];
+ bool _quitFlag;
+ bool _showBoundariesFl;
const ADGameDescription *_gameDescription;
int _startupMode;
@@ -222,7 +225,7 @@ public:
void runGame();
bool showTitle(const char *name);
void movie(const char *ext);
- void inf(const char *text);
+ void inf(const char *text, bool wideSpace = false);
void selectSound();
void dummy() {}
void NONE();
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index 51cf3bb621..fd7dd85c57 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -185,7 +185,7 @@ void CGEEngine::syncHeader(Common::Serializer &s) {
s.syncAsUint16LE(checksum);
} else {
// Read checksum and validate it
- uint16 checksum;
+ uint16 checksum = 0;
s.syncAsUint16LE(checksum);
if (checksum != kSavegameCheckSum)
error("%s", _text->getText(kBadSVG));
@@ -200,7 +200,7 @@ bool CGEEngine::loadGame(int slotNumber, SavegameHeader *header, bool tiny) {
if (slotNumber == -1) {
// Loading the data for the initial game state
- kSavegame0File file = kSavegame0File(this, kSavegame0Name);
+ EncryptedStream file = EncryptedStream(this, kSavegame0Name);
int size = file.size();
byte *dataBuffer = (byte *)malloc(size);
file.read(dataBuffer, size);
@@ -277,7 +277,12 @@ Common::String CGEEngine::generateSaveName(int slot) {
Common::Error CGEEngine::loadGameState(int slot) {
// Clear current game activity
sceneDown();
+ _hero->park();
resetGame();
+
+ // If music is playing, kill it.
+ if (_music)
+ _midiPlayer->killMidi();
// Load the game
loadGame(slot, NULL);
@@ -291,10 +296,12 @@ Common::Error CGEEngine::loadGameState(int slot) {
void CGEEngine::resetGame() {
_vga->_spareQ->clear();
+ _commandHandler->reset();
}
Common::Error CGEEngine::saveGameState(int slot, const Common::String &desc) {
sceneDown();
+ _hero->park();
_oldLev = _lev;
// Write out the user's progress
@@ -685,6 +692,8 @@ void CGEEngine::xScene() {
debugC(6, kCGEDebugEngine, "CGEEngine::xScene()");
sceneDown();
+ if (_lev != -1)
+ _commandHandler->addCommand(kCmdLevel, -1, _lev, &_sceneLight);
sceneUp();
}
@@ -692,6 +701,7 @@ void CGEEngine::qGame() {
debugC(1, kCGEDebugEngine, "CGEEngine::qGame()");
sceneDown();
+ _hero->park();
_oldLev = _lev;
// Write out the user's progress
@@ -716,7 +726,7 @@ void CGEEngine::switchScene(int newScene) {
if (_hero) {
_hero->park();
_hero->step(0);
- _vga->_spareQ->_show = 0;
+ _vga->_spareQ->_show = false;
}
_sceneLight->gotoxy(kSceneX + ((_now - 1) % kSceneNx) * kSceneDx + kSceneSX,
kSceneY + ((_now - 1) / kSceneNx) * kSceneDy + kSceneSY);
@@ -725,6 +735,7 @@ void CGEEngine::switchScene(int newScene) {
keyClick();
_commandHandler->addCommand(kCmdLabel, -1, 0, NULL); // wait for repaint
_commandHandler->addCallback(kCmdExec, 0, 0, kXScene); // switch scene
+
}
}
@@ -753,27 +764,14 @@ 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;
+ if (x == Common::KEYCODE_ESCAPE) {
+ // The original was calling keyClick()
+ // The sound is uselessly annoying and noisy, so it has been removed
+ _vm->killText();
+ if (_vm->_startupMode == 1) {
+ _vm->_commandHandler->addCommand(kCmdClear, -1, 0, NULL);
+ return;
}
- break;
}
} else {
if (_vm->_startupMode)
@@ -830,7 +828,7 @@ void System::tick() {
if (_vm->_commandHandler->idle()) {
if (_vm->_flag[0]) // Pain flag
_vm->heroCover(9);
- else { // CHECKME: Before, was: if (Startup::_core >= CORE_MID) {
+ else {
int n = _vm->newRandom(100);
if (n > 96)
_vm->heroCover(6 + (_vm->_hero->_x + _vm->_hero->_w / 2 < kScrWidth / 2));
@@ -847,6 +845,9 @@ void System::tick() {
_time = kSystemRate;
}
+/**
+ * Switch greyscale mode on/off
+ */
void CGEEngine::switchColorMode() {
debugC(1, kCGEDebugEngine, "CGEEngine::switchColorMode()");
@@ -855,6 +856,9 @@ void CGEEngine::switchColorMode() {
_vga->setColors(_vga->_sysPal, 64);
}
+/**
+ * Switch music on/off
+ */
void CGEEngine::switchMusic() {
debugC(1, kCGEDebugEngine, "CGEEngine::switchMusic()");
@@ -867,6 +871,9 @@ void CGEEngine::switchMusic() {
_midiPlayer->killMidi();
}
+/**
+ * Shutdown game
+ */
void CGEEngine::startCountDown() {
debugC(1, kCGEDebugEngine, "CGEEngine::startCountDown()");
@@ -911,7 +918,7 @@ void CGEEngine::optionTouch(int opt, uint16 mask) {
if (mask & kMouseLeftUp)
switchMusic();
else if (mask & kMouseRightUp)
- warning("TODO: Use ScummVM sound dialog");
+ openMainMenuDialog();
break;
case 3:
if (mask & kMouseLeftUp)
@@ -1243,12 +1250,15 @@ void CGEEngine::mainLoop() {
// Handle any pending events
_eventManager->poll();
+
+ // Check shouldQuit()
+ _quitFlag = shouldQuit();
}
void CGEEngine::handleFrame() {
// Game frame delay
uint32 millis = g_system->getMillis();
- while (!_eventManager->_quitFlag && (millis < (_lastFrame + kGameFrameDelay))) {
+ while (!_quitFlag && (millis < (_lastFrame + kGameFrameDelay))) {
// Handle any pending events
_eventManager->poll();
@@ -1297,7 +1307,7 @@ void CGEEngine::loadUser() {
}
void CGEEngine::runGame() {
- if (_eventManager->_quitFlag)
+ if (_quitFlag)
return;
loadHeroXY();
@@ -1327,9 +1337,7 @@ void CGEEngine::runGame() {
_vga->_showQ->append(_mouse);
-// ___________
loadUser();
-// ~~~~~~~~~~~
if ((_sprite = _vga->_spareQ->locate(121)) != NULL)
_commandHandlerTurbo->addCommand(kCmdSeq, -1, _vga->_mono, _sprite);
@@ -1397,7 +1405,7 @@ void CGEEngine::runGame() {
_keyboard->setClient(_sys);
// main loop
- while (!_finis && !_eventManager->_quitFlag) {
+ while (!_finis && !_quitFlag) {
if (_flag[3])
_commandHandler->addCallback(kCmdExec, -1, 0, kQGame);
mainLoop();
@@ -1420,7 +1428,7 @@ void CGEEngine::runGame() {
void CGEEngine::movie(const char *ext) {
assert(ext);
- if (_eventManager->_quitFlag)
+ if (_quitFlag)
return;
char fn[12];
@@ -1432,7 +1440,7 @@ void CGEEngine::movie(const char *ext) {
feedSnail(_vga->_showQ->locate(999), kTake);
_vga->_showQ->append(_mouse);
_keyboard->setClient(_sys);
- while (!_commandHandler->idle() && !_eventManager->_quitFlag)
+ while (!_commandHandler->idle() && !_quitFlag)
mainLoop();
_keyboard->setClient(NULL);
@@ -1444,7 +1452,7 @@ void CGEEngine::movie(const char *ext) {
}
bool CGEEngine::showTitle(const char *name) {
- if (_eventManager->_quitFlag)
+ if (_quitFlag)
return false;
_bitmapPalette = _vga->_sysPal;
@@ -1477,7 +1485,7 @@ bool CGEEngine::showTitle(const char *name) {
_mouse->on();
for (; !_commandHandler->idle() || Vmenu::_addr;) {
mainLoop();
- if (_eventManager->_quitFlag)
+ if (_quitFlag)
return false;
}
diff --git a/engines/cge/cge_main.h b/engines/cge/cge_main.h
index bdb3121d63..87199ee524 100644
--- a/engines/cge/cge_main.h
+++ b/engines/cge/cge_main.h
@@ -56,10 +56,8 @@ namespace CGE {
#define kSystemRate 6 // 12 Hz
#define kHeroFun0 (40 * 12)
#define kHeroFun1 ( 2 * 12)
-#define kGetNamePrompt 50
-#define kGetNameTitle 51
+#define kShowScummVMVersion 15
#define kTSeq 96
-#define kNoMusic 98
#define kBadSVG 99
#define kSeqHTalk (kTSeq + 4)
#define kSeqTooFar (kTSeq + 5)
@@ -82,7 +80,6 @@ namespace CGE {
#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)
diff --git a/engines/cge/console.cpp b/engines/cge/console.cpp
index 71eedf34ea..105f241944 100644
--- a/engines/cge/console.cpp
+++ b/engines/cge/console.cpp
@@ -26,9 +26,23 @@
namespace CGE {
CGEConsole::CGEConsole(CGEEngine *vm) : GUI::Debugger(), _vm(vm) {
+ DCmd_Register("Boundaries", WRAP_METHOD(CGEConsole, Cmd_boundaries));
}
CGEConsole::~CGEConsole() {
}
+/**
+ * This command shows and hides boundaries
+ */
+bool CGEConsole::Cmd_boundaries(int argc, const char **argv) {
+ if (argc != 1) {
+ DebugPrintf("Usage: %s\n", argv[0]);
+ return true;
+ }
+
+ _vm->_showBoundariesFl = !_vm->_showBoundariesFl;
+ return false;
+}
+
} // End of namespace CGE
diff --git a/engines/cge/console.h b/engines/cge/console.h
index 25a1a4fae3..ea36dfbaae 100644
--- a/engines/cge/console.h
+++ b/engines/cge/console.h
@@ -36,6 +36,7 @@ public:
private:
CGEEngine *_vm;
+ bool Cmd_boundaries(int argc, const char **argv);
};
} // End of namespace CGE
diff --git a/engines/cge/detection.cpp b/engines/cge/detection.cpp
index 8b90bd1483..3fa3dbd7ff 100644
--- a/engines/cge/detection.cpp
+++ b/engines/cge/detection.cpp
@@ -35,8 +35,6 @@ static const PlainGameDescriptor CGEGames[] = {
namespace CGE {
-using Common::GUIO_NONE;
-
static const ADGameDescription gameDescriptions[] = {
{
@@ -46,7 +44,7 @@ static const ADGameDescription gameDescriptions[] = {
{"vol.dat", 0, "f9ae2e7f8f7cac91378cdafca43faf1e", 8437572},
AD_LISTEND
},
- Common::PL_POL, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO_NONE
+ Common::PL_POL, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO0()
},
{
"soltys", "Soltys Freeware",
@@ -55,17 +53,7 @@ static const ADGameDescription gameDescriptions[] = {
{"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
+ Common::PL_POL, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO0()
},
{
"soltys", "Soltys Demo (not supported)",
@@ -74,7 +62,7 @@ static const ADGameDescription gameDescriptions[] = {
{"vol.dat", 0, "75d385a6074c58b69f7730481f256051", 1796710},
AD_LISTEND
},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO , GUIO_NONE
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO , GUIO0()
},
{
"soltys", "Soltys Demo (not supported)",
@@ -83,7 +71,25 @@ static const ADGameDescription gameDescriptions[] = {
{"vol.dat", 0, "c5d9b15863cab61dc125551576dece04", 1075272},
AD_LISTEND
},
- Common::PL_POL, Common::kPlatformPC, ADGF_DEMO , GUIO_NONE
+ Common::PL_POL, Common::kPlatformPC, ADGF_DEMO , GUIO0()
+ },
+ {
+ "soltys", "Soltys Freeware v1.0",
+ {
+ {"vol.cat", 0, "f1675684c68ab90272f5776f8f2c3974", 50176},
+ {"vol.dat", 0, "4ffeff4abc99ac5999b55ccfc56ab1df", 8430868},
+ AD_LISTEND
+ },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_NO_FLAGS , GUIO0()
+ },
+ {
+ "soltys", "Soltys Freeware v1.0",
+ {
+ {"vol.cat", 0, "20fdce799adb618100ef9ee2362be875", 50176},
+ {"vol.dat", 0, "0e43331c846094d77f5dd201827e0a3b", 8439339},
+ AD_LISTEND
+ },
+ Common::PL_POL, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO0()
},
AD_TABLE_END_MARKER
};
diff --git a/engines/cge/events.cpp b/engines/cge/events.cpp
index cc22d9075a..7c98f00b7b 100644
--- a/engines/cge/events.cpp
+++ b/engines/cge/events.cpp
@@ -39,55 +39,8 @@ 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;
+ _keyAlt = false;
}
Keyboard::~Keyboard() {
@@ -98,22 +51,23 @@ Sprite *Keyboard::setClient(Sprite *spr) {
return spr;
}
-bool Keyboard::getKey(Common::Event &event, int &cgeCode) {
+bool Keyboard::getKey(Common::Event &event) {
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 ((keycode == Common::KEYCODE_LALT) || (keycode == Common::KEYCODE_RALT))
+ _keyAlt = true;
+ else
+ _keyAlt = false;
+
+ switch (keycode) {
+ case Common::KEYCODE_F1:
+ if (event.type == Common::EVENT_KEYUP)
+ return false;
+ // Display ScummVM version and translation strings
+ for (int i = 0; i < 5; i++)
+ _vm->_commandHandler->addCommand(kCmdInf, 1, kShowScummVMVersion + i, NULL);
+ return false;
+ case Common::KEYCODE_F5:
if (_vm->canSaveGameStateCurrently()) {
const EnginePlugin *plugin = NULL;
EngineMan.findGame(_vm->_gameDescription->gameid, &plugin);
@@ -123,10 +77,12 @@ bool Keyboard::getKey(Common::Event &event, int &cgeCode) {
int16 savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
Common::String savegameDescription = dialog->getResultString();
delete dialog;
- _vm->saveGameState(savegameId, savegameDescription);
- }
+
+ if (savegameId != -1)
+ _vm->saveGameState(savegameId, savegameDescription);
+ }
return false;
- } else if (keycode == Common::KEYCODE_F7) {
+ case Common::KEYCODE_F7:
if (_vm->canLoadGameStateCurrently()) {
const EnginePlugin *plugin = NULL;
EngineMan.findGame(_vm->_gameDescription->gameid, &plugin);
@@ -135,50 +91,53 @@ bool Keyboard::getKey(Common::Event &event, int &cgeCode) {
dialog->setSaveMode(false);
int16 savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
delete dialog;
- _vm->loadGameState(savegameId);
+
+ if (savegameId != -1)
+ _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;
+ case Common::KEYCODE_d:
+ if (event.kbd.flags & Common::KBD_CTRL) {
+ // Start the debugger
+ _vm->getDebugger()->attach();
+ _vm->getDebugger()->onFrame();
+ return false;
+ }
+ break;
+ case Common::KEYCODE_x:
+ if (event.kbd.flags & Common::KBD_ALT) {
+ _vm->quit();
+ return false;
+ }
+ break;
+ case Common::KEYCODE_0:
+ case Common::KEYCODE_1:
+ case Common::KEYCODE_2:
+ case Common::KEYCODE_3:
+ case Common::KEYCODE_4:
+ if (event.kbd.flags & Common::KBD_ALT) {
+ _vm->_commandHandler->addCommand(kCmdLevel, -1, keycode - '0', NULL);
+ return false;
}
+ default:
+ break;
}
- return false;
+ return true;
}
void Keyboard::newKeyboard(Common::Event &event) {
- int keycode;
- if (!getKey(event, keycode))
+ if (!getKey(event))
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
- }
+ if ((event.type == Common::EVENT_KEYDOWN) && (_client)) {
+ CGEEvent &evt = _vm->_eventManager->getNextEvent();
+ evt._x = event.kbd.keycode; // 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) {
@@ -272,7 +231,6 @@ void Mouse::newMouse(Common::Event &event) {
/*----------------- EventManager interface -----------------*/
EventManager::EventManager(CGEEngine *vm) : _vm(vm){
- _quitFlag = false;
_eventQueueHead = 0;
_eventQueueTail = 0;
memset(&_eventQueue, 0, kEventMax * sizeof(CGEEvent));
@@ -282,10 +240,6 @@ EventManager::EventManager(CGEEngine *vm) : _vm(vm){
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
diff --git a/engines/cge/events.h b/engines/cge/events.h
index a4cdfed793..6bbd52e4a5 100644
--- a/engines/cge/events.h
+++ b/engines/cge/events.h
@@ -37,8 +37,6 @@ namespace CGE {
/*----------------- KEYBOARD interface -----------------*/
-#define kKeyCtrl 29
-#define kKeyAlt 56
#define kEventMax 256
enum EventMask {
@@ -51,49 +49,15 @@ enum EventMask {
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;
+ bool getKey(Common::Event &event);
CGEEngine *_vm;
public:
- static const uint16 _code[0x60];
- static const uint16 _scummVmCodes[0x60];
-
Sprite *_client;
- bool _key[0x60];
+ bool _keyAlt;
void newKeyboard(Common::Event &event);
- uint16 lastKey();
Sprite *setClient(Sprite *spr);
Keyboard(CGEEngine *vm);
@@ -118,7 +82,6 @@ public:
bool _exist;
int _buttons;
Sprite *_busy;
- //Sprite *Touched;
Mouse(CGEEngine *vm);
~Mouse();
void on();
@@ -140,8 +103,6 @@ private:
void handleEvents();
public:
- bool _quitFlag;
-
EventManager(CGEEngine *vm);
void poll();
void clearEvent(Sprite *spr);
diff --git a/engines/cge/fileio.cpp b/engines/cge/fileio.cpp
index 6db0818287..c50db4e929 100644
--- a/engines/cge/fileio.cpp
+++ b/engines/cge/fileio.cpp
@@ -235,6 +235,7 @@ int32 EncryptedStream::pos() {
}
EncryptedStream::~EncryptedStream() {
+ delete _readStream;
}
} // End of namespace CGE
diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp
index 34adeb3a8e..c26f68fa7b 100644
--- a/engines/cge/snail.cpp
+++ b/engines/cge/snail.cpp
@@ -194,7 +194,7 @@ void CommandHandler::runCommand() {
break;
case kCmdInf:
if (_talkEnable) {
- _vm->inf(_vm->_text->getText(tailCmd->_val));
+ _vm->inf(_vm->_text->getText(tailCmd->_val), true);
_vm->_sys->_funDel = kHeroFun0;
}
break;
@@ -375,6 +375,10 @@ bool CommandHandler::idle() {
return (_head == _tail);
}
+void CommandHandler::reset() {
+ _tail = _head;
+}
+
/**
* Handles mini-Games logic
* @param com Command
@@ -406,7 +410,7 @@ void CGEEngine::snGame(Sprite *spr, int num) {
Stage++;
if (hand && Stage > kDressed)
++hand;
- if (i >= 0 || (dup[i] == spr && newRandom(3) == 0)) {
+ 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
@@ -443,7 +447,7 @@ void CGEEngine::snGame(Sprite *spr, int num) {
_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;
+ _game = false;
return;
} else {
_commandHandler->addCommand(kCmdSeq, -1, 2, dup[0]); // reset animation sequence
@@ -489,7 +493,7 @@ void CGEEngine::snGame(Sprite *spr, int num) {
_sprK2->step(newRandom(6));
_sprK3->step(newRandom(6));
- if (spr->_ref == 1 && _keyboard->_key[kKeyAlt]) {
+ if (spr->_ref == 1 && _keyboard->_keyAlt) {
_sprK1->step(5);
_sprK2->step(5);
_sprK3->step(5);
@@ -613,15 +617,23 @@ int CGEEngine::findPocket(Sprite *spr) {
return -1;
}
+/**
+ * Check if an item is in the inventory, and returns its position
+ * @param Inventory slot number Sprite pointer
+ */
void CGEEngine::selectPocket(int n) {
debugC(1, kCGEDebugEngine, "CGEEngine::selectPocket(%d)", n);
if (n < 0 || (_pocLight->_seqPtr && _pocPtr == n)) {
+ // If no slot specified, or another slot already selected
+ // stop the blinking animation
_pocLight->step(0);
n = findPocket(NULL);
if (n >= 0)
_pocPtr = n;
} else {
+ // If slot specified, check if the slot if used.
+ // Is so, start the blinking animation
if (_pocket[n] != NULL) {
_pocPtr = n;
_pocLight->step(1);
@@ -630,13 +642,18 @@ void CGEEngine::selectPocket(int n) {
_pocLight->gotoxy(kPocketX + _pocPtr * kPocketDX + kPocketSX, kPocketY + kPocketSY);
}
+/**
+ * Logic used when all the inventory slots are full and the user tries to pick
+ * another object.
+ * @param Inventory slot number Sprite pointer
+ */
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(kCmdSound, -1, 2, _hero); // Play the 'hum-hum" sound (fx00002)
_commandHandler->addCommand(kCmdWait, -1, -1, _hero);
_commandHandler->addCommand(kCmdSay, 1, kPocketFull, _hero);
}
@@ -989,7 +1006,6 @@ void CGEEngine::snSetZ(Sprite *spr, int z) {
if (spr) {
spr->_z = z;
- //SNPOST_(SNZTRIM, -1, 0, spr);
snZTrim(spr);
}
}
@@ -1085,6 +1101,11 @@ void CGEEngine::snKeep(Sprite *spr, int stp) {
selectPocket(-1);
}
+/**
+ * Remove an object from the inventory and (if specified) trigger an animation
+ * @param spr Inventory item
+ * @param stp Animation
+ */
void CGEEngine::snGive(Sprite *spr, int stp) {
debugC(1, kCGEDebugEngine, "CGEEngine::snGive(spr, %d)", stp);
@@ -1136,8 +1157,13 @@ void CGEEngine::snLevel(Sprite *spr, int lev) {
_maxScene = _maxSceneArr[_lev];
}
-void CGEEngine::snFlag(int indx, bool v) {
- _flag[indx] = v;
+/**
+ * Set a flag to a value
+ * @param indx Flag index
+ * @param val Flag value
+ */
+void CGEEngine::snFlag(int indx, bool val) {
+ _flag[indx] = val;
}
void CGEEngine::snSetRef(Sprite *spr, int nr) {
@@ -1180,12 +1206,22 @@ void CGEEngine::snLight(bool in) {
_dark = !in;
}
+/**
+ * Set an horizontal boundary
+ * @param scene Scene number
+ * @param barX Horizontal boundary value
+ */
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;
}
+/**
+ * Set a vertical boundary
+ * @param scene Scene number
+ * @param barY Vertical boundary value
+ */
void CGEEngine::snVBarrier(const int scene, const int barY) {
debugC(1, kCGEDebugEngine, "CGEEngine::snVBarrier(%d, %d)", scene, barY);
diff --git a/engines/cge/snail.h b/engines/cge/snail.h
index 3acbbd0e5f..6a9e717441 100644
--- a/engines/cge/snail.h
+++ b/engines/cge/snail.h
@@ -45,7 +45,7 @@ enum CommandType {
kCmdSetX, kCmdSetY, kCmdSetZ, kCmdTrans, kCmdPort,
kCmdNext, kCmdNNext, kCmdTNext, kCmdRNNext, kCmdRTNext,
kCmdRMNear, kCmdRmTake, kCmdFlag, kCmdSetRef, kCmdBackPt,
- kCmdFlash, kCmdLight, kCmdSetHBarrier, kCmdSetVBarrier, kCmdWalk,
+ kCmdFlash, kCmdLight, kCmdSetVBarrier, kCmdSetHBarrier, kCmdWalk,
kCmdReach, kCmdCover, kCmdUncover, kCmdClear, kCmdTalk,
kCmdMouse, kCmdSound, kCmdCount, kCmdExec, kCmdStep,
kCmdZTrim, kCmdGhost
@@ -70,6 +70,7 @@ public:
void addCallback(CommandType com, int ref, int val, CallbackType cbType);
void insertCommand(CommandType com, int ref, int val, void *ptr);
bool idle();
+ void reset();
private:
CGEEngine *_vm;
bool _turbo;
diff --git a/engines/cge/talk.cpp b/engines/cge/talk.cpp
index 467b39be40..f5d570b389 100644
--- a/engines/cge/talk.cpp
+++ b/engines/cge/talk.cpp
@@ -73,8 +73,8 @@ uint16 Font::width(const char *text) {
return w;
}
-Talk::Talk(CGEEngine *vm, const char *text, TextBoxStyle mode)
- : Sprite(vm, NULL), _mode(mode), _vm(vm) {
+Talk::Talk(CGEEngine *vm, const char *text, TextBoxStyle mode, bool wideSpace)
+ : Sprite(vm, NULL), _mode(mode), _wideSpace(wideSpace), _vm(vm) {
_ts = NULL;
_flags._syst = true;
update(text);
@@ -85,6 +85,7 @@ Talk::Talk(CGEEngine *vm)
: Sprite(vm, NULL), _mode(kTBPure), _vm(vm) {
_ts = NULL;
_flags._syst = true;
+ _wideSpace = false;
}
void Talk::update(const char *text) {
@@ -103,7 +104,9 @@ void Talk::update(const char *text) {
if (k > mw)
mw = k;
k = 2 * hmarg;
- } else
+ } else if ((*p == 0x20) && (_vm->_font->_widthArr[(unsigned char)*p] > 4) && (!_wideSpace))
+ k += _vm->_font->_widthArr[(unsigned char)*p] - 2;
+ else
k += _vm->_font->_widthArr[(unsigned char)*p];
}
if (k > mw)
@@ -122,7 +125,14 @@ void Talk::update(const char *text) {
} 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++) {
+
+ // Handle properly space size, after it was enlarged to display properly
+ // 'F1' text.
+ int8 fontStart = 0;
+ if ((*text == 0x20) && (cw > 4) && (!_wideSpace))
+ fontStart = 2;
+
+ for (int i = fontStart; i < cw; i++) {
uint8 *pp = m;
uint16 n;
uint16 b = *(f++);
@@ -182,55 +192,6 @@ Bitmap *Talk::box(uint16 w, uint16 h) {
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];
@@ -271,7 +232,13 @@ void InfoLine::update(const char *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++) {
+ // Handle properly space size, after it was enlarged to display properly
+ // 'F1' text.
+ int8 fontStart = 0;
+ if ((*text == 0x20) && (cw > 4) && (!_wideSpace))
+ fontStart = 2;
+
+ for (int i = fontStart; i < cw; i++) {
uint16 b = fp[i];
for (uint16 n = 0; n < kFontHigh; n++) {
if (b & 1)
diff --git a/engines/cge/talk.h b/engines/cge/talk.h
index 55c529b7ea..66e3d85214 100644
--- a/engines/cge/talk.h
+++ b/engines/cge/talk.h
@@ -52,12 +52,12 @@ protected:
TextBoxStyle _mode;
BitmapPtr *_ts;
Bitmap *box(uint16 w, uint16 h);
+ bool _wideSpace;
public:
- Talk(CGEEngine *vm, const char *text, TextBoxStyle mode);
+ Talk(CGEEngine *vm, const char *text, TextBoxStyle mode, bool wideSpace = false);
Talk(CGEEngine *vm);
virtual void update(const char *text);
- void putLine(int line, const char *text);
private:
CGEEngine *_vm;
};
diff --git a/engines/cge/text.cpp b/engines/cge/text.cpp
index 64f9959442..331dc8ac2d 100644
--- a/engines/cge/text.cpp
+++ b/engines/cge/text.cpp
@@ -38,7 +38,7 @@ 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);
+ error("No talk (%s)", _fileName);
int16 txtCount = count() + 1;
if (!txtCount)
error("Unable to read dialog file %s", _fileName);
@@ -135,6 +135,13 @@ char *Text::getText(int ref) {
void Text::say(const char *text, Sprite *spr) {
_vm->killText();
+
+ if (!text)
+ return;
+
+ if (*text == 0)
+ return;
+
_vm->_talk = new Talk(_vm, text, kTBRound);
if (!_vm->_talk)
return;
@@ -175,11 +182,16 @@ void Text::say(const char *text, Sprite *spr) {
_vm->_vga->_showQ->insert(speaker, _vm->_vga->_showQ->last());
}
-void CGEEngine::inf(const char *text) {
+void CGEEngine::inf(const char *text, bool wideSpace) {
debugC(1, kCGEDebugEngine, "CGEEngine::inf(%s)", text);
+ if (!text)
+ return;
+
+ if (*text == 0)
+ return;
killText();
- _talk = new Talk(this, text, kTBRect);
+ _talk = new Talk(this, text, kTBRect, wideSpace);
if (!_talk)
return;
diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp
index 49cfcd3084..186de24036 100644
--- a/engines/cge/vga13h.cpp
+++ b/engines/cge/vga13h.cpp
@@ -115,13 +115,6 @@ BitmapPtr *Sprite::setShapeList(BitmapPtr *shpP) {
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;
@@ -492,7 +485,7 @@ void Sprite::sync(Common::Serializer &s) {
_flags._near = flags & 0x0002 ? true : false;
_flags._drag = flags & 0x0004 ? true : false;
_flags._hold = flags & 0x0008 ? true : false;
- _flags._____ = flags & 0x0010 ? true : false;
+ _flags._dummy = flags & 0x0010 ? true : false;
_flags._slav = flags & 0x0020 ? true : false;
_flags._syst = flags & 0x0040 ? true : false;
_flags._kill = flags & 0x0080 ? true : false;
@@ -516,7 +509,7 @@ void Sprite::sync(Common::Serializer &s) {
flags = (flags << 1) | _flags._kill;
flags = (flags << 1) | _flags._syst;
flags = (flags << 1) | _flags._slav;
- flags = (flags << 1) | _flags._____;
+ flags = (flags << 1) | _flags._dummy;
flags = (flags << 1) | _flags._hold;
flags = (flags << 1) | _flags._drag;
flags = (flags << 1) | _flags._near;
@@ -632,7 +625,7 @@ Sprite *Queue::locate(int ref) {
return NULL;
}
-Vga::Vga() : _frmCnt(0), _msg(NULL), _name(NULL), _setPal(false), _mono(0) {
+Vga::Vga(CGEEngine *vm) : _frmCnt(0), _msg(NULL), _name(NULL), _setPal(false), _mono(0), _vm(vm) {
_oldColors = NULL;
_newColors = NULL;
_showQ = new Queue(true);
@@ -829,6 +822,17 @@ void Vga::update() {
updateColors();
_setPal = false;
}
+ if (_vm->_showBoundariesFl) {
+ Vga::_page[0]->hLine(0, 200 - kPanHeight, 320, 0xee);
+ if (_vm->_barriers[_vm->_now]._horz != 255) {
+ for (int i = 0; i < 8; i++)
+ Vga::_page[0]->vLine((_vm->_barriers[_vm->_now]._horz * 8) + i, 0, 200, 0xff);
+ }
+ if (_vm->_barriers[_vm->_now]._vert != 255) {
+ for (int i = 0; i < 4; i++)
+ Vga::_page[0]->hLine(0, 80 + (_vm->_barriers[_vm->_now]._vert * 4) + i, 320, 0xff);
+ }
+ }
g_system->copyRectToScreen((const byte *)Vga::_page[0]->getBasePtr(0, 0), kScrWidth, 0, 0, kScrWidth, kScrHeight);
g_system->updateScreen();
diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h
index 0c514c4a66..beca19f667 100644
--- a/engines/cge/vga13h.h
+++ b/engines/cge/vga13h.h
@@ -91,7 +91,7 @@ public:
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 _dummy : 1; // intrrupt driven animation
uint16 _slav : 1; // slave object
uint16 _syst : 1; // system object
uint16 _kill : 1; // dispose memory after remove
@@ -128,7 +128,6 @@ public:
virtual ~Sprite();
BitmapPtr shp();
BitmapPtr *setShapeList(BitmapPtr *shp);
- void moveShapes(uint8 *buf);
Sprite *expand();
Sprite *contract();
Sprite *backShow(bool fast = false);
@@ -178,6 +177,7 @@ public:
};
class Vga {
+ CGEEngine *_vm;
bool _setPal;
Dac *_oldColors;
Dac *_newColors;
@@ -197,7 +197,7 @@ public:
Graphics::Surface *_page[4];
Dac *_sysPal;
- Vga();
+ Vga(CGEEngine *vm);
~Vga();
uint8 *glass(Dac *pal, const uint8 colR, const uint8 colG, const uint8 colB);
diff --git a/engines/cge/walk.cpp b/engines/cge/walk.cpp
index 31ea1909d8..22c06a17c1 100644
--- a/engines/cge/walk.cpp
+++ b/engines/cge/walk.cpp
@@ -126,7 +126,10 @@ int Walk::distance(Sprite *spr) {
return dz - 1;
}
-
+/**
+ * Turn the character to a given direction
+ * @param d Direction
+ */
void Walk::turn(Dir d) {
Dir dir = (_dir == kDirNone) ? kDirSouth : _dir;
if (d != _dir) {
@@ -135,6 +138,9 @@ void Walk::turn(Dir d) {
}
}
+/**
+ * Stop the character and reset his direction
+ */
void Walk::park() {
if (_time == 0)
_time++;
diff --git a/engines/cge/walk.h b/engines/cge/walk.h
index 99dc362eec..00ec080416 100644
--- a/engines/cge/walk.h
+++ b/engines/cge/walk.h
@@ -35,7 +35,6 @@
namespace CGE {
#define kMapArrSize (kMapZCnt * kMapXCnt)
-#define kMapTop 80
#define kMapHig 80
#define kMapGridX (kScrWidth / kMapXCnt)
#define kMapGridZ (kMapHig / kMapZCnt)
diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp
index 6f34b0f860..6b94c33c31 100644
--- a/engines/cine/cine.cpp
+++ b/engines/cine/cine.cpp
@@ -141,11 +141,11 @@ void CineEngine::initialize() {
// Resize zone data table to its correct size and reset all its elements
g_cine->_zoneData.resize(NUM_MAX_ZONE);
- Common::set_to(g_cine->_zoneData.begin(), g_cine->_zoneData.end(), 0);
+ Common::fill(g_cine->_zoneData.begin(), g_cine->_zoneData.end(), 0);
// Resize zone query table to its correct size and reset all its elements
g_cine->_zoneQuery.resize(NUM_MAX_ZONE);
- Common::set_to(g_cine->_zoneQuery.begin(), g_cine->_zoneQuery.end(), 0);
+ Common::fill(g_cine->_zoneQuery.begin(), g_cine->_zoneQuery.end(), 0);
_timerDelayMultiplier = 12; // Set default speed
setupOpcodes();
diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp
index ba0251520b..ed656682ee 100644
--- a/engines/cine/detection.cpp
+++ b/engines/cine/detection.cpp
@@ -65,7 +65,7 @@ class CineMetaEngine : public AdvancedMetaEngine {
public:
CineMetaEngine() : AdvancedMetaEngine(Cine::gameDescriptions, sizeof(Cine::CINEGameDescription), cineGames) {
_singleid = "cine";
- _guioptions = Common::GUIO_NOSPEECH | Common::GUIO_NOMIDI;
+ _guioptions = GUIO1(GUIO_NOSPEECH);
}
virtual GameDescriptor findGame(const char *gameid) const {
diff --git a/engines/cine/detection_tables.h b/engines/cine/detection_tables.h
index 4b293deb62..0ec2768bae 100644
--- a/engines/cine/detection_tables.h
+++ b/engines/cine/detection_tables.h
@@ -22,8 +22,6 @@
namespace Cine {
-using Common::GUIO_NONE;
-
static const CINEGameDescription gameDescriptions[] = {
{
{
@@ -33,7 +31,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_FW,
0,
@@ -53,7 +51,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::EN_USA,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GType_FW,
GF_CD | GF_CRYPTED_BOOT_PRC,
@@ -68,7 +66,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_FW,
0,
@@ -82,7 +80,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_FW,
GF_ALT_FONT,
@@ -96,7 +94,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_FW,
GF_ALT_FONT,
@@ -110,7 +108,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_FW,
0,
@@ -124,7 +122,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOMIDI)
},
GType_FW,
0,
@@ -138,7 +136,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::EN_USA,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOMIDI)
},
GType_FW,
0,
@@ -152,7 +150,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOMIDI)
},
GType_FW,
GF_ALT_FONT,
@@ -166,7 +164,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOMIDI)
},
GType_FW,
0,
@@ -180,7 +178,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOMIDI)
},
GType_FW,
0,
@@ -194,7 +192,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOMIDI)
},
GType_FW,
0,
@@ -212,7 +210,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAmiga,
ADGF_DEMO,
- GUIO_NONE
+ GUIO1(GUIO_NOMIDI)
},
GType_FW,
0,
@@ -226,7 +224,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAtariST,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOMIDI)
},
GType_FW,
0,
@@ -240,7 +238,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformAtariST,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOMIDI)
},
GType_FW,
0,
@@ -254,7 +252,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::EN_GRB,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_OS,
0,
@@ -270,7 +268,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::EN_GRB,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_OS,
0,
@@ -284,7 +282,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::EN_USA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_OS,
0,
@@ -298,7 +296,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::EN_USA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_OS,
GF_CD,
@@ -312,7 +310,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_OS,
0,
@@ -326,7 +324,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_OS,
0,
@@ -344,7 +342,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_OS,
GF_CD,
@@ -358,7 +356,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_OS,
0,
@@ -372,7 +370,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_OS,
0,
@@ -386,7 +384,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::EN_GRB,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOMIDI)
},
GType_OS,
0,
@@ -400,7 +398,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::EN_GRB,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOMIDI)
},
GType_OS,
0,
@@ -414,7 +412,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::EN_USA,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOMIDI)
},
GType_OS,
0,
@@ -428,7 +426,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOMIDI)
},
GType_OS,
0,
@@ -442,7 +440,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOMIDI)
},
GType_OS,
0,
@@ -456,7 +454,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOMIDI)
},
GType_OS,
0,
@@ -470,7 +468,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::EN_GRB,
Common::kPlatformAmiga,
ADGF_DEMO,
- GUIO_NONE
+ GUIO1(GUIO_NOMIDI)
},
GType_OS,
GF_DEMO,
@@ -484,7 +482,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::EN_GRB,
Common::kPlatformAtariST,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOMIDI)
},
GType_OS,
0,
@@ -498,7 +496,7 @@ static const CINEGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformAtariST,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOMIDI)
},
GType_OS,
0,
diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp
index bb0545db72..971830ce8f 100644
--- a/engines/cine/main_loop.cpp
+++ b/engines/cine/main_loop.cpp
@@ -345,7 +345,7 @@ void CineEngine::mainLoop(int bootScriptIdx) {
// Clear the zoneQuery table (Operation Stealth specific)
if (g_cine->getGameType() == Cine::GType_OS) {
- Common::set_to(g_cine->_zoneQuery.begin(), g_cine->_zoneQuery.end(), 0);
+ Common::fill(g_cine->_zoneQuery.begin(), g_cine->_zoneQuery.end(), 0);
}
if (g_cine->getGameType() == Cine::GType_OS) {
diff --git a/engines/cine/saveload.cpp b/engines/cine/saveload.cpp
index 0ea1a23e8f..223099a587 100644
--- a/engines/cine/saveload.cpp
+++ b/engines/cine/saveload.cpp
@@ -1034,7 +1034,7 @@ void loadResourcesFromSave(Common::SeekableReadStream &fHandle, enum CineSaveGam
}
// Alright, the animation entry looks to be valid so let's start handling it...
- if (strcmp(currentPartName, name)) {
+ if (strcmp(currentPartName, name) != 0) {
closePart();
loadPart(name);
}
diff --git a/engines/cine/sound.cpp b/engines/cine/sound.cpp
index 0c3541fae7..0328466e76 100644
--- a/engines/cine/sound.cpp
+++ b/engines/cine/sound.cpp
@@ -25,12 +25,16 @@
#include "common/memstream.h"
#include "common/system.h"
#include "common/textconsole.h"
+#include "common/timer.h"
+#include "common/mutex.h"
+#include "common/config-manager.h"
#include "cine/cine.h"
#include "cine/sound.h"
#include "audio/audiostream.h"
#include "audio/fmopl.h"
+#include "audio/mididrv.h"
#include "audio/decoders/raw.h"
#include "audio/mods/soundfx.h"
@@ -48,14 +52,13 @@ public:
virtual void playSample(const byte *data, int size, int channel, int volume) = 0;
virtual void stopAll() = 0;
virtual const char *getInstrumentExtension() const { return ""; }
+ virtual void notifyInstrumentLoad(const byte *data, int size, int channel) {}
- void setUpdateCallback(UpdateCallback upCb, void *ref);
+ virtual void setUpdateCallback(UpdateCallback upCb, void *ref) = 0;
void resetChannel(int channel);
void findNote(int freq, int *note, int *oct) const;
protected:
- UpdateCallback _upCb;
- void *_upRef;
static const int _noteTable[];
static const int _noteTableCount;
@@ -104,6 +107,7 @@ public:
virtual ~AdLibSoundDriver();
// PCSoundDriver interface
+ virtual void setUpdateCallback(UpdateCallback upCb, void *ref);
virtual void setupChannel(int channel, const byte *data, int instrument, int volume);
virtual void stopChannel(int channel);
virtual void stopAll();
@@ -121,6 +125,9 @@ public:
virtual void loadInstrument(const byte *data, AdLibSoundInstrument *asi) = 0;
protected:
+ UpdateCallback _upCb;
+ void *_upRef;
+
FM_OPL *_opl;
int _sampleRate;
Audio::Mixer *_mixer;
@@ -177,6 +184,30 @@ public:
virtual void playSample(const byte *data, int size, int channel, int volume);
};
+// (Future Wars) MIDI driver
+class MidiSoundDriverH32 : public PCSoundDriver {
+public:
+ MidiSoundDriverH32(MidiDriver *output);
+ ~MidiSoundDriverH32();
+
+ virtual void setUpdateCallback(UpdateCallback upCb, void *ref);
+ virtual void setupChannel(int channel, const byte *data, int instrument, int volume);
+ virtual void setChannelFrequency(int channel, int frequency);
+ virtual void stopChannel(int channel);
+ virtual void playSample(const byte *data, int size, int channel, int volume);
+ virtual void stopAll() {}
+ virtual const char *getInstrumentExtension() const { return ".H32"; }
+ virtual void notifyInstrumentLoad(const byte *data, int size, int channel);
+
+private:
+ MidiDriver *_output;
+ UpdateCallback _callback;
+ Common::Mutex _mutex;
+
+ void writeInstrument(int offset, const byte *data, int size);
+ void selectInstrument(int channel, int unk, int instrument, int volume);
+};
+
class PCSoundFxPlayer {
public:
@@ -213,23 +244,35 @@ private:
byte *_sfxData;
byte *_instrumentsData[NUM_INSTRUMENTS];
PCSoundDriver *_driver;
+ Common::Mutex _mutex;
};
-void PCSoundDriver::setUpdateCallback(UpdateCallback upCb, void *ref) {
- _upCb = upCb;
- _upRef = ref;
-}
-
void PCSoundDriver::findNote(int freq, int *note, int *oct) const {
- *note = _noteTableCount - 1;
- for (int i = 0; i < _noteTableCount; ++i) {
- if (_noteTable[i] <= freq) {
+ if (freq > 0x777)
+ *oct = 0;
+ else if (freq > 0x3BB)
+ *oct = 1;
+ else if (freq > 0x1DD)
+ *oct = 2;
+ else if (freq > 0x0EE)
+ *oct = 3;
+ else if (freq > 0x077)
+ *oct = 4;
+ else if (freq > 0x03B)
+ *oct = 5;
+ else if (freq > 0x01D)
+ *oct = 6;
+ else
+ *oct = 7;
+
+ *note = 11;
+ for (int i = 0; i < 12; ++i) {
+ if (_noteTable[*oct * 12 + i] <= freq) {
*note = i;
break;
}
}
- *oct = *note / 12;
}
void PCSoundDriver::resetChannel(int channel) {
@@ -252,6 +295,11 @@ AdLibSoundDriver::~AdLibSoundDriver() {
OPLDestroy(_opl);
}
+void AdLibSoundDriver::setUpdateCallback(UpdateCallback upCb, void *ref) {
+ _upCb = upCb;
+ _upRef = ref;
+}
+
void AdLibSoundDriver::setupChannel(int channel, const byte *data, int instrument, int volume) {
assert(channel < 4);
if (data) {
@@ -441,12 +489,11 @@ void AdLibSoundDriverINS::setChannelFrequency(int channel, int frequency) {
if (ins->mode == 0 || ins->channel == 6) {
int freq, note, oct;
findNote(frequency, &note, &oct);
- if (channel == 6) {
- note %= 12;
- }
+ if (channel == 6)
+ oct = 0;
freq = _freqTable[note % 12];
OPLWriteReg(_opl, 0xA0 | channel, freq);
- freq = ((note / 12) << 2) | ((freq & 0x300) >> 8);
+ freq = (oct << 2) | ((freq & 0x300) >> 8);
if (ins->mode == 0) {
freq |= 0x20;
}
@@ -509,14 +556,16 @@ void AdLibSoundDriverADL::setChannelFrequency(int channel, int frequency) {
findNote(frequency, &note, &oct);
if (ins->amDepth) {
note = ins->amDepth;
+ oct = note / 12;
}
if (note < 0) {
note = 0;
+ oct = 0;
}
freq = _freqTable[note % 12];
OPLWriteReg(_opl, 0xA0 | channel, freq);
- freq = ((note / 12) << 2) | ((freq & 0x300) >> 8);
+ freq = (oct << 2) | ((freq & 0x300) >> 8);
if (ins->mode == 0) {
freq |= 0x20;
}
@@ -564,8 +613,147 @@ void AdLibSoundDriverADL::playSample(const byte *data, int size, int channel, in
}
}
+MidiSoundDriverH32::MidiSoundDriverH32(MidiDriver *output)
+ : _output(output), _callback(0), _mutex() {
+}
+
+MidiSoundDriverH32::~MidiSoundDriverH32() {
+ if (_callback)
+ g_system->getTimerManager()->removeTimerProc(_callback);
+
+ _output->close();
+ delete _output;
+}
+
+void MidiSoundDriverH32::setUpdateCallback(UpdateCallback upCb, void *ref) {
+ Common::StackLock lock(_mutex);
+
+ Common::TimerManager *timer = g_system->getTimerManager();
+ assert(timer);
+
+ if (_callback)
+ timer->removeTimerProc(_callback);
+
+ _callback = upCb;
+ if (_callback)
+ timer->installTimerProc(_callback, 1000000 / 50, ref, "MidiSoundDriverH32");
+}
+
+void MidiSoundDriverH32::setupChannel(int channel, const byte *data, int instrument, int volume) {
+ Common::StackLock lock(_mutex);
+
+ if (volume < 0 || volume > 100)
+ volume = 0;
+
+ if (!data)
+ selectInstrument(channel, 0, 0, volume);
+ else if (data[0] < 0x80)
+ selectInstrument(channel, data[0] / 0x40, data[0] % 0x40, volume);
+ else
+ selectInstrument(channel, 2, instrument, volume);
+}
+
+void MidiSoundDriverH32::setChannelFrequency(int channel, int frequency) {
+ Common::StackLock lock(_mutex);
+
+ int note, oct;
+ findNote(frequency, &note, &oct);
+ note %= 12;
+ note = oct * 12 + note + 12;
+
+ _output->send(0x91 + channel, note, 0x7F);
+}
+
+void MidiSoundDriverH32::stopChannel(int channel) {
+ Common::StackLock lock(_mutex);
+
+ _output->send(0xB1 + channel, 0x7B, 0x00);
+}
+
+void MidiSoundDriverH32::playSample(const byte *data, int size, int channel, int volume) {
+ Common::StackLock lock(_mutex);
+
+ stopChannel(channel);
+
+ volume = volume * 8 / 5;
+
+ if (data[0] < 0x80) {
+ selectInstrument(channel, data[0] / 0x40, data[0] % 0x40, volume);
+ } else {
+ writeInstrument(channel * 512 + 0x80000, data + 1, 256);
+ selectInstrument(channel, 2, channel, volume);
+ }
+
+ _output->send(0x91 + channel, 12, 0x7F);
+}
+
+void MidiSoundDriverH32::notifyInstrumentLoad(const byte *data, int size, int channel) {
+ Common::StackLock lock(_mutex);
+
+ if (data[0] < 0x80 || data[0] > 0xC0)
+ return;
+
+ writeInstrument(channel * 512 + 0x80000, data + 1, size - 1);
+}
+
+void MidiSoundDriverH32::writeInstrument(int offset, const byte *data, int size) {
+ byte sysEx[254];
+
+ sysEx[0] = 0x41;
+ sysEx[1] = 0x10;
+ sysEx[2] = 0x16;
+ sysEx[3] = 0x12;
+ sysEx[4] = (offset >> 16) & 0xFF;
+ sysEx[5] = (offset >> 8) & 0xFF;
+ sysEx[6] = (offset >> 0) & 0xFF;
+ int copySize = MIN(246, size);
+ memcpy(&sysEx[7], data, copySize);
+
+ byte checkSum = 0;
+ for (int i = 0; i < copySize + 3; ++i)
+ checkSum += sysEx[4 + i];
+ sysEx[7 + copySize] = 0x80 - (checkSum & 0x7F);
+
+ _output->sysEx(sysEx, copySize + 8);
+}
+
+void MidiSoundDriverH32::selectInstrument(int channel, int unk, int instrument, int volume) {
+ const int offset = channel * 16 + 0x30000;
+
+ byte sysEx[24] = {
+ 0x41, 0x10, 0x16, 0x12,
+ 0x00, 0x00, 0x00, // offset
+ 0x00, // unk
+ 0x00, // instrument
+ 0x18, 0x32, 0x0C, 0x03, 0x01, 0x00,
+ 0x00, // volume
+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00 // checksum
+ };
+
+
+ sysEx[4] = (offset >> 16) & 0xFF;
+ sysEx[5] = (offset >> 8) & 0xFF;
+ sysEx[6] = (offset >> 0) & 0xFF;
+
+ sysEx[7] = unk;
+
+ sysEx[8] = instrument;
+
+ sysEx[15] = volume;
+
+ byte checkSum = 0;
+
+ for (int i = 4; i < 23; ++i)
+ checkSum += sysEx[i];
+
+ sysEx[23] = 0x80 - (checkSum & 0x7F);
+
+ _output->sysEx(sysEx, 24);
+}
+
PCSoundFxPlayer::PCSoundFxPlayer(PCSoundDriver *driver)
- : _playing(false), _driver(driver) {
+ : _playing(false), _driver(driver), _mutex() {
memset(_instrumentsData, 0, sizeof(_instrumentsData));
_sfxData = NULL;
_fadeOutCounter = 0;
@@ -573,12 +761,15 @@ PCSoundFxPlayer::PCSoundFxPlayer(PCSoundDriver *driver)
}
PCSoundFxPlayer::~PCSoundFxPlayer() {
+ Common::StackLock lock(_mutex);
+
_driver->setUpdateCallback(NULL, NULL);
stop();
}
bool PCSoundFxPlayer::load(const char *song) {
debug(9, "PCSoundFxPlayer::load('%s')", song);
+ Common::StackLock lock(_mutex);
/* stop (w/ fade out) the previous song */
while (_fadeOutCounter != 0 && _fadeOutCounter < 100) {
@@ -602,15 +793,18 @@ bool PCSoundFxPlayer::load(const char *song) {
memcpy(instrument, _sfxData + 20 + i * 30, 12);
instrument[63] = '\0';
- if (strlen(instrument) != 0) {
+ if (instrument[0] != '\0') {
char *dot = strrchr(instrument, '.');
if (dot) {
*dot = '\0';
}
strcat(instrument, _driver->getInstrumentExtension());
- _instrumentsData[i] = readBundleSoundFile(instrument);
+ uint32 instrumentSize;
+ _instrumentsData[i] = readBundleSoundFile(instrument, &instrumentSize);
if (!_instrumentsData[i]) {
warning("Unable to load soundfx instrument '%s'", instrument);
+ } else {
+ _driver->notifyInstrumentLoad(_instrumentsData[i], instrumentSize, i);
}
}
}
@@ -619,6 +813,7 @@ bool PCSoundFxPlayer::load(const char *song) {
void PCSoundFxPlayer::play() {
debug(9, "PCSoundFxPlayer::play()");
+ Common::StackLock lock(_mutex);
if (_sfxData) {
for (int i = 0; i < NUM_CHANNELS; ++i) {
_instrumentsChannelTable[i] = -1;
@@ -633,6 +828,7 @@ void PCSoundFxPlayer::play() {
}
void PCSoundFxPlayer::stop() {
+ Common::StackLock lock(_mutex);
if (_playing || _fadeOutCounter != 0) {
_fadeOutCounter = 0;
_playing = false;
@@ -645,6 +841,7 @@ void PCSoundFxPlayer::stop() {
}
void PCSoundFxPlayer::fadeOut() {
+ Common::StackLock lock(_mutex);
if (_playing) {
_fadeOutCounter = 1;
_playing = false;
@@ -656,6 +853,7 @@ void PCSoundFxPlayer::updateCallback(void *ref) {
}
void PCSoundFxPlayer::update() {
+ Common::StackLock lock(_mutex);
if (_playing || (_fadeOutCounter != 0 && _fadeOutCounter < 100)) {
++_updateTicksCounter;
if (_updateTicksCounter > _eventsDelay) {
@@ -717,12 +915,33 @@ void PCSoundFxPlayer::unload() {
PCSound::PCSound(Audio::Mixer *mixer, CineEngine *vm)
- : Sound(mixer, vm) {
- if (_vm->getGameType() == GType_FW) {
- _soundDriver = new AdLibSoundDriverINS(_mixer);
- } else {
- _soundDriver = new AdLibSoundDriverADL(_mixer);
+ : Sound(mixer, vm), _soundDriver(0) {
+
+ const MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB);
+ const MusicType musicType = MidiDriver::getMusicType(dev);
+ if (musicType == MT_MT32 || musicType == MT_GM) {
+ const bool isMT32 = (musicType == MT_MT32 || ConfMan.getBool("native_mt32"));
+ if (isMT32) {
+ MidiDriver *driver = MidiDriver::createMidi(dev);
+ if (driver && driver->open() == 0) {
+ driver->sendMT32Reset();
+ _soundDriver = new MidiSoundDriverH32(driver);
+ } else {
+ warning("Could not create MIDI output, falling back to AdLib");
+ }
+ } else {
+ warning("General MIDI output devices are not supported, falling back to AdLib");
+ }
}
+
+ if (!_soundDriver) {
+ if (_vm->getGameType() == GType_FW) {
+ _soundDriver = new AdLibSoundDriverINS(_mixer);
+ } else {
+ _soundDriver = new AdLibSoundDriverADL(_mixer);
+ }
+ }
+
_player = new PCSoundFxPlayer(_soundDriver);
}
diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp
index 2f0c13740f..9b73ae1101 100644
--- a/engines/cine/various.cpp
+++ b/engines/cine/various.cpp
@@ -685,7 +685,6 @@ int16 makeMenuChoice(const CommandeType commandList[], uint16 height, uint16 X,
int16 paramY;
uint16 button;
int16 var_A;
- int16 di;
uint16 j;
int16 mouseX, mouseY;
int16 currentSelection, oldSelection;
@@ -721,8 +720,6 @@ int16 makeMenuChoice(const CommandeType commandList[], uint16 height, uint16 X,
currentSelection = 0;
- di = currentSelection * 9 + Y + 4;
-
menu->setSelection(currentSelection);
renderer->drawFrame();
@@ -772,8 +769,6 @@ int16 makeMenuChoice(const CommandeType commandList[], uint16 height, uint16 X,
hideMouse();
}
- di = currentSelection * 9 + Y + 4;
-
menu->setSelection(currentSelection);
renderer->drawFrame();
diff --git a/engines/composer/composer.cpp b/engines/composer/composer.cpp
index 085ce815dd..556dad7e94 100644
--- a/engines/composer/composer.cpp
+++ b/engines/composer/composer.cpp
@@ -32,6 +32,7 @@
#include "graphics/cursorman.h"
#include "graphics/surface.h"
#include "graphics/pixelformat.h"
+#include "graphics/wincursor.h"
#include "engines/util.h"
#include "engines/advancedDetector.h"
@@ -52,6 +53,11 @@ ComposerEngine::ComposerEngine(OSystem *syst, const ComposerGameDescription *gam
ComposerEngine::~ComposerEngine() {
DebugMan.clearAllDebugChannels();
+ stopPipes();
+ for (Common::List<OldScript *>::iterator i = _oldScripts.begin(); i != _oldScripts.end(); i++)
+ delete *i;
+ for (Common::List<Animation *>::iterator i = _anims.begin(); i != _anims.end(); i++)
+ delete *i;
for (Common::List<Library>::iterator i = _libraries.begin(); i != _libraries.end(); i++)
delete i->_archive;
for (Common::List<Sprite>::iterator i = _sprites.begin(); i != _sprites.end(); i++)
@@ -99,6 +105,11 @@ Common::Error ComposerEngine::run() {
_surface.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
_needsUpdate = true;
+ Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor();
+ CursorMan.replaceCursor(cursor->getSurface(), cursor->getWidth(), cursor->getHeight(), cursor->getHotspotX(),
+ cursor->getHotspotY(), cursor->getKeyColor());
+ CursorMan.replaceCursorPalette(cursor->getPalette(), cursor->getPaletteStartIndex(), cursor->getPaletteCount());
+
loadLibrary(0);
_currentTime = 0;
@@ -150,6 +161,7 @@ Common::Error ComposerEngine::run() {
redraw();
+ tickOldScripts();
processAnimFrame();
} else if (_needsUpdate) {
redraw();
@@ -213,11 +225,13 @@ void ComposerEngine::onMouseDown(const Common::Point &pos) {
if (!button)
return;
+ debug(3, "mouseDown on button id %d", button->_id);
+
// TODO: other buttons?
uint16 buttonsDown = 1; // MK_LBUTTON
uint16 spriteId = sprite ? sprite->_id : 0;
- runScript(button->_scriptId, button->_id, buttonsDown, spriteId);
+ runScript(button->_scriptId, (getGameType() == GType_ComposerV1) ? 0 : button->_id, buttonsDown, spriteId);
}
void ComposerEngine::onMouseMove(const Common::Point &pos) {
@@ -233,21 +247,48 @@ void ComposerEngine::onMouseMove(const Common::Point &pos) {
const Button *button = getButtonFor(sprite, pos);
if (_lastButton != button) {
if (_lastButton && _lastButton->_scriptIdRollOff)
- runScript(_lastButton->_scriptIdRollOff, _lastButton->_id, buttonsDown, 0);
+ runScript(_lastButton->_scriptIdRollOff, (getGameType() == GType_ComposerV1) ? 0 : _lastButton->_id, buttonsDown, 0);
_lastButton = button;
if (_lastButton && _lastButton->_scriptIdRollOn)
- runScript(_lastButton->_scriptIdRollOn, _lastButton->_id, buttonsDown, 0);
+ runScript(_lastButton->_scriptIdRollOn, (getGameType() == GType_ComposerV1) ? 0 : _lastButton->_id, buttonsDown, 0);
}
if (_mouseSpriteId) {
addSprite(_mouseSpriteId, 0, 0, _lastMousePos - _mouseOffset);
- _needsUpdate = true;
}
+ _needsUpdate = true;
}
void ComposerEngine::onKeyDown(uint16 keyCode) {
runEvent(kEventKeyDown, keyCode, 0, 0);
runEvent(kEventChar, keyCode, 0, 0);
+
+ for (Common::List<Library>::iterator i = _libraries.begin(); i != _libraries.end(); i++) {
+ for (Common::List<KeyboardHandler>::iterator j = i->_keyboardHandlers.begin(); j != i->_keyboardHandlers.end(); j++) {
+ const KeyboardHandler &handler = *j;
+ if (keyCode != handler.keyId)
+ continue;
+
+ int modifiers = g_system->getEventManager()->getModifierState();
+ switch (handler.modifierId) {
+ case 0x10: // shift
+ if (!(modifiers & Common::KBD_SHIFT))
+ continue;
+ break;
+ case 0x11: // control
+ if (!(modifiers & Common::KBD_CTRL))
+ continue;
+ break;
+ case 0:
+ break;
+ default:
+ warning("unknown keyb modifier %d", handler.modifierId);
+ continue;
+ }
+
+ runScript(handler.scriptId);
+ }
+ }
}
void ComposerEngine::setCursor(uint16 id, const Common::Point &offset) {
@@ -269,11 +310,15 @@ void ComposerEngine::setCursorVisible(bool visible) {
_mouseVisible = true;
if (_mouseSpriteId)
addSprite(_mouseSpriteId, 0, 0, _lastMousePos - _mouseOffset);
+ else
+ CursorMan.showMouse(true);
onMouseMove(_lastMousePos);
} else if (!visible && _mouseVisible) {
_mouseVisible = false;
if (_mouseSpriteId)
removeSprite(_mouseSpriteId, 0);
+ else
+ CursorMan.showMouse(false);
}
}
@@ -316,9 +361,42 @@ Common::String ComposerEngine::mangleFilename(Common::String filename) {
}
void ComposerEngine::loadLibrary(uint id) {
- if (!id)
- id = atoi(getStringFromConfig("Common", "StartUp").c_str());
- Common::String filename = getFilename("Libs", id);
+ if (getGameType() == GType_ComposerV1 && !_libraries.empty()) {
+ // kill the previous page, starting with any scripts running on it
+
+ for (Common::List<OldScript *>::iterator i = _oldScripts.begin(); i != _oldScripts.end(); i++)
+ delete *i;
+ _oldScripts.clear();
+
+ Library *library = &_libraries.front();
+ unloadLibrary(library->_id);
+ }
+
+ Common::String filename;
+
+ if (getGameType() == GType_ComposerV1) {
+ if (!id || _bookGroup.empty())
+ filename = getStringFromConfig("Common", "StartPage");
+ else
+ filename = getStringFromConfig(_bookGroup, Common::String::format("%d", id));
+ filename = mangleFilename(filename);
+
+ _bookGroup.clear();
+ for (uint i = 0; i < filename.size(); i++) {
+ if (filename[i] == '\\' || filename[i] == ':')
+ continue;
+ for (uint j = 0; j < filename.size(); j++) {
+ if (filename[j] == '.')
+ break;
+ _bookGroup += filename[j];
+ }
+ break;
+ }
+ } else {
+ if (!id)
+ id = atoi(getStringFromConfig("Common", "StartUp").c_str());
+ filename = getFilename("Libs", id);
+ }
Library library;
@@ -348,6 +426,37 @@ void ComposerEngine::loadLibrary(uint id) {
newLib._buttons.push_back(button);
}
+ Common::Array<uint16> ambientResources = library._archive->getResourceIDList(ID_AMBI);
+ for (uint i = 0; i < ambientResources.size(); i++) {
+ Common::SeekableReadStream *stream = library._archive->getResource(ID_AMBI, ambientResources[i]);
+ Button button(stream);
+ newLib._buttons.insert(newLib._buttons.begin(), button);
+ }
+
+ Common::Array<uint16> accelResources = library._archive->getResourceIDList(ID_ACEL);
+ for (uint i = 0; i < accelResources.size(); i++) {
+ Common::SeekableReadStream *stream = library._archive->getResource(ID_ACEL, accelResources[i]);
+ KeyboardHandler handler;
+ handler.keyId = stream->readUint16LE();
+ handler.modifierId = stream->readUint16LE();
+ handler.scriptId = stream->readUint16LE();
+ newLib._keyboardHandlers.push_back(handler);
+ }
+
+ Common::Array<uint16> randResources = library._archive->getResourceIDList(ID_RAND);
+ for (uint i = 0; i < randResources.size(); i++) {
+ Common::SeekableReadStream *stream = library._archive->getResource(ID_RAND, randResources[i]);
+ Common::Array<RandomEvent> &events = _randomEvents[randResources[i]];
+ uint16 count = stream->readUint16LE();
+ for (uint j = 0; j < count; j++) {
+ RandomEvent random;
+ random.scriptId = stream->readUint16LE();
+ random.weight = stream->readUint16LE();
+ events.push_back(random);
+ }
+ delete stream;
+ }
+
// add background sprite, if it exists
if (hasResource(ID_BMAP, 1000))
setBackground(1000);
@@ -373,10 +482,9 @@ void ComposerEngine::unloadLibrary(uint id) {
delete *j;
}
_anims.clear();
- for (Common::List<Pipe *>::iterator j = _pipes.begin(); j != _pipes.end(); j++) {
- delete *j;
- }
- _pipes.clear();
+ stopPipes();
+
+ _randomEvents.clear();
for (Common::List<Sprite>::iterator j = _sprites.begin(); j != _sprites.end(); j++) {
j->_surface.free();
@@ -426,13 +534,14 @@ Button::Button(Common::SeekableReadStream *stream, uint16 id, uint gameType) {
_type = stream->readUint16LE();
_active = (_type & 0x8000) ? true : false;
+ bool hasRollover = (gameType == GType_ComposerV1) && (_type & 0x4000);
_type &= 0xfff;
debug(9, "button %d: type %d, active %d", id, _type, _active);
- uint16 flags = 0;
uint16 size = 4;
if (gameType == GType_ComposerV1) {
- flags = stream->readUint16LE();
+ stream->skip(2);
+
_zorder = 0;
_scriptId = stream->readUint16LE();
_scriptIdRollOn = 0;
@@ -469,7 +578,7 @@ Button::Button(Common::SeekableReadStream *stream, uint16 id, uint gameType) {
error("unknown button type %d", _type);
}
- if (flags & 0x40) {
+ if (hasRollover) {
_scriptIdRollOn = stream->readUint16LE();
_scriptIdRollOff = stream->readUint16LE();
}
@@ -477,6 +586,26 @@ Button::Button(Common::SeekableReadStream *stream, uint16 id, uint gameType) {
delete stream;
}
+// AMBI-style button
+Button::Button(Common::SeekableReadStream *stream) {
+ _id = 0;
+ _zorder = 0;
+ _active = true;
+ _type = kButtonSprites;
+ _scriptIdRollOn = 0;
+ _scriptIdRollOff = 0;
+
+ _scriptId = stream->readUint16LE();
+
+ uint16 count = stream->readUint16LE();
+ for (uint j = 0; j < count; j++) {
+ uint16 spriteId = stream->readUint16LE();
+ _spriteIds.push_back(spriteId);
+ }
+
+ delete stream;
+}
+
bool Button::contains(const Common::Point &pos) const {
switch (_type) {
case kButtonRect:
@@ -524,4 +653,16 @@ const Button *ComposerEngine::getButtonFor(const Sprite *sprite, const Common::P
return NULL;
}
+void ComposerEngine::setButtonActive(uint16 id, bool active) {
+ for (Common::List<Library>::iterator l = _libraries.begin(); l != _libraries.end(); l++) {
+ for (Common::List<Button>::iterator i = l->_buttons.begin(); i != l->_buttons.end(); i++) {
+ if (i->_id != id)
+ continue;
+ i->_active = active;
+ }
+ }
+
+ onMouseMove(_lastMousePos);
+}
+
} // End of namespace Composer
diff --git a/engines/composer/composer.h b/engines/composer/composer.h
index 03e895b59e..0f53258289 100644
--- a/engines/composer/composer.h
+++ b/engines/composer/composer.h
@@ -69,6 +69,7 @@ class Button {
public:
Button() { }
Button(Common::SeekableReadStream *stream, uint16 id, uint gameType);
+ Button(Common::SeekableReadStream *stream);
bool contains(const Common::Point &pos) const;
@@ -94,11 +95,23 @@ enum {
kEventKeyUp = 7
};
+struct KeyboardHandler {
+ uint16 keyId;
+ uint16 modifierId;
+ uint16 scriptId;
+};
+
+struct RandomEvent {
+ uint16 weight;
+ uint16 scriptId;
+};
+
struct Library {
uint _id;
Archive *_archive;
Common::List<Button> _buttons;
+ Common::List<KeyboardHandler> _keyboardHandlers;
};
struct QueuedScript {
@@ -116,6 +129,19 @@ struct PendingPageChange {
bool _remove;
};
+struct OldScript {
+ OldScript(uint16 id, Common::SeekableReadStream *stream);
+ ~OldScript();
+
+ uint16 _id;
+
+ uint32 _size;
+ Common::SeekableReadStream *_stream;
+
+ uint16 _zorder;
+ uint32 _currDelay;
+};
+
class ComposerEngine : public Engine {
protected:
Common::Error run();
@@ -149,15 +175,20 @@ private:
uint _directoriesToStrip;
Common::ConfigFile _bookIni;
+ Common::String _bookGroup;
Common::List<Library> _libraries;
Common::Array<PendingPageChange> _pendingPageChanges;
Common::Array<uint16> _stack;
Common::Array<uint16> _vars;
+ Common::List<OldScript *> _oldScripts;
Common::Array<QueuedScript> _queuedScripts;
Common::List<Animation *> _anims;
Common::List<Pipe *> _pipes;
+ Common::Array<Common::SeekableReadStream *> _pipeStreams;
+
+ Common::HashMap<uint16, Common::Array<RandomEvent> > _randomEvents;
void onMouseDown(const Common::Point &pos);
void onMouseMove(const Common::Point &pos);
@@ -188,17 +219,25 @@ private:
void setArg(uint16 arg, uint16 type, uint16 val);
void runScript(uint16 id);
int16 scriptFuncCall(uint16 id, int16 param1, int16 param2, int16 param3);
+ void runOldScript(uint16 id, uint16 wait);
+ void stopOldScript(uint16 id);
+ void tickOldScripts();
+ bool tickOldScript(OldScript *script);
void playAnimation(uint16 animId, int16 param1, int16 param2, int16 param3);
void stopAnimation(Animation *anim, bool localOnly = false, bool pipesOnly = false);
void playWaveForAnim(uint16 id, uint16 priority, bool bufferingOnly);
void processAnimFrame();
+ void playPipe(uint16 id);
+ void stopPipes();
+
bool spriteVisible(uint16 id, uint16 animId);
Sprite *addSprite(uint16 id, uint16 animId, uint16 zorder, const Common::Point &pos);
void removeSprite(uint16 id, uint16 animId);
const Sprite *getSpriteAtPos(const Common::Point &pos);
const Button *getButtonFor(const Sprite *sprite, const Common::Point &pos);
+ void setButtonActive(uint16 id, bool active);
void dirtySprite(const Sprite &sprite);
void redraw();
diff --git a/engines/composer/detection.cpp b/engines/composer/detection.cpp
index 2ca00f9f53..af355402c2 100644
--- a/engines/composer/detection.cpp
+++ b/engines/composer/detection.cpp
@@ -63,8 +63,6 @@ static const PlainGameDescriptor composerGames[] = {
namespace Composer {
-using Common::GUIO_NONE;
-
static const ComposerGameDescription gameDescriptions[] = {
// from Liam Finds a Story CD
{
@@ -75,7 +73,7 @@ static const ComposerGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_USEEXTRAASTITLE | ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_ComposerV1
},
@@ -88,7 +86,7 @@ static const ComposerGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_ComposerV2
},
@@ -102,7 +100,7 @@ static const ComposerGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_USEEXTRAASTITLE | ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_ComposerV2
},
@@ -119,7 +117,7 @@ static const ComposerGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_ComposerV2
},
@@ -132,7 +130,7 @@ static const ComposerGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_ComposerV2
},
@@ -145,7 +143,7 @@ static const ComposerGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_ComposerV2
},
@@ -162,7 +160,7 @@ static const ComposerGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_ComposerV2
},
@@ -175,7 +173,7 @@ static const ComposerGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_ComposerV2
},
@@ -188,7 +186,7 @@ static const ComposerGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_ComposerV2
},
@@ -205,7 +203,7 @@ static const ComposerGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_ComposerV2
},
@@ -222,7 +220,7 @@ static const ComposerGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_ComposerV2
},
diff --git a/engines/composer/graphics.cpp b/engines/composer/graphics.cpp
index f253d85ad7..1314e903ae 100644
--- a/engines/composer/graphics.cpp
+++ b/engines/composer/graphics.cpp
@@ -123,8 +123,10 @@ void ComposerEngine::playAnimation(uint16 animId, int16 x, int16 y, int16 eventP
// If the resource is a pipe itself, then load the pipe
// and then fish the requested animation out of it.
if (type != 1) {
+ _pipeStreams.push_back(stream);
newPipe = new Pipe(stream);
_pipes.push_front(newPipe);
+ newPipe->nextFrame();
stream = newPipe->getResource(ID_ANIM, animId, false);
}
}
@@ -187,8 +189,10 @@ void ComposerEngine::playWaveForAnim(uint16 id, uint16 priority, bool bufferingO
}
}
Common::SeekableReadStream *stream = NULL;
+ bool fromPipe = true;
if (!bufferingOnly && hasResource(ID_WAVE, id)) {
stream = getResource(ID_WAVE, id);
+ fromPipe = false;
} else {
for (Common::List<Pipe *>::iterator k = _pipes.begin(); k != _pipes.end(); k++) {
Pipe *pipe = *k;
@@ -200,12 +204,18 @@ void ComposerEngine::playWaveForAnim(uint16 id, uint16 priority, bool bufferingO
}
if (!stream)
return;
- // FIXME: non-pipe buffers have fixed wav header (data at +44, size at +40)
- byte *buffer = (byte *)malloc(stream->size());
- stream->read(buffer, stream->size());
+
+ uint32 size = stream->size();
+ if (!fromPipe) {
+ // non-pipe buffers have fixed wav header (data at +44, size at +40)
+ stream->skip(40);
+ size = stream->readUint32LE();
+ }
+ byte *buffer = (byte *)malloc(size);
+ stream->read(buffer, size);
if (!_audioStream)
_audioStream = Audio::makeQueuingAudioStream(22050, false);
- _audioStream->queueBuffer(buffer, stream->size(), DisposeAfterUse::YES, Audio::FLAG_UNSIGNED);
+ _audioStream->queueBuffer(buffer, size, DisposeAfterUse::YES, Audio::FLAG_UNSIGNED);
_currSoundPriority = priority;
delete stream;
if (!_mixer->isSoundHandleActive(_soundHandle))
@@ -351,9 +361,50 @@ void ComposerEngine::processAnimFrame() {
for (Common::List<Pipe *>::iterator j = _pipes.begin(); j != _pipes.end(); j++) {
Pipe *pipe = *j;
pipe->nextFrame();
+
+ // V1 pipe audio; see OldPipe
+ if (pipe->hasResource(ID_WAVE, 0xffff))
+ playWaveForAnim(0xffff, 0, false);
}
}
+void ComposerEngine::playPipe(uint16 id) {
+ stopPipes();
+
+ if (!hasResource(ID_PIPE, id)) {
+ error("couldn't find pipe %d", id);
+ }
+
+ Common::SeekableReadStream *stream = getResource(ID_PIPE, id);
+ OldPipe *pipe = new OldPipe(stream);
+ _pipes.push_front(pipe);
+ //pipe->nextFrame();
+
+ const Common::Array<uint16> *scripts = pipe->getScripts();
+ if (scripts && !scripts->empty())
+ runScript((*scripts)[0], 1, 0, 0);
+}
+
+void ComposerEngine::stopPipes() {
+ for (Common::List<Pipe *>::iterator j = _pipes.begin(); j != _pipes.end(); j++) {
+ const Common::Array<uint16> *scripts = (*j)->getScripts();
+ if (scripts) {
+ for (uint i = 0; i < scripts->size(); i++) {
+ removeSprite((*scripts)[i], 0);
+ stopOldScript((*scripts)[i]);
+ }
+ }
+ delete *j;
+ }
+
+ _pipes.clear();
+
+ // substreams may need to remain valid until the end of a page
+ for (uint i = 0; i < _pipeStreams.size(); i++)
+ delete _pipeStreams[i];
+ _pipeStreams.clear();
+}
+
bool ComposerEngine::spriteVisible(uint16 id, uint16 animId) {
for (Common::List<Sprite>::iterator i = _sprites.begin(); i != _sprites.end(); i++) {
if (i->_id != id)
@@ -375,7 +426,10 @@ Sprite *ComposerEngine::addSprite(uint16 id, uint16 animId, uint16 zorder, const
for (Common::List<Sprite>::iterator i = _sprites.begin(); i != _sprites.end(); i++) {
if (i->_id != id)
continue;
- if (i->_animId && animId && (i->_animId != animId))
+ if (getGameType() == GType_ComposerV1) {
+ if (i->_animId != animId)
+ continue;
+ } else if (i->_animId && animId && (i->_animId != animId))
continue;
dirtySprite(*i);
@@ -425,7 +479,10 @@ void ComposerEngine::removeSprite(uint16 id, uint16 animId) {
for (Common::List<Sprite>::iterator i = _sprites.begin(); i != _sprites.end(); i++) {
if (!i->_id || (id && i->_id != id))
continue;
- if (i->_animId && animId && (i->_animId != animId))
+ if (getGameType() == GType_ComposerV1) {
+ if (i->_animId != animId)
+ continue;
+ } else if (i->_animId && animId && (i->_animId != animId))
continue;
dirtySprite(*i);
i->_surface.free();
@@ -499,8 +556,8 @@ void ComposerEngine::loadCTBL(uint16 id, uint fadePercent) {
uint16 numEntries = stream->readUint16LE();
debug(1, "CTBL: %d entries", numEntries);
- assert(numEntries <= 256);
- assert(stream->size() == 2 + (numEntries * 3));
+ if ((numEntries > 256) || (stream->size() < 2 + (numEntries * 3)))
+ error("CTBL %d was invalid (%d entries, size %d)", id, numEntries, stream->size());
byte buffer[256 * 3];
stream->read(buffer, numEntries * 3);
diff --git a/engines/composer/resource.cpp b/engines/composer/resource.cpp
index b40bdb379b..a4e292747c 100644
--- a/engines/composer/resource.cpp
+++ b/engines/composer/resource.cpp
@@ -252,8 +252,9 @@ Pipe::Pipe(Common::SeekableReadStream *stream) {
_offset = 0;
_stream = stream;
_anim = NULL;
+}
- nextFrame();
+Pipe::~Pipe() {
}
void Pipe::nextFrame() {
@@ -334,4 +335,69 @@ Common::SeekableReadStream *Pipe::getResource(uint32 tag, uint16 id, bool buffer
return new Common::MemoryReadStream(buffer, size, DisposeAfterUse::YES);
}
+OldPipe::OldPipe(Common::SeekableReadStream *stream) : Pipe(stream), _currFrame(0) {
+ uint32 tag = _stream->readUint32BE();
+ if (tag != ID_PIPE)
+ error("invalid tag for pipe (%08x)", tag);
+
+ _numFrames = _stream->readUint32LE();
+ uint16 scriptCount = _stream->readUint16LE();
+ _scripts.reserve(scriptCount);
+ for (uint i = 0; i < scriptCount; i++)
+ _scripts.push_back(_stream->readUint16LE());
+
+ _offset = _stream->pos();
+}
+
+void OldPipe::nextFrame() {
+ if (_currFrame >= _numFrames)
+ return;
+
+ _stream->seek(_offset, SEEK_SET);
+
+ uint32 tag = _stream->readUint32BE();
+ if (tag != ID_FRME)
+ error("invalid tag for pipe (%08x)", tag);
+
+ uint16 spriteCount = _stream->readUint16LE();
+ uint32 spriteSize = _stream->readUint32LE();
+ uint32 audioSize = _stream->readUint32LE();
+
+ Common::Array<uint16> spriteIds;
+ Common::Array<PipeResourceEntry> spriteEntries;
+ for (uint i = 0; i < spriteCount; i++) {
+ spriteIds.push_back(_stream->readUint16LE());
+ PipeResourceEntry entry;
+ entry.size = _stream->readUint32LE();
+ entry.offset = _stream->readUint32LE();
+ spriteEntries.push_back(entry);
+ }
+
+ uint32 spriteDataOffset = _stream->pos();
+ _stream->skip(spriteSize);
+
+ ResourceMap &spriteResMap = _types[ID_BMAP];
+ spriteResMap.clear();
+ for (uint i = 0; i < spriteIds.size(); i++) {
+ PipeResourceEntry &entry = spriteEntries[i];
+ entry.offset += spriteDataOffset;
+ spriteResMap[spriteIds[i]].entries.push_back(entry);
+ }
+
+ ResourceMap &audioResMap = _types[ID_WAVE];
+ audioResMap.clear();
+
+ if (audioSize > 0) {
+ PipeResourceEntry entry;
+ entry.size = audioSize;
+ entry.offset = _stream->pos();
+ // we use 0xffff for per-frame pipe audio
+ audioResMap[0xffff].entries.push_back(entry);
+ _stream->skip(audioSize);
+ }
+
+ _offset = _stream->pos();
+ _currFrame++;
+}
+
} // End of namespace Composer
diff --git a/engines/composer/resource.h b/engines/composer/resource.h
index 9408cdffb8..e0052cd868 100644
--- a/engines/composer/resource.h
+++ b/engines/composer/resource.h
@@ -35,16 +35,21 @@ struct Animation;
#define ID_LBRC MKTAG('L','B','R','C') // Main FourCC
+#define ID_ACEL MKTAG('A','C','E','L') // Keyboard Accelerator (v1)
+#define ID_AMBI MKTAG('A','M','B','I') // Ambient (v1 sprite button)
#define ID_ANIM MKTAG('A','N','I','M') // Animation
#define ID_BMAP MKTAG('B','M','A','P') // Bitmap
#define ID_BUTN MKTAG('B','U','T','N') // Button
#define ID_CTBL MKTAG('C','T','B','L') // Color Table
#define ID_EVNT MKTAG('E','V','N','T') // Event
#define ID_PIPE MKTAG('P','I','P','E') // Pipe
+#define ID_RAND MKTAG('R','A','N','D') // Random Object
#define ID_SCRP MKTAG('S','C','R','P') // Script
#define ID_VARI MKTAG('V','A','R','I') // Variables
#define ID_WAVE MKTAG('W','A','V','E') // Wave
+#define ID_FRME MKTAG('F','R','M','E') // Frame
+
class Archive {
public:
Archive();
@@ -102,13 +107,16 @@ struct PipeResource {
class Pipe {
public:
Pipe(Common::SeekableReadStream *stream);
- void nextFrame();
+ virtual ~Pipe();
+ virtual void nextFrame();
Animation *_anim;
bool hasResource(uint32 tag, uint16 id) const;
Common::SeekableReadStream *getResource(uint32 tag, uint16 id, bool buffering);
+ virtual const Common::Array<uint16> *getScripts() { return NULL; }
+
protected:
Common::SeekableReadStream *_stream;
@@ -119,6 +127,18 @@ protected:
uint32 _offset;
};
+class OldPipe : public Pipe {
+public:
+ OldPipe(Common::SeekableReadStream *stream);
+ void nextFrame();
+
+ const Common::Array<uint16> *getScripts() { return &_scripts; }
+
+protected:
+ uint32 _currFrame, _numFrames;
+ Common::Array<uint16> _scripts;
+};
+
} // End of namespace Composer
#endif
diff --git a/engines/composer/scripting.cpp b/engines/composer/scripting.cpp
index 1989919233..3a201c841a 100644
--- a/engines/composer/scripting.cpp
+++ b/engines/composer/scripting.cpp
@@ -122,6 +122,11 @@ void ComposerEngine::runEvent(uint16 id, int16 param1, int16 param2, int16 param
}
int16 ComposerEngine::runScript(uint16 id, int16 param1, int16 param2, int16 param3) {
+ if (getGameType() == GType_ComposerV1) {
+ runOldScript(id, param1);
+ return 0;
+ }
+
_vars[1] = param1;
_vars[2] = param2;
_vars[3] = param3;
@@ -155,10 +160,14 @@ void ComposerEngine::setArg(uint16 arg, uint16 type, uint16 val) {
default:
error("invalid argument type %d (setting arg %d)", type, arg);
}
-
}
void ComposerEngine::runScript(uint16 id) {
+ if (getGameType() == GType_ComposerV1) {
+ runOldScript(id, 0);
+ return;
+ }
+
if (!hasResource(ID_SCRP, id)) {
debug(1, "ignoring attempt to run script %d, because it doesn't exist", id);
return;
@@ -561,25 +570,11 @@ int16 ComposerEngine::scriptFuncCall(uint16 id, int16 param1, int16 param2, int1
return 0;
case kFuncActivateButton:
debug(3, "kFuncActivateButton(%d)", param1);
- for (Common::List<Library>::iterator l = _libraries.begin(); l != _libraries.end(); l++) {
- for (Common::List<Button>::iterator i = l->_buttons.begin(); i != l->_buttons.end(); i++) {
- if (i->_id != param1)
- continue;
- i->_active = true;
- }
- }
- onMouseMove(_lastMousePos);
+ setButtonActive(param1, true);
return 1;
case kFuncDeactivateButton:
debug(3, "kFuncDeactivateButton(%d)", param1);
- for (Common::List<Library>::iterator l = _libraries.begin(); l != _libraries.end(); l++) {
- for (Common::List<Button>::iterator i = l->_buttons.begin(); i != l->_buttons.end(); i++) {
- if (i->_id != param1)
- continue;
- i->_active = false;
- }
- }
- onMouseMove(_lastMousePos);
+ setButtonActive(param1, false);
return 1;
case kFuncNewPage:
debug(3, "kFuncNewPage(%d, %d)", param1, param2);
@@ -726,4 +721,235 @@ int16 ComposerEngine::scriptFuncCall(uint16 id, int16 param1, int16 param2, int1
}
}
+OldScript::OldScript(uint16 id, Common::SeekableReadStream *stream) : _id(id), _stream(stream) {
+ _size = _stream->readUint32LE();
+ _stream->skip(2);
+ _currDelay = 0;
+ _zorder = 10;
+}
+
+OldScript::~OldScript() {
+ delete _stream;
+}
+
+void ComposerEngine::runOldScript(uint16 id, uint16 wait) {
+ stopOldScript(id);
+
+ Common::SeekableReadStream *stream = getResource(ID_SCRP, id);
+ OldScript *script = new OldScript(id, stream);
+ script->_currDelay = wait;
+ _oldScripts.push_back(script);
+}
+
+void ComposerEngine::stopOldScript(uint16 id) {
+ // FIXME: this could potentially (in the case of buggy script) be called on an in-use script
+
+ for (Common::List<OldScript *>::iterator i = _oldScripts.begin(); i != _oldScripts.end(); i++) {
+ if ((*i)->_id == id) {
+ delete *i;
+ i = _oldScripts.reverse_erase(i);
+ }
+ }
+}
+
+void ComposerEngine::tickOldScripts() {
+ for (Common::List<OldScript *>::iterator i = _oldScripts.begin(); i != _oldScripts.end(); i++) {
+ if (!tickOldScript(*i)) {
+ delete *i;
+ i = _oldScripts.reverse_erase(i);
+ }
+ }
+}
+
+enum {
+ kOldOpNoOp = 0,
+ kOldOpReplaceSprite = 1,
+ kOldOpPlayWav = 2,
+ kOldOpRunScript = 3,
+ kOldOpStopScript = 4,
+ kOldOpActivateButton = 5,
+ kOldOpDeactivateButton = 6,
+ kOldOpDrawSprite = 7,
+ kOldOpRemoveSprite = 8,
+ kOldOpDisableMouseInput = 9,
+ kOldOpEnableMouseInput = 10,
+ kOldOpWait = 11,
+ kOldOpRandWait = 12,
+ kOldOpDrawGlobalSprite = 13,
+ kOldOpRemoveGlobalSprite = 14,
+ kOldOpSetZOrder = 15,
+ kOldOpPlayPipe = 16,
+ kOldOpStopPipe = 17,
+ kOldOpNewScreen = 20,
+ kOldOpRunRandom = 22
+};
+
+bool ComposerEngine::tickOldScript(OldScript *script) {
+ if (script->_currDelay) {
+ script->_currDelay--;
+ return true;
+ }
+
+ bool running = true;
+ bool erasedOldSprite = false;
+ while (running && script->_stream->pos() < (int)script->_size) {
+ uint16 spriteId, scriptId, buttonId, pipeId;
+ Common::Point spritePos;
+
+ script->_stream->skip(0);
+ byte op = script->_stream->readByte();
+ switch (op) {
+ case kOldOpNoOp:
+ debug(3, "kOldOpNoOp()");
+ running = false;
+ break;
+ case kOldOpReplaceSprite:
+ if (!erasedOldSprite) {
+ removeSprite(0, script->_id);
+ erasedOldSprite = true;
+ }
+
+ spriteId = script->_stream->readUint16LE();
+ spritePos.x = script->_stream->readSint16LE();
+ spritePos.y = script->_stream->readSint16LE();
+ debug(3, "kOldOpReplaceSprite(%d, %d, %d)", spriteId, spritePos.x, spritePos.y);
+ addSprite(spriteId, script->_id, script->_zorder, spritePos);
+ break;
+ case kOldOpPlayWav:
+ uint16 wavId, prio;
+ wavId = script->_stream->readUint16LE();
+ prio = script->_stream->readUint16LE();
+ debug(3, "kOldOpPlayWav(%d, %d)", wavId, prio);
+ playWaveForAnim(wavId, prio, false);
+ break;
+ case kOldOpRunScript:
+ scriptId = script->_stream->readUint16LE();
+ debug(3, "kOldOpRunScript(%d)", scriptId);
+ if (scriptId == script->_id) {
+ // reset ourselves
+ removeSprite(0, script->_id);
+ script->_stream->seek(6);
+ } else {
+ runScript(scriptId);
+ }
+ break;
+ case kOldOpStopScript:
+ scriptId = script->_stream->readUint16LE();
+ debug(3, "kOldOpStopScript(%d)", scriptId);
+ removeSprite(0, scriptId);
+ stopOldScript(scriptId);
+ break;
+ case kOldOpActivateButton:
+ buttonId = script->_stream->readUint16LE();
+ debug(3, "kOldOpActivateButton(%d)", buttonId);
+ setButtonActive(buttonId, true);
+ break;
+ case kOldOpDeactivateButton:
+ buttonId = script->_stream->readUint16LE();
+ debug(3, "kOldOpDeactivateButton(%d)", buttonId);
+ setButtonActive(buttonId, false);
+ break;
+ case kOldOpDrawSprite:
+ spriteId = script->_stream->readUint16LE();
+ spritePos.x = script->_stream->readSint16LE();
+ spritePos.y = script->_stream->readSint16LE();
+ debug(3, "kOldOpDrawSprite(%d, %d, %d)", spriteId, spritePos.x, spritePos.y);
+ addSprite(spriteId, script->_id, script->_zorder, spritePos);
+ break;
+ case kOldOpRemoveSprite:
+ spriteId = script->_stream->readUint16LE();
+ debug(3, "kOldOpRemoveSprite(%d)", spriteId);
+ removeSprite(spriteId, script->_id);
+ break;
+ case kOldOpDisableMouseInput:
+ debug(3, "kOldOpDisableMouseInput()");
+ setCursorVisible(false);
+ break;
+ case kOldOpEnableMouseInput:
+ debug(3, "kOldOpEnableMouseInput()");
+ setCursorVisible(true);
+ break;
+ case kOldOpWait:
+ script->_currDelay = script->_stream->readUint16LE();
+ debug(3, "kOldOpWait(%d)", script->_currDelay);
+ break;
+ case kOldOpRandWait:
+ uint16 min, max;
+ min = script->_stream->readUint16LE();
+ max = script->_stream->readUint16LE();
+ debug(3, "kOldOpRandWait(%d, %d)", min, max);
+ script->_currDelay = _rnd->getRandomNumberRng(min, max);
+ break;
+ case kOldOpDrawGlobalSprite:
+ spriteId = script->_stream->readUint16LE();
+ spritePos.x = script->_stream->readSint16LE();
+ spritePos.y = script->_stream->readSint16LE();
+ debug(3, "kOldOpDrawGlobalSprite(%d, %d, %d)", spriteId, spritePos.x, spritePos.y);
+ addSprite(spriteId, 0, script->_zorder, spritePos);
+ break;
+ case kOldOpRemoveGlobalSprite:
+ spriteId = script->_stream->readUint16LE();
+ debug(3, "kOldOpRemoveGlobalSprite(%d)", spriteId);
+ removeSprite(spriteId, 0);
+ break;
+ case kOldOpSetZOrder:
+ script->_zorder = script->_stream->readUint16LE();
+ debug(3, "kOldOpSetZOrder(%d)", script->_zorder);
+ break;
+ case kOldOpPlayPipe:
+ pipeId = script->_stream->readUint16LE();
+ debug(3, "kOldOpPlayPipe(%d)", pipeId);
+ playPipe(pipeId);
+ break;
+ case kOldOpStopPipe:
+ pipeId = script->_stream->readUint16LE();
+ debug(3, "kOldOpStopPipe(%d)", pipeId);
+ // yes, pipeId is ignored here..
+ stopPipes();
+ break;
+ case kOldOpNewScreen:
+ uint16 newScreenId;
+ newScreenId = script->_stream->readUint16LE();
+ debug(3, "kOldOpNewScreen(%d)", newScreenId);
+ if (!newScreenId) {
+ quitGame();
+ } else {
+ _pendingPageChanges.clear();
+ _pendingPageChanges.push_back(PendingPageChange(newScreenId, false));
+ }
+ break;
+ case kOldOpRunRandom:
+ uint16 randomId;
+ randomId = script->_stream->readUint16LE();
+ debug(3, "kOldOpRunRandom(%d)", randomId);
+ if (!_randomEvents.contains(randomId)) {
+ warning("kOldOpRunRandom found no entries for id %d", randomId);
+ } else {
+ uint32 randValue = _rnd->getRandomNumberRng(0, 32767);
+ const Common::Array<RandomEvent> &events = _randomEvents[randomId];
+ uint i = 0;
+ for (i = 0; i < events.size(); i++) {
+ if ((i + 1 == events.size()) || (randValue <= events[i].weight)) {
+ runScript(events[i].scriptId);
+ break;
+ } else {
+ randValue -= events[i].weight;
+ }
+ }
+ }
+ break;
+ default:
+ error("unknown oldScript op %d", op);
+ }
+ }
+
+ if (script->_stream->pos() >= (int)script->_size) {
+ // stop running if we ran out of script
+ removeSprite(0, script->_id);
+ return false;
+ }
+
+ return true;
+}
+
} // End of namespace Composer
diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp
index ff4669607d..a1337aefa7 100644
--- a/engines/cruise/cruise_main.cpp
+++ b/engines/cruise/cruise_main.cpp
@@ -998,7 +998,7 @@ bool findRelation(int objOvl, int objIdx, int x, int y) {
ovlDataStruct *ovl2 = NULL;
ovlDataStruct *ovl3 = NULL;
- ovlDataStruct *ovl4 = NULL;
+ //ovlDataStruct *ovl4 = NULL;
if (verbeOvl > 0)
ovl2 = overlayTable[verbeOvl].ovlData;
@@ -1006,8 +1006,8 @@ bool findRelation(int objOvl, int objIdx, int x, int y) {
if (obj1Ovl > 0)
ovl3 = overlayTable[obj1Ovl].ovlData;
- if (obj2Ovl > 0)
- ovl4 = overlayTable[obj2Ovl].ovlData;
+ //if (obj2Ovl > 0)
+ // ovl4 = overlayTable[obj2Ovl].ovlData;
if ((ovl3) && (ptrHead->obj1Number >= 0)) {
testState = ptrHead->obj1OldState;
@@ -1804,6 +1804,8 @@ void CruiseEngine::mainLoop() {
bool skipEvents = false;
do {
+ g_system->updateScreen();
+
g_system->delayMillis(10);
currentTick = g_system->getMillis();
diff --git a/engines/cruise/detection.cpp b/engines/cruise/detection.cpp
index a68b14d986..eb7c1c524f 100644
--- a/engines/cruise/detection.cpp
+++ b/engines/cruise/detection.cpp
@@ -66,8 +66,6 @@ static const PlainGameDescriptor cruiseGames[] = {
namespace Cruise {
-using Common::GUIO_NONE;
-
static const CRUISEGameDescription gameDescriptions[] = {
{
{
@@ -77,7 +75,7 @@ static const CRUISEGameDescription gameDescriptions[] = {
Common::EN_GRB,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_CRUISE,
0,
@@ -90,7 +88,7 @@ static const CRUISEGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_CRUISE,
0,
@@ -103,7 +101,7 @@ static const CRUISEGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_CRUISE,
0,
@@ -116,7 +114,7 @@ static const CRUISEGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_CRUISE,
0,
@@ -129,7 +127,7 @@ static const CRUISEGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_CRUISE,
0,
@@ -142,7 +140,7 @@ static const CRUISEGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_CRUISE,
0,
@@ -155,7 +153,7 @@ static const CRUISEGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_CRUISE,
0,
@@ -168,7 +166,7 @@ static const CRUISEGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_CRUISE,
0,
@@ -181,7 +179,7 @@ static const CRUISEGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAtariST,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_CRUISE,
0,
@@ -194,7 +192,7 @@ static const CRUISEGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_CRUISE,
0,
@@ -207,7 +205,7 @@ static const CRUISEGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GType_CRUISE,
0,
@@ -221,7 +219,7 @@ class CruiseMetaEngine : public AdvancedMetaEngine {
public:
CruiseMetaEngine() : AdvancedMetaEngine(Cruise::gameDescriptions, sizeof(Cruise::CRUISEGameDescription), cruiseGames) {
_singleid = "cruise";
- _guioptions = Common::GUIO_NOSPEECH | Common::GUIO_NOMIDI;
+ _guioptions = GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI);
}
virtual const char *getName() const {
diff --git a/engines/cruise/gfxModule.cpp b/engines/cruise/gfxModule.cpp
index 7bbcae2259..aa2dbc5370 100644
--- a/engines/cruise/gfxModule.cpp
+++ b/engines/cruise/gfxModule.cpp
@@ -326,7 +326,7 @@ void flip() {
void drawSolidBox(int32 x1, int32 y1, int32 x2, int32 y2, uint8 color) {
for (int y = y1; y < y2; ++y) {
byte *p = &gfxModuleData.pPage00[y * 320 + x1];
- Common::set_to(p, p + (x2 - x1), color);
+ Common::fill(p, p + (x2 - x1), color);
}
}
diff --git a/engines/cruise/mainDraw.cpp b/engines/cruise/mainDraw.cpp
index 14b6daf4bb..9a5df69cae 100644
--- a/engines/cruise/mainDraw.cpp
+++ b/engines/cruise/mainDraw.cpp
@@ -621,11 +621,9 @@ void buildSegment() {
unsigned char *drawPolyMode1(unsigned char *dataPointer, int linesToDraw) {
int index;
- int16 *pBufferDest;
+ int16 *pBufferDest = polyBuffer4 + nbseg * 2;
- pBufferDest = polyBuffer4 + nbseg * 2;
nbseg = linesToDraw;
- A2ptr = polyBuffer4;
index = *(dataPointer++);
polyXMin = polyXMax = pBufferDest[-2] = pBufferDest[-2 + linesToDraw * 2] = polyBuffer2[index * 2];
diff --git a/engines/cruise/overlay.cpp b/engines/cruise/overlay.cpp
index 2f4b375865..d618ab5599 100644
--- a/engines/cruise/overlay.cpp
+++ b/engines/cruise/overlay.cpp
@@ -185,11 +185,10 @@ int loadOverlay(const char *scriptName) {
// This memory block will be later passed to a MemoryReadStream, which will dispose of it
unpackedBuffer = (byte *)malloc(unpackedSize);
- memset(unpackedBuffer, 0, unpackedSize);
-
if (!unpackedBuffer) {
return (-2);
}
+ memset(unpackedBuffer, 0, unpackedSize);
if (volumePtrToFileDescriptor[fileIdx].size + 2 != unpackedSize) {
char *pakedBuffer =
@@ -566,11 +565,10 @@ int loadOverlay(const char *scriptName) {
// This memory block will be later passed to a MemoryReadStream, which will dispose of it
unpackedBuffer = (byte *)malloc(unpackedSize);
- memset(unpackedBuffer, 0, unpackedSize);
-
if (!unpackedBuffer) {
return (-2);
}
+ memset(unpackedBuffer, 0, unpackedSize);
if (volumePtrToFileDescriptor[fileIdx].size + 2 !=
unpackedSize) {
diff --git a/engines/cruise/saveload.cpp b/engines/cruise/saveload.cpp
index c3d1ea6643..e2bd1ebc34 100644
--- a/engines/cruise/saveload.cpp
+++ b/engines/cruise/saveload.cpp
@@ -84,6 +84,7 @@ void writeSavegameHeader(Common::OutSaveFile *out, CruiseSavegameHeader &header)
Graphics::Surface *thumb = new Graphics::Surface();
::createThumbnail(thumb, globalScreen, 320, 200, workpal);
Graphics::saveThumbnail(*out, *thumb);
+ thumb->free();
delete thumb;
}
diff --git a/engines/cruise/volume.cpp b/engines/cruise/volume.cpp
index 773a146b9a..4b64d4ff77 100644
--- a/engines/cruise/volume.cpp
+++ b/engines/cruise/volume.cpp
@@ -326,7 +326,7 @@ int closeCnf() {
int16 readVolCnf() {
int i;
Common::File fileHandle;
- short int sizeHEntry;
+ //short int sizeHEntry;
volumeDataLoaded = 0;
@@ -344,7 +344,7 @@ int16 readVolCnf() {
}
numOfDisks = fileHandle.readSint16BE();
- sizeHEntry = fileHandle.readSint16BE(); // size of one header entry - 20 bytes
+ /*sizeHEntry =*/ fileHandle.readSint16BE(); // size of one header entry - 20 bytes
for (i = 0; i < numOfDisks; i++) {
// fread(&volumeData[i],20,1,fileHandle);
diff --git a/engines/draci/detection.cpp b/engines/draci/detection.cpp
index e7fbaf62ef..de76eb83e0 100644
--- a/engines/draci/detection.cpp
+++ b/engines/draci/detection.cpp
@@ -35,8 +35,6 @@ static const PlainGameDescriptor draciGames[] = {
namespace Draci {
-using Common::GUIO_NONE;
-
const ADGameDescription gameDescriptions[] = {
{
"draci",
@@ -45,7 +43,7 @@ const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
{
@@ -55,7 +53,7 @@ const ADGameDescription gameDescriptions[] = {
Common::CZ_CZE,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
{
@@ -65,7 +63,7 @@ const ADGameDescription gameDescriptions[] = {
Common::PL_POL,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
{
@@ -75,7 +73,7 @@ const ADGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
AD_TABLE_END_MARKER
diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp
index 67e043632e..6aa8477887 100644
--- a/engines/draci/draci.cpp
+++ b/engines/draci/draci.cpp
@@ -359,10 +359,11 @@ void DraciEngine::handleEvents() {
DraciEngine::~DraciEngine() {
// Dispose your resources here
- // If the common library supported STL's scoped_ptr<>, then wrapping
+ // If the common library supported Boost's scoped_ptr<>, then wrapping
// all the following pointers and many more would be appropriate. So
// far, there is only SharedPtr, which I feel being an overkill for
// easy deallocation.
+ // TODO: We have ScopedPtr nowadays. Maybe should adapt this code then?
delete _smallFont;
delete _bigFont;
diff --git a/engines/draci/saveload.cpp b/engines/draci/saveload.cpp
index b3bf0cbcd8..e3551c78b3 100644
--- a/engines/draci/saveload.cpp
+++ b/engines/draci/saveload.cpp
@@ -41,7 +41,7 @@ bool readSavegameHeader(Common::InSaveFile *in, DraciSavegameHeader &header) {
// Validate the header Id
in->read(saveIdentBuffer, 6);
- if (strcmp(saveIdentBuffer, draciIdentString))
+ if (strcmp(saveIdentBuffer, draciIdentString) != 0)
return false;
header.version = in->readByte();
diff --git a/engines/drascula/converse.cpp b/engines/drascula/converse.cpp
index 6f028e6e12..7abbb3214b 100644
--- a/engines/drascula/converse.cpp
+++ b/engines/drascula/converse.cpp
@@ -197,7 +197,7 @@ void DrasculaEngine::converse(int index) {
// from 1(top) to 31
color_abc(kColorLightGreen);
- while (breakOut == 0) {
+ while (breakOut == 0 && !shouldQuit()) {
updateRoom();
if (musicStatus() == 0 && roomMusic != 0) {
diff --git a/engines/drascula/detection.cpp b/engines/drascula/detection.cpp
index 6ba5597e8a..3310ac0598 100644
--- a/engines/drascula/detection.cpp
+++ b/engines/drascula/detection.cpp
@@ -63,8 +63,6 @@ static const PlainGameDescriptor drasculaGames[] = {
namespace Drascula {
-using Common::GUIO_NONE;
-
static const DrasculaGameDescription gameDescriptions[] = {
{
// Drascula English version
@@ -75,7 +73,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
},
@@ -95,7 +93,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
GF_PACKED,
- GUIO_NONE
+ GUIO0()
},
},
@@ -112,7 +110,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
GF_PACKED,
- GUIO_NONE
+ GUIO0()
},
},
@@ -129,7 +127,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
GF_PACKED,
- GUIO_NONE
+ GUIO0()
},
},
@@ -142,7 +140,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
GF_PACKED,
- GUIO_NONE
+ GUIO0()
},
},
@@ -155,7 +153,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
},
@@ -168,7 +166,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
},
@@ -181,7 +179,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
},
@@ -194,7 +192,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformPC,
GF_PACKED,
- GUIO_NONE
+ GUIO0()
},
},
{
@@ -206,7 +204,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
},
@@ -223,7 +221,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
GF_PACKED,
- GUIO_NONE
+ GUIO0()
},
},
@@ -240,7 +238,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformPC,
GF_PACKED,
- GUIO_NONE
+ GUIO0()
},
},
@@ -257,7 +255,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
GF_PACKED,
- GUIO_NONE
+ GUIO0()
},
},
@@ -270,7 +268,7 @@ class DrasculaMetaEngine : public AdvancedMetaEngine {
public:
DrasculaMetaEngine() : AdvancedMetaEngine(Drascula::gameDescriptions, sizeof(Drascula::DrasculaGameDescription), drasculaGames) {
_singleid = "drascula";
- _guioptions = Common::GUIO_NOMIDI | Common::GUIO_NOLAUNCHLOAD;
+ _guioptions = GUIO2(GUIO_NOMIDI, GUIO_NOLAUNCHLOAD);
}
virtual const char *getName() const {
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp
index b4f009eb44..1b3c4038f0 100644
--- a/engines/drascula/drascula.cpp
+++ b/engines/drascula/drascula.cpp
@@ -789,7 +789,7 @@ void DrasculaEngine::delay(int ms) {
_system->delayMillis(10);
updateEvents();
_system->updateScreen();
- } while (_system->getMillis() < end);
+ } while (_system->getMillis() < end && !shouldQuit());
}
void DrasculaEngine::pause(int duration) {
@@ -882,7 +882,7 @@ bool DrasculaEngine::loadDrasculaDat() {
in.read(buf, 8);
buf[8] = '\0';
- if (strcmp(buf, "DRASCULA")) {
+ if (strcmp(buf, "DRASCULA") != 0) {
Common::String errorMessage = "File 'drascula.dat' is corrupt. Get it from the ScummVM website";
GUIErrorMessage(errorMessage);
warning("%s", errorMessage.c_str());
diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp
index 9ea20e3e12..590561f0bd 100644
--- a/engines/drascula/graphics.cpp
+++ b/engines/drascula/graphics.cpp
@@ -154,6 +154,7 @@ void DrasculaEngine::showFrame(Common::SeekableReadStream *stream, bool firstFra
}
void DrasculaEngine::copyBackground(int xorg, int yorg, int xdes, int ydes, int width, int height, byte *src, byte *dest) {
+ debug(1, "DrasculaEngine::copyBackground(xorg:%d, yorg:%d, xdes:%d, ydes:%d width:%d height:%d, src, dest)", xorg, yorg, xdes, ydes, width,height);
dest += xdes + ydes * 320;
src += xorg + yorg * 320;
/* Unoptimized code
@@ -361,7 +362,7 @@ void DrasculaEngine::centerText(const char *message, int textX, int textY) {
curWord = strtok(msg, " ");
while (curWord != NULL) {
// Check if the word and the current line fit on screen
- if (strlen(tmpMessageLine) > 0)
+ if (tmpMessageLine[0] != '\0')
strcat(tmpMessageLine, " ");
strcat(tmpMessageLine, curWord);
if (textFitsCentered(tmpMessageLine, textX)) {
@@ -643,7 +644,7 @@ void DrasculaEngine::waitFrameSSN() {
}
bool DrasculaEngine::animate(const char *animationFile, int FPS) {
- int NFrames = 1;
+ int NFrames;
int cnt = 2;
Common::SeekableReadStream *stream = _archives.open(animationFile);
diff --git a/engines/drascula/interface.cpp b/engines/drascula/interface.cpp
index e3a97087c0..5e4f7a1541 100644
--- a/engines/drascula/interface.cpp
+++ b/engines/drascula/interface.cpp
@@ -100,9 +100,18 @@ bool DrasculaEngine::confirmExit() {
key = getScan();
if (key != 0)
break;
+
+ // This gives a better feedback to the user when he is asked to
+ // confirm whether he wants to quit. It now still updates the room and
+ // shows mouse cursor movement. Hopefully it will work in all
+ // locations of the game.
+ updateRoom();
+ color_abc(kColorRed);
+ centerText(_textsys[1], 160, 87);
+ updateScreen();
}
- if (key == Common::KEYCODE_ESCAPE) {
+ if (key == Common::KEYCODE_ESCAPE || shouldQuit()) {
stopMusic();
return false;
}
diff --git a/engines/drascula/saveload.cpp b/engines/drascula/saveload.cpp
index c8622f3c92..35e3821dc4 100644
--- a/engines/drascula/saveload.cpp
+++ b/engines/drascula/saveload.cpp
@@ -123,7 +123,7 @@ bool DrasculaEngine::saveLoadScreen() {
if (mouseX > 115 && mouseY > y + (9 * n) && mouseX < 115 + 175 && mouseY < y + 10 + (9 * n)) {
strcpy(select, _saveNames[n]);
- if (strcmp(select, "*"))
+ if (strcmp(select, "*") != 0)
selectionMade = 1;
else {
enterName();
diff --git a/engines/drascula/sound.cpp b/engines/drascula/sound.cpp
index 4721d2d369..112f6fd06c 100644
--- a/engines/drascula/sound.cpp
+++ b/engines/drascula/sound.cpp
@@ -23,10 +23,10 @@
#include "audio/audiostream.h"
#include "audio/mixer.h"
#include "audio/decoders/raw.h"
-#include "audio/decoders/voc.h"
#include "common/config-manager.h"
#include "common/textconsole.h"
+#include "common/substream.h"
#include "backends/audiocd/audiocd.h"
@@ -79,6 +79,8 @@ void DrasculaEngine::volumeControls() {
;
if (rightMouseButton == 1) {
+ // Clear this to avoid going straight to the inventory
+ rightMouseButton = 0;
delay(100);
break;
}
@@ -164,29 +166,28 @@ void DrasculaEngine::MusicFadeout() {
void DrasculaEngine::playFile(const char *fname) {
Common::SeekableReadStream *stream = _archives.open(fname);
if (stream) {
- int soundSize = stream->size();
- byte *soundData = (byte *)malloc(soundSize);
+ int startOffset = 0;
+ int soundSize = stream->size() - startOffset;
- if (!(!strcmp(fname, "3.als") && soundSize == 145166 && _lang != kSpanish)) {
- stream->seek(32);
- } else {
+ if (!strcmp(fname, "3.als") && soundSize == 145166 && _lang != kSpanish) {
// WORKAROUND: File 3.als with English speech files has a big silence at
// its beginning and end. We seek past the silence at the beginning,
// and ignore the silence at the end
// Fixes bug #2111815 - "DRASCULA: Voice delayed"
- stream->seek(73959, SEEK_SET);
- soundSize = 117158 - 73959;
+ startOffset = 73959;
+ soundSize = soundSize - startOffset - 26306;
}
- stream->read(soundData, soundSize);
- delete stream;
-
- _subtitlesDisabled = !ConfMan.getBool("subtitles");
- if (ConfMan.getBool("speech_mute"))
- memset(soundData, 0x80, soundSize); // Mute speech but keep the pause
+ Common::SeekableReadStream *subStream = new Common::SeekableSubReadStream(
+ stream, startOffset, startOffset + soundSize, DisposeAfterUse::YES);
+ if (!subStream) {
+ warning("playFile: Out of memory");
+ delete stream;
+ return;
+ }
- Audio::AudioStream *sound = Audio::makeRawStream(soundData, soundSize - 64,
- 11025, Audio::FLAG_UNSIGNED);
+ Audio::AudioStream *sound = Audio::makeRawStream(subStream, 11025,
+ Audio::FLAG_UNSIGNED);
_mixer->playStream(Audio::Mixer::kSpeechSoundType, &_soundHandle, sound);
} else
warning("playFile: Could not open %s", fname);
diff --git a/engines/drascula/talk.cpp b/engines/drascula/talk.cpp
index 6d1509fe3c..a326852e96 100644
--- a/engines/drascula/talk.cpp
+++ b/engines/drascula/talk.cpp
@@ -34,6 +34,11 @@ void DrasculaEngine::talkInit(const char *filename) {
}
bool DrasculaEngine::isTalkFinished() {
+ if (shouldQuit()) {
+ stopSound();
+ return true;
+ }
+
if (getScan() != 0)
stopSound();
if (soundIsActive())
@@ -367,6 +372,7 @@ void DrasculaEngine::talk(int index) {
}
void DrasculaEngine::talk(const char *said, const char *filename) {
+ debug(1, "DrasculaEngine::talk(said:\"%s\", filename:\"%s\")", said, filename);
int talkOffset = 0;
if (currentChapter != 2)
talkOffset = 1;
@@ -409,8 +415,8 @@ void DrasculaEngine::talk(const char *said, const char *filename) {
if (currentChapter == 2)
copyBackground(curX, curY, OBJWIDTH + 1, 0, curWidth, talkHeight - 1, screenSurface, drawSurface3);
else
- copyBackground(curX, curY, OBJWIDTH + 1, 0, (int)(((float)curWidth / 100) * factor_red[curY + curHeight]),
- (int)(((float)(talkHeight - 1) / 100) * factor_red[curY + curHeight]),
+ copyBackground(curX, curY, OBJWIDTH + 1, 0, (int)(((float)curWidth / 100) * factor_red[MIN(201, curY + curHeight)]),
+ (int)(((float)(talkHeight - 1) / 100) * factor_red[MIN(201, curY + curHeight)]),
screenSurface, drawSurface3);
moveCharacters();
@@ -419,8 +425,8 @@ void DrasculaEngine::talk(const char *said, const char *filename) {
if (!strcmp(menuBackground, "99.alg") || !strcmp(menuBackground, "994.alg"))
copyBackground(OBJWIDTH + 1, 0, curX, curY, curWidth, talkHeight - 1, drawSurface3, screenSurface);
} else {
- copyBackground(OBJWIDTH + 1, 0, curX, curY, (int)(((float)curWidth / 100) * factor_red[curY + curHeight]),
- (int)(((float)(talkHeight - 1) / 100) * factor_red[curY + curHeight]),
+ copyBackground(OBJWIDTH + 1, 0, curX, curY, (int)(((float)curWidth / 100) * factor_red[MIN(201, curY + curHeight)]),
+ (int)(((float)(talkHeight - 1) / 100) * factor_red[MIN(201, curY + curHeight)]),
drawSurface3, screenSurface);
}
@@ -429,8 +435,8 @@ void DrasculaEngine::talk(const char *said, const char *filename) {
copyRect(x_talk_izq[face], y_mask_talk, curX + 8, curY - 1, talkWidth, talkHeight,
extraSurface, screenSurface);
else
- reduce_hare_chico(x_talk_izq[face], y_mask_talk, curX + (int)((8.0f / 100) * factor_red[curY + curHeight]),
- curY, talkWidth, talkHeight, factor_red[curY + curHeight],
+ reduce_hare_chico(x_talk_izq[face], y_mask_talk, curX + (int)((8.0f / 100) * factor_red[MIN(201, curY + curHeight)]),
+ curY, talkWidth, talkHeight, factor_red[MIN(201, curY + curHeight)],
extraSurface, screenSurface);
updateRefresh();
@@ -439,8 +445,8 @@ void DrasculaEngine::talk(const char *said, const char *filename) {
copyRect(x_talk_dch[face], y_mask_talk, curX + 12, curY, talkWidth, talkHeight,
extraSurface, screenSurface);
else
- reduce_hare_chico(x_talk_dch[face], y_mask_talk, curX + (int)((12.0f / 100) * factor_red[curY + curHeight]),
- curY, talkWidth, talkHeight, factor_red[curY + curHeight], extraSurface, screenSurface);
+ reduce_hare_chico(x_talk_dch[face], y_mask_talk, curX + (int)((12.0f / 100) * factor_red[MIN(201, curY + curHeight)]),
+ curY, talkWidth, talkHeight, factor_red[MIN(201, curY + curHeight)], extraSurface, screenSurface);
updateRefresh();
} else if (trackProtagonist == 2) {
if (currentChapter == 2)
@@ -448,8 +454,8 @@ void DrasculaEngine::talk(const char *said, const char *filename) {
frontSurface, screenSurface);
else
reduce_hare_chico(x_talk_izq[face], y_mask_talk,
- talkOffset + curX + (int)((12.0f / 100) * factor_red[curY + curHeight]),
- curY, talkWidth, talkHeight, factor_red[curY + curHeight],
+ talkOffset + curX + (int)((12.0f / 100) * factor_red[MIN(201, curY + curHeight)]),
+ curY, talkWidth, talkHeight, factor_red[MIN(201, curY + curHeight)],
frontSurface, screenSurface);
updateRefresh();
} else if (trackProtagonist == 3) {
@@ -458,8 +464,8 @@ void DrasculaEngine::talk(const char *said, const char *filename) {
frontSurface, screenSurface);
else
reduce_hare_chico(x_talk_dch[face], y_mask_talk,
- talkOffset + curX + (int)((8.0f / 100) * factor_red[curY + curHeight]),
- curY, talkWidth,talkHeight, factor_red[curY + curHeight],
+ talkOffset + curX + (int)((8.0f / 100) * factor_red[MIN(201, curY + curHeight)]),
+ curY, talkWidth,talkHeight, factor_red[MIN(201, curY + curHeight)],
frontSurface, screenSurface);
updateRefresh();
}
diff --git a/engines/dreamweb/backdrop.cpp b/engines/dreamweb/backdrop.cpp
index ffcad5b6bf..3e005fdec9 100644
--- a/engines/dreamweb/backdrop.cpp
+++ b/engines/dreamweb/backdrop.cpp
@@ -24,15 +24,12 @@
namespace DreamGen {
-void DreamGenContext::doblocks() {
+void DreamGenContext::doBlocks() {
uint16 dstOffset = data.word(kMapady) * 320 + data.word(kMapadx);
uint16 mapOffset = kMap + data.byte(kMapy) * kMapwidth + data.byte(kMapx);
- ds = data.word(kMapdata);
- const uint8 *mapData = ds.ptr(mapOffset, 0);
- ds = data.word(kBackdrop);
- const uint8 *blocks = ds.ptr(kBlocks, 0);
- es = data.word(kWorkspace);
- uint8 *dstBuffer = es.ptr(dstOffset, 0);
+ const uint8 *mapData = getSegment(data.word(kMapdata)).ptr(mapOffset, 0);
+ const uint8 *blocks = getSegment(data.word(kBackdrop)).ptr(kBlocks, 0);
+ uint8 *dstBuffer = workspace() + dstOffset;
for (size_t i = 0; i < 10; ++i) {
for (size_t j = 0; j < 11; ++j) {
@@ -66,7 +63,7 @@ void DreamGenContext::doblocks() {
}
}
-uint8 DreamGenContext::getxad(const uint8 *setData, uint8 *result) {
+uint8 DreamGenContext::getXAd(const uint8 *setData, uint8 *result) {
uint8 v0 = setData[0];
uint8 v1 = setData[1];
uint8 v2 = setData[2];
@@ -81,7 +78,7 @@ uint8 DreamGenContext::getxad(const uint8 *setData, uint8 *result) {
return 1;
}
-uint8 DreamGenContext::getyad(const uint8 *setData, uint8 *result) {
+uint8 DreamGenContext::getYAd(const uint8 *setData, uint8 *result) {
uint8 v0 = setData[3];
uint8 v1 = setData[4];
if (v0 < data.byte(kMapy))
@@ -93,30 +90,30 @@ uint8 DreamGenContext::getyad(const uint8 *setData, uint8 *result) {
return 1;
}
-void DreamGenContext::getmapad() {
- ch = getmapad((const uint8 *)es.ptr(si, 5));
+void DreamGenContext::getMapAd() {
+ ch = getMapAd((const uint8 *)es.ptr(si, 5));
}
-uint8 DreamGenContext::getmapad(const uint8 *setData) {
+uint8 DreamGenContext::getMapAd(const uint8 *setData) {
uint8 xad, yad;
- if (getxad(setData, &xad) == 0)
+ if (getXAd(setData, &xad) == 0)
return 0;
data.word(kObjectx) = xad;
- if (getyad(setData, &yad) == 0)
+ if (getYAd(setData, &yad) == 0)
return 0;
data.word(kObjecty) = yad;
return 1;
}
-void DreamGenContext::calcfrframe() {
+void DreamGenContext::calcFrFrame(uint16 frame) {
uint8 width, height;
- calcfrframe(&width, &height);
+ calcFrFrame(frame, &width, &height);
cl = width;
ch = height;
}
-void DreamGenContext::calcfrframe(uint8* width, uint8* height) {
- const Frame *frame = (const Frame *)segRef(data.word(kFrsegment)).ptr(data.word(kCurrentframe) * sizeof(Frame), sizeof(Frame));
+void DreamGenContext::calcFrFrame(uint16 frameNum, uint8* width, uint8* height) {
+ const Frame *frame = (const Frame *)getSegment(data.word(kFrsegment)).ptr(frameNum * sizeof(Frame), sizeof(Frame));
data.word(kSavesource) = data.word(kFramesad) + frame->ptr();
data.byte(kSavesize+0) = frame->width;
data.byte(kSavesize+1) = frame->height;
@@ -126,49 +123,48 @@ void DreamGenContext::calcfrframe(uint8* width, uint8* height) {
*height = frame->height;
}
-void DreamGenContext::finalframe() {
+void DreamGenContext::finalFrame() {
uint16 x, y;
- finalframe(&x, &y);
+ finalFrame(&x, &y);
di = x;
bx = y;
}
-void DreamGenContext::finalframe(uint16 *x, uint16 *y) {
+void DreamGenContext::finalFrame(uint16 *x, uint16 *y) {
data.byte(kSavex) = (data.word(kObjectx) + data.word(kOffsetx)) & 0xff;
data.byte(kSavey) = (data.word(kObjecty) + data.word(kOffsety)) & 0xff;
*x = data.word(kObjectx);
*y = data.word(kObjecty);
}
-void DreamGenContext::showallobs() {
+void DreamGenContext::showAllObs() {
data.word(kListpos) = kSetlist;
- memset(segRef(data.word(kBuffers)).ptr(kSetlist, 0), 0xff, 128 * 5);
+ memset(getSegment(data.word(kBuffers)).ptr(kSetlist, 0), 0xff, 128 * 5);
data.word(kFrsegment) = data.word(kSetframes);
data.word(kDataad) = kFramedata;
data.word(kFramesad) = kFrames;
- const Frame *frames = (const Frame *)segRef(data.word(kFrsegment)).ptr(0, 0);
- SetObject *setEntries = (SetObject *)segRef(data.word(kSetdat)).ptr(0, 128 * sizeof(SetObject));
+ const Frame *frames = (const Frame *)getSegment(data.word(kFrsegment)).ptr(0, 0);
+ SetObject *setEntries = (SetObject *)getSegment(data.word(kSetdat)).ptr(0, 128 * sizeof(SetObject));
for (size_t i = 0; i < 128; ++i) {
SetObject *setEntry = setEntries + i;
- if (getmapad(setEntry->mapad) == 0)
+ if (getMapAd(setEntry->mapad) == 0)
continue;
- uint8 currentFrame = setEntry->b18[0];
- data.word(kCurrentframe) = currentFrame;
+ uint8 currentFrame = setEntry->frames[0];
if (currentFrame == 0xff)
continue;
- calcfrframe();
+ calcFrFrame(currentFrame);
uint16 x, y;
- finalframe(&x, &y);
- setEntry->index = setEntry->b18[0];
+ finalFrame(&x, &y);
+ setEntry->index = setEntry->frames[0];
if ((setEntry->type == 0) && (setEntry->priority != 5) && (setEntry->priority != 6)) {
x += data.word(kMapadx);
y += data.word(kMapady);
- showframe(frames, x, y, data.word(kCurrentframe), 0);
+ showFrame(frames, x, y, currentFrame, 0);
} else
- makebackob(setEntry);
+ makeBackOb(setEntry);
- ObjPos *objPos = (ObjPos *)segRef(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(ObjPos));
+ ObjPos *objPos = (ObjPos *)getSegment(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(ObjPos));
objPos->xMin = data.byte(kSavex);
objPos->yMin = data.byte(kSavey);
objPos->xMax = data.byte(kSavex) + data.byte(kSavesize+0);
@@ -178,18 +174,17 @@ void DreamGenContext::showallobs() {
}
}
-void DreamGenContext::getdimension()
-{
+void DreamGenContext::getDimension() {
uint8 mapXstart, mapYstart;
uint8 mapXsize, mapYsize;
- getdimension(&mapXstart, &mapYstart, &mapXsize, &mapYsize);
+ getDimension(&mapXstart, &mapYstart, &mapXsize, &mapYsize);
cl = mapXstart;
ch = mapYstart;
dl = mapXsize;
dh = mapYsize;
}
-bool DreamGenContext::addalong(const uint8 *mapFlags) {
+bool DreamGenContext::addAlong(const uint8 *mapFlags) {
for (size_t i = 0; i < 11; ++i) {
if (mapFlags[3 * i] != 0)
return true;
@@ -197,7 +192,7 @@ bool DreamGenContext::addalong(const uint8 *mapFlags) {
return false;
}
-bool DreamGenContext::addlength(const uint8 *mapFlags) {
+bool DreamGenContext::addLength(const uint8 *mapFlags) {
for (size_t i = 0; i < 10; ++i) {
if (mapFlags[3 * 11 * i] != 0)
return true;
@@ -205,23 +200,23 @@ bool DreamGenContext::addlength(const uint8 *mapFlags) {
return false;
}
-void DreamGenContext::getdimension(uint8 *mapXstart, uint8 *mapYstart, uint8 *mapXsize, uint8 *mapYsize) {
- const uint8 *mapFlags = segRef(data.word(kBuffers)).ptr(kMapflags, 0);
+void DreamGenContext::getDimension(uint8 *mapXstart, uint8 *mapYstart, uint8 *mapXsize, uint8 *mapYsize) {
+ const uint8 *mapFlags = getSegment(data.word(kBuffers)).ptr(kMapflags, 0);
uint8 yStart = 0;
- while (! addalong(mapFlags + 3 * 11 * yStart))
+ while (! addAlong(mapFlags + 3 * 11 * yStart))
++yStart;
uint8 xStart = 0;
- while (! addlength(mapFlags + 3 * xStart))
+ while (! addLength(mapFlags + 3 * xStart))
++xStart;
uint8 yEnd = 10;
- while (! addalong(mapFlags + 3 * 11 * (yEnd - 1)))
+ while (! addAlong(mapFlags + 3 * 11 * (yEnd - 1)))
--yEnd;
uint8 xEnd = 11;
- while (! addlength(mapFlags + 3 * (xEnd - 1)))
+ while (! addLength(mapFlags + 3 * (xEnd - 1)))
--xEnd;
*mapXstart = xStart;
@@ -234,37 +229,38 @@ void DreamGenContext::getdimension(uint8 *mapXstart, uint8 *mapYstart, uint8 *ma
data.byte(kMapysize) = *mapYsize << 4;
}
-void DreamGenContext::calcmapad() {
+void DreamGenContext::calcMapAd() {
uint8 mapXstart, mapYstart;
uint8 mapXsize, mapYsize;
- getdimension(&mapXstart, &mapYstart, &mapXsize, &mapYsize);
+ getDimension(&mapXstart, &mapYstart, &mapXsize, &mapYsize);
data.word(kMapadx) = data.word(kMapoffsetx) - 8 * (mapXsize + 2 * mapXstart - 11);
data.word(kMapady) = data.word(kMapoffsety) - 8 * (mapYsize + 2 * mapYstart - 10);
}
-void DreamGenContext::showallfree() {
+void DreamGenContext::showAllFree() {
data.word(kListpos) = kFreelist;
- ObjPos *listPos = (ObjPos *)segRef(data.word(kBuffers)).ptr(kFreelist, 80 * sizeof(ObjPos));
+ ObjPos *listPos = (ObjPos *)getSegment(data.word(kBuffers)).ptr(kFreelist, 80 * sizeof(ObjPos));
memset(listPos, 0xff, 80 * sizeof(ObjPos));
data.word(kFrsegment) = data.word(kFreeframes);
data.word(kDataad) = kFrframedata;
data.word(kFramesad) = kFrframes;
data.byte(kCurrentfree) = 0;
- const DynObject *freeObjects = (const DynObject *)segRef(data.word(kFreedat)).ptr(0, 0);
- for(size_t i = 0; i < 80; ++i) {
- uint8 mapad = getmapad(freeObjects[i].mapad);
- if (mapad != 0) {
- data.word(kCurrentframe) = 3 * data.byte(kCurrentfree);
+ const DynObject *freeObjects = (const DynObject *)getSegment(data.word(kFreedat)).ptr(0, 0);
+ for (size_t i = 0; i < 80; ++i) {
+ uint8 mapAd = getMapAd(freeObjects[i].mapad);
+ if (mapAd != 0) {
uint8 width, height;
- calcfrframe(&width, &height);
+ uint16 currentFrame = 3 * data.byte(kCurrentfree);
+ calcFrFrame(currentFrame, &width, &height);
uint16 x, y;
- finalframe(&x, &y);
+ finalFrame(&x, &y);
if ((width != 0) || (height != 0)) {
x += data.word(kMapadx);
y += data.word(kMapady);
- showframe((Frame *)segRef(data.word(kFrsegment)).ptr(0, 0), x, y, data.word(kCurrentframe) & 0xff, 0);
- ObjPos *objPos = (ObjPos *)segRef(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(ObjPos));
+ assert(currentFrame < 256);
+ showFrame((Frame *)getSegment(data.word(kFrsegment)).ptr(0, 0), x, y, currentFrame, 0);
+ ObjPos *objPos = (ObjPos *)getSegment(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(ObjPos));
objPos->xMin = data.byte(kSavex);
objPos->yMin = data.byte(kSavey);
objPos->xMax = data.byte(kSavex) + data.byte(kSavesize+0);
@@ -278,10 +274,10 @@ void DreamGenContext::showallfree() {
}
}
-void DreamGenContext::drawflags() {
- uint8 *mapFlags = segRef(data.word(kBuffers)).ptr(kMapflags, 0);
- const uint8 *mapData = segRef(data.word(kMapdata)).ptr(kMap + data.byte(kMapy) * kMapwidth + data.byte(kMapx), 0);
- const uint8 *backdropFlags = segRef(data.word(kBackdrop)).ptr(kFlags, 0);
+void DreamGenContext::drawFlags() {
+ uint8 *mapFlags = getSegment(data.word(kBuffers)).ptr(kMapflags, 0);
+ const uint8 *mapData = getSegment(data.word(kMapdata)).ptr(kMap + data.byte(kMapy) * kMapwidth + data.byte(kMapx), 0);
+ const uint8 *backdropFlags = getSegment(data.word(kBackdrop)).ptr(kFlags, 0);
for (size_t i = 0; i < 10; ++i) {
for (size_t j = 0; j < 11; ++j) {
@@ -294,31 +290,32 @@ void DreamGenContext::drawflags() {
}
}
-void DreamGenContext::showallex() {
+void DreamGenContext::showAllEx() {
data.word(kListpos) = kExlist;
- memset(segRef(data.word(kBuffers)).ptr(kExlist, 100 * 5), 0xff, 100 * 5);
+ memset(getSegment(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));
+ DynObject *objects = (DynObject *)getSegment(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)
+ if (getMapAd(object->mapad) == 0)
continue;
- data.word(kCurrentframe) = 3 * data.byte(kCurrentex);
uint8 width, height;
- calcfrframe(&width, &height);
+ uint16 currentFrame = 3 * data.byte(kCurrentex);
+ calcFrFrame(currentFrame, &width, &height);
uint16 x, y;
- finalframe(&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));
+ assert(currentFrame < 256);
+ showFrame((Frame *)getSegment(data.word(kFrsegment)).ptr(0, 0), x + data.word(kMapadx), y + data.word(kMapady), currentFrame, 0);
+ ObjPos *objPos = (ObjPos *)getSegment(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);
@@ -329,5 +326,4 @@ void DreamGenContext::showallex() {
}
}
-} /*namespace dreamgen */
-
+} // End of namespace DreamGen
diff --git a/engines/dreamweb/detection.cpp b/engines/dreamweb/detection.cpp
index 0ac61a3ac2..ba7152beb5 100644
--- a/engines/dreamweb/detection.cpp
+++ b/engines/dreamweb/detection.cpp
@@ -40,7 +40,7 @@ public:
AdvancedMetaEngine(DreamWeb::gameDescriptions,
sizeof(DreamWeb::DreamWebGameDescription), dreamWebGames) {
_singleid = "dreamweb";
- _guioptions = Common::GUIO_NOMIDI;
+ _guioptions = GUIO1(GUIO_NOMIDI);
}
virtual const char *getName() const {
@@ -95,7 +95,7 @@ SaveStateList DreamWebMetaEngine::listSaves(const char *target) const {
Common::sort(files.begin(), files.end());
SaveStateList saveList;
- for(uint i = 0; i < files.size(); ++i) {
+ for (uint i = 0; i < files.size(); ++i) {
const Common::String &file = files[i];
Common::InSaveFile *stream = saveFileMan->openForLoading(file);
if (!stream)
diff --git a/engines/dreamweb/detection_tables.h b/engines/dreamweb/detection_tables.h
index 82fb6102e4..75f5786268 100644
--- a/engines/dreamweb/detection_tables.h
+++ b/engines/dreamweb/detection_tables.h
@@ -25,8 +25,6 @@
namespace DreamWeb {
-using Common::GUIO_NONE;
-
static const DreamWebGameDescription gameDescriptions[] = {
// International floppy release
{
@@ -41,7 +39,7 @@ static const DreamWebGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_UNSTABLE,
- GUIO_NONE
+ GUIO0()
},
},
@@ -58,7 +56,7 @@ static const DreamWebGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_CD | ADGF_UNSTABLE,
- GUIO_NONE
+ GUIO0()
},
},
@@ -75,7 +73,7 @@ static const DreamWebGameDescription gameDescriptions[] = {
Common::EN_USA,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
},
@@ -92,7 +90,7 @@ static const DreamWebGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_CD | ADGF_UNSTABLE,
- GUIO_NONE
+ GUIO0()
},
},
@@ -109,7 +107,7 @@ static const DreamWebGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_UNSTABLE,
- GUIO_NONE
+ GUIO0()
},
},
@@ -126,7 +124,7 @@ static const DreamWebGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_CD | ADGF_UNSTABLE,
- GUIO_NONE
+ GUIO0()
},
},
@@ -143,7 +141,7 @@ static const DreamWebGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_UNSTABLE,
- GUIO_NONE
+ GUIO0()
},
},
@@ -160,7 +158,7 @@ static const DreamWebGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_CD | ADGF_UNSTABLE,
- GUIO_NONE
+ GUIO0()
},
},
@@ -177,7 +175,7 @@ static const DreamWebGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_UNSTABLE,
- GUIO_NONE
+ GUIO0()
},
},
diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h
new file mode 100644
index 0000000000..3d5c9ce88b
--- /dev/null
+++ b/engines/dreamweb/dreambase.h
@@ -0,0 +1,217 @@
+/* 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 DREAMBASE_H
+#define DREAMBASE_H
+
+#include "common/scummsys.h"
+
+#include "dreamweb/segment.h"
+
+namespace DreamWeb {
+ class DreamWebEngine;
+}
+
+
+namespace DreamGen {
+
+/**
+ * This class is one of the parent classes of DreamGenContext. Its sole purpose
+ * is to allow us to incrementally move things out of DreamGenContext into this
+ * base class, as soon as they don't modify any context registers (ax, bx, cx, ...)
+ * anymore.
+ * Ultimately, DreamGenContext should be empty, at which point it can be removed
+ * together with class Context. When that happens, we can probably merge
+ * DreamBase into DreamWebEngine.
+ */
+class DreamBase : public SegmentManager {
+protected:
+ DreamWeb::DreamWebEngine *engine;
+
+public:
+ DreamBase(DreamWeb::DreamWebEngine *en) : engine(en) { }
+
+public:
+ // from monitor.cpp
+ void printOuterMon();
+ void showCurrentFile();
+ void accessLightOn();
+ void accessLightOff();
+ void turnOnPower();
+ void powerLightOn();
+ void powerLightOff();
+ void printLogo();
+ void scrollMonitor();
+ const char *monPrint(const char *string);
+ void lockLightOn();
+ void lockLightOff();
+
+ // from object.cpp
+ void obIcons();
+
+ // from pathfind.cpp
+ Common::Point _lineData[200]; // Output of Bresenham
+ void checkDest(const RoomPaths *roomsPaths);
+ RoomPaths *getRoomsPaths();
+ void faceRightWay();
+ void setWalk();
+ void autoSetWalk();
+ void findXYFromPath();
+ void bresenhams();
+ void workoutFrames();
+
+ // from print.cpp
+ uint8 getNextWord(const Frame *charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount);
+ void printChar(const Frame* charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height);
+ void printChar(const Frame* charSet, uint16 x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height);
+ void printBoth(const Frame* charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar);
+ uint8 printDirect(const uint8** string, uint16 x, uint16 *y, uint8 maxWidth, bool centered);
+ uint8 printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered);
+ uint8 getNumber(const Frame *charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16 *offset);
+ uint8 kernChars(uint8 firstChar, uint8 secondChar, uint8 width);
+ uint8 printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered);
+ uint16 waitFrames();
+ void printCurs();
+ void delCurs();
+
+ // from saveload.cpp
+ char _saveNames[17*7];
+ char _saveNamesOld[17*7];
+ void showNames();
+
+ // from sound.cpp
+ bool loadSpeech(byte type1, int idx1, byte type2, int idx2);
+ void volumeAdjust();
+ void cancelCh0();
+ void cancelCh1();
+ void loadRoomsSample();
+ void playChannel0(uint8 index, uint8 repeat);
+ void playChannel1(uint8 index);
+
+ // from sprite.cpp
+ Sprite *spriteTable();
+ Reel *getReelStart(uint16 reelPointer);
+ const Frame *findSource(uint16 &frame);
+ void showReelFrame(Reel *reel);
+ const Frame *getReelFrameAX(uint16 frame);
+ void soundOnReels(uint16 reelPointer);
+ void rollEndCredits();
+
+ // from stubs.cpp
+ void crosshair();
+ void showBlink();
+ void dumpBlink();
+ void dumpPointer();
+ void showPointer();
+ void delPointer();
+ void showRyanPage();
+ Frame *tempGraphics();
+ Frame *tempGraphics2();
+ Frame *tempGraphics3();
+ void showArrows();
+ void showOpBox();
+ void middlePanel();
+ void showDiary();
+ void readMouse();
+ uint16 readMouseState();
+ void hangOn(uint16 frameCount);
+ bool quitRequested();
+ void lockMon();
+ uint8 *textUnder();
+ void readKey();
+ void findOrMake(uint8 index, uint8 value, uint8 type);
+ DynObject *getFreeAd(uint8 index);
+ DynObject *getExAd(uint8 index);
+ DynObject *getEitherAdCPP();
+ void showWatch();
+ void showTime();
+ void showExit();
+ void showMan();
+ void panelIcons1();
+ SetObject *getSetAd(uint8 index);
+ void *getAnyAd(uint8 *value1, uint8 *value2);
+ const uint8 *getTextInFile1(uint16 index);
+
+ // from use.cpp
+ void placeFreeObject(uint8 index);
+ void removeFreeObject(uint8 index);
+
+ // from vgafades.cpp
+ uint8 *mainPalette();
+ uint8 *startPalette();
+ uint8 *endPalette();
+ void clearStartPal();
+ void clearEndPal();
+ void palToStartPal();
+ void endPalToStart();
+ void startPalToEnd();
+ void palToEndPal();
+ void fadeDOS();
+ void doFade();
+ void fadeCalculation();
+ void fadeScreenUp();
+ void fadeScreenUps();
+ void fadeScreenUpHalf();
+ void fadeScreenDown();
+ void fadeScreenDowns();
+ void greyscaleSum();
+ void allPalette();
+ void dumpCurrent();
+
+ // from vgagrafx.cpp
+ uint8 _workspace[(0x1000 + 2) * 16];
+ inline uint8 *workspace() { return _workspace; }
+ void clearWork();
+
+ uint8 *mapStore();
+ void panelToMap();
+ void mapToPanel();
+ void dumpMap();
+
+ void transferInv();
+
+ void multiGet(uint8 *dst, uint16 x, uint16 y, uint8 width, uint8 height);
+ void multiPut(const uint8 *src, uint16 x, uint16 y, uint8 width, uint8 height);
+ void multiDump(uint16 x, uint16 y, uint8 width, uint8 height);
+ void workToScreenCPP();
+ void printUnderMon();
+ void cls();
+ 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);
+ void doShake();
+ void vSync();
+ void setMode();
+ void showPCX(const Common::String &name);
+ void showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height);
+ void showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag);
+ void loadPalFromIFF();
+ void createPanel();
+ void createPanel2();
+ void showPanel();
+};
+
+
+} // End of namespace DreamGen
+
+#endif
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index a76a2697e3..6d3da6d0f2 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -22,47 +22,13 @@
*
*/
-
-
#include "dreamgen.h"
namespace DreamGen {
-void DreamGenContext::alleybarksound() {
- STACK_CHECK;
- ax = es.word(bx+3);
- _dec(ax);
- _cmp(ax, 0);
- if (!flags.z())
- goto nobark;
- push(bx);
- push(es);
- al = 14;
- playchannel1();
- es = pop();
- bx = pop();
- ax = 1000;
-nobark:
- es.word(bx+3) = ax;
-}
-
-void DreamGenContext::intromusic() {
- STACK_CHECK;
-}
-
-void DreamGenContext::foghornsound() {
- STACK_CHECK;
- randomnumber();
- _cmp(al, 198);
- if (!flags.z())
- return /* (nofog) */;
- al = 13;
- playchannel1();
-}
-
void DreamGenContext::receptionist() {
STACK_CHECK;
- checkspeed();
+ checkSpeed();
if (!flags.z())
goto gotrecep;
_cmp(data.byte(kCardpassflag), 1);
@@ -75,7 +41,7 @@ notsetcard:
_cmp(es.word(bx+3), 58);
if (!flags.z())
goto notdes1;
- randomnumber();
+ randomNumber();
_cmp(al, 30);
if (flags.c())
goto notdes2;
@@ -85,7 +51,7 @@ notdes1:
_cmp(es.word(bx+3), 60);
if (!flags.z())
goto notdes2;
- randomnumber();
+ randomNumber();
_cmp(al, 240);
if (flags.c())
goto gotrecep;
@@ -100,8 +66,8 @@ notdes2:
notendcard:
_inc(es.word(bx+3));
gotrecep:
- showgamereel();
- addtopeoplelist();
+ showGameReel();
+ addToPeopleList();
al = es.byte(bx+7);
_and(al, 128);
if (flags.z())
@@ -109,196 +75,15 @@ gotrecep:
data.byte(kTalkedtorecep) = 1;
}
-void DreamGenContext::smokebloke() {
- STACK_CHECK;
- _cmp(data.byte(kRockstardead), 0);
- if (!flags.z())
- goto notspokento;
- al = es.byte(bx+7);
- _and(al, 128);
- if (flags.z())
- goto notspokento;
- push(es);
- push(bx);
- al = 5;
- setlocation();
- bx = pop();
- es = pop();
-notspokento:
- checkspeed();
- if (!flags.z())
- goto gotsmokeb;
- _cmp(es.word(bx+3), 100);
- if (!flags.z())
- goto notsmokeb1;
- randomnumber();
- _cmp(al, 30);
- if (flags.c())
- goto notsmokeb2;
- es.word(bx+3) = 96;
- goto gotsmokeb;
-notsmokeb1:
- _cmp(es.word(bx+3), 117);
- if (!flags.z())
- goto notsmokeb2;
- es.word(bx+3) = 96;
- goto gotsmokeb;
-notsmokeb2:
- _inc(es.word(bx+3));
-gotsmokeb:
- showgamereel();
- addtopeoplelist();
-}
-
-void DreamGenContext::attendant() {
- STACK_CHECK;
- showgamereel();
- addtopeoplelist();
- al = es.byte(bx+7);
- _and(al, 128);
- if (flags.z())
- return /* (nottalked) */;
- data.byte(kTalkedtoattendant) = 1;
-}
-
-void DreamGenContext::manasleep() {
- STACK_CHECK;
- al = es.byte(bx+7);
- _and(al, 127);
- es.byte(bx+7) = al;
- showgamereel();
- addtopeoplelist();
-}
-
-void DreamGenContext::eden() {
- STACK_CHECK;
- _cmp(data.byte(kGeneraldead), 0);
- if (!flags.z())
- return /* (notinbed) */;
- showgamereel();
- addtopeoplelist();
-}
-
-void DreamGenContext::edeninbath() {
- STACK_CHECK;
- _cmp(data.byte(kGeneraldead), 0);
- if (flags.z())
- return /* (notinbath) */;
- _cmp(data.byte(kSartaindead), 0);
- if (!flags.z())
- return /* (notinbath) */;
- showgamereel();
- addtopeoplelist();
-}
-
-void DreamGenContext::malefan() {
- STACK_CHECK;
- showgamereel();
- addtopeoplelist();
-}
-
-void DreamGenContext::femalefan() {
- STACK_CHECK;
- showgamereel();
- addtopeoplelist();
-}
-
-void DreamGenContext::louis() {
- STACK_CHECK;
- _cmp(data.byte(kRockstardead), 0);
- if (!flags.z())
- return /* (notlouis1) */;
- showgamereel();
- addtopeoplelist();
-}
-
-void DreamGenContext::louischair() {
- STACK_CHECK;
- _cmp(data.byte(kRockstardead), 0);
- if (flags.z())
- return /* (notlouis2) */;
- checkspeed();
- if (!flags.z())
- goto notlouisanim;
- ax = es.word(bx+3);
- _inc(ax);
- _cmp(ax, 191);
- if (flags.z())
- goto restartlouis;
- _cmp(ax, 185);
- if (flags.z())
- goto randomlouis;
- es.word(bx+3) = ax;
- goto notlouisanim;
-randomlouis:
- es.word(bx+3) = ax;
- randomnumber();
- _cmp(al, 245);
- if (!flags.c())
- goto notlouisanim;
-restartlouis:
- ax = 182;
- es.word(bx+3) = ax;
-notlouisanim:
- showgamereel();
- addtopeoplelist();
-}
-
-void DreamGenContext::manasleep2() {
- STACK_CHECK;
- al = es.byte(bx+7);
- _and(al, 127);
- es.byte(bx+7) = al;
- showgamereel();
- addtopeoplelist();
-}
-
-void DreamGenContext::mansatstill() {
- STACK_CHECK;
- showgamereel();
- addtopeoplelist();
-}
-
-void DreamGenContext::tattooman() {
- STACK_CHECK;
- showgamereel();
- addtopeoplelist();
-}
-
-void DreamGenContext::drinker() {
- STACK_CHECK;
- checkspeed();
- if (!flags.z())
- goto gotdrinker;
- _inc(es.word(bx+3));
- _cmp(es.word(bx+3), 115);
- if (!flags.z())
- goto notdrinker1;
- es.word(bx+3) = 105;
- goto gotdrinker;
-notdrinker1:
- _cmp(es.word(bx+3), 106);
- if (!flags.z())
- goto gotdrinker;
- randomnumber();
- _cmp(al, 3);
- if (flags.c())
- goto gotdrinker;
- es.word(bx+3) = 105;
-gotdrinker:
- showgamereel();
- addtopeoplelist();
-}
-
void DreamGenContext::bartender() {
STACK_CHECK;
- checkspeed();
+ checkSpeed();
if (!flags.z())
goto gotsmoket;
_cmp(es.word(bx+3), 86);
if (!flags.z())
goto notsmoket1;
- randomnumber();
+ randomNumber();
_cmp(al, 18);
if (flags.c())
goto notsmoket2;
@@ -313,145 +98,13 @@ notsmoket1:
notsmoket2:
_inc(es.word(bx+3));
gotsmoket:
- showgamereel();
+ showGameReel();
_cmp(data.byte(kGunpassflag), 1);
if (!flags.z())
goto notgotgun;
es.byte(bx+7) = 9;
notgotgun:
- addtopeoplelist();
-}
-
-void DreamGenContext::othersmoker() {
- STACK_CHECK;
- showgamereel();
- addtopeoplelist();
-}
-
-void DreamGenContext::barwoman() {
- STACK_CHECK;
- showgamereel();
- addtopeoplelist();
-}
-
-void DreamGenContext::interviewer() {
- STACK_CHECK;
- _cmp(data.word(kReeltowatch), 68);
- if (!flags.z())
- goto notgeneralstart;
- _inc(es.word(bx+3));
-notgeneralstart:
- _cmp(es.word(bx+3), 250);
- if (flags.z())
- goto talking;
- checkspeed();
- if (!flags.z())
- goto talking;
- _cmp(es.word(bx+3), 259);
- if (flags.z())
- goto talking;
- _inc(es.word(bx+3));
-talking:
- showgamereel();
-}
-
-void DreamGenContext::soldier1() {
- STACK_CHECK;
- _cmp(es.word(bx+3), 0);
- if (flags.z())
- goto soldierwait;
- data.word(kWatchingtime) = 10;
- _cmp(es.word(bx+3), 30);
- if (!flags.z())
- goto notaftersshot;
- _inc(data.byte(kCombatcount));
- _cmp(data.byte(kCombatcount), 40);
- if (!flags.z())
- goto gotsoldframe;
- data.byte(kMandead) = 2;
- goto gotsoldframe;
-notaftersshot:
- checkspeed();
- if (!flags.z())
- goto gotsoldframe;
- _inc(es.word(bx+3));
- goto gotsoldframe;
-soldierwait:
- _cmp(data.byte(kLastweapon), 1);
- if (!flags.z())
- goto gotsoldframe;
- data.word(kWatchingtime) = 10;
- _cmp(data.byte(kManspath), 2);
- if (!flags.z())
- goto gotsoldframe;
- _cmp(data.byte(kFacing), 4);
- if (!flags.z())
- goto gotsoldframe;
- _inc(es.word(bx+3));
- data.byte(kLastweapon) = -1;
- data.byte(kCombatcount) = 0;
-gotsoldframe:
- showgamereel();
- addtopeoplelist();
-}
-
-void DreamGenContext::rockstar() {
- STACK_CHECK;
- ax = es.word(bx+3);
- _cmp(ax, 303);
- if (flags.z())
- goto rockcombatend;
- _cmp(ax, 118);
- if (flags.z())
- goto rockcombatend;
- checkspeed();
- if (!flags.z())
- goto rockspeed;
- ax = es.word(bx+3);
- _inc(ax);
- _cmp(ax, 118);
- if (!flags.z())
- goto notbeforedead;
- data.byte(kMandead) = 2;
- goto gotrockframe;
-notbeforedead:
- _cmp(ax, 79);
- if (!flags.z())
- goto gotrockframe;
- _dec(ax);
- _cmp(data.byte(kLastweapon), 1);
- if (!flags.z())
- goto notgunonrock;
- data.byte(kLastweapon) = -1;
- ax = 123;
- goto gotrockframe;
-notgunonrock:
- _inc(data.byte(kCombatcount));
- _cmp(data.byte(kCombatcount), 40);
- if (!flags.z())
- goto gotrockframe;
- data.byte(kCombatcount) = 0;
- ax = 79;
-gotrockframe:
- es.word(bx+3) = ax;
-rockspeed:
- showgamereel();
- _cmp(es.word(bx+3), 78);
- if (!flags.z())
- goto notalkrock;
- addtopeoplelist();
- data.byte(kPointermode) = 2;
- data.word(kWatchingtime) = 0;
- return;
-notalkrock:
- data.word(kWatchingtime) = 2;
- data.byte(kPointermode) = 0;
- al = data.byte(kMapy);
- es.byte(bx+2) = al;
- return;
-rockcombatend:
- data.byte(kNewlocation) = 45;
- showgamereel();
+ addToPeopleList();
}
void DreamGenContext::helicopter() {
@@ -460,7 +113,7 @@ void DreamGenContext::helicopter() {
_cmp(ax, 203);
if (flags.z())
goto heliwon;
- checkspeed();
+ checkSpeed();
if (!flags.z())
goto helispeed;
ax = es.word(bx+3);
@@ -498,7 +151,7 @@ notgunonheli:
gotheliframe:
es.word(bx+3) = ax;
helispeed:
- showgamereel();
+ showGameReel();
al = data.byte(kMapx);
es.byte(bx+1) = al;
ax = es.word(bx+3);
@@ -533,30 +186,30 @@ void DreamGenContext::mugger() {
goto havesetwatch;
data.word(kWatchingtime) = 175*2;
havesetwatch:
- checkspeed();
+ checkSpeed();
if (!flags.z())
goto notmugger;
_inc(es.word(bx+3));
notmugger:
- showgamereel();
+ showGameReel();
al = data.byte(kMapx);
es.byte(bx+1) = al;
return;
endmugger1:
push(es);
push(bx);
- createpanel2();
- showicon();
+ createPanel2();
+ showIcon();
al = 41;
- findpuztext();
+ findPuzText();
di = 33+20;
bx = 104;
dl = 241;
ah = 0;
- printdirect();
- worktoscreen();
+ printDirect();
+ workToScreen();
cx = 300;
- hangon();
+ hangOn();
bx = pop();
es = pop();
push(es);
@@ -564,43 +217,37 @@ endmugger1:
es.word(bx+3) = 140;
data.byte(kManspath) = 2;
data.byte(kFinaldest) = 2;
- findxyfrompath();
+ findXYFromPath();
data.byte(kResetmanxy) = 1;
al = 'W';
ah = 'E';
cl = 'T';
ch = 'A';
- findexobject();
+ findExObject();
data.byte(kCommand) = al;
data.byte(kObjecttype) = 4;
- removeobfrominv();
+ removeObFromInv();
al = 'W';
ah = 'E';
cl = 'T';
ch = 'B';
- findexobject();
+ findExObject();
data.byte(kCommand) = al;
data.byte(kObjecttype) = 4;
- removeobfrominv();
- makemainscreen();
+ removeObFromInv();
+ makeMainScreen();
al = 48;
bl = 68-32;
bh = 54+64;
cx = 70;
dx = 10;
- setuptimeduse();
+ setupTimedUse();
data.byte(kBeenmugged) = 1;
bx = pop();
es = pop();
}
-void DreamGenContext::aide() {
- STACK_CHECK;
- showgamereel();
- addtopeoplelist();
-}
-
-void DreamGenContext::businessman() {
+void DreamGenContext::businessMan() {
STACK_CHECK;
data.byte(kPointermode) = 0;
data.word(kWatchingtime) = 2;
@@ -616,7 +263,7 @@ void DreamGenContext::businessman() {
dx = 1;
bl = 68;
bh = 174;
- setuptimeduse();
+ setupTimedUse();
es = pop();
bx = pop();
ax = pop();
@@ -627,7 +274,7 @@ notfirstbiz:
_cmp(ax, 49);
if (flags.z())
return /* (buscombatend) */;
- checkspeed();
+ checkSpeed();
if (!flags.z())
goto busspeed;
ax = es.word(bx+3);
@@ -664,16 +311,16 @@ buscombatwon:
push(bx);
push(es);
al = 0;
- turnpathon();
+ turnPathOn();
al = 1;
- turnpathon();
+ turnPathOn();
al = 2;
- turnpathon();
+ turnPathOn();
al = 3;
- turnpathoff();
+ turnPathOff();
data.byte(kManspath) = 5;
data.byte(kFinaldest) = 5;
- findxyfrompath();
+ findXYFromPath();
data.byte(kResetmanxy) = 1;
es = pop();
bx = pop();
@@ -682,7 +329,7 @@ buscombatwon:
gotbusframe:
es.word(bx+3) = ax;
busspeed:
- showgamereel();
+ showGameReel();
al = data.byte(kMapy);
es.byte(bx+2) = al;
ax = es.word(bx+3);
@@ -697,7 +344,7 @@ buscombatwonend:
data.word(kWatchingtime) = 0;
}
-void DreamGenContext::poolguard() {
+void DreamGenContext::poolGuard() {
STACK_CHECK;
ax = es.word(bx+3);
_cmp(ax, 214);
@@ -713,9 +360,9 @@ void DreamGenContext::poolguard() {
if (!flags.z())
goto notfirstpool;
al = 0;
- turnpathon();
+ turnPathOn();
notfirstpool:
- checkspeed();
+ checkSpeed();
if (!flags.z())
goto guardspeed;
ax = es.word(bx+3);
@@ -759,7 +406,7 @@ notgunonpool:
gotguardframe:
es.word(bx+3) = ax;
guardspeed:
- showgamereel();
+ showGameReel();
ax = es.word(bx+3);
_cmp(ax, 121);
if (flags.z())
@@ -778,12 +425,12 @@ combatover1:
data.word(kWatchingtime) = 0;
data.byte(kPointermode) = 0;
al = 0;
- turnpathon();
+ turnPathOn();
al = 1;
- turnpathoff();
+ turnPathOff();
return;
combatover2:
- showgamereel();
+ showGameReel();
data.word(kWatchingtime) = 2;
data.byte(kPointermode) = 0;
_inc(data.byte(kCombatcount));
@@ -794,40 +441,6 @@ combatover2:
data.byte(kMandead) = 2;
}
-void DreamGenContext::security() {
- STACK_CHECK;
- _cmp(es.word(bx+3), 32);
- if (flags.z())
- goto securwait;
- _cmp(es.word(bx+3), 69);
- if (!flags.z())
- goto notaftersec;
- return;
-notaftersec:
- data.word(kWatchingtime) = 10;
- checkspeed();
- if (!flags.z())
- goto gotsecurframe;
- _inc(es.word(bx+3));
- goto gotsecurframe;
-securwait:
- _cmp(data.byte(kLastweapon), 1);
- if (!flags.z())
- goto gotsecurframe;
- data.word(kWatchingtime) = 10;
- _cmp(data.byte(kManspath), 9);
- if (!flags.z())
- goto gotsecurframe;
- _cmp(data.byte(kFacing), 0);
- if (!flags.z())
- goto gotsecurframe;
- data.byte(kLastweapon) = -1;
- _inc(es.word(bx+3));
-gotsecurframe:
- showgamereel();
- addtopeoplelist();
-}
-
void DreamGenContext::heavy() {
STACK_CHECK;
al = es.byte(bx+7);
@@ -847,7 +460,7 @@ void DreamGenContext::heavy() {
data.byte(kMandead) = 2;
goto gotheavyframe;
notafterhshot:
- checkspeed();
+ checkSpeed();
if (!flags.z())
goto gotheavyframe;
_inc(es.word(bx+3));
@@ -866,650 +479,13 @@ heavywait:
_inc(es.word(bx+3));
data.byte(kCombatcount) = 0;
gotheavyframe:
- showgamereel();
- addtopeoplelist();
-}
-
-void DreamGenContext::bossman() {
- STACK_CHECK;
- checkspeed();
- if (!flags.z())
- goto notboss;
- ax = es.word(bx+3);
- _inc(ax);
- _cmp(ax, 4);
- if (flags.z())
- goto firstdes;
- _cmp(ax, 20);
- if (flags.z())
- goto secdes;
- _cmp(ax, 41);
- if (!flags.z())
- goto gotallboss;
- ax = 0;
- _inc(data.byte(kGunpassflag));
- es.byte(bx+7) = 10;
- goto gotallboss;
-firstdes:
- _cmp(data.byte(kGunpassflag), 1);
- if (flags.z())
- goto gotallboss;
- push(ax);
- randomnumber();
- cl = al;
- ax = pop();
- _cmp(cl, 10);
- if (flags.c())
- goto gotallboss;
- ax = 0;
- goto gotallboss;
-secdes:
- _cmp(data.byte(kGunpassflag), 1);
- if (flags.z())
- goto gotallboss;
- ax = 0;
-gotallboss:
- es.word(bx+3) = ax;
-notboss:
- showgamereel();
- addtopeoplelist();
- al = es.byte(bx+7);
- _and(al, 128);
- if (flags.z())
- return /* (nottalkedboss) */;
- data.byte(kTalkedtoboss) = 1;
-}
-
-void DreamGenContext::gamer() {
- STACK_CHECK;
- checkspeed();
- if (!flags.z())
- goto gamerfin;
-gameragain:
- randomnum1();
- _and(al, 7);
- _cmp(al, 5);
- if (!flags.c())
- goto gameragain;
- _add(al, 20);
- _cmp(al, es.byte(bx+3));
- if (flags.z())
- goto gameragain;
- ah = 0;
- es.word(bx+3) = ax;
-gamerfin:
- showgamereel();
- addtopeoplelist();
-}
-
-void DreamGenContext::sparkydrip() {
- STACK_CHECK;
- checkspeed();
- if (!flags.z())
- return /* (cantdrip) */;
- al = 14;
- ah = 0;
- playchannel0();
-}
-
-void DreamGenContext::carparkdrip() {
- STACK_CHECK;
- checkspeed();
- if (!flags.z())
- return /* (cantdrip2) */;
- al = 14;
- playchannel1();
-}
-
-void DreamGenContext::keeper() {
- STACK_CHECK;
- _cmp(data.byte(kKeeperflag), 0);
- if (!flags.z())
- goto notwaiting;
- _cmp(data.word(kReeltowatch), 190);
- if (flags.c())
- return /* (waiting) */;
- _inc(data.byte(kKeeperflag));
- ah = es.byte(bx+7);
- _and(ah, 127);
- _cmp(ah, data.byte(kDreamnumber));
- if (flags.z())
- return /* (notdiff) */;
- al = data.byte(kDreamnumber);
- es.byte(bx+7) = al;
- return;
-notwaiting:
- addtopeoplelist();
- showgamereel();
-}
-
-void DreamGenContext::candles1() {
- STACK_CHECK;
- checkspeed();
- if (!flags.z())
- goto candle1;
- ax = es.word(bx+3);
- _inc(ax);
- _cmp(ax, 44);
- if (!flags.z())
- goto notendcandle1;
- ax = 39;
-notendcandle1:
- es.word(bx+3) = ax;
-candle1:
- showgamereel();
-}
-
-void DreamGenContext::smallcandle() {
- STACK_CHECK;
- checkspeed();
- if (!flags.z())
- goto smallcandlef;
- ax = es.word(bx+3);
- _inc(ax);
- _cmp(ax, 37);
- if (!flags.z())
- goto notendsmallcandle;
- ax = 25;
-notendsmallcandle:
- es.word(bx+3) = ax;
-smallcandlef:
- showgamereel();
-}
-
-void DreamGenContext::intromagic1() {
- STACK_CHECK;
- checkspeed();
- if (!flags.z())
- goto introm1fin;
- ax = es.word(bx+3);
- _inc(ax);
- _cmp(ax, 145);
- if (!flags.z())
- goto gotintrom1;
- ax = 121;
-gotintrom1:
- es.word(bx+3) = ax;
- _cmp(ax, 121);
- if (!flags.z())
- goto introm1fin;
- _inc(data.byte(kIntrocount));
- push(es);
- push(bx);
- intro1text();
- bx = pop();
- es = pop();
- _cmp(data.byte(kIntrocount), 8);
- if (!flags.z())
- goto introm1fin;
- _add(data.byte(kMapy), 10);
- data.byte(kNowinnewroom) = 1;
-introm1fin:
- showgamereel();
-}
-
-void DreamGenContext::candles() {
- STACK_CHECK;
- checkspeed();
- if (!flags.z())
- goto candlesfin;
- ax = es.word(bx+3);
- _inc(ax);
- _cmp(ax, 167);
- if (!flags.z())
- goto gotcandles;
- ax = 162;
-gotcandles:
- es.word(bx+3) = ax;
-candlesfin:
- showgamereel();
-}
-
-void DreamGenContext::candles2() {
- STACK_CHECK;
- checkspeed();
- if (!flags.z())
- goto candles2fin;
- ax = es.word(bx+3);
- _inc(ax);
- _cmp(ax, 238);
- if (!flags.z())
- goto gotcandles2;
- ax = 233;
-gotcandles2:
- es.word(bx+3) = ax;
-candles2fin:
- showgamereel();
-}
-
-void DreamGenContext::gates() {
- STACK_CHECK;
- checkspeed();
- if (!flags.z())
- goto gatesfin;
- ax = es.word(bx+3);
- _inc(ax);
- _cmp(ax, 116);
- if (!flags.z())
- goto notbang;
- push(ax);
- push(bx);
- push(es);
- al = 17;
- playchannel1();
- es = pop();
- bx = pop();
- ax = pop();
-notbang:
- _cmp(ax, 110);
- if (flags.c())
- goto slowgates;
- es.byte(bx+5) = 2;
-slowgates:
- _cmp(ax, 120);
- if (!flags.z())
- goto gotgates;
- data.byte(kGetback) = 1;
- ax = 119;
-gotgates:
- es.word(bx+3) = ax;
- push(es);
- push(bx);
- intro3text();
- bx = pop();
- es = pop();
-gatesfin:
- showgamereel();
-}
-
-void DreamGenContext::intromagic2() {
- STACK_CHECK;
- checkspeed();
- if (!flags.z())
- goto introm2fin;
- ax = es.word(bx+3);
- _inc(ax);
- _cmp(ax, 216);
- if (!flags.z())
- goto gotintrom2;
- ax = 192;
-gotintrom2:
- es.word(bx+3) = ax;
-introm2fin:
- showgamereel();
-}
-
-void DreamGenContext::intromagic3() {
- STACK_CHECK;
- checkspeed();
- if (!flags.z())
- goto introm3fin;
- ax = es.word(bx+3);
- _inc(ax);
- _cmp(ax, 218);
- if (!flags.z())
- goto gotintrom3;
- data.byte(kGetback) = 1;
-gotintrom3:
- es.word(bx+3) = ax;
-introm3fin:
- showgamereel();
- al = data.byte(kMapx);
- es.byte(bx+1) = al;
-}
-
-void DreamGenContext::intromonks1() {
- STACK_CHECK;
- checkspeed();
- if (!flags.z())
- goto intromonk1fin;
- ax = es.word(bx+3);
- _inc(ax);
- _cmp(ax, 80);
- if (!flags.z())
- goto notendmonk1;
- _add(data.byte(kMapy), 10);
- data.byte(kNowinnewroom) = 1;
- showgamereel();
- return;
-notendmonk1:
- _cmp(ax, 30);
- if (!flags.z())
- goto gotintromonk1;
- _sub(data.byte(kMapy), 10);
- data.byte(kNowinnewroom) = 1;
- ax = 51;
-gotintromonk1:
- es.word(bx+3) = ax;
- _cmp(ax, 5);
- if (flags.z())
- goto waitstep;
- _cmp(ax, 15);
- if (flags.z())
- goto waitstep;
- _cmp(ax, 25);
- if (flags.z())
- goto waitstep;
- _cmp(ax, 61);
- if (flags.z())
- goto waitstep;
- _cmp(ax, 71);
- if (flags.z())
- goto waitstep;
- goto intromonk1fin;
-waitstep:
- push(es);
- push(bx);
- intro2text();
- bx = pop();
- es = pop();
- es.byte(bx+6) = -20;
-intromonk1fin:
- showgamereel();
- al = data.byte(kMapy);
- es.byte(bx+2) = al;
-}
-
-void DreamGenContext::intromonks2() {
- STACK_CHECK;
- checkspeed();
- if (!flags.z())
- goto intromonk2fin;
- ax = es.word(bx+3);
- _inc(ax);
- _cmp(ax, 87);
- if (!flags.z())
- goto nottalk1;
- _inc(data.byte(kIntrocount));
- push(es);
- push(bx);
- monks2text();
- bx = pop();
- es = pop();
- _cmp(data.byte(kIntrocount), 19);
- if (!flags.z())
- goto notlasttalk1;
- ax = 87;
- goto gotintromonk2;
-notlasttalk1:
- ax = 74;
- goto gotintromonk2;
-nottalk1:
- _cmp(ax, 110);
- if (!flags.z())
- goto notraisearm;
- _inc(data.byte(kIntrocount));
- push(es);
- push(bx);
- monks2text();
- bx = pop();
- es = pop();
- _cmp(data.byte(kIntrocount), 35);
- if (!flags.z())
- goto notlastraise;
- ax = 111;
- goto gotintromonk2;
-notlastraise:
- ax = 98;
- goto gotintromonk2;
-notraisearm:
- _cmp(ax, 176);
- if (!flags.z())
- goto notendmonk2;
- data.byte(kGetback) = 1;
- goto gotintromonk2;
-notendmonk2:
- _cmp(ax, 125);
- if (!flags.z())
- goto gotintromonk2;
- ax = 140;
-gotintromonk2:
- es.word(bx+3) = ax;
-intromonk2fin:
- showgamereel();
-}
-
-void DreamGenContext::handclap() {
- STACK_CHECK;
-}
-
-void DreamGenContext::monks2text() {
- STACK_CHECK;
- _cmp(data.byte(kIntrocount), 1);
- if (!flags.z())
- goto notmonk2text1;
- al = 8;
- bl = 36;
- bh = 160;
- cx = 100;
- goto gotmonks2text;
-notmonk2text1:
- _cmp(data.byte(kIntrocount), 4);
- if (!flags.z())
- goto notmonk2text2;
- al = 9;
- bl = 36;
- bh = 160;
- cx = 100;
- goto gotmonks2text;
-notmonk2text2:
- _cmp(data.byte(kIntrocount), 7);
- if (!flags.z())
- goto notmonk2text3;
- al = 10;
- bl = 36;
- bh = 160;
- cx = 100;
- goto gotmonks2text;
-notmonk2text3:
- _cmp(data.byte(kIntrocount), 10);
- if (!flags.z())
- goto notmonk2text4;
- data.byte(kIntrocount) = 12;
- al = 11;
- bl = 0;
- bh = 105;
- cx = 100;
- goto gotmonks2text;
-notmonk2text4:
- _cmp(data.byte(kIntrocount), 13);
- if (!flags.z())
- goto notmonk2text5;
- data.byte(kIntrocount) = 17;
- return;
- al = 12;
- bl = 0;
- bh = 120;
- cx = 100;
- goto gotmonks2text;
-notmonk2text5:
- _cmp(data.byte(kIntrocount), 16);
- if (!flags.z())
- goto notmonk2text6;
- al = 13;
- bl = 0;
- bh = 135;
- cx = 100;
- goto gotmonks2text;
-notmonk2text6:
- _cmp(data.byte(kIntrocount), 19);
- if (!flags.z())
- goto notmonk2text7;
- al = 14;
- bl = 36;
- bh = 160;
- cx = 100;
- dx = 1;
- ah = 82;
- { setuptimedtemp(); return; };
-notmonk2text7:
- _cmp(data.byte(kIntrocount), 22);
- if (!flags.z())
- goto notmonk2text8;
- al = 15;
- bl = 36;
- bh = 160;
- cx = 100;
- goto gotmonks2text;
-notmonk2text8:
- _cmp(data.byte(kIntrocount), 25);
- if (!flags.z())
- goto notmonk2text9;
- al = 16;
- bl = 36;
- bh = 160;
- cx = 100;
- goto gotmonks2text;
-notmonk2text9:
- _cmp(data.byte(kIntrocount), 27);
- if (!flags.z())
- goto notmonk2text10;
- al = 17;
- bl = 36;
- bh = 160;
- cx = 100;
- goto gotmonks2text;
-notmonk2text10:
- _cmp(data.byte(kIntrocount), 31);
- if (!flags.z())
- return /* (notmonk2text11) */;
- al = 18;
- bl = 36;
- bh = 160;
- cx = 100;
- goto gotmonks2text;
- return;
-gotmonks2text:
- dx = 1;
- cx = 120;
- ah = 82;
- setuptimedtemp();
-}
-
-void DreamGenContext::intro1text() {
- STACK_CHECK;
- _cmp(data.byte(kIntrocount), 2);
- if (!flags.z())
- goto notintro1text1;
- al = 40;
- bl = 34;
- bh = 130;
- cx = 90;
- goto gotintro1text;
-notintro1text1:
- _cmp(data.byte(kIntrocount), 4);
- if (!flags.z())
- goto notintro1text2;
- al = 41;
- bl = 34;
- bh = 130;
- cx = 90;
- goto gotintro1text;
-notintro1text2:
- _cmp(data.byte(kIntrocount), 6);
- if (!flags.z())
- return /* (notintro1text3) */;
- al = 42;
- bl = 34;
- bh = 130;
- cx = 90;
- goto gotintro1text;
- return;
-gotintro1text:
- dx = 1;
- ah = 82;
- _cmp(data.byte(kCh1playing), 255);
- if (flags.z())
- goto oktalk2;
- _dec(data.byte(kIntrocount));
- return;
-oktalk2:
- setuptimedtemp();
-}
-
-void DreamGenContext::intro2text() {
- STACK_CHECK;
- _cmp(ax, 5);
- if (!flags.z())
- goto notintro2text1;
- al = 43;
- bl = 34;
- bh = 40;
- cx = 90;
- goto gotintro2text;
-notintro2text1:
- _cmp(ax, 15);
- if (!flags.z())
- return /* (notintro2text2) */;
- al = 44;
- bl = 34;
- bh = 40;
- cx = 90;
- goto gotintro2text;
- return;
-gotintro2text:
- dx = 1;
- ah = 82;
- setuptimedtemp();
-}
-
-void DreamGenContext::intro3text() {
- STACK_CHECK;
- _cmp(ax, 107);
- if (!flags.z())
- goto notintro3text1;
- al = 45;
- bl = 36;
- bh = 56;
- cx = 100;
- goto gotintro3text;
-notintro3text1:
- _cmp(ax, 108);
- if (!flags.z())
- return /* (notintro3text2) */;
- al = 46;
- bl = 36;
- bh = 56;
- cx = 100;
- goto gotintro3text;
- return;
-gotintro3text:
- dx = 1;
- ah = 82;
- setuptimedtemp();
-}
-
-void DreamGenContext::monkandryan() {
- STACK_CHECK;
- checkspeed();
- if (!flags.z())
- goto notmonkryan;
- ax = es.word(bx+3);
- _inc(ax);
- _cmp(ax, 83);
- if (!flags.z())
- goto gotmonkryan;
- _inc(data.byte(kIntrocount));
- push(es);
- push(bx);
- textformonk();
- bx = pop();
- es = pop();
- ax = 77;
- _cmp(data.byte(kIntrocount), 57);
- if (!flags.z())
- goto gotmonkryan;
- data.byte(kGetback) = 1;
- return;
-gotmonkryan:
- es.word(bx+3) = ax;
-notmonkryan:
- showgamereel();
+ showGameReel();
+ addToPeopleList();
}
-void DreamGenContext::endgameseq() {
+void DreamGenContext::endGameSeq() {
STACK_CHECK;
- checkspeed();
+ checkSpeed();
if (!flags.z())
goto notendseq;
ax = es.word(bx+3);
@@ -1523,7 +499,7 @@ void DreamGenContext::endgameseq() {
_inc(data.byte(kIntrocount));
push(es);
push(bx);
- textforend();
+ textForEnd();
bx = pop();
es = pop();
ax = 50;
@@ -1535,7 +511,7 @@ gotendseq:
push(es);
push(bx);
push(ax);
- fadescreendownhalf();
+ fadeScreenDownHalf();
ax = pop();
bx = pop();
es = pop();
@@ -1547,7 +523,7 @@ notfadedown:
push(es);
push(bx);
push(ax);
- fadescreendowns();
+ fadeScreenDowns();
data.byte(kVolumeto) = 7;
data.byte(kVolumedirection) = 1;
ax = pop();
@@ -1559,7 +535,7 @@ notfadeend:
goto notendseq;
data.byte(kGetback) = 1;
notendseq:
- showgamereel();
+ showGameReel();
al = data.byte(kMapy);
es.byte(bx+2) = al;
ax = es.word(bx+3);
@@ -1567,496 +543,16 @@ notendseq:
if (!flags.z())
return /* (notendcreds) */;
es.word(bx+3) = 146;
- rollendcredits();
-}
-
-void DreamGenContext::rollendcredits() {
- STACK_CHECK;
- al = 16;
- ah = 255;
- playchannel0();
- data.byte(kVolume) = 7;
- data.byte(kVolumeto) = 0;
- data.byte(kVolumedirection) = -1;
- cl = 160;
- ch = 160;
- di = 75;
- bx = 20;
- ds = data.word(kMapstore);
- si = 0;
- multiget();
- es = data.word(kTextfile1);
- si = 3*2;
- ax = es.word(si);
- si = ax;
- _add(si, (66*2));
- cx = 254;
-endcredits1:
- push(cx);
- bx = 10;
- cx = data.word(kLinespacing);
-endcredits2:
- push(cx);
- push(si);
- push(di);
- push(es);
- push(bx);
- vsync();
- cl = 160;
- ch = 160;
- di = 75;
- bx = 20;
- ds = data.word(kMapstore);
- si = 0;
- multiput();
- vsync();
- bx = pop();
- es = pop();
- di = pop();
- si = pop();
- push(si);
- push(di);
- push(es);
- push(bx);
- cx = 18;
-onelot:
- push(cx);
- di = 75;
- dx = 161;
- ax = 0;
- printdirect();
- _add(bx, data.word(kLinespacing));
- cx = pop();
- if (--cx)
- goto onelot;
- vsync();
- cl = 160;
- ch = 160;
- di = 75;
- bx = 20;
- multidump();
- bx = pop();
- es = pop();
- di = pop();
- si = pop();
- cx = pop();
- _dec(bx);
- if (--cx)
- goto endcredits2;
- cx = pop();
-looknext:
- al = es.byte(si);
- _inc(si);
- _cmp(al, ':');
- if (flags.z())
- goto gotnext;
- _cmp(al, 0);
- if (flags.z())
- goto gotnext;
- goto looknext;
-gotnext:
- if (--cx)
- goto endcredits1;
- cx = 100;
- hangon();
- paneltomap();
- fadescreenuphalf();
-}
-
-void DreamGenContext::priest() {
- STACK_CHECK;
- _cmp(es.word(bx+3), 8);
- if (flags.z())
- return /* (priestspoken) */;
- data.byte(kPointermode) = 0;
- data.word(kWatchingtime) = 2;
- checkspeed();
- if (!flags.z())
- return /* (priestwait) */;
- _inc(es.word(bx+3));
- push(es);
- push(bx);
- priesttext();
- bx = pop();
- es = pop();
-}
-
-void DreamGenContext::madmanstelly() {
- STACK_CHECK;
- ax = es.word(bx+3);
- _inc(ax);
- _cmp(ax, 307);
- if (!flags.z())
- goto notendtelly;
- ax = 300;
-notendtelly:
- es.word(bx+3) = ax;
- showgamereel();
-}
-
-void DreamGenContext::priesttext() {
- STACK_CHECK;
- _cmp(es.word(bx+3), 2);
- if (flags.c())
- return /* (nopriesttext) */;
- _cmp(es.word(bx+3), 7);
- if (!flags.c())
- return /* (nopriesttext) */;
- al = es.byte(bx+3);
- _and(al, 1);
- if (!flags.z())
- return /* (nopriesttext) */;
- al = es.byte(bx+3);
- _shr(al, 1);
- _add(al, 50);
- bl = 72;
- bh = 80;
- cx = 54;
- dx = 1;
- setuptimeduse();
-}
-
-void DreamGenContext::textforend() {
- STACK_CHECK;
- _cmp(data.byte(kIntrocount), 20);
- if (!flags.z())
- goto notendtext1;
- al = 0;
- bl = 34;
- bh = 20;
- cx = 60;
- goto gotendtext;
-notendtext1:
- _cmp(data.byte(kIntrocount), 50);
- if (!flags.z())
- goto notendtext2;
- al = 1;
- bl = 34;
- bh = 20;
- cx = 60;
- goto gotendtext;
-notendtext2:
- _cmp(data.byte(kIntrocount), 85);
- if (!flags.z())
- return /* (notendtext3) */;
- al = 2;
- bl = 34;
- bh = 20;
- cx = 60;
- goto gotendtext;
- return;
-gotendtext:
- dx = 1;
- ah = 83;
- setuptimedtemp();
+ rollEndCredits();
}
-void DreamGenContext::textformonk() {
- STACK_CHECK;
- _cmp(data.byte(kIntrocount), 1);
- if (!flags.z())
- goto notmonktext1;
- al = 19;
- bl = 68;
- bh = 154;
- cx = 120;
- goto gotmonktext;
-notmonktext1:
- _cmp(data.byte(kIntrocount), 5);
- if (!flags.z())
- goto notmonktext2;
- al = 20;
- bl = 68;
- bh = 38;
- cx = 120;
- goto gotmonktext;
-notmonktext2:
- _cmp(data.byte(kIntrocount), 9);
- if (!flags.z())
- goto notmonktext3;
- al = 21;
- bl = 48;
- bh = 154;
- cx = 120;
- goto gotmonktext;
-notmonktext3:
- _cmp(data.byte(kIntrocount), 13);
- if (!flags.z())
- goto notmonktext4;
- al = 22;
- bl = 68;
- bh = 38;
- cx = 120;
- goto gotmonktext;
-notmonktext4:
- _cmp(data.byte(kIntrocount), 15);
- if (!flags.z())
- goto notmonktext5;
- al = 23;
- bl = 68;
- bh = 154;
- cx = 120;
- goto gotmonktext;
-notmonktext5:
- _cmp(data.byte(kIntrocount), 21);
- if (!flags.z())
- goto notmonktext6;
- al = 24;
- bl = 68;
- bh = 38;
- cx = 120;
- goto gotmonktext;
-notmonktext6:
- _cmp(data.byte(kIntrocount), 25);
- if (!flags.z())
- goto notmonktext7;
- al = 25;
- bl = 68;
- bh = 154;
- cx = 120;
- goto gotmonktext;
-notmonktext7:
- _cmp(data.byte(kIntrocount), 29);
- if (!flags.z())
- goto notmonktext8;
- al = 26;
- bl = 68;
- bh = 38;
- cx = 120;
- goto gotmonktext;
-notmonktext8:
- _cmp(data.byte(kIntrocount), 33);
- if (!flags.z())
- goto notmonktext9;
- al = 27;
- bl = 68;
- bh = 154;
- cx = 120;
- goto gotmonktext;
-notmonktext9:
- _cmp(data.byte(kIntrocount), 37);
- if (!flags.z())
- goto notmonktext10;
- al = 28;
- bl = 68;
- bh = 154;
- cx = 120;
- goto gotmonktext;
-notmonktext10:
- _cmp(data.byte(kIntrocount), 41);
- if (!flags.z())
- goto notmonktext11;
- al = 29;
- bl = 68;
- bh = 38;
- cx = 120;
- goto gotmonktext;
-notmonktext11:
- _cmp(data.byte(kIntrocount), 45);
- if (!flags.z())
- goto notmonktext12;
- al = 30;
- bl = 68;
- bh = 154;
- cx = 120;
- goto gotmonktext;
-notmonktext12:
- _cmp(data.byte(kIntrocount), 52);
- if (!flags.z())
- goto notmonktext13;
- al = 31;
- bl = 68;
- bh = 154;
- cx = 220;
- goto gotmonktext;
-notmonktext13:
- _cmp(data.byte(kIntrocount), 53);
- if (!flags.z())
- return /* (notendtitles) */;
- fadescreendowns();
- data.byte(kVolumeto) = 7;
- data.byte(kVolumedirection) = 1;
- return;
-gotmonktext:
- dx = 1;
- ah = 82;
- _cmp(data.byte(kCh1playing), 255);
- if (flags.z())
- goto oktalk;
- _dec(data.byte(kIntrocount));
- return;
-oktalk:
- setuptimedtemp();
-}
-
-void DreamGenContext::drunk() {
- STACK_CHECK;
- _cmp(data.byte(kGeneraldead), 0);
- if (!flags.z())
- return /* (trampgone) */;
- al = es.byte(bx+7);
- _and(al, 127);
- es.byte(bx+7) = al;
- showgamereel();
- addtopeoplelist();
-}
-
-void DreamGenContext::advisor() {
- STACK_CHECK;
- checkspeed();
- if (!flags.z())
- goto noadvisor;
- goto noadvisor;
- ax = es.word(bx+3);
- _inc(ax);
- _cmp(ax, 123);
- if (!flags.z())
- goto notendadvis;
- ax = 106;
- goto gotadvframe;
-notendadvis:
- _cmp(ax, 108);
- if (!flags.z())
- goto gotadvframe;
- push(ax);
- randomnumber();
- cl = al;
- ax = pop();
- _cmp(cl, 3);
- if (flags.c())
- goto gotadvframe;
- ax = 106;
-gotadvframe:
- es.word(bx+3) = ax;
-noadvisor:
- showgamereel();
- addtopeoplelist();
-}
-
-void DreamGenContext::copper() {
- STACK_CHECK;
- checkspeed();
- if (!flags.z())
- goto nocopper;
- ax = es.word(bx+3);
- _inc(ax);
- _cmp(ax, 94);
- if (!flags.z())
- goto notendcopper;
- ax = 64;
- goto gotcopframe;
-notendcopper:
- _cmp(ax, 81);
- if (flags.z())
- goto mightwait;
- _cmp(ax, 66);
- if (!flags.z())
- goto gotcopframe;
-mightwait:
- push(ax);
- randomnumber();
- cl = al;
- ax = pop();
- _cmp(cl, 7);
- if (flags.c())
- goto gotcopframe;
- _dec(ax);
-gotcopframe:
- es.word(bx+3) = ax;
-nocopper:
- showgamereel();
- addtopeoplelist();
-}
-
-void DreamGenContext::sparky() {
- STACK_CHECK;
- _cmp(data.word(kCard1money), 0);
- if (flags.z())
- goto animsparky;
- es.byte(bx+7) = 3;
- goto animsparky;
-animsparky:
- checkspeed();
- if (!flags.z())
- goto finishsparky;
- _cmp(es.word(bx+3), 34);
- if (!flags.z())
- goto notsparky1;
- randomnumber();
- _cmp(al, 30);
- if (flags.c())
- goto dosparky;
- es.word(bx+3) = 27;
- goto finishsparky;
-notsparky1:
- _cmp(es.word(bx+3), 48);
- if (!flags.z())
- goto dosparky;
- es.word(bx+3) = 27;
- goto finishsparky;
-dosparky:
- _inc(es.word(bx+3));
-finishsparky:
- showgamereel();
- addtopeoplelist();
- al = es.byte(bx+7);
- _and(al, 128);
- if (flags.z())
- return /* (nottalkedsparky) */;
- data.byte(kTalkedtosparky) = 1;
-}
-
-void DreamGenContext::train() {
- STACK_CHECK;
- return;
- ax = es.word(bx+3);
- _cmp(ax, 21);
- if (!flags.c())
- goto notrainyet;
- _inc(ax);
- goto gottrainframe;
-notrainyet:
- randomnumber();
- _cmp(al, 253);
- if (flags.c())
- return /* (notrainatall) */;
- _cmp(data.byte(kManspath), 5);
- if (!flags.z())
- return /* (notrainatall) */;
- _cmp(data.byte(kFinaldest), 5);
- if (!flags.z())
- return /* (notrainatall) */;
- ax = 5;
-gottrainframe:
- es.word(bx+3) = ax;
- showgamereel();
-}
-
-void DreamGenContext::checkspeed() {
- STACK_CHECK;
- _cmp(data.byte(kLastweapon), -1);
- if (!flags.z())
- goto forcenext;
- _inc(es.byte(bx+6));
- al = es.byte(bx+6);
- _cmp(al, es.byte(bx+5));
- if (!flags.z())
- return /* (notspeed) */;
- al = 0;
- es.byte(bx+6) = al;
- _cmp(al, al);
- return;
-forcenext:
- _cmp(al, al);
-}
-
-void DreamGenContext::checkforexit() {
+void DreamGenContext::checkForExit() {
STACK_CHECK;
cl = data.byte(kRyanx);
_add(cl, 12);
ch = data.byte(kRyany);
_add(ch, 12);
- checkone();
+ checkOne();
data.byte(kLastflag) = cl;
data.byte(kLastflagex) = ch;
data.byte(kFlagx) = dl;
@@ -2083,7 +579,7 @@ notnewdirect:
ah = 'E';
cl = 'T';
ch = 'A';
- isryanholding();
+ isRyanHolding();
bx = pop();
if (flags.z())
goto noshoe1;
@@ -2094,7 +590,7 @@ noshoe1:
ah = 'E';
cl = 'T';
ch = 'B';
- isryanholding();
+ isRyanHolding();
bx = pop();
if (flags.z())
goto noshoe2;
@@ -2113,7 +609,7 @@ notravmessage:
dx = 10;
bl = 68;
bh = 64;
- setuptimeduse();
+ setupTimedUse();
al = data.byte(kFacing);
_add(al, 4);
_and(al, 7);
@@ -2130,28 +626,28 @@ notleave:
_test(al, 4);
if (flags.z())
goto notaleft;
- adjustleft();
+ adjustLeft();
return;
notaleft:
_test(al, 2);
if (flags.z())
goto notaright;
- adjustright();
+ adjustRight();
return;
notaright:
_test(al, 8);
if (flags.z())
goto notadown;
- adjustdown();
+ adjustDown();
return;
notadown:
_test(al, 16);
if (flags.z())
return /* (notanup) */;
- adjustup();
+ adjustUp();
}
-void DreamGenContext::adjustdown() {
+void DreamGenContext::adjustDown() {
STACK_CHECK;
push(es);
push(bx);
@@ -2165,7 +661,7 @@ void DreamGenContext::adjustdown() {
es = pop();
}
-void DreamGenContext::adjustup() {
+void DreamGenContext::adjustUp() {
STACK_CHECK;
push(es);
push(bx);
@@ -2179,7 +675,7 @@ void DreamGenContext::adjustup() {
es = pop();
}
-void DreamGenContext::adjustleft() {
+void DreamGenContext::adjustLeft() {
STACK_CHECK;
push(es);
push(bx);
@@ -2194,7 +690,7 @@ void DreamGenContext::adjustleft() {
es = pop();
}
-void DreamGenContext::adjustright() {
+void DreamGenContext::adjustRight() {
STACK_CHECK;
push(es);
push(bx);
@@ -2224,14 +720,14 @@ void DreamGenContext::reminders() {
ah = 'K';
cl = 'E';
ch = 'Y';
- isryanholding();
+ isRyanHolding();
if (flags.z())
goto forgotone;
al = 'C';
ah = 'S';
cl = 'H';
ch = 'R';
- findexobject();
+ findExObject();
_cmp(al, (114));
if (flags.z())
goto forgotone;
@@ -2259,360 +755,10 @@ forgotone:
bh = 70;
cx = 48;
dx = 8;
- setuptimeduse();
-}
-
-void DreamGenContext::initrain() {
- STACK_CHECK;
- es = data.word(kBuffers);
- di = (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)+(5*80)+(250*4)+(256*30));
- bx = offset_rainlocations;
-checkmorerain:
- al = cs.byte(bx);
- _cmp(al, 255);
- if (flags.z())
- goto finishinitrain;
- _cmp(al, data.byte(kReallocation));
- if (!flags.z())
- goto checkrain;
- al = cs.byte(bx+1);
- _cmp(al, data.byte(kMapx));
- if (!flags.z())
- goto checkrain;
- al = cs.byte(bx+2);
- _cmp(al, data.byte(kMapy));
- if (!flags.z())
- goto checkrain;
- al = cs.byte(bx+3);
- data.byte(kRainspace) = al;
- goto dorain;
-checkrain:
- _add(bx, 4);
- goto checkmorerain;
-dorain:
- cx = 4;
-initraintop:
- randomnumber();
- _and(al, 31);
- _add(al, 3);
- _cmp(al, data.byte(kRainspace));
- if (!flags.c())
- goto initraintop;
- _add(cl, al);
- _cmp(cl, data.byte(kMapxsize));
- if (!flags.c())
- goto initrainside;
- push(cx);
- splitintolines();
- cx = pop();
- goto initraintop;
-initrainside:
- cl = data.byte(kMapxsize);
- _dec(cl);
-initrainside2:
- randomnumber();
- _and(al, 31);
- _add(al, 3);
- _cmp(al, data.byte(kRainspace));
- if (!flags.c())
- goto initrainside2;
- _add(ch, al);
- _cmp(ch, data.byte(kMapysize));
- if (!flags.c())
- goto finishinitrain;
- push(cx);
- splitintolines();
- cx = pop();
- goto initrainside2;
-finishinitrain:
- al = 255;
- _stosb();
-}
-
-void DreamGenContext::splitintolines() {
- STACK_CHECK;
-lookforlinestart:
- getblockofpixel();
- _cmp(al, 0);
- if (!flags.z())
- goto foundlinestart;
- _dec(cl);
- _inc(ch);
- _cmp(cl, 0);
- if (flags.z())
- return /* (endofthisline) */;
- _cmp(ch, data.byte(kMapysize));
- if (!flags.c())
- return /* (endofthisline) */;
- goto lookforlinestart;
-foundlinestart:
- es.word(di) = cx;
- bh = 1;
-lookforlineend:
- getblockofpixel();
- _cmp(al, 0);
- if (flags.z())
- goto foundlineend;
- _dec(cl);
- _inc(ch);
- _cmp(cl, 0);
- if (flags.z())
- goto foundlineend;
- _cmp(ch, data.byte(kMapysize));
- if (!flags.c())
- goto foundlineend;
- _inc(bh);
- goto lookforlineend;
-foundlineend:
- push(cx);
- es.byte(di+2) = bh;
- randomnumber();
- es.byte(di+3) = al;
- randomnumber();
- es.byte(di+4) = al;
- randomnumber();
- _and(al, 3);
- _add(al, 4);
- es.byte(di+5) = al;
- _add(di, 6);
- cx = pop();
- _cmp(cl, 0);
- if (flags.z())
- return /* (endofthisline) */;
- _cmp(ch, data.byte(kMapysize));
- if (!flags.c())
- return /* (endofthisline) */;
- goto lookforlinestart;
-}
-
-void DreamGenContext::liftnoise() {
- STACK_CHECK;
- _cmp(data.byte(kReallocation), 5);
- if (flags.z())
- goto hissnoise;
- _cmp(data.byte(kReallocation), 21);
- if (flags.z())
- goto hissnoise;
- playchannel1();
- return;
-hissnoise:
- al = 13;
- playchannel1();
-}
-
-void DreamGenContext::random() {
- STACK_CHECK;
- randomnum1();
- push(di);
- _and(ax, 7);
- _add(di, 18);
- _add(di, ax);
- al = ds.byte(di);
- di = pop();
- es.byte(bx+15) = al;
-}
-
-void DreamGenContext::steady() {
- STACK_CHECK;
- al = ds.byte(di+18);
- ds.byte(di+17) = al;
- es.byte(bx+15) = al;
-}
-
-void DreamGenContext::constant() {
- STACK_CHECK;
- _inc(es.byte(bx+19));
- cl = es.byte(bx+19);
- ch = 0;
- _add(di, cx);
- _cmp(ds.byte(di+18), 255);
- if (!flags.z())
- goto gotconst;
- _sub(di, cx);
- cx = 0;
- es.byte(bx+19) = cl;
-gotconst:
- al = ds.byte(di+18);
- _sub(di, cx);
- es.byte(bx+15) = al;
- ds.byte(di+17) = al;
-}
-
-void DreamGenContext::reelsonscreen() {
- STACK_CHECK;
- reconstruct();
- updatepeople();
- watchreel();
- showrain();
- usetimedtext();
-}
-
-void DreamGenContext::soundonreels() {
- STACK_CHECK;
- bl = data.byte(kReallocation);
- _add(bl, bl);
- _xor(bh, bh);
- _add(bx, 1214);
- si = cs.word(bx);
-reelsoundloop:
- al = cs.byte(si);
- _cmp(al, 255);
- if (flags.z())
- goto endreelsound;
- ax = cs.word(si+1);
- _cmp(ax, data.word(kReelpointer));
- if (!flags.z())
- goto skipreelsound;
- _cmp(ax, data.word(kLastsoundreel));
- if (flags.z())
- goto skipreelsound;
- data.word(kLastsoundreel) = ax;
- al = cs.byte(si);
- _cmp(al, 64);
- if (flags.c())
- { playchannel1(); return; };
- _cmp(al, 128);
- if (flags.c())
- goto channel0once;
- _and(al, 63);
- ah = 255;
- { playchannel0(); return; };
-channel0once:
- _and(al, 63);
- ah = 0;
- { playchannel0(); return; };
-skipreelsound:
- _add(si, 3);
- goto reelsoundloop;
-endreelsound:
- ax = data.word(kLastsoundreel);
- _cmp(ax, data.word(kReelpointer));
- if (flags.z())
- return /* (nochange2) */;
- data.word(kLastsoundreel) = -1;
-}
-
-void DreamGenContext::reconstruct() {
- STACK_CHECK;
- _cmp(data.byte(kHavedoneobs), 0);
- if (flags.z())
- return /* (noneedtorecon) */;
- data.byte(kNewobs) = 1;
- drawfloor();
- spriteupdate();
- printsprites();
- _cmp(data.byte(kForeignrelease), 0);
- if (flags.z())
- goto notfudge;
- _cmp(data.byte(kReallocation), 20);
- if (!flags.z())
- goto notfudge;
- undertextline();
-notfudge:
- data.byte(kHavedoneobs) = 0;
-}
-
-void DreamGenContext::deleverything() {
- STACK_CHECK;
- al = data.byte(kMapysize);
- ah = 0;
- _add(ax, data.word(kMapoffsety));
- _cmp(ax, 182);
- if (!flags.c())
- goto bigroom;
- maptopanel();
- return;
-bigroom:
- _sub(data.byte(kMapysize), 8);
- maptopanel();
- _add(data.byte(kMapysize), 8);
-}
-
-void DreamGenContext::loadpalfromiff() {
- STACK_CHECK;
- dx = 2481;
- openfile();
- cx = 2000;
- ds = data.word(kMapstore);
- dx = 0;
- readfromfile();
- closefile();
- es = data.word(kBuffers);
- di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768);
- ds = data.word(kMapstore);
- si = 0x30;
- cx = 768;
-palloop:
- _lodsb();
- _shr(al, 1);
- _shr(al, 1);
- _cmp(data.byte(kBrightness), 1);
- if (!flags.z())
- goto nought;
- _cmp(al, 0);
- if (flags.z())
- goto nought;
- ah = al;
- _shr(ah, 1);
- _add(al, ah);
- _shr(ah, 1);
- _add(al, ah);
- _cmp(al, 64);
- if (flags.c())
- goto nought;
- al = 63;
-nought:
- _stosb();
- if (--cx)
- goto palloop;
-}
-
-void DreamGenContext::createpanel() {
- STACK_CHECK;
- di = 0;
- bx = 8;
- ds = data.word(kIcons2);
- al = 0;
- ah = 2;
- showframe();
- di = 160;
- bx = 8;
- ds = data.word(kIcons2);
- al = 0;
- ah = 2;
- showframe();
- di = 0;
- bx = 104;
- ds = data.word(kIcons2);
- al = 0;
- ah = 2;
- showframe();
- di = 160;
- bx = 104;
- ds = data.word(kIcons2);
- al = 0;
- ah = 2;
- showframe();
-}
-
-void DreamGenContext::createpanel2() {
- STACK_CHECK;
- createpanel();
- di = 0;
- bx = 0;
- ds = data.word(kIcons2);
- al = 5;
- ah = 2;
- showframe();
- di = 160;
- bx = 0;
- ds = data.word(kIcons2);
- al = 5;
- ah = 2;
- showframe();
+ setupTimedUse();
}
-void DreamGenContext::transfermap() {
+void DreamGenContext::transferMap() {
STACK_CHECK;
di = data.word(kExframepos);
push(di);
@@ -2659,104 +805,10 @@ void DreamGenContext::transfermap() {
_add(data.word(kExframepos), cx);
}
-void DreamGenContext::dofade() {
- STACK_CHECK;
- _cmp(data.byte(kFadedirection), 0);
- if (flags.z())
- return /* (finishfade) */;
- cl = data.byte(kNumtofade);
- ch = 0;
- al = data.byte(kColourpos);
- ah = 0;
- ds = data.word(kBuffers);
- si = (0+(228*13)+32+60+(32*32)+(11*10*3));
- _add(si, ax);
- _add(si, ax);
- _add(si, ax);
- showgroup();
- al = data.byte(kNumtofade);
- _add(al, data.byte(kColourpos));
- data.byte(kColourpos) = al;
- _cmp(al, 0);
- if (!flags.z())
- return /* (finishfade) */;
- fadecalculation();
-}
-
-void DreamGenContext::clearendpal() {
+void DreamGenContext::fadeScreenDownHalf() {
STACK_CHECK;
- es = data.word(kBuffers);
- di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768);
- cx = 768;
- al = 0;
- _stosb(cx, true);
-}
-
-void DreamGenContext::clearpalette() {
- STACK_CHECK;
- data.byte(kFadedirection) = 0;
- clearstartpal();
- dumpcurrent();
-}
-
-void DreamGenContext::fadescreenup() {
- STACK_CHECK;
- clearstartpal();
- paltoendpal();
- data.byte(kFadedirection) = 1;
- data.byte(kFadecount) = 63;
- data.byte(kColourpos) = 0;
- data.byte(kNumtofade) = 128;
-}
-
-void DreamGenContext::fadetowhite() {
- STACK_CHECK;
- es = data.word(kBuffers);
- di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768);
- cx = 768;
- al = 63;
- _stosb(cx, true);
- di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768);
- al = 0;
- _stosb(3);
- paltostartpal();
- data.byte(kFadedirection) = 1;
- data.byte(kFadecount) = 63;
- data.byte(kColourpos) = 0;
- data.byte(kNumtofade) = 128;
-}
-
-void DreamGenContext::fadefromwhite() {
- STACK_CHECK;
- es = data.word(kBuffers);
- di = (0+(228*13)+32+60+(32*32)+(11*10*3));
- cx = 768;
- al = 63;
- _stosb(cx, true);
- di = (0+(228*13)+32+60+(32*32)+(11*10*3));
- al = 0;
- _stosb(3);
- paltoendpal();
- data.byte(kFadedirection) = 1;
- data.byte(kFadecount) = 63;
- data.byte(kColourpos) = 0;
- data.byte(kNumtofade) = 128;
-}
-
-void DreamGenContext::fadescreenups() {
- STACK_CHECK;
- clearstartpal();
- paltoendpal();
- data.byte(kFadedirection) = 1;
- data.byte(kFadecount) = 63;
- data.byte(kColourpos) = 0;
- data.byte(kNumtofade) = 64;
-}
-
-void DreamGenContext::fadescreendownhalf() {
- STACK_CHECK;
- paltostartpal();
- paltoendpal();
+ palToStartPal();
+ palToEndPal();
cx = 768;
es = data.word(kBuffers);
bx = (0+(228*13)+32+60+(32*32)+(11*10*3)+768);
@@ -2783,110 +835,7 @@ halfend:
data.byte(kNumtofade) = 32;
}
-void DreamGenContext::fadescreenuphalf() {
- STACK_CHECK;
- endpaltostart();
- paltoendpal();
- data.byte(kFadedirection) = 1;
- data.byte(kFadecount) = 31;
- data.byte(kColourpos) = 0;
- data.byte(kNumtofade) = 32;
-}
-
-void DreamGenContext::fadescreendown() {
- STACK_CHECK;
- paltostartpal();
- clearendpal();
- data.byte(kFadedirection) = 1;
- data.byte(kFadecount) = 63;
- data.byte(kColourpos) = 0;
- data.byte(kNumtofade) = 128;
-}
-
-void DreamGenContext::fadescreendowns() {
- STACK_CHECK;
- paltostartpal();
- clearendpal();
- data.byte(kFadedirection) = 1;
- data.byte(kFadecount) = 63;
- data.byte(kColourpos) = 0;
- data.byte(kNumtofade) = 64;
-}
-
-void DreamGenContext::clearstartpal() {
- STACK_CHECK;
- es = data.word(kBuffers);
- di = (0+(228*13)+32+60+(32*32)+(11*10*3));
- cx = 256;
-wholeloop1:
- ax = 0;
- _stosw();
- al = 0;
- _stosb();
- if (--cx)
- goto wholeloop1;
-}
-
-void DreamGenContext::showgun() {
- STACK_CHECK;
- data.byte(kAddtored) = 0;
- data.byte(kAddtogreen) = 0;
- data.byte(kAddtoblue) = 0;
- paltostartpal();
- paltoendpal();
- greyscalesum();
- data.byte(kFadedirection) = 1;
- data.byte(kFadecount) = 63;
- data.byte(kColourpos) = 0;
- data.byte(kNumtofade) = 128;
- cx = 130;
- hangon();
- endpaltostart();
- clearendpal();
- data.byte(kFadedirection) = 1;
- data.byte(kFadecount) = 63;
- data.byte(kColourpos) = 0;
- data.byte(kNumtofade) = 128;
- cx = 200;
- hangon();
- data.byte(kRoomssample) = 34;
- loadroomssample();
- data.byte(kVolume) = 0;
- dx = 2351;
- loadintotemp();
- createpanel2();
- ds = data.word(kTempgraphics);
- al = 0;
- ah = 0;
- di = 100;
- bx = 4;
- showframe();
- ds = data.word(kTempgraphics);
- al = 1;
- ah = 0;
- di = 158;
- bx = 106;
- showframe();
- worktoscreen();
- getridoftemp();
- fadescreenup();
- cx = 160;
- hangon();
- al = 12;
- ah = 0;
- playchannel0();
- dx = 2260;
- loadtemptext();
- rollendcredits2();
- getridoftemptext();
-}
-
-void DreamGenContext::rollendcredits2() {
- STACK_CHECK;
- rollem();
-}
-
-void DreamGenContext::rollem() {
+void DreamGenContext::rollEm() {
STACK_CHECK;
cl = 160;
ch = 160;
@@ -2894,7 +843,7 @@ void DreamGenContext::rollem() {
bx = 20;
ds = data.word(kMapstore);
si = 0;
- multiget();
+ multiGet();
es = data.word(kTextfile1);
si = 49*2;
ax = es.word(si);
@@ -2911,15 +860,15 @@ endcredits22:
push(di);
push(es);
push(bx);
- vsync();
+ vSync();
cl = 160;
ch = 160;
di = 25;
bx = 20;
ds = data.word(kMapstore);
si = 0;
- multiput();
- vsync();
+ multiPut();
+ vSync();
bx = pop();
es = pop();
di = pop();
@@ -2934,17 +883,17 @@ onelot2:
di = 25;
dx = 161;
ax = 0;
- printdirect();
+ printDirect();
_add(bx, data.word(kLinespacing));
cx = pop();
if (--cx)
goto onelot2;
- vsync();
+ vSync();
cl = 160;
ch = 160;
di = 25;
bx = 20;
- multidump();
+ multiDump();
bx = pop();
es = pop();
di = pop();
@@ -2974,178 +923,16 @@ gotnext2:
if (--cx)
goto endcredits21;
cx = 120;
- hangone();
+ hangOne();
return;
endearly2:
cx = pop();
}
-void DreamGenContext::fadecalculation() {
- STACK_CHECK;
- _cmp(data.byte(kFadecount), 0);
- if (flags.z())
- goto nomorefading;
- bl = data.byte(kFadecount);
- es = data.word(kBuffers);
- si = (0+(228*13)+32+60+(32*32)+(11*10*3));
- di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768);
- cx = 768;
-fadecolloop:
- al = es.byte(si);
- ah = es.byte(di);
- _cmp(al, ah);
- if (flags.z())
- goto gotthere;
- if (flags.c())
- goto lesscolour;
- _dec(es.byte(si));
- goto gotthere;
-lesscolour:
- _cmp(bl, ah);
- if (flags.z())
- goto withit;
- if (!flags.c())
- goto gotthere;
-withit:
- _inc(es.byte(si));
-gotthere:
- _inc(si);
- _inc(di);
- if (--cx)
- goto fadecolloop;
- _dec(data.byte(kFadecount));
- return;
-nomorefading:
- data.byte(kFadedirection) = 0;
-}
-
-void DreamGenContext::greyscalesum() {
- STACK_CHECK;
- es = data.word(kBuffers);
- si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768);
- di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768);
- cx = 256;
-greysumloop1:
- push(cx);
- bx = 0;
- al = es.byte(si);
- ah = 0;
- cx = 20;
- _mul(cx);
- _add(bx, ax);
- al = es.byte(si+1);
- ah = 0;
- cx = 59;
- _mul(cx);
- _add(bx, ax);
- al = es.byte(si+2);
- ah = 0;
- cx = 11;
- _mul(cx);
- _add(bx, ax);
- al = -1;
-greysumloop2:
- _inc(al);
- _sub(bx, 100);
- if (!flags.c())
- goto greysumloop2;
- bl = al;
- al = bl;
- ah = data.byte(kAddtored);
- _cmp(al, 0);
- _add(al, ah);
- _stosb();
- ah = data.byte(kAddtogreen);
- al = bl;
- _cmp(al, 0);
- if (flags.z())
- goto noaddg;
- _add(al, ah);
-noaddg:
- _stosb();
- ah = data.byte(kAddtoblue);
- al = bl;
- _cmp(al, 0);
- if (flags.z())
- goto noaddb;
- _add(al, ah);
-noaddb:
- _stosb();
- _add(si, 3);
- cx = pop();
- if (--cx)
- goto greysumloop1;
-}
-
-void DreamGenContext::paltostartpal() {
+void DreamGenContext::fadeDownMon() {
STACK_CHECK;
- es = data.word(kBuffers);
- ds = data.word(kBuffers);
- si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768);
- di = (0+(228*13)+32+60+(32*32)+(11*10*3));
- cx = 768/2;
- _movsw(cx, true);
-}
-
-void DreamGenContext::endpaltostart() {
- STACK_CHECK;
- es = data.word(kBuffers);
- ds = data.word(kBuffers);
- si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768);
- di = (0+(228*13)+32+60+(32*32)+(11*10*3));
- cx = 768/2;
- _movsw(cx, true);
-}
-
-void DreamGenContext::startpaltoend() {
- STACK_CHECK;
- es = data.word(kBuffers);
- ds = data.word(kBuffers);
- di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768);
- si = (0+(228*13)+32+60+(32*32)+(11*10*3));
- cx = 768/2;
- _movsw(cx, true);
-}
-
-void DreamGenContext::paltoendpal() {
- STACK_CHECK;
- es = data.word(kBuffers);
- ds = data.word(kBuffers);
- di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768);
- si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768);
- cx = 768/2;
- _movsw(cx, true);
-}
-
-void DreamGenContext::allpalette() {
- STACK_CHECK;
- es = data.word(kBuffers);
- ds = data.word(kBuffers);
- di = (0+(228*13)+32+60+(32*32)+(11*10*3));
- si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768);
- cx = 768/2;
- _movsw(cx, true);
- dumpcurrent();
-}
-
-void DreamGenContext::dumpcurrent() {
- STACK_CHECK;
- si = (0+(228*13)+32+60+(32*32)+(11*10*3));
- ds = data.word(kBuffers);
- vsync();
- al = 0;
- cx = 128;
- showgroup();
- vsync();
- al = 128;
- cx = 128;
- showgroup();
-}
-
-void DreamGenContext::fadedownmon() {
- STACK_CHECK;
- paltostartpal();
- paltoendpal();
+ palToStartPal();
+ palToEndPal();
es = data.word(kBuffers);
di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768)+(231*3);
cx = 3*8;
@@ -3159,33 +946,13 @@ void DreamGenContext::fadedownmon() {
data.byte(kColourpos) = 0;
data.byte(kNumtofade) = 128;
cx = 64;
- hangon();
-}
-
-void DreamGenContext::fadeupmon() {
- STACK_CHECK;
- paltostartpal();
- paltoendpal();
- es = data.word(kBuffers);
- di = (0+(228*13)+32+60+(32*32)+(11*10*3))+(231*3);
- cx = 3*8;
- ax = 0;
- _stosb(cx, true);
- di = (0+(228*13)+32+60+(32*32)+(11*10*3))+(246*3);
- _stosb();
- _stosw();
- data.byte(kFadedirection) = 1;
- data.byte(kFadecount) = 63;
- data.byte(kColourpos) = 0;
- data.byte(kNumtofade) = 128;
- cx = 128;
- hangon();
+ hangOn();
}
-void DreamGenContext::fadeupmonfirst() {
+void DreamGenContext::fadeUpMon() {
STACK_CHECK;
- paltostartpal();
- paltoendpal();
+ palToStartPal();
+ palToEndPal();
es = data.word(kBuffers);
di = (0+(228*13)+32+60+(32*32)+(11*10*3))+(231*3);
cx = 3*8;
@@ -3198,36 +965,13 @@ void DreamGenContext::fadeupmonfirst() {
data.byte(kFadecount) = 63;
data.byte(kColourpos) = 0;
data.byte(kNumtofade) = 128;
- cx = 64;
- hangon();
- al = 26;
- playchannel1();
- cx = 64;
- hangon();
-}
-
-void DreamGenContext::fadeupyellows() {
- STACK_CHECK;
- paltoendpal();
- es = data.word(kBuffers);
- di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768)+(231*3);
- cx = 3*8;
- ax = 0;
- _stosb(cx, true);
- di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768)+(246*3);
- _stosb();
- _stosw();
- data.byte(kFadedirection) = 1;
- data.byte(kFadecount) = 63;
- data.byte(kColourpos) = 0;
- data.byte(kNumtofade) = 128;
cx = 128;
- hangon();
+ hangOn();
}
-void DreamGenContext::initialmoncols() {
+void DreamGenContext::initialMonCols() {
STACK_CHECK;
- paltostartpal();
+ palToStartPal();
es = data.word(kBuffers);
di = (0+(228*13)+32+60+(32*32)+(11*10*3))+(230*3);
cx = 3*9;
@@ -3240,504 +984,35 @@ void DreamGenContext::initialmoncols() {
si = (0+(228*13)+32+60+(32*32)+(11*10*3))+(230*3);
al = 230;
cx = 18;
- showgroup();
-}
-
-void DreamGenContext::titles() {
- STACK_CHECK;
- clearpalette();
- biblequote();
- _cmp(data.byte(kQuitrequested), 0);
- if (!flags.z())
- return /* (titlesearly) */;
- intro();
-}
-
-void DreamGenContext::endgame() {
- STACK_CHECK;
- dx = 2260;
- loadtemptext();
- monkspeaking();
- gettingshot();
- getridoftemptext();
- data.byte(kVolumeto) = 7;
- data.byte(kVolumedirection) = 1;
- cx = 200;
- hangon();
-}
-
-void DreamGenContext::monkspeaking() {
- STACK_CHECK;
- data.byte(kRoomssample) = 35;
- loadroomssample();
- dx = 2364;
- loadintotemp();
- clearwork();
- showmonk();
- worktoscreen();
- data.byte(kVolume) = 7;
- data.byte(kVolumedirection) = -1;
- data.byte(kVolumeto) = 5;
- al = 12;
- ah = 255;
- playchannel0();
- fadescreenups();
- cx = 300;
- hangon();
- al = 40;
-loadspeech2:
- push(ax);
- dl = 'T';
- dh = 83;
- cl = 'T';
- ah = 0;
- loadspeech();
- al = 50+12;
- playchannel1();
-notloadspeech2:
- vsync();
- _cmp(data.byte(kCh1playing), 255);
- if (!flags.z())
- goto notloadspeech2;
- ax = pop();
- _inc(al);
- _cmp(al, 48);
- if (!flags.z())
- goto loadspeech2;
- data.byte(kVolumedirection) = 1;
- data.byte(kVolumeto) = 7;
- fadescreendowns();
- cx = 300;
- hangon();
- getridoftemp();
-}
-
-void DreamGenContext::showmonk() {
- STACK_CHECK;
- al = 0;
- ah = 128;
- di = 160;
- bx = 72;
- ds = data.word(kTempgraphics);
- showframe();
-}
-
-void DreamGenContext::gettingshot() {
- STACK_CHECK;
- data.byte(kNewlocation) = 55;
- clearpalette();
- loadintroroom();
- fadescreenups();
- data.byte(kVolumeto) = 0;
- data.byte(kVolumedirection) = -1;
- runendseq();
- clearbeforeload();
-}
-
-void DreamGenContext::credits() {
- STACK_CHECK;
- clearpalette();
- realcredits();
-}
-
-void DreamGenContext::biblequote() {
- STACK_CHECK;
- mode640x480();
- dx = 2377;
- showpcx();
- fadescreenups();
- cx = 80;
- hangone();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto biblequotearly;
- cx = 560;
- hangone();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto biblequotearly;
- fadescreendowns();
- cx = 200;
- hangone();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto biblequotearly;
- cancelch0();
-biblequotearly:
- data.byte(kLasthardkey) = 0;
-}
-
-void DreamGenContext::hangone() {
- STACK_CHECK;
-hangonloope:
- push(cx);
- vsync();
- cx = pop();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- return /* (hangonearly) */;
- if (--cx)
- goto hangonloope;
-}
-
-void DreamGenContext::intro() {
- STACK_CHECK;
- dx = 2247;
- loadtemptext();
- loadpalfromiff();
- setmode();
- data.byte(kNewlocation) = 50;
- clearpalette();
- loadintroroom();
- data.byte(kVolume) = 7;
- data.byte(kVolumedirection) = -1;
- data.byte(kVolumeto) = 4;
- al = 12;
- ah = 255;
- playchannel0();
- fadescreenups();
- runintroseq();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto introearly;
- clearbeforeload();
- data.byte(kNewlocation) = 52;
- loadintroroom();
- runintroseq();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto introearly;
- clearbeforeload();
- data.byte(kNewlocation) = 53;
- loadintroroom();
- runintroseq();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto introearly;
- clearbeforeload();
- allpalette();
- data.byte(kNewlocation) = 54;
- loadintroroom();
- runintroseq();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto introearly;
- getridoftemptext();
- clearbeforeload();
-introearly:
- data.byte(kLasthardkey) = 0;
-}
-
-void DreamGenContext::runintroseq() {
- STACK_CHECK;
- data.byte(kGetback) = 0;
-moreintroseq:
- vsync();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto earlyendrun;
- spriteupdate();
- vsync();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto earlyendrun;
- deleverything();
- printsprites();
- reelsonscreen();
- afterintroroom();
- usetimedtext();
- vsync();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto earlyendrun;
- dumpmap();
- dumptimedtext();
- vsync();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto earlyendrun;
- _cmp(data.byte(kGetback), 1);
- if (!flags.z())
- goto moreintroseq;
- return;
-earlyendrun:
- getridoftemptext();
- clearbeforeload();
+ showGroup();
}
-void DreamGenContext::runendseq() {
+void DreamGenContext::runEndSeq() {
STACK_CHECK;
atmospheres();
data.byte(kGetback) = 0;
moreendseq:
- vsync();
- spriteupdate();
- vsync();
- deleverything();
- printsprites();
- reelsonscreen();
- afterintroroom();
- usetimedtext();
- vsync();
- dumpmap();
- dumptimedtext();
- vsync();
+ vSync();
+ spriteUpdate();
+ vSync();
+ delEverything();
+ printSprites();
+ reelsOnScreen();
+ afterIntroRoom();
+ useTimedText();
+ vSync();
+ dumpMap();
+ dumpTimedText();
+ vSync();
_cmp(data.byte(kGetback), 1);
if (!flags.z())
goto moreendseq;
}
-void DreamGenContext::loadintroroom() {
- STACK_CHECK;
- data.byte(kIntrocount) = 0;
- data.byte(kLocation) = 255;
- loadroom();
- data.word(kMapoffsetx) = 72;
- data.word(kMapoffsety) = 16;
- clearsprites();
- data.byte(kThroughdoor) = 0;
- data.byte(kCurrentkey) = '0';
- data.byte(kMainmode) = 0;
- clearwork();
- data.byte(kNewobs) = 1;
- drawfloor();
- reelsonscreen();
- spriteupdate();
- printsprites();
- worktoscreen();
-}
-
-void DreamGenContext::realcredits() {
- STACK_CHECK;
- data.byte(kRoomssample) = 33;
- loadroomssample();
- data.byte(kVolume) = 0;
- mode640x480();
- cx = 35;
- hangon();
- dx = 2390;
- showpcx();
- al = 12;
- ah = 0;
- playchannel0();
- cx = 2;
- hangone();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto realcreditsearly;
- allpalette();
- cx = 80;
- hangone();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto realcreditsearly;
- fadescreendowns();
- cx = 256;
- hangone();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto realcreditsearly;
- dx = 2403;
- showpcx();
- al = 12;
- ah = 0;
- playchannel0();
- cx = 2;
- hangone();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto realcreditsearly;
- allpalette();
- cx = 80;
- hangone();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto realcreditsearly;
- fadescreendowns();
- cx = 256;
- hangone();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto realcreditsearly;
- dx = 2416;
- showpcx();
- al = 12;
- ah = 0;
- playchannel0();
- cx = 2;
- hangone();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto realcreditsearly;
- allpalette();
- cx = 80;
- hangone();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto realcreditsearly;
- fadescreendowns();
- cx = 256;
- hangone();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto realcreditsearly;
- dx = 2429;
- showpcx();
- al = 12;
- ah = 0;
- playchannel0();
- cx = 2;
- hangone();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto realcreditsearly;
- allpalette();
- cx = 80;
- hangone();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto realcreditsearly;
- fadescreendowns();
- cx = 256;
- hangone();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto realcreditsearly;
- dx = 2442;
- showpcx();
- al = 12;
- ah = 0;
- playchannel0();
- cx = 2;
- hangone();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto realcreditsearly;
- allpalette();
- cx = 80;
- hangone();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto realcreditsearly;
- fadescreendowns();
- cx = 256;
- hangone();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto realcreditsearly;
- dx = 2455;
- showpcx();
- fadescreenups();
- cx = 60;
- hangone();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto realcreditsearly;
- al = 13;
- ah = 0;
- playchannel0();
- cx = 350;
- hangone();
- _cmp(data.byte(kLasthardkey), 1);
- if (flags.z())
- goto realcreditsearly;
- fadescreendowns();
- cx = 256;
- hangone();
-realcreditsearly:
- data.byte(kLasthardkey) = 0;
-}
-
-void DreamGenContext::monprint() {
- STACK_CHECK;
- data.byte(kKerning) = 1;
- si = bx;
- dl = 166;
- di = data.word(kMonadx);
- bx = data.word(kMonady);
- ds = data.word(kTempcharset);
-printloop8:
- push(bx);
- push(di);
- push(dx);
- getnumber();
- ch = 0;
-printloop7:
- al = es.byte(si);
- _inc(si);
- _cmp(al, ':');
- if (flags.z())
- goto finishmon2;
- _cmp(al, 0);
- if (flags.z())
- goto finishmon;
- _cmp(al, 34);
- if (flags.z())
- goto finishmon;
- _cmp(al, '=');
- if (flags.z())
- goto finishmon;
- _cmp(al, '%');
- if (!flags.z())
- goto nottrigger;
- ah = es.byte(si);
- _inc(si);
- _inc(si);
- goto finishmon;
-nottrigger:
- push(cx);
- push(es);
- modifychar();
- printchar();
- data.word(kCurslocx) = di;
- data.word(kCurslocy) = bx;
- data.word(kMaintimer) = 1;
- printcurs();
- vsync();
- push(si);
- push(dx);
- push(ds);
- push(es);
- push(bx);
- push(di);
- lockmon();
- di = pop();
- bx = pop();
- es = pop();
- ds = pop();
- dx = pop();
- si = pop();
- delcurs();
- es = pop();
- cx = pop();
- if (--cx)
- goto printloop7;
-finishmon2:
- dx = pop();
- di = pop();
- bx = pop();
- scrollmonitor();
- data.word(kCurslocx) = di;
- goto printloop8;
-finishmon:
- dx = pop();
- di = pop();
- bx = pop();
- _cmp(al, '%');
- if (!flags.z())
- goto nottrigger2;
- data.byte(kLasttrigger) = ah;
-nottrigger2:
- data.word(kCurslocx) = di;
- scrollmonitor();
- bx = si;
- data.byte(kKerning) = 0;
-}
-
-void DreamGenContext::fillopen() {
+void DreamGenContext::fillOpen() {
STACK_CHECK;
- deltextline();
- getopenedsize();
+ delTextLine();
+ getOpenedSize();
_cmp(ah, 4);
if (flags.c())
goto lessthanapage;
@@ -3747,7 +1022,7 @@ lessthanapage:
push(ax);
es = data.word(kBuffers);
di = (0+(228*13));
- findallopen();
+ findAllOpen();
si = (0+(228*13));
di = (80);
bx = (58)+96;
@@ -3763,7 +1038,7 @@ openloop1:
_cmp(ch, cl);
if (flags.c())
goto nextopenslot;
- obtoinv();
+ obToInv();
nextopenslot:
es = pop();
si = pop();
@@ -3775,10 +1050,10 @@ nextopenslot:
_cmp(cl, 5);
if (!flags.z())
goto openloop1;
- undertextline();
+ underTextLine();
}
-void DreamGenContext::findallopen() {
+void DreamGenContext::findAllOpen() {
STACK_CHECK;
push(di);
cx = 16;
@@ -3851,118 +1126,14 @@ findopen2a:
goto findopen1a;
}
-void DreamGenContext::examineob() {
- STACK_CHECK;
- data.byte(kPointermode) = 0;
- data.word(kTimecount) = 0;
-examineagain:
- data.byte(kInmaparea) = 0;
- data.byte(kExamagain) = 0;
- data.byte(kOpenedob) = 255;
- data.byte(kOpenedtype) = 255;
- data.byte(kInvopen) = 0;
- al = data.byte(kCommandtype);
- data.byte(kObjecttype) = al;
- data.byte(kItemframe) = 0;
- data.byte(kPointerframe) = 0;
- createpanel();
- showpanel();
- showman();
- showexit();
- obicons();
- obpicture();
- describeob();
- undertextline();
- data.byte(kCommandtype) = 255;
- readmouse();
- showpointer();
- worktoscreen();
- delpointer();
-waitexam:
- readmouse();
- showpointer();
- vsync();
- dumppointer();
- dumptextline();
- delpointer();
- data.byte(kGetback) = 0;
- bx = offset_examlist;
- _cmp(data.byte(kInvopen), 0);
- if (flags.z())
- goto notuseinv;
- bx = offset_invlist1;
- _cmp(data.byte(kInvopen), 1);
- if (flags.z())
- goto notuseinv;
- 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;
- goto examineagain;
-norex:
- _cmp(data.byte(kGetback), 0);
- if (flags.z())
- goto waitexam;
-stopwaiting:
- data.byte(kPickup) = 0;
- _cmp(data.word(kWatchingtime), 0);
- if (!flags.z())
- goto iswatching;
- _cmp(data.byte(kNewlocation), 255);
- if (!flags.z())
- goto justgetback;
-iswatching:
- makemainscreen();
- data.byte(kInvopen) = 0;
- data.byte(kOpenedob) = 255;
- return;
-justgetback:
- data.byte(kInvopen) = 0;
- data.byte(kOpenedob) = 255;
-}
-
-void DreamGenContext::makemainscreen() {
- STACK_CHECK;
- createpanel();
- data.byte(kNewobs) = 1;
- drawfloor();
- spriteupdate();
- printsprites();
- reelsonscreen();
- showicon();
- getunderzoom();
- undertextline();
- data.byte(kCommandtype) = 255;
- animpointer();
- worktoscreenm();
- data.byte(kCommandtype) = 200;
- data.byte(kManisoffscreen) = 0;
-}
-
-void DreamGenContext::getbackfromob() {
- STACK_CHECK;
- _cmp(data.byte(kPickup), 1);
- if (!flags.z())
- goto notheldob;
- blank();
- return;
-notheldob:
- getback1();
-}
-
-void DreamGenContext::incryanpage() {
+void DreamGenContext::incRyanPage() {
STACK_CHECK;
_cmp(data.byte(kCommandtype), 222);
if (flags.z())
goto alreadyincryan;
data.byte(kCommandtype) = 222;
al = 31;
- commandonly();
+ commandOnly();
alreadyincryan:
ax = data.word(kMousebutton);
_cmp(ax, data.word(kOldbutton));
@@ -3981,37 +1152,25 @@ findnewpage:
_sub(ax, 18);
if (!flags.c())
goto findnewpage;
- delpointer();
- fillryan();
- readmouse();
- showpointer();
- worktoscreen();
- delpointer();
+ delPointer();
+ fillRyan();
+ readMouse();
+ showPointer();
+ workToScreen();
+ delPointer();
}
-void DreamGenContext::openinv() {
- STACK_CHECK;
- data.byte(kInvopen) = 1;
- al = 61;
- di = (80);
- bx = (58)-10;
- dl = 240;
- printmessage();
- fillryan();
- data.byte(kCommandtype) = 255;
-}
-
-void DreamGenContext::openob() {
+void DreamGenContext::openOb() {
STACK_CHECK;
al = data.byte(kOpenedob);
ah = data.byte(kOpenedtype);
di = offset_commandline;
- copyname();
+ copyName();
di = (80);
bx = (58)+86;
al = 62;
dl = 240;
- printmessage();
+ printMessage();
di = data.word(kLastxpos);
_add(di, 5);
bx = (58)+86;
@@ -4020,9 +1179,9 @@ void DreamGenContext::openob() {
dl = 220;
al = 0;
ah = 0;
- printdirect();
- fillopen();
- getopenedsize();
+ printDirect();
+ fillOpen();
+ getOpenedSize();
al = ah;
ah = 0;
cx = (44);
@@ -4032,19 +1191,9 @@ void DreamGenContext::openob() {
cs.word(bx) = ax;
}
-void DreamGenContext::examicon() {
- STACK_CHECK;
- ds = data.word(kIcons2);
- di = 254;
- bx = 5;
- al = 3;
- ah = 0;
- showframe();
-}
-
-void DreamGenContext::describeob() {
+void DreamGenContext::describeOb() {
STACK_CHECK;
- getobtextstart();
+ getObTextStart();
di = 33;
bx = 92;
_cmp(data.byte(kForeignrelease), 0);
@@ -4058,7 +1207,7 @@ notsetd:
dl = 241;
ah = 16;
data.word(kCharshift) = 91+91;
- printdirect();
+ printDirect();
data.word(kCharshift) = 0;
di = 36;
bx = 104;
@@ -4072,14 +1221,14 @@ notsetd:
notsetd2:
dl = 241;
ah = 0;
- printdirect();
+ printDirect();
push(bx);
- obsthatdothings();
+ obsThatDoThings();
bx = pop();
- additionaltext();
+ additionalText();
}
-void DreamGenContext::additionaltext() {
+void DreamGenContext::additionalText() {
STACK_CHECK;
_add(bx, 10);
push(bx);
@@ -4105,45 +1254,24 @@ void DreamGenContext::additionaltext() {
return;
emptycup:
al = 40;
- findpuztext();
+ findPuzText();
bx = pop();
di = 36;
dl = 241;
ah = 0;
- printdirect();
+ printDirect();
return;
fullcup:
al = 39;
- findpuztext();
+ findPuzText();
bx = pop();
di = 36;
dl = 241;
ah = 0;
- printdirect();
-}
-
-void DreamGenContext::obsthatdothings() {
- STACK_CHECK;
- al = data.byte(kCommand);
- ah = data.byte(kObjecttype);
- cl = 'M';
- ch = 'E';
- dl = 'M';
- dh = 'B';
- compare();
- if (!flags.z())
- return /* (notlouiscard) */;
- al = 4;
- getlocation();
- _cmp(al, 1);
- if (flags.z())
- return /* (seencard) */;
- al = 4;
- setlocation();
- lookatcard();
+ printDirect();
}
-void DreamGenContext::getobtextstart() {
+void DreamGenContext::getObTextStart() {
STACK_CHECK;
es = data.word(kFreedesc);
si = (0);
@@ -4171,7 +1299,7 @@ describe:
bx = ax;
tryagain:
push(si);
- findnextcolon();
+ findNextColon();
al = es.byte(si);
cx = si;
si = pop();
@@ -4186,11 +1314,11 @@ tryagain:
goto findsometext;
return;
findsometext:
- searchforsame();
+ searchForSame();
goto tryagain;
}
-void DreamGenContext::searchforsame() {
+void DreamGenContext::searchForSame() {
STACK_CHECK;
si = cx;
searchagain:
@@ -4233,127 +1361,7 @@ foundmatch:
bx = pop();
}
-void DreamGenContext::inventory() {
- STACK_CHECK;
- _cmp(data.byte(kMandead), 1);
- if (flags.z())
- goto iswatchinv;
- _cmp(data.word(kWatchingtime), 0);
- if (flags.z())
- goto notwatchinv;
-iswatchinv:
- blank();
- return;
-notwatchinv:
- _cmp(data.byte(kCommandtype), 239);
- if (flags.z())
- goto alreadyopinv;
- data.byte(kCommandtype) = 239;
- al = 32;
- commandonly();
-alreadyopinv:
- ax = data.word(kMousebutton);
- _cmp(ax, data.word(kOldbutton));
- if (flags.z())
- return /* (cantopinv) */;
- _and(ax, 1);
- if (!flags.z())
- goto doopeninv;
- return;
-doopeninv:
- data.word(kTimecount) = 0;
- data.byte(kPointermode) = 0;
- data.byte(kInmaparea) = 0;
- animpointer();
- createpanel();
- showpanel();
- examicon();
- showman();
- showexit();
- undertextline();
- data.byte(kPickup) = 0;
- data.byte(kInvopen) = 2;
- openinv();
- readmouse();
- showpointer();
- worktoscreen();
- delpointer();
- data.byte(kOpenedob) = 255;
- goto waitexam;
- return;
-/*continuing to unbounded code: examineagain from examineob:3-69*/
-examineagain:
- data.byte(kInmaparea) = 0;
- data.byte(kExamagain) = 0;
- data.byte(kOpenedob) = 255;
- data.byte(kOpenedtype) = 255;
- data.byte(kInvopen) = 0;
- al = data.byte(kCommandtype);
- data.byte(kObjecttype) = al;
- data.byte(kItemframe) = 0;
- data.byte(kPointerframe) = 0;
- createpanel();
- showpanel();
- showman();
- showexit();
- obicons();
- obpicture();
- describeob();
- undertextline();
- data.byte(kCommandtype) = 255;
- readmouse();
- showpointer();
- worktoscreen();
- delpointer();
-waitexam:
- readmouse();
- showpointer();
- vsync();
- dumppointer();
- dumptextline();
- delpointer();
- data.byte(kGetback) = 0;
- bx = offset_examlist;
- _cmp(data.byte(kInvopen), 0);
- if (flags.z())
- goto notuseinv;
- bx = offset_invlist1;
- _cmp(data.byte(kInvopen), 1);
- if (flags.z())
- goto notuseinv;
- 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;
- goto examineagain;
-norex:
- _cmp(data.byte(kGetback), 0);
- if (flags.z())
- goto waitexam;
-stopwaiting:
- data.byte(kPickup) = 0;
- _cmp(data.word(kWatchingtime), 0);
- if (!flags.z())
- goto iswatching;
- _cmp(data.byte(kNewlocation), 255);
- if (!flags.z())
- goto justgetback;
-iswatching:
- makemainscreen();
- data.byte(kInvopen) = 0;
- data.byte(kOpenedob) = 255;
- return;
-justgetback:
- data.byte(kInvopen) = 0;
- data.byte(kOpenedob) = 255;
-}
-
-void DreamGenContext::setpickup() {
+void DreamGenContext::setPickup() {
STACK_CHECK;
_cmp(data.byte(kObjecttype), 1);
if (flags.z())
@@ -4361,7 +1369,7 @@ void DreamGenContext::setpickup() {
_cmp(data.byte(kObjecttype), 3);
if (flags.z())
goto cantpick;
- getanyad();
+ getAnyAd();
al = es.byte(bx+2);
_cmp(al, 4);
if (!flags.z())
@@ -4377,7 +1385,7 @@ canpick:
bl = data.byte(kCommand);
bh = data.byte(kObjecttype);
al = 33;
- commandwithob();
+ commandWithOb();
alreadysp:
ax = data.word(kMousebutton);
_cmp(ax, 1);
@@ -4388,11 +1396,11 @@ alreadysp:
goto dosetpick;
return;
dosetpick:
- createpanel();
- showpanel();
- showman();
- showexit();
- examicon();
+ createPanel();
+ showPanel();
+ showMan();
+ showExit();
+ examIcon();
data.byte(kPickup) = 1;
data.byte(kInvopen) = 2;
_cmp(data.byte(kObjecttype), 4);
@@ -4401,63 +1409,26 @@ dosetpick:
al = data.byte(kCommand);
data.byte(kItemframe) = al;
data.byte(kOpenedob) = 255;
- transfertoex();
+ transferToEx();
data.byte(kItemframe) = al;
data.byte(kObjecttype) = 4;
- geteitherad();
+ getEitherAd();
es.byte(bx+2) = 20;
es.byte(bx+3) = 255;
- openinv();
- worktoscreenm();
+ openInv();
+ workToScreenM();
return;
pickupexob:
al = data.byte(kCommand);
data.byte(kItemframe) = al;
data.byte(kOpenedob) = 255;
- openinv();
- worktoscreenm();
-}
-
-void DreamGenContext::examinventory() {
- STACK_CHECK;
- _cmp(data.byte(kCommandtype), 249);
- if (flags.z())
- goto alreadyexinv;
- data.byte(kCommandtype) = 249;
- al = 32;
- commandonly();
-alreadyexinv:
- ax = data.word(kMousebutton);
- _and(ax, 1);
- if (!flags.z())
- goto doexinv;
- return;
-doexinv:
- createpanel();
- showpanel();
- showman();
- showexit();
- examicon();
- data.byte(kPickup) = 0;
- data.byte(kInvopen) = 2;
- openinv();
- worktoscreenm();
-}
-
-void DreamGenContext::reexfrominv() {
- STACK_CHECK;
- findinvpos();
- ax = es.word(bx);
- data.byte(kCommandtype) = ah;
- data.byte(kCommand) = al;
- data.byte(kExamagain) = 1;
- data.byte(kPointermode) = 0;
+ openInv();
+ workToScreenM();
}
-void DreamGenContext::reexfromopen() {
+void DreamGenContext::reExFromInv() {
STACK_CHECK;
- return;
- findopenpos();
+ findInvPos();
ax = es.word(bx);
data.byte(kCommandtype) = ah;
data.byte(kCommand) = al;
@@ -4465,7 +1436,7 @@ void DreamGenContext::reexfromopen() {
data.byte(kPointermode) = 0;
}
-void DreamGenContext::swapwithinv() {
+void DreamGenContext::swapWithInv() {
STACK_CHECK;
al = data.byte(kItemframe);
ah = data.byte(kObjecttype);
@@ -4480,7 +1451,7 @@ difsub7:
data.word(kOldsubject) = ax;
bx = ax;
al = 34;
- commandwithob();
+ commandWithOb();
alreadyswap1:
ax = data.word(kMousebutton);
_cmp(ax, data.word(kOldbutton));
@@ -4494,11 +1465,11 @@ doswap1:
ah = data.byte(kObjecttype);
al = data.byte(kItemframe);
push(ax);
- findinvpos();
+ findInvPos();
ax = es.word(bx);
data.byte(kItemframe) = al;
data.byte(kObjecttype) = ah;
- geteitherad();
+ getEitherAd();
es.byte(bx+2) = 20;
es.byte(bx+3) = 255;
bl = data.byte(kItemframe);
@@ -4507,10 +1478,10 @@ doswap1:
data.byte(kObjecttype) = ah;
data.byte(kItemframe) = al;
push(bx);
- findinvpos();
- delpointer();
+ findInvPos();
+ delPointer();
al = data.byte(kItemframe);
- geteitherad();
+ getEitherAd();
es.byte(bx+2) = 4;
es.byte(bx+3) = 255;
al = data.byte(kLastinvpos);
@@ -4518,14 +1489,14 @@ doswap1:
ax = pop();
data.byte(kObjecttype) = ah;
data.byte(kItemframe) = al;
- fillryan();
- readmouse();
- showpointer();
- worktoscreen();
- delpointer();
+ fillRyan();
+ readMouse();
+ showPointer();
+ workToScreen();
+ delPointer();
}
-void DreamGenContext::swapwithopen() {
+void DreamGenContext::swapWithOpen() {
STACK_CHECK;
al = data.byte(kItemframe);
ah = data.byte(kObjecttype);
@@ -4540,7 +1511,7 @@ difsub8:
data.word(kOldsubject) = ax;
bx = ax;
al = 34;
- commandwithob();
+ commandWithOb();
alreadyswap2:
ax = data.word(kMousebutton);
_cmp(ax, data.word(kOldbutton));
@@ -4551,14 +1522,14 @@ alreadyswap2:
goto doswap2;
return;
doswap2:
- geteitherad();
- isitworn();
+ getEitherAd();
+ isItWorn();
if (!flags.z())
goto notwornswap;
- wornerror();
+ wornError();
return;
notwornswap:
- delpointer();
+ delPointer();
al = data.byte(kItemframe);
_cmp(al, data.byte(kOpenedob));
if (!flags.z())
@@ -4567,10 +1538,10 @@ notwornswap:
_cmp(al, data.byte(kOpenedtype));
if (!flags.z())
goto isntsame2;
- errormessage1();
+ errorMessage1();
return;
isntsame2:
- checkobjectsize();
+ checkObjectSize();
_cmp(al, 0);
if (flags.z())
goto sizeok2;
@@ -4579,22 +1550,22 @@ sizeok2:
ah = data.byte(kObjecttype);
al = data.byte(kItemframe);
push(ax);
- findopenpos();
+ findOpenPos();
ax = es.word(bx);
data.byte(kItemframe) = al;
data.byte(kObjecttype) = ah;
_cmp(ah, 4);
if (!flags.z())
goto makeswapex;
- geteitherad();
+ getEitherAd();
es.byte(bx+2) = 20;
es.byte(bx+3) = 255;
goto actuallyswap;
makeswapex:
- transfertoex();
+ transferToEx();
data.byte(kItemframe) = al;
data.byte(kObjecttype) = 4;
- geteitherad();
+ getEitherAd();
es.byte(bx+2) = 20;
es.byte(bx+3) = 255;
actuallyswap:
@@ -4604,8 +1575,8 @@ actuallyswap:
data.byte(kObjecttype) = ah;
data.byte(kItemframe) = al;
push(bx);
- findopenpos();
- geteitherad();
+ findOpenPos();
+ getEitherAd();
al = data.byte(kOpenedtype);
es.byte(bx+2) = al;
al = data.byte(kOpenedob);
@@ -4617,30 +1588,30 @@ actuallyswap:
ax = pop();
data.byte(kObjecttype) = ah;
data.byte(kItemframe) = al;
- fillopen();
- fillryan();
- undertextline();
- readmouse();
- useopened();
- showpointer();
- worktoscreen();
- delpointer();
+ fillOpen();
+ fillRyan();
+ underTextLine();
+ readMouse();
+ useOpened();
+ showPointer();
+ workToScreen();
+ delPointer();
}
-void DreamGenContext::intoinv() {
+void DreamGenContext::inToInv() {
STACK_CHECK;
_cmp(data.byte(kPickup), 0);
if (!flags.z())
goto notout;
- outofinv();
+ outOfInv();
return;
notout:
- findinvpos();
+ findInvPos();
ax = es.word(bx);
_cmp(al, 255);
if (flags.z())
goto canplace1;
- swapwithinv();
+ swapWithInv();
return;
canplace1:
al = data.byte(kItemframe);
@@ -4656,7 +1627,7 @@ difsub1:
data.word(kOldsubject) = ax;
bx = ax;
al = 35;
- commandwithob();
+ commandWithOb();
alreadyplce:
ax = data.word(kMousebutton);
_cmp(ax, data.word(kOldbutton));
@@ -4667,25 +1638,25 @@ alreadyplce:
goto doplace;
return;
doplace:
- delpointer();
+ delPointer();
al = data.byte(kItemframe);
- getexad();
+ getExAd();
es.byte(bx+2) = 4;
es.byte(bx+3) = 255;
al = data.byte(kLastinvpos);
es.byte(bx+4) = al;
data.byte(kPickup) = 0;
- fillryan();
- readmouse();
- showpointer();
- outofinv();
- worktoscreen();
- delpointer();
+ fillRyan();
+ readMouse();
+ showPointer();
+ outOfInv();
+ workToScreen();
+ delPointer();
}
-void DreamGenContext::outofinv() {
+void DreamGenContext::outOfInv() {
STACK_CHECK;
- findinvpos();
+ findInvPos();
ax = es.word(bx);
_cmp(al, 255);
if (!flags.z())
@@ -4697,7 +1668,7 @@ canpick2:
_cmp(bx, 2);
if (!flags.z())
goto canpick2a;
- reexfrominv();
+ reExFromInv();
return;
canpick2a:
_cmp(ax, data.word(kOldsubject));
@@ -4711,7 +1682,7 @@ difsub3:
data.word(kOldsubject) = ax;
bx = ax;
al = 36;
- commandwithob();
+ commandWithOb();
alreadygrab:
ax = data.word(kMousebutton);
_cmp(ax, data.word(kOldbutton));
@@ -4722,24 +1693,24 @@ alreadygrab:
goto dograb;
return;
dograb:
- delpointer();
+ delPointer();
data.byte(kPickup) = 1;
- findinvpos();
+ findInvPos();
ax = es.word(bx);
data.byte(kItemframe) = al;
data.byte(kObjecttype) = ah;
- getexad();
+ getExAd();
es.byte(bx+2) = 20;
es.byte(bx+3) = 255;
- fillryan();
- readmouse();
- showpointer();
- intoinv();
- worktoscreen();
- delpointer();
+ fillRyan();
+ readMouse();
+ showPointer();
+ inToInv();
+ workToScreen();
+ delPointer();
}
-void DreamGenContext::getfreead() {
+void DreamGenContext::getFreeAd() {
STACK_CHECK;
ah = 0;
cl = 4;
@@ -4748,7 +1719,7 @@ void DreamGenContext::getfreead() {
es = data.word(kFreedat);
}
-void DreamGenContext::getexad() {
+void DreamGenContext::getExAd() {
STACK_CHECK;
ah = 0;
bx = 16;
@@ -4758,20 +1729,20 @@ void DreamGenContext::getexad() {
_add(bx, (0+2080+30000));
}
-void DreamGenContext::geteitherad() {
+void DreamGenContext::getEitherAd() {
STACK_CHECK;
_cmp(data.byte(kObjecttype), 4);
if (flags.z())
goto isinexlist;
al = data.byte(kItemframe);
- getfreead();
+ getFreeAd();
return;
isinexlist:
al = data.byte(kItemframe);
- getexad();
+ getExAd();
}
-void DreamGenContext::getanyad() {
+void DreamGenContext::getAnyAd() {
STACK_CHECK;
_cmp(data.byte(kObjecttype), 4);
if (flags.z())
@@ -4780,38 +1751,21 @@ void DreamGenContext::getanyad() {
if (flags.z())
goto isfree;
al = data.byte(kCommand);
- getsetad();
+ getSetAd();
ax = es.word(bx+4);
return;
isfree:
al = data.byte(kCommand);
- getfreead();
+ getFreeAd();
ax = es.word(bx+7);
return;
isex:
al = data.byte(kCommand);
- getexad();
+ getExAd();
ax = es.word(bx+7);
}
-void DreamGenContext::getanyaddir() {
- STACK_CHECK;
- _cmp(ah, 4);
- if (flags.z())
- goto isex3;
- _cmp(ah, 2);
- if (flags.z())
- goto isfree3;
- getsetad();
- return;
-isfree3:
- getfreead();
- return;
-isex3:
- getexad();
-}
-
-void DreamGenContext::getopenedsize() {
+void DreamGenContext::getOpenedSize() {
STACK_CHECK;
_cmp(data.byte(kOpenedtype), 4);
if (flags.z())
@@ -4820,21 +1774,21 @@ void DreamGenContext::getopenedsize() {
if (flags.z())
goto isfree2;
al = data.byte(kOpenedob);
- getsetad();
+ getSetAd();
ax = es.word(bx+3);
return;
isfree2:
al = data.byte(kOpenedob);
- getfreead();
+ getFreeAd();
ax = es.word(bx+7);
return;
isex2:
al = data.byte(kOpenedob);
- getexad();
+ getExAd();
ax = es.word(bx+7);
}
-void DreamGenContext::getsetad() {
+void DreamGenContext::getSetAd() {
STACK_CHECK;
ah = 0;
bx = 64;
@@ -4843,7 +1797,7 @@ void DreamGenContext::getsetad() {
es = data.word(kSetdat);
}
-void DreamGenContext::findinvpos() {
+void DreamGenContext::findInvPos() {
STACK_CHECK;
cx = data.word(kMousex);
_sub(cx, (80));
@@ -4873,7 +1827,7 @@ findinv2:
_add(bx, (0+(228*13)+32));
}
-void DreamGenContext::findopenpos() {
+void DreamGenContext::findOpenPos() {
STACK_CHECK;
cx = data.word(kMousex);
_sub(cx, (80));
@@ -4890,7 +1844,7 @@ findopenp1:
_add(bx, (0+(228*13)));
}
-void DreamGenContext::dropobject() {
+void DreamGenContext::dropObject() {
STACK_CHECK;
_cmp(data.byte(kCommandtype), 223);
if (flags.z())
@@ -4902,7 +1856,7 @@ void DreamGenContext::dropobject() {
bl = data.byte(kItemframe);
bh = data.byte(kObjecttype);
al = 37;
- commandwithob();
+ commandWithOb();
alreadydrop:
ax = data.word(kMousebutton);
_cmp(ax, data.word(kOldbutton));
@@ -4913,11 +1867,11 @@ alreadydrop:
goto dodrop;
return;
dodrop:
- geteitherad();
- isitworn();
+ getEitherAd();
+ isItWorn();
if (!flags.z())
goto nowornerror;
- wornerror();
+ wornError();
return;
nowornerror:
_cmp(data.byte(kReallocation), 47);
@@ -4927,12 +1881,12 @@ nowornerror:
_add(cl, 12);
ch = data.byte(kRyany);
_add(ch, 12);
- checkone();
+ checkOne();
_cmp(cl, 2);
if (flags.c())
goto nodroperror;
nodrop2:
- droperror();
+ dropError();
return;
nodroperror:
_cmp(data.byte(kMapxsize), 64);
@@ -4941,7 +1895,7 @@ nodroperror:
_cmp(data.byte(kMapysize), 64);
if (!flags.z())
goto notinlift;
- droperror();
+ dropError();
return;
notinlift:
al = data.byte(kItemframe);
@@ -4952,7 +1906,7 @@ notinlift:
dh = 'A';
compare();
if (flags.z())
- { cantdrop(); return; };
+ { cantDrop(); return; };
al = data.byte(kItemframe);
ah = 4;
cl = 'S';
@@ -4961,10 +1915,10 @@ notinlift:
dh = 'D';
compare();
if (flags.z())
- { cantdrop(); return; };
+ { cantDrop(); return; };
data.byte(kObjecttype) = 4;
al = data.byte(kItemframe);
- getexad();
+ getExAd();
es.byte(bx+2) = 0;
al = data.byte(kRyanx);
_add(al, 4);
@@ -4991,79 +1945,22 @@ notinlift:
es.byte(bx) = al;
}
-void DreamGenContext::droperror() {
- STACK_CHECK;
- data.byte(kCommandtype) = 255;
- delpointer();
- di = 76;
- bx = 21;
- al = 56;
- dl = 240;
- printmessage();
- worktoscreenm();
- cx = 50;
- hangonp();
- showpanel();
- showman();
- examicon();
- data.byte(kCommandtype) = 255;
- worktoscreenm();
-}
-
-void DreamGenContext::cantdrop() {
- STACK_CHECK;
- data.byte(kCommandtype) = 255;
- delpointer();
- di = 76;
- bx = 21;
- al = 24;
- dl = 240;
- printmessage();
- worktoscreenm();
- cx = 50;
- hangonp();
- showpanel();
- showman();
- examicon();
- data.byte(kCommandtype) = 255;
- worktoscreenm();
-}
-
-void DreamGenContext::wornerror() {
- STACK_CHECK;
- data.byte(kCommandtype) = 255;
- delpointer();
- di = 76;
- bx = 21;
- al = 57;
- dl = 240;
- printmessage();
- worktoscreenm();
- cx = 50;
- hangonp();
- showpanel();
- showman();
- examicon();
- data.byte(kCommandtype) = 255;
- worktoscreenm();
-}
-
-void DreamGenContext::removeobfrominv() {
+void DreamGenContext::removeObFromInv() {
STACK_CHECK;
_cmp(data.byte(kCommand), 100);
if (flags.z())
return /* (obnotexist) */;
- getanyad();
+ getAnyAd();
di = bx;
cl = data.byte(kCommand);
ch = 0;
- deleteexobject();
+ deleteExObject();
}
-void DreamGenContext::selectopenob() {
+void DreamGenContext::selectOpenOb() {
STACK_CHECK;
al = data.byte(kCommand);
- getanyad();
+ getAnyAd();
_cmp(al, 255);
if (!flags.z())
goto canopenit1;
@@ -5077,7 +1974,7 @@ canopenit1:
bl = data.byte(kCommand);
bh = data.byte(kObjecttype);
al = 38;
- commandwithob();
+ commandWithOb();
alreadyopob:
ax = data.word(kMousebutton);
_cmp(ax, data.word(kOldbutton));
@@ -5092,21 +1989,21 @@ doopenob:
data.byte(kOpenedob) = al;
al = data.byte(kObjecttype);
data.byte(kOpenedtype) = al;
- createpanel();
- showpanel();
- showman();
- examicon();
- showexit();
- openinv();
- openob();
- undertextline();
- readmouse();
- showpointer();
- worktoscreen();
- delpointer();
-}
-
-void DreamGenContext::useopened() {
+ createPanel();
+ showPanel();
+ showMan();
+ examIcon();
+ showExit();
+ openInv();
+ openOb();
+ underTextLine();
+ readMouse();
+ showPointer();
+ workToScreen();
+ delPointer();
+}
+
+void DreamGenContext::useOpened() {
STACK_CHECK;
_cmp(data.byte(kOpenedob), 255);
if (flags.z())
@@ -5114,15 +2011,15 @@ void DreamGenContext::useopened() {
_cmp(data.byte(kPickup), 0);
if (!flags.z())
goto notout2;
- outofopen();
+ outOfOpen();
return;
notout2:
- findopenpos();
+ findOpenPos();
ax = es.word(bx);
_cmp(al, 255);
if (flags.z())
goto canplace3;
- swapwithopen();
+ swapWithOpen();
return;
canplace3:
_cmp(data.byte(kPickup), 1);
@@ -5144,7 +2041,7 @@ difsub2:
data.word(kOldsubject) = ax;
bx = ax;
al = 35;
- commandwithob();
+ commandWithOb();
alreadyplc2:
ax = data.word(kMousebutton);
_cmp(ax, data.word(kOldbutton));
@@ -5155,14 +2052,14 @@ alreadyplc2:
goto doplace2;
return;
doplace2:
- geteitherad();
- isitworn();
+ getEitherAd();
+ isItWorn();
if (!flags.z())
goto notworntoopen;
- wornerror();
+ wornError();
return;
notworntoopen:
- delpointer();
+ delPointer();
al = data.byte(kItemframe);
_cmp(al, data.byte(kOpenedob));
if (!flags.z())
@@ -5171,10 +2068,10 @@ notworntoopen:
_cmp(al, data.byte(kOpenedtype));
if (!flags.z())
goto isntsame;
- errormessage1();
+ errorMessage1();
return;
isntsame:
- checkobjectsize();
+ checkObjectSize();
_cmp(al, 0);
if (flags.z())
goto sizeok1;
@@ -5182,7 +2079,7 @@ isntsame:
sizeok1:
data.byte(kPickup) = 0;
al = data.byte(kItemframe);
- geteitherad();
+ getEitherAd();
al = data.byte(kOpenedtype);
es.byte(bx+2) = al;
al = data.byte(kOpenedob);
@@ -5191,91 +2088,21 @@ sizeok1:
es.byte(bx+4) = al;
al = data.byte(kReallocation);
es.byte(bx+5) = al;
- fillopen();
- undertextline();
- readmouse();
- useopened();
- showpointer();
- worktoscreen();
- delpointer();
-}
-
-void DreamGenContext::errormessage1() {
- STACK_CHECK;
- delpointer();
- di = 76;
- bx = 21;
- al = 58;
- dl = 240;
- printmessage();
- readmouse();
- showpointer();
- worktoscreen();
- delpointer();
- cx = 50;
- hangonp();
- showpanel();
- showman();
- examicon();
- readmouse();
- useopened();
- showpointer();
- worktoscreen();
- delpointer();
-}
-
-void DreamGenContext::errormessage2() {
- STACK_CHECK;
- data.byte(kCommandtype) = 255;
- delpointer();
- di = 76;
- bx = 21;
- al = 59;
- dl = 240;
- printmessage();
- readmouse();
- showpointer();
- worktoscreen();
- delpointer();
- cx = 50;
- hangonp();
- showpanel();
- showman();
- examicon();
- readmouse();
- useopened();
- showpointer();
- worktoscreen();
- delpointer();
+ fillOpen();
+ underTextLine();
+ readMouse();
+ useOpened();
+ showPointer();
+ workToScreen();
+ delPointer();
}
-void DreamGenContext::errormessage3() {
+void DreamGenContext::checkObjectSize() {
STACK_CHECK;
- delpointer();
- di = 76;
- bx = 21;
- al = 60;
- dl = 240;
- printmessage();
- worktoscreenm();
- cx = 50;
- hangonp();
- showpanel();
- showman();
- examicon();
- readmouse();
- useopened();
- showpointer();
- worktoscreen();
- delpointer();
-}
-
-void DreamGenContext::checkobjectsize() {
- STACK_CHECK;
- getopenedsize();
+ getOpenedSize();
push(ax);
al = data.byte(kItemframe);
- geteitherad();
+ getEitherAd();
al = es.byte(bx+9);
cx = pop();
_cmp(al, 255);
@@ -5289,7 +2116,7 @@ notunsized:
_cmp(cl, 100);
if (flags.c())
goto isntspecial;
- errormessage3();
+ errorMessage3();
goto sizewrong;
isntspecial:
_cmp(cl, al);
@@ -5303,14 +2130,14 @@ specialcase:
_cmp(cl, al);
if (!flags.c())
goto sizeok;
- errormessage2();
+ errorMessage2();
goto sizewrong;
bothspecial:
_sub(cl, 100);
_cmp(al, cl);
if (flags.z())
goto sizeok;
- errormessage3();
+ errorMessage3();
sizewrong:
al = 1;
return;
@@ -5318,12 +2145,12 @@ sizeok:
al = 0;
}
-void DreamGenContext::outofopen() {
+void DreamGenContext::outOfOpen() {
STACK_CHECK;
_cmp(data.byte(kOpenedob), 255);
if (flags.z())
goto cantuseopen;
- findopenpos();
+ findOpenPos();
ax = es.word(bx);
_cmp(al, 255);
if (!flags.z())
@@ -5343,7 +2170,7 @@ difsub4:
data.word(kOldsubject) = ax;
bx = ax;
al = 36;
- commandwithob();
+ commandWithOb();
alreadygrb:
ax = data.word(kMousebutton);
_cmp(ax, data.word(kOldbutton));
@@ -5355,43 +2182,43 @@ alreadygrb:
_cmp(ax, 2);
if (!flags.z())
return /* (notletgo4) */;
- reexfromopen();
+ reExFromOpen();
return;
dogrb:
- delpointer();
+ delPointer();
data.byte(kPickup) = 1;
- findopenpos();
+ findOpenPos();
ax = es.word(bx);
data.byte(kItemframe) = al;
data.byte(kObjecttype) = ah;
_cmp(ah, 4);
if (!flags.z())
goto makeintoex;
- geteitherad();
+ getEitherAd();
es.byte(bx+2) = 20;
es.byte(bx+3) = 255;
goto actuallyout;
makeintoex:
- transfertoex();
+ transferToEx();
data.byte(kItemframe) = al;
data.byte(kObjecttype) = 4;
- geteitherad();
+ getEitherAd();
es.byte(bx+2) = 20;
es.byte(bx+3) = 255;
actuallyout:
- fillopen();
- undertextline();
- readmouse();
- useopened();
- showpointer();
- worktoscreen();
- delpointer();
+ fillOpen();
+ underTextLine();
+ readMouse();
+ useOpened();
+ showPointer();
+ workToScreen();
+ delPointer();
}
-void DreamGenContext::transfertoex() {
+void DreamGenContext::transferToEx() {
STACK_CHECK;
- emergencypurge();
- getexpos();
+ emergencyPurge();
+ getExPos();
al = data.byte(kExpos);
push(ax);
push(di);
@@ -5415,9 +2242,9 @@ void DreamGenContext::transfertoex() {
es.byte(di+4) = al;
al = data.byte(kItemframe);
data.byte(kItemtotran) = al;
- transfermap();
- transferinv();
- transfertext();
+ transferMap();
+ transferInv();
+ transferText();
al = data.byte(kItemframe);
ah = 0;
bx = 16;
@@ -5425,11 +2252,11 @@ void DreamGenContext::transfertoex() {
ds = data.word(kFreedat);
si = ax;
ds.byte(si+2) = 254;
- pickupconts();
+ pickupConts();
ax = pop();
}
-void DreamGenContext::pickupconts() {
+void DreamGenContext::pickupConts() {
STACK_CHECK;
al = ds.byte(si+7);
_cmp(al, 255);
@@ -5454,7 +2281,7 @@ pickupcontloop:
if (!flags.z())
goto notinsidethis;
data.byte(kItemtotran) = cl;
- transfercontoex();
+ transferConToEx();
notinsidethis:
ax = pop();
dx = pop();
@@ -5468,14 +2295,14 @@ notinsidethis:
goto pickupcontloop;
}
-void DreamGenContext::transfercontoex() {
+void DreamGenContext::transferConToEx() {
STACK_CHECK;
push(es);
push(bx);
push(dx);
push(es);
push(bx);
- getexpos();
+ getExPos();
si = pop();
ds = pop();
push(di);
@@ -5490,44 +2317,15 @@ void DreamGenContext::transfercontoex() {
es.byte(di+1) = al;
es.byte(di+3) = dl;
es.byte(di+2) = 4;
- transfermap();
- transferinv();
- transfertext();
+ transferMap();
+ transferInv();
+ transferText();
si = pop();
ds = pop();
ds.byte(si+2) = 255;
}
-void DreamGenContext::transfertext() {
- STACK_CHECK;
- es = data.word(kExtras);
- al = data.byte(kExpos);
- ah = 0;
- _add(ax, ax);
- bx = (0+2080+30000+(16*114));
- _add(bx, ax);
- di = data.word(kExtextpos);
- es.word(bx) = di;
- _add(di, (0+2080+30000+(16*114)+((114+2)*2)));
- al = data.byte(kItemtotran);
- ah = 0;
- _add(ax, ax);
- ds = data.word(kFreedesc);
- bx = (0);
- _add(bx, ax);
- si = (0+(82*2));
- ax = ds.word(bx);
- _add(si, ax);
-moretext:
- _lodsb();
- _stosb();
- _inc(data.word(kExtextpos));
- _cmp(al, 0);
- if (!flags.z())
- goto moretext;
-}
-
-void DreamGenContext::purgealocation() {
+void DreamGenContext::purgeALocation() {
STACK_CHECK;
push(ax);
es = data.word(kExtras);
@@ -5545,7 +2343,7 @@ purgeloc:
push(es);
push(bx);
push(cx);
- deleteexobject();
+ deleteExObject();
cx = pop();
bx = pop();
es = pop();
@@ -5558,7 +2356,7 @@ dontpurge:
goto purgeloc;
}
-void DreamGenContext::emergencypurge() {
+void DreamGenContext::emergencyPurge() {
STACK_CHECK;
checkpurgeagain:
ax = data.word(kExframepos);
@@ -5566,7 +2364,7 @@ checkpurgeagain:
_cmp(ax, (30000));
if (flags.c())
goto notnearframeend;
- purgeanitem();
+ purgeAnItem();
goto checkpurgeagain;
notnearframeend:
ax = data.word(kExtextpos);
@@ -5574,11 +2372,11 @@ notnearframeend:
_cmp(ax, (18000));
if (flags.c())
return /* (notneartextend) */;
- purgeanitem();
+ purgeAnItem();
goto checkpurgeagain;
}
-void DreamGenContext::purgeanitem() {
+void DreamGenContext::purgeAnItem() {
STACK_CHECK;
es = data.word(kExtras);
di = (0+2080+30000);
@@ -5599,7 +2397,7 @@ iscup:
_cmp(es.byte(di+11), bl);
if (flags.z())
goto cantpurge;
- deleteexobject();
+ deleteExObject();
return;
cantpurge:
_add(di, 16);
@@ -5618,7 +2416,7 @@ lookforpurge2:
_cmp(es.byte(di+12), 255);
if (!flags.z())
goto cantpurge2;
- deleteexobject();
+ deleteExObject();
return;
cantpurge2:
_add(di, 16);
@@ -5628,7 +2426,7 @@ cantpurge2:
goto lookforpurge2;
}
-void DreamGenContext::deleteexobject() {
+void DreamGenContext::deleteExObject() {
STACK_CHECK;
push(cx);
push(cx);
@@ -5641,15 +2439,15 @@ void DreamGenContext::deleteexobject() {
cl = al;
_add(al, al);
_add(al, cl);
- deleteexframe();
+ deleteExFrame();
ax = pop();
cl = al;
_add(al, al);
_add(al, cl);
_inc(al);
- deleteexframe();
+ deleteExFrame();
ax = pop();
- deleteextext();
+ deleteExText();
bx = pop();
bh = bl;
bl = 4;
@@ -5662,7 +2460,7 @@ deleteconts:
push(bx);
push(cx);
push(di);
- deleteexobject();
+ deleteExObject();
di = pop();
cx = pop();
bx = pop();
@@ -5674,7 +2472,7 @@ notinsideex:
goto deleteconts;
}
-void DreamGenContext::deleteexframe() {
+void DreamGenContext::deleteExFrame() {
STACK_CHECK;
di = (0);
ah = 0;
@@ -5715,7 +2513,7 @@ beforethisone:
goto shuffleadsdown;
}
-void DreamGenContext::deleteextext() {
+void DreamGenContext::deleteExText() {
STACK_CHECK;
di = (0+2080+30000+(16*114));
ah = 0;
@@ -5759,261 +2557,26 @@ beforethistext:
goto shuffletextads;
}
-void DreamGenContext::blockget() {
- STACK_CHECK;
- ah = al;
- al = 0;
- ds = data.word(kBackdrop);
- si = (0+192);
- _add(si, ax);
-}
-
-void DreamGenContext::drawfloor() {
- STACK_CHECK;
- push(es);
- push(bx);
- eraseoldobs();
- drawflags();
- calcmapad();
- doblocks();
- showallobs();
- showallfree();
- showallex();
- paneltomap();
- initrain();
- data.byte(kNewobs) = 0;
- bx = pop();
- es = pop();
-}
-
-void DreamGenContext::autolook() {
- STACK_CHECK;
- ax = data.word(kMousex);
- _cmp(ax, data.word(kOldx));
- if (!flags.z())
- goto diffmouse;
- ax = data.word(kMousey);
- _cmp(ax, data.word(kOldy));
- if (!flags.z())
- goto diffmouse;
- _dec(data.word(kLookcounter));
- _cmp(data.word(kLookcounter), 0);
- if (!flags.z())
- return /* (noautolook) */;
- _cmp(data.word(kWatchingtime), 0);
- if (!flags.z())
- return /* (noautolook) */;
- dolook();
- return;
-diffmouse:
- data.word(kLookcounter) = 1000;
-}
-
-void DreamGenContext::look() {
- STACK_CHECK;
- _cmp(data.word(kWatchingtime), 0);
- if (!flags.z())
- { blank(); return; };
- _cmp(data.byte(kPointermode), 2);
- if (flags.z())
- { blank(); return; };
- _cmp(data.byte(kCommandtype), 241);
- if (flags.z())
- goto alreadylook;
- data.byte(kCommandtype) = 241;
- al = 25;
- commandonly();
-alreadylook:
- _cmp(data.word(kMousebutton), 1);
- if (!flags.z())
- return /* (nolook) */;
- ax = data.word(kMousebutton);
- _cmp(ax, data.word(kOldbutton));
- if (flags.z())
- return /* (nolook) */;
- dolook();
-}
-
-void DreamGenContext::dolook() {
- STACK_CHECK;
- createpanel();
- showicon();
- undertextline();
- worktoscreenm();
- data.byte(kCommandtype) = 255;
- dumptextline();
- bl = data.byte(kRoomnum);
- _and(bl, 31);
- bh = 0;
- _add(bx, bx);
- es = data.word(kRoomdesc);
- _add(bx, (0));
- si = es.word(bx);
- _add(si, (0+(38*2)));
- findnextcolon();
- di = 66;
- _cmp(data.byte(kReallocation), 50);
- if (flags.c())
- goto notdream3;
- di = 40;
-notdream3:
- bx = 80;
- dl = 241;
- printslow();
- _cmp(al, 1);
- if (flags.z())
- goto afterlook;
- cx = 400;
- hangonp();
-afterlook:
- data.byte(kPointermode) = 0;
- data.byte(kCommandtype) = 0;
- redrawmainscrn();
- worktoscreenm();
-}
-
-void DreamGenContext::redrawmainscrn() {
- STACK_CHECK;
- data.word(kTimecount) = 0;
- createpanel();
- data.byte(kNewobs) = 0;
- drawfloor();
- printsprites();
- reelsonscreen();
- showicon();
- getunderzoom();
- undertextline();
- readmouse();
- data.byte(kCommandtype) = 255;
-}
-
-void DreamGenContext::getback1() {
- STACK_CHECK;
- _cmp(data.byte(kPickup), 0);
- if (flags.z())
- goto notgotobject;
- blank();
- return;
-notgotobject:
- _cmp(data.byte(kCommandtype), 202);
- if (flags.z())
- goto alreadyget;
- data.byte(kCommandtype) = 202;
- al = 26;
- commandonly();
-alreadyget:
- ax = data.word(kMousebutton);
- _cmp(ax, data.word(kOldbutton));
- if (flags.z())
- return /* (nogetback) */;
- _and(ax, 1);
- if (!flags.z())
- goto dogetback;
- return;
-dogetback:
- data.byte(kGetback) = 1;
- data.byte(kPickup) = 0;
-}
-
-void DreamGenContext::talk() {
- STACK_CHECK;
- data.byte(kTalkpos) = 0;
- data.byte(kInmaparea) = 0;
- al = data.byte(kCommand);
- data.byte(kCharacter) = al;
- createpanel();
- showpanel();
- showman();
- showexit();
- undertextline();
- convicons();
- starttalk();
- data.byte(kCommandtype) = 255;
- readmouse();
- showpointer();
- worktoscreen();
-waittalk:
- delpointer();
- readmouse();
- animpointer();
- showpointer();
- vsync();
- dumppointer();
- dumptextline();
- data.byte(kGetback) = 0;
- bx = offset_talklist;
- checkcoords();
- _cmp(data.byte(kQuitrequested), 0);
- if (!flags.z())
- goto finishtalk;
- _cmp(data.byte(kGetback), 0);
- if (flags.z())
- goto waittalk;
-finishtalk:
- bx = data.word(kPersondata);
- es = cs;
- _cmp(data.byte(kTalkpos), 4);
- if (flags.c())
- goto notnexttalk;
- al = es.byte(bx+7);
- _or(al, 128);
- es.byte(bx+7) = al;
-notnexttalk:
- redrawmainscrn();
- worktoscreenm();
- _cmp(data.byte(kSpeechloaded), 1);
- if (!flags.z())
- return /* (nospeech) */;
- cancelch1();
- data.byte(kVolumedirection) = -1;
- data.byte(kVolumeto) = 0;
-}
-
-void DreamGenContext::convicons() {
- STACK_CHECK;
- al = data.byte(kCharacter);
- _and(al, 127);
- getpersframe();
- di = 234;
- bx = 2;
- data.word(kCurrentframe) = ax;
- findsource();
- ax = data.word(kCurrentframe);
- _sub(ax, data.word(kTakeoff));
- ah = 0;
- showframe();
-}
-
-void DreamGenContext::getpersframe() {
- STACK_CHECK;
- ah = 0;
- _add(ax, ax);
- bx = ax;
- es = data.word(kPeople);
- _add(bx, (0));
- ax = es.word(bx);
-}
-
-void DreamGenContext::starttalk() {
+void DreamGenContext::startTalk() {
STACK_CHECK;
data.byte(kTalkmode) = 0;
al = data.byte(kCharacter);
_and(al, 127);
- getpersontext();
+ getPersonText();
data.word(kCharshift) = 91+91;
di = 66;
bx = 64;
dl = 241;
al = 0;
ah = 79;
- printdirect();
+ printDirect();
data.word(kCharshift) = 0;
di = 66;
bx = 80;
dl = 241;
al = 0;
ah = 0;
- printdirect();
+ printDirect();
data.byte(kSpeechloaded) = 0;
al = data.byte(kCharacter);
_and(al, 127);
@@ -6023,17 +2586,17 @@ void DreamGenContext::starttalk() {
cl = 'C';
dl = 'R';
dh = data.byte(kReallocation);
- loadspeech();
+ loadSpeech();
_cmp(data.byte(kSpeechloaded), 1);
if (!flags.z())
return /* (nospeech1) */;
data.byte(kVolumedirection) = 1;
data.byte(kVolumeto) = 6;
al = 50+12;
- playchannel1();
+ playChannel1();
}
-void DreamGenContext::getpersontext() {
+void DreamGenContext::getPersonText() {
STACK_CHECK;
ah = 0;
cx = 64*2;
@@ -6047,41 +2610,7 @@ void DreamGenContext::getpersontext() {
si = ax;
}
-void DreamGenContext::moretalk() {
- STACK_CHECK;
- _cmp(data.byte(kTalkmode), 0);
- if (flags.z())
- goto canmore;
- redes();
- return;
-canmore:
- _cmp(data.byte(kCommandtype), 215);
- if (flags.z())
- goto alreadymore;
- data.byte(kCommandtype) = 215;
- al = 49;
- commandonly();
-alreadymore:
- ax = data.word(kMousebutton);
- _cmp(ax, data.word(kOldbutton));
- if (flags.z())
- return /* (nomore) */;
- _and(ax, 1);
- if (!flags.z())
- goto domoretalk;
- return;
-domoretalk:
- data.byte(kTalkmode) = 2;
- data.byte(kTalkpos) = 4;
- _cmp(data.byte(kCharacter), 100);
- if (flags.c())
- goto notsecondpart;
- data.byte(kTalkpos) = 48;
-notsecondpart:
- dosometalk();
-}
-
-void DreamGenContext::dosometalk() {
+void DreamGenContext::doSomeTalk() {
STACK_CHECK;
dospeech:
al = data.byte(kTalkpos);
@@ -6107,11 +2636,11 @@ dospeech:
goto endheartalk;
push(es);
push(si);
- createpanel();
- showpanel();
- showman();
- showexit();
- convicons();
+ createPanel();
+ showPanel();
+ showMan();
+ showExit();
+ convIcons();
si = pop();
es = pop();
di = 164;
@@ -6119,7 +2648,7 @@ dospeech:
dl = 144;
al = 0;
ah = 0;
- printdirect();
+ printDirect();
al = data.byte(kCharacter);
_and(al, 127);
ah = 0;
@@ -6131,17 +2660,17 @@ dospeech:
cl = 'C';
dl = 'R';
dh = data.byte(kReallocation);
- loadspeech();
+ loadSpeech();
_cmp(data.byte(kSpeechloaded), 0);
if (flags.z())
goto noplay1;
al = 62;
- playchannel1();
+ playChannel1();
noplay1:
data.byte(kPointermode) = 3;
- worktoscreenm();
+ workToScreenM();
cx = 180;
- hangonpq();
+ hangOnPQ();
if (!flags.c())
goto _tmp1;
return;
@@ -6176,11 +2705,11 @@ _tmp1:
goto skiptalk2;
push(es);
push(si);
- createpanel();
- showpanel();
- showman();
- showexit();
- convicons();
+ createPanel();
+ showPanel();
+ showMan();
+ showExit();
+ convIcons();
si = pop();
es = pop();
di = 48;
@@ -6188,7 +2717,7 @@ _tmp1:
dl = 144;
al = 0;
ah = 0;
- printdirect();
+ printDirect();
al = data.byte(kCharacter);
_and(al, 127);
ah = 0;
@@ -6200,17 +2729,17 @@ _tmp1:
cl = 'C';
dl = 'R';
dh = data.byte(kReallocation);
- loadspeech();
+ loadSpeech();
_cmp(data.byte(kSpeechloaded), 0);
if (flags.z())
goto noplay2;
al = 62;
- playchannel1();
+ playChannel1();
noplay2:
data.byte(kPointermode) = 3;
- worktoscreenm();
+ workToScreenM();
cx = 180;
- hangonpq();
+ hangOnPQ();
if (!flags.c())
goto skiptalk2;
return;
@@ -6221,206 +2750,14 @@ endheartalk:
data.byte(kPointermode) = 0;
}
-void DreamGenContext::hangonpq() {
- STACK_CHECK;
- data.byte(kGetback) = 0;
- bx = 0;
-hangloopq:
- push(cx);
- push(bx);
- delpointer();
- readmouse();
- animpointer();
- showpointer();
- vsync();
- dumppointer();
- dumptextline();
- bx = offset_quitlist;
- checkcoords();
- bx = pop();
- cx = pop();
- _cmp(data.byte(kGetback), 1);
- if (flags.z())
- goto quitconv;
- _cmp(data.byte(kQuitrequested), 0);
- if (!flags.z())
- goto quitconv;
- _cmp(data.byte(kSpeechloaded), 1);
- if (!flags.z())
- goto notspeaking;
- _cmp(data.byte(kCh1playing), 255);
- if (!flags.z())
- goto notspeaking;
- _inc(bx);
- _cmp(bx, 40);
- if (flags.z())
- goto finishconv;
-notspeaking:
- _cmp(data.word(kMousebutton), 0);
- if (flags.z())
- goto hangloopq;
- _cmp(data.word(kOldbutton), 0);
- if (!flags.z())
- goto hangloopq;
-finishconv:
- delpointer();
- data.byte(kPointermode) = 0;
- flags._c = false;
- return;
-quitconv:
- delpointer();
- data.byte(kPointermode) = 0;
- cancelch1();
- flags._c = true;
- }
-
-void DreamGenContext::redes() {
- STACK_CHECK;
- _cmp(data.byte(kCh1playing), 255);
- if (!flags.z())
- goto cantredes;
- _cmp(data.byte(kTalkmode), 2);
- if (flags.z())
- goto canredes;
-cantredes:
- blank();
- return;
-canredes:
- _cmp(data.byte(kCommandtype), 217);
- if (flags.z())
- goto alreadyreds;
- data.byte(kCommandtype) = 217;
- al = 50;
- commandonly();
-alreadyreds:
- ax = data.word(kMousebutton);
- _and(ax, 1);
- if (!flags.z())
- goto doredes;
- return;
-doredes:
- delpointer();
- createpanel();
- showpanel();
- showman();
- showexit();
- convicons();
- starttalk();
- readmouse();
- showpointer();
- worktoscreen();
- delpointer();
-}
-
-void DreamGenContext::newplace() {
- STACK_CHECK;
- _cmp(data.byte(kNeedtotravel), 1);
- if (flags.z())
- goto istravel;
- _cmp(data.byte(kAutolocation), -1);
- if (!flags.z())
- goto isautoloc;
- return;
-isautoloc:
- al = data.byte(kAutolocation);
- data.byte(kNewlocation) = al;
- data.byte(kAutolocation) = -1;
- return;
-istravel:
- data.byte(kNeedtotravel) = 0;
- selectlocation();
-}
-
-void DreamGenContext::selectlocation() {
- STACK_CHECK;
- data.byte(kInmaparea) = 0;
- clearbeforeload();
- data.byte(kGetback) = 0;
- data.byte(kPointerframe) = 22;
- readcitypic();
- showcity();
- getridoftemp();
- readdesticon();
- loadtraveltext();
- showpanel();
- showman();
- showarrows();
- showexit();
- locationpic();
- undertextline();
- data.byte(kCommandtype) = 255;
- readmouse();
- data.byte(kPointerframe) = 0;
- showpointer();
- worktoscreen();
- al = 9;
- ah = 255;
- playchannel0();
- data.byte(kNewlocation) = 255;
-select:
- _cmp(data.byte(kQuitrequested), 0);
- if (!flags.z())
- goto quittravel;
- delpointer();
- readmouse();
- showpointer();
- vsync();
- dumppointer();
- dumptextline();
- _cmp(data.byte(kGetback), 1);
- if (flags.z())
- goto quittravel;
- bx = offset_destlist;
- checkcoords();
- _cmp(data.byte(kNewlocation), 255);
- if (flags.z())
- goto select;
- al = data.byte(kNewlocation);
- _cmp(al, data.byte(kLocation));
- if (flags.z())
- goto quittravel;
- getridoftemp();
- getridoftemp2();
- getridoftemp3();
- es = data.word(kTraveltext);
- deallocatemem();
- return;
-quittravel:
- al = data.byte(kReallocation);
- data.byte(kNewlocation) = al;
- data.byte(kGetback) = 0;
- getridoftemp();
- getridoftemp2();
- getridoftemp3();
- es = data.word(kTraveltext);
- deallocatemem();
-}
-
-void DreamGenContext::showcity() {
- STACK_CHECK;
- clearwork();
- ds = data.word(kTempgraphics);
- di = 57;
- bx = 32;
- al = 0;
- ah = 0;
- showframe();
- ds = data.word(kTempgraphics);
- di = 120+57;
- bx = 32;
- al = 1;
- ah = 0;
- showframe();
-}
-
-void DreamGenContext::lookatplace() {
+void DreamGenContext::lookAtPlace() {
STACK_CHECK;
_cmp(data.byte(kCommandtype), 224);
if (flags.z())
goto alreadyinfo;
data.byte(kCommandtype) = 224;
al = 27;
- commandonly();
+ commandOnly();
alreadyinfo:
ax = data.word(kMousebutton);
_and(ax, 1);
@@ -6434,20 +2771,20 @@ alreadyinfo:
if (!flags.c())
return /* (noinfo) */;
push(bx);
- delpointer();
- deltextline();
- getundercentre();
+ delPointer();
+ delTextLine();
+ getUnderCentre();
ds = data.word(kTempgraphics3);
al = 0;
ah = 0;
di = 60;
bx = 72;
- showframe();
+ showFrame();
al = 4;
ah = 0;
di = 60;
bx = 72+55;
- showframe();
+ showFrame();
_cmp(data.byte(kForeignrelease), 0);
if (flags.z())
goto _tmp1;
@@ -6455,7 +2792,7 @@ alreadyinfo:
ah = 0;
di = 60;
bx = 72+55+21;
- showframe();
+ showFrame();
_tmp1:
bx = pop();
bh = 0;
@@ -6463,7 +2800,7 @@ _tmp1:
es = data.word(kTraveltext);
si = es.word(bx);
_add(si, (66*2));
- findnextcolon();
+ findNextColon();
di = 63;
bx = 84;
_cmp(data.byte(kForeignrelease), 0);
@@ -6474,17 +2811,17 @@ _tmp2:
dl = 191;
al = 0;
ah = 0;
- printdirect();
- worktoscreenm();
+ printDirect();
+ workToScreenM();
cx = 500;
- hangonp();
+ hangOnP();
data.byte(kPointermode) = 0;
data.byte(kPointerframe) = 0;
- putundercentre();
- worktoscreenm();
+ putUnderCentre();
+ workToScreenM();
}
-void DreamGenContext::getundercentre() {
+void DreamGenContext::getUnderCentre() {
STACK_CHECK;
di = 58;
bx = 72;
@@ -6492,10 +2829,10 @@ void DreamGenContext::getundercentre() {
si = 0;
cl = 254;
ch = 110;
- multiget();
+ multiGet();
}
-void DreamGenContext::putundercentre() {
+void DreamGenContext::putUnderCentre() {
STACK_CHECK;
di = 58;
bx = 72;
@@ -6503,12 +2840,12 @@ void DreamGenContext::putundercentre() {
si = 0;
cl = 254;
ch = 110;
- multiput();
+ multiPut();
}
-void DreamGenContext::locationpic() {
+void DreamGenContext::locationPic() {
STACK_CHECK;
- getdestinfo();
+ getDestInfo();
al = es.byte(si);
push(es);
push(si);
@@ -6526,7 +2863,7 @@ gotgraphic:
_add(di, 104);
bx = 138+14;
ah = 0;
- showframe();
+ showFrame();
si = pop();
es = pop();
al = data.byte(kDestpos);
@@ -6538,7 +2875,7 @@ gotgraphic:
bx = 140+14;
ds = data.word(kTempgraphics);
ah = 0;
- showframe();
+ showFrame();
notinthisone:
bl = data.byte(kDestpos);
bh = 0;
@@ -6551,212 +2888,67 @@ notinthisone:
dl = 241;
al = 0;
ah = 0;
- printdirect();
+ printDirect();
}
-void DreamGenContext::getdestinfo() {
+void DreamGenContext::getDestInfo() {
STACK_CHECK;
al = data.byte(kDestpos);
ah = 0;
push(ax);
dx = data;
es = dx;
- si = 8011;
+ si = 1249;
_add(si, ax);
cl = es.byte(si);
ax = pop();
push(cx);
dx = data;
es = dx;
- si = 8027;
+ si = 1265;
_add(si, ax);
ax = pop();
}
-void DreamGenContext::showarrows() {
- STACK_CHECK;
- di = 116-12;
- bx = 16;
- ds = data.word(kTempgraphics);
- al = 0;
- ah = 0;
- showframe();
- di = 226+12;
- bx = 16;
- ds = data.word(kTempgraphics);
- al = 1;
- ah = 0;
- showframe();
- di = 280;
- bx = 14;
- ds = data.word(kTempgraphics);
- al = 2;
- ah = 0;
- showframe();
-}
-
-void DreamGenContext::nextdest() {
- STACK_CHECK;
- _cmp(data.byte(kCommandtype), 218);
- if (flags.z())
- goto alreadydu;
- data.byte(kCommandtype) = 218;
- al = 28;
- commandonly();
-alreadydu:
- ax = data.word(kMousebutton);
- _and(ax, 1);
- if (flags.z())
- return /* (nodu) */;
- _cmp(ax, data.word(kOldbutton));
- if (flags.z())
- return /* (nodu) */;
-searchdestup:
- _inc(data.byte(kDestpos));
- _cmp(data.byte(kDestpos), 15);
- if (!flags.z())
- goto notlastdest;
- data.byte(kDestpos) = 0;
-notlastdest:
- getdestinfo();
- _cmp(al, 0);
- if (flags.z())
- goto searchdestup;
- data.byte(kNewtextline) = 1;
- deltextline();
- delpointer();
- showpanel();
- showman();
- showarrows();
- locationpic();
- undertextline();
- readmouse();
- showpointer();
- worktoscreen();
- delpointer();
-}
-
-void DreamGenContext::lastdest() {
- STACK_CHECK;
- _cmp(data.byte(kCommandtype), 219);
- if (flags.z())
- goto alreadydd;
- data.byte(kCommandtype) = 219;
- al = 29;
- commandonly();
-alreadydd:
- ax = data.word(kMousebutton);
- _and(ax, 1);
- if (flags.z())
- return /* (nodd) */;
- _cmp(ax, data.word(kOldbutton));
- if (flags.z())
- return /* (nodd) */;
-searchdestdown:
- _dec(data.byte(kDestpos));
- _cmp(data.byte(kDestpos), -1);
- if (!flags.z())
- goto notfirstdest;
- data.byte(kDestpos) = 15;
-notfirstdest:
- getdestinfo();
- _cmp(al, 0);
- if (flags.z())
- goto searchdestdown;
- data.byte(kNewtextline) = 1;
- deltextline();
- delpointer();
- showpanel();
- showman();
- showarrows();
- locationpic();
- undertextline();
- readmouse();
- showpointer();
- worktoscreen();
- delpointer();
-}
-
-void DreamGenContext::destselect() {
- STACK_CHECK;
- _cmp(data.byte(kCommandtype), 222);
- if (flags.z())
- goto alreadytrav;
- data.byte(kCommandtype) = 222;
- al = 30;
- commandonly();
-alreadytrav:
- ax = data.word(kMousebutton);
- _and(ax, 1);
- if (flags.z())
- return /* (notrav) */;
- _cmp(ax, data.word(kOldbutton));
- if (flags.z())
- return /* (notrav) */;
- getdestinfo();
- al = data.byte(kDestpos);
- data.byte(kNewlocation) = al;
-}
-
-void DreamGenContext::getlocation() {
- STACK_CHECK;
- ah = 0;
- bx = ax;
- dx = data;
- es = dx;
- _add(bx, 8011);
- al = es.byte(bx);
-}
-
-void DreamGenContext::setlocation() {
- STACK_CHECK;
- ah = 0;
- bx = ax;
- dx = data;
- es = dx;
- _add(bx, 8011);
- es.byte(bx) = 1;
-}
-
-void DreamGenContext::resetlocation() {
+void DreamGenContext::resetLocation() {
STACK_CHECK;
push(ax);
_cmp(al, 5);
if (!flags.z())
goto notdelhotel;
- purgealocation();
+ purgeALocation();
al = 21;
- purgealocation();
+ purgeALocation();
al = 22;
- purgealocation();
+ purgeALocation();
al = 27;
- purgealocation();
+ purgeALocation();
goto clearedlocations;
notdelhotel:
_cmp(al, 8);
if (!flags.z())
goto notdeltvstud;
- purgealocation();
+ purgeALocation();
al = 28;
- purgealocation();
+ purgeALocation();
goto clearedlocations;
notdeltvstud:
_cmp(al, 6);
if (!flags.z())
goto notdelsarters;
- purgealocation();
+ purgeALocation();
al = 20;
- purgealocation();
+ purgeALocation();
al = 25;
- purgealocation();
+ purgeALocation();
goto clearedlocations;
notdelsarters:
_cmp(al, 13);
if (!flags.z())
goto notdelboathouse;
- purgealocation();
+ purgeALocation();
al = 29;
- purgealocation();
+ purgeALocation();
goto clearedlocations;
notdelboathouse:
clearedlocations:
@@ -6765,252 +2957,19 @@ clearedlocations:
bx = ax;
dx = data;
es = dx;
- _add(bx, 8011);
+ _add(bx, 1249);
es.byte(bx) = 0;
}
-void DreamGenContext::readdesticon() {
- STACK_CHECK;
- dx = 2013;
- loadintotemp();
- dx = 2026;
- loadintotemp2();
- dx = 1961;
- loadintotemp3();
-}
-
-void DreamGenContext::readcitypic() {
- STACK_CHECK;
- dx = 2000;
- loadintotemp();
-}
-
-void DreamGenContext::usemon() {
- STACK_CHECK;
- data.byte(kLasttrigger) = 0;
- es = cs;
- di = 2970+1;
- cx = 12;
- al = 32;
- _stosb(cx, true);
- es = cs;
- di = offset_operand1+1;
- cx = 12;
- al = 32;
- _stosb(cx, true);
- es = cs;
- di = offset_keys;
- es.byte(di) = 1;
- _add(di, 26);
- cx = 3;
-keyloop:
- es.byte(di) = 0;
- _add(di, 26);
- if (--cx)
- goto keyloop;
- createpanel();
- showpanel();
- showicon();
- drawfloor();
- getridofall();
- dx = 1974;
- loadintotemp();
- loadpersonal();
- loadnews();
- loadcart();
- dx = 1870;
- loadtempcharset();
- printoutermon();
- initialmoncols();
- printlogo();
- worktoscreen();
- turnonpower();
- fadeupyellows();
- fadeupmonfirst();
- data.word(kMonadx) = 76;
- data.word(kMonady) = 141;
- al = 1;
- monmessage();
- cx = 120;
- hangoncurs();
- al = 2;
- monmessage();
- cx = 60;
- randomaccess();
- al = 3;
- monmessage();
- cx = 100;
- hangoncurs();
- printlogo();
- scrollmonitor();
- data.word(kBufferin) = 0;
- data.word(kBufferout) = 0;
-moreinput:
- di = data.word(kMonadx);
- bx = data.word(kMonady);
- push(di);
- push(bx);
- input();
- bx = pop();
- di = pop();
- data.word(kMonadx) = di;
- data.word(kMonady) = bx;
- execcommand();
- _cmp(al, 0);
- if (flags.z())
- goto moreinput;
- getridoftemp();
- getridoftempcharset();
- es = data.word(kTextfile1);
- deallocatemem();
- es = data.word(kTextfile2);
- deallocatemem();
- es = data.word(kTextfile3);
- deallocatemem();
- data.byte(kGetback) = 1;
- al = 26;
- playchannel1();
- data.byte(kManisoffscreen) = 0;
- restoreall();
- redrawmainscrn();
- worktoscreenm();
-}
-
-void DreamGenContext::printoutermon() {
- STACK_CHECK;
- di = 40;
- bx = 32;
- ds = data.word(kTempgraphics);
- al = 1;
- ah = 0;
- showframe();
- di = 264;
- bx = 32;
- ds = data.word(kTempgraphics);
- al = 2;
- ah = 0;
- showframe();
- di = 40;
- bx = 12;
- ds = data.word(kTempgraphics);
- al = 3;
- ah = 0;
- showframe();
- di = 40;
- bx = 164;
- ds = data.word(kTempgraphics);
- al = 4;
- ah = 0;
- showframe();
-}
-
-void DreamGenContext::loadpersonal() {
- STACK_CHECK;
- al = data.byte(kLocation);
- dx = 2052;
- _cmp(al, 0);
- if (flags.z())
- goto foundpersonal;
- _cmp(al, 42);
- if (flags.z())
- goto foundpersonal;
- dx = 2065;
- _cmp(al, 2);
- if (flags.z())
- goto foundpersonal;
-foundpersonal:
- openfile();
- readheader();
- bx = es.word(di);
- push(bx);
- cl = 4;
- _shr(bx, cl);
- allocatemem();
- data.word(kTextfile1) = ax;
- ds = ax;
- cx = pop();
- dx = 0;
- readfromfile();
- closefile();
-}
-
-void DreamGenContext::loadnews() {
- STACK_CHECK;
- al = data.byte(kNewsitem);
- dx = 2078;
- _cmp(al, 0);
- if (flags.z())
- goto foundnews;
- dx = 2091;
- _cmp(al, 1);
- if (flags.z())
- goto foundnews;
- dx = 2104;
- _cmp(al, 2);
- if (flags.z())
- goto foundnews;
- dx = 2117;
-foundnews:
- openfile();
- readheader();
- bx = es.word(di);
- push(bx);
- cl = 4;
- _shr(bx, cl);
- allocatemem();
- data.word(kTextfile2) = ax;
- ds = ax;
- cx = pop();
- dx = 0;
- readfromfile();
- closefile();
-}
-
-void DreamGenContext::loadcart() {
- STACK_CHECK;
- lookininterface();
- dx = 2130;
- _cmp(al, 0);
- if (flags.z())
- goto gotcart;
- dx = 2143;
- _cmp(al, 1);
- if (flags.z())
- goto gotcart;
- dx = 2156;
- _cmp(al, 2);
- if (flags.z())
- goto gotcart;
- dx = 2169;
- _cmp(al, 3);
- if (flags.z())
- goto gotcart;
- dx = 2182;
-gotcart:
- openfile();
- readheader();
- bx = es.word(di);
- push(bx);
- cl = 4;
- _shr(bx, cl);
- allocatemem();
- data.word(kTextfile3) = ax;
- ds = ax;
- cx = pop();
- dx = 0;
- readfromfile();
- closefile();
-}
-
-void DreamGenContext::lookininterface() {
+void DreamGenContext::lookInInterface() {
STACK_CHECK;
al = 'I';
ah = 'N';
cl = 'T';
ch = 'F';
- findsetobject();
+ findSetObject();
ah = 1;
- checkinside();
+ checkInside();
_cmp(cl, (114));
if (flags.z())
goto emptyinterface;
@@ -7021,244 +2980,7 @@ emptyinterface:
al = 0;
}
-void DreamGenContext::turnonpower() {
- STACK_CHECK;
- cx = 3;
-powerloop:
- push(cx);
- powerlighton();
- cx = 30;
- hangon();
- powerlightoff();
- cx = 30;
- hangon();
- cx = pop();
- if (--cx)
- goto powerloop;
- powerlighton();
-}
-
-void DreamGenContext::randomaccess() {
- STACK_CHECK;
-accessloop:
- push(cx);
- vsync();
- vsync();
- randomnum1();
- _and(al, 15);
- _cmp(al, 10);
- if (flags.c())
- goto off;
- accesslighton();
- goto chosenaccess;
-off:
- accesslightoff();
-chosenaccess:
- cx = pop();
- if (--cx)
- goto accessloop;
- accesslightoff();
-}
-
-void DreamGenContext::powerlighton() {
- STACK_CHECK;
- di = 257+4;
- bx = 182;
- ds = data.word(kTempgraphics);
- al = 6;
- ah = 0;
- push(di);
- push(bx);
- showframe();
- bx = pop();
- di = pop();
- cl = 12;
- ch = 8;
- multidump();
-}
-
-void DreamGenContext::powerlightoff() {
- STACK_CHECK;
- di = 257+4;
- bx = 182;
- ds = data.word(kTempgraphics);
- al = 5;
- ah = 0;
- push(di);
- push(bx);
- showframe();
- bx = pop();
- di = pop();
- cl = 12;
- ch = 8;
- multidump();
-}
-
-void DreamGenContext::accesslighton() {
- STACK_CHECK;
- di = 74;
- bx = 182;
- ds = data.word(kTempgraphics);
- al = 8;
- ah = 0;
- push(di);
- push(bx);
- showframe();
- bx = pop();
- di = pop();
- cl = 12;
- ch = 8;
- multidump();
-}
-
-void DreamGenContext::accesslightoff() {
- STACK_CHECK;
- di = 74;
- bx = 182;
- ds = data.word(kTempgraphics);
- al = 7;
- ah = 0;
- push(di);
- push(bx);
- showframe();
- bx = pop();
- di = pop();
- cl = 12;
- ch = 8;
- multidump();
-}
-
-void DreamGenContext::locklighton() {
- STACK_CHECK;
- di = 56;
- bx = 182;
- ds = data.word(kTempgraphics);
- al = 10;
- ah = 0;
- push(di);
- push(bx);
- showframe();
- bx = pop();
- di = pop();
- cl = 12;
- ch = 8;
- multidump();
-}
-
-void DreamGenContext::locklightoff() {
- STACK_CHECK;
- di = 56;
- bx = 182;
- ds = data.word(kTempgraphics);
- al = 9;
- ah = 0;
- push(di);
- push(bx);
- showframe();
- bx = pop();
- di = pop();
- cl = 12;
- ch = 8;
- multidump();
-}
-
-void DreamGenContext::input() {
- STACK_CHECK;
- es = cs;
- di = 8045;
- cx = 64;
- al = 0;
- _stosb(cx, true);
- data.word(kCurpos) = 0;
- al = '>';
- di = data.word(kMonadx);
- bx = data.word(kMonady);
- ds = data.word(kTempcharset);
- ah = 0;
- printchar();
- di = data.word(kMonadx);
- bx = data.word(kMonady);
- cl = 6;
- ch = 8;
- multidump();
- _add(data.word(kMonadx), 6);
- ax = data.word(kMonadx);
- data.word(kCurslocx) = ax;
- ax = data.word(kMonady);
- data.word(kCurslocy) = ax;
-waitkey:
- printcurs();
- vsync();
- delcurs();
- readkey();
- al = data.byte(kCurrentkey);
- _cmp(al, 0);
- if (flags.z())
- goto waitkey;
- _cmp(al, 13);
- if (flags.z())
- return /* (endofinput) */;
- _cmp(al, 8);
- if (!flags.z())
- goto notdel;
- _cmp(data.word(kCurpos), 0);
- if (flags.z())
- goto waitkey;
- delchar();
- goto waitkey;
-notdel:
- _cmp(data.word(kCurpos), 28);
- if (flags.z())
- goto waitkey;
- _cmp(data.byte(kCurrentkey), 32);
- if (!flags.z())
- goto notleadingspace;
- _cmp(data.word(kCurpos), 0);
- if (flags.z())
- goto waitkey;
-notleadingspace:
- makecaps();
- es = cs;
- si = data.word(kCurpos);
- _add(si, si);
- _add(si, 8045);
- es.byte(si) = al;
- _cmp(al, 'Z'+1);
- if (!flags.c())
- goto waitkey;
- push(ax);
- push(es);
- push(si);
- di = data.word(kMonadx);
- bx = data.word(kMonady);
- ds = data.word(kMapstore);
- ax = data.word(kCurpos);
- _xchg(al, ah);
- si = ax;
- cl = 8;
- ch = 8;
- multiget();
- si = pop();
- es = pop();
- ax = pop();
- push(es);
- push(si);
- di = data.word(kMonadx);
- bx = data.word(kMonady);
- ds = data.word(kTempcharset);
- ah = 0;
- printchar();
- si = pop();
- es = pop();
- es.byte(si+1) = cl;
- ch = 0;
- _add(data.word(kMonadx), cx);
- _inc(data.word(kCurpos));
- _add(data.word(kCurslocx), cx);
- goto waitkey;
-}
-
-void DreamGenContext::makecaps() {
+void DreamGenContext::makeCaps() {
STACK_CHECK;
_cmp(al, 'a');
if (flags.c())
@@ -7266,45 +2988,17 @@ void DreamGenContext::makecaps() {
_sub(al, 32);
}
-void DreamGenContext::delchar() {
- STACK_CHECK;
- _dec(data.word(kCurpos));
- si = data.word(kCurpos);
- _add(si, si);
- es = cs;
- _add(si, 8045);
- es.byte(si) = 0;
- al = es.byte(si+1);
- ah = 0;
- _sub(data.word(kMonadx), ax);
- _sub(data.word(kCurslocx), ax);
- di = data.word(kMonadx);
- bx = data.word(kMonady);
- ds = data.word(kMapstore);
- ax = data.word(kCurpos);
- _xchg(al, ah);
- si = ax;
- cl = 8;
- ch = 8;
- multiput();
- di = data.word(kMonadx);
- bx = data.word(kMonady);
- cl = al;
- ch = 8;
- multidump();
-}
-
-void DreamGenContext::execcommand() {
+void DreamGenContext::execCommand() {
STACK_CHECK;
es = cs;
bx = offset_comlist;
ds = cs;
- si = 8045;
+ si = 1283;
al = ds.byte(si);
_cmp(al, 0);
if (!flags.z())
goto notblankinp;
- scrollmonitor();
+ scrollMonitor();
return;
notblankinp:
cl = 0;
@@ -7329,7 +3023,7 @@ comloop2:
_cmp(cl, 6);
if (!flags.z())
goto comloop;
- neterror();
+ netError();
al = 0;
return;
foundcom:
@@ -7352,11 +3046,11 @@ foundcom:
goto keyscom;
goto quitcom;
directory:
- dircom();
+ dirCom();
al = 0;
return;
signoncom:
- signon();
+ signOn();
al = 0;
return;
accesscom:
@@ -7364,34 +3058,27 @@ accesscom:
al = 0;
return;
keyscom:
- showkeys();
+ showKeys();
al = 0;
return;
testcom:
al = 6;
- monmessage();
+ monMessage();
al = 0;
return;
quitcom:
al = 1;
}
-void DreamGenContext::neterror() {
- STACK_CHECK;
- al = 5;
- monmessage();
- scrollmonitor();
-}
-
-void DreamGenContext::dircom() {
+void DreamGenContext::dirCom() {
STACK_CHECK;
cx = 30;
- randomaccess();
+ randomAccess();
parser();
_cmp(es.byte(di+1), 0);
if (flags.z())
goto dirroot;
- dirfile();
+ dirFile();
return;
dirroot:
data.byte(kLogonum) = 0;
@@ -7399,24 +3086,24 @@ dirroot:
si = offset_rootdir;
_inc(si);
es = cs;
- di = 2970;
+ di = 1125;
_inc(di);
cx = 12;
_movsb(cx, true);
- monitorlogo();
- scrollmonitor();
+ monitorLogo();
+ scrollMonitor();
al = 9;
- monmessage();
+ monMessage();
es = data.word(kTextfile1);
- searchforfiles();
+ searchForFiles();
es = data.word(kTextfile2);
- searchforfiles();
+ searchForFiles();
es = data.word(kTextfile3);
- searchforfiles();
- scrollmonitor();
+ searchForFiles();
+ scrollMonitor();
}
-void DreamGenContext::searchforfiles() {
+void DreamGenContext::searchForFiles() {
STACK_CHECK;
bx = (66*2);
directloop1:
@@ -7428,11 +3115,11 @@ directloop1:
_cmp(al, 34);
if (!flags.z())
goto directloop1;
- monprint();
+ monPrint();
goto directloop1;
}
-void DreamGenContext::signon() {
+void DreamGenContext::signOn() {
STACK_CHECK;
parser();
_inc(di);
@@ -7450,7 +3137,7 @@ signonloop2:
_cmp(al, 32);
if (flags.z())
goto foundsign;
- makecaps();
+ makeCaps();
ah = es.byte(di);
_inc(di);
_cmp(al, ah);
@@ -7466,7 +3153,7 @@ nomatch:
if (--cx)
goto signonloop;
al = 13;
- monmessage();
+ monMessage();
return;
foundsign:
di = pop();
@@ -7478,14 +3165,14 @@ foundsign:
if (flags.z())
goto notyetassigned;
al = 17;
- monmessage();
+ monMessage();
return;
notyetassigned:
push(es);
push(bx);
- scrollmonitor();
+ scrollMonitor();
al = 15;
- monmessage();
+ monMessage();
di = data.word(kMonadx);
bx = data.word(kMonady);
push(di);
@@ -7501,7 +3188,7 @@ notyetassigned:
push(bx);
_add(bx, 2);
ds = cs;
- si = 8045;
+ si = 1283;
checkpass:
_lodsw();
ah = es.byte(bx);
@@ -7514,32 +3201,32 @@ checkpass:
goto checkpass;
bx = pop();
es = pop();
- scrollmonitor();
+ scrollMonitor();
al = 16;
- monmessage();
+ monMessage();
return;
passpassed:
al = 14;
- monmessage();
+ monMessage();
bx = pop();
es = pop();
push(es);
push(bx);
_add(bx, 14);
- monprint();
- scrollmonitor();
+ monPrint();
+ scrollMonitor();
bx = pop();
es = pop();
es.byte(bx) = 1;
}
-void DreamGenContext::showkeys() {
+void DreamGenContext::showKeys() {
STACK_CHECK;
cx = 10;
- randomaccess();
- scrollmonitor();
+ randomAccess();
+ scrollMonitor();
al = 18;
- monmessage();
+ monMessage();
es = cs;
bx = offset_keys;
cx = 4;
@@ -7550,34 +3237,34 @@ keysloop:
if (flags.z())
goto notheld;
_add(bx, 14);
- monprint();
+ monPrint();
notheld:
bx = pop();
cx = pop();
_add(bx, 26);
if (--cx)
goto keysloop;
- scrollmonitor();
+ scrollMonitor();
}
void DreamGenContext::read() {
STACK_CHECK;
cx = 40;
- randomaccess();
+ randomAccess();
parser();
_cmp(es.byte(di+1), 0);
if (!flags.z())
goto okcom;
- neterror();
+ netError();
return;
okcom:
es = cs;
- di = 2970;
+ di = 1125;
ax = data.word(kTextfile1);
data.word(kMonsource) = ax;
ds = ax;
si = (66*2);
- searchforstring();
+ searchForString();
_cmp(al, 0);
if (flags.z())
goto foundfile2;
@@ -7585,7 +3272,7 @@ okcom:
data.word(kMonsource) = ax;
ds = ax;
si = (66*2);
- searchforstring();
+ searchForString();
_cmp(al, 0);
if (flags.z())
goto foundfile2;
@@ -7593,15 +3280,15 @@ okcom:
data.word(kMonsource) = ax;
ds = ax;
si = (66*2);
- searchforstring();
+ searchForString();
_cmp(al, 0);
if (flags.z())
goto foundfile2;
al = 7;
- monmessage();
+ monMessage();
return;
foundfile2:
- getkeyandlogo();
+ getKeyAndLogo();
_cmp(al, 0);
if (flags.z())
goto keyok1;
@@ -7610,25 +3297,25 @@ keyok1:
es = cs;
di = offset_operand1;
ds = data.word(kMonsource);
- searchforstring();
+ searchForString();
_cmp(al, 0);
if (flags.z())
goto findtopictext;
al = data.byte(kOldlogonum);
data.byte(kLogonum) = al;
al = 11;
- monmessage();
+ monMessage();
return;
findtopictext:
_inc(bx);
push(es);
push(bx);
- monitorlogo();
- scrollmonitor();
+ monitorLogo();
+ scrollMonitor();
bx = pop();
es = pop();
moretopic:
- monprint();
+ monPrint();
al = es.byte(bx);
_cmp(al, 34);
if (flags.z())
@@ -7641,17 +3328,17 @@ moretopic:
goto endoftopic;
push(es);
push(bx);
- processtrigger();
+ processTrigger();
cx = 24;
- randomaccess();
+ randomAccess();
bx = pop();
es = pop();
goto moretopic;
endoftopic:
- scrollmonitor();
+ scrollMonitor();
}
-void DreamGenContext::dirfile() {
+void DreamGenContext::dirFile() {
STACK_CHECK;
al = 34;
es.byte(di) = al;
@@ -7659,7 +3346,7 @@ void DreamGenContext::dirfile() {
push(di);
ds = data.word(kTextfile1);
si = (66*2);
- searchforstring();
+ searchForString();
_cmp(al, 0);
if (flags.z())
goto foundfile;
@@ -7669,7 +3356,7 @@ void DreamGenContext::dirfile() {
push(di);
ds = data.word(kTextfile2);
si = (66*2);
- searchforstring();
+ searchForString();
_cmp(al, 0);
if (flags.z())
goto foundfile;
@@ -7679,19 +3366,19 @@ void DreamGenContext::dirfile() {
push(di);
ds = data.word(kTextfile3);
si = (66*2);
- searchforstring();
+ searchForString();
_cmp(al, 0);
if (flags.z())
goto foundfile;
di = pop();
es = pop();
al = 7;
- monmessage();
+ monMessage();
return;
foundfile:
ax = pop();
ax = pop();
- getkeyandlogo();
+ getKeyAndLogo();
_cmp(al, 0);
if (flags.z())
goto keyok2;
@@ -7702,13 +3389,13 @@ keyok2:
ds = cs;
si = offset_operand1+1;
es = cs;
- di = 2970+1;
+ di = 1125+1;
cx = 12;
_movsb(cx, true);
- monitorlogo();
- scrollmonitor();
+ monitorLogo();
+ scrollMonitor();
al = 10;
- monmessage();
+ monMessage();
bx = pop();
es = pop();
directloop2:
@@ -7723,13 +3410,13 @@ directloop2:
_cmp(al, '=');
if (!flags.z())
goto directloop2;
- monprint();
+ monPrint();
goto directloop2;
endofdir2:
- scrollmonitor();
+ scrollMonitor();
}
-void DreamGenContext::getkeyandlogo() {
+void DreamGenContext::getKeyAndLogo() {
STACK_CHECK;
_inc(bx);
al = es.byte(bx);
@@ -7756,12 +3443,12 @@ void DreamGenContext::getkeyandlogo() {
push(bx);
push(es);
al = 12;
- monmessage();
+ monMessage();
es = pop();
bx = pop();
_add(bx, 14);
- monprint();
- scrollmonitor();
+ monPrint();
+ scrollMonitor();
bx = pop();
es = pop();
al = 1;
@@ -7774,7 +3461,7 @@ keyok:
al = 0;
}
-void DreamGenContext::searchforstring() {
+void DreamGenContext::searchForString() {
STACK_CHECK;
dl = es.byte(di);
cx = di;
@@ -7784,7 +3471,7 @@ restartlook:
dh = 0;
keeplooking:
_lodsb();
- makecaps();
+ makeCaps();
_cmp(al, '*');
if (flags.z())
goto notfound;
@@ -7829,7 +3516,7 @@ void DreamGenContext::parser() {
al = '=';
_stosb();
ds = cs;
- si = 8045;
+ si = 1283;
notspace1:
_lodsw();
_cmp(al, 32);
@@ -7857,133 +3544,36 @@ finishpars:
di = offset_operand1;
}
-void DreamGenContext::scrollmonitor() {
- STACK_CHECK;
- push(ax);
- push(bx);
- push(cx);
- push(dx);
- push(di);
- push(si);
- push(es);
- push(ds);
- printlogo();
- di = data.word(kMonadx);
- bx = data.word(kMonady);
- printundermon();
- ax = data.word(kMonady);
- worktoscreen();
- al = 25;
- playchannel1();
- ds = pop();
- es = pop();
- si = pop();
- di = pop();
- dx = pop();
- cx = pop();
- bx = pop();
- ax = pop();
-}
-
-void DreamGenContext::monitorlogo() {
- STACK_CHECK;
- al = data.byte(kLogonum);
- _cmp(al, data.byte(kOldlogonum));
- if (flags.z())
- goto notnewlogo;
- data.byte(kOldlogonum) = al;
- printlogo();
- printundermon();
- worktoscreen();
- printlogo();
- printlogo();
- al = 26;
- playchannel1();
- cx = 20;
- randomaccess();
- return;
-notnewlogo:
- printlogo();
-}
-
-void DreamGenContext::printlogo() {
- STACK_CHECK;
- di = 56;
- bx = 32;
- ds = data.word(kTempgraphics);
- al = 0;
- ah = 0;
- showframe();
- showcurrentfile();
-}
-
-void DreamGenContext::showcurrentfile() {
- STACK_CHECK;
- di = 178;
- bx = 37;
- si = 2970+1;
-curfileloop:
- al = cs.byte(si);
- _cmp(al, 0);
- if (flags.z())
- return /* (finishfile) */;
- _inc(si);
- push(si);
- modifychar();
- ds = data.word(kTempcharset);
- ah = 0;
- printchar();
- si = pop();
- goto curfileloop;
-}
-
-void DreamGenContext::monmessage() {
- STACK_CHECK;
- es = data.word(kTextfile1);
- bx = (66*2);
- cl = al;
- ch = 0;
-monmessageloop:
- al = es.byte(bx);
- _inc(bx);
- _cmp(al, '+');
- if (!flags.z())
- goto monmessageloop;
- if (--cx)
- goto monmessageloop;
- monprint();
-}
-
-void DreamGenContext::processtrigger() {
+void DreamGenContext::processTrigger() {
STACK_CHECK;
_cmp(data.byte(kLasttrigger), '1');
if (!flags.z())
goto notfirsttrigger;
al = 8;
- setlocation();
+ setLocation();
al = 45;
- triggermessage();
+ triggerMessage();
return;
notfirsttrigger:
_cmp(data.byte(kLasttrigger), '2');
if (!flags.z())
goto notsecondtrigger;
al = 9;
- setlocation();
+ setLocation();
al = 55;
- triggermessage();
+ triggerMessage();
return;
notsecondtrigger:
_cmp(data.byte(kLasttrigger), '3');
if (!flags.z())
return /* (notthirdtrigger) */;
al = 2;
- setlocation();
+ setLocation();
al = 59;
- triggermessage();
+ triggerMessage();
}
-void DreamGenContext::triggermessage() {
+void DreamGenContext::triggerMessage() {
STACK_CHECK;
push(ax);
di = 174;
@@ -7992,161 +3582,36 @@ void DreamGenContext::triggermessage() {
ch = 63;
ds = data.word(kMapstore);
si = 0;
- multiget();
+ multiGet();
ax = pop();
- findpuztext();
+ findPuzText();
di = 174;
bx = 156;
dl = 141;
ah = 16;
- printdirect();
+ printDirect();
cx = 140;
- hangon();
- worktoscreen();
+ hangOn();
+ workToScreen();
cx = 340;
- hangon();
+ hangOn();
di = 174;
bx = 153;
cl = 200;
ch = 63;
ds = data.word(kMapstore);
si = 0;
- multiput();
- worktoscreen();
+ multiPut();
+ workToScreen();
data.byte(kLasttrigger) = 0;
}
-void DreamGenContext::printcurs() {
- STACK_CHECK;
- push(si);
- push(di);
- push(ds);
- push(dx);
- push(bx);
- push(es);
- di = data.word(kCurslocx);
- bx = data.word(kCurslocy);
- cl = 6;
- ch = 8;
- _cmp(data.byte(kForeignrelease), 0);
- if (flags.z())
- goto _tmp1;
- _sub(bx, 3);
- ch = 11;
-_tmp1:
- ds = data.word(kBuffers);
- si = (0);
- push(di);
- push(bx);
- multiget();
- bx = pop();
- di = pop();
- push(bx);
- push(di);
- _inc(data.word(kMaintimer));
- ax = data.word(kMaintimer);
- _and(al, 16);
- if (!flags.z())
- goto flashcurs;
- al = '/';
- _sub(al, 32);
- ah = 0;
- ds = data.word(kTempcharset);
- showframe();
-flashcurs:
- di = pop();
- bx = pop();
- _sub(di, 6);
- cl = 12;
- ch = 8;
- _cmp(data.byte(kForeignrelease), 0);
- if (flags.z())
- goto _tmp2;
- ch = 11;
-_tmp2:
- multidump();
- es = pop();
- bx = pop();
- dx = pop();
- ds = pop();
- di = pop();
- si = pop();
-}
-
-void DreamGenContext::delcurs() {
- STACK_CHECK;
- push(es);
- push(bx);
- push(di);
- push(ds);
- push(dx);
- push(si);
- di = data.word(kCurslocx);
- bx = data.word(kCurslocy);
- cl = 6;
- ch = 8;
- _cmp(data.byte(kForeignrelease), 0);
- if (flags.z())
- goto _tmp1;
- _sub(bx, 3);
- ch = 11;
-_tmp1:
- push(di);
- push(bx);
- push(cx);
- ds = data.word(kBuffers);
- si = (0);
- multiput();
- cx = pop();
- bx = pop();
- di = pop();
- multidump();
- si = pop();
- dx = pop();
- ds = pop();
- di = pop();
- bx = pop();
- es = pop();
-}
-
-void DreamGenContext::useobject() {
- STACK_CHECK;
- data.byte(kWithobject) = 255;
- _cmp(data.byte(kCommandtype), 229);
- if (flags.z())
- goto alreadyuse;
- data.byte(kCommandtype) = 229;
- bl = data.byte(kCommand);
- bh = data.byte(kObjecttype);
- al = 51;
- commandwithob();
-alreadyuse:
- ax = data.word(kMousebutton);
- _cmp(ax, data.word(kOldbutton));
- if (flags.z())
- return /* (nouse) */;
- _and(ax, 1);
- if (!flags.z())
- goto douse;
- return;
-douse:
- useroutine();
-}
-
-void DreamGenContext::wheelsound() {
- STACK_CHECK;
- al = 17;
- playchannel1();
- showfirstuse();
- putbackobstuff();
-}
-
-void DreamGenContext::runtap() {
+void DreamGenContext::runTap() {
STACK_CHECK;
_cmp(data.byte(kWithobject), 255);
if (!flags.z())
goto tapwith;
- withwhat();
+ withWhat();
return;
tapwith:
al = data.byte(kWithobject);
@@ -8169,111 +3634,52 @@ tapwith:
goto cupfromtapfull;
cx = 300;
al = 56;
- showpuztext();
- putbackobstuff();
+ showPuzText();
+ putBackObStuff();
return;
fillcupfromtap:
al = data.byte(kWithobject);
- getexad();
+ getExAd();
es.byte(bx+15) = 'F'-'A';
al = 8;
- playchannel1();
+ playChannel1();
cx = 300;
al = 57;
- showpuztext();
- putbackobstuff();
+ showPuzText();
+ putBackObStuff();
return;
cupfromtapfull:
cx = 300;
al = 58;
- showpuztext();
- putbackobstuff();
-}
-
-void DreamGenContext::playguitar() {
- STACK_CHECK;
- al = 14;
- playchannel1();
- showfirstuse();
- putbackobstuff();
-}
-
-void DreamGenContext::hotelcontrol() {
- STACK_CHECK;
- _cmp(data.byte(kReallocation), 21);
- if (!flags.z())
- goto notrightcont;
- _cmp(data.byte(kMapx), 33);
- if (!flags.z())
- goto notrightcont;
- showfirstuse();
- putbackobstuff();
- return;
-notrightcont:
- showseconduse();
- putbackobstuff();
-}
-
-void DreamGenContext::hotelbell() {
- STACK_CHECK;
- al = 12;
- playchannel1();
- showfirstuse();
- putbackobstuff();
-}
-
-void DreamGenContext::opentomb() {
- STACK_CHECK;
- _inc(data.byte(kProgresspoints));
- showfirstuse();
- data.word(kWatchingtime) = 35*2;
- data.word(kReeltowatch) = 1;
- data.word(kEndwatchreel) = 33;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::usetrainer() {
- STACK_CHECK;
- getanyad();
- _cmp(es.byte(bx+2), 4);
- if (!flags.z())
- goto notheldtrainer;
- _inc(data.byte(kProgresspoints));
- makeworn();
- showseconduse();
- putbackobstuff();
- return;
-notheldtrainer:
- nothelderror();
+ showPuzText();
+ putBackObStuff();
}
-void DreamGenContext::nothelderror() {
+void DreamGenContext::notHeldError() {
STACK_CHECK;
- createpanel();
- showpanel();
- showman();
- showexit();
- obicons();
+ createPanel();
+ showPanel();
+ showMan();
+ showExit();
+ obIcons();
di = 64;
bx = 100;
al = 63;
ah = 1;
dl = 201;
printmessage2();
- worktoscreenm();
+ workToScreenM();
cx = 50;
- hangonp();
- putbackobstuff();
+ hangOnP();
+ putBackObStuff();
}
-void DreamGenContext::usepipe() {
+void DreamGenContext::usePipe() {
STACK_CHECK;
_cmp(data.byte(kWithobject), 255);
if (!flags.z())
goto pipewith;
- withwhat();
+ withWhat();
return;
pipewith:
al = data.byte(kWithobject);
@@ -8296,274 +3702,31 @@ pipewith:
goto alreadyfull;
cx = 300;
al = 14;
- showpuztext();
- putbackobstuff();
+ showPuzText();
+ putBackObStuff();
return;
fillcup:
cx = 300;
al = 36;
- showpuztext();
- putbackobstuff();
+ showPuzText();
+ putBackObStuff();
al = data.byte(kWithobject);
- getexad();
+ getExAd();
es.byte(bx+15) = 'F'-'A';
return;
alreadyfull:
cx = 300;
al = 35;
- showpuztext();
- putbackobstuff();
-}
-
-void DreamGenContext::usefullcart() {
- STACK_CHECK;
- _inc(data.byte(kProgresspoints));
- al = 2;
- ah = data.byte(kRoomnum);
- _add(ah, 6);
- turnanypathon();
- data.byte(kManspath) = 4;
- data.byte(kFacing) = 4;
- data.byte(kTurntoface) = 4;
- data.byte(kFinaldest) = 4;
- findxyfrompath();
- data.byte(kResetmanxy) = 1;
- showfirstuse();
- data.word(kWatchingtime) = 72*2;
- data.word(kReeltowatch) = 58;
- data.word(kEndwatchreel) = 142;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
+ showPuzText();
+ putBackObStuff();
}
-void DreamGenContext::useplinth() {
- STACK_CHECK;
- _cmp(data.byte(kWithobject), 255);
- if (!flags.z())
- goto plinthwith;
- withwhat();
- return;
-plinthwith:
- al = data.byte(kWithobject);
- ah = data.byte(kWithtype);
- cl = 'D';
- ch = 'K';
- dl = 'E';
- dh = 'Y';
- compare();
- if (flags.z())
- goto isrightkey;
- showfirstuse();
- putbackobstuff();
- return;
-isrightkey:
- _inc(data.byte(kProgresspoints));
- showseconduse();
- data.word(kWatchingtime) = 220;
- data.word(kReeltowatch) = 0;
- data.word(kEndwatchreel) = 104;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
- al = data.byte(kRoomafterdream);
- data.byte(kNewlocation) = al;
-}
-
-void DreamGenContext::chewy() {
- STACK_CHECK;
- showfirstuse();
- getanyad();
- es.byte(bx+2) = 255;
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::useladder() {
- STACK_CHECK;
- showfirstuse();
- _sub(data.byte(kMapx), 11);
- findroominloc();
- data.byte(kFacing) = 6;
- data.byte(kTurntoface) = 6;
- data.byte(kManspath) = 0;
- data.byte(kDestination) = 0;
- data.byte(kFinaldest) = 0;
- findxyfrompath();
- data.byte(kResetmanxy) = 1;
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::useladderb() {
- STACK_CHECK;
- showfirstuse();
- _add(data.byte(kMapx), 11);
- findroominloc();
- data.byte(kFacing) = 2;
- data.byte(kTurntoface) = 2;
- data.byte(kManspath) = 1;
- data.byte(kDestination) = 1;
- data.byte(kFinaldest) = 1;
- findxyfrompath();
- data.byte(kResetmanxy) = 1;
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::slabdoora() {
- STACK_CHECK;
- showfirstuse();
- data.byte(kGetback) = 1;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.word(kReeltowatch) = 13;
- _cmp(data.byte(kDreamnumber), 3);
- if (!flags.z())
- goto slabawrong;
- _inc(data.byte(kProgresspoints));
- data.word(kWatchingtime) = 60;
- data.word(kEndwatchreel) = 42;
- data.byte(kNewlocation) = 47;
- return;
-slabawrong:
- data.word(kWatchingtime) = 40;
- data.word(kEndwatchreel) = 34;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
-}
-
-void DreamGenContext::slabdoorb() {
- STACK_CHECK;
- _cmp(data.byte(kDreamnumber), 1);
- if (!flags.z())
- goto slabbwrong;
- al = 'S';
- ah = 'H';
- cl = 'L';
- ch = 'D';
- isryanholding();
- if (!flags.z())
- goto gotcrystal;
- al = 44;
- cx = 200;
- showpuztext();
- putbackobstuff();
- return;
-gotcrystal:
- showfirstuse();
- _inc(data.byte(kProgresspoints));
- data.byte(kGetback) = 1;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.word(kReeltowatch) = 44;
- data.word(kWatchingtime) = 60;
- data.word(kEndwatchreel) = 71;
- data.byte(kNewlocation) = 47;
- return;
-slabbwrong:
- showfirstuse();
- data.byte(kGetback) = 1;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.word(kReeltowatch) = 44;
- data.word(kWatchingtime) = 40;
- data.word(kEndwatchreel) = 63;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
-}
-
-void DreamGenContext::slabdoord() {
- STACK_CHECK;
- showfirstuse();
- data.byte(kGetback) = 1;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.word(kReeltowatch) = 75;
- _cmp(data.byte(kDreamnumber), 0);
- if (!flags.z())
- goto slabcwrong;
- _inc(data.byte(kProgresspoints));
- data.word(kWatchingtime) = 60;
- data.word(kEndwatchreel) = 102;
- data.byte(kNewlocation) = 47;
- return;
-slabcwrong:
- data.word(kWatchingtime) = 40;
- data.word(kEndwatchreel) = 94;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
-}
-
-void DreamGenContext::slabdoorc() {
- STACK_CHECK;
- showfirstuse();
- data.byte(kGetback) = 1;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.word(kReeltowatch) = 108;
- _cmp(data.byte(kDreamnumber), 4);
- if (!flags.z())
- goto slabdwrong;
- _inc(data.byte(kProgresspoints));
- data.word(kWatchingtime) = 60;
- data.word(kEndwatchreel) = 135;
- data.byte(kNewlocation) = 47;
- return;
-slabdwrong:
- data.word(kWatchingtime) = 40;
- data.word(kEndwatchreel) = 127;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
-}
-
-void DreamGenContext::slabdoore() {
- STACK_CHECK;
- showfirstuse();
- data.byte(kGetback) = 1;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.word(kReeltowatch) = 141;
- _cmp(data.byte(kDreamnumber), 5);
- if (!flags.z())
- goto slabewrong;
- _inc(data.byte(kProgresspoints));
- data.word(kWatchingtime) = 60;
- data.word(kEndwatchreel) = 168;
- data.byte(kNewlocation) = 47;
- return;
-slabewrong:
- data.word(kWatchingtime) = 40;
- data.word(kEndwatchreel) = 160;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
-}
-
-void DreamGenContext::slabdoorf() {
- STACK_CHECK;
- showfirstuse();
- data.byte(kGetback) = 1;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.word(kReeltowatch) = 171;
- _cmp(data.byte(kDreamnumber), 2);
- if (!flags.z())
- goto slabfwrong;
- _inc(data.byte(kProgresspoints));
- data.word(kWatchingtime) = 60;
- data.word(kEndwatchreel) = 197;
- data.byte(kNewlocation) = 47;
- return;
-slabfwrong:
- data.word(kWatchingtime) = 40;
- data.word(kEndwatchreel) = 189;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
-}
-
-void DreamGenContext::useslab() {
+void DreamGenContext::useSLab() {
STACK_CHECK;
_cmp(data.byte(kWithobject), 255);
if (!flags.z())
goto slabwith;
- withwhat();
+ withWhat();
return;
slabwith:
al = data.byte(kWithobject);
@@ -8577,26 +3740,26 @@ slabwith:
goto nextslab;
cx = 300;
al = 14;
- showpuztext();
- putbackobstuff();
+ showPuzText();
+ putBackObStuff();
return;
nextslab:
al = data.byte(kWithobject);
- getexad();
+ getExAd();
es.byte(bx+2) = 0;
al = data.byte(kCommand);
push(ax);
- removesetobject();
+ removeSetObject();
ax = pop();
_inc(al);
push(ax);
- placesetobject();
+ placeSetObject();
ax = pop();
_cmp(al, 54);
if (!flags.z())
goto notlastslab;
al = 0;
- turnpathon();
+ turnPathOn();
data.word(kWatchingtime) = 22;
data.word(kReeltowatch) = 35;
data.word(kEndwatchreel) = 48;
@@ -8604,112 +3767,16 @@ nextslab:
data.byte(kSpeedcount) = 1;
notlastslab:
_inc(data.byte(kProgresspoints));
- showfirstuse();
+ showFirstUse();
data.byte(kGetback) = 1;
}
-void DreamGenContext::usecart() {
- STACK_CHECK;
- _cmp(data.byte(kWithobject), 255);
- if (!flags.z())
- goto cartwith;
- withwhat();
- return;
-cartwith:
- al = data.byte(kWithobject);
- ah = data.byte(kWithtype);
- cl = 'R';
- ch = 'O';
- dl = 'C';
- dh = 'K';
- compare();
- if (flags.z())
- goto nextcart;
- cx = 300;
- al = 14;
- showpuztext();
- putbackobstuff();
- return;
-nextcart:
- al = data.byte(kWithobject);
- getexad();
- es.byte(bx+2) = 0;
- al = data.byte(kCommand);
- push(ax);
- removesetobject();
- ax = pop();
- _inc(al);
- placesetobject();
- _inc(data.byte(kProgresspoints));
- al = 17;
- playchannel1();
- showfirstuse();
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::useclearbox() {
- STACK_CHECK;
- _cmp(data.byte(kWithobject), 255);
- if (!flags.z())
- goto clearboxwith;
- withwhat();
- return;
-clearboxwith:
- al = data.byte(kWithobject);
- ah = data.byte(kWithtype);
- cl = 'R';
- ch = 'A';
- dl = 'I';
- dh = 'L';
- compare();
- if (flags.z())
- goto openbox;
- cx = 300;
- al = 14;
- showpuztext();
- putbackobstuff();
- return;
-openbox:
- _inc(data.byte(kProgresspoints));
- showfirstuse();
- data.word(kWatchingtime) = 80;
- data.word(kReeltowatch) = 67;
- data.word(kEndwatchreel) = 105;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::usecoveredbox() {
- STACK_CHECK;
- _inc(data.byte(kProgresspoints));
- showfirstuse();
- data.word(kWatchingtime) = 50;
- data.word(kReeltowatch) = 41;
- data.word(kEndwatchreel) = 66;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::userailing() {
- STACK_CHECK;
- showfirstuse();
- data.word(kWatchingtime) = 80;
- data.word(kReeltowatch) = 0;
- data.word(kEndwatchreel) = 30;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
- data.byte(kMandead) = 4;
-}
-
-void DreamGenContext::useopenbox() {
+void DreamGenContext::useOpenBox() {
STACK_CHECK;
_cmp(data.byte(kWithobject), 255);
if (!flags.z())
goto openboxwith;
- withwhat();
+ withWhat();
return;
openboxwith:
al = data.byte(kWithobject);
@@ -8730,15 +3797,15 @@ openboxwith:
compare();
if (flags.z())
goto openboxwrong;
- showfirstuse();
+ showFirstUse();
return;
destoryopenbox:
_inc(data.byte(kProgresspoints));
cx = 300;
al = 37;
- showpuztext();
+ showPuzText();
al = data.byte(kWithobject);
- getexad();
+ getExAd();
es.byte(bx+15) = 'E'-'A';
data.word(kWatchingtime) = 140;
data.word(kReeltowatch) = 105;
@@ -8746,119 +3813,23 @@ destoryopenbox:
data.byte(kWatchspeed) = 1;
data.byte(kSpeedcount) = 1;
al = 4;
- turnpathon();
+ turnPathOn();
data.byte(kGetback) = 1;
return;
openboxwrong:
cx = 300;
al = 38;
- showpuztext();
- putbackobstuff();
+ showPuzText();
+ putBackObStuff();
}
-void DreamGenContext::wearwatch() {
- STACK_CHECK;
- _cmp(data.byte(kWatchon), 1);
- if (flags.z())
- goto wearingwatch;
- showfirstuse();
- data.byte(kWatchon) = 1;
- data.byte(kGetback) = 1;
- getanyad();
- makeworn();
- return;
-wearingwatch:
- showseconduse();
- putbackobstuff();
-}
-
-void DreamGenContext::wearshades() {
- STACK_CHECK;
- _cmp(data.byte(kShadeson), 1);
- if (flags.z())
- goto wearingshades;
- data.byte(kShadeson) = 1;
- showfirstuse();
- data.byte(kGetback) = 1;
- getanyad();
- makeworn();
- return;
-wearingshades:
- showseconduse();
- putbackobstuff();
-}
-
-void DreamGenContext::sitdowninbar() {
- STACK_CHECK;
- _cmp(data.byte(kWatchmode), -1);
- if (!flags.z())
- goto satdown;
- showfirstuse();
- data.word(kWatchingtime) = 50;
- data.word(kReeltowatch) = 55;
- data.word(kEndwatchreel) = 71;
- data.word(kReeltohold) = 73;
- data.word(kEndofholdreel) = 83;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
- return;
-satdown:
- showseconduse();
- putbackobstuff();
-}
-
-void DreamGenContext::usechurchhole() {
- STACK_CHECK;
- showfirstuse();
- data.byte(kGetback) = 1;
- data.word(kWatchingtime) = 28;
- data.word(kReeltowatch) = 13;
- data.word(kEndwatchreel) = 26;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
-}
-
-void DreamGenContext::usehole() {
- STACK_CHECK;
- _cmp(data.byte(kWithobject), 255);
- if (!flags.z())
- goto holewith;
- withwhat();
- return;
-holewith:
- al = data.byte(kWithobject);
- ah = data.byte(kWithtype);
- cl = 'H';
- ch = 'N';
- dl = 'D';
- dh = 'A';
- compare();
- if (flags.z())
- goto righthand;
- cx = 300;
- al = 14;
- showpuztext();
- putbackobstuff();
- return;
-righthand:
- showfirstuse();
- al = 86;
- removesetobject();
- al = data.byte(kWithobject);
- getexad();
- es.byte(bx+2) = 255;
- data.byte(kCanmovealtar) = 1;
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::usealtar() {
+void DreamGenContext::useAltar() {
STACK_CHECK;
al = 'C';
ah = 'N';
cl = 'D';
ch = 'A';
- findexobject();
+ findExObject();
_cmp(al, (114));
if (flags.z())
goto thingsonaltar;
@@ -8866,7 +3837,7 @@ void DreamGenContext::usealtar() {
ah = 'N';
cl = 'D';
ch = 'B';
- findexobject();
+ findExObject();
_cmp(al, (114));
if (flags.z())
goto thingsonaltar;
@@ -8875,12 +3846,12 @@ void DreamGenContext::usealtar() {
goto movealtar;
cx = 300;
al = 23;
- showpuztext();
+ showPuzText();
data.byte(kGetback) = 1;
return;
movealtar:
_inc(data.byte(kProgresspoints));
- showseconduse();
+ showSecondUse();
data.word(kWatchingtime) = 160;
data.word(kReeltowatch) = 81;
data.word(kEndwatchreel) = 174;
@@ -8891,61 +3862,15 @@ movealtar:
bh = 76;
cx = 32;
dx = 98;
- setuptimeduse();
+ setupTimedUse();
data.byte(kGetback) = 1;
return;
thingsonaltar:
- showfirstuse();
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::opentvdoor() {
- STACK_CHECK;
- _cmp(data.byte(kWithobject), 255);
- if (!flags.z())
- goto tvdoorwith;
- withwhat();
- return;
-tvdoorwith:
- al = data.byte(kWithobject);
- ah = data.byte(kWithtype);
- cl = 'U';
- ch = 'L';
- dl = 'O';
- dh = 'K';
- compare();
- if (flags.z())
- goto keyontv;
- cx = 300;
- al = 14;
- showpuztext();
- putbackobstuff();
- return;
-keyontv:
- showfirstuse();
- data.byte(kLockstatus) = 0;
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::usedryer() {
- STACK_CHECK;
- al = 12;
- playchannel1();
- showfirstuse();
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::openlouis() {
- STACK_CHECK;
- al = 5;
- ah = 2;
- cl = 3;
- ch = 8;
- entercode();
+ showFirstUse();
data.byte(kGetback) = 1;
}
-void DreamGenContext::nextcolon() {
+void DreamGenContext::nextColon() {
STACK_CHECK;
lookcolon:
al = es.byte(si);
@@ -8955,513 +3880,22 @@ lookcolon:
goto lookcolon;
}
-void DreamGenContext::openyourneighbour() {
- STACK_CHECK;
- al = 255;
- ah = 255;
- cl = 255;
- ch = 255;
- entercode();
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::usewindow() {
- STACK_CHECK;
- _cmp(data.byte(kManspath), 6);
- if (!flags.z())
- goto notonbalc;
- _inc(data.byte(kProgresspoints));
- showfirstuse();
- data.byte(kNewlocation) = 29;
- data.byte(kGetback) = 1;
- return;
-notonbalc:
- showseconduse();
- putbackobstuff();
-}
-
-void DreamGenContext::usebalcony() {
- STACK_CHECK;
- showfirstuse();
- al = 6;
- turnpathon();
- al = 0;
- turnpathoff();
- al = 1;
- turnpathoff();
- al = 2;
- turnpathoff();
- al = 3;
- turnpathoff();
- al = 4;
- turnpathoff();
- al = 5;
- turnpathoff();
- _inc(data.byte(kProgresspoints));
- data.byte(kManspath) = 6;
- data.byte(kDestination) = 6;
- data.byte(kFinaldest) = 6;
- findxyfrompath();
- switchryanoff();
- data.byte(kResetmanxy) = 1;
- data.word(kWatchingtime) = 30*2;
- data.word(kReeltowatch) = 183;
- data.word(kEndwatchreel) = 212;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::openryan() {
- STACK_CHECK;
- al = 5;
- ah = 1;
- cl = 0;
- ch = 6;
- entercode();
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::openpoolboss() {
- STACK_CHECK;
- al = 5;
- ah = 2;
- cl = 2;
- ch = 2;
- entercode();
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::openeden() {
- STACK_CHECK;
- al = 2;
- ah = 8;
- cl = 6;
- ch = 5;
- entercode();
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::opensarters() {
- STACK_CHECK;
- al = 7;
- ah = 8;
- cl = 3;
- ch = 3;
- entercode();
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::isitright() {
- STACK_CHECK;
- bx = data;
- es = bx;
- bx = 8573;
- _cmp(es.byte(bx+0), al);
- if (!flags.z())
- return /* (notright) */;
- _cmp(es.byte(bx+1), ah);
- if (!flags.z())
- return /* (notright) */;
- _cmp(es.byte(bx+2), cl);
- if (!flags.z())
- return /* (notright) */;
- _cmp(es.byte(bx+3), ch);
-}
-
-void DreamGenContext::drawitall() {
- STACK_CHECK;
- createpanel();
- drawfloor();
- printsprites();
- showicon();
-}
-
-void DreamGenContext::openhoteldoor() {
- STACK_CHECK;
- _cmp(data.byte(kWithobject), 255);
- if (!flags.z())
- goto hoteldoorwith;
- withwhat();
- return;
-hoteldoorwith:
- al = data.byte(kWithobject);
- ah = data.byte(kWithtype);
- cl = 'K';
- ch = 'E';
- dl = 'Y';
- dh = 'A';
- compare();
- if (flags.z())
- goto keyonhotel1;
- cx = 300;
- al = 14;
- showpuztext();
- putbackobstuff();
- return;
-keyonhotel1:
- al = 16;
- playchannel1();
- showfirstuse();
- data.byte(kLockstatus) = 0;
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::openhoteldoor2() {
- STACK_CHECK;
- _cmp(data.byte(kWithobject), 255);
- if (!flags.z())
- goto hoteldoorwith2;
- withwhat();
- return;
-hoteldoorwith2:
- al = data.byte(kWithobject);
- ah = data.byte(kWithtype);
- cl = 'K';
- ch = 'E';
- dl = 'Y';
- dh = 'A';
- compare();
- if (flags.z())
- goto keyonhotel2;
- cx = 300;
- al = 14;
- showpuztext();
- putbackobstuff();
- return;
-keyonhotel2:
- al = 16;
- playchannel1();
- showfirstuse();
- putbackobstuff();
-}
-
-void DreamGenContext::grafittidoor() {
- STACK_CHECK;
- _cmp(data.byte(kWithobject), 255);
- if (!flags.z())
- goto grafwith;
- withwhat();
- return;
-grafwith:
- al = data.byte(kWithobject);
- ah = data.byte(kWithtype);
- cl = 'A';
- ch = 'P';
- dl = 'E';
- dh = 'N';
- compare();
- if (flags.z())
- goto dograf;
- cx = 300;
- al = 14;
- showpuztext();
- putbackobstuff();
- return;
-dograf:
- showfirstuse();
- putbackobstuff();
-}
-
-void DreamGenContext::trapdoor() {
- STACK_CHECK;
- _inc(data.byte(kProgresspoints));
- showfirstuse();
- switchryanoff();
- data.word(kWatchingtime) = 20*2;
- data.word(kReeltowatch) = 181;
- data.word(kEndwatchreel) = 197;
- data.byte(kNewlocation) = 26;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::callhotellift() {
- STACK_CHECK;
- al = 12;
- playchannel1();
- showfirstuse();
- data.byte(kCounttoopen) = 8;
- data.byte(kGetback) = 1;
- data.byte(kDestination) = 5;
- data.byte(kFinaldest) = 5;
- autosetwalk();
- al = 4;
- turnpathon();
-}
-
-void DreamGenContext::calledenslift() {
- STACK_CHECK;
- showfirstuse();
- data.byte(kCounttoopen) = 8;
- data.byte(kGetback) = 1;
- al = 2;
- turnpathon();
-}
-
-void DreamGenContext::calledensdlift() {
- STACK_CHECK;
- _cmp(data.byte(kLiftflag), 1);
- if (flags.z())
- goto edensdhere;
- showfirstuse();
- data.byte(kCounttoopen) = 8;
- data.byte(kGetback) = 1;
- al = 2;
- turnpathon();
- return;
-edensdhere:
- showseconduse();
- putbackobstuff();
-}
-
-void DreamGenContext::usepoolreader() {
- STACK_CHECK;
- _cmp(data.byte(kWithobject), 255);
- if (!flags.z())
- goto poolwith;
- withwhat();
- return;
-poolwith:
- al = data.byte(kWithobject);
- ah = data.byte(kWithtype);
- cl = 'M';
- ch = 'E';
- dl = 'M';
- dh = 'B';
- compare();
- if (flags.z())
- goto openpool;
- cx = 300;
- al = 14;
- showpuztext();
- putbackobstuff();
- return;
-openpool:
- _cmp(data.byte(kTalkedtoattendant), 1);
- if (flags.z())
- goto canopenpool;
- showseconduse();
- putbackobstuff();
- return;
-canopenpool:
- al = 17;
- playchannel1();
- showfirstuse();
- data.byte(kCounttoopen) = 6;
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::uselighter() {
- STACK_CHECK;
- _cmp(data.byte(kWithobject), 255);
- if (!flags.z())
- goto gotlighterwith;
- withwhat();
- return;
-gotlighterwith:
- al = data.byte(kWithobject);
- ah = data.byte(kWithtype);
- cl = 'S';
- ch = 'M';
- dl = 'K';
- dh = 'E';
- compare();
- if (flags.z())
- goto cigarette;
- showfirstuse();
- putbackobstuff();
- return;
-cigarette:
- cx = 300;
- al = 9;
- showpuztext();
- al = data.byte(kWithobject);
- getexad();
- es.byte(bx+2) = 255;
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::showseconduse() {
- STACK_CHECK;
- getobtextstart();
- nextcolon();
- nextcolon();
- nextcolon();
- usetext();
- cx = 400;
- hangonp();
-}
-
-void DreamGenContext::usecardreader1() {
- STACK_CHECK;
- _cmp(data.byte(kWithobject), 255);
- if (!flags.z())
- goto gotreader1with;
- withwhat();
- return;
-gotreader1with:
- al = data.byte(kWithobject);
- ah = data.byte(kWithtype);
- cl = 'C';
- ch = 'S';
- dl = 'H';
- dh = 'R';
- compare();
- if (flags.z())
- goto correctcard;
- cx = 300;
- al = 14;
- showpuztext();
- putbackobstuff();
- return;
-correctcard:
- _cmp(data.byte(kTalkedtosparky), 0);
- if (flags.z())
- goto notyet;
- _cmp(data.word(kCard1money), 0);
- if (flags.z())
- goto getscash;
- cx = 300;
- al = 17;
- showpuztext();
- putbackobstuff();
- return;
-getscash:
- al = 16;
- playchannel1();
- cx = 300;
- al = 18;
- showpuztext();
- _inc(data.byte(kProgresspoints));
- data.word(kCard1money) = 12432;
- data.byte(kGetback) = 1;
- return;
-notyet:
- showfirstuse();
- putbackobstuff();
-}
-
-void DreamGenContext::usecardreader2() {
- STACK_CHECK;
- _cmp(data.byte(kWithobject), 255);
- if (!flags.z())
- goto gotreader2with;
- withwhat();
- return;
-gotreader2with:
- al = data.byte(kWithobject);
- ah = data.byte(kWithtype);
- cl = 'C';
- ch = 'S';
- dl = 'H';
- dh = 'R';
- compare();
- if (flags.z())
- goto correctcard2;
- cx = 300;
- al = 14;
- showpuztext();
- putbackobstuff();
- return;
-correctcard2:
- _cmp(data.byte(kTalkedtoboss), 0);
- if (flags.z())
- goto notyetboss;
- _cmp(data.word(kCard1money), 0);
- if (flags.z())
- goto nocash;
- _cmp(data.byte(kGunpassflag), 2);
- if (flags.z())
- goto alreadygotnew;
- al = 18;
- playchannel1();
- cx = 300;
- al = 19;
- showpuztext();
- al = 94;
- placesetobject();
- data.byte(kGunpassflag) = 1;
- _sub(data.word(kCard1money), 2000);
- _inc(data.byte(kProgresspoints));
- data.byte(kGetback) = 1;
- return;
-nocash:
- cx = 300;
- al = 20;
- showpuztext();
- putbackobstuff();
- return;
-alreadygotnew:
- cx = 300;
- al = 22;
- showpuztext();
- putbackobstuff();
- return;
-notyetboss:
- showfirstuse();
- putbackobstuff();
-}
-
-void DreamGenContext::usecardreader3() {
+void DreamGenContext::drawItAll() {
STACK_CHECK;
- _cmp(data.byte(kWithobject), 255);
- if (!flags.z())
- goto gotreader3with;
- withwhat();
- return;
-gotreader3with:
- al = data.byte(kWithobject);
- ah = data.byte(kWithtype);
- cl = 'C';
- ch = 'S';
- dl = 'H';
- dh = 'R';
- compare();
- if (flags.z())
- goto rightcard;
- cx = 300;
- al = 14;
- showpuztext();
- putbackobstuff();
- return;
-rightcard:
- _cmp(data.byte(kTalkedtorecep), 0);
- if (flags.z())
- goto notyetrecep;
- _cmp(data.byte(kCardpassflag), 0);
- if (!flags.z())
- goto alreadyusedit;
- al = 16;
- playchannel1();
- cx = 300;
- al = 25;
- showpuztext();
- _inc(data.byte(kProgresspoints));
- _sub(data.word(kCard1money), 8300);
- data.byte(kCardpassflag) = 1;
- data.byte(kGetback) = 1;
- return;
-alreadyusedit:
- cx = 300;
- al = 26;
- showpuztext();
- putbackobstuff();
- return;
-notyetrecep:
- showfirstuse();
- putbackobstuff();
+ createPanel();
+ drawFloor();
+ printSprites();
+ showIcon();
}
-void DreamGenContext::usecashcard() {
+void DreamGenContext::useCashCard() {
STACK_CHECK;
- getridofreels();
- loadkeypad();
- createpanel();
- showpanel();
- showexit();
- showman();
+ getRidOfReels();
+ loadKeypad();
+ createPanel();
+ showPanel();
+ showExit();
+ showMan();
di = 114;
bx = 120;
_cmp(data.byte(kForeignrelease), 0);
@@ -9472,18 +3906,18 @@ _tmp1:
ds = data.word(kTempgraphics);
al = 39;
ah = 0;
- showframe();
+ showFrame();
ax = data.word(kCard1money);
- moneypoke();
- getobtextstart();
- nextcolon();
- nextcolon();
+ moneyPoke();
+ getObTextStart();
+ nextColon();
+ nextColon();
di = 36;
bx = 98;
dl = 241;
al = 0;
ah = 0;
- printdirect();
+ printDirect();
di = 160;
bx = 155;
es = cs;
@@ -9492,7 +3926,7 @@ _tmp1:
al = 0;
ah = 0;
dl = 240;
- printdirect();
+ printDirect();
di = 187;
bx = 155;
es = cs;
@@ -9501,50 +3935,50 @@ _tmp1:
al = 0;
ah = 0;
dl = 240;
- printdirect();
+ printDirect();
data.word(kCharshift) = 0;
- worktoscreenm();
+ workToScreenM();
cx = 400;
- hangonp();
- getridoftemp();
- restorereels();
- putbackobstuff();
+ hangOnP();
+ getRidOfTemp();
+ restoreReels();
+ putBackObStuff();
}
-void DreamGenContext::lookatcard() {
+void DreamGenContext::lookAtCard() {
STACK_CHECK;
data.byte(kManisoffscreen) = 1;
- getridofreels();
- loadkeypad();
- createpanel2();
+ getRidOfReels();
+ loadKeypad();
+ createPanel2();
di = 160;
bx = 80;
ds = data.word(kTempgraphics);
al = 42;
ah = 128;
- showframe();
- getobtextstart();
- findnextcolon();
- findnextcolon();
- findnextcolon();
+ showFrame();
+ getObTextStart();
+ findNextColon();
+ findNextColon();
+ findNextColon();
di = 36;
bx = 124;
dl = 241;
al = 0;
ah = 0;
- printdirect();
+ printDirect();
push(es);
push(si);
- worktoscreenm();
+ workToScreenM();
cx = 280;
- hangonw();
- createpanel2();
+ hangOnW();
+ createPanel2();
di = 160;
bx = 80;
ds = data.word(kTempgraphics);
al = 42;
ah = 128;
- showframe();
+ showFrame();
si = pop();
es = pop();
di = 36;
@@ -9552,17 +3986,17 @@ void DreamGenContext::lookatcard() {
dl = 241;
al = 0;
ah = 0;
- printdirect();
- worktoscreenm();
+ printDirect();
+ workToScreenM();
cx = 200;
- hangonw();
+ hangOnW();
data.byte(kManisoffscreen) = 0;
- getridoftemp();
- restorereels();
- putbackobstuff();
+ getRidOfTemp();
+ restoreReels();
+ putBackObStuff();
}
-void DreamGenContext::moneypoke() {
+void DreamGenContext::moneyPoke() {
STACK_CHECK;
bx = offset_money1poke;
cl = 48-1;
@@ -9605,12 +4039,12 @@ numberpoke3:
cs.byte(bx) = al;
}
-void DreamGenContext::usecontrol() {
+void DreamGenContext::useControl() {
STACK_CHECK;
_cmp(data.byte(kWithobject), 255);
if (!flags.z())
goto gotcontrolwith;
- withwhat();
+ withWhat();
return;
gotcontrolwith:
al = data.byte(kWithobject);
@@ -9644,18 +4078,18 @@ gotcontrolwith:
if (flags.z())
goto axeoncontrols;
balls:
- showfirstuse();
- putbackobstuff();
+ showFirstUse();
+ putBackObStuff();
return;
rightkey:
al = 16;
- playchannel1();
+ playChannel1();
_cmp(data.byte(kLocation), 21);
if (flags.z())
goto goingdown;
cx = 300;
al = 0;
- showpuztext();
+ showPuzText();
data.byte(kNewlocation) = 21;
data.byte(kCounttoclose) = 8;
data.byte(kCounttoopen) = 0;
@@ -9665,7 +4099,7 @@ rightkey:
goingdown:
cx = 300;
al = 3;
- showpuztext();
+ showPuzText();
data.byte(kNewlocation) = 30;
data.byte(kCounttoclose) = 8;
data.byte(kCounttoopen) = 0;
@@ -9674,191 +4108,58 @@ goingdown:
return;
jimmycontrols:
al = 50;
- placesetobject();
+ placeSetObject();
al = 51;
- placesetobject();
+ placeSetObject();
al = 26;
- placesetobject();
+ placeSetObject();
al = 30;
- placesetobject();
+ placeSetObject();
al = 16;
- removesetobject();
+ removeSetObject();
al = 17;
- removesetobject();
+ removeSetObject();
al = 14;
- playchannel1();
+ playChannel1();
cx = 300;
al = 10;
- showpuztext();
+ showPuzText();
_inc(data.byte(kProgresspoints));
data.byte(kGetback) = 1;
return;
axeoncontrols:
cx = 300;
al = 16;
- showpuztext();
- _inc(data.byte(kProgresspoints));
- putbackobstuff();
-}
-
-void DreamGenContext::usehatch() {
- STACK_CHECK;
- showfirstuse();
- data.byte(kNewlocation) = 40;
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::usewire() {
- STACK_CHECK;
- _cmp(data.byte(kWithobject), 255);
- if (!flags.z())
- goto gotwirewith;
- withwhat();
- return;
-gotwirewith:
- al = data.byte(kWithobject);
- ah = data.byte(kWithtype);
- cl = 'K';
- ch = 'N';
- dl = 'F';
- dh = 'E';
- compare();
- if (flags.z())
- goto wireknife;
- al = data.byte(kWithobject);
- ah = data.byte(kWithtype);
- cl = 'A';
- ch = 'X';
- dl = 'E';
- dh = 'D';
- compare();
- if (flags.z())
- goto wireaxe;
- cx = 300;
- al = 14;
- showpuztext();
- putbackobstuff();
- return;
-wireaxe:
- cx = 300;
- al = 16;
- showpuztext();
- putbackobstuff();
- return;
-wireknife:
- al = 51;
- removesetobject();
- al = 52;
- placesetobject();
- cx = 300;
- al = 11;
- showpuztext();
+ showPuzText();
_inc(data.byte(kProgresspoints));
- data.byte(kGetback) = 1;
+ putBackObStuff();
}
-void DreamGenContext::usehandle() {
+void DreamGenContext::useHandle() {
STACK_CHECK;
al = 'C';
ah = 'U';
cl = 'T';
ch = 'W';
- findsetobject();
+ findSetObject();
al = es.byte(bx+58);
_cmp(al, 255);
if (!flags.z())
goto havecutwire;
cx = 300;
al = 12;
- showpuztext();
+ showPuzText();
data.byte(kGetback) = 1;
return;
havecutwire:
cx = 300;
al = 13;
- showpuztext();
+ showPuzText();
data.byte(kNewlocation) = 22;
data.byte(kGetback) = 1;
}
-void DreamGenContext::useelevator1() {
- STACK_CHECK;
- showfirstuse();
- selectlocation();
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::showfirstuse() {
- STACK_CHECK;
- getobtextstart();
- findnextcolon();
- findnextcolon();
- usetext();
- cx = 400;
- hangonp();
-}
-
-void DreamGenContext::useelevator3() {
- STACK_CHECK;
- showfirstuse();
- data.byte(kCounttoclose) = 20;
- data.byte(kNewlocation) = 34;
- data.word(kReeltowatch) = 46;
- data.word(kEndwatchreel) = 63;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.word(kWatchingtime) = 80;
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::useelevator4() {
- STACK_CHECK;
- showfirstuse();
- data.word(kReeltowatch) = 0;
- data.word(kEndwatchreel) = 11;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kCounttoclose) = 20;
- data.word(kWatchingtime) = 80;
- data.byte(kGetback) = 1;
- data.byte(kNewlocation) = 24;
-}
-
-void DreamGenContext::useelevator2() {
- STACK_CHECK;
- _cmp(data.byte(kLocation), 23);
- if (flags.z())
- goto inpoolhall;
- showfirstuse();
- data.byte(kNewlocation) = 23;
- data.byte(kCounttoclose) = 20;
- data.byte(kCounttoopen) = 0;
- data.word(kWatchingtime) = 80;
- data.byte(kGetback) = 1;
- return;
-inpoolhall:
- showfirstuse();
- data.byte(kNewlocation) = 31;
- data.byte(kCounttoclose) = 20;
- data.byte(kCounttoopen) = 0;
- data.word(kWatchingtime) = 80;
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::useelevator5() {
- STACK_CHECK;
- al = 4;
- placesetobject();
- al = 0;
- removesetobject();
- data.byte(kNewlocation) = 20;
- data.word(kWatchingtime) = 80;
- data.byte(kLiftflag) = 1;
- data.byte(kCounttoclose) = 8;
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::usekey() {
+void DreamGenContext::useKey() {
STACK_CHECK;
_cmp(data.byte(kLocation), 5);
if (flags.z())
@@ -9871,8 +4172,8 @@ void DreamGenContext::usekey() {
goto usekey2;
cx = 200;
al = 1;
- showpuztext();
- putbackobstuff();
+ showPuzText();
+ putBackObStuff();
return;
usekey1:
_cmp(data.byte(kMapx), 22);
@@ -9883,7 +4184,7 @@ usekey1:
goto wrongroom1;
cx = 300;
al = 0;
- showpuztext();
+ showPuzText();
data.byte(kCounttoclose) = 100;
data.byte(kGetback) = 1;
return;
@@ -9896,29 +4197,29 @@ usekey2:
goto wrongroom1;
cx = 300;
al = 3;
- showpuztext();
+ showPuzText();
data.byte(kNewlocation) = 30;
al = 2;
- fadescreendown();
- showfirstuse();
- putbackobstuff();
+ fadeScreenDown();
+ showFirstUse();
+ putBackObStuff();
return;
wrongroom1:
cx = 200;
al = 2;
- showpuztext();
- putbackobstuff();
+ showPuzText();
+ putBackObStuff();
}
-void DreamGenContext::usestereo() {
+void DreamGenContext::useStereo() {
STACK_CHECK;
_cmp(data.byte(kLocation), 0);
if (flags.z())
goto stereook;
cx = 400;
al = 4;
- showpuztext();
- putbackobstuff();
+ showPuzText();
+ putBackObStuff();
return;
stereook:
_cmp(data.byte(kMapx), 11);
@@ -9930,30 +4231,30 @@ stereook:
stereonotok:
cx = 400;
al = 5;
- showpuztext();
- putbackobstuff();
+ showPuzText();
+ putBackObStuff();
return;
stereook2:
al = 'C';
ah = 'D';
cl = 'P';
ch = 'L';
- findsetobject();
+ findSetObject();
ah = 1;
- checkinside();
+ checkInside();
_cmp(cl, (114));
if (!flags.z())
goto cdinside;
al = 6;
cx = 400;
- showpuztext();
- putbackobstuff();
- getanyad();
+ showPuzText();
+ putBackObStuff();
+ getAnyAd();
al = 255;
es.byte(bx+10) = al;
return;
cdinside:
- getanyad();
+ getAnyAd();
al = es.byte(bx+10);
_xor(al, 1);
es.byte(bx+10) = al;
@@ -9962,33 +4263,17 @@ cdinside:
goto stereoon;
al = 7;
cx = 400;
- showpuztext();
- putbackobstuff();
+ showPuzText();
+ putBackObStuff();
return;
stereoon:
al = 8;
cx = 400;
- showpuztext();
- putbackobstuff();
-}
-
-void DreamGenContext::usecooker() {
- STACK_CHECK;
- al = data.byte(kCommand);
- ah = data.byte(kObjecttype);
- checkinside();
- _cmp(cl, (114));
- if (!flags.z())
- goto foodinside;
- showfirstuse();
- putbackobstuff();
- return;
-foodinside:
- showseconduse();
- putbackobstuff();
+ showPuzText();
+ putBackObStuff();
}
-void DreamGenContext::useaxe() {
+void DreamGenContext::useAxe() {
STACK_CHECK;
_cmp(data.byte(kReallocation), 22);
if (!flags.z())
@@ -9996,20 +4281,20 @@ void DreamGenContext::useaxe() {
_cmp(data.byte(kMapy), 10);
if (flags.z())
goto axeondoor;
- showseconduse();
+ showSecondUse();
_inc(data.byte(kProgresspoints));
data.byte(kLastweapon) = 2;
data.byte(kGetback) = 1;
- removeobfrominv();
+ removeObFromInv();
return;
notinpool:
- showfirstuse();
+ showFirstUse();
return;
/*continuing to unbounded code: axeondoor from useelvdoor:19-30*/
axeondoor:
al = 15;
cx = 300;
- showpuztext();
+ showPuzText();
_inc(data.byte(kProgresspoints));
data.word(kWatchingtime) = 46*2;
data.word(kReeltowatch) = 31;
@@ -10019,52 +4304,17 @@ axeondoor:
data.byte(kGetback) = 1;
}
-void DreamGenContext::useelvdoor() {
+void DreamGenContext::withWhat() {
STACK_CHECK;
- _cmp(data.byte(kWithobject), 255);
- if (!flags.z())
- goto gotdoorwith;
- withwhat();
- return;
-gotdoorwith:
- al = data.byte(kWithobject);
- ah = data.byte(kWithtype);
- cl = 'A';
- ch = 'X';
- dl = 'E';
- dh = 'D';
- compare();
- if (flags.z())
- goto axeondoor;
- al = 14;
- cx = 300;
- showpuztext();
- putbackobstuff();
- return;
-axeondoor:
- al = 15;
- cx = 300;
- showpuztext();
- _inc(data.byte(kProgresspoints));
- data.word(kWatchingtime) = 46*2;
- data.word(kReeltowatch) = 31;
- data.word(kEndwatchreel) = 77;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::withwhat() {
- STACK_CHECK;
- createpanel();
- showpanel();
- showman();
- showexit();
+ createPanel();
+ showPanel();
+ showMan();
+ showExit();
al = data.byte(kCommand);
ah = data.byte(kObjecttype);
es = cs;
di = offset_commandline;
- copyname();
+ copyName();
di = 100;
bx = 21;
dl = 200;
@@ -10079,7 +4329,7 @@ void DreamGenContext::withwhat() {
dl = 220;
al = 0;
ah = 0;
- printdirect();
+ printDirect();
di = data.word(kLastxpos);
_add(di, 5);
bx = 21;
@@ -10087,18 +4337,18 @@ void DreamGenContext::withwhat() {
al = 63;
ah = 3;
printmessage2();
- fillryan();
+ fillRyan();
data.byte(kCommandtype) = 255;
- readmouse();
- showpointer();
- worktoscreen();
- delpointer();
+ readMouse();
+ showPointer();
+ workToScreen();
+ delPointer();
data.byte(kInvopen) = 2;
}
-void DreamGenContext::selectob() {
+void DreamGenContext::selectOb() {
STACK_CHECK;
- findinvpos();
+ findInvPos();
ax = es.word(bx);
_cmp(al, 255);
if (!flags.z())
@@ -10119,7 +4369,7 @@ diffsub3:
data.word(kOldsubject) = ax;
bx = ax;
al = 0;
- commandwithob();
+ commandWithOb();
alreadyselob:
ax = data.word(kMousebutton);
_cmp(ax, data.word(kOldbutton));
@@ -10130,12 +4380,12 @@ alreadyselob:
goto doselob;
return;
doselob:
- delpointer();
+ delPointer();
data.byte(kInvopen) = 0;
- useroutine();
+ useRoutine();
}
-void DreamGenContext::findsetobject() {
+void DreamGenContext::findSetObject() {
STACK_CHECK;
_sub(al, 'A');
_sub(ah, 'A');
@@ -10168,7 +4418,7 @@ nofind:
al = dl;
}
-void DreamGenContext::findexobject() {
+void DreamGenContext::findExObject() {
STACK_CHECK;
_sub(al, 'A');
_sub(ah, 'A');
@@ -10201,7 +4451,7 @@ nofindex:
al = dl;
}
-void DreamGenContext::isryanholding() {
+void DreamGenContext::isRyanHolding() {
STACK_CHECK;
_sub(al, 'A');
_sub(ah, 'A');
@@ -10239,7 +4489,7 @@ nofindininv:
_cmp(al, (114));
}
-void DreamGenContext::checkinside() {
+void DreamGenContext::checkInside() {
STACK_CHECK;
es = data.word(kExtras);
bx = (0+2080+30000);
@@ -10260,47 +4510,7 @@ notfoundinside:
goto insideloop;
}
-void DreamGenContext::putbackobstuff() {
- STACK_CHECK;
- createpanel();
- showpanel();
- showman();
- obicons();
- showexit();
- obpicture();
- describeob();
- undertextline();
- data.byte(kCommandtype) = 255;
- readmouse();
- showpointer();
- worktoscreen();
- delpointer();
-}
-
-void DreamGenContext::showpuztext() {
- STACK_CHECK;
- push(cx);
- findpuztext();
- push(es);
- push(si);
- createpanel();
- showpanel();
- showman();
- showexit();
- obicons();
- si = pop();
- es = pop();
- di = 36;
- bx = 104;
- dl = 241;
- ah = 0;
- printdirect();
- worktoscreenm();
- cx = pop();
- hangonp();
-}
-
-void DreamGenContext::findpuztext() {
+void DreamGenContext::findPuzText() {
STACK_CHECK;
ah = 0;
si = ax;
@@ -10311,121 +4521,17 @@ void DreamGenContext::findpuztext() {
si = ax;
}
-void DreamGenContext::issetobonmap() {
- STACK_CHECK;
- push(es);
- push(bx);
- getsetad();
- al = es.byte(bx+58);
- bx = pop();
- es = pop();
- _cmp(al, 0);
-}
-
-void DreamGenContext::placefreeobject() {
+void DreamGenContext::removeFreeObject() {
STACK_CHECK;
push(es);
push(bx);
- cl = 0;
- ch = 1;
- findormake();
- getfreead();
- es.byte(bx+2) = 0;
- bx = pop();
- es = pop();
-}
-
-void DreamGenContext::removefreeobject() {
- STACK_CHECK;
- push(es);
- push(bx);
- getfreead();
+ getFreeAd();
es.byte(bx+2) = 255;
bx = pop();
es = pop();
}
-void DreamGenContext::switchryanon() {
- STACK_CHECK;
- data.byte(kRyanon) = 255;
-}
-
-void DreamGenContext::switchryanoff() {
- STACK_CHECK;
- data.byte(kRyanon) = 1;
-}
-
-void DreamGenContext::autoappear() {
- STACK_CHECK;
- _cmp(data.byte(kLocation), 32);
- if (!flags.z())
- goto notinalley;
- al = 5;
- resetlocation();
- al = 10;
- setlocation();
- data.byte(kDestpos) = 10;
- return;
-notinalley:
- _cmp(data.byte(kReallocation), 24);
- if (!flags.z())
- goto notinedens;
- _cmp(data.byte(kGeneraldead), 1);
- if (!flags.z())
- goto edenspart2;
- _inc(data.byte(kGeneraldead));
- al = 44;
- placesetobject();
- al = 18;
- placesetobject();
- al = 93;
- placesetobject();
- al = 92;
- removesetobject();
- al = 55;
- removesetobject();
- al = 75;
- removesetobject();
- al = 84;
- removesetobject();
- al = 85;
- removesetobject();
- return;
-edenspart2:
- _cmp(data.byte(kSartaindead), 1);
- if (!flags.z())
- return /* (notedens2) */;
- al = 44;
- removesetobject();
- al = 93;
- removesetobject();
- al = 55;
- placesetobject();
- _inc(data.byte(kSartaindead));
- return;
-notinedens:
- _cmp(data.byte(kReallocation), 25);
- if (!flags.z())
- goto notonsartroof;
- data.byte(kNewsitem) = 3;
- al = 6;
- resetlocation();
- al = 11;
- setlocation();
- data.byte(kDestpos) = 11;
- return;
-notonsartroof:
- _cmp(data.byte(kReallocation), 2);
- if (!flags.z())
- return /* (notinlouiss) */;
- _cmp(data.byte(kRockstardead), 0);
- if (flags.z())
- return /* (notinlouiss) */;
- al = 23;
- placesetobject();
-}
-
-void DreamGenContext::setuptimeduse() {
+void DreamGenContext::setupTimedUse() {
STACK_CHECK;
_cmp(data.word(kTimecount), 0);
if (!flags.z())
@@ -10447,120 +4553,13 @@ void DreamGenContext::setuptimeduse() {
data.word(kTimedoffset) = bx;
}
-void DreamGenContext::edenscdplayer() {
- STACK_CHECK;
- showfirstuse();
- data.word(kWatchingtime) = 18*2;
- data.word(kReeltowatch) = 25;
- data.word(kEndwatchreel) = 42;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::usewall() {
- STACK_CHECK;
- showfirstuse();
- _cmp(data.byte(kManspath), 3);
- if (flags.z())
- goto gobackover;
- data.word(kWatchingtime) = 30*2;
- data.word(kReeltowatch) = 2;
- data.word(kEndwatchreel) = 31;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
- al = 3;
- turnpathon();
- al = 4;
- turnpathon();
- al = 0;
- turnpathoff();
- al = 1;
- turnpathoff();
- al = 2;
- turnpathoff();
- al = 5;
- turnpathoff();
- data.byte(kManspath) = 3;
- data.byte(kFinaldest) = 3;
- findxyfrompath();
- data.byte(kResetmanxy) = 1;
- switchryanoff();
- return;
-gobackover:
- data.word(kWatchingtime) = 30*2;
- data.word(kReeltowatch) = 34;
- data.word(kEndwatchreel) = 60;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
- al = 3;
- turnpathoff();
- al = 4;
- turnpathoff();
- al = 0;
- turnpathon();
- al = 1;
- turnpathon();
- al = 2;
- turnpathon();
- al = 5;
- turnpathon();
- data.byte(kManspath) = 5;
- data.byte(kFinaldest) = 5;
- findxyfrompath();
- data.byte(kResetmanxy) = 1;
- switchryanoff();
-}
-
-void DreamGenContext::usechurchgate() {
- STACK_CHECK;
- _cmp(data.byte(kWithobject), 255);
- if (!flags.z())
- goto gatewith;
- withwhat();
- return;
-gatewith:
- al = data.byte(kWithobject);
- ah = data.byte(kWithtype);
- cl = 'C';
- ch = 'U';
- dl = 'T';
- dh = 'T';
- compare();
- if (flags.z())
- goto cutgate;
- cx = 300;
- al = 14;
- showpuztext();
- putbackobstuff();
- return;
-cutgate:
- showfirstuse();
- data.word(kWatchingtime) = 64*2;
- data.word(kReeltowatch) = 4;
- data.word(kEndwatchreel) = 70;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
- _inc(data.byte(kProgresspoints));
- al = 3;
- turnpathon();
- _cmp(data.byte(kAidedead), 0);
- if (flags.z())
- return /* (notopenchurch) */;
- al = 2;
- turnpathon();
-}
-
-void DreamGenContext::usegun() {
+void DreamGenContext::useGun() {
STACK_CHECK;
_cmp(data.byte(kObjecttype), 4);
if (flags.z())
goto istakengun;
- showseconduse();
- putbackobstuff();
+ showSecondUse();
+ putBackObStuff();
return;
istakengun:
_cmp(data.byte(kReallocation), 22);
@@ -10568,7 +4567,7 @@ istakengun:
goto notinpoolroom;
cx = 300;
al = 34;
- showpuztext();
+ showPuzText();
data.byte(kLastweapon) = 1;
data.byte(kCombatcount) = 39;
data.byte(kGetback) = 1;
@@ -10580,7 +4579,7 @@ notinpoolroom:
goto nothelicopter;
cx = 300;
al = 34;
- showpuztext();
+ showPuzText();
data.byte(kLastweapon) = 1;
data.byte(kCombatcount) = 19;
data.byte(kGetback) = 1;
@@ -10595,7 +4594,7 @@ nothelicopter:
goto notinrockroom;
cx = 300;
al = 46;
- showpuztext();
+ showPuzText();
data.byte(kPointermode) = 2;
data.byte(kRockstardead) = 1;
data.byte(kLastweapon) = 1;
@@ -10616,7 +4615,7 @@ notinrockroom:
if (!flags.z())
goto notbystudio;
al = 92;
- issetobonmap();
+ isSetObOnMap();
if (flags.z())
goto notbystudio;
_cmp(data.byte(kManspath), 9);
@@ -10624,7 +4623,7 @@ notinrockroom:
goto notbystudio;
data.byte(kDestination) = 9;
data.byte(kFinaldest) = 9;
- autosetwalk();
+ autoSetWalk();
data.byte(kLastweapon) = 1;
data.byte(kGetback) = 1;
_inc(data.byte(kProgresspoints));
@@ -10640,20 +4639,20 @@ notbystudio:
if (!flags.z())
goto notsarters;
al = 5;
- issetobonmap();
+ isSetObOnMap();
if (!flags.z())
goto notsarters;
data.byte(kDestination) = 1;
data.byte(kFinaldest) = 1;
- autosetwalk();
+ autoSetWalk();
al = 5;
- removesetobject();
+ removeSetObject();
al = 6;
- placesetobject();
+ placeSetObject();
al = 1;
ah = data.byte(kRoomnum);
_dec(ah);
- turnanypathon();
+ turnAnyPathOn();
data.byte(kLiftflag) = 1;
data.word(kWatchingtime) = 40*2;
data.word(kReeltowatch) = 4;
@@ -10669,13 +4668,13 @@ notsarters:
goto notaide;
data.byte(kGetback) = 1;
al = 13;
- resetlocation();
+ resetLocation();
al = 12;
- setlocation();
+ setLocation();
data.byte(kDestpos) = 12;
data.byte(kDestination) = 2;
data.byte(kFinaldest) = 2;
- autosetwalk();
+ autoSetWalk();
data.word(kWatchingtime) = 164*2;
data.word(kReeltowatch) = 3;
data.word(kEndwatchreel) = 164;
@@ -10701,7 +4700,7 @@ notaide:
goto pathokboss;
data.byte(kDestination) = 5;
data.byte(kFinaldest) = 5;
- autosetwalk();
+ autoSetWalk();
pathokboss:
data.byte(kLastweapon) = 1;
data.byte(kGetback) = 1;
@@ -10721,1279 +4720,17 @@ notwithboss:
goto pathoktv;
data.byte(kDestination) = 2;
data.byte(kFinaldest) = 2;
- autosetwalk();
+ autoSetWalk();
pathoktv:
data.byte(kLastweapon) = 1;
data.byte(kGetback) = 1;
return;
nottvsoldier:
- showfirstuse();
- putbackobstuff();
-}
-
-void DreamGenContext::useshield() {
- STACK_CHECK;
- _cmp(data.byte(kReallocation), 20);
- if (!flags.z())
- goto notinsartroom;
- _cmp(data.byte(kCombatcount), 0);
- if (flags.z())
- goto notinsartroom;
- data.byte(kLastweapon) = 3;
- showseconduse();
- data.byte(kGetback) = 1;
- _inc(data.byte(kProgresspoints));
- removeobfrominv();
- return;
-notinsartroom:
- showfirstuse();
- putbackobstuff();
+ showFirstUse();
+ putBackObStuff();
}
-void DreamGenContext::usebuttona() {
- STACK_CHECK;
- al = 95;
- issetobonmap();
- if (flags.z())
- goto donethisbit;
- showfirstuse();
- al = 0;
- ah = data.byte(kRoomnum);
- _dec(ah);
- turnanypathon();
- al = 9;
- removesetobject();
- al = 95;
- placesetobject();
- data.word(kWatchingtime) = 15*2;
- data.word(kReeltowatch) = 71;
- data.word(kEndwatchreel) = 85;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kGetback) = 1;
- _inc(data.byte(kProgresspoints));
- return;
-donethisbit:
- showseconduse();
- putbackobstuff();
-}
-
-void DreamGenContext::useplate() {
- STACK_CHECK;
- _cmp(data.byte(kWithobject), 255);
- if (!flags.z())
- goto platewith;
- withwhat();
- return;
-platewith:
- al = data.byte(kWithobject);
- ah = data.byte(kWithtype);
- cl = 'S';
- ch = 'C';
- dl = 'R';
- dh = 'W';
- compare();
- if (flags.z())
- goto unscrewplate;
- al = data.byte(kWithobject);
- ah = data.byte(kWithtype);
- cl = 'K';
- ch = 'N';
- dl = 'F';
- dh = 'E';
- compare();
- if (flags.z())
- goto triedknife;
- cx = 300;
- al = 14;
- showpuztext();
- putbackobstuff();
- return;
-unscrewplate:
- al = 20;
- playchannel1();
- showfirstuse();
- al = 28;
- placesetobject();
- al = 24;
- placesetobject();
- al = 25;
- removesetobject();
- al = 0;
- placefreeobject();
- _inc(data.byte(kProgresspoints));
- data.byte(kGetback) = 1;
- return;
-triedknife:
- cx = 300;
- al = 54;
- showpuztext();
- putbackobstuff();
-}
-
-void DreamGenContext::usewinch() {
- STACK_CHECK;
- al = 40;
- ah = 1;
- checkinside();
- _cmp(cl, (114));
- if (flags.z())
- goto nowinch;
- al = cl;
- ah = 4;
- cl = 'F';
- ch = 'U';
- dl = 'S';
- dh = 'E';
- compare();
- if (!flags.z())
- goto nowinch;
- data.word(kWatchingtime) = 217*2;
- data.word(kReeltowatch) = 0;
- data.word(kEndwatchreel) = 217;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- data.byte(kDestpos) = 1;
- data.byte(kNewlocation) = 45;
- data.byte(kDreamnumber) = 1;
- data.byte(kRoomafterdream) = 44;
- data.byte(kGeneraldead) = 1;
- data.byte(kNewsitem) = 2;
- data.byte(kGetback) = 1;
- _inc(data.byte(kProgresspoints));
- return;
-nowinch:
- showfirstuse();
- putbackobstuff();
-}
-
-void DreamGenContext::entercode() {
- STACK_CHECK;
- data.word(kKeypadax) = ax;
- data.word(kKeypadcx) = cx;
- getridofreels();
- loadkeypad();
- createpanel();
- showicon();
- showouterpad();
- showkeypad();
- readmouse();
- showpointer();
- worktoscreen();
- delpointer();
- data.word(kPresspointer) = 0;
- data.byte(kGetback) = 0;
-keypadloop:
- _cmp(data.byte(kQuitrequested), 0);
- if (!flags.z())
- goto numberright;
- delpointer();
- readmouse();
- showkeypad();
- showpointer();
- vsync();
- _cmp(data.byte(kPresscount), 0);
- if (flags.z())
- goto nopresses;
- _dec(data.byte(kPresscount));
- goto afterpress;
-nopresses:
- data.byte(kPressed) = 255;
- data.byte(kGraphicpress) = 255;
- vsync();
-afterpress:
- dumppointer();
- dumpkeypad();
- dumptextline();
- bx = offset_keypadlist;
- checkcoords();
- _cmp(data.byte(kGetback), 1);
- if (flags.z())
- goto numberright;
- _cmp(data.byte(kLightcount), 1);
- if (!flags.z())
- goto notendkey;
- _cmp(data.byte(kLockstatus), 0);
- if (flags.z())
- goto numberright;
- goto keypadloop;
-notendkey:
- _cmp(data.byte(kPresscount), 40);
- if (!flags.z())
- goto keypadloop;
- addtopresslist();
- _cmp(data.byte(kPressed), 11);
- if (!flags.z())
- goto keypadloop;
- ax = data.word(kKeypadax);
- cx = data.word(kKeypadcx);
- isitright();
- if (!flags.z())
- goto incorrect;
- data.byte(kLockstatus) = 0;
- al = 11;
- playchannel1();
- data.byte(kLightcount) = 120;
- data.word(kPresspointer) = 0;
- goto keypadloop;
-incorrect:
- al = 11;
- playchannel1();
- data.byte(kLightcount) = 120;
- data.word(kPresspointer) = 0;
- goto keypadloop;
-numberright:
- data.byte(kManisoffscreen) = 0;
- getridoftemp();
- restorereels();
- redrawmainscrn();
- worktoscreenm();
-}
-
-void DreamGenContext::loadkeypad() {
- STACK_CHECK;
- dx = 1948;
- loadintotemp();
-}
-
-void DreamGenContext::quitkey() {
- STACK_CHECK;
- _cmp(data.byte(kCommandtype), 222);
- if (flags.z())
- goto alreadyqk;
- data.byte(kCommandtype) = 222;
- al = 4;
- commandonly();
-alreadyqk:
- ax = data.word(kMousebutton);
- _cmp(ax, data.word(kOldbutton));
- if (flags.z())
- return /* (notqk) */;
- _and(ax, 1);
- if (!flags.z())
- goto doqk;
- return;
-doqk:
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::addtopresslist() {
- STACK_CHECK;
- _cmp(data.word(kPresspointer), 5);
- if (flags.z())
- return /* (nomorekeys) */;
- al = data.byte(kPressed);
- _cmp(al, 10);
- if (!flags.z())
- goto not10;
- al = 0;
-not10:
- bx = data.word(kPresspointer);
- dx = data;
- es = dx;
- _add(bx, 8573);
- es.byte(bx) = al;
- _inc(data.word(kPresspointer));
-}
-
-void DreamGenContext::buttonone() {
- STACK_CHECK;
- cl = 1;
- buttonpress();
-}
-
-void DreamGenContext::buttontwo() {
- STACK_CHECK;
- cl = 2;
- buttonpress();
-}
-
-void DreamGenContext::buttonthree() {
- STACK_CHECK;
- cl = 3;
- buttonpress();
-}
-
-void DreamGenContext::buttonfour() {
- STACK_CHECK;
- cl = 4;
- buttonpress();
-}
-
-void DreamGenContext::buttonfive() {
- STACK_CHECK;
- cl = 5;
- buttonpress();
-}
-
-void DreamGenContext::buttonsix() {
- STACK_CHECK;
- cl = 6;
- buttonpress();
-}
-
-void DreamGenContext::buttonseven() {
- STACK_CHECK;
- cl = 7;
- buttonpress();
-}
-
-void DreamGenContext::buttoneight() {
- STACK_CHECK;
- cl = 8;
- buttonpress();
-}
-
-void DreamGenContext::buttonnine() {
- STACK_CHECK;
- cl = 9;
- buttonpress();
-}
-
-void DreamGenContext::buttonnought() {
- STACK_CHECK;
- cl = 10;
- buttonpress();
-}
-
-void DreamGenContext::buttonenter() {
- STACK_CHECK;
- cl = 11;
- buttonpress();
-}
-
-void DreamGenContext::buttonpress() {
- STACK_CHECK;
- ch = cl;
- _add(ch, 100);
- _cmp(data.byte(kCommandtype), ch);
- if (flags.z())
- goto alreadyb;
- data.byte(kCommandtype) = ch;
- al = cl;
- _add(al, 4);
- push(cx);
- commandonly();
- cx = pop();
-alreadyb:
- ax = data.word(kMousebutton);
- _cmp(ax, data.word(kOldbutton));
- if (flags.z())
- return /* (notb) */;
- _and(ax, 1);
- if (!flags.z())
- goto dob;
- return;
-dob:
- data.byte(kPressed) = cl;
- _add(cl, 21);
- data.byte(kGraphicpress) = cl;
- data.byte(kPresscount) = 40;
- _cmp(cl, 32);
- if (flags.z())
- return /* (nonoise) */;
- al = 10;
- playchannel1();
-}
-
-void DreamGenContext::showouterpad() {
- STACK_CHECK;
- di = (36+112)-3;
- bx = (72)-4;
- ds = data.word(kTempgraphics);
- al = 1;
- ah = 0;
- showframe();
- di = (36+112)+74;
- bx = (72)+76;
- ds = data.word(kTempgraphics);
- al = 37;
- ah = 0;
- showframe();
-}
-
-void DreamGenContext::showkeypad() {
- STACK_CHECK;
- al = 22;
- di = (36+112)+9;
- bx = (72)+5;
- singlekey();
- al = 23;
- di = (36+112)+31;
- bx = (72)+5;
- singlekey();
- al = 24;
- di = (36+112)+53;
- bx = (72)+5;
- singlekey();
- al = 25;
- di = (36+112)+9;
- bx = (72)+23;
- singlekey();
- al = 26;
- di = (36+112)+31;
- bx = (72)+23;
- singlekey();
- al = 27;
- di = (36+112)+53;
- bx = (72)+23;
- singlekey();
- al = 28;
- di = (36+112)+9;
- bx = (72)+41;
- singlekey();
- al = 29;
- di = (36+112)+31;
- bx = (72)+41;
- singlekey();
- al = 30;
- di = (36+112)+53;
- bx = (72)+41;
- singlekey();
- al = 31;
- di = (36+112)+9;
- bx = (72)+59;
- singlekey();
- al = 32;
- di = (36+112)+31;
- bx = (72)+59;
- singlekey();
- _cmp(data.byte(kLightcount), 0);
- if (flags.z())
- return /* (notenter) */;
- _dec(data.byte(kLightcount));
- al = 36;
- bx = (72)-1+63;
- _cmp(data.byte(kLockstatus), 0);
- if (!flags.z())
- goto changelight;
- al = 41;
- bx = (72)+4+63;
-changelight:
- _cmp(data.byte(kLightcount), 60);
- if (flags.c())
- goto gotlight;
- _cmp(data.byte(kLightcount), 100);
- if (!flags.c())
- goto gotlight;
- _dec(al);
-gotlight:
- ds = data.word(kTempgraphics);
- ah = 0;
- di = (36+112)+60;
- showframe();
-}
-
-void DreamGenContext::singlekey() {
- STACK_CHECK;
- _cmp(data.byte(kGraphicpress), al);
- if (!flags.z())
- goto gotkey;
- _add(al, 11);
- _cmp(data.byte(kPresscount), 8);
- if (!flags.c())
- goto gotkey;
- _sub(al, 11);
-gotkey:
- ds = data.word(kTempgraphics);
- _sub(al, 20);
- ah = 0;
- showframe();
-}
-
-void DreamGenContext::dumpkeypad() {
- STACK_CHECK;
- di = (36+112)-3;
- bx = (72)-4;
- cl = 120;
- ch = 90;
- multidump();
-}
-
-void DreamGenContext::usemenu() {
- STACK_CHECK;
- getridofreels();
- loadmenu();
- createpanel();
- showpanel();
- showicon();
- data.byte(kNewobs) = 0;
- drawfloor();
- printsprites();
- al = 4;
- ah = 0;
- di = (80+40)-48;
- bx = (60)-4;
- ds = data.word(kTempgraphics2);
- showframe();
- getundermenu();
- al = 5;
- ah = 0;
- di = (80+40)+54;
- bx = (60)+72;
- ds = data.word(kTempgraphics2);
- showframe();
- worktoscreenm();
- data.byte(kGetback) = 0;
-menuloop:
- delpointer();
- putundermenu();
- showmenu();
- readmouse();
- showpointer();
- vsync();
- dumppointer();
- dumpmenu();
- dumptextline();
- bx = offset_menulist;
- checkcoords();
- _cmp(data.byte(kGetback), 1);
- if (!flags.z())
- goto menuloop;
- data.byte(kManisoffscreen) = 0;
- redrawmainscrn();
- getridoftemp();
- getridoftemp2();
- restorereels();
- worktoscreenm();
-}
-
-void DreamGenContext::dumpmenu() {
- STACK_CHECK;
- di = (80+40);
- bx = (60);
- cl = 48;
- ch = 48;
- multidump();
-}
-
-void DreamGenContext::getundermenu() {
- STACK_CHECK;
- di = (80+40);
- bx = (60);
- cl = 48;
- ch = 48;
- ds = data.word(kBuffers);
- si = (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)+(5*80)+(250*4));
- multiget();
-}
-
-void DreamGenContext::putundermenu() {
- STACK_CHECK;
- di = (80+40);
- bx = (60);
- cl = 48;
- ch = 48;
- ds = data.word(kBuffers);
- si = (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)+(5*80)+(250*4));
- multiput();
-}
-
-void DreamGenContext::showoutermenu() {
- STACK_CHECK;
- al = 40;
- ah = 0;
- di = (80+40)-34;
- bx = (60)-40;
- ds = data.word(kTempgraphics);
- showframe();
- al = 41;
- ah = 0;
- di = (80+40)+64-34;
- bx = (60)-40;
- ds = data.word(kTempgraphics);
- showframe();
- al = 42;
- ah = 0;
- di = (80+40)-26;
- bx = (60)+57-40;
- ds = data.word(kTempgraphics);
- showframe();
- al = 43;
- ah = 0;
- di = (80+40)+64-26;
- bx = (60)+57-40;
- ds = data.word(kTempgraphics);
- showframe();
-}
-
-void DreamGenContext::showmenu() {
- STACK_CHECK;
- _inc(data.byte(kMenucount));
- _cmp(data.byte(kMenucount), 37*2);
- if (!flags.z())
- goto menuframeok;
- data.byte(kMenucount) = 0;
-menuframeok:
- al = data.byte(kMenucount);
- _shr(al, 1);
- ah = 0;
- di = (80+40);
- bx = (60);
- ds = data.word(kTempgraphics);
- showframe();
-}
-
-void DreamGenContext::loadmenu() {
- STACK_CHECK;
- dx = 1832;
- loadintotemp();
- dx = 1987;
- loadintotemp2();
-}
-
-void DreamGenContext::viewfolder() {
- STACK_CHECK;
- data.byte(kManisoffscreen) = 1;
- getridofall();
- loadfolder();
- data.byte(kFolderpage) = 0;
- showfolder();
- worktoscreenm();
- data.byte(kGetback) = 0;
-folderloop:
- delpointer();
- readmouse();
- showpointer();
- vsync();
- dumppointer();
- dumptextline();
- bx = offset_folderlist;
- checkcoords();
- _cmp(data.byte(kGetback), 0);
- if (flags.z())
- goto folderloop;
- data.byte(kManisoffscreen) = 0;
- getridoftemp();
- getridoftemp2();
- getridoftemp3();
- getridoftempcharset();
- restoreall();
- redrawmainscrn();
- worktoscreenm();
-}
-
-void DreamGenContext::nextfolder() {
- STACK_CHECK;
- _cmp(data.byte(kFolderpage), 12);
- if (!flags.z())
- goto cannextf;
- blank();
- return;
-cannextf:
- _cmp(data.byte(kCommandtype), 201);
- if (flags.z())
- goto alreadynextf;
- data.byte(kCommandtype) = 201;
- al = 16;
- commandonly();
-alreadynextf:
- ax = data.word(kMousebutton);
- _cmp(ax, data.word(kOldbutton));
- if (flags.z())
- return /* (notnextf) */;
- _cmp(ax, 1);
- if (flags.z())
- goto donextf;
- return;
-donextf:
- _inc(data.byte(kFolderpage));
- folderhints();
- delpointer();
- showfolder();
- data.word(kMousebutton) = 0;
- bx = offset_folderlist;
- checkcoords();
- worktoscreenm();
-}
-
-void DreamGenContext::folderhints() {
- STACK_CHECK;
- _cmp(data.byte(kFolderpage), 5);
- if (!flags.z())
- goto notaideadd;
- _cmp(data.byte(kAidedead), 1);
- if (flags.z())
- goto notaideadd;
- al = 13;
- getlocation();
- _cmp(al, 1);
- if (flags.z())
- goto notaideadd;
- al = 13;
- setlocation();
- showfolder();
- al = 30;
- findtext1();
- di = 0;
- bx = 86;
- dl = 141;
- ah = 16;
- printdirect();
- worktoscreenm();
- cx = 200;
- hangonp();
- return;
-notaideadd:
- _cmp(data.byte(kFolderpage), 9);
- if (!flags.z())
- return /* (notaristoadd) */;
- al = 7;
- getlocation();
- _cmp(al, 1);
- if (flags.z())
- return /* (notaristoadd) */;
- al = 7;
- setlocation();
- showfolder();
- al = 31;
- findtext1();
- di = 0;
- bx = 86;
- dl = 141;
- ah = 16;
- printdirect();
- worktoscreenm();
- cx = 200;
- hangonp();
-}
-
-void DreamGenContext::lastfolder() {
- STACK_CHECK;
- _cmp(data.byte(kFolderpage), 0);
- if (!flags.z())
- goto canlastf;
- blank();
- return;
-canlastf:
- _cmp(data.byte(kCommandtype), 202);
- if (flags.z())
- goto alreadylastf;
- data.byte(kCommandtype) = 202;
- al = 17;
- commandonly();
-alreadylastf:
- _cmp(data.byte(kFolderpage), 0);
- if (flags.z())
- return /* (notlastf) */;
- ax = data.word(kMousebutton);
- _cmp(ax, data.word(kOldbutton));
- if (flags.z())
- return /* (notlastf) */;
- _cmp(ax, 1);
- if (flags.z())
- goto dolastf;
- return;
-dolastf:
- _dec(data.byte(kFolderpage));
- delpointer();
- showfolder();
- data.word(kMousebutton) = 0;
- bx = offset_folderlist;
- checkcoords();
- worktoscreenm();
-}
-
-void DreamGenContext::loadfolder() {
- STACK_CHECK;
- dx = 2299;
- loadintotemp();
- dx = 2312;
- loadintotemp2();
- dx = 2325;
- loadintotemp3();
- dx = 1883;
- loadtempcharset();
- dx = 2195;
- loadtemptext();
-}
-
-void DreamGenContext::showfolder() {
- STACK_CHECK;
- data.byte(kCommandtype) = 255;
- _cmp(data.byte(kFolderpage), 0);
- if (flags.z())
- goto closedfolder;
- usetempcharset();
- createpanel2();
- ds = data.word(kTempgraphics);
- di = 0;
- bx = 0;
- al = 0;
- ah = 0;
- showframe();
- ds = data.word(kTempgraphics);
- di = 143;
- bx = 0;
- al = 1;
- ah = 0;
- showframe();
- ds = data.word(kTempgraphics);
- di = 0;
- bx = 92;
- al = 2;
- ah = 0;
- showframe();
- ds = data.word(kTempgraphics);
- di = 143;
- bx = 92;
- al = 3;
- ah = 0;
- showframe();
- folderexit();
- _cmp(data.byte(kFolderpage), 1);
- if (flags.z())
- goto noleftpage;
- showleftpage();
-noleftpage:
- _cmp(data.byte(kFolderpage), 12);
- if (flags.z())
- goto norightpage;
- showrightpage();
-norightpage:
- usecharset1();
- undertextline();
- return;
-closedfolder:
- createpanel2();
- ds = data.word(kTempgraphics3);
- di = 143-28;
- bx = 0;
- al = 0;
- ah = 0;
- showframe();
- ds = data.word(kTempgraphics3);
- di = 143-28;
- bx = 92;
- al = 1;
- ah = 0;
- showframe();
- folderexit();
- undertextline();
-}
-
-void DreamGenContext::folderexit() {
- STACK_CHECK;
- ds = data.word(kTempgraphics2);
- di = 296;
- bx = 178;
- al = 6;
- ah = 0;
- showframe();
-}
-
-void DreamGenContext::showleftpage() {
- STACK_CHECK;
- ds = data.word(kTempgraphics2);
- di = 0;
- bx = 12;
- al = 3;
- ah = 0;
- showframe();
- bx = 12+5;
- cx = 9;
-leftpageloop:
- push(cx);
- push(bx);
- ds = data.word(kTempgraphics2);
- di = 0;
- al = 4;
- ah = 0;
- showframe();
- bx = pop();
- cx = pop();
- _add(bx, 16);
- if (--cx)
- goto leftpageloop;
- ds = data.word(kTempgraphics2);
- di = 0;
- al = 5;
- ah = 0;
- showframe();
- data.word(kLinespacing) = 8;
- data.word(kCharshift) = 91;
- data.byte(kKerning) = 1;
- bl = data.byte(kFolderpage);
- _dec(bl);
- _dec(bl);
- _add(bl, bl);
- bh = 0;
- _add(bx, bx);
- es = data.word(kTextfile1);
- si = es.word(bx);
- _add(si, 66*2);
- di = 2;
- bx = 48;
- dl = 140;
- cx = 2;
-twolotsleft:
- push(cx);
-contleftpage:
- printdirect();
- _add(bx, data.word(kLinespacing));
- _cmp(al, 0);
- if (!flags.z())
- goto contleftpage;
- cx = pop();
- if (--cx)
- goto twolotsleft;
- data.byte(kKerning) = 0;
- data.word(kCharshift) = 0;
- data.word(kLinespacing) = 10;
- es = data.word(kWorkspace);
- ds = data.word(kWorkspace);
- di = (48*320)+2;
- si = (48*320)+2+130;
- cx = 120;
-flipfolder:
- push(cx);
- push(di);
- push(si);
- cx = 65;
-flipfolderline:
- al = es.byte(di);
- ah = es.byte(si);
- es.byte(di) = ah;
- es.byte(si) = al;
- _dec(si);
- _inc(di);
- if (--cx)
- goto flipfolderline;
- si = pop();
- di = pop();
- cx = pop();
- _add(si, 320);
- _add(di, 320);
- if (--cx)
- goto flipfolder;
-}
-
-void DreamGenContext::showrightpage() {
- STACK_CHECK;
- ds = data.word(kTempgraphics2);
- di = 143;
- bx = 12;
- al = 0;
- ah = 0;
- showframe();
- bx = 12+37;
- cx = 7;
-rightpageloop:
- push(cx);
- push(bx);
- ds = data.word(kTempgraphics2);
- di = 143;
- al = 1;
- ah = 0;
- showframe();
- bx = pop();
- cx = pop();
- _add(bx, 16);
- if (--cx)
- goto rightpageloop;
- ds = data.word(kTempgraphics2);
- di = 143;
- al = 2;
- ah = 0;
- showframe();
- data.word(kLinespacing) = 8;
- data.byte(kKerning) = 1;
- bl = data.byte(kFolderpage);
- _dec(bl);
- _add(bl, bl);
- bh = 0;
- _add(bx, bx);
- es = data.word(kTextfile1);
- si = es.word(bx);
- _add(si, 66*2);
- di = 152;
- bx = 48;
- dl = 140;
- cx = 2;
-twolotsright:
- push(cx);
-contrightpage:
- printdirect();
- _add(bx, data.word(kLinespacing));
- _cmp(al, 0);
- if (!flags.z())
- goto contrightpage;
- cx = pop();
- if (--cx)
- goto twolotsright;
- data.byte(kKerning) = 0;
- data.word(kLinespacing) = 10;
-}
-
-void DreamGenContext::entersymbol() {
- STACK_CHECK;
- data.byte(kManisoffscreen) = 1;
- getridofreels();
- dx = 2338;
- loadintotemp();
- data.byte(kSymboltopx) = 24;
- data.byte(kSymboltopdir) = 0;
- data.byte(kSymbolbotx) = 24;
- data.byte(kSymbolbotdir) = 0;
- redrawmainscrn();
- showsymbol();
- undertextline();
- worktoscreenm();
- data.byte(kGetback) = 0;
-symbolloop:
- delpointer();
- updatesymboltop();
- updatesymbolbot();
- showsymbol();
- readmouse();
- showpointer();
- vsync();
- dumppointer();
- dumptextline();
- dumpsymbol();
- bx = offset_symbollist;
- checkcoords();
- _cmp(data.byte(kGetback), 0);
- if (flags.z())
- goto symbolloop;
- _cmp(data.byte(kSymbolbotnum), 3);
- if (!flags.z())
- goto symbolwrong;
- _cmp(data.byte(kSymboltopnum), 5);
- if (!flags.z())
- goto symbolwrong;
- al = 43;
- removesetobject();
- al = 46;
- placesetobject();
- ah = data.byte(kRoomnum);
- _add(ah, 12);
- al = 0;
- turnanypathon();
- data.byte(kManisoffscreen) = 0;
- redrawmainscrn();
- getridoftemp();
- restorereels();
- worktoscreenm();
- al = 13;
- playchannel1();
- return;
-symbolwrong:
- al = 46;
- removesetobject();
- al = 43;
- placesetobject();
- ah = data.byte(kRoomnum);
- _add(ah, 12);
- al = 0;
- turnanypathoff();
- data.byte(kManisoffscreen) = 0;
- redrawmainscrn();
- getridoftemp();
- restorereels();
- worktoscreenm();
-}
-
-void DreamGenContext::quitsymbol() {
- STACK_CHECK;
- _cmp(data.byte(kSymboltopx), 24);
- if (!flags.z())
- { blank(); return; };
- _cmp(data.byte(kSymbolbotx), 24);
- if (!flags.z())
- { blank(); return; };
- _cmp(data.byte(kCommandtype), 222);
- if (flags.z())
- goto alreadyqs;
- data.byte(kCommandtype) = 222;
- al = 18;
- commandonly();
-alreadyqs:
- ax = data.word(kMousebutton);
- _cmp(ax, data.word(kOldbutton));
- if (flags.z())
- return /* (notqs) */;
- _and(ax, 1);
- if (!flags.z())
- goto doqs;
- return;
-doqs:
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::settopleft() {
- STACK_CHECK;
- _cmp(data.byte(kSymboltopdir), 0);
- if (!flags.z())
- { blank(); return; };
- _cmp(data.byte(kCommandtype), 210);
- if (flags.z())
- goto alreadytopl;
- data.byte(kCommandtype) = 210;
- al = 19;
- commandonly();
-alreadytopl:
- _cmp(data.word(kMousebutton), 0);
- if (flags.z())
- return /* (notopleft) */;
- data.byte(kSymboltopdir) = -1;
-}
-
-void DreamGenContext::settopright() {
- STACK_CHECK;
- _cmp(data.byte(kSymboltopdir), 0);
- if (!flags.z())
- { blank(); return; };
- _cmp(data.byte(kCommandtype), 211);
- if (flags.z())
- goto alreadytopr;
- data.byte(kCommandtype) = 211;
- al = 20;
- commandonly();
-alreadytopr:
- _cmp(data.word(kMousebutton), 0);
- if (flags.z())
- return /* (notopright) */;
- data.byte(kSymboltopdir) = 1;
-}
-
-void DreamGenContext::setbotleft() {
- STACK_CHECK;
- _cmp(data.byte(kSymbolbotdir), 0);
- if (!flags.z())
- { blank(); return; };
- _cmp(data.byte(kCommandtype), 212);
- if (flags.z())
- goto alreadybotl;
- data.byte(kCommandtype) = 212;
- al = 21;
- commandonly();
-alreadybotl:
- _cmp(data.word(kMousebutton), 0);
- if (flags.z())
- return /* (nobotleft) */;
- data.byte(kSymbolbotdir) = -1;
-}
-
-void DreamGenContext::setbotright() {
- STACK_CHECK;
- _cmp(data.byte(kSymbolbotdir), 0);
- if (!flags.z())
- { blank(); return; };
- _cmp(data.byte(kCommandtype), 213);
- if (flags.z())
- goto alreadybotr;
- data.byte(kCommandtype) = 213;
- al = 22;
- commandonly();
-alreadybotr:
- _cmp(data.word(kMousebutton), 0);
- if (flags.z())
- return /* (nobotright) */;
- data.byte(kSymbolbotdir) = 1;
-}
-
-void DreamGenContext::dumpsymbol() {
- STACK_CHECK;
- data.byte(kNewtextline) = 0;
- di = (64);
- bx = (56)+20;
- cl = 104;
- ch = 60;
- multidump();
-}
-
-void DreamGenContext::showsymbol() {
- STACK_CHECK;
- al = 12;
- ah = 0;
- di = (64);
- bx = (56);
- ds = data.word(kTempgraphics);
- showframe();
- al = data.byte(kSymboltopx);
- ah = 0;
- di = ax;
- _add(di, (64)-44);
- al = data.byte(kSymboltopnum);
- bx = (56)+20;
- ds = data.word(kTempgraphics);
- ah = 32;
- push(ax);
- push(di);
- push(bx);
- push(ds);
- showframe();
- ds = pop();
- bx = pop();
- di = pop();
- ax = pop();
- nextsymbol();
- _add(di, 49);
- push(ax);
- push(di);
- push(bx);
- push(ds);
- showframe();
- ds = pop();
- bx = pop();
- di = pop();
- ax = pop();
- nextsymbol();
- _add(di, 49);
- showframe();
- al = data.byte(kSymbolbotx);
- ah = 0;
- di = ax;
- _add(di, (64)-44);
- al = data.byte(kSymbolbotnum);
- _add(al, 6);
- bx = (56)+49;
- ds = data.word(kTempgraphics);
- ah = 32;
- push(ax);
- push(di);
- push(bx);
- push(ds);
- showframe();
- ds = pop();
- bx = pop();
- di = pop();
- ax = pop();
- nextsymbol();
- _add(di, 49);
- push(ax);
- push(di);
- push(bx);
- push(ds);
- showframe();
- ds = pop();
- bx = pop();
- di = pop();
- ax = pop();
- nextsymbol();
- _add(di, 49);
- showframe();
-}
-
-void DreamGenContext::nextsymbol() {
- STACK_CHECK;
- _inc(al);
- _cmp(al, 6);
- if (flags.z())
- goto topwrap;
- _cmp(al, 12);
- if (flags.z())
- goto botwrap;
- return;
-topwrap:
- al = 0;
- return;
-botwrap:
- al = 6;
-}
-
-void DreamGenContext::updatesymboltop() {
+void DreamGenContext::updateSymbolTop() {
STACK_CHECK;
_cmp(data.byte(kSymboltopdir), 0);
if (flags.z())
@@ -12037,7 +4774,7 @@ notwrapback:
data.byte(kSymboltopdir) = 0;
}
-void DreamGenContext::updatesymbolbot() {
+void DreamGenContext::updateSymbolBot() {
STACK_CHECK;
_cmp(data.byte(kSymbolbotdir), 0);
if (flags.z())
@@ -12081,78 +4818,7 @@ notwrapbackb:
data.byte(kSymbolbotdir) = 0;
}
-void DreamGenContext::dumpsymbox() {
- STACK_CHECK;
- _cmp(data.word(kDumpx), -1);
- if (flags.z())
- return /* (nodumpsym) */;
- di = data.word(kDumpx);
- bx = data.word(kDumpy);
- cl = 30;
- ch = 77;
- multidump();
- data.word(kDumpx) = -1;
-}
-
-void DreamGenContext::usediary() {
- STACK_CHECK;
- getridofreels();
- dx = 2039;
- loadintotemp();
- dx = 2208;
- loadtemptext();
- dx = 1883;
- loadtempcharset();
- createpanel();
- showicon();
- showdiary();
- undertextline();
- showdiarypage();
- readmouse();
- showpointer();
- worktoscreen();
- delpointer();
- data.byte(kGetback) = 0;
-diaryloop:
- delpointer();
- readmouse();
- showdiarykeys();
- showpointer();
- vsync();
- dumppointer();
- dumpdiarykeys();
- dumptextline();
- bx = offset_diarylist;
- checkcoords();
- _cmp(data.byte(kGetback), 0);
- if (flags.z())
- goto diaryloop;
- getridoftemp();
- getridoftemptext();
- getridoftempcharset();
- restorereels();
- data.byte(kManisoffscreen) = 0;
- redrawmainscrn();
- worktoscreenm();
-}
-
-void DreamGenContext::showdiary() {
- STACK_CHECK;
- al = 1;
- ah = 0;
- di = (68+24);
- bx = (48+12)+37;
- ds = data.word(kTempgraphics);
- showframe();
- al = 2;
- ah = 0;
- di = (68+24)+176;
- bx = (48+12)+108;
- ds = data.word(kTempgraphics);
- showframe();
-}
-
-void DreamGenContext::showdiarykeys() {
+void DreamGenContext::showDiaryKeys() {
STACK_CHECK;
_cmp(data.byte(kPresscount), 0);
if (flags.z())
@@ -12174,11 +4840,11 @@ gotkeyn:
di = (68+24)+94;
bx = (48+12)+97;
ds = data.word(kTempgraphics);
- showframe();
+ showFrame();
_cmp(data.byte(kPresscount), 1);
if (!flags.z())
return /* (notshown) */;
- showdiarypage();
+ showDiaryPage();
return;
nokeyn:
al = 5;
@@ -12191,14 +4857,14 @@ gotkeyp:
di = (68+24)+151;
bx = (48+12)+71;
ds = data.word(kTempgraphics);
- showframe();
+ showFrame();
_cmp(data.byte(kPresscount), 1);
if (!flags.z())
return /* (notshowp) */;
- showdiarypage();
+ showDiaryPage();
}
-void DreamGenContext::dumpdiarykeys() {
+void DreamGenContext::dumpDiaryKeys() {
STACK_CHECK;
_cmp(data.byte(kPresscount), 1);
if (!flags.z())
@@ -12213,143 +4879,83 @@ void DreamGenContext::dumpdiarykeys() {
if (!flags.z())
goto notsartadd;
al = 6;
- getlocation();
+ getLocation();
_cmp(al, 1);
if (flags.z())
goto notsartadd;
al = 6;
- setlocation();
- delpointer();
+ setLocation();
+ delPointer();
al = 12;
- findtext1();
+ findText1();
di = 70;
bx = 106;
dl = 241;
ah = 16;
- printdirect();
- worktoscreenm();
+ printDirect();
+ workToScreenM();
cx = 200;
- hangonp();
- createpanel();
- showicon();
- showdiary();
- showdiarypage();
- worktoscreenm();
- showpointer();
+ hangOnP();
+ createPanel();
+ showIcon();
+ showDiary();
+ showDiaryPage();
+ workToScreenM();
+ showPointer();
return;
notsartadd:
di = (68+24)+48;
bx = (48+12)+15;
cl = 200;
ch = 16;
- multidump();
+ multiDump();
notdumpdiary:
di = (68+24)+94;
bx = (48+12)+97;
cl = 16;
ch = 16;
- multidump();
+ multiDump();
di = (68+24)+151;
bx = (48+12)+71;
cl = 16;
ch = 16;
- multidump();
+ multiDump();
}
-void DreamGenContext::diarykeyp() {
- STACK_CHECK;
- _cmp(data.byte(kCommandtype), 214);
- if (flags.z())
- goto alreadykeyp;
- data.byte(kCommandtype) = 214;
- al = 23;
- commandonly();
-alreadykeyp:
- _cmp(data.word(kMousebutton), 0);
- if (flags.z())
- return /* (notkeyp) */;
- ax = data.word(kOldbutton);
- _cmp(ax, data.word(kMousebutton));
- if (flags.z())
- return /* (notkeyp) */;
- _cmp(data.byte(kPresscount), 0);
- if (!flags.z())
- return /* (notkeyp) */;
- al = 16;
- playchannel1();
- data.byte(kPresscount) = 12;
- data.byte(kPressed) = 'P';
- _dec(data.byte(kDiarypage));
- _cmp(data.byte(kDiarypage), -1);
- if (!flags.z())
- return /* (notkeyp) */;
- data.byte(kDiarypage) = 11;
-}
-
-void DreamGenContext::diarykeyn() {
- STACK_CHECK;
- _cmp(data.byte(kCommandtype), 213);
- if (flags.z())
- goto alreadykeyn;
- data.byte(kCommandtype) = 213;
- al = 23;
- commandonly();
-alreadykeyn:
- _cmp(data.word(kMousebutton), 0);
- if (flags.z())
- return /* (notkeyn) */;
- ax = data.word(kOldbutton);
- _cmp(ax, data.word(kMousebutton));
- if (flags.z())
- return /* (notkeyn) */;
- _cmp(data.byte(kPresscount), 0);
- if (!flags.z())
- return /* (notkeyn) */;
- al = 16;
- playchannel1();
- data.byte(kPresscount) = 12;
- data.byte(kPressed) = 'N';
- _inc(data.byte(kDiarypage));
- _cmp(data.byte(kDiarypage), 12);
- if (!flags.z())
- return /* (notkeyn) */;
- data.byte(kDiarypage) = 0;
-}
-
-void DreamGenContext::showdiarypage() {
+void DreamGenContext::showDiaryPage() {
STACK_CHECK;
al = 0;
ah = 0;
di = (68+24);
bx = (48+12);
ds = data.word(kTempgraphics);
- showframe();
+ showFrame();
al = data.byte(kDiarypage);
- findtext1();
+ findText1();
data.byte(kKerning) = 1;
- usetempcharset();
+ useTempCharset();
di = (68+24)+48;
bx = (48+12)+16;
dl = 240;
ah = 16;
data.word(kCharshift) = 91+91;
- printdirect();
+ printDirect();
di = (68+24)+129;
bx = (48+12)+16;
dl = 240;
ah = 16;
- printdirect();
+ printDirect();
di = (68+24)+48;
bx = (48+12)+23;
dl = 240;
ah = 16;
- printdirect();
+ printDirect();
data.byte(kKerning) = 0;
data.word(kCharshift) = 0;
- usecharset1();
+ useCharset1();
}
-void DreamGenContext::findtext1() {
+void DreamGenContext::findText1() {
STACK_CHECK;
ah = 0;
si = ax;
@@ -12360,490 +4966,14 @@ void DreamGenContext::findtext1() {
si = ax;
}
-void DreamGenContext::zoomonoff() {
- STACK_CHECK;
- _cmp(data.word(kWatchingtime), 0);
- if (!flags.z())
- { blank(); return; };
- _cmp(data.byte(kPointermode), 2);
- if (flags.z())
- { blank(); return; };
- _cmp(data.byte(kCommandtype), 222);
- if (flags.z())
- goto alreadyonoff;
- data.byte(kCommandtype) = 222;
- al = 39;
- commandonly();
-alreadyonoff:
- ax = data.word(kMousebutton);
- _cmp(ax, data.word(kOldbutton));
- if (flags.z())
- return /* (nozoomonoff) */;
- _and(ax, 1);
- if (!flags.z())
- goto dozoomonoff;
- return;
-dozoomonoff:
- al = data.byte(kZoomon);
- _xor(al, 1);
- data.byte(kZoomon) = al;
- createpanel();
- data.byte(kNewobs) = 0;
- drawfloor();
- printsprites();
- reelsonscreen();
- showicon();
- getunderzoom();
- undertextline();
- al = 39;
- commandonly();
- readmouse();
- worktoscreenm();
-}
-
-void DreamGenContext::saveload() {
- STACK_CHECK;
- _cmp(data.word(kWatchingtime), 0);
- if (!flags.z())
- { blank(); return; };
- _cmp(data.byte(kPointermode), 2);
- if (flags.z())
- { blank(); return; };
- _cmp(data.byte(kCommandtype), 253);
- if (flags.z())
- goto alreadyops;
- data.byte(kCommandtype) = 253;
- al = 43;
- commandonly();
-alreadyops:
- ax = data.word(kMousebutton);
- _cmp(ax, data.word(kOldbutton));
- if (flags.z())
- return /* (noops) */;
- _and(ax, 1);
- if (flags.z())
- return /* (noops) */;
- dosaveload();
-}
-
-void DreamGenContext::dosaveload() {
- STACK_CHECK;
- data.byte(kPointerframe) = 0;
- data.word(kTextaddressx) = 70;
- data.word(kTextaddressy) = 182-8;
- data.byte(kTextlen) = 181;
- data.byte(kManisoffscreen) = 1;
- clearwork();
- createpanel2();
- undertextline();
- getridofall();
- loadsavebox();
- showopbox();
- showmainops();
- worktoscreen();
- goto donefirstops;
-restartops:
- showopbox();
- showmainops();
- worktoscreenm();
-donefirstops:
- data.byte(kGetback) = 0;
-waitops:
- _cmp(data.byte(kQuitrequested), 0);
- if (!flags.z())
- goto justret;
- readmouse();
- showpointer();
- vsync();
- dumppointer();
- dumptextline();
- delpointer();
- bx = offset_opslist;
- checkcoords();
- _cmp(data.byte(kGetback), 0);
- if (flags.z())
- goto waitops;
- _cmp(data.byte(kGetback), 2);
- if (flags.z())
- goto restartops;
- data.word(kTextaddressx) = 13;
- data.word(kTextaddressy) = 182;
- data.byte(kTextlen) = 240;
- _cmp(data.byte(kGetback), 4);
- if (flags.z())
- goto justret;
- getridoftemp();
- restoreall();
- redrawmainscrn();
- worktoscreenm();
- data.byte(kCommandtype) = 200;
-justret:
- data.byte(kManisoffscreen) = 0;
-}
-
-void DreamGenContext::getbackfromops() {
- STACK_CHECK;
- _cmp(data.byte(kMandead), 2);
- if (flags.z())
- goto opsblock1;
- getback1();
- return;
-opsblock1:
- blank();
-}
-
-void DreamGenContext::showmainops() {
- STACK_CHECK;
- ds = data.word(kTempgraphics);
- di = (60)+10;
- bx = (52)+10;
- al = 8;
- ah = 0;
- showframe();
- ds = data.word(kTempgraphics);
- di = (60)+59;
- bx = (52)+30;
- al = 7;
- ah = 0;
- showframe();
- ds = data.word(kTempgraphics);
- di = (60)+128+4;
- bx = (52)+12;
- al = 1;
- ah = 0;
- showframe();
-}
-
-void DreamGenContext::showdiscops() {
- STACK_CHECK;
- ds = data.word(kTempgraphics);
- di = (60)+128+4;
- bx = (52)+12;
- al = 1;
- ah = 0;
- showframe();
- ds = data.word(kTempgraphics);
- di = (60)+10;
- bx = (52)+10;
- al = 9;
- ah = 0;
- showframe();
- ds = data.word(kTempgraphics);
- di = (60)+59;
- bx = (52)+30;
- al = 10;
- ah = 0;
- showframe();
- ds = data.word(kTempgraphics);
- di = (60)+176+2;
- bx = (52)+60-4;
- al = 5;
- ah = 0;
- showframe();
-}
-
-void DreamGenContext::loadsavebox() {
- STACK_CHECK;
- dx = 1961;
- loadintotemp();
-}
-
-void DreamGenContext::getbacktoops() {
- STACK_CHECK;
- _cmp(data.byte(kCommandtype), 201);
- if (flags.z())
- goto alreadygetops;
- data.byte(kCommandtype) = 201;
- al = 42;
- commandonly();
-alreadygetops:
- ax = data.word(kMousebutton);
- _cmp(ax, data.word(kOldbutton));
- if (flags.z())
- return /* (nogetbackops) */;
- _and(ax, 1);
- if (!flags.z())
- goto dogetbackops;
- return;
-dogetbackops:
- oldtonames();
- data.byte(kGetback) = 2;
-}
-
-void DreamGenContext::discops() {
- STACK_CHECK;
- _cmp(data.byte(kCommandtype), 249);
- if (flags.z())
- goto alreadydiscops;
- data.byte(kCommandtype) = 249;
- al = 43;
- commandonly();
-alreadydiscops:
- ax = data.word(kMousebutton);
- _cmp(ax, data.word(kOldbutton));
- if (flags.z())
- return /* (nodiscops) */;
- _and(ax, 1);
- if (!flags.z())
- goto dodiscops;
- return;
-dodiscops:
- scanfornames();
- data.byte(kLoadingorsave) = 2;
- showopbox();
- showdiscops();
- data.byte(kCurrentslot) = 0;
- worktoscreenm();
- data.byte(kGetback) = 0;
-discopsloop:
- _cmp(data.byte(kQuitrequested), 0);
- if (!flags.z())
- return /* (quitdiscops) */;
- delpointer();
- readmouse();
- showpointer();
- vsync();
- dumppointer();
- dumptextline();
- bx = offset_discopslist;
- checkcoords();
- _cmp(data.byte(kGetback), 0);
- if (flags.z())
- goto discopsloop;
-}
-
-void DreamGenContext::actualsave() {
- STACK_CHECK;
- _cmp(data.byte(kCommandtype), 222);
- if (flags.z())
- goto alreadyactsave;
- data.byte(kCommandtype) = 222;
- al = 44;
- commandonly();
-alreadyactsave:
- ax = data.word(kMousebutton);
- _and(ax, 1);
- if (flags.z())
- return /* (noactsave) */;
- dx = data;
- ds = dx;
- si = 8579;
- al = data.byte(kCurrentslot);
- ah = 0;
- cx = 17;
- _mul(cx);
- _add(si, ax);
- _inc(si);
- _cmp(ds.byte(si), 0);
- if (flags.z())
- return /* (noactsave) */;
- al = data.byte(kLocation);
- ah = 0;
- cx = 32;
- _mul(cx);
- ds = cs;
- si = 6187;
- _add(si, ax);
- di = 7979;
- bx = di;
- es = cs;
- cx = 16;
- _movsw(cx, true);
- al = data.byte(kRoomssample);
- es.byte(bx+13) = al;
- al = data.byte(kMapx);
- es.byte(bx+15) = al;
- al = data.byte(kMapy);
- es.byte(bx+16) = al;
- al = data.byte(kLiftflag);
- es.byte(bx+20) = al;
- al = data.byte(kManspath);
- es.byte(bx+21) = al;
- al = data.byte(kFacing);
- es.byte(bx+22) = al;
- al = 255;
- es.byte(bx+27) = al;
- saveposition();
- getridoftemp();
- restoreall();
- data.word(kTextaddressx) = 13;
- data.word(kTextaddressy) = 182;
- data.byte(kTextlen) = 240;
- redrawmainscrn();
- worktoscreenm();
- data.byte(kGetback) = 4;
-}
-
-void DreamGenContext::actualload() {
- STACK_CHECK;
- _cmp(data.byte(kCommandtype), 221);
- if (flags.z())
- goto alreadyactload;
- data.byte(kCommandtype) = 221;
- al = 41;
- commandonly();
-alreadyactload:
- ax = data.word(kMousebutton);
- _cmp(ax, data.word(kOldbutton));
- if (flags.z())
- return /* (notactload) */;
- _cmp(ax, 1);
- if (!flags.z())
- return /* (notactload) */;
- dx = data;
- ds = dx;
- si = 8579;
- al = data.byte(kCurrentslot);
- ah = 0;
- cx = 17;
- _mul(cx);
- _add(si, ax);
- _inc(si);
- _cmp(ds.byte(si), 0);
- if (flags.z())
- return /* (notactload) */;
- loadposition();
- data.byte(kGetback) = 1;
-}
-
-void DreamGenContext::selectslot2() {
- STACK_CHECK;
- _cmp(data.word(kMousebutton), 0);
- if (flags.z())
- goto noselslot2;
- data.byte(kLoadingorsave) = 2;
-noselslot2:
- selectslot();
-}
-
-void DreamGenContext::checkinput() {
- STACK_CHECK;
- _cmp(data.byte(kLoadingorsave), 3);
- if (flags.z())
- return /* (nokeypress) */;
- readkey();
- al = data.byte(kCurrentkey);
- _cmp(al, 0);
- if (flags.z())
- return /* (nokeypress) */;
- _cmp(al, 13);
- if (!flags.z())
- goto notret;
- data.byte(kLoadingorsave) = 3;
- goto afterkey;
-notret:
- _cmp(al, 8);
- if (!flags.z())
- goto nodel2;
- _cmp(data.byte(kCursorpos), 0);
- if (flags.z())
- return /* (nokeypress) */;
- getnamepos();
- _dec(data.byte(kCursorpos));
- es.byte(bx) = 0;
- es.byte(bx+1) = 1;
- goto afterkey;
-nodel2:
- _cmp(data.byte(kCursorpos), 14);
- if (flags.z())
- return /* (nokeypress) */;
- getnamepos();
- _inc(data.byte(kCursorpos));
- al = data.byte(kCurrentkey);
- es.byte(bx+1) = al;
- es.byte(bx+2) = 0;
- es.byte(bx+3) = 1;
- goto afterkey;
- return;
-afterkey:
- showopbox();
- shownames();
- showslots();
- showsaveops();
- worktoscreenm();
-}
-
-void DreamGenContext::getnamepos() {
- STACK_CHECK;
- al = data.byte(kCurrentslot);
- ah = 0;
- cx = 17;
- _mul(cx);
- dx = data;
- es = dx;
- bx = 8579;
- _add(bx, ax);
- al = data.byte(kCursorpos);
- ah = 0;
- _add(bx, ax);
-}
-
-void DreamGenContext::showopbox() {
- STACK_CHECK;
- ds = data.word(kTempgraphics);
- di = (60);
- bx = (52);
- al = 0;
- ah = 0;
- showframe();
- ds = data.word(kTempgraphics);
- di = (60);
- bx = (52)+55;
- al = 4;
- ah = 0;
- showframe();
-}
-
-void DreamGenContext::showloadops() {
- STACK_CHECK;
- ds = data.word(kTempgraphics);
- di = (60)+128+4;
- bx = (52)+12;
- al = 1;
- ah = 0;
- showframe();
- ds = data.word(kTempgraphics);
- di = (60)+176+2;
- bx = (52)+60-4;
- al = 5;
- ah = 0;
- showframe();
- di = (60)+104;
- bx = (52)+14;
- al = 55;
- dl = 101;
- printmessage();
-}
-
-void DreamGenContext::showsaveops() {
- STACK_CHECK;
- ds = data.word(kTempgraphics);
- di = (60)+128+4;
- bx = (52)+12;
- al = 1;
- ah = 0;
- showframe();
- ds = data.word(kTempgraphics);
- di = (60)+176+2;
- bx = (52)+60-4;
- al = 5;
- ah = 0;
- showframe();
- di = (60)+104;
- bx = (52)+14;
- al = 54;
- dl = 101;
- printmessage();
-}
-
-void DreamGenContext::selectslot() {
+void DreamGenContext::selectSlot() {
STACK_CHECK;
_cmp(data.byte(kCommandtype), 244);
if (flags.z())
goto alreadysel;
data.byte(kCommandtype) = 244;
al = 45;
- commandonly();
+ commandOnly();
alreadysel:
ax = data.word(kMousebutton);
_cmp(ax, 1);
@@ -12857,7 +4987,7 @@ alreadysel:
goto notnocurs;
_dec(data.byte(kLoadingorsave));
notnocurs:
- oldtonames();
+ oldToNames();
ax = data.word(kMousey);
_sub(ax, (52)+4);
cl = -1;
@@ -12867,35 +4997,35 @@ getslotnum:
if (!flags.c())
goto getslotnum;
data.byte(kCurrentslot) = cl;
- delpointer();
- showopbox();
- showslots();
- shownames();
+ delPointer();
+ showOpBox();
+ showSlots();
+ showNames();
_cmp(data.byte(kLoadingorsave), 1);
if (flags.z())
goto isloadmode;
- showsaveops();
- readmouse();
- showpointer();
- worktoscreen();
- delpointer();
+ showSaveOps();
+ readMouse();
+ showPointer();
+ workToScreen();
+ delPointer();
return;
isloadmode:
- showloadops();
- readmouse();
- showpointer();
- worktoscreen();
- delpointer();
+ showLoadOps();
+ readMouse();
+ showPointer();
+ workToScreen();
+ delPointer();
}
-void DreamGenContext::showslots() {
+void DreamGenContext::showSlots() {
STACK_CHECK;
di = (60)+7;
bx = (52)+8;
al = 2;
ds = data.word(kTempgraphics);
ah = 0;
- showframe();
+ showFrame();
di = (60)+10;
bx = (52)+11;
cl = 0;
@@ -12909,7 +5039,7 @@ slotloop:
al = 3;
ds = data.word(kTempgraphics);
ah = 0;
- showframe();
+ showFrame();
nomatchslot:
bx = pop();
di = pop();
@@ -12921,564 +5051,7 @@ nomatchslot:
goto slotloop;
}
-void DreamGenContext::shownames() {
- STACK_CHECK;
- dx = data;
- es = dx;
- si = 8579+1;
- di = (60)+21;
- bx = (52)+10;
- cl = 0;
-shownameloop:
- push(cx);
- push(di);
- push(es);
- push(bx);
- push(si);
- al = 4;
- _cmp(cl, data.byte(kCurrentslot));
- if (!flags.z())
- goto nomatchslot2;
- _cmp(data.byte(kLoadingorsave), 2);
- if (!flags.z())
- goto loadmode;
- dx = si;
- cx = 15;
- _add(si, 15);
-zerostill:
- _dec(si);
- _dec(cl);
- _cmp(es.byte(si), 1);
- if (!flags.z())
- goto foundcharacter;
- goto zerostill;
-foundcharacter:
- data.byte(kCursorpos) = cl;
- es.byte(si) = '/';
- es.byte(si+1) = 0;
- push(si);
- si = dx;
- dl = 200;
- ah = 0;
- printdirect();
- si = pop();
- es.byte(si) = 0;
- es.byte(si+1) = 1;
- goto afterprintname;
-loadmode:
- al = 0;
- dl = 200;
- ah = 0;
- data.word(kCharshift) = 91;
- printdirect();
- data.word(kCharshift) = 0;
- goto afterprintname;
-nomatchslot2:
- dl = 200;
- ah = 0;
- printdirect();
-afterprintname:
- si = pop();
- bx = pop();
- es = pop();
- di = pop();
- cx = pop();
- _add(si, 17);
- _add(bx, 10);
- _inc(cl);
- _cmp(cl, 7);
- if (!flags.z())
- goto shownameloop;
-}
-
-void DreamGenContext::namestoold() {
- STACK_CHECK;
- ds = cs;
- si = 8579;
- di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5));
- es = data.word(kBuffers);
- cx = 17*4;
- _movsb(cx, true);
-}
-
-void DreamGenContext::oldtonames() {
- STACK_CHECK;
- es = cs;
- di = 8579;
- si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5));
- ds = data.word(kBuffers);
- cx = 17*4;
- _movsb(cx, true);
-}
-
-void DreamGenContext::saveposition() {
- STACK_CHECK;
- makeheader();
- al = data.byte(kCurrentslot);
- ah = 0;
- push(ax);
- cx = 13;
- _mul(cx);
- dx = data;
- ds = dx;
- dx = 8698;
- _add(dx, ax);
- openforsave();
- dx = data;
- ds = dx;
- dx = 6091;
- cx = (6187-6091);
- savefilewrite();
- dx = data;
- es = dx;
- di = 6141;
- ax = pop();
- cx = 17;
- _mul(cx);
- dx = data;
- ds = dx;
- dx = 8579;
- _add(dx, ax);
- saveseg();
- dx = data;
- ds = dx;
- dx = 0;
- saveseg();
- ds = data.word(kExtras);
- dx = (0);
- saveseg();
- ds = data.word(kBuffers);
- dx = (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)+(5*80));
- saveseg();
- dx = data;
- ds = dx;
- dx = 7979;
- saveseg();
- dx = data;
- ds = dx;
- dx = 534;
- saveseg();
- closefile();
-}
-
-void DreamGenContext::loadposition() {
- STACK_CHECK;
- data.word(kTimecount) = 0;
- clearchanges();
- al = data.byte(kCurrentslot);
- ah = 0;
- push(ax);
- cx = 13;
- _mul(cx);
- dx = data;
- ds = dx;
- dx = 8698;
- _add(dx, ax);
- openfilefromc();
- ds = cs;
- dx = 6091;
- cx = (6187-6091);
- savefileread();
- es = cs;
- di = 6141;
- ax = pop();
- cx = 17;
- _mul(cx);
- dx = data;
- ds = dx;
- dx = 8579;
- _add(dx, ax);
- loadseg();
- dx = data;
- ds = dx;
- dx = 0;
- loadseg();
- ds = data.word(kExtras);
- dx = (0);
- loadseg();
- ds = data.word(kBuffers);
- dx = (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)+(5*80));
- loadseg();
- dx = data;
- ds = dx;
- dx = 7979;
- loadseg();
- ds = cs;
- dx = 534;
- loadseg();
- closefile();
-}
-
-void DreamGenContext::makeheader() {
- STACK_CHECK;
- dx = data;
- es = dx;
- di = 6141;
- ax = 17;
- storeit();
- ax = (68-0);
- storeit();
- ax = (0+2080+30000+(16*114)+((114+2)*2)+18000);
- storeit();
- ax = (250)*4;
- storeit();
- ax = 48;
- storeit();
- ax = (991-534);
- storeit();
-}
-
-void DreamGenContext::storeit() {
- STACK_CHECK;
- _cmp(ax, 0);
- if (!flags.z())
- goto isntblank;
- _inc(ax);
-isntblank:
- _stosw();
-}
-
-void DreamGenContext::scanfornames() {
- STACK_CHECK;
- dx = data;
- es = dx;
- di = 8579;
- dx = data;
- ds = dx;
- dx = 8698;
- cx = 7;
-scanloop:
- push(es);
- push(ds);
- push(di);
- push(dx);
- push(cx);
- openfilefromc();
- if (flags.c())
- goto notexist;
- cx = pop();
- _inc(ch);
- push(cx);
- push(di);
- push(es);
- dx = data;
- ds = dx;
- dx = 6091;
- cx = (6187-6091);
- savefileread();
- dx = data;
- es = dx;
- di = 6141;
- ds = pop();
- dx = pop();
- loadseg();
- bx = data.word(kHandle);
- closefile();
-notexist:
- cx = pop();
- dx = pop();
- di = pop();
- ds = pop();
- es = pop();
- _add(dx, 13);
- _add(di, 17);
- _dec(cl);
- if (!flags.z())
- goto scanloop;
- al = ch;
-}
-
-void DreamGenContext::decide() {
- STACK_CHECK;
- setmode();
- loadpalfromiff();
- clearpalette();
- data.byte(kPointermode) = 0;
- data.word(kWatchingtime) = 0;
- data.byte(kPointerframe) = 0;
- data.word(kTextaddressx) = 70;
- data.word(kTextaddressy) = 182-8;
- data.byte(kTextlen) = 181;
- data.byte(kManisoffscreen) = 1;
- loadsavebox();
- showdecisions();
- worktoscreen();
- fadescreenup();
- data.byte(kGetback) = 0;
-waitdecide:
- _cmp(data.byte(kQuitrequested), 0);
- if (flags.z())
- goto _tmp1;
- return;
-_tmp1:
- readmouse();
- showpointer();
- vsync();
- dumppointer();
- dumptextline();
- delpointer();
- bx = offset_decidelist;
- checkcoords();
- _cmp(data.byte(kGetback), 0);
- if (flags.z())
- goto waitdecide;
- _cmp(data.byte(kGetback), 4);
- if (flags.z())
- goto hasloadedroom;
- getridoftemp();
-hasloadedroom:
- data.word(kTextaddressx) = 13;
- data.word(kTextaddressy) = 182;
- data.byte(kTextlen) = 240;
-}
-
-void DreamGenContext::showdecisions() {
- STACK_CHECK;
- createpanel2();
- showopbox();
- ds = data.word(kTempgraphics);
- di = (60)+17;
- bx = (52)+13;
- al = 6;
- ah = 0;
- showframe();
- undertextline();
-}
-
-void DreamGenContext::newgame() {
- STACK_CHECK;
- _cmp(data.byte(kCommandtype), 251);
- if (flags.z())
- goto alreadynewgame;
- data.byte(kCommandtype) = 251;
- al = 47;
- commandonly();
-alreadynewgame:
- ax = data.word(kMousebutton);
- _cmp(ax, 1);
- if (!flags.z())
- return /* (nonewgame) */;
- data.byte(kGetback) = 3;
-}
-
-void DreamGenContext::loadold() {
- STACK_CHECK;
- _cmp(data.byte(kCommandtype), 252);
- if (flags.z())
- goto alreadyloadold;
- data.byte(kCommandtype) = 252;
- al = 48;
- commandonly();
-alreadyloadold:
- ax = data.word(kMousebutton);
- _and(ax, 1);
- if (flags.z())
- return /* (noloadold) */;
- ax = 0x0ffff;
- doload();
- _cmp(data.byte(kGetback), 4);
- if (flags.z())
- return /* (noloadold) */;
- _cmp(data.byte(kQuitrequested), 0);
- if (!flags.z())
- return /* (noloadold) */;
- showdecisions();
- worktoscreenm();
- data.byte(kGetback) = 0;
-}
-
-void DreamGenContext::createname() {
- STACK_CHECK;
- push(ax);
- di = offset_speechfile;
- cs.byte(di+0) = dl;
- cs.byte(di+3) = cl;
- al = dh;
- ah = '0'-1;
-findten:
- _inc(ah);
- _sub(al, 10);
- if (!flags.c())
- goto findten;
- cs.byte(di+1) = ah;
- _add(al, 10+'0');
- cs.byte(di+2) = al;
- ax = pop();
- cl = '0'-1;
-thousandsc:
- _inc(cl);
- _sub(ax, 1000);
- if (!flags.c())
- goto thousandsc;
- _add(ax, 1000);
- cs.byte(di+4) = cl;
- cl = '0'-1;
-hundredsc:
- _inc(cl);
- _sub(ax, 100);
- if (!flags.c())
- goto hundredsc;
- _add(ax, 100);
- cs.byte(di+5) = cl;
- cl = '0'-1;
-tensc:
- _inc(cl);
- _sub(ax, 10);
- if (!flags.c())
- goto tensc;
- _add(ax, 10);
- cs.byte(di+6) = cl;
- _add(al, '0');
- cs.byte(di+7) = al;
-}
-
-void DreamGenContext::trysoundalloc() {
- STACK_CHECK;
- _cmp(data.byte(kNeedsoundbuff), 1);
- if (flags.z())
- return /* (gotsoundbuff) */;
- _inc(data.byte(kSoundtimes));
- bx = (16384+2048)/16;
- allocatemem();
- data.word(kSoundbuffer) = ax;
- push(ax);
- al = ah;
- cl = 4;
- _shr(al, cl);
- data.byte(kSoundbufferpage) = al;
- ax = pop();
- cl = 4;
- _shl(ax, cl);
- data.word(kSoundbufferad) = ax;
- _cmp(ax, 0x0b7ff);
- if (!flags.c())
- goto soundfail;
- es = data.word(kSoundbuffer);
- di = 0;
- cx = 16384/2;
- ax = 0x7f7f;
- _stosw(cx, true);
- data.byte(kNeedsoundbuff) = 1;
- return;
-soundfail:
- es = data.word(kSoundbuffer);
- deallocatemem();
-}
-
-void DreamGenContext::playchannel0() {
- STACK_CHECK;
- _cmp(data.byte(kSoundint), 255);
- if (flags.z())
- return /* (dontbother4) */;
- push(es);
- push(ds);
- push(bx);
- push(cx);
- push(di);
- push(si);
- data.byte(kCh0playing) = al;
- es = data.word(kSounddata);
- _cmp(al, 12);
- if (flags.c())
- goto notsecondbank;
- es = data.word(kSounddata2);
- _sub(al, 12);
-notsecondbank:
- data.byte(kCh0repeat) = ah;
- ah = 0;
- _add(ax, ax);
- bx = ax;
- _add(ax, ax);
- _add(bx, ax);
- al = es.byte(bx);
- ah = 0;
- data.word(kCh0emmpage) = ax;
- ax = es.word(bx+1);
- data.word(kCh0offset) = ax;
- ax = es.word(bx+3);
- data.word(kCh0blockstocopy) = ax;
- _cmp(data.byte(kCh0repeat), 0);
- if (flags.z())
- goto nosetloop;
- ax = data.word(kCh0emmpage);
- data.word(kCh0oldemmpage) = ax;
- ax = data.word(kCh0offset);
- data.word(kCh0oldoffset) = ax;
- ax = data.word(kCh0blockstocopy);
- data.word(kCh0oldblockstocopy) = ax;
-nosetloop:
- si = pop();
- di = pop();
- cx = pop();
- bx = pop();
- ds = pop();
- es = pop();
-}
-
-void DreamGenContext::playchannel1() {
- STACK_CHECK;
- _cmp(data.byte(kSoundint), 255);
- if (flags.z())
- return /* (dontbother5) */;
- _cmp(data.byte(kCh1playing), 7);
- if (flags.z())
- return /* (dontbother5) */;
- push(es);
- push(ds);
- push(bx);
- push(cx);
- push(di);
- push(si);
- data.byte(kCh1playing) = al;
- es = data.word(kSounddata);
- _cmp(al, 12);
- if (flags.c())
- goto notsecondbank1;
- es = data.word(kSounddata2);
- _sub(al, 12);
-notsecondbank1:
- ah = 0;
- _add(ax, ax);
- bx = ax;
- _add(ax, ax);
- _add(bx, ax);
- al = es.byte(bx);
- ah = 0;
- data.word(kCh1emmpage) = ax;
- ax = es.word(bx+1);
- data.word(kCh1offset) = ax;
- ax = es.word(bx+3);
- data.word(kCh1blockstocopy) = ax;
- si = pop();
- di = pop();
- cx = pop();
- bx = pop();
- ds = pop();
- es = pop();
-}
-
-void DreamGenContext::volumeadjust() {
- STACK_CHECK;
- al = data.byte(kVolumedirection);
- _cmp(al, 0);
- if (flags.z())
- return /* (volok) */;
- al = data.byte(kVolume);
- _cmp(al, data.byte(kVolumeto));
- if (flags.z())
- goto volfinish;
- _add(data.byte(kVolumecount), 64);
- if (!flags.z())
- return /* (volok) */;
- al = data.byte(kVolume);
- _add(al, data.byte(kVolumedirection));
- data.byte(kVolume) = al;
- return;
-volfinish:
- data.byte(kVolumedirection) = 0;
-}
-
-void DreamGenContext::entrytexts() {
+void DreamGenContext::entryTexts() {
STACK_CHECK;
_cmp(data.byte(kLocation), 21);
if (!flags.z())
@@ -13488,7 +5061,7 @@ void DreamGenContext::entrytexts() {
dx = 11;
bl = 68;
bh = 64;
- setuptimeduse();
+ setupTimedUse();
return;
notloc15:
_cmp(data.byte(kLocation), 30);
@@ -13499,7 +5072,7 @@ notloc15:
dx = 11;
bl = 68;
bh = 64;
- setuptimeduse();
+ setupTimedUse();
return;
notloc43:
_cmp(data.byte(kLocation), 23);
@@ -13510,7 +5083,7 @@ notloc43:
dx = 11;
bl = 68;
bh = 64;
- setuptimeduse();
+ setupTimedUse();
return;
notloc23:
_cmp(data.byte(kLocation), 31);
@@ -13521,7 +5094,7 @@ notloc23:
dx = 11;
bl = 68;
bh = 64;
- setuptimeduse();
+ setupTimedUse();
return;
notloc44:
_cmp(data.byte(kLocation), 20);
@@ -13532,7 +5105,7 @@ notloc44:
dx = 11;
bl = 68;
bh = 64;
- setuptimeduse();
+ setupTimedUse();
return;
notsarters2:
_cmp(data.byte(kLocation), 24);
@@ -13543,7 +5116,7 @@ notsarters2:
dx = 3;
bl = 68;
bh = 64;
- setuptimeduse();
+ setupTimedUse();
return;
notedenlob:
_cmp(data.byte(kLocation), 34);
@@ -13554,17 +5127,17 @@ notedenlob:
dx = 3;
bl = 68;
bh = 64;
- setuptimeduse();
+ setupTimedUse();
}
-void DreamGenContext::entryanims() {
+void DreamGenContext::entryAnims() {
STACK_CHECK;
data.word(kReeltowatch) = -1;
data.byte(kWatchmode) = -1;
_cmp(data.byte(kLocation), 33);
if (!flags.z())
goto notinthebeach;
- switchryanoff();
+ switchRyanOff();
data.word(kWatchingtime) = 76*2;
data.word(kReeltowatch) = 0;
data.word(kEndwatchreel) = 76;
@@ -13576,13 +5149,13 @@ notinthebeach:
if (!flags.z())
goto notsparkys;
al = 8;
- resetlocation();
+ resetLocation();
data.word(kWatchingtime) = 50*2;
data.word(kReeltowatch) = 247;
data.word(kEndwatchreel) = 297;
data.byte(kWatchspeed) = 1;
data.byte(kSpeedcount) = 1;
- switchryanoff();
+ switchRyanOff();
return;
notsparkys:
_cmp(data.byte(kLocation), 22);
@@ -13593,7 +5166,7 @@ notsparkys:
data.word(kEndwatchreel) = 30;
data.byte(kWatchspeed) = 1;
data.byte(kSpeedcount) = 1;
- switchryanoff();
+ switchRyanOff();
return;
notinthelift:
_cmp(data.byte(kLocation), 26);
@@ -13612,7 +5185,7 @@ notunderchurch:
data.word(kEndwatchreel) = 198;
data.byte(kWatchspeed) = 1;
data.byte(kSpeedcount) = 1;
- switchryanoff();
+ switchRyanOff();
return;
notenterdream:
_cmp(data.byte(kReallocation), 46);
@@ -13622,39 +5195,39 @@ notenterdream:
if (!flags.z())
goto notcrystal;
al = 0;
- removefreeobject();
+ removeFreeObject();
return;
notcrystal:
_cmp(data.byte(kLocation), 9);
if (!flags.z())
goto nottopchurch;
al = 2;
- checkifpathison();
+ checkIfPathIsOn();
if (flags.z())
goto nottopchurch;
_cmp(data.byte(kAidedead), 0);
if (flags.z())
goto nottopchurch;
al = 3;
- checkifpathison();
+ checkIfPathIsOn();
if (!flags.z())
goto makedoorsopen;
al = 2;
- turnpathon();
+ turnPathOn();
makedoorsopen:
al = 4;
- removesetobject();
+ removeSetObject();
al = 5;
- placesetobject();
+ placeSetObject();
return;
nottopchurch:
_cmp(data.byte(kLocation), 47);
if (!flags.z())
goto notdreamcentre;
al = 4;
- placesetobject();
+ placeSetObject();
al = 5;
- placesetobject();
+ placeSetObject();
return;
notdreamcentre:
_cmp(data.byte(kLocation), 38);
@@ -13665,7 +5238,7 @@ notdreamcentre:
data.word(kEndwatchreel) = 57;
data.byte(kWatchspeed) = 1;
data.byte(kSpeedcount) = 1;
- switchryanoff();
+ switchRyanOff();
return;
notcarpark:
_cmp(data.byte(kLocation), 32);
@@ -13676,7 +5249,7 @@ notcarpark:
data.word(kEndwatchreel) = 66;
data.byte(kWatchspeed) = 1;
data.byte(kSpeedcount) = 1;
- switchryanoff();
+ switchRyanOff();
return;
notalley:
_cmp(data.byte(kLocation), 24);
@@ -13685,111 +5258,13 @@ notalley:
al = 2;
ah = data.byte(kRoomnum);
_dec(ah);
- turnanypathon();
+ turnAnyPathOn();
}
-void DreamGenContext::initialinv() {
- STACK_CHECK;
- _cmp(data.byte(kReallocation), 24);
- if (flags.z())
- goto isedens;
- return;
-isedens:
- al = 11;
- ah = 5;
- pickupob();
- al = 12;
- ah = 6;
- pickupob();
- al = 13;
- ah = 7;
- pickupob();
- al = 14;
- ah = 8;
- pickupob();
- al = 18;
- al = 18;
- ah = 0;
- pickupob();
- al = 19;
- ah = 1;
- pickupob();
- al = 20;
- ah = 9;
- pickupob();
- al = 16;
- ah = 2;
- pickupob();
- data.byte(kWatchmode) = 1;
- data.word(kReeltohold) = 0;
- data.word(kEndofholdreel) = 6;
- data.byte(kWatchspeed) = 1;
- data.byte(kSpeedcount) = 1;
- switchryanoff();
-}
-
-void DreamGenContext::pickupob() {
- STACK_CHECK;
- data.byte(kLastinvpos) = ah;
- data.byte(kObjecttype) = 2;
- data.byte(kItemframe) = al;
- data.byte(kCommand) = al;
- getanyad();
- transfertoex();
-}
-
-void DreamGenContext::checkforemm() {
- STACK_CHECK;
-}
-
-void DreamGenContext::checkbasemem() {
- STACK_CHECK;
- bx = data.word(kHowmuchalloc);
- _cmp(bx, 0x9360);
- if (!flags.c())
- return /* (enoughmem) */;
- data.byte(kGameerror) = 5;
- { quickquit(); return; };
-}
-
-void DreamGenContext::allocatebuffers() {
- STACK_CHECK;
- bx = (0+2080+30000+(16*114)+((114+2)*2)+18000)/16;
- allocatemem();
- data.word(kExtras) = ax;
- trysoundalloc();
- bx = (0+(66*60))/16;
- allocatemem();
- data.word(kMapdata) = ax;
- trysoundalloc();
- 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)+(5*80)+(250*4)+(256*30)+(6*64)+991-534+68-0)/16;
- allocatemem();
- data.word(kBuffers) = ax;
- trysoundalloc();
- bx = (16*80)/16;
- allocatemem();
- data.word(kFreedat) = ax;
- trysoundalloc();
- bx = (64*128)/16;
- allocatemem();
- data.word(kSetdat) = ax;
- trysoundalloc();
- bx = (22*8*20*8)/16;
- allocatemem();
- data.word(kMapstore) = ax;
- allocatework();
- bx = 2048/16;
- allocatemem();
- data.word(kSounddata) = ax;
- bx = 2048/16;
- allocatemem();
- data.word(kSounddata2) = ax;
-}
-
-void DreamGenContext::clearbuffers() {
+void DreamGenContext::clearBuffers() {
STACK_CHECK;
es = data.word(kBuffers);
- cx = (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)+(5*80)+(250*4)+(256*30)+(6*64)+991-534+68-0)/2;
+ cx = (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)+(5*80)+(250*4)+(256*30)+(6*64)+916-459+68-0)/2;
ax = 0;
di = 0;
_stosw(cx, true);
@@ -13801,19 +5276,19 @@ void DreamGenContext::clearbuffers() {
es = data.word(kBuffers);
di = (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)+(5*80)+(250*4)+(256*30)+(6*64));
ds = cs;
- si = 534;
- cx = (991-534);
+ si = 459;
+ cx = (916-459);
_movsb(cx, true);
es = data.word(kBuffers);
- di = (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)+(5*80)+(250*4)+(256*30)+(6*64)+991-534);
+ di = (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)+(5*80)+(250*4)+(256*30)+(6*64)+916-459);
ds = cs;
si = 0;
cx = (68-0);
_movsb(cx, true);
- clearchanges();
+ clearChanges();
}
-void DreamGenContext::clearchanges() {
+void DreamGenContext::clearChanges() {
STACK_CHECK;
es = data.word(kBuffers);
cx = (250)*2;
@@ -13823,11 +5298,11 @@ void DreamGenContext::clearchanges() {
ds = data.word(kBuffers);
si = (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)+(5*80)+(250*4)+(256*30)+(6*64));
es = cs;
- di = 534;
- cx = (991-534);
+ di = 459;
+ cx = (916-459);
_movsb(cx, true);
ds = data.word(kBuffers);
- si = (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)+(5*80)+(250*4)+(256*30)+(6*64)+991-534);
+ si = (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)+(5*80)+(250*4)+(256*30)+(6*64)+916-459);
es = cs;
di = 0;
cx = (68-0);
@@ -13841,7 +5316,7 @@ void DreamGenContext::clearchanges() {
di = 0;
_stosw(cx, true);
es = cs;
- di = 8011;
+ di = 1249;
al = 1;
_stosb(2);
al = 0;
@@ -13853,506 +5328,7 @@ void DreamGenContext::clearchanges() {
_stosw(cx, true);
}
-void DreamGenContext::clearbeforeload() {
- STACK_CHECK;
- _cmp(data.byte(kRoomloaded), 1);
- if (!flags.z())
- return /* (noclear) */;
- clearreels();
- clearrest();
- data.byte(kRoomloaded) = 0;
-}
-
-void DreamGenContext::clearreels() {
- STACK_CHECK;
- es = data.word(kReel1);
- deallocatemem();
- es = data.word(kReel2);
- deallocatemem();
- es = data.word(kReel3);
- deallocatemem();
-}
-
-void DreamGenContext::clearrest() {
- STACK_CHECK;
- es = data.word(kMapdata);
- cx = (66*60)/2;
- ax = 0;
- di = (0);
- _stosw(cx, true);
- es = data.word(kBackdrop);
- deallocatemem();
- es = data.word(kSetframes);
- deallocatemem();
- es = data.word(kReels);
- deallocatemem();
- es = data.word(kPeople);
- deallocatemem();
- es = data.word(kSetdesc);
- deallocatemem();
- es = data.word(kBlockdesc);
- deallocatemem();
- es = data.word(kRoomdesc);
- deallocatemem();
- es = data.word(kFreeframes);
- deallocatemem();
- es = data.word(kFreedesc);
- deallocatemem();
-}
-
-void DreamGenContext::startup() {
- STACK_CHECK;
- data.byte(kCurrentkey) = 0;
- data.byte(kMainmode) = 0;
- createpanel();
- data.byte(kNewobs) = 1;
- drawfloor();
- showicon();
- getunderzoom();
- spriteupdate();
- printsprites();
- undertextline();
- reelsonscreen();
- atmospheres();
-}
-
-void DreamGenContext::startup1() {
- STACK_CHECK;
- clearpalette();
- data.byte(kThroughdoor) = 0;
- data.byte(kCurrentkey) = '0';
- data.byte(kMainmode) = 0;
- createpanel();
- data.byte(kNewobs) = 1;
- drawfloor();
- showicon();
- getunderzoom();
- spriteupdate();
- printsprites();
- undertextline();
- reelsonscreen();
- atmospheres();
- worktoscreen();
- fadescreenup();
-}
-
-void DreamGenContext::screenupdate() {
- STACK_CHECK;
- newplace();
- mainscreen();
- animpointer();
- showpointer();
- _cmp(data.word(kWatchingtime), 0);
- if (!flags.z())
- goto iswatchingmode;
- _cmp(data.byte(kNewlocation), 255);
- if (!flags.z())
- return /* (finishearly) */;
-iswatchingmode:
- vsync();
- readmouse1();
- dumppointer();
- dumptextline();
- delpointer();
- autolook();
- spriteupdate();
- watchcount();
- zoom();
- showpointer();
- _cmp(data.byte(kWongame), 0);
- if (!flags.z())
- return /* (finishearly) */;
- vsync();
- readmouse2();
- dumppointer();
- dumpzoom();
- delpointer();
- deleverything();
- printsprites();
- reelsonscreen();
- afternewroom();
- showpointer();
- vsync();
- readmouse3();
- dumppointer();
- dumpmap();
- dumptimedtext();
- delpointer();
- showpointer();
- vsync();
- readmouse4();
- dumppointer();
- dumpwatch();
- delpointer();
-}
-
-void DreamGenContext::watchreel() {
- STACK_CHECK;
- _cmp(data.word(kReeltowatch), -1);
- if (flags.z())
- goto notplayingreel;
- al = data.byte(kManspath);
- _cmp(al, data.byte(kFinaldest));
- if (!flags.z())
- return /* (waitstopwalk) */;
- al = data.byte(kTurntoface);
- _cmp(al, data.byte(kFacing));
- if (flags.z())
- goto notwatchpath;
- return;
-notwatchpath:
- _dec(data.byte(kSpeedcount));
- _cmp(data.byte(kSpeedcount), -1);
- if (!flags.z())
- goto showwatchreel;
- al = data.byte(kWatchspeed);
- data.byte(kSpeedcount) = al;
- ax = data.word(kReeltowatch);
- _cmp(ax, data.word(kEndwatchreel));
- if (!flags.z())
- goto ismorereel;
- _cmp(data.word(kWatchingtime), 0);
- if (!flags.z())
- goto showwatchreel;
- data.word(kReeltowatch) = -1;
- data.byte(kWatchmode) = -1;
- _cmp(data.word(kReeltohold), -1);
- if (flags.z())
- return /* (nomorereel) */;
- data.byte(kWatchmode) = 1;
- goto notplayingreel;
-ismorereel:
- _inc(data.word(kReeltowatch));
-showwatchreel:
- ax = data.word(kReeltowatch);
- data.word(kReelpointer) = ax;
- plotreel();
- ax = data.word(kReelpointer);
- data.word(kReeltowatch) = ax;
- checkforshake();
- return;
-notplayingreel:
- _cmp(data.byte(kWatchmode), 1);
- if (!flags.z())
- goto notholdingreel;
- ax = data.word(kReeltohold);
- data.word(kReelpointer) = ax;
- plotreel();
- return;
-notholdingreel:
- _cmp(data.byte(kWatchmode), 2);
- if (!flags.z())
- return /* (notreleasehold) */;
- _dec(data.byte(kSpeedcount));
- _cmp(data.byte(kSpeedcount), -1);
- if (!flags.z())
- goto notlastspeed2;
- al = data.byte(kWatchspeed);
- data.byte(kSpeedcount) = al;
- _inc(data.word(kReeltohold));
-notlastspeed2:
- ax = data.word(kReeltohold);
- _cmp(ax, data.word(kEndofholdreel));
- if (!flags.z())
- goto ismorereel2;
- data.word(kReeltohold) = -1;
- data.byte(kWatchmode) = -1;
- al = data.byte(kDestafterhold);
- data.byte(kDestination) = al;
- data.byte(kFinaldest) = al;
- autosetwalk();
- return;
-ismorereel2:
- ax = data.word(kReeltohold);
- data.word(kReelpointer) = ax;
- plotreel();
-}
-
-void DreamGenContext::checkforshake() {
- STACK_CHECK;
- _cmp(data.byte(kReallocation), 26);
- if (!flags.z())
- return /* (notstartshake) */;
- _cmp(ax, 104);
- if (!flags.z())
- return /* (notstartshake) */;
- data.byte(kShakecounter) = -1;
-}
-
-void DreamGenContext::watchcount() {
- STACK_CHECK;
- _cmp(data.byte(kWatchon), 0);
- if (flags.z())
- return /* (nowatchworn) */;
- _inc(data.byte(kTimercount));
- _cmp(data.byte(kTimercount), 9);
- if (flags.z())
- goto flashdots;
- _cmp(data.byte(kTimercount), 18);
- if (flags.z())
- goto uptime;
- return;
-flashdots:
- ax = 91*3+21;
- di = 268+4;
- bx = 21;
- ds = data.word(kCharset1);
- showframe();
- goto finishwatch;
-uptime:
- data.byte(kTimercount) = 0;
- _add(data.byte(kSecondcount), 1);
- _cmp(data.byte(kSecondcount), 60);
- if (!flags.z())
- goto finishtime;
- data.byte(kSecondcount) = 0;
- _inc(data.byte(kMinutecount));
- _cmp(data.byte(kMinutecount), 60);
- if (!flags.z())
- goto finishtime;
- data.byte(kMinutecount) = 0;
- _inc(data.byte(kHourcount));
- _cmp(data.byte(kHourcount), 24);
- if (!flags.z())
- goto finishtime;
- data.byte(kHourcount) = 0;
-finishtime:
- showtime();
-finishwatch:
- data.byte(kWatchdump) = 1;
-}
-
-void DreamGenContext::showtime() {
- STACK_CHECK;
- _cmp(data.byte(kWatchon), 0);
- if (flags.z())
- return /* (nowatch) */;
- al = data.byte(kSecondcount);
- cl = 0;
- twodigitnum();
- push(ax);
- al = ah;
- ah = 0;
- _add(ax, 91*3+10);
- ds = data.word(kCharset1);
- di = 282+5;
- bx = 21;
- showframe();
- ax = pop();
- ah = 0;
- _add(ax, 91*3+10);
- ds = data.word(kCharset1);
- di = 282+9;
- bx = 21;
- showframe();
- al = data.byte(kMinutecount);
- cl = 0;
- twodigitnum();
- push(ax);
- al = ah;
- ah = 0;
- _add(ax, 91*3);
- ds = data.word(kCharset1);
- di = 270+5;
- bx = 21;
- showframe();
- ax = pop();
- ah = 0;
- _add(ax, 91*3);
- ds = data.word(kCharset1);
- di = 270+11;
- bx = 21;
- showframe();
- al = data.byte(kHourcount);
- cl = 0;
- twodigitnum();
- push(ax);
- al = ah;
- ah = 0;
- _add(ax, 91*3);
- ds = data.word(kCharset1);
- di = 256+5;
- bx = 21;
- showframe();
- ax = pop();
- ah = 0;
- _add(ax, 91*3);
- ds = data.word(kCharset1);
- di = 256+11;
- bx = 21;
- showframe();
- ax = 91*3+20;
- ds = data.word(kCharset1);
- di = 267+5;
- bx = 21;
- showframe();
-}
-
-void DreamGenContext::dumpwatch() {
- STACK_CHECK;
- _cmp(data.byte(kWatchdump), 1);
- if (!flags.z())
- return /* (nodumpwatch) */;
- di = 256;
- bx = 21;
- cl = 40;
- ch = 12;
- multidump();
- data.byte(kWatchdump) = 0;
-}
-
-void DreamGenContext::showbyte() {
- STACK_CHECK;
- dl = al;
- _shr(dl, 1);
- _shr(dl, 1);
- _shr(dl, 1);
- _shr(dl, 1);
- onedigit();
- es.byte(di) = dl;
- dl = al;
- _and(dl, 15);
- onedigit();
- es.byte(di+1) = dl;
- _add(di, 3);
-}
-
-void DreamGenContext::onedigit() {
- STACK_CHECK;
- _cmp(dl, 10);
- if (!flags.c())
- goto morethan10;
- _add(dl, '0');
- return;
-morethan10:
- _sub(dl, 10);
- _add(dl, 'A');
-}
-
-void DreamGenContext::twodigitnum() {
- STACK_CHECK;
- ah = cl;
- _dec(ah);
-numloop1:
- _inc(ah);
- _sub(al, 10);
- if (!flags.c())
- goto numloop1;
- _add(al, 10);
- _add(al, cl);
-}
-
-void DreamGenContext::showword() {
- STACK_CHECK;
- ch = 0;
- bx = 10000;
- cl = 47;
-word1:
- _inc(cl);
- _sub(ax, bx);
- if (!flags.c())
- goto word1;
- _add(ax, bx);
- convnum();
- cs.byte(di) = cl;
- bx = 1000;
- cl = 47;
-word2:
- _inc(cl);
- _sub(ax, bx);
- if (!flags.c())
- goto word2;
- _add(ax, bx);
- convnum();
- cs.byte(di+1) = cl;
- bx = 100;
- cl = 47;
-word3:
- _inc(cl);
- _sub(ax, bx);
- if (!flags.c())
- goto word3;
- _add(ax, bx);
- convnum();
- cs.byte(di+2) = cl;
- bx = 10;
- cl = 47;
-word4:
- _inc(cl);
- _sub(ax, bx);
- if (!flags.c())
- goto word4;
- _add(ax, bx);
- convnum();
- cs.byte(di+3) = cl;
- _add(al, 48);
- cl = al;
- convnum();
- cs.byte(di+4) = cl;
-}
-
-void DreamGenContext::convnum() {
- STACK_CHECK;
- _cmp(ch, 0);
- if (!flags.z())
- return /* (noconvnum) */;
- _cmp(cl, '0');
- if (!flags.z())
- goto notzeronum;
- cl = 32;
- return /* (noconvnum) */;
-notzeronum:
- ch = 1;
-}
-
-void DreamGenContext::mainscreen() {
- STACK_CHECK;
- data.byte(kInmaparea) = 0;
- bx = offset_mainlist;
- _cmp(data.byte(kWatchon), 1);
- if (flags.z())
- goto checkmain;
- bx = offset_mainlist2;
-checkmain:
- checkcoords();
- _cmp(data.byte(kWalkandexam), 0);
- if (flags.z())
- return /* (finishmain) */;
- walkandexamine();
-}
-
-void DreamGenContext::madmanrun() {
- STACK_CHECK;
- _cmp(data.byte(kLocation), 14);
- if (!flags.z())
- { identifyob(); return; };
- _cmp(data.byte(kMapx), 22);
- if (!flags.z())
- { identifyob(); return; };
- _cmp(data.byte(kPointermode), 2);
- if (!flags.z())
- { identifyob(); return; };
- _cmp(data.byte(kMadmanflag), 0);
- if (!flags.z())
- { identifyob(); return; };
- _cmp(data.byte(kCommandtype), 211);
- if (flags.z())
- goto alreadyrun;
- data.byte(kCommandtype) = 211;
- al = 52;
- commandonly();
-alreadyrun:
- _cmp(data.word(kMousebutton), 1);
- if (!flags.z())
- return /* (norun) */;
- ax = data.word(kMousebutton);
- _cmp(ax, data.word(kOldbutton));
- if (flags.z())
- return /* (norun) */;
- data.byte(kLastweapon) = 8;
-}
-
-void DreamGenContext::identifyob() {
+void DreamGenContext::identifyOb() {
STACK_CHECK;
_cmp(data.word(kWatchingtime), 0);
if (!flags.z())
@@ -14376,23 +5352,23 @@ notover2:
data.byte(kInmaparea) = 1;
ah = bl;
push(ax);
- findpathofpoint();
+ findPathOfPoint();
data.byte(kPointerspath) = dl;
ax = pop();
push(ax);
- findfirstpath();
+ findFirstPath();
data.byte(kPointerfirstpath) = al;
ax = pop();
- checkifex();
+ checkIfEx();
if (!flags.z())
return /* (finishidentify) */;
- checkiffree();
+ checkIfFree();
if (!flags.z())
return /* (finishidentify) */;
- checkifperson();
+ checkIfPerson();
if (!flags.z())
return /* (finishidentify) */;
- checkifset();
+ checkIfSet();
if (!flags.z())
return /* (finishidentify) */;
ax = data.word(kMousex);
@@ -14401,7 +5377,7 @@ notover2:
ax = data.word(kMousey);
_sub(ax, data.word(kMapady));
ch = al;
- checkone();
+ checkOne();
_cmp(al, 0);
if (flags.z())
goto nothingund;
@@ -14409,13 +5385,13 @@ notover2:
if (flags.z())
goto nothingund;
ah = 3;
- obname();
+ obName();
return;
nothingund:
blank();
}
-void DreamGenContext::findpathofpoint() {
+void DreamGenContext::findPathOfPoint() {
STACK_CHECK;
push(ax);
bx = (0);
@@ -14459,7 +5435,7 @@ flunkedit:
dl = 255;
}
-void DreamGenContext::findfirstpath() {
+void DreamGenContext::findFirstPath() {
STACK_CHECK;
push(ax);
bx = (0);
@@ -14502,155 +5478,6 @@ gotfirst:
al = es.byte(bx+6);
}
-void DreamGenContext::afternewroom() {
- STACK_CHECK;
- _cmp(data.byte(kNowinnewroom), 0);
- if (flags.z())
- return /* (notnew) */;
- data.word(kTimecount) = 0;
- createpanel();
- data.byte(kCommandtype) = 0;
- findroominloc();
- _cmp(data.byte(kRyanon), 1);
- if (flags.z())
- goto ryansoff;
- al = data.byte(kRyanx);
- _add(al, 12);
- ah = data.byte(kRyany);
- _add(ah, 12);
- findpathofpoint();
- data.byte(kManspath) = dl;
- findxyfrompath();
- data.byte(kResetmanxy) = 1;
-ryansoff:
- data.byte(kNewobs) = 1;
- drawfloor();
- data.word(kLookcounter) = 160;
- data.byte(kNowinnewroom) = 0;
- showicon();
- spriteupdate();
- printsprites();
- undertextline();
- reelsonscreen();
- mainscreen();
- getunderzoom();
- zoom();
- worktoscreenm();
- walkintoroom();
- reminders();
- atmospheres();
-}
-
-void DreamGenContext::atmospheres() {
- STACK_CHECK;
- cl = data.byte(kMapx);
- ch = data.byte(kMapy);
- bx = offset_atmospherelist;
-nextatmos:
- al = cs.byte(bx);
- _cmp(al, 255);
- if (flags.z())
- goto nomoreatmos;
- _cmp(al, data.byte(kReallocation));
- if (!flags.z())
- goto wrongatmos;
- ax = cs.word(bx+1);
- _cmp(ax, cx);
- if (!flags.z())
- goto wrongatmos;
- ax = cs.word(bx+3);
- _cmp(al, data.byte(kCh0playing));
- if (flags.z())
- goto playingalready;
- _cmp(data.byte(kLocation), 45);
- if (!flags.z())
- goto notweb;
- _cmp(data.word(kReeltowatch), 45);
- if (flags.z())
- goto wrongatmos;
-notweb:
- playchannel0();
- _cmp(data.byte(kReallocation), 2);
- _cmp(data.byte(kMapy), 0);
- if (flags.z())
- goto fullvol;
- if (!flags.z())
- goto notlouisvol;
- _cmp(data.byte(kMapy), 10);
- if (!flags.z())
- goto notlouisvol;
- _cmp(data.byte(kMapx), 22);
- if (!flags.z())
- goto notlouisvol;
- data.byte(kVolume) = 5;
-notlouisvol:
- _cmp(data.byte(kReallocation), 14);
- if (!flags.z())
- goto notmad1;
- _cmp(data.byte(kMapx), 33);
- if (flags.z())
- goto ismad2;
- _cmp(data.byte(kMapx), 22);
- if (!flags.z())
- goto notmad1;
- data.byte(kVolume) = 5;
- return;
-ismad2:
- data.byte(kVolume) = 0;
- return;
-notmad1:
-playingalready:
- _cmp(data.byte(kReallocation), 2);
- if (!flags.z())
- return /* (notlouisvol2) */;
- _cmp(data.byte(kMapx), 22);
- if (flags.z())
- goto louisvol;
- _cmp(data.byte(kMapx), 11);
- if (!flags.z())
- return /* (notlouisvol2) */;
-fullvol:
- data.byte(kVolume) = 0;
- return;
-louisvol:
- data.byte(kVolume) = 5;
- return;
-wrongatmos:
- _add(bx, 5);
- goto nextatmos;
-nomoreatmos:
- cancelch0();
-}
-
-void DreamGenContext::walkintoroom() {
- STACK_CHECK;
- _cmp(data.byte(kLocation), 14);
- if (!flags.z())
- return /* (notlair) */;
- _cmp(data.byte(kMapx), 22);
- if (!flags.z())
- return /* (notlair) */;
- data.byte(kDestination) = 1;
- data.byte(kFinaldest) = 1;
- autosetwalk();
-}
-
-void DreamGenContext::afterintroroom() {
- STACK_CHECK;
- _cmp(data.byte(kNowinnewroom), 0);
- if (flags.z())
- return /* (notnewintro) */;
- clearwork();
- findroominloc();
- data.byte(kNewobs) = 1;
- drawfloor();
- reelsonscreen();
- spriteupdate();
- printsprites();
- worktoscreen();
- data.byte(kNowinnewroom) = 0;
-}
-
void DreamGenContext::printmessage2() {
STACK_CHECK;
push(dx);
@@ -14667,7 +5494,7 @@ void DreamGenContext::printmessage2() {
ax = pop();
searchmess:
push(ax);
- findnextcolon();
+ findNextColon();
ax = pop();
_dec(ah);
if (!flags.z())
@@ -14677,923 +5504,9 @@ searchmess:
dx = pop();
al = 0;
ah = 0;
- printdirect();
-}
-
-void DreamGenContext::setwalk() {
- STACK_CHECK;
- _cmp(data.byte(kLinepointer), 254);
- if (!flags.z())
- goto alreadywalking;
- al = data.byte(kPointerspath);
- _cmp(al, data.byte(kManspath));
- if (flags.z())
- goto cantwalk2;
- _cmp(data.byte(kWatchmode), 1);
- if (flags.z())
- goto holdingreel;
- _cmp(data.byte(kWatchmode), 2);
- if (flags.z())
- return /* (cantwalk) */;
- data.byte(kDestination) = al;
- data.byte(kFinaldest) = al;
- _cmp(data.word(kMousebutton), 2);
- if (!flags.z())
- goto notwalkandexam;
- _cmp(data.byte(kCommandtype), 3);
- if (flags.z())
- goto notwalkandexam;
- data.byte(kWalkandexam) = 1;
- al = data.byte(kCommandtype);
- data.byte(kWalkexamtype) = al;
- al = data.byte(kCommand);
- data.byte(kWalkexamnum) = al;
-notwalkandexam:
- autosetwalk();
- return;
-cantwalk2:
- facerightway();
- return;
-alreadywalking:
- al = data.byte(kPointerspath);
- data.byte(kFinaldest) = al;
- return;
-holdingreel:
- data.byte(kDestafterhold) = al;
- data.byte(kWatchmode) = 2;
-}
-
-void DreamGenContext::workoutframes() {
- STACK_CHECK;
- bx = data.word(kLinestartx);
- _add(bx, 32);
- ax = data.word(kLineendx);
- _add(ax, 32);
- _sub(bx, ax);
- if (!flags.c())
- goto notneg1;
- _neg(bx);
-notneg1:
- cx = data.word(kLinestarty);
- _add(cx, 32);
- ax = data.word(kLineendy);
- _add(ax, 32);
- _sub(cx, ax);
- if (!flags.c())
- goto notneg2;
- _neg(cx);
-notneg2:
- _cmp(bx, cx);
- if (!flags.c())
- goto tendstohoriz;
- dl = 2;
- ax = cx;
- _shr(ax, 1);
- _cmp(bx, ax);
- if (flags.c())
- goto gotquad;
- dl = 1;
- goto gotquad;
-tendstohoriz:
- dl = 0;
- ax = bx;
- _shr(ax, 1);
- _cmp(cx, ax);
- if (flags.c())
- goto gotquad;
- dl = 1;
- goto gotquad;
-gotquad:
- bx = data.word(kLinestartx);
- _add(bx, 32);
- ax = data.word(kLineendx);
- _add(ax, 32);
- _sub(bx, ax);
- if (flags.c())
- goto isinright;
- cx = data.word(kLinestarty);
- _add(cx, 32);
- ax = data.word(kLineendy);
- _add(ax, 32);
- _sub(cx, ax);
- if (!flags.c())
- goto topleft;
- _cmp(dl, 1);
- if (flags.z())
- goto noswap1;
- _xor(dl, 2);
-noswap1:
- _add(dl, 4);
- goto success;
-topleft:
- _add(dl, 6);
- goto success;
-isinright:
- cx = data.word(kLinestarty);
- _add(cx, 32);
- ax = data.word(kLineendy);
- _add(ax, 32);
- _sub(cx, ax);
- if (!flags.c())
- goto botright;
- _add(dl, 2);
- goto success;
-botright:
- _cmp(dl, 1);
- if (flags.z())
- goto noswap2;
- _xor(dl, 2);
-noswap2:
-success:
- _and(dl, 7);
- data.byte(kTurntoface) = dl;
- data.byte(kTurndirection) = 0;
-}
-
-void DreamGenContext::showicon() {
- STACK_CHECK;
- _cmp(data.byte(kReallocation), 50);
- if (!flags.c())
- goto isdream1;
- showpanel();
- showman();
- roomname();
- panelicons1();
- zoomicon();
- return;
-isdream1:
- ds = data.word(kTempsprites);
- di = 72;
- bx = 2;
- al = 45;
- ah = 0;
- showframe();
- ds = data.word(kTempsprites);
- di = 72+47;
- bx = 2;
- al = 46;
- ah = 0;
- showframe();
- ds = data.word(kTempsprites);
- di = 69-10;
- bx = 21;
- al = 49;
- ah = 0;
- showframe();
- ds = data.word(kTempsprites);
- di = 160+88;
- bx = 2;
- al = 45;
- ah = 4;
- showframe();
- ds = data.word(kTempsprites);
- di = 160+43;
- bx = 2;
- al = 46;
- ah = 4;
- showframe();
- ds = data.word(kTempsprites);
- di = 160+101;
- bx = 21;
- al = 49;
- ah = 4;
- showframe();
- middlepanel();
-}
-
-void DreamGenContext::middlepanel() {
- STACK_CHECK;
- ds = data.word(kTempsprites);
- di = 72+47+20;
- bx = 0;
- al = 48;
- ah = 0;
- showframe();
- ds = data.word(kTempsprites);
- di = 72+19;
- bx = 21;
- al = 47;
- ah = 0;
- showframe();
- ds = data.word(kTempsprites);
- di = 160+23;
- bx = 0;
- al = 48;
- ah = 4;
- showframe();
- ds = data.word(kTempsprites);
- di = 160+71;
- bx = 21;
- al = 47;
- ah = 4;
- showframe();
-}
-
-void DreamGenContext::showman() {
- STACK_CHECK;
- ds = data.word(kIcons1);
- di = 0;
- bx = 0;
- al = 0;
- ah = 0;
- showframe();
- ds = data.word(kIcons1);
- di = 0;
- bx = 114;
- al = 1;
- ah = 0;
- showframe();
- _cmp(data.byte(kShadeson), 0);
- if (flags.z())
- return /* (notverycool) */;
- ds = data.word(kIcons1);
- di = 28;
- bx = 25;
- al = 2;
- ah = 0;
- showframe();
-}
-
-void DreamGenContext::roomname() {
- STACK_CHECK;
- di = 88;
- bx = 18;
- al = 53;
- dl = 240;
- printmessage();
- bl = data.byte(kRoomnum);
- _cmp(bl, 32);
- if (flags.c())
- goto notover32;
- _sub(bl, 32);
-notover32:
- bh = 0;
- _add(bx, bx);
- es = data.word(kRoomdesc);
- _add(bx, (0));
- ax = es.word(bx);
- _add(ax, (0+(38*2)));
- si = ax;
- data.word(kLinespacing) = 7;
- di = 88;
- bx = 25;
- dl = 120;
- _cmp(data.byte(kWatchon), 1);
- if (flags.z())
- goto gotpl;
- dl = 160;
-gotpl:
- al = 0;
- ah = 0;
- printdirect();
- data.word(kLinespacing) = 10;
- usecharset1();
-}
-
-void DreamGenContext::usecharset1() {
- STACK_CHECK;
- ax = data.word(kCharset1);
- data.word(kCurrentset) = ax;
-}
-
-void DreamGenContext::usetempcharset() {
- STACK_CHECK;
- ax = data.word(kTempcharset);
- data.word(kCurrentset) = ax;
-}
-
-void DreamGenContext::showexit() {
- STACK_CHECK;
- ds = data.word(kIcons1);
- di = 274;
- bx = 154;
- al = 11;
- ah = 0;
- showframe();
-}
-
-void DreamGenContext::panelicons1() {
- STACK_CHECK;
- di = 0;
- _cmp(data.byte(kWatchon), 1);
- if (flags.z())
- goto watchison;
- di = 48;
-watchison:
- push(di);
- ds = data.word(kIcons2);
- _add(di, 204);
- bx = 4;
- al = 2;
- ah = 0;
- showframe();
- di = pop();
- push(di);
- _cmp(data.byte(kZoomon), 1);
- if (flags.z())
- goto zoomisoff;
- ds = data.word(kIcons1);
- _add(di, 228);
- bx = 8;
- al = 5;
- ah = 0;
- showframe();
-zoomisoff:
- di = pop();
- showwatch();
-}
-
-void DreamGenContext::showwatch() {
- STACK_CHECK;
- _cmp(data.byte(kWatchon), 0);
- if (flags.z())
- return /* (nowristwatch) */;
- ds = data.word(kIcons1);
- di = 250;
- bx = 1;
- al = 6;
- ah = 0;
- showframe();
- showtime();
-}
-
-void DreamGenContext::zoomicon() {
- STACK_CHECK;
- _cmp(data.byte(kZoomon), 0);
- if (flags.z())
- return /* (nozoom1) */;
- ds = data.word(kIcons1);
- di = (8);
- bx = (132)-1;
- al = 8;
- ah = 0;
- showframe();
-}
-
-void DreamGenContext::worktoscreenm() {
- STACK_CHECK;
- animpointer();
- readmouse();
- showpointer();
- vsync();
- worktoscreen();
- delpointer();
-}
-
-void DreamGenContext::blank() {
- STACK_CHECK;
- _cmp(data.byte(kCommandtype), 199);
- if (flags.z())
- return /* (alreadyblnk) */;
- data.byte(kCommandtype) = 199;
- al = 0;
- commandonly();
+ printDirect();
}
-void DreamGenContext::allpointer() {
- STACK_CHECK;
- readmouse();
- showpointer();
- dumppointer();
-}
-
-void DreamGenContext::hangonw() {
- STACK_CHECK;
-hangloopw:
- push(cx);
- delpointer();
- readmouse();
- animpointer();
- showpointer();
- vsync();
- dumppointer();
- cx = pop();
- if (--cx)
- goto hangloopw;
-}
-
-void DreamGenContext::hangoncurs() {
- STACK_CHECK;
-monloop1:
- push(cx);
- printcurs();
- vsync();
- delcurs();
- cx = pop();
- if (--cx)
- goto monloop1;
-}
-
-void DreamGenContext::getunderzoom() {
- STACK_CHECK;
- di = (8)+5;
- bx = (132)+4;
- ds = data.word(kBuffers);
- si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5));
- cl = 46;
- ch = 40;
- multiget();
-}
-
-void DreamGenContext::dumpzoom() {
- STACK_CHECK;
- _cmp(data.byte(kZoomon), 1);
- if (!flags.z())
- return /* (notzoomon) */;
- di = (8)+5;
- bx = (132)+4;
- cl = 46;
- ch = 40;
- multidump();
-}
-
-void DreamGenContext::putunderzoom() {
- STACK_CHECK;
- di = (8)+5;
- bx = (132)+4;
- ds = data.word(kBuffers);
- si = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5));
- cl = 46;
- ch = 40;
- multiput();
-}
-
-void DreamGenContext::undertextline() {
- STACK_CHECK;
- di = data.word(kTextaddressx);
- bx = data.word(kTextaddressy);
- _cmp(data.byte(kForeignrelease), 0);
- if (flags.z())
- goto _tmp1;
- _sub(bx, 3);
-_tmp1:
- ds = data.word(kBuffers);
- si = (0);
- cl = (228);
- ch = (13);
- multiget();
-}
-
-void DreamGenContext::readkey() {
- STACK_CHECK;
- bx = data.word(kBufferout);
- _cmp(bx, data.word(kBufferin));
- if (flags.z())
- goto nokey;
- _inc(bx);
- _and(bx, 15);
- data.word(kBufferout) = bx;
- di = offset_keybuffer;
- _add(di, bx);
- al = cs.byte(di);
- data.byte(kCurrentkey) = al;
- return;
-nokey:
- data.byte(kCurrentkey) = 0;
-}
-
-void DreamGenContext::randomnum1() {
- STACK_CHECK;
- push(ds);
- push(es);
- push(di);
- push(bx);
- push(cx);
- randomnumber();
- cx = pop();
- bx = pop();
- di = pop();
- es = pop();
- ds = pop();
-}
-
-void DreamGenContext::randomnum2() {
- STACK_CHECK;
- push(ds);
- push(es);
- push(di);
- push(bx);
- push(ax);
- randomnumber();
- cl = al;
- ax = pop();
- bx = pop();
- di = pop();
- es = pop();
- ds = pop();
-}
-
-void DreamGenContext::loadtraveltext() {
- STACK_CHECK;
- dx = 2234;
- standardload();
- data.word(kTraveltext) = ax;
-}
-
-void DreamGenContext::loadintotemp() {
- STACK_CHECK;
- ds = cs;
- standardload();
- data.word(kTempgraphics) = ax;
-}
-
-void DreamGenContext::loadintotemp2() {
- STACK_CHECK;
- ds = cs;
- standardload();
- data.word(kTempgraphics2) = ax;
-}
-
-void DreamGenContext::loadintotemp3() {
- STACK_CHECK;
- ds = cs;
- standardload();
- data.word(kTempgraphics3) = ax;
-}
-
-void DreamGenContext::loadtempcharset() {
- STACK_CHECK;
- standardload();
- data.word(kTempcharset) = ax;
-}
-
-void DreamGenContext::standardload() {
- STACK_CHECK;
- openfile();
- readheader();
- bx = es.word(di);
- push(bx);
- cl = 4;
- _shr(bx, cl);
- allocatemem();
- ds = ax;
- cx = pop();
- push(ax);
- dx = 0;
- readfromfile();
- closefile();
- ax = pop();
-}
-
-void DreamGenContext::loadtemptext() {
- STACK_CHECK;
- standardload();
- data.word(kTextfile1) = ax;
-}
-
-void DreamGenContext::loadroom() {
- STACK_CHECK;
- data.byte(kRoomloaded) = 1;
- data.word(kTimecount) = 0;
- data.word(kMaintimer) = 0;
- data.word(kMapoffsetx) = 104;
- data.word(kMapoffsety) = 38;
- data.word(kTextaddressx) = 13;
- data.word(kTextaddressy) = 182;
- data.byte(kTextlen) = 240;
- al = data.byte(kNewlocation);
- data.byte(kLocation) = al;
- getroomdata();
- startloading();
- loadroomssample();
- switchryanon();
- drawflags();
- getdimension();
-}
-
-void DreamGenContext::loadroomssample() {
- STACK_CHECK;
- al = data.byte(kRoomssample);
- _cmp(al, 255);
- if (flags.z())
- return /* (loadedalready) */;
- _cmp(al, data.byte(kCurrentsample));
- if (flags.z())
- return /* (loadedalready) */;
- data.byte(kCurrentsample) = al;
- al = data.byte(kCurrentsample);
- cl = '0';
- twodigitnum();
- di = 1896;
- _xchg(al, ah);
- cs.word(di+10) = ax;
- dx = di;
- loadsecondsample();
-}
-
-void DreamGenContext::getridofreels() {
- STACK_CHECK;
- _cmp(data.byte(kRoomloaded), 0);
- if (flags.z())
- return /* (dontgetrid) */;
- es = data.word(kReel1);
- deallocatemem();
- es = data.word(kReel2);
- deallocatemem();
- es = data.word(kReel3);
- deallocatemem();
-}
-
-void DreamGenContext::getridofall() {
- STACK_CHECK;
- es = data.word(kBackdrop);
- deallocatemem();
- es = data.word(kSetframes);
- deallocatemem();
- es = data.word(kReel1);
- deallocatemem();
- es = data.word(kReel2);
- deallocatemem();
- es = data.word(kReel3);
- deallocatemem();
- es = data.word(kReels);
- deallocatemem();
- es = data.word(kPeople);
- deallocatemem();
- es = data.word(kSetdesc);
- deallocatemem();
- es = data.word(kBlockdesc);
- deallocatemem();
- es = data.word(kRoomdesc);
- deallocatemem();
- es = data.word(kFreeframes);
- deallocatemem();
- es = data.word(kFreedesc);
- deallocatemem();
-}
-
-void DreamGenContext::restorereels() {
- STACK_CHECK;
- _cmp(data.byte(kRoomloaded), 0);
- if (flags.z())
- return /* (dontrestore) */;
- al = data.byte(kReallocation);
- getroomdata();
- dx = bx;
- openfile();
- readheader();
- dontloadseg();
- dontloadseg();
- dontloadseg();
- dontloadseg();
- allocateload();
- data.word(kReel1) = ax;
- ds = ax;
- dx = 0;
- loadseg();
- allocateload();
- data.word(kReel2) = ax;
- ds = ax;
- dx = 0;
- loadseg();
- allocateload();
- data.word(kReel3) = ax;
- ds = ax;
- dx = 0;
- loadseg();
- closefile();
-}
-
-void DreamGenContext::restoreall() {
- STACK_CHECK;
- al = data.byte(kLocation);
- getroomdata();
- dx = bx;
- openfile();
- readheader();
- allocateload();
- ds = ax;
- data.word(kBackdrop) = ax;
- dx = (0);
- loadseg();
- ds = data.word(kWorkspace);
- dx = (0);
- cx = 132*66;
- al = 0;
- fillspace();
- loadseg();
- sortoutmap();
- allocateload();
- data.word(kSetframes) = ax;
- ds = ax;
- dx = (0);
- loadseg();
- dontloadseg();
- allocateload();
- data.word(kReel1) = ax;
- ds = ax;
- dx = 0;
- loadseg();
- allocateload();
- data.word(kReel2) = ax;
- ds = ax;
- dx = 0;
- loadseg();
- allocateload();
- data.word(kReel3) = ax;
- ds = ax;
- dx = 0;
- loadseg();
- allocateload();
- data.word(kReels) = ax;
- ds = ax;
- dx = 0;
- loadseg();
- allocateload();
- data.word(kPeople) = ax;
- ds = ax;
- dx = 0;
- loadseg();
- allocateload();
- data.word(kSetdesc) = ax;
- ds = ax;
- dx = 0;
- loadseg();
- allocateload();
- data.word(kBlockdesc) = ax;
- ds = ax;
- dx = 0;
- loadseg();
- allocateload();
- data.word(kRoomdesc) = ax;
- ds = ax;
- dx = 0;
- loadseg();
- allocateload();
- data.word(kFreeframes) = ax;
- ds = ax;
- dx = 0;
- loadseg();
- dontloadseg();
- allocateload();
- data.word(kFreedesc) = ax;
- ds = ax;
- dx = (0);
- loadseg();
- closefile();
- setallchanges();
-}
-
-void DreamGenContext::sortoutmap() {
- STACK_CHECK;
- push(es);
- push(di);
- ds = data.word(kWorkspace);
- si = 0;
- es = data.word(kMapdata);
- di = 0;
- cx = (60);
-blimey:
- push(cx);
- push(si);
- cx = (66);
- _movsb(cx, true);
- si = pop();
- cx = pop();
- _add(si, 132);
- if (--cx)
- goto blimey;
- di = pop();
- es = pop();
-}
-
-void DreamGenContext::disablepath() {
- STACK_CHECK;
- push(cx);
- _xchg(al, ah);
- cx = -6;
-looky2:
- _add(cx, 6);
- _sub(al, 10);
- if (!flags.c())
- goto looky2;
- al = ah;
- _dec(cx);
-lookx2:
- _inc(cx);
- _sub(al, 11);
- if (!flags.c())
- goto lookx2;
- al = cl;
- 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::findroominloc() {
- STACK_CHECK;
- al = data.byte(kMapy);
- cx = -6;
-looky:
- _add(cx, 6);
- _sub(al, 10);
- if (!flags.c())
- goto looky;
- al = data.byte(kMapx);
- _dec(cx);
-lookx:
- _inc(cx);
- _sub(al, 11);
- if (!flags.c())
- goto lookx;
- data.byte(kRoomnum) = cl;
-}
-
-void DreamGenContext::allocateload() {
- STACK_CHECK;
- push(es);
- push(di);
- bx = es.word(di);
- cl = 4;
- _shr(bx, cl);
- allocatemem();
- di = pop();
- es = pop();
-}
-
-void DreamGenContext::getridoftemp() {
- STACK_CHECK;
- es = data.word(kTempgraphics);
- deallocatemem();
-}
-
-void DreamGenContext::getridoftemptext() {
- STACK_CHECK;
- es = data.word(kTextfile1);
- deallocatemem();
-}
-
-void DreamGenContext::getridoftemp2() {
- STACK_CHECK;
- es = data.word(kTempgraphics2);
- deallocatemem();
-}
-
-void DreamGenContext::getridoftemp3() {
- STACK_CHECK;
- es = data.word(kTempgraphics3);
- deallocatemem();
-}
-
-void DreamGenContext::getridoftempcharset() {
- STACK_CHECK;
- es = data.word(kTempcharset);
- deallocatemem();
-}
-
-void DreamGenContext::getridoftempsp() {
- STACK_CHECK;
- es = data.word(kTempsprites);
- deallocatemem();
-}
-
-void DreamGenContext::readsetdata() {
- STACK_CHECK;
- dx = 1857;
- standardload();
- data.word(kCharset1) = ax;
- dx = 1922;
- standardload();
- data.word(kIcons1) = ax;
- dx = 1935;
- standardload();
- data.word(kIcons2) = ax;
- dx = 1819;
- standardload();
- data.word(kMainsprites) = ax;
- dx = 2221;
- standardload();
- data.word(kPuzzletext) = ax;
- dx = 2273;
- standardload();
- data.word(kCommandtext) = ax;
- ax = data.word(kCharset1);
- data.word(kCurrentset) = ax;
- _cmp(data.byte(kSoundint), 255);
- if (flags.z())
- return /* (novolumeload) */;
- dx = 2286;
- openfile();
- cx = 2048-256;
- ds = data.word(kSoundbuffer);
- dx = 16384;
- readfromfile();
- closefile();
-}
-
-
-
void DreamGenContext::__start() {
static const uint8 src[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x13, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -15618,14 +5531,14 @@ void DreamGenContext::__start() {
//0x0090: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x00a0: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x00b0: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x00c0: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x00d0: .... .... .... ....
- 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x00e0: .. .... .... ....
+ 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ //0x00e0: .. .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x00f0: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -15640,1690 +5553,141 @@ void DreamGenContext::__start() {
//0x0140: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x0150: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x0160: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x01, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
//0x0170: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0180: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0190: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x01a0: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x01b0: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x01c0: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x01d0: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x01e0: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x01f0: .... .... .... ....
- 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x0200: .... .... .... ....
- 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x01, 0x2c, 0x00, 0x14, 0x00, 0x02, 0x00, 0x01, 0x01, 0x37,
- //0x0210: .... ..., .... ...7
- 0x00, 0x00, 0x00, 0x32, 0x14, 0x00, 0x18, 0x16, 0x00, 0x4a, 0x00, 0x01, 0x00, 0x00, 0x18, 0x21,
- //0x0220: ...2 .... .J.. ...!
- 0x0a, 0x4b, 0x00, 0x01, 0x00, 0x01, 0x01, 0x2c, 0x00, 0x1b, 0x00, 0x02, 0x00, 0x02, 0x01, 0x2c,
- //0x0230: .K.. ..., .... ...,
- 0x00, 0x60, 0x00, 0x03, 0x00, 0x04, 0x01, 0x2c, 0x00, 0x76, 0x00, 0x02, 0x00, 0x05, 0x01, 0x2c,
- //0x0240: .`.. ..., .v.. ...,
- 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x05, 0x16, 0x14, 0x35, 0x00, 0x03, 0x00, 0x00, 0x05, 0x16,
- //0x0250: .... .... .5.. ....
- 0x14, 0x28, 0x00, 0x01, 0x00, 0x02, 0x05, 0x16, 0x14, 0x32, 0x00, 0x01, 0x00, 0x03, 0x02, 0x0b,
- //0x0260: .(.. .... .2.. ....
- 0x0a, 0xc0, 0x00, 0x01, 0x00, 0x00, 0x02, 0x0b, 0x0a, 0xb6, 0x00, 0x02, 0x00, 0x01, 0x08, 0x0b,
- //0x0270: .... .... .... ....
- 0x0a, 0x00, 0x00, 0x02, 0x00, 0x01, 0x17, 0x00, 0x32, 0x00, 0x00, 0x03, 0x00, 0x00, 0x1c, 0x0b,
- //0x0280: .... .... 2... ....
- 0x14, 0xfa, 0x00, 0x04, 0x00, 0x00, 0x17, 0x00, 0x32, 0x2b, 0x00, 0x02, 0x00, 0x08, 0x17, 0x0b,
- //0x0290: .... .... 2+.. ....
- 0x28, 0x82, 0x00, 0x02, 0x00, 0x01, 0x17, 0x16, 0x28, 0x7a, 0x00, 0x02, 0x00, 0x02, 0x17, 0x16,
- //0x02a0: (... .... (z.. ....
- 0x28, 0x69, 0x00, 0x02, 0x00, 0x03, 0x17, 0x16, 0x28, 0x51, 0x00, 0x02, 0x00, 0x04, 0x17, 0x0b,
- //0x02b0: (i.. .... (Q.. ....
- 0x28, 0x87, 0x00, 0x02, 0x00, 0x05, 0x17, 0x16, 0x28, 0x91, 0x00, 0x02, 0x00, 0x06, 0x04, 0x16,
- //0x02c0: (... .... (... ....
- 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x2d, 0x16, 0x1e, 0xc8, 0x00, 0x00, 0x00, 0x14, 0x2d, 0x16,
- //0x02d0: .... ..-. .... ..-.
- 0x1e, 0x27, 0x00, 0x02, 0x00, 0x00, 0x2d, 0x16, 0x1e, 0x19, 0x00, 0x02, 0x00, 0x00, 0x08, 0x16,
- //0x02e0: .'.. ..-. .... ....
- 0x28, 0x20, 0x00, 0x02, 0x00, 0x00, 0x07, 0x0b, 0x14, 0x40, 0x00, 0x02, 0x00, 0x00, 0x16, 0x16,
- //0x02f0: ( .. .... .@.. ....
- 0x14, 0x52, 0x00, 0x02, 0x00, 0x00, 0x1b, 0x0b, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x14, 0x00,
- //0x0300: .R.. .... .... ....
- 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x21, 0x28, 0x15, 0x00, 0x01, 0x00, 0x00, 0x1d, 0x0b,
- //0x0310: .... ...! (... ....
- 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x16, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x19, 0x00,
- //0x0320: .... .... .... ....
- 0x32, 0x04, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x1e, 0x79, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16,
- //0x0330: 2... ..2. .y.. ..2.
- 0x1e, 0x00, 0x00, 0x14, 0x00, 0x00, 0x34, 0x16, 0x1e, 0xc0, 0x00, 0x02, 0x00, 0x00, 0x34, 0x16,
- //0x0340: .... ..4. .... ..4.
- 0x1e, 0xe9, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x28, 0x68, 0x00, 0x37, 0x00, 0x00, 0x35, 0x21,
- //0x0350: .... ..2. (h.7 ..5!
- 0x00, 0x63, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x28, 0x00, 0x00, 0x03, 0x00, 0x00, 0x32, 0x16,
- //0x0360: .c.. ..2. (... ..2.
- 0x1e, 0xa2, 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, 0x1e, 0x39, 0x00, 0x02, 0x00, 0x00, 0x34, 0x16,
- //0x0370: .... ..4. .9.. ..4.
- 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x36, 0x00, 0x00, 0x48, 0x00, 0x03, 0x00, 0x00, 0x37, 0x2c,
- //0x0380: .... ..6. .H.. ..7,
- 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x0e, 0x16,
- //0x0390: .... .... .... ....
- 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x16, 0x00, 0x2c, 0x01, 0x01, 0x00, 0x00, 0x0a, 0x16,
- //0x03a0: .... .... .,.. ....
- 0x1e, 0xae, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x16, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0b, 0x0b,
- //0x03b0: .... .... .... ....
- 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0b, 0x0b, 0x1e, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0b, 0x16,
- //0x03c0: ...2 .... ...2 ....
- 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0e, 0x21, 0x28, 0x00, 0x00, 0x32, 0x14, 0x00, 0xff, 0x7c,
- //0x03d0: ...2 ...! (..2 ...|
- 0xc0, 0x80, 0xc0, 0x1c, 0xc0, 0x20, 0xc0, 0x00, 0xc1, 0x10, 0xc0, 0x18, 0xc0, 0xf4, 0xc0, 0x0c,
- //0x03e0: .... . .. .... ....
- 0xc0, 0x24, 0xc0, 0x28, 0xc0, 0x2c, 0xc0, 0x30, 0xc0, 0x54, 0xc0, 0x78, 0xc0, 0x50, 0xc0, 0x74,
- //0x03f0: .$.( .,.0 .T.x .P.t
- 0xc0, 0x34, 0xc0, 0x38, 0xc0, 0x40, 0xc0, 0x44, 0xc0, 0x48, 0xc0, 0x3c, 0xc0, 0x14, 0xc0, 0x88,
- //0x0400: .4.8 .@.D .H.< ....
- 0xc0, 0x8c, 0xc0, 0x90, 0xc0, 0x70, 0xc0, 0xfc, 0xc0, 0x6c, 0xc0, 0x58, 0xc0, 0x68, 0xc0, 0x04,
- //0x0410: .... .p.. .l.X .h..
- 0xc1, 0x64, 0xc0, 0x60, 0xc0, 0x5c, 0xc0, 0x94, 0xc0, 0x04, 0xc0, 0xa4, 0xc0, 0x9c, 0xc0, 0xa0,
- //0x0420: .d.` .... .... ....
- 0xc0, 0xa8, 0xc0, 0xac, 0xc0, 0x98, 0xc0, 0xb0, 0xc0, 0xb4, 0xc0, 0xc8, 0xc0, 0xcc, 0xc0, 0xd4,
- //0x0430: .... .... .... ....
- 0xc0, 0xdc, 0xc0, 0xd8, 0xc0, 0x00, 0xc0, 0x08, 0xc0, 0x84, 0xc0, 0x84, 0xc0, 0x84, 0xc0, 0x84,
- //0x0440: .... .... .... ....
- 0xc0, 0x00, 0x3c, 0x21, 0x47, 0x0b, 0x52, 0x16, 0x5d, 0x01, 0x2c, 0x0a, 0x10, 0x04, 0x0b, 0x1e,
- //0x0450: ..<! G.R. ].,. ....
- 0x0e, 0x04, 0x16, 0x1e, 0x0e, 0x03, 0x21, 0x0a, 0x0e, 0x0a, 0x21, 0x1e, 0x0e, 0x0a, 0x16, 0x1e,
- //0x0460: .... ..!. ..!. ....
- 0x18, 0x09, 0x16, 0x0a, 0x0e, 0x02, 0x21, 0x00, 0x0e, 0x02, 0x16, 0x00, 0x0e, 0x06, 0x0b, 0x1e,
- //0x0470: .... ..!. .... ....
- 0x0e, 0x07, 0x0b, 0x14, 0x12, 0x07, 0x00, 0x14, 0x12, 0x07, 0x00, 0x1e, 0x12, 0x37, 0x2c, 0x00,
- //0x0480: .... .... .... .7,.
- 0x0e, 0x05, 0x16, 0x1e, 0x0e, 0x08, 0x00, 0x0a, 0x12, 0x08, 0x0b, 0x0a, 0x12, 0x08, 0x16, 0x0a,
- //0x0490: .... .... .... ....
- 0x12, 0x08, 0x21, 0x0a, 0x12, 0x08, 0x21, 0x14, 0x12, 0x08, 0x21, 0x1e, 0x12, 0x08, 0x21, 0x28,
- //0x04a0: ..!. ..!. ..!. ..!(
- 0x12, 0x08, 0x16, 0x28, 0x12, 0x08, 0x0b, 0x28, 0x12, 0x15, 0x2c, 0x14, 0x12, 0xff, 0x2e, 0x05,
- //0x04b0: ...( ...( ..,. ....
- 0x2f, 0x05, 0x33, 0x05, 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05, 0x46, 0x05, 0x2e, 0x05, 0x4d, 0x05,
- //0x04c0: /.3. .... ..F. ..M.
- 0x5d, 0x05, 0x64, 0x05, 0x68, 0x05, 0x6c, 0x05, 0x70, 0x05, 0x7d, 0x05, 0x2e, 0x05, 0x2e, 0x05,
- //0x04d0: ].d. h.l. p.}. ....
- 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05, 0x9f, 0x05, 0x2e, 0x05, 0xb5, 0x05, 0xd4, 0x05, 0x2e, 0x05,
- //0x04e0: .... .... .... ....
- 0xe1, 0x05, 0xf7, 0x05, 0x0d, 0x06, 0x26, 0x06, 0x39, 0x06, 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05,
- //0x04f0: .... ..&. 9... ....
- 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05,
- //0x0500: .... .... .... ....
- 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05, 0x49, 0x06, 0x50, 0x06, 0x75, 0x06, 0x2e, 0x05,
- //0x0510: .... .... I.P. u...
- 0x2e, 0x05, 0x2e, 0x05, 0x2e, 0x05, 0x82, 0x06, 0x86, 0x06, 0x2e, 0x05, 0x8d, 0x06, 0xff, 0x0f,
- //0x0520: .... .... .... ....
- 0x01, 0x01, 0xff, 0x0c, 0x05, 0x00, 0x0d, 0x15, 0x00, 0x0f, 0x23, 0x00, 0x11, 0x32, 0x00, 0x12,
- //0x0530: .... .... ..#. .2..
- 0x67, 0x00, 0x13, 0x6c, 0x00, 0xff, 0x12, 0x13, 0x00, 0x13, 0x17, 0x00, 0xff, 0x0c, 0x33, 0x00,
- //0x0540: g..l .... .... ..3.
- 0x0d, 0x35, 0x00, 0x0e, 0x0e, 0x00, 0x0f, 0x14, 0x00, 0x00, 0x4e, 0x00, 0xff, 0x0c, 0x77, 0x00,
- //0x0550: .5.. .... ..N. ..w.
- 0x0c, 0x91, 0x00, 0xff, 0x0d, 0x10, 0x00, 0xff, 0x0d, 0x14, 0x00, 0xff, 0x0e, 0x10, 0x00, 0xff,
- //0x0560: .... .... .... ....
- 0x0f, 0x04, 0x00, 0x10, 0x08, 0x00, 0x11, 0x86, 0x00, 0x12, 0x99, 0x00, 0xff, 0x0d, 0x6c, 0x00,
- //0x0570: .... .... .... ..l.
- 0x0f, 0x46, 0x01, 0x0f, 0x4b, 0x01, 0x0f, 0x50, 0x01, 0x0f, 0x56, 0x01, 0x0f, 0x5c, 0x01, 0x0f,
- //0x0580: .F.. K..P ..V. ....
- 0x62, 0x01, 0x12, 0x9f, 0x00, 0x12, 0xb2, 0x00, 0x93, 0xd9, 0x00, 0x54, 0xe4, 0x00, 0xff, 0x0d,
- //0x0590: b... .... ...T ....
- 0x14, 0x00, 0x0d, 0x15, 0x00, 0x0f, 0x22, 0x00, 0x0d, 0x34, 0x00, 0x0d, 0x37, 0x00, 0x19, 0x39,
- //0x05a0: .... ..". .4.. 7..9
- 0x00, 0x15, 0x49, 0x00, 0xff, 0x0d, 0xc4, 0x00, 0x0d, 0xea, 0x00, 0x0d, 0x9c, 0x00, 0x0e, 0x81,
- //0x05b0: ..I. .... .... ....
- 0x00, 0x0d, 0x7c, 0x00, 0x0f, 0xa2, 0x00, 0x0f, 0xc8, 0x00, 0x0f, 0xef, 0x00, 0x11, 0x63, 0x00,
- //0x05c0: ..|. .... .... ..c.
- 0x0c, 0x34, 0x00, 0xff, 0x0f, 0x38, 0x00, 0x10, 0x40, 0x00, 0x13, 0x16, 0x00, 0x14, 0x21, 0x00,
- //0x05d0: .4.. .8.. @... ..!.
- 0xff, 0x14, 0x0b, 0x00, 0x14, 0x0f, 0x00, 0x0f, 0x1c, 0x00, 0x0d, 0x50, 0x00, 0x15, 0x52, 0x00,
- //0x05e0: .... .... ...P ..R.
- 0x93, 0x57, 0x00, 0x57, 0x80, 0x00, 0xff, 0x0c, 0x0d, 0x00, 0x0e, 0x27, 0x00, 0x0c, 0x43, 0x00,
- //0x05f0: .W.W .... ...' ..C.
- 0x0c, 0x4b, 0x00, 0x0c, 0x53, 0x00, 0x0c, 0x5b, 0x00, 0x0f, 0x66, 0x00, 0xff, 0x16, 0x24, 0x00,
- //0x0600: .K.. S..[ ..f. ..$.
- 0x0d, 0x7d, 0x00, 0x12, 0x58, 0x00, 0x0f, 0x6b, 0x00, 0x0e, 0x7f, 0x00, 0x0e, 0x9a, 0x00, 0x93,
- //0x0610: .}.. X..k .... ....
- 0xaa, 0x00, 0x57, 0xe8, 0x00, 0xff, 0x15, 0x10, 0x00, 0x15, 0x48, 0x00, 0x15, 0xcd, 0x00, 0x16,
- //0x0620: ..W. .... ..H. ....
- 0x3f, 0x00, 0x97, 0x63, 0x00, 0x58, 0x9e, 0x00, 0xff, 0x0d, 0x15, 0x00, 0x0e, 0x18, 0x00, 0x93,
- //0x0630: ?..c .X.. .... ....
- 0x32, 0x00, 0x57, 0x4b, 0x00, 0x18, 0x80, 0x00, 0xff, 0x53, 0x2e, 0x00, 0x10, 0xa7, 0x00, 0xff,
- //0x0640: 2.WK .... .S.. ....
- 0x10, 0x13, 0x00, 0x0e, 0x24, 0x00, 0x10, 0x32, 0x00, 0x0e, 0x41, 0x00, 0x10, 0x51, 0x00, 0x0e,
- //0x0650: .... $..2 ..A. .Q..
- 0x60, 0x00, 0x10, 0x72, 0x00, 0x0e, 0x81, 0x00, 0x10, 0x93, 0x00, 0x0e, 0xa2, 0x00, 0x10, 0xb1,
- //0x0660: `..r .... .... ....
- 0x00, 0x0e, 0xbf, 0x00, 0xff, 0x0d, 0x30, 0x00, 0x0e, 0x29, 0x00, 0x0f, 0x4e, 0x00, 0x10, 0x5c,
- //0x0670: .... ..0. .).. N...
- 0x00, 0xff, 0x10, 0x73, 0x00, 0xff, 0x15, 0x67, 0x00, 0x14, 0xc7, 0x00, 0xff, 0x11, 0x35, 0x00,
- //0x0680: ...s ...g .... ..5.
- 0x11, 0x36, 0x00, 0x11, 0x37, 0x00, 0x11, 0x38, 0x00, 0x11, 0x39, 0x00, 0x11, 0x3a, 0x00, 0x11,
- //0x0690: .6.. 7..8 ..9. .:..
- 0x3b, 0x00, 0x11, 0x3d, 0x00, 0x11, 0x3f, 0x00, 0x11, 0x40, 0x00, 0x11, 0x41, 0x00, 0xff, 0x9c,
- //0x06a0: ;..= ..?. .@.. A...
- 0x9a, 0x9f, 0x9a, 0x9c, 0x9e, 0xa0, 0x9b, 0x9d, 0x99, 0x9f, 0x9e, 0x9c, 0x9a, 0x9f, 0x9a, 0x9c,
- //0x06b0: .... .... .... ....
- 0x9e, 0xa0, 0x9b, 0x9d, 0x99, 0x9f, 0x9e, 0x9c, 0x9a, 0x9f, 0x9a, 0x9c, 0x9e, 0xa0, 0x9b, 0x9d,
- //0x06c0: .... .... .... ....
- 0x99, 0x9f, 0x9e, 0x9c, 0x9a, 0x9f, 0x9a, 0x9c, 0x9e, 0xa0, 0x9b, 0x9d, 0x99, 0x9f, 0x9e, 0x9c,
- //0x06d0: .... .... .... ....
- 0x9a, 0x9f, 0x9a, 0x9c, 0x9e, 0xa0, 0x9b, 0x9d, 0x99, 0x9f, 0x9e, 0x9c, 0x9a, 0x9f, 0x9a, 0x9c,
- //0x06e0: .... .... .... ....
- 0x9e, 0xa0, 0x9b, 0x9d, 0x99, 0x9f, 0x9e, 0x9c, 0x9a, 0x9f, 0x9a, 0x9c, 0x9e, 0xa0, 0x9b, 0x9d,
- //0x06f0: .... .... .... ....
- 0x99, 0x9f, 0x9e, 0x9c, 0x9a, 0x9f, 0x9a, 0x9c, 0x9e, 0xa0, 0x9b, 0x9d, 0x99, 0x9f, 0x9e, 0x9c,
- //0x0700: .... .... .... ....
- 0x9a, 0x9f, 0x9a, 0x9c, 0x9e, 0xa0, 0x9b, 0x9d, 0x99, 0x9f, 0x9c, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x0710: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x53, 0x30, 0x30, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42,
- //0x0720: WEB. S00. DREA MWEB
- 0x2e, 0x53, 0x30, 0x32, 0x00, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x2e, 0x44, 0x41, 0x54,
- //0x0730: .S02 .INS TALL .DAT
- 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x43, 0x30, 0x30, 0x00, 0x44, 0x52,
- //0x0740: .DRE AMWE B.C0 0.DR
- 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x43, 0x30, 0x31, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x0750: EAMW EB.C 01.D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x43, 0x30, 0x32, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42,
- //0x0760: WEB. C02. DREA MWEB
- 0x2e, 0x56, 0x30, 0x30, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39,
- //0x0770: .V00 .DRE AMWE B.V9
- 0x39, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x47, 0x30, 0x30, 0x00, 0x44,
- //0x0780: 9.DR EAMW EB.G 00.D
- 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x47, 0x30, 0x31, 0x00, 0x44, 0x52, 0x45, 0x41,
- //0x0790: REAM WEB. G01. DREA
- 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x47, 0x30, 0x32, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45,
- //0x07a0: MWEB .G02 .DRE AMWE
- 0x42, 0x2e, 0x47, 0x30, 0x38, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x47,
- //0x07b0: B.G0 8.DR EAMW EB.G
- 0x30, 0x33, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x47, 0x30, 0x37, 0x00,
- //0x07c0: 03.D REAM WEB. G07.
- 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x47, 0x30, 0x34, 0x00, 0x44, 0x52, 0x45,
- //0x07d0: DREA MWEB .G04 .DRE
- 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x47, 0x30, 0x35, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57,
- //0x07e0: AMWE B.G0 5.DR EAMW
- 0x45, 0x42, 0x2e, 0x47, 0x30, 0x36, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e,
- //0x07f0: EB.G 06.D REAM WEB.
- 0x47, 0x31, 0x34, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x30, 0x31,
- //0x0800: G14. DREA MWEB .T01
- 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x30, 0x32, 0x00, 0x44, 0x52,
- //0x0810: .DRE AMWE B.T0 2.DR
- 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x31, 0x30, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x0820: EAMW EB.T 10.D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x54, 0x31, 0x31, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42,
- //0x0830: WEB. T11. DREA MWEB
- 0x2e, 0x54, 0x31, 0x32, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x31,
- //0x0840: .T12 .DRE AMWE B.T1
- 0x33, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x32, 0x30, 0x00, 0x44,
- //0x0850: 3.DR EAMW EB.T 20.D
- 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x32, 0x31, 0x00, 0x44, 0x52, 0x45, 0x41,
- //0x0860: REAM WEB. T21. DREA
- 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x32, 0x32, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45,
- //0x0870: MWEB .T22 .DRE AMWE
- 0x42, 0x2e, 0x54, 0x32, 0x33, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54,
- //0x0880: B.T2 3.DR EAMW EB.T
- 0x32, 0x34, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x35, 0x30, 0x00,
- //0x0890: 24.D REAM WEB. T50.
- 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x35, 0x31, 0x00, 0x44, 0x52, 0x45,
- //0x08a0: DREA MWEB .T51 .DRE
- 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x38, 0x30, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57,
- //0x08b0: AMWE B.T8 0.DR EAMW
- 0x45, 0x42, 0x2e, 0x54, 0x38, 0x31, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e,
- //0x08c0: EB.T 81.D REAM WEB.
- 0x54, 0x38, 0x32, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x38, 0x33,
- //0x08d0: T82. DREA MWEB .T83
- 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x54, 0x38, 0x34, 0x00, 0x44, 0x52,
- //0x08e0: .DRE AMWE B.T8 4.DR
- 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x56, 0x4f, 0x4c, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x08f0: EAMW EB.V OL.D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x47, 0x30, 0x39, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42,
- //0x0900: WEB. G09. DREA MWEB
- 0x2e, 0x47, 0x31, 0x30, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x47, 0x31,
- //0x0910: .G10 .DRE AMWE B.G1
- 0x31, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x47, 0x31, 0x32, 0x00, 0x44,
- //0x0920: 1.DR EAMW EB.G 12.D
- 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x47, 0x31, 0x33, 0x00, 0x44, 0x52, 0x45, 0x41,
- //0x0930: REAM WEB. G13. DREA
- 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x47, 0x31, 0x35, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45,
- //0x0940: MWEB .G15 .DRE AMWE
- 0x42, 0x2e, 0x49, 0x30, 0x30, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x49,
- //0x0950: B.I0 0.DR EAMW EB.I
- 0x30, 0x31, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x49, 0x30, 0x32, 0x00,
- //0x0960: 01.D REAM WEB. I02.
- 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x49, 0x30, 0x33, 0x00, 0x44, 0x52, 0x45,
- //0x0970: DREA MWEB .I03 .DRE
- 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x49, 0x30, 0x34, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57,
- //0x0980: AMWE B.I0 4.DR EAMW
- 0x45, 0x42, 0x2e, 0x49, 0x30, 0x35, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e,
- //0x0990: EB.I 05.D REAM WEB.
- 0x49, 0x30, 0x36, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x49, 0x30, 0x37,
- //0x09a0: I06. DREA MWEB .I07
- 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x50, 0x41, 0x4c, 0x00, 0x11, 0x01,
- //0x09b0: .DRE AMWE B.PA L...
- 0x40, 0x01, 0x9d, 0x00, 0xc6, 0x00, 0x44, 0xc3, 0x04, 0x01, 0x2c, 0x01, 0x00, 0x00, 0x2c, 0x00,
- //0x09c0: @... ..D. ..,. ..,.
- 0x80, 0xc5, 0xd2, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x2c, 0x00, 0xdc, 0xc3, 0x90, 0x00, 0xb0, 0x00,
- //0x09d0: .... .... ,... ....
- 0x40, 0x00, 0x60, 0x00, 0x80, 0xc3, 0x00, 0x00, 0x32, 0x00, 0x32, 0x00, 0xc8, 0x00, 0x84, 0xc3,
- //0x09e0: @.`. .... 2.2. ....
- 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, 0x11, 0x01, 0x40, 0x01,
- //0x09f0: ..@. .... .... ..@.
- 0x9d, 0x00, 0xc6, 0x00, 0x44, 0xc3, 0xff, 0x00, 0x26, 0x01, 0x00, 0x00, 0x18, 0x00, 0xc8, 0xc3,
- //0x0a00: .... D... &... ....
- 0xf7, 0x00, 0x2d, 0x01, 0x28, 0x00, 0x38, 0x00, 0x48, 0xc3, 0x50, 0x00, 0x00, 0x01, 0x9e, 0x00,
- //0x0a10: ..-. (.8. H.P. ....
- 0xca, 0x00, 0xe0, 0xc3, 0x50, 0x00, 0x2c, 0x01, 0x3a, 0x00, 0x92, 0x00, 0x98, 0xc3, 0x00, 0x00,
- //0x0a20: .... P.,. :... ....
- 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, 0x11, 0x01, 0x40, 0x01, 0x9d, 0x00,
- //0x0a30: @... .... .... @...
- 0xc6, 0x00, 0x44, 0xc3, 0xf7, 0x00, 0x2d, 0x01, 0x28, 0x00, 0x38, 0x00, 0x48, 0xc3, 0x50, 0x00,
- //0x0a40: ..D. ..-. (.8. H.P.
- 0x2c, 0x01, 0x3a, 0x00, 0x92, 0x00, 0xbc, 0xc6, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00,
- //0x0a50: ,.:. .... ..@. ....
- 0xa0, 0xca, 0xff, 0xff, 0x11, 0x01, 0x40, 0x01, 0x9d, 0x00, 0xc6, 0x00, 0x7c, 0xc4, 0xf0, 0x00,
- //0x0a60: .... ..@. .... |...
- 0x22, 0x01, 0x02, 0x00, 0x2c, 0x00, 0x94, 0xc4, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00,
- //0x0a70: "... ,... ..@. ....
- 0xa0, 0xca, 0xff, 0xff, 0x11, 0x01, 0x40, 0x01, 0x9d, 0x00, 0xc6, 0x00, 0x7c, 0xc4, 0x00, 0x00,
- //0x0a80: .... ..@. .... |...
- 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, 0xee, 0x00, 0x02, 0x01, 0x04, 0x00,
- //0x0a90: @... .... .... ....
- 0x2c, 0x00, 0xc8, 0xc4, 0x68, 0x00, 0x7c, 0x00, 0x04, 0x00, 0x2c, 0x00, 0xcc, 0xc4, 0x18, 0x01,
- //0x0aa0: ,... h.|. ..,. ....
- 0x34, 0x01, 0x04, 0x00, 0x2c, 0x00, 0xb0, 0xc4, 0x68, 0x00, 0xd8, 0x00, 0x8a, 0x00, 0xc0, 0x00,
- //0x0ab0: 4... ,... h... ....
- 0xd0, 0xc4, 0x11, 0x01, 0x40, 0x01, 0x9d, 0x00, 0xc6, 0x00, 0x7c, 0xc4, 0x00, 0x00, 0x40, 0x01,
- //0x0ac0: .... @... ..|. ..@.
- 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, 0x45, 0x58, 0x49, 0x54, 0x20, 0x20, 0x20, 0x20,
- //0x0ad0: .... .... EXIT
- 0x20, 0x20, 0x48, 0x45, 0x4c, 0x50, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x49, 0x53, 0x54,
- //0x0ae0: HE LP LIST
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x52, 0x45, 0x41, 0x44, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- //0x0af0: RE AD
- 0x4c, 0x4f, 0x47, 0x4f, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4b, 0x45, 0x59, 0x53, 0x20, 0x20,
- //0x0b00: LOGO N KE YS
- 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20,
- //0x0b10: ..PU BLIC
- 0x20, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00,
- //0x0b20: PU BLIC ...
- 0x42, 0x4c, 0x41, 0x43, 0x4b, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e,
- //0x0b30: BLAC KDRA GON RYAN
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49,
- //0x0b40: . ..HE NDRI
- 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x55, 0x49, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20,
- //0x0b50: X LO UIS
- 0x20, 0x00, 0x00, 0x00, 0x53, 0x45, 0x50, 0x54, 0x49, 0x4d, 0x55, 0x53, 0x20, 0x20, 0x20, 0x20,
- //0x0b60: ... SEPT IMUS
- 0x42, 0x45, 0x43, 0x4b, 0x45, 0x54, 0x54, 0x20, 0x20, 0x20, 0x20, 0x00, 0xff, 0xff, 0x20, 0x20,
- //0x0b70: BECK ETT . ..
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f,
- //0x0b80: . "ROO
- 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20,
- //0x0b90: T ."
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x4e, 0x45, 0x54, 0x57, 0xe8, 0xc4, 0x45, 0x4c,
- //0x0ba0: . NETW ..EL
- 0x56, 0x41, 0x8c, 0xc6, 0x45, 0x4c, 0x56, 0x42, 0x9c, 0xc6, 0x45, 0x4c, 0x56, 0x43, 0x94, 0xc6,
- //0x0bb0: VA.. ELVB ..EL VC..
- 0x45, 0x4c, 0x56, 0x45, 0x98, 0xc6, 0x45, 0x4c, 0x56, 0x46, 0xa0, 0xc6, 0x43, 0x47, 0x41, 0x54,
- //0x0bc0: ELVE ..EL VF.. CGAT
- 0x30, 0xc7, 0x52, 0x45, 0x4d, 0x4f, 0xa8, 0xc6, 0x42, 0x55, 0x54, 0x41, 0x3c, 0xc7, 0x43, 0x42,
- //0x0bd0: 0.RE MO.. BUTA <.CB
- 0x4f, 0x58, 0x44, 0xc7, 0x4c, 0x49, 0x54, 0x45, 0x5c, 0xc6, 0x50, 0x4c, 0x41, 0x54, 0x40, 0xc7,
- //0x0be0: OXD. LITE ..PL AT@.
- 0x4c, 0x49, 0x46, 0x54, 0x7c, 0xc6, 0x57, 0x49, 0x52, 0x45, 0x84, 0xc6, 0x48, 0x4e, 0x44, 0x4c,
- //0x0bf0: LIFT |.WI RE.. HNDL
- 0x88, 0xc6, 0x48, 0x41, 0x43, 0x48, 0x80, 0xc6, 0x44, 0x4f, 0x4f, 0x52, 0xb4, 0xc6, 0x43, 0x53,
- //0x0c00: ..HA CH.. DOOR ..CS
- 0x48, 0x52, 0x70, 0xc6, 0x47, 0x55, 0x4e, 0x41, 0x34, 0xc7, 0x43, 0x52, 0x41, 0x41, 0x64, 0xc6,
- //0x0c10: HRp. GUNA 4.CR AAd.
- 0x43, 0x52, 0x42, 0x42, 0x68, 0xc6, 0x43, 0x52, 0x43, 0x43, 0x6c, 0xc6, 0x53, 0x45, 0x41, 0x54,
- //0x0c20: CRBB h.CR CCl. SEAT
- 0xf8, 0xc5, 0x4d, 0x45, 0x4e, 0x55, 0x98, 0xc7, 0x43, 0x4f, 0x4f, 0x4b, 0xac, 0xc6, 0x45, 0x4c,
- //0x0c30: ..ME NU.. COOK ..EL
- 0x43, 0x41, 0x4c, 0xc6, 0x45, 0x44, 0x43, 0x41, 0x50, 0xc6, 0x44, 0x44, 0x43, 0x41, 0x54, 0xc6,
- //0x0c40: CAL. EDCA P.DD CAT.
- 0x41, 0x4c, 0x54, 0x52, 0x04, 0xc6, 0x4c, 0x4f, 0x4b, 0x41, 0x3c, 0xc6, 0x4c, 0x4f, 0x4b, 0x42,
- //0x0c50: ALTR ..LO KA<. LOKB
- 0x40, 0xc6, 0x45, 0x4e, 0x54, 0x41, 0x10, 0xc6, 0x45, 0x4e, 0x54, 0x42, 0x24, 0xc6, 0x45, 0x4e,
- //0x0c60: @.EN TA.. ENTB $.EN
- 0x54, 0x45, 0x28, 0xc6, 0x45, 0x4e, 0x54, 0x43, 0x18, 0xc6, 0x45, 0x4e, 0x54, 0x44, 0x2c, 0xc6,
- //0x0c70: TE(. ENTC ..EN TD,.
- 0x45, 0x4e, 0x54, 0x48, 0x30, 0xc6, 0x57, 0x57, 0x41, 0x54, 0xf0, 0xc5, 0x50, 0x4f, 0x4f, 0x4c,
- //0x0c80: ENTH 0.WW AT.. POOL
- 0x58, 0xc6, 0x57, 0x53, 0x48, 0x44, 0xf4, 0xc5, 0x47, 0x52, 0x41, 0x46, 0x44, 0xc6, 0x54, 0x52,
- //0x0c90: X.WS HD.. GRAF D.TR
- 0x41, 0x50, 0x48, 0xc6, 0x43, 0x44, 0x50, 0x45, 0x28, 0xc7, 0x44, 0x4c, 0x4f, 0x4b, 0x08, 0xc6,
- //0x0ca0: APH. CDPE (.DL OK..
- 0x48, 0x4f, 0x4c, 0x45, 0x00, 0xc6, 0x44, 0x52, 0x59, 0x52, 0x0c, 0xc6, 0x48, 0x4f, 0x4c, 0x59,
- //0x0cb0: HOLE ..DR YR.. HOLY
- 0xfc, 0xc5, 0x57, 0x41, 0x4c, 0x4c, 0x2c, 0xc7, 0x42, 0x4f, 0x4f, 0x4b, 0x08, 0xc8, 0x41, 0x58,
- //0x0cc0: ..WA LL,. BOOK ..AX
- 0x45, 0x44, 0xb0, 0xc6, 0x53, 0x48, 0x4c, 0x44, 0x38, 0xc7, 0x42, 0x43, 0x4e, 0x59, 0xe8, 0xc5,
- //0x0cd0: ED.. SHLD 8.BC NY..
- 0x4c, 0x49, 0x44, 0x43, 0xe4, 0xc5, 0x4c, 0x49, 0x44, 0x55, 0xe0, 0xc5, 0x4c, 0x49, 0x44, 0x4f,
- //0x0ce0: LIDC ..LI DU.. LIDO
- 0xec, 0xc5, 0x50, 0x49, 0x50, 0x45, 0xa8, 0xc5, 0x42, 0x41, 0x4c, 0x43, 0x20, 0xc6, 0x57, 0x49,
- //0x0cf0: ..PI PE.. BALC .WI
- 0x4e, 0x44, 0x1c, 0xc6, 0x50, 0x41, 0x50, 0x52, 0xb4, 0xc7, 0x55, 0x57, 0x54, 0x41, 0xa0, 0xc5,
- //0x0d00: ND.. PAPR ..UW TA..
- 0x55, 0x57, 0x54, 0x42, 0xa0, 0xc5, 0x53, 0x54, 0x41, 0x54, 0xd8, 0xc7, 0x54, 0x4c, 0x49, 0x44,
- //0x0d10: UWTB ..ST AT.. TLID
- 0x9c, 0xc5, 0x53, 0x4c, 0x41, 0x42, 0xd8, 0xc5, 0x43, 0x41, 0x52, 0x54, 0xdc, 0xc5, 0x46, 0x43,
- //0x0d20: ..SL AB.. CART ..FC
- 0x41, 0x52, 0xac, 0xc5, 0x53, 0x4c, 0x42, 0x41, 0xc0, 0xc5, 0x53, 0x4c, 0x42, 0x42, 0xc4, 0xc5,
- //0x0d30: AR.. SLBA ..SL BB..
- 0x53, 0x4c, 0x42, 0x43, 0xcc, 0xc5, 0x53, 0x4c, 0x42, 0x44, 0xc8, 0xc5, 0x53, 0x4c, 0x42, 0x45,
- //0x0d40: SLBC ..SL BD.. SLBE
- 0xd0, 0xc5, 0x53, 0x4c, 0x42, 0x46, 0xd4, 0xc5, 0x50, 0x4c, 0x49, 0x4e, 0xb0, 0xc5, 0x4c, 0x41,
- //0x0d50: ..SL BF.. PLIN ..LA
- 0x44, 0x44, 0xb8, 0xc5, 0x4c, 0x41, 0x44, 0x42, 0xbc, 0xc5, 0x47, 0x55, 0x4d, 0x41, 0xb4, 0xc5,
- //0x0d60: DD.. LADB ..GU MA..
- 0x53, 0x51, 0x45, 0x45, 0x88, 0xc5, 0x54, 0x41, 0x50, 0x50, 0x8c, 0xc5, 0x47, 0x55, 0x49, 0x54,
- //0x0d70: SQEE ..TA PP.. GUIT
- 0x90, 0xc5, 0x43, 0x4f, 0x4e, 0x54, 0x94, 0xc5, 0x42, 0x45, 0x4c, 0x4c, 0x98, 0xc5, 0x8c, 0x8c,
- //0x0d80: ..CO NT.. BELL ....
- 0x8c, 0x8c, 0x30, 0x30, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x9d, 0x00, 0xb2, 0x00, 0x51, 0x00,
- //0x0d90: ..00 00.0 0... ..Q.
- 0x5e, 0x00, 0x58, 0xc7, 0xb3, 0x00, 0xc8, 0x00, 0x51, 0x00, 0x5e, 0x00, 0x5c, 0xc7, 0xc9, 0x00,
- //0x0da0: ^.X. .... Q.^. ....
- 0xde, 0x00, 0x51, 0x00, 0x5e, 0x00, 0x60, 0xc7, 0x9d, 0x00, 0xb2, 0x00, 0x5f, 0x00, 0x70, 0x00,
- //0x0db0: ..Q. ^.`. .... _.p.
- 0x64, 0xc7, 0xb3, 0x00, 0xc8, 0x00, 0x5f, 0x00, 0x70, 0x00, 0x68, 0xc7, 0xc9, 0x00, 0xde, 0x00,
- //0x0dc0: d... .._. p.h. ....
- 0x5f, 0x00, 0x70, 0x00, 0x6c, 0xc7, 0x9d, 0x00, 0xb2, 0x00, 0x71, 0x00, 0x82, 0x00, 0x70, 0xc7,
- //0x0dd0: _.p. l... ..q. ..p.
- 0xb3, 0x00, 0xc8, 0x00, 0x71, 0x00, 0x82, 0x00, 0x74, 0xc7, 0xc9, 0x00, 0xde, 0x00, 0x71, 0x00,
- //0x0de0: .... q... t... ..q.
- 0x82, 0x00, 0x78, 0xc7, 0x9d, 0x00, 0xb2, 0x00, 0x83, 0x00, 0x91, 0x00, 0x7c, 0xc7, 0xb3, 0x00,
- //0x0df0: ..x. .... .... |...
- 0xde, 0x00, 0x83, 0x00, 0x91, 0x00, 0x80, 0xc7, 0xdc, 0x00, 0xea, 0x00, 0x98, 0x00, 0xa6, 0x00,
- //0x0e00: .... .... .... ....
- 0x50, 0xc7, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, 0xae, 0x00,
- //0x0e10: P... @... .... ....
- 0xbc, 0x00, 0x84, 0x00, 0x94, 0x00, 0x50, 0xc7, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00,
- //0x0e20: .... ..P. ..@. ....
- 0xa0, 0xca, 0xff, 0xff, 0x18, 0x01, 0x40, 0x01, 0xa0, 0x00, 0xc8, 0x00, 0x50, 0xc7, 0x8f, 0x00,
- //0x0e30: .... ..@. .... P...
- 0x2c, 0x01, 0x06, 0x00, 0xc2, 0x00, 0xb8, 0xc7, 0x00, 0x00, 0x8f, 0x00, 0x06, 0x00, 0xc2, 0x00,
- //0x0e40: ,... .... .... ....
- 0xc0, 0xc7, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, 0x68, 0x00,
- //0x0e50: .... @... .... ..h.
- 0x80, 0x00, 0x3a, 0x00, 0x48, 0x00, 0xdc, 0xc7, 0x40, 0x00, 0x74, 0x00, 0x4c, 0x00, 0x6a, 0x00,
- //0x0e60: ..:. H... @.t. L.j.
- 0xe0, 0xc7, 0x74, 0x00, 0xa8, 0x00, 0x4c, 0x00, 0x6a, 0x00, 0xe4, 0xc7, 0x40, 0x00, 0x74, 0x00,
- //0x0e70: ..t. ..L. j... @.t.
- 0x6a, 0x00, 0x88, 0x00, 0xe8, 0xc7, 0x74, 0x00, 0xa8, 0x00, 0x6a, 0x00, 0x88, 0x00, 0xec, 0xc7,
- //0x0e80: j... ..t. ..j. ....
- 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, 0xba, 0x00, 0xca, 0x00,
- //0x0e90: ..@. .... .... ....
- 0x9d, 0x00, 0xad, 0x00, 0x1c, 0xc8, 0xf3, 0x00, 0x03, 0x01, 0x83, 0x00, 0x93, 0x00, 0x18, 0xc8,
- //0x0ea0: .... .... .... ....
- 0x0c, 0x01, 0x1c, 0x01, 0xa8, 0x00, 0xb8, 0x00, 0x50, 0xc7, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00,
- //0x0eb0: .... .... P... @...
- 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, 0x77, 0x00, 0xae, 0x00, 0x52, 0x00, 0x80, 0x00, 0x34, 0xc8,
- //0x0ec0: .... ..w. ..R. ..4.
- 0x46, 0x00, 0x89, 0x00, 0x3e, 0x00, 0x6f, 0x00, 0x80, 0xc8, 0xbc, 0x00, 0xfa, 0x00, 0x44, 0x00,
- //0x0ed0: F... >.o. .... ..D.
- 0x98, 0x00, 0x4c, 0xc8, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff,
- //0x0ee0: ..L. ..@. .... ....
- 0xec, 0x00, 0xfc, 0x00, 0x70, 0x00, 0x80, 0x00, 0x48, 0xc8, 0xbc, 0x00, 0xfa, 0x00, 0x40, 0x00,
- //0x0ef0: .... p... H... ..@.
- 0x98, 0x00, 0x58, 0xc8, 0x3e, 0x00, 0x98, 0x00, 0x38, 0x00, 0x85, 0x00, 0x74, 0xc8, 0x00, 0x00,
- //0x0f00: ..X. >... 8... t...
- 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, 0x77, 0x00, 0xae, 0x00, 0x52, 0x00,
- //0x0f10: @... .... ..w. ..R.
- 0x80, 0x00, 0x44, 0xc8, 0x46, 0x00, 0x8b, 0x00, 0x3e, 0x00, 0x6f, 0x00, 0x50, 0xc8, 0xec, 0x00,
- //0x0f20: ..D. F... >.o. P...
- 0xfc, 0x00, 0x70, 0x00, 0x80, 0x00, 0x48, 0xc8, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00,
- //0x0f30: ..p. ..H. ..@. ....
- 0xa0, 0xca, 0xff, 0xff, 0xec, 0x00, 0xfc, 0x00, 0x70, 0x00, 0x80, 0x00, 0x48, 0xc8, 0xbc, 0x00,
- //0x0f40: .... .... p... H...
- 0xfa, 0x00, 0x40, 0x00, 0x98, 0x00, 0x54, 0xc8, 0x3e, 0x00, 0x98, 0x00, 0x38, 0x00, 0x85, 0x00,
- //0x0f50: ..@. ..T. >... 8...
- 0x74, 0xc8, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, 0x0d, 0x0a,
- //0x0f60: t... @... .... ....
- 0x0d, 0x0a, 0x44, 0x72, 0x65, 0x61, 0x6d, 0x77, 0x65, 0x62, 0x20, 0x68, 0x61, 0x73, 0x20, 0x61,
- //0x0f70: ..Dr eamw eb h as a
- 0x6e, 0x20, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x3a, 0x0d, 0x0a, 0x55, 0x6e, 0x61, 0x62, 0x6c, 0x65,
- //0x0f80: n Er ror: ..Un able
- 0x20, 0x74, 0x6f, 0x20, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x65, 0x20, 0x45, 0x78, 0x70,
- //0x0f90: to allo cate Exp
- 0x61, 0x6e, 0x64, 0x65, 0x64, 0x20, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x2e, 0x0d, 0x0a, 0x0d,
- //0x0fa0: ande d Me mory ....
- 0x0a, 0x24, 0x0d, 0x0a, 0x0d, 0x0a, 0x44, 0x72, 0x65, 0x61, 0x6d, 0x77, 0x65, 0x62, 0x20, 0x68,
- //0x0fb0: .$.. ..Dr eamw eb h
- 0x61, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x3a, 0x0d, 0x0a, 0x53, 0x6f,
- //0x0fc0: as a n Er ror: ..So
- 0x75, 0x6e, 0x64, 0x20, 0x42, 0x6c, 0x61, 0x73, 0x74, 0x65, 0x72, 0x20, 0x63, 0x61, 0x72, 0x64,
- //0x0fd0: und Blas ter card
- 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x20, 0x61, 0x74, 0x20, 0x61, 0x64,
- //0x0fe0: not fou nd a t ad
- 0x64, 0x72, 0x65, 0x73, 0x73, 0x20, 0x32, 0x32, 0x30, 0x20, 0x48, 0x65, 0x78, 0x2e, 0x0d, 0x0a,
- //0x0ff0: dres s 22 0 He x...
- 0x0d, 0x0a, 0x24, 0x0d, 0x0a, 0x0d, 0x0a, 0x44, 0x72, 0x65, 0x61, 0x6d, 0x77, 0x65, 0x62, 0x20,
- //0x1000: ..$. ...D ream web
- 0x68, 0x61, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x3a, 0x0d, 0x0a, 0x4f,
- //0x1010: has an E rror :..O
- 0x75, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x42, 0x61, 0x73, 0x65, 0x20, 0x4d, 0x65, 0x6d, 0x6f, 0x72,
- //0x1020: ut o f Ba se M emor
- 0x79, 0x2e, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x0d, 0x0a, 0x0d, 0x0a, 0x44, 0x72, 0x65, 0x61, 0x6d,
- //0x1030: y... ..$. ...D ream
- 0x77, 0x65, 0x62, 0x20, 0x68, 0x61, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x45, 0x72, 0x72, 0x6f, 0x72,
- //0x1040: web has an E rror
- 0x3a, 0x0d, 0x0a, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x20, 0x44, 0x65, 0x61, 0x6c, 0x6c, 0x6f,
- //0x1050: :..M emor y De allo
- 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x70, 0x72, 0x6f, 0x62, 0x6c, 0x65, 0x6d, 0x2e, 0x0d,
- //0x1060: cati on p robl em..
- 0x0a, 0x0d, 0x0a, 0x24, 0x0d, 0x0a, 0x0d, 0x0a, 0x44, 0x72, 0x65, 0x61, 0x6d, 0x77, 0x65, 0x62,
- //0x1070: ...$ .... Drea mweb
- 0x20, 0x68, 0x61, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x3a, 0x0d, 0x0a,
- //0x1080: has an Erro r:..
- 0x41, 0x74, 0x20, 0x6c, 0x65, 0x61, 0x73, 0x74, 0x20, 0x35, 0x39, 0x30, 0x4b, 0x20, 0x6f, 0x66,
- //0x1090: At l east 590 K of
- 0x20, 0x62, 0x61, 0x73, 0x65, 0x20, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x20, 0x69, 0x73, 0x20,
- //0x10a0: bas e me mory is
- 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x2e, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x0d, 0x0a,
- //0x10b0: requ ired .... .$..
- 0x0d, 0x0a, 0x44, 0x72, 0x65, 0x61, 0x6d, 0x77, 0x65, 0x62, 0x20, 0x68, 0x61, 0x73, 0x20, 0x61,
- //0x10c0: ..Dr eamw eb h as a
- 0x6e, 0x20, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x3a, 0x0d, 0x0a, 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x20,
- //0x10d0: n Er ror: ..So und
- 0x42, 0x6c, 0x61, 0x73, 0x74, 0x65, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e,
- //0x10e0: Blas ter not foun
- 0x64, 0x20, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x75, 0x70, 0x74, 0x20, 0x30, 0x0d,
- //0x10f0: d on int erup t 0.
- 0x0a, 0x0d, 0x0a, 0x24, 0x0d, 0x0a, 0x0d, 0x0a, 0x44, 0x72, 0x65, 0x61, 0x6d, 0x77, 0x65, 0x62,
- //0x1100: ...$ .... Drea mweb
- 0x20, 0x68, 0x61, 0x73, 0x20, 0x61, 0x6e, 0x20, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x3a, 0x0d, 0x0a,
- //0x1110: has an Erro r:..
- 0x55, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74,
- //0x1120: Unab le t o se lect
- 0x20, 0x45, 0x4d, 0x4d, 0x20, 0x70, 0x61, 0x67, 0x65, 0x2e, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x0d,
- //0x1130: EMM pag e... ..$.
- 0x0a, 0x0d, 0x0a, 0x44, 0x72, 0x65, 0x61, 0x6d, 0x77, 0x65, 0x62, 0x20, 0x68, 0x61, 0x73, 0x20,
- //0x1140: ...D ream web has
- 0x61, 0x6e, 0x20, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x3a, 0x0d, 0x0a, 0x46, 0x69, 0x6c, 0x65, 0x20,
- //0x1150: an E rror :..F ile
- 0x6e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x2e, 0x63, 0x0d, 0x0a, 0x0d, 0x0a, 0x24,
- //0x1160: not foun d.c. ...$
- 0x44, 0x72, 0x65, 0x61, 0x6d, 0x77, 0x65, 0x62, 0x20, 0x6c, 0x6f, 0x6f, 0x6b, 0x73, 0x20, 0x66,
- //0x1170: Drea mweb loo ks f
- 0x6f, 0x72, 0x20, 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x20, 0x42, 0x6c, 0x61, 0x73, 0x74, 0x65, 0x72,
- //0x1180: or S ound Bla ster
- 0x20, 0x69, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x0d,
- //0x1190: inf orma tion in.
- 0x0a, 0x74, 0x68, 0x65, 0x20, 0x42, 0x4c, 0x41, 0x53, 0x54, 0x45, 0x52, 0x20, 0x65, 0x6e, 0x76,
- //0x11a0: .the BLA STER env
- 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c,
- //0x11b0: iron ment var iabl
- 0x65, 0x20, 0x28, 0x69, 0x6e, 0x20, 0x79, 0x6f, 0x75, 0x72, 0x20, 0x41, 0x55, 0x54, 0x4f, 0x45,
- //0x11c0: e (i n yo ur A UTOE
- 0x58, 0x45, 0x43, 0x2e, 0x42, 0x41, 0x54, 0x29, 0x0d, 0x0a, 0x0d, 0x0a, 0x49, 0x66, 0x20, 0x74,
- //0x11d0: XEC. BAT) .... If t
- 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64,
- //0x11e0: his is n ot f ound
- 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x49, 0x52, 0x51, 0x20, 0x37, 0x2c, 0x20, 0x44, 0x4d, 0x41,
- //0x11f0: the n IR Q 7, DMA
- 0x20, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x20, 0x31, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x62,
- //0x1200: cha nnel 1 a nd b
- 0x61, 0x73, 0x65, 0x0d, 0x0a, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x20, 0x32, 0x32, 0x30,
- //0x1210: ase. .add ress 220
- 0x68, 0x20, 0x61, 0x72, 0x65, 0x20, 0x61, 0x73, 0x73, 0x75, 0x6d, 0x65, 0x64, 0x2e, 0x0d, 0x0a,
- //0x1220: h ar e as sume d...
- 0x0d, 0x0a, 0x54, 0x6f, 0x20, 0x61, 0x6c, 0x74, 0x65, 0x72, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x6f,
- //0x1230: ..To alt er a ny o
- 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x73, 0x65, 0x20, 0x73,
- //0x1240: r al l of the se s
- 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x20, 0x79, 0x6f, 0x75, 0x20, 0x63, 0x61, 0x6e, 0x20,
- //0x1250: etti ngs you can
- 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x79, 0x20, 0x74, 0x68, 0x65, 0x6d, 0x0d, 0x0a, 0x6f, 0x6e,
- //0x1260: spec ify them ..on
- 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x20, 0x6c, 0x69, 0x6e,
- //0x1270: the com mand lin
- 0x65, 0x2e, 0x20, 0x46, 0x6f, 0x72, 0x20, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x3a, 0x0d,
- //0x1280: e. F or e xamp le:.
- 0x0a, 0x0d, 0x0a, 0x54, 0x79, 0x70, 0x65, 0x20, 0x20, 0x20, 0x20, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1290: ...T ype D REAM
- 0x57, 0x45, 0x42, 0x20, 0x49, 0x37, 0x20, 0x41, 0x32, 0x32, 0x30, 0x20, 0x44, 0x31, 0x20, 0x20,
- //0x12a0: WEB I7 A 220 D1
- 0x20, 0x20, 0x74, 0x6f, 0x20, 0x72, 0x75, 0x6e, 0x20, 0x44, 0x72, 0x65, 0x61, 0x6d, 0x77, 0x65,
- //0x12b0: to run Dre amwe
- 0x62, 0x20, 0x6f, 0x6e, 0x20, 0x49, 0x52, 0x51, 0x20, 0x37, 0x2c, 0x20, 0x44, 0x4d, 0x41, 0x0d,
- //0x12c0: b on IRQ 7, DMA.
- 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- //0x12d0: .
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- //0x12e0:
- 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x20, 0x31, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x62, 0x61,
- //0x12f0: chan nel 1 an d ba
- 0x73, 0x65, 0x20, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x20, 0x32, 0x32, 0x30, 0x68, 0x0d,
- //0x1300: se a ddre ss 2 20h.
- 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45,
- //0x1310: . DRE AMWE
- 0x42, 0x20, 0x49, 0x35, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- //0x1320: B I5
- 0x74, 0x6f, 0x20, 0x72, 0x75, 0x6e, 0x20, 0x44, 0x72, 0x65, 0x61, 0x6d, 0x77, 0x65, 0x62, 0x20,
- //0x1330: to r un D ream web
- 0x6f, 0x6e, 0x20, 0x49, 0x52, 0x51, 0x20, 0x35, 0x20, 0x61, 0x6e, 0x64, 0x0d, 0x0a, 0x20, 0x20,
- //0x1340: on I RQ 5 and ..
+ //0x01b0: .... .... .... ....
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x01, 0x2c, 0x00, 0x14, 0x00,
+ //0x01c0: .... .... .... ,...
+ 0x02, 0x00, 0x01, 0x01, 0x37, 0x00, 0x00, 0x00, 0x32, 0x14, 0x00, 0x18, 0x16, 0x00, 0x4a, 0x00,
+ //0x01d0: .... 7... 2... ..J.
+ 0x01, 0x00, 0x00, 0x18, 0x21, 0x0a, 0x4b, 0x00, 0x01, 0x00, 0x01, 0x01, 0x2c, 0x00, 0x1b, 0x00,
+ //0x01e0: .... !.K. .... ,...
+ 0x02, 0x00, 0x02, 0x01, 0x2c, 0x00, 0x60, 0x00, 0x03, 0x00, 0x04, 0x01, 0x2c, 0x00, 0x76, 0x00,
+ //0x01f0: .... ,.`. .... ,.v.
+ 0x02, 0x00, 0x05, 0x01, 0x2c, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x05, 0x16, 0x14, 0x35, 0x00,
+ //0x0200: .... ,... .... ..5.
+ 0x03, 0x00, 0x00, 0x05, 0x16, 0x14, 0x28, 0x00, 0x01, 0x00, 0x02, 0x05, 0x16, 0x14, 0x32, 0x00,
+ //0x0210: .... ..(. .... ..2.
+ 0x01, 0x00, 0x03, 0x02, 0x0b, 0x0a, 0xc0, 0x00, 0x01, 0x00, 0x00, 0x02, 0x0b, 0x0a, 0xb6, 0x00,
+ //0x0220: .... .... .... ....
+ 0x02, 0x00, 0x01, 0x08, 0x0b, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x01, 0x17, 0x00, 0x32, 0x00, 0x00,
+ //0x0230: .... .... .... .2..
+ 0x03, 0x00, 0x00, 0x1c, 0x0b, 0x14, 0xfa, 0x00, 0x04, 0x00, 0x00, 0x17, 0x00, 0x32, 0x2b, 0x00,
+ //0x0240: .... .... .... .2+.
+ 0x02, 0x00, 0x08, 0x17, 0x0b, 0x28, 0x82, 0x00, 0x02, 0x00, 0x01, 0x17, 0x16, 0x28, 0x7a, 0x00,
+ //0x0250: .... .(.. .... .(z.
+ 0x02, 0x00, 0x02, 0x17, 0x16, 0x28, 0x69, 0x00, 0x02, 0x00, 0x03, 0x17, 0x16, 0x28, 0x51, 0x00,
+ //0x0260: .... .(i. .... .(Q.
+ 0x02, 0x00, 0x04, 0x17, 0x0b, 0x28, 0x87, 0x00, 0x02, 0x00, 0x05, 0x17, 0x16, 0x28, 0x91, 0x00,
+ //0x0270: .... .(.. .... .(..
+ 0x02, 0x00, 0x06, 0x04, 0x16, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x2d, 0x16, 0x1e, 0xc8, 0x00,
+ //0x0280: .... .... ...- ....
+ 0x00, 0x00, 0x14, 0x2d, 0x16, 0x1e, 0x27, 0x00, 0x02, 0x00, 0x00, 0x2d, 0x16, 0x1e, 0x19, 0x00,
+ //0x0290: ...- ..'. ...- ....
+ 0x02, 0x00, 0x00, 0x08, 0x16, 0x28, 0x20, 0x00, 0x02, 0x00, 0x00, 0x07, 0x0b, 0x14, 0x40, 0x00,
+ //0x02a0: .... .( . .... ..@.
+ 0x02, 0x00, 0x00, 0x16, 0x16, 0x14, 0x52, 0x00, 0x02, 0x00, 0x00, 0x1b, 0x0b, 0x1e, 0x00, 0x00,
+ //0x02b0: .... ..R. .... ....
+ 0x02, 0x00, 0x00, 0x14, 0x00, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x21, 0x28, 0x15, 0x00,
+ //0x02c0: .... .... .... !(..
+ 0x01, 0x00, 0x00, 0x1d, 0x0b, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x16, 0x00, 0x02, 0x00,
+ //0x02d0: .... .... .... ....
+ 0x02, 0x00, 0x00, 0x19, 0x00, 0x32, 0x04, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x1e, 0x79, 0x00,
+ //0x02e0: .... .2.. ...2 ..y.
+ 0x02, 0x00, 0x00, 0x32, 0x16, 0x1e, 0x00, 0x00, 0x14, 0x00, 0x00, 0x34, 0x16, 0x1e, 0xc0, 0x00,
+ //0x02f0: ...2 .... ...4 ....
+ 0x02, 0x00, 0x00, 0x34, 0x16, 0x1e, 0xe9, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x28, 0x68, 0x00,
+ //0x0300: ...4 .... ...2 .(h.
+ 0x37, 0x00, 0x00, 0x35, 0x21, 0x00, 0x63, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x28, 0x00, 0x00,
+ //0x0310: 7..5 !.c. ...2 .(..
+ 0x03, 0x00, 0x00, 0x32, 0x16, 0x1e, 0xa2, 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, 0x1e, 0x39, 0x00,
+ //0x0320: ...2 .... ...4 ..9.
+ 0x02, 0x00, 0x00, 0x34, 0x16, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x36, 0x00, 0x00, 0x48, 0x00,
+ //0x0330: ...4 .... ...6 ..H.
+ 0x03, 0x00, 0x00, 0x37, 0x2c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00,
+ //0x0340: ...7 ,... .... ....
+ 0x1c, 0x00, 0x00, 0x0e, 0x16, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x16, 0x00, 0x2c, 0x01,
+ //0x0350: .... .... .... ..,.
+ 0x01, 0x00, 0x00, 0x0a, 0x16, 0x1e, 0xae, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x16, 0x14, 0x00, 0x00,
+ //0x0360: .... .... .... ....
+ 0x01, 0x00, 0x00, 0x0b, 0x0b, 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0b, 0x0b, 0x1e, 0x00, 0x00,
+ //0x0370: .... .... 2... ....
+ 0x32, 0x14, 0x00, 0x0b, 0x16, 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0e, 0x21, 0x28, 0x00, 0x00,
+ //0x0380: 2... .... 2... !(..
+ 0x32, 0x14, 0x00, 0xff, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, 0x39,
+ //0x0390: 2... DREA MWEB .V99
+ 0x00, 0x00, 0x01, 0x45, 0x58, 0x49, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x48, 0x45, 0x4c,
+ //0x03a0: ...E XIT HEL
+ 0x50, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x49, 0x53, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20,
+ //0x03b0: P L IST
+ 0x20, 0x52, 0x45, 0x41, 0x44, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x47, 0x4f, 0x4e,
+ //0x03c0: REA D L OGON
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x4b, 0x45, 0x59, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01,
+ //0x03d0: KEY S .
+ 0x00, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x55, 0x42,
+ //0x03e0: .PUB LIC PUB
+ 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x42, 0x4c, 0x41, 0x43, 0x4b,
+ //0x03f0: LIC ...B LACK
+ 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20,
+ //0x0400: DRAG ON R YAN
+ 0x20, 0x20, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49, 0x58, 0x20, 0x20, 0x20, 0x20,
+ //0x0410: .. .HEN DRIX
+ 0x20, 0x4c, 0x4f, 0x55, 0x49, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x53,
+ //0x0420: LOU IS ...S
+ 0x45, 0x50, 0x54, 0x49, 0x4d, 0x55, 0x53, 0x20, 0x20, 0x20, 0x20, 0x42, 0x45, 0x43, 0x4b, 0x45,
+ //0x0430: EPTI MUS B ECKE
+ 0x54, 0x54, 0x20, 0x20, 0x20, 0x20, 0x00, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ //0x0440: TT .. .
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, 0x54, 0x20, 0x20, 0x20, 0x20,
+ //0x0450: ." ROOT
+ 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ //0x0460: ."
+ 0x20, 0x20, 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24,
+ //0x0470: .0 000. 00.. ...$
+ 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x20, 0x4e, 0x41, 0x4d, 0x45, 0x20, 0x4f, 0x4e, 0x45, 0x20,
+ //0x0480: OBJE CT N AME ONE
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- //0x1350:
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x64, 0x65, 0x66,
- //0x1360: def
- 0x61, 0x75, 0x6c, 0x74, 0x20, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x20, 0x6f, 0x66, 0x20,
- //0x1370: ault add ress of
- 0x32, 0x32, 0x30, 0x68, 0x2c, 0x20, 0x44, 0x4d, 0x41, 0x20, 0x31, 0x0d, 0x0a, 0x0d, 0x0a, 0x24,
- //0x1380: 220h , DM A 1. ...$
- 0x0d, 0x0a, 0x0d, 0x0a, 0x54, 0x72, 0x79, 0x20, 0x74, 0x68, 0x65, 0x20, 0x44, 0x72, 0x65, 0x61,
- //0x1390: .... Try the Drea
- 0x6d, 0x77, 0x65, 0x62, 0x20, 0x43, 0x44, 0x20, 0x69, 0x6e, 0x20, 0x79, 0x6f, 0x75, 0x72, 0x20,
- //0x13a0: mweb CD in y our
- 0x73, 0x74, 0x65, 0x72, 0x65, 0x6f, 0x2e, 0x2e, 0x2e, 0x2e, 0x0d, 0x0a, 0x0d, 0x0a, 0x0d, 0x0a,
- //0x13b0: ster eo.. .... ....
- 0x24, 0x81, 0x00, 0xb8, 0x00, 0x52, 0x00, 0x80, 0x00, 0xc0, 0xc8, 0x50, 0x00, 0x93, 0x00, 0x3e,
- //0x13c0: $... .R.. ...P ...>
- 0x00, 0x6f, 0x00, 0x80, 0xc8, 0xb7, 0x00, 0xfa, 0x00, 0x3e, 0x00, 0x6f, 0x00, 0xc4, 0xc8, 0x00,
- //0x13d0: .o.. .... .>.o ....
- 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, 0x53, 0x50, 0x45, 0x45, 0x43,
- //0x13e0: .@.. .... ...S PEEC
- 0x48, 0x52, 0x32, 0x34, 0x43, 0x30, 0x30, 0x30, 0x35, 0x2e, 0x52, 0x41, 0x57, 0x00, 0x87, 0x83,
- //0x13f0: HR24 C000 5.RA W...
- 0x81, 0x82, 0x2c, 0x00, 0x46, 0x00, 0x20, 0x00, 0x2e, 0x00, 0x70, 0xc4, 0x00, 0x00, 0x32, 0x00,
- //0x1400: ..,. F. . ..p. ..2.
- 0x00, 0x00, 0xb4, 0x00, 0x7c, 0xc3, 0xe2, 0x00, 0xf4, 0x00, 0x0a, 0x00, 0x1a, 0x00, 0x28, 0xc8,
- //0x1410: .... |... .... ..(.
- 0xe2, 0x00, 0xf4, 0x00, 0x1a, 0x00, 0x28, 0x00, 0x2c, 0xc8, 0xf0, 0x00, 0x04, 0x01, 0x64, 0x00,
- //0x1420: .... ..(. ,... ..d.
- 0x7c, 0x00, 0xcc, 0xc9, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xd4, 0xc9, 0xff, 0xff,
- //0x1430: |... ..@. .... ....
- 0x2c, 0x00, 0x46, 0x00, 0x20, 0x00, 0x2e, 0x00, 0x70, 0xc4, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00,
- //0x1440: ,.F. ... p... 2...
- 0xb4, 0x00, 0x7c, 0xc3, 0x12, 0x01, 0x24, 0x01, 0x0a, 0x00, 0x1a, 0x00, 0x28, 0xc8, 0x12, 0x01,
- //0x1450: ..|. ..$. .... (...
- 0x24, 0x01, 0x1a, 0x00, 0x28, 0x00, 0x2c, 0xc8, 0xf0, 0x00, 0x04, 0x01, 0x64, 0x00, 0x7c, 0x00,
- //0x1460: $... (.,. .... d.|.
- 0xcc, 0xc9, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xd4, 0xc9, 0xff, 0xff, 0x00, 0x21,
- //0x1470: .... @... .... ...!
- 0x0a, 0x0f, 0xff, 0x00, 0x16, 0x0a, 0x0f, 0xff, 0x00, 0x16, 0x00, 0x0f, 0xff, 0x00, 0x0b, 0x00,
- //0x1480: .... .... .... ....
- 0x0f, 0xff, 0x00, 0x0b, 0x0a, 0x0f, 0xff, 0x00, 0x00, 0x0a, 0x0f, 0xff, 0x01, 0x2c, 0x0a, 0x06,
- //0x1490: .... .... .... .,..
- 0xff, 0x01, 0x2c, 0x00, 0x0d, 0xff, 0x02, 0x21, 0x00, 0x06, 0xff, 0x02, 0x16, 0x00, 0x05, 0xff,
- //0x14a0: ..,. ...! .... ....
- 0x02, 0x16, 0x0a, 0x10, 0xff, 0x02, 0x0b, 0x0a, 0x10, 0xff, 0x03, 0x2c, 0x00, 0x0f, 0xff, 0x03,
- //0x14b0: .... .... ..., ....
- 0x21, 0x0a, 0x06, 0xff, 0x03, 0x21, 0x00, 0x05, 0xff, 0x04, 0x0b, 0x1e, 0x06, 0xff, 0x04, 0x16,
- //0x14c0: !... .!.. .... ....
- 0x1e, 0x05, 0xff, 0x04, 0x16, 0x14, 0x0d, 0xff, 0x0a, 0x21, 0x1e, 0x06, 0xff, 0x0a, 0x16, 0x1e,
- //0x14d0: .... .... .!.. ....
- 0x06, 0xff, 0x09, 0x16, 0x0a, 0x06, 0xff, 0x09, 0x16, 0x14, 0x10, 0xff, 0x09, 0x16, 0x1e, 0x10,
- //0x14e0: .... .... .... ....
- 0xff, 0x09, 0x16, 0x28, 0x10, 0xff, 0x09, 0x16, 0x32, 0x10, 0xff, 0x06, 0x0b, 0x1e, 0x06, 0xff,
- //0x14f0: ...( .... 2... ....
- 0x06, 0x00, 0x0a, 0x0f, 0xff, 0x06, 0x00, 0x14, 0x0f, 0xff, 0x06, 0x0b, 0x14, 0x0f, 0xff, 0x06,
- //0x1500: .... .... .... ....
- 0x16, 0x14, 0x0f, 0xff, 0x07, 0x0b, 0x14, 0x06, 0xff, 0x07, 0x00, 0x14, 0x06, 0xff, 0x07, 0x00,
- //0x1510: .... .... .... ....
- 0x1e, 0x06, 0xff, 0x37, 0x2c, 0x00, 0x05, 0xff, 0x37, 0x2c, 0x0a, 0x05, 0xff, 0x05, 0x16, 0x1e,
- //0x1520: ...7 ,... 7,.. ....
- 0x06, 0xff, 0x05, 0x16, 0x14, 0x0f, 0xff, 0x05, 0x16, 0x0a, 0x0f, 0xff, 0x18, 0x16, 0x00, 0x0f,
- //0x1530: .... .... .... ....
- 0xff, 0x18, 0x21, 0x00, 0x0f, 0xff, 0x18, 0x2c, 0x00, 0x0f, 0xff, 0x18, 0x21, 0x0a, 0x0f, 0xff,
- //0x1540: ..!. ..., .... !...
- 0x08, 0x00, 0x0a, 0x06, 0xff, 0x08, 0x0b, 0x0a, 0x06, 0xff, 0x08, 0x16, 0x0a, 0x06, 0xff, 0x08,
- //0x1550: .... .... .... ....
- 0x21, 0x0a, 0x06, 0xff, 0x08, 0x21, 0x14, 0x06, 0xff, 0x08, 0x21, 0x1e, 0x06, 0xff, 0x08, 0x21,
- //0x1560: !... .!.. ..!. ...!
- 0x28, 0x06, 0xff, 0x08, 0x16, 0x28, 0x06, 0xff, 0x08, 0x0b, 0x28, 0x06, 0xff, 0x0b, 0x0b, 0x14,
- //0x1570: (... .(.. ..(. ....
- 0x0c, 0xff, 0x0b, 0x0b, 0x1e, 0x0c, 0xff, 0x0b, 0x16, 0x14, 0x0c, 0xff, 0x0b, 0x16, 0x1e, 0x0c,
- //0x1580: .... .... .... ....
- 0xff, 0x0c, 0x16, 0x14, 0x0c, 0xff, 0x0d, 0x16, 0x14, 0x0c, 0xff, 0x0d, 0x21, 0x14, 0x0c, 0xff,
- //0x1590: .... .... .... !...
- 0x0e, 0x2c, 0x14, 0x0c, 0xff, 0x0e, 0x21, 0x00, 0x0c, 0xff, 0x0e, 0x21, 0x0a, 0x0c, 0xff, 0x0e,
- //0x15a0: .,.. ..!. ...! ....
- 0x21, 0x14, 0x0c, 0xff, 0x0e, 0x21, 0x1e, 0x0c, 0xff, 0x0e, 0x21, 0x28, 0x0c, 0xff, 0x0e, 0x16,
- //0x15b0: !... .!.. ..!( ....
- 0x00, 0x10, 0xff, 0x13, 0x00, 0x00, 0x0c, 0xff, 0x14, 0x00, 0x14, 0x10, 0xff, 0x14, 0x00, 0x1e,
- //0x15c0: .... .... .... ....
- 0x10, 0xff, 0x14, 0x0b, 0x1e, 0x10, 0xff, 0x14, 0x00, 0x28, 0x10, 0xff, 0x14, 0x0b, 0x28, 0x10,
- //0x15d0: .... .... .(.. ..(.
- 0xff, 0x15, 0x0b, 0x0a, 0x0f, 0xff, 0x15, 0x0b, 0x14, 0x0f, 0xff, 0x15, 0x00, 0x14, 0x0f, 0xff,
- //0x15e0: .... .... .... ....
- 0x15, 0x16, 0x14, 0x0f, 0xff, 0x15, 0x21, 0x14, 0x0f, 0xff, 0x15, 0x2c, 0x14, 0x0f, 0xff, 0x15,
- //0x15f0: .... ..!. ..., ....
- 0x2c, 0x0a, 0x0f, 0xff, 0x16, 0x16, 0x0a, 0x10, 0xff, 0x16, 0x16, 0x14, 0x10, 0xff, 0x17, 0x16,
- //0x1600: ,... .... .... ....
- 0x1e, 0x0d, 0xff, 0x17, 0x16, 0x28, 0x0d, 0xff, 0x17, 0x21, 0x28, 0x0d, 0xff, 0x17, 0x0b, 0x28,
- //0x1610: .... .(.. .!(. ...(
- 0x0d, 0xff, 0x17, 0x00, 0x28, 0x0d, 0xff, 0x17, 0x00, 0x32, 0x0d, 0xff, 0x19, 0x0b, 0x28, 0x10,
- //0x1620: .... (... .2.. ..(.
- 0xff, 0x19, 0x0b, 0x32, 0x10, 0xff, 0x19, 0x00, 0x32, 0x10, 0xff, 0x1b, 0x0b, 0x14, 0x10, 0xff,
- //0x1630: ...2 .... 2... ....
- 0x1b, 0x0b, 0x1e, 0x10, 0xff, 0x1d, 0x0b, 0x0a, 0x10, 0xff, 0x2d, 0x16, 0x1e, 0x0c, 0xff, 0x2d,
- //0x1640: .... .... ..-. ...-
- 0x16, 0x28, 0x0c, 0xff, 0x2d, 0x16, 0x32, 0x0c, 0xff, 0x2e, 0x16, 0x28, 0x0c, 0xff, 0x2e, 0x0b,
- //0x1650: .(.. -.2. ...( ....
- 0x32, 0x0c, 0xff, 0x2e, 0x16, 0x32, 0x0c, 0xff, 0x2e, 0x21, 0x32, 0x0c, 0xff, 0x2f, 0x00, 0x00,
- //0x1660: 2... .2.. .!2. ./..
- 0x0c, 0xff, 0x1a, 0x16, 0x14, 0x10, 0xff, 0x1a, 0x21, 0x0a, 0x10, 0xff, 0x1a, 0x21, 0x14, 0x10,
- //0x1670: .... .... !... .!..
- 0xff, 0x1a, 0x21, 0x1e, 0x10, 0xff, 0x1a, 0x2c, 0x1e, 0x10, 0xff, 0x1a, 0x16, 0x1e, 0x10, 0xff,
- //0x1680: ..!. ..., .... ....
- 0x1a, 0x0b, 0x1e, 0x10, 0xff, 0x1a, 0x0b, 0x14, 0x10, 0xff, 0x1a, 0x00, 0x14, 0x10, 0xff, 0x1a,
- //0x1690: .... .... .... ....
- 0x0b, 0x28, 0x10, 0xff, 0x1a, 0x00, 0x28, 0x10, 0xff, 0x1a, 0x16, 0x28, 0x10, 0xff, 0x1a, 0x0b,
- //0x16a0: .(.. ..(. ...( ....
- 0x32, 0x10, 0xff, 0x1c, 0x00, 0x1e, 0x0f, 0xff, 0x1c, 0x00, 0x14, 0x0f, 0xff, 0x1c, 0x00, 0x28,
- //0x16b0: 2... .... .... ...(
- 0x0f, 0xff, 0x1c, 0x0b, 0x1e, 0x0f, 0xff, 0x1c, 0x0b, 0x14, 0x0f, 0xff, 0x1c, 0x16, 0x1e, 0x0f,
- //0x16c0: .... .... .... ....
- 0xff, 0x1c, 0x16, 0x14, 0x0f, 0xff, 0xff, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x20, 0x4e, 0x41,
- //0x16d0: .... ...O BJEC T NA
- 0x4d, 0x45, 0x20, 0x4f, 0x4e, 0x45, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- //0x16e0: ME O NE
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
- //0x16f0: .
- 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- //0x1700: .... .... .... ....
- 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1710: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
- //0x1720: .... .... ..12 3456
- 0x37, 0x38, 0x39, 0x30, 0x2d, 0x00, 0x08, 0x00, 0x51, 0x57, 0x45, 0x52, 0x54, 0x59, 0x55, 0x49,
- //0x1730: 7890 -... QWER TYUI
- 0x4f, 0x50, 0x00, 0x00, 0x0d, 0x00, 0x41, 0x53, 0x44, 0x46, 0x47, 0x48, 0x4a, 0x4b, 0x4c, 0x00,
- //0x1740: OP.. ..AS DFGH JKL.
- 0x00, 0x00, 0x00, 0x00, 0x5a, 0x58, 0x43, 0x56, 0x42, 0x4e, 0x4d, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1750: .... ZXCV BNM. ....
- 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1760: . .. .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1770: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1780: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1790: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x3a, 0x00, 0x00, 0x00,
- //0x17a0: .... .... ...D :...
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x17b0: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x17c0: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x20, 0x44, 0x41, 0x54, 0x41, 0x20, 0x46, 0x49, 0x4c, 0x45, 0x20, 0x43, 0x4f,
- //0x17d0: WEB DATA FIL E CO
- 0x50, 0x59, 0x52, 0x49, 0x47, 0x48, 0x54, 0x20, 0x31, 0x39, 0x39, 0x32, 0x20, 0x43, 0x52, 0x45,
- //0x17e0: PYRI GHT 1992 CRE
- 0x41, 0x54, 0x49, 0x56, 0x45, 0x20, 0x52, 0x45, 0x41, 0x4c, 0x49, 0x54, 0x59, 0x00, 0x00, 0x00,
- //0x17f0: ATIV E RE ALIT Y...
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1800: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1810: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1820: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x30, 0x00, 0x05, 0xff, 0x21, 0x0a, 0xff, 0xff, 0xff, 0x00,
- //0x1830: WEB. R00. ..!. ....
- 0x01, 0x06, 0x02, 0xff, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1840: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x31, 0x00, 0x01, 0xff, 0x2c, 0x0a, 0xff, 0xff, 0xff, 0x00,
- //0x1850: WEB. R01. ..,. ....
- 0x07, 0x02, 0xff, 0xff, 0xff, 0xff, 0x06, 0xff, 0xff, 0xff, 0x01, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1860: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x32, 0x00, 0x02, 0xff, 0x21, 0x00, 0xff, 0xff, 0xff, 0x00,
- //0x1870: WEB. R02. ..!. ....
- 0x01, 0x00, 0xff, 0xff, 0x01, 0xff, 0x03, 0xff, 0xff, 0xff, 0x02, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1880: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x33, 0x00, 0x05, 0xff, 0x21, 0x0a, 0xff, 0xff, 0xff, 0x00,
- //0x1890: WEB. R03. ..!. ....
- 0x02, 0x02, 0x00, 0x02, 0x04, 0xff, 0x00, 0xff, 0xff, 0xff, 0x03, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x18a0: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x34, 0x00, 0x17, 0xff, 0x0b, 0x1e, 0xff, 0xff, 0xff, 0x00,
- //0x18b0: WEB. R04. .... ....
- 0x01, 0x04, 0x00, 0x05, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0x04, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x18c0: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x35, 0x00, 0x05, 0xff, 0x16, 0x1e, 0xff, 0xff, 0xff, 0x00,
- //0x18d0: WEB. R05. .... ....
- 0x01, 0x02, 0x00, 0x04, 0xff, 0xff, 0x03, 0xff, 0xff, 0xff, 0x05, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x18e0: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x36, 0x00, 0x05, 0xff, 0x0b, 0x1e, 0xff, 0xff, 0xff, 0x00,
- //0x18f0: WEB. R06. .... ....
- 0x01, 0x00, 0x00, 0x01, 0x02, 0xff, 0x00, 0xff, 0xff, 0xff, 0x06, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1900: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x37, 0x00, 0xff, 0xff, 0x00, 0x14, 0xff, 0xff, 0xff, 0x00,
- //0x1910: WEB. R07. .... ....
- 0x02, 0x02, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x07, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1920: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x38, 0x00, 0x08, 0xff, 0x00, 0x0a, 0xff, 0xff, 0xff, 0x00,
- //0x1930: WEB. R08. .... ....
- 0x01, 0x02, 0xff, 0xff, 0xff, 0xff, 0x00, 0x0b, 0x28, 0x00, 0x08, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1940: .... .... (..D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x39, 0x00, 0x09, 0xff, 0x16, 0x0a, 0xff, 0xff, 0xff, 0x00,
- //0x1950: WEB. R09. .... ....
- 0x04, 0x06, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x09, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1960: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x31, 0x30, 0x00, 0x0a, 0xff, 0x21, 0x1e, 0xff, 0xff, 0xff, 0x00,
- //0x1970: WEB. R10. ..!. ....
- 0x02, 0x00, 0xff, 0xff, 0x02, 0x02, 0x04, 0x16, 0x1e, 0xff, 0x0a, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1980: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x31, 0x31, 0x00, 0x0b, 0xff, 0x0b, 0x14, 0xff, 0xff, 0xff, 0x00,
- //0x1990: WEB. R11. .... ....
- 0x00, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0b, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x19a0: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x31, 0x32, 0x00, 0x0c, 0xff, 0x16, 0x14, 0xff, 0xff, 0xff, 0x00,
- //0x19b0: WEB. R12. .... ....
- 0x01, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0c, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x19c0: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x31, 0x33, 0x00, 0x0c, 0xff, 0x16, 0x14, 0xff, 0xff, 0xff, 0x00,
- //0x19d0: WEB. R13. .... ....
- 0x01, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0d, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x19e0: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x31, 0x34, 0x00, 0x0e, 0xff, 0x2c, 0x14, 0xff, 0xff, 0xff, 0x00,
- //0x19f0: WEB. R14. ..,. ....
- 0x00, 0x06, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1a00: .... .... .... ....
+ //0x0490:
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10,
+ //0x04a0: .... ....
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ //0x04b0: .... .... .... ....
+ 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ //0x04c0: .D:. .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1a10: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1a20: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1a30: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1a40: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1a50: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1a60: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1a70: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1a80: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x31, 0x39, 0x00, 0x13, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00,
- //0x1a90: WEB. R19. .... ....
- 0x00, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x13, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1aa0: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x30, 0x00, 0x16, 0xff, 0x00, 0x14, 0xff, 0xff, 0xff, 0x00,
- //0x1ab0: WEB. R20. .... ....
- 0x01, 0x04, 0x02, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x14, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1ac0: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x31, 0x00, 0x05, 0xff, 0x0b, 0x0a, 0xff, 0xff, 0xff, 0x00,
- //0x1ad0: WEB. R21. .... ....
- 0x01, 0x04, 0x02, 0x0f, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0x15, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1ae0: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x32, 0x00, 0x16, 0xff, 0x16, 0x0a, 0xff, 0xff, 0xff, 0x00,
- //0x1af0: WEB. R22. .... ....
- 0x00, 0x04, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1b00: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x33, 0x00, 0x17, 0xff, 0x16, 0x1e, 0xff, 0xff, 0xff, 0x00,
- //0x1b10: WEB. R23. .... ....
- 0x01, 0x04, 0x02, 0x0f, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1b20: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x34, 0x00, 0x05, 0xff, 0x2c, 0x00, 0xff, 0xff, 0xff, 0x00,
- //0x1b30: WEB. R24. ..,. ....
- 0x01, 0x06, 0x02, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x18, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1b40: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x35, 0x00, 0x16, 0xff, 0x0b, 0x28, 0xff, 0xff, 0xff, 0x00,
- //0x1b50: WEB. R25. ...( ....
- 0x01, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x19, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1b60: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x36, 0x00, 0x09, 0xff, 0x16, 0x14, 0xff, 0xff, 0xff, 0x00,
- //0x1b70: WEB. R26. .... ....
- 0x04, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1a, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1b80: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x37, 0x00, 0x16, 0xff, 0x0b, 0x14, 0xff, 0xff, 0xff, 0x00,
- //0x1b90: WEB. R27. .... ....
- 0x00, 0x06, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1b, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1ba0: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x38, 0x00, 0x05, 0xff, 0x0b, 0x1e, 0xff, 0xff, 0xff, 0x00,
- //0x1bb0: WEB. R28. .... ....
- 0x00, 0x00, 0xff, 0xff, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1c, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1bc0: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x39, 0x00, 0x16, 0xff, 0x0b, 0x0a, 0xff, 0xff, 0xff, 0x00,
- //0x1bd0: WEB. R29. .... ....
- 0x00, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1d, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1be0: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x35, 0x00, 0x05, 0xff, 0x16, 0x0a, 0xff, 0xff, 0xff, 0x00,
- //0x1bf0: WEB. R05. .... ....
- 0x01, 0x04, 0x01, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x05, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1c00: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x34, 0x00, 0x17, 0xff, 0x16, 0x14, 0xff, 0xff, 0xff, 0x00,
- //0x1c10: WEB. R04. .... ....
- 0x01, 0x04, 0x02, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x04, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1c20: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x31, 0x30, 0x00, 0x0a, 0xff, 0x16, 0x1e, 0xff, 0xff, 0xff, 0x00,
- //0x1c30: WEB. R10. .... ....
- 0x03, 0x06, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0a, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1c40: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x31, 0x32, 0x00, 0x0c, 0xff, 0x16, 0x14, 0xff, 0xff, 0xff, 0x00,
- //0x1c50: WEB. R12. .... ....
- 0x00, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0c, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1c60: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x33, 0x00, 0x05, 0xff, 0x2c, 0x00, 0xff, 0xff, 0xff, 0x00,
- //0x1c70: WEB. R03. ..,. ....
- 0x01, 0x06, 0x02, 0xff, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1c80: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x34, 0x00, 0x05, 0xff, 0x16, 0x00, 0xff, 0xff, 0xff, 0x00,
- //0x1c90: WEB. R24. .... ....
- 0x03, 0x06, 0x00, 0xff, 0xff, 0xff, 0xff, 0x21, 0x00, 0x03, 0x18, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1ca0: .... ...! ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x32, 0x00, 0x16, 0xff, 0x16, 0x14, 0xff, 0xff, 0xff, 0x00,
- //0x1cb0: WEB. R22. .... ....
- 0x01, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1cc0: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x32, 0x00, 0x16, 0xff, 0x16, 0x14, 0xff, 0xff, 0xff, 0x00,
- //0x1cd0: WEB. R22. .... ....
- 0x00, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x16, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1ce0: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x31, 0x31, 0x00, 0x0b, 0xff, 0x16, 0x1e, 0xff, 0xff, 0xff, 0x00,
- //0x1cf0: WEB. R11. .... ....
- 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0b, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1d00: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x38, 0x00, 0x05, 0xff, 0x0b, 0x14, 0xff, 0xff, 0xff, 0x00,
- //0x1d10: WEB. R28. .... ....
- 0x00, 0x06, 0xff, 0xff, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1c, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1d20: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x31, 0x00, 0x05, 0xff, 0x0b, 0x0a, 0xff, 0xff, 0xff, 0x00,
- //0x1d30: WEB. R21. .... ....
- 0x01, 0x04, 0x02, 0x0f, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0x15, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1d40: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x32, 0x36, 0x00, 0x09, 0xff, 0x00, 0x28, 0xff, 0xff, 0xff, 0x00,
- //0x1d50: WEB. R26. ...( ....
- 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1a, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1d60: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x31, 0x39, 0x00, 0x13, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00,
- //0x1d70: WEB. R19. .... ....
- 0x02, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x13, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1d80: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x38, 0x00, 0x08, 0xff, 0x0b, 0x28, 0xff, 0xff, 0xff, 0x00,
- //0x1d90: WEB. R08. ...( ....
- 0x00, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x08, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1da0: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x30, 0x31, 0x00, 0x01, 0xff, 0x2c, 0x0a, 0xff, 0xff, 0xff, 0x00,
- //0x1db0: WEB. R01. ..,. ....
- 0x03, 0x06, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1dc0: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x34, 0x35, 0x00, 0x23, 0xff, 0x16, 0x1e, 0xff, 0xff, 0xff, 0x00,
- //0x1dd0: WEB. R45. #... ....
- 0x00, 0x06, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x2d, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1de0: .... .... ..-D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x34, 0x36, 0x00, 0x23, 0xff, 0x16, 0x28, 0xff, 0xff, 0xff, 0x00,
- //0x1df0: WEB. R46. #..( ....
- 0x00, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x2e, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1e00: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x34, 0x37, 0x00, 0x23, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00,
- //0x1e10: WEB. R47. #... ....
- 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x2f, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1e20: .... .... ../D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x34, 0x35, 0x00, 0x23, 0xff, 0x16, 0x1e, 0xff, 0xff, 0xff, 0x00,
- //0x1e30: WEB. R45. #... ....
- 0x04, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x2d, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1e40: .... .... ..-D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x34, 0x36, 0x00, 0x23, 0xff, 0x16, 0x32, 0xff, 0xff, 0xff, 0x00,
- //0x1e50: WEB. R46. #..2 ....
- 0x00, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x2e, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1e60: .... .... ...D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x35, 0x30, 0x00, 0x23, 0xff, 0x16, 0x1e, 0xff, 0xff, 0xff, 0x00,
- //0x1e70: WEB. R50. #... ....
- 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x32, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1e80: .... .... ..2D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x35, 0x31, 0x00, 0x23, 0xff, 0x0b, 0x1e, 0xff, 0xff, 0xff, 0x00,
- //0x1e90: WEB. R51. #... ....
- 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x33, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1ea0: .... .... ..3D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x35, 0x32, 0x00, 0x23, 0xff, 0x16, 0x1e, 0xff, 0xff, 0xff, 0x00,
- //0x1eb0: WEB. R52. #... ....
- 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x34, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1ec0: .... .... ..4D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x35, 0x33, 0x00, 0x23, 0xff, 0x21, 0x00, 0xff, 0xff, 0xff, 0x00,
- //0x1ed0: WEB. R53. #.!. ....
- 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x35, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1ee0: .... .... ..5D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x35, 0x34, 0x00, 0x23, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00,
- //0x1ef0: WEB. R54. #... ....
- 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x36, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x1f00: .... .... ..6D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x52, 0x35, 0x35, 0x00, 0x0e, 0xff, 0x2c, 0x00, 0xff, 0xff, 0xff, 0x00,
- //0x1f10: WEB. R55. ..,. ....
- 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1f20: .... .... ..7. ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1f30: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00,
- //0x1f40: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, 0x04,
- //0x1f50: .... .... .... ....
- 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1f60: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1f70: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1f80: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1f90: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1fa0: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1fb0: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1fc0: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x1fd0: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
- //0x1fe0: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x1ff0: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x2000: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x2010: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x2020: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x2030: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x2040: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x2050: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x2060: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x2070: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x2080: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x2090: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x20a0: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x20b0: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x20c0: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x20d0: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x20e0: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x20f0: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x2100: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x2110: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x2120: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x2130: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x2140: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x2150: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x2160: .... .... .... ....
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- //0x2170: .... .... .... ....
- 0xff, 0xff, 0xff, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- //0x2180: .... .... .... ....
- 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- //0x2190: .... .... .... ....
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- //0x21a0: .... .... .... ....
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- //0x21b0: .... .... .... ....
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- //0x21c0: .... .... .... ....
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- //0x21d0: .... .... .... ....
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,
- //0x21e0: .... .... .... ....
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57,
- //0x21f0: .... .... ..DR EAMW
- 0x45, 0x42, 0x2e, 0x44, 0x30, 0x30, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e,
- //0x2200: EB.D 00.D REAM WEB.
- 0x44, 0x30, 0x31, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x44, 0x30, 0x32,
- //0x2210: D01. DREA MWEB .D02
- 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x44, 0x30, 0x33, 0x00, 0x44, 0x52,
- //0x2220: .DRE AMWE B.D0 3.DR
- 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x44, 0x30, 0x34, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d,
- //0x2230: EAMW EB.D 04.D REAM
- 0x57, 0x45, 0x42, 0x2e, 0x44, 0x30, 0x35, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42,
- //0x2240: WEB. D05. DREA MWEB
- 0x2e, 0x44, 0x30, 0x36, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x44, 0x45,
- //0x2250: .D06 .DRE AMWE B.DE
- 0x4d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x2260: M... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x2270: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x2280: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x2290: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x22a0: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x22b0: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x22c0: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x22d0: .... .... .... ....
+ //0x04d0: .... .... .... ....
+ 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ //0x04e0: .... .... .... ....
+ 0x00, 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00,
+ //0x04f0: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x22e0: .... .... .... ....
+ //0x0500: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x22f0: .... .... .... ....
+ //0x0510: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x2300: .... .... .... ....
+ //0x0520: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x2310: .... .... .... ....
+ //0x0530: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x2320: .... .... .... ....
+ //0x0540: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x2330: .... .... .... ....
+ //0x0550: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x2340: .... .... .... ....
+ //0x0560: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x2350: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, };
+ //0x0570: .... .... .... ....
+ 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, };
ds.assign(src, src + sizeof(src));
-dreamweb();
-}
-
-void DreamGenContext::__dispatch_call(uint16 addr) {
- switch(addr) {
- case addr_alleybarksound: alleybarksound(); break;
- case addr_intromusic: intromusic(); break;
- case addr_foghornsound: foghornsound(); break;
- case addr_receptionist: receptionist(); break;
- case addr_smokebloke: smokebloke(); break;
- case addr_attendant: attendant(); break;
- case addr_manasleep: manasleep(); break;
- case addr_eden: eden(); break;
- case addr_edeninbath: edeninbath(); break;
- case addr_malefan: malefan(); break;
- case addr_femalefan: femalefan(); break;
- case addr_louis: louis(); break;
- case addr_louischair: louischair(); break;
- case addr_manasleep2: manasleep2(); break;
- case addr_mansatstill: mansatstill(); break;
- case addr_tattooman: tattooman(); break;
- case addr_drinker: drinker(); break;
- case addr_bartender: bartender(); break;
- case addr_othersmoker: othersmoker(); break;
- case addr_barwoman: barwoman(); break;
- case addr_interviewer: interviewer(); break;
- case addr_soldier1: soldier1(); break;
- case addr_rockstar: rockstar(); break;
- case addr_helicopter: helicopter(); break;
- case addr_mugger: mugger(); break;
- case addr_aide: aide(); break;
- case addr_businessman: businessman(); break;
- case addr_poolguard: poolguard(); break;
- case addr_security: security(); break;
- case addr_heavy: heavy(); break;
- case addr_bossman: bossman(); break;
- case addr_gamer: gamer(); break;
- case addr_sparkydrip: sparkydrip(); break;
- case addr_carparkdrip: carparkdrip(); break;
- case addr_keeper: keeper(); break;
- case addr_candles1: candles1(); break;
- case addr_smallcandle: smallcandle(); break;
- case addr_intromagic1: intromagic1(); break;
- case addr_candles: candles(); break;
- case addr_candles2: candles2(); break;
- case addr_gates: gates(); break;
- case addr_intromagic2: intromagic2(); break;
- case addr_intromagic3: intromagic3(); break;
- case addr_intromonks1: intromonks1(); break;
- case addr_intromonks2: intromonks2(); break;
- case addr_handclap: handclap(); break;
- case addr_monks2text: monks2text(); break;
- case addr_intro1text: intro1text(); break;
- case addr_intro2text: intro2text(); break;
- case addr_intro3text: intro3text(); break;
- case addr_monkandryan: monkandryan(); break;
- case addr_endgameseq: endgameseq(); break;
- case addr_rollendcredits: rollendcredits(); break;
- case addr_priest: priest(); break;
- case addr_madmanstelly: madmanstelly(); break;
- case addr_madman: madman(); break;
- case addr_priesttext: priesttext(); break;
- case addr_textforend: textforend(); break;
- case addr_textformonk: textformonk(); break;
- case addr_drunk: drunk(); break;
- case addr_advisor: advisor(); break;
- case addr_copper: copper(); break;
- case addr_sparky: sparky(); break;
- case addr_train: train(); break;
- case addr_checkspeed: checkspeed(); break;
- case addr_mainman: mainman(); break;
- case addr_checkforexit: checkforexit(); break;
- case addr_adjustdown: adjustdown(); break;
- case addr_adjustup: adjustup(); break;
- case addr_adjustleft: adjustleft(); break;
- case addr_adjustright: adjustright(); break;
- case addr_reminders: reminders(); break;
- case addr_initrain: initrain(); break;
- case addr_splitintolines: splitintolines(); break;
- case addr_backobject: backobject(); break;
- case addr_liftnoise: liftnoise(); break;
- case addr_random: random(); break;
- case addr_steady: steady(); break;
- case addr_constant: constant(); break;
- case addr_reelsonscreen: reelsonscreen(); break;
- case addr_soundonreels: soundonreels(); break;
- case addr_reconstruct: reconstruct(); break;
- case addr_deleverything: deleverything(); break;
- case addr_showpcx: showpcx(); break;
- case addr_loadpalfromiff: loadpalfromiff(); break;
- case addr_setmode: setmode(); break;
- case addr_createpanel: createpanel(); break;
- case addr_createpanel2: createpanel2(); break;
- case addr_vsync: vsync(); break;
- case addr_doshake: doshake(); break;
- case addr_transfermap: transfermap(); break;
- case addr_fadedos: fadedos(); break;
- case addr_dofade: dofade(); break;
- case addr_clearendpal: clearendpal(); break;
- case addr_clearpalette: clearpalette(); break;
- case addr_fadescreenup: fadescreenup(); break;
- case addr_fadetowhite: fadetowhite(); break;
- case addr_fadefromwhite: fadefromwhite(); break;
- case addr_fadescreenups: fadescreenups(); break;
- case addr_fadescreendownhalf: fadescreendownhalf(); break;
- case addr_fadescreenuphalf: fadescreenuphalf(); break;
- case addr_fadescreendown: fadescreendown(); break;
- case addr_fadescreendowns: fadescreendowns(); break;
- case addr_clearstartpal: clearstartpal(); break;
- case addr_showgun: showgun(); break;
- case addr_rollendcredits2: rollendcredits2(); break;
- case addr_rollem: rollem(); break;
- case addr_fadecalculation: fadecalculation(); break;
- case addr_greyscalesum: greyscalesum(); break;
- case addr_showgroup: showgroup(); break;
- case addr_paltostartpal: paltostartpal(); break;
- case addr_endpaltostart: endpaltostart(); break;
- case addr_startpaltoend: startpaltoend(); break;
- case addr_paltoendpal: paltoendpal(); break;
- case addr_allpalette: allpalette(); break;
- case addr_dumpcurrent: dumpcurrent(); break;
- case addr_fadedownmon: fadedownmon(); break;
- case addr_fadeupmon: fadeupmon(); break;
- case addr_fadeupmonfirst: fadeupmonfirst(); break;
- case addr_fadeupyellows: fadeupyellows(); break;
- case addr_initialmoncols: initialmoncols(); break;
- case addr_titles: titles(); break;
- case addr_endgame: endgame(); break;
- case addr_monkspeaking: monkspeaking(); break;
- case addr_showmonk: showmonk(); break;
- case addr_gettingshot: gettingshot(); break;
- case addr_credits: credits(); break;
- case addr_biblequote: biblequote(); break;
- case addr_hangone: hangone(); break;
- case addr_intro: intro(); break;
- case addr_runintroseq: runintroseq(); break;
- case addr_runendseq: runendseq(); break;
- case addr_loadintroroom: loadintroroom(); break;
- case addr_mode640x480: mode640x480(); break;
- case addr_set16colpalette: set16colpalette(); break;
- case addr_realcredits: realcredits(); break;
- case addr_monprint: monprint(); break;
- case addr_fillopen: fillopen(); break;
- case addr_findallopen: findallopen(); 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_openob: openob(); break;
- case addr_examicon: examicon(); 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_inventory: inventory(); break;
- case addr_setpickup: setpickup(); break;
- case addr_examinventory: examinventory(); break;
- case addr_reexfrominv: reexfrominv(); break;
- case addr_reexfromopen: reexfromopen(); break;
- case addr_swapwithinv: swapwithinv(); break;
- case addr_swapwithopen: swapwithopen(); break;
- case addr_intoinv: intoinv(); break;
- case addr_outofinv: outofinv(); break;
- case addr_getfreead: getfreead(); break;
- case addr_getexad: getexad(); break;
- case addr_geteitherad: geteitherad(); break;
- case addr_getanyad: getanyad(); break;
- case addr_getanyaddir: getanyaddir(); break;
- case addr_getopenedsize: getopenedsize(); break;
- case addr_getsetad: getsetad(); break;
- case addr_findinvpos: findinvpos(); break;
- case addr_findopenpos: findopenpos(); break;
- case addr_dropobject: dropobject(); break;
- case addr_droperror: droperror(); break;
- case addr_cantdrop: cantdrop(); break;
- case addr_wornerror: wornerror(); break;
- case addr_removeobfrominv: removeobfrominv(); break;
- case addr_selectopenob: selectopenob(); break;
- case addr_useopened: useopened(); break;
- case addr_errormessage1: errormessage1(); break;
- case addr_errormessage2: errormessage2(); break;
- case addr_errormessage3: errormessage3(); break;
- case addr_checkobjectsize: checkobjectsize(); break;
- case addr_outofopen: outofopen(); break;
- case addr_transfertoex: transfertoex(); break;
- case addr_pickupconts: pickupconts(); break;
- case addr_transfercontoex: transfercontoex(); break;
- case addr_transfertext: transfertext(); break;
- case addr_purgealocation: purgealocation(); break;
- case addr_emergencypurge: emergencypurge(); break;
- case addr_purgeanitem: purgeanitem(); break;
- case addr_deleteexobject: deleteexobject(); break;
- case addr_deleteexframe: deleteexframe(); break;
- case addr_deleteextext: deleteextext(); break;
- case addr_blockget: blockget(); break;
- case addr_drawfloor: drawfloor(); break;
- case addr_autolook: autolook(); break;
- case addr_look: look(); break;
- case addr_dolook: dolook(); break;
- case addr_redrawmainscrn: redrawmainscrn(); break;
- case addr_getback1: getback1(); break;
- case addr_talk: talk(); break;
- case addr_convicons: convicons(); break;
- case addr_getpersframe: getpersframe(); break;
- case addr_starttalk: starttalk(); break;
- case addr_getpersontext: getpersontext(); break;
- case addr_moretalk: moretalk(); break;
- case addr_dosometalk: dosometalk(); break;
- case addr_hangonpq: hangonpq(); break;
- case addr_redes: redes(); break;
- case addr_newplace: newplace(); break;
- case addr_selectlocation: selectlocation(); break;
- case addr_showcity: showcity(); break;
- case addr_lookatplace: lookatplace(); break;
- case addr_getundercentre: getundercentre(); break;
- case addr_putundercentre: putundercentre(); break;
- case addr_locationpic: locationpic(); break;
- case addr_getdestinfo: getdestinfo(); break;
- case addr_showarrows: showarrows(); break;
- case addr_nextdest: nextdest(); break;
- case addr_lastdest: lastdest(); break;
- case addr_destselect: destselect(); break;
- case addr_getlocation: getlocation(); break;
- case addr_setlocation: setlocation(); break;
- case addr_resetlocation: resetlocation(); break;
- case addr_readdesticon: readdesticon(); break;
- case addr_readcitypic: readcitypic(); break;
- case addr_usemon: usemon(); break;
- case addr_printoutermon: printoutermon(); break;
- case addr_loadpersonal: loadpersonal(); break;
- case addr_loadnews: loadnews(); break;
- case addr_loadcart: loadcart(); break;
- case addr_lookininterface: lookininterface(); break;
- case addr_turnonpower: turnonpower(); break;
- case addr_randomaccess: randomaccess(); break;
- case addr_powerlighton: powerlighton(); break;
- case addr_powerlightoff: powerlightoff(); break;
- case addr_accesslighton: accesslighton(); break;
- case addr_accesslightoff: accesslightoff(); break;
- case addr_locklighton: locklighton(); break;
- case addr_locklightoff: locklightoff(); break;
- case addr_input: input(); break;
- case addr_makecaps: makecaps(); break;
- case addr_delchar: delchar(); break;
- case addr_execcommand: execcommand(); break;
- case addr_neterror: neterror(); break;
- case addr_dircom: dircom(); break;
- case addr_searchforfiles: searchforfiles(); break;
- case addr_signon: signon(); break;
- case addr_showkeys: showkeys(); break;
- case addr_read: read(); break;
- case addr_dirfile: dirfile(); break;
- case addr_getkeyandlogo: getkeyandlogo(); break;
- case addr_searchforstring: searchforstring(); break;
- case addr_parser: parser(); break;
- case addr_scrollmonitor: scrollmonitor(); break;
- case addr_monitorlogo: monitorlogo(); break;
- case addr_printlogo: printlogo(); break;
- case addr_showcurrentfile: showcurrentfile(); break;
- case addr_monmessage: monmessage(); break;
- case addr_processtrigger: processtrigger(); break;
- case addr_triggermessage: triggermessage(); break;
- case addr_printcurs: printcurs(); break;
- case addr_delcurs: delcurs(); break;
- case addr_useobject: useobject(); break;
- case addr_wheelsound: wheelsound(); break;
- case addr_runtap: runtap(); break;
- case addr_playguitar: playguitar(); break;
- case addr_hotelcontrol: hotelcontrol(); break;
- case addr_hotelbell: hotelbell(); break;
- case addr_opentomb: opentomb(); break;
- case addr_usetrainer: usetrainer(); break;
- case addr_nothelderror: nothelderror(); break;
- case addr_usepipe: usepipe(); break;
- case addr_usefullcart: usefullcart(); break;
- case addr_useplinth: useplinth(); break;
- case addr_chewy: chewy(); break;
- case addr_useladder: useladder(); break;
- case addr_useladderb: useladderb(); break;
- case addr_slabdoora: slabdoora(); break;
- case addr_slabdoorb: slabdoorb(); break;
- case addr_slabdoord: slabdoord(); break;
- case addr_slabdoorc: slabdoorc(); break;
- case addr_slabdoore: slabdoore(); break;
- case addr_slabdoorf: slabdoorf(); break;
- case addr_useslab: useslab(); break;
- case addr_usecart: usecart(); break;
- case addr_useclearbox: useclearbox(); break;
- case addr_usecoveredbox: usecoveredbox(); break;
- case addr_userailing: userailing(); break;
- case addr_useopenbox: useopenbox(); break;
- case addr_wearwatch: wearwatch(); break;
- case addr_wearshades: wearshades(); break;
- case addr_sitdowninbar: sitdowninbar(); break;
- case addr_usechurchhole: usechurchhole(); break;
- case addr_usehole: usehole(); break;
- case addr_usealtar: usealtar(); break;
- case addr_opentvdoor: opentvdoor(); break;
- case addr_usedryer: usedryer(); break;
- case addr_openlouis: openlouis(); break;
- case addr_nextcolon: nextcolon(); break;
- case addr_openyourneighbour: openyourneighbour(); break;
- case addr_usewindow: usewindow(); break;
- case addr_usebalcony: usebalcony(); break;
- case addr_openryan: openryan(); break;
- case addr_openpoolboss: openpoolboss(); break;
- case addr_openeden: openeden(); break;
- case addr_opensarters: opensarters(); break;
- case addr_isitright: isitright(); break;
- case addr_drawitall: drawitall(); break;
- case addr_openhoteldoor: openhoteldoor(); break;
- case addr_openhoteldoor2: openhoteldoor2(); break;
- case addr_grafittidoor: grafittidoor(); break;
- case addr_trapdoor: trapdoor(); break;
- case addr_callhotellift: callhotellift(); break;
- case addr_calledenslift: calledenslift(); break;
- case addr_calledensdlift: calledensdlift(); break;
- case addr_usepoolreader: usepoolreader(); break;
- case addr_uselighter: uselighter(); break;
- case addr_showseconduse: showseconduse(); break;
- case addr_usecardreader1: usecardreader1(); break;
- case addr_usecardreader2: usecardreader2(); break;
- case addr_usecardreader3: usecardreader3(); break;
- case addr_usecashcard: usecashcard(); break;
- case addr_lookatcard: lookatcard(); break;
- case addr_moneypoke: moneypoke(); break;
- case addr_usecontrol: usecontrol(); break;
- case addr_usehatch: usehatch(); break;
- case addr_usewire: usewire(); break;
- case addr_usehandle: usehandle(); break;
- case addr_useelevator1: useelevator1(); break;
- case addr_showfirstuse: showfirstuse(); break;
- case addr_useelevator3: useelevator3(); break;
- case addr_useelevator4: useelevator4(); break;
- case addr_useelevator2: useelevator2(); break;
- case addr_useelevator5: useelevator5(); break;
- case addr_usekey: usekey(); break;
- case addr_usestereo: usestereo(); break;
- case addr_usecooker: usecooker(); break;
- case addr_useaxe: useaxe(); break;
- case addr_useelvdoor: useelvdoor(); break;
- case addr_withwhat: withwhat(); break;
- case addr_selectob: selectob(); break;
- case addr_findsetobject: findsetobject(); break;
- case addr_findexobject: findexobject(); break;
- case addr_isryanholding: isryanholding(); break;
- case addr_checkinside: checkinside(); break;
- case addr_putbackobstuff: putbackobstuff(); break;
- case addr_showpuztext: showpuztext(); break;
- case addr_findpuztext: findpuztext(); break;
- case addr_issetobonmap: issetobonmap(); break;
- case addr_placefreeobject: placefreeobject(); break;
- case addr_removefreeobject: removefreeobject(); break;
- case addr_switchryanon: switchryanon(); break;
- case addr_switchryanoff: switchryanoff(); break;
- case addr_autoappear: autoappear(); break;
- case addr_setuptimeduse: setuptimeduse(); break;
- case addr_edenscdplayer: edenscdplayer(); break;
- case addr_usewall: usewall(); break;
- case addr_usechurchgate: usechurchgate(); break;
- case addr_usegun: usegun(); break;
- case addr_useshield: useshield(); break;
- case addr_usebuttona: usebuttona(); break;
- case addr_useplate: useplate(); break;
- case addr_usewinch: usewinch(); break;
- case addr_entercode: entercode(); break;
- case addr_loadkeypad: loadkeypad(); break;
- case addr_quitkey: quitkey(); break;
- case addr_addtopresslist: addtopresslist(); break;
- case addr_buttonone: buttonone(); break;
- case addr_buttontwo: buttontwo(); break;
- case addr_buttonthree: buttonthree(); break;
- case addr_buttonfour: buttonfour(); break;
- case addr_buttonfive: buttonfive(); break;
- case addr_buttonsix: buttonsix(); break;
- case addr_buttonseven: buttonseven(); break;
- case addr_buttoneight: buttoneight(); break;
- case addr_buttonnine: buttonnine(); break;
- case addr_buttonnought: buttonnought(); break;
- case addr_buttonenter: buttonenter(); break;
- case addr_buttonpress: buttonpress(); break;
- case addr_showouterpad: showouterpad(); break;
- case addr_showkeypad: showkeypad(); break;
- case addr_singlekey: singlekey(); break;
- case addr_dumpkeypad: dumpkeypad(); break;
- case addr_usemenu: usemenu(); break;
- case addr_dumpmenu: dumpmenu(); break;
- case addr_getundermenu: getundermenu(); break;
- case addr_putundermenu: putundermenu(); break;
- case addr_showoutermenu: showoutermenu(); break;
- case addr_showmenu: showmenu(); break;
- case addr_loadmenu: loadmenu(); break;
- case addr_viewfolder: viewfolder(); break;
- case addr_nextfolder: nextfolder(); break;
- case addr_folderhints: folderhints(); break;
- case addr_lastfolder: lastfolder(); break;
- case addr_loadfolder: loadfolder(); break;
- case addr_showfolder: showfolder(); break;
- case addr_folderexit: folderexit(); break;
- case addr_showleftpage: showleftpage(); break;
- case addr_showrightpage: showrightpage(); break;
- case addr_entersymbol: entersymbol(); break;
- case addr_quitsymbol: quitsymbol(); break;
- case addr_settopleft: settopleft(); break;
- case addr_settopright: settopright(); break;
- case addr_setbotleft: setbotleft(); break;
- case addr_setbotright: setbotright(); break;
- case addr_dumpsymbol: dumpsymbol(); break;
- case addr_showsymbol: showsymbol(); break;
- case addr_nextsymbol: nextsymbol(); break;
- case addr_updatesymboltop: updatesymboltop(); break;
- case addr_updatesymbolbot: updatesymbolbot(); break;
- case addr_dumpsymbox: dumpsymbox(); break;
- case addr_usediary: usediary(); break;
- case addr_showdiary: showdiary(); break;
- case addr_showdiarykeys: showdiarykeys(); break;
- case addr_dumpdiarykeys: dumpdiarykeys(); break;
- case addr_diarykeyp: diarykeyp(); break;
- case addr_diarykeyn: diarykeyn(); break;
- case addr_showdiarypage: showdiarypage(); break;
- case addr_findtext1: findtext1(); break;
- case addr_zoomonoff: zoomonoff(); break;
- case addr_saveload: saveload(); break;
- case addr_dosaveload: dosaveload(); break;
- case addr_getbackfromops: getbackfromops(); break;
- case addr_showmainops: showmainops(); break;
- case addr_showdiscops: showdiscops(); break;
- case addr_loadsavebox: loadsavebox(); break;
- case addr_loadgame: loadgame(); break;
- case addr_getbacktoops: getbacktoops(); break;
- case addr_discops: discops(); break;
- case addr_savegame: savegame(); break;
- case addr_actualsave: actualsave(); break;
- case addr_actualload: actualload(); break;
- case addr_selectslot2: selectslot2(); break;
- case addr_checkinput: checkinput(); break;
- case addr_getnamepos: getnamepos(); break;
- case addr_showopbox: showopbox(); break;
- case addr_showloadops: showloadops(); break;
- case addr_showsaveops: showsaveops(); break;
- case addr_selectslot: selectslot(); break;
- case addr_showslots: showslots(); break;
- case addr_shownames: shownames(); break;
- case addr_dosreturn: dosreturn(); break;
- case addr_error: error(); break;
- case addr_namestoold: namestoold(); break;
- case addr_oldtonames: oldtonames(); break;
- case addr_savefilewrite: savefilewrite(); break;
- case addr_savefileread: savefileread(); break;
- case addr_saveposition: saveposition(); break;
- case addr_loadposition: loadposition(); break;
- case addr_loadseg: loadseg(); break;
- case addr_makeheader: makeheader(); break;
- case addr_storeit: storeit(); break;
- case addr_saveseg: saveseg(); break;
- case addr_scanfornames: scanfornames(); break;
- case addr_decide: decide(); break;
- case addr_showdecisions: showdecisions(); break;
- case addr_newgame: newgame(); break;
- case addr_loadold: loadold(); break;
- case addr_loadspeech: loadspeech(); break;
- case addr_createname: createname(); break;
- case addr_loadsample: loadsample(); break;
- case addr_loadsecondsample: loadsecondsample(); break;
- case addr_soundstartup: soundstartup(); break;
- case addr_trysoundalloc: trysoundalloc(); break;
- case addr_setsoundoff: setsoundoff(); break;
- case addr_checksoundint: checksoundint(); break;
- case addr_enablesoundint: enablesoundint(); break;
- case addr_disablesoundint: disablesoundint(); break;
- case addr_interupttest: interupttest(); break;
- case addr_soundend: soundend(); break;
- case addr_out22c: out22c(); break;
- case addr_playchannel0: playchannel0(); break;
- case addr_playchannel1: playchannel1(); break;
- case addr_volumeadjust: volumeadjust(); break;
- case addr_channel0only: channel0only(); break;
- case addr_channel1only: channel1only(); break;
- case addr_bothchannels: bothchannels(); break;
- case addr_saveems: saveems(); break;
- case addr_restoreems: restoreems(); break;
- case addr_dmaend: dmaend(); break;
- case addr_startdmablock: startdmablock(); break;
- case addr_setuppit: setuppit(); break;
- case addr_getridofpit: getridofpit(); break;
- case addr_pitinterupt: pitinterupt(); break;
- case addr_dreamweb: dreamweb(); break;
- case addr_entrytexts: entrytexts(); break;
- case addr_entryanims: entryanims(); break;
- case addr_initialinv: initialinv(); break;
- case addr_pickupob: pickupob(); break;
- case addr_setupemm: setupemm(); break;
- case addr_removeemm: removeemm(); break;
- case addr_checkforemm: checkforemm(); break;
- case addr_checkbasemem: checkbasemem(); break;
- case addr_allocatebuffers: allocatebuffers(); break;
- case addr_clearbuffers: clearbuffers(); break;
- case addr_clearchanges: clearchanges(); break;
- case addr_clearbeforeload: clearbeforeload(); break;
- case addr_clearreels: clearreels(); break;
- case addr_clearrest: clearrest(); break;
- case addr_deallocatemem: deallocatemem(); break;
- case addr_allocatemem: allocatemem(); break;
- case addr_startup: startup(); break;
- case addr_startup1: startup1(); break;
- case addr_screenupdate: screenupdate(); break;
- case addr_watchreel: watchreel(); break;
- case addr_checkforshake: checkforshake(); break;
- case addr_watchcount: watchcount(); break;
- case addr_showtime: showtime(); break;
- case addr_dumpwatch: dumpwatch(); break;
- case addr_showbyte: showbyte(); break;
- case addr_onedigit: onedigit(); break;
- case addr_twodigitnum: twodigitnum(); break;
- case addr_showword: showword(); break;
- case addr_convnum: convnum(); break;
- case addr_mainscreen: mainscreen(); break;
- case addr_madmanrun: madmanrun(); break;
- case addr_identifyob: identifyob(); break;
- case addr_findpathofpoint: findpathofpoint(); break;
- case addr_findfirstpath: findfirstpath(); break;
- case addr_afternewroom: afternewroom(); break;
- case addr_atmospheres: atmospheres(); break;
- case addr_walkintoroom: walkintoroom(); break;
- case addr_afterintroroom: afterintroroom(); break;
- case addr_printmessage2: printmessage2(); break;
- case addr_setwalk: setwalk(); break;
- case addr_workoutframes: workoutframes(); break;
- case addr_showicon: showicon(); break;
- case addr_middlepanel: middlepanel(); break;
- case addr_showman: showman(); break;
- case addr_roomname: roomname(); break;
- case addr_usecharset1: usecharset1(); break;
- case addr_usetempcharset: usetempcharset(); break;
- case addr_showexit: showexit(); break;
- case addr_panelicons1: panelicons1(); break;
- case addr_showwatch: showwatch(); break;
- case addr_gettime: gettime(); break;
- case addr_zoomicon: zoomicon(); break;
- case addr_worktoscreenm: worktoscreenm(); break;
- case addr_blank: blank(); break;
- case addr_allpointer: allpointer(); break;
- case addr_hangonw: hangonw(); break;
- case addr_hangoncurs: hangoncurs(); break;
- case addr_getunderzoom: getunderzoom(); break;
- case addr_dumpzoom: dumpzoom(); break;
- case addr_putunderzoom: putunderzoom(); break;
- case addr_undertextline: undertextline(); break;
- case addr_setmouse: setmouse(); break;
- case addr_mousecall: mousecall(); break;
- case addr_readkey: readkey(); break;
- case addr_randomnum1: randomnum1(); break;
- case addr_randomnum2: randomnum2(); break;
- case addr_loadtraveltext: loadtraveltext(); break;
- case addr_loadintotemp: loadintotemp(); break;
- case addr_loadintotemp2: loadintotemp2(); break;
- case addr_loadintotemp3: loadintotemp3(); break;
- case addr_loadtempcharset: loadtempcharset(); break;
- case addr_standardload: standardload(); break;
- case addr_loadtemptext: loadtemptext(); break;
- case addr_loadroom: loadroom(); break;
- case addr_loadroomssample: loadroomssample(); break;
- case addr_getridofreels: getridofreels(); break;
- case addr_getridofall: getridofall(); break;
- case addr_restorereels: restorereels(); break;
- case addr_restoreall: restoreall(); break;
- case addr_sortoutmap: sortoutmap(); break;
- case addr_disablepath: disablepath(); break;
- case addr_findroominloc: findroominloc(); break;
- case addr_dontloadseg: dontloadseg(); break;
- case addr_allocateload: allocateload(); break;
- case addr_getridoftemp: getridoftemp(); break;
- case addr_getridoftemptext: getridoftemptext(); break;
- case addr_getridoftemp2: getridoftemp2(); break;
- case addr_getridoftemp3: getridoftemp3(); break;
- case addr_getridoftempcharset: getridoftempcharset(); break;
- case addr_getridoftempsp: getridoftempsp(); break;
- case addr_readsetdata: readsetdata(); break;
- case addr_createfile: createfile(); break;
- case addr_openfile: openfile(); break;
- case addr_openfilefromc: openfilefromc(); break;
- case addr_openfilenocheck: openfilenocheck(); break;
- case addr_openforsave: openforsave(); break;
- case addr_closefile: closefile(); break;
- case addr_readfromfile: readfromfile(); break;
- case addr_setkeyboardint: setkeyboardint(); break;
- case addr_resetkeyboard: resetkeyboard(); break;
- case addr_keyboardread: keyboardread(); break;
- case addr_doload: doload(); break;
- case addr_generalerror: generalerror(); break;
- default: ::error("invalid call to %04x dispatched", (uint16)ax);
- }
+ dreamweb();
}
-} /*namespace*/
+} // End of namespace DreamGen
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 729b802b41..ae9bf3bb06 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -25,1977 +25,593 @@
*
*/
+#include "dreamweb/runtime.h"
+#include "dreamweb/structs.h"
+#include "dreamweb/dreambase.h"
+namespace DreamGen {
-#include "dreamweb/runtime.h"
+static const uint16 offset_rootdir = 0x0457;
+static const uint16 offset_money2poke = 0x0478;
+static const uint16 offset_keys = 0x03df;
+static const uint16 offset_money1poke = 0x0473;
+static const uint16 offset_comlist = 0x03a3;
+static const uint16 offset_openchangesize = 0x03a1;
+static const uint16 offset_commandline = 0x0480;
+static const uint16 offset_operand1 = 0x0449;
+static const uint16 kStartvars = 0;
+static const uint16 kProgresspoints = 1;
+static const uint16 kWatchon = 2;
+static const uint16 kShadeson = 3;
+static const uint16 kSecondcount = 4;
+static const uint16 kMinutecount = 5;
+static const uint16 kHourcount = 6;
+static const uint16 kZoomon = 7;
+static const uint16 kLocation = 8;
+static const uint16 kExpos = 9;
+static const uint16 kExframepos = 10;
+static const uint16 kExtextpos = 12;
+static const uint16 kCard1money = 14;
+static const uint16 kListpos = 16;
+static const uint16 kRyanpage = 18;
+static const uint16 kWatchingtime = 19;
+static const uint16 kReeltowatch = 21;
+static const uint16 kEndwatchreel = 23;
+static const uint16 kSpeedcount = 25;
+static const uint16 kWatchspeed = 26;
+static const uint16 kReeltohold = 27;
+static const uint16 kEndofholdreel = 29;
+static const uint16 kWatchmode = 31;
+static const uint16 kDestafterhold = 32;
+static const uint16 kNewsitem = 33;
+static const uint16 kLiftflag = 34;
+static const uint16 kLiftpath = 35;
+static const uint16 kLockstatus = 36;
+static const uint16 kDoorpath = 37;
+static const uint16 kCounttoopen = 38;
+static const uint16 kCounttoclose = 39;
+static const uint16 kRockstardead = 40;
+static const uint16 kGeneraldead = 41;
+static const uint16 kSartaindead = 42;
+static const uint16 kAidedead = 43;
+static const uint16 kBeenmugged = 44;
+static const uint16 kGunpassflag = 45;
+static const uint16 kCanmovealtar = 46;
+static const uint16 kTalkedtoattendant = 47;
+static const uint16 kTalkedtosparky = 48;
+static const uint16 kTalkedtoboss = 49;
+static const uint16 kTalkedtorecep = 50;
+static const uint16 kCardpassflag = 51;
+static const uint16 kMadmanflag = 52;
+static const uint16 kKeeperflag = 53;
+static const uint16 kLasttrigger = 54;
+static const uint16 kMandead = 55;
+static const uint16 kSeed = 56;
+static const uint16 kNeedtotravel = 59;
+static const uint16 kThroughdoor = 60;
+static const uint16 kNewobs = 61;
+static const uint16 kRyanon = 62;
+static const uint16 kCombatcount = 63;
+static const uint16 kLastweapon = 64;
+static const uint16 kDreamnumber = 65;
+static const uint16 kRoomafterdream = 66;
+static const uint16 kShakecounter = 67;
+static const uint16 kSpeechcount = 68;
+static const uint16 kCharshift = 69;
+static const uint16 kKerning = 71;
+static const uint16 kBrightness = 72;
+static const uint16 kRoomloaded = 73;
+static const uint16 kDidzoom = 74;
+static const uint16 kLinespacing = 75;
+static const uint16 kTextaddressx = 77;
+static const uint16 kTextaddressy = 79;
+static const uint16 kTextlen = 81;
+static const uint16 kLastxpos = 82;
+static const uint16 kIcontop = 84;
+static const uint16 kIconleft = 86;
+static const uint16 kItemframe = 88;
+static const uint16 kItemtotran = 89;
+static const uint16 kRoomad = 90;
+static const uint16 kOldsubject = 92;
+static const uint16 kWithobject = 94;
+static const uint16 kWithtype = 95;
+static const uint16 kLookcounter = 96;
+static const uint16 kCommand = 98;
+static const uint16 kCommandtype = 99;
+static const uint16 kOldcommandtype = 100;
+static const uint16 kObjecttype = 101;
+static const uint16 kGetback = 102;
+static const uint16 kInvopen = 103;
+static const uint16 kMainmode = 104;
+static const uint16 kPickup = 105;
+static const uint16 kLastinvpos = 106;
+static const uint16 kExamagain = 107;
+static const uint16 kNewtextline = 108;
+static const uint16 kOpenedob = 109;
+static const uint16 kOpenedtype = 110;
+static const uint16 kOldmapadx = 111;
+static const uint16 kOldmapady = 113;
+static const uint16 kMapadx = 115;
+static const uint16 kMapady = 117;
+static const uint16 kMapoffsetx = 119;
+static const uint16 kMapoffsety = 121;
+static const uint16 kMapxstart = 123;
+static const uint16 kMapystart = 125;
+static const uint16 kMapxsize = 127;
+static const uint16 kMapysize = 128;
+static const uint16 kHavedoneobs = 129;
+static const uint16 kManisoffscreen = 130;
+static const uint16 kRainspace = 131;
+static const uint16 kFacing = 132;
+static const uint16 kLeavedirection = 133;
+static const uint16 kTurntoface = 134;
+static const uint16 kTurndirection = 135;
+static const uint16 kMaintimer = 136;
+static const uint16 kIntrocount = 138;
+static const uint16 kArrowad = 139;
+static const uint16 kCurrentkey = 141;
+static const uint16 kOldkey = 142;
+static const uint16 kUseddirection = 143;
+static const uint16 kCurrentkey2 = 144;
+static const uint16 kTimercount = 145;
+static const uint16 kOldtimercount = 146;
+static const uint16 kMapx = 147;
+static const uint16 kMapy = 148;
+static const uint16 kNewscreen = 149;
+static const uint16 kRyanx = 150;
+static const uint16 kRyany = 151;
+static const uint16 kLastflag = 152;
+static const uint16 kLastflagex = 153;
+static const uint16 kFlagx = 154;
+static const uint16 kFlagy = 155;
+static const uint16 kCurrentex = 156;
+static const uint16 kCurrentfree = 157;
+static const uint16 kFramesad = 158;
+static const uint16 kDataad = 160;
+static const uint16 kFrsegment = 162;
+static const uint16 kObjectx = 164;
+static const uint16 kObjecty = 166;
+static const uint16 kOffsetx = 168;
+static const uint16 kOffsety = 170;
+static const uint16 kSavesize = 172;
+static const uint16 kSavesource = 174;
+static const uint16 kSavex = 176;
+static const uint16 kSavey = 177;
+static const uint16 kCurrentob = 178;
+static const uint16 kPrioritydep = 179;
+static const uint16 kDestpos = 180;
+static const uint16 kReallocation = 181;
+static const uint16 kRoomnum = 182;
+static const uint16 kNowinnewroom = 183;
+static const uint16 kResetmanxy = 184;
+static const uint16 kNewlocation = 185;
+static const uint16 kAutolocation = 186;
+static const uint16 kMustload = 187;
+static const uint16 kAnswered = 188;
+static const uint16 kSaidno = 189;
+static const uint16 kDoorcheck1 = 190;
+static const uint16 kDoorcheck2 = 191;
+static const uint16 kDoorcheck3 = 192;
+static const uint16 kDoorcheck4 = 193;
+static const uint16 kMousex = 194;
+static const uint16 kMousey = 196;
+static const uint16 kMousebutton = 198;
+static const uint16 kMousebutton1 = 200;
+static const uint16 kMousebutton2 = 202;
+static const uint16 kMousebutton3 = 204;
+static const uint16 kMousebutton4 = 206;
+static const uint16 kOldbutton = 208;
+static const uint16 kOldx = 210;
+static const uint16 kOldy = 212;
+static const uint16 kLastbutton = 214;
+static const uint16 kOldpointerx = 216;
+static const uint16 kOldpointery = 218;
+static const uint16 kDelherex = 220;
+static const uint16 kDelherey = 222;
+static const uint16 kPointerxs = 224;
+static const uint16 kPointerys = 225;
+static const uint16 kDelxs = 226;
+static const uint16 kDelys = 227;
+static const uint16 kPointerframe = 228;
+static const uint16 kPointerpower = 229;
+static const uint16 kAuxpointerframe = 230;
+static const uint16 kPointermode = 231;
+static const uint16 kPointerspeed = 232;
+static const uint16 kPointercount = 233;
+static const uint16 kInmaparea = 234;
+static const uint16 kSlotdata = 235;
+static const uint16 kThisslot = 236;
+static const uint16 kSlotflags = 237;
+static const uint16 kTalkmode = 238;
+static const uint16 kTalkpos = 239;
+static const uint16 kCharacter = 240;
+static const uint16 kPersondata = 241;
+static const uint16 kTalknum = 243;
+static const uint16 kNumberinroom = 244;
+static const uint16 kCurrentcel = 245;
+static const uint16 kOldselection = 246;
+static const uint16 kStopwalking = 247;
+static const uint16 kMouseon = 248;
+static const uint16 kPlayed = 249;
+static const uint16 kTimer1 = 251;
+static const uint16 kTimer2 = 252;
+static const uint16 kTimer3 = 253;
+static const uint16 kWholetimer = 254;
+static const uint16 kTimer1to = 256;
+static const uint16 kTimer2to = 257;
+static const uint16 kTimer3to = 258;
+static const uint16 kWatchdump = 259;
+static const uint16 kLogonum = 260;
+static const uint16 kOldlogonum = 261;
+static const uint16 kNewlogonum = 262;
+static const uint16 kNetseg = 263;
+static const uint16 kNetpoint = 265;
+static const uint16 kKeynum = 267;
+static const uint16 kCursorstate = 268;
+static const uint16 kPressed = 269;
+static const uint16 kPresspointer = 270;
+static const uint16 kGraphicpress = 272;
+static const uint16 kPresscount = 273;
+static const uint16 kKeypadax = 274;
+static const uint16 kKeypadcx = 276;
+static const uint16 kLightcount = 278;
+static const uint16 kFolderpage = 279;
+static const uint16 kDiarypage = 280;
+static const uint16 kMenucount = 281;
+static const uint16 kSymboltopx = 282;
+static const uint16 kSymboltopnum = 283;
+static const uint16 kSymboltopdir = 284;
+static const uint16 kSymbolbotx = 285;
+static const uint16 kSymbolbotnum = 286;
+static const uint16 kSymbolbotdir = 287;
+static const uint16 kSymboltolight = 288;
+static const uint16 kSymbol1 = 289;
+static const uint16 kSymbol2 = 290;
+static const uint16 kSymbol3 = 291;
+static const uint16 kSymbolnum = 292;
+static const uint16 kDumpx = 293;
+static const uint16 kDumpy = 295;
+static const uint16 kWalkandexam = 297;
+static const uint16 kWalkexamtype = 298;
+static const uint16 kWalkexamnum = 299;
+static const uint16 kCursloc = 300;
+static const uint16 kCurslocx = 302;
+static const uint16 kCurslocy = 304;
+static const uint16 kCurpos = 306;
+static const uint16 kMonadx = 308;
+static const uint16 kMonady = 310;
+static const uint16 kGotfrom = 312;
+static const uint16 kMonsource = 314;
+static const uint16 kNumtodo = 316;
+static const uint16 kTimecount = 318;
+static const uint16 kCounttotimed = 320;
+static const uint16 kTimedseg = 322;
+static const uint16 kTimedoffset = 324;
+static const uint16 kTimedy = 326;
+static const uint16 kTimedx = 327;
+static const uint16 kNeedtodumptimed = 328;
+static const uint16 kLoadingorsave = 329;
+static const uint16 kCurrentslot = 330;
+static const uint16 kCursorpos = 331;
+static const uint16 kColourpos = 332;
+static const uint16 kFadedirection = 333;
+static const uint16 kNumtofade = 334;
+static const uint16 kFadecount = 335;
+static const uint16 kAddtogreen = 336;
+static const uint16 kAddtored = 337;
+static const uint16 kAddtoblue = 338;
+static const uint16 kLastsoundreel = 339;
+static const uint16 kSpeechloaded = 341;
+static const uint16 kSpeechlength = 342;
+static const uint16 kVolume = 344;
+static const uint16 kVolumeto = 345;
+static const uint16 kVolumedirection = 346;
+static const uint16 kVolumecount = 347;
+static const uint16 kPlayblock = 348;
+static const uint16 kWongame = 349;
+static const uint16 kLasthardkey = 350;
+static const uint16 kBufferin = 351;
+static const uint16 kBufferout = 353;
+static const uint16 kExtras = 355;
+static const uint16 kWorkspace = 357;
+static const uint16 kMapstore = 359;
+static const uint16 kCharset1 = 361;
+static const uint16 kBuffers = 363;
+static const uint16 kMainsprites = 365;
+static const uint16 kBackdrop = 367;
+static const uint16 kMapdata = 369;
+static const uint16 kSounddata = 371;
+static const uint16 kSounddata2 = 373;
+static const uint16 kRecordspace = 375;
+static const uint16 kFreedat = 377;
+static const uint16 kSetdat = 379;
+static const uint16 kReel1 = 381;
+static const uint16 kReel2 = 383;
+static const uint16 kReel3 = 385;
+static const uint16 kRoomdesc = 387;
+static const uint16 kFreedesc = 389;
+static const uint16 kSetdesc = 391;
+static const uint16 kBlockdesc = 393;
+static const uint16 kSetframes = 395;
+static const uint16 kFreeframes = 397;
+static const uint16 kPeople = 399;
+static const uint16 kReels = 401;
+static const uint16 kCommandtext = 403;
+static const uint16 kPuzzletext = 405;
+static const uint16 kTraveltext = 407;
+static const uint16 kTempgraphics = 409;
+static const uint16 kTempgraphics2 = 411;
+static const uint16 kTempgraphics3 = 413;
+static const uint16 kTempsprites = 415;
+static const uint16 kTextfile1 = 417;
+static const uint16 kTextfile2 = 419;
+static const uint16 kTextfile3 = 421;
+static const uint16 kBlinkframe = 423;
+static const uint16 kBlinkcount = 424;
+static const uint16 kReasseschanges = 425;
+static const uint16 kPointerspath = 426;
+static const uint16 kManspath = 427;
+static const uint16 kPointerfirstpath = 428;
+static const uint16 kFinaldest = 429;
+static const uint16 kDestination = 430;
+static const uint16 kLinestartx = 431;
+static const uint16 kLinestarty = 433;
+static const uint16 kLineendx = 435;
+static const uint16 kLineendy = 437;
+static const uint16 kIncrement1 = 439;
+static const uint16 kIncrement2 = 441;
+static const uint16 kLineroutine = 443;
+static const uint16 kLinepointer = 444;
+static const uint16 kLinedirection = 445;
+static const uint16 kLinelength = 446;
+static const uint16 kLiftsoundcount = 447;
+static const uint16 kCh0blockstocopy = 448;
+static const uint16 kCh0playing = 450;
+static const uint16 kCh0repeat = 451;
+static const uint16 kCh1playing = 452;
+static const uint16 kCh1blockstocopy = 453;
+static const uint16 kSoundbufferwrite = 455;
+static const uint16 kCurrentsample = 457;
+static const uint16 kRoomssample = 458;
+static const uint16 kReelroutines = 459;
+static const uint16 kBasicsample = 916;
+static const uint16 kCurrentfile = 1125;
+static const uint16 kRoomscango = 1249;
+static const uint16 kRoompics = 1265;
+static const uint16 kOplist = 1280;
+static const uint16 kInputline = 1283;
+static const uint16 kPresslist = 1411;
+static const uint16 kQuitrequested = 1417;
+static const uint16 kSubtitles = 1418;
+static const uint16 kForeignrelease = 1419;
+static const uint16 kBlocktextdat = (0);
+static const uint16 kPersonframes = (0);
+static const uint16 kDebuglevel1 = (0);
+static const uint16 kDebuglevel2 = (0);
+static const uint16 kPlayback = (0);
+static const uint16 kMap = (0);
+static const uint16 kSettextdat = (0);
+static const uint16 kSpanish = (0);
+static const uint16 kFramedata = (0);
+static const uint16 kRecording = (0);
+static const uint16 kFlags = (0);
+static const uint16 kGerman = (0);
+static const uint16 kTextunder = (0);
+static const uint16 kPathdata = (0);
+static const uint16 kDemo = (0);
+static const uint16 kExframedata = (0);
+static const uint16 kIntextdat = (0);
+static const uint16 kFreetextdat = (0);
+static const uint16 kFrframedata = (0);
+static const uint16 kSettext = (0+(130*2));
+static const uint16 kOpeninvlist = (0+(228*13));
+static const uint16 kRyaninvlist = (0+(228*13)+32);
+static const uint16 kPointerback = (0+(228*13)+32+60);
+static const uint16 kMapflags = (0+(228*13)+32+60+(32*32));
+static const uint16 kStartpal = (0+(228*13)+32+60+(32*32)+(11*10*3));
+static const uint16 kEndpal = (0+(228*13)+32+60+(32*32)+(11*10*3)+768);
+static const uint16 kMaingamepal = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768);
+static const uint16 kSpritetable = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768);
+static const uint16 kSetlist = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32));
+static const uint16 kFreelist = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5));
+static const uint16 kExlist = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5));
+static const uint16 kPeoplelist = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5));
+static const uint16 kZoomspace = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5));
+static const uint16 kPrintedlist = (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));
+static const uint16 kListofchanges = (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)+(5*80));
+static const uint16 kUndertimedtext = (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)+(5*80)+(250*4));
+static const uint16 kRainlist = (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)+(5*80)+(250*4)+(256*30));
+static const uint16 kInitialreelrouts = (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)+(5*80)+(250*4)+(256*30)+(6*64));
+static const uint16 kInitialvars = (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)+(5*80)+(250*4)+(256*30)+(6*64)+916-459);
+static const uint16 kLengthofbuffer = (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)+(5*80)+(250*4)+(256*30)+(6*64)+916-459+68-0);
+static const uint16 kReellist = (0+(36*144));
+static const uint16 kIntext = (0+(38*2));
+static const uint16 kLengthofmap = (0+(66*60));
+static const uint16 kFreetext = (0+(82*2));
+static const uint16 kBlocktext = (0+(98*2));
+static const uint16 kBlocks = (0+192);
+static const uint16 kFrframes = (0+2080);
+static const uint16 kExframes = (0+2080);
+static const uint16 kFrames = (0+2080);
+static const uint16 kExdata = (0+2080+30000);
+static const uint16 kExtextdat = (0+2080+30000+(16*114));
+static const uint16 kExtext = (0+2080+30000+(16*114)+((114+2)*2));
+static const uint16 kLengthofextra = (0+2080+30000+(16*114)+((114+2)*2)+18000);
+static const uint16 kPersontxtdat = (0+24);
+static const uint16 kPersontext = (0+24+(1026*2));
+static const uint16 kInputport = (0x63);
+static const uint16 kForeign = (1);
+static const uint16 kCd = (1);
+static const uint16 kNumexobjects = (114);
+static const uint16 kUndertextsizey = (13);
+static const uint16 kZoomy = (132);
+static const uint16 kFreedatlen = (16*80);
+static const uint16 kExtextlen = (18000);
+static const uint16 kLenofmapstore = (22*8*20*8);
+static const uint16 kUndertextsizex = (228);
+static const uint16 kNumchanges = (250);
+static const uint16 kUndertimedysize = (30);
+static const uint16 kExframeslen = (30000);
+static const uint16 kTablesize = (32);
+static const uint16 kScreenwidth = (320);
+static const uint16 kKeypadx = (36+112);
+static const uint16 kItempicsize = (44);
+static const uint16 kDiaryy = (48+12);
+static const uint16 kOpsy = (52);
+static const uint16 kSymboly = (56);
+static const uint16 kInventy = (58);
+static const uint16 kMenuy = (60);
+static const uint16 kOpsx = (60);
+static const uint16 kMaplength = (60);
+static const uint16 kSymbolx = (64);
+static const uint16 kSetdatlen = (64*128);
+static const uint16 kMapwidth = (66);
+static const uint16 kTextstart = (66*2);
+static const uint16 kMaplen = (66*60);
+static const uint16 kDiaryx = (68+24);
+static const uint16 kLengthofvars = (68-0);
+static const uint16 kKeypady = (72);
+static const uint16 kZoomx = (8);
+static const uint16 kInventx = (80);
+static const uint16 kMenux = (80+40);
+static const uint16 kLenofreelrouts = (916-459);
+static const uint16 kHeaderlen = (96);
-namespace DreamGen {
-#include "structs.h"
-class DreamGenContext : public Context {
+
+class DreamGenContext : public DreamBase, public Context {
public:
+ DreamGenContext(DreamWeb::DreamWebEngine *en) : DreamBase(en), Context(this) {}
+
void __start();
- void __dispatch_call(uint16 addr);
#include "stubs.h" // Allow hand-reversed functions to have a signature different than void f()
- static const uint16 addr_dreamweb = 0xc948;
- static const uint16 addr_keyboardread = 0xcbb4;
- static const uint16 addr_resetkeyboard = 0xcbb0;
- static const uint16 addr_setkeyboardint = 0xcbac;
- static const uint16 addr_readfromfile = 0xcba8;
- static const uint16 addr_closefile = 0xcba4;
- static const uint16 addr_openforsave = 0xcba0;
- static const uint16 addr_openfilenocheck = 0xcb9c;
- static const uint16 addr_openfilefromc = 0xcb94;
- static const uint16 addr_openfile = 0xcb90;
- static const uint16 addr_createfile = 0xcb8c;
- static const uint16 addr_readsetdata = 0xcb88;
- static const uint16 addr_getridoftempsp = 0xcb84;
- static const uint16 addr_getridoftempcharset = 0xcb80;
- static const uint16 addr_getridoftemp3 = 0xcb7c;
- static const uint16 addr_getridoftemp2 = 0xcb78;
- static const uint16 addr_getridoftemptext = 0xcb74;
- static const uint16 addr_getridoftemp = 0xcb70;
- static const uint16 addr_allocateload = 0xcb68;
- static const uint16 addr_dontloadseg = 0xcb64;
- static const uint16 addr_findroominloc = 0xcb58;
- static const uint16 addr_disablepath = 0xcb50;
- static const uint16 addr_sortoutmap = 0xcb48;
- static const uint16 addr_restoreall = 0xcb44;
- static const uint16 addr_restorereels = 0xcb40;
- static const uint16 addr_getridofall = 0xcb3c;
- static const uint16 addr_getridofreels = 0xcb38;
- static const uint16 addr_loadroomssample = 0xcb34;
- static const uint16 addr_loadroom = 0xcb30;
- static const uint16 addr_loadtemptext = 0xcb2c;
- static const uint16 addr_standardload = 0xcb28;
- static const uint16 addr_loadtempcharset = 0xcb24;
- static const uint16 addr_loadintotemp3 = 0xcb20;
- static const uint16 addr_loadintotemp2 = 0xcb1c;
- static const uint16 addr_loadintotemp = 0xcb18;
- static const uint16 addr_loadtraveltext = 0xcb14;
- static const uint16 addr_randomnum2 = 0xcb08;
- static const uint16 addr_randomnum1 = 0xcb04;
- static const uint16 addr_readkey = 0xcafc;
- static const uint16 addr_mousecall = 0xcae8;
- static const uint16 addr_setmouse = 0xcae0;
- static const uint16 addr_undertextline = 0xcad0;
- static const uint16 addr_putunderzoom = 0xcabc;
- static const uint16 addr_dumpzoom = 0xcab8;
- static const uint16 addr_getunderzoom = 0xcab4;
- static const uint16 addr_hangoncurs = 0xcab0;
- static const uint16 addr_hangonw = 0xcaac;
- static const uint16 addr_allpointer = 0xcaa4;
- static const uint16 addr_blank = 0xcaa0;
- static const uint16 addr_worktoscreenm = 0xca9c;
- static const uint16 addr_zoomicon = 0xca90;
- static const uint16 addr_gettime = 0xca8c;
- static const uint16 addr_showwatch = 0xca88;
- static const uint16 addr_panelicons1 = 0xca84;
- static const uint16 addr_showexit = 0xca80;
- static const uint16 addr_usetempcharset = 0xca7c;
- static const uint16 addr_usecharset1 = 0xca78;
- static const uint16 addr_roomname = 0xca74;
- static const uint16 addr_showman = 0xca6c;
- static const uint16 addr_middlepanel = 0xca68;
- static const uint16 addr_showicon = 0xca64;
- static const uint16 addr_workoutframes = 0xca54;
- static const uint16 addr_setwalk = 0xca44;
- static const uint16 addr_printmessage2 = 0xca30;
- 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_findfirstpath = 0xc9f0;
- static const uint16 addr_findpathofpoint = 0xc9ec;
- static const uint16 addr_identifyob = 0xc9d4;
- static const uint16 addr_madmanrun = 0xc9cc;
- static const uint16 addr_mainscreen = 0xc9c8;
- static const uint16 addr_convnum = 0xc9c4;
- static const uint16 addr_showword = 0xc9c0;
- static const uint16 addr_twodigitnum = 0xc9bc;
- static const uint16 addr_onedigit = 0xc9b8;
- static const uint16 addr_showbyte = 0xc9b4;
- static const uint16 addr_dumpwatch = 0xc9b0;
- static const uint16 addr_showtime = 0xc9ac;
- static const uint16 addr_watchcount = 0xc9a8;
- static const uint16 addr_checkforshake = 0xc9a4;
- static const uint16 addr_watchreel = 0xc9a0;
- static const uint16 addr_screenupdate = 0xc99c;
- static const uint16 addr_startup1 = 0xc998;
- static const uint16 addr_startup = 0xc994;
- static const uint16 addr_allocatemem = 0xc988;
- static const uint16 addr_deallocatemem = 0xc984;
- static const uint16 addr_clearrest = 0xc980;
- static const uint16 addr_clearreels = 0xc97c;
- static const uint16 addr_clearbeforeload = 0xc978;
- static const uint16 addr_clearchanges = 0xc974;
- static const uint16 addr_clearbuffers = 0xc970;
- static const uint16 addr_allocatebuffers = 0xc96c;
- static const uint16 addr_checkbasemem = 0xc968;
- static const uint16 addr_checkforemm = 0xc964;
- static const uint16 addr_removeemm = 0xc960;
- static const uint16 addr_setupemm = 0xc95c;
- static const uint16 addr_pickupob = 0xc958;
- static const uint16 addr_initialinv = 0xc954;
- static const uint16 addr_entryanims = 0xc950;
- static const uint16 addr_entrytexts = 0xc94c;
- static const uint16 addr_pitinterupt = 0xc944;
- static const uint16 addr_getridofpit = 0xc940;
- static const uint16 addr_setuppit = 0xc93c;
- static const uint16 addr_startdmablock = 0xc938;
- static const uint16 addr_dmaend = 0xc934;
- static const uint16 addr_restoreems = 0xc92c;
- static const uint16 addr_saveems = 0xc928;
- static const uint16 addr_bothchannels = 0xc924;
- static const uint16 addr_channel1only = 0xc91c;
- static const uint16 addr_channel0only = 0xc918;
- static const uint16 addr_volumeadjust = 0xc908;
- static const uint16 addr_playchannel1 = 0xc900;
- static const uint16 addr_playchannel0 = 0xc8fc;
- static const uint16 addr_out22c = 0xc8f8;
- static const uint16 addr_soundend = 0xc8f4;
- static const uint16 addr_interupttest = 0xc8f0;
- static const uint16 addr_disablesoundint = 0xc8ec;
- static const uint16 addr_enablesoundint = 0xc8e8;
- static const uint16 addr_checksoundint = 0xc8e4;
- static const uint16 addr_setsoundoff = 0xc8e0;
- static const uint16 addr_trysoundalloc = 0xc8dc;
- static const uint16 addr_soundstartup = 0xc8d8;
- static const uint16 addr_loadsecondsample = 0xc8d4;
- static const uint16 addr_loadsample = 0xc8d0;
- static const uint16 addr_createname = 0xc8cc;
- static const uint16 addr_loadspeech = 0xc8c8;
- static const uint16 addr_loadold = 0xc8c4;
- static const uint16 addr_doload = 0xcbb8;
- static const uint16 addr_newgame = 0xc8c0;
- static const uint16 addr_showdecisions = 0xc8bc;
- static const uint16 addr_decide = 0xc8b8;
- static const uint16 addr_scanfornames = 0xc8b4;
- static const uint16 addr_saveseg = 0xc8ac;
- static const uint16 addr_storeit = 0xc8a8;
- static const uint16 addr_makeheader = 0xc8a4;
- static const uint16 addr_loadseg = 0xc8a0;
- static const uint16 addr_loadposition = 0xc89c;
- static const uint16 addr_saveposition = 0xc898;
- static const uint16 addr_savefileread = 0xc894;
- static const uint16 addr_savefilewrite = 0xc890;
- static const uint16 addr_oldtonames = 0xc88c;
- static const uint16 addr_namestoold = 0xc888;
- static const uint16 addr_error = 0xc884;
- static const uint16 addr_generalerror = 0xcbbc;
- static const uint16 addr_dosreturn = 0xc880;
- static const uint16 addr_shownames = 0xc87c;
- static const uint16 addr_showslots = 0xc878;
- static const uint16 addr_selectslot = 0xc874;
- static const uint16 addr_showsaveops = 0xc870;
- static const uint16 addr_showloadops = 0xc86c;
- static const uint16 addr_showopbox = 0xc868;
- static const uint16 addr_getnamepos = 0xc864;
- static const uint16 addr_checkinput = 0xc860;
- static const uint16 addr_selectslot2 = 0xc85c;
- static const uint16 addr_actualload = 0xc858;
- static const uint16 addr_actualsave = 0xc854;
- static const uint16 addr_savegame = 0xc850;
- static const uint16 addr_discops = 0xc84c;
- static const uint16 addr_getbacktoops = 0xc848;
- static const uint16 addr_loadgame = 0xc844;
- static const uint16 addr_loadsavebox = 0xc840;
- static const uint16 addr_showdiscops = 0xc83c;
- static const uint16 addr_showmainops = 0xc838;
- static const uint16 addr_getbackfromops = 0xc834;
- static const uint16 addr_dosaveload = 0xc830;
- static const uint16 addr_saveload = 0xc82c;
- static const uint16 addr_zoomonoff = 0xc828;
- static const uint16 addr_findtext1 = 0xc824;
- static const uint16 addr_showdiarypage = 0xc820;
- static const uint16 addr_diarykeyn = 0xc81c;
- static const uint16 addr_diarykeyp = 0xc818;
- static const uint16 addr_dumpdiarykeys = 0xc814;
- static const uint16 addr_showdiarykeys = 0xc810;
- static const uint16 addr_showdiary = 0xc80c;
- static const uint16 addr_usediary = 0xc808;
- static const uint16 addr_dumpsymbox = 0xc804;
- static const uint16 addr_updatesymbolbot = 0xc800;
- static const uint16 addr_updatesymboltop = 0xc7fc;
- static const uint16 addr_nextsymbol = 0xc7f8;
- static const uint16 addr_showsymbol = 0xc7f4;
- static const uint16 addr_dumpsymbol = 0xc7f0;
- static const uint16 addr_setbotright = 0xc7ec;
- static const uint16 addr_setbotleft = 0xc7e8;
- static const uint16 addr_settopright = 0xc7e4;
- static const uint16 addr_settopleft = 0xc7e0;
- static const uint16 addr_quitsymbol = 0xc7dc;
- static const uint16 addr_entersymbol = 0xc7d8;
- static const uint16 addr_showrightpage = 0xc7d4;
- static const uint16 addr_showleftpage = 0xc7d0;
- static const uint16 addr_folderexit = 0xc7cc;
- static const uint16 addr_showfolder = 0xc7c8;
- static const uint16 addr_loadfolder = 0xc7c4;
- static const uint16 addr_lastfolder = 0xc7c0;
- static const uint16 addr_folderhints = 0xc7bc;
- static const uint16 addr_nextfolder = 0xc7b8;
- static const uint16 addr_viewfolder = 0xc7b4;
- static const uint16 addr_loadmenu = 0xc7b0;
- static const uint16 addr_showmenu = 0xc7ac;
- static const uint16 addr_showoutermenu = 0xc7a8;
- static const uint16 addr_putundermenu = 0xc7a4;
- static const uint16 addr_getundermenu = 0xc7a0;
- static const uint16 addr_dumpmenu = 0xc79c;
- static const uint16 addr_usemenu = 0xc798;
- static const uint16 addr_dumpkeypad = 0xc794;
- static const uint16 addr_singlekey = 0xc790;
- static const uint16 addr_showkeypad = 0xc78c;
- static const uint16 addr_showouterpad = 0xc788;
- static const uint16 addr_buttonpress = 0xc784;
- static const uint16 addr_buttonenter = 0xc780;
- static const uint16 addr_buttonnought = 0xc77c;
- static const uint16 addr_buttonnine = 0xc778;
- static const uint16 addr_buttoneight = 0xc774;
- static const uint16 addr_buttonseven = 0xc770;
- static const uint16 addr_buttonsix = 0xc76c;
- static const uint16 addr_buttonfive = 0xc768;
- static const uint16 addr_buttonfour = 0xc764;
- static const uint16 addr_buttonthree = 0xc760;
- static const uint16 addr_buttontwo = 0xc75c;
- static const uint16 addr_buttonone = 0xc758;
- static const uint16 addr_addtopresslist = 0xc754;
- static const uint16 addr_quitkey = 0xc750;
- static const uint16 addr_loadkeypad = 0xc74c;
- static const uint16 addr_entercode = 0xc748;
- static const uint16 addr_usewinch = 0xc744;
- static const uint16 addr_useplate = 0xc740;
- static const uint16 addr_usebuttona = 0xc73c;
- static const uint16 addr_useshield = 0xc738;
- static const uint16 addr_usegun = 0xc734;
- static const uint16 addr_usechurchgate = 0xc730;
- static const uint16 addr_usewall = 0xc72c;
- static const uint16 addr_edenscdplayer = 0xc728;
- static const uint16 addr_setuptimeduse = 0xc71c;
- static const uint16 addr_autoappear = 0xc70c;
- static const uint16 addr_switchryanoff = 0xc700;
- static const uint16 addr_switchryanon = 0xc6fc;
- static const uint16 addr_removefreeobject = 0xc6f4;
- static const uint16 addr_placefreeobject = 0xc6f0;
- static const uint16 addr_issetobonmap = 0xc6ec;
- static const uint16 addr_findpuztext = 0xc6e0;
- static const uint16 addr_showpuztext = 0xc6dc;
- static const uint16 addr_putbackobstuff = 0xc6d8;
- 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_selectob = 0xc6bc;
- static const uint16 addr_withwhat = 0xc6b8;
- static const uint16 addr_useelvdoor = 0xc6b4;
- static const uint16 addr_useaxe = 0xc6b0;
- static const uint16 addr_usecooker = 0xc6ac;
- static const uint16 addr_usestereo = 0xc6a8;
- static const uint16 addr_usekey = 0xc6a4;
- static const uint16 addr_useelevator5 = 0xc6a0;
- static const uint16 addr_useelevator2 = 0xc69c;
- static const uint16 addr_useelevator4 = 0xc698;
- static const uint16 addr_useelevator3 = 0xc694;
- static const uint16 addr_showfirstuse = 0xc690;
- static const uint16 addr_useelevator1 = 0xc68c;
- static const uint16 addr_usehandle = 0xc688;
- static const uint16 addr_usewire = 0xc684;
- static const uint16 addr_usehatch = 0xc680;
- static const uint16 addr_usecontrol = 0xc67c;
- static const uint16 addr_moneypoke = 0xc678;
- static const uint16 addr_lookatcard = 0xc674;
- static const uint16 addr_usecashcard = 0xc670;
- static const uint16 addr_usecardreader3 = 0xc66c;
- static const uint16 addr_usecardreader2 = 0xc668;
- static const uint16 addr_usecardreader1 = 0xc664;
- static const uint16 addr_showseconduse = 0xc660;
- static const uint16 addr_uselighter = 0xc65c;
- static const uint16 addr_usepoolreader = 0xc658;
- static const uint16 addr_calledensdlift = 0xc654;
- static const uint16 addr_calledenslift = 0xc650;
- static const uint16 addr_callhotellift = 0xc64c;
- static const uint16 addr_trapdoor = 0xc648;
- static const uint16 addr_grafittidoor = 0xc644;
- static const uint16 addr_openhoteldoor2 = 0xc640;
- static const uint16 addr_openhoteldoor = 0xc63c;
- static const uint16 addr_drawitall = 0xc638;
- static const uint16 addr_isitright = 0xc634;
- static const uint16 addr_opensarters = 0xc630;
- static const uint16 addr_openeden = 0xc62c;
- static const uint16 addr_openpoolboss = 0xc628;
- static const uint16 addr_openryan = 0xc624;
- static const uint16 addr_usebalcony = 0xc620;
- static const uint16 addr_usewindow = 0xc61c;
- static const uint16 addr_openyourneighbour = 0xc618;
- static const uint16 addr_nextcolon = 0xc614;
- static const uint16 addr_openlouis = 0xc610;
- static const uint16 addr_usedryer = 0xc60c;
- static const uint16 addr_opentvdoor = 0xc608;
- static const uint16 addr_usealtar = 0xc604;
- static const uint16 addr_usehole = 0xc600;
- static const uint16 addr_usechurchhole = 0xc5fc;
- static const uint16 addr_sitdowninbar = 0xc5f8;
- static const uint16 addr_wearshades = 0xc5f4;
- static const uint16 addr_wearwatch = 0xc5f0;
- static const uint16 addr_useopenbox = 0xc5ec;
- static const uint16 addr_userailing = 0xc5e8;
- static const uint16 addr_usecoveredbox = 0xc5e4;
- static const uint16 addr_useclearbox = 0xc5e0;
- static const uint16 addr_usecart = 0xc5dc;
- static const uint16 addr_useslab = 0xc5d8;
- static const uint16 addr_slabdoorf = 0xc5d4;
- static const uint16 addr_slabdoore = 0xc5d0;
- static const uint16 addr_slabdoorc = 0xc5cc;
- static const uint16 addr_slabdoord = 0xc5c8;
- static const uint16 addr_slabdoorb = 0xc5c4;
- static const uint16 addr_slabdoora = 0xc5c0;
- static const uint16 addr_useladderb = 0xc5bc;
- static const uint16 addr_useladder = 0xc5b8;
- static const uint16 addr_chewy = 0xc5b4;
- static const uint16 addr_useplinth = 0xc5b0;
- static const uint16 addr_usefullcart = 0xc5ac;
- static const uint16 addr_usepipe = 0xc5a8;
- static const uint16 addr_nothelderror = 0xc5a4;
- static const uint16 addr_usetrainer = 0xc5a0;
- static const uint16 addr_opentomb = 0xc59c;
- static const uint16 addr_hotelbell = 0xc598;
- static const uint16 addr_hotelcontrol = 0xc594;
- static const uint16 addr_playguitar = 0xc590;
- static const uint16 addr_runtap = 0xc58c;
- static const uint16 addr_wheelsound = 0xc588;
- static const uint16 addr_useobject = 0xc580;
- static const uint16 addr_delcurs = 0xc57c;
- static const uint16 addr_printcurs = 0xc578;
- static const uint16 addr_triggermessage = 0xc574;
- static const uint16 addr_processtrigger = 0xc570;
- static const uint16 addr_monmessage = 0xc56c;
- static const uint16 addr_showcurrentfile = 0xc568;
- static const uint16 addr_printlogo = 0xc564;
- static const uint16 addr_monitorlogo = 0xc560;
- static const uint16 addr_scrollmonitor = 0xc558;
- static const uint16 addr_parser = 0xc554;
- static const uint16 addr_searchforstring = 0xc550;
- static const uint16 addr_getkeyandlogo = 0xc54c;
- static const uint16 addr_dirfile = 0xc548;
- static const uint16 addr_read = 0xc544;
- static const uint16 addr_showkeys = 0xc540;
- static const uint16 addr_signon = 0xc53c;
- static const uint16 addr_searchforfiles = 0xc538;
- static const uint16 addr_dircom = 0xc534;
- static const uint16 addr_neterror = 0xc530;
- static const uint16 addr_execcommand = 0xc52c;
- static const uint16 addr_delchar = 0xc528;
- static const uint16 addr_makecaps = 0xc524;
- static const uint16 addr_input = 0xc520;
- static const uint16 addr_locklightoff = 0xc51c;
- static const uint16 addr_locklighton = 0xc518;
- static const uint16 addr_accesslightoff = 0xc514;
- static const uint16 addr_accesslighton = 0xc510;
- static const uint16 addr_powerlightoff = 0xc50c;
- static const uint16 addr_powerlighton = 0xc508;
- static const uint16 addr_randomaccess = 0xc504;
- static const uint16 addr_turnonpower = 0xc500;
- static const uint16 addr_lookininterface = 0xc4fc;
- static const uint16 addr_loadcart = 0xc4f8;
- static const uint16 addr_loadnews = 0xc4f4;
- static const uint16 addr_loadpersonal = 0xc4f0;
- static const uint16 addr_printoutermon = 0xc4ec;
- static const uint16 addr_usemon = 0xc4e8;
- static const uint16 addr_readcitypic = 0xc4e4;
- static const uint16 addr_readdesticon = 0xc4e0;
- static const uint16 addr_resetlocation = 0xc4dc;
- static const uint16 addr_setlocation = 0xc4d8;
- static const uint16 addr_getlocation = 0xc4d4;
- static const uint16 addr_destselect = 0xc4d0;
- static const uint16 addr_lastdest = 0xc4cc;
- static const uint16 addr_nextdest = 0xc4c8;
- static const uint16 addr_showarrows = 0xc4c4;
- static const uint16 addr_getdestinfo = 0xc4c0;
- static const uint16 addr_locationpic = 0xc4bc;
- static const uint16 addr_putundercentre = 0xc4b8;
- static const uint16 addr_getundercentre = 0xc4b4;
- static const uint16 addr_lookatplace = 0xc4b0;
- static const uint16 addr_showcity = 0xc4ac;
- static const uint16 addr_selectlocation = 0xc4a8;
- static const uint16 addr_newplace = 0xc4a4;
- static const uint16 addr_redes = 0xc4a0;
- static const uint16 addr_hangonpq = 0xc49c;
- static const uint16 addr_dosometalk = 0xc498;
- static const uint16 addr_moretalk = 0xc494;
- static const uint16 addr_getpersontext = 0xc490;
- static const uint16 addr_starttalk = 0xc48c;
- static const uint16 addr_getpersframe = 0xc488;
- static const uint16 addr_convicons = 0xc484;
- static const uint16 addr_talk = 0xc480;
- static const uint16 addr_getback1 = 0xc47c;
- static const uint16 addr_redrawmainscrn = 0xc478;
- static const uint16 addr_dolook = 0xc474;
- static const uint16 addr_look = 0xc470;
- static const uint16 addr_autolook = 0xc46c;
- static const uint16 addr_drawfloor = 0xc428;
- static const uint16 addr_blockget = 0xc424;
- static const uint16 addr_deleteextext = 0xc420;
- static const uint16 addr_deleteexframe = 0xc41c;
- static const uint16 addr_deleteexobject = 0xc418;
- static const uint16 addr_purgeanitem = 0xc414;
- static const uint16 addr_emergencypurge = 0xc410;
- static const uint16 addr_purgealocation = 0xc40c;
- static const uint16 addr_transfertext = 0xc404;
- static const uint16 addr_transfercontoex = 0xc400;
- static const uint16 addr_pickupconts = 0xc3fc;
- static const uint16 addr_transfertoex = 0xc3f8;
- static const uint16 addr_outofopen = 0xc3f4;
- static const uint16 addr_checkobjectsize = 0xc3f0;
- static const uint16 addr_errormessage3 = 0xc3ec;
- static const uint16 addr_errormessage2 = 0xc3e8;
- static const uint16 addr_errormessage1 = 0xc3e4;
- static const uint16 addr_useopened = 0xc3e0;
- static const uint16 addr_selectopenob = 0xc3dc;
- static const uint16 addr_removeobfrominv = 0xc3d8;
- static const uint16 addr_wornerror = 0xc3d4;
- static const uint16 addr_cantdrop = 0xc3d0;
- static const uint16 addr_droperror = 0xc3cc;
- static const uint16 addr_dropobject = 0xc3c8;
- static const uint16 addr_findopenpos = 0xc3c4;
- static const uint16 addr_findinvpos = 0xc3c0;
- static const uint16 addr_getsetad = 0xc3bc;
- static const uint16 addr_getopenedsize = 0xc3b8;
- static const uint16 addr_getanyaddir = 0xc3b4;
- static const uint16 addr_getanyad = 0xc3b0;
- static const uint16 addr_geteitherad = 0xc3ac;
- static const uint16 addr_getexad = 0xc3a8;
- static const uint16 addr_getfreead = 0xc3a4;
- static const uint16 addr_outofinv = 0xc3a0;
- static const uint16 addr_intoinv = 0xc398;
- static const uint16 addr_swapwithopen = 0xc394;
- static const uint16 addr_swapwithinv = 0xc390;
- static const uint16 addr_reexfromopen = 0xc38c;
- static const uint16 addr_reexfrominv = 0xc388;
- static const uint16 addr_examinventory = 0xc384;
- static const uint16 addr_setpickup = 0xc380;
- static const uint16 addr_inventory = 0xc37c;
- 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_examicon = 0xc35c;
- static const uint16 addr_openob = 0xc354;
- 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_findallopen = 0xc32c;
- static const uint16 addr_fillopen = 0xc324;
- static const uint16 addr_monprint = 0xc314;
- static const uint16 addr_realcredits = 0xc2f8;
- static const uint16 addr_set16colpalette = 0xc2f4;
- static const uint16 addr_mode640x480 = 0xc2f0;
- static const uint16 addr_loadintroroom = 0xc2ec;
- static const uint16 addr_runendseq = 0xc2e8;
- static const uint16 addr_runintroseq = 0xc2e4;
- static const uint16 addr_intro = 0xc2e0;
- static const uint16 addr_hangone = 0xc2dc;
- static const uint16 addr_biblequote = 0xc2d8;
- static const uint16 addr_credits = 0xc2d4;
- static const uint16 addr_gettingshot = 0xc2d0;
- static const uint16 addr_showmonk = 0xc2cc;
- static const uint16 addr_monkspeaking = 0xc2c8;
- static const uint16 addr_endgame = 0xc2c4;
- static const uint16 addr_titles = 0xc2c0;
- static const uint16 addr_initialmoncols = 0xc2bc;
- static const uint16 addr_fadeupyellows = 0xc2b8;
- static const uint16 addr_fadeupmonfirst = 0xc2b4;
- static const uint16 addr_fadeupmon = 0xc2b0;
- static const uint16 addr_fadedownmon = 0xc2ac;
- static const uint16 addr_dumpcurrent = 0xc2a8;
- static const uint16 addr_allpalette = 0xc2a4;
- static const uint16 addr_paltoendpal = 0xc2a0;
- static const uint16 addr_startpaltoend = 0xc29c;
- static const uint16 addr_endpaltostart = 0xc298;
- static const uint16 addr_paltostartpal = 0xc294;
- static const uint16 addr_showgroup = 0xc290;
- static const uint16 addr_greyscalesum = 0xc28c;
- static const uint16 addr_fadecalculation = 0xc288;
- static const uint16 addr_rollem = 0xc284;
- static const uint16 addr_rollendcredits2 = 0xc280;
- static const uint16 addr_showgun = 0xc27c;
- static const uint16 addr_clearstartpal = 0xc278;
- static const uint16 addr_fadescreendowns = 0xc274;
- static const uint16 addr_fadescreendown = 0xc270;
- static const uint16 addr_fadescreenuphalf = 0xc26c;
- static const uint16 addr_fadescreendownhalf = 0xc268;
- static const uint16 addr_fadescreenups = 0xc264;
- static const uint16 addr_fadefromwhite = 0xc260;
- static const uint16 addr_fadetowhite = 0xc25c;
- static const uint16 addr_fadescreenup = 0xc258;
- static const uint16 addr_clearpalette = 0xc254;
- static const uint16 addr_clearendpal = 0xc250;
- static const uint16 addr_dofade = 0xc24c;
- static const uint16 addr_fadedos = 0xc248;
- static const uint16 addr_transfermap = 0xc244;
- 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_setmode = 0xc1dc;
- static const uint16 addr_loadpalfromiff = 0xc1d8;
- static const uint16 addr_showpcx = 0xc1cc;
- static const uint16 addr_deleverything = 0xc1c0;
- static const uint16 addr_reconstruct = 0xc1ac;
- static const uint16 addr_soundonreels = 0xc1a8;
- static const uint16 addr_reelsonscreen = 0xc1a0;
- static const uint16 addr_constant = 0xc184;
- static const uint16 addr_steady = 0xc180;
- static const uint16 addr_random = 0xc17c;
- static const uint16 addr_liftnoise = 0xc178;
- static const uint16 addr_backobject = 0xc170;
- static const uint16 addr_splitintolines = 0xc164;
- static const uint16 addr_initrain = 0xc160;
- static const uint16 addr_reminders = 0xc15c;
- static const uint16 addr_adjustright = 0xc158;
- static const uint16 addr_adjustleft = 0xc154;
- static const uint16 addr_adjustup = 0xc150;
- static const uint16 addr_adjustdown = 0xc14c;
- static const uint16 addr_checkforexit = 0xc148;
- static const uint16 addr_mainman = 0xc138;
- static const uint16 addr_checkspeed = 0xc110;
- static const uint16 addr_train = 0xc104;
- static const uint16 addr_sparky = 0xc100;
- static const uint16 addr_copper = 0xc0fc;
- static const uint16 addr_advisor = 0xc0f8;
- static const uint16 addr_drunk = 0xc0f4;
- static const uint16 addr_textformonk = 0xc0f0;
- static const uint16 addr_textforend = 0xc0ec;
- static const uint16 addr_priesttext = 0xc0e8;
- static const uint16 addr_madman = 0xc0dc;
- static const uint16 addr_madmanstelly = 0xc0d8;
- static const uint16 addr_priest = 0xc0d4;
- static const uint16 addr_rollendcredits = 0xc0d0;
- static const uint16 addr_endgameseq = 0xc0cc;
- static const uint16 addr_monkandryan = 0xc0c8;
- static const uint16 addr_intro3text = 0xc0c4;
- static const uint16 addr_intro2text = 0xc0c0;
- static const uint16 addr_intro1text = 0xc0bc;
- static const uint16 addr_monks2text = 0xc0b8;
- static const uint16 addr_handclap = 0xc0b4;
- static const uint16 addr_intromonks2 = 0xc0b0;
- static const uint16 addr_intromonks1 = 0xc0ac;
- static const uint16 addr_intromagic3 = 0xc0a8;
- static const uint16 addr_intromagic2 = 0xc0a4;
- static const uint16 addr_gates = 0xc0a0;
- static const uint16 addr_candles2 = 0xc09c;
- static const uint16 addr_candles = 0xc098;
- static const uint16 addr_intromagic1 = 0xc094;
- static const uint16 addr_smallcandle = 0xc090;
- static const uint16 addr_candles1 = 0xc08c;
- static const uint16 addr_keeper = 0xc088;
- static const uint16 addr_carparkdrip = 0xc084;
- static const uint16 addr_sparkydrip = 0xc080;
- static const uint16 addr_gamer = 0xc07c;
- static const uint16 addr_bossman = 0xc078;
- static const uint16 addr_heavy = 0xc074;
- static const uint16 addr_security = 0xc070;
- static const uint16 addr_poolguard = 0xc06c;
- static const uint16 addr_businessman = 0xc068;
- static const uint16 addr_aide = 0xc064;
- static const uint16 addr_mugger = 0xc060;
- static const uint16 addr_helicopter = 0xc05c;
- static const uint16 addr_rockstar = 0xc058;
- static const uint16 addr_soldier1 = 0xc054;
- static const uint16 addr_interviewer = 0xc050;
- static const uint16 addr_barwoman = 0xc04c;
- static const uint16 addr_othersmoker = 0xc048;
- static const uint16 addr_bartender = 0xc044;
- static const uint16 addr_drinker = 0xc040;
- static const uint16 addr_tattooman = 0xc03c;
- static const uint16 addr_mansatstill = 0xc038;
- static const uint16 addr_manasleep2 = 0xc034;
- static const uint16 addr_louischair = 0xc030;
- static const uint16 addr_louis = 0xc02c;
- static const uint16 addr_femalefan = 0xc028;
- static const uint16 addr_malefan = 0xc024;
- static const uint16 addr_edeninbath = 0xc020;
- static const uint16 addr_eden = 0xc01c;
- static const uint16 addr_manasleep = 0xc018;
- static const uint16 addr_attendant = 0xc014;
- static const uint16 addr_smokebloke = 0xc010;
- static const uint16 addr_receptionist = 0xc00c;
- static const uint16 addr_foghornsound = 0xc008;
- static const uint16 addr_intromusic = 0xc004;
- static const uint16 addr_alleybarksound = 0xc000;
- static const uint16 offset_quitlist = 0x0a84;
- static const uint16 offset_savelist = 0x0f44;
- static const uint16 offset_mainlist = 0x1402;
- static const uint16 offset_gameerror8 = 0x113f;
- static const uint16 offset_gameerror5 = 0x1074;
- static const uint16 offset_error2patch = 0x0ff6;
- static const uint16 offset_openchangesize = 0x0a1c;
- static const uint16 offset_keys = 0x0b14;
- static const uint16 offset_mainlist2 = 0x1440;
- static const uint16 offset_gameerror2 = 0x0fb2;
- static const uint16 offset_loadlist = 0x0ef0;
- static const uint16 offset_gameerror6 = 0x10be;
- static const uint16 offset_speechfile = 0x13f1;
- static const uint16 offset_atmospherelist = 0x147e;
- static const uint16 offset_gameerror4 = 0x1037;
- static const uint16 offset_gameerror1 = 0x0f6e;
- static const uint16 offset_examlist = 0x09be;
- static const uint16 offset_gameinfo = 0x1170;
- static const uint16 offset_opslist = 0x0ec6;
- static const uint16 offset_invlist1 = 0x09fc;
- static const uint16 offset_money2poke = 0x0d97;
- static const uint16 offset_talklist = 0x0a64;
- static const uint16 offset_menulist = 0x0e1e;
- static const uint16 offset_comlist = 0x0ad8;
- static const uint16 offset_withlist1 = 0x0a3a;
- static const uint16 offset_money1poke = 0x0d92;
- static const uint16 offset_gameerror7 = 0x1104;
- static const uint16 offset_discopslist = 0x0f1a;
- static const uint16 offset_commandline = 0x16d7;
- static const uint16 offset_destlist = 0x0a9a;
- static const uint16 offset_shaketable = 0x06af;
- static const uint16 offset_error6patch = 0x10fe;
- static const uint16 offset_keybuffer = 0x1718;
- static const uint16 offset_speechfilename = 0x13eb;
- static const uint16 offset_rootdir = 0x0b8c;
- static const uint16 offset_gameerror3 = 0x1003;
- static const uint16 offset_rainlocations = 0x0459;
- static const uint16 offset_diarylist = 0x0e9c;
- static const uint16 offset_decidelist = 0x13c1;
- static const uint16 offset_symbollist = 0x0e5e;
- static const uint16 offset_folderlist = 0x0e34;
- static const uint16 offset_facelist = 0x0451;
- static const uint16 offset_operand1 = 0x0b7e;
- static const uint16 offset_keypadlist = 0x0d9a;
- static const uint16 kStartvars = 0;
- static const uint16 kProgresspoints = 1;
- static const uint16 kWatchon = 2;
- static const uint16 kShadeson = 3;
- static const uint16 kSecondcount = 4;
- static const uint16 kMinutecount = 5;
- static const uint16 kHourcount = 6;
- static const uint16 kZoomon = 7;
- static const uint16 kLocation = 8;
- static const uint16 kExpos = 9;
- static const uint16 kExframepos = 10;
- static const uint16 kExtextpos = 12;
- static const uint16 kCard1money = 14;
- static const uint16 kListpos = 16;
- static const uint16 kRyanpage = 18;
- static const uint16 kWatchingtime = 19;
- static const uint16 kReeltowatch = 21;
- static const uint16 kEndwatchreel = 23;
- static const uint16 kSpeedcount = 25;
- static const uint16 kWatchspeed = 26;
- static const uint16 kReeltohold = 27;
- static const uint16 kEndofholdreel = 29;
- static const uint16 kWatchmode = 31;
- static const uint16 kDestafterhold = 32;
- static const uint16 kNewsitem = 33;
- static const uint16 kLiftflag = 34;
- static const uint16 kLiftpath = 35;
- static const uint16 kLockstatus = 36;
- static const uint16 kDoorpath = 37;
- static const uint16 kCounttoopen = 38;
- static const uint16 kCounttoclose = 39;
- static const uint16 kRockstardead = 40;
- static const uint16 kGeneraldead = 41;
- static const uint16 kSartaindead = 42;
- static const uint16 kAidedead = 43;
- static const uint16 kBeenmugged = 44;
- static const uint16 kGunpassflag = 45;
- static const uint16 kCanmovealtar = 46;
- static const uint16 kTalkedtoattendant = 47;
- static const uint16 kTalkedtosparky = 48;
- static const uint16 kTalkedtoboss = 49;
- static const uint16 kTalkedtorecep = 50;
- static const uint16 kCardpassflag = 51;
- static const uint16 kMadmanflag = 52;
- static const uint16 kKeeperflag = 53;
- static const uint16 kLasttrigger = 54;
- static const uint16 kMandead = 55;
- static const uint16 kSeed = 56;
- static const uint16 kNeedtotravel = 59;
- static const uint16 kThroughdoor = 60;
- static const uint16 kNewobs = 61;
- static const uint16 kRyanon = 62;
- static const uint16 kCombatcount = 63;
- static const uint16 kLastweapon = 64;
- static const uint16 kDreamnumber = 65;
- static const uint16 kRoomafterdream = 66;
- static const uint16 kShakecounter = 67;
- static const uint16 kSpeechcount = 68;
- static const uint16 kCharshift = 69;
- static const uint16 kKerning = 71;
- static const uint16 kBrightness = 72;
- static const uint16 kRoomloaded = 73;
- static const uint16 kDidzoom = 74;
- static const uint16 kLinespacing = 75;
- static const uint16 kTextaddressx = 77;
- static const uint16 kTextaddressy = 79;
- static const uint16 kTextlen = 81;
- static const uint16 kLastxpos = 82;
- static const uint16 kIcontop = 84;
- static const uint16 kIconleft = 86;
- static const uint16 kItemframe = 88;
- static const uint16 kItemtotran = 89;
- static const uint16 kRoomad = 90;
- static const uint16 kOldsubject = 92;
- static const uint16 kWithobject = 94;
- static const uint16 kWithtype = 95;
- static const uint16 kLookcounter = 96;
- static const uint16 kCommand = 98;
- static const uint16 kCommandtype = 99;
- static const uint16 kOldcommandtype = 100;
- static const uint16 kObjecttype = 101;
- static const uint16 kGetback = 102;
- static const uint16 kInvopen = 103;
- static const uint16 kMainmode = 104;
- static const uint16 kPickup = 105;
- static const uint16 kLastinvpos = 106;
- static const uint16 kExamagain = 107;
- static const uint16 kNewtextline = 108;
- static const uint16 kOpenedob = 109;
- static const uint16 kOpenedtype = 110;
- static const uint16 kOldmapadx = 111;
- static const uint16 kOldmapady = 113;
- static const uint16 kMapadx = 115;
- static const uint16 kMapady = 117;
- static const uint16 kMapoffsetx = 119;
- static const uint16 kMapoffsety = 121;
- static const uint16 kMapxstart = 123;
- static const uint16 kMapystart = 125;
- static const uint16 kMapxsize = 127;
- static const uint16 kMapysize = 128;
- static const uint16 kHavedoneobs = 129;
- static const uint16 kManisoffscreen = 130;
- static const uint16 kRainspace = 131;
- static const uint16 kFacing = 132;
- static const uint16 kLeavedirection = 133;
- static const uint16 kTurntoface = 134;
- static const uint16 kTurndirection = 135;
- static const uint16 kMaintimer = 136;
- static const uint16 kIntrocount = 138;
- static const uint16 kArrowad = 139;
- static const uint16 kCurrentkey = 141;
- static const uint16 kOldkey = 142;
- static const uint16 kUseddirection = 143;
- static const uint16 kCurrentkey2 = 144;
- static const uint16 kTimercount = 145;
- static const uint16 kOldtimercount = 146;
- static const uint16 kMapx = 147;
- static const uint16 kMapy = 148;
- static const uint16 kNewscreen = 149;
- static const uint16 kRyanx = 150;
- static const uint16 kRyany = 151;
- static const uint16 kLastflag = 152;
- static const uint16 kLastflagex = 153;
- static const uint16 kFlagx = 154;
- static const uint16 kFlagy = 155;
- static const uint16 kCurrentex = 156;
- static const uint16 kCurrentfree = 157;
- static const uint16 kCurrentframe = 158;
- static const uint16 kFramesad = 160;
- static const uint16 kDataad = 162;
- static const uint16 kFrsegment = 164;
- static const uint16 kObjectx = 166;
- static const uint16 kObjecty = 168;
- static const uint16 kOffsetx = 170;
- static const uint16 kOffsety = 172;
- static const uint16 kSavesize = 174;
- static const uint16 kSavesource = 176;
- static const uint16 kSavex = 178;
- static const uint16 kSavey = 179;
- static const uint16 kCurrentob = 180;
- static const uint16 kPrioritydep = 181;
- static const uint16 kDestpos = 182;
- static const uint16 kReallocation = 183;
- static const uint16 kRoomnum = 184;
- static const uint16 kNowinnewroom = 185;
- static const uint16 kResetmanxy = 186;
- static const uint16 kNewlocation = 187;
- static const uint16 kAutolocation = 188;
- static const uint16 kMustload = 189;
- static const uint16 kAnswered = 190;
- static const uint16 kSaidno = 191;
- static const uint16 kDoorcheck1 = 192;
- static const uint16 kDoorcheck2 = 193;
- static const uint16 kDoorcheck3 = 194;
- static const uint16 kDoorcheck4 = 195;
- static const uint16 kMousex = 196;
- static const uint16 kMousey = 198;
- static const uint16 kMousebutton = 200;
- static const uint16 kMousebutton1 = 202;
- static const uint16 kMousebutton2 = 204;
- static const uint16 kMousebutton3 = 206;
- static const uint16 kMousebutton4 = 208;
- static const uint16 kOldbutton = 210;
- static const uint16 kOldx = 212;
- static const uint16 kOldy = 214;
- static const uint16 kLastbutton = 216;
- static const uint16 kOldpointerx = 218;
- static const uint16 kOldpointery = 220;
- static const uint16 kDelherex = 222;
- static const uint16 kDelherey = 224;
- static const uint16 kPointerxs = 226;
- static const uint16 kPointerys = 227;
- static const uint16 kDelxs = 228;
- static const uint16 kDelys = 229;
- static const uint16 kPointerframe = 230;
- static const uint16 kPointerpower = 231;
- static const uint16 kAuxpointerframe = 232;
- static const uint16 kPointermode = 233;
- static const uint16 kPointerspeed = 234;
- static const uint16 kPointercount = 235;
- static const uint16 kInmaparea = 236;
- static const uint16 kReelpointer = 237;
- static const uint16 kSlotdata = 239;
- static const uint16 kThisslot = 240;
- static const uint16 kSlotflags = 241;
- static const uint16 kTakeoff = 242;
- static const uint16 kTalkmode = 244;
- static const uint16 kTalkpos = 245;
- static const uint16 kCharacter = 246;
- static const uint16 kPersondata = 247;
- static const uint16 kTalknum = 249;
- static const uint16 kNumberinroom = 250;
- static const uint16 kCurrentcel = 251;
- static const uint16 kOldselection = 252;
- static const uint16 kStopwalking = 253;
- static const uint16 kMouseon = 254;
- static const uint16 kPlayed = 255;
- static const uint16 kTimer1 = 257;
- static const uint16 kTimer2 = 258;
- static const uint16 kTimer3 = 259;
- static const uint16 kWholetimer = 260;
- static const uint16 kTimer1to = 262;
- static const uint16 kTimer2to = 263;
- static const uint16 kTimer3to = 264;
- static const uint16 kWatchdump = 265;
- static const uint16 kCurrentset = 266;
- static const uint16 kLogonum = 268;
- static const uint16 kOldlogonum = 269;
- static const uint16 kNewlogonum = 270;
- static const uint16 kNetseg = 271;
- static const uint16 kNetpoint = 273;
- static const uint16 kKeynum = 275;
- static const uint16 kCursorstate = 276;
- static const uint16 kPressed = 277;
- static const uint16 kPresspointer = 278;
- static const uint16 kGraphicpress = 280;
- static const uint16 kPresscount = 281;
- static const uint16 kKeypadax = 282;
- static const uint16 kKeypadcx = 284;
- static const uint16 kLightcount = 286;
- static const uint16 kFolderpage = 287;
- static const uint16 kDiarypage = 288;
- static const uint16 kMenucount = 289;
- static const uint16 kSymboltopx = 290;
- static const uint16 kSymboltopnum = 291;
- static const uint16 kSymboltopdir = 292;
- static const uint16 kSymbolbotx = 293;
- static const uint16 kSymbolbotnum = 294;
- static const uint16 kSymbolbotdir = 295;
- static const uint16 kSymboltolight = 296;
- static const uint16 kSymbol1 = 297;
- static const uint16 kSymbol2 = 298;
- static const uint16 kSymbol3 = 299;
- static const uint16 kSymbolnum = 300;
- static const uint16 kDumpx = 301;
- static const uint16 kDumpy = 303;
- static const uint16 kWalkandexam = 305;
- static const uint16 kWalkexamtype = 306;
- static const uint16 kWalkexamnum = 307;
- static const uint16 kCursloc = 308;
- static const uint16 kCurslocx = 310;
- static const uint16 kCurslocy = 312;
- static const uint16 kCurpos = 314;
- static const uint16 kMonadx = 316;
- static const uint16 kMonady = 318;
- static const uint16 kGotfrom = 320;
- static const uint16 kMonsource = 322;
- static const uint16 kNumtodo = 324;
- static const uint16 kTimecount = 326;
- static const uint16 kCounttotimed = 328;
- static const uint16 kTimedseg = 330;
- static const uint16 kTimedoffset = 332;
- static const uint16 kTimedy = 334;
- static const uint16 kTimedx = 335;
- static const uint16 kNeedtodumptimed = 336;
- static const uint16 kHandle = 337;
- static const uint16 kLoadingorsave = 339;
- static const uint16 kCurrentslot = 340;
- static const uint16 kCursorpos = 341;
- static const uint16 kColourpos = 342;
- static const uint16 kFadedirection = 343;
- static const uint16 kNumtofade = 344;
- static const uint16 kFadecount = 345;
- static const uint16 kAddtogreen = 346;
- static const uint16 kAddtored = 347;
- static const uint16 kAddtoblue = 348;
- static const uint16 kLastsoundreel = 349;
- static const uint16 kSoundbuffer = 351;
- static const uint16 kSoundbufferad = 353;
- static const uint16 kSoundbufferpage = 355;
- static const uint16 kSoundtimes = 356;
- static const uint16 kNeedsoundbuff = 357;
- static const uint16 kOldint9seg = 358;
- static const uint16 kOldint9add = 360;
- static const uint16 kOldint8seg = 362;
- static const uint16 kOldint8add = 364;
- static const uint16 kOldsoundintseg = 366;
- static const uint16 kOldsoundintadd = 368;
- static const uint16 kSoundbaseadd = 370;
- static const uint16 kDsp_status = 372;
- static const uint16 kDsp_write = 374;
- static const uint16 kDmaaddress = 376;
- static const uint16 kSoundint = 377;
- static const uint16 kSounddmachannel = 378;
- static const uint16 kSampleplaying = 379;
- static const uint16 kTestresult = 380;
- static const uint16 kCurrentirq = 381;
- static const uint16 kSpeechloaded = 382;
- static const uint16 kSpeechlength = 383;
- static const uint16 kVolume = 385;
- static const uint16 kVolumeto = 386;
- static const uint16 kVolumedirection = 387;
- static const uint16 kVolumecount = 388;
- static const uint16 kPlayblock = 389;
- static const uint16 kWongame = 390;
- static const uint16 kLasthardkey = 391;
- static const uint16 kBufferin = 392;
- static const uint16 kBufferout = 394;
- static const uint16 kExtras = 396;
- static const uint16 kWorkspace = 398;
- static const uint16 kMapstore = 400;
- static const uint16 kCharset1 = 402;
- static const uint16 kTempcharset = 404;
- static const uint16 kIcons1 = 406;
- static const uint16 kIcons2 = 408;
- static const uint16 kBuffers = 410;
- static const uint16 kMainsprites = 412;
- static const uint16 kBackdrop = 414;
- static const uint16 kMapdata = 416;
- static const uint16 kSounddata = 418;
- static const uint16 kSounddata2 = 420;
- static const uint16 kRecordspace = 422;
- static const uint16 kFreedat = 424;
- static const uint16 kSetdat = 426;
- static const uint16 kReel1 = 428;
- static const uint16 kReel2 = 430;
- static const uint16 kReel3 = 432;
- static const uint16 kRoomdesc = 434;
- static const uint16 kFreedesc = 436;
- static const uint16 kSetdesc = 438;
- static const uint16 kBlockdesc = 440;
- static const uint16 kSetframes = 442;
- static const uint16 kFreeframes = 444;
- static const uint16 kPeople = 446;
- static const uint16 kReels = 448;
- static const uint16 kCommandtext = 450;
- static const uint16 kPuzzletext = 452;
- static const uint16 kTraveltext = 454;
- static const uint16 kTempgraphics = 456;
- static const uint16 kTempgraphics2 = 458;
- static const uint16 kTempgraphics3 = 460;
- static const uint16 kTempsprites = 462;
- static const uint16 kTextfile1 = 464;
- static const uint16 kTextfile2 = 466;
- static const uint16 kTextfile3 = 468;
- static const uint16 kBlinkframe = 470;
- static const uint16 kBlinkcount = 471;
- static const uint16 kReasseschanges = 472;
- static const uint16 kPointerspath = 473;
- static const uint16 kManspath = 474;
- static const uint16 kPointerfirstpath = 475;
- static const uint16 kFinaldest = 476;
- static const uint16 kDestination = 477;
- static const uint16 kLinestartx = 478;
- static const uint16 kLinestarty = 480;
- static const uint16 kLineendx = 482;
- static const uint16 kLineendy = 484;
- static const uint16 kIncrement1 = 486;
- static const uint16 kIncrement2 = 488;
- static const uint16 kLineroutine = 490;
- static const uint16 kLinepointer = 491;
- static const uint16 kLinedirection = 492;
- static const uint16 kLinelength = 493;
- static const uint16 kLiftsoundcount = 494;
- static const uint16 kEmmhandle = 495;
- static const uint16 kEmmpageframe = 497;
- static const uint16 kEmmhardwarepage = 499;
- static const uint16 kCh0emmpage = 500;
- static const uint16 kCh0offset = 502;
- static const uint16 kCh0blockstocopy = 504;
- static const uint16 kCh0playing = 506;
- static const uint16 kCh0repeat = 507;
- static const uint16 kCh0oldemmpage = 508;
- static const uint16 kCh0oldoffset = 510;
- static const uint16 kCh0oldblockstocopy = 512;
- static const uint16 kCh1playing = 514;
- static const uint16 kCh1emmpage = 515;
- static const uint16 kCh1offset = 517;
- static const uint16 kCh1blockstocopy = 519;
- static const uint16 kCh1blocksplayed = 521;
- static const uint16 kSoundbufferwrite = 523;
- static const uint16 kSoundemmpage = 525;
- static const uint16 kSpeechemmpage = 527;
- static const uint16 kCurrentsample = 529;
- static const uint16 kRoomssample = 530;
- static const uint16 kGameerror = 531;
- static const uint16 kHowmuchalloc = 532;
- static const uint16 kReelroutines = 534;
- static const uint16 kReelcalls = 991;
- static const uint16 kRoombyroom = 1214;
- static const uint16 kR0 = 1326;
- static const uint16 kR1 = 1327;
- static const uint16 kR2 = 1331;
- static const uint16 kR6 = 1350;
- static const uint16 kR8 = 1357;
- static const uint16 kR9 = 1373;
- static const uint16 kR10 = 1380;
- static const uint16 kR11 = 1384;
- static const uint16 kR12 = 1388;
- static const uint16 kR13 = 1392;
- static const uint16 kR14 = 1405;
- static const uint16 kR20 = 1439;
- static const uint16 kR22 = 1461;
- static const uint16 kR23 = 1492;
- static const uint16 kR25 = 1505;
- static const uint16 kR26 = 1527;
- static const uint16 kR27 = 1549;
- static const uint16 kR28 = 1574;
- static const uint16 kR29 = 1593;
- static const uint16 kR45 = 1609;
- static const uint16 kR46 = 1616;
- static const uint16 kR47 = 1653;
- static const uint16 kR52 = 1666;
- static const uint16 kR53 = 1670;
- static const uint16 kR55 = 1677;
- static const uint16 kSpritename1 = 1819;
- static const uint16 kSpritename3 = 1832;
- static const uint16 kIdname = 1845;
- static const uint16 kCharacterset1 = 1857;
- static const uint16 kCharacterset2 = 1870;
- static const uint16 kCharacterset3 = 1883;
- static const uint16 kSamplename = 1896;
- static const uint16 kBasicsample = 1909;
- static const uint16 kIcongraphics0 = 1922;
- static const uint16 kIcongraphics1 = 1935;
- static const uint16 kExtragraphics1 = 1948;
- static const uint16 kIcongraphics8 = 1961;
- static const uint16 kMongraphicname = 1974;
- static const uint16 kMongraphics2 = 1987;
- static const uint16 kCityname = 2000;
- static const uint16 kTravelgraphic1 = 2013;
- static const uint16 kTravelgraphic2 = 2026;
- static const uint16 kDiarygraphic = 2039;
- static const uint16 kMonitorfile1 = 2052;
- static const uint16 kMonitorfile2 = 2065;
- static const uint16 kMonitorfile10 = 2078;
- static const uint16 kMonitorfile11 = 2091;
- static const uint16 kMonitorfile12 = 2104;
- static const uint16 kMonitorfile13 = 2117;
- static const uint16 kMonitorfile20 = 2130;
- static const uint16 kMonitorfile21 = 2143;
- static const uint16 kMonitorfile22 = 2156;
- static const uint16 kMonitorfile23 = 2169;
- static const uint16 kMonitorfile24 = 2182;
- static const uint16 kFoldertext = 2195;
- static const uint16 kDiarytext = 2208;
- static const uint16 kPuzzletextname = 2221;
- static const uint16 kTraveltextname = 2234;
- static const uint16 kIntrotextname = 2247;
- static const uint16 kEndtextname = 2260;
- static const uint16 kCommandtextname = 2273;
- static const uint16 kVolumetabname = 2286;
- static const uint16 kFoldergraphic1 = 2299;
- static const uint16 kFoldergraphic2 = 2312;
- static const uint16 kFoldergraphic3 = 2325;
- static const uint16 kSymbolgraphic = 2338;
- static const uint16 kGungraphic = 2351;
- static const uint16 kMonkface = 2364;
- static const uint16 kTitle0graphics = 2377;
- static const uint16 kTitle1graphics = 2390;
- static const uint16 kTitle2graphics = 2403;
- static const uint16 kTitle3graphics = 2416;
- static const uint16 kTitle4graphics = 2429;
- static const uint16 kTitle5graphics = 2442;
- static const uint16 kTitle6graphics = 2455;
- static const uint16 kTitle7graphics = 2468;
- static const uint16 kPalettescreen = 2481;
- static const uint16 kCurrentfile = 2970;
- static const uint16 kDmaaddresses = 5118;
- static const uint16 kFileheader = 6091;
- static const uint16 kFiledata = 6141;
- static const uint16 kExtradata = 6181;
- static const uint16 kRoomdata = 6187;
- static const uint16 kMadeuproomdat = 7979;
- static const uint16 kRoomscango = 8011;
- static const uint16 kRoompics = 8027;
- static const uint16 kOplist = 8042;
- static const uint16 kInputline = 8045;
- static const uint16 kLinedata = 8173;
- static const uint16 kPresslist = 8573;
- static const uint16 kSavenames = 8579;
- static const uint16 kSavefiles = 8698;
- static const uint16 kRecname = 8789;
- static const uint16 kQuitrequested = 8802;
- static const uint16 kSubtitles = 8803;
- static const uint16 kForeignrelease = 8804;
- static const uint16 kStak = 8805;
- static const uint16 kBlocktextdat = (0);
- static const uint16 kPersonframes = (0);
- static const uint16 kDebuglevel1 = (0);
- static const uint16 kDebuglevel2 = (0);
- static const uint16 kPlayback = (0);
- static const uint16 kMap = (0);
- static const uint16 kSettextdat = (0);
- static const uint16 kSpanish = (0);
- static const uint16 kFramedata = (0);
- static const uint16 kRecording = (0);
- static const uint16 kFlags = (0);
- static const uint16 kGerman = (0);
- static const uint16 kTextunder = (0);
- static const uint16 kPathdata = (0);
- static const uint16 kDemo = (0);
- static const uint16 kExframedata = (0);
- static const uint16 kIntextdat = (0);
- static const uint16 kFreetextdat = (0);
- static const uint16 kFrframedata = (0);
- static const uint16 kSettext = (0+(130*2));
- static const uint16 kOpeninvlist = (0+(228*13));
- static const uint16 kRyaninvlist = (0+(228*13)+32);
- static const uint16 kPointerback = (0+(228*13)+32+60);
- static const uint16 kMapflags = (0+(228*13)+32+60+(32*32));
- static const uint16 kStartpal = (0+(228*13)+32+60+(32*32)+(11*10*3));
- static const uint16 kEndpal = (0+(228*13)+32+60+(32*32)+(11*10*3)+768);
- static const uint16 kMaingamepal = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768);
- static const uint16 kSpritetable = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768);
- static const uint16 kSetlist = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32));
- static const uint16 kFreelist = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5));
- static const uint16 kExlist = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5));
- static const uint16 kPeoplelist = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5));
- static const uint16 kZoomspace = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5));
- static const uint16 kPrintedlist = (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));
- static const uint16 kListofchanges = (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)+(5*80));
- static const uint16 kUndertimedtext = (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)+(5*80)+(250*4));
- static const uint16 kRainlist = (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)+(5*80)+(250*4)+(256*30));
- static const uint16 kInitialreelrouts = (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)+(5*80)+(250*4)+(256*30)+(6*64));
- static const uint16 kInitialvars = (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)+(5*80)+(250*4)+(256*30)+(6*64)+991-534);
- static const uint16 kLengthofbuffer = (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)+(5*80)+(250*4)+(256*30)+(6*64)+991-534+68-0);
- static const uint16 kReellist = (0+(36*144));
- static const uint16 kIntext = (0+(38*2));
- static const uint16 kLengthofmap = (0+(66*60));
- static const uint16 kFreetext = (0+(82*2));
- static const uint16 kBlocktext = (0+(98*2));
- static const uint16 kBlocks = (0+192);
- static const uint16 kFrframes = (0+2080);
- static const uint16 kExframes = (0+2080);
- static const uint16 kFrames = (0+2080);
- static const uint16 kExdata = (0+2080+30000);
- static const uint16 kExtextdat = (0+2080+30000+(16*114));
- static const uint16 kExtext = (0+2080+30000+(16*114)+((114+2)*2));
- static const uint16 kLengthofextra = (0+2080+30000+(16*114)+((114+2)*2)+18000);
- static const uint16 kPersontxtdat = (0+24);
- static const uint16 kPersontext = (0+24+(1026*2));
- static const uint16 kInputport = (0x63);
- static const uint16 kForeign = (1);
- static const uint16 kCd = (1);
- static const uint16 kNumexobjects = (114);
- static const uint16 kUndertextsizey = (13);
- static const uint16 kZoomy = (132);
- static const uint16 kFreedatlen = (16*80);
- static const uint16 kExtextlen = (18000);
- static const uint16 kLenofmapstore = (22*8*20*8);
- static const uint16 kUndertextsizex = (228);
- static const uint16 kNumchanges = (250);
- static const uint16 kUndertimedysize = (30);
- static const uint16 kExframeslen = (30000);
- static const uint16 kTablesize = (32);
- static const uint16 kScreenwidth = (320);
- static const uint16 kKeypadx = (36+112);
- static const uint16 kItempicsize = (44);
- static const uint16 kDiaryy = (48+12);
- static const uint16 kOpsy = (52);
- static const uint16 kSymboly = (56);
- static const uint16 kInventy = (58);
- static const uint16 kMenuy = (60);
- static const uint16 kOpsx = (60);
- static const uint16 kMaplength = (60);
- static const uint16 kHeaderlen = (6187-6091);
- static const uint16 kSymbolx = (64);
- static const uint16 kSetdatlen = (64*128);
- static const uint16 kMapwidth = (66);
- static const uint16 kTextstart = (66*2);
- static const uint16 kMaplen = (66*60);
- static const uint16 kDiaryx = (68+24);
- static const uint16 kLengthofvars = (68-0);
- static const uint16 kKeypady = (72);
- static const uint16 kZoomx = (8);
- static const uint16 kInventx = (80);
- static const uint16 kMenux = (80+40);
- static const uint16 kLenofreelrouts = (991-534);
-
- void bothchannels();
- void usewire();
- void getnamepos();
- void loadtemptext();
- void clearstartpal();
- void femalefan();
- //void showgamereel();
- void identifyob();
- void trysoundalloc();
- void uselighter();
- void showmenu();
- void usepoolreader();
- void startdmablock();
- void useopenbox();
- void clearbuffers();
- //void getyad();
- void neterror();
- void storeit();
- //void lockeddoorway();
- //void isitworn();
- //void putundertimed();
- //void dumpmap();
- //void multidump();
- void channel0only();
- void worktoscreenm();
- //void obicons();
- void removeemm();
- //void frameoutbh();
- void getobtextstart();
- void loadfolder();
- void decide();
- //void dumppointer();
- void reelsonscreen();
- void getridofreels();
- void readkey();
- void louis();
- void entrytexts();
- //void getreelstart();
- void buttonenter();
- void checkinput();
- //void crosshair();
- void setmode();
- void getbackfromops();
- //void frameoutv();
- void showbyte();
- void screenupdate();
- //void addlength();
- void wornerror();
- void putundercentre();
- void checkobjectsize();
- //void commandonly();
- void titles();
- void deallocatemem();
- void mainscreen();
- void watchreel();
- void showfolder();
- //void turnanypathoff();
- void openfilefromc();
- void gettime();
- //void clearwork();
- void loadtraveltext();
- //void worktoscreen();
- //void getexpos();
- void fadedos();
- //void fillspace();
- void selectlocation();
- //void multiget();
- //void autosetwalk();
- void fadeupmonfirst();
- void drawfloor();
- void loadkeypad();
- //void findsource();
- void clearendpal();
- void findtext1();
- void isryanholding();
- void showslots();
- void usecashcard();
- void usewall();
- void opentomb();
- //void makename();
- void buttonfour();
- void restoreall();
- //void lockmon();
- //void dochange();
- void getanyaddir();
- //void dumpblink();
- void showsaveops();
- void intromonks1();
- void resetlocation();
- void oldtonames();
- void showdiscops();
- void advisor();
- void additionaltext();
- //void compare();
- void othersmoker();
- void dofade();
- //void setuptimedtemp();
- //void blocknametext();
- void useelevator5();
- void useelevator4();
- void useelevator1();
- //void findormake();
- void useelevator3();
- void useelevator2();
- void buttonone();
- void keyboardread();
- //void deltextline();
- void entercode();
- void getopenedsize();
- void getpersframe();
- void doshake();
- void resetkeyboard();
- //void showpanel();
- void soundstartup();
- void slabdoora();
- void fadeupyellows();
- void slabdoorc();
- void slabdoorb();
- void slabdoore();
- void slabdoord();
- void adjustup();
- void slabdoorf();
- void loadintotemp();
- void loadintroroom();
- void saveseg();
- //void showblink();
- void mousecall();
- void train();
- void watchcount();
- void fadedownmon();
- void loadcart();
- //void calcfrframe();
+ void identifyOb();
+ void runEndSeq();
+ void useOpenBox();
+ void clearBuffers();
+ void getObTextStart();
+ void entryTexts();
+ void putUnderCentre();
+ void checkObjectSize();
+ void findText1();
+ void isRyanHolding();
+ void showSlots();
+ void useCashCard();
+ void moneyPoke();
+ void doSomeTalk();
+ void resetLocation();
+ void getOpenedSize();
+ void adjustUp();
+ void fadeScreenDownHalf();
+ void fadeDownMon();
void bartender();
- void eden();
- void showdiary();
- void purgealocation();
- //void updatepeople();
- //void addtopeoplelist();
- void hangoncurs();
- //void getblockofpixel();
- //void kernchars();
- void printcurs();
- //void convertkey();
- void outofopen();
- //void dealwithspecial();
- //void eraseoldobs();
- void dircom();
- //void liftsprite();
- void dumpkeypad();
- void showsymbol();
- void endgameseq();
- //void cancelch0();
- void setbotleft();
- void findfirstpath();
- //void cancelch1();
- void loadold();
- void loadtempcharset();
- void useslab();
- void dumpzoom();
- //void aboutturn();
- void usealtar();
- void createpanel2();
- void turnonpower();
- void manasleep2();
- void moretalk();
- //void printslow();
- void loadroom();
- void starttalk();
- void delchar();
- void getanyad();
- void endgame();
- void monprint();
- void usepipe();
- //void startloading();
- void getunderzoom();
- void candles();
- void backobject();
- void rollendcredits2();
+ void outOfOpen();
+ void dirCom();
+ void endGameSeq();
+ void findFirstPath();
+ void useSLab();
+ void useAltar();
+ void startTalk();
+ void getAnyAd();
+ void usePipe();
void reminders();
- void selectslot2();
- void runtap();
- //void domix();
- //void paneltomap();
- //void obname();
- void getridoftemp3();
- void getridoftemp2();
- void usebalcony();
- void runendseq();
- void dumpdiarykeys();
- void disablesoundint();
- void priesttext();
- //void showallex();
- void openpoolboss();
- void buttontwo();
- //void usetimedtext();
- //void delsprite();
- //void getroomspaths();
- //void dumptextline();
- void fadescreendownhalf();
- void useplate();
- void candles1();
- void lookininterface();
- void manasleep();
- //void isitdescribed();
- void hotelbell();
- void loadspeech();
- void interupttest();
- //void cls();
- //void printsprites();
- //void checkifperson();
- //void showallobs();
- //void getnumber();
- void adjustleft();
- void calledenslift();
- void useclearbox();
- void entryanims();
- void nextfolder();
- void getfreead();
- void showarrows();
- void walkintoroom();
- void usehatch();
- void printoutermon();
- void setuppit();
- void showpcx();
- void showdecisions();
- void checkspeed();
- //void printchar();
- void showkeypad();
- //void obtoinv();
- //void getroomdata();
- void removeobfrominv();
- void usecoveredbox();
- void openyourneighbour();
- void fadescreenuphalf();
- void getridoftempcharset();
+ void runTap();
+ void dumpDiaryKeys();
+ void checkForExit();
+ void lookInInterface();
+ void inToInv();
+ void adjustLeft();
+ void deleteExText();
+ void entryAnims();
+ void getFreeAd();
+ void removeObFromInv();
void heavy();
- void endpaltostart();
- void showkeys();
- void usekey();
- void locklighton();
- void useladderb();
- //void spriteupdate();
- void usetempcharset();
- void discops();
- //void printdirect();
- //void delthisone();
- //void makebackob();
- void middlepanel();
- void dumpwatch();
- void saveload();
- void monitorlogo();
- void loadposition();
- void entersymbol();
- void showword();
- void dirfile();
- //void bresenhams();
- //void walktotext();
- void pickupconts();
- void locklightoff();
- void wearwatch();
- void runintroseq();
- //void doblocks();
- void opensarters();
- //void delpointer();
- void attendant();
- void nextsymbol();
- void monks2text();
- void clearpalette();
- void cantdrop();
- //void maptopanel();
- //void calcmapad();
- void getridofall();
- void copper();
- void folderhints();
- void openhoteldoor();
- //void removesetobject();
- //void dumptimedtext();
- //void frameoutfx();
- void blank();
- void drinker();
- void nextcolon();
- void placefreeobject();
- void allpalette();
- //void loopchannel0();
- void initrain();
- void showleftpage();
- void rockstar();
- void adjustright();
- void putunderzoom();
- void vsync();
- //void finishedwalking();
- void findinvpos();
- void dumpmenu();
- //void examineobtext();
- void liftnoise();
- void workoutframes();
- void getbackfromob();
- void dumpsymbox();
- void loadgame();
- void getridoftemp();
- void showcity();
- void dumpsymbol();
- void disablepath();
- void buttonsix();
- void intro2text();
- void showouterpad();
- void getkeyandlogo();
- void selectob();
- //void checkcoords();
- //void usetext();
- void chewy();
- void accesslighton();
- void useplinth();
- //void adjustlen();
- //void quickquit();
- //void showpointer();
- void usecooker();
- void loadmenu();
- void checkforemm();
- //void checkifpathison();
- //void finalframe();
+ void useKey();
+ void dirFile();
+ void pickupConts();
+ void nextColon();
+ void findInvPos();
+ void getKeyAndLogo();
+ void selectOb();
void receptionist();
- void selectslot();
- void openfilenocheck();
- //void readoneblock();
- void fadeupmon();
- void paltoendpal();
- void fadetowhite();
- void loadsavebox();
- void soundend();
- void redes();
- void errormessage1();
- void clearchanges();
- void errormessage3();
- //void deletetaken();
- void putundermenu();
- void intromonks2();
- void intromagic2();
- void intromagic3();
- void edeninbath();
- void intromagic1();
- void showdiarypage();
- void useshield();
- void getbacktoops();
- void rollendcredits();
- void intro1text();
- void transfertoex();
- void playchannel1();
- void playchannel0();
- void usemon();
- void steady();
- //void pixelcheckset();
- void reexfrominv();
- void examinventory();
- void talk();
- void usedryer();
- //void dumpeverything();
- //void readmouse2();
- //void zoom();
- void outofinv();
- void viewfolder();
- //void walking();
- void diarykeyp();
- //void readabyte();
- //void showframe();
- void random();
- void mainman();
- void mansatstill();
- void channel1only();
- void checkbasemem();
- void lastfolder();
- void transfermap();
- //void showreelframe();
- void showmonk();
- void diarykeyn();
- void set16colpalette();
- void convicons();
- void interviewer();
- void sparky();
- void purgeanitem();
- void madman();
- void createpanel();
- //void turnpathon();
- void enablesoundint();
- void madmanstelly();
- void constant();
- void loadroomssample();
- void sparkydrip();
- void paltostartpal();
- void bossman();
- void getridofpit();
- void convnum();
- //void checkifset();
- void nothelderror();
- //void readheader();
- void getsetad();
- void textformonk();
- void reconstruct();
- void soldier1();
- //void animpointer();
- void getundercentre();
- void checkforexit();
- void loadseg();
- void makeheader();
- void setkeyboardint();
- void priest();
- //void readmouse();
- void powerlighton();
- void savefilewrite();
+ void selectSlot();
+ void fadeUpMon();
+ void showDiaryPage();
+ void reExFromInv();
+ void businessMan();
+ void outOfInv();
+ void transferMap();
+ void purgeAnItem();
+ void purgeALocation();
+ void notHeldError();
+ void getSetAd();
+ void getUnderCentre();
+ void showKeys();
void printmessage2();
- //void showallfree();
- void loadnews();
- void rollem();
- //void makeworn();
- void hangonpq();
- void startup();
- void savegame();
- void startpaltoend();
- void showicon();
- void findopenpos();
- void describeob();
- void deleteexframe();
- void folderexit();
- void dosreturn();
- void wheelsound();
- void actualsave();
- void autolook();
- void playguitar();
- void transfertext();
- void searchforsame();
- void showmainops();
- void getback1();
- void setlocation();
- void fadefromwhite();
- void checksoundint();
- void usewindow();
- void wearshades();
- void onedigit();
- void pitinterupt();
- void deleverything();
- void fadescreendown();
- //void findxyfrompath();
- void namestoold();
- //void getxad();
- void openinv();
- void lookatplace();
- void useaxe();
- void examineob();
- void buttonnought();
- void useelvdoor();
- void putbackobstuff();
- void useladder();
- void realcredits();
- void handclap();
- void smokebloke();
- void afterintroroom();
- //void printundermon();
- void buttonnine();
- void findallopen();
- void loadintotemp3();
- void loadintotemp2();
- void gamer();
- void poolguard();
- void readfromfile();
- void initialinv();
- void quitsymbol();
- //void modifychar();
- //void initman();
- void settopright();
- void findsetobject();
- void singlekey();
- //void seecommandtail();
- //void getundertimed();
- void hangone();
- void carparkdrip();
- void usediary();
- void deleteexobject();
- //void frameoutnm();
- void moneypoke();
- void destselect();
- void restoreems();
- void lastdest();
- void removefreeobject();
- void trapdoor();
- void openlouis();
- void buttonthree();
- void getundermenu();
- //void randomnumber();
- void lookatcard();
+ void findOpenPos();
+ void describeOb();
+ void deleteExFrame();
+ void searchForSame();
+ void rollEm();
+ void poolGuard();
+ void lookAtPlace();
+ void useAxe();
+ void findAllOpen();
+ void fillOpen();
+ void findSetObject();
+ void deleteExObject();
+ void removeFreeObject();
+ void lookAtCard();
void helicopter();
- void scrollmonitor();
- void setsoundoff();
- void setpickup();
- //void doorway();
- void dropobject();
- void isitright();
- void reexfromopen();
- //void fillryan();
- void drawitall();
- void usestereo();
- void showcurrentfile();
- //void turnpathoff();
- //void copyname();
- void look();
- void setmouse();
- //void checkone();
- //void transferinv();
- void candles2();
- void pickupob();
- void error();
- void showopbox();
- void clearbeforeload();
- void biblequote();
- void doload();
- void showexit();
- void blockget();
- void usetrainer();
- //void allocatework();
- void addtopresslist();
- //void walkandexamine();
- void dmaend();
- //void quickquit2();
- void twodigitnum();
- //void madmantext();
- void dumpcurrent();
- void textforend();
- void showdiarykeys();
- void dontloadseg();
- //void madmode();
- void intro3text();
- void allocatemem();
- void sortoutmap();
- //void showrain();
- void useopened();
- void inventory();
- void powerlightoff();
- void fillopen();
- void showoutermenu();
- void signon();
- void deleteextext();
- void foghornsound();
- void showrightpage();
- void showloadops();
- void examicon();
- void showgun();
- void switchryanon();
- //void personnametext();
- void louischair();
- void saveems();
- void locationpic();
- //void getflagunderp();
- void dolook();
- void opentvdoor();
- void triggermessage();
- void smallcandle();
- //void plotreel();
- void swapwithopen();
- //void makesprite();
+ void getEitherAd();
+ void setPickup();
+ void dropObject();
+ void openOb();
+ void drawItAll();
+ void useStereo();
+ void showDiaryKeys();
+ void useOpened();
+ void signOn();
+ void locationPic();
+ void triggerMessage();
+ void swapWithOpen();
void dreamweb();
- void droperror();
- void edenscdplayer();
- void calledensdlift();
- void checkinside();
- void gates();
- void newgame();
- void showwatch();
- //void turnanypathon();
- void restorereels();
- void setwalk();
- //void useroutine();
- void zoomicon();
- //void findlen();
- void findpathofpoint();
- void issetobonmap();
- void getdestinfo();
- void drunk();
- void getridoftemptext();
- void setuptimeduse();
- void grafittidoor();
- void input();
- void nextdest();
- //void getdimension();
- void makecaps();
+ void checkInside();
+ void findPathOfPoint();
+ void getDestInfo();
+ void setupTimedUse();
+ void makeCaps();
void read();
- void fadescreenups();
- //void checkdest();
- //void hangon();
- void loadpalfromiff();
- //void facerightway();
- void startup1();
- void hotelcontrol();
+ void additionalText();
void mugger();
- void atmospheres();
- void out22c();
- void loadpersonal();
- void gettingshot();
- void settopleft();
- void searchforstring();
- //void clearsprites();
- //void obpicture();
- void selectopenob();
- //void widedoor();
- void security();
- //void printasprite();
- void buttonfive();
- void soundonreels();
- void usegun();
- void autoappear();
- //void findnextcolon();
- //void readmouse4();
- void openryan();
- void callhotellift();
- void showman();
- void usefullcart();
- void newplace();
- //void movemap();
- void loadsample();
- void usecardreader1();
- void usecardreader2();
- void usecardreader3();
- void tattooman();
- void usehandle();
- void openfile();
- void usecharset1();
- //void makenextblock();
- void showpuztext();
- //void addalong();
- //void width160();
- void incryanpage();
- //void dodoor();
- void greyscalesum();
- void buttoneight();
- void findexobject();
- void errormessage2();
- void usechurchhole();
- void searchforfiles();
- void monkspeaking();
- void fadecalculation();
- //void waitframes();
- void clearrest();
- //void getreelframeax();
- void barwoman();
- void roomname();
- void credits();
- void madmanrun();
- void randomnum1();
- void keeper();
- void afternewroom();
- void getexad();
- void openforsave();
- void closefile();
- void delcurs();
- void randomaccess();
- void splitintolines();
- //void checkifex();
- //void findobname();
- void initialmoncols();
- void checkforshake();
- void usebuttona();
- void fadescreenup();
- //void getnextword();
- void generalerror();
- void actualload();
- void allocateload();
- void saveposition();
- void mode640x480();
- void openeden();
- void execcommand();
- void obsthatdothings();
- void updatesymbolbot();
- void findpuztext();
- void usechurchgate();
- void monkandryan();
- void allocatebuffers();
- void swapwithinv();
- void usecontrol();
- void buttonseven();
- void redrawmainscrn();
- void showgroup();
- //void findallryan();
- //void channel0tran();
- void buttonpress();
- //void parseblaster();
- //void readmouse1();
- void makemainscreen();
- void usewinch();
- void setbotright();
- //void readmouse3();
- void showfirstuse();
- void setupemm();
- void aide();
- //void getmapad();
- void getlocation();
- void geteitherad();
- //void placesetobject();
- //void drawflags();
- void zoomonoff();
- void updatesymboltop();
- //void showryanpage();
- void printlogo();
- void allpointer();
- void showseconduse();
- void clearreels();
- void malefan();
- void dosaveload();
- void createname();
- void readcitypic();
- void getpersontext();
- void intoinv();
- void showtime();
+ void searchForString();
+ void selectOpenOb();
+ void useGun();
+ void useHandle();
+ void incRyanPage();
+ void findExObject();
+ void clearChanges();
+ void searchForFiles();
+ void getExAd();
+ void initialMonCols();
+ void execCommand();
+ void updateSymbolBot();
+ void findPuzText();
+ void swapWithInv();
+ void useControl();
+ void adjustRight();
+ void transferToEx();
+ void updateSymbolTop();
+ void getPersonText();
void parser();
- void hangonw();
- void intro();
- //void hangonp();
- void fadescreendowns();
- void openhoteldoor2();
- void getridoftempsp();
- void scanfornames();
- //void setallchanges();
- void readsetdata();
- //void printboth();
- void standardload();
- void undertextline();
- void findroominloc();
- void sitdowninbar();
- void shownames();
- void savefileread();
- void emergencypurge();
- void usemenu();
- void alleybarksound();
- void dosometalk();
- void usecart();
- void intromusic();
- void quitkey();
- void processtrigger();
- void monmessage();
- void readdesticon();
- void randomnum2();
- void loadsecondsample();
- void transfercontoex();
- //void multiput();
- //void printmessage();
- void businessman();
- void switchryanoff();
- //void commandwithob();
- void panelicons1();
- void adjustdown();
- void withwhat();
- void openob();
- void createfile();
- void userailing();
- void accesslightoff();
- void usehole();
- void useobject();
- void volumeadjust();
- //void checkiffree();
+ void emergencyPurge();
+ void processTrigger();
+ void transferConToEx();
+ void adjustDown();
+ void withWhat();
};
-}
+
+} // End of namespace DreamGen
#endif
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp
index 0e43f18db6..b4fc1b7b77 100644
--- a/engines/dreamweb/dreamweb.cpp
+++ b/engines/dreamweb/dreamweb.cpp
@@ -30,9 +30,6 @@
#include "common/timer.h"
#include "common/util.h"
-#include "audio/mixer.h"
-#include "audio/decoders/raw.h"
-
#include "graphics/palette.h"
#include "graphics/surface.h"
@@ -42,9 +39,8 @@
namespace DreamWeb {
DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gameDesc) :
- Engine(syst), _gameDescription(gameDesc), _rnd("dreamweb") {
+ Engine(syst), _gameDescription(gameDesc), _rnd("dreamweb"), _context(this), _base(_context) {
- _context.engine = this;
// Setup mixer
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
@@ -55,7 +51,6 @@ DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gam
_console = 0;
DebugMan.addDebugChannel(kDebugAnimation, "Animation", "Animation Debug Flag");
DebugMan.addDebugChannel(kDebugSaveLoad, "SaveLoad", "Track Save/Load Function");
- _outSaveFile = 0;
_inSaveFile = 0;
_speed = 1;
_turbo = false;
@@ -63,10 +58,18 @@ DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gam
_channel0 = 0;
_channel1 = 0;
+ _icons1 = NULL;
+ _icons2 = NULL;
+ _tempCharset = NULL;
+
_language = gameDesc->desc.language;
}
DreamWebEngine::~DreamWebEngine() {
+ assert(_icons1 == NULL);
+ assert(_icons2 == NULL);
+ assert(_tempCharset == NULL);
+
DebugMan.clearAllDebugChannels();
delete _console;
}
@@ -93,19 +96,18 @@ void DreamWebEngine::waitForVSync() {
setVSyncInterrupt(false);
}
- _context.doshake();
- _context.dofade();
+ _base.doShake();
+ _base.doFade();
_system->updateScreen();
}
void DreamWebEngine::quit() {
- _context.data.byte(DreamGen::DreamGenContext::kQuitrequested) = 1;
- _context.data.byte(DreamGen::DreamGenContext::kLasthardkey) = 1;
+ _base.data.byte(DreamGen::kQuitrequested) = 1;
+ _base.data.byte(DreamGen::kLasthardkey) = 1;
}
void DreamWebEngine::processEvents() {
- Common::EventManager *event_manager = _system->getEventManager();
- if (event_manager->shouldQuit()) {
+ if (_eventMan->shouldQuit()) {
quit();
return;
}
@@ -113,7 +115,7 @@ void DreamWebEngine::processEvents() {
soundHandler();
Common::Event event;
int softKey, hardKey;
- while (event_manager->pollEvent(event)) {
+ while (_eventMan->pollEvent(event)) {
switch(event.type) {
case Common::EVENT_RTL:
quit();
@@ -136,8 +138,8 @@ void DreamWebEngine::processEvents() {
break;
case Common::KEYCODE_c: //skip statue puzzle
- _context.data.byte(DreamGen::DreamGenContext::kSymbolbotnum) = 3;
- _context.data.byte(DreamGen::DreamGenContext::kSymboltopnum) = 5;
+ _base.data.byte(DreamGen::kSymbolbotnum) = 3;
+ _base.data.byte(DreamGen::kSymboltopnum) = 5;
break;
default:
@@ -167,7 +169,7 @@ void DreamWebEngine::processEvents() {
break;
}
- _context.data.byte(DreamGen::DreamGenContext::kLasthardkey) = hardKey;
+ _base.data.byte(DreamGen::kLasthardkey) = hardKey;
// The rest of the keys are converted to ASCII. This
// is fairly restrictive, and eventually we may want
@@ -203,18 +205,17 @@ void DreamWebEngine::processEvents() {
}
}
-
Common::Error DreamWebEngine::run() {
syncSoundSettings();
_console = new DreamWebConsole(this);
ConfMan.registerDefault("dreamweb_originalsaveload", "true");
- getTimerManager()->installTimerProc(vSyncInterrupt, 1000000 / 70, this, "dreamwebVSync");
+ _timer->installTimerProc(vSyncInterrupt, 1000000 / 70, this, "dreamwebVSync");
_context.__start();
- _context.data.byte(DreamGen::DreamGenContext::kQuitrequested) = 0;
+ _base.data.byte(DreamGen::kQuitrequested) = 0;
- getTimerManager()->removeTimerProc(vSyncInterrupt);
+ _timer->removeTimerProc(vSyncInterrupt);
return Common::kNoError;
}
@@ -222,8 +223,8 @@ Common::Error DreamWebEngine::run() {
void DreamWebEngine::setSpeed(uint speed) {
debug(0, "setting speed %u", speed);
_speed = speed;
- getTimerManager()->removeTimerProc(vSyncInterrupt);
- getTimerManager()->installTimerProc(vSyncInterrupt, 1000000 / 70 / speed, this, "dreamwebVSync");
+ _timer->removeTimerProc(vSyncInterrupt);
+ _timer->installTimerProc(vSyncInterrupt, 1000000 / 70 / speed, this, "dreamwebVSync");
}
void DreamWebEngine::openFile(const Common::String &name) {
@@ -231,7 +232,10 @@ void DreamWebEngine::openFile(const Common::String &name) {
closeFile();
if (_file.open(name))
return;
- _inSaveFile = _system->getSavefileManager()->openForLoading(name);
+ // File not found? See if there is a save state with this name
+ // FIXME: Is this really needed? If yes, document why; if not,
+ // remove all traces of _inSaveFile.
+ _inSaveFile = _saveFileMan->openForLoading(name);
if (_inSaveFile)
return;
error("cannot open file %s", name.c_str());
@@ -258,55 +262,32 @@ void DreamWebEngine::closeFile() {
_file.close();
delete _inSaveFile;
_inSaveFile = 0;
- delete _outSaveFile;
- _outSaveFile = 0;
-}
-
-void DreamWebEngine::openSaveFileForWriting(const Common::String &name) {
- processEvents();
- delete _outSaveFile;
- _outSaveFile = _system->getSavefileManager()->openForSaving(name);
-}
-
-bool DreamWebEngine::openSaveFileForReading(const Common::String &name) {
- processEvents();
- delete _inSaveFile;
- _inSaveFile = _system->getSavefileManager()->openForLoading(name);
- return _inSaveFile != 0;
-}
-
-uint DreamWebEngine::writeToSaveFile(const uint8 *data, uint size) {
- processEvents();
- if (!_outSaveFile)
- error("save file was not opened for writing");
- return _outSaveFile->write(data, size);
}
-uint DreamWebEngine::readFromSaveFile(uint8 *data, uint size) {
- processEvents();
- if (!_inSaveFile)
- error("save file was not opened for reading");
- return _inSaveFile->read(data, size);
+Common::String DreamWebEngine::getSavegameFilename(int slot) const {
+ // TODO: Are saves from all versions of Dreamweb compatible with each other?
+ // Then we can can consider keeping the filenames as DREAMWEB.Dnn.
+ // Otherwise, this must be changed to be target dependent.
+ //Common::String filename = _targetName + Common::String::format(".d%02d", savegameId);
+ Common::String filename = Common::String::format("DREAMWEB.D%02d", slot);
+ return filename;
}
-
void DreamWebEngine::keyPressed(uint16 ascii) {
debug(2, "key pressed = %04x", ascii);
- uint8* keybuf = _context.data.ptr(5912, 16); //fixme: some hardcoded offsets are not added as consts
- uint16 in = (_context.data.word(DreamGen::DreamGenContext::kBufferin) + 1) & 0x0f;
- uint16 out = _context.data.word(DreamGen::DreamGenContext::kBufferout);
+ uint16 in = (_base.data.word(DreamGen::kBufferin) + 1) & 0x0f;
+ uint16 out = _base.data.word(DreamGen::kBufferout);
if (in == out) {
warning("keyboard buffer is full");
return;
}
- _context.data.word(DreamGen::DreamGenContext::kBufferin) = in;
- keybuf[in] = ascii;
+ _base.data.word(DreamGen::kBufferin) = in;
+ DreamGen::g_keyBuffer[in] = ascii;
}
void DreamWebEngine::mouseCall(uint16 *x, uint16 *y, uint16 *state) {
processEvents();
- Common::EventManager *eventMan = _system->getEventManager();
- Common::Point pos = eventMan->getMousePos();
+ Common::Point pos = _eventMan->getMousePos();
if (pos.x > 298)
pos.x = 298;
if (pos.x < 15)
@@ -318,54 +299,26 @@ void DreamWebEngine::mouseCall(uint16 *x, uint16 *y, uint16 *state) {
*x = pos.x;
*y = pos.y;
- unsigned newState = eventMan->getButtonState();
+ unsigned newState = _eventMan->getButtonState();
*state = (newState == _oldMouseState? 0 : newState);
_oldMouseState = newState;
}
-void DreamWebEngine::fadeDos() {
- _context.ds = _context.es = _context.data.word(DreamGen::DreamGenContext::kBuffers);
- return; //fixme later
- waitForVSync();
- //processEvents will be called from vsync
- uint8 *dst = _context.es.ptr(DreamGen::DreamGenContext::kStartpal, 768);
- getPalette(dst, 0, 64);
- for(int fade = 0; fade < 64; ++fade) {
- for(int c = 0; c < 768; ++c) { //original sources decrement 768 values -> 256 colors
- if (dst[c]) {
- --dst[c];
- }
- }
- setPalette(dst, 0, 64);
- waitForVSync();
- }
-}
-
-void DreamWebEngine::setPalette() {
- processEvents();
- unsigned n = (uint16)_context.cx;
- uint8 *src = _context.ds.ptr(_context.si, n * 3);
- setPalette(src, _context.al, n);
- _context.si += n * 3;
- _context.cx = 0;
-}
-
void DreamWebEngine::getPalette(uint8 *data, uint start, uint count) {
_system->getPaletteManager()->grabPalette(data, start, count);
- while(count--)
+ while (count--)
*data++ >>= 2;
}
void DreamWebEngine::setPalette(const uint8 *data, uint start, uint count) {
assert(start + count <= 256);
uint8 fixed[768];
- for(uint i = 0; i < count * 3; ++i) {
+ for (uint i = 0; i < count * 3; ++i) {
fixed[i] = data[i] << 2;
}
_system->getPaletteManager()->setPalette(fixed, start, count);
}
-
void DreamWebEngine::blit(const uint8 *src, int pitch, int x, int y, int w, int h) {
if (y + h > 200)
h = 200 - y;
@@ -377,28 +330,23 @@ void DreamWebEngine::blit(const uint8 *src, int pitch, int x, int y, int w, int
}
void DreamWebEngine::printUnderMonitor() {
- _context.es = _context.data.word(DreamGen::DreamGenContext::kWorkspace);
- _context.di = DreamGen::DreamGenContext::kScreenwidth * 43 + 76;
- _context.si = _context.di + 8 * DreamGen::DreamGenContext::kScreenwidth;
+ uint8 *dst = _base._workspace + DreamGen::kScreenwidth * 43 + 76;
Graphics::Surface *s = _system->lockScreen();
if (!s)
error("lockScreen failed");
- for(uint y = 0; y < 104; ++y) {
+ for (uint y = 0; y < 104; ++y) {
uint8 *src = (uint8 *)s->getBasePtr(76, 43 + 8 + y);
- uint8 *dst = _context.es.ptr(_context.di, 170);
- for(uint x = 0; x < 170; ++x) {
+ for (uint x = 0; x < 170; ++x) {
if (*src < 231)
*dst++ = *src++;
else {
++dst; ++src;
}
}
- _context._add(_context.di, DreamGen::DreamGenContext::kScreenwidth);
- _context._add(_context.si, DreamGen::DreamGenContext::kScreenwidth);
+ dst += DreamGen::kScreenwidth - 170;
}
- _context.cx = 0;
_system->unlockScreen();
}
@@ -406,173 +354,6 @@ void DreamWebEngine::cls() {
_system->fillScreen(0);
}
-void DreamWebEngine::playSound(uint8 channel, uint8 id, uint8 loops) {
- debug(1, "playSound(%u, %u, %u)", channel, id, loops);
-
- int bank = 0;
- bool speech = false;
- Audio::Mixer::SoundType type = channel == 0?
- Audio::Mixer::kMusicSoundType: Audio::Mixer::kSFXSoundType;
-
- if (id >= 12) {
- id -= 12;
- bank = 1;
- if (id == 50) {
- speech = true;
- type = Audio::Mixer::kSpeechSoundType;
- }
- }
- const SoundData &data = _soundData[bank];
-
- Audio::SeekableAudioStream *raw;
- if (!speech) {
- if (id >= data.samples.size() || data.samples[id].size == 0) {
- warning("invalid sample #%u played", id);
- return;
- }
-
- const Sample &sample = data.samples[id];
- uint8 *buffer = (uint8 *)malloc(sample.size);
- if (!buffer)
- error("out of memory: cannot allocate memory for sound(%u bytes)", sample.size);
- memcpy(buffer, data.data.begin() + sample.offset, sample.size);
-
- raw = Audio::makeRawStream(
- buffer,
- sample.size, 22050, Audio::FLAG_UNSIGNED);
- } else {
- uint8 *buffer = (uint8 *)malloc(_speechData.size());
- memcpy(buffer, _speechData.begin(), _speechData.size());
- if (!buffer)
- error("out of memory: cannot allocate memory for sound(%u bytes)", _speechData.size());
- raw = Audio::makeRawStream(
- buffer,
- _speechData.size(), 22050, Audio::FLAG_UNSIGNED);
-
- }
-
- Audio::AudioStream *stream;
- if (loops > 1) {
- stream = new Audio::LoopingAudioStream(raw, loops < 255? loops: 0);
- } else
- stream = raw;
-
- if (_mixer->isSoundHandleActive(_channelHandle[channel]))
- _mixer->stopHandle(_channelHandle[channel]);
- _mixer->playStream(type, &_channelHandle[channel], stream);
-}
-
-void DreamWebEngine::stopSound(uint8 channel) {
- debug(1, "stopSound(%u)", channel);
- assert(channel == 0 || channel == 1);
- _mixer->stopHandle(_channelHandle[channel]);
- if (channel == 0)
- _channel0 = 0;
- else
- _channel1 = 0;
-}
-
-bool DreamWebEngine::loadSpeech(const Common::String &filename) {
- if (ConfMan.getBool("speech_mute"))
- return false;
-
- Common::File file;
- if (!file.open("speech/" + filename))
- return false;
-
- debug(1, "loadSpeech(%s)", filename.c_str());
-
- uint size = file.size();
- _speechData.resize(size);
- file.read(_speechData.begin(), size);
- file.close();
- return true;
-}
-
-
-void DreamWebEngine::soundHandler() {
- _context.data.byte(_context.kSubtitles) = ConfMan.getBool("subtitles");
- _context.push(_context.ax);
- _context.volumeadjust();
- _context.ax = _context.pop();
-
- uint volume = _context.data.byte(DreamGen::DreamGenContext::kVolume);
- //.vol file loaded into soundbuf:0x4000
- //volume table at (volume * 0x100 + 0x3f00)
- //volume value could be from 1 to 7
- //1 - 0x10-0xff
- //2 - 0x1f-0xdf
- //3 - 0x2f-0xd0
- //4 - 0x3e-0xc1
- //5 - 0x4d-0xb2
- //6 - 0x5d-0xa2
- //7 - 0x6f-0x91
- if (volume >= 8)
- volume = 7;
- volume = (8 - volume) * Audio::Mixer::kMaxChannelVolume / 8;
- _mixer->setChannelVolume(_channelHandle[0], volume);
-
- uint8 ch0 = _context.data.byte(DreamGen::DreamGenContext::kCh0playing);
- if (ch0 == 255)
- ch0 = 0;
- uint8 ch1 = _context.data.byte(DreamGen::DreamGenContext::kCh1playing);
- if (ch1 == 255)
- ch1 = 0;
- uint8 ch0loop = _context.data.byte(DreamGen::DreamGenContext::kCh0repeat);
-
- if (_channel0 != ch0) {
- _channel0 = ch0;
- if (ch0) {
- playSound(0, ch0, ch0loop);
- }
- }
- if (_channel1 != ch1) {
- _channel1 = ch1;
- if (ch1) {
- playSound(1, ch1, 1);
- }
- }
- if (!_mixer->isSoundHandleActive(_channelHandle[0])) {
- _context.data.byte(DreamGen::DreamGenContext::kCh0playing) = 255;
- _channel0 = 0;
- }
- if (!_mixer->isSoundHandleActive(_channelHandle[1])) {
- _context.data.byte(DreamGen::DreamGenContext::kCh1playing) = 255;
- _channel1 = 0;
- }
-
-}
-
-void DreamWebEngine::loadSounds(uint bank, const Common::String &filename) {
- debug(1, "loadSounds(%u, %s)", bank, filename.c_str());
- Common::File file;
- if (!file.open(filename)) {
- warning("cannot open %s", filename.c_str());
- return;
- }
-
- uint8 header[0x60];
- file.read(header, sizeof(header));
- uint tablesize = READ_LE_UINT16(header + 0x32);
- debug(1, "table size = %u", tablesize);
-
- SoundData &soundData = _soundData[bank];
- soundData.samples.resize(tablesize / 6);
- uint total = 0;
- for(uint i = 0; i < tablesize / 6; ++i) {
- uint8 entry[6];
- Sample &sample = soundData.samples[i];
- file.read(entry, sizeof(entry));
- sample.offset = entry[0] * 0x4000 + READ_LE_UINT16(entry + 1);
- sample.size = READ_LE_UINT16(entry + 3) * 0x800;
- total += sample.size;
- debug(1, "offset: %08x, size: %u", sample.offset, sample.size);
- }
- soundData.data.resize(total);
- file.read(soundData.data.begin(), total);
- file.close();
-}
-
uint8 DreamWebEngine::modifyChar(uint8 c) const {
if (c < 128)
return c;
diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h
index 97f6007f9d..7ff0005fa4 100644
--- a/engines/dreamweb/dreamweb.h
+++ b/engines/dreamweb/dreamweb.h
@@ -40,6 +40,20 @@
#include "dreamweb/dreamgen.h"
#include "dreamweb/console.h"
+#include "dreamweb/structs.h"
+
+namespace DreamGen {
+
+// These are for ReelRoutine::reelPointer, which is a callback field.
+const uint16 addr_backobject = 0xc170;
+const uint16 addr_mainman = 0xc138;
+
+// Keyboard buffer. data.word(kBufferin) and data.word(kBufferout) are indexes
+// into this, making it a ring buffer
+extern uint8 g_keyBuffer[16];
+
+}
+
namespace DreamWeb {
// Engine Debug Flags
@@ -84,19 +98,13 @@ public:
void mouseCall(uint16 *x, uint16 *y, uint16 *state); //fill mouse pos and button state
void processEvents();
- void setPalette();
- void fadeDos();
void blit(const uint8 *src, int pitch, int x, int y, int w, int h);
void cls();
void getPalette(uint8 *data, uint start, uint count);
void setPalette(const uint8 *data, uint start, uint count);
- void openSaveFileForWriting(const Common::String &name);
- uint writeToSaveFile(const uint8 *data, uint size);
-
- bool openSaveFileForReading(const Common::String &name);
- uint readFromSaveFile(uint8 *data, uint size);
+ Common::String getSavegameFilename(int slot) const;
void setShakePos(int pos) { _system->setShakePos(pos); }
void printUnderMonitor();
@@ -113,6 +121,20 @@ public:
void stopSound(uint8 channel);
+ DreamGen::Frame *icons1() const { return (DreamGen::Frame *)_icons1; }
+ DreamGen::Frame *icons2() const { return (DreamGen::Frame *)_icons2; }
+ void setIcons1(void *frames) { assert(_icons1 == NULL); _icons1 = frames; }
+ void setIcons2(void *frames) { assert(_icons2 == NULL); _icons2 = frames; }
+ void freeIcons1() { free(_icons1); _icons1 = NULL; }
+ void freeIcons2() { free(_icons2); _icons2 = NULL; }
+
+ DreamGen::Frame *tempCharset() const { return (DreamGen::Frame *)_tempCharset; }
+ void setTempCharset(void *frames) { assert(_tempCharset == NULL); _tempCharset = frames; }
+ void freeTempCharset() { free(_tempCharset); _tempCharset = NULL; }
+
+ DreamGen::Frame *currentCharset() const { return _currentCharset; }
+ void setCurrentCharset(DreamGen::Frame *charset) { _currentCharset = charset; }
+
private:
void keyPressed(uint16 ascii);
void setSpeed(uint speed);
@@ -123,7 +145,6 @@ private:
Common::RandomSource _rnd;
Common::File _file;
- Common::OutSaveFile *_outSaveFile;
Common::InSaveFile *_inSaveFile;
uint _speed;
@@ -148,7 +169,13 @@ private:
Audio::SoundHandle _channelHandle[2];
uint8 _channel0, _channel1;
+ void *_icons1;
+ void *_icons2;
+ void *_tempCharset;
+ DreamGen::Frame *_currentCharset;
+
DreamGen::DreamGenContext _context;
+ DreamGen::DreamBase &_base;
};
} // End of namespace DreamWeb
diff --git a/engines/dreamweb/keypad.cpp b/engines/dreamweb/keypad.cpp
new file mode 100644
index 0000000000..09bdcb837b
--- /dev/null
+++ b/engines/dreamweb/keypad.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.
+ *
+ */
+
+#include "dreamweb/dreamweb.h"
+
+namespace DreamGen {
+
+void DreamGenContext::getUnderMenu() {
+ multiGet(getSegment(data.word(kBuffers)).ptr(kUndertimedtext, 0), kMenux, kMenuy, 48, 48);
+}
+
+void DreamGenContext::putUnderMenu() {
+ multiPut(getSegment(data.word(kBuffers)).ptr(kUndertimedtext, 0), kMenux, kMenuy, 48, 48);
+}
+
+void DreamGenContext::singleKey(uint8 key, uint16 x, uint16 y) {
+ if (key == data.byte(kGraphicpress)) {
+ key += 11;
+ if (data.byte(kPresscount) < 8)
+ key -= 11;
+ }
+ key -= 20;
+ showFrame(tempGraphics(), x, y, key, 0);
+}
+
+void DreamGenContext::loadKeypad() {
+ loadIntoTemp("DREAMWEB.G02");
+}
+
+void DreamGenContext::showKeypad() {
+ singleKey(22, kKeypadx+9, kKeypady+5);
+ singleKey(23, kKeypadx+31, kKeypady+5);
+ singleKey(24, kKeypadx+53, kKeypady+5);
+ singleKey(25, kKeypadx+9, kKeypady+23);
+ singleKey(26, kKeypadx+31, kKeypady+23);
+ singleKey(27, kKeypadx+53, kKeypady+23);
+ singleKey(28, kKeypadx+9, kKeypady+41);
+ singleKey(29, kKeypadx+31, kKeypady+41);
+ singleKey(30, kKeypadx+53, kKeypady+41);
+ singleKey(31, kKeypadx+9, kKeypady+59);
+ singleKey(32, kKeypadx+31, kKeypady+59);
+ if (data.byte(kLightcount)) {
+ --data.byte(kLightcount);
+ uint8 frameIndex;
+ uint16 y;
+ if (data.byte(kLockstatus)) {
+ frameIndex = 36;
+ y = kKeypady-1+63;
+ } else {
+ frameIndex = 41;
+ y = kKeypady+4+63;
+ }
+ if ((data.byte(kLightcount) >= 60) && (data.byte(kLightcount) < 100))
+ --frameIndex;
+ showFrame(tempGraphics(), kKeypadx+60, y, frameIndex, 0);
+ }
+}
+
+bool DreamGenContext::isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3) {
+
+ return digit0 == data.byte(kPresslist+0) && digit1 == data.byte(kPresslist+1)
+ && digit2 == data.byte(kPresslist+2) && digit3 == data.byte(kPresslist+3);
+}
+
+void DreamGenContext::addToPressList() {
+ if (data.word(kPresspointer) == 5)
+ return;
+ uint8 pressed = data.byte(kPressed);
+ if (pressed == 10)
+ pressed = 0;
+
+ data.byte(kPresslist + data.word(kPresspointer)) = pressed;
+ ++data.word(kPresspointer);
+}
+
+void DreamGenContext::enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3) {
+ RectWithCallback keypadList[] = {
+ { kKeypadx+9,kKeypadx+30,kKeypady+9,kKeypady+22,&DreamGenContext::buttonOne },
+ { kKeypadx+31,kKeypadx+52,kKeypady+9,kKeypady+22,&DreamGenContext::buttonTwo },
+ { kKeypadx+53,kKeypadx+74,kKeypady+9,kKeypady+22,&DreamGenContext::buttonThree },
+ { kKeypadx+9,kKeypadx+30,kKeypady+23,kKeypady+40,&DreamGenContext::buttonFour },
+ { kKeypadx+31,kKeypadx+52,kKeypady+23,kKeypady+40,&DreamGenContext::buttonFive },
+ { kKeypadx+53,kKeypadx+74,kKeypady+23,kKeypady+40,&DreamGenContext::buttonSix },
+ { kKeypadx+9,kKeypadx+30,kKeypady+41,kKeypady+58,&DreamGenContext::buttonSeven },
+ { kKeypadx+31,kKeypadx+52,kKeypady+41,kKeypady+58,&DreamGenContext::buttonEight },
+ { kKeypadx+53,kKeypadx+74,kKeypady+41,kKeypady+58,&DreamGenContext::buttonNine },
+ { kKeypadx+9,kKeypadx+30,kKeypady+59,kKeypady+73,&DreamGenContext::buttonNought },
+ { kKeypadx+31,kKeypadx+74,kKeypady+59,kKeypady+73,&DreamGenContext::buttonEnter },
+ { kKeypadx+72,kKeypadx+86,kKeypady+80,kKeypady+94,&DreamGenContext::quitKey },
+ { 0,320,0,200,&DreamGenContext::blank },
+ { 0xFFFF,0,0,0,0 }
+ };
+
+ getRidOfReels();
+ loadKeypad();
+ createPanel();
+ showIcon();
+ showOuterPad();
+ showKeypad();
+ readMouse();
+ showPointer();
+ workToScreenCPP();
+ delPointer();
+ data.word(kPresspointer) = 0;
+ data.byte(kGetback) = 0;
+ while (true) {
+ delPointer();
+ readMouse();
+ showKeypad();
+ showPointer();
+ vSync();
+ if (data.byte(kPresscount) == 0) {
+ data.byte(kPressed) = 255;
+ data.byte(kGraphicpress) = 255;
+ vSync();
+ } else
+ --data.byte(kPresscount);
+
+ dumpPointer();
+ dumpKeypad();
+ dumpTextLine();
+ checkCoords(keypadList);
+ if (quitRequested() || (data.byte(kGetback) == 1))
+ break;
+ if (data.byte(kLightcount) == 1) {
+ if (data.byte(kLockstatus) == 0)
+ break;
+ } else {
+ if (data.byte(kPresscount) == 40) {
+ addToPressList();
+ if (data.byte(kPressed) == 11) {
+ if (isItRight(digit0, digit1, digit2, digit3))
+ data.byte(kLockstatus) = 0;
+ playChannel1(11);
+ data.byte(kLightcount) = 120;
+ data.word(kPresspointer) = 0;
+ }
+ }
+ }
+ }
+ data.byte(kManisoffscreen) = 0;
+ getRidOfTemp();
+ restoreReels();
+ redrawMainScrn();
+ workToScreenM();
+}
+
+void DreamGenContext::buttonOne() {
+ buttonPress(1);
+}
+
+void DreamGenContext::buttonTwo() {
+ buttonPress(2);
+}
+
+void DreamGenContext::buttonThree() {
+ buttonPress(3);
+}
+
+void DreamGenContext::buttonFour() {
+ buttonPress(4);
+}
+
+void DreamGenContext::buttonFive() {
+ buttonPress(5);
+}
+
+void DreamGenContext::buttonSix() {
+ buttonPress(6);
+}
+
+void DreamGenContext::buttonSeven() {
+ buttonPress(7);
+}
+
+void DreamGenContext::buttonEight() {
+ buttonPress(8);
+}
+
+void DreamGenContext::buttonNine() {
+ buttonPress(9);
+}
+
+void DreamGenContext::buttonNought() {
+ buttonPress(10);
+}
+
+void DreamGenContext::buttonEnter() {
+ buttonPress(11);
+}
+
+void DreamGenContext::buttonPress(uint8 buttonId) {
+ uint8 commandType = 100 + buttonId;
+ if (data.byte(kCommandtype) != commandType) {
+ data.byte(kCommandtype) = commandType;
+ commandOnly(buttonId + 4);
+ }
+ if ((data.word(kMousebutton) & 1) && (data.word(kMousebutton) != data.word(kOldbutton))) {
+ data.byte(kPressed) = buttonId;
+ data.byte(kGraphicpress) = buttonId + 21;
+ data.byte(kPresscount) = 40;
+ if (buttonId != 11)
+ playChannel1(10);
+ }
+}
+
+void DreamGenContext::showOuterPad() {
+ showFrame(tempGraphics(), kKeypadx-3, kKeypady-4, 1, 0);
+ showFrame(tempGraphics(), kKeypadx+74, kKeypady+76, 37, 0);
+}
+
+void DreamGenContext::dumpKeypad() {
+ multiDump(kKeypadx - 3, kKeypady - 4, 120, 90);
+}
+
+void DreamGenContext::dumpSymbol() {
+ data.byte(kNewtextline) = 0;
+ multiDump(kSymbolx, kSymboly + 20, 104, 60);
+}
+
+void DreamGenContext::dumpSymBox() {
+ if (data.word(kDumpx) != 0xFFFF) {
+ multiDump(data.word(kDumpx), data.word(kDumpy), 30, 77);
+ data.word(kDumpx) = 0xFFFF;
+ }
+}
+
+void DreamGenContext::quitSymbol() {
+ if (data.byte(kSymboltopx) != 24 || data.byte(kSymbolbotx) != 24) {
+ blank();
+ return;
+ };
+
+ if (data.byte(kCommandtype) != 222) {
+ data.byte(kCommandtype) = 222;
+ commandOnly(18);
+ }
+
+ if (data.word(kMousebutton) == data.word(kOldbutton))
+ return; // notqs
+
+ if (!(data.word(kMousebutton) & 1))
+ return;
+
+ data.byte(kGetback) = 1;
+}
+
+} // End of namespace DreamGen
diff --git a/engines/dreamweb/module.mk b/engines/dreamweb/module.mk
index 8cacbdc91e..398f0b8db0 100644
--- a/engines/dreamweb/module.mk
+++ b/engines/dreamweb/module.mk
@@ -6,12 +6,19 @@ MODULE_OBJS := \
detection.o \
dreamweb.o \
dreamgen.o \
+ keypad.o \
+ monitor.o \
+ object.o \
pathfind.o \
+ people.o \
print.o \
saveload.o \
+ sound.o \
sprite.o \
stubs.o \
+ talk.o \
use.o \
+ vgafades.o \
vgagrafx.o
# This module can be built as a plugin
diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp
new file mode 100644
index 0000000000..f01664632a
--- /dev/null
+++ b/engines/dreamweb/monitor.cpp
@@ -0,0 +1,347 @@
+/* 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 {
+
+struct MonitorKeyEntry {
+ uint8 b0;
+ uint8 b1;
+ char b2[24];
+};
+
+void DreamGenContext::useMon() {
+ data.byte(kLasttrigger) = 0;
+ memset(data.ptr(kCurrentfile+1, 0), ' ', 12);
+ memset(data.ptr(offset_operand1+1, 0), ' ', 12);
+
+ MonitorKeyEntry *monitorKeyEntries = (MonitorKeyEntry *)data.ptr(offset_keys, 0);
+ monitorKeyEntries[0].b0 = 1;
+ monitorKeyEntries[1].b0 = 0;
+ monitorKeyEntries[2].b0 = 0;
+ monitorKeyEntries[3].b0 = 0;
+
+ createPanel();
+ showPanel();
+ showIcon();
+ drawFloor();
+ getRidOfAll();
+ loadIntoTemp("DREAMWEB.G03"); // mon. graphic name
+ loadPersonal();
+ loadNews();
+ loadCart();
+ loadTempCharset("DREAMWEB.C01"); // character set 2
+ printOuterMon();
+ initialMonCols();
+ printLogo();
+ workToScreenCPP();
+ turnOnPower();
+ fadeupYellows();
+ fadeupMonFirst();
+ data.word(kMonadx) = 76;
+ data.word(kMonady) = 141;
+ monMessage(1);
+ hangOnCurs(120);
+ monMessage(2);
+ randomAccess(60);
+ monMessage(3);
+ hangOnCurs(100);
+ printLogo();
+ scrollMonitor();
+ data.word(kBufferin) = 0;
+ data.word(kBufferout) = 0;
+ do {
+ di = data.word(kMonadx);
+ bx = data.word(kMonady);
+ push(di);
+ push(bx);
+ input();
+ bx = pop();
+ di = pop();
+ data.word(kMonadx) = di;
+ data.word(kMonady) = bx;
+ execCommand();
+ if (quitRequested()) //TODO : Check why it crashes when put before the execcommand
+ break;
+ } while (al == 0);
+ getRidOfTemp();
+ getRidOfTempCharset();
+ deallocateMem(data.word(kTextfile1));
+ deallocateMem(data.word(kTextfile2));
+ deallocateMem(data.word(kTextfile3));
+ data.byte(kGetback) = 1;
+ playChannel1(26);
+ data.byte(kManisoffscreen) = 0;
+ restoreAll();
+ redrawMainScrn();
+ workToScreenM();
+}
+
+void DreamGenContext::monitorLogo() {
+ if (data.byte(kLogonum) != data.byte(kOldlogonum)) {
+ data.byte(kOldlogonum) = data.byte(kLogonum);
+ printLogo();
+ printUnderMon();
+ workToScreenCPP();
+ printLogo();
+ printLogo();
+ playChannel1(26);
+ randomAccess(20);
+ } else {
+ printLogo();
+ }
+}
+
+void DreamBase::printLogo() {
+ showFrame(tempGraphics(), 56, 32, 0, 0);
+ showCurrentFile();
+}
+
+void DreamGenContext::input() {
+ char *inputLine = (char *)data.ptr(kInputline, 64);
+ memset(inputLine, 0, 64);
+ data.word(kCurpos) = 0;
+ printChar(engine->tempCharset(), data.word(kMonadx), data.word(kMonady), '>', 0, NULL, NULL);
+ multiDump(data.word(kMonadx), data.word(kMonady), 6, 8);
+ data.word(kMonadx) += 6;
+ data.word(kCurslocx) = data.word(kMonadx);
+ data.word(kCurslocy) = data.word(kMonady);
+ while (true) {
+ printCurs();
+ vSync();
+ delCurs();
+ readKey();
+ if (quitRequested())
+ return;
+ uint8 currentKey = data.byte(kCurrentkey);
+ if (currentKey == 0)
+ continue;
+ if (currentKey == 13)
+ return;
+ if (currentKey == 8) {
+ if (data.word(kCurpos) > 0)
+ delChar();
+ continue;
+ }
+ if (data.word(kCurpos) == 28)
+ continue;
+ if ((currentKey == 32) && (data.word(kCurpos) == 0))
+ continue;
+ al = currentKey;
+ makeCaps();
+ currentKey = al;
+ inputLine[data.word(kCurpos) * 2 + 0] = currentKey;
+ if (currentKey > 'Z')
+ continue;
+ multiGet(mapStore() + data.word(kCurpos) * 256, data.word(kMonadx), data.word(kMonady), 8, 8);
+ uint8 charWidth;
+ printChar(engine->tempCharset(), data.word(kMonadx), data.word(kMonady), currentKey, 0, &charWidth, NULL);
+ inputLine[data.word(kCurpos) * 2 + 1] = charWidth;
+ data.word(kMonadx) += charWidth;
+ ++data.word(kCurpos);
+ data.word(kCurslocx) += charWidth;
+ }
+}
+
+void DreamGenContext::delChar() {
+ char *inputLine = (char *)data.ptr(kInputline, 0);
+ --data.word(kCurpos);
+ inputLine[data.word(kCurpos) * 2] = 0;
+ uint8 width = inputLine[data.word(kCurpos) * 2 + 1];
+ data.word(kMonadx) -= width;
+ data.word(kCurslocx) -= width;
+ uint16 offset = data.word(kCurpos);
+ offset = ((offset & 0x00ff) << 8) | ((offset & 0xff00) >> 8);
+ multiPut(mapStore() + offset, data.word(kMonadx), data.word(kMonady), 8, 8);
+ multiDump(data.word(kMonadx), data.word(kMonady), al, 8);
+}
+
+void DreamBase::printCurs() {
+ uint16 x = data.word(kCurslocx);
+ uint16 y = data.word(kCurslocy);
+ uint16 height;
+ if (data.byte(kForeignrelease)) {
+ y -= 3;
+ height = 11;
+ } else
+ height = 8;
+ multiGet(textUnder(), x, y, 6, height);
+ ++data.word(kMaintimer);
+ if ((data.word(kMaintimer) & 16) == 0)
+ showFrame(engine->tempCharset(), x, y, '/' - 32, 0);
+ multiDump(x - 6, y, 12, height);
+}
+
+void DreamBase::delCurs() {
+ uint16 x = data.word(kCurslocx);
+ uint16 y = data.word(kCurslocy);
+ uint16 width = 6;
+ uint16 height;
+ if (data.byte(kForeignrelease)) {
+ y -= 3;
+ height = 11;
+ } else
+ height = 8;
+ multiPut(textUnder(), x, y, width, height);
+ multiDump(x, y, width, height);
+}
+
+void DreamGenContext::hangOnCurs() {
+ hangOnCurs(cx);
+}
+
+void DreamBase::scrollMonitor() {
+ printLogo();
+ printUnderMon();
+ workToScreenCPP();
+ playChannel1(25);
+}
+
+void DreamBase::showCurrentFile() {
+ uint16 x = 178; // TODO: Looks like this hardcoded constant in the asm doesn't match the frame
+ const char *currentFile = (const char *)data.ptr(kCurrentfile+1, 0);
+ while (*currentFile) {
+ char c = *currentFile++;
+ c = engine->modifyChar(c);
+ printChar(engine->tempCharset(), &x, 37, c, 0, NULL, NULL);
+ }
+}
+
+void DreamBase::accessLightOn() {
+ showFrame(tempGraphics(), 74, 182, 8, 0);
+ multiDump(74, 182, 12, 8);
+}
+
+void DreamBase::accessLightOff() {
+ showFrame(tempGraphics(), 74, 182, 7, 0);
+ multiDump(74, 182, 12, 8);
+}
+
+void DreamGenContext::randomAccess() {
+ randomAccess(cx);
+}
+
+void DreamGenContext::randomAccess(uint16 count) {
+ for (uint16 i = 0; i < count; ++i) {
+ vSync();
+ vSync();
+ uint16 v = engine->randomNumber() & 15;
+ if (v < 10)
+ accessLightOff();
+ else
+ accessLightOn();
+ }
+ accessLightOff();
+}
+
+void DreamGenContext::monMessage() {
+ monMessage(al);
+}
+
+void DreamGenContext::monMessage(uint8 index) {
+ assert(index > 0);
+ const char *string = (const char *)getSegment(data.word(kTextfile1)).ptr(kTextstart, 0);
+ for (uint8 i = 0; i < index; ++i) {
+ while (*string++ != '+') {
+ }
+ }
+ monPrint(string);
+}
+
+void DreamGenContext::netError() {
+ monMessage(5);
+ scrollMonitor();
+}
+
+void DreamBase::powerLightOn() {
+ showFrame(tempGraphics(), 257+4, 182, 6, 0);
+ multiDump(257+4, 182, 12, 8);
+}
+
+void DreamBase::powerLightOff() {
+ showFrame(tempGraphics(), 257+4, 182, 5, 0);
+ multiDump(257+4, 182, 12, 8);
+}
+
+void DreamBase::lockLightOn() {
+ showFrame(tempGraphics(), 56, 182, 10, 0);
+ multiDump(58, 182, 12, 8);
+}
+
+void DreamBase::lockLightOff() {
+ showFrame(tempGraphics(), 56, 182, 9, 0);
+ multiDump(58, 182, 12, 8);
+}
+
+void DreamBase::turnOnPower() {
+ for (size_t i = 0; i < 3; ++i) {
+ powerLightOn();
+ hangOn(30);
+ powerLightOff();
+ hangOn(30);
+ }
+ powerLightOn();
+}
+
+void DreamBase::printOuterMon() {
+ showFrame(tempGraphics(), 40, 32, 1, 0);
+ showFrame(tempGraphics(), 264, 32, 2, 0);
+ showFrame(tempGraphics(), 40, 12, 3, 0);
+ showFrame(tempGraphics(), 40, 164, 4, 0);
+}
+
+void DreamGenContext::loadPersonal() {
+ if (data.byte(kLocation) == 0 || data.byte(kLocation) == 42)
+ data.word(kTextfile1) = standardLoad("DREAMWEB.T01"); // monitor file 1
+ else
+ data.word(kTextfile1) = standardLoad("DREAMWEB.T02"); // monitor file 2
+}
+
+void DreamGenContext::loadNews() {
+ // textfile2 holds information accessible by anyone
+ if (data.byte(kNewsitem) == 0)
+ data.word(kTextfile2) = standardLoad("DREAMWEB.T10"); // monitor file 10
+ else if (data.byte(kNewsitem) == 1)
+ data.word(kTextfile2) = standardLoad("DREAMWEB.T11"); // monitor file 11
+ else if (data.byte(kNewsitem) == 2)
+ data.word(kTextfile2) = standardLoad("DREAMWEB.T12"); // monitor file 12
+ else
+ data.word(kTextfile2) = standardLoad("DREAMWEB.T13"); // monitor file 13
+}
+
+void DreamGenContext::loadCart() {
+ lookInInterface();
+
+ if (al == 0)
+ data.word(kTextfile3) = standardLoad("DREAMWEB.T20"); // monitor file 20
+ else if (al == 1)
+ data.word(kTextfile3) = standardLoad("DREAMWEB.T21"); // monitor file 21
+ else if (al == 2)
+ data.word(kTextfile3) = standardLoad("DREAMWEB.T22"); // monitor file 22
+ else if (al == 3)
+ data.word(kTextfile3) = standardLoad("DREAMWEB.T23"); // monitor file 23
+ else
+ data.word(kTextfile3) = standardLoad("DREAMWEB.T24"); // monitor file 24
+}
+
+} // End of namespace DreamGen
diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp
new file mode 100644
index 0000000000..53d834e74c
--- /dev/null
+++ b/engines/dreamweb/object.cpp
@@ -0,0 +1,266 @@
+/* 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 {
+
+void DreamGenContext::fillRyan() {
+ uint8 *inv = getSegment(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::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::wornError() {
+ data.byte(kCommandtype) = 255;
+ delPointer();
+ printMessage(76, 21, 57, 240, false);
+ workToScreenM();
+ hangOnP(50);
+ showPanel();
+ showMan();
+ examIcon();
+ data.byte(kCommandtype) = 255;
+ workToScreenM();
+}
+
+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) {
+ showFrame(engine->icons1(), x - 2, y - 1, 10, 0);
+ if (index == 0xff)
+ return;
+
+ Frame *extras = (Frame *)getSegment(data.word(kExtras)).ptr(0, 0);
+ Frame *frees = (Frame *)getSegment(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(engine->icons1(), x - 3, y - 2, 7, 0);
+}
+
+void DreamGenContext::obPicture() {
+ if (data.byte(kObjecttype) == 1)
+ return;
+ Frame *frames;
+ if (data.byte(kObjecttype) == 4)
+ frames = (Frame *)getSegment(data.word(kExtras)).ptr(0, 0);
+ else
+ frames = (Frame *)getSegment(data.word(kFreeframes)).ptr(0, 0);
+ uint8 frame = 3 * data.byte(kCommand) + 1;
+ showFrame(frames, 160, 68, frame, 0x80);
+}
+
+void DreamBase::obIcons() {
+ uint8 value1, value2;
+ getAnyAd(&value1, &value2);
+ if (value1 != 0xff) {
+ // can open it
+ showFrame(engine->icons2(), 210, 1, 4, 0);
+ }
+
+ showFrame(engine->icons2(), 260, 1, 1, 0);
+}
+
+void DreamGenContext::examineOb(bool examineAgain) {
+ data.byte(kPointermode) = 0;
+ data.word(kTimecount) = 0;
+ while (true) {
+ if (examineAgain) {
+ data.byte(kInmaparea) = 0;
+ data.byte(kExamagain) = 0;
+ data.byte(kOpenedob) = 255;
+ data.byte(kOpenedtype) = 255;
+ data.byte(kInvopen) = 0;
+ al = data.byte(kCommandtype);
+ data.byte(kObjecttype) = al;
+ data.byte(kItemframe) = 0;
+ data.byte(kPointerframe) = 0;
+ createPanel();
+ showPanel();
+ showMan();
+ showExit();
+ obIcons();
+ obPicture();
+ describeOb();
+ underTextLine();
+ data.byte(kCommandtype) = 255;
+ readMouse();
+ showPointer();
+ workToScreenCPP();
+ delPointer();
+ examineAgain = false;
+ }
+
+ readMouse();
+ showPointer();
+ vSync();
+ dumpPointer();
+ dumpTextLine();
+ delPointer();
+ data.byte(kGetback) = 0;
+ switch (data.byte(kInvopen)) {
+ case 0: {
+ RectWithCallback examList[] = {
+ { 273,320,157,198,&DreamGenContext::getBackFromOb },
+ { 260,300,0,44,&DreamGenContext::useObject },
+ { 210,254,0,44,&DreamGenContext::selectOpenOb },
+ { 144,176,64,96,&DreamGenContext::setPickup },
+ { 0,50,50,200,&DreamGenContext::examineInventory },
+ { 0,320,0,200,&DreamGenContext::blank },
+ { 0xFFFF,0,0,0,0 }
+ };
+ checkCoords(examList);
+ break;
+ }
+ case 1: {
+ // NB: This table contains the non-constant openChangeSize!
+ RectWithCallback invList1[] = {
+ { 273,320,157,198,&DreamGenContext::getBackFromOb },
+ { 255,294,0,24,&DreamGenContext::dropObject },
+ { kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamGenContext::incRyanPage },
+ { kInventx, data.word(offset_openchangesize),kInventy+100,kInventy+100+kItempicsize,&DreamGenContext::useOpened },
+ { kInventx,kInventx+(5*kItempicsize), kInventy,kInventy+(2*kItempicsize),&DreamGenContext::inToInv },
+ { 0,320,0,200,&DreamGenContext::blank },
+ { 0xFFFF,0,0,0,0 }
+ };
+ checkCoords(invList1);
+ break;
+ }
+ default: {
+ RectWithCallback withList1[] = {
+ { 273,320,157,198,&DreamGenContext::getBackFromOb },
+ { kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamGenContext::incRyanPage },
+ { kInventx,kInventx+(5*kItempicsize), kInventy,kInventy+(2*kItempicsize),&DreamGenContext::selectOb },
+ { 0,320,0,200,&DreamGenContext::blank },
+ { 0xFFFF,0,0,0,0 }
+ };
+ checkCoords(withList1);
+ break;
+ }
+ }
+ if (data.byte(kQuitrequested) != 0)
+ break;
+ if (data.byte(kExamagain) != 0)
+ examineAgain = true;
+ else if (data.byte(kGetback) != 0)
+ break;
+ }
+
+ data.byte(kPickup) = 0;
+ if (data.word(kWatchingtime) != 0 || data.byte(kNewlocation) == 255) {
+ // isWatching
+ makeMainScreen();
+ }
+
+ data.byte(kInvopen) = 0;
+ data.byte(kOpenedob) = 255;
+}
+
+void DreamGenContext::inventory() {
+ if (data.byte(kMandead) == 1 || data.word(kWatchingtime) != 0) {
+ blank();
+ return;
+ }
+
+ if (data.byte(kCommandtype) != 239) {
+ data.byte(kCommandtype) = 239;
+ al = 32;
+ commandOnly();
+ }
+
+ if (data.word(kMousebutton) == data.word(kOldbutton))
+ return;
+ if (!(data.word(kMousebutton) & 1)) // only on left mouse button
+ return;
+
+
+ data.word(kTimecount) = 0;
+ data.byte(kPointermode) = 0;
+ data.byte(kInmaparea) = 0;
+ animPointer();
+ createPanel();
+ showPanel();
+ examIcon();
+ showMan();
+ showExit();
+ underTextLine();
+ data.byte(kPickup) = 0;
+ data.byte(kInvopen) = 2;
+ openInv();
+ readMouse();
+ showPointer();
+ workToScreenCPP();
+ delPointer();
+ data.byte(kOpenedob) = 255;
+ examineOb(false);
+}
+
+void DreamGenContext::transferText() {
+ getSegment(data.word(kExtras)).word(kExtextdat + data.byte(kExpos) * 2) = data.word(kExtextpos);
+ uint16 freeTextOffset = data.byte(kItemtotran) * 2;
+ uint16 srcOffset = getSegment(data.word(kFreedesc)).word(kFreetextdat + freeTextOffset);
+ const char *src = (const char *)getSegment(data.word(kFreedesc)).ptr(kFreetext + srcOffset, 0);
+ char *dst = (char *)getSegment(data.word(kExtras)).ptr(kExtext + data.word(kExtextpos), 0);
+
+ size_t len = strlen(src);
+ memcpy(dst, src, len + 1);
+ data.word(kExtextpos) += len + 1;
+}
+
+void DreamGenContext::getBackFromOb() {
+ if (data.byte(kPickup) != 1)
+ getBack1();
+ else
+ blank();
+}
+
+} // End of namespace DreamGen
diff --git a/engines/dreamweb/pathfind.cpp b/engines/dreamweb/pathfind.cpp
index d367f02d15..f6591d4666 100644
--- a/engines/dreamweb/pathfind.cpp
+++ b/engines/dreamweb/pathfind.cpp
@@ -24,62 +24,94 @@
namespace DreamGen {
-void DreamGenContext::turnpathon() {
- turnpathon(al);
+void DreamGenContext::turnPathOn() {
+ turnPathOn(al);
}
-void DreamGenContext::turnpathon(uint8 param) {
- findormake(param, 0xff, data.byte(kRoomnum) + 100);
- PathNode *roomsPaths = getroomspaths()->nodes;
+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::turnPathOff() {
+ turnPathOff(al);
}
-void DreamGenContext::turnpathoff(uint8 param) {
- findormake(param, 0x00, data.byte(kRoomnum) + 100);
- PathNode *roomsPaths = getroomspaths()->nodes;
+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);
+void DreamGenContext::turnAnyPathOn(uint8 param, uint8 room) {
+ findOrMake(param, 0xff, room + 100);
+ PathNode *paths = (PathNode *)getSegment(data.word(kReels)).ptr(kPathdata + 144 * room, 0);
paths[param].on = 0xff;
}
-
-void DreamGenContext::turnanypathon() {
- turnanypathon(al, ah);
+void DreamGenContext::turnAnyPathOn() {
+ turnAnyPathOn(al, ah);
}
-void DreamGenContext::turnanypathoff(uint8 param, uint8 room) {
- findormake(param, 0x00, room + 100);
- PathNode *paths = (PathNode *)segRef(data.word(kReels)).ptr(kPathdata + 144 * room, 0);
+void DreamGenContext::turnAnyPathOff(uint8 param, uint8 room) {
+ findOrMake(param, 0x00, room + 100);
+ PathNode *paths = (PathNode *)getSegment(data.word(kReels)).ptr(kPathdata + 144 * room, 0);
paths[param].on = 0x00;
}
-void DreamGenContext::turnanypathoff() {
- turnanypathoff(al, ah);
+void DreamGenContext::turnAnyPathOff() {
+ turnAnyPathOff(al, ah);
}
-RoomPaths *DreamGenContext::getroomspaths() {
- void *result = segRef(data.word(kReels)).ptr(data.byte(kRoomnum) * 144, 144);
+RoomPaths *DreamBase::getRoomsPaths() {
+ void *result = getSegment(data.word(kReels)).ptr(data.byte(kRoomnum) * 144, 144);
return (RoomPaths *)result;
}
-void DreamGenContext::autosetwalk() {
- al = data.byte(kManspath);
- if (data.byte(kFinaldest) == al)
+void DreamBase::faceRightWay() {
+ PathNode *paths = getRoomsPaths()->nodes;
+ uint8 dir = paths[data.byte(kManspath)].dir;
+ data.byte(kTurntoface) = dir;
+ data.byte(kLeavedirection) = dir;
+}
+
+void DreamBase::setWalk() {
+ if (data.byte(kLinepointer) != 254) {
+ // Already walking
+ data.byte(kFinaldest) = data.byte(kPointerspath);
+ } else if (data.byte(kPointerspath) == data.byte(kManspath)) {
+ // Can't walk
+ faceRightWay();
+ } else if (data.byte(kWatchmode) == 1) {
+ // Holding reel
+ data.byte(kDestafterhold) = data.byte(kPointerspath);
+ data.byte(kWatchmode) = 2;
+ } else if (data.byte(kWatchmode) == 2) {
+ // Can't walk
+ } else {
+ data.byte(kDestination) = data.byte(kPointerspath);
+ data.byte(kFinaldest) = data.byte(kPointerspath);
+ if (data.word(kMousebutton) != 2 || data.word(kCommandtype) == 3) {
+ autoSetWalk();
+ } else {
+ data.byte(kWalkandexam) = 1;
+ data.byte(kWalkexamtype) = data.byte(kCommandtype);
+ data.byte(kWalkexamnum) = data.byte(kCommand);
+ autoSetWalk();
+ }
+ }
+}
+
+void DreamBase::autoSetWalk() {
+ if (data.byte(kFinaldest) == data.byte(kManspath))
return;
- const RoomPaths *roomsPaths = getroomspaths();
- checkdest(roomsPaths);
+ const RoomPaths *roomsPaths = getRoomsPaths();
+ checkDest(roomsPaths);
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;
@@ -93,46 +125,44 @@ void DreamGenContext::autosetwalk() {
data.byte(kLinepointer) = 0;
}
-void DreamGenContext::checkdest(const RoomPaths *roomsPaths) {
+void DreamBase::checkDest(const RoomPaths *roomsPaths) {
const PathSegment *segments = roomsPaths->segments;
- ah = data.byte(kManspath) << 4;
- al = data.byte(kDestination);
+ const uint8 tmp = data.byte(kManspath) << 4;
uint8 destination = data.byte(kDestination);
for (size_t i = 0; i < 24; ++i) {
- dh = segments[i].b0 & 0xf0;
- dl = segments[i].b0 & 0x0f;
- if (ax == dx) {
+ if ((segments[i].b0 & 0xf0) == tmp &&
+ (segments[i].b0 & 0x0f) == data.byte(kDestination)) {
data.byte(kDestination) = segments[i].b1 & 0x0f;
return;
}
- dl = (segments[i].b0 & 0xf0) >> 4;
- dh = (segments[i].b0 & 0x0f) << 4;
- if (ax == dx) {
+
+ if (((segments[i].b0 & 0x0f) << 4) == tmp &&
+ ((segments[i].b0 & 0xf0) >> 4) == data.byte(kDestination)) {
destination = segments[i].b1 & 0x0f;
}
}
data.byte(kDestination) = destination;
}
-void DreamGenContext::findxyfrompath() {
- const PathNode *roomsPaths = getroomspaths()->nodes;
+void DreamBase::findXYFromPath() {
+ 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);
+void DreamGenContext::checkIfPathIsOn() {
+ flags._z = checkIfPathIsOn(al);
}
-bool DreamGenContext::checkifpathison(uint8 index) {
- RoomPaths *roomsPaths = getroomspaths();
+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);
+void DreamBase::bresenhams() {
+ workoutFrames();
+ Common::Point *lineData = &_lineData[0];
int16 startX = (int16)data.word(kLinestartx);
int16 startY = (int16)data.word(kLinestarty);
int16 endX = (int16)data.word(kLineendx);
@@ -153,13 +183,12 @@ void DreamGenContext::bresenhams() {
++deltaY;
int8 x = (int8)startX;
data.byte(kLinelength) = deltaY;
- do {
- lineData[0] = x;
- lineData[1] = y;
- lineData += 2;
+ for (; deltaY; --deltaY) {
+ lineData->x = x;
+ lineData->y = y;
+ ++lineData;
++y;
- --deltaY;
- } while (deltaY);
+ }
return;
}
uint16 deltaX;
@@ -183,13 +212,12 @@ void DreamGenContext::bresenhams() {
int8 y = (int8)startY;
++deltaX;
data.byte(kLinelength) = deltaX;
- do {
- lineData[0] = x;
- lineData[1] = y;
- lineData += 2;
+ for (; deltaX; --deltaX) {
+ lineData->x = x;
+ lineData->y = y;
+ ++lineData;
++x;
- --deltaX;
- } while (deltaX);
+ }
return;
}
uint16 deltaY;
@@ -220,10 +248,10 @@ void DreamGenContext::bresenhams() {
int8 y = (int8)startY;
data.byte(kLinelength) = delta1;
if (data.byte(kLineroutine) != 1) {
- do {
- lineData[0] = x;
- lineData[1] = y;
- lineData += 2;
+ for (; delta1; --delta1) {
+ lineData->x = x;
+ lineData->y = y;
+ ++lineData;
++x;
if (remainder < 0) {
remainder += data.word(kIncrement1);
@@ -231,13 +259,12 @@ void DreamGenContext::bresenhams() {
remainder += data.word(kIncrement2);
y += increment;
}
- --delta1;
- } while (delta1);
+ }
} else {
- do {
- lineData[0] = x;
- lineData[1] = y;
- lineData += 2;
+ for (; delta1; --delta1) {
+ lineData->x = x;
+ lineData->y = y;
+ ++lineData;
y += increment;
if (remainder < 0) {
remainder += data.word(kIncrement1);
@@ -245,10 +272,59 @@ void DreamGenContext::bresenhams() {
remainder += data.word(kIncrement2);
++x;
}
- --delta1;
- } while (delta1);
+ }
}
}
-} /*namespace dreamgen */
+void DreamBase::workoutFrames() {
+ byte tmp;
+ int diffx, diffy;
+
+ // We have to use signed arithmetic here because these values can
+ // be slightly negative when walking off-screen
+ int lineStartX = (int16)data.word(kLinestartx);
+ int lineStartY = (int16)data.word(kLinestarty);
+ int lineEndX = (int16)data.word(kLineendx);
+ int lineEndY = (int16)data.word(kLineendy);
+
+
+ diffx = ABS(lineStartX - lineEndX);
+ diffy = ABS(lineStartY - lineEndY);
+
+ if (diffx < diffy) {
+ tmp = 2;
+ if (diffx >= (diffy >> 1))
+ tmp = 1;
+ } else {
+ // tendstohoriz
+ tmp = 0;
+ if (diffy >= (diffx >> 1))
+ tmp = 1;
+ }
+
+ if (lineStartX >= lineEndX) {
+ // isinleft
+ if (lineStartY < lineEndY) {
+ if (tmp != 1)
+ tmp ^= 2;
+ tmp += 4;
+ } else {
+ // topleft
+ tmp += 6;
+ }
+ } else {
+ // isinright
+ if (lineStartY < lineEndY) {
+ tmp += 2;
+ } else {
+ // botright
+ if (tmp != 1)
+ tmp ^= 2;
+ }
+ }
+
+ data.byte(kTurntoface) = tmp & 7;
+ data.byte(kTurndirection) = 0;
+}
+} // End of namespace DreamGen
diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp
new file mode 100644
index 0000000000..889a430a22
--- /dev/null
+++ b/engines/dreamweb/people.cpp
@@ -0,0 +1,789 @@
+/* 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 {
+
+static void (DreamGenContext::*reelCallbacks[57])() = {
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ &DreamGenContext::receptionist, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ &DreamGenContext::heavy, NULL,
+ NULL, NULL,
+ &DreamGenContext::bartender, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, &DreamGenContext::poolGuard,
+ NULL, &DreamGenContext::businessMan,
+ NULL, NULL,
+ &DreamGenContext::mugger, &DreamGenContext::helicopter,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, &DreamGenContext::endGameSeq,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL
+};
+
+static void (DreamGenContext::*reelCallbacksCPP[57])(ReelRoutine &) = {
+ &DreamGenContext::gamer, &DreamGenContext::sparkyDrip,
+ &DreamGenContext::eden, &DreamGenContext::edenInBath,
+ &DreamGenContext::sparky, &DreamGenContext::smokeBloke,
+ &DreamGenContext::manAsleep, &DreamGenContext::drunk,
+ /*&DreamGenContext::receptionist*/NULL, &DreamGenContext::genericPerson /*maleFan*/,
+ &DreamGenContext::genericPerson /*femaleFan*/, &DreamGenContext::louis,
+ &DreamGenContext::louisChair, &DreamGenContext::soldier1,
+ &DreamGenContext::bossMan, &DreamGenContext::interviewer,
+ /*&DreamGenContext::heavy*/NULL, &DreamGenContext::manAsleep /*manAsleep2*/,
+ &DreamGenContext::genericPerson /*manSatStill*/, &DreamGenContext::drinker,
+ /*&DreamGenContext::bartender*/NULL, &DreamGenContext::genericPerson /*otherSmoker*/,
+ &DreamGenContext::genericPerson /*tattooMan*/, &DreamGenContext::attendant,
+ &DreamGenContext::keeper, &DreamGenContext::candles1,
+ &DreamGenContext::smallCandle, &DreamGenContext::security,
+ &DreamGenContext::copper, /*&DreamGenContext::poolGuard*/NULL,
+ &DreamGenContext::rockstar, /*&DreamGenContext::businessMan*/NULL,
+ &DreamGenContext::train, &DreamGenContext::genericPerson /*aide*/,
+ /*&DreamGenContext::mugger*/NULL, /*&DreamGenContext::helicopter*/NULL,
+ &DreamGenContext::introMagic1, &DreamGenContext::introMusic,
+ &DreamGenContext::introMagic2, &DreamGenContext::candles2,
+ &DreamGenContext::gates, &DreamGenContext::introMagic3,
+ &DreamGenContext::introMonks1, &DreamGenContext::candles,
+ &DreamGenContext::introMonks2, &DreamGenContext::handClap,
+ &DreamGenContext::monkAndRyan, /*&DreamGenContext::endGameSeq*/NULL,
+ &DreamGenContext::priest, &DreamGenContext::madman,
+ &DreamGenContext::madmansTelly, &DreamGenContext::alleyBarkSound,
+ &DreamGenContext::foghornSound, &DreamGenContext::carParkDrip,
+ &DreamGenContext::carParkDrip, &DreamGenContext::carParkDrip,
+ &DreamGenContext::carParkDrip
+};
+
+void DreamGenContext::updatePeople() {
+ data.word(kListpos) = kPeoplelist;
+ memset(getSegment(data.word(kBuffers)).ptr(kPeoplelist, 12 * sizeof(People)), 0xff, 12 * sizeof(People));
+ ++data.word(kMaintimer);
+
+ // The original callbacks are called with es:bx pointing to their reelRoutine entry.
+ // The new callbacks take a mutable ReelRoutine parameter.
+
+ es = data;
+ ReelRoutine *r = (ReelRoutine *)data.ptr(kReelroutines, 0);
+
+ for (int i = 0; r[i].reallocation != 255; ++i) {
+ bx = kReelroutines + 8*i;
+ if (r[i].reallocation == data.byte(kReallocation) &&
+ r[i].mapX == data.byte(kMapx) &&
+ r[i].mapY == data.byte(kMapy)) {
+ if (reelCallbacks[i]) {
+ assert(!reelCallbacksCPP[i]);
+ (this->*(reelCallbacks[i]))();
+ } else {
+ assert(reelCallbacksCPP[i]);
+ (this->*(reelCallbacksCPP[i]))(r[i]);
+ }
+ }
+ }
+}
+
+void DreamGenContext::madmanText() {
+ if (isCD()) {
+ if (data.byte(kSpeechcount) >= 63)
+ return;
+ if (data.byte(kCh1playing) != 255)
+ return;
+ al = data.byte(kSpeechcount);
+ ++data.byte(kSpeechcount);
+ } else {
+ if (data.byte(kCombatcount) >= 61)
+ return;
+ al = data.byte(kCombatcount);
+ _and(al, 3);
+ if (!flags.z())
+ return;
+ al = data.byte(kCombatcount) / 4;
+ }
+ setupTimedTemp(47 + al, 82, 72, 80, 90, 1);
+}
+
+void DreamGenContext::madman(ReelRoutine &routine) {
+ data.word(kWatchingtime) = 2;
+ if (checkSpeed(routine)) {
+ uint16 newReelPointer = routine.reelPointer();
+ if (newReelPointer >= 364) {
+ data.byte(kMandead) = 2;
+ showGameReel(&routine);
+ return;
+ }
+ if (newReelPointer == 10) {
+ loadTempText("DREAMWEB.T82");
+ data.byte(kCombatcount) = (uint8)-1;
+ data.byte(kSpeechcount) = 0;
+ }
+ ++newReelPointer;
+ if (newReelPointer == 294) {
+ if (data.byte(kWongame) != 1) {
+ data.byte(kWongame) = 1;
+ getRidOfTempText();
+ }
+ return;
+ }
+ if (newReelPointer == 66) {
+ ++data.byte(kCombatcount);
+ madmanText();
+ newReelPointer = 53;
+ if (data.byte(kCombatcount) >= (isCD() ? 64 : 62)) {
+ if (data.byte(kCombatcount) == (isCD() ? 70 : 68))
+ newReelPointer = 310;
+ else {
+ if (data.byte(kLastweapon) == 8) {
+ data.byte(kCombatcount) = isCD() ? 72 : 70;
+ data.byte(kLastweapon) = (uint8)-1;
+ data.byte(kMadmanflag) = 1;
+ newReelPointer = 67;
+ }
+ }
+ }
+ }
+ routine.setReelPointer(newReelPointer);
+ }
+ showGameReel(&routine);
+ routine.mapX = data.byte(kMapx);
+ madMode();
+}
+
+void DreamGenContext::madMode() {
+ data.word(kWatchingtime) = 2;
+ data.byte(kPointermode) = 0;
+ if (data.byte(kCombatcount) < (isCD() ? 65 : 63))
+ return;
+ if (data.byte(kCombatcount) >= (isCD() ? 70 : 68))
+ return;
+ data.byte(kPointermode) = 2;
+}
+
+void DreamGenContext::addToPeopleList() {
+ addToPeopleList((ReelRoutine *)es.ptr(bx, sizeof(ReelRoutine)));
+}
+
+void DreamGenContext::addToPeopleList(ReelRoutine *routine) {
+ uint16 routinePointer = (const uint8 *)routine - data.ptr(0, 0);
+
+ People *people = (People *)getSegment(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);
+}
+
+void DreamGenContext::checkSpeed() {
+ ReelRoutine *routine = (ReelRoutine *)es.ptr(bx, sizeof(ReelRoutine));
+ flags._z = checkSpeed(*routine);
+}
+
+bool DreamGenContext::checkSpeed(ReelRoutine &routine) {
+ if (data.byte(kLastweapon) != (uint8)-1)
+ return true;
+ ++routine.counter;
+ if (routine.counter != routine.period)
+ return false;
+ routine.counter = 0;
+ return true;
+}
+
+void DreamGenContext::sparkyDrip(ReelRoutine &routine) {
+ if (checkSpeed(routine))
+ playChannel0(14, 0);
+}
+
+void DreamGenContext::genericPerson(ReelRoutine &routine) {
+ showGameReel(&routine);
+ addToPeopleList(&routine);
+}
+
+void DreamGenContext::gamer(ReelRoutine &routine) {
+ if (checkSpeed(routine)) {
+ uint8 v;
+ do {
+ v = 20 + engine->randomNumber() % 5;
+ } while (v == routine.reelPointer());
+ routine.setReelPointer(v);
+ }
+
+ showGameReel(&routine);
+ addToPeopleList(&routine);
+}
+
+void DreamGenContext::eden(ReelRoutine &routine) {
+ if (data.byte(kGeneraldead))
+ return;
+ showGameReel(&routine);
+ addToPeopleList(&routine);
+}
+
+void DreamGenContext::sparky(ReelRoutine &routine) {
+ if (data.word(kCard1money))
+ routine.b7 = 3;
+ if (checkSpeed(routine)) {
+ if (routine.reelPointer() != 34) {
+ if (engine->randomNumber() < 30)
+ routine.incReelPointer();
+ else
+ routine.setReelPointer(27);
+ } else {
+ if (routine.reelPointer() != 48)
+ routine.incReelPointer();
+ else
+ routine.setReelPointer(27);
+ }
+ }
+ showGameReel(&routine);
+ addToPeopleList(&routine);
+ if (routine.b7 & 128)
+ data.byte(kTalkedtosparky) = 1;
+}
+
+void DreamGenContext::rockstar(ReelRoutine &routine) {
+ if ((routine.reelPointer() == 303) || (routine.reelPointer() == 118)) {
+ data.byte(kNewlocation) = 45;
+ showGameReel(&routine);
+ return;
+ }
+ if (checkSpeed(routine)) {
+ uint16 nextReelPointer = routine.reelPointer() + 1;
+ if (nextReelPointer == 118) {
+ data.byte(kMandead) = 2;
+ } else if (nextReelPointer == 79) {
+ --nextReelPointer;
+ if (data.byte(kLastweapon) != 1) {
+ ++data.byte(kCombatcount);
+ if (data.byte(kCombatcount) == 40) {
+ data.byte(kCombatcount) = 0;
+ nextReelPointer = 79;
+ }
+ } else {
+ data.byte(kLastweapon) = (uint8)-1;
+ nextReelPointer = 123;
+ }
+ }
+ routine.setReelPointer(nextReelPointer);
+ }
+ showGameReel(&routine);
+ if (routine.reelPointer() == 78) {
+ addToPeopleList(&routine);
+ data.byte(kPointermode) = 2;
+ data.word(kWatchingtime) = 0;
+ } else {
+ data.word(kWatchingtime) = 2;
+ data.byte(kPointermode) = 0;
+ routine.mapY = data.byte(kMapy);
+ }
+}
+
+void DreamGenContext::madmansTelly(ReelRoutine &routine) {
+ uint16 nextReelPointer = routine.reelPointer() + 1;
+ if (nextReelPointer == 307)
+ nextReelPointer = 300;
+ routine.setReelPointer(nextReelPointer);
+ showGameReel(&routine);
+}
+
+
+void DreamGenContext::smokeBloke(ReelRoutine &routine) {
+ if (data.byte(kRockstardead) == 0) {
+ if (routine.b7 & 128)
+ setLocation(5);
+ }
+ if (checkSpeed(routine)) {
+ if (routine.reelPointer() == 100) {
+ if (engine->randomNumber() < 30)
+ routine.incReelPointer();
+ else
+ routine.setReelPointer(96);
+ } else if (routine.reelPointer() == 117)
+ routine.setReelPointer(96);
+ else
+ routine.incReelPointer();
+ }
+ showGameReel(&routine);
+ addToPeopleList(&routine);
+}
+
+void DreamGenContext::manAsleep(ReelRoutine &routine) {
+ routine.b7 &= 127;
+ showGameReel(&routine);
+ addToPeopleList(&routine);
+}
+
+void DreamGenContext::attendant(ReelRoutine &routine) {
+ showGameReel(&routine);
+ addToPeopleList(&routine);
+ if (routine.b7 & 128)
+ data.byte(kTalkedtoattendant) = 1;
+}
+
+void DreamGenContext::keeper(ReelRoutine &routine) {
+ if (data.byte(kKeeperflag) != 0) {
+ // Not waiting
+ addToPeopleList(&routine);
+ showGameReel(&routine);
+ return;
+ }
+
+ if (data.word(kReeltowatch) < 190)
+ return; // waiting
+
+ data.byte(kKeeperflag)++;
+
+ if ((routine.b7 & 127) != data.byte(kDreamnumber))
+ routine.b7 = data.byte(kDreamnumber);
+}
+
+void DreamGenContext::drunk(ReelRoutine &routine) {
+ if (data.byte(kGeneraldead))
+ return;
+ routine.b7 &= 127;
+ showGameReel(&routine);
+ addToPeopleList(&routine);
+}
+
+void DreamGenContext::interviewer(ReelRoutine &routine) {
+ if (data.word(kReeltowatch) == 68)
+ routine.incReelPointer();
+
+ if (routine.reelPointer() != 250 && routine.reelPointer() != 259 && checkSpeed(routine))
+ routine.incReelPointer();
+
+ showGameReel(&routine);
+}
+
+void DreamGenContext::drinker(ReelRoutine &routine) {
+ if (checkSpeed(routine)) {
+ routine.incReelPointer();
+
+ if ( routine.reelPointer() == 115 ||
+ (routine.reelPointer() == 106 && engine->randomNumber() >= 3))
+ routine.setReelPointer(105);
+ }
+
+ showGameReel(&routine);
+ addToPeopleList(&routine);
+}
+
+void DreamGenContext::alleyBarkSound(ReelRoutine &routine) {
+ uint16 prevReelPointer = routine.reelPointer() - 1;
+ if (prevReelPointer == 0) {
+ playChannel1(14);
+ routine.setReelPointer(1000);
+ } else {
+ routine.setReelPointer(prevReelPointer);
+ }
+}
+
+void DreamGenContext::introMagic1(ReelRoutine &routine) {
+ if (checkSpeed(routine)) {
+ uint16 nextReelPointer = routine.reelPointer() + 1;
+ if (nextReelPointer == 145)
+ nextReelPointer = 121;
+ routine.setReelPointer(nextReelPointer);
+ if (nextReelPointer == 121) {
+ ++data.byte(kIntrocount);
+ push(es);
+ push(bx);
+ intro1Text();
+ bx = pop();
+ es = pop();
+ if (data.byte(kIntrocount) == 8) {
+ data.byte(kMapy) += 10;
+ data.byte(kNowinnewroom) = 1;
+ }
+ }
+ }
+ showGameReel(&routine);
+}
+
+void DreamGenContext::introMagic2(ReelRoutine &routine) {
+ if (checkSpeed(routine)) {
+ uint16 nextReelPointer = routine.reelPointer() + 1;
+ if (nextReelPointer == 216)
+ nextReelPointer = 192;
+ routine.setReelPointer(nextReelPointer);
+ }
+ showGameReel(&routine);
+}
+
+void DreamGenContext::introMagic3(ReelRoutine &routine) {
+ if (checkSpeed(routine)) {
+ uint16 nextReelPointer = routine.reelPointer() + 1;
+ if (nextReelPointer == 218)
+ data.byte(kGetback) = 1;
+ routine.setReelPointer(nextReelPointer);
+ }
+ showGameReel(&routine);
+ routine.mapX = data.byte(kMapx);
+}
+
+void DreamGenContext::candles1(ReelRoutine &routine) {
+ if (checkSpeed(routine)) {
+ uint16 nextReelPointer = routine.reelPointer() + 1;
+ if (nextReelPointer == 44)
+ nextReelPointer = 39;
+ routine.setReelPointer(nextReelPointer);
+ }
+ showGameReel(&routine);
+}
+
+void DreamGenContext::candles2(ReelRoutine &routine) {
+ if (checkSpeed(routine)) {
+ uint16 nextReelPointer = routine.reelPointer() + 1;
+ if (nextReelPointer == 238)
+ nextReelPointer = 233;
+ routine.setReelPointer(nextReelPointer);
+ }
+ showGameReel(&routine);
+}
+
+void DreamGenContext::smallCandle(ReelRoutine &routine) {
+ if (checkSpeed(routine)) {
+ uint16 nextReelPointer = routine.reelPointer() + 1;
+ if (nextReelPointer == 37)
+ nextReelPointer = 25;
+ routine.setReelPointer(nextReelPointer);
+ }
+ showGameReel(&routine);
+}
+
+void DreamGenContext::introMusic(ReelRoutine &routine) {
+}
+
+void DreamGenContext::candles(ReelRoutine &routine) {
+ if (checkSpeed(routine)) {
+ uint16 nextReelPointer = routine.reelPointer() + 1;
+ if (nextReelPointer == 167)
+ nextReelPointer = 162;
+ routine.setReelPointer(nextReelPointer);
+ }
+ showGameReel(&routine);
+}
+
+void DreamGenContext::gates(ReelRoutine &routine) {
+ if (checkSpeed(routine)) {
+ uint16 nextReelPointer = routine.reelPointer() + 1;
+ if (nextReelPointer == 116)
+ playChannel1(17);
+ if (nextReelPointer >= 110)
+ routine.period = 2;
+ if (nextReelPointer == 120) {
+ data.byte(kGetback) = 1;
+ nextReelPointer = 119;
+ }
+ routine.setReelPointer(nextReelPointer);
+ push(es);
+ push(bx);
+ ax = nextReelPointer;
+ intro3Text();
+ bx = pop();
+ es = pop();
+ }
+ showGameReel(&routine);
+}
+
+void DreamGenContext::security(ReelRoutine &routine) {
+ if (routine.reelPointer() == 32) {
+ if (data.byte(kLastweapon) == 1) {
+ data.word(kWatchingtime) = 10;
+ if ((data.byte(kManspath) == 9) && (data.byte(kFacing) == 0)) {
+ data.byte(kLastweapon) = (uint8)-1;
+ routine.incReelPointer();
+ }
+ }
+ } else if (routine.reelPointer() == 69)
+ return;
+ else {
+ data.word(kWatchingtime) = 10;
+ if (checkSpeed(routine))
+ routine.incReelPointer();
+ }
+ showGameReel(&routine);
+ addToPeopleList(&routine);
+}
+
+void DreamGenContext::edenInBath(ReelRoutine &routine) {
+ if (data.byte(kGeneraldead) == 0 || data.byte(kSartaindead) != 0)
+ return;
+
+ showGameReel(&routine);
+ addToPeopleList(&routine);
+}
+
+void DreamGenContext::louis(ReelRoutine &routine) {
+ if (data.byte(kRockstardead) != 0)
+ return;
+
+ showGameReel(&routine);
+ addToPeopleList(&routine);
+}
+
+void DreamGenContext::handClap(ReelRoutine &routine) {
+}
+
+void DreamGenContext::carParkDrip(ReelRoutine &routine) {
+ if (!checkSpeed(routine))
+ return; // cantdrip2
+
+ playChannel1(14);
+}
+
+void DreamGenContext::foghornSound(ReelRoutine &routine) {
+ if (engine->randomNumber() == 198)
+ playChannel1(13);
+}
+
+void DreamGenContext::train(ReelRoutine &routine) {
+ // The original code has logic for this, but it is disabled
+}
+
+void DreamGenContext::louisChair(ReelRoutine &routine) {
+ if (data.byte(kRockstardead) == 0)
+ return; // notlouis2
+
+ if (checkSpeed(routine)) {
+ uint16 nextReelPointer = routine.reelPointer() + 1;
+ if (nextReelPointer == 191) {
+ routine.setReelPointer(182); // Restart Louis
+ } else if (nextReelPointer != 185) {
+ routine.setReelPointer(nextReelPointer);
+ } else {
+ if (engine->randomNumber() < 245)
+ routine.setReelPointer(182); // Restart Louis
+ else
+ routine.setReelPointer(nextReelPointer);
+ }
+ }
+
+ showGameReel(&routine);
+ addToPeopleList(&routine);
+}
+
+void DreamGenContext::bossMan(ReelRoutine &routine) {
+ if (checkSpeed(routine)) {
+ uint16 nextReelPointer = routine.reelPointer() + 1;
+
+ if (nextReelPointer == 4) {
+ if (data.byte(kGunpassflag) != 1 && engine->randomNumber() >= 10)
+ nextReelPointer = 0;
+ } else if (nextReelPointer == 20) {
+ if (data.byte(kGunpassflag) != 1)
+ nextReelPointer = 0;
+ } else if (nextReelPointer == 41) {
+ nextReelPointer = 0;
+ data.byte(kGunpassflag)++;
+ routine.b7 = 10;
+ }
+
+ routine.setReelPointer(nextReelPointer);
+ }
+
+ showGameReel(&routine);
+ addToPeopleList(&routine);
+
+ if (routine.b7 & 128)
+ data.byte(kTalkedtoboss) = 1;
+}
+
+void DreamGenContext::priest(ReelRoutine &routine) {
+ if (routine.reelPointer() == 8)
+ return; // priestspoken
+
+ data.byte(kPointermode) = 0;
+ data.word(kWatchingtime) = 2;
+
+ if (checkSpeed(routine)) {
+ routine.incReelPointer();
+ push(es);
+ push(bx);
+ priestText(routine);
+ bx = pop();
+ es = pop();
+ }
+}
+
+void DreamGenContext::priestText(ReelRoutine &routine) {
+ uint16 reel = routine.reelPointer();
+ if (reel < 2 || reel >= 7 || (reel & 1))
+ return; // nopriesttext
+
+ al = ((reel & 0xFF) >> 1) + 50;
+ bl = 72;
+ bh = 80;
+ cx = 54;
+ dx = 1;
+ setupTimedUse();
+}
+
+void DreamGenContext::monkAndRyan(ReelRoutine &routine) {
+ if (checkSpeed(routine)) {
+ uint16 nextReelPointer = routine.reelPointer() + 1;
+ if (nextReelPointer == 83) {
+ data.byte(kIntrocount)++;
+ textForMonk();
+ nextReelPointer = 77;
+
+ if (data.byte(kIntrocount) == 57) {
+ data.byte(kGetback) = 1;
+ return;
+ }
+ }
+
+ routine.setReelPointer(nextReelPointer);
+ }
+
+ showGameReel(&routine);
+}
+
+void DreamGenContext::copper(ReelRoutine &routine) {
+ if (checkSpeed(routine)) {
+ uint16 nextReelPointer = routine.reelPointer() + 1;
+ if (nextReelPointer == 94) {
+ nextReelPointer = 64;
+ } else if (nextReelPointer == 81 || nextReelPointer == 66) {
+ // Might wait
+ if (engine->randomNumber() >= 7)
+ nextReelPointer--;
+ }
+
+ routine.setReelPointer(nextReelPointer);
+ }
+
+ showGameReel(&routine);
+ addToPeopleList(&routine);
+}
+
+void DreamGenContext::introMonks1(ReelRoutine &routine) {
+ if (checkSpeed(routine)) {
+ uint16 nextReelPointer = routine.reelPointer() + 1;
+
+ if (nextReelPointer == 80) {
+ data.byte(kMapy) += 10;
+ data.byte(kNowinnewroom) = 1;
+ showGameReel(&routine);
+ return;
+ } else if (nextReelPointer == 30) {
+ data.byte(kMapy) -= 10;
+ data.byte(kNowinnewroom) = 1;
+ nextReelPointer = 51;
+ }
+
+ routine.setReelPointer(nextReelPointer);
+
+ if (nextReelPointer == 5 || nextReelPointer == 15 ||
+ nextReelPointer == 25 || nextReelPointer == 61 ||
+ nextReelPointer == 71) {
+ // Wait step
+ push(es);
+ push(bx);
+ intro2Text();
+ bx = pop();
+ es = pop();
+ routine.counter = (uint8)-20;
+ }
+ }
+
+ showGameReel(&routine);
+ routine.mapY = data.byte(kMapy);
+}
+
+void DreamGenContext::introMonks2(ReelRoutine &routine) {
+ if (checkSpeed(routine)) {
+ uint16 nextReelPointer = routine.reelPointer() + 1;
+ if (nextReelPointer == 87) {
+ data.byte(kIntrocount)++;
+ push(es);
+ push(bx);
+ monks2text();
+ bx = pop();
+ es = pop();
+
+ if (data.byte(kIntrocount), 19)
+ nextReelPointer = 87;
+ else
+ nextReelPointer = 74;
+ }
+
+ if (nextReelPointer == 110) {
+ data.byte(kIntrocount)++;
+ push(es);
+ push(bx);
+ monks2text();
+ bx = pop();
+ es = pop();
+
+ if (data.byte(kIntrocount) == 35)
+ nextReelPointer = 111;
+ else
+ nextReelPointer = 98;
+ } else if (nextReelPointer == 176) {
+ data.byte(kGetback) = 1;
+ } else if (nextReelPointer == 125) {
+ nextReelPointer = 140;
+ }
+
+ routine.setReelPointer(nextReelPointer);
+ }
+
+ showGameReel(&routine);
+}
+
+void DreamGenContext::soldier1(ReelRoutine &routine) {
+ if (routine.reelPointer() != 0) {
+ data.word(kWatchingtime) = 10;
+ if (routine.reelPointer() == 30) {
+ data.byte(kCombatcount)++;
+ if (data.byte(kCombatcount) == 40)
+ data.byte(kMandead) = 2;
+ } else if (checkSpeed(routine)) {
+ // Not after shot
+ routine.incReelPointer();
+ }
+ } else if (data.byte(kLastweapon) == 1) {
+ data.word(kWatchingtime) = 10;
+ if (data.byte(kManspath) == 2 && data.byte(kFacing) == 4)
+ routine.incReelPointer();
+ data.byte(kLastweapon) = 0xFF;
+ data.byte(kCombatcount) = 0;
+ }
+
+ showGameReel(&routine);
+ addToPeopleList(&routine);
+}
+
+} // End of namespace DreamGen
diff --git a/engines/dreamweb/print.cpp b/engines/dreamweb/print.cpp
index edaf8ee1eb..0fd596ceac 100644
--- a/engines/dreamweb/print.cpp
+++ b/engines/dreamweb/print.cpp
@@ -24,18 +24,18 @@
namespace DreamGen {
-void DreamGenContext::printboth(const Frame *charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar) {
+void DreamBase::printBoth(const Frame *charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar) {
uint16 newX = *x;
uint8 width, height;
- printchar(charSet, &newX, y, c, nextChar, &width, &height);
- multidump(*x, y, width, height);
+ printChar(charSet, &newX, y, c, nextChar, &width, &height);
+ multiDump(*x, y, width, height);
*x = newX;
}
-uint8 DreamGenContext::getnextword(const Frame *charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount) {
+uint8 DreamBase::getNextWord(const Frame *charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount) {
*totalWidth = 0;
*charCount = 0;
- while(true) {
+ while (true) {
uint8 firstChar = *string;
++string;
++*charCount;
@@ -51,55 +51,47 @@ uint8 DreamGenContext::getnextword(const Frame *charSet, const uint8 *string, ui
if (firstChar != 255) {
uint8 secondChar = *string;
uint8 width = charSet[firstChar - 32 + data.word(kCharshift)].width;
- width = kernchars(firstChar, secondChar, width);
+ width = kernChars(firstChar, secondChar, width);
*totalWidth += width;
}
}
}
-void DreamGenContext::printchar() {
- uint16 x = di;
- uint8 width, height;
- printchar((const Frame *)ds.ptr(0, 0), &x, bx, al, ah, &width, &height);
- di = x;
- cl = width;
- ch = height;
-}
-
-void DreamGenContext::printchar(const Frame *charSet, uint16* x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height) {
+void DreamBase::printChar(const Frame *charSet, uint16* x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height) {
if (c == 255)
return;
- push(si);
- push(di);
- if (data.byte(kForeignrelease) != 0)
+
+ uint8 dummyWidth, dummyHeight;
+ if (width == NULL)
+ width = &dummyWidth;
+ if (height == NULL)
+ height = &dummyHeight;
+ if (data.byte(kForeignrelease))
y -= 3;
uint16 tmp = c - 32 + data.word(kCharshift);
- showframe(charSet, *x, y, tmp & 0x1ff, (tmp >> 8) & 0xfe, width, height);
- di = pop();
- si = pop();
- _cmp(data.byte(kKerning), 0);
- if (flags.z())
- *width = kernchars(c, nextChar, *width);
+ showFrame(charSet, *x, y, tmp & 0x1ff, (tmp >> 8) & 0xfe, width, height);
+ if (data.byte(kKerning), 0)
+ *width = kernChars(c, nextChar, *width);
(*x) += *width;
}
-void DreamGenContext::printslow() {
- al = printslow(es.ptr(si, 0), di, bx, dl, (bool)(dl & 1));
+void DreamBase::printChar(const Frame *charSet, uint16 x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height) {
+ printChar(charSet, &x, y, c, nextChar, width, height);
}
-uint8 DreamGenContext::printslow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered) {
+uint8 DreamBase::printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered) {
data.byte(kPointerframe) = 1;
data.byte(kPointermode) = 3;
- const Frame* charSet = (const Frame *)segRef(data.word(kCharset1)).ptr(0, 0);
+ const Frame* charSet = (const Frame *)getSegment(data.word(kCharset1)).ptr(0, 0);
do {
uint16 offset = x;
- uint16 charCount = getnumber(charSet, string, maxWidth, centered, &offset);
+ uint16 charCount = getNumber(charSet, string, maxWidth, centered, &offset);
do {
uint8 c0 = string[0];
uint8 c1 = string[1];
uint8 c2 = string[2];
c0 = engine->modifyChar(c0);
- printboth(charSet, &offset, y, c0, c1);
+ printBoth(charSet, &offset, y, c0, c1);
if ((c1 == 0) || (c1 == ':')) {
return 0;
}
@@ -107,10 +99,10 @@ uint8 DreamGenContext::printslow(const uint8 *string, uint16 x, uint16 y, uint8
c1 = engine->modifyChar(c1);
data.word(kCharshift) = 91;
uint16 offset2 = offset;
- printboth(charSet, &offset2, y, c1, c2);
+ printBoth(charSet, &offset2, y, c1, c2);
data.word(kCharshift) = 0;
for (int i=0; i<2; ++i) {
- uint16 mouseState = waitframes();
+ uint16 mouseState = waitFrames();
if (data.byte(kQuitrequested))
return 0;
if (mouseState == 0)
@@ -128,83 +120,75 @@ uint8 DreamGenContext::printslow(const uint8 *string, uint16 x, uint16 y, uint8
} while (true);
}
-void DreamGenContext::printdirect() {
+void DreamGenContext::printDirect() {
uint16 y = bx;
- uint16 initialSi = si;
const uint8 *initialString = es.ptr(si, 0);
const uint8 *string = initialString;
- printdirect(&string, di, &y, dl, (bool)(dl & 1));
- si = initialSi + (string - initialString);
+ al = DreamBase::printDirect(&string, di, &y, dl, (bool)(dl & 1));
+ si += (string - initialString);
bx = y;
}
-void DreamGenContext::printdirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered) {
- printdirect(&string, x, &y, maxWidth, centered);
+uint8 DreamBase::printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered) {
+ return printDirect(&string, x, &y, maxWidth, centered);
}
-void DreamGenContext::printdirect(const uint8** string, uint16 x, uint16 *y, uint8 maxWidth, bool centered) {
+uint8 DreamBase::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);
+ const Frame *charSet = engine->currentCharset();
while (true) {
uint16 offset = x;
- uint8 charCount = getnumber(charSet, *string, maxWidth, centered, &offset);
+ uint8 charCount = getNumber(charSet, *string, maxWidth, centered, &offset);
uint16 i = offset;
do {
uint8 c = (*string)[0];
uint8 nextChar = (*string)[1];
++(*string);
if ((c == 0) || (c == ':')) {
- return;
+ return c;
}
c = engine->modifyChar(c);
uint8 width, height;
- printchar(charSet, &i, *y, c, nextChar, &width, &height);
+ printChar(charSet, &i, *y, c, nextChar, &width, &height);
data.word(kLastxpos) = i;
--charCount;
- } while(charCount);
+ } while (charCount);
*y += data.word(kLinespacing);
}
}
-void DreamGenContext::getnumber() {
- uint16 offset = di;
- cl = getnumber((Frame *)ds.ptr(0, 0), es.ptr(si, 0), dl, (bool)(dl & 1), &offset);
- di = offset;
-}
-
-uint8 DreamGenContext::getnumber(const Frame *charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16* offset) {
+uint8 DreamBase::getNumber(const Frame *charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16* offset) {
uint8 totalWidth = 0;
uint8 charCount = 0;
while (true) {
uint8 wordTotalWidth, wordCharCount;
- uint8 done = getnextword(charSet, string, &wordTotalWidth, &wordCharCount);
+ uint8 done = getNextWord(charSet, string, &wordTotalWidth, &wordCharCount);
string += wordCharCount;
+ uint16 tmp = totalWidth + wordTotalWidth - 10;
if (done == 1) { //endoftext
- ax = totalWidth + wordTotalWidth - 10;
- if (ax < maxWidth) {
+ if (tmp < maxWidth) {
totalWidth += wordTotalWidth;
charCount += wordCharCount;
}
if (centered) {
- ax = (maxWidth & 0xfe) + 2 + 20 - totalWidth;
- ax /= 2;
+ tmp = (maxWidth & 0xfe) + 2 + 20 - totalWidth;
+ tmp /= 2;
} else {
- ax = 0;
+ tmp = 0;
}
- *offset += ax;
+ *offset += tmp;
return charCount;
}
- ax = totalWidth + wordTotalWidth - 10;
- if (ax >= maxWidth) { //gotoverend
+ if (tmp >= maxWidth) { //gotoverend
if (centered) {
- ax = (maxWidth & 0xfe) - totalWidth + 20;
- ax /= 2;
+ tmp = (maxWidth & 0xfe) - totalWidth + 20;
+ tmp /= 2;
} else {
- ax = 0;
+ tmp = 0;
}
- *offset += ax;
+ *offset += tmp;
return charCount;
}
totalWidth += wordTotalWidth;
@@ -212,22 +196,71 @@ uint8 DreamGenContext::getnumber(const Frame *charSet, const uint8 *string, uint
}
}
-uint8 DreamGenContext::kernchars(uint8 firstChar, uint8 secondChar, uint8 width) {
- if ((firstChar == 'a') || (al == 'u')) {
+uint8 DreamBase::kernChars(uint8 firstChar, uint8 secondChar, uint8 width) {
+ if ((firstChar == 'a') || (firstChar == 'u')) {
if ((secondChar == 'n') || (secondChar == 't') || (secondChar == 'r') || (secondChar == 'i') || (secondChar == 'l'))
return width-1;
}
return width;
}
-uint16 DreamGenContext::waitframes() {
- readmouse();
- showpointer();
- vsync();
- dumppointer();
- delpointer();
+uint16 DreamBase::waitFrames() {
+ readMouse();
+ showPointer();
+ vSync();
+ dumpPointer();
+ delPointer();
return data.word(kMousebutton);
}
-} /*namespace dreamgen */
+void DreamGenContext::monPrint() {
+ uint16 originalBx = bx;
+ const char *string = (const char *)es.ptr(bx, 0);
+ const char *nextString = monPrint(string);
+ bx = originalBx + (nextString - string);
+}
+
+const char *DreamBase::monPrint(const char *string) {
+ data.byte(kKerning) = 1;
+ uint16 x = data.word(kMonadx);
+ Frame *charset = engine->tempCharset();
+ const char *iterator = string;
+ bool done = false;
+ while (!done) {
+
+ uint16 count = getNumber(charset, (const uint8 *)iterator, 166, false, &x);
+ do {
+ char c = *iterator++;
+ if (c == ':')
+ break;
+ if ((c == 0) || (c == '"') || (c == '=')) {
+ done = true;
+ break;
+ }
+ if (c == '%') {
+ data.byte(kLasttrigger) = *iterator;
+ iterator += 2;
+ done = true;
+ break;
+ }
+ c = engine->modifyChar(c);
+ printChar(charset, &x, data.word(kMonady), c, 0, NULL, NULL);
+ data.word(kCurslocx) = x;
+ data.word(kCurslocy) = data.word(kMonady);
+ data.word(kMaintimer) = 1;
+ printCurs();
+ vSync();
+ lockMon();
+ delCurs();
+ } while (--count);
+
+ x = data.word(kMonadx);
+ scrollMonitor();
+ data.word(kCurslocx) = data.word(kMonadx);
+ }
+
+ data.byte(kKerning) = 0;
+ return iterator;
+}
+} // End of namespace DreamGen
diff --git a/engines/dreamweb/runtime.h b/engines/dreamweb/runtime.h
index 8aa71b285c..9b70d164a6 100644
--- a/engines/dreamweb/runtime.h
+++ b/engines/dreamweb/runtime.h
@@ -20,26 +20,18 @@
*
*/
-#ifndef DREAMGEN_RUNTIME_H__
-#define DREAMGEN_RUNTIME_H__
+#ifndef DREAMGEN_RUNTIME_H
+#define DREAMGEN_RUNTIME_H
#include <assert.h>
#include "common/scummsys.h"
#include "common/array.h"
#include "common/debug.h"
-#include "common/hashmap.h"
-#include "common/list.h"
-#include "common/ptr.h"
-namespace DreamWeb {
- class DreamWebEngine;
-}
+#include "dreamweb/segment.h"
namespace DreamGen {
-//fixme: name clash
-#undef random
-
struct Register {
union {
uint16 _value;
@@ -48,12 +40,6 @@ struct Register {
inline Register(): _value() {}
inline Register& operator=(uint16 v) { _value = v; return *this; }
inline operator uint16&() { return _value; }
- inline void cbw() {
- if (_value & 0x80)
- _value |= 0xff00;
- else
- _value &= 0x7f;
- }
};
template<int kIndex> //from low to high
@@ -85,113 +71,6 @@ struct RegisterPart {
typedef RegisterPart<0> HighPartOfRegister;
#endif
-class WordRef {
- uint8 *_data;
- unsigned _index;
- uint16 _value;
-
-public:
- inline WordRef(Common::Array<uint8> &data, unsigned index) : _data(data.begin() + index), _index(index) {
- assert(index + 1 < data.size());
- _value = _data[0] | (_data[1] << 8);
- }
-
- inline WordRef& operator=(const WordRef &ref) {
- _value = ref._value;
- return *this;
- }
-
- inline WordRef& operator=(uint16 v) {
- _value = v;
- return *this;
- }
-
- inline operator uint16&() {
- return _value;
- }
-
- inline ~WordRef() {
- _data[0] = _value & 0xff;
- _data[1] = _value >> 8;
- _value = _data[0] | (_data[1] << 8);
- }
-};
-
-struct Segment {
- Common::Array<uint8> data;
-
- inline void assign(const uint8 *b, const uint8 *e) {
- data.assign(b, e);
- }
-
- inline uint8 &byte(unsigned index) {
- assert(index < data.size());
- return data[index];
- }
-
- inline WordRef word(unsigned index) {
- return WordRef(data, index);
- }
-
- inline uint8 *ptr(unsigned index, unsigned size) {
- assert(index + size <= data.size());
- return data.begin() + index;
- }
-};
-
-typedef Common::SharedPtr<Segment> SegmentPtr;
-
-class Context;
-
-class SegmentRef {
- Context *_context;
- uint16 _value;
- SegmentPtr _segment;
-
-public:
- SegmentRef(Context *ctx, uint16 value = 0, SegmentPtr segment = SegmentPtr()): _context(ctx), _value(value), _segment(segment) {
- }
-
- inline void reset(uint16 value);
-
- inline SegmentRef& operator=(const uint16 id) {
- reset(id);
- return *this;
- }
-
- inline SegmentRef& operator=(const SegmentRef &ref) {
- _context = ref._context;
- _value = ref._value;
- _segment = ref._segment;
- return *this;
- }
-
- inline uint8 &byte(unsigned index) {
- assert(_segment != 0);
- return _segment->byte(index);
- }
-
- inline operator uint16() const {
- return _value;
- }
-
- inline WordRef word(unsigned index) {
- //debug(1, "getting word ref for %04x:%d", _value, index);
- assert(_segment != 0);
- return _segment->word(index);
- }
-
- inline void assign(const uint8 *b, const uint8 *e) {
- assert(_segment != 0);
- _segment->assign(b, e);
- }
-
- inline uint8 *ptr(unsigned index, unsigned size) {
- assert(_segment != 0);
- return _segment->ptr(index, size);
- }
-};
-
struct Flags {
bool _z, _c, _s, _o;
inline Flags(): _z(true), _c(false), _s(false), _o(false) {}
@@ -225,17 +104,7 @@ struct Flags {
};
class Context {
- typedef Common::HashMap<uint16, SegmentPtr> SegmentMap;
- SegmentMap _segments;
-
- typedef Common::List<uint16> FreeSegmentList;
- FreeSegmentList _freeSegments;
-
public:
- DreamWeb::DreamWebEngine *engine;
-
- enum { kDefaultDataSegment = 0x1000 };
-
Register ax, dx, bx, cx, si, di;
LowPartOfRegister al;
HighPartOfRegister ah;
@@ -246,51 +115,16 @@ public:
LowPartOfRegister dl;
HighPartOfRegister dh;
- SegmentRef cs, ds, es, data;
- //data == fake segment register always pointing to data segment
+ SegmentRef cs;
+ MutableSegmentRef ds;
+ MutableSegmentRef es;
Flags flags;
- inline Context(): engine(0), al(ax), ah(ax), bl(bx), bh(bx), cl(cx), ch(cx), dl(dx), dh(dx),
- cs(this), ds(this), es(this), data(this) {
- _segments[kDefaultDataSegment] = SegmentPtr(new Segment());
- cs.reset(kDefaultDataSegment);
- ds.reset(kDefaultDataSegment);
- es.reset(kDefaultDataSegment);
- data.reset(kDefaultDataSegment);
- }
-
- SegmentRef getSegment(uint16 value) {
- SegmentMap::iterator i = _segments.find(value);
- assert(i != _segments.end());
- return SegmentRef(this, value, i->_value);
- }
-
- SegmentRef allocateSegment(uint size) {
- unsigned id;
- if (_freeSegments.empty())
- id = kDefaultDataSegment + _segments.size();
- else {
- id = _freeSegments.front();
- _freeSegments.pop_front();
- }
- assert(!_segments.contains(id));
- SegmentPtr seg(new Segment());
- seg->data.resize(size);
- _segments[id] = seg;
- return SegmentRef(this, id, seg);
- }
-
- void deallocateSegment(uint16 id) {
- SegmentMap::iterator i = _segments.find(id);
- assert(i != _segments.end());
- _segments.erase(i);
- _freeSegments.push_back(id);
- }
+ Context(SegmentManager *segMan): al(ax), ah(ax), bl(bx), bh(bx), cl(cx), ch(cx), dl(dx), dh(dx),
+ cs(segMan->data),
+ ds(segMan, segMan->data),
+ es(segMan, segMan->data) {
- SegmentRef segRef(uint16 seg) {
- SegmentRef result(this);
- result = seg;
- return result;
}
inline void _cmp(uint8 a, uint8 b) {
@@ -564,10 +398,6 @@ public:
}
};
-inline void SegmentRef::reset(uint16 value) {
- *this = _context->getSegment(value);
-}
-
class StackChecker {
const Context &_context;
const uint _stackDepth;
@@ -583,6 +413,6 @@ public:
# define STACK_CHECK do {} while (0)
#endif
-}
+} // End of namespace DreamGen
#endif
diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp
index 636182dc83..f0fd477ec1 100644
--- a/engines/dreamweb/saveload.cpp
+++ b/engines/dreamweb/saveload.cpp
@@ -28,54 +28,53 @@
namespace DreamGen {
-void DreamGenContext::loadgame() {
- STACK_CHECK;
+// Temporary storage for loading the room from a savegame
+Room g_madeUpRoomDat;
+
+void DreamGenContext::loadGame() {
if (data.byte(kCommandtype) != 246) {
data.byte(kCommandtype) = 246;
- al = 41;
- commandonly();
+ commandOnly(41);
}
if (data.word(kMousebutton) == data.word(kOldbutton))
return; // "noload"
- if (data.word(kMousebutton) == 1) {
- ax = 0xFFFF;
- doload();
- }
+ if (data.word(kMousebutton) == 1)
+ doLoad(-1);
}
-// input: ax = savegameId
// if -1, open menu to ask for slot to load
// if >= 0, directly load from that slot
-void DreamGenContext::doload() {
- STACK_CHECK;
- int savegameId = (int16)ax;
-
+void DreamGenContext::doLoad(int savegameId) {
data.byte(kLoadingorsave) = 1;
if (ConfMan.getBool("dreamweb_originalsaveload") && savegameId == -1) {
- showopbox();
- showloadops();
+ showOpBox();
+ showLoadOps();
data.byte(kCurrentslot) = 0;
- showslots();
- shownames();
+ showSlots();
+ showNames();
data.byte(kPointerframe) = 0;
- worktoscreenm();
- namestoold();
+ workToScreenM();
+ namesToOld();
data.byte(kGetback) = 0;
- while (true) {
- if (data.byte(kQuitrequested))
- return; // "quitloaded"
- delpointer();
- readmouse();
- showpointer();
- vsync();
- dumppointer();
- dumptextline();
- bx = offset_loadlist;
- checkcoords();
- if (data.byte(kGetback) == 1)
- break;
+ while (data.byte(kGetback) == 0) {
+ if (quitRequested())
+ return;
+ delPointer();
+ readMouse();
+ showPointer();
+ vSync();
+ dumpPointer();
+ dumpTextLine();
+ RectWithCallback loadlist[] = {
+ { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamGenContext::getBackToOps },
+ { kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamGenContext::actualLoad },
+ { kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamGenContext::selectSlot },
+ { 0,320,0,200,&DreamGenContext::blank },
+ { 0xFFFF,0,0,0,0 }
+ };
+ checkCoords(loadlist);
if (data.byte(kGetback) == 2)
return; // "quitloaded"
}
@@ -98,83 +97,35 @@ void DreamGenContext::doload() {
return;
}
+ loadPosition(savegameId);
- // TODO: proper scheme for filename, in a separate function
- //Common::String filename = ConfMan.getActiveDomainName() + Common::String::format(".d%02d", savegameId);
- Common::String filename = Common::String::format("DREAMWEB.D%02d", savegameId);
- debug(1, "Loading from filename: %s", filename.c_str());
- engine->openSaveFileForReading(filename);
-
- // TODO: The below is duplicated from Loadposition
- data.word(kTimecount) = 0;
- clearchanges();
-
- ds = cs;
- dx = kFileheader;
- cx = kHeaderlen;
- savefileread();
- es = cs;
- di = kFiledata;
- ax = savegameId;
- if (savegameId < 7) {
- cx = 17;
- _mul(cx);
- ds = data;
- dx = kSavenames;
- _add(dx, ax);
- loadseg();
- } else {
- // For potential support of more than 7 savegame slots,
- // loading into the savenames buffer isn't always possible
- // Emulate a loadseg call:
- uint8 namebuf[17];
- engine->readFromFile(namebuf, 17);
- _add(di, 2);
- }
- ds = data;
- dx = kStartvars;
- loadseg();
- ds = data.word(kExtras);
- dx = kExframedata;
- loadseg();
- ds = data.word(kBuffers);
- dx = kListofchanges;
- loadseg();
- ds = data;
- dx = kMadeuproomdat;
- loadseg();
- ds = cs;
- dx = kReelroutines;
- loadseg();
- closefile();
data.byte(kGetback) = 1;
}
+ // If we reach this point, loadPosition() has just been called.
+ // Among other things, it will have filled g_MadeUpRoomDat.
+
// kTempgraphics might not have been allocated if we bypassed all menus
if (data.word(kTempgraphics) != 0xFFFF)
- getridoftemp();
+ getRidOfTemp();
- dx = data;
- es = dx;
- bx = kMadeuproomdat;
- startloading();
- loadroomssample();
+ startLoading(g_madeUpRoomDat);
+ loadRoomsSample();
data.byte(kRoomloaded) = 1;
data.byte(kNewlocation) = 255;
- clearsprites();
- initman();
- initrain();
+ clearSprites();
+ initMan();
+ initRain();
data.word(kTextaddressx) = 13;
data.word(kTextaddressy) = 182;
data.byte(kTextlen) = 240;
startup();
- worktoscreen();
+ workToScreenCPP();
data.byte(kGetback) = 4;
}
-void DreamGenContext::savegame() {
- STACK_CHECK;
+void DreamGenContext::saveGame() {
if (data.byte(kMandead) == 2) {
blank();
return;
@@ -182,8 +133,7 @@ void DreamGenContext::savegame() {
if (data.byte(kCommandtype) != 247) {
data.byte(kCommandtype) = 247;
- al = 44;
- commandonly();
+ commandOnly(44);
}
if (data.word(kMousebutton) != 1)
return;
@@ -191,34 +141,36 @@ void DreamGenContext::savegame() {
data.byte(kLoadingorsave) = 2;
if (ConfMan.getBool("dreamweb_originalsaveload")) {
- showopbox();
- showsaveops();
+ showOpBox();
+ showSaveOps();
data.byte(kCurrentslot) = 0;
- showslots();
- shownames();
- worktoscreenm();
- namestoold();
+ showSlots();
+ showNames();
+ workToScreenM();
+ namesToOld();
data.word(kBufferin) = 0;
data.word(kBufferout) = 0;
data.byte(kGetback) = 0;
- while (true) {
- _cmp(data.byte(kQuitrequested), 0);
- if (!flags.z())
- return /* (quitsavegame) */;
- delpointer();
- checkinput();
- readmouse();
- showpointer();
- vsync();
- dumppointer();
- dumptextline();
- bx = offset_savelist;
- checkcoords();
- _cmp(data.byte(kGetback), 0);
- if (flags.z())
- continue;
- break;
+ while (data.byte(kGetback) == 0) {
+ if (quitRequested())
+ return;
+ delPointer();
+ checkInput();
+ readMouse();
+ showPointer();
+ vSync();
+ dumpPointer();
+ dumpTextLine();
+
+ RectWithCallback savelist[] = {
+ { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamGenContext::getBackToOps },
+ { kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamGenContext::actualSave },
+ { kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamGenContext::selectSlot },
+ { 0,320,0,200,&DreamGenContext::blank },
+ { 0xFFFF,0,0,0,0 }
+ };
+ checkCoords(savelist);
}
return;
} else {
@@ -238,54 +190,7 @@ void DreamGenContext::savegame() {
return;
}
- // TODO: The below is copied from actualsave
- al = data.byte(kLocation);
- ah = 0;
- cx = 32;
- _mul(cx);
- ds = cs;
- si = kRoomdata;
- _add(si, ax);
- di = kMadeuproomdat;
- bx = di;
- es = cs;
- cx = 16;
- _movsw(cx, true);
- al = data.byte(kRoomssample);
- es.byte(bx+13) = al;
- al = data.byte(kMapx);
- es.byte(bx+15) = al;
- al = data.byte(kMapy);
- es.byte(bx+16) = al;
- al = data.byte(kLiftflag);
- es.byte(bx+20) = al;
- al = data.byte(kManspath);
- es.byte(bx+21) = al;
- al = data.byte(kFacing);
- es.byte(bx+22) = al;
- al = 255;
- es.byte(bx+27) = al;
-
- // TODO: The below is copied from saveposition
- makeheader();
-
- //Common::String filename = ConfMan.getActiveDomainName() + Common::String::format(".d%02d", savegameId);
- Common::String filename = Common::String::format("DREAMWEB.D%02d", savegameId);
- debug(1, "Saving to filename: %s (%s)", filename.c_str(), game_description.c_str());
-
- engine->openSaveFileForWriting(filename.c_str());
-
- dx = data;
- ds = dx;
- dx = kFileheader;
- cx = kHeaderlen;
- savefilewrite();
- dx = data;
- es = dx;
- di = kFiledata;
-
- // TODO: Check if this 2 is a constant
- uint8 descbuf[17] = { 2, 0 };
+ char descbuf[17] = { 2, 0 };
strncpy((char*)descbuf+1, game_description.c_str(), 16);
unsigned int desclen = game_description.size();
if (desclen > 15)
@@ -294,50 +199,328 @@ void DreamGenContext::savegame() {
descbuf[++desclen] = 0;
while (desclen < 17)
descbuf[++desclen] = 1;
- if (savegameId < 7) {
- ax = savegameId;
- cx = 17;
- _mul(cx);
- ds = data;
- dx = kSavenames;
- _add(dx, ax);
- memcpy(data.ptr(dx,17), descbuf, 17);
- saveseg();
- } else {
- // savenames only has room for descriptions for 7 slots
- uint16 len = es.word(di);
- _add(di, 2);
- assert(len == 17);
- engine->writeToSaveFile(descbuf, len);
- }
+ if (savegameId < 7)
+ memcpy(&_saveNames[17*savegameId], descbuf, 17);
- ds = data;
- dx = kStartvars;
- saveseg();
- ds = data.word(kExtras);
- dx = kExframedata;
- saveseg();
- ds = data.word(kBuffers);
- dx = kListofchanges;
- saveseg();
- ds = data;
- dx = kMadeuproomdat;
- saveseg();
- ds = data;
- dx = kReelroutines;
- saveseg();
- closefile();
-
- getridoftemp();
- restoreall();
+ savePosition(savegameId, descbuf);
+
+ // TODO: The below is copied from actualsave
+ getRidOfTemp();
+ restoreAll(); // reels
data.word(kTextaddressx) = 13;
data.word(kTextaddressy) = 182;
data.byte(kTextlen) = 240;
- redrawmainscrn();
- worktoscreenm();
+ redrawMainScrn();
+ workToScreenM();
data.byte(kGetback) = 4;
}
}
+void DreamGenContext::namesToOld() {
+ memcpy(_saveNamesOld, _saveNames, 17*7);
+}
+
+void DreamGenContext::oldToNames() {
+ memcpy(_saveNames, _saveNamesOld, 17*7);
+}
+
+void DreamGenContext::saveLoad() {
+ if (data.word(kWatchingtime) || (data.byte(kPointermode) == 2)) {
+ blank();
+ return;
+ }
+ if (data.byte(kCommandtype) != 253) {
+ data.byte(kCommandtype) = 253;
+ commandOnly(43);
+ }
+ if ((data.word(kMousebutton) != data.word(kOldbutton)) && (data.word(kMousebutton) & 1))
+ doSaveLoad();
+}
+
+void DreamGenContext::showMainOps() {
+ showFrame(tempGraphics(), kOpsx+10, kOpsy+10, 8, 0);
+ showFrame(tempGraphics(), kOpsx+59, kOpsy+30, 7, 0);
+ showFrame(tempGraphics(), kOpsx+128+4, kOpsy+12, 1, 0);
+}
+
+void DreamGenContext::showDiscOps() {
+ showFrame(tempGraphics(), kOpsx+128+4, kOpsy+12, 1, 0);
+ showFrame(tempGraphics(), kOpsx+10, kOpsy+10, 9, 0);
+ showFrame(tempGraphics(), kOpsx+59, kOpsy+30, 10, 0);
+ showFrame(tempGraphics(), kOpsx+176+2, kOpsy+60-4, 5, 0);
+}
+
+void DreamGenContext::actualSave() {
+ if (data.byte(kCommandtype) != 222) {
+ data.byte(kCommandtype) = 222;
+ commandOnly(44);
+ }
+
+ if (!(data.word(kMousebutton) & 1))
+ return;
+
+ unsigned int slot = data.byte(kCurrentslot);
+
+ const char *desc = &_saveNames[17*slot];
+ if (desc[1] == 0) // The actual description string starts at desc[1]
+ return;
+
+ savePosition(slot, desc);
+
+ getRidOfTemp();
+ restoreAll(); // reels
+ data.word(kTextaddressx) = 13;
+ data.word(kTextaddressy) = 182;
+ data.byte(kTextlen) = 240;
+ redrawMainScrn();
+ workToScreenM();
+ data.byte(kGetback) = 4;
+}
+
+void DreamGenContext::actualLoad() {
+ if (data.byte(kCommandtype) != 221) {
+ data.byte(kCommandtype) = 221;
+ commandOnly(41);
+ }
+
+ if (data.word(kMousebutton) == data.word(kOldbutton) || data.word(kMousebutton) != 1)
+ return;
+
+ unsigned int slot = data.byte(kCurrentslot);
+
+ const char *desc = &_saveNames[17*slot];
+ if (desc[1] == 0) // The actual description string starts at desc[1]
+ return;
+
+ loadPosition(data.byte(kCurrentslot));
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::savePosition(unsigned int slot, const char *descbuf) {
+
+ const Room &currentRoom = g_roomData[data.byte(kLocation)];
+
+ Room madeUpRoom = currentRoom;
+ madeUpRoom.roomsSample = data.byte(kRoomssample);
+ madeUpRoom.mapX = data.byte(kMapx);
+ madeUpRoom.mapY = data.byte(kMapy);
+ madeUpRoom.liftFlag = data.byte(kLiftflag);
+ madeUpRoom.b21 = data.byte(kManspath);
+ madeUpRoom.facing = data.byte(kFacing);
+ madeUpRoom.b27 = 255;
+
+
+ engine->processEvents(); // TODO: Is this necessary?
+
+ Common::String filename = engine->getSavegameFilename(slot);
+ debug(1, "savePosition: slot %d filename %s", slot, filename.c_str());
+ Common::OutSaveFile *outSaveFile = engine->getSaveFileManager()->openForSaving(filename);
+ if (!outSaveFile) // TODO: Do proper error handling!
+ error("save could not be opened for writing");
+
+ // Initialize new header
+ FileHeader header;
+
+ // Note: _desc is not zero-terminated
+ const char *desc = "DREAMWEB DATA FILE COPYRIGHT 1992 CREATIVE REALITY";
+ assert(strlen(desc) == sizeof(header._desc));
+ memcpy(header._desc, desc, sizeof(header._desc));
+ memset(&header._len[0], 0, sizeof(header._len));
+ memset(&header._padding[0], 0, sizeof(header._padding));
+
+ // fill length fields in savegame file header
+ uint16 len[6] = { 17, kLengthofvars, kLengthofextra,
+ 4*kNumchanges, 48, kLenofreelrouts };
+ for (int i = 0; i < 6; ++i)
+ header.setLen(i, len[i]);
+
+ outSaveFile->write((const uint8 *)&header, sizeof(FileHeader));
+ outSaveFile->write(descbuf, len[0]);
+ outSaveFile->write(data.ptr(kStartvars, len[1]), len[1]);
+ outSaveFile->write(getSegment(data.word(kExtras)).ptr(kExframedata, len[2]), len[2]);
+ outSaveFile->write(getSegment(data.word(kBuffers)).ptr(kListofchanges, len[3]), len[3]);
+
+ // len[4] == 48, which is sizeof(Room) plus 16 for 'Roomscango'
+ outSaveFile->write((const uint8 *)&madeUpRoom, sizeof(Room));
+ outSaveFile->write(data.ptr(kRoomscango, 16), 16);
+
+ outSaveFile->write(data.ptr(kReelroutines, len[5]), len[5]);
+
+ outSaveFile->finalize();
+ if (outSaveFile->err()) {
+ // TODO: Do proper error handling
+ warning("an error occurred while writing the savegame");
+ }
+
+ delete outSaveFile;
+}
+
+void DreamGenContext::loadPosition(unsigned int slot) {
+ data.word(kTimecount) = 0;
+ clearChanges();
+
+ Common::String filename = engine->getSavegameFilename(slot);
+ debug(1, "loadPosition: slot %d filename %s", slot, filename.c_str());
+ Common::InSaveFile *inSaveFile = engine->getSaveFileManager()->openForLoading(filename);
+ if (!inSaveFile) // TODO: Do proper error handling!
+ error("save could not be opened for reading");
+
+ FileHeader header;
+
+ inSaveFile->read((uint8 *)&header, sizeof(FileHeader));
+
+ // read segment lengths from savegame file header
+ int len[6];
+ for (int i = 0; i < 6; ++i)
+ len[i] = header.len(i);
+ if (len[0] != 17)
+ ::error("Error loading save: description buffer isn't 17 bytes");
+
+ if (slot < 7) {
+ inSaveFile->read(&_saveNames[17*slot], len[0]);
+ } else {
+ // The savenames buffer only has room for 7 descriptions
+ uint8 namebuf[17];
+ inSaveFile->read(namebuf, 17);
+ }
+ inSaveFile->read(data.ptr(kStartvars, len[1]), len[1]);
+ inSaveFile->read(getSegment(data.word(kExtras)).ptr(kExframedata, len[2]), len[2]);
+ inSaveFile->read(getSegment(data.word(kBuffers)).ptr(kListofchanges, len[3]), len[3]);
+
+ // len[4] == 48, which is sizeof(Room) plus 16 for 'Roomscango'
+ // Note: the values read into g_madeUpRoomDat are only used in actualLoad,
+ // which is (almost) immediately called after this function
+ inSaveFile->read((uint8 *)&g_madeUpRoomDat, sizeof(Room));
+ inSaveFile->read(data.ptr(kRoomscango, 16), 16);
+
+ inSaveFile->read(data.ptr(kReelroutines, len[5]), len[5]);
+
+ delete inSaveFile;
+}
+
+// Count number of save files, and load their descriptions into _saveNames
+unsigned int DreamGenContext::scanForNames() {
+ unsigned int count = 0;
+
+ FileHeader header;
+
+ // TODO: Change this to use SaveFileManager::listSavefiles()
+ for (unsigned int slot = 0; slot < 7; ++slot) {
+ _saveNames[17*slot+0] = 2;
+ _saveNames[17*slot+1] = 0;
+ for (int i = 2; i < 17; ++i)
+ _saveNames[17*slot+i] = 1;
+
+ // Try opening savegame with the given slot id
+ Common::String filename = engine->getSavegameFilename(slot);
+ Common::InSaveFile *inSaveFile = engine->getSaveFileManager()->openForLoading(filename);
+ if (!inSaveFile)
+ continue;
+
+ ++count;
+
+ inSaveFile->read((uint8 *)&header, sizeof(FileHeader));
+
+ if (header.len(0) != 17) {
+ ::warning("Error loading save: description buffer isn't 17 bytes");
+ delete inSaveFile;
+ continue;
+ }
+
+ // NB: Only possible if slot < 7
+ inSaveFile->read(&_saveNames[17*slot], 17);
+
+ delete inSaveFile;
+ }
+
+ al = (uint8)count;
+
+ return count;
+}
+
+void DreamGenContext::loadOld() {
+ if (data.byte(kCommandtype) != 252) {
+ data.byte(kCommandtype) = 252;
+ commandOnly(48);
+ }
+
+ if (!(data.word(kMousebutton) & 1))
+ return;
+
+ doLoad(-1);
+
+ if (data.byte(kGetback) == 4 || quitRequested())
+ return;
+
+ showDecisions();
+ workToScreenM();
+ data.byte(kGetback) = 0;
+}
+
+void DreamGenContext::loadSaveBox() {
+ loadIntoTemp("DREAMWEB.G08");
+}
+
+// show savegame names (original interface), and set kCursorpos
+void DreamBase::showNames() {
+ for (int slot = 0; slot < 7; ++slot) {
+ // The first character of the savegame name is unused
+ Common::String name(&_saveNames[17*slot + 1]);
+
+ if (slot != data.byte(kCurrentslot)) {
+ printDirect((const uint8 *)name.c_str(), kOpsx + 21, kOpsy + 10*slot + 10, 200, false);
+ continue;
+ }
+ if (data.byte(kLoadingorsave) != 2) {
+ data.word(kCharshift) = 91;
+ printDirect((const uint8 *)name.c_str(), kOpsx + 21, kOpsy + 10*slot + 10, 200, false);
+ data.word(kCharshift) = 0;
+ continue;
+ }
+
+ int pos = name.size();
+ data.byte(kCursorpos) = pos;
+ name += '/'; // cursor character
+ printDirect((const uint8 *)name.c_str(), kOpsx + 21, kOpsy + 10*slot + 10, 200, false);
+ }
+}
+
+void DreamGenContext::checkInput() {
+ if (data.byte(kLoadingorsave) == 3)
+ return;
+
+ readKey();
+
+ // The first character of the savegame name is unused
+ char *name = &_saveNames[17*data.byte(kCurrentslot) + 1];
+
+ if (data.byte(kCurrentkey) == 0) {
+ return;
+ } else if (data.byte(kCurrentkey) == 13) {
+ data.byte(kLoadingorsave) = 3;
+ } else if (data.byte(kCurrentkey) == 8) {
+ if (data.byte(kCursorpos) == 0)
+ return;
+
+ --data.byte(kCursorpos);
+ name[data.byte(kCursorpos)] = 0;
+ name[data.byte(kCursorpos)+1] = 1;
+ } else {
+ if (data.byte(kCursorpos) == 14)
+ return;
+
+ name[data.byte(kCursorpos)] = data.byte(kCurrentkey);
+ name[data.byte(kCursorpos)+1] = 0;
+ name[data.byte(kCursorpos)+2] = 1;
+ ++data.byte(kCursorpos);
+ }
+
+ showOpBox();
+ showNames();
+ showSlots();
+ showSaveOps();
+ workToScreenM();
+}
+
-} /*namespace dreamgen */
+} // End of namespace DreamGen
diff --git a/engines/dreamweb/segment.h b/engines/dreamweb/segment.h
new file mode 100644
index 0000000000..9464015478
--- /dev/null
+++ b/engines/dreamweb/segment.h
@@ -0,0 +1,227 @@
+/* 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 DREAMGEN_SEGMENT_H
+#define DREAMGEN_SEGMENT_H
+
+#include "common/array.h"
+#include "common/ptr.h"
+#include "common/hashmap.h"
+#include "common/list.h"
+
+namespace DreamGen {
+
+class WordRef {
+ uint8 *_data;
+ unsigned _index;
+ uint16 _value;
+
+public:
+ inline WordRef(Common::Array<uint8> &data, unsigned index) : _data(data.begin() + index), _index(index) {
+ assert(index + 1 < data.size());
+ _value = _data[0] | (_data[1] << 8);
+ }
+
+ inline WordRef& operator=(const WordRef &ref) {
+ _value = ref._value;
+ return *this;
+ }
+
+ inline WordRef& operator=(uint16 v) {
+ _value = v;
+ return *this;
+ }
+
+ inline operator uint16&() {
+ return _value;
+ }
+
+ inline ~WordRef() {
+ _data[0] = _value & 0xff;
+ _data[1] = _value >> 8;
+ _value = _data[0] | (_data[1] << 8);
+ }
+};
+
+class Segment {
+ Common::Array<uint8> data;
+
+public:
+ Segment(uint size = 0) {
+ if (size > 0)
+ data.resize(size);
+ }
+
+ inline void assign(const uint8 *b, const uint8 *e) {
+ data.assign(b, e);
+ }
+
+ inline uint8 &byte(unsigned index) {
+ assert(index < data.size());
+ return data[index];
+ }
+
+ inline WordRef word(unsigned index) {
+ return WordRef(data, index);
+ }
+
+ inline uint8 *ptr(unsigned index, unsigned size) {
+ assert(index + size <= data.size());
+ return data.begin() + index;
+ }
+};
+
+typedef Common::SharedPtr<Segment> SegmentPtr;
+
+class SegmentRef {
+ uint16 _value;
+ SegmentPtr _segment;
+
+public:
+ SegmentRef(uint16 value = 0, SegmentPtr segment = SegmentPtr())
+ : _value(value), _segment(segment) {
+ }
+
+ inline operator uint16() const {
+ return _value;
+ }
+
+ SegmentPtr getSegmentPtr() const {
+ return _segment;
+ }
+
+ inline uint8 &byte(unsigned index) {
+ assert(_segment != 0);
+ return _segment->byte(index);
+ }
+
+ inline WordRef word(unsigned index) {
+ //debug(1, "getting word ref for %04x:%d", _value, index);
+ assert(_segment != 0);
+ return _segment->word(index);
+ }
+
+ inline void assign(const uint8 *b, const uint8 *e) {
+ assert(_segment != 0);
+ _segment->assign(b, e);
+ }
+
+ inline uint8 *ptr(unsigned index, unsigned size) {
+ assert(_segment != 0);
+ return _segment->ptr(index, size);
+ }
+
+protected:
+ SegmentRef &operator=(const SegmentRef &seg) {
+ _value = seg._value;
+ _segment = seg._segment;
+ return *this;
+ }
+
+};
+
+class SegmentManager;
+
+class MutableSegmentRef : public SegmentRef {
+protected:
+ SegmentManager *_segMan;
+
+public:
+ MutableSegmentRef(SegmentManager *segMan, uint16 value = 0, SegmentPtr segment = SegmentPtr())
+ : _segMan(segMan), SegmentRef(value, segment) {
+ }
+
+ MutableSegmentRef(SegmentManager *segMan, SegmentRef seg)
+ : _segMan(segMan), SegmentRef(seg) {
+ }
+
+ inline MutableSegmentRef& operator=(const uint16 id);
+
+};
+
+
+class SegmentManager {
+private:
+ typedef Common::HashMap<uint16, SegmentPtr> SegmentMap;
+ SegmentMap _segments;
+
+ typedef Common::List<uint16> FreeSegmentList;
+ FreeSegmentList _freeSegments;
+
+ enum { kDefaultDataSegment = 0x1000 };
+
+public:
+
+ SegmentPtr _realData; ///< the primary data segment, points to a huge blob of binary data
+ SegmentRef data; ///< fake segment register always pointing to data segment
+
+public:
+ SegmentManager() :
+ _realData(new Segment()),
+ data(kDefaultDataSegment, _realData) {
+
+ _segments[kDefaultDataSegment] = data.getSegmentPtr();
+ }
+
+ SegmentRef getSegment(uint16 value) {
+ SegmentMap::iterator i = _segments.find(value);
+ if (i != _segments.end())
+ return SegmentRef(value, i->_value);
+ else
+ return SegmentRef(value);
+ }
+
+ SegmentRef allocateSegment(uint size) {
+ unsigned id;
+ if (_freeSegments.empty())
+ id = kDefaultDataSegment + _segments.size();
+ else {
+ id = _freeSegments.front();
+ _freeSegments.pop_front();
+ }
+ assert(!_segments.contains(id));
+ SegmentPtr seg(new Segment(size));
+ _segments[id] = seg;
+ return SegmentRef(id, seg);
+ }
+
+ void deallocateSegment(uint16 id) {
+ SegmentMap::iterator i = _segments.find(id);
+ if(i != _segments.end()) {
+ _segments.erase(i);
+ _freeSegments.push_back(id);
+ } else {
+ debug("Deallocating non existent segment! Client code should be fixed.");
+ }
+ }
+
+};
+
+
+inline MutableSegmentRef& MutableSegmentRef::operator=(const uint16 id) {
+ SegmentRef::operator=(_segMan->getSegment(id));
+ return *this;
+}
+
+} // End of namespace DreamGen
+
+#endif
diff --git a/engines/dreamweb/sound.cpp b/engines/dreamweb/sound.cpp
new file mode 100644
index 0000000000..784a6d0d11
--- /dev/null
+++ b/engines/dreamweb/sound.cpp
@@ -0,0 +1,294 @@
+/* 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"
+#include "dreamweb/dreamgen.h"
+
+#include "audio/mixer.h"
+#include "audio/decoders/raw.h"
+
+#include "common/config-manager.h"
+
+namespace DreamGen {
+
+void DreamGenContext::loadSpeech() {
+ loadSpeech((uint8)dl, (uint8)dh, (uint8)cl, (uint16)ax);
+}
+
+bool DreamBase::loadSpeech(byte type1, int idx1, byte type2, int idx2) {
+ cancelCh1();
+
+ Common::String name = Common::String::format("%c%02d%c%04d.RAW", type1, idx1, type2, idx2);
+ //debug("name = %s", name.c_str());
+ bool result = engine->loadSpeech(name);
+
+ data.byte(kSpeechloaded) = result;
+ return result;
+}
+
+
+void DreamBase::volumeAdjust() {
+ if (data.byte(kVolumedirection) == 0)
+ return;
+ if (data.byte(kVolume) != data.byte(kVolumeto)) {
+ data.byte(kVolumecount) += 64;
+ // Only modify the volume every 256/64 = 4th time around
+ if (data.byte(kVolumecount) == 0)
+ data.byte(kVolume) += data.byte(kVolumedirection);
+ } else {
+ data.byte(kVolumedirection) = 0;
+ }
+}
+
+void DreamBase::playChannel0(uint8 index, uint8 repeat) {
+ data.byte(kCh0playing) = index;
+ Sound *soundBank;
+ if (index >= 12) {
+ soundBank = (Sound *)getSegment(data.word(kSounddata2)).ptr(0, 0);
+ index -= 12;
+ } else
+ soundBank = (Sound *)getSegment(data.word(kSounddata)).ptr(0, 0);
+
+ data.byte(kCh0repeat) = repeat;
+ data.word(kCh0blockstocopy) = soundBank[index].blockCount();
+}
+
+void DreamBase::playChannel1(uint8 index) {
+ if (data.byte(kCh1playing) == 7)
+ return;
+
+ data.byte(kCh1playing) = index;
+ Sound *soundBank;
+ if (index >= 12) {
+ soundBank = (Sound *)getSegment(data.word(kSounddata2)).ptr(0, 0);
+ index -= 12;
+ } else
+ soundBank = (Sound *)getSegment(data.word(kSounddata)).ptr(0, 0);
+
+ data.word(kCh1blockstocopy) = soundBank[index].blockCount();
+}
+
+void DreamGenContext::playChannel1() {
+ playChannel1(al);
+}
+
+void DreamBase::cancelCh0() {
+ data.byte(kCh0repeat) = 0;
+ data.word(kCh0blockstocopy) = 0;
+ data.byte(kCh0playing) = 255;
+ engine->stopSound(0);
+}
+
+void DreamBase::cancelCh1() {
+ data.word(kCh1blockstocopy) = 0;
+ data.byte(kCh1playing) = 255;
+ engine->stopSound(1);
+}
+
+void DreamBase::loadRoomsSample() {
+ uint8 sample = data.byte(kRoomssample);
+
+ if (sample == 255 || data.byte(kCurrentsample) == sample)
+ return; // loaded already
+
+ assert(sample < 100);
+ Common::String sampleName = Common::String::format("DREAMWEB.V%02d", sample);
+
+ uint8 ch0 = data.byte(kCh0playing);
+ if (ch0 >= 12 && ch0 != 255)
+ cancelCh0();
+ uint8 ch1 = data.byte(kCh1playing);
+ if (ch1 >= 12)
+ cancelCh1();
+ engine->loadSounds(1, sampleName.c_str());
+}
+
+} // End of namespace DreamGen
+
+
+namespace DreamWeb {
+
+void DreamWebEngine::playSound(uint8 channel, uint8 id, uint8 loops) {
+ debug(1, "playSound(%u, %u, %u)", channel, id, loops);
+
+ int bank = 0;
+ bool speech = false;
+ Audio::Mixer::SoundType type = channel == 0?
+ Audio::Mixer::kMusicSoundType: Audio::Mixer::kSFXSoundType;
+
+ if (id >= 12) {
+ id -= 12;
+ bank = 1;
+ if (id == 50) {
+ speech = true;
+ type = Audio::Mixer::kSpeechSoundType;
+ }
+ }
+ const SoundData &data = _soundData[bank];
+
+ Audio::SeekableAudioStream *raw;
+ if (!speech) {
+ if (id >= data.samples.size() || data.samples[id].size == 0) {
+ warning("invalid sample #%u played", id);
+ return;
+ }
+
+ const Sample &sample = data.samples[id];
+ uint8 *buffer = (uint8 *)malloc(sample.size);
+ if (!buffer)
+ error("out of memory: cannot allocate memory for sound(%u bytes)", sample.size);
+ memcpy(buffer, data.data.begin() + sample.offset, sample.size);
+
+ raw = Audio::makeRawStream(
+ buffer,
+ sample.size, 22050, Audio::FLAG_UNSIGNED);
+ } else {
+ uint8 *buffer = (uint8 *)malloc(_speechData.size());
+ if (!buffer)
+ error("out of memory: cannot allocate memory for sound(%u bytes)", _speechData.size());
+ memcpy(buffer, _speechData.begin(), _speechData.size());
+ raw = Audio::makeRawStream(
+ buffer,
+ _speechData.size(), 22050, Audio::FLAG_UNSIGNED);
+
+ }
+
+ Audio::AudioStream *stream;
+ if (loops > 1) {
+ stream = new Audio::LoopingAudioStream(raw, loops < 255? loops: 0);
+ } else
+ stream = raw;
+
+ if (_mixer->isSoundHandleActive(_channelHandle[channel]))
+ _mixer->stopHandle(_channelHandle[channel]);
+ _mixer->playStream(type, &_channelHandle[channel], stream);
+}
+
+void DreamWebEngine::stopSound(uint8 channel) {
+ debug(1, "stopSound(%u)", channel);
+ assert(channel == 0 || channel == 1);
+ _mixer->stopHandle(_channelHandle[channel]);
+ if (channel == 0)
+ _channel0 = 0;
+ else
+ _channel1 = 0;
+}
+
+bool DreamWebEngine::loadSpeech(const Common::String &filename) {
+ if (ConfMan.getBool("speech_mute"))
+ return false;
+
+ Common::File file;
+ if (!file.open("speech/" + filename))
+ return false;
+
+ debug(1, "loadSpeech(%s)", filename.c_str());
+
+ uint size = file.size();
+ _speechData.resize(size);
+ file.read(_speechData.begin(), size);
+ file.close();
+ return true;
+}
+
+void DreamWebEngine::soundHandler() {
+ _base.data.byte(DreamGen::kSubtitles) = ConfMan.getBool("subtitles");
+ _base.volumeAdjust();
+
+ uint volume = _base.data.byte(DreamGen::kVolume);
+ //.vol file loaded into soundbuf:0x4000
+ //volume table at (volume * 0x100 + 0x3f00)
+ //volume value could be from 1 to 7
+ //1 - 0x10-0xff
+ //2 - 0x1f-0xdf
+ //3 - 0x2f-0xd0
+ //4 - 0x3e-0xc1
+ //5 - 0x4d-0xb2
+ //6 - 0x5d-0xa2
+ //7 - 0x6f-0x91
+ if (volume >= 8)
+ volume = 7;
+ volume = (8 - volume) * Audio::Mixer::kMaxChannelVolume / 8;
+ _mixer->setChannelVolume(_channelHandle[0], volume);
+
+ uint8 ch0 = _base.data.byte(DreamGen::kCh0playing);
+ if (ch0 == 255)
+ ch0 = 0;
+ uint8 ch1 = _base.data.byte(DreamGen::kCh1playing);
+ if (ch1 == 255)
+ ch1 = 0;
+ uint8 ch0loop = _base.data.byte(DreamGen::kCh0repeat);
+
+ if (_channel0 != ch0) {
+ _channel0 = ch0;
+ if (ch0) {
+ playSound(0, ch0, ch0loop);
+ }
+ }
+ if (_channel1 != ch1) {
+ _channel1 = ch1;
+ if (ch1) {
+ playSound(1, ch1, 1);
+ }
+ }
+ if (!_mixer->isSoundHandleActive(_channelHandle[0])) {
+ _base.data.byte(DreamGen::kCh0playing) = 255;
+ _channel0 = 0;
+ }
+ if (!_mixer->isSoundHandleActive(_channelHandle[1])) {
+ _base.data.byte(DreamGen::kCh1playing) = 255;
+ _channel1 = 0;
+ }
+
+}
+
+void DreamWebEngine::loadSounds(uint bank, const Common::String &filename) {
+ debug(1, "loadSounds(%u, %s)", bank, filename.c_str());
+ Common::File file;
+ if (!file.open(filename)) {
+ warning("cannot open %s", filename.c_str());
+ return;
+ }
+
+ uint8 header[0x60];
+ file.read(header, sizeof(header));
+ uint tablesize = READ_LE_UINT16(header + 0x32);
+ debug(1, "table size = %u", tablesize);
+
+ SoundData &soundData = _soundData[bank];
+ soundData.samples.resize(tablesize / 6);
+ uint total = 0;
+ for (uint i = 0; i < tablesize / 6; ++i) {
+ uint8 entry[6];
+ Sample &sample = soundData.samples[i];
+ file.read(entry, sizeof(entry));
+ sample.offset = entry[0] * 0x4000 + READ_LE_UINT16(entry + 1);
+ sample.size = READ_LE_UINT16(entry + 3) * 0x800;
+ total += sample.size;
+ debug(1, "offset: %08x, size: %u", sample.offset, sample.size);
+ }
+ soundData.data.resize(total);
+ file.read(soundData.data.begin(), total);
+ file.close();
+}
+
+} // End of namespace DreamWeb
diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp
index 864bba1d8c..e93a77f3ff 100644
--- a/engines/dreamweb/sprite.cpp
+++ b/engines/dreamweb/sprite.cpp
@@ -24,14 +24,14 @@
namespace DreamGen {
-Sprite *DreamGenContext::spritetable() {
- Sprite *sprite = (Sprite *)segRef(data.word(kBuffers)).ptr(kSpritetable, 16 * sizeof(Sprite));
+Sprite *DreamBase::spriteTable() {
+ Sprite *sprite = (Sprite *)getSegment(data.word(kBuffers)).ptr(kSpritetable, 16 * sizeof(Sprite));
return sprite;
}
-void DreamGenContext::printsprites() {
+void DreamGenContext::printSprites() {
for (size_t priority = 0; priority < 7; ++priority) {
- Sprite *sprites = spritetable();
+ Sprite *sprites = spriteTable();
for (size_t j = 0; j < 16; ++j) {
const Sprite &sprite = sprites[j];
if (sprite.updateCallback() == 0x0ffff)
@@ -40,12 +40,12 @@ void DreamGenContext::printsprites() {
continue;
if (sprite.hidden == 1)
continue;
- printasprite(&sprite);
+ printASprite(&sprite);
}
}
}
-void DreamGenContext::printasprite(const Sprite *sprite) {
+void DreamGenContext::printASprite(const Sprite *sprite) {
uint16 x, y;
if (sprite->y >= 220) {
y = data.word(kMapady) - (256 - sprite->y);
@@ -60,20 +60,20 @@ void DreamGenContext::printasprite(const Sprite *sprite) {
}
uint8 c;
- if (sprite->b29 != 0)
+ if (sprite->walkFrame != 0)
c = 8;
else
c = 0;
- showframe((const Frame *)segRef(sprite->frameData()).ptr(0, 0), x, y, sprite->b15, c);
+ showFrame((const Frame *)getSegment(sprite->frameData()).ptr(0, 0), x, y, sprite->frameNumber, c);
}
-void DreamGenContext::clearsprites() {
- memset(spritetable(), 0xff, sizeof(Sprite) * 16);
+void DreamGenContext::clearSprites() {
+ memset(spriteTable(), 0xff, sizeof(Sprite) * 16);
}
-Sprite *DreamGenContext::makesprite(uint8 x, uint8 y, uint16 updateCallback, uint16 frameData, uint16 somethingInDi) {
- Sprite *sprite = spritetable();
- while (sprite->b15 != 0xff) { // NB: No boundchecking in the original code either
+Sprite *DreamGenContext::makeSprite(uint8 x, uint8 y, uint16 updateCallback, uint16 frameData, uint16 somethingInDi) {
+ Sprite *sprite = spriteTable();
+ while (sprite->frameNumber != 0xff) { // NB: No boundchecking in the original code either
++sprite;
}
@@ -83,13 +83,13 @@ Sprite *DreamGenContext::makesprite(uint8 x, uint8 y, uint16 updateCallback, uin
sprite->setFrameData(frameData);
WRITE_LE_UINT16(&sprite->w8, somethingInDi);
sprite->w2 = 0xffff;
- sprite->b15 = 0;
+ sprite->frameNumber = 0;
sprite->delay = 0;
return sprite;
}
-void DreamGenContext::spriteupdate() {
- Sprite *sprites = spritetable();
+void DreamGenContext::spriteUpdate() {
+ Sprite *sprites = spriteTable();
sprites[0].hidden = data.byte(kRyanon);
Sprite *sprite = sprites;
@@ -98,10 +98,10 @@ void DreamGenContext::spriteupdate() {
if (updateCallback != 0xffff) {
sprite->w24 = sprite->w2;
if (updateCallback == addr_mainman) // NB : Let's consider the callback as an enum while more code is not ported to C++
- mainman(sprite);
+ mainMan(sprite);
else {
assert(updateCallback == addr_backobject);
- backobject(sprite);
+ backObject(sprite);
}
}
@@ -111,18 +111,18 @@ void DreamGenContext::spriteupdate() {
}
}
-void DreamGenContext::initman() {
- Sprite *sprite = makesprite(data.byte(kRyanx), data.byte(kRyany), addr_mainman, data.word(kMainsprites), 0);
+void DreamGenContext::initMan() {
+ Sprite *sprite = makeSprite(data.byte(kRyanx), data.byte(kRyany), addr_mainman, data.word(kMainsprites), 0);
sprite->priority = 4;
- sprite->b22 = 0;
- sprite->b29 = 0;
+ sprite->speed = 0;
+ sprite->walkFrame = 0;
}
-void DreamGenContext::mainman() {
+void DreamGenContext::mainMan() {
assert(false);
}
-void DreamGenContext::mainman(Sprite *sprite) {
+void DreamGenContext::mainMan(Sprite *sprite) {
push(es);
push(ds);
@@ -137,48 +137,48 @@ void DreamGenContext::mainman(Sprite *sprite) {
data.byte(kResetmanxy) = 0;
sprite->x = data.byte(kRyanx);
sprite->y = data.byte(kRyany);
- sprite->b29 = 0;
+ sprite->walkFrame = 0;
}
- --sprite->b22;
- if (sprite->b22 != 0xff) {
+ --sprite->speed;
+ if (sprite->speed != 0xff) {
ds = pop();
es = pop();
return;
}
- sprite->b22 = 0;
+ sprite->speed = 0;
if (data.byte(kTurntoface) != data.byte(kFacing)) {
- aboutturn(sprite);
+ aboutTurn(sprite);
} else {
if ((data.byte(kTurndirection) != 0) && (data.byte(kLinepointer) == 254)) {
data.byte(kReasseschanges) = 1;
if (data.byte(kFacing) == data.byte(kLeavedirection))
- checkforexit();
+ checkForExit();
}
data.byte(kTurndirection) = 0;
if (data.byte(kLinepointer) == 254) {
- sprite->b29 = 0;
+ sprite->walkFrame = 0;
} else {
- ++sprite->b29;
- if (sprite->b29 == 11)
- sprite->b29 = 1;
+ ++sprite->walkFrame;
+ if (sprite->walkFrame == 11)
+ sprite->walkFrame = 1;
walking(sprite);
if (data.byte(kLinepointer) != 254) {
if ((data.byte(kFacing) & 1) == 0)
walking(sprite);
- else if ((sprite->b29 != 2) && (sprite->b29 != 7))
+ else if ((sprite->walkFrame != 2) && (sprite->walkFrame != 7))
walking(sprite);
}
if (data.byte(kLinepointer) == 254) {
if (data.byte(kTurntoface) == data.byte(kFacing)) {
data.byte(kReasseschanges) = 1;
if (data.byte(kFacing) == data.byte(kLeavedirection))
- checkforexit();
+ checkForExit();
}
}
}
}
static const uint8 facelist[] = { 0,60,33,71,11,82,22,93 };
- sprite->b15 = sprite->b29 + facelist[data.byte(kFacing)];
+ sprite->frameNumber = sprite->walkFrame + facelist[data.byte(kFacing)];
data.byte(kRyanx) = sprite->x;
data.byte(kRyany) = sprite->y;
@@ -196,26 +196,26 @@ void DreamGenContext::walking(Sprite *sprite) {
comp = data.byte(kLinelength);
}
if (data.byte(kLinepointer) < comp) {
- sprite->x = data.byte(kLinedata + data.byte(kLinepointer) * 2 + 0);
- sprite->y = data.byte(kLinedata + data.byte(kLinepointer) * 2 + 1);
+ sprite->x = (uint8)_lineData[data.byte(kLinepointer)].x;
+ sprite->y = (uint8)_lineData[data.byte(kLinepointer)].y;
return;
}
data.byte(kLinepointer) = 254;
data.byte(kManspath) = data.byte(kDestination);
if (data.byte(kDestination) == data.byte(kFinaldest)) {
- facerightway();
+ faceRightWay();
return;
}
data.byte(kDestination) = data.byte(kFinaldest);
push(es);
push(bx);
- autosetwalk();
+ autoSetWalk();
bx = pop();
es = pop();
}
-void DreamGenContext::aboutturn(Sprite *sprite) {
+void DreamGenContext::aboutTurn(Sprite *sprite) {
bool incdir = true;
if (data.byte(kTurndirection) == 1)
@@ -241,20 +241,20 @@ void DreamGenContext::aboutturn(Sprite *sprite) {
if (incdir) {
data.byte(kTurndirection) = 1;
data.byte(kFacing) = (data.byte(kFacing) + 1) & 7;
- sprite->b29 = 0;
+ sprite->walkFrame = 0;
} else {
- data.byte(kTurndirection) = -1;
+ data.byte(kTurndirection) = (uint8)-1;
data.byte(kFacing) = (data.byte(kFacing) - 1) & 7;
- sprite->b29 = 0;
+ sprite->walkFrame = 0;
}
}
-void DreamGenContext::backobject() {
+void DreamGenContext::backObject() {
assert(false);
}
-void DreamGenContext::backobject(Sprite *sprite) {
- SetObject *objData = (SetObject *)segRef(data.word(kSetdat)).ptr(sprite->objData(), 0);
+void DreamGenContext::backObject(Sprite *sprite) {
+ SetObject *objData = (SetObject *)getSegment(data.word(kSetdat)).ptr(sprite->objData(), 0);
if (sprite->delay != 0) {
--sprite->delay;
@@ -263,13 +263,13 @@ void DreamGenContext::backobject(Sprite *sprite) {
sprite->delay = objData->delay;
if (objData->type == 6)
- widedoor(sprite, objData);
+ wideDoor(sprite, objData);
else if (objData->type == 5)
- random(sprite, objData);
+ randomSprite(sprite, objData);
else if (objData->type == 4)
- lockeddoorway(sprite, objData);
+ lockedDoorway(sprite, objData);
else if (objData->type == 3)
- liftsprite(sprite, objData);
+ liftSprite(sprite, objData);
else if (objData->type == 2)
doorway(sprite, objData);
else if (objData->type == 1)
@@ -279,563 +279,277 @@ void DreamGenContext::backobject(Sprite *sprite) {
}
void DreamGenContext::constant(Sprite *sprite, SetObject *objData) {
- ++sprite->frame;
- if (objData->b18[sprite->frame] == 255) {
- sprite->frame = 0;
+ ++sprite->animFrame;
+ if (objData->frames[sprite->animFrame] == 255) {
+ sprite->animFrame = 0;
}
- uint8 b18 = objData->b18[sprite->frame];
- objData->index = b18;
- sprite->b15 = b18;
+ uint8 frame = objData->frames[sprite->animFrame];
+ objData->index = frame;
+ sprite->frameNumber = frame;
}
-void DreamGenContext::random(Sprite *sprite, SetObject *objData) {
- randomnum1();
- uint16 r = ax;
- sprite->b15 = objData->b18[r&7];
+void DreamGenContext::randomSprite(Sprite *sprite, SetObject *objData) {
+ uint8 r = engine->randomNumber();
+ sprite->frameNumber = objData->frames[r&7];
}
void DreamGenContext::doorway(Sprite *sprite, SetObject *objData) {
- data.byte(kDoorcheck1) = -24;
- data.byte(kDoorcheck2) = 10;
- data.byte(kDoorcheck3) = -30;
- data.byte(kDoorcheck4) = 10;
- dodoor(sprite, objData);
+ Common::Rect check(-24, -30, 10, 10);
+ doDoor(sprite, objData, check);
}
-void DreamGenContext::widedoor(Sprite *sprite, SetObject *objData) {
- data.byte(kDoorcheck1) = -24;
- data.byte(kDoorcheck2) = 24;
- data.byte(kDoorcheck3) = -30;
- data.byte(kDoorcheck4) = 24;
- dodoor(sprite, objData);
+void DreamGenContext::wideDoor(Sprite *sprite, SetObject *objData) {
+ Common::Rect check(-24, -30, 24, 24);
+ doDoor(sprite, objData, check);
}
-void DreamGenContext::dodoor() {
- Sprite *sprite = (Sprite *)es.ptr(bx, sizeof(Sprite));
- SetObject *objData = (SetObject *)ds.ptr(di, 0);
- dodoor(sprite, objData);
-}
+void DreamGenContext::doDoor(Sprite *sprite, SetObject *objData, Common::Rect check) {
+ int ryanx = data.byte(kRyanx);
+ int ryany = data.byte(kRyany);
+
+ // Automatically opening doors: check if Ryan is in range
+
+ check.translate(sprite->x, sprite->y);
+ bool openDoor = check.contains(ryanx, ryany);
+
+ if (openDoor) {
+
+ if ((data.byte(kThroughdoor) == 1) && (sprite->animFrame == 0))
+ sprite->animFrame = 6;
+
+ ++sprite->animFrame;
+ if (sprite->animFrame == 1) { // doorsound2
+ uint8 soundIndex;
+ if (data.byte(kReallocation) == 5) // hoteldoor2
+ soundIndex = 13;
+ else
+ soundIndex = 0;
+ playChannel1(soundIndex);
+ }
+ if (objData->frames[sprite->animFrame] == 255)
+ --sprite->animFrame;
+
+ sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
+ data.byte(kThroughdoor) = 1;
-void DreamGenContext::dodoor(Sprite *sprite, SetObject *objData) {
- uint8 ryanx = data.byte(kRyanx);
- uint8 ryany = data.byte(kRyany);
- if (ryanx < sprite->x) {
- if (ryanx < sprite->x + (int8)data.byte(kDoorcheck1))
- goto shutdoor;
- } else {
- if (ryanx >= sprite->x + data.byte(kDoorcheck2))
- goto shutdoor;
- }
- if (ryany < sprite->y) {
- if (ryany < sprite->y + (int8)data.byte(kDoorcheck3))
- goto shutdoor;
} else {
- if (ryany >= sprite->y + data.byte(kDoorcheck4))
- goto shutdoor;
- }
-//opendoor:
- if ((data.byte(kThroughdoor) == 1) && (sprite->frame == 0))
- sprite->frame = 6;
-
- ++sprite->frame;
- if (sprite->frame == 1) { //doorsound2
- if (data.byte(kReallocation) == 5) //hoteldoor2
- al = 13;
- else
- al = 0;
- playchannel1();
- }
- if (objData->b18[sprite->frame] == 255) {
- --sprite->frame;
- }
- sprite->b15 = objData->index = objData->b18[sprite->frame];
- data.byte(kThroughdoor) = 1;
- return;
-shutdoor:
- if (sprite->frame == 5) { //doorsound1;
- if (data.byte(kReallocation) == 5) //hoteldoor1
- al = 13;
- else
- al = 1;
- playchannel1();
- }
- if (sprite->frame != 0) {
- --sprite->frame;
+ // shut door
+
+ if (sprite->animFrame == 5) { // doorsound1;
+ uint8 soundIndex;
+ if (data.byte(kReallocation) == 5) // hoteldoor1
+ soundIndex = 13;
+ else
+ soundIndex = 1;
+ playChannel1(soundIndex);
+ }
+ if (sprite->animFrame != 0)
+ --sprite->animFrame;
+
+ sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
+ if (sprite->animFrame == 5) // nearly
+ data.byte(kThroughdoor) = 0;
}
- 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->index = b18;
- sprite->b15 = b18;
+ uint8 frame = objData->frames[0];
+ objData->index = frame;
+ sprite->frameNumber = frame;
}
-void DreamGenContext::lockeddoorway(Sprite *sprite, SetObject *objData) {
- if (data.byte(kRyanx) < sprite->x) {
- if (sprite->x - data.byte(kRyanx) > 24)
- goto shutdoor2;
- } else {
- if (data.byte(kRyanx) - sprite->x >= 10)
- goto shutdoor2;
- }
+void DreamGenContext::lockedDoorway(Sprite *sprite, SetObject *objData) {
+ int ryanx = data.byte(kRyanx);
+ int ryany = data.byte(kRyany);
- if (data.byte(kRyany) < sprite->y) {
- if (sprite->y - data.byte(kRyany) > 30)
- goto shutdoor2;
- } else {
- if (data.byte(kRyany) - sprite->y >= 12)
- goto shutdoor2;
- }
+ Common::Rect check(-24, -30, 10, 12);
+ check.translate(sprite->x, sprite->y);
+ bool openDoor = check.contains(ryanx, ryany);
- if (data.byte(kThroughdoor) != 1) {
- if (data.byte(kLockstatus) == 1)
- goto shutdoor2;
- }
+ if (data.byte(kThroughdoor) != 1 && data.byte(kLockstatus) == 1)
+ openDoor = false;
- if (sprite->frame == 1) {
- al = 0;
- playchannel1();
- }
+ if (openDoor) {
- if (sprite->frame == 6) {
- turnpathon(data.byte(kDoorpath));
- }
+ if (sprite->animFrame == 1) {
+ playChannel1(0);
+ }
- if ((data.byte(kThroughdoor) == 1) && (sprite->frame == 0)) {
- sprite->frame = 6;
- }
+ if (sprite->animFrame == 6)
+ turnPathOn(data.byte(kDoorpath));
- ++sprite->frame;
- if (objData->b18[sprite->frame] == 255) {
- --sprite->frame;
- }
+ if (data.byte(kThroughdoor) == 1 && sprite->animFrame == 0)
+ sprite->animFrame = 6;
- sprite->b15 = objData->index = objData->b18[sprite->frame];
- if (sprite->frame == 5)
- data.byte(kThroughdoor) = 1;
- return;
+ ++sprite->animFrame;
+ if (objData->frames[sprite->animFrame] == 255)
+ --sprite->animFrame;
-shutdoor2:
- if (sprite->frame == 5) {
- al = 1;
- playchannel1();
- }
+ sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
+ if (sprite->animFrame == 5)
+ data.byte(kThroughdoor) = 1;
- if (sprite->frame != 0) {
- --sprite->frame;
- }
+ } else {
+ // shut door
- data.byte(kThroughdoor) = 0;
- sprite->b15 = objData->index = objData->b18[sprite->frame];
+ if (sprite->animFrame == 5) {
+ playChannel1(1);
+ }
- if (sprite->frame == 0) {
- turnpathoff(data.byte(kDoorpath));
- data.byte(kLockstatus) = 1;
+ if (sprite->animFrame != 0)
+ --sprite->animFrame;
+
+ data.byte(kThroughdoor) = 0;
+ sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
+
+ if (sprite->animFrame == 0) {
+ turnPathOff(data.byte(kDoorpath));
+ data.byte(kLockstatus) = 1;
+ }
}
}
-void DreamGenContext::liftsprite(Sprite *sprite, SetObject *objData) {
+void DreamGenContext::liftSprite(Sprite *sprite, SetObject *objData) {
uint8 liftFlag = data.byte(kLiftflag);
if (liftFlag == 0) { //liftclosed
- turnpathoff(data.byte(kLiftpath));
+ turnPathOff(data.byte(kLiftpath));
if (data.byte(kCounttoopen) != 0) {
_dec(data.byte(kCounttoopen));
if (data.byte(kCounttoopen) == 0)
data.byte(kLiftflag) = 3;
}
- sprite->frame = 0;
- sprite->b15 = objData->index = objData->b18[sprite->frame];
+ sprite->animFrame = 0;
+ sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
}
else if (liftFlag == 1) { //liftopen
- turnpathon(data.byte(kLiftpath));
+ turnPathOn(data.byte(kLiftpath));
if (data.byte(kCounttoclose) != 0) {
_dec(data.byte(kCounttoclose));
if (data.byte(kCounttoclose) == 0)
data.byte(kLiftflag) = 2;
}
- sprite->frame = 12;
- sprite->b15 = objData->index = objData->b18[sprite->frame];
+ sprite->animFrame = 12;
+ sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
}
else if (liftFlag == 3) { //openlift
- if (sprite->frame == 12) {
+ if (sprite->animFrame == 12) {
data.byte(kLiftflag) = 1;
return;
}
- ++sprite->frame;
- if (sprite->frame == 1) {
- al = 2;
- liftnoise();
+ ++sprite->animFrame;
+ if (sprite->animFrame == 1) {
+ liftNoise(2);
}
- sprite->b15 = objData->index = objData->b18[sprite->frame];
+ sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
} else { //closeLift
assert(liftFlag == 2);
- if (sprite->frame == 0) {
+ if (sprite->animFrame == 0) {
data.byte(kLiftflag) = 0;
return;
}
- --sprite->frame;
- if (sprite->frame == 11) {
- al = 3;
- liftnoise();
+ --sprite->animFrame;
+ if (sprite->animFrame == 11) {
+ liftNoise(3);
}
- sprite->b15 = objData->index = objData->b18[sprite->frame];
+ sprite->frameNumber = objData->index = objData->frames[sprite->animFrame];
}
}
-void DreamGenContext::facerightway() {
- PathNode *paths = getroomspaths()->nodes;
- uint8 dir = paths[data.byte(kManspath)].dir;
- data.byte(kTurntoface) = dir;
- data.byte(kLeavedirection) = dir;
+Reel *DreamBase::getReelStart(uint16 reelPointer) {
+ Reel *reel = (Reel *)getSegment(data.word(kReels)).ptr(kReellist + reelPointer * sizeof(Reel) * 8, sizeof(Reel));
+ return reel;
}
-void DreamGenContext::findsource() {
- uint16 currentFrame = data.word(kCurrentframe);
- if (currentFrame < 160) {
- ds = data.word(kReel1);
- data.word(kTakeoff) = 0;
- } else if (currentFrame < 320) {
- ds = data.word(kReel2);
- data.word(kTakeoff) = 160;
+// Locate the reel segment (reel1, reel2, reel3) this frame is stored in,
+// and adjust the frame number relative to this segment.
+const Frame *DreamBase::findSource(uint16 &frame) {
+ uint16 base;
+ if (frame < 160) {
+ base = data.word(kReel1);
+ } else if (frame < 320) {
+ frame -= 160;
+ base = data.word(kReel2);
} else {
- ds = data.word(kReel3);
- data.word(kTakeoff) = 320;
+ frame -= 320;
+ base = data.word(kReel3);
}
+ return (const Frame *)getSegment(base).ptr(0, (frame+1)*sizeof(Frame));
}
-Frame *DreamGenContext::findsourceCPP() {
- push(ds);
- findsource();
- Frame *result = (Frame *)ds.ptr(0, 0);
- ds = pop();
- return result;
-}
-
-Reel *DreamGenContext::getreelstart() {
- Reel *reel = (Reel *)segRef(data.word(kReels)).ptr(kReellist + data.word(kReelpointer) * sizeof(Reel) * 8, sizeof(Reel));
- return reel;
-}
-
-void DreamGenContext::showreelframe() {
- Reel *reel = (Reel *)es.ptr(si, sizeof(Reel));
- showreelframe(reel);
-}
-
-void DreamGenContext::showreelframe(Reel *reel) {
+void DreamBase::showReelFrame(Reel *reel) {
uint16 x = reel->x + data.word(kMapadx);
uint16 y = reel->y + data.word(kMapady);
- data.word(kCurrentframe) = reel->frame();
- Frame *source = findsourceCPP();
- uint16 frame = data.word(kCurrentframe) - data.word(kTakeoff);
- showframe(source, x, y, frame, 8);
+ uint16 frame = reel->frame();
+ const Frame *base = findSource(frame);
+ showFrame(base, x, y, frame, 8);
}
-void DreamGenContext::showgamereel() {
- showgamereel((ReelRoutine *)es.ptr(bx, sizeof(ReelRoutine)));
+void DreamGenContext::showGameReel() {
+ showGameReel((ReelRoutine *)es.ptr(bx, sizeof(ReelRoutine)));
}
-void DreamGenContext::showgamereel(ReelRoutine *routine) {
- uint16 reelpointer = routine->reelPointer();
- if (reelpointer >= 512)
+void DreamGenContext::showGameReel(ReelRoutine *routine) {
+ uint16 reelPointer = routine->reelPointer();
+ if (reelPointer >= 512)
return;
- data.word(kReelpointer) = reelpointer;
- plotreel();
- routine->setReelPointer(data.word(kReelpointer));
+ plotReel(reelPointer);
+ routine->setReelPointer(reelPointer);
}
-const Frame *DreamGenContext::getreelframeax(uint16 frame) {
- data.word(kCurrentframe) = frame;
- Frame *source = findsourceCPP();
- uint16 offset = data.word(kCurrentframe) - data.word(kTakeoff);
- return source + offset;
+const Frame *DreamBase::getReelFrameAX(uint16 frame) {
+ const Frame *base = findSource(frame);
+ return base + frame;
}
-void DreamGenContext::showrain() {
- ds = data.word(kMainsprites);
- si = 6*58;
- ax = ds.word(si+2);
- si = ax + 2080;
- Rain *rain = (Rain *)segRef(data.word(kBuffers)).ptr(kRainlist, 0);
+void DreamGenContext::showRain() {
+ Rain *rain = (Rain *)getSegment(data.word(kBuffers)).ptr(kRainlist, 0);
+
+ // Do nothing if there's no rain at all
if (rain->x == 255)
return;
- while (true) {
- if (rain->x == 255) {
- if (data.word(kCh1blockstocopy) != 0)
- return;
- if ((data.byte(kReallocation) == 2) && (data.byte(kBeenmugged) != 1))
- return;
- if (data.byte(kReallocation) == 55)
- return;
- randomnum1();
- if (al >= 1)
- return;
- if (data.byte(kCh0playing) != 6)
- al = 4;
- else
- al = 7;
- playchannel1();
- return;
- }
+
+ ds = data.word(kMainsprites);
+ si = 6*58; // Frame 58
+ ax = ds.word(si+2); // Frame::ptr
+ si = ax + 2080;
+
+ for (; rain->x != 255; ++rain) {
uint16 y = rain->y + data.word(kMapady) + data.word(kMapystart);
uint16 x = rain->x + data.word(kMapadx) + data.word(kMapxstart);
uint16 size = rain->size;
ax = ((uint16)(rain->w3() - rain->b5)) & 511;
rain->setW3(ax);
- ++rain;
const uint8 *src = ds.ptr(si, 0) + ax;
uint8 *dst = workspace() + y * 320 + x;
- for(uint16 i = 0; i < size; ++i) {
+ for (uint16 i = 0; i < size; ++i) {
uint8 v = src[i];
if (v != 0)
*dst = v;
- dst += 320-1;
+ dst += 320-1; // advance diagonally
}
}
-}
-void DreamGenContext::updatepeople() {
- data.word(kListpos) = kPeoplelist;
- memset(segRef(data.word(kBuffers)).ptr(kPeoplelist, 12 * sizeof(People)), 0xff, 12 * sizeof(People));
- ++data.word(kMaintimer);
- es = cs;
- bx = kReelroutines;
- const ReelRoutine *reelRoutine = (const ReelRoutine *)cs.ptr(bx, 0);
- const uint16 *callbacks = (const uint16 *)cs.ptr(kReelcalls, 0);
- while (true) {
- uint8 realLocation = reelRoutine->reallocation;
- if (realLocation == 255)
- return;
- if ((realLocation == data.byte(kReallocation)) &&
- (reelRoutine->mapX == data.byte(kMapx)) &&
- (reelRoutine->mapY == data.byte(kMapy))) {
- uint16 callback = READ_LE_UINT16(callbacks);
- //dw gamer,sparkydrip,eden,edeninbath,sparky,smokebloke
- if (callback == addr_gamer)
- gamer();
- else if (callback == addr_sparkydrip)
- sparkydrip();
- else if (callback == addr_eden)
- eden();
- else if (callback == addr_edeninbath)
- edeninbath();
- else if (callback == addr_sparky)
- sparky();
- else if (callback == addr_smokebloke)
- smokebloke();
- //dw manasleep,drunk,receptionist,malefan,femalefan
- else if (callback == addr_manasleep)
- manasleep();
- else if (callback == addr_drunk)
- drunk();
- else if (callback == addr_receptionist)
- receptionist();
- else if (callback == addr_malefan)
- malefan();
- else if (callback == addr_femalefan)
- femalefan();
- //dw louis,louischair,soldier1,bossman,interviewer
- else if (callback == addr_louis)
- louis();
- else if (callback == addr_louischair)
- louischair();
- else if (callback == addr_soldier1)
- soldier1();
- else if (callback == addr_bossman)
- bossman();
- else if (callback == addr_interviewer)
- interviewer();
- //dw heavy,manasleep2,mansatstill,drinker,bartender
- else if (callback == addr_heavy)
- heavy();
- else if (callback == addr_manasleep2)
- manasleep2();
- else if (callback == addr_mansatstill)
- mansatstill();
- else if (callback == addr_drinker)
- drinker();
- else if (callback == addr_bartender)
- bartender();
- //dw othersmoker,tattooman,attendant,keeper,candles1
- else if (callback == addr_othersmoker)
- othersmoker();
- else if (callback == addr_tattooman)
- tattooman();
- else if (callback == addr_attendant)
- attendant();
- else if (callback == addr_keeper)
- keeper();
- else if (callback == addr_candles1)
- candles1();
- //dw smallcandle,security,copper,poolguard,rockstar
- else if (callback == addr_smallcandle)
- smallcandle();
- else if (callback == addr_security)
- security();
- else if (callback == addr_copper)
- copper();
- else if (callback == addr_poolguard)
- poolguard();
- else if (callback == addr_rockstar)
- rockstar();
- //dw businessman,train,aide,mugger,helicopter
- else if (callback == addr_businessman)
- businessman();
- else if (callback == addr_train)
- train();
- else if (callback == addr_aide)
- aide();
- else if (callback == addr_mugger)
- mugger();
- else if (callback == addr_helicopter)
- helicopter();
- //dw intromagic1,intromusic,intromagic2,candles2,gates
- else if (callback == addr_intromagic1)
- intromagic1();
- else if (callback == addr_intromusic)
- intromusic();
- else if (callback == addr_intromagic2)
- intromagic2();
- else if (callback == addr_candles2)
- candles2();
- else if (callback == addr_gates)
- gates();
- //dw intromagic3,intromonks1,candles,intromonks2
- else if (callback == addr_intromagic3)
- intromagic3();
- else if (callback == addr_intromonks1)
- intromonks1();
- else if (callback == addr_candles)
- candles();
- else if (callback == addr_intromonks2)
- intromonks2();
- //dw handclap,monkandryan,endgameseq,priest,madman
- else if (callback == addr_handclap)
- handclap();
- else if (callback == addr_monkandryan)
- monkandryan();
- else if (callback == addr_endgameseq)
- endgameseq();
- else if (callback == addr_priest)
- priest();
- else if (callback == addr_madman)
- madman();
- //dw madmanstelly,alleybarksound,foghornsound
- else if (callback == addr_madmanstelly)
- madmanstelly();
- else if (callback == addr_alleybarksound)
- alleybarksound();
- else if (callback == addr_foghornsound)
- foghornsound();
- //dw carparkdrip,carparkdrip,carparkdrip,carparkdrip
- else if (callback == addr_carparkdrip)
- carparkdrip();
- else
- assert(false); // Oops I forgot something in the dispatch table
- }
- bx += 8;
- ++reelRoutine;
- ++callbacks;
- }
-}
-
-void DreamGenContext::madmantext() {
- if (isCD()) {
- if (data.byte(kSpeechcount) >= 63)
- return;
- if (data.byte(kCh1playing) != 255)
- return;
- al = data.byte(kSpeechcount);
- ++data.byte(kSpeechcount);
- } else {
- if (data.byte(kCombatcount) >= 61)
- return;
- al = data.byte(kCombatcount);
- _and(al, 3);
- if (!flags.z())
- return;
- al = data.byte(kCombatcount) / 4;
- }
- setuptimedtemp(47 + al, 82, 72, 80, 90, 1);
-}
-
-void DreamGenContext::madman() {
- data.word(kWatchingtime) = 2;
- checkspeed();
- if (flags.z()) {
- ax = es.word(bx+3);
- if (ax >= 364) {
- data.byte(kMandead) = 2;
- showgamereel();
- return;
- }
- if (ax == 10) {
- push(es);
- push(bx);
- push(ax);
- dx = kIntrotextname;
- loadtemptext();
- ax = pop();
- bx = pop();
- es = pop();
- data.byte(kCombatcount) = -1;
- data.byte(kSpeechcount) = 0;
- }
- ++ax;
- if (ax == 294) {
- if (data.byte(kWongame) == 1)
- return;
- data.byte(kWongame) = 1;
- push(es);
- push(bx);
- getridoftemptext();
- bx = pop();
- es = pop();
- return;
- }
- if (ax == 66) {
- ++data.byte(kCombatcount);
- push(es);
- push(bx);
- madmantext();
- bx = pop();
- es = pop();
- ax = 53;
- if (data.byte(kCombatcount) >= (isCD() ? 64 : 62)) {
- if (data.byte(kCombatcount) == (isCD() ? 70 : 68))
- ax = 310;
- else {
- if (data.byte(kLastweapon) == 8) {
- data.byte(kCombatcount) = isCD() ? 72 : 70;
- data.byte(kLastweapon) = -1;
- data.byte(kMadmanflag) = 1;
- ax = 67;
- }
- }
- }
- }
- es.word(bx+3) = ax;
- }
- showgamereel();
- es.byte(bx+1) = data.byte(kMapx);
- madmode();
-}
-
-void DreamGenContext::madmode() {
- data.word(kWatchingtime) = 2;
- data.byte(kPointermode) = 0;
- if (data.byte(kCombatcount) < (isCD() ? 65 : 63))
+ if (data.word(kCh1blockstocopy) != 0)
+ return;
+ if (data.byte(kReallocation) == 2 && data.byte(kBeenmugged) != 1)
return;
- if (data.byte(kCombatcount) >= (isCD() ? 70 : 68))
+ if (data.byte(kReallocation) == 55)
return;
- data.byte(kPointermode) = 2;
+
+ if (engine->randomNumber() >= 1) // play thunder with 1 in 256 chance
+ return;
+
+ uint8 soundIndex;
+ if (data.byte(kCh0playing) != 6)
+ soundIndex = 4;
+ else
+ soundIndex = 7;
+ playChannel1(soundIndex);
}
-void DreamGenContext::movemap(uint8 param) {
+void DreamGenContext::moveMap(uint8 param) {
switch (param) {
case 32:
data.byte(kMapy) -= 20;
@@ -856,9 +570,9 @@ void DreamGenContext::movemap(uint8 param) {
data.byte(kNowinnewroom) = 1;
}
-void DreamGenContext::checkone() {
+void DreamGenContext::checkOne() {
uint8 flag, flagEx, type, flagX, flagY;
- checkone(cl, ch, &flag, &flagEx, &type, &flagX, &flagY);
+ checkOne(cl, ch, &flag, &flagEx, &type, &flagX, &flagY);
cl = flag;
ch = flagEx;
@@ -867,41 +581,658 @@ void DreamGenContext::checkone() {
al = type;
}
-void DreamGenContext::checkone(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY) {
+void DreamGenContext::checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY) {
*flagX = x / 16;
*flagY = y / 16;
- const uint8 *tileData = segRef(data.word(kBuffers)).ptr(kMapflags + (*flagY * 11 + *flagX) * 3, 3);
+ const uint8 *tileData = getSegment(data.word(kBuffers)).ptr(kMapflags + (*flagY * 11 + *flagX) * 3, 3);
*flag = tileData[0];
*flagEx = tileData[1];
*type = tileData[2];
}
-void DreamGenContext::getblockofpixel() {
- al = getblockofpixel(cl, ch);
+void DreamGenContext::getBlockOfPixel() {
+ al = getBlockOfPixel(cl, ch);
}
-uint8 DreamGenContext::getblockofpixel(uint8 x, uint8 y) {
+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);
+ 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)));
+Rain *DreamGenContext::splitIntoLines(uint8 x, uint8 y, Rain *rain) {
+ do {
+ // Look for line start
+ while (!getBlockOfPixel(x, y)) {
+ --x;
+ ++y;
+ if (x == 0 || y >= data.byte(kMapysize))
+ return rain;
+ }
+
+ rain->x = x;
+ rain->y = y;
+
+ uint8 length = 1;
+
+ // Look for line end
+ while (getBlockOfPixel(x, y)) {
+ --x;
+ ++y;
+ if (x == 0 || y >= data.byte(kMapysize))
+ break;
+ ++length;
+ }
+
+ rain->size = length;
+ rain->w3_lo = engine->randomNumber();
+ rain->w3_hi = engine->randomNumber();
+ rain->b5 = (engine->randomNumber() & 3) + 4;
+ ++rain;
+ } while (x > 0 && y < data.byte(kMapysize));
+
+ return rain;
+}
+
+struct RainLocation {
+ uint8 location;
+ uint8 x, y;
+ uint8 rainSpacing;
+};
+
+static const RainLocation rainLocationList[] = {
+ { 1,44,10,16 },
+ { 4,11,30,14 },
+ { 4,22,30,14 },
+ { 3,33,10,14 },
+ { 10,33,30,14 },
+ { 10,22,30,24 },
+ { 9,22,10,14 },
+ { 2,33,0,14 },
+ { 2,22,0,14 },
+ { 6,11,30,14 },
+ { 7,11,20,18 },
+ { 7,0,20,18 },
+ { 7,0,30,18 },
+ { 55,44,0,14 },
+ { 5,22,30,14 },
+
+ { 8,0,10,18 },
+ { 8,11,10,18 },
+ { 8,22,10,18 },
+ { 8,33,10,18 },
+ { 8,33,20,18 },
+ { 8,33,30,18 },
+ { 8,33,40,18 },
+ { 8,22,40,18 },
+ { 8,11,40,18 },
+
+ { 21,44,20,18 },
+ { 255,0,0,0 }
+};
+
+void DreamGenContext::initRain() {
+ const RainLocation *r = rainLocationList;
+ Rain *rainList = (Rain *)getSegment(data.word(kBuffers)).ptr(kRainlist, 0);
+ Rain *rain = rainList;
+
+ uint8 rainSpacing = 0;
+
+ // look up location in rainLocationList to determine rainSpacing
+ for (r = rainLocationList; r->location != 0xff; ++r) {
+ if (r->location == data.byte(kReallocation) &&
+ r->x == data.byte(kMapx) && r->y == data.byte(kMapy)) {
+ rainSpacing = r->rainSpacing;
+ break;
+ }
+ }
+
+ if (rainSpacing == 0) {
+ // location not found in rainLocationList: no rain
+ rain->x = 0xff;
+ return;
+ }
+
+ // start lines of rain from top of screen
+ uint8 x = 4;
+ do {
+ uint8 delta;
+ do {
+ delta = (engine->randomNumber() & 31) + 3;
+ } while (delta >= rainSpacing);
+
+ x += delta;
+ if (x >= data.byte(kMapxsize))
+ break;
+
+ rain = splitIntoLines(x, 0, rain);
+ } while (true);
+
+ // start lines of rain from side of screen
+ uint8 y = 0;
+ do {
+ uint8 delta;
+ do {
+ delta = (engine->randomNumber() & 31) + 3;
+ } while (delta >= rainSpacing);
+
+ y += delta;
+ if (y >= data.byte(kMapysize))
+ break;
+
+ rain = splitIntoLines(data.byte(kMapxsize) - 1, y, rain);
+ } while (true);
+
+ rain->x = 0xff;
+}
+
+void DreamGenContext::intro1Text() {
+ if (data.byte(kIntrocount) != 2 && data.byte(kIntrocount) != 4 && data.byte(kIntrocount) != 6)
+ return;
+
+ if (isCD() && data.byte(kCh1playing) != 255) {
+ data.byte(kIntrocount)--;
+ } else {
+ if (data.byte(kIntrocount) == 2)
+ setupTimedTemp(40, 82, 34, 130, 90, 1);
+ else if (data.byte(kIntrocount) == 4)
+ setupTimedTemp(41, 82, 34, 130, 90, 1);
+ else if (data.byte(kIntrocount) == 6)
+ setupTimedTemp(42, 82, 34, 130, 90, 1);
+ }
+}
+
+void DreamGenContext::intro2Text() {
+ if (ax == 5)
+ setupTimedTemp(43, 82, 34, 40, 90, 1);
+ else if (ax == 15)
+ setupTimedTemp(44, 82, 34, 40, 90, 1);
+}
+
+void DreamGenContext::intro3Text() {
+ if (ax == 107)
+ setupTimedTemp(45, 82, 36, 56, 100, 1);
+ else if (ax == (isCD() ? 108 : 109))
+ setupTimedTemp(46, 82, 36, 56, 100, 1);
+}
+
+void DreamBase::rollEndCredits() {
+ playChannel0(16, 255);
+ data.byte(kVolume) = 7;
+ data.byte(kVolumeto) = 0;
+ data.byte(kVolumedirection) = 0xFF;
+
+ multiGet(mapStore(), 75, 20, 160, 160);
+
+ const uint8 *string = getTextInFile1(3);
+ const int linespacing = data.word(kLinespacing);
+
+ for (int i = 0; i < 254; ++i) {
+ // Output the text, initially with an offset of 10 pixels,
+ // then move it up one pixel until we shifted it by a complete
+ // line of text.
+ for (int j = 0; j < linespacing; ++j) {
+ vSync();
+ multiPut(mapStore(), 75, 20, 160, 160);
+ vSync();
+
+ // Output up to 18 lines of text
+ uint16 y = 10 - j;
+ const uint8 *tmp_str = string;
+ for (int k = 0; k < 18; ++k) {
+ DreamBase::printDirect(&tmp_str, 75, &y, 160 + 1, true);
+ y += linespacing;
+ }
+
+ vSync();
+ multiDump(75, 20, 160, 160);
+ }
+
+ // Skip to the next text line
+ byte c;
+ do {
+ c = *string++;
+ } while (c != ':' && c != 0);
+ }
+ hangOn(100);
+ panelToMap();
+ fadeScreenUpHalf();
+}
+
+
+void DreamGenContext::monks2text() {
+ bool isGermanCD = isCD() && engine->getLanguage() == Common::DE_DEU;
+
+ if (data.byte(kIntrocount) == 1)
+ setupTimedTemp(8, 82, 36, 160, 120, 1);
+ else if (data.byte(kIntrocount) == (isGermanCD ? 5 : 4))
+ setupTimedTemp(9, 82, 36, 160, 120, 1);
+ else if (data.byte(kIntrocount) == (isGermanCD ? 9 : 7))
+ setupTimedTemp(10, 82, 36, 160, 120, 1);
+ else if (data.byte(kIntrocount) == 10 && !isGermanCD) {
+ if (isCD())
+ data.byte(kIntrocount) = 12;
+ setupTimedTemp(11, 82, 0, 105, 120, 1);
+ } else if (data.byte(kIntrocount) == 13 && isGermanCD) {
+ data.byte(kIntrocount) = 14;
+ setupTimedTemp(11, 82, 0, 105, 120, 1);
+ } else if (data.byte(kIntrocount) == 13 && !isGermanCD) {
+ if (isCD())
+ data.byte(kIntrocount) = 17;
+ else
+ setupTimedTemp(12, 82, 0, 120, 120, 1);
+ } else if (data.byte(kIntrocount) == 16 && !isGermanCD)
+ setupTimedTemp(13, 82, 0, 135, 120, 1);
+ else if (data.byte(kIntrocount) == 19)
+ setupTimedTemp(14, 82, 36, 160, 100, 1);
+ else if (data.byte(kIntrocount) == (isGermanCD ? 23 : 22))
+ setupTimedTemp(15, 82, 36, 160, 120, 1);
+ else if (data.byte(kIntrocount) == (isGermanCD ? 27 : 25))
+ setupTimedTemp(16, 82, 36, 160, 120, 1);
+ else if (data.byte(kIntrocount) == (isCD() ? 27 : 28) && !isGermanCD)
+ setupTimedTemp(17, 82, 36, 160, 120, 1);
+ else if (data.byte(kIntrocount) == 30 && isGermanCD)
+ setupTimedTemp(17, 82, 36, 160, 120, 1);
+ else if (data.byte(kIntrocount) == (isGermanCD ? 35 : 31))
+ setupTimedTemp(18, 82, 36, 160, 120, 1);
+}
+
+void DreamGenContext::textForEnd() {
+ if (data.byte(kIntrocount) == 20)
+ setupTimedTemp(0, 83, 34, 20, 60, 1);
+ else if (data.byte(kIntrocount) == (isCD() ? 50 : 65))
+ setupTimedTemp(1, 83, 34, 20, 60, 1);
+ else if (data.byte(kIntrocount) == (isCD() ? 85 : 110))
+ setupTimedTemp(2, 83, 34, 20, 60, 1);
}
-void DreamGenContext::addtopeoplelist(ReelRoutine *routine) {
- uint16 routinePointer = (const uint8 *)routine - cs.ptr(0, 0);
+void DreamGenContext::textForMonkHelper(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount) {
+ if (isCD() && data.byte(kCh1playing) != 255)
+ data.byte(kIntrocount)--;
+ else
+ setupTimedTemp(textIndex, voiceIndex, x, y, countToTimed, timeCount);
+}
- 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);
+void DreamGenContext::textForMonk() {
+ if (data.byte(kIntrocount) == 1)
+ textForMonkHelper(19, 82, 68, 154, 120, 1);
+ else if (data.byte(kIntrocount) == 5)
+ textForMonkHelper(20, 82, 68, 38, 120, 1);
+ else if (data.byte(kIntrocount) == 9)
+ textForMonkHelper(21, 82, 48, 154, 120, 1);
+ else if (data.byte(kIntrocount) == 13)
+ textForMonkHelper(22, 82, 68, 38, 120, 1);
+ else if (data.byte(kIntrocount) == (isCD() ? 15 : 17))
+ textForMonkHelper(23, 82, 68, 154, 120, 1);
+ else if (data.byte(kIntrocount) == 21)
+ textForMonkHelper(24, 82, 68, 38, 120, 1);
+ else if (data.byte(kIntrocount) == 25)
+ textForMonkHelper(25, 82, 68, 154, 120, 1);
+ else if (data.byte(kIntrocount) == 29)
+ textForMonkHelper(26, 82, 68, 38, 120, 1);
+ else if (data.byte(kIntrocount) == 33)
+ textForMonkHelper(27, 82, 68, 154, 120, 1);
+ else if (data.byte(kIntrocount) == 37)
+ textForMonkHelper(28, 82, 68, 154, 120, 1);
+ else if (data.byte(kIntrocount) == 41)
+ textForMonkHelper(29, 82, 68, 38, 120, 1);
+ else if (data.byte(kIntrocount) == 45)
+ textForMonkHelper(30, 82, 68, 154, 120, 1);
+ else if (data.byte(kIntrocount) == (isCD() ? 52 : 49))
+ textForMonkHelper(31, 82, 68, 154, 220, 1);
+ else if (data.byte(kIntrocount) == 53) {
+ fadeScreenDowns();
+ if (isCD()) {
+ data.byte(kVolumeto) = 7;
+ data.byte(kVolumedirection) = 1;
+ }
+ }
}
-} /*namespace dreamgen */
+void DreamGenContext::reelsOnScreen() {
+ reconstruct();
+ updatePeople();
+ watchReel();
+ showRain();
+ useTimedText();
+}
+
+void DreamGenContext::reconstruct() {
+ if (data.byte(kHavedoneobs) == 0)
+ return;
+ data.byte(kNewobs) = 1;
+ drawFloor();
+ spriteUpdate();
+ printSprites();
+ if ((data.byte(kForeignrelease) != 0) && (data.byte(kReallocation) == 20))
+ underTextLine();
+ data.byte(kHavedoneobs) = 0;
+}
+
+
+
+struct ReelSound {
+ uint8 _sample;
+ uint16 _reelPointer;
+};
+
+static const ReelSound g_roomSound0[] = {
+ { 255,0 }
+};
+
+static const ReelSound g_roomSound1[] = {
+ { 15, 257 },
+ { 255,0 }
+};
+
+static const ReelSound g_roomSound2[] = {
+ { 12, 5 },
+ { 13, 21 },
+ { 15, 35 }, // hitting floor?
+ { 17, 50 },
+ { 18, 103 },
+ { 19, 108 },
+ { 255,0 }
+};
+
+static const ReelSound g_roomSound6[] = {
+ { 18, 19 },
+ { 19, 23 },
+ { 255,0 }
+};
+static const ReelSound g_roomSound8[] = {
+
+ { 12, 51 },
+ { 13, 53 },
+ { 14, 14 },
+ { 15, 20 },
+ { 0, 78 },
+ { 255,0 }
+};
+static const ReelSound g_roomSound9[] = {
+
+ { 12, 119 },
+ { 12, 145 },
+ { 255,0 }
+};
+
+static const ReelSound g_roomSound10[] = {
+ { 13, 16 },
+ { 255,0 }
+};
+
+static const ReelSound g_roomSound11[] = {
+ { 13, 20 },
+ { 255,0 }
+};
+
+static const ReelSound g_roomSound12[] = {
+ { 14, 16 },
+ { 255,0 }
+};
+
+static const ReelSound g_roomSound13[] = {
+ { 15, 4 },
+ { 16, 8 },
+ { 17, 134 },
+ { 18, 153 },
+ { 255,0 }
+};
+
+static const ReelSound g_roomSound14[] = {
+ { 13, 108 },
+ { 15, 326 },
+ { 15, 331 },
+ { 15, 336 },
+ { 15, 342 },
+ { 15, 348 },
+ { 15, 354 },
+ { 18, 159 },
+ { 18, 178 },
+ { 19+128, 217 },
+ { 20+64, 228 },
+ { 255,0 }
+};
+
+static const ReelSound g_roomSound20[] = {
+ { 13, 20 },
+ { 13, 21 },
+ { 15, 34 },
+ { 13, 52 },
+ { 13, 55 },
+ { 25, 57 },
+ { 21, 73 },
+ { 255,0 }
+};
+
+static const ReelSound g_roomSound22[] = {
+ { 13, 196 },
+ { 13, 234 },
+ { 13, 156 },
+ { 14, 129 },
+ { 13, 124 },
+ { 15, 162 },
+ { 15, 200 },
+ { 15, 239 },
+ { 17, 99 },
+ { 12, 52 },
+ { 255,0 }
+};
+
+static const ReelSound g_roomSound23[] = {
+ { 15, 56 },
+ { 16, 64 },
+ { 19, 22 },
+ { 20, 33 },
+ { 255,0 }
+};
+
+static const ReelSound g_roomSound25[] = {
+ { 20, 11 },
+ { 20, 15 },
+ { 15, 28 },
+ { 13, 80 },
+ { 21, 82 },
+ { 19+128, 87 },
+ { 23+64, 128 },
+ { 255,0 }
+};
+
+static const ReelSound g_roomSound26[] = {
+ { 12, 13 },
+ { 14, 39 },
+ { 12, 67 },
+ { 12, 75 },
+ { 12, 83 },
+ { 12, 91 },
+ { 15, 102 }, // was 90, should be mine cart
+ { 255,0 }
+};
+
+static const ReelSound g_roomSound27[] = {
+ { 22, 36 },
+ { 13, 125 },
+ { 18, 88 },
+ { 15, 107 },
+ { 14, 127 },
+ { 14, 154 },
+ { 19+128, 170 },
+ { 23+64, 232 },
+ { 255,0 }
+};
+
+static const ReelSound g_roomSound28[] = {
+ { 21, 16 },
+ { 21, 72 },
+ { 21, 205 },
+ { 22, 63 }, // 65
+ { 23+128, 99 },
+ { 24+64, 158 },
+ { 255,0 }
+};
+
+static const ReelSound g_roomSound29[] = {
+ { 13, 21 },
+ { 14, 24 },
+ { 19+128, 50 },
+ { 23+64, 75 },
+ { 24, 128 },
+ { 255,0 }
+};
+
+static const ReelSound g_roomSound29_German[] = {
+ { 13, 21 },
+ { 14, 24 },
+ { 19+128, 50 },
+ { 23+64, 75 },
+ { 255,0 }
+};
+
+
+static const ReelSound g_roomSound45[] = {
+ { 19+64, 46 },
+ { 16, 167 },
+ { 255,0 }
+};
+
+static const ReelSound g_roomSound46[] = {
+ { 16, 19 },
+ { 14, 36 },
+ { 16, 50 },
+ { 14, 65 },
+ { 16, 81 },
+ { 14, 96 },
+ { 16, 114 },
+ { 14, 129 },
+ { 16, 147 },
+ { 14, 162 },
+ { 16, 177 },
+ { 14, 191 },
+ { 255,0 }
+};
+
+static const ReelSound g_roomSound47[] = {
+ { 13, 48 },
+ { 14, 41 },
+ { 15, 78 },
+ { 16, 92 },
+ { 255,0 }
+};
+
+static const ReelSound g_roomSound52[] = {
+ { 16, 115 },
+ { 255,0 }
+};
+
+static const ReelSound g_roomSound53[] = {
+ { 21, 103 },
+ { 20, 199 },
+ { 255,0 }
+};
+
+static const ReelSound g_roomSound55[] = {
+ { 17, 53 },
+ { 17, 54 },
+ { 17, 55 },
+ { 17, 56 },
+ { 17, 57 },
+ { 17, 58 },
+ { 17, 59 },
+ { 17, 61 },
+ { 17, 63 },
+ { 17, 64 },
+ { 17, 65 },
+ { 255,0 }
+};
+
+static const ReelSound *g_roomByRoom[] = {
+ g_roomSound0,g_roomSound1,g_roomSound2,g_roomSound0,g_roomSound0,
+ g_roomSound0,g_roomSound6,g_roomSound0,g_roomSound8,g_roomSound9,
+ g_roomSound10,g_roomSound11,g_roomSound12,g_roomSound13,g_roomSound14,
+ g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,
+ g_roomSound20,g_roomSound0,g_roomSound22,g_roomSound23,g_roomSound0,
+ g_roomSound25,g_roomSound26,g_roomSound27,g_roomSound28,g_roomSound29,
+ g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,
+ g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,
+ g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,g_roomSound0,
+ g_roomSound45,g_roomSound46,g_roomSound47,g_roomSound0,g_roomSound0,
+ g_roomSound0,g_roomSound0,g_roomSound52,g_roomSound53,g_roomSound0,
+ g_roomSound55
+};
+
+
+void DreamBase::soundOnReels(uint16 reelPointer) {
+ const ReelSound *r = g_roomByRoom[data.byte(kReallocation)];
+
+ if (engine->getLanguage() == Common::DE_DEU && r == g_roomSound29)
+ r = g_roomSound29_German;
+
+ for (; r->_sample != 255; ++r) {
+ if (r->_reelPointer != reelPointer)
+ continue;
+ if (r->_reelPointer == data.word(kLastsoundreel))
+ continue;
+ data.word(kLastsoundreel) = r->_reelPointer;
+ if (r->_sample < 64) {
+ playChannel1(r->_sample);
+ return;
+ }
+ if (r->_sample < 128) {
+ playChannel0(r->_sample & 63, 0);
+ return;
+ }
+ playChannel0(r->_sample & 63, 255);
+ }
+
+ if (data.word(kLastsoundreel) != reelPointer)
+ data.word(kLastsoundreel) = (uint16)-1;
+}
+
+void DreamGenContext::clearBeforeLoad() {
+ if (data.byte(kRoomloaded) != 1)
+ return /* (noclear) */;
+
+ clearReels();
+
+ //clearRest
+ uint8 *dst = (uint8 *)getSegment(data.word(kMapdata)).ptr(0, 0);
+ memset(dst, 0, kMaplen);
+ deallocateMem(data.word(kBackdrop));
+ deallocateMem(data.word(kSetframes));
+ deallocateMem(data.word(kReels));
+ deallocateMem(data.word(kPeople));
+ deallocateMem(data.word(kSetdesc));
+ deallocateMem(data.word(kBlockdesc));
+ deallocateMem(data.word(kRoomdesc));
+ deallocateMem(data.word(kFreeframes));
+ deallocateMem(data.word(kFreedesc));
+
+ data.byte(kRoomloaded) = 0;
+}
+
+void DreamGenContext::clearReels() {
+ deallocateMem(data.word(kReel1));
+ deallocateMem(data.word(kReel2));
+ deallocateMem(data.word(kReel3));
+}
+
+void DreamGenContext::getRidOfReels() {
+ if (data.byte(kRoomloaded) == 0)
+ return /* (dontgetrid) */;
+
+ deallocateMem(data.word(kReel1));
+ deallocateMem(data.word(kReel2));
+ deallocateMem(data.word(kReel3));
+}
+
+void DreamGenContext::liftNoise(uint8 index) {
+ if (data.byte(kReallocation) == 5 || data.byte(kReallocation) == 21)
+ playChannel1(13); // hiss noise
+ else
+ playChannel1(index);
+}
+} // End of namespace DreamGen
diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h
index 0d7bbb6cbf..30962a272c 100644
--- a/engines/dreamweb/structs.h
+++ b/engines/dreamweb/structs.h
@@ -20,7 +20,13 @@
*
*/
+#ifndef DREAMWEB_STRUCTS_H
+#define DREAMWEB_STRUCTS_H
+
#include "common/endian.h"
+#include "common/rect.h"
+
+namespace DreamGen {
struct Sprite {
uint16 _updateCallback;
@@ -36,37 +42,33 @@ struct Sprite {
uint8 y;
uint16 w12;
uint8 b14;
- uint8 b15;
+ uint8 frameNumber;
uint8 b16;
uint8 b17;
uint8 delay;
- uint8 frame;
+ uint8 animFrame; // index into SetObject::frames
uint16 _objData;
uint16 objData() const { return READ_LE_UINT16(&_objData); }
void setObjData(uint16 v) { WRITE_LE_UINT16(&_objData, v); }
- uint8 b22;
+ uint8 speed;
uint8 priority;
uint16 w24;
uint16 w26;
uint8 b28;
- uint8 b29;
+ uint8 walkFrame;
uint8 type;
uint8 hidden;
};
+class DreamGenContext;
+
struct RectWithCallback {
uint16 _xMin, _xMax;
uint16 _yMin, _yMax;
- uint16 _callback;
-
- uint16 xMin() const { return READ_LE_UINT16(&_xMin); }
- uint16 xMax() const { return READ_LE_UINT16(&_xMax); }
- uint16 yMin() const { return READ_LE_UINT16(&_yMin); }
- uint16 yMax() const { return READ_LE_UINT16(&_yMax); }
- uint16 callback() const { return READ_LE_UINT16(&_callback); }
+ void (DreamGenContext::*_callback)();
bool contains(uint16 x, uint16 y) const {
- return (x >= xMin()) && (x < xMax()) && (y >= yMin()) && (y < yMax());
+ return (x >= _xMin) && (x < _xMax) && (y >= _yMin) && (y < _yMax);
}
};
@@ -86,7 +88,8 @@ struct SetObject {
uint8 name[4];
uint8 b16;
uint8 index;
- uint8 b18[13]; // NB: Don't know the size yet
+ uint8 frames[13]; // Table mapping animFrame to sprite frame number
+ // NB: Don't know the size yet
uint8 b31;
uint8 b32;
uint8 b33;
@@ -136,6 +139,9 @@ struct ObjPos {
uint8 xMax;
uint8 yMax;
uint8 index;
+ bool contains(uint8 x, uint8 y) const {
+ return (x >= xMin) && (x < xMax) && (y >= yMin) && (y < yMax);
+ }
};
struct Frame {
@@ -166,8 +172,9 @@ struct ReelRoutine {
uint8 b4;
uint16 reelPointer() const { return READ_LE_UINT16(&b3); }
void setReelPointer(uint16 v) { WRITE_LE_UINT16(&b3, v); }
- uint8 b5;
- uint8 b6;
+ void incReelPointer() { setReelPointer(reelPointer() + 1); }
+ uint8 period;
+ uint8 counter;
uint8 b7;
};
@@ -185,10 +192,7 @@ struct People {
};
struct Room {
- uint8 name[10];
- uint8 b10;
- uint8 b11;
- uint8 b12;
+ char name[13];
uint8 roomsSample;
uint8 b14;
uint8 mapX;
@@ -198,7 +202,7 @@ struct Room {
uint8 b19;
uint8 liftFlag;
uint8 b21;
- uint8 b22;
+ uint8 facing;
uint8 countToOpen;
uint8 liftPath;
uint8 doorPath;
@@ -207,8 +211,9 @@ struct Room {
uint8 b28;
uint8 b29;
uint8 b30;
- uint8 b31;
+ uint8 realLocation;
};
+extern const Room g_roomData[];
struct Rain {
uint8 x;
@@ -249,3 +254,42 @@ struct RoomPaths {
PathSegment segments[24];
};
+struct Sound {
+ uint8 w1_lo;
+ uint8 w1_hi;
+ uint16 offset() const { return READ_LE_UINT16(&w1_lo); }
+ void setOffset(uint16 v) { WRITE_LE_UINT16(&w1_lo, v); }
+ uint8 w3_lo;
+ uint8 w3_hi;
+ uint16 blockCount() const { return READ_LE_UINT16(&w3_lo); }
+ void setBlockCount(uint16 v) { WRITE_LE_UINT16(&w3_lo, v); }
+ uint8 b5;
+};
+
+struct FileHeader {
+ char _desc[50];
+ uint16 _len[20];
+ uint8 _padding[6];
+
+ uint16 len(unsigned int i) const {
+ assert(i < 20);
+ return READ_LE_UINT16(&_len[i]);
+ }
+ void setLen(unsigned int i, uint16 length) {
+ assert(i < 20);
+ WRITE_LE_UINT16(&_len[i], length);
+ }
+};
+
+struct Atmosphere {
+ uint8 _location;
+ uint8 _mapX;
+ uint8 _mapY;
+ uint8 _sound;
+ uint8 _repeat;
+};
+
+} // End of namespace DreamWeb
+
+#endif
+
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index acba57ae87..162152ccda 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -26,26 +26,468 @@
namespace DreamGen {
+// Keyboard buffer. data.word(kBufferin) and data.word(kBufferout) are indexes
+// into this, making it a ring buffer
+uint8 g_keyBuffer[16];
+
+const Room g_roomData[] = {
+ { "DREAMWEB.R00", // Ryan's apartment
+ 5,255,33,10,
+ 255,255,255,0,
+ 1,6,2,255,3,255,255,255,255,255,0 },
+
+ { "DREAMWEB.R01",
+ 1,255,44,10,
+ 255,255,255,0,
+ 7,2,255,255,255,255,6,255,255,255,1 },
+
+ { "DREAMWEB.R02",
+ 2,255,33,0,
+ 255,255,255,0,
+ 1,0,255,255,1,255,3,255,255,255,2 },
+
+ { "DREAMWEB.R03",
+ 5,255,33,10,
+ 255,255,255,0,
+ 2,2,0,2,4,255,0,255,255,255,3 },
+
+ { "DREAMWEB.R04",
+ 23,255,11,30,
+ 255,255,255,0,
+ 1,4,0,5,255,255,3,255,255,255,4 },
+
+ { "DREAMWEB.R05",
+ 5,255,22,30, // if demo: 22,255,22,30,
+ 255,255,255,0,
+ 1,2,0,4,255,255,3,255,255,255,5 },
+
+ { "DREAMWEB.R06",
+ 5,255,11,30,
+ 255,255,255,0,
+ 1,0,0,1,2,255,0,255,255,255,6 },
+
+ { "DREAMWEB.R07",
+ 255,255,0,20,
+ 255,255,255,0,
+ 2,2,255,255,255,255,0,255,255,255,7 },
+
+ { "DREAMWEB.R08",
+ 8,255,0,10,
+ 255,255,255,0,
+ 1,2,255,255,255,255,0,11,40,0,8 },
+
+ { "DREAMWEB.R09",
+ 9,255,22,10,
+ 255,255,255,0,
+ 4,6,255,255,255,255,0,255,255,255,9 },
+
+ { "DREAMWEB.R10",
+ 10,255,33,30,
+ 255,255,255,0,
+ 2,0,255,255,2,2,4,22,30,255,10 }, // 22,30,0 switches
+ // off path 0 in skip
+ { "DREAMWEB.R11",
+ 11,255,11,20,
+ 255,255,255,0,
+ 0,4,255,255,255,255,255,255,255,255,11 },
+
+ { "DREAMWEB.R12",
+ 12,255,22,20,
+ 255,255,255,0,
+ 1,4,255,255,255,255,255,255,255,255,12 },
+
+ { "DREAMWEB.R13",
+ 12,255,22,20,
+ 255,255,255,0,
+ 1,4,255,255,255,255,255,255,255,255,13 },
+
+ { "DREAMWEB.R14",
+ 14,255,44,20,
+ 255,255,255,0,
+ 0,6,255,255,255,255,255,255,255,255,14 },
+
+ { "", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
+ { "", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
+ { "", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
+ { "", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
+
+ { "DREAMWEB.R19",
+ 19,255,0,0,
+ 255,255,255,0,
+ 0,4,255,255,255,255,255,255,255,255,19 },
+
+ { "DREAMWEB.R20",
+ 22,255,0,20,
+ 255,255,255,0,
+ 1,4,2,15,255,255,255,255,255,255,20 },
+
+ { "DREAMWEB.R21",
+ 5,255,11,10, // if demo: 22,255,11,10,
+ 255,255,255,0,
+ 1,4,2,15,1,255,255,255,255,255,21 },
+
+ { "DREAMWEB.R22",
+ 22,255,22,10,
+ 255,255,255,0,
+ 0,4,255,255,1,255,255,255,255,255,22 },
+
+ { "DREAMWEB.R23",
+ 23,255,22,30,
+ 255,255,255,0,
+ 1,4,2,15,3,255,255,255,255,255,23 },
+
+ { "DREAMWEB.R24",
+ 5,255,44,0,
+ 255,255,255,0,
+ 1,6,2,15,255,255,255,255,255,255,24 },
+
+ { "DREAMWEB.R25",
+ 22,255,11,40,
+ 255,255,255,0,
+ 1,0,255,255,255,255,255,255,255,255,25 },
+
+ { "DREAMWEB.R26",
+ 9,255,22,20,
+ 255,255,255,0,
+ 4,2,255,255,255,255,255,255,255,255,26 },
+
+ { "DREAMWEB.R27",
+ 22,255,11,20,
+ 255,255,255,0,
+ 0,6,255,255,255,255,255,255,255,255,27 },
+
+ { "DREAMWEB.R28",
+ 5,255,11,30,
+ 255,255,255,0,
+ 0,0,255,255,2,255,255,255,255,255,28 },
+
+ { "DREAMWEB.R29",
+ 22,255,11,10,
+ 255,255,255,0,
+ 0,2,255,255,255,255,255,255,255,255,29 },
+
+
+
+ { "DREAMWEB.R05", // Duplicate of hotel lobby, but emerging from the lift.
+ 5,255,22,10, // if demo: 22,255,22,10
+ 255,255,255,0,
+ 1,4,1,15,255,255,255,255,255,255,5 },
+
+ { "DREAMWEB.R04", // Duplicate of pool hall lobby,
+ 23,255,22,20, // but emerging from the lift.
+ 255,255,255,0,
+ 1,4,2,15,255,255,255,255,255,255,4 },
+
+ { "DREAMWEB.R10", // entering alley via skip
+ 10,255,22,30,
+ 255,255,255,0,
+ 3,6,255,255,255,255,255,255,255,255,10 },
+
+ { "DREAMWEB.R12", // on the beach, getting up.
+ 12,255,22,20,
+ 255,255,255,0,
+ 0,2,255,255,255,255,255,255,255,255,12 },
+
+ { "DREAMWEB.R03", // Duplicate of Eden's lobby
+ 5,255,44,0, // but emerging from the lift
+ 255,255,255,0,
+ 1,6,2,255,4,255,255,255,255,255,3 },
+
+ { "DREAMWEB.R24", // Duplicate of Eden's flat
+ 5,255,22,0, // but starting on the bed
+ 255,255,255,0,
+ 3,6,0,255,255,255,255,33,0,3,24 }, // 33,0,3 turns off path for lift
+
+ { "DREAMWEB.R22", // Duplicate
+ 22,255,22,20, // of hotel but in pool room
+ 255,255,255,0,
+ 1,4,255,255,255,255,255,255,255,255,22 },
+
+ { "DREAMWEB.R22", // Duplicate
+ 22,255,22,20, // of hotel but in pool room
+ 255,255,255,0, // coming out of bedroom
+ 0,2,255,255,255,255,255,255,255,255,22 },
+
+ { "DREAMWEB.R11", // Duplicate
+ 11,255,22,30, // of carpark but getting
+ 255,255,255,0, // up off the floor
+ 0,0,255,255,255,255,255,255,255,255,11 },
+
+ { "DREAMWEB.R28",
+ 5,255,11,20,
+ 255,255,255,0,
+ 0,6,255,255,2,255,255,255,255,255,28 },
+
+ { "DREAMWEB.R21",
+ 5,255,11,10, // if demo: 22,255,11,10
+ 255,255,255,0,
+ 1,4,2,15,1,255,255,255,255,255,21 },
+
+ { "DREAMWEB.R26",
+ 9,255,0,40,
+ 255,255,255,0,
+ 0,0,255,255,255,255,255,255,255,255,26 },
+
+ { "DREAMWEB.R19",
+ 19,255,0,0,
+ 255,255,255,0,
+ 2,2,255,255,255,255,255,255,255,255,19 },
+
+ { "DREAMWEB.R08", // leaving tvstudio into street
+ 8,255,11,40,
+ 255,255,255,0,
+ 0,4,255,255,255,255,255,255,255,255,8 },
+
+ { "DREAMWEB.R01",
+ 1,255,44,10,
+ 255,255,255,0,
+ 3,6,255,255,255,255,255,255,255,255,1 },
+
+
+ { "DREAMWEB.R45", // Dream room
+ 35,255,22,30,
+ 255,255,255,0,
+ 0,6,255,255,255,255,255,255,255,255,45 },
+
+ { "DREAMWEB.R46", // Dream room
+ 35,255,22,40,
+ 255,255,255,0,
+ 0,4,255,255,255,255,255,255,255,255,46 },
+
+ { "DREAMWEB.R47", // Dream room
+ 35,255,0,0,
+ 255,255,255,0,
+ 0,0,255,255,255,255,255,255,255,255,47 },
+
+ { "DREAMWEB.R45", // Dream room
+ 35,255,22,30,
+ 255,255,255,0,
+ 4,0,255,255,255,255,255,255,255,255,45 },
+
+ { "DREAMWEB.R46", // Dream room
+ 35,255,22,50,
+ 255,255,255,0,
+ 0,4,255,255,255,255,255,255,255,255,46 },
+
+
+
+ { "DREAMWEB.R50", // Intro sequence one
+ 35,255,22,30,
+ 255,255,255,0,
+ 0,0,255,255,255,255,255,255,255,255,50 },
+
+ { "DREAMWEB.R51", // Intro sequence two
+ 35,255,11,30,
+ 255,255,255,0,
+ 0,0,255,255,255,255,255,255,255,255,51 },
+
+ { "DREAMWEB.R52", // Intro sequence three
+ 35,255,22,30,
+ 255,255,255,0,
+ 0,0,255,255,255,255,255,255,255,255,52 },
+
+ { "DREAMWEB.R53", // Intro sequence four
+ 35,255,33,0,
+ 255,255,255,0,
+ 0,0,255,255,255,255,255,255,255,255,53 },
+
+ { "DREAMWEB.R54", // Intro sequence five - wasteland
+ 35,255,0,0,
+ 255,255,255,0,
+ 0,0,255,255,255,255,255,255,255,255,54 },
+
+ { "DREAMWEB.R55", // End sequence
+ 14,255,44,0,
+ 255,255,255,0,
+ 0,0,255,255,255,255,255,255,255,255,55 }
+};
+
+static const Atmosphere g_atmosphereList[] = {
+ // location,map x,y,sound,repeat
+ { 0,33,10,15,255 },
+ { 0,22,10,15,255 },
+ { 0,22,0,15,255 },
+ { 0,11,0,15,255 },
+ { 0,11,10,15,255 },
+ { 0,0,10,15,255 },
+
+ { 1,44,10,6,255 },
+ { 1,44,0,13,255 },
+
+ { 2,33,0,6,255 },
+ { 2,22,0,5,255 },
+ { 2,22,10,16,255 },
+ { 2,11,10,16,255 },
+
+ { 3,44,0,15,255 },
+ { 3,33,10,6,255 },
+ { 3,33,0,5,255 },
+
+ { 4,11,30,6,255 },
+ { 4,22,30,5,255 },
+ { 4,22,20,13,255 },
+
+ { 10,33,30,6,255 },
+ { 10,22,30,6,255 },
+
+ { 9,22,10,6,255 },
+ { 9,22,20,16,255 },
+ { 9,22,30,16,255 },
+ { 9,22,40,16,255 },
+ { 9,22,50,16,255 },
+
+ { 6,11,30,6,255 },
+ { 6,0,10,15,255 },
+ { 6,0,20,15,255 },
+ { 6,11,20,15,255 },
+ { 6,22,20,15,255 },
+
+ { 7,11,20,6,255 },
+ { 7,0,20,6,255 },
+ { 7,0,30,6,255 },
+
+ { 55,44,0,5,255 },
+ { 55,44,10,5,255 },
+
+ { 5,22,30,6,255 },
+ { 5,22,20,15,255 }, // if demo: { 5,22,20,16,255 },
+ { 5,22,10,15,255 }, // if demo: { 5,22,10,16,255 },
+
+ { 24,22,0,15,255 },
+ { 24,33,0,15,255 },
+ { 24,44,0,15,255 },
+ { 24,33,10,15,255 },
+
+ { 8,0,10,6,255 },
+ { 8,11,10,6,255 },
+ { 8,22,10,6,255 },
+ { 8,33,10,6,255 },
+ { 8,33,20,6,255 },
+ { 8,33,30,6,255 },
+ { 8,33,40,6,255 },
+ { 8,22,40,6,255 },
+ { 8,11,40,6,255 },
+
+ { 11,11,20,12,255 },
+ { 11,11,30,12,255 },
+ { 11,22,20,12,255 },
+ { 11,22,30,12,255 },
+
+ { 12,22,20,12,255 },
+ { 13,22,20,12,255 },
+ { 13,33,20,12,255 },
+
+ { 14,44,20,12,255 },
+ { 14,33,0,12,255 },
+ { 14,33,10,12,255 },
+ { 14,33,20,12,255 },
+ { 14,33,30,12,255 },
+ { 14,33,40,12,255 },
+ { 14,22,0,16,255 },
+
+ { 19,0,0,12,255 },
+
+ { 20,0,20,16,255 },
+ { 20,0,30,16,255 },
+ { 20,11,30,16,255 },
+ { 20,0,40,16,255 },
+ { 20,11,40,16,255 },
+
+ { 21,11,10,15,255 }, // if demo: { 21,11,10,16,255 },
+ { 21,11,20,15,255 }, // if demo: { 21,11,20,16,255 },
+ { 21, 0,20,15,255 }, // if demo: { 21,0,20,16,255 },
+ { 21,22,20,15,255 }, // if demo: { 21,22,20,16,255 },
+ { 21,33,20,15,255 }, // if demo: { 21,33,20,16,255 },
+ { 21,44,20,15,255 }, // if demo: { 21,44,20,16,255 },
+ { 21,44,10,15,255 }, // if demo: { 21,44,10,16,255 },
+
+ { 22,22,10,16,255 },
+ { 22,22,20,16,255 },
+
+ { 23,22,30,13,255 },
+ { 23,22,40,13,255 },
+ { 23,33,40,13,255 },
+ { 23,11,40,13,255 },
+ { 23,0,40,13,255 },
+ { 23,0,50,13,255 },
+
+ { 25,11,40,16,255 },
+ { 25,11,50,16,255 },
+ { 25,0,50,16,255 },
+
+ { 27,11,20,16,255 },
+ { 27,11,30,16,255 },
+
+ { 29,11,10,16,255 },
+
+ { 45,22,30,12,255 },
+ { 45,22,40,12,255 },
+ { 45,22,50,12,255 },
+
+ { 46,22,40,12,255 },
+ { 46,11,50,12,255 },
+ { 46,22,50,12,255 },
+ { 46,33,50,12,255 },
+
+ { 47,0,0,12,255 },
+
+ { 26,22,20,16,255 },
+ { 26,33,10,16,255 },
+ { 26,33,20,16,255 },
+ { 26,33,30,16,255 },
+ { 26,44,30,16,255 },
+ { 26,22,30,16,255 },
+ { 26,11,30,16,255 },
+ { 26,11,20,16,255 },
+ { 26,0,20,16,255 },
+ { 26,11,40,16,255 },
+ { 26,0,40,16,255 },
+ { 26,22,40,16,255 },
+ { 26,11,50,16,255 },
+
+ { 28,0,30,15,255 },
+ { 28,0,20,15,255 },
+ { 28,0,40,15,255 },
+ { 28,11,30,15,255 },
+ { 28,11,20,15,255 },
+ { 28,22,30,15,255 },
+ { 28,22,20,15,255 },
+
+ { 255,255,255,255,255 }
+
+};
+
void DreamGenContext::dreamweb() {
STACK_CHECK;
- seecommandtail();
- checkbasemem();
- soundstartup();
- setkeyboardint();
- setupemm();
- allocatebuffers();
- setmouse();
- fadedos();
- gettime();
- clearbuffers();
- clearpalette();
- set16colpalette();
- readsetdata();
+
+ switch(engine->getLanguage()) {
+ case Common::EN_ANY:
+ case Common::EN_GRB:
+ case Common::EN_USA:
+ // Implicit data.byte(kForeignrelease) = 0
+ break;
+ default:
+ data.byte(kForeignrelease) = 1;
+ break;
+ }
+
+ seeCommandTail();
+ // soundStartup used to be done here...
+ // setKeyboardInt used to be done here...
+ allocateBuffers();
+
+ // setMouse
+ data.word(kOldpointerx) = 0xffff;
+
+ fadeDOS();
+ getTime();
+ clearBuffers();
+ clearPalette();
+ set16ColPalette();
+ readSetData();
data.byte(kWongame) = 0;
- dx = 1909;
- loadsample();
- setsoundoff();
+ engine->loadSounds(0, "DREAMWEB.V99"); // basic sample
bool firstLoop = true;
@@ -53,7 +495,7 @@ void DreamGenContext::dreamweb() {
while (true) {
- scanfornames();
+ unsigned int count = scanForNames();
bool startNewGame = true;
@@ -62,35 +504,34 @@ void DreamGenContext::dreamweb() {
// loading a savegame requested from launcher/command line
cls();
- setmode();
- loadpalfromiff();
- clearpalette();
-
- ax = savegameId;
- doload();
- worktoscreen();
- fadescreenup();
+ setMode();
+ loadPalFromIFF();
+ clearPalette();
+
+ doLoad(savegameId);
+ workToScreenCPP();
+ fadeScreenUp();
startNewGame = false;
- } else if (al == 0 && firstLoop) {
+ } else if (count == 0 && firstLoop) {
// no savegames found, and we're not restarting.
- setmode();
- loadpalfromiff();
+ setMode();
+ loadPalFromIFF();
} else {
- // "dodecisions"
+ // "doDecisions"
// Savegames found, so ask if we should load one.
// (If we're restarting after game over, we also always show these
// options.)
cls();
- setmode();
+ setMode();
decide();
- if (data.byte(kQuitrequested))
- return; // exit game
+ if (quitRequested())
+ goto done;
if (data.byte(kGetback) == 4)
startNewGame = false; // savegame has been loaded
@@ -100,34 +541,42 @@ void DreamGenContext::dreamweb() {
firstLoop = false;
if (startNewGame) {
- // "playgame"
+ // "playGame"
- titles();
- if (data.byte(kQuitrequested))
- return; // exit game
- credits();
+ // "titles"
+ clearPalette();
+ bibleQuote();
+ if (!quitRequested()) // "titlesearly"
+ intro();
- if (data.byte(kQuitrequested))
- return; // exit game
+ if (quitRequested())
+ goto done;
- clearchanges();
- setmode();
- loadpalfromiff();
+ // "credits"
+ clearPalette();
+ realCredits();
+
+ if (quitRequested())
+ goto done;
+
+ clearChanges();
+ setMode();
+ loadPalFromIFF();
data.byte(kLocation) = 255;
data.byte(kRoomafterdream) = 1;
data.byte(kNewlocation) = 35;
data.byte(kVolume) = 7;
- loadroom();
- clearsprites();
- initman();
- entrytexts();
- entryanims();
+ loadRoom();
+ clearSprites();
+ initMan();
+ entryTexts();
+ entryAnims();
data.byte(kDestpos) = 3;
- initialinv();
+ initialInv();
data.byte(kLastflag) = 32;
startup1();
data.byte(kVolumeto) = 0;
- data.byte(kVolumedirection) = -1;
+ data.byte(kVolumedirection) = (uint8)-1;
data.byte(kCommandtype) = 255;
}
@@ -135,19 +584,22 @@ void DreamGenContext::dreamweb() {
// main loop
while (true) {
- if (data.byte(kQuitrequested))
- return; // exit game
+ if (quitRequested())
+ goto done;
- screenupdate();
+ screenUpdate();
+
+ if (quitRequested())
+ goto done;
if (data.byte(kWongame) != 0) {
// "endofgame"
- clearbeforeload();
- fadescreendowns();
- hangon(200);
- endgame();
- quickquit2();
- return;
+ clearBeforeLoad();
+ fadeScreenDowns();
+ hangOn(200);
+ endGame();
+ quickQuit2();
+ goto done;
}
if (data.byte(kMandead) == 1 || data.byte(kMandead) == 2)
@@ -159,193 +611,229 @@ void DreamGenContext::dreamweb() {
}
if (data.word(kWatchingtime) == 0) {
- // "notwatching"
+ // "notWatching"
if (data.byte(kMandead) == 4)
break;
if (data.byte(kNewlocation) != 255) {
- // "loadnew"
- clearbeforeload();
- loadroom();
- clearsprites();
- initman();
- entrytexts();
- entryanims();
+ // "loadNew"
+ clearBeforeLoad();
+ loadRoom();
+ clearSprites();
+ initMan();
+ entryTexts();
+ entryAnims();
data.byte(kNewlocation) = 255;
startup();
data.byte(kCommandtype) = 255;
- worktoscreenm();
+ workToScreenM();
}
}
}
- // "gameover"
- clearbeforeload();
- showgun();
- fadescreendown();
- hangon(100);
+ // "gameOver"
+ clearBeforeLoad();
+ showGun();
+ fadeScreenDown();
+ hangOn(100);
}
+done: // The engine will need some cleaner finalization, let's put it here for now
+ // FIXME: This triggers "Deallocating non existent segment" errors when
+ // quitting from a menu.
+ getRidOfAll();
+ engine->freeIcons1();
+ engine->freeIcons2();
}
-static Common::String getFilename(Context &context) {
- uint16 name_ptr = context.dx;
- Common::String name;
- uint8 c;
- while((c = context.cs.byte(name_ptr++)) != 0)
- name += (char)c;
- return name;
+bool DreamBase::quitRequested() {
+ return data.byte(kQuitrequested);
}
-void DreamGenContext::seecommandtail() {
- data.word(kSoundbaseadd) = 0x220;
- data.byte(kSoundint) = 5;
- data.byte(kSounddmachannel) = 1;
- data.byte(kBrightness) = 1;
- data.word(kHowmuchalloc) = 0x9360;
-}
+void DreamGenContext::screenUpdate() {
+ newPlace();
+ mainScreen();
+ if (quitRequested())
+ return;
+ animPointer();
-void DreamGenContext::randomnumber() {
- al = engine->randomNumber();
+ showPointer();
+ if ((data.word(kWatchingtime) == 0) && (data.byte(kNewlocation) != 0xff))
+ return;
+ vSync();
+ uint16 mouseState = 0;
+ mouseState |= readMouseState();
+ dumpPointer();
+
+ dumpTextLine();
+ delPointer();
+ autoLook();
+ spriteUpdate();
+ watchCount();
+ zoom();
+
+ showPointer();
+ if (data.byte(kWongame))
+ return;
+ vSync();
+ mouseState |= readMouseState();
+ dumpPointer();
+
+ dumpZoom();
+ delPointer();
+ delEverything();
+ printSprites();
+ reelsOnScreen();
+ afterNewRoom();
+
+ showPointer();
+ vSync();
+ mouseState |= readMouseState();
+ dumpPointer();
+
+ dumpMap();
+ dumpTimedText();
+ delPointer();
+
+ showPointer();
+ vSync();
+ data.word(kOldbutton) = data.word(kMousebutton);
+ mouseState |= readMouseState();
+ data.word(kMousebutton) = mouseState;
+ dumpPointer();
+
+ dumpWatch();
+ delPointer();
}
-void DreamGenContext::quickquit() {
- engine->quit();
+void DreamGenContext::startup() {
+ data.byte(kCurrentkey) = 0;
+ data.byte(kMainmode) = 0;
+ createPanel();
+ data.byte(kNewobs) = 1;
+ drawFloor();
+ showIcon();
+ getUnderZoom();
+ spriteUpdate();
+ printSprites();
+ underTextLine();
+ reelsOnScreen();
+ atmospheres();
}
-void DreamGenContext::quickquit2() {
- engine->quit();
+void DreamGenContext::startup1() {
+ clearPalette();
+ data.byte(kThroughdoor) = 0;
+
+ startup();
+
+ workToScreenCPP();
+ fadeScreenUp();
}
-void DreamGenContext::keyboardread() {
- ::error("keyboardread"); //this keyboard int handler, must never be called
+void DreamGenContext::switchRyanOn() {
+ data.byte(kRyanon) = 255;
}
-void DreamGenContext::resetkeyboard() {
+void DreamGenContext::switchRyanOff() {
+ data.byte(kRyanon) = 1;
}
-void DreamGenContext::setkeyboardint() {
+uint8 *DreamBase::textUnder() {
+ return getSegment(data.word(kBuffers)).ptr(kTextunder, 0);
}
-void DreamGenContext::readfromfile() {
- uint16 dst_offset = dx;
- uint16 size = cx;
- debug(1, "readfromfile(%04x:%u, %u)", (uint16)ds, dst_offset, size);
- ax = engine->readFromFile(ds.ptr(dst_offset, size), size);
- flags._c = false;
+uint16 DreamGenContext::standardLoad(const char *fileName, uint16 *outSizeInBytes) {
+ FileHeader header;
+
+ Common::File file;
+ file.open(fileName);
+ file.read((uint8 *)&header, sizeof(FileHeader));
+ uint16 sizeInBytes = header.len(0);
+ if (outSizeInBytes)
+ *outSizeInBytes = sizeInBytes;
+ uint16 result = allocateMem((sizeInBytes + 15) / 16);
+ file.read(getSegment(result).ptr(0, 0), sizeInBytes);
+ return result;
}
-void DreamGenContext::closefile() {
- engine->closeFile();
- data.byte(kHandle) = 0;
+void *DreamGenContext::standardLoadCPP(const char *fileName, uint16 *outSizeInBytes) {
+ uint16 sizeInBytes;
+ uint16 seg = standardLoad(fileName, &sizeInBytes);
+ void *buffer = malloc(sizeInBytes);
+ memcpy(buffer, getSegment(seg).ptr(0, 0), sizeInBytes);
+ deallocateMem(seg);
+ if (outSizeInBytes)
+ *outSizeInBytes = sizeInBytes;
+ return buffer;
}
-void DreamGenContext::openforsave() {
- const char *name = (const char *)ds.ptr(dx, 13);
- debug(1, "openforsave(%s)", name);
- engine->openSaveFileForWriting(name);
+void DreamGenContext::loadIntoTemp() {
+ loadIntoTemp((const char *)data.ptr(dx, 0));
}
-void DreamGenContext::openfilenocheck() {
- const char *name = (const char *)ds.ptr(dx, 13);
- debug(1, "checksavefile(%s)", name);
- bool ok = engine->openSaveFileForReading(name);
- flags._c = !ok;
+void DreamGenContext::loadIntoTemp(const char *fileName) {
+ data.word(kTempgraphics) = standardLoad(fileName);
}
-void DreamGenContext::openfilefromc() {
- openfilenocheck();
+void DreamGenContext::loadIntoTemp2(const char *fileName) {
+ data.word(kTempgraphics2) = standardLoad(fileName);
}
-void DreamGenContext::openfile() {
- Common::String name = getFilename(*this);
- debug(1, "opening file: %s", name.c_str());
- engine->openFile(name);
- cs.word(kHandle) = 1; //only one handle
- flags._c = false;
+void DreamGenContext::loadIntoTemp3(const char *fileName) {
+ data.word(kTempgraphics3) = standardLoad(fileName);
}
-void DreamGenContext::createfile() {
- ::error("createfile");
+void DreamGenContext::loadTempCharset() {
+ loadTempCharset((const char *)data.ptr(dx, 0));
}
-void DreamGenContext::dontloadseg() {
- ax = es.word(di);
- _add(di, 2);
- dx = ax;
- cx = 0;
- unsigned pos = engine->skipBytes(dx);
- dx = pos >> 16;
- ax = pos & 0xffff;
- flags._c = false;
+void DreamGenContext::loadTempCharset(const char *fileName) {
+ engine->setTempCharset(standardLoadCPP(fileName));
}
-void DreamGenContext::mousecall() {
- uint16 x, y, state;
- engine->mouseCall(&x, &y, &state);
- cx = x;
- dx = y;
- bx = state;
+void DreamGenContext::hangOnCurs(uint16 frameCount) {
+ for (uint16 i = 0; i < frameCount; ++i) {
+ printCurs();
+ vSync();
+ delCurs();
+ }
}
-void DreamGenContext::readmouse() {
- data.word(kOldbutton) = data.word(kMousebutton);
- data.word(kOldx) = data.word(kMousex);
- data.word(kOldy) = data.word(kMousey);
- uint16 x, y, state;
- engine->mouseCall(&x, &y, &state);
- data.word(kMousex) = x;
- data.word(kMousey) = y;
- data.word(kMousebutton) = state;
+void DreamGenContext::seeCommandTail() {
+ data.byte(kBrightness) = 1;
}
-void DreamGenContext::readmouse1() {
- data.word(kOldx) = data.word(kMousex);
- data.word(kOldy) = data.word(kMousey);
- uint16 x, y, state;
- engine->mouseCall(&x, &y, &state);
- data.word(kMousex) = x;
- data.word(kMousey) = y;
- data.word(kMousebutton1) = state;
+void DreamGenContext::randomNumber() {
+ al = engine->randomNumber();
}
-void DreamGenContext::readmouse2() {
- data.word(kOldx) = data.word(kMousex);
- data.word(kOldy) = data.word(kMousey);
- uint16 x, y, state;
- engine->mouseCall(&x, &y, &state);
- data.word(kMousex) = x;
- data.word(kMousey) = y;
- data.word(kMousebutton2) = state;
+void DreamGenContext::quickQuit() {
+ engine->quit();
}
-void DreamGenContext::readmouse3() {
- data.word(kOldx) = data.word(kMousex);
- data.word(kOldy) = data.word(kMousey);
- uint16 x, y, state;
- engine->mouseCall(&x, &y, &state);
- data.word(kMousex) = x;
- data.word(kMousey) = y;
- data.word(kMousebutton3) = state;
+void DreamGenContext::quickQuit2() {
+ engine->quit();
}
-void DreamGenContext::readmouse4() {
+void DreamBase::readMouse() {
data.word(kOldbutton) = data.word(kMousebutton);
+ uint16 state = readMouseState();
+ data.word(kMousebutton) = state;
+}
+
+uint16 DreamBase::readMouseState() {
data.word(kOldx) = data.word(kMousex);
data.word(kOldy) = data.word(kMousey);
uint16 x, y, state;
engine->mouseCall(&x, &y, &state);
data.word(kMousex) = x;
data.word(kMousey) = y;
- data.word(kMousebutton) = state | data.word(kMousebutton1) | data.word(kMousebutton2) | data.word(kMousebutton3);
+ return state;
}
-void DreamGenContext::setmouse() {
- data.word(kOldpointerx) = 0xffff;
-}
-
-void DreamGenContext::dumptextline() {
+void DreamGenContext::dumpTextLine() {
if (data.byte(kNewtextline) != 1)
return;
data.byte(kNewtextline) = 0;
@@ -353,39 +841,39 @@ void DreamGenContext::dumptextline() {
uint16 y = data.word(kTextaddressy);
if (data.byte(kForeignrelease) != 0)
y -= 3;
- multidump(x, y, 228, 13);
+ multiDump(x, y, 228, 13);
}
-void DreamGenContext::getundertimed() {
+void DreamGenContext::getUnderTimed() {
uint16 y = data.byte(kTimedy);
if (data.byte(kForeignrelease))
y -= 3;
ds = data.word(kBuffers);
si = kUndertimedtext;
- multiget(ds.ptr(si, 0), data.byte(kTimedx), y, 240, kUndertimedysize);
+ multiGet(ds.ptr(si, 0), data.byte(kTimedx), y, 240, kUndertimedysize);
}
-void DreamGenContext::putundertimed() {
+void DreamGenContext::putUnderTimed() {
uint16 y = data.byte(kTimedy);
if (data.byte(kForeignrelease))
y -= 3;
ds = data.word(kBuffers);
si = kUndertimedtext;
- multiput(ds.ptr(si, 0), data.byte(kTimedx), y, 240, kUndertimedysize);
+ multiPut(ds.ptr(si, 0), data.byte(kTimedx), y, 240, kUndertimedysize);
}
-void DreamGenContext::usetimedtext() {
+void DreamGenContext::useTimedText() {
if (data.word(kTimecount) == 0)
return;
--data.word(kTimecount);
if (data.word(kTimecount) == 0) {
- putundertimed();
+ putUnderTimed();
data.byte(kNeedtodumptimed) = 1;
return;
}
if (data.word(kTimecount) == data.word(kCounttotimed))
- getundertimed();
+ getUnderTimed();
else if (data.word(kTimecount) > data.word(kCounttotimed))
return;
@@ -393,34 +881,20 @@ void DreamGenContext::usetimedtext() {
si = data.word(kTimedoffset);
const uint8 *string = es.ptr(si, 0);
uint16 y = data.byte(kTimedy);
- printdirect(&string, data.byte(kTimedx), &y, 237, true);
+ printDirect(&string, data.byte(kTimedx), &y, 237, true);
data.byte(kNeedtodumptimed) = 1;
}
-void DreamGenContext::setuptimedtemp() {
- setuptimedtemp(al, ah, bl, bh, cx, dx);
-}
-
-void DreamGenContext::setuptimedtemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount) {
+void DreamGenContext::setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount) {
#if 1 // if cd
if (voiceIndex != 0) {
- push(ax);
- push(bx);
- push(cx);
- push(dx);
- dl = 'T';
- dh = voiceIndex;
- cl = 'T';
- ah = 0;
- loadspeech();
- if (data.byte(kSpeechloaded) == 1) {
- al = 50+12;
- playchannel1();
+ if (loadSpeech('T', voiceIndex, 'T', textIndex)) {
+ playChannel1(50+12);
}
- dx = pop();
- cx = pop();
- bx = pop();
- ax = pop();
+
+ // FIXME: This fallthrough does not properly support subtitles+speech
+ // mode. The parameters to setuptimedtemp() are sometimes different
+ // for speech and for subtitles. See e.g., madmantext()
if ((data.byte(kSpeechloaded) == 1) && (data.byte(kSubtitles) != 1))
return;
}
@@ -433,23 +907,23 @@ void DreamGenContext::setuptimedtemp(uint8 textIndex, uint8 voiceIndex, uint8 x,
data.word(kCounttotimed) = countToTimed;
data.word(kTimecount) = timeCount + countToTimed;
data.word(kTimedseg) = data.word(kTextfile1);
- data.word(kTimedoffset) = kTextstart + segRef(data.word(kTextfile1)).word(textIndex * 2);
- const uint8 *string = segRef(data.word(kTextfile1)).ptr(data.word(kTimedoffset), 0);
- debug(1, "setuptimedtemp: (%d, %d) => '%s'", textIndex, voiceIndex, string);
+ data.word(kTimedoffset) = kTextstart + getSegment(data.word(kTextfile1)).word(textIndex * 2);
+ const uint8 *string = getSegment(data.word(kTextfile1)).ptr(data.word(kTimedoffset), 0);
+ debug(1, "setupTimedTemp: (%d, %d) => '%s'", textIndex, voiceIndex, string);
}
-void DreamGenContext::dumptimedtext() {
+void DreamGenContext::dumpTimedText() {
if (data.byte(kNeedtodumptimed) != 1)
return;
uint8 y = data.byte(kTimedy);
if (data.byte(kForeignrelease) != 0)
y -= 3;
- multidump(data.byte(kTimedx), y, 240, kUndertimedysize);
+ multiDump(data.byte(kTimedx), y, 240, kUndertimedysize);
data.byte(kNeedtodumptimed) = 0;
}
-void DreamGenContext::gettime() {
+void DreamGenContext::getTime() {
TimeDate t;
g_system->getTimeAndDate(t);
debug(1, "\tgettime: %02d:%02d:%02d", t.tm_hour, t.tm_min, t.tm_sec);
@@ -461,11 +935,7 @@ void DreamGenContext::gettime() {
data.byte(kHourcount) = ch;
}
-void DreamGenContext::allocatemem() {
- ax = allocatemem(bx);
-}
-
-uint16 DreamGenContext::allocatemem(uint16 paragraphs) {
+uint16 DreamGenContext::allocateMem(uint16 paragraphs) {
uint size = (paragraphs + 2) * 16;
debug(1, "allocate mem, %u bytes", size);
flags._c = false;
@@ -475,10 +945,9 @@ uint16 DreamGenContext::allocatemem(uint16 paragraphs) {
return result;
}
-void DreamGenContext::deallocatemem() {
- uint16 id = (uint16)es;
- debug(1, "deallocating segment %04x", id);
- deallocateSegment(id);
+void DreamGenContext::deallocateMem(uint16 segment) {
+ debug(1, "deallocating segment %04x", segment);
+ deallocateSegment(segment);
//fixing invalid entries in the sprite table
es = data;
@@ -486,190 +955,38 @@ void DreamGenContext::deallocatemem() {
uint16 bseg = data.word(kBuffers);
if (!bseg)
return;
- SegmentRef buffers(this);
+ MutableSegmentRef buffers(this);
buffers = bseg;
uint8 *ptr = buffers.ptr(kSpritetable, tsize);
- for(uint i = 0; i < tsize; i += 32) {
+ for (uint i = 0; i < tsize; i += 32) {
uint16 seg = READ_LE_UINT16(ptr + i + 6);
//debug(1, "sprite segment = %04x", seg);
- if (seg == id)
+ if (seg == segment)
memset(ptr + i, 0xff, 32);
}
}
-void DreamGenContext::removeemm() {
- ::error("removeemm");
-}
-
-void DreamGenContext::setupemm() {
- //good place for early initialization
- switch(engine->getLanguage()) {
- case Common::EN_ANY:
- case Common::EN_GRB:
- case Common::EN_USA:
- return;
- default:
- data.byte(kForeignrelease) = 1;
- }
-}
-
-void DreamGenContext::pitinterupt() {
- ::error("pitinterupt");
-}
-
-void DreamGenContext::getridofpit() {
- ::error("getridofpit");
-}
-
-void DreamGenContext::setuppit() {
- ::error("setuppit");
-}
-
-void DreamGenContext::startdmablock() {
- ::error("startdmablock");
-}
-
-void DreamGenContext::dmaend() {
- ::error("dmaend");
-}
-
-void DreamGenContext::restoreems() {
- ::error("restoreems");
-}
-
-void DreamGenContext::saveems() {
- ::error("saveems");
-}
-
-void DreamGenContext::bothchannels() {
- ::error("bothchannels");
-}
-
-void DreamGenContext::channel1only() {
- ::error("channel1only");
-}
-
-void DreamGenContext::channel0only() {
- ::error("channel0only");
-}
-
-void DreamGenContext::out22c() {
- ::error("out22c");
-}
-
-void DreamGenContext::soundstartup() {}
-void DreamGenContext::soundend() {}
-void DreamGenContext::interupttest() {}
-void DreamGenContext::disablesoundint() {}
-void DreamGenContext::enablesoundint() {}
-void DreamGenContext::checksoundint() {
- data.byte(kTestresult) = 1;
-}
-
-void DreamGenContext::setsoundoff() {
- warning("setsoundoff: STUB");
-}
-
-void DreamGenContext::loadsample() {
- engine->loadSounds(0, (const char *)data.ptr(dx, 13));
-}
-
-void DreamGenContext::loadsecondsample() {
- uint8 ch0 = data.byte(kCh0playing);
- if (ch0 >= 12 && ch0 != 255)
- cancelch0();
- uint8 ch1 = data.byte(kCh1playing);
- if (ch1 >= 12)
- cancelch1();
- engine->loadSounds(1, (const char *)data.ptr(dx, 13));
-}
-
-void DreamGenContext::loadspeech() {
- cancelch1();
- data.byte(kSpeechloaded) = 0;
- createname();
- const char *name = (const char *)data.ptr(di, 13);
- //warning("name = %s", name);
- if (engine->loadSpeech(name))
- data.byte(kSpeechloaded) = 1;
-}
-
-void DreamGenContext::saveseg() {
- cx = es.word(di);
- _add(di, 2);
- savefilewrite();
-}
-
-void DreamGenContext::savefilewrite() {
- ax = engine->writeToSaveFile(ds.ptr(dx, cx), cx);
-}
-
-void DreamGenContext::savefileread() {
- ax = engine->readFromSaveFile(ds.ptr(dx, cx), cx);
-}
-
-void DreamGenContext::loadseg() {
- ax = es.word(di);
- di += 2;
-
- uint16 dst_offset = dx;
- uint16 size = ax;
-
- debug(1, "loadseg(%04x:%u, %u)", (uint16)ds, dst_offset, size);
- ax = engine->readFromFile(ds.ptr(dst_offset, size), size);
- flags._c = false;
-}
-
-void DreamGenContext::error() {
- ::error("error");
-}
-
-void DreamGenContext::generalerror() {
- ::error("generalerror");
-}
-
-void DreamGenContext::dosreturn() {
-
- _cmp(data.byte(kCommandtype), 250);
- if (!flags.z()) {
+void DreamGenContext::DOSReturn() {
+ if (data.byte(kCommandtype) != 250) {
data.byte(kCommandtype) = 250;
- al = 46;
- commandonly();
+ commandOnly(46);
}
- ax = data.word(kMousebutton);
- _and(ax, 1);
- if (flags.z())
- return;
-
- data.word(kMousebutton) = 0;
- engine->quit();
-}
-
-void DreamGenContext::set16colpalette() {
-}
-
-void DreamGenContext::mode640x480() {
- // Video mode 12h: 640x480 pixels, 16 colors, I believe
- al = 0x12 + 128;
- ah = 0;
- initGraphics(640, 480, true);
-}
-
-void DreamGenContext::showgroup() {
- engine->setPalette();
+ if (data.word(kMousebutton) & 1) {
+ data.word(kMousebutton) = 0;
+ engine->quit();
+ }
}
-void DreamGenContext::fadedos() {
- engine->fadeDos();
+void DreamGenContext::set16ColPalette() {
}
-void DreamGenContext::eraseoldobs() {
+void DreamGenContext::eraseOldObs() {
if (data.byte(kNewobs) == 0)
return;
- Sprite *sprites = spritetable();
- for (size_t i=0; i < 16; ++i) {
+ Sprite *sprites = spriteTable();
+ for (size_t i = 0; i < 16; ++i) {
Sprite &sprite = sprites[i];
if (sprite.objData() != 0xffff) {
memset(&sprite, 0xff, sizeof(Sprite));
@@ -677,11 +994,7 @@ void DreamGenContext::eraseoldobs() {
}
}
-void DreamGenContext::modifychar() {
- al = engine->modifyChar(al);
-}
-
-void DreamGenContext::lockmon() {
+void DreamBase::lockMon() {
// Pressing space pauses text output in the monitor. We use the "hard"
// key because calling readkey() drains characters from the input
// buffer, we we want the user to be able to type ahead while the text
@@ -690,44 +1003,31 @@ void DreamGenContext::lockmon() {
// Clear the keyboard buffer. Otherwise the space that caused
// the pause will be read immediately unpause the game.
do {
- readkey();
+ readKey();
} while (data.byte(kCurrentkey) != 0);
- locklighton();
+ lockLightOn();
while (!engine->shouldQuit()) {
engine->waitForVSync();
- readkey();
+ readKey();
if (data.byte(kCurrentkey) == ' ')
break;
}
// Forget the last "hard" key, otherwise the space that caused
// the unpausing will immediately re-pause the game.
data.byte(kLasthardkey) = 0;
- locklightoff();
+ lockLightOff();
}
}
-void DreamGenContext::cancelch0() {
- data.byte(kCh0repeat) = 0;
- data.word(kCh0blockstocopy) = 0;
- data.byte(kCh0playing) = 255;
- engine->stopSound(0);
-}
-
-void DreamGenContext::cancelch1() {
- data.word(kCh1blockstocopy) = 0;
- data.byte(kCh1playing) = 255;
- engine->stopSound(1);
-}
-
-void DreamGenContext::makebackob(SetObject *objData) {
+void DreamGenContext::makeBackOb(SetObject *objData) {
if (data.byte(kNewobs) == 0)
return;
uint8 priority = objData->priority;
uint8 type = objData->type;
- Sprite *sprite = makesprite(data.word(kObjectx), data.word(kObjecty), addr_backobject, data.word(kSetframes), 0);
+ Sprite *sprite = makeSprite(data.word(kObjectx), data.word(kObjecty), addr_backobject, data.word(kSetframes), 0);
- uint16 objDataOffset = (uint8 *)objData - segRef(data.word(kSetdat)).ptr(0, 0);
+ uint16 objDataOffset = (uint8 *)objData - getSegment(data.word(kSetdat)).ptr(0, 0);
assert(objDataOffset % sizeof(SetObject) == 0);
assert(objDataOffset < 128 * sizeof(SetObject));
sprite->setObjData(objDataOffset);
@@ -737,256 +1037,162 @@ void DreamGenContext::makebackob(SetObject *objData) {
sprite->type = type;
sprite->b16 = 0;
sprite->delay = 0;
- sprite->frame = 0;
+ sprite->animFrame = 0;
}
-void DreamGenContext::getroomdata() {
- bx = kRoomdata + sizeof(Room) * al;
+uint16 DreamGenContext::allocateAndLoad(unsigned int size) {
+ // allocatemem adds 32 bytes, so it doesn't matter that size/16 rounds down
+ uint16 result = allocateMem(size / 16);
+ engine->readFromFile(getSegment(result).ptr(0, size), size);
+ return result;
}
-void DreamGenContext::startloading() {
- const Room *room = (Room *)cs.ptr(bx, sizeof(Room));
- startloading(room);
+void DreamGenContext::clearAndLoad(uint8 *buf, uint8 c,
+ unsigned int size, unsigned int maxSize) {
+ assert(size <= maxSize);
+ memset(buf, c, maxSize);
+ engine->readFromFile(buf, size);
}
-void DreamGenContext::readheader() {
- ax = engine->readFromFile(cs.ptr(kFileheader, kHeaderlen), kHeaderlen);
- es = cs;
- di = kFiledata;
+void DreamGenContext::clearAndLoad(uint16 seg, uint8 c,
+ unsigned int size, unsigned int maxSize) {
+ assert(size <= maxSize);
+ uint8 *buf = getSegment(seg).ptr(0, maxSize);
+ clearAndLoad(buf, c, size, maxSize);
}
-void DreamGenContext::startloading(const Room *room) {
+void DreamGenContext::startLoading(const Room &room) {
data.byte(kCombatcount) = 0;
- data.byte(kRoomssample) = room->roomsSample;
- data.byte(kMapx) = room->mapX;
- data.byte(kMapy) = room->mapY;
- data.byte(kLiftflag) = room->liftFlag;
- data.byte(kManspath) = room->b21;
- data.byte(kDestination) = room->b21;
- data.byte(kFinaldest) = room->b21;
- data.byte(kFacing) = room->b22;
- data.byte(kTurntoface) = room->b22;
- data.byte(kCounttoopen) = room->countToOpen;
- data.byte(kLiftpath) = room->liftPath;
- data.byte(kDoorpath) = room->doorPath;
- data.byte(kLastweapon) = -1;
- al = room->b27;
- push(ax);
- al = room->b31;
+ data.byte(kRoomssample) = room.roomsSample;
+ data.byte(kMapx) = room.mapX;
+ data.byte(kMapy) = room.mapY;
+ data.byte(kLiftflag) = room.liftFlag;
+ data.byte(kManspath) = room.b21;
+ data.byte(kDestination) = room.b21;
+ data.byte(kFinaldest) = room.b21;
+ data.byte(kFacing) = room.facing;
+ data.byte(kTurntoface) = room.facing;
+ data.byte(kCounttoopen) = room.countToOpen;
+ data.byte(kLiftpath) = room.liftPath;
+ data.byte(kDoorpath) = room.doorPath;
+ data.byte(kLastweapon) = (uint8)-1;
ah = data.byte(kReallocation);
- data.byte(kReallocation) = al;
- dx = bx;
- Common::String name = getFilename(*this);
- engine->openFile(name);
- cs.word(kHandle) = 1; //only one handle
- flags._c = false;
- readheader();
- allocateload();
- ds = ax;
- data.word(kBackdrop) = ax;
- dx = (0);
- loadseg();
- ds = data.word(kWorkspace);
- dx = (0);
- cx = 132*66;
- al = 0;
- fillspace();
- loadseg();
- sortoutmap();
- allocateload();
- data.word(kSetframes) = ax;
- ds = ax;
- dx = (0);
- loadseg();
- ds = data.word(kSetdat);
- dx = 0;
- cx = (64*128);
- al = 255;
- fillspace();
- loadseg();
- allocateload();
- data.word(kReel1) = ax;
- ds = ax;
- dx = 0;
- loadseg();
- allocateload();
- data.word(kReel2) = ax;
- ds = ax;
- dx = 0;
- loadseg();
- allocateload();
- data.word(kReel3) = ax;
- ds = ax;
- dx = 0;
- loadseg();
- allocateload();
- data.word(kReels) = ax;
- ds = ax;
- dx = 0;
- loadseg();
- allocateload();
- data.word(kPeople) = ax;
- ds = ax;
- dx = 0;
- loadseg();
- allocateload();
- data.word(kSetdesc) = ax;
- ds = ax;
- dx = 0;
- loadseg();
- allocateload();
- data.word(kBlockdesc) = ax;
- ds = ax;
- dx = 0;
- loadseg();
- allocateload();
- data.word(kRoomdesc) = ax;
- ds = ax;
- dx = 0;
- loadseg();
- allocateload();
- data.word(kFreeframes) = ax;
- ds = ax;
- dx = 0;
- loadseg();
- ds = data.word(kFreedat);
- dx = 0;
- cx = (16*80);
- al = 255;
- fillspace();
- loadseg();
- allocateload();
- data.word(kFreedesc) = ax;
- ds = ax;
- dx = (0);
- loadseg();
- closefile();
- findroominloc();
- deletetaken();
- setallchanges();
- autoappear();
- al = data.byte(kNewlocation);
- getroomdata();
- data.byte(kLastweapon) = -1;
+ data.byte(kReallocation) = room.realLocation;
+
+ loadRoomData(room, false);
+
+ findRoomInLoc();
+ deleteTaken();
+ setAllChanges();
+ autoAppear();
+// const Room &newRoom = g_roomData[data.byte(kNewlocation)];
+ bx = 0x7fff; // TODO: bx used to be set to the offset of newRoom
+ // It seems to be unused (like newRoom itself), but set it
+ // to an invalid value to catch any missed use of it.
+ // (The push/pop of bx below is likely also unnecessary)
+ data.byte(kLastweapon) = (uint8)-1;
data.byte(kMandead) = 0;
data.word(kLookcounter) = 160;
data.byte(kNewlocation) = 255;
data.byte(kLinepointer) = 254;
- ax = pop();
- if (al != 255) {
- data.byte(kManspath) = al;
+ if (room.b27 != 255) {
+ data.byte(kManspath) = room.b27;
push(bx);
- autosetwalk();
+ autoSetWalk();
bx = pop();
}
- findxyfrompath();
-}
-
-void DreamGenContext::fillspace() {
- memset(ds.ptr(dx, cx), al, cx);
+ findXYFromPath();
}
-void DreamGenContext::dealwithspecial(uint8 firstParam, uint8 secondParam) {
+void DreamGenContext::dealWithSpecial(uint8 firstParam, uint8 secondParam) {
uint8 type = firstParam - 220;
if (type == 0) {
- placesetobject(secondParam);
+ placeSetObject(secondParam);
data.byte(kHavedoneobs) = 1;
} else if (type == 1) {
- removesetobject(secondParam);
+ removeSetObject(secondParam);
data.byte(kHavedoneobs) = 1;
} else if (type == 2) {
- al = secondParam;
- placefreeobject();
+ placeFreeObject(secondParam);
data.byte(kHavedoneobs) = 1;
} else if (type == 3) {
- al = secondParam;
- removefreeobject();
+ removeFreeObject(secondParam);
data.byte(kHavedoneobs) = 1;
} else if (type == 4) {
- switchryanoff();
+ switchRyanOff();
} else if (type == 5) {
data.byte(kTurntoface) = secondParam;
data.byte(kFacing) = secondParam;
- switchryanon();
+ switchRyanOn();
} else if (type == 6) {
data.byte(kNewlocation) = secondParam;
} else {
- movemap(secondParam);
+ moveMap(secondParam);
}
}
-void DreamGenContext::plotreel() {
- Reel *reel = getreelstart();
- while (true) {
- if (reel->x < 220)
- break;
- if (reel->x == 255)
- break;
- dealwithspecial(reel->x, reel->y);
- ++data.word(kReelpointer);
+void DreamGenContext::plotReel(uint16 &reelPointer) {
+ Reel *reel = getReelStart(reelPointer);
+ while (reel->x >= 220 && reel->x != 255) {
+ dealWithSpecial(reel->x, reel->y);
+ ++reelPointer;
reel += 8;
}
for (size_t i = 0; i < 8; ++i) {
if (reel->frame() != 0xffff)
- showreelframe(reel);
+ showReelFrame(reel);
++reel;
}
- push(es);
- push(bx);
- soundonreels();
- bx = pop();
- es = pop();
+ soundOnReels(reelPointer);
}
-void DreamGenContext::crosshair() {
+void DreamBase::crosshair() {
uint8 frame;
if ((data.byte(kCommandtype) != 3) && (data.byte(kCommandtype) < 10)) {
frame = 9;
} else {
frame = 29;
}
- const Frame *src = (const Frame *)segRef(data.word(kIcons1)).ptr(0, 0);
- showframe(src, kZoomx + 24, kZoomy + 19, frame, 0);
+ showFrame(engine->icons1(), kZoomx + 24, kZoomy + 19, frame, 0);
}
-void DreamGenContext::deltextline() {
+void DreamGenContext::delTextLine() {
uint16 x = data.word(kTextaddressx);
uint16 y = data.word(kTextaddressy);
if (data.byte(kForeignrelease) != 0)
y -= 3;
- multiput(segRef(data.word(kBuffers)).ptr(kTextunder, 0), x, y, kUndertextsizex, kUndertextsizey);
+ multiPut(textUnder(), x, y, kUndertextsizex, kUndertextsizey);
}
-void DreamGenContext::commandonly() {
- commandonly(al);
+void DreamGenContext::commandOnly() {
+ commandOnly(al);
}
-void DreamGenContext::commandonly(uint8 command) {
- deltextline();
+void DreamGenContext::commandOnly(uint8 command) {
+ delTextLine();
uint16 index = command * 2;
- uint16 offset = kTextstart + segRef(data.word(kCommandtext)).word(index);
+ uint16 offset = kTextstart + getSegment(data.word(kCommandtext)).word(index);
uint16 y = data.word(kTextaddressy);
- const uint8 *string = segRef(data.word(kCommandtext)).ptr(offset, 0);
- printdirect(&string, data.word(kTextaddressx), &y, data.byte(kTextlen), (bool)(data.byte(kTextlen) & 1));
+ const uint8 *string = getSegment(data.word(kCommandtext)).ptr(offset, 0);
+ printDirect(&string, data.word(kTextaddressx), &y, data.byte(kTextlen), (bool)(data.byte(kTextlen) & 1));
data.byte(kNewtextline) = 1;
}
-void DreamGenContext::checkifperson() {
- flags._z = not checkifperson(al, ah);
+void DreamGenContext::checkIfPerson() {
+ flags._z = !checkIfPerson(al, ah);
}
-bool DreamGenContext::checkifperson(uint8 x, uint8 y) {
- People *people = (People *)segRef(data.word(kBuffers)).ptr(kPeoplelist, 0);
+bool DreamGenContext::checkIfPerson(uint8 x, uint8 y) {
+ People *people = (People *)getSegment(data.word(kBuffers)).ptr(kPeoplelist, 0);
for (size_t i = 0; i < 12; ++i, ++people) {
if (people->b4 == 255)
continue;
- data.word(kReelpointer) = people->reelPointer();
- Reel *reel = getreelstart();
+ Reel *reel = getReelStart(people->reelPointer());
if (reel->frame() == 0xffff)
++reel;
- const Frame *frame = getreelframeax(reel->frame());
+ const Frame *frame = getReelFrameAX(reel->frame());
uint8 xmin = reel->x + frame->x;
uint8 ymin = reel->y + frame->y;
uint8 xmax = xmin + frame->width;
@@ -1000,86 +1206,70 @@ bool DreamGenContext::checkifperson(uint8 x, uint8 y) {
if (y >= ymax)
continue;
data.word(kPersondata) = people->routinePointer();
- obname(people->b4, 5);
+ obName(people->b4, 5);
return true;
}
return false;
}
-void DreamGenContext::checkiffree() {
- flags._z = not checkiffree(al, ah);
+void DreamGenContext::checkIfFree() {
+ flags._z = !checkIfFree(al, ah);
}
-bool DreamGenContext::checkiffree(uint8 x, uint8 y) {
- const ObjPos *freeList = (const ObjPos *)segRef(data.word(kBuffers)).ptr(kFreelist, 80 * sizeof(ObjPos));
+bool DreamGenContext::checkIfFree(uint8 x, uint8 y) {
+ const ObjPos *freeList = (const ObjPos *)getSegment(data.word(kBuffers)).ptr(kFreelist, 80 * sizeof(ObjPos));
for (size_t i = 0; i < 80; ++i) {
const ObjPos *objPos = freeList + 79 - i;
- if (objPos->index == 0xff)
- continue;
- if (x < objPos->xMin)
- continue;
- if (x >= objPos->xMax)
+ if (objPos->index == 0xff || !objPos->contains(x,y))
continue;
- if (y < objPos->yMin)
- continue;
- if (y >= objPos->yMax)
- continue;
- obname(objPos->index, 2);
+ obName(objPos->index, 2);
return true;
}
return false;
}
-void DreamGenContext::checkifex() {
- flags._z = not checkifex(al, ah);
+void DreamGenContext::checkIfEx() {
+ flags._z = !checkIfEx(al, ah);
}
-bool DreamGenContext::checkifex(uint8 x, uint8 y) {
- const ObjPos *exList = (const ObjPos *)segRef(data.word(kBuffers)).ptr(kExlist, 100 * sizeof(ObjPos));
+bool DreamGenContext::checkIfEx(uint8 x, uint8 y) {
+ const ObjPos *exList = (const ObjPos *)getSegment(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)
+ if (objPos->index == 0xff || !objPos->contains(x,y))
continue;
- if (x >= objPos->xMax)
- continue;
- if (y < objPos->yMin)
- continue;
- if (y >= objPos->yMax)
- continue;
- obname(objPos->index, 4);
+ obName(objPos->index, 4);
return true;
}
return false;
}
-const uint8 *DreamGenContext::findobname(uint8 type, uint8 index) {
+const uint8 *DreamGenContext::findObName(uint8 type, uint8 index) {
if (type == 5) {
uint16 i = 64 * 2 * (index & 127);
- uint16 offset = segRef(data.word(kPeople)).word(kPersontxtdat + i) + kPersontext;
- return segRef(data.word(kPeople)).ptr(offset, 0);
+ uint16 offset = getSegment(data.word(kPeople)).word(kPersontxtdat + i) + kPersontext;
+ return getSegment(data.word(kPeople)).ptr(offset, 0);
} else if (type == 4) {
- uint16 offset = segRef(data.word(kExtras)).word(kExtextdat + index * 2) + kExtext;
- return segRef(data.word(kExtras)).ptr(offset, 0);
+ uint16 offset = getSegment(data.word(kExtras)).word(kExtextdat + index * 2) + kExtext;
+ return getSegment(data.word(kExtras)).ptr(offset, 0);
} else if (type == 2) {
- uint16 offset = segRef(data.word(kFreedesc)).word(kFreetextdat + index * 2) + kFreetext;
- return segRef(data.word(kFreedesc)).ptr(offset, 0);
+ uint16 offset = getSegment(data.word(kFreedesc)).word(kFreetextdat + index * 2) + kFreetext;
+ return getSegment(data.word(kFreedesc)).ptr(offset, 0);
} else if (type == 1) {
- uint16 offset = segRef(data.word(kSetdesc)).word(kSettextdat + index * 2) + kSettext;
- return segRef(data.word(kSetdesc)).ptr(offset, 0);
+ uint16 offset = getSegment(data.word(kSetdesc)).word(kSettextdat + index * 2) + kSettext;
+ return getSegment(data.word(kSetdesc)).ptr(offset, 0);
} else {
- uint16 offset = segRef(data.word(kBlockdesc)).word(kBlocktextdat + index * 2) + kBlocktext;
- return segRef(data.word(kBlockdesc)).ptr(offset, 0);
+ uint16 offset = getSegment(data.word(kBlockdesc)).word(kBlocktextdat + index * 2) + kBlocktext;
+ return getSegment(data.word(kBlockdesc)).ptr(offset, 0);
}
}
-void DreamGenContext::copyname() {
- copyname(ah, al, cs.ptr(di, 0));
+void DreamGenContext::copyName() {
+ copyName(ah, al, data.ptr(di, 0));
}
-void DreamGenContext::copyname(uint8 type, uint8 index, uint8 *dst) {
- const uint8 *src = findobname(type, index);
+void DreamGenContext::copyName(uint8 type, uint8 index, uint8 *dst) {
+ const uint8 *src = findObName(type, index);
size_t i;
for (i = 0; i < 28; ++i) {
char c = src[i];
@@ -1092,139 +1282,117 @@ void DreamGenContext::copyname(uint8 type, uint8 index, uint8 *dst) {
dst[i] = 0;
}
-void DreamGenContext::commandwithob() {
- commandwithob(al, bh, bl);
+void DreamGenContext::commandWithOb() {
+ commandWithOb(al, bh, bl);
}
-void DreamGenContext::commandwithob(uint8 command, uint8 type, uint8 index) {
+void DreamGenContext::commandWithOb(uint8 command, uint8 type, uint8 index) {
uint8 commandLine[64] = "OBJECT NAME ONE ";
- deltextline();
- uint16 commandText = kTextstart + segRef(data.word(kCommandtext)).word(command * 2);
+ delTextLine();
+ uint16 commandText = kTextstart + getSegment(data.word(kCommandtext)).word(command * 2);
uint8 textLen = data.byte(kTextlen);
{
- const uint8 *string = segRef(data.word(kCommandtext)).ptr(commandText, 0);
- printdirect(string, data.word(kTextaddressx), data.word(kTextaddressy), textLen, (bool)(textLen & 1));
+ const uint8 *string = getSegment(data.word(kCommandtext)).ptr(commandText, 0);
+ printDirect(string, data.word(kTextaddressx), data.word(kTextaddressy), textLen, (bool)(textLen & 1));
}
- copyname(type, index, commandLine);
+ copyName(type, index, commandLine);
uint16 x = data.word(kLastxpos);
if (command != 0)
x += 5;
- printdirect(commandLine, x, data.word(kTextaddressy), 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);
- showframe(frame, 192, 0, 19, 0);
-}
-
-void DreamGenContext::blocknametext() {
- commandwithob(0, data.byte(kCommandtype), data.byte(kCommand));
+void DreamGenContext::examineObText() {
+ commandWithOb(1, data.byte(kCommandtype), data.byte(kCommand));
}
-void DreamGenContext::personnametext() {
- commandwithob(2, data.byte(kCommandtype), data.byte(kCommand) & 127);
+void DreamGenContext::blockNameText() {
+ commandWithOb(0, data.byte(kCommandtype), data.byte(kCommand));
}
-void DreamGenContext::walktotext() {
- commandwithob(3, data.byte(kCommandtype), data.byte(kCommand));
+void DreamGenContext::personNameText() {
+ commandWithOb(2, data.byte(kCommandtype), data.byte(kCommand) & 127);
}
-void DreamGenContext::findormake() {
- uint8 b0 = al;
- uint8 b2 = cl;
- uint8 b3 = ch;
- findormake(b0, b2, b3);
+void DreamGenContext::walkToText() {
+ commandWithOb(3, data.byte(kCommandtype), data.byte(kCommand));
}
-void DreamGenContext::findormake(uint8 index, uint8 value, uint8 type) {
- Change *change = (Change *)segRef(data.word(kBuffers)).ptr(kListofchanges, sizeof(Change));
- while (true) {
- if (change->index == 0xff) {
- change->index = index;
- change->location = data.byte(kReallocation);
- change->value = value;
- change->type = type;
- return;
- }
- if ((index == change->index) && (data.byte(kReallocation) == change->location) && (type == change->type)) {
+void DreamBase::findOrMake(uint8 index, uint8 value, uint8 type) {
+ Change *change = (Change *)getSegment(data.word(kBuffers)).ptr(kListofchanges, sizeof(Change));
+ for (; change->index != 0xff; ++change) {
+ if (index == change->index && data.byte(kReallocation) == change->location && type == change->type) {
change->value = value;
return;
}
- ++change;
}
+
+ change->index = index;
+ change->location = data.byte(kReallocation);
+ change->value = value;
+ change->type = type;
}
-void DreamGenContext::setallchanges() {
- Change *change = (Change *)segRef(data.word(kBuffers)).ptr(kListofchanges, sizeof(Change));
- while (change->index != 0xff) {
+void DreamGenContext::setAllChanges() {
+ Change *change = (Change *)getSegment(data.word(kBuffers)).ptr(kListofchanges, sizeof(Change));
+ for (; change->index != 0xff; ++change)
if (change->location == data.byte(kReallocation))
- dochange(change->index, change->value, change->type);
- ++change;
- }
+ doChange(change->index, change->value, change->type);
}
-DynObject *DreamGenContext::getfreead(uint8 index) {
- return (DynObject *)segRef(data.word(kFreedat)).ptr(0, 0) + index;
+DynObject *DreamBase::getFreeAd(uint8 index) {
+ return (DynObject *)getSegment(data.word(kFreedat)).ptr(0, 0) + index;
}
-DynObject *DreamGenContext::getexad(uint8 index) {
- return (DynObject *)segRef(data.word(kExtras)).ptr(kExdata, 0) + index;
+DynObject *DreamBase::getExAd(uint8 index) {
+ return (DynObject *)getSegment(data.word(kExtras)).ptr(kExdata, 0) + index;
}
-DynObject *DreamGenContext::geteitheradCPP() {
+DynObject *DreamBase::getEitherAdCPP() {
if (data.byte(kObjecttype) == 4)
- return getexad(data.byte(kItemframe));
+ return getExAd(data.byte(kItemframe));
else
- return getfreead(data.byte(kItemframe));
+ return getFreeAd(data.byte(kItemframe));
}
-void *DreamGenContext::getanyad(uint8 *value1, uint8 *value2) {
+void *DreamBase::getAnyAd(uint8 *value1, uint8 *value2) {
if (data.byte(kObjecttype) == 4) {
- DynObject *exObject = getexad(data.byte(kCommand));
+ 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));
+ DynObject *freeObject = getFreeAd(data.byte(kCommand));
*value1 = freeObject->b7;
*value2 = freeObject->b8;
return freeObject;
} else {
- SetObject *setObject = getsetad(data.byte(kCommand));
+ SetObject *setObject = getSetAd(data.byte(kCommand));
*value1 = setObject->b4;
*value2 = setObject->priority;
return setObject;
}
}
-void *DreamGenContext::getanyaddir(uint8 index, uint8 flag) {
+void *DreamGenContext::getAnyAdDir(uint8 index, uint8 flag) {
if (flag == 4)
- return getexad(index);
+ return getExAd(index);
else if (flag == 2)
- return getfreead(index);
+ return getFreeAd(index);
else
- return getsetad(index);
-}
-
-SetObject *DreamGenContext::getsetad(uint8 index) {
- return (SetObject *)segRef(data.word(kSetdat)).ptr(0, 0) + index;
+ return getSetAd(index);
}
-void DreamGenContext::dochange() {
- dochange(al, cl, ch);
+SetObject *DreamBase::getSetAd(uint8 index) {
+ return (SetObject *)getSegment(data.word(kSetdat)).ptr(0, 0) + index;
}
-void DreamGenContext::dochange(uint8 index, uint8 value, uint8 type) {
+void DreamGenContext::doChange(uint8 index, uint8 value, uint8 type) {
if (type == 0) { //object
- getsetad(index)->mapad[0] = value;
- } else if (type == 1) { //freeobject
- DynObject *freeObject = getfreead(index);
+ getSetAd(index)->mapad[0] = value;
+ } else if (type == 1) { //freeObject
+ DynObject *freeObject = getFreeAd(index);
if (freeObject->mapad[0] == 0xff)
freeObject->mapad[0] = value;
} else { //path
@@ -1234,10 +1402,10 @@ void DreamGenContext::dochange(uint8 index, uint8 value, uint8 type) {
}
}
-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) {
+void DreamGenContext::deleteTaken() {
+ const DynObject *extraObjects = (const DynObject *)getSegment(data.word(kExtras)).ptr(kExdata, 0);
+ DynObject *freeObjects = (DynObject *)getSegment(data.word(kFreedat)).ptr(0, 0);
+ for (size_t i = 0; i < kNumexobjects; ++i) {
uint8 location = extraObjects[i].initialLocation;
if (location == data.byte(kReallocation)) {
uint8 index = extraObjects[i].index;
@@ -1246,9 +1414,9 @@ void DreamGenContext::deletetaken() {
}
}
-void DreamGenContext::getexpos() {
+void DreamGenContext::getExPos() {
es = data.word(kExtras);
- const DynObject *objects = (const DynObject *)segRef(data.word(kExtras)).ptr(kExdata, sizeof(DynObject));
+ const DynObject *objects = (const DynObject *)getSegment(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;
@@ -1260,75 +1428,75 @@ void DreamGenContext::getexpos() {
di = kExdata + kNumexobjects * sizeof(DynObject);
}
-void DreamGenContext::placesetobject() {
- placesetobject(al);
+void DreamGenContext::placeSetObject() {
+ placeSetObject(al);
}
-void DreamGenContext::placesetobject(uint8 index) {
- findormake(index, 0, 0);
- getsetad(index)->mapad[0] = 0;
+void DreamGenContext::placeSetObject(uint8 index) {
+ findOrMake(index, 0, 0);
+ getSetAd(index)->mapad[0] = 0;
}
-void DreamGenContext::removesetobject() {
- removesetobject(al);
+void DreamGenContext::removeSetObject() {
+ removeSetObject(al);
}
-void DreamGenContext::removesetobject(uint8 index) {
- findormake(index, 0xff, 0);
- getsetad(index)->mapad[0] = 0xff;
+void DreamGenContext::removeSetObject(uint8 index) {
+ findOrMake(index, 0xff, 0);
+ getSetAd(index)->mapad[0] = 0xff;
}
-void DreamGenContext::finishedwalking() {
- flags._z = finishedwalkingCPP();
+void DreamGenContext::finishedWalking() {
+ flags._z = finishedWalkingCPP();
}
-bool DreamGenContext::finishedwalkingCPP() {
+bool DreamGenContext::finishedWalkingCPP() {
return (data.byte(kLinepointer) == 254) && (data.byte(kFacing) == data.byte(kTurntoface));
}
-void DreamGenContext::getflagunderp() {
+void DreamGenContext::getFlagUnderP() {
uint8 flag, flagEx;
- getflagunderp(&flag, &flagEx);
+ getFlagUnderP(&flag, &flagEx);
cl = flag;
ch = flagEx;
}
-void DreamGenContext::getflagunderp(uint8 *flag, uint8 *flagEx) {
+void DreamGenContext::getFlagUnderP(uint8 *flag, uint8 *flagEx) {
uint8 type, flagX, flagY;
- checkone(data.word(kMousex) - data.word(kMapadx), data.word(kMousey) - data.word(kMapady), flag, flagEx, &type, &flagX, &flagY);
+ checkOne(data.word(kMousex) - data.word(kMapadx), data.word(kMousey) - data.word(kMapady), flag, flagEx, &type, &flagX, &flagY);
cl = data.byte(kLastflag) = *flag;
ch = data.byte(kLastflagex) = *flagEx;
}
-void DreamGenContext::walkandexamine() {
- if (! finishedwalkingCPP())
+void DreamGenContext::walkAndExamine() {
+ if (!finishedWalkingCPP())
return;
data.byte(kCommandtype) = data.byte(kWalkexamtype);
data.byte(kCommand) = data.byte(kWalkexamnum);
data.byte(kWalkandexam) = 0;
if (data.byte(kCommandtype) != 5)
- examineob();
+ examineOb();
}
-void DreamGenContext::obname() {
- obname(al, ah);
+void DreamGenContext::obName() {
+ obName(al, ah);
}
-void DreamGenContext::obname(uint8 command, uint8 commandType) {
+void DreamGenContext::obName(uint8 command, uint8 commandType) {
if (data.byte(kReasseschanges) == 0) {
if ((commandType == data.byte(kCommandtype)) && (command == data.byte(kCommand))) {
if (data.byte(kWalkandexam) == 1) {
- walkandexamine();
+ walkAndExamine();
return;
} else if (data.word(kMousebutton) == 0)
return;
else if ((data.byte(kCommandtype) == 3) && (data.byte(kLastflag) < 2))
return;
else if ((data.byte(kManspath) != data.byte(kPointerspath)) || (data.byte(kCommandtype) == 3)) {
- setwalk();
+ setWalk();
data.byte(kReasseschanges) = 1;
return;
- } else if (! finishedwalkingCPP())
+ } else if (! finishedWalkingCPP())
return;
else if (data.byte(kCommandtype) == 5) {
if (data.word(kWatchingtime) == 0)
@@ -1336,7 +1504,7 @@ void DreamGenContext::obname(uint8 command, uint8 commandType) {
return;
} else {
if (data.word(kWatchingtime) == 0)
- examineob();
+ examineOb();
return;
}
}
@@ -1346,56 +1514,56 @@ void DreamGenContext::obname(uint8 command, uint8 commandType) {
data.byte(kCommand) = command;
data.byte(kCommandtype) = commandType;
if ((data.byte(kLinepointer) != 254) || (data.word(kWatchingtime) != 0) || (data.byte(kFacing) != data.byte(kTurntoface))) {
- blocknametext();
+ blockNameText();
return;
} else if (data.byte(kCommandtype) != 3) {
if (data.byte(kManspath) != data.byte(kPointerspath)) {
- walktotext();
+ walkToText();
return;
} else if (data.byte(kCommandtype) == 3) {
- blocknametext();
+ blockNameText();
return;
} else if (data.byte(kCommandtype) == 5) {
- personnametext();
+ personNameText();
return;
} else {
- examineobtext();
+ examineObText();
return;
}
}
if (data.byte(kManspath) == data.byte(kPointerspath)) {
uint8 flag, flagEx, type, flagX, flagY;
- checkone(data.byte(kRyanx) + 12, data.byte(kRyany) + 12, &flag, &flagEx, &type, &flagX, &flagY);
+ checkOne(data.byte(kRyanx) + 12, data.byte(kRyany) + 12, &flag, &flagEx, &type, &flagX, &flagY);
if (flag < 2) {
- blocknametext();
+ blockNameText();
return;
}
}
- getflagunderp();
+ getFlagUnderP();
if (data.byte(kLastflag) < 2) {
- blocknametext();
+ blockNameText();
return;
} else if (data.byte(kLastflag) >= 128) {
- blocknametext();
+ blockNameText();
return;
} else {
- walktotext();
+ walkToText();
return;
}
}
-void DreamGenContext::delpointer() {
+void DreamBase::delPointer() {
if (data.word(kOldpointerx) == 0xffff)
return;
data.word(kDelherex) = data.word(kOldpointerx);
data.word(kDelherey) = data.word(kOldpointery);
data.byte(kDelxs) = data.byte(kPointerxs);
data.byte(kDelys) = data.byte(kPointerys);
- multiput(segRef(data.word(kBuffers)).ptr(kPointerback, 0), data.word(kDelherex), data.word(kDelherey), data.byte(kPointerxs), data.byte(kPointerys));
+ multiPut(getSegment(data.word(kBuffers)).ptr(kPointerback, 0), data.word(kDelherex), data.word(kDelherey), data.byte(kPointerxs), data.byte(kPointerys));
}
-void DreamGenContext::showblink() {
+void DreamBase::showBlink() {
if (data.byte(kManisoffscreen) == 1)
return;
++data.byte(kBlinkcount);
@@ -1413,184 +1581,41 @@ void DreamGenContext::showblink() {
blinkFrame = 6;
static const uint8 blinkTab[] = { 16,18,18,17,16,16,16 };
uint8 width, height;
- showframe((Frame *)segRef(data.word(kIcons1)).ptr(0, 0), 44, 32, blinkTab[blinkFrame], 0, &width, &height);
+ showFrame(engine->icons1(), 44, 32, blinkTab[blinkFrame], 0, &width, &height);
}
-void DreamGenContext::dumpblink() {
+void DreamBase::dumpBlink() {
if (data.byte(kShadeson) != 0)
return;
if (data.byte(kBlinkcount) != 0)
return;
if (data.byte(kBlinkframe) >= 6)
return;
- multidump(44, 32, 16, 12);
+ multiDump(44, 32, 16, 12);
}
-void DreamGenContext::dumppointer() {
- dumpblink();
- multidump(data.word(kDelherex), data.word(kDelherey), data.byte(kDelxs), data.byte(kDelys));
+void DreamBase::dumpPointer() {
+ dumpBlink();
+ multiDump(data.word(kDelherex), data.word(kDelherey), data.byte(kDelxs), data.byte(kDelys));
if ((data.word(kOldpointerx) != data.word(kDelherex)) || (data.word(kOldpointery) != data.word(kDelherey)))
- multidump(data.word(kOldpointerx), data.word(kOldpointery), data.byte(kPointerxs), data.byte(kPointerys));
-}
-
-void DreamGenContext::checkcoords() {
- checkcoords((const RectWithCallback *)cs.ptr(bx, 0));
+ multiDump(data.word(kOldpointerx), data.word(kOldpointery), data.byte(kPointerxs), data.byte(kPointerys));
}
-void DreamGenContext::checkcoords(const RectWithCallback *rectWithCallbacks) {
+void DreamGenContext::checkCoords(const RectWithCallback *rectWithCallbacks) {
if (data.byte(kNewlocation) != 0xff)
return;
- const RectWithCallback *rectWithCallback = rectWithCallbacks;
- while (rectWithCallback->xMin() != 0xffff) {
- if (rectWithCallback->contains(data.word(kMousex), data.word(kMousey))) {
- uint16 callback = rectWithCallback->callback();
-
- // common
- if(callback == addr_blank)
- blank();
- else if(callback == addr_getbackfromob)
- getbackfromob();
- else if(callback == addr_incryanpage)
- incryanpage();
- else if(callback == addr_getback1)
- getback1();
- else if(callback == addr_quitkey)
- quitkey();
- else if(callback == addr_dosreturn)
- dosreturn();
- else if(callback == addr_getbacktoops)
- getbacktoops();
- else if(callback == addr_selectslot)
- selectslot();
- // examlist
- else if(callback == addr_useobject)
- useobject();
- else if(callback == addr_selectopenob)
- selectopenob();
- else if(callback == addr_setpickup)
- setpickup();
- else if(callback == addr_examinventory)
- examinventory();
- // invlist1
- else if(callback == addr_dropobject)
- dropobject();
- else if(callback == addr_useopened)
- useopened();
- else if(callback == addr_setpickup)
- setpickup();
- else if(callback == addr_intoinv)
- intoinv();
- // withlist1
- else if(callback == addr_selectob)
- selectob();
- // talklist
- else if(callback == addr_moretalk)
- moretalk();
- // quitlist
- // destlist
- else if(callback == addr_nextdest)
- nextdest();
- else if(callback == addr_lastdest)
- lastdest();
- else if(callback == addr_lookatplace)
- lookatplace();
- else if(callback == addr_destselect)
- destselect();
- // keypadlist
- else if(callback == addr_buttonone)
- buttonone();
- else if(callback == addr_buttontwo)
- buttontwo();
- else if(callback == addr_buttonthree)
- buttonthree();
- else if(callback == addr_buttonfour)
- buttonfour();
- else if(callback == addr_buttonfive)
- buttonfive();
- else if(callback == addr_buttonsix)
- buttonsix();
- else if(callback == addr_buttonseven)
- buttonseven();
- else if(callback == addr_buttoneight)
- buttoneight();
- else if(callback == addr_buttonnine)
- buttonnine();
- else if(callback == addr_buttonnought)
- buttonnought();
- else if(callback == addr_buttonenter)
- buttonenter();
- // menulist
- // folderlist
- else if(callback == addr_nextfolder)
- nextfolder();
- else if(callback == addr_lastfolder)
- lastfolder();
- // symbollist
- else if(callback == addr_quitsymbol)
- quitsymbol();
- else if(callback == addr_settopleft)
- settopleft();
- else if(callback == addr_settopright)
- settopright();
- else if(callback == addr_setbotleft)
- setbotleft();
- else if(callback == addr_setbotright)
- setbotright();
- // diarylist
- else if(callback == addr_diarykeyn)
- diarykeyn();
- else if(callback == addr_diarykeyp)
- diarykeyp();
- else if(callback == addr_quitkey)
- quitkey();
- // opslist
- else if(callback == addr_getbackfromops)
- getbackfromops();
- else if(callback == addr_discops)
- discops();
- // discopslist
- else if(callback == addr_loadgame)
- loadgame();
- else if(callback == addr_savegame)
- savegame();
- // mainlist, mainlist2
- else if(callback == addr_look)
- look();
- else if(callback == addr_inventory)
- inventory();
- else if(callback == addr_zoomonoff)
- zoomonoff();
- else if(callback == addr_saveload)
- saveload();
- else if(callback == addr_madmanrun)
- madmanrun();
- else if(callback == addr_identifyob)
- identifyob();
- // decidelist
- else if(callback == addr_newgame)
- newgame();
- else if(callback == addr_loadold)
- loadold();
- // loadlist
- else if(callback == addr_actualload)
- actualload();
- // savelist
- else if(callback == addr_actualsave)
- actualsave();
- else {
- debug("__dispatch_call remaining in checkcoords! %d", (int)callback);
- __dispatch_call(callback);
- }
+ const RectWithCallback *r;
+ for (r = rectWithCallbacks; r->_xMin != 0xffff; ++r) {
+ if (r->contains(data.word(kMousex), data.word(kMousey))) {
+ (this->*(r->_callback))();
return;
}
- ++rectWithCallback;
}
}
-void DreamGenContext::showpointer() {
- showblink();
- const Frame *icons1 = ((const Frame *)segRef(data.word(kIcons1)).ptr(0, 0));
+void DreamBase::showPointer() {
+ showBlink();
uint16 x = data.word(kMousex);
data.word(kOldpointerx) = data.word(kMousex);
uint16 y = data.word(kMousey);
@@ -1598,9 +1623,9 @@ void DreamGenContext::showpointer() {
if (data.byte(kPickup) == 1) {
const Frame *frames;
if (data.byte(kObjecttype) != 4)
- frames = (const Frame *)segRef(data.word(kFreeframes)).ptr(0, 0);
+ frames = (const Frame *)getSegment(data.word(kFreeframes)).ptr(0, 0);
else
- frames = (const Frame *)segRef(data.word(kExtras)).ptr(0, 0);
+ frames = (const Frame *)getSegment(data.word(kExtras)).ptr(0, 0);
const Frame *frame = frames + (3 * data.byte(kItemframe) + 1);
uint8 width = frame->width;
uint8 height = frame->height;
@@ -1614,11 +1639,11 @@ void DreamGenContext::showpointer() {
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);
+ multiGet(getSegment(data.word(kBuffers)).ptr(kPointerback, 0), xMin, yMin, width, height);
+ showFrame(frames, x, y, 3 * data.byte(kItemframe) + 1, 128);
+ showFrame(engine->icons1(), x, y, 3, 128);
} else {
- const Frame *frame = icons1 + (data.byte(kPointerframe) + 20);
+ const Frame *frame = engine->icons1() + (data.byte(kPointerframe) + 20);
uint8 width = frame->width;
uint8 height = frame->height;
if (width < 12)
@@ -1627,12 +1652,12 @@ void DreamGenContext::showpointer() {
height = 12;
data.byte(kPointerxs) = width;
data.byte(kPointerys) = height;
- multiget(segRef(data.word(kBuffers)).ptr(kPointerback, 0), x, y, width, height);
- showframe(icons1, x, y, data.byte(kPointerframe) + 20, 0);
+ multiGet(getSegment(data.word(kBuffers)).ptr(kPointerback, 0), x, y, width, height);
+ showFrame(engine->icons1(), x, y, data.byte(kPointerframe) + 20, 0);
}
}
-void DreamGenContext::animpointer() {
+void DreamGenContext::animPointer() {
if (data.byte(kPointermode) == 2) {
data.byte(kPointerframe) = 0;
@@ -1662,7 +1687,7 @@ void DreamGenContext::animpointer() {
if (data.byte(kPointerfirstpath) == 0)
return;
uint8 flag, flagEx;
- getflagunderp(&flag, &flagEx);
+ getFlagUnderP(&flag, &flagEx);
if (flag < 2)
return;
if (flag >= 128)
@@ -1686,36 +1711,14 @@ 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::printMessage() {
+ printMessage(di, bx, al, dl, (bool)(dl & 1));
}
-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::printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered) {
+ uint16 offset = kTextstart + getSegment(data.word(kCommandtext)).word(index * 2);
+ const uint8 *string = getSegment(data.word(kCommandtext)).ptr(offset, 0);
+ printDirect(&string, x, &y, maxWidth, centered);
}
void DreamGenContext::compare() {
@@ -1724,18 +1727,18 @@ void DreamGenContext::compare() {
}
bool DreamGenContext::compare(uint8 index, uint8 flag, const char id[4]) {
- void *ptr = getanyaddir(index, flag);
+ 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')
+ 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);
+bool DreamGenContext::isItDescribed(const ObjPos *pos) {
+ uint16 offset = getSegment(data.word(kSetdesc)).word(kSettextdat + pos->index * 2);
+ uint8 result = getSegment(data.word(kSetdesc)).byte(kSettext + offset);
return result != 0;
}
@@ -1747,85 +1750,58 @@ bool DreamGenContext::isCD() {
return (data.byte(kSpeechloaded) == 1);
}
-void DreamGenContext::checkifset() {
- flags._z = !checkifset(al, ah);
+void DreamGenContext::showIcon() {
+ if (data.byte(kReallocation) < 50) {
+ showPanel();
+ showMan();
+ roomName();
+ panelIcons1();
+ zoomIcon();
+ } else {
+ Frame *tempSprites = (Frame *)getSegment(data.word(kTempsprites)).ptr(0, 0);
+ showFrame(tempSprites, 72, 2, 45, 0);
+ showFrame(tempSprites, 72+47, 2, 46, 0);
+ showFrame(tempSprites, 69-10, 21, 49, 0);
+ showFrame(tempSprites, 160+88, 2, 45, 4 & 0xfe);
+ showFrame(tempSprites, 160+43, 2, 46, 4 & 0xfe);
+ showFrame(tempSprites, 160+101, 21, 49, 4 & 0xfe);
+ middlePanel();
+ }
+}
+
+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);
+bool DreamGenContext::checkIfSet(uint8 x, uint8 y) {
+ const ObjPos *setList = (const ObjPos *)getSegment(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)
+ if (pos->index == 0xff || !pos->contains(x,y))
continue;
- if (y >= pos->yMax)
+ if (! pixelCheckSet(pos, x, y))
continue;
- if (! pixelcheckset(pos, x, y))
+ if (! isItDescribed(pos))
continue;
- if (! isitdescribed(pos))
- continue;
- obname(pos->index, 1);
+ 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 DreamBase::showRyanPage() {
+ showFrame(engine->icons1(), kInventx + 167, kInventy - 12, 12, 0);
+ showFrame(engine->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() {
+ findAllRyan(es.ptr(di, 60));
}
-void DreamGenContext::findallryan(uint8 *inv) {
+void DreamGenContext::findAllRyan(uint8 *inv) {
memset(inv, 0xff, 60);
for (size_t i = 0; i < kNumexobjects; ++i) {
- DynObject *extra = getexad(i);
+ DynObject *extra = getExAd(i);
if (extra->mapad[0] != 4)
continue;
if (extra->mapad[1] != 0xff)
@@ -1837,78 +1813,82 @@ void DreamGenContext::findallryan(uint8 *inv) {
}
}
-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);
- }
+void DreamGenContext::hangOn() {
+ hangOn(cx);
+}
+
+void DreamBase::hangOn(uint16 frameCount) {
+ while (frameCount) {
+ vSync();
+ --frameCount;
+ if (quitRequested())
+ break;
}
- showryanpage();
}
-void DreamGenContext::hangon() {
- hangon(cx);
+void DreamGenContext::hangOnW() {
+ hangOnW(cx);
}
-void DreamGenContext::hangon(uint16 frameCount) {
+void DreamGenContext::hangOnW(uint16 frameCount) {
while (frameCount) {
- vsync();
+ delPointer();
+ readMouse();
+ animPointer();
+ showPointer();
+ vSync();
+ dumpPointer();
--frameCount;
- if (data.byte(kQuitrequested))
+ if (quitRequested())
break;
}
}
-void DreamGenContext::hangonp() {
- hangonp(cx);
+void DreamGenContext::hangOnP() {
+ hangOnP(cx);
}
-void DreamGenContext::hangonp(uint16 count) {
+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))
+ readMouse();
+ animPointer();
+ showPointer();
+ vSync();
+ dumpPointer();
+
+ count *= 3;
+ for (uint16 i = 0; i < count; ++i) {
+ delPointer();
+ readMouse();
+ animPointer();
+ showPointer();
+ vSync();
+ dumpPointer();
+ if (quitRequested())
break;
- if (data.word(kMousebutton) == 0)
- continue;
- if (data.word(kMousebutton) != data.word(kOldbutton))
+ if (data.word(kMousebutton) != 0 && data.word(kMousebutton) != data.word(kOldbutton))
break;
}
- delpointer();
+ delPointer();
data.byte(kPointerframe) = pointerFrame;
data.byte(kPickup) = pickup;
data.byte(kPointermode) = 0;
}
-void DreamGenContext::findnextcolon() {
+void DreamGenContext::findNextColon() {
uint8 *initialString = es.ptr(si, 0);
uint8 *string = initialString;
- al = findnextcolon(&string);
+ al = findNextColon(&string);
si += (string - initialString);
}
-uint8 DreamGenContext::findnextcolon(uint8 **string) {
+uint8 DreamGenContext::findNextColon(uint8 **string) {
uint8 c;
do {
c = **string;
@@ -1917,15 +1897,2424 @@ uint8 DreamGenContext::findnextcolon(uint8 **string) {
return c;
}
-uint8 *DreamGenContext::getobtextstartCPP() {
+uint8 *DreamGenContext::getObTextStartCPP() {
push(es);
push(si);
- getobtextstart();
+ getObTextStart();
uint8 *result = es.ptr(si, 0);
si = pop();
es = pop();
return result;
}
-} /*namespace dreamgen */
+void DreamGenContext::enterSymbol() {
+ data.byte(kManisoffscreen) = 1;
+ getRidOfReels();
+ loadIntoTemp("DREAMWEB.G12"); // symbol graphics
+ data.byte(kSymboltopx) = 24;
+ data.byte(kSymboltopdir) = 0;
+ data.byte(kSymbolbotx) = 24;
+ data.byte(kSymbolbotdir) = 0;
+ redrawMainScrn();
+ showSymbol();
+ underTextLine();
+ workToScreenM();
+ data.byte(kGetback) = 0;
+ do {
+ delPointer();
+ updateSymbolTop();
+ updateSymbolBot();
+ showSymbol();
+ readMouse();
+ showPointer();
+ vSync();
+ dumpPointer();
+ dumpTextLine();
+ dumpSymbol();
+ RectWithCallback symbolList[] = {
+ { kSymbolx+40,kSymbolx+64,kSymboly+2,kSymboly+16,&DreamGenContext::quitSymbol },
+ { kSymbolx,kSymbolx+52,kSymboly+20,kSymboly+50,&DreamGenContext::setTopLeft },
+ { kSymbolx+52,kSymbolx+104,kSymboly+20,kSymboly+50,&DreamGenContext::setTopRight },
+ { kSymbolx,kSymbolx+52,kSymboly+50,kSymboly+80,&DreamGenContext::setBotLeft },
+ { kSymbolx+52,kSymbolx+104,kSymboly+50,kSymboly+80,&DreamGenContext::setBotRight },
+ { 0,320,0,200,&DreamGenContext::blank },
+ { 0xFFFF,0,0,0,0 }
+ };
+ checkCoords(symbolList);
+ } while ((data.byte(kGetback) == 0) && !quitRequested());
+ if ((data.byte(kSymbolbotnum) == 3) && (data.byte(kSymboltopnum) == 5)) {
+ removeSetObject(43);
+ placeSetObject(46);
+ turnAnyPathOn(0, data.byte(kRoomnum) + 12);
+ data.byte(kManisoffscreen) = 0;
+ redrawMainScrn();
+ getRidOfTemp();
+ restoreReels();
+ workToScreenM();
+ playChannel1(13);
+ } else {
+ removeSetObject(46);
+ placeSetObject(43);
+ turnAnyPathOff(0, data.byte(kRoomnum) + 12);
+ data.byte(kManisoffscreen) = 0;
+ redrawMainScrn();
+ getRidOfTemp();
+ restoreReels();
+ workToScreenM();
+ }
+}
+
+void DreamGenContext::zoomOnOff() {
+ if (data.word(kWatchingtime) != 0 || data.byte(kPointermode) == 2) {
+ blank();
+ return;
+ }
+
+ if (data.byte(kCommandtype) != 222) {
+ data.byte(kCommandtype) = 222;
+ commandOnly(39);
+ }
+
+ if (!(data.word(kMousebutton) & 1) || (data.word(kMousebutton) == data.word(kOldbutton)))
+ return;
+
+ data.byte(kZoomon) ^= 1;
+ createPanel();
+ data.byte(kNewobs) = 0;
+ drawFloor();
+ printSprites();
+ reelsOnScreen();
+ showIcon();
+ getUnderZoom();
+ underTextLine();
+ commandOnly(39);
+ readMouse();
+ workToScreenM();
+}
+
+void DreamGenContext::sortOutMap() {
+ const uint8 *src = workspace();
+ uint8 *dst = (uint8 *)getSegment(data.word(kMapdata)).ptr(0, 0);
+ for (uint16 y = 0; y < kMaplength; ++y) {
+ memcpy(dst, src, kMapwidth);
+ dst += kMapwidth;
+ src += 132;
+ }
+}
+
+void DreamGenContext::showCity() {
+ clearWork();
+ showFrame(tempGraphics(), 57, 32, 0, 0);
+ showFrame(tempGraphics(), 120+57, 32, 1, 0);
+}
+
+void DreamGenContext::mainScreen() {
+ data.byte(kInmaparea) = 0;
+ if (data.byte(kWatchon) == 1) {
+ RectWithCallback mainList[] = {
+ { 44,70,32,46,&DreamGenContext::look },
+ { 0,50,0,180,&DreamGenContext::inventory },
+ { 226,244,10,26,&DreamGenContext::zoomOnOff },
+ { 226,244,26,40,&DreamGenContext::saveLoad },
+ { 240,260,100,124,&DreamGenContext::madmanRun },
+ { 0,320,0,200,&DreamGenContext::identifyOb },
+ { 0xFFFF,0,0,0,0 }
+ };
+ checkCoords(mainList);
+ } else {
+ RectWithCallback mainList2[] = {
+ { 44,70,32,46,&DreamGenContext::look },
+ { 0,50,0,180,&DreamGenContext::inventory },
+ { 226+48,244+48,10,26,&DreamGenContext::zoomOnOff },
+ { 226+48,244+48,26,40,&DreamGenContext::saveLoad },
+ { 240,260,100,124,&DreamGenContext::madmanRun },
+ { 0,320,0,200,&DreamGenContext::identifyOb },
+ { 0xFFFF,0,0,0,0 }
+ };
+ checkCoords(mainList2);
+ }
+
+ if (data.byte(kWalkandexam) != 0)
+ walkAndExamine();
+}
+
+void DreamBase::showWatch() {
+ if (data.byte(kWatchon)) {
+ showFrame(engine->icons1(), 250, 1, 6, 0);
+ showTime();
+ }
+}
+
+void DreamGenContext::dumpWatch() {
+ if (data.byte(kWatchdump) != 1)
+ return;
+ multiDump(256, 21, 40, 12);
+ data.byte(kWatchdump) = 0;
+}
+
+void DreamBase::showTime() {
+ if (data.byte(kWatchon) == 0)
+ return;
+ Frame *charset = (Frame *)getSegment(data.word(kCharset1)).ptr(0, 0);
+
+ int seconds = data.byte(kSecondcount);
+ int minutes = data.byte(kMinutecount);
+ int hours = data.byte(kHourcount);
+
+ showFrame(charset, 282+5, 21, 91*3+10 + seconds / 10, 0);
+ showFrame(charset, 282+9, 21, 91*3+10 + seconds % 10, 0);
+
+ showFrame(charset, 270+5, 21, 91*3 + minutes / 10, 0);
+ showFrame(charset, 270+11, 21, 91*3 + minutes % 10, 0);
+
+ showFrame(charset, 256+5, 21, 91*3 + hours / 10, 0);
+ showFrame(charset, 256+11, 21, 91*3 + hours % 10, 0);
+
+ showFrame(charset, 267+5, 21, 91*3+20, 0);
+}
+
+void DreamGenContext::watchCount() {
+ if (data.byte(kWatchon) == 0)
+ return;
+ ++data.byte(kTimercount);
+ if (data.byte(kTimercount) == 9) {
+ showFrame((Frame *)getSegment(data.word(kCharset1)).ptr(0, 0), 268+4, 21, 91*3+21, 0);
+ data.byte(kWatchdump) = 1;
+ } else if (data.byte(kTimercount) == 18) {
+ data.byte(kTimercount) = 0;
+ ++data.byte(kSecondcount);
+ if (data.byte(kSecondcount) == 60) {
+ data.byte(kSecondcount) = 0;
+ ++data.byte(kMinutecount);
+ if (data.byte(kMinutecount) == 60) {
+ data.byte(kMinutecount) = 0;
+ ++data.byte(kHourcount);
+ if (data.byte(kHourcount) == 24)
+ data.byte(kHourcount) = 0;
+ }
+ }
+ showTime();
+ data.byte(kWatchdump) = 1;
+ }
+}
+
+void DreamGenContext::roomName() {
+ printMessage(88, 18, 53, 240, false);
+ uint16 textIndex = data.byte(kRoomnum);
+ if (textIndex >= 32)
+ textIndex -= 32;
+ data.word(kLinespacing) = 7;
+ uint8 maxWidth = (data.byte(kWatchon) == 1) ? 120 : 160;
+ uint16 descOffset = getSegment(data.word(kRoomdesc)).word(kIntextdat + textIndex * 2);
+ const uint8 *string = getSegment(data.word(kRoomdesc)).ptr(kIntext + descOffset, 0);
+ printDirect(string, 88, 25, maxWidth, false);
+ data.word(kLinespacing) = 10;
+ useCharset1();
+}
+
+void DreamGenContext::zoomIcon() {
+ if (data.byte(kZoomon) == 0)
+ return;
+ showFrame(engine->icons1(), kZoomx, kZoomy-1, 8, 0);
+}
+
+void DreamGenContext::loadRoom() {
+ data.byte(kRoomloaded) = 1;
+ data.word(kTimecount) = 0;
+ data.word(kMaintimer) = 0;
+ data.word(kMapoffsetx) = 104;
+ data.word(kMapoffsety) = 38;
+ data.word(kTextaddressx) = 13;
+ data.word(kTextaddressy) = 182;
+ data.byte(kTextlen) = 240;
+ data.byte(kLocation) = data.byte(kNewlocation);
+ const Room &room = g_roomData[data.byte(kNewlocation)];
+ startLoading(room);
+ loadRoomsSample();
+ switchRyanOn();
+ drawFlags();
+ getDimension();
+}
+
+void DreamGenContext::readSetData() {
+ data.word(kCharset1) = standardLoad("DREAMWEB.C00");
+
+ void *icons1Buffer = standardLoadCPP("DREAMWEB.G00");
+ engine->setIcons1(icons1Buffer);
+ void *icons2Buffer = standardLoadCPP("DREAMWEB.G01");
+ engine->setIcons2(icons2Buffer);
+
+ data.word(kMainsprites) = standardLoad("DREAMWEB.S00");
+ data.word(kPuzzletext) = standardLoad("DREAMWEB.T80");
+ data.word(kCommandtext) = standardLoad("DREAMWEB.T84");
+ useCharset1();
+
+ // FIXME: Why is this commented out?
+ //engine->openFile("DREAMWEB.VOL");
+ //uint8 *volumeTab = getSegment(data.word(kSoundbuffer)).ptr(16384, 0);
+ //engine->readFromFile(volumeTab, 2048-256);
+ //engine->closeFile();
+}
+
+Frame * DreamBase::tempGraphics() {
+ return (Frame *)getSegment(data.word(kTempgraphics)).ptr(0, 0);
+}
+
+Frame * DreamBase::tempGraphics2() {
+ return (Frame *)getSegment(data.word(kTempgraphics2)).ptr(0, 0);
+}
+
+Frame * DreamBase::tempGraphics3() {
+ return (Frame *)getSegment(data.word(kTempgraphics3)).ptr(0, 0);
+}
+
+void DreamGenContext::findRoomInLoc() {
+ uint8 x = data.byte(kMapx) / 11;
+ uint8 y = data.byte(kMapy) / 10;
+ uint8 roomNum = y * 6 + x;
+ data.byte(kRoomnum) = roomNum;
+}
+
+void DreamGenContext::autoLook() {
+ if ((data.word(kMousex) != data.word(kOldx)) || (data.word(kMousey) != data.word(kOldy))) {
+ data.word(kLookcounter) = 1000;
+ return;
+ }
+
+ --data.word(kLookcounter);
+ if (data.word(kLookcounter))
+ return;
+ if (data.word(kWatchingtime))
+ return;
+ doLook();
+}
+
+void DreamGenContext::look() {
+ if (data.word(kWatchingtime) || (data.byte(kPointermode) == 2)) {
+ blank();
+ return;
+ }
+ if (data.byte(kCommandtype) != 241) {
+ data.byte(kCommandtype) = 241;
+ commandOnly(25);
+ }
+ if ((data.word(kMousebutton) == 1) && (data.word(kMousebutton) != data.word(kOldbutton)))
+ doLook();
+}
+
+void DreamGenContext::doLook() {
+ createPanel();
+ showIcon();
+ underTextLine();
+ workToScreenM();
+ data.byte(kCommandtype) = 255;
+ dumpTextLine();
+ uint8 index = data.byte(kRoomnum) & 31;
+ uint16 offset = getSegment(data.word(kRoomdesc)).word(kIntextdat + index * 2);
+ uint8 *string = getSegment(data.word(kRoomdesc)).ptr(kIntext, 0) + offset;
+ findNextColon(&string);
+ uint16 x;
+ if (data.byte(kReallocation) < 50)
+ x = 66;
+ else
+ x = 40;
+ if (printSlow(string, x, 80, 241, true) != 1)
+ hangOnP(400);
+
+ data.byte(kPointermode) = 0;
+ data.byte(kCommandtype) = 0;
+ redrawMainScrn();
+ workToScreenM();
+}
+
+void DreamGenContext::useCharset1() {
+ engine->setCurrentCharset((Frame *)getSegment(data.word(kCharset1)).ptr(0, 0));
+}
+
+void DreamGenContext::useTempCharset() {
+ engine->setCurrentCharset(engine->tempCharset());
+}
+
+void DreamGenContext::getRidOfTemp() {
+ deallocateMem(data.word(kTempgraphics));
+}
+
+void DreamGenContext::getRidOfTempText() {
+ deallocateMem(data.word(kTextfile1));
+}
+
+void DreamGenContext::getRidOfTemp2() {
+ deallocateMem(data.word(kTempgraphics2));
+}
+
+void DreamGenContext::getRidOfTemp3() {
+ deallocateMem(data.word(kTempgraphics3));
+}
+
+void DreamGenContext::getRidOfTempCharset() {
+ engine->freeTempCharset();
+}
+
+void DreamGenContext::getRidOfTempsP() {
+ deallocateMem(data.word(kTempsprites));
+}
+
+void DreamGenContext::getRidOfAll() {
+ deallocateMem(data.word(kBackdrop));
+ deallocateMem(data.word(kSetframes));
+ deallocateMem(data.word(kReel1));
+ deallocateMem(data.word(kReel2));
+ deallocateMem(data.word(kReel3));
+ deallocateMem(data.word(kReels));
+ deallocateMem(data.word(kPeople));
+ deallocateMem(data.word(kSetdesc));
+ deallocateMem(data.word(kBlockdesc));
+ deallocateMem(data.word(kRoomdesc));
+ deallocateMem(data.word(kFreeframes));
+ deallocateMem(data.word(kFreedesc));
+}
+
+// if skipDat, skip clearing and loading Setdat and Freedat
+void DreamGenContext::loadRoomData(const Room &room, bool skipDat) {
+ engine->openFile(room.name);
+
+ FileHeader header;
+ engine->readFromFile((uint8 *)&header, sizeof(FileHeader));
+
+ // read segment lengths from room file header
+ int len[15];
+ for (int i = 0; i < 15; ++i)
+ len[i] = header.len(i);
+
+ data.word(kBackdrop) = allocateAndLoad(len[0]);
+ clearAndLoad(workspace(), 0, len[1], 132*66); // 132*66 = maplen
+ sortOutMap();
+ data.word(kSetframes) = allocateAndLoad(len[2]);
+ if (!skipDat)
+ clearAndLoad(data.word(kSetdat), 255, len[3], kSetdatlen);
+ else
+ engine->skipBytes(len[3]);
+ // NB: The skipDat version of this function as called by restoreall
+ // had a 'call bloc' instead of 'call loadseg' for reel1,
+ // but 'bloc' was not defined.
+ data.word(kReel1) = allocateAndLoad(len[4]);
+ data.word(kReel2) = allocateAndLoad(len[5]);
+ data.word(kReel3) = allocateAndLoad(len[6]);
+ data.word(kReels) = allocateAndLoad(len[7]);
+ data.word(kPeople) = allocateAndLoad(len[8]);
+ data.word(kSetdesc) = allocateAndLoad(len[9]);
+ data.word(kBlockdesc) = allocateAndLoad(len[10]);
+ data.word(kRoomdesc) = allocateAndLoad(len[11]);
+ data.word(kFreeframes) = allocateAndLoad(len[12]);
+ if (!skipDat)
+ clearAndLoad(data.word(kFreedat), 255, len[13], kFreedatlen);
+ else
+ engine->skipBytes(len[13]);
+ data.word(kFreedesc) = allocateAndLoad(len[14]);
+
+ engine->closeFile();
+}
+
+void DreamGenContext::restoreAll() {
+ const Room &room = g_roomData[data.byte(kLocation)];
+ loadRoomData(room, true);
+ setAllChanges();
+}
+
+void DreamGenContext::restoreReels() {
+ if (data.byte(kRoomloaded) == 0)
+ return;
+
+ const Room &room = g_roomData[data.byte(kReallocation)];
+
+ engine->openFile(room.name);
+
+ FileHeader header;
+ engine->readFromFile((uint8 *)&header, sizeof(FileHeader));
+
+ // read segment lengths from room file header
+ int len[15];
+ for (int i = 0; i < 15; ++i)
+ len[i] = header.len(i);
+
+ engine->skipBytes(len[0]);
+ engine->skipBytes(len[1]);
+ engine->skipBytes(len[2]);
+ engine->skipBytes(len[3]);
+ data.word(kReel1) = allocateAndLoad(len[4]);
+ data.word(kReel2) = allocateAndLoad(len[5]);
+ data.word(kReel3) = allocateAndLoad(len[6]);
+
+ engine->closeFile();
+}
+
+void DreamGenContext::loadFolder() {
+ loadIntoTemp("DREAMWEB.G09"); // folder graphics 1
+ loadIntoTemp2("DREAMWEB.G10"); // folder graphics 2
+ loadIntoTemp3("DREAMWEB.G11"); // folder graphics 3
+ loadTempCharset("DREAMWEB.C02"); // character set 3
+ loadTempText("DREAMWEB.T50"); // folder text
+}
+
+void DreamGenContext::showFolder() {
+ data.byte(kCommandtype) = 255;
+ if (data.byte(kFolderpage)) {
+ useTempCharset();
+ createPanel2();
+ showFrame(tempGraphics(), 0, 0, 0, 0);
+ showFrame(tempGraphics(), 143, 0, 1, 0);
+ showFrame(tempGraphics(), 0, 92, 2, 0);
+ showFrame(tempGraphics(), 143, 92, 3, 0);
+ folderExit();
+ if (data.byte(kFolderpage) != 1)
+ showLeftPage();
+ if (data.byte(kFolderpage) != 12)
+ showRightPage();
+ useCharset1();
+ underTextLine();
+ } else {
+ createPanel2();
+ showFrame(tempGraphics3(), 143-28, 0, 0, 0);
+ showFrame(tempGraphics3(), 143-28, 92, 1, 0);
+ folderExit();
+ underTextLine();
+ }
+}
+
+void DreamGenContext::showLeftPage() {
+ showFrame(tempGraphics2(), 0, 12, 3, 0);
+ uint16 y = 12+5;
+ for (size_t i = 0; i < 9; ++i) {
+ showFrame(tempGraphics2(), 0, y, 4, 0);
+ y += 16;
+ }
+ showFrame(tempGraphics2(), 0, y, 5, 0);
+ data.word(kLinespacing) = 8;
+ data.word(kCharshift) = 91;
+ data.byte(kKerning) = 1;
+ uint8 pageIndex = data.byte(kFolderpage) - 2;
+ const uint8 *string = getTextInFile1(pageIndex * 2);
+ y = 48;
+ for (size_t i = 0; i < 2; ++i) {
+ uint8 lastChar;
+ do {
+ lastChar = printDirect(&string, 2, &y, 140, false);
+ y += data.word(kLinespacing);
+ } while (lastChar != '\0');
+ }
+ data.byte(kKerning) = 0;
+ data.word(kCharshift) = 0;
+ data.word(kLinespacing) = 10;
+ uint8 *bufferToSwap = workspace() + (48*320)+2;
+ for (size_t i = 0; i < 120; ++i) {
+ for (size_t j = 0; j < 65; ++j) {
+ SWAP(bufferToSwap[j], bufferToSwap[130 - j]);
+ }
+ bufferToSwap += 320;
+ }
+}
+
+void DreamGenContext::showRightPage() {
+ showFrame(tempGraphics2(), 143, 12, 0, 0);
+ uint16 y = 12+37;
+ for (size_t i = 0; i < 7; ++i) {
+ showFrame(tempGraphics2(), 143, y, 1, 0);
+ y += 16;
+ }
+
+ showFrame(tempGraphics2(), 143, y, 2, 0);
+ data.word(kLinespacing) = 8;
+ data.byte(kKerning) = 1;
+ uint8 pageIndex = data.byte(kFolderpage) - 1;
+ const uint8 *string = getTextInFile1(pageIndex * 2);
+ y = 48;
+ for (size_t i = 0; i < 2; ++i) {
+ uint8 lastChar;
+ do {
+ lastChar = printDirect(&string, 152, &y, 140, false);
+ y += data.word(kLinespacing);
+ } while (lastChar != '\0');
+ }
+ data.byte(kKerning) = 0;
+ data.word(kLinespacing) = 10;
+}
+
+void DreamBase::showExit() {
+ showFrame(engine->icons1(), 274, 154, 11, 0);
+}
+
+void DreamBase::showMan() {
+ showFrame(engine->icons1(), 0, 0, 0, 0);
+ showFrame(engine->icons1(), 0, 114, 1, 0);
+ if (data.byte(kShadeson))
+ showFrame(engine->icons1(), 28, 25, 2, 0);
+}
+
+void DreamBase::panelIcons1() {
+ uint16 x;
+ if (data.byte(kWatchon) != 1)
+ x = 48;
+ else
+ x = 0;
+ showFrame(engine->icons2(), 204 + x, 4, 2, 0);
+ if (data.byte(kZoomon) != 1)
+ showFrame(engine->icons1(), 228 + x, 8, 5, 0);
+ showWatch();
+}
+
+void DreamGenContext::examIcon() {
+ showFrame(engine->icons2(), 254, 5, 3, 0);
+}
+
+uint8 DreamGenContext::getLocation(uint8 index) {
+ return data.byte(kRoomscango + index);
+}
+
+void DreamGenContext::getLocation() {
+ al = getLocation(al);
+}
+
+void DreamGenContext::setLocation(uint8 index) {
+ data.byte(kRoomscango + index) = 1;
+}
+
+void DreamGenContext::setLocation() {
+ setLocation(al);
+}
+
+const uint8 *DreamBase::getTextInFile1(uint16 index) {
+ SegmentRef text = getSegment(data.word(kTextfile1));
+ uint16 offset = text.word(index * 2) + kTextstart;
+ const uint8 *string = text.ptr(offset, 0);
+ return string;
+}
+
+void DreamGenContext::checkFolderCoords() {
+ RectWithCallback folderList[] = {
+ { 280,320,160,200, &DreamGenContext::quitKey },
+ { 143,300,6,194, &DreamGenContext::nextFolder },
+ { 0,143,6,194, &DreamGenContext::lastFolder },
+ { 0,320,0,200, &DreamGenContext::blank },
+ { 0xFFFF,0,0,0, 0 }
+ };
+ checkCoords(folderList);
+}
+
+void DreamGenContext::nextFolder() {
+ if (data.byte(kFolderpage) == 12) {
+ blank();
+ return;
+ }
+ if (data.byte(kCommandtype) != 201) {
+ data.byte(kCommandtype) = 201;
+ commandOnly(16);
+ }
+ if ((data.word(kMousebutton) == 1) && (data.word(kMousebutton) != data.word(kOldbutton))) {
+ ++data.byte(kFolderpage);
+ folderHints();
+ delPointer();
+ showFolder();
+ data.word(kMousebutton) = 0;
+ checkFolderCoords();
+ workToScreenM();
+ }
+}
+
+void DreamGenContext::lastFolder() {
+ if (data.byte(kFolderpage) == 0) {
+ blank();
+ return;
+ }
+ if (data.byte(kCommandtype) != 202) {
+ data.byte(kCommandtype) = 202;
+ commandOnly(17);
+ }
+
+ if ((data.word(kMousebutton) == 1) && (data.word(kMousebutton) != data.word(kOldbutton))) {
+ --data.byte(kFolderpage);
+ delPointer();
+ showFolder();
+ data.word(kMousebutton) = 0;
+ checkFolderCoords();
+ workToScreenM();
+ }
+}
+
+void DreamGenContext::folderHints() {
+ if (data.byte(kFolderpage) == 5) {
+ if ((data.byte(kAidedead) != 1) && (getLocation(13) != 1)) {
+ setLocation(13);
+ showFolder();
+ const uint8 *string = getTextInFile1(30);
+ printDirect(string, 0, 86, 141, true);
+ workToScreenM();
+ hangOnP(200);
+ }
+ } else if (data.byte(kFolderpage) == 9) {
+ if (getLocation(7) != 1) {
+ setLocation(7);
+ showFolder();
+ const uint8 *string = getTextInFile1(31);
+ printDirect(string, 0, 86, 141, true);
+ workToScreenM();
+ hangOnP(200);
+ }
+ }
+}
+
+void DreamGenContext::folderExit() {
+ showFrame(tempGraphics2(), 296, 178, 6, 0);
+}
+
+void DreamGenContext::loadTravelText() {
+ data.word(kTraveltext) = standardLoad("DREAMWEB.T81"); // location descs
+}
+
+void DreamGenContext::loadTempText() {
+ loadTempText((const char *)data.ptr(dx, 0));
+}
+
+void DreamGenContext::loadTempText(const char *fileName) {
+ data.word(kTextfile1) = standardLoad(fileName);
+}
+
+void DreamGenContext::drawFloor() {
+ eraseOldObs();
+ drawFlags();
+ calcMapAd();
+ doBlocks();
+ showAllObs();
+ showAllFree();
+ showAllEx();
+ panelToMap();
+ initRain();
+ data.byte(kNewobs) = 0;
+}
+
+void DreamGenContext::allocateBuffers() {
+ data.word(kExtras) = allocateMem(kLengthofextra/16);
+ data.word(kMapdata) = allocateMem(kLengthofmap/16);
+ data.word(kBuffers) = allocateMem(kLengthofbuffer/16);
+ data.word(kFreedat) = allocateMem(kFreedatlen/16);
+ data.word(kSetdat) = allocateMem(kSetdatlen/16);
+ data.word(kMapstore) = allocateMem(kLenofmapstore/16);
+ data.word(kSounddata) = allocateMem(2048/16);
+ data.word(kSounddata2) = allocateMem(2048/16);
+}
+
+void DreamGenContext::workToScreenM() {
+ animPointer();
+ readMouse();
+ showPointer();
+ vSync();
+ workToScreenCPP();
+ delPointer();
+}
+
+void DreamGenContext::loadMenu() {
+ loadIntoTemp("DREAMWEB.S02"); // sprite name 3
+ loadIntoTemp2("DREAMWEB.G07"); // mon. graphics 2
+}
+
+void DreamGenContext::showMenu() {
+ ++data.byte(kMenucount);
+ if (data.byte(kMenucount) == 37*2)
+ data.byte(kMenucount) = 0;
+ showFrame(tempGraphics(), kMenux, kMenuy, data.byte(kMenucount) / 2, 0);
+}
+
+void DreamGenContext::dumpMenu() {
+ multiDump(kMenux, kMenuy, 48, 48);
+}
+
+void DreamGenContext::useMenu() {
+ getRidOfReels();
+ loadMenu();
+ createPanel();
+ showPanel();
+ showIcon();
+ data.byte(kNewobs) = 0;
+ drawFloor();
+ printSprites();
+ showFrame(tempGraphics2(), kMenux-48, kMenuy-4, 4, 0);
+ getUnderMenu();
+ showFrame(tempGraphics2(), kMenux+54, kMenuy+72, 5, 0);
+ workToScreenM();
+ data.byte(kGetback) = 0;
+ do {
+ delPointer();
+ putUnderMenu();
+ showMenu();
+ readMouse();
+ showPointer();
+ vSync();
+ dumpPointer();
+ dumpMenu();
+ dumpTextLine();
+ RectWithCallback menuList[] = {
+ { kMenux+54,kMenux+68,kMenuy+72,kMenuy+88,&DreamGenContext::quitKey },
+ { 0,320,0,200,&DreamGenContext::blank },
+ { 0xFFFF,0,0,0,0 }
+ };
+ checkCoords(menuList);
+ } while ((data.byte(kGetback) != 1) && !quitRequested());
+ data.byte(kManisoffscreen) = 0;
+ redrawMainScrn();
+ getRidOfTemp();
+ getRidOfTemp2();
+ restoreReels();
+ workToScreenM();
+}
+
+void DreamGenContext::atmospheres() {
+
+ const Atmosphere *a = &g_atmosphereList[0];
+
+ for (; a->_location != 255; ++a) {
+ if (a->_location != data.byte(kReallocation))
+ continue;
+ if (a->_mapX != data.byte(kMapx) || a->_mapY != data.byte(kMapy))
+ continue;
+ if (a->_sound != data.byte(kCh0playing)) {
+
+ if (data.byte(kLocation) == 45 && data.word(kReeltowatch) == 45)
+ continue; // "web"
+
+ playChannel0(a->_sound, a->_repeat);
+
+ // NB: The asm here reads
+ // cmp reallocation,2
+ // cmp mapy,0
+ // jz fullvol
+ // jnz notlouisvol
+ // I'm interpreting this as if the cmp reallocation is below the jz
+
+ if (data.byte(kMapy) == 0) {
+ data.byte(kVolume) = 0; // "fullvol"
+ return;
+ }
+
+ if (data.byte(kReallocation) == 2 && data.byte(kMapx) == 22 && data.byte(kMapy) == 10)
+ data.byte(kVolume) = 5; // "louisvol"
+
+ if (isCD() && data.byte(kReallocation) == 14) {
+ if (data.byte(kMapx) == 33) {
+ data.byte(kVolume) = 0; // "ismad2"
+ return;
+ }
+
+ if (data.byte(kMapx) == 22) {
+ data.byte(kVolume) = 5;
+ return;
+ }
+
+ }
+ }
+
+ if (data.byte(kReallocation) == 2) {
+ if (data.byte(kMapx) == 22) {
+ data.byte(kVolume) = 5; // "louisvol"
+ return;
+ }
+
+ if (data.byte(kMapx) == 11) {
+ data.byte(kVolume) = 0; // "fullvol"
+ return;
+ }
+ }
+ return;
+ }
+
+ cancelCh0();
+}
+
+void DreamGenContext::readCityPic() {
+ loadIntoTemp("DREAMWEB.G04");
+}
+
+void DreamGenContext::readDestIcon() {
+ loadIntoTemp("DREAMWEB.G05");
+ loadIntoTemp2("DREAMWEB.G06");
+ loadIntoTemp3("DREAMWEB.G08");
+}
+
+uint8 DreamGenContext::nextSymbol(uint8 symbol) {
+ uint8 result = symbol + 1;
+ if (result == 6)
+ return 0;
+ if (result == 12)
+ return 6;
+ return result;
+}
+
+void DreamGenContext::showSymbol() {
+ showFrame(tempGraphics(), kSymbolx, kSymboly, 12, 0);
+
+ showFrame(tempGraphics(), data.byte(kSymboltopx) + kSymbolx-44, kSymboly+20, data.byte(kSymboltopnum), 32);
+ uint8 nextTopSymbol = nextSymbol(data.byte(kSymboltopnum));
+ showFrame(tempGraphics(), data.byte(kSymboltopx) + kSymbolx+5, kSymboly+20, nextTopSymbol, 32);
+ uint8 nextNextTopSymbol = nextSymbol(nextTopSymbol);
+ showFrame(tempGraphics(), data.byte(kSymboltopx) + kSymbolx+54, kSymboly+20, nextNextTopSymbol, 32);
+
+ showFrame(tempGraphics(), data.byte(kSymbolbotx) + kSymbolx-44, kSymboly+49, 6 + data.byte(kSymbolbotnum), 32);
+ uint8 nextBotSymbol = nextSymbol(data.byte(kSymbolbotnum));
+ showFrame(tempGraphics(), data.byte(kSymbolbotx) + kSymbolx+5, kSymboly+49, 6 + nextBotSymbol, 32);
+ uint8 nextNextBotSymbol = nextSymbol(nextBotSymbol);
+ showFrame(tempGraphics(), data.byte(kSymbolbotx) + kSymbolx+54, kSymboly+49, 6 + nextNextBotSymbol, 32);
+}
+
+void DreamBase::readKey() {
+ uint16 bufOut = data.word(kBufferout);
+
+ if (bufOut == data.word(kBufferin)) {
+ // empty buffer
+ data.byte(kCurrentkey) = 0;
+ return;
+ }
+
+ bufOut = (bufOut + 1) & 15; // The buffer has size 16
+ data.byte(kCurrentkey) = g_keyBuffer[bufOut];
+ data.word(kBufferout) = bufOut;
+}
+
+void DreamGenContext::hangOne(uint16 delay) {
+ do {
+ vSync();
+ if (data.byte(kLasthardkey) == 1)
+ return; // "hangonearly"
+ } while (--delay);
+}
+
+void DreamGenContext::hangOne() {
+ hangOne(cx);
+}
+
+void DreamGenContext::bibleQuote() {
+ initGraphics(640, 480, true);
+
+ showPCX("DREAMWEB.I00");
+ fadeScreenUps();
+
+ hangOne(80);
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "biblequotearly"
+ }
+
+ hangOne(560);
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "biblequotearly"
+ }
+
+ fadeScreenDowns();
+
+ hangOne(200);
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "biblequotearly"
+ }
+
+ cancelCh0();
+
+ data.byte(kLasthardkey) = 0;
+}
+
+void DreamGenContext::realCredits() {
+ data.byte(kRoomssample) = 33;
+ loadRoomsSample();
+ data.byte(kVolume) = 0;
+
+ initGraphics(640, 480, true);
+ hangOn(35);
+
+ showPCX("DREAMWEB.I01");
+ playChannel0(12, 0);
+
+ hangOne(2);
+
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "realcreditsearly"
+ }
+
+ allPalette();
+ hangOne(80);
+
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "realcreditsearly"
+ }
+
+ fadeScreenDowns();
+ hangOne(256);
+
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "realcreditsearly"
+ }
+
+ showPCX("DREAMWEB.I02");
+ playChannel0(12, 0);
+ hangOne(2);
+
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "realcreditsearly"
+ }
+
+ allPalette();
+ hangOne(80);
+
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "realcreditsearly"
+ }
+
+ fadeScreenDowns();
+ hangOne(256);
+
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "realcreditsearly"
+ }
+
+ showPCX("DREAMWEB.I03");
+ playChannel0(12, 0);
+ hangOne(2);
+
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "realcreditsearly"
+ }
+
+ allPalette();
+ hangOne(80);
+
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "realcreditsearly"
+ }
+
+ fadeScreenDowns();
+ hangOne(256);
+
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "realcreditsearly"
+ }
+
+ showPCX("DREAMWEB.I04");
+ playChannel0(12, 0);
+ hangOne(2);
+
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "realcreditsearly"
+ }
+
+ allPalette();
+ hangOne(80);
+
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "realcreditsearly"
+ }
+
+ fadeScreenDowns();
+ hangOne(256);
+
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "realcreditsearly"
+ }
+
+ showPCX("DREAMWEB.I05");
+ playChannel0(12, 0);
+ hangOne(2);
+
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "realcreditsearly"
+ }
+
+ allPalette();
+ hangOne(80);
+
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "realcreditsearly"
+ }
+
+ fadeScreenDowns();
+ hangOne(256);
+
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "realcreditsearly"
+ }
+
+ showPCX("DREAMWEB.I06");
+ fadeScreenUps();
+ hangOne(60);
+
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "realcreditsearly"
+ }
+
+ playChannel0(13, 0);
+ hangOne(350);
+
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "realcreditsearly"
+ }
+
+ fadeScreenDowns();
+ hangOne(256);
+
+ data.byte(kLasthardkey) = 0;
+}
+
+void DreamGenContext::runIntroSeq() {
+ data.byte(kGetback) = 0;
+
+ do {
+ vSync();
+
+ if (data.byte(kLasthardkey) == 1)
+ break;
+
+ spriteUpdate();
+ vSync();
+
+ if (data.byte(kLasthardkey) == 1)
+ break;
+
+ delEverything();
+ printSprites();
+ reelsOnScreen();
+ afterIntroRoom();
+ useTimedText();
+ vSync();
+
+ if (data.byte(kLasthardkey) == 1)
+ break;
+
+ dumpMap();
+ dumpTimedText();
+ vSync();
+
+ if (data.byte(kLasthardkey) == 1)
+ break;
+
+ } while (data.byte(kGetback) != 1);
+
+
+ if (data.byte(kLasthardkey) == 1) {
+ getRidOfTempText();
+ clearBeforeLoad();
+ }
+
+ // These were not called in this program arc
+ // in the original code.. Bug?
+ //getRidOfTempText();
+ //clearBeforeLoad();
+}
+
+void DreamGenContext::intro() {
+ loadTempText("DREAMWEB.T82");
+ loadPalFromIFF();
+ setMode();
+ data.byte(kNewlocation) = 50;
+ clearPalette();
+ loadIntroRoom();
+ data.byte(kVolume) = 7;
+ data.byte(kVolumedirection) = (uint8)-1;
+ data.byte(kVolumeto) = 4;
+ playChannel0(12, 255);
+ fadeScreenUps();
+ runIntroSeq();
+
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "introearly"
+ }
+
+ clearBeforeLoad();
+ data.byte(kNewlocation) = 52;
+ loadIntroRoom();
+ runIntroSeq();
+
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "introearly"
+ }
+
+ clearBeforeLoad();
+ data.byte(kNewlocation) = 53;
+ loadIntroRoom();
+ runIntroSeq();
+
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "introearly"
+ }
+
+ clearBeforeLoad();
+ allPalette();
+ data.byte(kNewlocation) = 54;
+ loadIntroRoom();
+ runIntroSeq();
+
+ if (data.byte(kLasthardkey) == 1) {
+ data.byte(kLasthardkey) = 0;
+ return; // "introearly"
+ }
+
+ getRidOfTempText();
+ clearBeforeLoad();
+
+ data.byte(kLasthardkey) = 0;
+}
+
+void DreamGenContext::setTopLeft() {
+ if (data.byte(kSymboltopdir) != 0) {
+ blank();
+ return;
+ }
+
+ if (data.byte(kCommandtype) != 210) {
+ data.byte(kCommandtype) = 210;
+ commandOnly(19);
+ }
+
+ if (data.word(kMousebutton) != 0)
+ data.byte(kSymboltopdir) = 0xFF;
+}
+
+void DreamGenContext::setTopRight() {
+ if (data.byte(kSymboltopdir) != 0) {
+ blank();
+ return;
+ }
+
+ if (data.byte(kCommandtype) != 211) {
+ data.byte(kCommandtype) = 211;
+ commandOnly(20);
+ }
+
+ if (data.word(kMousebutton) != 0)
+ data.byte(kSymboltopdir) = 1;
+}
+
+void DreamGenContext::setBotLeft() {
+ if (data.byte(kSymbolbotdir) != 0) {
+ blank();
+ return;
+ }
+
+ if (data.byte(kCommandtype) != 212) {
+ data.byte(kCommandtype) = 212;
+ commandOnly(21);
+ }
+
+ if (data.word(kMousebutton) != 0)
+ data.byte(kSymbolbotdir) = 0xFF;
+}
+
+void DreamGenContext::setBotRight() {
+ if (data.byte(kSymbolbotdir) != 0) {
+ blank();
+ return;
+ }
+
+ if (data.byte(kCommandtype) != 213) {
+ data.byte(kCommandtype) = 213;
+ commandOnly(22);
+ }
+
+ if (data.word(kMousebutton) != 0)
+ data.byte(kSymbolbotdir) = 1;
+}
+
+void DreamGenContext::newGame() {
+ if (data.byte(kCommandtype) != 251) {
+ data.byte(kCommandtype) = 251;
+ commandOnly(47);
+ }
+
+ if (data.word(kMousebutton) == 1)
+ data.byte(kGetback) = 3;
+}
+
+void DreamGenContext::getBackFromOps() {
+ if (data.byte(kMandead) == 2)
+ blank();
+ else
+ getBack1();
+}
+
+void DreamGenContext::getBackToOps() {
+ if (data.byte(kCommandtype) != 201) {
+ data.byte(kCommandtype) = 201;
+ commandOnly(42);
+ }
+
+ if (data.word(kMousebutton) != data.word(kOldbutton)) {
+ if (data.word(kMousebutton) & 1) {
+ oldToNames();
+ data.byte(kGetback) = 2;
+ }
+ }
+}
+
+void DreamGenContext::pickupOb(uint8 command, uint8 pos) {
+ data.byte(kLastinvpos) = pos;
+ data.byte(kObjecttype) = 2;
+ data.byte(kItemframe) = command;
+ data.byte(kCommand) = command;
+ getAnyAd();
+ transferToEx();
+}
+
+void DreamGenContext::initialInv() {
+ if (data.byte(kReallocation) != 24)
+ return;
+
+ pickupOb(11, 5);
+ pickupOb(12, 6);
+ pickupOb(13, 7);
+ pickupOb(14, 8);
+ pickupOb(18, 0);
+ pickupOb(19, 1);
+ pickupOb(20, 9);
+ pickupOb(16, 2);
+ data.byte(kWatchmode) = 1;
+ data.word(kReeltohold) = 0;
+ data.word(kEndofholdreel) = 6;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ switchRyanOff();
+}
+
+void DreamGenContext::walkIntoRoom() {
+ if (data.byte(kLocation) == 14 && data.byte(kMapx) == 22) {
+ data.byte(kDestination) = 1;
+ data.byte(kFinaldest) = 1;
+ autoSetWalk();
+ }
+}
+
+void DreamGenContext::loadIntroRoom() {
+ data.byte(kIntrocount) = 0;
+ data.byte(kLocation) = 255;
+ loadRoom();
+ data.word(kMapoffsetx) = 72;
+ data.word(kMapoffsety) = 16;
+ clearSprites();
+ data.byte(kThroughdoor) = 0;
+ data.byte(kCurrentkey) = '0';
+ data.byte(kMainmode) = 0;
+ clearWork();
+ data.byte(kNewobs) = 1;
+ drawFloor();
+ reelsOnScreen();
+ spriteUpdate();
+ printSprites();
+ workToScreenCPP();
+}
+
+void DreamGenContext::afterIntroRoom() {
+ if (data.byte(kNowinnewroom) == 0)
+ return; // notnewintro
+
+ clearWork();
+ findRoomInLoc();
+ data.byte(kNewobs) = 1;
+ drawFloor();
+ reelsOnScreen();
+ spriteUpdate();
+ printSprites();
+ workToScreenCPP();
+ data.byte(kNowinnewroom) = 0;
+}
+
+void DreamGenContext::gettingShot() {
+ data.byte(kNewlocation) = 55;
+ clearPalette();
+ loadIntroRoom();
+ fadeScreenUps();
+ data.byte(kVolumeto) = 0;
+ data.byte(kVolumedirection) = 0xFF;
+ runEndSeq();
+ clearBeforeLoad();
+}
+
+void DreamGenContext::redrawMainScrn() {
+ data.word(kTimecount) = 0;
+ createPanel();
+ data.byte(kNewobs) = 0;
+ drawFloor();
+ printSprites();
+ reelsOnScreen();
+ showIcon();
+ getUnderZoom();
+ underTextLine();
+ readMouse();
+ data.byte(kCommandtype) = 255;
+}
+
+void DreamGenContext::selectSlot2() {
+ if (data.word(kMousebutton))
+ data.byte(kLoadingorsave) = 2;
+ selectSlot();
+}
+
+void DreamGenContext::blank() {
+ if (data.byte(kCommandtype) != 199) {
+ data.byte(kCommandtype) = 199;
+ commandOnly(0);
+ }
+}
+
+void DreamGenContext::allPointer() {
+ readMouse();
+ showPointer();
+ dumpPointer();
+}
+
+void DreamGenContext::makeMainScreen() {
+ createPanel();
+ data.byte(kNewobs) = 1;
+ drawFloor();
+ spriteUpdate();
+ printSprites();
+ reelsOnScreen();
+ showIcon();
+ getUnderZoom();
+ underTextLine();
+ data.byte(kCommandtype) = 255;
+ animPointer();
+ workToScreenM();
+ data.byte(kCommandtype) = 200;
+ data.byte(kManisoffscreen) = 0;
+}
+
+void DreamGenContext::openInv() {
+ data.byte(kInvopen) = 1;
+ printMessage(80, 58 - 10, 61, 240, (240 & 1));
+ fillRyan();
+ data.byte(kCommandtype) = 255;
+}
+
+void DreamGenContext::obsThatDoThings() {
+ char id[4] = { 'M', 'E', 'M', 'B' }; // TODO: convert to string with trailing zero
+ if (!compare(data.byte(kCommand), data.byte(kObjecttype), id))
+ return; // notlouiscard
+
+ if (getLocation(4) != 1) {
+ setLocation(4);
+ lookAtCard();
+ }
+}
+
+void DreamGenContext::delEverything() {
+ if (data.byte(kMapysize) + data.word(kMapoffsety) < 182) {
+ mapToPanel();
+ } else {
+ // Big room
+ data.byte(kMapysize) -= 8;
+ mapToPanel();
+ data.byte(kMapysize) += 8;
+ }
+}
+
+void DreamGenContext::errorMessage1() {
+ delPointer();
+ printMessage(76, 21, 58, 240, (240 & 1));
+ readMouse();
+ showPointer();
+ workToScreenCPP();
+ delPointer();
+ hangOnP(50);
+ showPanel();
+ showMan();
+ examIcon();
+ readMouse();
+ useOpened();
+ showPointer();
+ workToScreenCPP();
+ delPointer();
+}
+
+void DreamGenContext::errorMessage2() {
+ data.byte(kCommandtype) = 255;
+ delPointer();
+ printMessage(76, 21, 59, 240, (240 & 1));
+ readMouse();
+ showPointer();
+ workToScreenCPP();
+ delPointer();
+ hangOnP(50);
+ showPanel();
+ showMan();
+ examIcon();
+ readMouse();
+ useOpened();
+ showPointer();
+ workToScreenCPP();
+ delPointer();
+}
+
+void DreamGenContext::errorMessage3() {
+ delPointer();
+ printMessage(76, 21, 60, 240, (240 & 1));
+ workToScreenM();
+ hangOnP(50);
+ showPanel();
+ showMan();
+ examIcon();
+ readMouse();
+ useOpened();
+ showPointer();
+ workToScreenCPP();
+ delPointer();
+}
+
+void DreamGenContext::reExFromOpen() {
+
+}
+
+void DreamGenContext::nextDest() {
+ if (data.byte(kCommandtype) != 218) {
+ data.byte(kCommandtype) = 218;
+ commandOnly(28);
+ }
+
+ if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1)
+ return; // nodu
+
+ do {
+ data.byte(kDestpos)++;
+ if (data.byte(kDestpos) == 15)
+ data.byte(kDestpos) = 0; // last destination
+
+ getDestInfo();
+ } while (al == 0);
+
+ data.byte(kNewtextline) = 1;
+ delTextLine();
+ delPointer();
+ showPanel();
+ showMan();
+ showArrows();
+ locationPic();
+ underTextLine();
+ readMouse();
+ showPointer();
+ workToScreenCPP();
+ delPointer();
+}
+
+void DreamGenContext::lastDest() {
+ if (data.byte(kCommandtype) != 219) {
+ data.byte(kCommandtype) = 219;
+ commandOnly(29);
+ }
+
+ if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1)
+ return; // nodd
+
+ do {
+ data.byte(kDestpos)--;
+ if (data.byte(kDestpos) == 0xFF)
+ data.byte(kDestpos) = 15; // first destination
+
+ getDestInfo();
+ } while (al == 0);
+
+ data.byte(kNewtextline) = 1;
+ delTextLine();
+ delPointer();
+ showPanel();
+ showMan();
+ showArrows();
+ locationPic();
+ underTextLine();
+ readMouse();
+ showPointer();
+ workToScreenCPP();
+ delPointer();
+}
+
+void DreamGenContext::destSelect() {
+ if (data.byte(kCommandtype) != 222) {
+ data.byte(kCommandtype) = 222;
+ commandOnly(30);
+ }
+
+ if (!(data.word(kMousebutton) & 1) || data.word(kOldbutton) == 1)
+ return; // notrav
+
+ getDestInfo();
+ data.byte(kNewlocation) = data.byte(kDestpos);
+}
+
+void DreamGenContext::putBackObStuff() {
+ createPanel();
+ showPanel();
+ showMan();
+ obIcons();
+ showExit();
+ obPicture();
+ describeOb();
+ underTextLine();
+ data.byte(kCommandtype) = 255;
+ readMouse();
+ showPointer();
+ workToScreenCPP();
+ delPointer();
+}
+
+void DreamGenContext::redes() {
+ if (data.byte(kCh1playing) != 255 || data.byte(kTalkmode) != 2) {
+ blank();
+ return;
+ }
+
+ if (data.byte(kCommandtype) != 217) {
+ data.byte(kCommandtype) = 217;
+ commandOnly(50);
+ }
+
+ if (!(data.word(kMousebutton) & 1))
+ return;
+
+ delPointer();
+ createPanel();
+ showPanel();
+ showMan();
+ showExit();
+ convIcons();
+ startTalk();
+ readMouse();
+ showPointer();
+ workToScreenCPP();
+ delPointer();
+}
+
+void DreamGenContext::moreTalk() {
+ if (data.byte(kTalkmode) != 0) {
+ redes();
+ return;
+ }
+
+ if (data.byte(kCommandtype) != 215) {
+ data.byte(kCommandtype) = 215;
+ commandOnly(49);
+ }
+
+ if (data.word(kMousebutton) == data.word(kOldbutton))
+ return; // nomore
+
+ if (!(data.word(kMousebutton) & 1))
+ return;
+
+ data.byte(kTalkmode) = 2;
+ data.byte(kTalkpos) = 4;
+
+ if (data.byte(kCharacter) >= 100)
+ data.byte(kTalkpos) = 48; // second part
+ doSomeTalk();
+}
+
+bool DreamGenContext::isSetObOnMap(uint8 index) {
+ return (getSetAd(index)->mapad[0] == 0);
+}
+
+void DreamGenContext::isSetObOnMap() {
+ flags._z = isSetObOnMap(al);
+}
+
+void DreamGenContext::dumpZoom() {
+ if (data.byte(kZoomon) == 1)
+ multiDump(kZoomx + 5, kZoomy + 4, 46, 40);
+}
+
+void DreamGenContext::selectLocation() {
+ data.byte(kInmaparea) = 0;
+ clearBeforeLoad();
+ data.byte(kGetback) = 0;
+ data.byte(kPointerframe) = 22;
+ readCityPic();
+ showCity();
+ getRidOfTemp();
+ readDestIcon();
+ loadTravelText();
+ showPanel();
+ showMan();
+ showArrows();
+ showExit();
+ locationPic();
+ underTextLine();
+ data.byte(kCommandtype) = 255;
+ readMouse();
+ data.byte(kPointerframe) = 0;
+ showPointer();
+ workToScreenCPP();
+ playChannel0(9, 255);
+ data.byte(kNewlocation) = 255;
+
+ while (data.byte(kNewlocation) == 255) {
+ if (quitRequested())
+ break;
+
+ delPointer();
+ readMouse();
+ showPointer();
+ vSync();
+ dumpPointer();
+ dumpTextLine();
+
+ if (data.byte(kGetback) == 1)
+ break;
+
+ RectWithCallback destList[] = {
+ { 238,258,4,44,&DreamGenContext::nextDest },
+ { 104,124,4,44,&DreamGenContext::lastDest },
+ { 280,308,4,44,&DreamGenContext::lookAtPlace },
+ { 104,216,138,192,&DreamGenContext::destSelect },
+ { 273,320,157,198,&DreamGenContext::getBack1 },
+ { 0,320,0,200,&DreamGenContext::blank },
+ { 0xFFFF,0,0,0,0 }
+ };
+ checkCoords(destList);
+ }
+
+ if (quitRequested() || data.byte(kGetback) == 1 || data.byte(kNewlocation) == data.byte(kLocation)) {
+ data.byte(kNewlocation) = data.byte(kReallocation);
+ data.byte(kGetback) = 0;
+ }
+
+ getRidOfTemp();
+ getRidOfTemp2();
+ getRidOfTemp3();
+ deallocateMem(data.word(kTraveltext));
+}
+
+
+void DreamGenContext::examineInventory() {
+ if (data.byte(kCommandtype) != 249) {
+ data.byte(kCommandtype) = 249;
+ commandOnly(32);
+ }
+
+ if (!(data.word(kMousebutton) & 1))
+ return;
+
+ createPanel();
+ showPanel();
+ showMan();
+ showExit();
+ examIcon();
+ data.byte(kPickup) = 0;
+ data.byte(kInvopen) = 2;
+ openInv();
+ workToScreenM();
+}
+
+void DreamBase::showArrows() {
+ showFrame(tempGraphics(), 116 - 12, 16, 0, 0);
+ showFrame(tempGraphics(), 226 + 12, 16, 1, 0);
+ showFrame(tempGraphics(), 280, 14, 2, 0);
+}
+
+void DreamBase::showOpBox() {
+ showFrame(tempGraphics(), kOpsx, kOpsy, 0, 0);
+
+ // CHECKME: There seem to be versions of dreamweb in which this call
+ // should be removed. It displays a red dot on the ops dialogs if left in.
+ showFrame(tempGraphics(), kOpsx, kOpsy + 55, 4, 0);
+}
+
+void DreamGenContext::showLoadOps() {
+ showFrame(tempGraphics(), kOpsx + 128 + 4, kOpsy + 12, 1, 0);
+ showFrame(tempGraphics(), kOpsx + 176 + 2, kOpsy + 60 - 4, 5, 0);
+ printMessage(kOpsx + 104, kOpsy + 14, 55, 101, (101 & 1));
+}
+
+void DreamGenContext::showSaveOps() {
+ showFrame(tempGraphics(), kOpsx + 128 + 4, kOpsy + 12, 1, 0);
+ showFrame(tempGraphics(), kOpsx + 176 + 2, kOpsy + 60 - 4, 5, 0);
+ printMessage(kOpsx + 104, kOpsy + 14, 54, 101, (101 & 1));
+}
+
+void DreamBase::middlePanel() {
+ Frame *tempSprites = (Frame *)getSegment(data.word(kTempsprites)).ptr(0, 0);
+ showFrame(tempSprites, 72 + 47 + 20, 0, 48, 0);
+ showFrame(tempSprites, 72 + 19, 21, 47, 0);
+ showFrame(tempSprites, 160 + 23, 0, 48, 4);
+ showFrame(tempSprites, 160 + 71, 21, 47, 4);
+}
+
+void DreamBase::showDiary() {
+ showFrame(tempGraphics(), kDiaryx, kDiaryy + 37, 1, 0);
+ showFrame(tempGraphics(), kDiaryx + 176, kDiaryy + 108, 2, 0);
+}
+
+void DreamGenContext::underTextLine() {
+ uint16 y = data.word(kTextaddressy);
+ if (data.byte(kForeignrelease))
+ y -= 3;
+ ds = data.word(kBuffers);
+ si = kTextunder;
+ multiGet(ds.ptr(si, 0), data.byte(kTextaddressx), y, kUndertextsizex, kUndertextsizey);
+}
+
+void DreamGenContext::showDecisions() {
+ createPanel2();
+ showOpBox();
+ showFrame(tempGraphics(), kOpsx + 17, kOpsy + 13, 6, 0);
+ underTextLine();
+}
+
+void DreamGenContext::getUnderZoom() {
+ ds = data.word(kBuffers);
+ si = kZoomspace;
+ multiGet(ds.ptr(si, 0), kZoomx + 5, kZoomy + 4, 46, 40);
+}
+
+void DreamGenContext::putUnderZoom() {
+ ds = data.word(kBuffers);
+ si = kZoomspace;
+ multiPut(ds.ptr(si, 0), kZoomx + 5, kZoomy + 4, 46, 40);
+}
+
+void DreamGenContext::showWatchReel() {
+ uint16 reelPointer = data.word(kReeltowatch);
+ plotReel(reelPointer);
+ data.word(kReeltowatch) = reelPointer;
+
+ // check for shake
+ if (data.byte(kReallocation) == 26 && reelPointer == 104)
+ data.byte(kShakecounter) = 0xFF;
+}
+
+void DreamGenContext::watchReel() {
+ if (data.word(kReeltowatch) != 0xFFFF) {
+ if (data.byte(kManspath) != data.byte(kFinaldest))
+ return; // Wait until stopped walking
+ if (data.byte(kTurntoface) != data.byte(kFacing))
+ return;
+
+ if (--data.byte(kSpeedcount) != 0xFF) {
+ showWatchReel();
+ return;
+ }
+ data.byte(kSpeedcount) = data.byte(kWatchspeed);
+ if (data.word(kReeltowatch) != data.word(kEndwatchreel)) {
+ ++data.word(kReeltowatch);
+ showWatchReel();
+ return;
+ }
+ if (data.word(kWatchingtime)) {
+ showWatchReel();
+ return;
+ }
+ data.word(kReeltowatch) = 0xFFFF;
+ data.byte(kWatchmode) = 0xFF;
+ if (data.word(kReeltohold) == 0xFFFF)
+ return; // No more reel
+ data.byte(kWatchmode) = 1;
+ } else if (data.byte(kWatchmode) != 1) {
+ if (data.byte(kWatchmode) != 2)
+ return; // "notreleasehold"
+ if (--data.byte(kSpeedcount) == 0xFF) {
+ data.byte(kSpeedcount) = data.byte(kWatchspeed);
+ ++data.word(kReeltohold);
+ }
+ if (data.word(kReeltohold) == data.word(kEndofholdreel)) {
+ data.word(kReeltohold) = 0xFFFF;
+ data.byte(kWatchmode) = 0xFF;
+ data.byte(kDestination) = data.byte(kDestafterhold);
+ data.byte(kFinaldest) = data.byte(kDestafterhold);
+ autoSetWalk();
+ return;
+ }
+ }
+
+ uint16 reelPointer = data.word(kReeltohold);
+ plotReel(reelPointer);
+}
+
+void DreamGenContext::afterNewRoom() {
+ if (data.byte(kNowinnewroom) == 0)
+ return; // notnew
+
+ data.word(kTimecount) = 0;
+ createPanel();
+ data.byte(kCommandtype) = 0;
+ findRoomInLoc();
+ if (data.byte(kRyanon) != 1) {
+ al = data.byte(kRyanx) + 12;
+ ah = data.byte(kRyany) + 12;
+ findPathOfPoint();
+ data.byte(kManspath) = dl;
+ findXYFromPath();
+ data.byte(kResetmanxy) = 1;
+ }
+ data.byte(kNewobs) = 1;
+ drawFloor();
+ data.word(kLookcounter) = 160;
+ data.byte(kNowinnewroom) = 0;
+ showIcon();
+ spriteUpdate();
+ printSprites();
+ underTextLine();
+ reelsOnScreen();
+ mainScreen();
+ getUnderZoom();
+ zoom();
+ workToScreenM();
+ walkIntoRoom();
+ reminders();
+ atmospheres();
+}
+
+void DreamGenContext::madmanRun() {
+ if (data.byte(kLocation) != 14 ||
+ data.byte(kMapx) != 22 ||
+ data.byte(kPointermode) != 2 ||
+ data.byte(kMadmanflag) != 0) {
+ identifyOb();
+ return;
+ }
+
+ if (data.byte(kCommandtype) != 211) {
+ data.byte(kCommandtype) = 211;
+ commandOnly(52);
+ }
+
+ if (data.word(kMousebutton) == 1 &&
+ data.word(kMousebutton) != data.word(kOldbutton))
+ data.byte(kLastweapon) = 8;
+}
+
+
+void DreamGenContext::decide() {
+ setMode();
+ loadPalFromIFF();
+ clearPalette();
+ data.byte(kPointermode) = 0;
+ data.word(kWatchingtime) = 0;
+ data.byte(kPointerframe) = 0;
+ data.word(kTextaddressx) = 70;
+ data.word(kTextaddressy) = 182 - 8;
+ data.byte(kTextlen) = 181;
+ data.byte(kManisoffscreen) = 1;
+ loadSaveBox();
+ showDecisions();
+ workToScreenCPP();
+ fadeScreenUp();
+ data.byte(kGetback) = 0;
+
+ RectWithCallback decideList[] = {
+ { kOpsx+69,kOpsx+124,kOpsy+30,kOpsy+76,&DreamGenContext::newGame },
+ { kOpsx+20,kOpsx+87,kOpsy+10,kOpsy+59,&DreamGenContext::DOSReturn },
+ { kOpsx+123,kOpsx+190,kOpsy+10,kOpsy+59,&DreamGenContext::loadOld },
+ { 0,320,0,200,&DreamGenContext::blank },
+ { 0xFFFF,0,0,0,0 }
+ };
+
+ do {
+ if (data.byte(kQuitrequested) != 0)
+ return;
+
+ readMouse();
+ showPointer();
+ vSync();
+ dumpPointer();
+ dumpTextLine();
+ delPointer();
+ checkCoords(decideList);
+ } while (!data.byte(kGetback));
+
+ if (data.byte(kGetback) != 4)
+ getRidOfTemp(); // room not loaded
+
+ data.word(kTextaddressx) = 13;
+ data.word(kTextaddressy) = 182;
+ data.byte(kTextlen) = 240;
+}
+
+void DreamGenContext::talk() {
+ data.byte(kTalkpos) = 0;
+ data.byte(kInmaparea) = 0;
+ data.byte(kCharacter) = data.byte(kCommand);
+ createPanel();
+ showPanel();
+ showMan();
+ showExit();
+ underTextLine();
+ convIcons();
+ startTalk();
+ data.byte(kCommandtype) = 255;
+ readMouse();
+ showPointer();
+ workToScreenCPP();
+
+ RectWithCallback talkList[] = {
+ { 273,320,157,198,&DreamGenContext::getBack1 },
+ { 240,290,2,44,&DreamGenContext::moreTalk },
+ { 0,320,0,200,&DreamGenContext::blank },
+ { 0xFFFF,0,0,0,0 }
+ };
+
+ do {
+ delPointer();
+ readMouse();
+ animPointer();
+ showPointer();
+ vSync();
+ dumpPointer();
+ dumpTextLine();
+ data.byte(kGetback) = 0;
+ checkCoords(talkList);
+ if (data.byte(kQuitrequested))
+ break;
+ } while (!data.byte(kGetback));
+
+ bx = data.word(kPersondata);
+ es = cs;
+
+ if (data.byte(kTalkpos) >= 4)
+ es.byte(bx+7) |= 128;
+
+ redrawMainScrn();
+ workToScreenM();
+ if (data.byte(kSpeechloaded) == 1) {
+ cancelCh1();
+ data.byte(kVolumedirection) = 0xFF;
+ data.byte(kVolumeto) = 0;
+ }
+}
+
+
+void DreamGenContext::discOps() {
+ if (data.byte(kCommandtype) != 249) {
+ data.byte(kCommandtype) = 249;
+ commandOnly(43);
+ }
+
+ if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1))
+ return;
+
+ scanForNames();
+ data.byte(kLoadingorsave) = 2;
+ showOpBox();
+ showDiscOps();
+ data.byte(kCurrentslot) = 0;
+ workToScreenM();
+ data.byte(kGetback) = 0;
+
+ RectWithCallback discOpsList[] = {
+ { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamGenContext::loadGame },
+ { kOpsx+10,kOpsx+79,kOpsy+10,kOpsy+59,&DreamGenContext::saveGame },
+ { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamGenContext::getBackToOps },
+ { 0,320,0,200,&DreamGenContext::blank },
+ { 0xFFFF,0,0,0,0 }
+ };
+
+ do {
+ if (data.byte(kQuitrequested) != 0)
+ return; // quitdiscops
+
+ delPointer();
+ readMouse();
+ showPointer();
+ vSync();
+ dumpPointer();
+ dumpTextLine();
+ checkCoords(discOpsList);
+ } while (!data.byte(kGetback));
+}
+
+void DreamGenContext::doSaveLoad() {
+ data.byte(kPointerframe) = 0;
+ data.word(kTextaddressx) = 70;
+ data.word(kTextaddressy) = 182-8;
+ data.byte(kTextlen) = 181;
+ data.byte(kManisoffscreen) = 1;
+ clearWork();
+ createPanel2();
+ underTextLine();
+ getRidOfAll();
+ loadSaveBox();
+ showOpBox();
+ showMainOps();
+ workToScreenCPP();
+
+ RectWithCallback opsList[] = {
+ { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamGenContext::getBackFromOps },
+ { kOpsx+10,kOpsx+77,kOpsy+10,kOpsy+59,&DreamGenContext::DOSReturn },
+ { kOpsx+128,kOpsx+190,kOpsy+16,kOpsy+100,&DreamGenContext::discOps },
+ { 0,320,0,200,&DreamGenContext::blank },
+ { 0xFFFF,0,0,0,0 }
+ };
+
+ bool firstOps = true;
+
+ do { // restart ops
+ if (firstOps) {
+ firstOps = false;
+ } else {
+ showOpBox();
+ showMainOps();
+ workToScreenM();
+ }
+ data.byte(kGetback) = 0;
+
+ do { // wait ops
+ if (data.byte(kQuitrequested)) {
+ data.byte(kManisoffscreen) = 0;
+ return;
+ }
+
+ readMouse();
+ showPointer();
+ vSync();
+ dumpPointer();
+ dumpTextLine();
+ delPointer();
+ checkCoords(opsList);
+ } while (!data.byte(kGetback));
+ } while (data.byte(kGetback) == 2);
+
+ data.word(kTextaddressx) = 13;
+ data.word(kTextaddressy) = 182;
+ data.byte(kTextlen) = 240;
+ if (data.byte(kGetback) != 4) {
+ getRidOfTemp();
+ restoreAll();
+ redrawMainScrn();
+ workToScreenM();
+ data.byte(kCommandtype) = 200;
+ }
+ data.byte(kManisoffscreen) = 0;
+}
+
+void DreamGenContext::hangOnPQ() {
+ data.byte(kGetback) = 0;
+
+ RectWithCallback quitList[] = {
+ { 273,320,157,198,&DreamGenContext::getBack1 },
+ { 0,320,0,200,&DreamGenContext::blank },
+ { 0xFFFF,0,0,0,0 }
+ };
+
+ uint16 speechFlag = 0;
+
+ do {
+ delPointer();
+ readMouse();
+ animPointer();
+ showPointer();
+ vSync();
+ dumpPointer();
+ dumpTextLine();
+ checkCoords(quitList);
+
+ if (data.byte(kGetback) == 1 || data.byte(kQuitrequested)) {
+ // Quit conversation
+ delPointer();
+ data.byte(kPointermode) = 0;
+ cancelCh1();
+ flags._c = true;
+ return;
+ }
+
+ if (data.byte(kSpeechloaded) == 1 && data.byte(kCh1playing) == 255) {
+ speechFlag++;
+ if (speechFlag == 40)
+ break;
+ }
+ } while (!data.word(kMousebutton) || data.word(kOldbutton));
+
+ delPointer();
+ data.byte(kPointermode) = 0;
+ flags._c = false;
+ }
+
+void DreamGenContext::endGame() {
+ loadTempText("DREAMWEB.T83");
+ monkSpeaking();
+ gettingShot();
+ getRidOfTempText();
+ data.byte(kVolumeto) = 7;
+ data.byte(kVolumedirection) = 1;
+ hangOn(200);
+}
+
+void DreamGenContext::showGun() {
+ data.byte(kAddtored) = 0;
+ data.byte(kAddtogreen) = 0;
+ data.byte(kAddtoblue) = 0;
+ palToStartPal();
+ palToEndPal();
+ greyscaleSum();
+ data.byte(kFadedirection) = 1;
+ data.byte(kFadecount) = 63;
+ data.byte(kColourpos) = 0;
+ data.byte(kNumtofade) = 128;
+ hangOn(130);
+ endPalToStart();
+ clearEndPal();
+ data.byte(kFadedirection) = 1;
+ data.byte(kFadecount) = 63;
+ data.byte(kColourpos) = 0;
+ data.byte(kNumtofade) = 128;
+ hangOn(200);
+ data.byte(kRoomssample) = 34;
+ loadRoomsSample();
+ data.byte(kVolume) = 0;
+ loadIntoTemp("DREAMWEB.G13");
+ createPanel2();
+ showFrame(tempGraphics(), 100, 4, 0, 0);
+ showFrame(tempGraphics(), 158, 106, 1, 0);
+ workToScreenCPP();
+ getRidOfTemp();
+ fadeScreenUp();
+ hangOn(160);
+ playChannel0(12, 0);
+ loadTempText("DREAMWEB.T83");
+ rollEndCredits2();
+ getRidOfTempText();
+}
+
+void DreamGenContext::diaryKeyP() {
+ if (data.byte(kCommandtype) != 214) {
+ data.byte(kCommandtype) = 214;
+ commandOnly(23);
+ }
+
+ if (!data.word(kMousebutton) ||
+ data.word(kOldbutton) == data.word(kMousebutton) ||
+ data.byte(kPresscount))
+ return; // notkeyp
+
+ playChannel1(16);
+ data.byte(kPresscount) = 12;
+ data.byte(kPressed) = 'P';
+ data.byte(kDiarypage)--;
+
+ if (data.byte(kDiarypage) == 0xFF)
+ data.byte(kDiarypage) = 11;
+}
+
+void DreamGenContext::diaryKeyN() {
+ if (data.byte(kCommandtype) != 213) {
+ data.byte(kCommandtype) = 213;
+ commandOnly(23);
+ }
+
+ if (!data.word(kMousebutton) ||
+ data.word(kOldbutton) == data.word(kMousebutton) ||
+ data.byte(kPresscount))
+ return; // notkeyn
+
+ playChannel1(16);
+ data.byte(kPresscount) = 12;
+ data.byte(kPressed) = 'N';
+ data.byte(kDiarypage)++;
+
+ if (data.byte(kDiarypage) == 12)
+ data.byte(kDiarypage) = 0;
+}
+
+void DreamGenContext::dropError() {
+ data.byte(kCommandtype) = 255;
+ delPointer();
+ printMessage(76, 21, 56, 240, 240 & 1);
+ workToScreenM();
+ hangOnP(50);
+ showPanel();
+ showMan();
+ examIcon();
+ data.byte(kCommandtype) = 255;
+ workToScreenM();
+}
+
+void DreamGenContext::cantDrop() {
+ data.byte(kCommandtype) = 255;
+ delPointer();
+ printMessage(76, 21, 24, 240, 240 & 1);
+ workToScreenM();
+ hangOnP(50);
+ showPanel();
+ showMan();
+ examIcon();
+ data.byte(kCommandtype) = 255;
+ workToScreenM();
+}
+
+void DreamGenContext::getBack1() {
+ if (data.byte(kPickup) != 0) {
+ blank();
+ return;
+ }
+
+
+ if (data.byte(kCommandtype) != 202) {
+ data.byte(kCommandtype) = 202;
+ commandOnly(26);
+ }
+
+ if (data.word(kMousebutton) == data.word(kOldbutton))
+ return;
+
+ if (data.word(kMousebutton) & 1) {
+ // Get back
+ data.byte(kGetback) = 1;
+ data.byte(kPickup) = 0;
+ }
+}
+
+void DreamGenContext::newPlace() {
+ if (data.byte(kNeedtotravel) == 1) {
+ data.byte(kNeedtotravel) = 0;
+ selectLocation();
+ } else if (data.byte(kAutolocation) != 0xFF) {
+ data.byte(kNewlocation) = data.byte(kAutolocation);
+ data.byte(kAutolocation) = 0xFF;
+ }
+}
+
+void DreamGenContext::showPuzText() {
+ showPuzText(al, cx);
+}
+
+void DreamGenContext::showPuzText(uint16 command, uint16 count) {
+ findPuzText(); // FIXME: Unnecessary? (Input: al, Output: es:si)
+ createPanel();
+ showPanel();
+ showMan();
+ showExit();
+ obIcons();
+ uint16 offset = kTextstart + getSegment(data.word(kPuzzletext)).word(command * 2);
+ const uint8 *string = getSegment(data.word(kPuzzletext)).ptr(offset, 0);
+ printDirect(string, 36, 104, 241, 241 & 1);
+ workToScreenM();
+ hangOnP(count);
+}
+
+void DreamGenContext::monkSpeaking() {
+ // FIXME: This is the CD version only.
+
+ data.byte(kRoomssample) = 35;
+ loadRoomsSample();
+ loadIntoTemp("DREAMWEB.G15");
+ clearWork();
+ showFrame(tempGraphics(), 160, 72, 0, 128); // show monk
+ workToScreen();
+ data.byte(kVolume) = 7;
+ data.byte(kVolumedirection) = 0xFF;
+ data.byte(kVolumeto) = 5;
+ playChannel0(12, 255);
+ fadeScreenUps();
+ hangOn(300);
+
+ for (int i = 40; i <= 48; i++) {
+ loadSpeech('T', 83, 'T', i);
+
+ playChannel1(50 + 12);
+
+ do {
+ engine->waitForVSync();
+ } while (data.byte(kCh1playing) != 255);
+ }
+
+ data.byte(kVolumedirection) = 1;
+ data.byte(kVolumeto) = 7;
+ fadeScreenDowns();
+ hangOn(300);
+ getRidOfTemp();
+}
+
+void DreamGenContext::useButtonA() {
+ if (!isSetObOnMap(95)) {
+ showFirstUse();
+ turnAnyPathOn(0, data.byte(kRoomnum) - 1);
+ removeSetObject(9);
+ placeSetObject(95);
+ data.word(kWatchingtime) = 15 * 2;
+ data.word(kReeltowatch) = 71;
+ data.word(kEndwatchreel) = 85;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.byte(kGetback) = 1;
+ data.byte(kProgresspoints)++;
+ } else {
+ // Done this bit
+ showSecondUse();
+ putBackObStuff();
+ }
+}
+
+void DreamGenContext::autoAppear() {
+ if (data.byte(kLocation) == 32) {
+ // In alley
+ al = 5;
+ resetLocation();
+ setLocation(10);
+ data.byte(kDestpos) = 10;
+ return;
+ }
+
+ if (data.byte(kReallocation) == 24) {
+ // In Eden's apartment
+ if (data.byte(kGeneraldead) == 1) {
+ data.byte(kGeneraldead)++;
+ placeSetObject(44);
+ placeSetObject(18);
+ placeSetObject(93);
+ removeSetObject(92);
+ removeSetObject(55);
+ removeSetObject(75);
+ removeSetObject(84);
+ removeSetObject(85);
+ } else if (data.byte(kSartaindead) == 1) {
+ // Eden's part 2
+ removeSetObject(44);
+ removeSetObject(93);
+ placeSetObject(55);
+ data.byte(kSartaindead)++;
+ }
+ } else {
+ // Not in Eden's
+ if (data.byte(kReallocation) == 25) {
+ // Sart roof
+ data.byte(kNewsitem) = 3;
+ al = 6;
+ resetLocation();
+ setLocation(11);
+ data.byte(kDestpos) = 11;
+ } else {
+ if (data.byte(kReallocation) == 2 && data.byte(kRockstardead) != 0)
+ placeSetObject(23);
+ }
+ }
+}
+
+void DreamGenContext::quitKey() {
+ if (data.byte(kCommandtype) != 222) {
+ data.byte(kCommandtype) = 222;
+ commandOnly(4);
+ }
+
+ if (data.word(kMousebutton) != data.word(kOldbutton) && (data.word(kMousebutton) & 1))
+ data.byte(kGetback) = 1;
+}
+} // End of namespace DreamGen
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index d25a8d13b7..4308bd54ea 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -19,231 +19,554 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
- uint16 allocatemem(uint16 paragraphs);
- uint8 *workspace();
- void allocatework();
- 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, 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);
- void worktoscreen();
- void multiget();
- void multiget(uint8 *dst, uint16 x, uint16 y, uint8 width, uint8 height);
- void convertkey();
- void cls();
- void printsprites();
- void quickquit();
- void readoneblock();
- void printundermon();
- void seecommandtail();
- void randomnumber();
- void quickquit2();
- uint8 getnextword(const Frame *charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount);
- void printboth(const Frame* charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar);
- void printchar();
- 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();
- void setuptimedtemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount);
- void getundertimed();
- void putundertimed();
- uint8 printslow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered);
- void printslow();
- void dumptextline();
- void getnumber();
- uint8 getnumber(const Frame *charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16 *offset);
- uint8 kernchars(uint8 firstChar, uint8 secondChar, uint8 width);
- void getroomdata();
- void readheader();
- void fillspace();
- void startloading();
- void startloading(const Room *room);
- Sprite *spritetable();
- void showframe();
- void showframe(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height);
- void showframe(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag);
- void printasprite(const Sprite *sprite);
+#ifndef DREAMWEB_STUBS_H
+#define DREAMWEB_STUBS_H
+
+ void screenUpdate();
+ void startup();
+ void startup1();
+ void switchRyanOn();
+ void switchRyanOff();
+ uint16 allocateMem(uint16 paragraphs);
+ void deallocateMem(uint16 segment);
+ uint16 standardLoad(const char *fileName, uint16 *outSizeInBytes = NULL); // Returns a segment handle which needs to be freed with deallocatemem for symmetry
+ void *standardLoadCPP(const char *fileName, uint16 *outSizeInBytes = NULL); // And this one should be 'free'd
+ void loadIntoTemp();
+ void loadIntoTemp(const char *fileName);
+ void loadIntoTemp2(const char *fileName);
+ void loadIntoTemp3(const char *fileName);
+ void loadTempCharset();
+ void loadTempCharset(const char *fileName);
+ void saveLoad();
+ void delChar();
+ void hangOnCurs(uint16 frameCount);
+ void hangOnCurs();
+ void workToScreen();
+ void multiGet();
+ void multiGet(uint8 *dst, uint16 x, uint16 y, uint8 width, uint8 height) {
+ DreamBase::multiGet(dst, x, y, width, height);
+ }
+ void multiPut();
+ void multiPut(const uint8 *src, uint16 x, uint16 y, uint8 width, uint8 height) {
+ DreamBase::multiPut(src, x, y, width, height);
+ }
+ void multiDump();
+ void multiDump(uint16 x, uint16 y, uint8 width, uint8 height) {
+ DreamBase::multiDump(x, y, width, height);
+ }
+ void printSprites();
+ void quickQuit();
+ void readOneBlock();
+ void readCityPic();
+ void readDestIcon();
+ void seeCommandTail();
+ void randomNumber();
+ void quickQuit2();
+ void printDirect();
+ uint8 printDirect(const uint8** string, uint16 x, uint16 *y, uint8 maxWidth, bool centered) {
+ return DreamBase::printDirect(string, x, y, maxWidth, centered);
+ }
+ uint8 printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered) {
+ return DreamBase::printDirect(string, x, y, maxWidth, centered);
+ }
+ void printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered);
+ void printMessage();
+ void useTimedText();
+ void dumpTimedText();
+ void setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount);
+ void getUnderTimed();
+ void putUnderTimed();
+ void dumpTextLine();
+ void oldToNames();
+ void namesToOld();
+ void startLoading(const Room &room);
+ void showFrame();
+ void showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height) {
+ DreamBase::showFrame(frameData, x, y, frameNumber, effectsFlag, width, height);
+ }
+ void showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag) {
+ DreamBase::showFrame(frameData, x, y, frameNumber, effectsFlag);
+ }
+ void printASprite(const Sprite *sprite);
void width160();
- void multiput(const uint8 *src, uint16 x, uint16 y, uint8 width, uint8 height);
- void multiput();
- void eraseoldobs();
- void clearsprites();
- Sprite *makesprite(uint8 x, uint8 y, uint16 updateCallback, uint16 frameData, uint16 somethingInDi);
- void spriteupdate();
- void initman();
- void mainman(Sprite *sprite);
- void facerightway();
+ void eraseOldObs();
+ void clearSprites();
+ Sprite *makeSprite(uint8 x, uint8 y, uint16 updateCallback, uint16 frameData, uint16 somethingInDi);
+ void spriteUpdate();
+ void initMan();
+ void mainMan(Sprite *sprite);
+ void mainMan();
void walking(Sprite *sprite);
- void autosetwalk();
- void checkdest(const RoomPaths *roomsPaths);
- void aboutturn(Sprite *sprite);
- void backobject(Sprite *sprite);
+ void aboutTurn(Sprite *sprite);
+ void backObject(Sprite *sprite);
+ void backObject();
void constant(Sprite *sprite, SetObject *objData);
void steady(Sprite *sprite, SetObject *objData);
- void random(Sprite *sprite, SetObject *objData);
- void dodoor();
- void dodoor(Sprite *sprite, SetObject *objData);
+ void randomSprite(Sprite *sprite, SetObject *objData);
+ void doDoor(Sprite *sprite, SetObject *objData, Common::Rect check);
void doorway(Sprite *sprite, SetObject *objData);
- void widedoor(Sprite *sprite, SetObject *objData);
- void lockeddoorway(Sprite *sprite, SetObject *objData);
- void liftsprite(Sprite *sprite, SetObject *objData);
- void findsource();
- Frame *findsourceCPP();
- void showgamereel();
- void showgamereel(ReelRoutine *routine);
- void showreelframe();
- void showreelframe(Reel *reel);
- const Frame *getreelframeax(uint16 frame);
- 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();
- void cancelch0();
- void cancelch1();
- void plotreel();
- Reel *getreelstart();
- void dealwithspecial(uint8 firstParam, uint8 secondParam);
+ void wideDoor(Sprite *sprite, SetObject *objData);
+ void lockedDoorway(Sprite *sprite, SetObject *objData);
+ void liftSprite(Sprite *sprite, SetObject *objData);
+ void showGameReel();
+ void showGameReel(ReelRoutine *routine);
+ 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();
+ void makeBackOb(SetObject *objData);
+ void dealWithSpecial(uint8 firstParam, uint8 secondParam);
void zoom();
- void crosshair();
- void showrain();
- void deltextline();
- void commandonly();
- void commandonly(uint8 command);
- void doblocks();
- void checkifperson();
- 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);
- void commandwithob();
- void commandwithob(uint8 command, uint8 type, uint8 index);
- void showpanel();
- void updatepeople();
- void madmantext();
- void madmode();
- void movemap(uint8 param);
- bool addalong(const uint8 *mapFlags);
- bool addlength(const uint8 *mapFlags);
- void getdimension();
- void getdimension(uint8 *mapXstart, uint8 *mapYstart, uint8 *mapXsize, uint8 *mapYsize);
- void getmapad();
- void calcmapad();
- uint8 getmapad(const uint8 *setData);
- uint8 getxad(const uint8 *setData, uint8 *result);
- uint8 getyad(const uint8 *setData, uint8 *result);
- void calcfrframe();
- void calcfrframe(uint8* width, uint8* height);
- void finalframe();
- void finalframe(uint16 *x, uint16 *y);
- void showallobs();
- void blocknametext();
- void walktotext();
- void personnametext();
- void findxyfrompath();
- void findormake();
- void findormake(uint8 index, uint8 value, uint8 type);
- DynObject *getfreead(uint8 index);
- 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);
- void deletetaken();
+ void showRain();
+ void delTextLine();
+ void commandOnly();
+ void commandOnly(uint8 command);
+ void doBlocks();
+ void checkIfPerson();
+ 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);
+ void commandWithOb();
+ void commandWithOb(uint8 command, uint8 type, uint8 index);
+ void updatePeople();
+ void madman(ReelRoutine &routine);
+ void madmanText();
+ void madMode();
+ void moveMap(uint8 param);
+ bool addAlong(const uint8 *mapFlags);
+ bool addLength(const uint8 *mapFlags);
+ void getDimension();
+ void getDimension(uint8 *mapXstart, uint8 *mapYstart, uint8 *mapXsize, uint8 *mapYsize);
+ void getMapAd();
+ void calcMapAd();
+ uint8 getMapAd(const uint8 *setData);
+ uint8 getXAd(const uint8 *setData, uint8 *result);
+ uint8 getYAd(const uint8 *setData, uint8 *result);
+ void calcFrFrame(uint16 frame);
+ void calcFrFrame(uint16 frame, uint8* width, uint8* height);
+ void finalFrame();
+ void finalFrame(uint16 *x, uint16 *y);
+ void showAllObs();
+ void blockNameText();
+ void walkToText();
+ void personNameText();
+ DynObject *getFreeAd(uint8 index) {
+ return DreamBase::getFreeAd(index);
+ }
+ DynObject *getExAd(uint8 index) {
+ return DreamBase::getExAd(index);
+ }
+ DynObject *getEitherAdCPP();
+ void *getAnyAd(uint8 *value1, uint8 *value2) {
+ return DreamBase::getAnyAd(value1, value2);
+ }
+ SetObject *getSetAd(uint8 index) {
+ return DreamBase::getSetAd(index);
+ }
+ void *getAnyAdDir(uint8 index, uint8 flag);
+ void setAllChanges();
+ void doChange(uint8 index, uint8 value, uint8 type);
+ void deleteTaken();
bool isCD();
- void placesetobject();
- void placesetobject(uint8 index);
- void removesetobject();
- void removesetobject(uint8 index);
- void showallfree();
- void showallex();
- bool finishedwalkingCPP();
- void finishedwalking();
- void checkone();
- void checkone(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY);
- void getflagunderp();
- void getflagunderp(uint8 *flag, uint8 *flagEx);
- void walkandexamine();
- void obname();
- void obname(uint8 command, uint8 commandType);
- void delpointer();
- void showblink();
- void dumpblink();
- void dumppointer();
- void showpointer();
- void animpointer();
- void checkcoords();
- void checkcoords(const RectWithCallback *rectWithCallbacks);
- void readmouse();
- void readmouse1();
- void readmouse2();
- void readmouse3();
- 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 placeSetObject();
+ void placeSetObject(uint8 index);
+ void removeSetObject();
+ void removeSetObject(uint8 index);
+ void showAllFree();
+ void showAllEx();
+ bool finishedWalkingCPP();
+ void finishedWalking();
+ void checkOne();
+ void checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY);
+ void getFlagUnderP();
+ void getFlagUnderP(uint8 *flag, uint8 *flagEx);
+ void walkAndExamine();
+ void obName();
+ void obName(uint8 command, uint8 commandType);
+ void animPointer();
+ void checkCoords(const RectWithCallback *rectWithCallbacks);
+ void drawFlags();
+ void addToPeopleList();
+ void addToPeopleList(ReelRoutine *routine);
+ void getExPos();
+ void obPicture();
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();
-
+ 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 wornError();
+ void makeWorn();
+ void makeWorn(DynObject *object);
+ void obToInv();
+ void obToInv(uint8 index, uint8 flag, uint16 x, uint16 y);
+ void findAllRyan();
+ void findAllRyan(uint8 *inv);
+ void fillRyan();
+ void useRoutine();
+ void hangOn();
+ void hangOn(uint16 frameCount) {
+ DreamBase::hangOn(frameCount);
+ }
+ void hangOnW();
+ void hangOnW(uint16 frameCount);
+ void hangOnP();
+ void hangOnP(uint16 count);
+ void showIcon();
+ uint8 findNextColon(uint8 **string);
+ void findNextColon();
+ uint8 *getObTextStartCPP();
+ void useText(const uint8 *string);
+ void useText();
+ void getBlockOfPixel();
+ uint8 getBlockOfPixel(uint8 x, uint8 y);
+ void examineObText();
+ void sortOutMap();
+ void showCity();
+ uint16 getPersFrame(uint8 index);
+ void convIcons();
+ void examineOb(bool examineAgain = true);
+ void dumpWatch();
+ void roomName();
+ void transferText();
+ void initRain();
+ Rain *splitIntoLines(uint8 x, uint8 y, Rain *rain);
+ void watchCount();
+ void zoomIcon();
+ void loadRoom();
+ void getUnderMenu();
+ void putUnderMenu();
+ void textForMonk();
+ void textForMonkHelper(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount);
+ void textForEnd();
+ void monks2text();
+ void intro1Text();
+ void intro2Text();
+ void intro3Text();
+ void readSetData();
+ void fadeupYellows();
+ void fadeupMonFirst();
+ void loadMenu();
+ void showMenu();
+ void dumpMenu();
+ void useMenu();
+ void useMon();
+ void input();
+ void monPrint();
+ const char *monPrint(const char *string) {
+ return DreamBase::monPrint(string);
+ }
+ void randomAccess(uint16 count);
+ void randomAccess();
+ void monMessage(uint8 index);
+ void monMessage();
+ void netError();
+ void playChannel1();
+ void playChannel1(uint8 index) {
+ DreamBase::playChannel1(index);
+ }
+ void showMainOps();
+ void showDiscOps();
+ void findRoomInLoc();
+ void reelsOnScreen();
+ void reconstruct();
+ void look();
+ void autoLook();
+ void doLook();
+ void useTempCharset();
+ void useCharset1();
+ void getBackFromOb();
+ void getRidOfAll();
+ void getRidOfTemp();
+ void getRidOfTempText();
+ void getRidOfTemp2();
+ void getRidOfTemp3();
+ void getRidOfTempCharset();
+ void getRidOfTempsP();
+ void showFirstUse();
+ void showSecondUse();
+ void actualSave();
+ void actualLoad();
+ void loadPosition(unsigned int slot);
+ void savePosition(unsigned int slot, const char *descbuf);
+ uint16 allocateAndLoad(unsigned int size);
+ void clearAndLoad(uint8 *buf, uint8 c, unsigned int size, unsigned int maxSize);
+ void clearAndLoad(uint16 seg, uint8 c, unsigned int size, unsigned int maxSize);
+ void loadRoomData(const Room &room, bool skipDat);
+ void restoreAll();
+ void restoreReels();
+ void enterSymbol();
+ void viewFolder();
+ void edensCDPlayer();
+ void hotelBell();
+ void playGuitar();
+ void callEdensDLift();
+ void callEdensLift();
+ void sitDownInBar();
+ void trapDoor();
+ void useBalcony();
+ void useChurchHole();
+ void useCoveredBox();
+ void useElevator1();
+ void useElevator2();
+ void useElevator3();
+ void useElevator4();
+ void useElevator5();
+ void useDryer();
+ void useRailing();
+ void useWindow();
+ void useHatch();
+ void useLighter();
+ void wheelSound();
+ void callHotelLift();
+ void useShield();
+ void useWall();
+ void useChurchGate();
+ void useFullCart();
+ void useClearBox();
+ void usePlate();
+ void usePlinth();
+ void useElvDoor();
+ void useObject();
+ void useWinch();
+ void useCardReader1();
+ void useCardReader2();
+ void useCardReader3();
+ void usePoolReader();
+ void useCooker();
+ void useWire();
+ bool defaultUseHandler(const char *id);
+ void openTVDoor();
+ void wearWatch();
+ void wearShades();
+ void checkFolderCoords();
+ void loadFolder();
+ void showFolder();
+ void showLeftPage();
+ void showRightPage();
+ void nextFolder();
+ void lastFolder();
+ void folderHints();
+ void folderExit();
+ uint8 getLocation(uint8 index);
+ void getLocation();
+ void setLocation(uint8 index);
+ void setLocation();
+ void loadTempText();
+ void loadTempText(const char *fileName);
+ void loadTravelText();
+ void drawFloor();
+ void allocateBuffers();
+ void workToScreenM();
+ bool checkSpeed(ReelRoutine &routine);
+ void checkSpeed();
+ void sparkyDrip(ReelRoutine &routine);
+ void genericPerson(ReelRoutine &routine);
+ void gamer(ReelRoutine &routine);
+ void eden(ReelRoutine &routine);
+ void sparky(ReelRoutine &routine);
+ void rockstar(ReelRoutine &routine);
+ void madmansTelly(ReelRoutine &routine);
+ void smokeBloke(ReelRoutine &routine);
+ void manAsleep(ReelRoutine &routine);
+ void drunk(ReelRoutine &routine);
+ void introMagic1(ReelRoutine &routine);
+ void introMagic2(ReelRoutine &routine);
+ void introMagic3(ReelRoutine &routine);
+ void introMusic(ReelRoutine &routine);
+ void candles(ReelRoutine &routine);
+ void candles1(ReelRoutine &routine);
+ void candles2(ReelRoutine &routine);
+ void smallCandle(ReelRoutine &routine);
+ void gates(ReelRoutine &routine);
+ void security(ReelRoutine &routine);
+ void edenInBath(ReelRoutine &routine);
+ void louis(ReelRoutine &routine);
+ void handClap(ReelRoutine &routine);
+ void carParkDrip(ReelRoutine &routine);
+ void foghornSound(ReelRoutine &routine);
+ void train(ReelRoutine &routine);
+ void attendant(ReelRoutine &routine);
+ void keeper(ReelRoutine &routine);
+ void interviewer(ReelRoutine &routine);
+ void drinker(ReelRoutine &routine);
+ void alleyBarkSound(ReelRoutine &routine);
+ void louisChair(ReelRoutine &routine);
+ void bossMan(ReelRoutine &routine);
+ void priest(ReelRoutine &routine);
+ void priestText(ReelRoutine &routine);
+ void monkAndRyan(ReelRoutine &routine);
+ void copper(ReelRoutine &routine);
+ void introMonks1(ReelRoutine &routine);
+ void introMonks2(ReelRoutine &routine);
+ void soldier1(ReelRoutine &routine);
+ void singleKey(uint8 key, uint16 x, uint16 y);
+ void loadSaveBox();
+ void loadKeypad();
+ void showKeypad();
+ void showOuterPad();
+ uint8 nextSymbol(uint8 symbol);
+ void showSymbol();
+ void examIcon();
+ void buttonOne();
+ void buttonTwo();
+ void buttonThree();
+ void buttonFour();
+ void buttonFive();
+ void buttonSix();
+ void buttonSeven();
+ void buttonEight();
+ void buttonNine();
+ void buttonNought();
+ void buttonEnter();
+ void buttonPress(uint8 buttonId);
+ void addToPressList();
+ bool isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3);
+ void enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3);
+ unsigned int scanForNames();
+ void doLoad(int slot);
+ void loadOld();
+ void inventory();
+ void mainScreen();
+ void loadGame();
+ void saveGame();
+ void zoomOnOff();
+ void atmospheres();
+ void loadPersonal();
+ void loadNews();
+ void loadCart();
+ void hangOne(uint16 delay);
+ void hangOne();
+ void bibleQuote();
+ void realCredits();
+ void runIntroSeq();
+ void intro();
+ void clearBeforeLoad();
+ void clearReels();
+ void getRidOfReels();
+ void liftNoise(uint8 index);
+ void setTopLeft();
+ void setTopRight();
+ void setBotLeft();
+ void setBotRight();
+ void newGame();
+ void getBackFromOps();
+ void getBackToOps();
+ void pickupOb(uint8 command, uint8 pos);
+ void initialInv();
+ void walkIntoRoom();
+ void loadIntroRoom();
+ void afterIntroRoom();
+ void gettingShot();
+ void redrawMainScrn();
+ void selectSlot2();
+ void blank();
+ void allPointer();
+ void openYourNeighbour();
+ void openRyan();
+ void openPoolBoss();
+ void openEden();
+ void openSarters();
+ void openLouis();
+ void DOSReturn();
+ void useLadder();
+ void useLadderB();
+ void useCart();
+ void useTrainer();
+ void useHole();
+ void chewy();
+ void sLabDoorA();
+ void sLabDoorB();
+ void sLabDoorC();
+ void sLabDoorE();
+ void sLabDoorD();
+ void sLabDoorF();
+ void openHotelDoor();
+ void openHotelDoor2();
+ void grafittiDoor();
+ void openTomb();
+ void hotelControl();
+ void obsThatDoThings();
+ void makeMainScreen();
+ void openInv();
+ void delEverything();
+ void clearPalette();
+ void errorMessage1();
+ void errorMessage2();
+ void errorMessage3();
+ void reExFromOpen();
+ void nextDest();
+ void lastDest();
+ void destSelect();
+ void putBackObStuff();
+ void moreTalk();
+ void redes();
+ void isSetObOnMap();
+ bool isSetObOnMap(uint8 index);
+ void dumpKeypad();
+ void dumpSymbol();
+ void dumpSymBox();
+ void dumpZoom();
+ void selectLocation();
+ void showGroup();
+ void loadSpeech();
+ bool loadSpeech(byte type1, int idx1, byte type2, int idx2) {
+ return DreamBase::loadSpeech(type1, idx1, type2, idx2);
+ }
+ void getTime();
+ void set16ColPalette();
+ void examineInventory();
+ void showSaveOps();
+ void showLoadOps();
+ void watchReel();
+ void showWatchReel();
+ void plotReel(uint16 &reelPointer);
+ void removeFreeObject(uint8 index) {
+ DreamBase::removeFreeObject(index);
+ }
+ void afterNewRoom();
+ void madmanRun();
+ void showDecisions();
+ void underTextLine();
+ void getUnderZoom();
+ void putUnderZoom();
+ void decide();
+ void talk();
+ void discOps();
+ void doSaveLoad();
+ void useDiary();
+ void hangOnPQ();
+ void showGun();
+ void endGame();
+ void monitorLogo();
+ void quitSymbol();
+ void diaryKeyP();
+ void diaryKeyN();
+ void checkInput();
+ void dropError();
+ void cantDrop();
+ void getBack1();
+ void newPlace();
+ void showPuzText(uint16 command, uint16 count);
+ void showPuzText();
+ void monkSpeaking();
+ void rollEndCredits2();
+ void useButtonA();
+ void autoAppear();
+ void quitKey();
+#endif
diff --git a/engines/dreamweb/talk.cpp b/engines/dreamweb/talk.cpp
new file mode 100644
index 0000000000..86d1b886ef
--- /dev/null
+++ b/engines/dreamweb/talk.cpp
@@ -0,0 +1,38 @@
+/* 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 {
+
+uint16 DreamGenContext::getPersFrame(uint8 index) {
+ return getSegment(data.word(kPeople)).word(kPersonframes + index * 2);
+}
+
+void DreamGenContext::convIcons() {
+ uint8 index = data.byte(kCharacter) & 127;
+ uint16 frame = getPersFrame(index);
+ const Frame *base = findSource(frame);
+ showFrame(base, 234, 2, frame, 0);
+}
+
+} // End of namespace DreamGen
diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp
index d6648b556e..0990e5ba5e 100644
--- a/engines/dreamweb/use.cpp
+++ b/engines/dreamweb/use.cpp
@@ -27,95 +27,98 @@ namespace DreamGen {
typedef void (DreamGenContext::*UseCallback)(void);
+// Note: The callback pointer has been placed before the
+// ID to keep MSVC happy (otherwise, it throws warnings
+// that alignment of a member was sensitive to packing)
struct UseListEntry {
- uint8 id[5]; // 0-terminal because it is easier syntatically to initialize the array
UseCallback callback;
+ const char *id;
};
-void DreamGenContext::useroutine() {
+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 },
+ { &DreamGenContext::useMon, "NETW" },
+ { &DreamGenContext::useElevator1, "ELVA" },
+ { &DreamGenContext::useElevator2, "ELVB" },
+ { &DreamGenContext::useElevator3, "ELVC" },
+ { &DreamGenContext::useElevator4, "ELVE" },
+ { &DreamGenContext::useElevator5, "ELVF" },
+ { &DreamGenContext::useChurchGate, "CGAT" },
+ { &DreamGenContext::useStereo, "REMO" },
+ { &DreamGenContext::useButtonA, "BUTA" },
+ { &DreamGenContext::useWinch, "CBOX" },
+ { &DreamGenContext::useLighter, "LITE" },
+ { &DreamGenContext::usePlate, "PLAT" },
+ { &DreamGenContext::useControl, "LIFT" },
+ { &DreamGenContext::useWire, "WIRE" },
+ { &DreamGenContext::useHandle, "HNDL" },
+ { &DreamGenContext::useHatch, "HACH" },
+ { &DreamGenContext::useElvDoor, "DOOR" },
+ { &DreamGenContext::useCashCard, "CSHR" },
+ { &DreamGenContext::useGun, "GUNA" },
+ { &DreamGenContext::useCardReader1, "CRAA" },
+ { &DreamGenContext::useCardReader2, "CRBB" },
+ { &DreamGenContext::useCardReader3, "CRCC" },
+ { &DreamGenContext::sitDownInBar, "SEAT" },
+ { &DreamGenContext::useMenu, "MENU" },
+ { &DreamGenContext::useCooker, "COOK" },
+ { &DreamGenContext::callHotelLift, "ELCA" },
+ { &DreamGenContext::callEdensLift, "EDCA" },
+ { &DreamGenContext::callEdensDLift, "DDCA" },
+ { &DreamGenContext::useAltar, "ALTR" },
+ { &DreamGenContext::openHotelDoor, "LOKA" },
+ { &DreamGenContext::openHotelDoor2, "LOKB" },
+ { &DreamGenContext::openLouis, "ENTA" },
+ { &DreamGenContext::openRyan, "ENTB" },
+ { &DreamGenContext::openPoolBoss, "ENTE" },
+ { &DreamGenContext::openYourNeighbour, "ENTC" },
+ { &DreamGenContext::openEden, "ENTD" },
+ { &DreamGenContext::openSarters, "ENTH" },
+ { &DreamGenContext::wearWatch, "WWAT" },
+ { &DreamGenContext::usePoolReader, "POOL" },
+ { &DreamGenContext::wearShades, "WSHD" },
+ { &DreamGenContext::grafittiDoor, "GRAF" },
+ { &DreamGenContext::trapDoor, "TRAP" },
+ { &DreamGenContext::edensCDPlayer, "CDPE" },
+ { &DreamGenContext::openTVDoor, "DLOK" },
+ { &DreamGenContext::useHole, "HOLE" },
+ { &DreamGenContext::useDryer, "DRYR" },
+ { &DreamGenContext::useChurchHole, "HOLY" },
+ { &DreamGenContext::useWall, "WALL" },
+ { &DreamGenContext::useDiary, "BOOK" },
+ { &DreamGenContext::useAxe, "AXED" },
+ { &DreamGenContext::useShield, "SHLD" },
+ { &DreamGenContext::useRailing, "BCNY" },
+ { &DreamGenContext::useCoveredBox, "LIDC" },
+ { &DreamGenContext::useClearBox, "LIDU" },
+ { &DreamGenContext::useOpenBox, "LIDO" },
+ { &DreamGenContext::usePipe, "PIPE" },
+ { &DreamGenContext::useBalcony, "BALC" },
+ { &DreamGenContext::useWindow, "WIND" },
+ { &DreamGenContext::viewFolder, "PAPR" },
+ { &DreamGenContext::useTrainer, "UWTA" },
+ { &DreamGenContext::useTrainer, "UWTB" },
+ { &DreamGenContext::enterSymbol, "STAT" },
+ { &DreamGenContext::openTomb, "TLID" },
+ { &DreamGenContext::useSLab, "SLAB" },
+ { &DreamGenContext::useCart, "CART" },
+ { &DreamGenContext::useFullCart, "FCAR" },
+ { &DreamGenContext::sLabDoorA, "SLBA" },
+ { &DreamGenContext::sLabDoorB, "SLBB" },
+ { &DreamGenContext::sLabDoorC, "SLBC" },
+ { &DreamGenContext::sLabDoorD, "SLBD" },
+ { &DreamGenContext::sLabDoorE, "SLBE" },
+ { &DreamGenContext::sLabDoorF, "SLBF" },
+ { &DreamGenContext::usePlinth, "PLIN" },
+ { &DreamGenContext::useLadder, "LADD" },
+ { &DreamGenContext::useLadderB, "LADB" },
+ { &DreamGenContext::chewy, "GUMA" },
+ { &DreamGenContext::wheelSound, "SQEE" },
+ { &DreamGenContext::runTap, "TAPP" },
+ { &DreamGenContext::playGuitar, "GUIT" },
+ { &DreamGenContext::hotelControl, "CONT" },
+ { &DreamGenContext::hotelBell, "BELL" },
};
if (data.byte(kReallocation) >= 50) {
@@ -124,7 +127,7 @@ void DreamGenContext::useroutine() {
data.byte(kPointerpower) = 0;
}
- getanyad();
+ getAnyAd();
const uint8 *id = es.ptr(bx + 12, 4);
for (size_t i = 0; i < sizeof(kUseList)/sizeof(UseListEntry); ++i) {
@@ -135,44 +138,1090 @@ void DreamGenContext::useroutine() {
}
}
- delpointer();
- uint8 *obText = getobtextstartCPP();
- if (findnextcolon(&obText) != 0) {
- if (findnextcolon(&obText) != 0) {
+ delPointer();
+ uint8 *obText = getObTextStartCPP();
+ if (findNextColon(&obText) != 0) {
+ if (findNextColon(&obText) != 0) {
if (*obText != 0) {
- usetext(obText);
- hangonp(400);
- putbackobstuff();
+ useText(obText);
+ hangOnP(400);
+ putBackObStuff();
return;
}
}
}
- createpanel();
- showpanel();
- showman();
- showexit();
- obicons();
- printmessage(33, 100, 63, 241, true);
- worktoscreenm();
- hangonp(50);
- putbackobstuff();
+ 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() {
+ useText(es.ptr(si, 0));
}
-void DreamGenContext::usetext(const uint8 *string) {
- createpanel();
- showpanel();
- showman();
- showexit();
- obicons();
- printdirect(string, 36, 104, 241, true);
- worktoscreenm();
+void DreamGenContext::useText(const uint8 *string) {
+ createPanel();
+ showPanel();
+ showMan();
+ showExit();
+ obIcons();
+ printDirect(string, 36, 104, 241, true);
+ workToScreenM();
}
-} /*namespace dreamgen */
+void DreamGenContext::showFirstUse() {
+ uint8 *obText = getObTextStartCPP();
+ findNextColon(&obText);
+ findNextColon(&obText);
+ useText(obText);
+ hangOnP(400);
+}
+
+void DreamGenContext::showSecondUse() {
+ uint8 *obText = getObTextStartCPP();
+ findNextColon(&obText);
+ findNextColon(&obText);
+ findNextColon(&obText);
+ useText(obText);
+ hangOnP(400);
+}
+
+void DreamGenContext::viewFolder() {
+ data.byte(kManisoffscreen) = 1;
+ getRidOfAll();
+ loadFolder();
+ data.byte(kFolderpage) = 0;
+ showFolder();
+ workToScreenM();
+ data.byte(kGetback) = 0;
+ do {
+ if (quitRequested())
+ break;
+ delPointer();
+ readMouse();
+ showPointer();
+ vSync();
+ dumpPointer();
+ dumpTextLine();
+ checkFolderCoords();
+ } while (data.byte(kGetback) == 0);
+ data.byte(kManisoffscreen) = 0;
+ getRidOfTemp();
+ getRidOfTemp2();
+ getRidOfTemp3();
+ getRidOfTempCharset();
+ restoreAll();
+ redrawMainScrn();
+ workToScreenM();
+}
+
+void DreamGenContext::edensCDPlayer() {
+ showFirstUse();
+ data.word(kWatchingtime) = 18 * 2;
+ data.word(kReeltowatch) = 25;
+ data.word(kEndwatchreel) = 42;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::hotelBell() {
+ playChannel1(12);
+ showFirstUse();
+ putBackObStuff();
+}
+
+void DreamGenContext::playGuitar() {
+ playChannel1(14);
+ showFirstUse();
+ putBackObStuff();
+}
+
+void DreamGenContext::useElevator1() {
+ showFirstUse();
+ selectLocation();
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::useElevator2() {
+ showFirstUse();
+
+ if (data.byte(kLocation) == 23) // In pool hall
+ data.byte(kNewlocation) = 31;
+ else
+ data.byte(kNewlocation) = 23;
+
+ data.byte(kCounttoclose) = 20;
+ data.byte(kCounttoopen) = 0;
+ data.word(kWatchingtime) = 80;
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::useElevator3() {
+ showFirstUse();
+ data.byte(kCounttoclose) = 20;
+ data.byte(kNewlocation) = 34;
+ data.word(kReeltowatch) = 46;
+ data.word(kEndwatchreel) = 63;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.word(kWatchingtime) = 80;
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::useElevator4() {
+ showFirstUse();
+ data.word(kReeltowatch) = 0;
+ data.word(kEndwatchreel) = 11;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.byte(kCounttoclose) = 20;
+ data.word(kWatchingtime) = 80;
+ data.byte(kGetback) = 1;
+ data.byte(kNewlocation) = 24;
+}
+
+void DreamGenContext::useElevator5() {
+ placeSetObject(4);
+ removeSetObject(0);
+ data.byte(kNewlocation) = 20;
+ data.word(kWatchingtime) = 80;
+ data.byte(kLiftflag) = 1;
+ data.byte(kCounttoclose) = 8;
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::useHatch() {
+ showFirstUse();
+ data.byte(kNewlocation) = 40;
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::wheelSound() {
+ playChannel1(17);
+ showFirstUse();
+ putBackObStuff();
+}
+
+void DreamGenContext::callHotelLift() {
+ playChannel1(12);
+ showFirstUse();
+ data.byte(kCounttoopen) = 8;
+ data.byte(kGetback) = 1;
+ data.byte(kDestination) = 5;
+ data.byte(kFinaldest) = 5;
+ autoSetWalk();
+ turnPathOn(4);
+}
+
+void DreamGenContext::useShield() {
+ if (data.byte(kReallocation) != 20 || data.byte(kCombatcount) == 0) {
+ // Not in Sart room
+ showFirstUse();
+ putBackObStuff();
+ } else {
+ data.byte(kLastweapon) = 3;
+ showSecondUse();
+ data.byte(kGetback) = 1;
+ data.byte(kProgresspoints)++;
+ removeObFromInv();
+ }
+}
+
+void DreamGenContext::useCoveredBox() {
+ data.byte(kProgresspoints)++;
+ showFirstUse();
+ data.word(kWatchingtime) = 50;
+ data.word(kReeltowatch) = 41;
+ data.word(kEndwatchreel) = 66;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::useRailing() {
+ showFirstUse();
+ data.word(kWatchingtime) = 80;
+ data.word(kReeltowatch) = 0;
+ data.word(kEndwatchreel) = 30;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.byte(kGetback) = 1;
+ data.byte(kMandead) = 4;
+}
+
+void DreamGenContext::wearWatch() {
+ if (data.byte(kWatchon) == 1) {
+ // Already wearing watch
+ showSecondUse();
+ putBackObStuff();
+ } else {
+ showFirstUse();
+ data.byte(kWatchon) = 1;
+ data.byte(kGetback) = 1;
+ getAnyAd();
+ makeWorn();
+ }
+}
+
+void DreamGenContext::wearShades() {
+ if (data.byte(kShadeson) == 1) {
+ // Already wearing shades
+ showSecondUse();
+ putBackObStuff();
+ } else {
+ data.byte(kShadeson) = 1;
+ showFirstUse();
+ data.byte(kGetback) = 1;
+ getAnyAd();
+ makeWorn();
+ }
+}
+
+void DreamGenContext::useChurchHole() {
+ showFirstUse();
+ data.byte(kGetback) = 1;
+ data.word(kWatchingtime) = 28;
+ data.word(kReeltowatch) = 13;
+ data.word(kEndwatchreel) = 26;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+}
+
+void DreamGenContext::sitDownInBar() {
+ if (data.byte(kWatchmode) != 0xFF) {
+ // Sat down
+ showSecondUse();
+ putBackObStuff();
+ } else {
+ showFirstUse();
+ data.word(kWatchingtime) = 50;
+ data.word(kReeltowatch) = 55;
+ data.word(kEndwatchreel) = 71;
+ data.word(kReeltohold) = 73;
+ data.word(kEndofholdreel) = 83;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.byte(kGetback) = 1;
+ }
+}
+
+void DreamGenContext::useDryer() {
+ playChannel1(12);
+ showFirstUse();
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::useBalcony() {
+ showFirstUse();
+ turnPathOn(6);
+ turnPathOff(0);
+ turnPathOff(1);
+ turnPathOff(2);
+ turnPathOff(3);
+ turnPathOff(4);
+ turnPathOff(5);
+ data.byte(kProgresspoints)++;
+ data.byte(kManspath) = 6;
+ data.byte(kDestination) = 6;
+ data.byte(kFinaldest) = 6;
+ findXYFromPath();
+ switchRyanOff();
+ data.byte(kResetmanxy) = 1;
+ data.word(kWatchingtime) = 30 * 2;
+ data.word(kReeltowatch) = 183;
+ data.word(kEndwatchreel) = 212;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::useWindow() {
+ if (data.byte(kManspath) != 6) {
+ // Not on balcony
+ showSecondUse();
+ putBackObStuff();
+ } else {
+ data.byte(kProgresspoints)++;
+ showFirstUse();
+ data.byte(kNewlocation) = 29;
+ data.byte(kGetback) = 1;
+ }
+}
+
+void DreamGenContext::trapDoor() {
+ data.byte(kProgresspoints)++;
+ showFirstUse();
+ switchRyanOff();
+ data.word(kWatchingtime) = 20 * 2;
+ data.word(kReeltowatch) = 181;
+ data.word(kEndwatchreel) = 197;
+ data.byte(kNewlocation) = 26;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::callEdensLift() {
+ showFirstUse();
+ data.byte(kCounttoopen) = 8;
+ data.byte(kGetback) = 1;
+ turnPathOn(2);
+}
+
+void DreamGenContext::callEdensDLift() {
+ if (data.byte(kLiftflag) == 1) {
+ // Eden's D here
+ showSecondUse();
+ putBackObStuff();
+ } else {
+ showFirstUse();
+ data.byte(kCounttoopen) = 8;
+ data.byte(kGetback) = 1;
+ turnPathOn(2);
+ }
+}
+
+void DreamGenContext::openYourNeighbour() {
+ enterCode(255, 255, 255, 255);
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::openRyan() {
+ enterCode(5, 1, 0, 6);
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::openPoolBoss() {
+ enterCode(5, 2, 2, 2);
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::openEden() {
+ enterCode(2, 8, 6, 5);
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::openSarters() {
+ enterCode(7, 8, 3, 3);
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::openLouis() {
+ enterCode(5, 2, 3, 8);
+ data.byte(kGetback) = 1;
+}
+
+
+void DreamGenContext::useWall() {
+ showFirstUse();
+
+ if (data.byte(kManspath) != 3) {
+ data.word(kWatchingtime) = 30*2;
+ data.word(kReeltowatch) = 2;
+ data.word(kEndwatchreel) = 31;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.byte(kGetback) = 1;
+ turnPathOn(3);
+ turnPathOn(4);
+ turnPathOff(0);
+ turnPathOff(1);
+ turnPathOff(2);
+ turnPathOff(5);
+ data.byte(kManspath) = 3;
+ data.byte(kFinaldest) = 3;
+ findXYFromPath();
+ data.byte(kResetmanxy) = 1;
+ switchRyanOff();
+ } else {
+ // Go back over
+ data.word(kWatchingtime) = 30 * 2;
+ data.word(kReeltowatch) = 34;
+ data.word(kEndwatchreel) = 60;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.byte(kGetback) = 1;
+ turnPathOff(3);
+ turnPathOff(4);
+ turnPathOn(0);
+ turnPathOn(1);
+ turnPathOn(2);
+ turnPathOn(5);
+ data.byte(kManspath) = 5;
+ data.byte(kFinaldest) = 5;
+ findXYFromPath();
+ data.byte(kResetmanxy) = 1;
+ switchRyanOff();
+ }
+}
+
+void DreamGenContext::useLadder() {
+ showFirstUse();
+ data.byte(kMapx) = data.byte(kMapx) - 11;
+ findRoomInLoc();
+ data.byte(kFacing) = 6;
+ data.byte(kTurntoface) = 6;
+ data.byte(kManspath) = 0;
+ data.byte(kDestination) = 0;
+ data.byte(kFinaldest) = 0;
+ findXYFromPath();
+ data.byte(kResetmanxy) = 1;
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::useLadderB() {
+ showFirstUse();
+ data.byte(kMapx) = data.byte(kMapx) + 11;
+ findRoomInLoc();
+ data.byte(kFacing) = 2;
+ data.byte(kTurntoface) = 2;
+ data.byte(kManspath) = 1;
+ data.byte(kDestination) = 1;
+ data.byte(kFinaldest) = 1;
+ findXYFromPath();
+ data.byte(kResetmanxy) = 1;
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::sLabDoorA() {
+ showFirstUse();
+ data.byte(kGetback) = 1;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.word(kReeltowatch) = 13;
+ if (data.byte(kDreamnumber) != 3) {
+ // Wrong
+ data.word(kWatchingtime) = 40;
+ data.word(kEndwatchreel) = 34;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ } else {
+ data.byte(kProgresspoints)++;
+ data.word(kWatchingtime) = 60;
+ data.word(kEndwatchreel) = 42;
+ data.byte(kNewlocation) = 47;
+ }
+}
+
+void DreamGenContext::sLabDoorB() {
+ if (data.byte(kDreamnumber) != 1) {
+ // Wrong
+ showFirstUse();
+ data.byte(kGetback) = 1;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.word(kReeltowatch) = 44;
+ data.word(kWatchingtime) = 40;
+ data.word(kEndwatchreel) = 63;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ } else {
+ al = 'S';
+ ah = 'H';
+ cl = 'L';
+ ch = 'D';
+ isRyanHolding();
+
+ if (flags.z()) {
+ // No crystal
+ showPuzText(44, 200);
+ putBackObStuff();
+ } else {
+ // Got crystal
+ showFirstUse();
+ data.byte(kProgresspoints)++;
+ data.byte(kGetback) = 1;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.word(kReeltowatch) = 44;
+ data.word(kWatchingtime) = 60;
+ data.word(kEndwatchreel) = 71;
+ data.byte(kNewlocation) = 47;
+ }
+ }
+}
+
+void DreamGenContext::sLabDoorC() {
+ showFirstUse();
+ data.byte(kGetback) = 1;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.word(kReeltowatch) = 108;
+ if (data.byte(kDreamnumber) != 4) {
+ // Wrong
+ data.word(kWatchingtime) = 40;
+ data.word(kEndwatchreel) = 127;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ } else {
+ data.byte(kProgresspoints)++;
+ data.word(kWatchingtime) = 60;
+ data.word(kEndwatchreel) = 135;
+ data.byte(kNewlocation) = 47;
+ }
+}
+
+void DreamGenContext::sLabDoorD() {
+ showFirstUse();
+ data.byte(kGetback) = 1;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.word(kReeltowatch) = 75;
+ if (data.byte(kDreamnumber) != 0) {
+ // Wrong
+ data.word(kWatchingtime) = 40;
+ data.word(kEndwatchreel) = 94;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ } else {
+ data.byte(kProgresspoints)++;
+ data.word(kWatchingtime) = 60;
+ data.word(kEndwatchreel) = 102;
+ data.byte(kNewlocation) = 47;
+ }
+}
+
+void DreamGenContext::sLabDoorE() {
+ showFirstUse();
+ data.byte(kGetback) = 1;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.word(kReeltowatch) = 141;
+ if (data.byte(kDreamnumber) != 5) {
+ // Wrong
+ data.word(kWatchingtime) = 40;
+ data.word(kEndwatchreel) = 160;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ } else {
+ data.byte(kProgresspoints)++;
+ data.word(kWatchingtime) = 60;
+ data.word(kEndwatchreel) = 168;
+ data.byte(kNewlocation) = 47;
+ }
+}
+
+void DreamGenContext::sLabDoorF() {
+ showFirstUse();
+ data.byte(kGetback) = 1;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.word(kReeltowatch) = 171;
+ if (data.byte(kDreamnumber) != 2) {
+ // Wrong
+ data.word(kWatchingtime) = 40;
+ data.word(kEndwatchreel) = 189;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ } else {
+ data.byte(kProgresspoints)++;
+ data.word(kWatchingtime) = 60;
+ data.word(kEndwatchreel) = 197;
+ data.byte(kNewlocation) = 47;
+ }
+}
+
+bool DreamGenContext::defaultUseHandler(const char *id) {
+ if (data.byte(kWithobject) == 255) {
+ withWhat();
+ return true; // event handled
+ }
+
+ if (!compare(data.byte(kWithobject), data.byte(kWithtype), id)) {
+ // Wrong item
+ showPuzText(14, 300);
+ putBackObStuff();
+ return true; // event handled
+ }
+
+ return false; // continue with the original event
+}
+
+void DreamGenContext::useChurchGate() {
+ char id[4] = { 'C', 'U', 'T', 'T' }; // TODO: convert to string with trailing zero
+ if (defaultUseHandler(id))
+ return;
+
+ // Cut gate
+ showFirstUse();
+ data.word(kWatchingtime) = 64 * 2;
+ data.word(kReeltowatch) = 4;
+ data.word(kEndwatchreel) = 70;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.byte(kGetback) = 1;
+ data.byte(kProgresspoints)++;
+ turnPathOn(3);
+ if (data.byte(kAidedead) != 0)
+ turnPathOn(2); // Open church
+}
+
+void DreamGenContext::useFullCart() {
+ data.byte(kProgresspoints)++;
+ turnAnyPathOn(2, data.byte(kRoomnum) + 6);
+ data.byte(kManspath) = 4;
+ data.byte(kFacing) = 4;
+ data.byte(kTurntoface) = 4;
+ data.byte(kFinaldest) = 4;
+ findXYFromPath();
+ data.byte(kResetmanxy) = 1;
+ showFirstUse();
+ data.word(kWatchingtime) = 72 * 2;
+ data.word(kReeltowatch) = 58;
+ data.word(kEndwatchreel) = 142;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::useClearBox() {
+ char id[4] = { 'R', 'A', 'I', 'L' }; // TODO: convert to string with trailing zero
+ if (defaultUseHandler(id))
+ return;
+
+ // Open box
+ data.byte(kProgresspoints)++;
+ showFirstUse();
+ data.word(kWatchingtime) = 80;
+ data.word(kReeltowatch) = 67;
+ data.word(kEndwatchreel) = 105;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::openTVDoor() {
+ char id[4] = { 'U', 'L', 'O', 'K' }; // TODO: convert to string with trailing zero
+ if (defaultUseHandler(id))
+ return;
+
+ // Key on TV
+ showFirstUse();
+ data.byte(kLockstatus) = 0;
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::usePlate() {
+ if (data.byte(kWithobject) == 255) {
+ withWhat();
+ return;
+ }
+
+ char screw[4] = { 'S', 'C', 'R', 'W' }; // TODO: convert to string with trailing zero
+ char knife[4] = { 'K', 'N', 'F', 'E' }; // TODO: convert to string with trailing zero
+ if (compare(data.byte(kWithobject), data.byte(kWithtype), screw)) {
+ // Unscrew plate
+ playChannel1(20);
+ showFirstUse();
+ placeSetObject(28);
+ placeSetObject(24);
+ removeSetObject(25);
+ placeFreeObject(0);
+ data.byte(kProgresspoints)++;
+ data.byte(kGetback) = 1;
+ } else if (compare(data.byte(kWithobject), data.byte(kWithtype), knife)) {
+ // Tried knife
+ showPuzText(54, 300);
+ putBackObStuff();
+ } else {
+ // Wrong item
+ showPuzText(14, 300);
+ putBackObStuff();
+ }
+}
+
+void DreamGenContext::usePlinth() {
+ if (data.byte(kWithobject) == 255) {
+ withWhat();
+ return;
+ }
+
+ char id[4] = { 'D', 'K', 'E', 'Y' }; // TODO: convert to string with trailing zero
+ if (!compare(data.byte(kWithobject), data.byte(kWithtype), id)) {
+ // Wrong key
+ showFirstUse();
+ putBackObStuff();
+ } else {
+ data.byte(kProgresspoints)++;
+ showSecondUse();
+ data.word(kWatchingtime) = 220;
+ data.word(kReeltowatch) = 0;
+ data.word(kEndwatchreel) = 104;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.byte(kGetback) = 1;
+ data.byte(kNewlocation) = data.byte(kRoomafterdream);
+ }
+}
+
+void DreamGenContext::useElvDoor() {
+ char id[4] = { 'A', 'X', 'E', 'D' }; // TODO: convert to string with trailing zero
+ if (defaultUseHandler(id))
+ return;
+
+ // Axe on door
+ showPuzText(15, 300);
+ _inc(data.byte(kProgresspoints));
+ data.word(kWatchingtime) = 46 * 2;
+ data.word(kReeltowatch) = 31;
+ data.word(kEndwatchreel) = 77;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::useObject() {
+ data.byte(kWithobject) = 255;
+
+ if (data.byte(kCommandtype) != 229) {
+ data.byte(kCommandtype) = 229;
+ commandWithOb(51, data.byte(kObjecttype), data.byte(kCommand));
+ }
+
+ if (data.word(kMousebutton) == data.word(kOldbutton))
+ return; // nouse
+
+ if (data.word(kMousebutton) & 1)
+ useRoutine();
+}
+
+void DreamGenContext::useWinch() {
+ al = 40;
+ ah = 1;
+ checkInside();
+
+ char id[4] = { 'F', 'U', 'S', 'E' }; // TODO: convert to string with trailing zero
+ if (cl == kNumexobjects || !compare(cl, 4, id)) {
+ // No winch
+ showFirstUse();
+ putBackObStuff();
+ return;
+ }
+
+ data.word(kWatchingtime) = 217 * 2;
+ data.word(kReeltowatch) = 0;
+ data.word(kEndwatchreel) = 217;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.byte(kDestpos) = 1;
+ data.byte(kNewlocation) = 45;
+ data.byte(kDreamnumber) = 1;
+ data.byte(kRoomafterdream) = 44;
+ data.byte(kGeneraldead) = 1;
+ data.byte(kNewsitem) = 2;
+ data.byte(kGetback) = 1;
+ data.byte(kProgresspoints)++;
+}
+
+void DreamGenContext::useCart() {
+ char id[4] = { 'R', 'O', 'C', 'K' }; // TODO: convert to string with trailing zero
+ if (defaultUseHandler(id))
+ return;
+
+ DynObject *exObject = getExAd(data.byte(kWithobject));
+ exObject->mapad[0] = 0;
+ removeSetObject(data.byte(kCommand));
+ placeSetObject(data.byte(kCommand) + 1);
+ data.byte(kProgresspoints)++;
+ playChannel1(17);
+ showFirstUse();
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::useTrainer() {
+ // TODO: Use the C++ version of getAnyAd()
+ getAnyAd();
+ if (es.byte(bx + 2) != 4) {
+ notHeldError();
+ } else {
+ data.byte(kProgresspoints)++;
+ makeWorn();
+ showSecondUse();
+ putBackObStuff();
+ }
+}
+
+void DreamGenContext::chewy() {
+ showFirstUse();
+ // TODO: Use the C++ version of getAnyAd()
+ getAnyAd();
+ es.byte(bx + 2) = 255;
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::useHole() {
+ char id[4] = { 'H', 'N', 'D', 'A' }; // TODO: convert to string with trailing zero
+ if (defaultUseHandler(id))
+ return;
+
+ showFirstUse();
+ removeSetObject(86);
+ DynObject *exObject = getExAd(data.byte(kWithobject));
+ exObject->mapad[0] = 255;
+ data.byte(kCanmovealtar) = 1;
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::openHotelDoor() {
+ char id[4] = { 'K', 'E', 'Y', 'A' }; // TODO: convert to string with trailing zero
+ if (defaultUseHandler(id))
+ return;
+
+ playChannel1(16);
+ showFirstUse();
+ data.byte(kLockstatus) = 0;
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::openHotelDoor2() {
+ char id[4] = { 'K', 'E', 'Y', 'A' }; // TODO: convert to string with trailing zero
+ if (defaultUseHandler(id))
+ return;
+
+ playChannel1(16);
+ showFirstUse();
+ putBackObStuff();
+}
+
+void DreamGenContext::grafittiDoor() {
+ char id[4] = { 'A', 'P', 'E', 'N' }; // TODO: convert to string with trailing zero
+ if (defaultUseHandler(id))
+ return;
+
+ showFirstUse();
+ putBackObStuff();
+}
+
+void DreamGenContext::usePoolReader() {
+ char id[4] = { 'M', 'E', 'M', 'B' }; // TODO: convert to string with trailing zero
+ if (defaultUseHandler(id))
+ return;
+
+ if (data.byte(kTalkedtoattendant) != 1) {
+ // Can't open pool
+ showSecondUse();
+ putBackObStuff();
+ } else {
+ playChannel1(17);
+ showFirstUse();
+ data.byte(kCounttoopen) = 6;
+ data.byte(kGetback) = 1;
+ }
+}
+
+void DreamGenContext::useCardReader1() {
+ char id[4] = { 'C', 'S', 'H', 'R' }; // TODO: convert to string with trailing zero
+ if (defaultUseHandler(id))
+ return;
+
+ if (data.byte(kTalkedtosparky) == 0) {
+ // Not yet
+ showFirstUse();
+ putBackObStuff();
+ } else if (data.word(kCard1money) != 0) {
+ // No cash
+ showPuzText(17, 300);
+ putBackObStuff();
+ } else {
+ // Get cash
+ playChannel1(16);
+ showPuzText(18, 300);
+ data.byte(kProgresspoints)++;
+ data.word(kCard1money) = 12432;
+ data.byte(kGetback) = 1;
+ }
+}
+
+void DreamGenContext::useCardReader2() {
+ char id[4] = { 'C', 'S', 'H', 'R' }; // TODO: convert to string with trailing zero
+ if (defaultUseHandler(id))
+ return;
+
+ if (data.byte(kTalkedtoboss) == 0) {
+ // Haven't talked to boss
+ showFirstUse();
+ putBackObStuff();
+ } else if (data.byte(kCard1money) == 0) {
+ // No cash
+ showPuzText(20, 300);
+ putBackObStuff();
+ } else if (data.byte(kGunpassflag) == 2) {
+ // Already got new
+ showPuzText(22, 300);
+ putBackObStuff();
+ } else {
+ playChannel1(18);
+ showPuzText(19, 300);
+ placeSetObject(94);
+ data.byte(kGunpassflag) = 1;
+ data.word(kCard1money) -= 2000;
+ data.byte(kProgresspoints)++;
+ data.byte(kGetback) = 1;
+ }
+}
+
+void DreamGenContext::useCardReader3() {
+ char id[4] = { 'C', 'S', 'H', 'R' }; // TODO: convert to string with trailing zero
+ if (defaultUseHandler(id))
+ return;
+
+ if (data.byte(kTalkedtorecep) == 0) {
+ // Haven't talked to receptionist
+ showFirstUse();
+ putBackObStuff();
+ } else if (data.byte(kCardpassflag) != 0) {
+ // Already used it
+ showPuzText(26, 300);
+ putBackObStuff();
+ } else {
+ playChannel1(16);
+ showPuzText(25, 300);
+ data.byte(kProgresspoints)++;
+ data.word(kCard1money) -= 8300;
+ data.byte(kCardpassflag) = 1;
+ data.byte(kGetback) = 1;
+ }
+}
+
+void DreamGenContext::useLighter() {
+ if (data.byte(kWithobject) == 255) {
+ withWhat();
+ return;
+ }
+
+ char id[4] = { 'S', 'M', 'K', 'E' }; // TODO: convert to string with trailing zero
+ if (!compare(data.byte(kWithobject), data.byte(kWithtype), id)) {
+ showFirstUse();
+ putBackObStuff();
+ } else {
+ showPuzText(9, 300);
+ DynObject *withObj = getExAd(data.byte(kWithobject));
+ withObj->mapad[0] = 255;
+ data.byte(kGetback) = 1;
+ }
+}
+
+void DreamGenContext::useWire() {
+ if (data.byte(kWithobject) == 255) {
+ withWhat();
+ return;
+ }
+
+ char knife[4] = { 'K', 'N', 'F', 'E' }; // TODO: convert to string with trailing zero
+ if (compare(data.byte(kWithobject), data.byte(kWithtype), knife)) {
+ removeSetObject(51);
+ placeSetObject(52);
+ showPuzText(11, 300);
+ data.byte(kProgresspoints)++;
+ data.byte(kGetback) = 1;
+ return;
+ }
+
+ char axe[4] = { 'A', 'X', 'E', 'D' }; // TODO: convert to string with trailing zero
+ if (compare(data.byte(kWithobject), data.byte(kWithtype), axe)) {
+ showPuzText(16, 300);
+ putBackObStuff();
+ return;
+ }
+
+ showPuzText(14, 300);
+ putBackObStuff();
+}
+
+void DreamGenContext::openTomb() {
+ data.byte(kProgresspoints)++;
+ showFirstUse();
+ data.word(kWatchingtime) = 35 * 2;
+ data.word(kReeltowatch) = 1;
+ data.word(kEndwatchreel) = 33;
+ data.byte(kWatchspeed) = 1;
+ data.byte(kSpeedcount) = 1;
+ data.byte(kGetback) = 1;
+}
+
+void DreamGenContext::hotelControl() {
+ if (data.byte(kReallocation) != 21 || data.byte(kMapx) != 33)
+ showSecondUse(); // Not right control
+ else
+ showFirstUse();
+
+ putBackObStuff();
+}
+
+void DreamGenContext::useCooker() {
+ al = data.byte(kCommand);
+ ah = data.byte(kObjecttype);
+ checkInside();
+
+ if (cl == 114)
+ showFirstUse();
+ else
+ showSecondUse(); // Food inside
+
+ putBackObStuff();
+}
+
+void DreamBase::placeFreeObject(uint8 index) {
+ findOrMake(index, 0, 1);
+ getFreeAd(index)->mapad[0] = 0;
+}
+
+void DreamBase::removeFreeObject(uint8 index) {
+ getFreeAd(index)->mapad[0] = 0xFF;
+}
+
+void DreamGenContext::useDiary() {
+ getRidOfReels();
+ loadIntoTemp("DREAMWEB.G14");
+ loadTempText("DREAMWEB.T51");
+ loadTempCharset("DREAMWEB.C02");
+ createPanel();
+ showIcon();
+ showDiary();
+ underTextLine();
+ showDiaryPage();
+ readMouse();
+ showPointer();
+ workToScreenCPP();
+ delPointer();
+ data.byte(kGetback) = 0;
+
+ RectWithCallback diaryList[] = {
+ { kDiaryx+94,kDiaryx+110,kDiaryy+97,kDiaryy+113,&DreamGenContext::diaryKeyN },
+ { kDiaryx+151,kDiaryx+167,kDiaryy+71,kDiaryy+87,&DreamGenContext::diaryKeyP },
+ { kDiaryx+176,kDiaryx+192,kDiaryy+108,kDiaryy+124,&DreamGenContext::quitKey },
+ { 0,320,0,200,&DreamGenContext::blank },
+ { 0xFFFF,0,0,0,0 }
+ };
+
+ do {
+ delPointer();
+ readMouse();
+ showDiaryKeys();
+ showPointer();
+ vSync();
+ dumpPointer();
+ dumpDiaryKeys();
+ dumpTextLine();
+ checkCoords(diaryList);
+ } while (!data.byte(kGetback));
+
+ getRidOfTemp();
+ getRidOfTempText();
+ getRidOfTempCharset();
+ restoreReels();
+ data.byte(kManisoffscreen) = 0;
+ redrawMainScrn();
+ workToScreenM();
+}
+} // End of namespace DreamGen
diff --git a/engines/dreamweb/vgafades.cpp b/engines/dreamweb/vgafades.cpp
new file mode 100644
index 0000000000..ca63b7308c
--- /dev/null
+++ b/engines/dreamweb/vgafades.cpp
@@ -0,0 +1,255 @@
+/* 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 {
+
+uint8 *DreamBase::mainPalette() {
+ return getSegment(data.word(kBuffers)).ptr(kMaingamepal, 256 * 3);
+}
+
+uint8 *DreamBase::startPalette() {
+ return getSegment(data.word(kBuffers)).ptr(kStartpal, 256 * 3);
+}
+
+uint8 *DreamBase::endPalette() {
+ return getSegment(data.word(kBuffers)).ptr(kEndpal, 256 * 3);
+}
+
+void DreamBase::clearStartPal() {
+ memset(startPalette(), 0, 256 * 3);
+}
+
+void DreamBase::clearEndPal() {
+ memset(endPalette(), 0, 256 * 3);
+}
+
+void DreamBase::palToStartPal() {
+ memcpy(startPalette(), mainPalette(), 256 * 3);
+}
+
+void DreamBase::endPalToStart() {
+ memcpy(startPalette(), endPalette(), 256 * 3);
+}
+
+void DreamBase::startPalToEnd() {
+ memcpy(endPalette(), startPalette(), 256 * 3);
+}
+
+void DreamBase::palToEndPal() {
+ memcpy(endPalette(), mainPalette(), 256 * 3);
+}
+
+void DreamBase::fadeDOS() {
+ return; // FIXME later
+
+ engine->waitForVSync();
+ //processEvents will be called from vsync
+ uint8 *dst = startPalette();
+ engine->getPalette(dst, 0, 64);
+ for (int fade = 0; fade < 64; ++fade) {
+ for (int c = 0; c < 768; ++c) { //original sources decrement 768 values -> 256 colors
+ if (dst[c]) {
+ --dst[c];
+ }
+ }
+ engine->setPalette(dst, 0, 64);
+ engine->waitForVSync();
+ }
+}
+
+void DreamBase::doFade() {
+ if (data.byte(kFadedirection) == 0)
+ return;
+
+ engine->processEvents();
+ uint8 *src = startPalette() + 3 * data.byte(kColourpos);
+ engine->setPalette(src, data.byte(kColourpos), data.byte(kNumtofade));
+
+ data.byte(kColourpos) += data.byte(kNumtofade);
+ if (data.byte(kColourpos) == 0)
+ fadeCalculation();
+}
+
+void DreamBase::fadeCalculation() {
+ if (data.byte(kFadecount) == 0) {
+ data.byte(kFadedirection) = 0;
+ return;
+ }
+
+ uint8 *startPal = startPalette();
+ const uint8 *endPal = endPalette();
+ for (size_t i = 0; i < 256 * 3; ++i) {
+ uint8 s = startPal[i];
+ uint8 e = endPal[i];
+ if (s == e)
+ continue;
+ else if (s > e)
+ --startPal[i];
+ else {
+ if (data.byte(kFadecount) <= e)
+ ++startPal[i];
+ }
+ }
+ --data.byte(kFadecount);
+}
+
+void DreamGenContext::fadeupYellows() {
+ palToEndPal();
+ memset(endPalette() + 231 * 3, 0, 8 * 3);
+ memset(endPalette() + 246 * 3, 0, 1 * 3);
+ data.byte(kFadedirection) = 1;
+ data.byte(kFadecount) = 63;
+ data.byte(kColourpos) = 0;
+ data.byte(kNumtofade) = 128;
+ hangOn(128);
+}
+
+void DreamGenContext::fadeupMonFirst() {
+ palToStartPal();
+ palToEndPal();
+ memset(startPalette() + 231 * 3, 0, 8 * 3);
+ memset(startPalette() + 246 * 3, 0, 1 * 3);
+ data.byte(kFadedirection) = 1;
+ data.byte(kFadecount) = 63;
+ data.byte(kColourpos) = 0;
+ data.byte(kNumtofade) = 128;
+ hangOn(64);
+ playChannel1(26);
+ hangOn(64);
+}
+
+void DreamBase::fadeScreenUp() {
+ clearStartPal();
+ palToEndPal();
+ data.byte(kFadedirection) = 1;
+ data.byte(kFadecount) = 63;
+ data.byte(kColourpos) = 0;
+ data.byte(kNumtofade) = 128;
+}
+
+void DreamBase::fadeScreenUps() {
+ clearStartPal();
+ palToEndPal();
+ data.byte(kFadedirection) = 1;
+ data.byte(kFadecount) = 63;
+ data.byte(kColourpos) = 0;
+ data.byte(kNumtofade) = 64;
+}
+
+void DreamBase::fadeScreenUpHalf() {
+ endPalToStart();
+ palToEndPal();
+ data.byte(kFadedirection) = 1;
+ data.byte(kFadecount) = 31;
+ data.byte(kColourpos) = 0;
+ data.byte(kNumtofade) = 32;
+}
+
+void DreamBase::fadeScreenDown() {
+ palToStartPal();
+ clearEndPal();
+ data.byte(kFadedirection) = 1;
+ data.byte(kFadecount) = 63;
+ data.byte(kColourpos) = 0;
+ data.byte(kNumtofade) = 128;
+}
+
+void DreamBase::fadeScreenDowns() {
+ palToStartPal();
+ clearEndPal();
+ data.byte(kFadedirection) = 1;
+ data.byte(kFadecount) = 63;
+ data.byte(kColourpos) = 0;
+ data.byte(kNumtofade) = 64;
+}
+
+void DreamGenContext::clearPalette() {
+ data.byte(kFadedirection) = 0;
+ clearStartPal();
+ dumpCurrent();
+}
+
+// Converts palette to grey scale, summed using formula
+// .20xred + .59xGreen + .11xBlue
+void DreamBase::greyscaleSum() {
+ byte *src = mainPalette();
+ byte *dst = endPalette();
+
+ for (int i = 0; i < 256; ++i) {
+ const unsigned int r = 20 * *src++;
+ const unsigned int g = 59 * *src++;
+ const unsigned int b = 11 * *src++;
+ const byte grey = (r + b + g) / 100;
+ byte tmp;
+
+ tmp = grey;
+ //if (tmp != 0) // FIXME: The assembler code has this check commented out. Bug or feature?
+ tmp += data.byte(kAddtored);
+ *dst++ = tmp;
+
+ tmp = grey;
+ if (tmp != 0)
+ tmp += data.byte(kAddtogreen);
+ *dst++ = tmp;
+
+ tmp = grey;
+ if (tmp != 0)
+ tmp += data.byte(kAddtoblue);
+ *dst++ = tmp;
+ }
+}
+
+void DreamBase::allPalette() {
+ memcpy(startPalette(), mainPalette(), 3 * 256);
+ dumpCurrent();
+}
+
+void DreamBase::dumpCurrent() {
+ uint8 *pal = startPalette();
+
+ engine->waitForVSync();
+ engine->processEvents();
+ engine->setPalette(pal, 0, 128);
+
+ pal += 128 * 3;
+
+ engine->waitForVSync();
+ engine->processEvents();
+ engine->setPalette(pal, 128, 128);
+}
+
+void DreamGenContext::showGroup() {
+ engine->processEvents();
+ unsigned n = (uint16)cx;
+ uint8 *src = ds.ptr(si, n * 3);
+ engine->setPalette(src, al, n);
+ si += n * 3;
+ cx = 0;
+}
+
+void DreamGenContext::rollEndCredits2() {
+ rollEm();
+}
+
+} // End of namespace DreamGen
diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp
index 53db811313..cea9dbef8c 100644
--- a/engines/dreamweb/vgagrafx.cpp
+++ b/engines/dreamweb/vgagrafx.cpp
@@ -21,28 +21,20 @@
*/
#include "dreamweb/dreamweb.h"
+#include "dreamweb/stubs.h"
#include "engines/util.h"
#include "graphics/surface.h"
namespace DreamGen {
-uint8 *DreamGenContext::workspace() {
- uint8 *result = segRef(data.word(kWorkspace)).ptr(0, 0);
- return result;
-}
-
-void DreamGenContext::allocatework() {
- data.word(kWorkspace) = allocatemem(0x1000);
-}
-
-void DreamGenContext::multiget() {
- multiget(ds.ptr(si, 0), di, bx, cl, ch);
+void DreamGenContext::multiGet() {
+ multiGet(ds.ptr(si, 0), di, bx, cl, ch);
si += cl * ch;
di += bx * kScreenwidth + kScreenwidth * ch;
cx = 0;
}
-void DreamGenContext::multiget(uint8 *dst, uint16 x, uint16 y, uint8 w, uint8 h) {
+void DreamBase::multiGet(uint8 *dst, uint16 x, uint16 y, uint8 w, uint8 h) {
assert(x < 320);
assert(y < 200);
const uint8 *src = workspace() + x + y * kScreenwidth;
@@ -50,22 +42,22 @@ void DreamGenContext::multiget(uint8 *dst, uint16 x, uint16 y, uint8 w, uint8 h)
h = 200 - y;
if (x + w > 320)
w = 320 - x;
- //debug(1, "multiget %u,%u %ux%u -> segment: %04x->%04x", x, y, w, h, (uint16)ds, (uint16)es);
- for(unsigned l = 0; l < h; ++l) {
+ //debug(1, "multiGet %u,%u %ux%u -> segment: %04x->%04x", x, y, w, h, (uint16)ds, (uint16)es);
+ for (unsigned l = 0; l < h; ++l) {
const uint8 *src_p = src + kScreenwidth * l;
uint8 *dst_p = dst + w * l;
memcpy(dst_p, src_p, w);
}
}
-void DreamGenContext::multiput() {
- multiput(ds.ptr(si, 0), di, bx, cl, ch);
+void DreamGenContext::multiPut() {
+ multiPut(ds.ptr(si, 0), di, bx, cl, ch);
si += cl * ch;
di += bx * kScreenwidth + kScreenwidth * ch;
cx = 0;
}
-void DreamGenContext::multiput(const uint8 *src, uint16 x, uint16 y, uint8 w, uint8 h) {
+void DreamBase::multiPut(const uint8 *src, uint16 x, uint16 y, uint8 w, uint8 h) {
assert(x < 320);
assert(y < 200);
uint8 *dst = workspace() + x + y * kScreenwidth;
@@ -73,43 +65,47 @@ void DreamGenContext::multiput(const uint8 *src, uint16 x, uint16 y, uint8 w, ui
h = 200 - y;
if (x + w > 320)
w = 320 - x;
- //debug(1, "multiput %ux%u -> segment: %04x->%04x", w, h, (uint16)ds, (uint16)es);
- for(unsigned l = 0; l < h; ++l) {
+ //debug(1, "multiPut %ux%u -> segment: %04x->%04x", w, h, (uint16)ds, (uint16)es);
+ for (unsigned l = 0; l < h; ++l) {
const uint8 *src_p = src + w * l;
uint8 *dst_p = dst + kScreenwidth * l;
memcpy(dst_p, src_p, w);
}
}
-void DreamGenContext::multidump(uint16 x, uint16 y, uint8 width, uint8 height) {
+void DreamGenContext::multiDump() {
+ multiDump(di, bx, cl, ch);
+ unsigned offset = di + bx * kScreenwidth;
+ si = di = offset + ch * kScreenwidth;
+ cx = 0;
+}
+
+void DreamBase::multiDump(uint16 x, uint16 y, uint8 width, uint8 height) {
unsigned offset = x + y * kScreenwidth;
- //debug(1, "multidump %ux%u(segment: %04x) -> %d,%d(address: %d)", w, h, (uint16)ds, x, y, offset);
+ //debug(1, "multiDump %ux%u(segment: %04x) -> %d,%d(address: %d)", w, h, (uint16)ds, x, y, offset);
engine->blit(workspace() + offset, kScreenwidth, x, y, width, height);
}
-void DreamGenContext::multidump() {
- multidump(di, bx, cl, ch);
- unsigned offset = di + bx * kScreenwidth;
- si = di = offset + ch * kScreenwidth;
- cx = 0;
+void DreamBase::workToScreenCPP() {
+ engine->blit(workspace(), 320, 0, 0, 320, 200);
}
-void DreamGenContext::worktoscreen() {
+void DreamGenContext::workToScreen() {
+ workToScreenCPP();
uint size = 320 * 200;
- engine->blit(workspace(), 320, 0, 0, 320, 200);
di = si = size;
cx = 0;
}
-void DreamGenContext::printundermon() {
+void DreamBase::printUnderMon() {
engine->printUnderMonitor();
}
-void DreamGenContext::cls() {
+void DreamBase::cls() {
engine->cls();
}
-void DreamGenContext::frameoutnm(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) {
+void DreamBase::frameOutNm(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) {
dst += pitch * y + x;
for (uint16 j = 0; j < height; ++j) {
@@ -119,7 +115,7 @@ void DreamGenContext::frameoutnm(uint8 *dst, const uint8 *src, uint16 pitch, uin
}
}
-void DreamGenContext::frameoutbh(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) {
+void DreamBase::frameOutBh(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) {
uint16 stride = pitch - width;
dst += y * pitch + x;
@@ -135,7 +131,7 @@ void DreamGenContext::frameoutbh(uint8 *dst, const uint8 *src, uint16 pitch, uin
}
}
-void DreamGenContext::frameoutfx(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) {
+void DreamBase::frameOutFx(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) {
uint16 stride = pitch - width;
dst += y * pitch + x;
dst -= width;
@@ -152,7 +148,7 @@ void DreamGenContext::frameoutfx(uint8 *dst, const uint8 *src, uint16 pitch, uin
}
}
-void DreamGenContext::doshake() {
+void DreamBase::doShake() {
uint8 &counter = data.byte(kShakecounter);
if (counter == 48)
return;
@@ -177,46 +173,21 @@ void DreamGenContext::doshake() {
0, -2, 3, -2, 0, 2, 4, -1,
1, -3, 3, 0,
};
+ assert(counter < ARRAYSIZE(shakeTable));
int offset = shakeTable[counter];
engine->setShakePos(offset >= 0 ? offset : -offset);
}
-void DreamGenContext::vsync() {
- push(ax);
- push(bx);
- push(cx);
- push(dx);
- push(si);
- push(di);
- push(es);
- push(ds);
+void DreamBase::vSync() {
engine->waitForVSync();
- ds = pop();
- es = pop();
- di = pop();
- si = pop();
- dx = pop();
- cx = pop();
- bx = pop();
- ax = pop();
-}
-
-void DreamGenContext::setmode() {
- vsync();
- initGraphics(320, 200, false);
}
-static Common::String getFilename(Context &context) {
- uint16 name_ptr = context.dx;
- Common::String name;
- uint8 c;
- while((c = context.cs.byte(name_ptr++)) != 0)
- name += (char)c;
- return name;
+void DreamBase::setMode() {
+ engine->waitForVSync();
+ initGraphics(320, 200, false);
}
-void DreamGenContext::showpcx() {
- Common::String name = getFilename(*this);
+void DreamBase::showPCX(const Common::String &name) {
Common::File pcxFile;
if (!pcxFile.open(name)) {
@@ -224,20 +195,19 @@ void DreamGenContext::showpcx() {
return;
}
- uint8 *maingamepal;
+ uint8 *mainGamePal;
int i, j;
// Read the 16-color palette into the 'maingamepal' buffer. Note that
// the color components have to be adjusted from 8 to 6 bits.
pcxFile.seek(16, SEEK_SET);
- es = data.word(kBuffers);
- maingamepal = es.ptr(kMaingamepal, 768);
- pcxFile.read(maingamepal, 48);
+ mainGamePal = mainPalette();
+ pcxFile.read(mainGamePal, 48);
- memset(maingamepal + 48, 0xff, 720);
+ memset(mainGamePal + 48, 0xff, 720);
for (i = 0; i < 48; i++) {
- maingamepal[i] >>= 2;
+ mainGamePal[i] >>= 2;
}
// Decode the image data.
@@ -285,31 +255,31 @@ void DreamGenContext::showpcx() {
pcxFile.close();
}
-void DreamGenContext::frameoutv(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, int16 x, int16 y) {
+void DreamBase::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) {
+ if (x < 0) {
assert(width >= -x);
width -= -x;
src += -x;
x = 0;
}
- if(y < 0) {
+ if (y < 0) {
assert(height >= -y);
height -= -y;
src += (-y) * width;
y = 0;
}
- if(x >= 320)
+ if (x >= 320)
return;
- if(y >= 200)
+ if (y >= 200)
return;
- if(x + width > 320) {
+ if (x + width > 320) {
width = 320 - x;
}
- if(y + height > 200) {
+ if (y + height > 200) {
height = 200 - y;
}
@@ -327,12 +297,12 @@ void DreamGenContext::frameoutv(uint8 *dst, const uint8 *src, uint16 pitch, uint
}
}
-void DreamGenContext::showframe(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag) {
+void DreamBase::showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag) {
uint8 width, height;
- showframe(frameData, x, y, frameNumber, effectsFlag, &width, &height);
+ showFrame(frameData, x, y, frameNumber, effectsFlag, &width, &height);
}
-void DreamGenContext::showframe(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height) {
+void DreamBase::showFrame(const Frame *frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height) {
const Frame *frame = frameData + frameNumber;
if ((frame->width == 0) && (frame->height == 0)) {
*width = 0;
@@ -340,12 +310,12 @@ void DreamGenContext::showframe(const Frame *frameData, uint16 x, uint16 y, uint
return;
}
-//notblankshow:
+//notBlankShow:
if ((effectsFlag & 128) == 0) {
x += frame->x;
y += frame->y;
}
-//skipoffsets:
+//skipOffsets:
*width = frame->width;
*height = frame->height;
@@ -356,45 +326,48 @@ void DreamGenContext::showframe(const Frame *frameData, uint16 x, uint16 y, uint
x -= *width / 2;
y -= *height / 2;
}
- if (effectsFlag & 64) { //diffdest
- frameoutfx(es.ptr(0, dx * *height), pSrc, dx, *width, *height, x, y);
+ if (effectsFlag & 64) { //diffDest
+ error("Unsupported DreamBase::showFrame effectsFlag %d", effectsFlag);
+ /*
+ frameOutFx(es.ptr(0, dx * *height), pSrc, dx, *width, *height, x, y);
return;
+ */
}
- if (effectsFlag & 8) { //printlist
+ if (effectsFlag & 8) { //printList
/*
push(ax);
al = x - data.word(kMapadx);
ah = y - data.word(kMapady);
- //addtoprintlist(); // NB: Commented in the original asm
+ //addToPrintList(); // NB: Commented in the original asm
ax = pop();
*/
}
- if (effectsFlag & 4) { //flippedx
- frameoutfx(workspace(), pSrc, 320, *width, *height, x, y);
+ if (effectsFlag & 4) { //flippedX
+ frameOutFx(workspace(), pSrc, 320, *width, *height, x, y);
return;
}
- if (effectsFlag & 2) { //nomask
- frameoutnm(workspace(), pSrc, 320, *width, *height, x, y);
+ if (effectsFlag & 2) { //noMask
+ frameOutNm(workspace(), pSrc, 320, *width, *height, x, y);
return;
}
if (effectsFlag & 32) {
- frameoutbh(workspace(), pSrc, 320, *width, *height, x, y);
+ frameOutBh(workspace(), pSrc, 320, *width, *height, x, y);
return;
}
}
-//noeffects:
- frameoutv(workspace(), pSrc, 320, *width, *height, x, y);
+//noEffects:
+ frameOutV(workspace(), pSrc, 320, *width, *height, x, y);
return;
}
-void DreamGenContext::showframe() {
+void DreamGenContext::showFrame() {
uint8 width, height;
- showframe((Frame *)ds.ptr(0, 0), di, bx, ax & 0x1ff, ah & 0xfe, &width, &height);
+ showFrame((Frame *)ds.ptr(0, 0), di, bx, ax & 0x1ff, ah & 0xfe, &width, &height);
cl = width;
ch = height;
}
-void DreamGenContext::clearwork() {
+void DreamBase::clearWork() {
memset(workspace(), 0, 320*200);
}
@@ -404,15 +377,15 @@ void DreamGenContext::zoom() {
if (data.byte(kZoomon) != 1)
return;
if (data.byte(kCommandtype) >= 199) {
- putunderzoom();
+ putUnderZoom();
return;
}
uint16 srcOffset = (data.word(kOldpointery) - 9) * 320 + (data.word(kOldpointerx) - 11);
uint16 dstOffset = (kZoomy + 4) * 320 + (kZoomx + 5);
const uint8 *src = workspace() + srcOffset;
uint8 *dst = workspace() + dstOffset;
- for(size_t i=0; i<20; ++i) {
- for(size_t j=0; j<23; ++j) {
+ for (size_t i = 0; i < 20; ++i) {
+ for (size_t j = 0; j < 23; ++j) {
uint8 v = src[j];
dst[2*j+0] = v;
dst[2*j+1] = v;
@@ -426,43 +399,85 @@ 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));
+uint8 *DreamBase::mapStore() {
+ return getSegment(data.word(kMapstore)).ptr(0, 0);
+}
+
+void DreamBase::panelToMap() {
+ multiGet(mapStore(), 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 DreamBase::mapToPanel() {
+ multiPut(mapStore(), 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 DreamBase::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);
+void DreamBase::transferInv() {
+ const Frame *freeFrames = (const Frame *)getSegment(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 *exFrames = (Frame *)getSegment(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);
+ const uint8 *src = getSegment(data.word(kFreeframes)).ptr(kFrframes + freeFrame->ptr(), byteCount);
+ uint8 *dst = getSegment(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) {
+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;
+ SetObject *setObject = getSetAd(pos->index);
+ Frame *frame = (Frame *)getSegment(data.word(kSetframes)).ptr(kFramedata, 0) + setObject->index;
+ const uint8 *ptr = getSegment(data.word(kSetframes)).ptr(kFrames, 0) + frame->ptr() + y * frame->width + x;
return *ptr != 0;
}
-} /*namespace dreamgen */
+void DreamBase::loadPalFromIFF() {
+ Common::File palFile;
+ palFile.open("DREAMWEB.PAL");
+ palFile.read(mapStore(), 2000);
+ palFile.close();
+
+ const uint8 *src = mapStore() + 0x30;
+ uint8 *dst = mainPalette();
+ for (size_t i = 0; i < 256*3; ++i) {
+ uint8 c = src[i] / 4;
+ if (data.byte(kBrightness) == 1) {
+ if (c) {
+ c = c + c / 2 + c / 4;
+ if (c > 63)
+ c = 63;
+ }
+ }
+ dst[i] = c;
+ }
+}
+
+void DreamBase::createPanel() {
+ showFrame(engine->icons2(), 0, 8, 0, 2);
+ showFrame(engine->icons2(), 160, 8, 0, 2);
+ showFrame(engine->icons2(), 0, 104, 0, 2);
+ showFrame(engine->icons2(), 160, 104, 0, 2);
+}
+
+void DreamBase::createPanel2() {
+ createPanel();
+ showFrame(engine->icons2(), 0, 0, 5, 2);
+ showFrame(engine->icons2(), 160, 0, 5, 2);
+}
+
+void DreamBase::showPanel() {
+ showFrame(engine->icons1(), 72, 0, 19, 0);
+ showFrame(engine->icons1(), 192, 0, 19, 0);
+}
+} // End of namespace DreamGen
diff --git a/engines/engine.cpp b/engines/engine.cpp
index ee1d53fa9c..e4e4630841 100644
--- a/engines/engine.cpp
+++ b/engines/engine.cpp
@@ -479,10 +479,20 @@ void Engine::syncSoundSettings() {
if (ConfMan.hasKey("mute"))
mute = ConfMan.getBool("mute");
+ // We need to handle the speech mute separately here. This is because the
+ // engine code should be able to rely on all speech sounds muted when the
+ // user specified subtitles only mode, which results in "speech_mute" to
+ // be set to "true". The global mute setting has precedence over the
+ // speech mute setting though.
+ bool speechMute = mute;
+ if (!speechMute)
+ speechMute = ConfMan.getBool("speech_mute");
+
_mixer->muteSoundType(Audio::Mixer::kPlainSoundType, mute);
_mixer->muteSoundType(Audio::Mixer::kMusicSoundType, mute);
_mixer->muteSoundType(Audio::Mixer::kSFXSoundType, mute);
- _mixer->muteSoundType(Audio::Mixer::kSpeechSoundType, mute);
+ _mixer->muteSoundType(Audio::Mixer::kSpeechSoundType, speechMute);
+
_mixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, Audio::Mixer::kMaxMixerVolume);
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, soundVolumeMusic);
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, soundVolumeSFX);
diff --git a/engines/engine.h b/engines/engine.h
index 2796df5c4f..d508b4ed18 100644
--- a/engines/engine.h
+++ b/engines/engine.h
@@ -180,6 +180,11 @@ public:
*/
virtual void syncSoundSettings();
+ /*
+ * Initialize the engine-specific keymap
+ */
+ virtual void initKeymap() {}
+
/**
* Flip mute all sound option.
*/
diff --git a/engines/engines.mk b/engines/engines.mk
index bf0c24c57d..74a5dce1d6 100644
--- a/engines/engines.mk
+++ b/engines/engines.mk
@@ -99,11 +99,6 @@ DEFINES += -DENABLE_LURE=$(ENABLE_LURE)
MODULES += engines/lure
endif
-ifdef ENABLE_M4
-DEFINES += -DENABLE_M4=$(ENABLE_M4)
-MODULES += engines/m4
-endif
-
ifdef ENABLE_MADE
DEFINES += -DENABLE_MADE=$(ENABLE_MADE)
MODULES += engines/made
@@ -198,6 +193,11 @@ DEFINES += -DENABLE_TINSEL=$(ENABLE_TINSEL)
MODULES += engines/tinsel
endif
+ifdef ENABLE_TOLTECS
+DEFINES += -DENABLE_TOLTECS=$(ENABLE_TOLTECS)
+MODULES += engines/toltecs
+endif
+
ifdef ENABLE_TOON
DEFINES += -DENABLE_TOON=$(ENABLE_TOON)
MODULES += engines/toon
diff --git a/engines/game.cpp b/engines/game.cpp
index 8ea68bb681..be15240745 100644
--- a/engines/game.cpp
+++ b/engines/game.cpp
@@ -38,29 +38,29 @@ GameDescriptor::GameDescriptor() {
setVal("description", "");
}
-GameDescriptor::GameDescriptor(const PlainGameDescriptor &pgd, uint32 guioptions) {
+GameDescriptor::GameDescriptor(const PlainGameDescriptor &pgd, Common::String guioptions) {
setVal("gameid", pgd.gameid);
setVal("description", pgd.description);
- if (guioptions != 0)
+ if (!guioptions.empty())
setVal("guioptions", Common::getGameGUIOptionsDescription(guioptions));
}
-GameDescriptor::GameDescriptor(const Common::String &g, const Common::String &d, Common::Language l, Common::Platform p, uint32 guioptions, GameSupportLevel gsl) {
+GameDescriptor::GameDescriptor(const Common::String &g, const Common::String &d, Common::Language l, Common::Platform p, Common::String guioptions, GameSupportLevel gsl) {
setVal("gameid", g);
setVal("description", d);
if (l != Common::UNK_LANG)
setVal("language", Common::getLanguageCode(l));
if (p != Common::kPlatformUnknown)
setVal("platform", Common::getPlatformCode(p));
- if (guioptions != 0)
+ if (!guioptions.empty())
setVal("guioptions", Common::getGameGUIOptionsDescription(guioptions));
setSupportLevel(gsl);
}
-void GameDescriptor::setGUIOptions(uint32 guioptions) {
- if (guioptions != 0)
+void GameDescriptor::setGUIOptions(Common::String guioptions) {
+ if (!guioptions.empty())
setVal("guioptions", Common::getGameGUIOptionsDescription(guioptions));
else
erase("guioptions");
diff --git a/engines/game.h b/engines/game.h
index 9082d93793..d5136936bc 100644
--- a/engines/game.h
+++ b/engines/game.h
@@ -65,12 +65,12 @@ enum GameSupportLevel {
class GameDescriptor : public Common::StringMap {
public:
GameDescriptor();
- GameDescriptor(const PlainGameDescriptor &pgd, uint32 guioptions = 0);
+ GameDescriptor(const PlainGameDescriptor &pgd, Common::String guioptions = Common::String());
GameDescriptor(const Common::String &gameid,
const Common::String &description,
Common::Language language = Common::UNK_LANG,
Common::Platform platform = Common::kPlatformUnknown,
- uint32 guioptions = 0,
+ Common::String guioptions = Common::String(),
GameSupportLevel gsl = kStableGame);
/**
@@ -80,7 +80,7 @@ public:
*/
void updateDesc(const char *extra = 0);
- void setGUIOptions(uint32 options);
+ void setGUIOptions(Common::String options);
void appendGUIOptions(const Common::String &str);
/**
diff --git a/engines/gob/detection.cpp b/engines/gob/detection.cpp
index 9a554b5429..17a2ae3da8 100644
--- a/engines/gob/detection.cpp
+++ b/engines/gob/detection.cpp
@@ -91,7 +91,7 @@ class GobMetaEngine : public AdvancedMetaEngine {
public:
GobMetaEngine() : AdvancedMetaEngine(Gob::gameDescriptions, sizeof(Gob::GOBGameDescription), gobGames) {
_singleid = "gob";
- _guioptions = Common::GUIO_NOLAUNCHLOAD;
+ _guioptions = GUIO1(GUIO_NOLAUNCHLOAD);
}
virtual GameDescriptor findGame(const char *gameid) const {
diff --git a/engines/gob/detection_tables.h b/engines/gob/detection_tables.h
index 9c13b4f7b8..a88ddcc734 100644
--- a/engines/gob/detection_tables.h
+++ b/engines/gob/detection_tables.h
@@ -22,10 +22,6 @@
namespace Gob {
-using Common::GUIO_NOSPEECH;
-using Common::GUIO_NOSUBTITLES;
-using Common::GUIO_NONE;
-
static const GOBGameDescription gameDescriptions[] = {
{ // Supplied by Florian Zeitz on scummvm-devel
{
@@ -35,7 +31,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesEGA,
@@ -49,7 +45,7 @@ static const GOBGameDescription gameDescriptions[] = {
RU_RUS,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesEGA,
@@ -63,7 +59,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesNone,
@@ -77,7 +73,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesAdLib,
@@ -91,7 +87,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformMacintosh,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesNone,
@@ -105,7 +101,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformMacintosh,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesAdLib,
@@ -119,7 +115,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformMacintosh,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesAdLib,
@@ -133,7 +129,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformMacintosh,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesAdLib,
@@ -147,7 +143,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformMacintosh,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesAdLib,
@@ -161,7 +157,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformMacintosh,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesAdLib,
@@ -179,7 +175,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesAdLib,
@@ -197,7 +193,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesAdLib,
@@ -215,7 +211,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesAdLib,
@@ -233,7 +229,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesAdLib,
@@ -251,7 +247,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesAdLib,
@@ -269,7 +265,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesAdLib,
@@ -287,7 +283,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesAdLib,
@@ -305,7 +301,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesAdLib,
@@ -323,7 +319,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesAdLib,
@@ -341,7 +337,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesAdLib,
@@ -355,7 +351,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesAdLib,
@@ -369,7 +365,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesAdLib,
@@ -383,7 +379,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesAdLib,
@@ -397,7 +393,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesAdLib,
@@ -411,7 +407,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesAdLib,
@@ -425,7 +421,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesCD,
@@ -439,7 +435,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_USA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesCD,
@@ -453,7 +449,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesCD,
@@ -467,7 +463,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesCD,
@@ -481,7 +477,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesCD,
@@ -495,7 +491,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesCD,
@@ -509,7 +505,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_USA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesCD,
@@ -523,7 +519,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesCD,
@@ -537,7 +533,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesCD,
@@ -551,7 +547,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesCD,
@@ -565,7 +561,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesCD,
@@ -579,7 +575,7 @@ static const GOBGameDescription gameDescriptions[] = {
HU_HUN,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesCD,
@@ -593,7 +589,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesCD,
@@ -607,7 +603,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesCD,
@@ -621,7 +617,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesCD,
@@ -635,7 +631,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformAmiga,
ADGF_DEMO,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesNone,
@@ -649,7 +645,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformPC,
ADGF_DEMO,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesNone,
@@ -663,7 +659,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformPC,
ADGF_DEMO,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesNone,
@@ -677,7 +673,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_DEMO,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesNone,
@@ -691,7 +687,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformCDi,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesAdLib,
@@ -705,7 +701,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesNone,
@@ -719,7 +715,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesNone,
@@ -733,7 +729,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesNone,
@@ -747,7 +743,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformAtariST,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesNone,
@@ -765,7 +761,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformMacintosh,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -783,7 +779,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformMacintosh,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -797,7 +793,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -811,7 +807,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_USA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -825,7 +821,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_USA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -839,7 +835,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -853,7 +849,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -867,7 +863,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -881,7 +877,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -895,7 +891,7 @@ static const GOBGameDescription gameDescriptions[] = {
RU_RUS,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -909,7 +905,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -927,7 +923,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -945,7 +941,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_USA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -963,7 +959,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -981,7 +977,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -999,7 +995,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_USA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -1017,7 +1013,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -1031,7 +1027,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -1045,7 +1041,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -1059,7 +1055,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_USA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesCD,
@@ -1073,7 +1069,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesCD,
@@ -1087,7 +1083,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesCD,
@@ -1101,7 +1097,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesCD,
@@ -1115,7 +1111,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesCD,
@@ -1129,7 +1125,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesCD,
@@ -1143,7 +1139,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesCD,
@@ -1157,7 +1153,7 @@ static const GOBGameDescription gameDescriptions[] = {
HU_HUN,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesCD,
@@ -1171,7 +1167,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesCD,
@@ -1185,7 +1181,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesCD,
@@ -1199,7 +1195,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesCD,
@@ -1213,7 +1209,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesCD,
@@ -1227,7 +1223,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformPC,
ADGF_DEMO,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -1241,7 +1237,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformPC,
ADGF_DEMO,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -1255,7 +1251,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformAmiga,
ADGF_DEMO,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesNone,
@@ -1269,7 +1265,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformAmiga,
ADGF_DEMO,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesNone,
@@ -1287,7 +1283,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeWeen,
kFeaturesNone,
@@ -1301,7 +1297,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeWeen,
kFeaturesNone,
@@ -1315,7 +1311,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeWeen,
kFeaturesNone,
@@ -1329,7 +1325,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeWeen,
kFeaturesNone,
@@ -1347,7 +1343,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeWeen,
kFeaturesNone,
@@ -1365,7 +1361,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformAtariST,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeWeen,
kFeaturesNone,
@@ -1379,7 +1375,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformAtariST,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeWeen,
kFeaturesNone,
@@ -1393,7 +1389,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeWeen,
kFeaturesAdLib,
@@ -1407,7 +1403,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_USA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeWeen,
kFeaturesAdLib,
@@ -1421,7 +1417,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeWeen,
kFeaturesAdLib,
@@ -1435,7 +1431,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeWeen,
kFeaturesAdLib,
@@ -1449,7 +1445,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeWeen,
kFeaturesAdLib,
@@ -1463,7 +1459,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeWeen,
kFeaturesAdLib,
@@ -1477,7 +1473,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformPC,
ADGF_DEMO,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeWeen,
kFeaturesAdLib,
@@ -1491,7 +1487,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_USA,
kPlatformPC,
ADGF_DEMO,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeWeen,
kFeaturesAdLib,
@@ -1505,7 +1501,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeBargon,
kFeaturesNone,
@@ -1519,7 +1515,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformAtariST,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeBargon,
kFeaturesNone,
@@ -1533,7 +1529,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeBargon,
kFeaturesNone,
@@ -1547,7 +1543,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeBargon,
kFeaturesNone,
@@ -1561,7 +1557,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeBargon,
kFeaturesNone,
@@ -1575,7 +1571,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeBargon,
kFeaturesNone,
@@ -1589,7 +1585,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeBargon,
kFeaturesNone,
@@ -1603,7 +1599,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib | kFeaturesEGA,
@@ -1617,7 +1613,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib | kFeaturesEGA,
@@ -1631,7 +1627,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib | kFeaturesEGA,
@@ -1645,7 +1641,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib | kFeaturesEGA,
@@ -1659,7 +1655,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib | kFeaturesEGA,
@@ -1677,7 +1673,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesNone,
@@ -1691,7 +1687,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib | kFeaturesEGA,
@@ -1705,7 +1701,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib | kFeaturesEGA,
@@ -1719,7 +1715,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib | kFeaturesEGA,
@@ -1733,7 +1729,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib | kFeaturesEGA,
@@ -1747,7 +1743,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib | kFeaturesEGA,
@@ -1761,7 +1757,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib | kFeaturesEGA,
@@ -1775,7 +1771,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib | kFeaturesEGA,
@@ -1789,7 +1785,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib | kFeaturesEGA,
@@ -1803,7 +1799,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib | kFeaturesEGA,
@@ -1817,7 +1813,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib | kFeaturesEGA,
@@ -1833,7 +1829,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_PIRATED,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesAdLib,
@@ -1847,7 +1843,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_USA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesAdLib,
@@ -1861,7 +1857,7 @@ static const GOBGameDescription gameDescriptions[] = {
HE_ISR,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesAdLib,
@@ -1875,7 +1871,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesAdLib,
@@ -1889,7 +1885,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesAdLib,
@@ -1907,7 +1903,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformMacintosh,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesAdLib,
@@ -1921,7 +1917,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_USA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesCD,
@@ -1935,7 +1931,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesCD,
@@ -1949,7 +1945,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesCD,
@@ -1963,7 +1959,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesCD,
@@ -1977,7 +1973,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesCD,
@@ -1991,7 +1987,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesCD,
@@ -2005,7 +2001,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_USA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesCD,
@@ -2019,7 +2015,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesCD,
@@ -2033,7 +2029,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesCD,
@@ -2047,7 +2043,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesCD,
@@ -2061,7 +2057,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesCD,
@@ -2075,7 +2071,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesCD,
@@ -2089,7 +2085,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesAdLib,
@@ -2103,7 +2099,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesAdLib,
@@ -2117,7 +2113,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesAdLib,
@@ -2131,7 +2127,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesAdLib,
@@ -2145,7 +2141,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesAdLib,
@@ -2159,7 +2155,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesAdLib,
@@ -2177,7 +2173,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesAdLib,
@@ -2195,7 +2191,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesAdLib,
@@ -2209,7 +2205,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesAdLib,
@@ -2227,7 +2223,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesAdLib,
@@ -2241,7 +2237,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformPC,
ADGF_DEMO,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesAdLib,
@@ -2255,7 +2251,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformPC,
ADGF_DEMO,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesAdLib,
@@ -2269,7 +2265,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeFascination,
kFeaturesAdLib,
@@ -2283,7 +2279,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeFascination,
kFeaturesAdLib,
@@ -2297,7 +2293,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeFascination,
kFeaturesAdLib,
@@ -2311,7 +2307,7 @@ static const GOBGameDescription gameDescriptions[] = {
HE_ISR,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeFascination,
kFeaturesAdLib,
@@ -2325,7 +2321,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeFascination,
kFeaturesAdLib,
@@ -2339,7 +2335,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeFascination,
kFeaturesAdLib,
@@ -2353,7 +2349,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeFascination,
kFeaturesNone,
@@ -2367,7 +2363,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeFascination,
kFeaturesNone,
@@ -2381,7 +2377,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeFascination,
kFeaturesNone,
@@ -2395,7 +2391,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeFascination,
kFeaturesNone,
@@ -2409,7 +2405,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformAtariST,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeFascination,
kFeaturesNone,
@@ -2423,7 +2419,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES
+ GUIO1(GUIO_NOSUBTITLES)
},
kGameTypeFascination,
kFeaturesCD,
@@ -2437,7 +2433,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES
+ GUIO1(GUIO_NOSUBTITLES)
},
kGameTypeFascination,
kFeaturesCD,
@@ -2451,7 +2447,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES
+ GUIO1(GUIO_NOSUBTITLES)
},
kGameTypeFascination,
kFeaturesCD,
@@ -2465,7 +2461,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES
+ GUIO1(GUIO_NOSUBTITLES)
},
kGameTypeFascination,
kFeaturesCD,
@@ -2479,7 +2475,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES
+ GUIO1(GUIO_NOSUBTITLES)
},
kGameTypeFascination,
kFeaturesCD,
@@ -2493,7 +2489,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGeisha,
kFeaturesEGA | kFeaturesAdLib,
@@ -2507,7 +2503,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGeisha,
kFeaturesEGA | kFeaturesAdLib,
@@ -2521,7 +2517,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGeisha,
kFeaturesEGA,
@@ -2535,7 +2531,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesAdLib,
@@ -2549,7 +2545,7 @@ static const GOBGameDescription gameDescriptions[] = {
HE_ISR,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesAdLib,
@@ -2563,7 +2559,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesAdLib,
@@ -2581,7 +2577,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesAdLib,
@@ -2599,7 +2595,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesAdLib,
@@ -2617,7 +2613,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesAdLib,
@@ -2635,7 +2631,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformMacintosh,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesAdLib,
@@ -2649,7 +2645,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_USA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesAdLib,
@@ -2663,7 +2659,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesAdLib,
@@ -2677,7 +2673,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesAdLib,
@@ -2691,7 +2687,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesAdLib,
@@ -2705,7 +2701,7 @@ static const GOBGameDescription gameDescriptions[] = {
RU_RUS,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesAdLib,
@@ -2719,7 +2715,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesAdLib,
@@ -2733,7 +2729,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesAdLib,
@@ -2747,7 +2743,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesNone,
@@ -2761,7 +2757,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesNone,
@@ -2779,7 +2775,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesAdLib,
@@ -2797,7 +2793,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesAdLib,
@@ -2815,7 +2811,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesAdLib,
@@ -2829,7 +2825,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesAdLib,
@@ -2843,7 +2839,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_USA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesCD,
@@ -2857,7 +2853,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesCD,
@@ -2871,7 +2867,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesCD,
@@ -2885,7 +2881,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesCD,
@@ -2899,7 +2895,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesCD,
@@ -2913,7 +2909,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesCD,
@@ -2927,7 +2923,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesCD,
@@ -2941,7 +2937,7 @@ static const GOBGameDescription gameDescriptions[] = {
HU_HUN,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesCD,
@@ -2955,7 +2951,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesCD,
@@ -2969,7 +2965,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesCD,
@@ -2983,7 +2979,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesCD,
@@ -2997,7 +2993,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_DEMO,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesAdLib,
@@ -3011,7 +3007,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_DEMO,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesAdLib,
@@ -3025,7 +3021,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformPC,
ADGF_DEMO,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesAdLib,
@@ -3039,7 +3035,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformPC,
ADGF_DEMO,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesAdLib,
@@ -3053,7 +3049,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_USA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeInca2,
kFeaturesCD,
@@ -3067,7 +3063,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeInca2,
kFeaturesCD,
@@ -3081,7 +3077,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeInca2,
kFeaturesCD,
@@ -3095,7 +3091,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeInca2,
kFeaturesCD,
@@ -3109,7 +3105,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeInca2,
kFeaturesCD,
@@ -3123,7 +3119,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_USA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeInca2,
kFeaturesAdLib,
@@ -3137,7 +3133,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeInca2,
kFeaturesAdLib,
@@ -3151,7 +3147,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeInca2,
kFeaturesAdLib,
@@ -3165,7 +3161,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_USA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeInca2,
kFeaturesAdLib,
@@ -3179,7 +3175,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeInca2,
kFeaturesAdLib,
@@ -3193,7 +3189,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeInca2,
kFeaturesAdLib,
@@ -3207,7 +3203,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeInca2,
kFeaturesAdLib,
@@ -3221,7 +3217,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeInca2,
kFeaturesAdLib,
@@ -3248,7 +3244,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeInca2,
kFeaturesAdLib | kFeaturesBATDemo,
@@ -3262,7 +3258,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3276,7 +3272,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3290,7 +3286,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3304,7 +3300,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3318,7 +3314,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3332,7 +3328,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3346,7 +3342,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3360,7 +3356,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3374,7 +3370,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3388,7 +3384,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3402,7 +3398,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3416,7 +3412,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3430,7 +3426,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3444,7 +3440,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3458,7 +3454,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3472,7 +3468,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3486,7 +3482,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3500,7 +3496,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3514,7 +3510,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3528,7 +3524,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3542,7 +3538,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3556,7 +3552,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3570,7 +3566,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3584,7 +3580,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3598,7 +3594,7 @@ static const GOBGameDescription gameDescriptions[] = {
PL_POL,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -3616,7 +3612,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480 | kFeaturesSCNDemo,
@@ -3630,7 +3626,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_USA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeDynasty,
kFeatures640x480,
@@ -3644,7 +3640,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_USA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeDynasty,
kFeatures640x480,
@@ -3658,7 +3654,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeDynasty,
kFeatures640x480,
@@ -3672,7 +3668,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeDynasty,
kFeatures640x480,
@@ -3686,7 +3682,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeDynasty,
kFeatures640x480,
@@ -3700,7 +3696,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_USA,
kPlatformPC,
ADGF_DEMO,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeDynasty,
kFeatures640x480,
@@ -3714,7 +3710,7 @@ static const GOBGameDescription gameDescriptions[] = {
UNK_LANG,
kPlatformWindows,
ADGF_DEMO,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeDynasty,
kFeatures640x480,
@@ -3728,7 +3724,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformWindows,
ADGF_DEMO,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeDynasty,
kFeatures640x480,
@@ -3742,7 +3738,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_USA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeUrban,
kFeatures640x480 | kFeaturesTrueColor,
@@ -3756,7 +3752,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_USA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeUrban,
kFeatures640x480 | kFeaturesTrueColor,
@@ -3770,7 +3766,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeUrban,
kFeatures640x480 | kFeaturesTrueColor,
@@ -3784,7 +3780,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeUrban,
kFeatures640x480 | kFeaturesTrueColor,
@@ -3798,7 +3794,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeUrban,
kFeatures640x480 | kFeaturesTrueColor,
@@ -3812,7 +3808,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeUrban,
kFeatures640x480 | kFeaturesTrueColor,
@@ -3826,7 +3822,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeUrban,
kFeatures640x480 | kFeaturesTrueColor,
@@ -3845,7 +3841,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeUrban,
kFeatures640x480 | kFeaturesTrueColor | kFeaturesSCNDemo,
@@ -3863,7 +3859,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -3881,7 +3877,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -3899,7 +3895,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -3917,7 +3913,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -3940,7 +3936,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480 | kFeaturesSCNDemo,
@@ -3958,7 +3954,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480 | kFeaturesSCNDemo,
@@ -3980,7 +3976,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480 | kFeaturesSCNDemo,
@@ -4001,7 +3997,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480 | kFeaturesSCNDemo,
@@ -4019,7 +4015,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -4037,7 +4033,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -4055,7 +4051,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -4073,7 +4069,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -4091,7 +4087,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -4109,7 +4105,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -4127,7 +4123,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -4145,7 +4141,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -4163,7 +4159,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -4181,7 +4177,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -4199,7 +4195,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -4217,7 +4213,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -4235,7 +4231,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeBambou,
kFeatures640x480,
@@ -4253,7 +4249,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -4271,7 +4267,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -4289,7 +4285,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -4303,7 +4299,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
kGameTypeAdi2,
kFeaturesNone,
@@ -4317,7 +4313,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeAdi2,
kFeatures640x480,
@@ -4331,7 +4327,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeAdi2,
kFeatures640x480,
@@ -4345,7 +4341,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
kGameTypeAdi2,
kFeaturesNone,
@@ -4359,7 +4355,7 @@ static const GOBGameDescription gameDescriptions[] = {
ES_ESP,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeAdi2,
kFeatures640x480,
@@ -4373,7 +4369,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeAdi2,
kFeatures640x480,
@@ -4387,7 +4383,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeAdi2,
kFeatures640x480,
@@ -4401,7 +4397,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeAdi2,
kFeatures640x480,
@@ -4415,7 +4411,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeAdi2,
kFeatures640x480,
@@ -4429,7 +4425,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeAdi2,
kFeatures640x480,
@@ -4449,7 +4445,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeAdi2,
kFeatures640x480 | kFeaturesSCNDemo,
@@ -4463,7 +4459,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeAdi4,
kFeatures640x480,
@@ -4477,7 +4473,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeAdi4,
kFeatures640x480,
@@ -4491,7 +4487,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeAdi4,
kFeatures640x480,
@@ -4505,7 +4501,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeAdi4,
kFeatures640x480,
@@ -4519,7 +4515,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeAdi4,
kFeatures640x480,
@@ -4533,7 +4529,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeAdi4,
kFeatures640x480,
@@ -4547,7 +4543,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeAdi4,
kFeaturesNone,
@@ -4561,7 +4557,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeAdi4,
kFeaturesNone,
@@ -4575,7 +4571,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeAdi4,
kFeaturesNone,
@@ -4589,7 +4585,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeAdi4,
kFeatures640x480,
@@ -4603,10 +4599,10 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeAdi4,
- kFeaturesNone,
+ kFeatures640x480,
0, 0, 0
},
{
@@ -4617,7 +4613,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeAdi4,
kFeatures640x480,
@@ -4631,7 +4627,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_DEMO,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeAdi4,
kFeatures640x480,
@@ -4645,7 +4641,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_ANY,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -4659,7 +4655,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeAdibou1,
kFeaturesAdLib,
@@ -4673,7 +4669,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
kGameTypeAdibou2,
kFeaturesNone,
@@ -4687,7 +4683,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
kGameTypeAdibou2,
kFeaturesNone,
@@ -4701,7 +4697,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
kGameTypeAdibou2,
kFeaturesNone,
@@ -4715,7 +4711,7 @@ static const GOBGameDescription gameDescriptions[] = {
IT_ITA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
kGameTypeAdibou2,
kFeaturesNone,
@@ -4729,7 +4725,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
kGameTypeAdibou2,
kFeaturesNone,
@@ -4743,7 +4739,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
kGameTypeAdibou2,
kFeaturesNone,
@@ -4757,7 +4753,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
kGameTypeAdibou2,
kFeaturesNone,
@@ -4771,7 +4767,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
kGameTypeAdibou2,
kFeaturesNone,
@@ -4785,7 +4781,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
kGameTypeAdibou2,
kFeaturesNone,
@@ -4799,7 +4795,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
kGameTypeAdibou2,
kFeaturesNone,
@@ -4817,7 +4813,7 @@ static const GOBGameDescription gameDescriptions[] = {
EN_GRB,
kPlatformPC,
ADGF_DEMO,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeAdibou2,
kFeatures640x480 | kFeaturesSCNDemo,
@@ -4835,7 +4831,7 @@ static const GOBGameDescription gameDescriptions[] = {
DE_DEU,
kPlatformPC,
ADGF_DEMO,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeAdibou2,
kFeatures640x480 | kFeaturesSCNDemo,
@@ -4853,7 +4849,7 @@ static const GOBGameDescription gameDescriptions[] = {
FR_FRA,
kPlatformPC,
ADGF_DEMO,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeAdibou2,
kFeatures640x480 | kFeaturesSCNDemo,
@@ -4871,7 +4867,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesNone,
@@ -4885,7 +4881,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob1,
kFeaturesCD,
@@ -4899,7 +4895,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -4913,7 +4909,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformMacintosh,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesAdLib,
@@ -4927,7 +4923,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob2,
kFeaturesCD,
@@ -4941,7 +4937,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeBargon,
kFeaturesNone,
@@ -4955,7 +4951,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesAdLib,
@@ -4969,7 +4965,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGob3,
kFeaturesCD,
@@ -4983,7 +4979,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeWoodruff,
kFeatures640x480,
@@ -4997,7 +4993,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesAdLib,
@@ -5011,7 +5007,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformMacintosh,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesAdLib,
@@ -5025,7 +5021,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeLostInTime,
kFeaturesCD,
@@ -5039,7 +5035,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeUrban,
kFeatures640x480 | kFeaturesTrueColor,
@@ -5053,7 +5049,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -5067,7 +5063,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -5081,7 +5077,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -5095,7 +5091,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -5109,7 +5105,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -5123,7 +5119,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypePlaytoons,
kFeatures640x480,
@@ -5137,7 +5133,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeBambou,
kFeatures640x480,
@@ -5151,7 +5147,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeFascination,
kFeaturesNone,
@@ -5165,7 +5161,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO2(GUIO_NOSUBTITLES, GUIO_NOSPEECH)
},
kGameTypeGeisha,
kFeaturesEGA,
@@ -5179,7 +5175,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeAdi2,
kFeatures640x480,
@@ -5193,7 +5189,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ GUIO3(GUIO_NOSUBTITLES, GUIO_NOSPEECH, GUIO_NOASPECT)
},
kGameTypeAdi4,
kFeatures640x480,
@@ -5207,7 +5203,7 @@ static const GOBGameDescription fallbackDescs[] = {
UNK_LANG,
kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
kGameTypeUrban,
kFeaturesAdLib | kFeatures640x480 | kFeaturesSCNDemo,
diff --git a/engines/gob/draw_v1.cpp b/engines/gob/draw_v1.cpp
index 8cb88b522c..fb15fdbc19 100644
--- a/engines/gob/draw_v1.cpp
+++ b/engines/gob/draw_v1.cpp
@@ -251,7 +251,7 @@ void Draw_v1::printTotText(int16 id) {
cmd = ptrEnd[17] & 0x7F;
if (cmd == 0) {
val = READ_LE_UINT16(ptrEnd + 18) * 4;
- sprintf(buf, "%d", VAR_OFFSET(val));
+ sprintf(buf, "%d", (int32)VAR_OFFSET(val));
} else if (cmd == 1) {
val = READ_LE_UINT16(ptrEnd + 18) * 4;
@@ -259,7 +259,7 @@ void Draw_v1::printTotText(int16 id) {
} else {
val = READ_LE_UINT16(ptrEnd + 18) * 4;
- sprintf(buf, "%d", VAR_OFFSET(val));
+ sprintf(buf, "%d", (int32)VAR_OFFSET(val));
if (buf[0] == '-') {
while (strlen(buf) - 1 < (uint32)ptrEnd[17]) {
_vm->_util->insertStr("0", buf, 1);
diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp
index 6e64d6fd06..78702f2ec9 100644
--- a/engines/gob/draw_v2.cpp
+++ b/engines/gob/draw_v2.cpp
@@ -553,13 +553,13 @@ void Draw_v2::printTotText(int16 id) {
cmd = ptrEnd[17] & 0x7F;
if (cmd == 0) {
val = READ_LE_UINT16(ptrEnd + 18) * 4;
- sprintf(buf, "%d", VAR_OFFSET(val));
+ sprintf(buf, "%d", (int32)VAR_OFFSET(val));
} else if (cmd == 1) {
val = READ_LE_UINT16(ptrEnd + 18) * 4;
Common::strlcpy(buf, GET_VARO_STR(val), 20);
} else {
val = READ_LE_UINT16(ptrEnd + 18) * 4;
- sprintf(buf, "%d", VAR_OFFSET(val));
+ sprintf(buf, "%d", (int32)VAR_OFFSET(val));
if (buf[0] == '-') {
while (strlen(buf) - 1 < (uint32)ptrEnd[17]) {
_vm->_util->insertStr("0", buf, 1);
diff --git a/engines/gob/iniconfig.cpp b/engines/gob/iniconfig.cpp
index 9b8f1c703e..bba531723c 100644
--- a/engines/gob/iniconfig.cpp
+++ b/engines/gob/iniconfig.cpp
@@ -90,7 +90,7 @@ bool INIConfig::openConfig(const Common::String &file, Config &config) {
bool INIConfig::createConfig(const Common::String &file, Config &config) {
config.config = new Common::ConfigFile();
- config.created = true;;
+ config.created = true;
_configs.setVal(file, config);
diff --git a/engines/gob/inter_playtoons.cpp b/engines/gob/inter_playtoons.cpp
index e05cae354c..f76ba8e97b 100644
--- a/engines/gob/inter_playtoons.cpp
+++ b/engines/gob/inter_playtoons.cpp
@@ -148,7 +148,7 @@ void Inter_Playtoons::oPlaytoons_printText(OpFuncParams &params) {
case TYPE_VAR_INT32:
case TYPE_ARRAY_INT32:
sprintf(buf + i, "%d",
- VAR_OFFSET(_vm->_game->_script->readVarIndex()));
+ (int32)VAR_OFFSET(_vm->_game->_script->readVarIndex()));
break;
case TYPE_VAR_STR:
diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp
index 0eb8be1a03..2d3f2ad731 100644
--- a/engines/gob/inter_v1.cpp
+++ b/engines/gob/inter_v1.cpp
@@ -945,7 +945,7 @@ void Inter_v1::o1_printText(OpFuncParams &params) {
case TYPE_VAR_INT32:
case TYPE_ARRAY_INT32:
sprintf(buf + i, "%d",
- VAR_OFFSET(_vm->_game->_script->readVarIndex()));
+ (int32)VAR_OFFSET(_vm->_game->_script->readVarIndex()));
break;
case TYPE_VAR_STR:
diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp
index 2fea18343d..1e5b7bb24c 100644
--- a/engines/gob/inter_v2.cpp
+++ b/engines/gob/inter_v2.cpp
@@ -1104,7 +1104,7 @@ void Inter_v2::o2_printText(OpFuncParams &params) {
case TYPE_VAR_INT32:
case TYPE_ARRAY_INT32:
sprintf(buf + i, "%d",
- VAR_OFFSET(_vm->_game->_script->readVarIndex()));
+ (int32)VAR_OFFSET(_vm->_game->_script->readVarIndex()));
break;
case TYPE_VAR_STR:
diff --git a/engines/gob/inter_v7.cpp b/engines/gob/inter_v7.cpp
index a36154fe5e..81547f7362 100644
--- a/engines/gob/inter_v7.cpp
+++ b/engines/gob/inter_v7.cpp
@@ -135,7 +135,7 @@ void Inter_v7::o7_intToString() {
uint16 valueIndex = _vm->_game->_script->readVarIndex();
uint16 destIndex = _vm->_game->_script->readVarIndex();
- sprintf(GET_VARO_STR(destIndex), "%d", READ_VARO_UINT32(valueIndex));
+ sprintf(GET_VARO_STR(destIndex), "%d", (int32)READ_VARO_UINT32(valueIndex));
}
void Inter_v7::o7_callFunction() {
diff --git a/engines/gob/map.cpp b/engines/gob/map.cpp
index 57f5f7af48..e58cd3c9a3 100644
--- a/engines/gob/map.cpp
+++ b/engines/gob/map.cpp
@@ -373,7 +373,7 @@ void Map::findNearestWalkable(int16 &gobDestX, int16 &gobDestY,
int i;
mapWidth = _screenWidth / _tilesWidth;
- mapHeight = _vm->_width / _tilesHeight;
+ mapHeight = _vm->_height / _tilesHeight;
direction = 0;
for (i = 1; i <= gobDestX; i++)
diff --git a/engines/groovie/detection.cpp b/engines/groovie/detection.cpp
index 62887bac1e..1a3b313649 100644
--- a/engines/groovie/detection.cpp
+++ b/engines/groovie/detection.cpp
@@ -52,7 +52,7 @@ static const GroovieGameDescription gameDescriptions[] = {
"t7g", "",
AD_ENTRY1s("script.grv", "d1b8033b40aa67c076039881eccce90d", 16659),
Common::EN_ANY, Common::kPlatformPC, ADGF_NO_FLAGS,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_NOASPECT)
},
kGroovieT7G, 0
},
@@ -63,7 +63,7 @@ static const GroovieGameDescription gameDescriptions[] = {
"t7g", "",
AD_ENTRY1s("T7GMac", "acdc4a58dd3f007f65e99b99d78e0bce", 1814029),
Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_NOASPECT)
},
kGroovieT7G, 0
},
@@ -79,7 +79,7 @@ static const GroovieGameDescription gameDescriptions[] = {
"t7g", "",
AD_ENTRY1s("T7GMac", "6bdee8d0f9eef6d58d02fcd7deec3fb2", 1830783),
Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_NOASPECT)
},
kGroovieT7G, 0
},
@@ -90,7 +90,7 @@ static const GroovieGameDescription gameDescriptions[] = {
"t7g", "",
AD_ENTRY1s("T7GMac", "0d595d4b44ae1814082938d051e5174e", 1830783),
Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_NOASPECT)
},
kGroovieT7G, 0
},
@@ -106,7 +106,7 @@ static const GroovieGameDescription gameDescriptions[] = {
{ NULL, 0, NULL, 0}
},
Common::RU_RUS, Common::kPlatformPC, ADGF_NO_FLAGS,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_NOASPECT)
},
kGroovieT7G, 0
},
@@ -120,7 +120,7 @@ static const GroovieGameDescription gameDescriptions[] = {
{ NULL, 0, NULL, 0}
},
Common::EN_ANY, Common::kPlatformIOS, ADGF_NO_FLAGS,
- Common::GUIO_NOMIDI
+ GUIO2(GUIO_NOMIDI, GUIO_NOASPECT)
},
kGroovieT7G, 0
},
@@ -132,7 +132,7 @@ static const GroovieGameDescription gameDescriptions[] = {
"11h", "",
AD_ENTRY1s("disk.1", "5c0428cd3659fc7bbcd0aa16485ed5da", 227),
Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_NOASPECT)
},
kGroovieV2, 1
},
@@ -142,8 +142,8 @@ static const GroovieGameDescription gameDescriptions[] = {
{
"11h", "Demo",
AD_ENTRY1s("disk.1", "aacb32ce07e0df2894bd83a3dee40c12", 70),
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, Common::GUIO_NOLAUNCHLOAD |
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE,
+ GUIO5(GUIO_NOLAUNCHLOAD, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_NOASPECT)
},
kGroovieV2, 1
},
@@ -153,7 +153,8 @@ static const GroovieGameDescription gameDescriptions[] = {
{
"11h", "Making Of",
AD_ENTRY1s("disk.1", "5c0428cd3659fc7bbcd0aa16485ed5da", 227),
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, Common::GUIO_NOMIDI | Common::GUIO_NOLAUNCHLOAD
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE,
+ GUIO3(GUIO_NOMIDI, GUIO_NOLAUNCHLOAD, GUIO_NOASPECT)
},
kGroovieV2, 2
},
@@ -163,7 +164,8 @@ static const GroovieGameDescription gameDescriptions[] = {
{
"clandestiny", "Trailer",
AD_ENTRY1s("disk.1", "5c0428cd3659fc7bbcd0aa16485ed5da", 227),
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, Common::GUIO_NOMIDI | Common::GUIO_NOLAUNCHLOAD
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE,
+ GUIO3(GUIO_NOMIDI, GUIO_NOLAUNCHLOAD, GUIO_NOASPECT)
},
kGroovieV2, 3
},
@@ -173,7 +175,8 @@ static const GroovieGameDescription gameDescriptions[] = {
{
"clandestiny", "",
AD_ENTRY1s("disk.1", "f79fc1515174540fef6a34132efc4c53", 76),
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, Common::GUIO_NOMIDI
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE,
+ GUIO2(GUIO_NOMIDI, GUIO_NOASPECT)
},
kGroovieV2, 1
},
@@ -183,7 +186,8 @@ static const GroovieGameDescription gameDescriptions[] = {
{
"unclehenry", "",
AD_ENTRY1s("disk.1", "0e1b1d3cecc4fc7efa62a968844d1f7a", 72),
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, Common::GUIO_NOMIDI
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE,
+ GUIO2(GUIO_NOMIDI, GUIO_NOASPECT)
},
kGroovieV2, 1
},
@@ -193,7 +197,8 @@ static const GroovieGameDescription gameDescriptions[] = {
{
"tlc", "",
AD_ENTRY1s("disk.1", "32a1afa68478f1f9d2b25eeea427f2e3", 84),
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, Common::GUIO_NOMIDI
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE,
+ GUIO2(GUIO_NOMIDI, GUIO_NOASPECT)
},
kGroovieV2, 1
},
@@ -216,7 +221,7 @@ public:
// to the detection entries. In the latter case, this TODO should be
// replaced with an according explanation.
_flags = kADFlagUseExtraAsHint;
- _guioptions = Common::GUIO_NOSUBTITLES | Common::GUIO_NOSFX;
+ _guioptions = GUIO3(GUIO_NOSUBTITLES, GUIO_NOSFX, GUIO_NOASPECT);
}
const char *getName() const {
diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp
index ca896a8d21..53f335ce68 100644
--- a/engines/groovie/roq.cpp
+++ b/engines/groovie/roq.cpp
@@ -138,9 +138,7 @@ void ROQPlayer::buildShowBuf() {
}
// Swap buffers
- Graphics::Surface *tmp = _prevBuf;
- _prevBuf = _currBuf;
- _currBuf = tmp;
+ SWAP(_prevBuf, _currBuf);
}
bool ROQPlayer::playFrameInternal() {
diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index 9003a58ab8..a8b4417459 100644
--- a/engines/groovie/script.cpp
+++ b/engines/groovie/script.cpp
@@ -590,9 +590,9 @@ bool Script::playvideofromref(uint32 fileref) {
if (_videoFile) {
_videoRef = fileref;
- // If teeth cursor, and in main script, mark video prefer low-speed
- // filename check as sometimes teeth used for puzzle movements (bishops)
- if (_version == kGroovieT7G && _lastCursor == 7 && _scriptFile == "script.grv")
+ // If teeth or mask cursor, and in main script, mark video prefer low-speed.
+ // Filename check as sometimes teeth used for puzzle movements (bishops)
+ if (_version == kGroovieT7G && (_lastCursor == 7 || _lastCursor == 4) && _scriptFile == "script.grv")
_bitflags |= (1 << 15);
_vm->_videoPlayer->load(_videoFile, _bitflags);
} else {
diff --git a/engines/hugo/detection.cpp b/engines/hugo/detection.cpp
index 5d972f5658..90708163f5 100644
--- a/engines/hugo/detection.cpp
+++ b/engines/hugo/detection.cpp
@@ -63,7 +63,7 @@ static const HugoGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO0()
},
kGameTypeHugo1
},
@@ -75,7 +75,7 @@ static const HugoGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
GF_PACKED,
- Common::GUIO_NONE
+ GUIO0()
},
kGameTypeHugo1
},
@@ -87,7 +87,7 @@ static const HugoGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
GF_PACKED,
- Common::GUIO_NONE
+ GUIO0()
},
kGameTypeHugo2
},
@@ -99,7 +99,7 @@ static const HugoGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
GF_PACKED,
- Common::GUIO_NONE
+ GUIO0()
},
kGameTypeHugo2
},
@@ -111,7 +111,7 @@ static const HugoGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
GF_PACKED,
- Common::GUIO_NONE
+ GUIO0()
},
kGameTypeHugo3
},
@@ -123,7 +123,7 @@ static const HugoGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
GF_PACKED,
- Common::GUIO_NONE
+ GUIO0()
},
kGameTypeHugo3
},
diff --git a/engines/hugo/game.h b/engines/hugo/game.h
index 5db57789dc..b1c5f407b3 100644
--- a/engines/hugo/game.h
+++ b/engines/hugo/game.h
@@ -66,7 +66,7 @@ enum cycle_t {kCycleInvisible, kCycleAlmostInvisible, kCycleNotCycling, kCycleFo
/**
* Enumerate sequence index matching direction of travel
*/
-enum {RIGHT, LEFT, DOWN, _UP};
+enum {SEQ_RIGHT, SEQ_LEFT, SEQ_DOWN, SEQ_UP};
enum font_t {LARGE_ROMAN, MED_ROMAN, NUM_GDI_FONTS, INIT_FONTS, DEL_FONTS};
diff --git a/engines/hugo/object_v1d.cpp b/engines/hugo/object_v1d.cpp
index ecdbb3b4c6..831dc88dea 100644
--- a/engines/hugo/object_v1d.cpp
+++ b/engines/hugo/object_v1d.cpp
@@ -205,15 +205,15 @@ void ObjectHandler_v1d::moveObjects() {
if (!obj->vx) { // Got 4 directions
if (obj->vx != obj->oldvx) {// vx just stopped
if (dy > 0)
- obj->currImagePtr = obj->seqList[DOWN].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr;
else
- obj->currImagePtr = obj->seqList[_UP].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr;
}
} else if (obj->vx != obj->oldvx) {
if (dx > 0)
- obj->currImagePtr = obj->seqList[RIGHT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
else
- obj->currImagePtr = obj->seqList[LEFT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
}
}
@@ -239,15 +239,15 @@ void ObjectHandler_v1d::moveObjects() {
if (!obj->vx && (obj->seqNumb > 2)) {
if (obj->vx != obj->oldvx) { // vx just stopped
if (obj->vy > 0)
- obj->currImagePtr = obj->seqList[DOWN].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr;
else
- obj->currImagePtr = obj->seqList[_UP].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr;
}
} else if (obj->vx != obj->oldvx) {
if (obj->vx > 0)
- obj->currImagePtr = obj->seqList[RIGHT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
else
- obj->currImagePtr = obj->seqList[LEFT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
}
if (obj->vx || obj->vy)
diff --git a/engines/hugo/object_v1w.cpp b/engines/hugo/object_v1w.cpp
index 11c09176e5..4388ef5520 100644
--- a/engines/hugo/object_v1w.cpp
+++ b/engines/hugo/object_v1w.cpp
@@ -208,24 +208,24 @@ void ObjectHandler_v1w::moveObjects() {
if (!obj->vx) { // Got 4 directions
if (obj->vx != obj->oldvx) { // vx just stopped
if (dy >= 0)
- obj->currImagePtr = obj->seqList[DOWN].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr;
else
- obj->currImagePtr = obj->seqList[_UP].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr;
}
} else if (obj->vx != obj->oldvx) {
if (dx > 0)
- obj->currImagePtr = obj->seqList[RIGHT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
else
- obj->currImagePtr = obj->seqList[LEFT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
}
break;
case 3:
case 2:
if (obj->vx != obj->oldvx) { // vx just stopped
if (dx > 0) // Left & right only
- obj->currImagePtr = obj->seqList[RIGHT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
else
- obj->currImagePtr = obj->seqList[LEFT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
}
break;
}
@@ -252,15 +252,15 @@ void ObjectHandler_v1w::moveObjects() {
if (!obj->vx && (obj->seqNumb >= 4)) {
if (obj->vx != obj->oldvx) { // vx just stopped
if (obj->vy > 0)
- obj->currImagePtr = obj->seqList[DOWN].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr;
else
- obj->currImagePtr = obj->seqList[_UP].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr;
}
} else if (obj->vx != obj->oldvx) {
if (obj->vx > 0)
- obj->currImagePtr = obj->seqList[RIGHT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
else
- obj->currImagePtr = obj->seqList[LEFT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
}
}
obj->oldvx = obj->vx;
diff --git a/engines/hugo/object_v2d.cpp b/engines/hugo/object_v2d.cpp
index c9e5104972..4a22fab2c0 100644
--- a/engines/hugo/object_v2d.cpp
+++ b/engines/hugo/object_v2d.cpp
@@ -211,24 +211,24 @@ void ObjectHandler_v2d::moveObjects() {
if (!obj->vx) { // Got 4 directions
if (obj->vx != obj->oldvx) { // vx just stopped
if (dy > 0)
- obj->currImagePtr = obj->seqList[DOWN].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr;
else
- obj->currImagePtr = obj->seqList[_UP].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr;
}
} else if (obj->vx != obj->oldvx) {
if (dx > 0)
- obj->currImagePtr = obj->seqList[RIGHT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
else
- obj->currImagePtr = obj->seqList[LEFT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
}
break;
case 3:
case 2:
if (obj->vx != obj->oldvx) { // vx just stopped
if (dx > 0) // Left & right only
- obj->currImagePtr = obj->seqList[RIGHT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
else
- obj->currImagePtr = obj->seqList[LEFT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
}
break;
}
@@ -255,15 +255,15 @@ void ObjectHandler_v2d::moveObjects() {
if (!obj->vx && (obj->seqNumb >= 4)) {
if (obj->vx != obj->oldvx) { // vx just stopped
if (obj->vy > 0)
- obj->currImagePtr = obj->seqList[DOWN].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr;
else
- obj->currImagePtr = obj->seqList[_UP].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr;
}
} else if (obj->vx != obj->oldvx) {
if (obj->vx > 0)
- obj->currImagePtr = obj->seqList[RIGHT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
else
- obj->currImagePtr = obj->seqList[LEFT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
}
}
obj->oldvx = obj->vx;
diff --git a/engines/hugo/object_v3d.cpp b/engines/hugo/object_v3d.cpp
index 07bd5e0c7f..cde7f5fd62 100644
--- a/engines/hugo/object_v3d.cpp
+++ b/engines/hugo/object_v3d.cpp
@@ -92,24 +92,24 @@ void ObjectHandler_v3d::moveObjects() {
if (!obj->vx) { // Got 4 directions
if (obj->vx != obj->oldvx) { // vx just stopped
if (dy >= 0)
- obj->currImagePtr = obj->seqList[DOWN].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr;
else
- obj->currImagePtr = obj->seqList[_UP].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr;
}
} else if (obj->vx != obj->oldvx) {
if (dx > 0)
- obj->currImagePtr = obj->seqList[RIGHT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
else
- obj->currImagePtr = obj->seqList[LEFT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
}
break;
case 3:
case 2:
if (obj->vx != obj->oldvx) { // vx just stopped
if (dx > 0) // Left & right only
- obj->currImagePtr = obj->seqList[RIGHT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
else
- obj->currImagePtr = obj->seqList[LEFT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
}
break;
}
@@ -136,15 +136,15 @@ void ObjectHandler_v3d::moveObjects() {
if (!obj->vx && (obj->seqNumb >= 4)) {
if (obj->vx != obj->oldvx) { // vx just stopped
if (obj->vy > 0)
- obj->currImagePtr = obj->seqList[DOWN].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr;
else
- obj->currImagePtr = obj->seqList[_UP].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr;
}
} else if (obj->vx != obj->oldvx) {
if (obj->vx > 0)
- obj->currImagePtr = obj->seqList[RIGHT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
else
- obj->currImagePtr = obj->seqList[LEFT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
}
}
obj->oldvx = obj->vx;
diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp
index bbf6c39f13..a0ad4c0986 100644
--- a/engines/hugo/parser.cpp
+++ b/engines/hugo/parser.cpp
@@ -391,8 +391,6 @@ void Parser::command(const char *format, ...) {
va_list marker;
va_start(marker, format);
-// TODO:
-// _vm->_line = Common::String::vformat(format, marker);
vsprintf(_vm->_line, format, marker);
va_end(marker);
diff --git a/engines/hugo/route.cpp b/engines/hugo/route.cpp
index af8ec3427d..281aacf031 100644
--- a/engines/hugo/route.cpp
+++ b/engines/hugo/route.cpp
@@ -67,35 +67,35 @@ void Route::setDirection(const uint16 keyCode) {
switch (keyCode) {
case Common::KEYCODE_UP:
case Common::KEYCODE_KP8:
- obj->currImagePtr = obj->seqList[_UP].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr;
break;
case Common::KEYCODE_DOWN:
case Common::KEYCODE_KP2:
- obj->currImagePtr = obj->seqList[DOWN].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr;
break;
case Common::KEYCODE_LEFT:
case Common::KEYCODE_KP4:
- obj->currImagePtr = obj->seqList[LEFT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
break;
case Common::KEYCODE_RIGHT:
case Common::KEYCODE_KP6:
- obj->currImagePtr = obj->seqList[RIGHT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
break;
case Common::KEYCODE_HOME:
case Common::KEYCODE_KP7:
- obj->currImagePtr = obj->seqList[LEFT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
break;
case Common::KEYCODE_END:
case Common::KEYCODE_KP1:
- obj->currImagePtr = obj->seqList[LEFT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr;
break;
case Common::KEYCODE_PAGEUP:
case Common::KEYCODE_KP9:
- obj->currImagePtr = obj->seqList[RIGHT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
break;
case Common::KEYCODE_PAGEDOWN:
case Common::KEYCODE_KP3:
- obj->currImagePtr = obj->seqList[RIGHT].seqPtr;
+ obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr;
break;
}
}
@@ -231,48 +231,48 @@ void Route::segment(int16 x, int16 y) {
if (_vm->_hero->x < x1) {
// Hero x not in segment, search x1..x2
// Find all segments above current
- for (x = x1; !(_routeFoundFl | _fullStackFl | _fullSegmentFl) && x <= x2; x++) {
+ for (x = x1; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x <= x2; x++) {
if (_boundaryMap[y - 1][x] == 0)
segment(x, y - 1);
}
// Find all segments below current
- for (x = x1; !(_routeFoundFl | _fullStackFl | _fullSegmentFl) && x <= x2; x++) {
+ for (x = x1; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x <= x2; x++) {
if (_boundaryMap[y + 1][x] == 0)
segment(x, y + 1);
}
} else if (_vm->_hero->x + kHeroMaxWidth > x2) {
// Hero x not in segment, search x1..x2
// Find all segments above current
- for (x = x2; !(_routeFoundFl | _fullStackFl | _fullSegmentFl) && x >= x1; x--) {
+ for (x = x2; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x >= x1; x--) {
if (_boundaryMap[y - 1][x] == 0)
segment(x, y - 1);
}
// Find all segments below current
- for (x = x2; !(_routeFoundFl | _fullStackFl | _fullSegmentFl) && x >= x1; x--) {
+ for (x = x2; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x >= x1; x--) {
if (_boundaryMap[y + 1][x] == 0)
segment(x, y + 1);
}
} else {
// Organize search around hero x position - this gives
// better chance for more direct route.
- for (x = _vm->_hero->x; !(_routeFoundFl | _fullStackFl | _fullSegmentFl) && x <= x2; x++) {
+ for (x = _vm->_hero->x; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x <= x2; x++) {
if (_boundaryMap[y - 1][x] == 0)
segment(x, y - 1);
}
- for (x = x1; !(_routeFoundFl | _fullStackFl | _fullSegmentFl) && x < _vm->_hero->x; x++) {
+ for (x = x1; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x < _vm->_hero->x; x++) {
if (_boundaryMap[y - 1][x] == 0)
segment(x, y - 1);
}
- for (x = _vm->_hero->x; !(_routeFoundFl | _fullStackFl | _fullSegmentFl) && x <= x2; x++) {
+ for (x = _vm->_hero->x; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x <= x2; x++) {
if (_boundaryMap[y + 1][x] == 0)
segment(x, y + 1);
}
- for (x = x1; !(_routeFoundFl | _fullStackFl | _fullSegmentFl) && x < _vm->_hero->x; x++) {
+ for (x = x1; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x < _vm->_hero->x; x++) {
if (_boundaryMap[y + 1][x] == 0)
segment(x, y + 1);
}
diff --git a/engines/hugo/schedule.cpp b/engines/hugo/schedule.cpp
index 384b3ace8f..892c144393 100644
--- a/engines/hugo/schedule.cpp
+++ b/engines/hugo/schedule.cpp
@@ -1539,7 +1539,7 @@ void Scheduler_v1d::promptAction(act *action) {
response.toLowercase();
char resp[256];
- strncpy(resp, response.c_str(), 256);
+ Common::strlcpy(resp, response.c_str(), 256);
if (action->a3.encodedFl)
decodeString(resp);
@@ -1585,12 +1585,9 @@ void Scheduler_v2d::promptAction(act *action) {
bool found = false;
const char *tmpStr; // General purpose string ptr
- char resp[256];
- strncpy(resp, response.c_str(), 256);
-
for (int dx = 0; !found && (action->a3.responsePtr[dx] != -1); dx++) {
tmpStr = _vm->_file->fetchString(action->a3.responsePtr[dx]);
- if (strstr(Utils::strlwr(resp), tmpStr))
+ if (response.contains(tmpStr))
found = true;
}
diff --git a/engines/kyra/debugger.cpp b/engines/kyra/debugger.cpp
index dfc2a9f868..35b4d8ba7f 100644
--- a/engines/kyra/debugger.cpp
+++ b/engines/kyra/debugger.cpp
@@ -32,9 +32,10 @@
namespace Kyra {
Debugger::Debugger(KyraEngine_v1 *vm)
- : ::GUI::Debugger() {
- _vm = vm;
+ : ::GUI::Debugger(), _vm(vm) {
+}
+void Debugger::initialize() {
DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit));
DCmd_Register("screen_debug_mode", WRAP_METHOD(Debugger, cmd_setScreenDebug));
DCmd_Register("load_palette", WRAP_METHOD(Debugger, cmd_loadPalette));
@@ -196,6 +197,9 @@ bool Debugger::cmd_setTimerCountdown(int argc, const char **argv) {
Debugger_LoK::Debugger_LoK(KyraEngine_LoK *vm)
: Debugger(vm), _vm(vm) {
+}
+
+void Debugger_LoK::initialize() {
DCmd_Register("enter", WRAP_METHOD(Debugger_LoK, cmd_enterRoom));
DCmd_Register("scenes", WRAP_METHOD(Debugger_LoK, cmd_listScenes));
DCmd_Register("give", WRAP_METHOD(Debugger_LoK, cmd_giveItem));
@@ -281,6 +285,9 @@ bool Debugger_LoK::cmd_listBirthstones(int argc, const char **argv) {
#pragma mark -
Debugger_v2::Debugger_v2(KyraEngine_v2 *vm) : Debugger(vm), _vm(vm) {
+}
+
+void Debugger_v2::initialize() {
DCmd_Register("character_info", WRAP_METHOD(Debugger_v2, cmd_characterInfo));
DCmd_Register("enter", WRAP_METHOD(Debugger_v2, cmd_enterScene));
DCmd_Register("scenes", WRAP_METHOD(Debugger_v2, cmd_listScenes));
@@ -433,6 +440,9 @@ bool Debugger_v2::cmd_giveItem(int argc, const char **argv) {
#pragma mark -
Debugger_HoF::Debugger_HoF(KyraEngine_HoF *vm) : Debugger_v2(vm), _vm(vm) {
+}
+
+void Debugger_HoF::initialize() {
DCmd_Register("pass_codes", WRAP_METHOD(Debugger_HoF, cmd_passcodes));
}
diff --git a/engines/kyra/debugger.h b/engines/kyra/debugger.h
index 09ddd89a7a..e9c0a6a98a 100644
--- a/engines/kyra/debugger.h
+++ b/engines/kyra/debugger.h
@@ -37,6 +37,8 @@ public:
Debugger(KyraEngine_v1 *vm);
virtual ~Debugger() {} // we need this for __SYMBIAN32__ archaic gcc/UIQ
+ virtual void initialize();
+
protected:
KyraEngine_v1 *_vm;
@@ -56,6 +58,7 @@ public:
Debugger_LoK(KyraEngine_LoK *vm);
virtual ~Debugger_LoK() {} // we need this for __SYMBIAN32__ archaic gcc/UIQ
+ virtual void initialize();
protected:
KyraEngine_LoK *_vm;
@@ -70,6 +73,7 @@ public:
Debugger_v2(KyraEngine_v2 *vm);
virtual ~Debugger_v2() {}
+ virtual void initialize();
protected:
KyraEngine_v2 *_vm;
@@ -85,6 +89,7 @@ class Debugger_HoF : public Debugger_v2 {
public:
Debugger_HoF(KyraEngine_HoF *vm);
+ virtual void initialize();
protected:
KyraEngine_HoF *_vm;
diff --git a/engines/kyra/detection_tables.h b/engines/kyra/detection_tables.h
index c224c8f46d..ebf7c8eee7 100644
--- a/engines/kyra/detection_tables.h
+++ b/engines/kyra/detection_tables.h
@@ -67,7 +67,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
},
KYRA1_FLOPPY_CMP_FLAGS
},
@@ -80,7 +80,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
},
KYRA1_FLOPPY_CMP_FLAGS
},
@@ -94,7 +94,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
},
KYRA1_FLOPPY_FLAGS
},
@@ -107,7 +107,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
},
KYRA1_FLOPPY_FLAGS
},
@@ -119,7 +119,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
},
KYRA1_FLOPPY_FLAGS
},
@@ -131,7 +131,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
},
KYRA1_FLOPPY_FLAGS
},
@@ -143,7 +143,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
},
KYRA1_FLOPPY_FLAGS
},
@@ -155,7 +155,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::RU_RUS,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
},
KYRA1_OLDFLOPPY_FLAGS
},
@@ -167,7 +167,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
},
KYRA1_FLOPPY_FLAGS
},
@@ -179,7 +179,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
},
KYRA1_FLOPPY_FLAGS
},
@@ -191,7 +191,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
},
KYRA1_FLOPPY_FLAGS
},
@@ -208,7 +208,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIAMIGA
+ GUIO2(GUIO_NOSPEECH, GUIO_MIDIAMIGA)
},
KYRA1_AMIGA_FLAGS
},
@@ -225,7 +225,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIAMIGA
+ GUIO2(GUIO_NOSPEECH, GUIO_MIDIAMIGA)
},
KYRA1_AMIGA_FLAGS
},
@@ -242,7 +242,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIGM
+ GUIO2(GUIO_NOSPEECH, GUIO_MIDIGM)
},
KYRA1_FLOPPY_FLAGS
},
@@ -259,7 +259,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformFMTowns,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDITOWNS
+ GUIO2(GUIO_NOSPEECH, GUIO_MIDITOWNS)
},
KYRA1_TOWNS_FLAGS
},
@@ -275,7 +275,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::JA_JPN,
Common::kPlatformFMTowns,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDITOWNS
+ GUIO2(GUIO_NOSPEECH, GUIO_MIDITOWNS)
},
KYRA1_TOWNS_SJIS_FLAGS
},
@@ -294,7 +294,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::JA_JPN,
Common::kPlatformPC98,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIPC98
+ GUIO2(GUIO_NOSPEECH, GUIO_MIDIPC98)
},
KYRA1_TOWNS_SJIS_FLAGS
},
@@ -307,7 +307,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIPCSPK
+ GUIO3(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
},
KYRA1_CD_FLAGS
},
@@ -319,7 +319,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIPCSPK
+ GUIO3(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
},
KYRA1_CD_FLAGS
},
@@ -331,7 +331,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIPCSPK
+ GUIO3(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
},
KYRA1_CD_FLAGS
},
@@ -344,7 +344,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIPCSPK
+ GUIO3(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
},
KYRA1_CD_FLAGS
},
@@ -361,7 +361,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_CD,
- Common::GUIO_NONE
+ GUIO0()
},
KYRA1_CD_FLAGS
},
@@ -377,7 +377,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformMacintosh,
ADGF_CD,
- Common::GUIO_NONE
+ GUIO0()
},
KYRA1_CD_FLAGS
},
@@ -393,7 +393,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformMacintosh,
ADGF_CD,
- Common::GUIO_NONE
+ GUIO0()
},
KYRA1_CD_FLAGS
},
@@ -406,7 +406,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
},
KYRA1_DEMO_FLAGS
},
@@ -419,7 +419,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIPCSPK
+ GUIO3(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIPCSPK)
},
KYRA1_DEMO_CD_FLAGS
},
@@ -432,7 +432,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
KYRA2_FLOPPY_CMP_FLAGS
},
@@ -445,7 +445,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
KYRA2_FLOPPY_CMP_FLAGS
},
@@ -458,7 +458,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
KYRA2_FLOPPY_FLAGS
},
@@ -471,7 +471,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
KYRA2_FLOPPY_FLAGS
},
@@ -484,7 +484,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
KYRA2_FLOPPY_FLAGS
},
@@ -497,7 +497,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
KYRA2_FLOPPY_FLAGS
},
@@ -510,7 +510,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::RU_RUS,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
KYRA2_FLOPPY_FAN_FLAGS(Common::RU_RUS, Common::EN_ANY)
},
@@ -523,7 +523,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::RU_RUS,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
KYRA2_FLOPPY_FAN_FLAGS(Common::RU_RUS, Common::EN_ANY)
},
@@ -536,7 +536,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
KYRA2_CD_FLAGS
},
@@ -548,7 +548,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
KYRA2_CD_FLAGS
},
@@ -560,7 +560,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
KYRA2_CD_FLAGS
},
@@ -574,7 +574,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -586,7 +586,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -598,7 +598,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -611,7 +611,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -624,7 +624,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -637,7 +637,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
KYRA2_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -650,7 +650,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD | ADGF_DEMO,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
KYRA2_CD_DEMO_FLAGS
},
@@ -663,7 +663,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD | ADGF_DEMO,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
KYRA2_CD_DEMO_FLAGS
},
@@ -676,7 +676,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD | ADGF_DEMO,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
KYRA2_CD_DEMO_FLAGS
},
@@ -689,7 +689,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
KYRA2_DEMO_FLAGS
},
@@ -702,7 +702,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformFMTowns,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDITOWNS
+ GUIO2(GUIO_NOSPEECH, GUIO_MIDITOWNS)
},
KYRA2_TOWNS_FLAGS
},
@@ -714,7 +714,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::JA_JPN,
Common::kPlatformFMTowns,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDITOWNS
+ GUIO2(GUIO_NOSPEECH, GUIO_MIDITOWNS)
},
KYRA2_TOWNS_SJIS_FLAGS
},
@@ -726,7 +726,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC98,
ADGF_CD,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIPC98
+ GUIO2(GUIO_NOSPEECH, GUIO_MIDIPC98)
},
KYRA2_TOWNS_FLAGS
},
@@ -738,7 +738,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::JA_JPN,
Common::kPlatformPC98,
ADGF_CD,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIPC98
+ GUIO2(GUIO_NOSPEECH, GUIO_MIDIPC98)
},
KYRA2_TOWNS_SJIS_FLAGS
},
@@ -758,7 +758,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- Common::GUIO_NOMIDI
+ GUIO1(GUIO_NOMIDI)
},
KYRA3_CD_FLAGS
},
@@ -774,7 +774,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- Common::GUIO_NOMIDI
+ GUIO1(GUIO_NOMIDI)
},
KYRA3_CD_FLAGS
},
@@ -790,7 +790,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- Common::GUIO_NOMIDI
+ GUIO1(GUIO_NOMIDI)
},
KYRA3_CD_FLAGS
},
@@ -808,7 +808,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- Common::GUIO_NOMIDI
+ GUIO1(GUIO_NOMIDI)
},
KYRA3_CD_INS_FLAGS
},
@@ -824,7 +824,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- Common::GUIO_NOMIDI
+ GUIO1(GUIO_NOMIDI)
},
KYRA3_CD_INS_FLAGS
},
@@ -840,7 +840,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- Common::GUIO_NOMIDI
+ GUIO1(GUIO_NOMIDI)
},
KYRA3_CD_INS_FLAGS
},
@@ -858,7 +858,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_DROPLANGUAGE,
- Common::GUIO_NOMIDI
+ GUIO1(GUIO_NOMIDI)
},
KYRA3_CD_INS_FLAGS
},
@@ -874,7 +874,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformMacintosh,
ADGF_DROPLANGUAGE,
- Common::GUIO_NOMIDI
+ GUIO1(GUIO_NOMIDI)
},
KYRA3_CD_INS_FLAGS
},
@@ -890,7 +890,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformMacintosh,
ADGF_DROPLANGUAGE,
- Common::GUIO_NOMIDI
+ GUIO1(GUIO_NOMIDI)
},
KYRA3_CD_INS_FLAGS
},
@@ -908,7 +908,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- Common::GUIO_NOMIDI
+ GUIO1(GUIO_NOMIDI)
},
KYRA3_CD_FAN_FLAGS(Common::ES_ESP, Common::EN_ANY)
},
@@ -924,7 +924,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- Common::GUIO_NOMIDI
+ GUIO1(GUIO_NOMIDI)
},
KYRA3_CD_FAN_FLAGS(Common::ES_ESP, Common::EN_ANY)
},
@@ -940,7 +940,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- Common::GUIO_NOMIDI
+ GUIO1(GUIO_NOMIDI)
},
KYRA3_CD_FAN_FLAGS(Common::ES_ESP, Common::EN_ANY)
},
@@ -958,7 +958,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- Common::GUIO_NOMIDI
+ GUIO1(GUIO_NOMIDI)
},
KYRA3_CD_FAN_FLAGS(Common::IT_ITA, Common::FR_FRA)
},
@@ -974,7 +974,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- Common::GUIO_NOMIDI
+ GUIO1(GUIO_NOMIDI)
},
KYRA3_CD_FAN_FLAGS(Common::IT_ITA, Common::FR_FRA)
},
@@ -990,7 +990,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- Common::GUIO_NOMIDI
+ GUIO1(GUIO_NOMIDI)
},
KYRA3_CD_FAN_FLAGS(Common::IT_ITA, Common::FR_FRA)
},
@@ -1009,7 +1009,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_CD_FLAGS
},
@@ -1026,7 +1026,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_CD_FLAGS
},
@@ -1043,7 +1043,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_CD_FLAGS
},
@@ -1060,7 +1060,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_CD_FLAGS
},
@@ -1077,7 +1077,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_CD_FLAGS
},
@@ -1094,7 +1094,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_CD_FLAGS
},
@@ -1112,7 +1112,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_CD_FAN_FLAGS(Common::RU_RUS, Common::DE_DEU)
},
@@ -1130,7 +1130,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_CD_FAN_FLAGS(Common::RU_RUS, Common::DE_DEU)
},
@@ -1147,7 +1147,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::RU_RUS,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_CD_FAN_FLAGS(Common::RU_RUS, Common::DE_DEU)
},
@@ -1165,7 +1165,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -1182,7 +1182,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -1199,7 +1199,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -1216,7 +1216,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -1233,7 +1233,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -1250,7 +1250,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_CD_FAN_FLAGS(Common::IT_ITA, Common::EN_ANY)
},
@@ -1266,7 +1266,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_FLOPPY_CMP_FLAGS
},
@@ -1282,7 +1282,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_FLOPPY_CMP_FLAGS
},
@@ -1298,7 +1298,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_FLOPPY_CMP_FLAGS
},
@@ -1315,7 +1315,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_FLOPPY_FLAGS
},
@@ -1332,7 +1332,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_FLOPPY_FLAGS
},
@@ -1349,7 +1349,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_FLOPPY_FLAGS
},
@@ -1366,7 +1366,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_FLOPPY_FLAGS
},
@@ -1384,7 +1384,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::RU_RUS,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO5(GUIO_NOSPEECH, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_FLOPPY_FAN_FLAGS(Common::RU_RUS, Common::EN_ANY)
},
@@ -1401,7 +1401,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::JA_JPN,
Common::kPlatformPC98,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH | Common::GUIO_MIDIPC98
+ GUIO2(GUIO_NOSPEECH, GUIO_MIDIPC98)
},
LOL_PC98_SJIS_FLAGS
},
@@ -1418,7 +1418,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_DEMO_FLAGS
},
@@ -1434,7 +1434,7 @@ const KYRAGameDescription adGameDescs[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- Common::GUIO_MIDIADLIB | Common::GUIO_MIDIMT32 | Common::GUIO_MIDIGM | Common::GUIO_MIDIPCSPK
+ GUIO4(GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_MIDIGM, GUIO_MIDIPCSPK)
},
LOL_KYRA2_DEMO_FLAGS
},
diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp
index 7fd9880dce..27f09b645e 100644
--- a/engines/kyra/gui.cpp
+++ b/engines/kyra/gui.cpp
@@ -388,6 +388,10 @@ void GUI::updateSaveList(bool excludeQuickSaves) {
if (_saveSlots.begin() == _saveSlots.end())
return;
+ sortSaveSlots();
+}
+
+void GUI::sortSaveSlots() {
Common::sort(_saveSlots.begin(), _saveSlots.end(), Common::Less<int>());
if (_saveSlots.size() > 2)
Common::sort(_saveSlots.begin()+1, _saveSlots.end(), Common::Greater<int>());
diff --git a/engines/kyra/gui.h b/engines/kyra/gui.h
index 1efbdde394..6e9606f1de 100644
--- a/engines/kyra/gui.h
+++ b/engines/kyra/gui.h
@@ -200,10 +200,15 @@ protected:
void redrawText(const Menu &menu);
void redrawHighlight(const Menu &menu);
+ // The engine expects a list of contiguous savegame indices.
+ // Since ScummVM's savegame indices aren't, we re-index them.
+ // The integers stored in _saveSlots are ScummVM savegame indices.
Common::Array<int> _saveSlots;
void updateSaveList(bool excludeQuickSaves = false);
int getNextSavegameSlot();
+ virtual void sortSaveSlots();
+
uint32 _lastScreenUpdate;
Common::KeyState _keyPressed;
void checkTextfieldInput();
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp
index 3ab52b9940..5bef3cd5b5 100644
--- a/engines/kyra/gui_lol.cpp
+++ b/engines/kyra/gui_lol.cpp
@@ -184,7 +184,7 @@ void LoLEngine::gui_displayCharInventory(int charNum) {
static const uint16 statusFlags[] = { 0x0080, 0x0000, 0x1000, 0x0002, 0x100, 0x0001, 0x0000, 0x0000 };
- memset(_charStatusFlags, 0xffff, sizeof(_charStatusFlags));
+ memset(_charStatusFlags, 0xFF, sizeof(_charStatusFlags));
int x = 0;
int32 c = 0;
@@ -2572,11 +2572,11 @@ void GUI_LoL::setupSaveMenuSlots(Menu &menu, int num) {
slotOffs = 1;
}
- int saveSlotMaxLen = ((_screen->getScreenDim(8))->w << 3) - _screen->getCharWidth('W');
-
+ int saveSlotMaxLen = ((_screen->getScreenDim(8))->w << 3) - _screen->getCharWidth('W');
+
for (int i = startSlot; i < num && _savegameOffset + i - slotOffs < _savegameListSize; ++i) {
- if (_savegameList[_saveSlots[i + _savegameOffset - slotOffs]]) {
- Common::strlcpy(s, _savegameList[_saveSlots[i + _savegameOffset - slotOffs]], 80);
+ if (_savegameList[i + _savegameOffset - slotOffs]) {
+ Common::strlcpy(s, _savegameList[i + _savegameOffset - slotOffs], 80);
// Trim long GMM save descriptions to fit our save slots
int fC = _screen->getTextWidth(s);
@@ -2618,15 +2618,13 @@ void GUI_LoL::updateSavegameList() {
_savegameListSize = _saveSlots.size();
if (_savegameListSize) {
- Common::sort(_saveSlots.begin(), _saveSlots.end(), Common::Greater<int>());
-
LoLEngine::SaveHeader header;
Common::InSaveFile *in;
_savegameList = new char *[_savegameListSize];
for (int i = 0; i < _savegameListSize; i++) {
- in = _vm->openSaveForReading(_vm->getSavegameFilename(i), header);
+ in = _vm->openSaveForReading(_vm->getSavegameFilename(_saveSlots[i]), header);
if (in) {
_savegameList[i] = new char[header.description.size() + 1];
Common::strlcpy(_savegameList[i], header.description.c_str(), header.description.size() + 1);
@@ -2634,15 +2632,18 @@ void GUI_LoL::updateSavegameList() {
delete in;
} else {
_savegameList[i] = 0;
- error("GUI_LoL::updateSavegameList(): Unexpected missing save file for slot: %d.", i);
+ warning("GUI_LoL::updateSavegameList(): Unexpected missing save file for slot: %d.", _saveSlots[i]);
}
}
-
} else {
_savegameList = 0;
}
}
+void GUI_LoL::sortSaveSlots() {
+ Common::sort(_saveSlots.begin(), _saveSlots.end(), Common::Greater<int>());
+}
+
void GUI_LoL::printMenuText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 flags) {
_screen->fprintString("%s", x, y, c0, c1, _vm->gameFlags().use16ColorMode ? (flags & 3) : flags , str);
}
diff --git a/engines/kyra/gui_lol.h b/engines/kyra/gui_lol.h
index 0686926534..af487402f6 100644
--- a/engines/kyra/gui_lol.h
+++ b/engines/kyra/gui_lol.h
@@ -175,6 +175,8 @@ private:
char **_savegameList;
int _savegameListSize;
bool _savegameListUpdateNeeded;
+
+ virtual void sortSaveSlots();
};
} // End of namespace Kyra
diff --git a/engines/kyra/items_lol.cpp b/engines/kyra/items_lol.cpp
index 7e9ae439fc..0d6e99a696 100644
--- a/engines/kyra/items_lol.cpp
+++ b/engines/kyra/items_lol.cpp
@@ -127,14 +127,8 @@ Item LoLEngine::makeItem(int itemType, int curFrame, int flags) {
continue;
bool t = false;
- Item ii = i;
- while (ii && !t) {
- t = testUnkItemFlags(ii);
- if (t)
- break;
- else
- ii = _itemsInPlay[ii - 1].nextAssignedObject;
- }
+ for (Item ii = i; ii && !t; ii = _itemsInPlay[ii].nextAssignedObject)
+ t = isItemMoveable(ii);
if (t) {
cnt = diff;
@@ -144,24 +138,20 @@ Item LoLEngine::makeItem(int itemType, int curFrame, int flags) {
Item slot = i;
if (cnt) {
- slot = r;
- if (testUnkItemFlags(r)) {
+ slot = 0;
+ if (isItemMoveable(r)) {
if (_itemsInPlay[r].nextAssignedObject)
_itemsInPlay[_itemsInPlay[r].nextAssignedObject].level = _itemsInPlay[r].level;
deleteItem(r);
slot = r;
} else {
- uint16 ii = _itemsInPlay[slot].nextAssignedObject;
- while (ii) {
- if (testUnkItemFlags(ii)) {
- _itemsInPlay[slot].nextAssignedObject = _itemsInPlay[ii].nextAssignedObject;
- deleteItem(ii);
- slot = ii;
- break;
- } else {
- slot = ii;
- }
- ii = _itemsInPlay[slot].nextAssignedObject;
+ for (uint16 ii = _itemsInPlay[r].nextAssignedObject; ii; ii = _itemsInPlay[ii].nextAssignedObject) {
+ if (!isItemMoveable(ii))
+ continue;
+ _itemsInPlay[r].nextAssignedObject = _itemsInPlay[ii].nextAssignedObject;
+ deleteItem(ii);
+ slot = ii;
+ break;
}
}
}
@@ -219,7 +209,7 @@ bool LoLEngine::addItemToInventory(Item itemIndex) {
return true;
}
-bool LoLEngine::testUnkItemFlags(Item itemIndex) {
+bool LoLEngine::isItemMoveable(Item itemIndex) {
if (!(_itemsInPlay[itemIndex].shpCurFrame_flg & 0x4000))
return false;
@@ -304,7 +294,7 @@ bool LoLEngine::itemEquipped(int charNum, uint16 itemType) {
return false;
}
-void LoLEngine::setItemPosition(Item item, uint16 x, uint16 y, int flyingHeight, int b) {
+void LoLEngine::setItemPosition(Item item, uint16 x, uint16 y, int flyingHeight, int moveable) {
if (!flyingHeight) {
x = (x & 0xffc0) | 0x40;
y = (y & 0xffc0) | 0x40;
@@ -316,7 +306,7 @@ void LoLEngine::setItemPosition(Item item, uint16 x, uint16 y, int flyingHeight,
_itemsInPlay[item].block = block;
_itemsInPlay[item].flyingHeight = flyingHeight;
- if (b)
+ if (moveable)
_itemsInPlay[item].shpCurFrame_flg |= 0x4000;
else
_itemsInPlay[item].shpCurFrame_flg &= 0xbfff;
@@ -325,7 +315,7 @@ void LoLEngine::setItemPosition(Item item, uint16 x, uint16 y, int flyingHeight,
assignItemToBlock(&_levelBlockProperties[block].assignedObjects, item);
reassignDrawObjects(_currentDirection, item, &_levelBlockProperties[block], false);
- if (b)
+ if (moveable)
runLevelScriptCustom(block, 0x80, -1, item, 0, 0);
checkSceneUpdateNeed(block);
diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp
index 4497ab8019..34bde7fe5c 100644
--- a/engines/kyra/kyra_hof.cpp
+++ b/engines/kyra/kyra_hof.cpp
@@ -223,11 +223,12 @@ Common::Error KyraEngine_HoF::init() {
assert(_screen);
_screen->setResolution();
+ _debugger = new Debugger_HoF(this);
+ assert(_debugger);
+
KyraEngine_v1::init();
initStaticResource();
- _debugger = new Debugger_HoF(this);
- assert(_debugger);
_text = new TextDisplayer_HoF(this, _screen);
assert(_text);
_gui = new GUI_HoF(this);
@@ -455,6 +456,9 @@ void KyraEngine_HoF::startup() {
}
void KyraEngine_HoF::runLoop() {
+ // Initialize debugger since how it should be fully usable
+ _debugger->initialize();
+
_screen->updateScreen();
_runFlag = true;
@@ -1083,7 +1087,7 @@ void KyraEngine_HoF::loadNPCScript() {
#pragma mark -
void KyraEngine_HoF::resetScaleTable() {
- Common::set_to(_scaleTable, ARRAYEND(_scaleTable), 0x100);
+ Common::fill(_scaleTable, ARRAYEND(_scaleTable), 0x100);
}
void KyraEngine_HoF::setScaleTableItem(int item, int data) {
@@ -1473,7 +1477,7 @@ void KyraEngine_HoF::snd_playVoiceFile(int id) {
char vocFile[9];
assert(id >= 0 && id <= 9999999);
sprintf(vocFile, "%07d", id);
- if (_sound->voiceFileIsPresent(vocFile)) {
+ if (_sound->isVoicePresent(vocFile)) {
snd_stopVoice();
while (!_sound->voicePlay(vocFile, &_speechHandle)) {
@@ -1673,7 +1677,7 @@ void KyraEngine_HoF::setCauldronState(uint8 state, bool paletteFade) {
}
void KyraEngine_HoF::clearCauldronTable() {
- Common::set_to(_cauldronTable, ARRAYEND(_cauldronTable), -1);
+ Common::fill(_cauldronTable, ARRAYEND(_cauldronTable), -1);
}
void KyraEngine_HoF::addFrontCauldronTable(int item) {
diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp
index 27d0849e5f..84990bcfb8 100644
--- a/engines/kyra/kyra_lok.cpp
+++ b/engines/kyra/kyra_lok.cpp
@@ -174,6 +174,9 @@ Common::Error KyraEngine_LoK::init() {
assert(_screen);
_screen->setResolution();
+ _debugger = new Debugger_LoK(this);
+ assert(_debugger);
+
KyraEngine_v1::init();
_sprites = new Sprites(this, _system);
@@ -229,8 +232,6 @@ Common::Error KyraEngine_LoK::init() {
memset(&_scriptMain, 0, sizeof(EMCState));
memset(&_scriptClick, 0, sizeof(EMCState));
- _debugger = new Debugger_LoK(this);
- assert(_debugger);
memset(_shapes, 0, sizeof(_shapes));
for (int i = 0; i < ARRAYSIZE(_movieObjects); ++i)
@@ -254,7 +255,7 @@ Common::Error KyraEngine_LoK::init() {
_poisonDeathCounter = 0;
memset(_itemHtDat, 0, sizeof(_itemHtDat));
- memset(_exitList, 0xFFFF, sizeof(_exitList));
+ memset(_exitList, 0xFF, sizeof(_exitList));
_exitListPtr = 0;
_pathfinderFlag = _pathfinderFlag2 = 0;
_lastFindWayRet = 0;
@@ -436,6 +437,9 @@ void KyraEngine_LoK::startup() {
}
void KyraEngine_LoK::mainLoop() {
+ // Initialize debugger since how it should be fully usable
+ _debugger->initialize();
+
_eventList.clear();
while (!shouldQuit()) {
diff --git a/engines/kyra/kyra_lok.h b/engines/kyra/kyra_lok.h
index 57e6bd39ab..e5fb3cddca 100644
--- a/engines/kyra/kyra_lok.h
+++ b/engines/kyra/kyra_lok.h
@@ -29,10 +29,6 @@
#include "kyra/gui_lok.h"
#include "kyra/item.h"
-namespace Graphics {
-struct Surface;
-}
-
namespace Kyra {
class Movie;
@@ -416,7 +412,7 @@ protected:
Movie *_movieObjects[10];
- uint16 _entranceMouseCursorTracks[8];
+ uint16 _entranceMouseCursorTracks[5];
uint16 _walkBlockNorth;
uint16 _walkBlockEast;
uint16 _walkBlockSouth;
diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp
index 5798e99a1f..39ed0d038a 100644
--- a/engines/kyra/kyra_mr.cpp
+++ b/engines/kyra/kyra_mr.cpp
@@ -205,12 +205,12 @@ Common::Error KyraEngine_MR::init() {
assert(_screen);
_screen->setResolution();
- KyraEngine_v1::init();
- initStaticResource();
-
_debugger = new Debugger_v2(this);
assert(_debugger);
+ KyraEngine_v1::init();
+ initStaticResource();
+
_soundDigital = new SoundDigital(this, _mixer);
assert(_soundDigital);
if (!_soundDigital->init())
@@ -887,6 +887,9 @@ bool KyraEngine_MR::checkCharCollision(int x, int y) {
#pragma mark -
void KyraEngine_MR::runLoop() {
+ // Initialize debugger since how it should be fully usable
+ _debugger->initialize();
+
_eventList.clear();
_runFlag = true;
diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp
index c950612a42..dbdcda22d5 100644
--- a/engines/kyra/kyra_v1.cpp
+++ b/engines/kyra/kyra_v1.cpp
@@ -85,8 +85,9 @@ KyraEngine_v1::KyraEngine_v1(OSystem *system, const GameFlags &flags)
void KyraEngine_v1::pauseEngineIntern(bool pause) {
Engine::pauseEngineIntern(pause);
if (_sound)
- _sound->pause(pause);
- _timer->pause(pause);
+ _sound->pause(pause);
+ if (_timer)
+ _timer->pause(pause);
}
Common::Error KyraEngine_v1::init() {
@@ -183,6 +184,7 @@ Common::Error KyraEngine_v1::init() {
assert(_staticres);
if (!_staticres->init())
error("_staticres->init() failed");
+ assert(screen());
if (!screen()->init())
error("screen()->init() failed");
_timer = new TimerManager(this, _system);
diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h
index 584176e08c..5a9feb0054 100644
--- a/engines/kyra/kyra_v1.h
+++ b/engines/kyra/kyra_v1.h
@@ -52,14 +52,16 @@ class KyraMetaEngine;
*
* Status of this engine:
*
- * The KYRA engine supports all three Kyrandia games by Westwood. It also supports Westwood's
- * Lands of Lore. There are various platform ports of the different games, almost all of them are
- * fully supported. Only the Macintosh port of Kyrandia 1 makes a difference here, which lacks
- * support for sound effects and music.
+ * The KYRA engine supports all three Kyrandia games by Westwood. It also
+ * supports Westwood's Lands of Lore. There are various platform ports of
+ * the different games, almost all of them are fully supported. Only the
+ * Macintosh port of Kyrandia 1 makes a difference here, which lacks support
+ * for sound effects and music.
*
- * The different translations of the games are mostly supported, since every translation
- * requires some work for kyra.dat for example, it is almost impossible to support translations,
- * without owning them. There a currently a few reported unsupported translations:
+ * The different translations of the games are mostly supported, since every
+ * translation requires some work for kyra.dat for example, it is almost
+ * impossible to support translations, without owning them. There a currently
+ * a few reported unsupported translations:
*
* - Official translations
* None known.
@@ -69,24 +71,30 @@ class KyraMetaEngine;
* Kyrandia 1 Korean (feature request #1758252 "KYRA1: Add support for Korean/DOS version")
* Kyrandia 2 Polish (feature request #2146192 "KYRA2: Add support for Polish floppy version")
* - Fan translations:
- * Kyrandia 1 Russian (no feature request)
- * Kyrandia 2 Russian (no feature request)
* Kyrandia 3 Russian (feature request #2812792 "Kyrandia3 Russian")
*
- * The engine is maintained by _athrxx.
+ * The primary maintainer for the engine is LordHoto, although some parts are
+ * maintained by _athrxx. If you have questions about parts of the code, the
+ * following rough description might help in determining who you should ask:
+ * _athrxx is the maintainer for the Lands of Lore subengine, he also
+ * maintains most of the FM-TOWNS and PC98 specific code (especially the sound
+ * code, also some ingame code) and the Kyrandia 2 sequence player code.
+ * LordHoto is responsible for the rest of the codebase, he also worked on the
+ * graphics output for 16 color PC98 games.
*
- * Other people who worked on this engine include cyx, who initially started to work on Kyrandia 1
- * support, vinterstum, who did various things for Kyrandia 1 and started to work on the Kyrandia 2
- * sequence player code and also on the TIM script code, and eriktorbjorn, who helped out naming
- * our AdLib player code and also contributed a work around for a music bug in the "Pool of Sorrow"
- * scene of Kyrandia 1, which is also present in the original. LordHoto worked on Kyrandia 1 to 3
- * support and graphics output for 16 color PC98 games and was a maintainer of the Kyrandia part.
- * All mentioned developers are not actively working on KYRA anymore.
+ * Other people who worked on this engine include cyx, who initially started
+ * to work on Kyrandia 1 support. Vinterstum, who did various things for
+ * Kyrandia 1 and started to work on the Kyrandia 2 sequence player code and
+ * also on the TIM script code. Eriktorbjorn, who helped out naming our AdLib
+ * player code and also contributed a work around for a music bug in the
+ * "Pool of Sorrow" scene of Kyrandia 1, which is also present in the original.
+ * He also contributed the VQA player for Kyrandia 3.
*
- * The engine is mostly finished code wise. A possible remaining task is proper refactoring,
- * which might help in reducing binary size and along with it runtime memory use, but of course
- * might lead to regressions (since the current code makes no problems on our low end ports, it
- * is pretty minor priority though, since the benefit would be mostly nicer code). The biggest
+ * The engine is mostly finished code wise. A possible remaining task is
+ * proper refactoring, which might help in reducing binary size and along with
+ * it runtime memory use, but of course might lead to regressions (since the
+ * current code makes no problems on our low end ports, it is pretty minor
+ * priority though, since the benefit would be mostly nicer code). The biggest
* task left is the kyra.dat handling.
*
* Games using this engine:
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 5aba264ceb..538e88aa90 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -34,9 +34,14 @@
#include "common/config-manager.h"
#include "common/system.h"
+#include "common/translation.h"
+
+#include "backends/keymapper/keymapper.h"
namespace Kyra {
+const char *const LoLEngine::kKeymapName = "lol";
+
LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(system, flags) {
_screen = 0;
_gui = 0;
@@ -246,6 +251,10 @@ LoLEngine::LoLEngine(OSystem *system, const GameFlags &flags) : KyraEngine_v1(sy
LoLEngine::~LoLEngine() {
setupPrologueData(false);
+#ifdef ENABLE_KEYMAPPER
+ _eventMan->getKeymapper()->cleanupGameKeymaps();
+#endif
+
delete[] _landsFile;
delete[] _levelLangFile;
@@ -425,6 +434,9 @@ Common::Error LoLEngine::init() {
assert(_screen);
_screen->setResolution();
+ _debugger = new Debugger_LoL(this);
+ assert(_debugger);
+
KyraEngine_v1::init();
initStaticResource();
@@ -538,12 +550,67 @@ Common::Error LoLEngine::init() {
_spellProcs.push_back(new SpellProc(this, 0));
_spellProcs.push_back(new SpellProc(this, &LoLEngine::castGuardian));
- _debugger = new Debugger_LoL(this);
- assert(_debugger);
+ initKeymap();
return Common::kNoError;
}
+void LoLEngine::initKeymap() {
+#ifdef ENABLE_KEYMAPPER
+
+ bool tmp;
+ Common::Keymapper *mapper = _eventMan->getKeymapper();
+
+ // Do not try to recreate same keymap over again
+ if (mapper->getKeymap(kKeymapName, tmp) != 0)
+ return;
+
+ Common::Action *act;
+ Common::Keymap *engineKeyMap = new Common::Keymap(kKeymapName);
+
+ act = new Common::Action(engineKeyMap, "AT1", _("Attack 1"), Common::kGenericActionType, Common::kActionKeyType);
+ act->addKeyEvent(Common::KeyState(Common::KEYCODE_F1, Common::ASCII_F1 , 0));
+
+ act = new Common::Action(engineKeyMap, "AT2", _("Attack 2"), Common::kGenericActionType, Common::kActionKeyType);
+ act->addKeyEvent(Common::KeyState(Common::KEYCODE_F2, Common::ASCII_F2 , 0));
+
+ act = new Common::Action(engineKeyMap, "AT3", _("Attack 3"), Common::kGenericActionType, Common::kActionKeyType);
+ act->addKeyEvent(Common::KeyState(Common::KEYCODE_F3, Common::ASCII_F3 , 0));
+
+ act = new Common::Action(engineKeyMap, "MVF", _("Move Forward"), Common::kGenericActionType, Common::kActionKeyType);
+ act->addKeyEvent(Common::KeyState(Common::KEYCODE_UP));
+
+ act = new Common::Action(engineKeyMap, "MVB", _("Move Back"), Common::kGenericActionType, Common::kActionKeyType);
+ act->addKeyEvent(Common::KeyState(Common::KEYCODE_DOWN));
+
+ act = new Common::Action(engineKeyMap, "SLL", _("Slide Left"), Common::kGenericActionType, Common::kActionKeyType);
+ act->addKeyEvent(Common::KeyState(Common::KEYCODE_LEFT));
+
+ act = new Common::Action(engineKeyMap, "SLR", _("Slide Right"), Common::kGenericActionType, Common::kActionKeyType);
+ act->addKeyEvent(Common::KeyState(Common::KEYCODE_RIGHT));
+
+ act = new Common::Action(engineKeyMap, "TL", _("Turn Left"), Common::kGenericActionType, Common::kActionKeyType);
+ act->addKeyEvent(Common::KeyState(Common::KEYCODE_HOME));
+
+ act = new Common::Action(engineKeyMap, "TR", _("Turn Right"), Common::kGenericActionType, Common::kActionKeyType);
+ act->addKeyEvent(Common::KeyState(Common::KEYCODE_PAGEUP));
+
+ act = new Common::Action(engineKeyMap, "RST", _("Rest"), Common::kGenericActionType, Common::kActionKeyType);
+ act->addKeyEvent(Common::KeyState(Common::KEYCODE_r));
+
+ act = new Common::Action(engineKeyMap, "OPT", _("Options"), Common::kGenericActionType, Common::kActionKeyType);
+ act->addKeyEvent(Common::KeyState(Common::KEYCODE_o));
+
+ act = new Common::Action(engineKeyMap, "SPL", _("Choose Spell"), Common::kGenericActionType, Common::kActionKeyType);
+ act->addKeyEvent(Common::KeyState(Common::KEYCODE_SLASH));
+
+ mapper->addGameKeymap(engineKeyMap);
+
+ mapper->pushKeymap(kKeymapName, true);
+
+#endif
+}
+
Common::Error LoLEngine::go() {
int action = -1;
@@ -896,7 +963,7 @@ void LoLEngine::startupNew() {
_availableSpells[0] = 0;
setupScreenDims();
- memset(_globalScriptVars2, 0x100, 8);
+ Common::fill(_globalScriptVars2, ARRAYEND(_globalScriptVars2), 0x100);
static const int selectIds[] = { -9, -1, -8, -5 };
assert(_charSelection >= 0);
@@ -911,6 +978,9 @@ void LoLEngine::startupNew() {
}
void LoLEngine::runLoop() {
+ // Initialize debugger since how it should be fully usable
+ _debugger->initialize();
+
enableSysTimer(2);
bool _runFlag = true;
@@ -993,6 +1063,10 @@ void LoLEngine::writeSettings() {
void LoLEngine::readSettings() {
_monsterDifficulty = ConfMan.getInt("monster_difficulty");
+ if (_monsterDifficulty < 0 || _monsterDifficulty > 2) {
+ _monsterDifficulty = CLIP(_monsterDifficulty, 0, 2);
+ warning("LoLEngine: Config file contains invalid difficulty setting.");
+ }
_smoothScrollingEnabled = ConfMan.getBool("smooth_scrolling");
_floatingCursorsEnabled = ConfMan.getBool("floating_cursors");
@@ -1922,8 +1996,7 @@ int LoLEngine::playCharacterScriptChat(int charId, int mode, int restorePortrait
stopPortraitSpeechAnim();
if (charId < 0) {
- charId = ch = (_rnd.getRandomNumber(0x7fff) * countActiveCharacters()) / 0x8000;
- ch = _rnd.getRandomNumber(countActiveCharacters() - 1);
+ charId = ch = _rnd.getRandomNumber(countActiveCharacters() - 1);
} else if (charId > 0) {
int i = 0;
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index 164f030a1d..eb2f6cf2d7 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -307,6 +307,8 @@ public:
LoLEngine(OSystem *system, const GameFlags &flags);
~LoLEngine();
+ virtual void initKeymap();
+
Screen *screen();
GUI *gui() const;
@@ -333,6 +335,8 @@ private:
void writeSettings();
void readSettings();
+ static const char *const kKeymapName;
+
const char *const *_pakFileList;
int _pakFileListSize;
@@ -759,7 +763,7 @@ private:
int olol_distanceAttack(EMCState *script);
int olol_removeCharacterEffects(EMCState *script);
int olol_checkInventoryFull(EMCState *script);
- int olol_objectLeavesLevel(EMCState *script);
+ int olol_moveBlockObjects(EMCState *script);
int olol_addSpellToScroll(EMCState *script);
int olol_playDialogueText(EMCState *script);
int olol_playDialogueTalkText(EMCState *script);
@@ -1206,14 +1210,14 @@ private:
Item makeItem(int itemType, int curFrame, int flags);
void placeMoveLevelItem(Item itemIndex, int level, int block, int xOffs, int yOffs, int flyingHeight);
bool addItemToInventory(Item itemIndex);
- bool testUnkItemFlags(Item itemIndex);
+ bool isItemMoveable(Item itemIndex);
void deleteItem(Item itemIndex);
ItemInPlay *findObject(uint16 index);
void runItemScript(int charNum, Item item, int flags, int next, int reg4);
void setHandItem(Item itemIndex);
bool itemEquipped(int charNum, uint16 itemType);
- void setItemPosition(Item item, uint16 x, uint16 y, int flyingHeight, int b);
+ void setItemPosition(Item item, uint16 x, uint16 y, int flyingHeight, int moveable);
void removeLevelItem(Item item, int block);
bool launchObject(int objectType, Item item, int startX, int startY, int flyingHeight, int direction, int, int attackerId, int c);
void endObjectFlight(FlyingObject *t, int x, int y, int collisionObject);
diff --git a/engines/kyra/scene_lok.cpp b/engines/kyra/scene_lok.cpp
index a926f8493f..ab1670ea6e 100644
--- a/engines/kyra/scene_lok.cpp
+++ b/engines/kyra/scene_lok.cpp
@@ -131,7 +131,7 @@ void KyraEngine_LoK::enterNewScene(int sceneId, int facing, int unk1, int unk2,
_emc->run(&_scriptClick);
}
- memset(_entranceMouseCursorTracks, 0xFFFF, sizeof(uint16)*4);
+ memset(_entranceMouseCursorTracks, 0xFF, sizeof(_entranceMouseCursorTracks));
_currentCharacter->sceneId = sceneId;
assert(sceneId < _roomTableSize);
diff --git a/engines/kyra/scene_mr.cpp b/engines/kyra/scene_mr.cpp
index 74d2e89e6e..d6df523f82 100644
--- a/engines/kyra/scene_mr.cpp
+++ b/engines/kyra/scene_mr.cpp
@@ -83,7 +83,7 @@ void KyraEngine_MR::enterNewScene(uint16 sceneId, int facing, int unk1, int unk2
}
_specialExitCount = 0;
- Common::set_to(_specialExitTable, ARRAYEND(_specialExitTable), 0xFFFF);
+ Common::fill(_specialExitTable, ARRAYEND(_specialExitTable), 0xFFFF);
_mainCharacter.sceneId = sceneId;
_sceneList[sceneId].flags &= ~1;
@@ -388,7 +388,7 @@ void KyraEngine_MR::initSceneScript(int unk1) {
strcat(filename, ".CPS");
_screen->loadBitmap(filename, 3, 3, 0);
- Common::set_to(_specialSceneScriptState, ARRAYEND(_specialSceneScriptState), false);
+ Common::fill(_specialSceneScriptState, ARRAYEND(_specialSceneScriptState), false);
_sceneEnterX1 = 160;
_sceneEnterY1 = 0;
_sceneEnterX2 = 296;
diff --git a/engines/kyra/scene_v1.cpp b/engines/kyra/scene_v1.cpp
index 5319d4e657..bc90f49002 100644
--- a/engines/kyra/scene_v1.cpp
+++ b/engines/kyra/scene_v1.cpp
@@ -277,7 +277,7 @@ void KyraEngine_v1::changePosTowardsFacing(int &x, int &y, int facing) {
}
int KyraEngine_v1::getMoveTableSize(int *moveTable) {
- int retValue = 0;
+ int tableSize = 0;
if (moveTable[0] == 8)
return 0;
@@ -298,11 +298,11 @@ int KyraEngine_v1::getMoveTableSize(int *moveTable) {
int *oldPosition = moveTable;
int *tempPosition = moveTable;
int *curPosition = moveTable + 1;
- retValue = 1;
+ tableSize = 1;
while (*curPosition != 8) {
if (*oldPosition == facingTable[*curPosition]) {
- retValue -= 2;
+ tableSize -= 2;
*oldPosition = 9;
*curPosition = 9;
@@ -313,7 +313,7 @@ int KyraEngine_v1::getMoveTableSize(int *moveTable) {
}
if (tempPosition == moveTable && *tempPosition == 9) {
- while (*tempPosition != 8 && *tempPosition == 9)
+ while (*tempPosition == 9)
++tempPosition;
if (*tempPosition == 8)
@@ -321,53 +321,40 @@ int KyraEngine_v1::getMoveTableSize(int *moveTable) {
}
oldPosition = tempPosition;
- curPosition = oldPosition+1;
+ curPosition = oldPosition + 1;
- while (*curPosition != 8 && *curPosition == 9)
+ while (*curPosition == 9)
++curPosition;
-
- continue;
- }
-
- if (unkTable[*curPosition+((*oldPosition)*8)] != -1) {
- --retValue;
- *oldPosition = unkTable[*curPosition+((*oldPosition)*8)];
+ } else if (unkTable[*curPosition + *oldPosition * 8] != -1) {
+ --tableSize;
+ *oldPosition = unkTable[*curPosition + *oldPosition * 8];
*curPosition = 9;
if (tempPosition != oldPosition) {
curPosition = oldPosition;
oldPosition = tempPosition;
- while (true) {
- if (tempPosition == moveTable)
- break;
-
+ while (tempPosition != moveTable) {
--tempPosition;
if (*tempPosition != 9)
break;
-
}
} else {
- while (true) {
+ do {
++curPosition;
- if (*curPosition != 9)
- break;
- }
+ } while (*curPosition == 9);
}
- continue;
- }
-
- tempPosition = oldPosition;
- oldPosition = curPosition;
- ++retValue;
+ } else {
+ tempPosition = oldPosition;
+ oldPosition = curPosition;
+ ++tableSize;
- while (true) {
- ++curPosition;
- if (*curPosition != 9)
- break;
+ do {
+ ++curPosition;
+ } while (*curPosition == 9);
}
}
- return retValue;
+ return tableSize;
}
} // End of namespace Kyra
diff --git a/engines/kyra/script_hof.cpp b/engines/kyra/script_hof.cpp
index 296cd4002b..b80b8105a1 100644
--- a/engines/kyra/script_hof.cpp
+++ b/engines/kyra/script_hof.cpp
@@ -1397,7 +1397,6 @@ int KyraEngine_HoF::o2_demoFinale(EMCState *script) {
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0);
_screen->_curPage = 0;
- _screen->setFont(Screen::FID_6_FNT);
int y = _lang == 1 ? 70 : 65;
for (int i = 0; i < 6; i++)
_text->printText(strings[i], _text->getCenterStringX(strings[i], 1, 319), y + i * 10, 255, 207, 0);
@@ -1406,7 +1405,7 @@ int KyraEngine_HoF::o2_demoFinale(EMCState *script) {
_screen->updateScreen();
_eventList.clear();
- while (!skipFlag())
+ while (!skipFlag() && !shouldQuit())
delay(10);
_sound->beginFadeOut();
diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp
index b4b8f00022..d8ba32ce09 100644
--- a/engines/kyra/script_lol.cpp
+++ b/engines/kyra/script_lol.cpp
@@ -124,7 +124,7 @@ int LoLEngine::olol_setWallType(EMCState *script) {
int LoLEngine::olol_getWallType(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_getWallType(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
- return _levelBlockProperties[stackPos(0)].walls[stackPos(1) & 3];
+ return (int8)_levelBlockProperties[stackPos(0)].walls[stackPos(1) & 3];
}
int LoLEngine::olol_drawScene(EMCState *script) {
@@ -286,13 +286,13 @@ int LoLEngine::olol_makeItem(EMCState *script) {
}
int LoLEngine::olol_placeMoveLevelItem(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_setItemProperty(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5));
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_placeMoveLevelItem(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5));
placeMoveLevelItem(stackPos(0), stackPos(1), stackPos(2), stackPos(3) & 0xff, stackPos(4) & 0xff, stackPos(5));
return 1;
}
int LoLEngine::olol_createLevelItem(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_setItemProperty(%p) (%d, %d, %d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7));
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_createLevelItem(%p) (%d, %d, %d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7));
int item = makeItem(stackPos(0), stackPos(1), stackPos(2));
if (item == -1)
return item;
@@ -676,6 +676,8 @@ int LoLEngine::olol_getGlobalVar(EMCState *script) {
return _drainMagic;
case 13:
return getVolume(kVolumeSpeech) - 2;
+ case 14:
+ return _tim->_abortFlag;
default:
break;
}
@@ -842,7 +844,7 @@ int LoLEngine::olol_initMonster(EMCState *script) {
l->direction = l->facing << 1;
l->hitPoints = (l->properties->hitPoints * _monsterModifiers[_monsterDifficulty]) >> 8;
- if (_currentLevel == 12 && l->type == 2)
+ if (_currentLevel != 12 || l->type != 2)
l->hitPoints = (l->hitPoints * (rollDice(1, 128) + 192)) >> 8;
l->numDistAttacks = l->properties->numDistAttacks;
@@ -859,7 +861,7 @@ int LoLEngine::olol_initMonster(EMCState *script) {
l->destDirection = l->direction;
for (int ii = 0; ii < 4; ii++)
- l->equipmentShapes[ii] = stackPos(7 + ii);
+ l->equipmentShapes[ii] = stackPos(7 + ii) & 0xff;
checkSceneUpdateNeed(l->block);
return i;
@@ -1538,12 +1540,12 @@ int LoLEngine::olol_checkInventoryFull(EMCState *script) {
return 1;
}
-int LoLEngine::olol_objectLeavesLevel(EMCState *script) {
- debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_objectLeavesLevel(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5));
+int LoLEngine::olol_moveBlockObjects(EMCState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_moveBlockObjects(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5));
int o = _levelBlockProperties[stackPos(0)].assignedObjects;
int res = 0;
int level = stackPos(2);
- int block = stackPos(1);
+ int destBlock = stackPos(1);
int runScript = stackPos(4);
int includeMonsters = stackPos(3);
int includeItems = stackPos(5);
@@ -1551,9 +1553,9 @@ int LoLEngine::olol_objectLeavesLevel(EMCState *script) {
// WORKAROUND for script bug
// Items would vanish when thrown towards the stairs
// in white tower level 3.
- if (_currentLevel == 21 && level == 21 && block == 0x3e0) {
+ if (_currentLevel == 21 && level == 21 && destBlock == 0x3e0) {
level = 20;
- block = 0x0247;
+ destBlock = 0x0247;
}
while (o) {
@@ -1577,15 +1579,13 @@ int LoLEngine::olol_objectLeavesLevel(EMCState *script) {
if (!(_itemsInPlay[l].shpCurFrame_flg & 0x4000) || !includeItems)
continue;
- placeMoveLevelItem(l, level, block, _itemsInPlay[l].x & 0xff, _itemsInPlay[l].y & 0xff, _itemsInPlay[l].flyingHeight);
+ placeMoveLevelItem(l, level, destBlock, _itemsInPlay[l].x & 0xff, _itemsInPlay[l].y & 0xff, _itemsInPlay[l].flyingHeight);
+ res = 1;
- if (!runScript || level != _currentLevel) {
- res = 1;
- continue;
- }
+ if (!runScript || level != _currentLevel)
+ continue;
- runLevelScriptCustom(block, 0x80, -1, l, 0, 0);
- res = 1;
+ runLevelScriptCustom(destBlock, 0x80, -1, l, 0, 0);
}
}
@@ -2056,17 +2056,16 @@ int LoLEngine::olol_changeItemTypeOrFlag(EMCState *script) {
return 0;
ItemInPlay *i = &_itemsInPlay[stackPos(0)];
- int r = stackPos(2) & 0x1fff;
+ int16 val = stackPos(2);
- if (stackPos(1) == 4) {
- i->itemPropertyIndex = r;
- return r;
- } else if (stackPos(1) == 15) {
- i->shpCurFrame_flg = (i->shpCurFrame_flg & 0xe000) | r;
- return r;
- }
+ if (stackPos(1) == 4)
+ i->itemPropertyIndex = val;
+ else if (stackPos(1) == 15)
+ i->shpCurFrame_flg = (i->shpCurFrame_flg & 0xe000) | (val & 0x1fff);
+ else
+ val = -1;
- return -1;
+ return val;
}
int LoLEngine::olol_placeInventoryItemInHand(EMCState *script) {
@@ -2881,7 +2880,7 @@ void LoLEngine::setupOpcodeTable() {
// 0x74
Opcode(olol_checkInventoryFull);
- Opcode(olol_objectLeavesLevel);
+ Opcode(olol_moveBlockObjects);
OpcodeUnImpl();
OpcodeUnImpl();
diff --git a/engines/kyra/script_mr.cpp b/engines/kyra/script_mr.cpp
index 8ab094ac0c..afe11aba02 100644
--- a/engines/kyra/script_mr.cpp
+++ b/engines/kyra/script_mr.cpp
@@ -405,7 +405,7 @@ int KyraEngine_MR::o3_updateConversations(EMCState *script) {
}
int convs[4];
- Common::set_to(convs, convs+4, -1);
+ Common::fill(convs, convs+4, -1);
if (_currentChapter == 1) {
switch (_mainCharacter.dlgIndex) {
diff --git a/engines/kyra/sequences_lok.cpp b/engines/kyra/sequences_lok.cpp
index 2de0565a74..99ae2ad7b3 100644
--- a/engines/kyra/sequences_lok.cpp
+++ b/engines/kyra/sequences_lok.cpp
@@ -1322,7 +1322,7 @@ void KyraEngine_LoK::seq_playCredits() {
_screen->copyRegion(0, 32, 0, 32, 320, 128, 4, 2, Screen::CR_NO_P_CHECK);
bottom = 0;
- for (CreditsLineList::iterator it = lines.begin(); it != lines.end(); ++it) {
+ for (CreditsLineList::iterator it = lines.begin(); it != lines.end();) {
if (it->y < 0) {
it = lines.erase(it);
continue;
@@ -1338,6 +1338,8 @@ void KyraEngine_LoK::seq_playCredits() {
it->y--;
if (it->y > bottom)
bottom = it->y;
+
+ ++it;
}
_screen->copyRegion(0, 32, 0, 32, 320, 128, 2, 0, Screen::CR_NO_P_CHECK);
diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp
index 83d525d400..01db92c225 100644
--- a/engines/kyra/sequences_lol.cpp
+++ b/engines/kyra/sequences_lol.cpp
@@ -788,7 +788,7 @@ void HistoryPlayer::play() {
for (; voiceFilename[3] <= '9' && !_vm->shouldQuit() && !_vm->skipFlag(); ++voiceFilename[3], voiceFilename[4] = 'a') {
while (!_vm->shouldQuit() && !_vm->skipFlag()) {
- if (!sound->voiceFileIsPresent(voiceFilename))
+ if (!sound->isVoicePresent(voiceFilename))
break;
if (data[part * 15] == voiceFilename[3] && data[part * 15 + 1] == voiceFilename[4]) {
diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp
index b4fcea784e..a1af1ad6f8 100644
--- a/engines/kyra/sound.cpp
+++ b/engines/kyra/sound.cpp
@@ -43,25 +43,30 @@ Sound::Sound(KyraEngine_v1 *vm, Audio::Mixer *mixer)
Sound::~Sound() {
}
-bool Sound::voiceFileIsPresent(const char *file) {
- for (int i = 0; _supportedCodecs[i].fileext; ++i) {
- Common::String f = file;
- f += _supportedCodecs[i].fileext;
- if (_vm->resource()->getFileSize(f.c_str()) > 0)
- return true;
- }
+Sound::kType Sound::getSfxType() const {
+ return getMusicType();
+}
+
+void Sound::setSoundList(const AudioDataStruct *list) {
+ _soundDataList = list;
+}
+
+bool Sound::hasSoundFile(uint file) const {
+ return (fileListEntry(file) != 0);
+}
+bool Sound::isPlaying() const {
return false;
}
-bool Sound::isVoicePresent(const char *file) {
- char filenamebuffer[25];
+bool Sound::isVoicePresent(const char *file) const {
+ Common::String filename;
for (int i = 0; _supportedCodecs[i].fileext; ++i) {
- strcpy(filenamebuffer, file);
- strcat(filenamebuffer, _supportedCodecs[i].fileext);
+ filename = file;
+ filename += _supportedCodecs[i].fileext;
- if (_vm->resource()->exists(filenamebuffer))
+ if (_vm->resource()->exists(filename.c_str()))
return true;
}
@@ -80,15 +85,15 @@ int32 Sound::voicePlay(const char *file, Audio::SoundHandle *handle, uint8 volum
return playTime;
}
-Audio::SeekableAudioStream *Sound::getVoiceStream(const char *file) {
- char filenamebuffer[25];
+Audio::SeekableAudioStream *Sound::getVoiceStream(const char *file) const {
+ Common::String filename;
Audio::SeekableAudioStream *audioStream = 0;
for (int i = 0; _supportedCodecs[i].fileext; ++i) {
- strcpy(filenamebuffer, file);
- strcat(filenamebuffer, _supportedCodecs[i].fileext);
+ filename = file;
+ filename += _supportedCodecs[i].fileext;
- Common::SeekableReadStream *stream = _vm->resource()->createReadStream(filenamebuffer);
+ Common::SeekableReadStream *stream = _vm->resource()->createReadStream(filename);
if (!stream)
continue;
@@ -109,8 +114,14 @@ bool Sound::playVoiceStream(Audio::AudioStream *stream, Audio::SoundHandle *hand
while (h < kNumChannelHandles && _mixer->isSoundHandleActive(_soundChannels[h]))
++h;
- if (h >= kNumChannelHandles)
+ if (h >= kNumChannelHandles) {
+ // When we run out of handles we need to destroy the stream object,
+ // this is to avoid memory leaks in some scenes where too many sfx
+ // are started.
+ // See bug #3427240 "LOL-CD: Memory leak in caves level 3".
+ delete stream;
return false;
+ }
_mixer->playStream(isSfx ? Audio::Mixer::kSFXSoundType : Audio::Mixer::kSpeechSoundType, &_soundChannels[h], stream, -1, volume);
if (handle)
@@ -130,7 +141,7 @@ void Sound::voiceStop(const Audio::SoundHandle *handle) {
}
}
-bool Sound::voiceIsPlaying(const Audio::SoundHandle *handle) {
+bool Sound::voiceIsPlaying(const Audio::SoundHandle *handle) const {
if (!handle) {
for (int h = 0; h < kNumChannelHandles; ++h) {
if (_mixer->isSoundHandleActive(_soundChannels[h]))
@@ -143,7 +154,7 @@ bool Sound::voiceIsPlaying(const Audio::SoundHandle *handle) {
return false;
}
-bool Sound::allVoiceChannelsPlaying() {
+bool Sound::allVoiceChannelsPlaying() const {
for (int i = 0; i < kNumChannelHandles; ++i)
if (!_mixer->isSoundHandleActive(_soundChannels[i]))
return false;
@@ -152,6 +163,91 @@ bool Sound::allVoiceChannelsPlaying() {
#pragma mark -
+MixedSoundDriver::MixedSoundDriver(KyraEngine_v1 *vm, Audio::Mixer *mixer, Sound *music, Sound *sfx)
+ : Sound(vm, mixer), _music(music), _sfx(sfx) {
+}
+
+MixedSoundDriver::~MixedSoundDriver() {
+ delete _music;
+ delete _sfx;
+}
+
+Sound::kType MixedSoundDriver::getMusicType() const {
+ return _music->getMusicType();
+}
+
+Sound::kType MixedSoundDriver::getSfxType() const {
+ return _sfx->getSfxType();
+}
+
+bool MixedSoundDriver::init() {
+ return (_music->init() && _sfx->init());
+}
+
+void MixedSoundDriver::process() {
+ _music->process();
+ _sfx->process();
+}
+
+void MixedSoundDriver::updateVolumeSettings() {
+ _music->updateVolumeSettings();
+ _sfx->updateVolumeSettings();
+}
+
+void MixedSoundDriver::setSoundList(const AudioDataStruct *list) {
+ _music->setSoundList(list);
+ _sfx->setSoundList(list);
+}
+
+bool MixedSoundDriver::hasSoundFile(uint file) const {
+ return _music->hasSoundFile(file) && _sfx->hasSoundFile(file);
+}
+
+void MixedSoundDriver::loadSoundFile(uint file) {
+ _music->loadSoundFile(file);
+ _sfx->loadSoundFile(file);
+}
+
+void MixedSoundDriver::loadSoundFile(Common::String file) {
+ _music->loadSoundFile(file);
+ _sfx->loadSoundFile(file);
+}
+
+void MixedSoundDriver::loadSfxFile(Common::String file) {
+ _sfx->loadSoundFile(file);
+}
+
+void MixedSoundDriver::playTrack(uint8 track) {
+ _music->playTrack(track);
+}
+
+void MixedSoundDriver::haltTrack() {
+ _music->haltTrack();
+}
+
+bool MixedSoundDriver::isPlaying() const {
+ return _music->isPlaying() | _sfx->isPlaying();
+}
+
+void MixedSoundDriver::playSoundEffect(uint8 track) {
+ _sfx->playSoundEffect(track);
+}
+
+void MixedSoundDriver::stopAllSoundEffects() {
+ _sfx->stopAllSoundEffects();
+}
+
+void MixedSoundDriver::beginFadeOut() {
+ _music->beginFadeOut();
+}
+
+void MixedSoundDriver::pause(bool paused) {
+ _music->pause(paused);
+ _sfx->pause(paused);
+}
+
+#pragma mark -
+
void KyraEngine_v1::snd_playTheme(int file, int track) {
if (_curMusicTheme == file)
return;
@@ -238,16 +334,7 @@ namespace {
// A simple wrapper to create VOC streams the way like creating MP3, OGG/Vorbis and FLAC streams.
// Possible TODO: Think of making this complete and moving it to sound/voc.cpp ?
Audio::SeekableAudioStream *makeVOCStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) {
-
-#ifdef STREAM_AUDIO_FROM_DISK
Audio::SeekableAudioStream *as = Audio::makeVOCStream(stream, Audio::FLAG_UNSIGNED, disposeAfterUse);
-#else
- Audio::SeekableAudioStream *as = Audio::makeVOCStream(stream, Audio::FLAG_UNSIGNED, DisposeAfterUse::NO);
-
- if (disposeAfterUse)
- delete stream;
-#endif
-
return as;
}
diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h
index c3c32331be..f3de56520e 100644
--- a/engines/kyra/sound.h
+++ b/engines/kyra/sound.h
@@ -58,7 +58,7 @@ public:
};
virtual kType getMusicType() const = 0;
- virtual kType getSfxType() const { return getMusicType(); }
+ virtual kType getSfxType() const;
/**
* Initializes the output device.
@@ -83,7 +83,7 @@ public:
*
* @param list soundfile list
*/
- virtual void setSoundList(const AudioDataStruct *list) { _soundDataList = list; }
+ virtual void setSoundList(const AudioDataStruct *list);
/**
* Checks if a given sound file is present.
@@ -91,7 +91,7 @@ public:
* @param track track number
* @return true if available, false otherwise
*/
- virtual bool hasSoundFile(uint file) const { return (fileListEntry(file) != 0); }
+ virtual bool hasSoundFile(uint file) const;
/**
* Load a specifc sound file for use of
@@ -140,7 +140,7 @@ public:
*
* @return true if playing, false otherwise
*/
- virtual bool isPlaying() const { return false; }
+ virtual bool isPlaying() const;
/**
* Starts fading out the volume.
@@ -163,15 +163,13 @@ public:
void enableSFX(bool enable) { _sfxEnabled = enable; }
bool sfxEnabled() const { return _sfxEnabled; }
- virtual bool voiceFileIsPresent(const char *file);
-
/**
* Checks whether a voice file with the given name is present
*
* @param file file name
* @return true if available, false otherwise
*/
- bool isVoicePresent(const char *file);
+ bool isVoicePresent(const char *file) const;
/**
* Plays the specified voice file.
@@ -188,7 +186,7 @@ public:
*/
virtual int32 voicePlay(const char *file, Audio::SoundHandle *handle = 0, uint8 volume = 255, bool isSfx = false);
- Audio::SeekableAudioStream *getVoiceStream(const char *file);
+ Audio::SeekableAudioStream *getVoiceStream(const char *file) const;
bool playVoiceStream(Audio::AudioStream *stream, Audio::SoundHandle *handle = 0, uint8 volume = 255, bool isSfx = false);
@@ -197,21 +195,21 @@ public:
*
* @return true when playing, else false
*/
- bool voiceIsPlaying(const Audio::SoundHandle *handle = 0);
+ bool voiceIsPlaying(const Audio::SoundHandle *handle = 0) const;
/**
* Checks if all voice handles are used.
*
* @return false when a handle is free, else true
*/
- bool allVoiceChannelsPlaying();
+ bool allVoiceChannelsPlaying() const;
/**
* Checks how long a voice has been playing
*
* @return time in milliseconds
*/
- uint32 voicePlayedTime(const Audio::SoundHandle &handle) {
+ uint32 voicePlayedTime(const Audio::SoundHandle &handle) const {
return _mixer->getSoundElapsedTime(handle);
}
@@ -253,34 +251,34 @@ private:
class MixedSoundDriver : public Sound {
public:
- MixedSoundDriver(KyraEngine_v1 *vm, Audio::Mixer *mixer, Sound *music, Sound *sfx) : Sound(vm, mixer), _music(music), _sfx(sfx) {}
- ~MixedSoundDriver() { delete _music; delete _sfx; }
+ MixedSoundDriver(KyraEngine_v1 *vm, Audio::Mixer *mixer, Sound *music, Sound *sfx);
+ ~MixedSoundDriver();
- kType getMusicType() const { return _music->getMusicType(); }
- kType getSfxType() const { return _sfx->getSfxType(); }
+ virtual kType getMusicType() const;
+ virtual kType getSfxType() const;
- bool init() { return (_music->init() && _sfx->init()); }
- void process() { _music->process(); _sfx->process(); }
+ virtual bool init();
+ virtual void process();
- void updateVolumeSettings() { _music->updateVolumeSettings(); _sfx->updateVolumeSettings(); }
+ virtual void updateVolumeSettings();
- void setSoundList(const AudioDataStruct * list) { _music->setSoundList(list); _sfx->setSoundList(list); }
- bool hasSoundFile(uint file) const { return _music->hasSoundFile(file) && _sfx->hasSoundFile(file); }
- void loadSoundFile(uint file) { _music->loadSoundFile(file); _sfx->loadSoundFile(file); }
- void loadSoundFile(Common::String file) { _music->loadSoundFile(file); _sfx->loadSoundFile(file); }
+ virtual void setSoundList(const AudioDataStruct *list);
+ virtual bool hasSoundFile(uint file) const;
+ virtual void loadSoundFile(uint file);
+ virtual void loadSoundFile(Common::String file);
- void loadSfxFile(Common::String file) { _sfx->loadSoundFile(file); }
+ virtual void loadSfxFile(Common::String file);
- void playTrack(uint8 track) { _music->playTrack(track); }
- void haltTrack() { _music->haltTrack(); }
- bool isPlaying() const { return _music->isPlaying() | _sfx->isPlaying(); }
+ virtual void playTrack(uint8 track);
+ virtual void haltTrack();
+ virtual bool isPlaying() const;
- void playSoundEffect(uint8 track) { _sfx->playSoundEffect(track); }
+ virtual void playSoundEffect(uint8 track);
- void stopAllSoundEffects() { _sfx->stopAllSoundEffects(); }
+ virtual void stopAllSoundEffects();
- void beginFadeOut() { _music->beginFadeOut(); }
- void pause(bool paused) { _music->pause(paused); _sfx->pause(paused); }
+ virtual void beginFadeOut();
+ virtual void pause(bool paused);
private:
Sound *_music, *_sfx;
};
diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp
index 8976eba99c..b04abea080 100644
--- a/engines/kyra/sound_adlib.cpp
+++ b/engines/kyra/sound_adlib.cpp
@@ -42,6 +42,7 @@
#include "common/system.h"
#include "common/mutex.h"
+#include "common/config-manager.h"
#include "audio/mixer.h"
#include "audio/fmopl.h"
@@ -59,7 +60,13 @@ public:
AdLibDriver(Audio::Mixer *mixer, bool v2);
~AdLibDriver();
- int callback(int opcode, ...);
+ void initDriver();
+ void setSoundData(uint8 *data);
+ void queueTrack(int track);
+ bool isChannelPlaying(int channel) const;
+ void stopAllChannels();
+ int getSoundTrigger() const { return _soundTrigger; }
+
void callback();
// AudioStream API
@@ -92,36 +99,10 @@ public:
void setSyncJumpMask(uint16 mask) { _syncJumpMask = mask; }
-private:
- struct OpcodeEntry {
- typedef int (AdLibDriver::*DriverOpcode)(va_list &list);
- DriverOpcode function;
- const char *name;
- };
-
- void setupOpcodeList();
- const OpcodeEntry *_opcodeList;
- int _opcodesEntries;
-
- int snd_ret0x100(va_list &list);
- int snd_ret0x1983(va_list &list);
- int snd_initDriver(va_list &list);
- int snd_deinitDriver(va_list &list);
- int snd_setSoundData(va_list &list);
- int snd_unkOpcode1(va_list &list);
- int snd_startSong(va_list &list);
- int snd_isChannelPlaying(va_list &list);
- int snd_stopChannel(va_list &list);
- int snd_readByte(va_list &list);
- int snd_writeByte(va_list &list);
- int snd_getSoundTrigger(va_list &list);
- int snd_unkOpcode4(va_list &list);
- int snd_dummy(va_list &list);
- int snd_getNullvar4(va_list &list);
- int snd_setNullvar3(va_list &list);
- int snd_setFlag(va_list &list);
- int snd_clearFlag(va_list &list);
+ void setMusicVolume(uint8 volume);
+ void setSfxVolume(uint8 volume);
+private:
// These variables have not yet been named, but some of them are partly
// known nevertheless:
//
@@ -195,6 +176,7 @@ private:
uint8 tempoReset;
uint8 rawNote;
int8 unk16;
+ uint8 volumeModifier;
};
void primaryEffect1(Channel &channel);
@@ -346,11 +328,8 @@ private:
int32 _samplesTillCallback;
int32 _samplesTillCallbackRemainder;
- int _lastProcessed;
- int8 _flagTrigger;
int _curChannel;
uint8 _soundTrigger;
- int _soundsPlaying;
uint16 _rnd;
@@ -375,12 +354,19 @@ private:
uint8 _unkValue19;
uint8 _unkValue20;
- int _flags;
FM_OPL *_adlib;
uint8 *_soundData;
- uint8 _soundIdTable[0x10];
+ int _programStartTimeout;
+ uint8 *_programQueue[16];
+ int _programQueueStart, _programQueueEnd;
+
+ void adjustSfxData(uint8 *data);
+ uint8 *_sfxPointer;
+ int _sfxPriority;
+ int _sfxVelocity;
+
Channel _channels[10];
uint8 _vibratoAndAMDepthBits;
@@ -406,18 +392,18 @@ private:
Audio::Mixer *_mixer;
Audio::SoundHandle _soundHandle;
+ uint8 _musicVolume, _sfxVolume;
+
bool _v2;
};
AdLibDriver::AdLibDriver(Audio::Mixer *mixer, bool v2) {
- setupOpcodeList();
setupParserOpcodeTable();
_v2 = v2;
_mixer = mixer;
- _flags = 0;
_adlib = makeAdLibOPL(getRate());
assert(_adlib);
@@ -426,12 +412,12 @@ AdLibDriver::AdLibDriver(Audio::Mixer *mixer, bool v2) {
_vibratoAndAMDepthBits = _curRegOffset = 0;
- _lastProcessed = _flagTrigger = _curChannel = _rhythmSectionBits = 0;
- _soundsPlaying = 0;
+ _curChannel = _rhythmSectionBits = 0;
_rnd = 0x1234;
_tempo = 0;
_soundTrigger = 0;
+ _programStartTimeout = 0;
_callbackTimer = 0xFF;
_unkValue1 = _unkValue2 = _unkValue4 = _unkValue5 = 0;
@@ -441,14 +427,7 @@ AdLibDriver::AdLibDriver(Audio::Mixer *mixer, bool v2) {
_tablePtr1 = _tablePtr2 = 0;
- // HACK: We use MusicSoundType here for now so we can adjust the volume in the launcher dialog.
- // This affects SFX too, but if we want to support different volumes for SFX and music we would
- // have to change our player implementation, currently we setup the volume for an AdLib channel
- // in AdLibDriver::adjustVolume, so if that would be called, we would have to know if the channel
- // is used by SFX or music, and then adjust the volume accordingly. Since Kyrandia 2 supports
- // different volumes for SFX and music, looking at the disasm and checking how the original does it
- // would be a good idea.
- _mixer->playStream(Audio::Mixer::kMusicSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
+ _mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
_samplesPerCallback = getRate() / CALLBACKS_PER_SECOND;
_samplesPerCallbackRemainder = getRate() % CALLBACKS_PER_SECOND;
@@ -456,6 +435,13 @@ AdLibDriver::AdLibDriver(Audio::Mixer *mixer, bool v2) {
_samplesTillCallbackRemainder = 0;
_syncJumpMask = 0;
+
+ _musicVolume = 0;
+ _sfxVolume = 0;
+
+ _sfxPointer = 0;
+
+ _programQueueStart = _programQueueEnd = 0;
}
AdLibDriver::~AdLibDriver() {
@@ -464,100 +450,108 @@ AdLibDriver::~AdLibDriver() {
_adlib = 0;
}
-int AdLibDriver::callback(int opcode, ...) {
+void AdLibDriver::setMusicVolume(uint8 volume) {
Common::StackLock lock(_mutex);
- if (opcode >= _opcodesEntries || opcode < 0) {
- warning("AdLibDriver: calling unknown opcode '%d'", opcode);
- return 0;
+
+ _musicVolume = volume;
+
+ for (uint i = 0; i < 6; ++i) {
+ Channel &chan = _channels[i];
+ chan.volumeModifier = volume;
+
+ const uint8 regOffset = _regOffset[i];
+
+ // Level Key Scaling / Total Level
+ writeOPL(0x40 + regOffset, calculateOpLevel1(chan));
+ writeOPL(0x43 + regOffset, calculateOpLevel2(chan));
}
- debugC(9, kDebugLevelSound, "Calling opcode '%s' (%d)", _opcodeList[opcode].name, opcode);
+ // For now we use the music volume for both sfx and music in Kyra1.
+ if (!_v2) {
+ _sfxVolume = volume;
- va_list args;
- va_start(args, opcode);
- int returnValue = (this->*(_opcodeList[opcode].function))(args);
- va_end(args);
- return returnValue;
-}
+ for (uint i = 6; i < 9; ++i) {
+ Channel &chan = _channels[i];
+ chan.volumeModifier = volume;
-// Opcodes
+ const uint8 regOffset = _regOffset[i];
-int AdLibDriver::snd_ret0x100(va_list &list) {
- return 0x100;
+ // Level Key Scaling / Total Level
+ writeOPL(0x40 + regOffset, calculateOpLevel1(chan));
+ writeOPL(0x43 + regOffset, calculateOpLevel2(chan));
+ }
+ }
}
-int AdLibDriver::snd_ret0x1983(va_list &list) {
- return 0x1983;
-}
+void AdLibDriver::setSfxVolume(uint8 volume) {
+ // We only support sfx volume in v2 games.
+ if (!_v2)
+ return;
-int AdLibDriver::snd_initDriver(va_list &list) {
- _lastProcessed = _soundsPlaying = 0;
- resetAdLibState();
- return 0;
+ Common::StackLock lock(_mutex);
+
+ _sfxVolume = volume;
+
+ for (uint i = 6; i < 9; ++i) {
+ Channel &chan = _channels[i];
+ chan.volumeModifier = volume;
+
+ const uint8 regOffset = _regOffset[i];
+
+ // Level Key Scaling / Total Level
+ writeOPL(0x40 + regOffset, calculateOpLevel1(chan));
+ writeOPL(0x43 + regOffset, calculateOpLevel2(chan));
+ }
}
-int AdLibDriver::snd_deinitDriver(va_list &list) {
+void AdLibDriver::initDriver() {
+ Common::StackLock lock(_mutex);
resetAdLibState();
- return 0;
}
-int AdLibDriver::snd_setSoundData(va_list &list) {
+void AdLibDriver::setSoundData(uint8 *data) {
+ Common::StackLock lock(_mutex);
+
+ // Drop all tracks that are still queued. These would point to the old
+ // sound data.
+ _programQueueStart = _programQueueEnd = 0;
+ memset(_programQueue, 0, sizeof(_programQueue));
+
if (_soundData) {
delete[] _soundData;
_soundData = 0;
}
- _soundData = va_arg(list, uint8 *);
- return 0;
-}
-int AdLibDriver::snd_unkOpcode1(va_list &list) {
- warning("unimplemented snd_unkOpcode1");
- return 0;
+ _soundData = data;
}
-int AdLibDriver::snd_startSong(va_list &list) {
- int songId = va_arg(list, int);
- _flags |= 8;
- _flagTrigger = 1;
+void AdLibDriver::queueTrack(int track) {
+ Common::StackLock lock(_mutex);
- uint8 *ptr = getProgram(songId);
- assert(ptr);
- uint8 chan = *ptr;
+ uint8 *trackData = getProgram(track);
+ if (!trackData)
+ return;
- if ((songId << 1) != 0) {
- if (chan == 9) {
- if (_flags & 2)
- return 0;
- } else {
- if (_flags & 1)
- return 0;
- }
+ if (_programQueueEnd == _programQueueStart && _programQueue[_programQueueEnd] != 0) {
+ warning("AdLibDriver: Program queue full, dropping track %d", track);
+ return;
}
- _soundIdTable[_soundsPlaying++] = songId;
- _soundsPlaying &= 0x0F;
-
- return 0;
+ _programQueue[_programQueueEnd++] = trackData;
+ _programQueueEnd &= 15;
}
-int AdLibDriver::snd_isChannelPlaying(va_list &list) {
- int channel = va_arg(list, int);
+bool AdLibDriver::isChannelPlaying(int channel) const {
+ Common::StackLock lock(_mutex);
+
assert(channel >= 0 && channel <= 9);
- return (_channels[channel].dataptr != 0) ? 1 : 0;
+ return (_channels[channel].dataptr != 0);
}
-int AdLibDriver::snd_stopChannel(va_list &list) {
- int channel = va_arg(list, int);
-
- int maxChannel;
- if (channel < 0) {
- channel = 0;
- maxChannel = 9;
- } else {
- maxChannel = channel;
- }
+void AdLibDriver::stopAllChannels() {
+ Common::StackLock lock(_mutex);
- for (; channel <= maxChannel; ++channel) {
+ for (int channel = 0; channel <= 9; ++channel) {
_curChannel = channel;
Channel &chan = _channels[_curChannel];
@@ -567,71 +561,16 @@ int AdLibDriver::snd_stopChannel(va_list &list) {
if (channel != 9)
noteOff(chan);
}
-
- return 0;
-}
-
-int AdLibDriver::snd_readByte(va_list &list) {
- int a = va_arg(list, int);
- int b = va_arg(list, int);
- uint8 *ptr = getProgram(a) + b;
- assert(ptr);
- return *ptr;
-}
-
-int AdLibDriver::snd_writeByte(va_list &list) {
- int a = va_arg(list, int);
- int b = va_arg(list, int);
- uint8 value = va_arg(list, int);
- uint8 *ptr = getProgram(a) + b;
- assert(ptr);
- SWAP(*ptr, value);
- return value;
-}
-
-int AdLibDriver::snd_getSoundTrigger(va_list &list) {
- return _soundTrigger;
-}
-
-int AdLibDriver::snd_unkOpcode4(va_list &list) {
- warning("unimplemented snd_unkOpcode4");
- return 0;
-}
-
-int AdLibDriver::snd_dummy(va_list &list) {
- return 0;
-}
-
-int AdLibDriver::snd_getNullvar4(va_list &list) {
- warning("unimplemented snd_getNullvar4");
- return 0;
-}
-
-int AdLibDriver::snd_setNullvar3(va_list &list) {
- warning("unimplemented snd_setNullvar3");
- return 0;
-}
-
-int AdLibDriver::snd_setFlag(va_list &list) {
- int oldFlags = _flags;
- _flags |= va_arg(list, int);
- return oldFlags;
-}
-
-int AdLibDriver::snd_clearFlag(va_list &list) {
- int oldFlags = _flags;
- _flags &= ~(va_arg(list, int));
- return oldFlags;
}
// timer callback
void AdLibDriver::callback() {
Common::StackLock lock(_mutex);
- --_flagTrigger;
- if (_flagTrigger < 0)
- _flags &= ~8;
- setupPrograms();
+ if (_programStartTimeout)
+ --_programStartTimeout;
+ else
+ setupPrograms();
executePrograms();
uint8 temp = _callbackTimer;
@@ -645,36 +584,86 @@ void AdLibDriver::callback() {
}
void AdLibDriver::setupPrograms() {
- while (_lastProcessed != _soundsPlaying) {
- uint8 *ptr = getProgram(_soundIdTable[_lastProcessed]);
- uint8 chan = *ptr++;
- uint8 priority = *ptr++;
-
- // Only start this sound if its priority is higher than the one
- // already playing.
-
- Channel &channel = _channels[chan];
-
- if (priority >= channel.priority) {
- initChannel(channel);
- channel.priority = priority;
- channel.dataptr = ptr;
- channel.tempo = 0xFF;
- channel.position = 0xFF;
- channel.duration = 1;
- unkOutput2(chan);
- }
+ // If there is no program queued, we skip this.
+ if (_programQueueStart == _programQueueEnd)
+ return;
+
+ uint8 *ptr = _programQueue[_programQueueStart];
+ // Clear the queue entry
+ _programQueue[_programQueueStart] = 0;
+ _programQueueStart = (_programQueueStart + 1) & 15;
+
+ // Adjust data in case we hit a sound effect.
+ adjustSfxData(ptr);
+
+ const int chan = *ptr++;
+ const int priority = *ptr++;
+
+ // Only start this sound if its priority is higher than the one
+ // already playing.
+
+ Channel &channel = _channels[chan];
- // What we have set up now is, probably, the controlling
- // channel for the sound. It is assumed that this program will
- // set up all the other channels it needs, clearing their locks
- // along the way.
+ if (priority >= channel.priority) {
+ initChannel(channel);
+ channel.priority = priority;
+ channel.dataptr = ptr;
+ channel.tempo = 0xFF;
+ channel.position = 0xFF;
+ channel.duration = 1;
- ++_lastProcessed;
- _lastProcessed &= 0x0F;
+ if (chan <= 5)
+ channel.volumeModifier = _musicVolume;
+ else
+ channel.volumeModifier = _sfxVolume;
+
+ unkOutput2(chan);
+
+ // We need to wait two callback calls till we can start another track.
+ // This is (probably) required to assure that the sfx are started with
+ // the correct priority and velocity.
+ _programStartTimeout = 2;
}
}
+void AdLibDriver::adjustSfxData(uint8 *ptr) {
+ // Check whether we need to reset the data of an old sfx which has been
+ // started.
+ if (_sfxPointer) {
+ _sfxPointer[1] = _sfxPriority;
+ _sfxPointer[3] = _sfxVelocity;
+ _sfxPointer = 0;
+ }
+
+ // Only music tracks are started on channel 9, thus we need to make sure
+ // we do not have a music track here.
+ if (*ptr == 9)
+ return;
+
+ // Store the pointer so we can reset the data when a new program is started.
+ _sfxPointer = ptr;
+
+ // Store the old values.
+ _sfxPriority = ptr[1];
+ _sfxVelocity = ptr[3];
+
+ // In the cases I've seen, the mysterious fourth byte has been
+ // the parameter for the update_setExtraLevel3() callback.
+ //
+ // The extra level is part of the channels "total level", which
+ // is a six-bit value where larger values means softer volume.
+ //
+ // So what seems to be happening here is that sounds which are
+ // started by this function are given a slightly lower priority
+ // and a slightly higher (i.e. softer) extra level 3 than they
+ // would have if they were started from anywhere else. Strange.
+
+ // Adjust the values.
+ int newVal = ((((ptr[3]) + 63) * 0xFF) >> 8) & 0xFF;
+ ptr[3] = -newVal + 63;
+ ptr[1] = ((ptr[1] * 0xFF) >> 8) & 0xFF;
+}
+
// A few words on opcode parsing and timing:
//
// First of all, We simulate a timer callback 72 times per second. Each timeout
@@ -1273,9 +1262,21 @@ uint8 AdLibDriver::calculateOpLevel1(Channel &channel) {
if (channel.twoChan) {
value += channel.opExtraLevel1;
value += channel.opExtraLevel2;
- value += channel.opExtraLevel3;
+
+ uint16 level3 = (channel.opExtraLevel3 ^ 0x3F) * channel.volumeModifier;
+ if (level3) {
+ level3 += 0x3F;
+ level3 >>= 8;
+ }
+
+ value += level3 ^ 0x3F;
}
+ value = CLIP<int8>(value, 0, 0x3F);
+
+ if (!channel.volumeModifier)
+ value = 0x3F;
+
// Preserve the scaling level bits from opLevel1
return checkValue(value) | (channel.opLevel1 & 0xC0);
@@ -1286,7 +1287,19 @@ uint8 AdLibDriver::calculateOpLevel2(Channel &channel) {
value += channel.opExtraLevel1;
value += channel.opExtraLevel2;
- value += channel.opExtraLevel3;
+
+ uint16 level3 = (channel.opExtraLevel3 ^ 0x3F) * channel.volumeModifier;
+ if (level3) {
+ level3 += 0x3F;
+ level3 >>= 8;
+ }
+
+ value += level3 ^ 0x3F;
+
+ value = CLIP<int8>(value, 0, 0x3F);
+
+ if (!channel.volumeModifier)
+ value = 0x3F;
// Preserve the scaling level bits from opLevel2
@@ -1323,14 +1336,22 @@ int AdLibDriver::update_setupProgram(uint8 *&dataptr, Channel &channel, uint8 va
Channel &channel2 = _channels[chan];
if (priority >= channel2.priority) {
- _flagTrigger = 1;
- _flags |= 8;
+ // We keep new tracks from being started for two further iterations of
+ // the callback. This assures the correct velocity is used for this
+ // program.
+ _programStartTimeout = 2;
initChannel(channel2);
channel2.priority = priority;
channel2.dataptr = ptr;
channel2.tempo = 0xFF;
channel2.position = 0xFF;
channel2.duration = 1;
+
+ if (chan <= 5)
+ channel2.volumeModifier = _musicVolume;
+ else
+ channel2.volumeModifier = _sfxVolume;
+
unkOutput2(chan);
}
@@ -1911,32 +1932,6 @@ int AdLibDriver::updateCallback56(uint8 *&dataptr, Channel &channel, uint8 value
#define COMMAND(x) { &AdLibDriver::x, #x }
-void AdLibDriver::setupOpcodeList() {
- static const OpcodeEntry opcodeList[] = {
- COMMAND(snd_ret0x100),
- COMMAND(snd_ret0x1983),
- COMMAND(snd_initDriver),
- COMMAND(snd_deinitDriver),
- COMMAND(snd_setSoundData),
- COMMAND(snd_unkOpcode1),
- COMMAND(snd_startSong),
- COMMAND(snd_isChannelPlaying),
- COMMAND(snd_stopChannel),
- COMMAND(snd_readByte),
- COMMAND(snd_writeByte),
- COMMAND(snd_getSoundTrigger),
- COMMAND(snd_unkOpcode4),
- COMMAND(snd_dummy),
- COMMAND(snd_getNullvar4),
- COMMAND(snd_setNullvar3),
- COMMAND(snd_setFlag),
- COMMAND(snd_clearFlag)
- };
-
- _opcodeList = opcodeList;
- _opcodesEntries = ARRAYSIZE(opcodeList);
-}
-
void AdLibDriver::setupParserOpcodeTable() {
static const ParserOpcode parserOpcodeTable[] = {
// 0
@@ -2266,13 +2261,12 @@ SoundAdLibPC::~SoundAdLibPC() {
}
bool SoundAdLibPC::init() {
- _driver->callback(2);
- _driver->callback(16, int(4));
+ _driver->initDriver();
return true;
}
void SoundAdLibPC::process() {
- uint8 trigger = _driver->callback(11);
+ int trigger = _driver->getSoundTrigger();
if (trigger < _numSoundTriggers) {
int soundId = _soundTriggers[trigger];
@@ -2285,6 +2279,23 @@ void SoundAdLibPC::process() {
}
}
+void SoundAdLibPC::updateVolumeSettings() {
+ bool mute = false;
+ if (ConfMan.hasKey("mute"))
+ mute = ConfMan.getBool("mute");
+
+ int newMusicVolume = mute ? 0 : ConfMan.getInt("music_volume");
+ //newMusicVolume = (newMusicVolume * 145) / Audio::Mixer::kMaxMixerVolume + 110;
+ newMusicVolume = CLIP(newMusicVolume, 0, 255);
+
+ int newSfxVolume = mute ? 0 : ConfMan.getInt("sfx_volume");
+ //newSfxVolume = (newSfxVolume * 200) / Audio::Mixer::kMaxMixerVolume + 55;
+ newSfxVolume = CLIP(newSfxVolume, 0, 255);
+
+ _driver->setMusicVolume(newMusicVolume);
+ _driver->setSfxVolume(newSfxVolume);
+}
+
void SoundAdLibPC::playTrack(uint8 track) {
if (_musicEnabled) {
// WORKAROUND: There is a bug in the Kyra 1 "Pool of Sorrow"
@@ -2301,13 +2312,13 @@ void SoundAdLibPC::playTrack(uint8 track) {
}
void SoundAdLibPC::haltTrack() {
- playSoundEffect(0);
- playSoundEffect(0);
+ play(0);
+ play(0);
//_vm->_system->delayMillis(3 * 60);
}
bool SoundAdLibPC::isPlaying() const {
- return _driver->callback(7, int(0)) != 0;
+ return _driver->isChannelPlaying(0);
}
void SoundAdLibPC::playSoundEffect(uint8 track) {
@@ -2326,60 +2337,11 @@ void SoundAdLibPC::play(uint8 track) {
if ((soundId == 0xFFFF && _v2) || (soundId == 0xFF && !_v2) || !_soundDataPtr)
return;
- // HACK: Since we might call this when the engines is paused (on game load via GMM)
- // we must unpause the engine here, so this will work properly
-
- int pauseCount = 0;
- while (_vm->isPaused()) {
- ++pauseCount;
- _vm->pauseEngine(false);
- }
-
- while ((_driver->callback(16, 0) & 8)) {
- // We call the system delay and not the game delay to avoid concurrency issues.
- _vm->_system->delayMillis(10);
- }
-
- while (pauseCount--)
- _vm->pauseEngine(true);
-
- if (_sfxPlayingSound != -1) {
- // Restore the sounds's normal values.
- _driver->callback(10, _sfxPlayingSound, int(1), int(_sfxPriority));
- _driver->callback(10, _sfxPlayingSound, int(3), int(_sfxFourthByteOfSong));
- _sfxPlayingSound = -1;
- }
-
- int chan = _driver->callback(9, soundId, int(0));
-
- if (chan != 9) {
- _sfxPlayingSound = soundId;
- _sfxPriority = _driver->callback(9, soundId, int(1));
- _sfxFourthByteOfSong = _driver->callback(9, soundId, int(3));
-
- // In the cases I've seen, the mysterious fourth byte has been
- // the parameter for the update_setExtraLevel3() callback.
- //
- // The extra level is part of the channels "total level", which
- // is a six-bit value where larger values means softer volume.
- //
- // So what seems to be happening here is that sounds which are
- // started by this function are given a slightly lower priority
- // and a slightly higher (i.e. softer) extra level 3 than they
- // would have if they were started from anywhere else. Strange.
-
- int newVal = ((((-_sfxFourthByteOfSong) + 63) * 0xFF) >> 8) & 0xFF;
- newVal = -newVal + 63;
- _driver->callback(10, soundId, int(3), newVal);
- newVal = ((_sfxPriority * 0xFF) >> 8) & 0xFF;
- _driver->callback(10, soundId, int(1), newVal);
- }
-
- _driver->callback(6, soundId);
+ _driver->queueTrack(soundId);
}
void SoundAdLibPC::beginFadeOut() {
- playSoundEffect(1);
+ play(1);
}
void SoundAdLibPC::loadSoundFile(uint file) {
@@ -2409,7 +2371,7 @@ void SoundAdLibPC::internalLoadFile(Common::String file) {
playSoundEffect(0);
playSoundEffect(0);
- _driver->callback(8, int(-1));
+ _driver->stopAllChannels();
_soundDataPtr = 0;
int soundDataSize = fileSize;
@@ -2434,7 +2396,7 @@ void SoundAdLibPC::internalLoadFile(Common::String file) {
fileData = p = 0;
fileSize = 0;
- _driver->callback(4, _soundDataPtr);
+ _driver->setSoundData(_soundDataPtr);
_soundFileLoaded = file;
}
diff --git a/engines/kyra/sound_adlib.h b/engines/kyra/sound_adlib.h
index c09fec997e..923a4cb75f 100644
--- a/engines/kyra/sound_adlib.h
+++ b/engines/kyra/sound_adlib.h
@@ -62,22 +62,23 @@ public:
SoundAdLibPC(KyraEngine_v1 *vm, Audio::Mixer *mixer);
~SoundAdLibPC();
- kType getMusicType() const { return kAdLib; }
+ virtual kType getMusicType() const { return kAdLib; }
- bool init();
- void process();
+ virtual bool init();
+ virtual void process();
- void loadSoundFile(uint file);
- void loadSoundFile(Common::String file);
- void loadSoundFile(const uint8 *soundData, int dataSize) {}
+ virtual void updateVolumeSettings();
- void playTrack(uint8 track);
- void haltTrack();
- bool isPlaying() const;
+ virtual void loadSoundFile(uint file);
+ virtual void loadSoundFile(Common::String file);
- void playSoundEffect(uint8 track);
+ virtual void playTrack(uint8 track);
+ virtual void haltTrack();
+ virtual bool isPlaying() const;
- void beginFadeOut();
+ virtual void playSoundEffect(uint8 track);
+
+ virtual void beginFadeOut();
private:
void internalLoadFile(Common::String file);
@@ -92,9 +93,6 @@ private:
Common::String _soundFileLoaded;
- uint8 _sfxPriority;
- uint8 _sfxFourthByteOfSong;
-
int _numSoundTriggers;
const int *_soundTriggers;
diff --git a/engines/kyra/sound_lol.cpp b/engines/kyra/sound_lol.cpp
index efa844968d..968488eef3 100644
--- a/engines/kyra/sound_lol.cpp
+++ b/engines/kyra/sound_lol.cpp
@@ -98,12 +98,12 @@ bool LoLEngine::snd_playCharacterSpeech(int id, int8 speaker, int) {
_speechList = newSpeechList;
_activeVoiceFileTotalTime = 0;
- for (SpeechList::iterator i = _speechList.begin(); i != _speechList.end(); ++i) {
+ for (SpeechList::iterator i = _speechList.begin(); i != _speechList.end();) {
// Just in case any file loading failed: Remove the bad streams here.
if (!*i)
i = _speechList.erase(i);
else
- _activeVoiceFileTotalTime += (*i)->getLength().msecs();
+ _activeVoiceFileTotalTime += (*i++)->getLength().msecs();
}
_sound->playVoiceStream(*_speechList.begin(), &_speechHandle);
diff --git a/engines/lastexpress/data/scene.h b/engines/lastexpress/data/scene.h
index 0c0d12b9c0..69a1417459 100644
--- a/engines/lastexpress/data/scene.h
+++ b/engines/lastexpress/data/scene.h
@@ -76,10 +76,6 @@ class SeekableReadStream;
class String;
}
-namespace Graphics {
-struct Surface;
-}
-
namespace LastExpress {
class Scene;
diff --git a/engines/lastexpress/data/snd.cpp b/engines/lastexpress/data/snd.cpp
index 6845be8808..a9bee6155d 100644
--- a/engines/lastexpress/data/snd.cpp
+++ b/engines/lastexpress/data/snd.cpp
@@ -396,7 +396,7 @@ public:
// First nibble
idx = data >> 4;
step = stepTable[idx + _status.ima_ch[0].stepIndex / 4];
- sample = CLIP(imaTable[idx + _status.ima_ch[0].stepIndex / 4] + _status.ima_ch[0].last, -32767, 32767);
+ sample = CLIP<int>(imaTable[idx + _status.ima_ch[0].stepIndex / 4] + _status.ima_ch[0].last, -32767, 32767);
buffer[samples] = (_stepAdjust2 * sample) >> _stepAdjust1;
// Second nibble
diff --git a/engines/lastexpress/detection.cpp b/engines/lastexpress/detection.cpp
index 0a177809dd..82a6520522 100644
--- a/engines/lastexpress/detection.cpp
+++ b/engines/lastexpress/detection.cpp
@@ -48,7 +48,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformUnknown,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
// The Last Express (English) - UK Broderbund Release
@@ -66,7 +66,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformUnknown,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
// The Last Express (English) - Interplay Release
@@ -84,7 +84,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformUnknown,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
// The Last Express (Demo - English) - Broderbund
@@ -99,7 +99,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformUnknown,
ADGF_DEMO | ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
// The Last Express (French) - Broderbund Release
@@ -117,7 +117,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformUnknown,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
// The Last Express (German)
@@ -135,7 +135,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformUnknown,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
// The Last Express (Spanish)
@@ -153,7 +153,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformUnknown,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
// The Last Express (Italian)
@@ -171,7 +171,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformUnknown,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
// The Last Express (Russian)
@@ -189,7 +189,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::RU_RUS,
Common::kPlatformUnknown,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
AD_TABLE_END_MARKER
@@ -200,7 +200,7 @@ class LastExpressMetaEngine : public AdvancedMetaEngine {
public:
LastExpressMetaEngine() : AdvancedMetaEngine(gameDescriptions, sizeof(ADGameDescription), lastExpressGames) {
_singleid = "lastexpress";
- _guioptions = Common::GUIO_NOSUBTITLES | Common::GUIO_NOSFX;
+ _guioptions = GUIO2(GUIO_NOSUBTITLES, GUIO_NOSFX);
}
const char *getName() const {
diff --git a/engines/lastexpress/entities/abbot.cpp b/engines/lastexpress/entities/abbot.cpp
index c5c6f2a44d..301c52e142 100644
--- a/engines/lastexpress/entities/abbot.cpp
+++ b/engines/lastexpress/entities/abbot.cpp
@@ -841,7 +841,7 @@ IMPLEMENT_FUNCTION(31, Abbot, function31)
case kActionNone:
if (params->param4 != kTimeInvalid && params->param2 < getState()->time) {
- if (getState()->time < getState()->time) {
+ if (params->param3 < getState()->time) {
params->param4 = kTimeInvalid;
setCallback(1);
diff --git a/engines/lastexpress/entities/august.cpp b/engines/lastexpress/entities/august.cpp
index eb3b09af59..cfde8a2d6f 100644
--- a/engines/lastexpress/entities/august.cpp
+++ b/engines/lastexpress/entities/august.cpp
@@ -2118,7 +2118,7 @@ IMPLEMENT_FUNCTION_II(41, August, function41, CarIndex, EntityPosition)
&& getEntities()->isDistanceBetweenEntities(kEntityAugust, kEntityPlayer, 1000)
&& !getEntities()->isInsideCompartments(kEntityPlayer)
&& !getEntities()->checkFields10(kEntityPlayer)) {
- if (getData()->car == kCarGreenSleeping || getData()->car == kCarGreenSleeping) {
+ if (getData()->car == kCarGreenSleeping || getData()->car == kCarRedSleeping) {
getAction()->playAnimation(kEventAugustMerchandise);
getEntities()->loadSceneFromEntityPosition(getData()->car, (EntityPosition)(getData()->entityPosition + (750 * (getData()->direction == kDirectionUp ? -1 : 1))), getData()->direction == kDirectionUp);
diff --git a/engines/lastexpress/entities/francois.cpp b/engines/lastexpress/entities/francois.cpp
index 2b170d93a3..46cd790ffb 100644
--- a/engines/lastexpress/entities/francois.cpp
+++ b/engines/lastexpress/entities/francois.cpp
@@ -450,7 +450,7 @@ label_callback:
if (isNight())
getAction()->playAnimation(getData()->entityPosition <= getEntityData(kEntityPlayer)->entityPosition ? kEventFrancoisWhistleNightD : kEventFrancoisWhistleNight);
else
- getAction()->playAnimation(getData()->entityPosition <= getEntityData(kEntityPlayer)->entityPosition ? kEventFrancoisWhistleD : kEventFrancoisWhistleD);
+ getAction()->playAnimation(getData()->entityPosition <= getEntityData(kEntityPlayer)->entityPosition ? kEventFrancoisWhistleD : kEventFrancoisWhistle);
}
getEntities()->loadSceneFromEntityPosition(getData()->car, (EntityPosition)(getData()->entityPosition + 750 * (getData()->direction == kDirectionUp ? -1 : 1)), getData()->direction == kDirectionUp);
break;
diff --git a/engines/lastexpress/entities/mertens.cpp b/engines/lastexpress/entities/mertens.cpp
index e222af4805..d88962fce2 100644
--- a/engines/lastexpress/entities/mertens.cpp
+++ b/engines/lastexpress/entities/mertens.cpp
@@ -390,7 +390,7 @@ IMPLEMENT_FUNCTION_II(10, Mertens, updateEntity, CarIndex, EntityPosition)
break;
case kActionDefault:
- if ((!getProgress().eventCorpseFound && !getEvent(kEventMertensAskTylerCompartment) && !getEvent(kEventMertensAskTylerCompartment))
+ if ((!getProgress().eventCorpseFound && !getEvent(kEventMertensAskTylerCompartment) && !getEvent(kEventMertensAskTylerCompartmentD))
|| (ENTITY_PARAM(0, 4) && getProgress().jacket == kJacketGreen && !getEvent(kEventMertensDontMakeBed) && !getProgress().eventCorpseThrown))
params->param3 = 1;
diff --git a/engines/lastexpress/game/action.cpp b/engines/lastexpress/game/action.cpp
index 2ef4c20d70..98d74dd1a7 100644
--- a/engines/lastexpress/game/action.cpp
+++ b/engines/lastexpress/game/action.cpp
@@ -1806,7 +1806,7 @@ CursorStyle Action::getCursor(const SceneHotspot &hotspot) const {
if (getProgress().jacket != kJacketGreen)
return kCursorNormal;
- if ((getEvent(kEventCathLookOutsideWindowDay) || getEvent(kEventCathLookOutsideWindowDay) || getObjects()->get(kObjectCompartment1).location2 == kObjectLocation1)
+ if ((getEvent(kEventCathLookOutsideWindowDay) || getEvent(kEventCathLookOutsideWindowNight) || getObjects()->get(kObjectCompartment1).location2 == kObjectLocation1)
&& getProgress().isTrainRunning
&& (object != kObjectOutsideAnnaCompartment || (getEntities()->isInsideCompartment(kEntityRebecca, kCarRedSleeping, kPosition_4840) && getObjects()->get(kObjectOutsideBetweenCompartments).location == 2))
&& getInventory()->getSelectedItem() != kItemBriefcase && getInventory()->getSelectedItem() != kItemFirebird)
diff --git a/engines/lastexpress/game/entities.cpp b/engines/lastexpress/game/entities.cpp
index 1b31339b7b..894663dda6 100644
--- a/engines/lastexpress/game/entities.cpp
+++ b/engines/lastexpress/game/entities.cpp
@@ -87,16 +87,15 @@ static const EntityPosition objectsPosition[8] = {kPosition_8200, kPosition_7500
kPosition_4840, kPosition_4070,
kPosition_3050, kPosition_2740};
-static const EntityPosition entityPositions[41] = {
- kPositionNone, kPosition_851, kPosition_1430, kPosition_2110, kPositionNone,
- kPosition_2410, kPosition_2980, kPosition_3450, kPosition_3760, kPosition_4100,
- kPosition_4680, kPosition_5140, kPosition_5440, kPosition_5810, kPosition_6410,
- kPosition_6850, kPosition_7160, kPosition_7510, kPosition_8514, kPositionNone,
- kPositionNone, kPositionNone, kPosition_2086, kPosition_2690, kPositionNone,
- kPosition_3110, kPosition_3390, kPosition_3890, kPosition_4460, kPosition_4770,
- kPosition_5090, kPosition_5610, kPosition_6160, kPosition_6460, kPosition_6800,
- kPosition_7320, kPosition_7870, kPosition_8160, kPosition_8500, kPosition_9020,
- kPosition_9269};
+static const EntityPosition entityPositions[41] = {kPositionNone, kPosition_851, kPosition_1430, kPosition_2110, kPositionNone,
+ kPosition_2410, kPosition_2980, kPosition_3450, kPosition_3760, kPosition_4100,
+ kPosition_4680, kPosition_5140, kPosition_5440, kPosition_5810, kPosition_6410,
+ kPosition_6850, kPosition_7160, kPosition_7510, kPosition_8514, kPositionNone,
+ kPositionNone, kPositionNone, kPosition_2086, kPosition_2690, kPositionNone,
+ kPosition_3110, kPosition_3390, kPosition_3890, kPosition_4460, kPosition_4770,
+ kPosition_5090, kPosition_5610, kPosition_6160, kPosition_6460, kPosition_6800,
+ kPosition_7320, kPosition_7870, kPosition_8160, kPosition_8500, kPosition_9020,
+ kPosition_9269};
#define ADD_ENTITY(class) \
_entities.push_back(new class(engine));
@@ -105,7 +104,7 @@ static const EntityPosition entityPositions[41] = {
sequenceTo = sequenceFrom; \
for (int seqIdx = 0; seqIdx < 7; seqIdx++) \
sequenceTo.deleteLastChar(); \
- if (isInsideTrainCar(entityIndex, kCarGreenSleeping) || isInsideTrainCar(entityIndex, kCarGreenSleeping)) { \
+ if (isInsideTrainCar(entityIndex, kCarGreenSleeping) || isInsideTrainCar(entityIndex, kCarRedSleeping)) { \
if (data->car < getData(kEntityPlayer)->car || (data->car == getData(kEntityPlayer)->car && data->entityPosition < getData(kEntityPlayer)->entityPosition)) \
sequenceTo += "R.SEQ"; \
else \
diff --git a/engines/lastexpress/game/savegame.cpp b/engines/lastexpress/game/savegame.cpp
index 57c18b5697..9c464feb6e 100644
--- a/engines/lastexpress/game/savegame.cpp
+++ b/engines/lastexpress/game/savegame.cpp
@@ -154,11 +154,11 @@ void SaveLoad::loadStream(GameId id) {
error("[SaveLoad::loadStream] Savegame stream is invalid");
// Load all savegame data
- uint8* buf = new uint8[8192];
+ uint8 *buf = new uint8[8192];
while (!save->eos() && !save->err()) {
_engine->pollEvents();
- uint32 count = save->read(buf, sizeof(buf));
+ uint32 count = save->read(buf, 8192);
if (count) {
uint32 w = _savegame->write(buf, count);
assert (w == count);
diff --git a/engines/lure/decode.cpp b/engines/lure/decode.cpp
index 59390e6e91..1338559534 100644
--- a/engines/lure/decode.cpp
+++ b/engines/lure/decode.cpp
@@ -34,12 +34,18 @@ namespace Lure {
/* Provides the functionality for decoding screens */
/*--------------------------------------------------------------------------*/
+/**
+ * Write a single byte to the output buffer
+ */
void PictureDecoder::writeByte(MemoryBlock *dest, byte v) {
if (outputOffset == dest->size())
error("Decoded data exceeded allocated output buffer size");
dest->data()[outputOffset++] = v;
}
+/**
+ * Writes out a specified byte a given number of times to the output
+ */
void PictureDecoder::writeBytes(MemoryBlock *dest, byte v, uint16 numBytes) {
if (outputOffset + numBytes > dest->size())
error("Decoded data exceeded allocated output buffer size");
@@ -47,6 +53,9 @@ void PictureDecoder::writeBytes(MemoryBlock *dest, byte v, uint16 numBytes) {
outputOffset += numBytes;
}
+/**
+ * Gets a byte from the compressed source using the first data pointer
+ */
byte PictureDecoder::DSSI(bool incr) {
if (dataPos > dataIn->size())
error("PictureDecoder went beyond end of source data");
@@ -57,6 +66,9 @@ byte PictureDecoder::DSSI(bool incr) {
return result;
}
+/**
+ * Gets a byte from the compressed source using the second data pointer
+ */
byte PictureDecoder::ESBX(bool incr) {
if (dataPos2 >= dataIn->size())
error("PictureDecoder went beyond end of source data");
@@ -227,56 +239,61 @@ MemoryBlock *PictureDecoder::vgaDecode(MemoryBlock *src, uint32 maxOutputSize) {
CH = ESBX();
CL = 9;
-Loc754:
- AL = DSSI();
- writeByte(dest, AL);
- BP = ((uint16) AL) << 2;
-
-Loc755:
- decrCtr();
- if (shlCarry()) goto Loc761;
- decrCtr();
- if (shlCarry()) goto Loc759;
- AL = dataIn->data()[BP];
-
-Loc758:
- writeByte(dest, AL);
- BP = ((uint16) AL) << 2;
- goto Loc755;
-
-Loc759:
- AL = (byte) (BP >> 2);
- AH = DSSI();
- if (AH == 0) goto Loc768;
-
- writeBytes(dest, AL, AH);
- goto Loc755;
-
-Loc761:
- decrCtr();
- if (shlCarry()) goto Loc765;
- decrCtr();
-
- if (shlCarry()) goto Loc764;
- AL = dataIn->data()[BP+1];
- goto Loc758;
-
-Loc764:
- AL = dataIn->data()[BP+2];
- goto Loc758;
-
-Loc765:
- decrCtr();
- if (shlCarry()) goto Loc767;
- AL = dataIn->data()[BP+3];
- goto Loc758;
-
-Loc767:
- goto Loc754;
-
-Loc768:
- AL = DSSI();
- if (AL != 0) goto Loc755;
+ // Main decoding loop
+ bool loopFlag = true;
+ while (loopFlag) {
+ AL = DSSI();
+ writeByte(dest, AL);
+ BP = ((uint16) AL) << 2;
+
+ // Inner loop
+ for (;;) {
+ decrCtr();
+ if (shlCarry()) {
+ decrCtr();
+ if (shlCarry()) {
+ decrCtr();
+ if (shlCarry())
+ break;
+
+ AL = dataIn->data()[BP + 3];
+ } else {
+ decrCtr();
+ if (shlCarry())
+ AL = dataIn->data()[BP + 2];
+ else
+ AL = dataIn->data()[BP + 1];
+ }
+ } else {
+ decrCtr();
+ if (shlCarry()) {
+ AL = (byte) (BP >> 2);
+ AH = DSSI();
+ if (AH == 0) {
+ AL = DSSI();
+ if (AL == 0) {
+ // Finally done
+ loopFlag = false;
+ break;
+ } else {
+ // Keep going
+ continue;
+ }
+ } else {
+ // Write out byte sequence
+ writeBytes(dest, AL, AH);
+ continue;
+ }
+ } else {
+ AL = dataIn->data()[BP];
+ }
+ }
+
+ // Write out the next byte
+ writeByte(dest, AL);
+ BP = ((uint16) AL) << 2;
+ }
+ }
// Resize the output to be the number of outputed bytes and return it
if (outputOffset < dest->size()) dest->reallocate(outputOffset);
@@ -355,106 +372,54 @@ uint32 AnimationDecoder::decode_data(MemoryBlock *src, MemoryBlock *dest, uint32
currData <<= 4;
dx = 1;
- for (;;) {
- carry = false;
- rcl(currData, carry);
- if (--bitCtr == 0) {
- GET_BYTE;
- bitCtr = 8;
- }
- if (carry) goto loc_1441;
- tableOffset = BX_VAL(0);
-
-loc_1439:
- dx ^= 1;
- if ((dx & 1) != 0) {
- SET_HI_BYTE(dx, tableOffset << 4);
- *pDest = dx >> 8;
- } else {
- *pDest++ |= tableOffset;
- }
- continue;
-
-loc_1441:
- rcl(currData, carry);
- if (--bitCtr == 0) {
- GET_BYTE;
- bitCtr = 8;
- }
- if (!carry) {
+ // Main loop
+ bool loopFlag = true;
+ while (loopFlag) {
+ for (;;) {
+ carry = false;
rcl(currData, carry);
if (--bitCtr == 0) {
GET_BYTE;
bitCtr = 8;
}
-
if (!carry) {
- tableOffset = BX_VAL(0x10);
- } else {
- tableOffset = BX_VAL(0x20);
+ tableOffset = BX_VAL(0);
+ break;
}
- goto loc_1439;
- }
-
- rcl(currData, carry);
- if (--bitCtr == 0) {
- GET_BYTE;
- bitCtr = 8;
- }
- if (!carry) {
- tableOffset = BX_VAL(0x30);
- goto loc_1439;
- }
- SET_HI_BYTE(dx, currData >> 12);
- carry = false;
- for (int ctr = 0; ctr < 4; ++ctr) {
rcl(currData, carry);
if (--bitCtr == 0) {
GET_BYTE;
bitCtr = 8;
}
- }
-
- byte dxHigh = dx >> 8;
- if (dxHigh == BX_VAL(0)) {
- tempReg1 = bitCtr;
- tempReg2 = dx;
- decode_data_2(src, pSrc, currData, bitCtr, dx, carry);
-
- SET_LO_BYTE(dx, dx >> 8);
- decode_data_2(src, pSrc, currData, bitCtr, dx, carry);
- SET_HI_BYTE(bitCtr, dx & 0xff);
- SET_LO_BYTE(bitCtr, dx >> 8);
- dx = tempReg2;
-
- if (bitCtr == 0)
- // Exit out of infinite loop
- break;
-
- } else if (dxHigh == BX_VAL(0x10)) {
- tempReg1 = bitCtr;
- decode_data_2(src, pSrc, currData, bitCtr, dx, carry);
- bitCtr = dx >> 8;
-
- } else if (dxHigh == BX_VAL(0x20)) {
- SET_HI_BYTE(dx, currData >> 10);
-
- for (v = 0; v < 6; ++v) {
+ if (!carry) {
rcl(currData, carry);
if (--bitCtr == 0) {
GET_BYTE;
bitCtr = 8;
}
- }
- tempReg1 = bitCtr;
- bitCtr = dx >> 8;
+ if (!carry) {
+ tableOffset = BX_VAL(0x10);
+ } else {
+ tableOffset = BX_VAL(0x20);
+ }
+ break;
+ }
- } else if (dxHigh == BX_VAL(0x30)) {
- SET_HI_BYTE(dx, currData >> 11);
+ rcl(currData, carry);
+ if (--bitCtr == 0) {
+ GET_BYTE;
+ bitCtr = 8;
+ }
+ if (!carry) {
+ tableOffset = BX_VAL(0x30);
+ break;
+ }
- for (v = 0; v < 5; ++v) {
+ SET_HI_BYTE(dx, currData >> 12);
+ carry = false;
+ for (int ctr = 0; ctr < 4; ++ctr) {
rcl(currData, carry);
if (--bitCtr == 0) {
GET_BYTE;
@@ -462,34 +427,92 @@ loc_1441:
}
}
- tempReg1 = bitCtr;
- bitCtr = dx >> 8;
+ byte dxHigh = dx >> 8;
+ if (dxHigh == BX_VAL(0)) {
+ tempReg1 = bitCtr;
+ tempReg2 = dx;
+ decode_data_2(src, pSrc, currData, bitCtr, dx, carry);
+
+ SET_LO_BYTE(dx, dx >> 8);
+ decode_data_2(src, pSrc, currData, bitCtr, dx, carry);
+ SET_HI_BYTE(bitCtr, dx & 0xff);
+ SET_LO_BYTE(bitCtr, dx >> 8);
+ dx = tempReg2;
+
+ if (bitCtr == 0) {
+ // End of decompression
+ loopFlag = false;
+ break;
+ }
+ } else if (dxHigh == BX_VAL(0x10)) {
+ tempReg1 = bitCtr;
+ decode_data_2(src, pSrc, currData, bitCtr, dx, carry);
+ bitCtr = dx >> 8;
+
+ } else if (dxHigh == BX_VAL(0x20)) {
+ SET_HI_BYTE(dx, currData >> 10);
+
+ for (v = 0; v < 6; ++v) {
+ rcl(currData, carry);
+ if (--bitCtr == 0) {
+ GET_BYTE;
+ bitCtr = 8;
+ }
+ }
+
+ tempReg1 = bitCtr;
+ bitCtr = dx >> 8;
- } else {
- tableOffset = dx >> 8;
- goto loc_1439;
- }
+ } else if (dxHigh == BX_VAL(0x30)) {
+ SET_HI_BYTE(dx, currData >> 11);
- if ((dx & 1) == 1) {
- *pDest++ |= tableOffset;
- --bitCtr;
- dx &= 0xfffe;
- }
+ for (v = 0; v < 5; ++v) {
+ rcl(currData, carry);
+ if (--bitCtr == 0) {
+ GET_BYTE;
+ bitCtr = 8;
+ }
+ }
- SET_HI_BYTE(dx, tableOffset << 4);
- tableOffset |= dx >> 8;
+ tempReg1 = bitCtr;
+ bitCtr = dx >> 8;
- v = bitCtr >> 1;
- while (v-- > 0) *pDest++ = tableOffset;
+ } else {
+ tableOffset = dx >> 8;
+ break;
+ }
- bitCtr &= 1;
- if (bitCtr != 0) {
- *pDest = tableOffset & 0xf0;
- dx |= 1; //dx.l
+ if ((dx & 1) == 1) {
+ *pDest++ |= tableOffset;
+ --bitCtr;
+ dx &= 0xfffe;
+ }
+
+ SET_HI_BYTE(dx, tableOffset << 4);
+ tableOffset |= dx >> 8;
+
+ v = bitCtr >> 1;
+ while (v-- > 0) *pDest++ = tableOffset;
+
+ bitCtr &= 1;
+ if (bitCtr != 0) {
+ *pDest = tableOffset & 0xf0;
+ dx |= 1; //dx.l
+ }
+
+ bitCtr = tempReg1;
+ tableOffset &= 0x0f;
}
- bitCtr = tempReg1;
- tableOffset &= 0x0f;
+ if (loopFlag) {
+ dx ^= 1;
+ if ((dx & 1) != 0) {
+ SET_HI_BYTE(dx, tableOffset << 4);
+ *pDest = dx >> 8;
+ } else {
+ *pDest++ |= tableOffset;
+ }
+ }
}
// Return number of bytes written
diff --git a/engines/lure/detection.cpp b/engines/lure/detection.cpp
index 081625863d..ab7615c265 100644
--- a/engines/lure/detection.cpp
+++ b/engines/lure/detection.cpp
@@ -63,8 +63,6 @@ static const PlainGameDescriptor lureGames[] = {
namespace Lure {
-using Common::GUIO_NONE;
-
static const LureGameDescription gameDescriptions[] = {
{
{
@@ -74,7 +72,7 @@ static const LureGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GF_FLOPPY,
},
@@ -87,7 +85,7 @@ static const LureGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GF_FLOPPY | GF_EGA,
},
@@ -100,7 +98,7 @@ static const LureGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GF_FLOPPY,
},
@@ -113,7 +111,7 @@ static const LureGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GF_FLOPPY | GF_EGA,
},
@@ -126,7 +124,7 @@ static const LureGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GF_FLOPPY,
},
@@ -139,7 +137,7 @@ static const LureGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GF_FLOPPY,
},
@@ -152,7 +150,7 @@ static const LureGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GF_FLOPPY,
},
@@ -165,7 +163,7 @@ static const LureGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GF_FLOPPY,
},
@@ -184,7 +182,7 @@ public:
// Use kADFlagUseExtraAsHint to distinguish between EGA and VGA versions
// of italian Lure when their datafiles sit in the same directory.
_flags = kADFlagUseExtraAsHint;
- _guioptions = Common::GUIO_NOSPEECH;
+ _guioptions = GUIO1(GUIO_NOSPEECH);
}
virtual const char *getName() const {
diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp
index 96e5e088ab..207c125a0c 100644
--- a/engines/lure/hotspots.cpp
+++ b/engines/lure/hotspots.cpp
@@ -179,7 +179,6 @@ Hotspot::Hotspot(): _pathFinder(NULL) {
_walkFlag = false;
_skipFlag = false;
_roomNumber = 0;
- _destHotspotId = 0;
_startX = 0;
_startY = 0;
_destX = 0;
diff --git a/engines/lure/res.cpp b/engines/lure/res.cpp
index fbf9f33b87..6328301233 100644
--- a/engines/lure/res.cpp
+++ b/engines/lure/res.cpp
@@ -408,7 +408,7 @@ byte *Resources::getCursor(uint8 cursorNum) {
if (!LureEngine::getReference().isEGA())
return _cursors->data() + (cursorNum * CURSOR_SIZE);
- Common::set_to(&_cursor[0], &_cursor[0] + CURSOR_SIZE, 0);
+ Common::fill(&_cursor[0], &_cursor[0] + CURSOR_SIZE, 0);
byte *pSrc = _cursors->data() + (cursorNum * 64);
byte *pDest = &_cursor[0];
diff --git a/engines/lure/room.cpp b/engines/lure/room.cpp
index 2cb871d73f..219ed0263d 100644
--- a/engines/lure/room.cpp
+++ b/engines/lure/room.cpp
@@ -43,7 +43,7 @@ RoomLayer::RoomLayer(uint16 screenId, bool backgroundLayer):
int cellIndex = 0;
// Reset all the cells to unused
- Common::set_to((uint8 *) _cells, (uint8 *) _cells + GRID_SIZE, 0xff);
+ Common::fill((uint8 *) _cells, (uint8 *) _cells + GRID_SIZE, 0xff);
// Load up the screen data
MemoryBlock *rawData = disk.getEntry(screenId);
diff --git a/engines/lure/scripts.cpp b/engines/lure/scripts.cpp
index 22656dd3fe..df2f06df96 100644
--- a/engines/lure/scripts.cpp
+++ b/engines/lure/scripts.cpp
@@ -499,7 +499,7 @@ void Script::fixGoewin(uint16 v1, uint16 v2, uint16 v3) {
hotspot->currentActions().clear();
hotspot->currentActions().addFront(DISPATCH_ACTION, entry, hotspot->roomNumber());
- hotspot->setActions(hotspot->resource()->actions & !(1 << (TELL - 1)));
+ hotspot->setActions(hotspot->resource()->actions & ~(1 << (TELL - 1)));
hotspot->setActionCtr(0);
hotspot->setDelayCtr(0);
hotspot->setCharacterMode(CHARMODE_NONE);
diff --git a/engines/lure/sound.cpp b/engines/lure/sound.cpp
index 85b86a8400..0aecae22ec 100644
--- a/engines/lure/sound.cpp
+++ b/engines/lure/sound.cpp
@@ -53,7 +53,7 @@ SoundManager::SoundManager() {
_isRoland = MidiDriver::getMusicType(dev) != MT_ADLIB;
_nativeMT32 = ((MidiDriver::getMusicType(dev) == MT_MT32) || ConfMan.getBool("native_mt32"));
- Common::set_to(_channelsInUse, _channelsInUse + NUM_CHANNELS, false);
+ Common::fill(_channelsInUse, _channelsInUse + NUM_CHANNELS, false);
_driver = MidiDriver::createMidi(dev);
int statusCode = _driver->open();
@@ -182,7 +182,7 @@ void SoundManager::killSounds() {
// Clear the active sounds
_activeSounds.clear();
- Common::set_to(_channelsInUse, _channelsInUse + NUM_CHANNELS, false);
+ Common::fill(_channelsInUse, _channelsInUse + NUM_CHANNELS, false);
}
void SoundManager::addSound(uint8 soundIndex, bool tidyFlag) {
@@ -221,7 +221,7 @@ void SoundManager::addSound(uint8 soundIndex, bool tidyFlag) {
}
// Mark the found channels as in use
- Common::set_to(_channelsInUse+channelCtr, _channelsInUse+channelCtr + numChannels, true);
+ Common::fill(_channelsInUse+channelCtr, _channelsInUse+channelCtr + numChannels, true);
SoundDescResource *newEntry = new SoundDescResource();
newEntry->soundNumber = rec.soundNumber;
@@ -342,7 +342,7 @@ void SoundManager::tidySounds() {
++i;
else {
// Mark the channels that it used as now being free
- Common::set_to(_channelsInUse+rec->channel, _channelsInUse+rec->channel+rec->numChannels, false);
+ Common::fill(_channelsInUse+rec->channel, _channelsInUse+rec->channel+rec->numChannels, false);
i = _activeSounds.erase(i);
}
@@ -373,7 +373,7 @@ void SoundManager::restoreSounds() {
SoundDescResource *rec = (*i).get();
if ((rec->numChannels != 0) && ((rec->flags & SF_RESTORE) != 0)) {
- Common::set_to(_channelsInUse+rec->channel, _channelsInUse+rec->channel+rec->numChannels, true);
+ Common::fill(_channelsInUse+rec->channel, _channelsInUse+rec->channel+rec->numChannels, true);
musicInterface_Play(rec->soundNumber, rec->channel, rec->numChannels);
musicInterface_SetVolume(rec->channel, rec->volume);
diff --git a/engines/m4/actor.cpp b/engines/m4/actor.cpp
deleted file mode 100644
index 80a3624475..0000000000
--- a/engines/m4/actor.cpp
+++ /dev/null
@@ -1,199 +0,0 @@
-/* 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/system.h"
-#include "common/array.h"
-#include "common/textconsole.h"
-#include "m4/actor.h"
-#include "m4/m4_views.h"
-#include "m4/assets.h"
-
-namespace M4 {
-
-#define WALKER_BURGER "Wilbur0%i" // wilbur, with a number denoting his current direction
-
-Actor::Actor(MadsM4Engine *vm) : _vm(vm) {
- _scaling = 100;
- _direction = 5;
- _walkerSprites.resize(10);
- loadWalkers();
-}
-
-Actor::~Actor() {
- unloadWalkers();
-}
-
-int Actor::getWalkerWidth() { return _walkerSprites[kFacingSouth]->getFrame(0)->width(); }
-int Actor::getWalkerHeight() { return _walkerSprites[kFacingSouth]->getFrame(0)->height(); }
-
-void Actor::placeWalkerSpriteAt(int spriteNum, int x, int y) {
- if (_direction < 1 || _direction > 9) {
- warning("Direction is %i, fixing", _direction);
- _direction = 1; // TODO: this is a temporary fix
- }
- SpriteInfo info;
- info.sprite = _walkerSprites[_direction]->getFrame(spriteNum);
- info.hotX = info.hotY = 0;
- info.width = info.sprite->width();
- info.height = info.sprite->height();
- info.scaleX = info.scaleY = _scaling;
- info.palette = _walkerSprites[_direction]->getPalette();
- info.inverseColorTable = _m4Vm->scene()->getInverseColorTable();
-
- _vm->_scene->drawSprite(x, y, info, Common::Rect(640, 400));
-}
-
-void Actor::loadWalkers() {
- for (uint8 i = 1; i < 10; i++) {
- if (i == 6)
- continue; // walker sprite 6 is unused
- loadWalkerDirection(i);
- }
-}
-
-void Actor::loadWalkerDirection(uint8 direction) {
- char name[20];
- Common::SeekableReadStream *walkerS;
-
- if (_vm->getGameType() == GType_Burger) {
- sprintf(name, WALKER_BURGER, direction);
- } else {
- //warning("Actor::loadWalkerDirection: unspecified walker type, not loading walker");
- // TODO: Master Lu walkers
- return;
- }
-
- walkerS = _vm->res()->get(name);
- _walkerSprites.insert_at(direction, new SpriteAsset(_vm, walkerS, walkerS->size(), name));
- _vm->res()->toss(name);
-}
-
-void Actor::unloadWalkers() {
- for (uint8 i = 9; i > 0; i--) {
- if (i == 6)
- continue; // walker sprite 6 is unused
- SpriteAsset *tempSprite = _walkerSprites[i];
- _walkerSprites.remove_at(i);
- delete tempSprite;
- }
-}
-
-void Actor::setWalkerPalette() {
- _vm->_palette->setPalette(_walkerSprites[kFacingSouthEast]->getPalette(), 0,
- _walkerSprites[kFacingSouthEast]->getColorCount());
-}
-
-Inventory::Inventory(MadsM4Engine *vm) : _vm(vm) {
-}
-
-Inventory::~Inventory() {
- _inventory.clear();
-}
-
-void Inventory::registerObject(char* name, int32 scene, int32 icon) {
- InventoryObject *newObject = new InventoryObject();
- int newObjectIndex = 0;
-
- // Capitalize registered inventory object names
- str_upper(name);
-
- newObject->name = strdup(name);
- newObject->scene = scene;
- newObject->icon = icon;
-
- newObjectIndex = _inventory.size();
-
- _inventory.push_back(newObject);
-
- if (scene == BACKPACK)
- addToBackpack(newObjectIndex);
-}
-
-void Inventory::moveObject(char* name, int32 scene) {
- uint i = 0;
-
- for (i = 0; i < _inventory.size(); i++) {
- if (!scumm_stricmp(_inventory[i]->name, name)) {
- if (_inventory[i]->scene == BACKPACK && scene != BACKPACK)
- removeFromBackpack(i);
-
- _inventory[i]->scene = scene;
-
- if (scene == BACKPACK)
- addToBackpack(i);
-
- return;
- }
- }
-}
-
-void Inventory::addToBackpack(uint32 objectIndex) {
- _m4Vm->scene()->getInterface()->inventoryAdd(_inventory[objectIndex]->name, "", _inventory[objectIndex]->icon);
-}
-
-void Inventory::removeFromBackpack(uint32 objectIndex) {
- _m4Vm->scene()->getInterface()->inventoryRemove(_inventory[objectIndex]->name);
-}
-
-bool Inventory::isInCurrentScene(char* name) {
- return (getScene(name) == _vm->_scene->getCurrentScene());
-}
-
-int Inventory::getScene(char* name) {
- uint i = 0;
-
- for (i = 0; i < _inventory.size(); i++) {
- if (!scumm_stricmp(_inventory[i]->name, name))
- return _inventory[i]->scene;
- }
- return UNKNOWN_OBJECT;
-}
-
-int Inventory::getIcon(char* name) {
- uint i = 0;
-
- for (i = 0; i < _inventory.size(); i++) {
- if (!scumm_stricmp(_inventory[i]->name, name))
- return _inventory[i]->icon;
- }
- return UNKNOWN_OBJECT;
-}
-
-int Inventory::getIndex(char* name) {
- uint i = 0;
-
- for (i = 0; i < _inventory.size(); i++) {
- if (!scumm_stricmp(_inventory[i]->name, name))
- return i;
- }
- return UNKNOWN_OBJECT;
-}
-
-void Inventory::clear() {
- for (uint i = 0; i < _inventory.size(); i++) {
- delete _inventory[i]->name;
- delete _inventory[i];
- _inventory.remove_at(i);
- }
-}
-
-} // End of namespace M4
diff --git a/engines/m4/actor.h b/engines/m4/actor.h
deleted file mode 100644
index e28c522df8..0000000000
--- a/engines/m4/actor.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* 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 M4_ACTOR_H
-#define M4_ACTOR_H
-
-#include "common/array.h"
-
-#include "m4/m4.h"
-#include "m4/scene.h"
-#include "m4/graphics.h"
-#include "m4/assets.h"
-
-namespace M4 {
-
-struct InventoryObject {
- const char* name;
- int32 scene;
- int32 icon;
-};
-
-enum inventoryObjectFlags {
- UNKNOWN_OBJECT = 997,
- BACKPACK = 998,
- NOWHERE = 999
-};
-
-enum WalkerDirection {
- kFacingNorth = 1, // has shadow
- kFacingNorthEast = 2, // has shadow
- kFacingEast = 3, // has shadow
- kFacingSouthEast = 4, // has shadow
- kFacingSouth = 5, // has shadow
- // 6 is unused
- kFacingSouthAlt = 7, // no shadow
- kFacingSouthWest = 8, // no shadow
- kFacingWest = 9 // no shadow
-};
-
-class Actor {
-public:
- Actor(MadsM4Engine *vm);
- ~Actor();
- void placeWalkerSpriteAt(int spriteNum, int x, int y);
- void setWalkerScaling(int scaling) { _scaling = scaling; }
- int getWalkerScaling() { return _scaling; }
- void setWalkerDirection(uint8 direction) { _direction = direction; }
- uint8 getWalkerDirection() { return _direction; }
- void setWalkerPalette();
- int getWalkerWidth();
- int getWalkerHeight();
-private:
- MadsM4Engine *_vm;
- int _scaling;
- uint8 _direction;
- Common::Array<SpriteAsset*> _walkerSprites;
-
- void loadWalkers();
- void loadWalkerDirection(uint8 direction);
- void unloadWalkers();
-};
-
-// TODO: perhaps the inventory and its view could be merged?
-// TODO: the original game capitalizes all inventory object names
-// internally, which we do as well, but perhaps we could make sure
-// that all object names are parsed with the same case and avoid
-// case-insensitive string comparing through scumm_stricmp, using
-// the normal strcmp method instead
-class Inventory {
-public:
- Inventory(MadsM4Engine *vm);
- ~Inventory();
- void clear();
- void registerObject(char* name, int32 scene, int32 icon);
- void moveObject(char* name, int32 scene);
- void giveToPlayer(char* name) { moveObject(name, BACKPACK); }
- void addToBackpack(uint32 objectIndex);
- void removeFromBackpack(uint32 objectIndex);
- bool isInBackpack(char* name) { return (getScene(name) == BACKPACK); }
- bool isInScene(char* name, int32 scene) { return (getScene(name) == scene); }
- bool isInCurrentScene(char* name);
- int getScene(char* name);
- int getIcon(char* name);
- int getIndex(char* name);
- int getTotalItems() { return _inventory.size(); }
-
-private:
- MadsM4Engine *_vm;
- Common::Array<InventoryObject *> _inventory;
-};
-
-} // End of namespace M4
-
-
-#endif
diff --git a/engines/m4/animation.cpp b/engines/m4/animation.cpp
deleted file mode 100644
index 4f315dd396..0000000000
--- a/engines/m4/animation.cpp
+++ /dev/null
@@ -1,535 +0,0 @@
-/* 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/textconsole.h"
-
-#include "m4/assets.h"
-#include "m4/animation.h"
-#include "m4/compression.h"
-#include "m4/mads_scene.h"
-
-namespace M4 {
-
-// TODO: this code needs cleanup
-
-MadsAnimation::MadsAnimation(MadsM4Engine *vm, MadsView *view): Animation(vm), _view(view) {
- _font = NULL;
- _resetFlag = false;
- _freeFlag = false;
- _skipLoad = false;
- _unkIndex = -1;
- _messageCtr= 0;
- _field12 = 0;
-
- _currentFrame = 0;
- _oldFrameEntry = 0;
- _nextFrameTimer = _madsVm->_currentTimer;
- _nextScrollTimer = 0;
-}
-
-MadsAnimation::~MadsAnimation() {
- for (uint i = 0; i < _messages.size(); ++i) {
- if (_messages[i].kernelMsgIndex >= 0)
- _view->_kernelMessages.remove(_messages[i].kernelMsgIndex);
- }
-
- // Further deletion logic
- if (_field12) {
- _view->_spriteSlots.deleteSprites(_spriteListIndexes[_spriteListIndex]);
- }
-}
-
-#define FILENAME_SIZE 13
-
-/**
- * Initializes and loads the data of an animation
- */
-void MadsAnimation::initialize(const Common::String &filename, uint16 flags, M4Surface *surface, M4Surface *depthSurface) {
- MadsPack anim(filename.c_str(), _vm);
- bool madsRes = filename[0] == '*';
- char buffer[20];
- int streamIndex = 1;
-
- // Chunk 1: header
- // header
-
- Common::SeekableReadStream *animStream = anim.getItemStream(0);
-
- int spriteListCount = animStream->readUint16LE();
- int miscEntriesCount = animStream->readUint16LE();
- int frameEntryCount = animStream->readUint16LE();
- int messagesCount = animStream->readUint16LE();
- animStream->skip(1);
- _flags = animStream->readByte();
-
- animStream->skip(2);
- _animMode = animStream->readUint16LE();
- _roomNumber = animStream->readUint16LE();
- animStream->skip(2);
- _field12 = animStream->readUint16LE() != 0;
- _spriteListIndex = animStream->readUint16LE();
- _scrollX = animStream->readSint16LE();
- _scrollY = animStream->readSint16LE();
- _scrollTicks = animStream->readUint16LE();
- animStream->skip(8);
-
- animStream->read(buffer, FILENAME_SIZE);
- buffer[FILENAME_SIZE] = '\0';
- _interfaceFile = Common::String(buffer);
-
- for (int i = 0; i < 10; ++i) {
- animStream->read(buffer, FILENAME_SIZE);
- buffer[FILENAME_SIZE] = '\0';
- _spriteSetNames[i] = Common::String(buffer);
- }
-
- animStream->skip(81);
- animStream->read(buffer, FILENAME_SIZE);
- buffer[FILENAME_SIZE] = '\0';
- _lbmFilename = Common::String(buffer);
-
- animStream->skip(365);
- animStream->read(buffer, FILENAME_SIZE);
- buffer[FILENAME_SIZE] = '\0';
- _spritesFilename = Common::String(buffer);
-
- animStream->skip(48);
- animStream->read(buffer, FILENAME_SIZE);
- buffer[FILENAME_SIZE] = '\0';
- _soundName = Common::String(buffer);
-
- animStream->skip(13);
- animStream->read(buffer, FILENAME_SIZE);
- buffer[FILENAME_SIZE] = '\0';
- _dsrName = Common::String(buffer);
-
- animStream->read(buffer, FILENAME_SIZE);
- buffer[FILENAME_SIZE] = '\0';
- Common::String fontResource(buffer);
-
- if (_animMode == 4)
- flags |= 0x4000;
- if (flags & 0x100)
- loadInterface(surface, depthSurface);
-
- // Initialize the reference list
- for (int i = 0; i < spriteListCount; ++i)
- _spriteListIndexes.push_back(-1);
-
- delete animStream;
-
- if (messagesCount > 0) {
- // Chunk 2
- // Following is a list of any messages for the animation
-
- animStream = anim.getItemStream(streamIndex++);
-
- for (int i = 0; i < messagesCount; ++i) {
- AnimMessage rec;
- rec.soundId = animStream->readSint16LE();
- animStream->read(rec.msg, 64);
- animStream->skip(4);
- rec.pos.x = animStream->readSint16LE();
- rec.pos.y = animStream->readSint16LE();
- rec.flags = animStream->readUint16LE();
- rec.rgb1.r = animStream->readByte() << 2;
- rec.rgb1.g = animStream->readByte() << 2;
- rec.rgb1.b = animStream->readByte() << 2;
- rec.rgb2.r = animStream->readByte() << 2;
- rec.rgb2.g = animStream->readByte() << 2;
- rec.rgb2.b = animStream->readByte() << 2;
- animStream->skip(2); // Space for kernelMsgIndex
- rec.kernelMsgIndex = -1;
- animStream->skip(6);
- rec.startFrame = animStream->readUint16LE();
- rec.endFrame = animStream->readUint16LE();
- animStream->skip(2);
-
- _messages.push_back(rec);
- }
-
- delete animStream;
- }
-
- if (frameEntryCount > 0) {
- // Chunk 3: animation frame info
- animStream = anim.getItemStream(streamIndex++);
-
- for (int i = 0; i < frameEntryCount; i++) {
- AnimFrameEntry rec;
- rec.frameNumber = animStream->readUint16LE();
- rec.seqIndex = animStream->readByte();
- rec.spriteSlot.spriteListIndex = animStream->readByte();
- rec.spriteSlot.frameNumber = animStream->readUint16LE();
- rec.spriteSlot.xp = animStream->readSint16LE();
- rec.spriteSlot.yp = animStream->readSint16LE();
- rec.spriteSlot.depth = animStream->readSByte();
- rec.spriteSlot.scale = (int8)animStream->readByte();
-
- _frameEntries.push_back(rec);
- }
-
- delete animStream;
- }
-
- if (miscEntriesCount > 0) {
- // Chunk 4: Misc Data
- animStream = anim.getItemStream(streamIndex);
-
- for (int i = 0; i < miscEntriesCount; ++i) {
- AnimMiscEntry rec;
- rec.soundNum = animStream->readByte();
- rec.msgIndex = animStream->readSByte();
- rec.numTicks = animStream->readUint16LE();
- rec.posAdjust.x = animStream->readUint16LE();
- rec.posAdjust.y = animStream->readUint16LE();
- animStream->readUint16LE();
-
- _miscEntries.push_back(rec);
- }
-
- delete animStream;
- }
-
- // If the animation specifies a font, then load it for access
- if (_flags & ANIM_CUSTOM_FONT) {
- Common::String fontName;
- if (madsRes)
- fontName += "*";
- fontName += fontResource;
-
- if (fontName != "")
- _font = _vm->_font->getFont(fontName.c_str());
- else
- warning("Attempted to set a font with an empty name");
- }
-
- // If a speech file is specified, then load it
- if (!_dsrName.empty())
- _vm->_sound->loadDSRFile(_dsrName.c_str());
-
- // Load all the sprite sets for the animation
- for (int i = 0; i < spriteListCount; ++i) {
- if (_field12 && (i == _spriteListIndex))
- // Skip over field, since it's manually loaded
- continue;
-
- _spriteListIndexes[i] = _view->_spriteSlots.addSprites(_spriteSetNames[i].c_str());
- }
-
-
- if (_field12) {
- Common::String resName;
- if (madsRes)
- resName += "*";
- resName += _spriteSetNames[_spriteListIndex];
-
- _spriteListIndexes[_spriteListIndex] = _view->_spriteSlots.addSprites(resName.c_str());
- }
-
- // TODO: Unknown section about handling sprite set list combined with messages size
-
- // TODO: The original has two separate loops for the loop below based on _animMode == 4. Is it
- // perhaps that in that mode the sprite frames has a different format..?
-
- // Remap the sprite list index fields from the initial value to the indexes of the loaded
- // sprite sets for the animation
- for (uint i = 0; i < _frameEntries.size(); ++i) {
- int idx = _frameEntries[i].spriteSlot.spriteListIndex;
- _frameEntries[i].spriteSlot.spriteListIndex = _spriteListIndexes[idx];
- }
-
- if (hasScroll())
- _nextScrollTimer = _madsVm->_currentTimer + _scrollTicks;
-}
-
-/**
- * Loads an animation file for display
- */
-void MadsAnimation::load(const Common::String &filename, int abortTimers) {
- initialize(filename, 0, NULL, NULL);
- _messageCtr = 0;
- _skipLoad = true;
-
-/* TODO: figure out extra stuff in this routine
- if (_field12) {
- _unkIndex = -1;
- int listIndex = _spriteListIndexes[_spriteListIndex];
- SpriteAsset &spriteSet = _view->_spriteSlots.getSprite(listIndex);
- ..?..
- }
-*/
-
- // Initialize miscellaneous fields
- _currentFrame = 0;
- _oldFrameEntry = 0;
- _nextFrameTimer = _madsVm->_currentTimer;
- _abortTimers = abortTimers;
- _abortMode = _madsVm->scene()->_abortTimersMode2;
-
- if (_madsVm->_scene)
- _actionNouns = _madsVm->scene()->_action._action;
-
- // Initialize kernel message list
- for (uint i = 0; i < _messages.size(); ++i)
- _messages[i].kernelMsgIndex = -1;
-}
-
-void MadsAnimation::update() {
- if (_field12) {
- int spriteListIndex = _spriteListIndexes[_spriteListIndex];
- int newIndex = -1;
-
- for (uint idx = _oldFrameEntry; idx < _frameEntries.size(); ++idx) {
- if (_frameEntries[idx].frameNumber > _currentFrame)
- break;
- if (_frameEntries[idx].spriteSlot.spriteListIndex == spriteListIndex)
- newIndex = _frameEntries[idx].spriteSlot.frameNumber;
- }
-
- if (newIndex >= 0)
- load1(newIndex);
- }
-
- // Check for scroll change
- bool screenChanged = false;
-
- // Handle any scrolling of the screen surface
- if (hasScroll() && (_madsVm->_currentTimer >= _nextScrollTimer)) {
- _view->_bgSurface->scrollX(_scrollX);
- _view->_bgSurface->scrollY(_scrollY);
-
- _nextScrollTimer = _madsVm->_currentTimer + _scrollTicks;
- screenChanged = true;
- }
-
- // If it's not time for the next frame, then exit
- if (_madsVm->_currentTimer < _nextFrameTimer) {
- if (screenChanged)
- _view->_spriteSlots.fullRefresh();
- return;
- }
-
- // Loop checks for any prior animation sprite slots to be expired
- for (int slotIndex = 0; slotIndex < _view->_spriteSlots.startIndex; ++slotIndex) {
- if (_view->_spriteSlots[slotIndex].seqIndex >= 0x80) {
- // Flag the frame as animation sprite slot
- _view->_spriteSlots[slotIndex].spriteType = EXPIRED_SPRITE;
- }
- }
-
- // Validate the current frame
- if (_currentFrame >= (int)_miscEntries.size()) {
- // Is the animation allowed to be repeated?
- if (_resetFlag) {
- _currentFrame = 0;
- _oldFrameEntry = 0;
- } else {
- _freeFlag = true;
- return;
- }
- }
-
- // Handle starting any sound for this frame
- AnimMiscEntry &misc = _miscEntries[_currentFrame];
- if (misc.soundNum)
- _vm->_sound->playSound(misc.soundNum);
-
- // Handle any offset adjustment for sprites as of this frame
- if (_view->_posAdjust.x != misc.posAdjust.x) {
- _view->_posAdjust.x = misc.posAdjust.x;
- screenChanged = true;
- }
- if (_view->_posAdjust.y != misc.posAdjust.y) {
- _view->_posAdjust.y = misc.posAdjust.y;
- screenChanged = true;
- }
-
-
- if (screenChanged) {
- // Signal the entire screen needs refreshing
- _view->_spriteSlots.fullRefresh();
- }
-
- int spriteSlotsMax = _view->_spriteSlots.startIndex;
-
- // Main frame animation loop - frames get animated by being placed, as necessary, into the
- // main sprite slot array
- while ((uint)_oldFrameEntry < _frameEntries.size()) {
- if (_frameEntries[_oldFrameEntry].frameNumber > _currentFrame)
- break;
- else if (_frameEntries[_oldFrameEntry].frameNumber == _currentFrame) {
- // Found the correct frame
- int spriteSlotIndex = 0;
- int index = 0;
-
- for (;;) {
- if ((spriteSlotIndex == 0) && (index < spriteSlotsMax)) {
- int seqIndex = _frameEntries[_oldFrameEntry].seqIndex - _view->_spriteSlots[index].seqIndex;
- if (seqIndex == 0x80) {
- if (_view->_spriteSlots[index] == _frameEntries[_oldFrameEntry].spriteSlot) {
- _view->_spriteSlots[index].spriteType = SPRITE_ZERO;
- spriteSlotIndex = -1;
- }
- }
- ++index;
- continue;
- }
-
- if (spriteSlotIndex == 0) {
- int slotIndex = _view->_spriteSlots.getIndex();
- MadsSpriteSlot &slot = _view->_spriteSlots[slotIndex];
- slot.copy(_frameEntries[_oldFrameEntry].spriteSlot);
- slot.seqIndex = _frameEntries[_oldFrameEntry].seqIndex + 0x80;
-
- SpriteAsset &spriteSet = _view->_spriteSlots.getSprite(
- _view->_spriteSlots[slotIndex].spriteListIndex);
- slot.spriteType = spriteSet.isBackground() ? BACKGROUND_SPRITE : FOREGROUND_SPRITE;
- }
- break;
- }
- }
-
- ++_oldFrameEntry;
- }
-
- // Handle the display of any messages
- for (uint idx = 0; idx < _messages.size(); ++idx) {
- if (_messages[idx].kernelMsgIndex >= 0) {
- // Handle currently active message
- if ((_currentFrame < _messages[idx].startFrame) || (_currentFrame > _messages[idx].endFrame)) {
- _view->_kernelMessages.remove(_messages[idx].kernelMsgIndex);
- _messages[idx].kernelMsgIndex = -1;
- --_messageCtr;
- }
- } else if ((_currentFrame >= _messages[idx].startFrame) && (_currentFrame <= _messages[idx].endFrame)) {
- // Start displaying the message
- AnimMessage &me = _messages[idx];
-
- // The color index to use is dependant on how many messages are currently on-screen
- uint8 colIndex;
- switch (_messageCtr) {
- case 1:
- colIndex = 252;
- break;
- case 2:
- colIndex = 16;
- break;
- default:
- colIndex = 250;
- break;
- }
-
- _vm->_palette->setEntry(colIndex, me.rgb1.r, me.rgb1.g, me.rgb1.b);
- _vm->_palette->setEntry(colIndex + 1, me.rgb2.r, me.rgb2.g, me.rgb2.b);
-
- // Add a kernel message to display the given text
- me.kernelMsgIndex = _view->_kernelMessages.add(me.pos, colIndex * 0x101 + 0x100, 0, 0, INDEFINITE_TIMEOUT, me.msg);
- assert(me.kernelMsgIndex >= 0);
-
- // Play the associated sound, if it exists
- if (me.soundId > 0)
- _vm->_sound->playDSRSound(me.soundId - 1, 255, false);
- ++_messageCtr;
- }
- }
-
- // Move to the next frame
- _currentFrame++;
- if (_currentFrame >= (int)_miscEntries.size()) {
- // Animation is complete
- if (_abortTimers != 0) {
- _view->_abortTimers = _abortTimers;
- _view->_abortTimersMode = _abortMode;
-
- if (_abortMode != ABORTMODE_1) {
- // Copy the noun list
- if (_madsVm->_scene)
- _madsVm->scene()->_action._action = _actionNouns;
- }
- }
- }
-
- int frameNum = MIN(_currentFrame, (int)_miscEntries.size() - 1);
- _nextFrameTimer = _madsVm->_currentTimer + _miscEntries[frameNum].numTicks;
-}
-
-void MadsAnimation::setCurrentFrame(int frameNumber) {
- _currentFrame = frameNumber;
- _oldFrameEntry = 0;
- _freeFlag = false;
-
- _nextScrollTimer = _nextFrameTimer = _madsVm->_currentTimer;
-}
-
-int MadsAnimation::getCurrentFrame() {
- return _currentFrame;
-}
-
-void MadsAnimation::load1(int frameNumber) {
- if (_skipLoad)
- return;
-
- Common::Point pt;
- int listIndex = _spriteListIndexes[_spriteListIndex];
- SpriteAsset &spriteSet = _view->_spriteSlots.getSprite(listIndex);
-
- if (_unkIndex < 0) {
- M4Surface *frame = spriteSet.getFrame(0);
- pt.x = frame->bounds().left;
- pt.y = frame->bounds().top;
- } else {
- pt.x = _unkList[_unkIndex].x;
- pt.y = _unkList[_unkIndex].y;
- _unkIndex = 1 - _unkIndex;
- }
-
- if (proc1(spriteSet, pt, frameNumber))
- error("proc1 failure");
-}
-
-bool MadsAnimation::proc1(SpriteAsset &spriteSet, const Common::Point &pt, int frameNumber) {
- return 0;
-}
-
-void MadsAnimation::loadInterface(M4Surface *&interfaceSurface, M4Surface *&depthSurface) {
- if (_animMode <= 2) {
- MadsSceneResources sceneResources;
- sceneResources.load(_roomNumber, _interfaceFile.c_str(), 0, depthSurface, interfaceSurface);
-
- } else if (_animMode == 4) {
- // Load a scene interface
- interfaceSurface->madsLoadInterface(_interfaceFile);
- } else {
- // This mode allocates two large surfaces for the animation
- // TODO: Are these ever properly freed?
-error("Anim mode %d - need to check free logic", _animMode);
- assert(!interfaceSurface);
- assert(!depthSurface);
- depthSurface = new M4Surface(MADS_SURFACE_WIDTH, MADS_SCREEN_HEIGHT);
- interfaceSurface = new M4Surface(MADS_SURFACE_WIDTH, MADS_SCREEN_HEIGHT);
- depthSurface->clear();
- interfaceSurface->clear();
- }
-}
-
-} // End of namespace M4
diff --git a/engines/m4/animation.h b/engines/m4/animation.h
deleted file mode 100644
index 68a2883241..0000000000
--- a/engines/m4/animation.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/* 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 M4_ANIMATION_H
-#define M4_ANIMATION_H
-
-#include "m4/m4.h"
-#include "m4/graphics.h"
-#include "m4/assets.h"
-#include "m4/mads_views.h"
-#include "common/array.h"
-
-namespace M4 {
-
-class MadsView;
-class SpriteSlotSubset;
-
-class AnimMessage {
-public:
- int16 soundId;
- char msg[64];
- Common::Point pos;
- RGB8 rgb1, rgb2;
- uint16 flags;
- int startFrame, endFrame;
- int kernelMsgIndex;
-};
-
-class AnimFrameEntry {
-public:
- int frameNumber;
- int seqIndex;
- SpriteSlotSubset spriteSlot;
-};
-
-class AnimMiscEntry {
-public:
- int soundNum;
- int msgIndex;
- int numTicks;
- Common::Point posAdjust;
-};
-
-#define ANIM_SPRITE_SET_SIZE 50
-
-enum MadsAnimationFlags {ANIM_CUSTOM_FONT = 0x20, ANIM_HAS_SOUND = 0x8000};
-
-class MadsAnimation: public Animation {
-private:
- MadsView *_view;
-
- int _spriteListCount;
- Common::Array<AnimMessage> _messages;
- Common::Array<AnimFrameEntry> _frameEntries;
- Common::Array<AnimMiscEntry> _miscEntries;
- Font *_font;
-
- uint8 _flags;
- int _animMode;
- int _roomNumber;
- bool _field12;
- int _spriteListIndex;
- int _scrollX;
- int _scrollY;
- int _scrollTicks;
- Common::String _interfaceFile;
- Common::String _spriteSetNames[10];
- Common::String _lbmFilename;
- Common::String _spritesFilename;
- Common::String _soundName;
- Common::String _dsrName;
- Common::Array<int> _spriteListIndexes;
-
- int _currentFrame, _oldFrameEntry;
- bool _resetFlag;
- bool _freeFlag;
- bool _skipLoad;
- int _unkIndex;
- Common::Point _unkList[2];
- uint32 _nextFrameTimer;
- uint32 _nextScrollTimer;
- int _messageCtr;
- int _abortTimers;
- AbortTimerMode _abortMode;
- ActionDetails _actionNouns;
-
- void load1(int frameNumber);
- bool proc1(SpriteAsset &spriteSet, const Common::Point &pt, int frameNumber);
- void loadInterface(M4Surface *&interfaceSurface, M4Surface *&depthSurface);
- bool hasScroll() const { return (_scrollX != 0) || (_scrollY != 0); }
-public:
- MadsAnimation(MadsM4Engine *vm, MadsView *view);
- virtual ~MadsAnimation();
-
- virtual void initialize(const Common::String &filename, uint16 flags, M4Surface *surface, M4Surface *depthSurface);
- virtual void load(const Common::String &filename, int abortTimers);
- virtual void update();
- virtual void setCurrentFrame(int frameNumber);
- virtual int getCurrentFrame();
-
- bool freeFlag() const { return _freeFlag; }
- bool getAnimMode() const { return _animMode; }
- int roomNumber() const { return _roomNumber; }
-};
-
-} // End of namespace M4
-
-#endif
diff --git a/engines/m4/assets.cpp b/engines/m4/assets.cpp
deleted file mode 100644
index d6cc71e133..0000000000
--- a/engines/m4/assets.cpp
+++ /dev/null
@@ -1,650 +0,0 @@
-/* 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 "m4/assets.h"
-#include "m4/globals.h"
-#include "m4/compression.h"
-#include "m4/graphics.h"
-
-#include "common/memstream.h"
-
-namespace M4 {
-
-BaseAsset::BaseAsset(MadsM4Engine *vm) : _vm(vm) {
-}
-
-BaseAsset::~BaseAsset() {
-}
-
-MachineAsset::MachineAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name) : BaseAsset(vm) {
- uint32 stateCount = stream->readUint32LE();
- for (uint32 curState = 0; curState < stateCount; curState++) {
- uint32 stateOffset = stream->readUint32LE();
- _stateTable.push_back(stateOffset);
- }
- _codeSize = size - 4 - 4 * stateCount;
- _code = new byte[_codeSize];
- stream->read(_code, _codeSize);
-}
-
-MachineAsset::~MachineAsset() {
- delete[] _code;
-}
-
-void MachineAsset::getCode(byte *&code, uint32 &codeSize) {
- code = _code;
- codeSize = _codeSize;
-}
-
-uint32 MachineAsset::getStateOffset(uint32 state) {
- assert(state < _stateTable.size());
- return _stateTable[state];
-}
-
-SequenceAsset::SequenceAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name) : BaseAsset(vm) {
- _localVarCount = stream->readUint32LE();
- _codeSize = size - 4;
- _code = new byte[_codeSize];
- stream->read(_code, _codeSize);
-}
-
-SequenceAsset::~SequenceAsset() {
- delete[] _code;
-}
-
-void SequenceAsset::getCode(byte *&code, uint32 &codeSize) {
- code = _code;
- codeSize = _codeSize;
-}
-
-
-DataAsset::DataAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name) : BaseAsset(vm) {
-
- _recCount = stream->readUint32LE();
- _recSize = stream->readUint32LE();
- _dataSize = _recCount * _recSize;
- _data = new long[_dataSize];
- for (uint32 i = 0; i < _dataSize; i++)
- _data[i] = (long)stream->readUint32LE();
-
-}
-
-DataAsset::~DataAsset() {
- delete _data;
-}
-
-long *DataAsset::getRow(int index) {
- assert(index < _recCount);
- return &_data[_recSize * index];
-}
-
-SpriteAsset::SpriteAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name,
- bool asStream, int flags) :
- BaseAsset(vm) {
- _stream = stream;
- _palInterface = NULL;
- _paletteData = NULL;
-
- if (_vm->isM4()) {
- loadM4SpriteAsset(vm, stream, asStream);
- } else {
- loadMadsSpriteAsset(vm, stream, flags);
- }
-}
-
-SpriteAsset::SpriteAsset(MadsM4Engine *vm, const char *name): BaseAsset(vm) {
- _stream = vm->res()->get(name);
- _palInterface = NULL;
- _paletteData = NULL;
-
- if (_vm->isM4()) {
- loadM4SpriteAsset(vm, _stream, true);
- } else {
- loadMadsSpriteAsset(vm, _stream, 0);
- }
-
- vm->res()->toss(name);
-}
-
-SpriteAsset::~SpriteAsset() {
- if (_palInterface) {
- // Internally stored palette translation data, so release it
- _palInterface->deleteRange(_paletteData);
- delete _paletteData;
- }
-
- // Delete the individual frames
- for (Common::Array<SpriteAssetFrame>::iterator it = _frames.begin(); it != _frames.end(); ++it) {
- delete (*it).frame;
- }
-
- delete _charInfo;
-}
-
-void SpriteAsset::loadM4SpriteAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, bool asStream) {
- bool isBigEndian = false;
- uint32 frameOffset;
-
- uint32 header = _stream->readUint32LE();
- if (header == HEAD_M4SS) {
- debugC(kDebugGraphics, "LE-encoded sprite\n");
- } else {
- debugC(kDebugGraphics, "BE-encoded sprite\n");
- isBigEndian = true;
- }
-
- _srcSize = parseSprite(isBigEndian);
-
- _stream->readUint32LE();
- _frameRate = (!isBigEndian) ? _stream->readUint32LE() : _stream->readUint32BE();
- _pixelSpeed = (!isBigEndian) ? _stream->readUint32LE() : _stream->readUint32BE();
- _maxWidth = (!isBigEndian) ? _stream->readUint32LE() : _stream->readUint32BE();
- _maxHeight = (!isBigEndian) ? _stream->readUint32LE() : _stream->readUint32BE();
- _stream->skip(6 * 4);
- _frameCount = (!isBigEndian) ? _stream->readUint32LE() : _stream->readUint32BE();
-
- debugC(kDebugGraphics, "SpriteAsset::SpriteAsset() srcSize = %d; frameRate = %04X; pixelSpeed = %04X; maxWidth = %d; maxHeight = %d; frameCount = %d\n", _srcSize, _frameRate, _pixelSpeed, _maxWidth, _maxHeight, _frameCount);
-
- for (int curFrame = 0; curFrame < _frameCount; curFrame++) {
- frameOffset = (!isBigEndian) ? _stream->readUint32LE() : _stream->readUint32BE();
- _frameOffsets.push_back(frameOffset);
- }
- _frameOffsets.push_back(_srcSize - 48 - _frameCount * 4);
-
- _frameStartOffset = _stream->pos();
-
- // We don't need to load frames when streaming
- if (asStream)
- return;
-
- for (int curFrame = 0; curFrame < _frameCount; curFrame++) {
- frameOffset = _frameStartOffset + _frameOffsets[curFrame];
- _stream->seek(frameOffset);
-
- SpriteAssetFrame frame;
- loadFrameHeader(frame, isBigEndian);
-
- // Load & unpack RLE data if it's not a streaming animation
- if (frame.stream != 1) {
-
- frame.frame = new M4Sprite(stream, frame.x, frame.y, frame.w, frame.h, true, frame.comp);
-#if 0
- char fn[512];
- sprintf(fn, "%04d.raw", curFrame);
- FILE *h = fopen(fn, "wb");
- fwrite((byte*)frame.frame->getBasePtr(), frame.w * frame.h, 1, h);
- fclose(h);
-#endif
- }
-
- _frames.push_back(frame);
-
- }
-
-}
-
-void SpriteAsset::loadMadsSpriteAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int flags) {
- int curFrame = 0;
- uint32 frameOffset = 0;
- MadsPack sprite(stream);
- _frameRate = 0;
- _pixelSpeed = 0;
- _maxWidth = 0;
- _maxHeight = 0;
-
- Common::SeekableReadStream *spriteStream = sprite.getItemStream(0);
- _mode = spriteStream->readByte();
- spriteStream->skip(1);
- int type1 = spriteStream->readUint16LE();
- int type2 = spriteStream->readUint16LE();
- _isBackground = (type1 != 0) && (type2 < 4);
- spriteStream->skip(32);
- _frameCount = spriteStream->readUint16LE();
-
- if (_vm->isM4() || ((flags & SPRITE_SET_CHAR_INFO) == 0))
- _charInfo = NULL;
- else
- _charInfo = new MadsSpriteSetCharInfo(spriteStream);
-
- delete spriteStream;
-
- // Get the palette data
- spriteStream = sprite.getItemStream(2);
- int numColors = 0;
- RGB8 *palData = Palette::decodeMadsPalette(spriteStream, &numColors);
- Common::copy(palData, &palData[numColors], &_palette[0]);
- if (numColors < 256)
- Common::set_to((byte *)&_palette[numColors], (byte *)&_palette[256], 0);
- _colorCount = numColors;
- delete[] palData;
- delete spriteStream;
-
- spriteStream = sprite.getItemStream(1);
- Common::SeekableReadStream *spriteDataStream = sprite.getItemStream(3);
- SpriteAssetFrame frame;
- Common::Array<int> frameSizes;
- for (curFrame = 0; curFrame < _frameCount; curFrame++) {
- frame.stream = 0;
- frame.comp = 0;
- frameOffset = spriteStream->readUint32LE();
- _frameOffsets.push_back(frameOffset);
- uint32 frameSize = spriteStream->readUint32LE();
- frameSizes.push_back(frameSize);
-
- frame.x = spriteStream->readUint16LE();
- frame.y = spriteStream->readUint16LE();
- frame.w = spriteStream->readUint16LE();
- frame.h = spriteStream->readUint16LE();
- if (curFrame == 0)
- debugC(1, kDebugGraphics, "%i frames, x = %i, y = %i, w = %i, h = %i\n", _frameCount, frame.x, frame.y, frame.w, frame.h);
-
- if (_mode == 0) {
- // Create a frame and decompress the raw pixel data
- uint32 currPos = (uint32)spriteDataStream->pos();
- frame.frame = new M4Sprite(spriteDataStream, frame.x, frame.y, frame.w, frame.h, false);
- assert((uint32)spriteDataStream->pos() == (currPos + frameSize));
- }
-
- _frames.push_back(frame);
- }
-
- if (_mode != 0) {
- // Handle decompressing Fab encoded data
- for (curFrame = 0; curFrame < _frameCount; curFrame++) {
- FabDecompressor fab;
-
- int srcSize = (curFrame == (_frameCount - 1)) ? spriteDataStream->size() - _frameOffsets[curFrame] :
- _frameOffsets[curFrame + 1] - _frameOffsets[curFrame];
- byte *srcData = (byte *)malloc(srcSize);
- assert(srcData);
- spriteDataStream->read(srcData, srcSize);
-
- byte *destData = (byte *)malloc(frameSizes[curFrame]);
- assert(destData);
-
- fab.decompress(srcData, srcSize, destData, frameSizes[curFrame]);
-
- // Load the frame
- Common::MemoryReadStream *rs = new Common::MemoryReadStream(destData, frameSizes[curFrame]);
- _frames[curFrame].frame = new M4Sprite(rs, _frames[curFrame].x, _frames[curFrame].y,
- _frames[curFrame].w, _frames[curFrame].h, false);
- delete rs;
-
- free(srcData);
- free(destData);
- }
- }
-
-
- delete spriteStream;
- delete spriteDataStream;
-}
-
-int32 SpriteAsset::parseSprite(bool isBigEndian) {
-
- uint32 format, chunkType, chunkSize = 0;
-
- _colorCount = 0;
-
- format = (!isBigEndian) ? _stream->readUint32LE() : _stream->readUint32BE();
-
- chunkType = (!isBigEndian) ? _stream->readUint32LE() : _stream->readUint32BE();
-
- if (chunkType == CELS__PAL) {
- chunkSize = (!isBigEndian) ? _stream->readUint32LE() : _stream->readUint32BE();
- uint32 numColors = (!isBigEndian) ? _stream->readUint32LE() : _stream->readUint32BE();
- // TODO
- //if (palette) {
- // TODO: A sprite set palette specifies the indexes, which need not start at
- // index 0. For now, I'm simply preloading the currently active palette
- // before starting to replace existing entries
-
- _vm->_palette->grabPalette((byte *) _palette, 0, 256);
- _colorCount = 0;
-
- for (uint32 i = 0; i < numColors; i++) {
- uint32 paletteEntry = (!isBigEndian) ? _stream->readUint32LE() : _stream->readUint32BE();
- uint index = (paletteEntry >> 24) & 0xFF;
-
- _palette[index].r = ((paletteEntry >> 16) & 0xFF) << 2;
- _palette[index].g = ((paletteEntry >> 8) & 0xFF) << 2;
- _palette[index].b = (paletteEntry & 0xFF) << 2;
-
- _colorCount = MAX<int>(_colorCount, index);
- }
-
- /*
- } else {
- stream.seek(colorCount, )
- data += colorCount * 4;
- }
- */
- chunkType = (!isBigEndian) ? _stream->readUint32LE() : _stream->readUint32BE();
- }
-
- if (chunkType == CELS___SS) {
- chunkSize = (!isBigEndian) ? _stream->readUint32LE() : _stream->readUint32BE();
- } else {
- debugC(kDebugGraphics, "SpriteAsset::parseSprite() Expected chunk type %08X, got %08X", CELS___SS, chunkType);
- }
-
- return chunkSize;
-
-}
-
-void SpriteAsset::loadFrameHeader(SpriteAssetFrame &frameHeader, bool isBigEndian) {
- _stream->readUint32LE();
- frameHeader.stream = (!isBigEndian) ? _stream->readUint32LE() : _stream->readUint32BE();
- frameHeader.x = (!isBigEndian) ? _stream->readUint32LE() : _stream->readUint32BE();
- frameHeader.y = (!isBigEndian) ? _stream->readUint32LE() : _stream->readUint32BE();
- frameHeader.w = (!isBigEndian) ? _stream->readUint32LE() : _stream->readUint32BE();
- frameHeader.h = (!isBigEndian) ? _stream->readUint32LE() : _stream->readUint32BE();
- frameHeader.comp = (!isBigEndian) ? _stream->readUint32LE() : _stream->readUint32BE();
- frameHeader.frame = NULL;
- _stream->seek(8 * 4, SEEK_CUR);
- //debugC(kDebugGraphics, "SpriteAsset::loadFrameHeader() stream = %d; x = %d; y = %d; w = %d; h = %d; comp = %d\n", frameHeader.stream, frameHeader.x, frameHeader.y, frameHeader.w, frameHeader.h, frameHeader.comp);
-}
-
-M4Sprite *SpriteAsset::getFrame(int frameIndex) {
- if ((uint)frameIndex < _frames.size()) {
- return _frames[frameIndex].frame;
- } else {
- debugC(kDebugGraphics, "SpriteAsset::getFrame: Invalid frame %d, out of %d", frameIndex, _frames.size());
- return _frames[_frames.size() - 1].frame;
- }
-}
-
-void SpriteAsset::loadStreamingFrame(M4Sprite *frame, int frameIndex, int destX, int destY) {
- uint32 frameOffset = _frameStartOffset + _frameOffsets[frameIndex];
- _stream->seek(frameOffset);
-
- SpriteAssetFrame frameHeader;
- loadFrameHeader(frameHeader);
-
- if (frameHeader.w > 0 && frameHeader.h > 0) {
- Common::SeekableReadStream *frameData = _stream->readStream(getFrameSize(frameIndex));
- if (frameHeader.stream) {
- frame->loadDeltaRle(frameData, destX - frameHeader.x, destY - frameHeader.y);
- } else {
- frame->loadRle(frameData);
- }
- delete frameData;
- }
-
-}
-
-RGBList *SpriteAsset::getRgbList() {
- RGBList *result = new RGBList(_colorCount);
- Common::copy((byte *)&_palette[0], (byte *)&_palette[_colorCount], (byte *)result->data());
- return result;
-}
-
-void SpriteAsset::translate(RGBList *list, bool isTransparent) {
- for (int frameIndex = 0; frameIndex < _frameCount; ++frameIndex)
- _frames[frameIndex].frame->translate(list, isTransparent);
-}
-
-void SpriteAsset::translate(Palette *palette) {
- _palInterface = palette;
- _paletteData = this->getRgbList();
- palette->addRange(_paletteData);
- this->translate(_paletteData, true);
-}
-
-
-int32 SpriteAsset::getFrameSize(int index) {
- /*
- if (index + 1 == _frameCount) {
- } else {
-
- }
- */
- return _frameOffsets[index + 1] - _frameOffsets[index];
-}
-
-AssetManager::AssetManager(MadsM4Engine *vm) {
-
- _vm = vm;
-
- /* Initialize asset arrays */
- for (int i = 0; i < 256; i++) {
- _MACH[i] = NULL;
- _SEQU[i] = NULL;
- _DATA[i] = NULL;
- _CELS[i] = NULL;
- }
-
-}
-
-AssetManager::~AssetManager() {
- // unload all remaining assets
- clearAssets(kAssetTypeMACH, 0, 255);
- clearAssets(kAssetTypeSEQU, 0, 255);
- clearAssets(kAssetTypeCELS, 0, 255);
- clearAssets(kAssetTypeDATA, 0, 255);
-}
-
-bool AssetManager::clearAssets(AssetType assetType, int32 minHash, int32 maxHash) {
-
- minHash = MAX<int>(0, minHash);
- maxHash = MIN<int>(maxHash, 255);
-
- switch (assetType) {
- case kAssetTypeMACH:
- for (int i = minHash; i <= maxHash; i++)
- if (_MACH[i]) {
- delete _MACH[i];
- _MACH[i] = NULL;
- }
- break;
- case kAssetTypeSEQU:
- for (int i = minHash; i <= maxHash; i++)
- if (_SEQU[i]) {
- delete _SEQU[i];
- _SEQU[i] = NULL;
- }
- break;
- case kAssetTypeDATA:
- for (int i = minHash; i <= maxHash; i++)
- if (_DATA[i]) {
- delete _DATA[i];
- _DATA[i] = NULL;
- }
- break;
- case kAssetTypeCELS:
- for (int i = minHash; i <= maxHash; i++)
- if (_CELS[i]) {
- delete _CELS[i];
- _CELS[i] = NULL;
- }
- break;
- }
-
- // FIXME: no value is returned, returning true for now
- return true;
-}
-
-bool AssetManager::loadAsset(const char *assetName, RGB8 *palette) {
-
- debugC(kDebugGraphics, "AssetManager::loadAsset() %s\n", assetName);
-
- // TODO, better use MemoryReadStreamEndian?
- //convertAssetToLE(assetData, assetSize);
-
- Common::SeekableReadStream *assetS = _vm->res()->get(assetName);
-
- while (assetS->pos() + 12 < assetS->size()) {
- uint32 chunkType, chunkSize, chunkHash;
-
- chunkType = assetS->readUint32LE();
- chunkSize = assetS->readUint32LE() - 12; // sub 12 for the chunk header
- chunkHash = assetS->readUint32LE();
-
- debugC(kDebugGraphics, "hash = %d\n", chunkHash);
-
- // Until loading code is complete, so that chunks not fully read are skipped correctly
- uint32 nextOfs = assetS->pos() + chunkSize;
-
- switch (chunkType) {
- case CHUNK_MACH:
- debugC(kDebugGraphics, "MACH\n");
- clearAssets(kAssetTypeMACH, chunkHash, chunkHash);
- _MACH[chunkHash] = new MachineAsset(_vm, assetS, chunkSize, assetName);
- break;
- case CHUNK_SEQU:
- debugC(kDebugGraphics, "SEQU\n");
- clearAssets(kAssetTypeSEQU, chunkHash, chunkHash);
- _SEQU[chunkHash] = new SequenceAsset(_vm, assetS, chunkSize, assetName);
- break;
- case CHUNK_DATA:
- debugC(kDebugGraphics, "DATA\n");
- clearAssets(kAssetTypeDATA, chunkHash, chunkHash);
- _DATA[chunkHash] = new DataAsset(_vm, assetS, chunkSize, assetName);
- break;
- case CHUNK_CELS:
- debugC(kDebugGraphics, "CELS\n");
- clearAssets(kAssetTypeCELS, chunkHash, chunkHash);
- _CELS[chunkHash] = new SpriteAsset(_vm, assetS, chunkSize, assetName);
- break;
- default:
- debugC(kDebugGraphics, "AssetManager::loadAsset() Unknown chunk type %08X\n", chunkType);
- }
-
- // Until loading code is complete (see above)
- assetS->seek(nextOfs);
-
- }
-
- _vm->res()->toss(assetName);
-
- // FIXME: no value is returned, returning true for now
- return true;
-}
-
-int32 AssetManager::addSpriteAsset(const char *assetName, int32 hash, RGB8 *palette) {
-
- bool alreadyLoaded = false;
-
- if (hash < 0) {
- for (int i = 0; i <= 255; i++) {
- if (_CELS[i] != NULL) {
- if (_CELS[i]->getName() == assetName) {
- alreadyLoaded = true;
- hash = i;
- break;
- }
- } else {
- hash = i;
- break;
- }
- }
- } else {
- alreadyLoaded = _CELS[hash] != NULL && _CELS[hash]->getName() == assetName;
- }
-
- /* Not loaded and no empty slots */
- if (hash < 0)
- return -1;
-
- if (!alreadyLoaded) {
-
- debugC(kDebugGraphics, "AssetManager::addSpriteAsset() asset %s not loaded, loading into %d\n", assetName, hash);
-
- clearAssets(kAssetTypeCELS, hash, hash);
-
- Common::SeekableReadStream *assetS = _vm->res()->get(assetName);
- _CELS[hash] = new SpriteAsset(_vm, assetS, assetS->size(), assetName);
- _vm->res()->toss(assetName);
-
- } else {
-
- debugC(kDebugGraphics, "AssetManager::addSpriteAsset() asset %s already loaded in %d\n", assetName, hash);
-
- /* TODO/FIXME
- if (_CELS[hash].palOffset >= 0 && palette)
- restorePalette(palette, _CELS[hash].data + _CELS[hash].palOffset);
- */
-
- }
-
- return hash;
-
-}
-
-void AssetManager::restorePalette(RGB8 *palette, byte *data) {
- // TODO
-}
-
-void AssetManager::convertAssetToLE(byte *assetData, uint32 assetSize) {
-
-}
-
-MachineAsset *AssetManager::getMachine(int32 hash) {
- assert(_MACH[hash] != NULL);
- return _MACH[hash];
-}
-
-SequenceAsset *AssetManager::getSequence(int32 hash) {
- assert(_SEQU[hash] != NULL);
- return _SEQU[hash];
-}
-
-DataAsset *AssetManager::getData(int32 hash) {
- assert(_DATA[hash] != NULL);
- return _DATA[hash];
-}
-
-SpriteAsset *AssetManager::getSprite(int32 hash) {
- assert(_CELS[hash] != NULL);
- return _CELS[hash];
-}
-
-M4Sprite *AssetManager::getSpriteFrame(int32 hash, int frameIndex) {
- assert(_CELS[hash] != NULL);
- return _CELS[hash]->getFrame(frameIndex);
-}
-
-int32 AssetManager::getSpriteFrameCount(int32 hash) {
- assert(_CELS[hash] != NULL);
- return _CELS[hash]->getCount();
-}
-
-//--------------------------------------------------------------------------
-
-MadsSpriteSetCharInfo::MadsSpriteSetCharInfo(Common::SeekableReadStream *s) {
- _totalFrames = s->readByte();
- s->skip(1);
- _numEntries = s->readUint16LE();
-
- for (int i = 0; i < 16; ++i)
- _frameList[i] = s->readUint16LE();
- for (int i = 0; i < 16; ++i)
- _frameList2[i] = s->readUint16LE();
- for (int i = 0; i < 16; ++i)
- _ticksList[i] = s->readUint16LE();
-
- _unk1 = s->readUint16LE();
- _ticksAmount = s->readByte();
- _yScale = s->readByte();
-}
-
-} // End of namespace M4
diff --git a/engines/m4/assets.h b/engines/m4/assets.h
deleted file mode 100644
index 25996a421e..0000000000
--- a/engines/m4/assets.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/* 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 M4_ASSETS_H
-#define M4_ASSETS_H
-
-#include "common/scummsys.h"
-#include "common/stream.h"
-
-#include "m4/sprite.h"
-
-namespace M4 {
-
-// Sequence chunks
-#define CHUNK_SCEN MKTAG('S','C','E','N')
-#define CHUNK_MACH MKTAG('M','A','C','H')
-#define CHUNK_SEQU MKTAG('S','E','Q','U')
-#define CHUNK_DATA MKTAG('D','A','T','A')
-#define CHUNK_CELS MKTAG('C','E','L','S')
-
-// Sprite chunks
-#define HEAD_M4SS MKTAG('M','4','S','S') //'M4SS'
-#define CELS__PAL MKTAG(' ','P','A','L') //' PAL'
-#define CELS___SS MKTAG(' ',' ','S','S') //' SS'
-
-#define SPRITE_SET_CHAR_INFO 4
-
-class MadsM4Engine;
-class Palette;
-
-class BaseAsset {
-public:
- BaseAsset(MadsM4Engine *vm);
- ~BaseAsset();
- const Common::String getName() const { return _name; }
-protected:
- MadsM4Engine *_vm;
- Common::String _name;
-};
-
-class MachineAsset : public BaseAsset {
-public:
- MachineAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name);
- ~MachineAsset();
- void getCode(byte *&code, uint32 &codeSize);
- uint32 getStateOffset(uint32 state);
-protected:
- Common::Array<uint32> _stateTable;
- byte *_code;
- uint32 _codeSize;
-};
-
-class SequenceAsset : public BaseAsset {
-public:
- SequenceAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name);
- ~SequenceAsset();
- void getCode(byte *&code, uint32 &codeSize);
- int localVarCount() const { return _localVarCount; }
-protected:
- int _localVarCount;
- byte *_code;
- uint32 _codeSize;
-};
-
-class DataAsset : public BaseAsset {
-public:
- DataAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name);
- ~DataAsset();
- int getCount() const { return _recCount; }
- long *getRow(int index);
-protected:
- long *_data;
- uint32 _recSize, _dataSize;
- int _recCount;
-};
-
-struct SpriteAssetFrame {
- uint32 stream;
- int x, y, w, h;
- uint32 comp;
- M4Sprite *frame;
-};
-
-class MadsSpriteSetCharInfo {
-public:
- MadsSpriteSetCharInfo(Common::SeekableReadStream *s);
-
- int _totalFrames;
- int _numEntries;
- int _frameList2[16];
- int _frameList[16];
- int _ticksList[16];
- int _unk1;
- int _ticksAmount;
- int _yScale;
-};
-
-class SpriteAsset : public BaseAsset {
-public:
- SpriteAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int size, const char *name,
- bool asStream = false, int flags = 0);
- SpriteAsset(MadsM4Engine *vm, const char *name);
- ~SpriteAsset();
- void loadM4SpriteAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, bool asStream);
- void loadMadsSpriteAsset(MadsM4Engine *vm, Common::SeekableReadStream* stream, int flags);
- int32 getCount() { return _frameCount; }
- int32 getFrameRate() const { return _frameRate; }
- int32 getPixelSpeed() const { return _pixelSpeed; }
- int32 getFrameWidth(int index);
- int32 getFrameHeight(int index);
- int32 getMaxFrameWidth() const { return _maxWidth; }
- int32 getMaxFrameHeight() const { return _maxHeight; }
- bool isBackground() const { return _isBackground; }
- M4Sprite *getFrame(int frameIndex);
- void loadStreamingFrame(M4Sprite *frame, int frameIndex, int destX, int destY);
- RGB8* getPalette() { return _palette; }
- int getColorCount() { return _colorCount; }
- RGBList *getRgbList();
- void translate(RGBList *list, bool isTransparent = false);
- void translate(Palette *palette);
- int32 getFrameSize(int index);
- M4Sprite *operator[](int index) { return getFrame(index); }
-public:
- MadsSpriteSetCharInfo *_charInfo;
-protected:
- Common::SeekableReadStream *_stream;
- RGB8 _palette[256];
- uint32 _colorCount;
- uint32 _srcSize;
- int32 _frameRate, _pixelSpeed;
- int _maxWidth, _maxHeight;
- int _frameCount;
- Common::Array<uint32> _frameOffsets;
- Common::Array<SpriteAssetFrame> _frames;
- uint32 _frameStartOffset;
-
- // MADS sprite set fields
- uint8 _mode;
- bool _isBackground;
-
- int32 parseSprite(bool isBigEndian = false);
- void loadFrameHeader(SpriteAssetFrame &frameHeader, bool isBigEndian = false);
-private:
- RGBList *_paletteData;
- Palette *_palInterface;
-};
-
-enum AssetType {
- kAssetTypeMACH,
- kAssetTypeSEQU,
- kAssetTypeDATA,
- kAssetTypeCELS
-};
-
-enum CallbackHandlers {
- kCallbackTriggerDispatch
-};
-
-class AssetManager {
-public:
-
- AssetManager(MadsM4Engine *vm);
- ~AssetManager();
-
- bool clearAssets(AssetType assetType, int32 minHash, int32 maxHash);
- bool loadAsset(const char *assetName, RGB8 *palette);
- int32 addSpriteAsset(const char *assetName, int32 hash, RGB8 *palette);
-
- // TODO: Move to Palette class
- void restorePalette(RGB8 *palette, byte *data);
-
- MachineAsset *getMachine(int32 hash);
- SequenceAsset *getSequence(int32 hash);
- DataAsset *getData(int32 hash);
- SpriteAsset *getSprite(int32 hash);
- M4Sprite *getSpriteFrame(int32 hash, int frameIndex);
- int32 getSpriteFrameCount(int32 hash);
-
-protected:
- // TODO: Check if we need _vm
- MadsM4Engine *_vm;
-
- MachineAsset *_MACH[256];
- SequenceAsset *_SEQU[256];
- DataAsset *_DATA[256];
- SpriteAsset *_CELS[256];
-
- void convertAssetToLE(byte *assetData, uint32 assetSize);
-
-};
-
-} // End of namespace M4
-
-#endif
diff --git a/engines/m4/burger_data.h b/engines/m4/burger_data.h
deleted file mode 100644
index d30e546023..0000000000
--- a/engines/m4/burger_data.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* 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 M4_BURGER_DATA_H
-#define M4_BURGER_DATA_H
-
-#include "m4/graphics.h"
-#include "m4/actor.h"
-
-namespace M4 {
-
-InventoryObject burger_inventory [] = {
- // name scene icon
- //-------------------- ----- -----
- { "empty jug", 303, 14 },
- { "distilled juice", 999, 15 },
- { "broken puz dispenser", 999, 16 },
- { "puz dispenser", 999, 17 },
- { "broken mouse trap", 999, 18 },
- { "mouse trap", 999, 19 },
- { "kindling", 999, 20 },
- { "burning kindling", 999, 21 },
- { "lights", 508, 22 },
- { "lights on", 508, 23 },
- { "bottle", 999, 24 },
- { "carrot juice", 999, 25 },
- { "soapy water", 999, 26 },
- { "iron filings", 999, 27 },
- { "waxed hair", 999, 28 },
- { "fish", 999, 29 },
- { "hook", 999, 30 },
- { "keys", 999, 31 },
- { "records", 999, 32 },
- { "collar", 999, 33 },
- { "amp", 999, 34 },
- { "rubber gloves", 999, 35 },
- { "sock", 504, 36 },
- { "jaws of life", 999, 37 },
- { "deed", 999, 38 },
- { "burger morsel", 999, 39 },
- { "whistle", 999, 40 },
- { "coin", 999, 41 },
- { "matches", 999, 42 },
- { "phone cord", 999, 43 },
- { "kibble", 602, 44 }, // picked up from tray
- { "pantyhose", 999, 45 },
- { "fan belt", 999, 46 },
- { "spring", 999, 47 },
- { "mirror", 999, 48 },
- { "grate", 999, 49 },
- { "ray gun", 604, 50 }, // given to Wilbur when he enters 604
- { "grasshoppers", 999, 51 },
- { "rolling pin", 999, 52 },
- { "rubber duck", 999, 53 },
- { "ladder", 999, 54 },
- { "money", 999, 55 },
- { "crow bar", 999, 56 },
- { "Wilbur", 999, 57 }
-};
-
-} // End of namespace M4
-
-#endif
diff --git a/engines/m4/compression.cpp b/engines/m4/compression.cpp
deleted file mode 100644
index 65a25c14e3..0000000000
--- a/engines/m4/compression.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-/* 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 "m4/compression.h"
-#include "m4/m4.h"
-
-#include "common/memstream.h"
-#include "common/textconsole.h"
-
-namespace M4 {
-
-const char *madsPackString = "MADSPACK";
-
-bool MadsPack::isCompressed(Common::SeekableReadStream *stream) {
- // Check whether the passed stream is packed
-
- char tempBuffer[8];
- stream->seek(0);
- if (stream->read(tempBuffer, 8) == 8) {
- if (!strncmp(tempBuffer, madsPackString, 8))
- return true;
- }
-
- return false;
-}
-
-MadsPack::MadsPack(Common::SeekableReadStream *stream) {
- initialize(stream);
-}
-
-MadsPack::MadsPack(const char *resourceName, MadsM4Engine* vm) {
- Common::SeekableReadStream *stream = vm->_resourceManager->get(resourceName);
- initialize(stream);
- vm->_resourceManager->toss(resourceName);
-}
-
-void MadsPack::initialize(Common::SeekableReadStream *stream) {
- if (!MadsPack::isCompressed(stream))
- error("Attempted to decompress a resource that was not MadsPacked");
-
- stream->seek(14);
- _count = stream->readUint16LE();
- _items = new MadsPackEntry[_count];
-
- byte *headerData = new byte[0xA0];
- byte *header = headerData;
- stream->read(headerData, 0xA0);
-
- for (int i = 0; i < _count; ++i, header += 10) {
- // Get header data
- _items[i].hash = READ_LE_UINT16(header);
- _items[i].size = READ_LE_UINT32(header + 2);
- _items[i].compressedSize = READ_LE_UINT32(header + 6);
-
- _items[i].data = new byte[_items[i].size];
- if (_items[i].size == _items[i].compressedSize) {
- // Entry isn't compressed
- stream->read(_items[i].data, _items[i].size);
- } else {
- // Decompress the entry
- byte *compressedData = new byte[_items[i].compressedSize];
- stream->read(compressedData, _items[i].compressedSize);
-
- FabDecompressor fab;
- fab.decompress(compressedData, _items[i].compressedSize, _items[i].data, _items[i].size);
- delete[] compressedData;
- }
- }
-
- delete[] headerData;
- _dataOffset = stream->pos();
-}
-
-Common::SeekableReadStream *MadsPack::getItemStream(int index) {
- return new Common::MemoryReadStream(_items[index].data, _items[index].size, DisposeAfterUse::NO);
-}
-
-MadsPack::~MadsPack() {
- for (int i = 0; i < _count; ++i)
- delete[] _items[i].data;
- delete[] _items;
-}
-
-//--------------------------------------------------------------------------
-
-void FabDecompressor::decompress(const byte *srcData, int srcSize, byte *destData, int destSize) {
- byte copyLen, copyOfsShift, copyOfsMask, copyLenMask;
- unsigned long copyOfs;
- byte *destP;
-
- // Validate that the data starts with the FAB header
- if (strncmp((const char *)srcData, "FAB", 3) != 0)
- error("FabDecompressor - Invalid compressed data");
-
- int shiftVal = srcData[3];
- if ((shiftVal < 10) || (shiftVal > 13))
- error("FabDecompressor - Invalid shift start");
-
- copyOfsShift = 16 - shiftVal;
- copyOfsMask = 0xFF << (shiftVal - 8);
- copyLenMask = (1 << copyOfsShift) - 1;
- copyOfs = 0xFFFF0000;
- destP = destData;
-
- // Initialize data fields
- _srcData = srcData;
- _srcP = _srcData + 6;
- _srcSize = srcSize;
- _bitsLeft = 16;
- _bitBuffer = READ_LE_UINT16(srcData + 4);
-
- for (;;) {
- if (getBit() == 0) {
- if (getBit() == 0) {
- copyLen = ((getBit() << 1) | getBit()) + 2;
- copyOfs = *_srcP++ | 0xFFFFFF00;
- } else {
- copyOfs = (((_srcP[1] >> copyOfsShift) | copyOfsMask) << 8) | _srcP[0];
- copyLen = _srcP[1] & copyLenMask;
- _srcP += 2;
- if (copyLen == 0) {
- copyLen = *_srcP++;
- if (copyLen == 0)
- break;
- else if (copyLen == 1)
- continue;
- else
- copyLen++;
- } else {
- copyLen += 2;
- }
- copyOfs |= 0xFFFF0000;
- }
- while (copyLen-- > 0) {
- if (destP - destData == destSize)
- error("FabDecompressor - Decompressed data exceeded specified size");
-
- *destP = destP[(signed int)copyOfs];
- destP++;
- }
- } else {
- if (_srcP - srcData == srcSize)
- error("FabDecompressor - Passed end of input buffer during decompression");
- if (destP - destData == destSize)
- error("FabDecompressor - Decompressed data exceeded specified size");
-
- *destP++ = *_srcP++;
- }
- }
-
- if (destP - destData != destSize)
- error("FabDecompressor - Decompressed data does not match header decompressed size");
-}
-
-int FabDecompressor::getBit() {
- _bitsLeft--;
- if (_bitsLeft == 0) {
- if (_srcP - _srcData == _srcSize)
- error("FabDecompressor - Passed end of input buffer during decompression");
-
- _bitBuffer = (READ_LE_UINT16(_srcP) << 1) | (_bitBuffer & 1);
- _srcP += 2;
- _bitsLeft = 16;
- }
-
- int bit = _bitBuffer & 1;
- _bitBuffer >>= 1;
- return bit;
-}
-
-} // End of namespace M4
diff --git a/engines/m4/compression.h b/engines/m4/compression.h
deleted file mode 100644
index cb0ef74eb7..0000000000
--- a/engines/m4/compression.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* 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 M4_COMPRESSION_H
-#define M4_COMPRESSION_H
-
-#include "common/scummsys.h"
-#include "common/stream.h"
-#include "common/endian.h"
-
-#include "m4/m4.h"
-
-namespace M4 {
-
-struct MadsPackEntry {
-public:
- uint16 hash;
- uint32 size;
- uint32 compressedSize;
- byte *data;
-};
-
-class MadsPack {
-private:
- MadsPackEntry *_items;
- int _count;
- int _dataOffset;
-
- void initialize(Common::SeekableReadStream *stream);
-public:
- static bool isCompressed(Common::SeekableReadStream *stream);
- MadsPack(Common::SeekableReadStream *stream);
- MadsPack(const char *resourceName, MadsM4Engine *vm);
- ~MadsPack();
-
- int getCount() const { return _count; }
- MadsPackEntry &getItem(int index) const { return _items[index]; }
- MadsPackEntry &operator[](int index) const { return _items[index]; }
- Common::SeekableReadStream *getItemStream(int index);
- int getDataOffset() const { return _dataOffset; }
-};
-
-class FabDecompressor {
-private:
- int _bitsLeft;
- uint32 _bitBuffer;
- const byte *_srcData, *_srcP;
- int _srcSize;
-
- int getBit();
-public:
- void decompress(const byte *srcData, int srcSize, byte *destData, int destSize);
-};
-
-} // End of namespace M4
-
-
-#endif
diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp
deleted file mode 100644
index fa4ca6d121..0000000000
--- a/engines/m4/console.cpp
+++ /dev/null
@@ -1,428 +0,0 @@
-/* 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/textconsole.h"
-
-#include "m4/m4.h"
-#include "m4/console.h"
-#include "m4/dialogs.h"
-#include "m4/scene.h"
-#include "m4/staticres.h"
-
-namespace M4 {
-
-Console::Console(MadsM4Engine *vm) : GUI::Debugger() {
- _vm = vm;
-
- DCmd_Register("scene", WRAP_METHOD(Console, cmdLoadScene));
- DCmd_Register("start", WRAP_METHOD(Console, cmdStartingScene));
- DCmd_Register("show_hotspots", WRAP_METHOD(Console, cmdShowHotSpots));
- DCmd_Register("list_hotspots", WRAP_METHOD(Console, cmdListHotSpots));
- DCmd_Register("play_sound", WRAP_METHOD(Console, cmdPlaySound));
- DCmd_Register("play_dsr_sound", WRAP_METHOD(Console, cmdPlayDSRSound));
- DCmd_Register("show_resources", WRAP_METHOD(Console, cmdShowResources));
- DCmd_Register("show_codes", WRAP_METHOD(Console, cmdShowCodes));
- DCmd_Register("dump_file", WRAP_METHOD(Console, cmdDumpFile));
- DCmd_Register("sprite", WRAP_METHOD(Console, cmdShowSprite));
- DCmd_Register("start_conv", WRAP_METHOD(Console, cmdStartConversation));
- DCmd_Register("textview", WRAP_METHOD(Console, cmdShowTextview));
- DCmd_Register("animview", WRAP_METHOD(Console, cmdShowAnimview));
-}
-
-Console::~Console() {
-}
-
-static int strToInt(const char *s) {
- if (!*s)
- // No string at all
- return 0;
- else if (toupper(s[strlen(s) - 1]) != 'H')
- // Standard decimal string
- return atoi(s);
-
- // Hexadecimal string
- uint tmp = 0;
- int read = sscanf(s, "%xh", &tmp);
- if (read < 1)
- error("strToInt failed on string \"%s\"", s);
- return (int)tmp;
-}
-
-bool Console::cmdLoadScene(int argc, const char **argv) {
- if (argc != 2) {
- DebugPrintf("Usage: %s <scene number>\n", argv[0]);
- return true;
- } else {
- if (_vm->isM4())
- _vm->_kernel->newRoom = atoi(argv[1]);
- else
- _vm->_scene->loadScene(atoi(argv[1]));
- return false;
- }
-}
-
-bool Console::cmdStartingScene(int argc, const char **argv) {
- if (_vm->getGameType() != GType_Riddle) {
- if (_vm->isM4())
- _vm->_kernel->newRoom = FIRST_SCENE;
- else
- _vm->_scene->loadScene(FIRST_SCENE);
- return false;
- } else {
- DebugPrintf("%s: Riddle of Master Lu is not supported", argv[0]);
- return true;
- }
-}
-
-bool Console::cmdShowHotSpots(int argc, const char **argv) {
- _vm->_scene->showHotSpots();
- return false;
-}
-
-bool Console::cmdListHotSpots(int argc, const char **argv) {
- DebugPrintf("Scene hotspots\n");
- _vm->_scene->getSceneResources().hotspots->dump();
- if (_vm->isM4()) {
- DebugPrintf("Scene parallax\n");
- _m4Vm->scene()->getSceneResources().parallax->dump();
- DebugPrintf("Scene dynamic hotspots\n");
- _vm->_scene->getSceneResources().dynamicHotspots->dump();
- }
- return true;
-}
-
-bool Console::cmdPlaySound(int argc, const char **argv) {
- if (argc != 2) {
- DebugPrintf("Usage: %s <sound file>\n", argv[0]);
- } else {
- _vm->_sound->playSound(argv[1], 255, false);
- }
- return true;
-}
-
-bool Console::cmdPlayDSRSound(int argc, const char **argv) {
- if (argc != 2 && argc != 3) {
- DebugPrintf("Usage: %s <sound index> <DSR file>\n", argv[0]);
- DebugPrintf("The DSR file parameter is optional, and specifies which DSR to load\n");
- } else {
- if (argc == 3)
- _vm->_sound->loadDSRFile(argv[2]);
- _vm->_sound->playDSRSound(atoi(argv[1]), 255, false);
- }
- return true;
-}
-
-bool Console::cmdShowResources(int argc, const char **argv) {
- _vm->res()->dump();
- return true;
-}
-
-bool Console::cmdShowCodes(int argc, const char **argv) {
- _vm->_scene->showCodes();
- return false;
-}
-
-bool Console::cmdDumpFile(int argc, const char **argv) {
- if (argc != 2 && argc != 3) {
- DebugPrintf("Usage: %s <file> <uncompress>\n", argv[0]);
- DebugPrintf("If uncompress is 1, the file is uncompressed (for MADS games)\n");
- } else {
- if (argc == 2) {
- _vm->dumpFile(argv[1], false);
- } else {
- if (argc == 3 && atoi(argv[2]) == 1)
- _vm->dumpFile(argv[1], true);
- else
- _vm->dumpFile(argv[1], false);
- }
- }
- return true;
-}
-
-bool Console::cmdShowSprite(int argc, const char **argv) {
- View *view = _vm->_viewManager->getView(VIEWID_SCENE);
- if (view == NULL)
- DebugPrintf("The scene view isn't currently active\n");
- else if (argc < 2)
- DebugPrintf("Usage: %s resource_name\n", argv[0]);
- else {
- char resourceName[20];
- strncpy(resourceName, argv[1], 15);
- resourceName[15] = '\0';
- if (!strchr(resourceName, '.'))
- strcat(resourceName, ".SS");
-
- _vm->_viewManager->moveToFront(view);
- Common::SeekableReadStream *data = _vm->res()->get(resourceName);
- SpriteAsset *asset = new SpriteAsset(_vm, data, data->size(), resourceName);
- _vm->res()->toss(resourceName);
-
- RGBList *palData = new RGBList(asset->getColorCount(), asset->getPalette(), true);
- _vm->_palette->addRange(palData);
-
- // Get the scene background surface
- M4Surface *bg = _vm->_scene->getBackgroundSurface();
-
- // Write the sprite onto the screen
- int x = 0, y = 0, yMax = 0;
- for (int index = 0; index < asset->getCount(); index++) {
- M4Sprite *spr = asset->getFrame(index);
- spr->translate(palData); // sprite pixel translation
-
- if ((x + spr->width() >= bg->width()) && (yMax != 0)) {
- x = 0;
- y += yMax;
- yMax = 0;
- }
-
- if (y >= bg->height())
- break;
-
- spr->copyTo(bg, x, y, (int)spr->getTransparencyIndex());
-
- x += spr->width();
- yMax = MAX(yMax, spr->height());
- }
-
- view->restore(0, 0, view->width(), view->height());
- return false;
- }
-
- return true;
-}
-
-bool Console::cmdStartConversation(int argc, const char **argv) {
- if (argc != 2) {
- DebugPrintf("Usage: %s <conversation file name>\n", argv[0]);
- return true;
- } else if (_vm->isM4()) {
- ((M4Engine *)_vm)->_converse->startConversation(argv[1]);
- return false;
- } else {
- error("MADS engine does not support conversations yet");
- return false;
- }
-}
-
-bool Console::cmdShowTextview(int argc, const char **argv) {
- if (argc != 2) {
- DebugPrintf("Usage: %s <txr resource>\n", argv[0]);
- return true;
- }
-
- _vm->_viewManager->showTextView(argv[1], false);
- return false;
-}
-
-bool Console::cmdShowAnimview(int argc, const char **argv) {
- if (argc != 2) {
- DebugPrintf("Usage: %s <res resource>\n", argv[0]);
- return true;
- }
-
- char resName[80];
- strcpy(resName, "@");
- strcat(resName, *argv[1] == '@' ? argv[1] + 1 : argv[1]);
-
- _vm->_viewManager->showAnimView(resName, false);
- return false;
-}
-
-/*--------------------------------------------------------------------------*/
-
-MadsConsole::MadsConsole(MadsEngine *vm): Console(vm) {
- _vm = vm;
-
- DCmd_Register("object", WRAP_METHOD(MadsConsole, cmdObject));
- DCmd_Register("message", WRAP_METHOD(MadsConsole, cmdMessage));
- DCmd_Register("scene_info", WRAP_METHOD(MadsConsole, cmdSceneInfo));
- DCmd_Register("anim", WRAP_METHOD(MadsConsole, cmdPlayAnimation));
-}
-
-bool MadsConsole::cmdObject(int argc, const char **argv) {
- if (argc == 1) {
- DebugPrintf("Usage: object ['list' | '#objnum' | 'add #objnum']\n");
- } else if (!strcmp(argv[1], "list")) {
- // List of objects
- for (uint objStart = 0; objStart < _vm->globals()->getObjectsSize(); objStart += 5) {
- DebugPrintf("%2d - ", objStart);
- for (uint objId = objStart; objId < MIN<uint>(_vm->globals()->getObjectsSize(), objStart + 5); ++objId) {
- if (objId != objStart) DebugPrintf(", ");
- uint16 descId = _vm->globals()->getObject(objId)->_descId;
- DebugPrintf("%s", _vm->globals()->getVocab(descId));
- }
-
- DebugPrintf("\n");
- }
-
- DebugPrintf("\n");
- } else if (!strcmp(argv[1], "add") && (argc == 3)) {
- // Add the specified object to the player's inventory
- int objNum = strToInt(argv[2]);
-
- if ((objNum < 0) || (objNum >= (int)_vm->globals()->getObjectsSize()))
- DebugPrintf("Invalid object specified\n");
- else if (_vm->isM4())
- DebugPrintf("Not implemented for M4 games\n");
- else {
- _vm->_scene->getInterface()->addObjectToInventory(objNum);
- return false;
- }
-
- } else {
- // Print the details of a specific object
- int objNum = strToInt(argv[1]);
-
- if ((objNum < 0) || (objNum >= (int)_vm->globals()->getObjectsSize()))
- DebugPrintf("Invalid object specified\n");
- else {
- const MadsObject *obj = _vm->globals()->getObject(objNum);
-
- DebugPrintf("Object #%d (%s) room=%d article=%d/%s vocabs=%d", objNum, _vm->globals()->getVocab(obj->_descId),
- obj->_roomNumber, (int)obj->_article, englishMADSArticleList[obj->_article], obj->_vocabCount);
-
- if (obj->_vocabCount > 0) {
- DebugPrintf(" - ");
- for (int i = 0; i < obj->_vocabCount; ++i) {
- if (i != 0) DebugPrintf(", ");
- DebugPrintf("%s (%d)/%d,%d", _vm->globals()->getVocab(obj->_vocabList[i].vocabId),
- obj->_vocabList[i].vocabId, obj->_vocabList[i].flags1, obj->_vocabList[i].flags2);
- }
- }
- DebugPrintf("\n");
- }
- }
-
- return true;
-}
-
-bool MadsConsole::cmdMessage(int argc, const char **argv) {
- if (argc == 1) {
- DebugPrintf("message 'objnum'\n");
- } else if (!strcmp(argv[1], "list_quotes")) {
- // Dump the quotes list
-#if 0
- // FIXME: The following code is not portable and hence has been disabled.
- // Try replacing FILE by Common::DumpFile.
- FILE *destFile = fopen("mads_quotes.txt", "wb");
- for (uint i = 0; i < _vm->globals()->getQuotesSize(); ++i)
- fprintf(destFile, "%.3d - %s\n", i, _vm->globals()->getQuote(i));
- fclose(destFile);
-#endif
-
- } else if (!strcmp(argv[1], "list_vocab")) {
- // Dump the vocab list
-#if 0
- // FIXME: The following code is not portable and hence has been disabled.
- // Try replacing FILE by Common::DumpFile.
- FILE *destFile = fopen("mads_vocab.txt", "wb");
- for (uint i = 1; i <= _vm->globals()->getVocabSize(); ++i)
- fprintf(destFile, "%.3d/%.3x - %s\n", i, i, _vm->globals()->getVocab(i));
- fclose(destFile);
-#endif
-
- } else {
- int messageIdx = strToInt(argv[1]);
-
- if ((argc != 3) || (strcmp(argv[2], "idx") != 0))
- messageIdx = _vm->globals()->messageIndexOf(messageIdx);
-
- const char *msg = _vm->globals()->loadMessage(messageIdx);
- if (!msg)
- DebugPrintf("Unknown message\n");
- else {
- Dialog *dlg = new Dialog(_vm, msg, "TEST DIALOG");
-
- _vm->_viewManager->addView(dlg);
- _vm->_viewManager->moveToFront(dlg);
-
- return false;
- }
- }
-
- return true;
-}
-
-bool MadsConsole::cmdSceneInfo(int argc, const char **argv) {
- DebugPrintf("Current scene is: %i\n", _vm->_scene->getCurrentScene());
-
- return true;
-}
-
-bool MadsConsole::cmdPlayAnimation(int argc, const char **argv) {
- View *view = _vm->_viewManager->getView(VIEWID_SCENE);
- if (view == NULL) {
- DebugPrintf("The scene view isn't currently active\n");
- } else if (argc != 2 && argc != 3) {
- DebugPrintf("Usage: %s <anim resource (*.aa)> <fullscreen>\n", argv[0]);
- DebugPrintf("If fullscreen is 1, the screen palette is replaced with the palette of the animation\n");
- } else {
- char resourceName[20];
- strncpy(resourceName, argv[1], 15);
- resourceName[15] = '\0';
- if (!strchr(resourceName, '.'))
- strcat(resourceName, ".AA");
-
- _vm->_viewManager->moveToFront(view);
- if (argc == 3 && atoi(argv[2]) == 1)
- _madsVm->_palette->deleteAllRanges();
-
- _madsVm->scene()->_sceneAnimation->load(resourceName, 0);
-
- view->restore(0, 0, view->width(), view->height());
- return false;
- }
-
- return true;
-}
-
-/*--------------------------------------------------------------------------*/
-
-M4Console::M4Console(M4Engine *vm): Console(vm) {
- _vm = vm;
-
- DCmd_Register("scene_info", WRAP_METHOD(M4Console, cmdSceneInfo));
-}
-
-bool M4Console::cmdSceneInfo(int argc, const char **argv) {
- DebugPrintf("Current scene is: %i\n", _m4Vm->scene()->getCurrentScene());
-
- DebugPrintf("Scene resources:\n");
- DebugPrintf("artBase: %s\n", _m4Vm->scene()->getSceneResources().artBase);
- DebugPrintf("pictureBase: %s\n", _m4Vm->scene()->getSceneResources().pictureBase);
- DebugPrintf("hotspotCount: %i\n", _m4Vm->scene()->getSceneResources().hotspots->size());
- DebugPrintf("parallaxCount: %i\n", _m4Vm->scene()->getSceneResources().parallaxCount);
- DebugPrintf("dynHotspotCount: %i\n", _m4Vm->scene()->getSceneResources().dynamicHotspots->size());
- DebugPrintf("frontY: %i\n", _m4Vm->scene()->getSceneResources().frontY);
- DebugPrintf("backY: %i\n", _m4Vm->scene()->getSceneResources().backY);
- DebugPrintf("frontScale: %i\n", _m4Vm->scene()->getSceneResources().frontScale);
- DebugPrintf("backScale: %i\n", _m4Vm->scene()->getSceneResources().backScale);
- DebugPrintf("depthTable: ");
- for (uint i = 0; i < 16; i++)
- DebugPrintf("%i ", _m4Vm->scene()->getSceneResources().depthTable[i]);
- DebugPrintf("\n");
- DebugPrintf("railNodeCount: %i\n", _m4Vm->scene()->getSceneResources().railNodeCount);
-
- return true;
-}
-
-} // End of namespace M4
diff --git a/engines/m4/console.h b/engines/m4/console.h
deleted file mode 100644
index fc473b6464..0000000000
--- a/engines/m4/console.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* 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 M4_CONSOLE_H
-#define M4_CONSOLE_H
-
-#include "gui/debugger.h"
-
-namespace M4 {
-
-class MadsM4Engine;
-class MadsEngine;
-
-class Console : public GUI::Debugger {
-private:
- MadsM4Engine *_vm;
-
- bool cmdLoadScene(int argc, const char **argv);
- bool cmdStartingScene(int argc, const char **argv);
- bool cmdShowHotSpots(int argc, const char **argv);
- bool cmdListHotSpots(int argc, const char **argv);
- bool cmdPlaySound(int argc, const char **argv);
- bool cmdPlayDSRSound(int argc, const char **argv);
- bool cmdShowResources(int argc, const char **argv);
- bool cmdShowCodes(int argc, const char **argv);
- bool cmdDumpFile(int argc, const char **argv);
- bool cmdShowSprite(int argc, const char **argv);
- bool cmdStartConversation(int argc, const char **argv);
- bool cmdShowTextview(int argc, const char **argv);
- bool cmdShowAnimview(int argc, const char **argv);
-
-public:
- Console(MadsM4Engine *vm);
- virtual ~Console();
-};
-
-class MadsConsole : public Console {
-private:
- MadsEngine *_vm;
-
- bool cmdObject(int argc, const char **argv);
- bool cmdMessage(int argc, const char **argv);
- bool cmdSceneInfo(int argc, const char **argv);
- bool cmdPlayAnimation(int argc, const char **argv);
-
-public:
- MadsConsole(MadsEngine *vm);
- virtual ~MadsConsole() {}
-};
-
-class M4Console : public Console {
-private:
- M4Engine *_vm;
-
- bool cmdSceneInfo(int argc, const char **argv);
-public:
- M4Console(M4Engine *vm);
- virtual ~M4Console() {}
-};
-
-} // End of namespace M4
-
-
-#endif
diff --git a/engines/m4/converse.cpp b/engines/m4/converse.cpp
deleted file mode 100644
index bdce7928ac..0000000000
--- a/engines/m4/converse.cpp
+++ /dev/null
@@ -1,1239 +0,0 @@
-/* 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/array.h"
-#include "common/hashmap.h"
-#include "common/substream.h"
-#include "common/textconsole.h"
-
-#include "m4/converse.h"
-#include "m4/resource.h"
-#include "m4/globals.h"
-#include "m4/m4_views.h"
-#include "m4/compression.h"
-
-namespace M4 {
-
-#define CONV_ENTRIES_X_OFFSET 20
-#define CONV_ENTRIES_Y_OFFSET 4
-#define CONV_ENTRIES_HEIGHT 20
-#define CONV_MAX_SHOWN_ENTRIES 5
-
-#define CONVERSATION_ENTRY_HIGHLIGHTED 22
-#define CONVERSATION_ENTRY_NORMAL 3
-
-// Conversation chunks
-// Header
-#define HEAD_CONV MKTAG('C','O','N','V') // conversation
-#define CHUNK_DECL MKTAG('D','E','C','L') // declaration
-#define CHUNK_NODE MKTAG('N','O','D','E') // node
-#define CHUNK_LNOD MKTAG('L','N','O','D') // linear node
-#define CHUNK_ETRY MKTAG('E','T','R','Y') // entry
-#define CHUNK_TEXT MKTAG('T','E','X','T') // text
-#define CHUNK_MESG MKTAG('M','E','S','G') // message
-// Conversation chunks - entry related (unconditional)
-#define CHUNK_RPLY MKTAG('R','P','L','Y') // reply
-#define CHUNK_HIDE MKTAG('H','I','D','E') // hide entry
-#define CHUNK_UHID MKTAG('U','H','I','D') // unhide entry
-#define CHUNK_DSTR MKTAG('D','S','T','R') // destroy entry
-// Conversation chunks - entry related (conditional)
-#define CHUNK_CRPL MKTAG('C','R','P','L') // reply
-#define CHUNK_CHDE MKTAG('C','H','D','E') // hide entry
-#define CHUNK_CUHD MKTAG('C','U','H','D') // unhide entry
-#define CHUNK_CDST MKTAG('D','D','T','S') // destroy entry
-// Conversation chunks - branching and logic (unconditional)
-#define CHUNK_ASGN MKTAG('A','S','G','N') // assign
-#define CHUNK_GOTO MKTAG('G','O','T','O') // goto chunk
-#define CHUNK_EXIT MKTAG('E','X','I','T') // exit/return from goto
-// Conversation chunks - branching and logic (conditional)
-#define CHUNK_CASN MKTAG('C','A','S','N') // assign
-#define CHUNK_CCGO MKTAG('C','C','G','O') // goto chunk
-#define CHUNK_CEGO MKTAG('C','E','G','O') // exit/return from goto
-// Others
-#define CHUNK_FALL MKTAG('F','A','L','L') // fallthrough
-#define CHUNK_WRPL MKTAG('W','R','P','L') // weighted reply chunk
-#define CHUNK_WPRL MKTAG('W','P','R','L') // weighted preply chunk
-
-
-ConversationView::ConversationView(MadsM4Engine *vm): View(vm, Common::Rect(0,
- vm->_screen->height() - INTERFACE_HEIGHT, vm->_screen->width(), vm->_screen->height())) {
-
- _screenType = VIEWID_CONVERSATION;
- _screenFlags.layer = LAYER_INTERFACE;
- _screenFlags.visible = false;
- _screenFlags.get = SCREVENT_MOUSE;
- _conversationState = kNoConversation;
- _currentHandle = NULL;
-}
-
-ConversationView::~ConversationView() {
- _activeItems.clear();
-}
-
-void ConversationView::setNode(int32 nodeIndex) {
- _highlightedIndex = -1;
- _xEnd = CONV_ENTRIES_X_OFFSET;
- _vm->_font->setFont(FONT_CONVERSATION);
-
- // TODO: Conversation styles and colors
- _vm->_font->current()->setColors(2, 1, 3);
-
- _currentNodeIndex = nodeIndex;
-
- _activeItems.clear();
-
- if (nodeIndex != -1) {
- ConvEntry *node = _m4Vm->_converse->getNode(nodeIndex);
-
- for (uint i = 0; i < node->entries.size(); ++i) {
- if (!node->entries[i]->visible)
- continue;
-
- if ((int)_activeItems.size() > CONV_MAX_SHOWN_ENTRIES) {
- warning("TODO: scrolling. Max shown entries are %i, skipping entry %i",
- CONV_MAX_SHOWN_ENTRIES, i);
- }
-
- // Add node to active items list
- _activeItems.push_back(node->entries[i]);
-
- if (node->entries[i]->autoSelect || strlen(node->entries[i]->text) == 0) {
- //warning(kDebugConversations, "Auto selecting entry %i of node %i\n", i, nodeIndex);
- selectEntry(i);
- return;
- }
-
- // Figure out the longest string to determine where option highlighting ends
- int tempX = _vm->_font->current()->getWidth(node->entries[i]->text, 0) +
- CONV_ENTRIES_X_OFFSET + 10;
- _xEnd = MAX(_xEnd, tempX);
- }
-
- // Make sure that there aren't too many entries
- //assert((int)_activeItems.size() < (height() - CONV_ENTRIES_Y_OFFSET) / CONV_ENTRIES_HEIGHT);
-
- // Fallthrough
- if (node->fallthroughMinEntries >= 0 && node->fallthroughOffset >= 0) {
- //warning(kDebugConversations, "Current node falls through node at offset %i when entries are less or equal than %i\n",
- // node->fallthroughOffset, node->fallthroughMinEntries);
- if (_activeItems.size() <= (uint32)node->fallthroughMinEntries) {
- const EntryInfo *entryInfo = _m4Vm->_converse->getEntryInfo(node->fallthroughOffset);
- //warning(kDebugConversations, "Entries are less than or equal to %i, falling through to node at offset %i, index %i\n",
- // node->fallthroughMinEntries, node->fallthroughOffset, entryInfo->nodeIndex);
- setNode(entryInfo->nodeIndex);
- return;
- }
- }
-
- _entriesShown = true;
- _conversationState = kConversationOptionsShown;
- }
-}
-
-void ConversationView::onRefresh(RectList *rects, M4Surface *destSurface) {
- //if (!this->isVisible())
- // return;
- clear();
-
- if (_entriesShown) {
- // Write out the conversation options
- _vm->_font->setFont(FONT_CONVERSATION);
- for (int i = 0; i < (int)_activeItems.size(); ++i) {
- // TODO: scrolling
- if (i > CONV_MAX_SHOWN_ENTRIES - 1)
- break;
-
- _vm->_font->current()->setColor((_highlightedIndex == i) ? CONVERSATION_ENTRY_HIGHLIGHTED :
- CONVERSATION_ENTRY_NORMAL);
-
- _vm->_font->current()->writeString(this, _activeItems[i]->text, CONV_ENTRIES_X_OFFSET,
- CONV_ENTRIES_Y_OFFSET + CONV_ENTRIES_HEIGHT * i, 0, 0);
- }
- }
- View::onRefresh(rects, destSurface);
-}
-
-bool ConversationView::onEvent(M4EventType eventType, int32 param, int x, int y, bool &captureEvents) {
- //if (!this->isVisible())
- // return false;
- if (!_entriesShown)
- return false;
- if (eventType == KEVENT_KEY)
- return false;
-
- int localY = y - _coords.top;
- int selectedIndex = _highlightedIndex;
-
- switch (eventType) {
- case MEVENT_MOVE:
- if ((x < CONV_ENTRIES_X_OFFSET) || (x >= _xEnd) || (localY < CONV_ENTRIES_Y_OFFSET))
- _highlightedIndex = -1;
- else {
- int index = (localY - CONV_ENTRIES_Y_OFFSET) / CONV_ENTRIES_HEIGHT;
- _highlightedIndex = (index >= (int)_activeItems.size()) ? -1 : index;
- }
- break;
-
- case MEVENT_LEFT_RELEASE:
- if (_highlightedIndex != -1) {
- selectEntry(selectedIndex);
- }
- break;
-
- default:
- break;
- }
-
- return true;
-}
-
-void ConversationView::selectEntry(int entryIndex) {
- char buffer[20];
- sprintf(buffer, "%s.raw", _activeItems[entryIndex]->voiceFile);
-
- _entriesShown = false;
- _conversationState = kEntryIsActive;
- _vm->_player->setCommandsAllowed(false);
- // Necessary, as entries can be selected programmatically
- _highlightedIndex = entryIndex;
-
- // Play the selected entry's voice
- if (strlen(_activeItems[entryIndex]->voiceFile) > 0) {
- _currentHandle = _vm->_sound->getHandle();
- _vm->_sound->playVoice(buffer, 255);
- } else {
- _currentHandle = NULL;
- }
-
- // Hide selected entry, unless it has a persistent flag set
- if (!(_activeItems[entryIndex]->flags & kEntryPersists)) {
- //debugCN(kDebugConversations, "Hiding selected entry\n");
- _m4Vm->_converse->getNode(_currentNodeIndex)->entries[entryIndex]->visible = false;
- } else {
- //debugCN(kDebugConversations, "Selected entry is persistent, not hiding it\n");
- }
-}
-
-void ConversationView::updateState() {
- switch (_conversationState) {
- case kConversationOptionsShown:
- return;
- case kEntryIsActive:
- case kReplyIsActive:
- // FIXME: for now, we determine whether a conversation entry is
- // finished by waiting for its associated speech file to finish playing
- if (_currentHandle != NULL && _vm->_sound->isHandleActive(_currentHandle)) {
- return;
- } else {
- playNextReply();
- } // end else
- break;
- case kNoConversation:
- return;
- default:
- error("Unknown converstation state");
- break;
- }
-}
-
-void ConversationView::playNextReply() {
- char buffer[20];
-
- assert(_highlightedIndex >= 0);
-
- // Start playing the first reply
- for (uint32 i = 0; i < _activeItems[_highlightedIndex]->entries.size(); i++) {
- ConvEntry *currentEntry = _activeItems[_highlightedIndex]->entries[i];
-
- if (currentEntry->isConditional) {
- if (!_m4Vm->_converse->evaluateCondition(
- _m4Vm->_converse->getValue(currentEntry->condition.offset),
- currentEntry->condition.op, currentEntry->condition.val))
- continue; // don't play this reply
- }
-
- if (currentEntry->entryType != kWeightedReply) {
- sprintf(buffer, "%s.raw", currentEntry->voiceFile);
- if (strlen(currentEntry->voiceFile) > 0) {
- _currentHandle = _vm->_sound->getHandle();
- _vm->_sound->playVoice(buffer, 255);
- // Remove reply from the list of replies
- _activeItems[_highlightedIndex]->entries.remove_at(i);
- _conversationState = kReplyIsActive;
- return;
- } else {
- _currentHandle = NULL;
- }
- } else {
- int selectedWeight = _vm->_random->getRandomNumber(currentEntry->totalWeight - 1) + 1;
- //debugCN(kDebugConversations, "Selected weight: %i\n", selectedWeight);
- int previousWeight = 1;
- int currentWeight = 0;
-
- for (uint32 j = 0; j < currentEntry->entries.size(); j++) {
- currentWeight += currentEntry->entries[j]->weight;
- if (selectedWeight >= previousWeight && selectedWeight <= currentWeight) {
- sprintf(buffer, "%s.raw", currentEntry->entries[j]->voiceFile);
- if (strlen(currentEntry->entries[j]->voiceFile) > 0) {
- _currentHandle = _vm->_sound->getHandle();
- _vm->_sound->playVoice(buffer, 255);
- // Remove reply from the list of replies
- _activeItems[_highlightedIndex]->entries.remove_at(i);
- _conversationState = kReplyIsActive;
- return;
- } else {
- _currentHandle = NULL;
- }
- break;
- }
- previousWeight += currentWeight;
- } // end for j
- } // end if
- } // end for i
-
- // If we reached here, there are no more replies, so perform the active entry's actions
-
- //debugCN(kDebugConversations, "Current selection does %i actions\n", _activeItems[entryIndex]->actions.size());
- for (uint32 i = 0; i < _activeItems[_highlightedIndex]->actions.size(); i++) {
- if (!_m4Vm->_converse->performAction(_activeItems[_highlightedIndex]->actions[i]))
- break;
- } // end for
-
- // Refresh the conversation node, in case it hasn't changed
- setNode(_currentNodeIndex);
-
- _entriesShown = true;
- _vm->_player->setCommandsAllowed(true);
-
- // Check if the conversation has been ended
- if (_currentNodeIndex == -1) {
- _conversationState = kNoConversation;
- }
-}
-
-//--------------------------------------------------------------------------
-
-void Converse::startConversation(const char *convName, bool showConverseBox, ConverseStyle style) {
- if (_vm->isM4())
- loadConversation(convName);
- else
- loadConversationMads(convName);
-
- if (!_vm->isM4()) showConverseBox = false; // TODO: remove
-
- _playerCommandsAllowed = _vm->_player->commandsAllowed;
- if (_vm->isM4()) // TODO: remove (interface not implemented yet in MADS games)
- _interfaceWasVisible = _m4Vm->scene()->getInterface()->isVisible();
- _vm->_player->setCommandsAllowed(false);
- _style = style;
-
- if (showConverseBox) {
- _vm->_conversationView->show();
- _vm->_mouse->lockCursor(CURSOR_ARROW);
-
- if (_interfaceWasVisible)
- _m4Vm->scene()->getInterface()->hide();
-
- _vm->_conversationView->setNode(0);
- _vm->_conversationView->show();
- }
-}
-
-void Converse::endConversation() {
- _vm->_conversationView->setNode(-1);
- _vm->_conversationView->hide();
- // TODO: do a more proper cleanup here
- _convNodes.clear();
- _variables.clear();
- _offsetMap.clear();
- _vm->_player->setCommandsAllowed(_playerCommandsAllowed);
- if (_interfaceWasVisible)
- _m4Vm->scene()->getInterface()->show();
-}
-
-void Converse::loadConversation(const char *convName) {
- char name[40];
- char buffer[256];
- sprintf(name, "%s.chk", convName);
- Common::SeekableReadStream *convS = _vm->res()->get(name);
- uint32 header = convS->readUint32LE();
- uint32 size;
- uint32 chunk;
- uint32 data = 0;
- uint32 i = 0;
- ConvEntry* curEntry = NULL;
- ConvEntry* replyEntry = NULL;
- int32 currentWeightedEntry = -1;
- EntryAction* curAction = NULL;
- uint32 curNode = 0;
- uint32 chunkPos = 0;
- uint32 val;
- int32 autoSelectIndex = -1;
- int returnAddress = -1;
-
- bool debugFlag = false; // set to true for debug messages
-
- // Conversation *.chk files contain a 'CONV' header in LE format
- if (header != HEAD_CONV) {
- warning("Unexpected conversation file external header");
- return;
- }
- size = convS->readUint32LE(); // is this used at all?
- if (debugFlag) debugCN(kDebugConversations, "Conv chunk size (external header): %i\n", size);
-
- // Conversation name, which is the conversation file's name
- // without the extension
- convS->read(buffer, 8);
- if (debugFlag) debugCN(kDebugConversations, "Conversation name: %s\n", buffer);
-
- while (true) {
- chunkPos = convS->pos();
- chunk = convS->readUint32LE(); // read chunk
- if (convS->eos()) break;
-
- if (debugFlag) debugC(kDebugConversations, "***** Pos: %i -> ", chunkPos);
- switch (chunk) {
- case CHUNK_DECL: // Declare
- if (debugFlag) debugCN(kDebugConversations, "DECL chunk\n");
- data = convS->readUint32LE();
- if (debugFlag) debugCN(kDebugConversations, "Tag: %i\n", data);
- if (data > 0)
- warning("Tag > 0 in DECL chunk, value is: %i", data); // TODO
- val = convS->readUint32LE();
- if (debugFlag) debugCN(kDebugConversations, "Value: %i\n", val);
- data = convS->readUint32LE();
- if (debugFlag) debugCN(kDebugConversations, "Flags: %i\n", data);
- if (data > 0)
- warning("Flags != 0 in DECL chunk, value is %i", data); // TODO
- setValue(chunkPos, val);
- break;
- // ----------------------------------------------------------------------------
- case CHUNK_NODE: // Node
- case CHUNK_LNOD: // Linear node
- // Create new node
- curEntry = new ConvEntry();
- curEntry->offset = chunkPos;
- curEntry->entryType = (chunk == CHUNK_NODE) ? kNode : kLinearNode;
- curEntry->fallthroughMinEntries = -1;
- curEntry->fallthroughOffset = -1;
- if (chunk == CHUNK_NODE) {
- if (debugFlag) debugCN(kDebugConversations, "NODE chunk\n");
- } else {
- if (debugFlag) debugCN(kDebugConversations, "LNOD chunk\n");
- }
- curNode = convS->readUint32LE();
- if (debugFlag) debugCN(kDebugConversations, "Node number: %i\n", curNode);
- data = convS->readUint32LE();
- if (debugFlag) debugCN(kDebugConversations, "Tag: %i\n", data);
- if (chunk == CHUNK_LNOD) {
- autoSelectIndex = convS->readUint32LE();
- if (debugFlag) debugCN(kDebugConversations, "Autoselect entry number: %i\n", autoSelectIndex);
- }
- size = convS->readUint32LE();
- if (debugFlag) debugCN(kDebugConversations, "Number of entries: %i\n", size);
- for (i = 0; i < size; i++) {
- data = convS->readUint32LE();
- if (debugFlag) debugCN(kDebugConversations, "Entry %i: %i\n", i + 1, data);
- }
- _convNodes.push_back(curEntry);
- setEntryInfo(curEntry->offset, curEntry->entryType, curNode, -1);
- break;
- case CHUNK_ETRY: // Entry
- // Create new entry
- curEntry = new ConvEntry();
- curEntry->offset = chunkPos;
- curEntry->entryType = kEntry;
- strcpy(curEntry->voiceFile, "");
- strcpy(curEntry->text, "");
- if (debugFlag) debugCN(kDebugConversations, "ETRY chunk\n");
- data = convS->readUint32LE();
- if (debugFlag) debugCN(kDebugConversations, "Unknown (attributes perhaps?): %i\n", data);
- data = convS->readUint32LE();
- if (debugFlag) debugCN(kDebugConversations, "Entry flags: ");
- if (debugFlag) if (data & kEntryInitial) debugCN(kDebugConversations, "Initial ");
- if (debugFlag) if (data & kEntryPersists) debugCN(kDebugConversations, "Persists ");
- if (debugFlag) debugCN(kDebugConversations, "\n");
- curEntry->flags = data;
- curEntry->visible = (curEntry->flags & kEntryInitial) ? true : false;
- if (autoSelectIndex >= 0) {
- if (_convNodes[curNode]->entries.size() == (uint32)autoSelectIndex) {
- curEntry->autoSelect = true;
- autoSelectIndex = -1;
- } else {
- curEntry->autoSelect = false;
- }
- } else {
- curEntry->autoSelect = false;
- }
- _convNodes[curNode]->entries.push_back(curEntry);
- setEntryInfo(curEntry->offset, curEntry->entryType,
- curNode, _convNodes[curNode]->entries.size() - 1);
- replyEntry = NULL;
- break;
- case CHUNK_WPRL: // Weighted preply
- // WPRL chunks are random entries that the character would say, not an NPC
- // They don't seem to be used in Orion Burger
- warning("WPRL chunk - treating as WRPL chunk");
- case CHUNK_WRPL: // Weighted reply
- case CHUNK_CRPL: // Conditional reply
- case CHUNK_RPLY: // Reply
- {
- ConvEntry* weightedEntry = NULL;
- // Create new reply
- replyEntry = new ConvEntry();
- replyEntry->offset = chunkPos;
- strcpy(replyEntry->voiceFile, "");
-
- // Conditional part
- if (chunk == CHUNK_CRPL) {
- replyEntry->isConditional = true;
- replyEntry->condition.offset = convS->readUint32LE();
- replyEntry->condition.op = convS->readUint32LE();
- replyEntry->condition.val = convS->readUint32LE();
- } else {
- replyEntry->isConditional = false;
- }
-
- if (chunk == CHUNK_WPRL || chunk == CHUNK_WRPL) {
- replyEntry->entryType = kWeightedReply;
- replyEntry->totalWeight = 0;
- if (debugFlag) debugCN(kDebugConversations, "WRPL chunk\n");
- size = convS->readUint32LE();
- if (debugFlag) debugCN(kDebugConversations, "Weighted reply %i - %i entries:\n", i, size);
- for (i = 0; i < size; i++) {
- weightedEntry = new ConvEntry();
- weightedEntry->offset = chunkPos;
- strcpy(weightedEntry->voiceFile, "");
- weightedEntry->entryType = kWeightedReply;
- data = convS->readUint32LE();
- if (debugFlag) debugCN(kDebugConversations, "- Weight: %i ", data);
- weightedEntry->weight = data;
- replyEntry->totalWeight += weightedEntry->weight;
- data = convS->readUint32LE();
- if (debugFlag) debugCN(kDebugConversations, "offset: %i\n", data);
- replyEntry->entries.push_back(weightedEntry);
- }
- currentWeightedEntry = 0;
- } else {
- replyEntry->entryType = kReply;
- if (debugFlag) debugCN(kDebugConversations, "RPLY chunk\n");
- data = convS->readUint32LE();
- if (debugFlag) debugCN(kDebugConversations, "Reply data offset: %i\n", data);
- }
-
- if (!curEntry)
- error("Converse::loadConversation(): curEntry is NULL while adding a reply");
-
- curEntry->entries.push_back(replyEntry);
- setEntryInfo(replyEntry->offset, replyEntry->entryType,
- curNode, _convNodes[curNode]->entries.size() - 1);
- // Seek to chunk data (i.e. TEXT/MESG tag, which is usually right
- // after this chunk but it can be further on in conditional reply chunks
- assert((int)data >= convS->pos());
- // If the entry's data is not right after the entry, remember the position
- // to return to after the data is read
- if (chunk == CHUNK_CRPL && (int)data != convS->pos())
- returnAddress = convS->pos();
- convS->seek(data, SEEK_SET);
- }
- break;
- // ----------------------------------------------------------------------------
- case CHUNK_TEXT: // Text (contains text and voice)
- case CHUNK_MESG: // Message (contains voice only)
- {
- ConvEntry* parentEntry = NULL;
- if (chunk == CHUNK_TEXT) {
- if (debugFlag) debugCN(kDebugConversations, "TEXT chunk\n");
- } else {
- if (debugFlag) debugCN(kDebugConversations, "MESG chunk\n");
- }
-
- if (replyEntry == NULL) {
- parentEntry = curEntry;
- } else if (replyEntry != NULL && replyEntry->entryType != kWeightedReply) {
- parentEntry = replyEntry;
- } else if (replyEntry != NULL && replyEntry->entryType == kWeightedReply) {
- parentEntry = replyEntry->entries[currentWeightedEntry];
- currentWeightedEntry++;
- } else {
- error("Converse::loadConversation(): Unexpected reply entry while processing TEXT/MESG chunk");
- }
-
- size = convS->readUint32LE();
- if (debugFlag) debugCN(kDebugConversations, "Entry data size: %i\n", size);
- convS->read(buffer, 8);
- size -= 8; // subtract maximum length of voice file name
- // If the file name is 8 characters, it will not be 0-terminated, so use strncpy
- strncpy(parentEntry->voiceFile, buffer, 8);
- parentEntry->voiceFile[8] = '\0';
- if (debugFlag) debugCN(kDebugConversations, "Voice file: %s\n", parentEntry->voiceFile);
-
- if (chunk == CHUNK_TEXT) {
- convS->read(buffer, size);
- if (debugFlag) debugCN(kDebugConversations, "Text: %s\n", buffer);
- sprintf(parentEntry->text, "%s", buffer);
- } else {
- while (size > 0) {
- data = convS->readUint32LE();
- if (debugFlag) debugCN(kDebugConversations, "Unknown: %i\n", data); // TODO
- size -= 4;
- }
- }
- // Now that the data chunk has been read, if we skipped a reply node,
- // jump back to it
- if (returnAddress != -1) {
- convS->seek(returnAddress, SEEK_SET);
- returnAddress = -1;
- }
- }
- break;
- // ----------------------------------------------------------------------------
- // Entry action chunks
- case CHUNK_CASN: // Conditional assign
- case CHUNK_ASGN: { // Assign
- curAction = new EntryAction();
- if (debugFlag) debugCN(kDebugConversations, "ASGN chunk\n");
- curAction->actionType = kAssignValue;
-
- // Conditional part
- if (chunk == CHUNK_CASN) {
- curAction->isConditional = true;
- curAction->condition.offset = convS->readUint32LE();
- curAction->condition.op = convS->readUint32LE();
- curAction->condition.val = convS->readUint32LE();
- } else {
- curAction->isConditional = false;
- }
-
- curAction->targetOffset = convS->readUint32LE();
- int op = convS->readUint32LE();
- assert(op == kOpAssign);
- curAction->value = convS->readUint32LE();
- break;
- }
- case CHUNK_CCGO: // Conditional go to entry
- case CHUNK_CHDE: // Conditional hide entry
- case CHUNK_CUHD: // Conditional unhide entry
- case CHUNK_CDST: // Conditional destroy entry
- case CHUNK_CEGO: // Conditional exit conversation / go to
-
- case CHUNK_GOTO: // Go to entry
- case CHUNK_HIDE: // Hide entry
- case CHUNK_UHID: // Unhide entry
- case CHUNK_DSTR: // Destroy entry
- case CHUNK_EXIT: // Exit conversation
- curAction = new EntryAction();
-
- // Conditional part
- if (chunk == CHUNK_CCGO || chunk == CHUNK_CHDE || chunk == CHUNK_CUHD ||
- chunk == CHUNK_CDST || chunk == CHUNK_CEGO) {
- curAction->isConditional = true;
- curAction->condition.offset = convS->readUint32LE();
- curAction->condition.op = convS->readUint32LE();
- curAction->condition.val = convS->readUint32LE();
- } else {
- curAction->isConditional = false;
- }
-
- if (chunk == CHUNK_GOTO || chunk == CHUNK_CCGO) {
- curAction->actionType = kGotoEntry;
- if (debugFlag) debugCN(kDebugConversations, "GOTO chunk\n");
- } else if (chunk == CHUNK_HIDE || chunk == CHUNK_CHDE) {
- curAction->actionType = kHideEntry;
- if (debugFlag) debugCN(kDebugConversations, "HIDE chunk\n");
- } else if (chunk == CHUNK_UHID || chunk == CHUNK_CUHD) {
- curAction->actionType = kUnhideEntry;
- if (debugFlag) debugCN(kDebugConversations, "UHID chunk\n");
- } else if (chunk == CHUNK_DSTR || chunk == CHUNK_CDST) {
- curAction->actionType = kDestroyEntry;
- if (debugFlag) debugCN(kDebugConversations, "DSTR chunk\n");
- } else if (chunk == CHUNK_EXIT || chunk == CHUNK_CEGO) {
- curAction->actionType = kExitConv;
- if (debugFlag) debugCN(kDebugConversations, "EXIT chunk\n");
- }
- data = convS->readUint32LE();
- if (debugFlag) debugCN(kDebugConversations, "Offset: %i\n", data);
- curAction->targetOffset = data;
- curEntry->actions.push_back(curAction);
- break;
- case CHUNK_FALL: // Fallthrough
- if (debugFlag) debugCN(kDebugConversations, "FALL chunk\n");
- size = convS->readUint32LE();
- if (debugFlag) debugCN(kDebugConversations, "Minimum nodes: %i\n", size);
- _convNodes[curNode]->fallthroughMinEntries = size;
- data = convS->readUint32LE();
- if (debugFlag) debugCN(kDebugConversations, "Offset: %i\n", data);
- _convNodes[curNode]->fallthroughOffset = data;
- break;
- // ----------------------------------------------------------------------------
- default:
- // Should never happen
- error("Unknown conversation chunk");
- break;
- }
- }
-
- _vm->res()->toss(name);
-}
-
-void Converse::loadConversationMads(const char *convName) {
- char name[40];
- char buffer[256];
- char *buf;
- Common::SeekableReadStream *convS;
- int curPos = 0;
- int unk = 0;
- uint32 stringIndex = 0;
- uint32 stringCount = 0;
- int flags = 0;
- int count = 0;
- uint32 i, j;
- ConvEntry* curEntry = NULL;
- MessageEntry *curMessage;
- Common::Array<char *> messageList;
- // TODO
-
- // CND file
- sprintf(name, "%s.cnd", convName);
- MadsPack convDataD(name, _vm);
-
- // ------------------------------------------------------------
- // Chunk 0
- convS = convDataD.getItemStream(0);
- debugCN(kDebugConversations, "Chunk 0\n");
- debugCN(kDebugConversations, "Conv stream size: %i\n", convS->size());
-
- while (!convS->eos()) { // FIXME (eos changed)
- debugCN(kDebugConversations, "%i ", convS->readByte());
- }
- debugCN(kDebugConversations, "\n");
-
- // ------------------------------------------------------------
- // Chunk 1
- convS = convDataD.getItemStream(1);
- debugCN(kDebugConversations, "Chunk 1\n");
- debugCN(kDebugConversations, "Conv stream size: %i\n", convS->size());
-
- while (!convS->eos()) { // FIXME (eos changed)
- debugCN(kDebugConversations, "%i ", convS->readByte());
- }
- debugCN(kDebugConversations, "\n");
-
- // ------------------------------------------------------------
- // Chunk 2
- convS = convDataD.getItemStream(2);
- debugCN(kDebugConversations, "Chunk 2\n");
- debugCN(kDebugConversations, "Conv stream size: %i\n", convS->size());
-
- while (!convS->eos()) { // FIXME (eos changed)
- debugCN(kDebugConversations, "%i ", convS->readByte());
- }
- debugCN(kDebugConversations, "\n");
-
- // ------------------------------------------------------------
- // CNV file
- sprintf(name, "%s.cnv", convName);
- MadsPack convData(name, _vm);
- // *.cnv files have 7 chunks
- // Here is the chunk output of conv001.cnv (from the dump_file command)
- /*
- Dumping conv001.cnv, size: 3431
- Dumping compressed chunk 1 of 7, size is 150
- Dumping compressed chunk 2 of 7, size is 130
- Dumping compressed chunk 3 of 7, size is 224
- Dumping compressed chunk 4 of 7, size is 92
- Dumping compressed chunk 5 of 7, size is 168
- Dumping compressed chunk 6 of 7, size is 4064
- Dumping compressed chunk 7 of 7, size is 2334
- */
-
- // ------------------------------------------------------------
- // TODO: finish this
- // Chunk 0
- convS = convData.getItemStream(0);
- debugCN(kDebugConversations, "Chunk 0\n");
- debugCN(kDebugConversations, "Conv stream size: %i\n", convS->size());
- debugCN(kDebugConversations, "%i ", convS->readUint16LE());
- debugCN(kDebugConversations, "%i ", convS->readUint16LE());
- debugCN(kDebugConversations, "%i ", convS->readUint16LE());
- debugCN(kDebugConversations, "%i ", convS->readUint16LE());
- debugCN(kDebugConversations, "%i ", convS->readUint16LE());
- debugCN(kDebugConversations, "%i ", convS->readUint16LE());
- debugCN(kDebugConversations, "\n");
- count = convS->readUint16LE(); // conversation face count (usually 2)
- debugCN(kDebugConversations, "Conversation faces: %i\n", count);
- for (i = 0; i < 5; i++) {
- convS->read(buffer, 16);
- debugCN(kDebugConversations, "Face %i: %s ", i + 1, buffer);
- }
- debugCN(kDebugConversations, "\n");
-
- // 5 face slots
- // 1 = face slot has a face (with the filename specified above)
- // 0 = face slot doesn't contain face data
- for (i = 0; i < 5; i++) {
- debugCN(kDebugConversations, "%i ", convS->readUint16LE());
- }
- debugCN(kDebugConversations, "\n");
-
- convS->read(buffer, 14); // speech file
- debugCN(kDebugConversations, "Speech file: %s\n", buffer);
-
- while (!convS->eos()) { // FIXME: eos changed
- debugCN(kDebugConversations, "%i ", convS->readByte());
- }
- debugCN(kDebugConversations, "\n");
-
- delete convS;
-
- // ------------------------------------------------------------
- // Chunk 1: Conversation nodes
- convS = convData.getItemStream(1);
- debugCN(kDebugConversations, "Chunk 1: conversation nodes\n");
- debugCN(kDebugConversations, "Conv stream size: %i\n", convS->size());
-
- while (true) {
- uint16 id = convS->readUint16LE();
- if (convS->eos()) break;
-
- curEntry = new ConvEntry();
- curEntry->id = id;
- curEntry->entryCount = convS->readUint16LE();
- curEntry->flags = convS->readUint16LE();
- if (curEntry->entryCount == 1 && curEntry->flags != 65535) {
- warning("Entry count is 1 and flags is not 65535 (it's %i)", flags);
- } else if (curEntry->entryCount != 1 && flags != 0) {
- warning("Entry count > 1 and flags is not 0 (it's %i)", flags);
- }
- unk = convS->readUint16LE();
- assert (unk == 65535);
- unk = convS->readUint16LE();
- assert (unk == 65535);
- _convNodes.push_back(curEntry);
- debugCN(kDebugConversations, "Node %i, ID %i, entries %i\n", _convNodes.size(), curEntry->id, curEntry->entryCount);
- // flags = 0: node has more than 1 entry
- // flags = 65535: node has 1 entry
- }
- debugCN(kDebugConversations, "Conversation has %i nodes\n", _convNodes.size());
- debugCN(kDebugConversations, "\n");
-
- delete convS;
-
- // ------------------------------------------------------------
- // Chunk 4 contains the conversation string offsets of chunk 5
- // (unused, as it's unneeded - we find the offsets ourselves)
-
- // ------------------------------------------------------------
- // Chunk 5 contains the conversation strings
- convS = convData.getItemStream(5);
- //debugCN(kDebugConversations, "Chunk 5: conversation strings\n");
- //debugCN(kDebugConversations, "Conv stream size: %i\n", convS->size());
-
- *buffer = 0;
-
- while (true) {
- //if (curPos == 0)
- // debugCN(kDebugConversations, "%i: Offset %i: ", _convStrings.size(), convS->pos());
- uint8 b = convS->readByte();
- if (convS->eos()) break;
-
- buffer[curPos++] = b;
- if (buffer[curPos - 1] == '~') { // filter out special characters
- curPos--;
- continue;
- }
- if (buffer[curPos - 1] == '\0') {
- // end of string
- //debugCN(kDebugConversations, "%s\n", buffer);
- buf = new char[strlen(buffer) + 1];
- strcpy(buf, buffer);
- _convStrings.push_back(buf);
- curPos = 0;
- *buffer = 0;
- }
- }
-
- delete convS;
-
- // ------------------------------------------------------------
- // Chunk 2: entry data
- convS = convData.getItemStream(2);
- //debugCN(kDebugConversations, "Chunk 2 - entry data\n");
- //debugCN(kDebugConversations, "Conv stream size: %i\n", convS->size());
-
- for (i = 0; i < _convNodes.size(); i++) {
- for (j = 0; j < _convNodes[i]->entryCount; j++) {
- curEntry = new ConvEntry();
- stringIndex = convS->readUint16LE();
- if (stringIndex != 65535)
- sprintf(curEntry->text, "%s", _convStrings[stringIndex]);
- else
- *curEntry->text = 0;
- curEntry->id = convS->readUint16LE();
- curEntry->offset = convS->readUint16LE();
- curEntry->size = convS->readUint16LE();
-
- _convNodes[i]->entries.push_back(curEntry);
- //debugCN(kDebugConversations, "Node %i, entry %i, id %i, offset %i, size %i, text: %s\n",
- // i, j, curEntry->id, curEntry->offset, curEntry->size, curEntry->text);
- }
- }
-
- delete convS;
-
- // ------------------------------------------------------------
- // Chunk 3: message (MESG) chunks, created from the strings of chunk 5
- convS = convData.getItemStream(3);
- //debugCN(kDebugConversations, "Chunk 3 - MESG chunk data\n");
- //debugCN(kDebugConversations, "Conv stream size: %i\n", convS->size());
-
- while (true) {
- uint16 index = convS->readUint16LE();
- if (convS->eos()) break;
-
- curMessage = new MessageEntry();
- stringIndex = index;
- stringCount = convS->readUint16LE();
- *buffer = 0;
- //debugCN(kDebugConversations, "Message: %i\n", _madsMessageList.size());
- for (i = stringIndex; i < stringIndex + stringCount; i++) {
- //debugCN(kDebugConversations, "%i: %s\n", i, _convStrings[i]);
- curMessage->messageStrings.push_back(_convStrings[i]);
- }
- _madsMessageList.push_back(curMessage);
- //debugCN(kDebugConversations, "----------\n");
- }
- //debugCN(kDebugConversations, "\n");
-
- delete convS;
-
- // ------------------------------------------------------------
- // TODO: finish this
- // Chunk 6: conversation script
- convS = convData.getItemStream(6);
- debugCN(kDebugConversations, "Chunk 6\n");
- debugCN(kDebugConversations, "Conv stream size: %i\n", convS->size());
- /*while (!convS->eos()) { // FIXME (eos changed)
- debugCN(kDebugConversations, "%i ", convS->readByte());
- debugCN(kDebugConversations, "%i ", convS->readByte());
- debugCN(kDebugConversations, "%i ", convS->readByte());
- debugCN(kDebugConversations, "%i ", convS->readByte());
- debugCN(kDebugConversations, "%i ", convS->readByte());
- debugCN(kDebugConversations, "%i ", convS->readByte());
- debugCN(kDebugConversations, "%i ", convS->readByte());
- debugCN(kDebugConversations, "%i ", convS->readByte());
- debugCN(kDebugConversations, "%i ", convS->readByte());
- debugCN(kDebugConversations, "%i ", convS->readByte());
- debugCN(kDebugConversations, "\n");
- }
- return;*/
-
- for (i = 0; i < _convNodes.size(); i++) {
- for (j = 0; j < _convNodes[i]->entryCount; j++) {
- debugCN(kDebugConversations, "*** Node %i entry %i data size %i\n", i, j, _convNodes[i]->entries[j]->size);
- debugCN(kDebugConversations, "Entry ID %i, text %s\n", _convNodes[i]->entries[j]->id, _convNodes[i]->entries[j]->text);
- Common::ReadStream *entryStream = new Common::SubReadStream(convS, _convNodes[i]->entries[j]->size);
- readConvEntryActions(entryStream, _convNodes[i]->entries[j]);
- delete entryStream;
- debugCN(kDebugConversations, "--------------------\n");
- }
- }
-
- delete convS;
-}
-
-void Converse::readConvEntryActions(Common::ReadStream *convS, ConvEntry *curEntry) {
- uint8 chunk;
- uint8 type; // 255: normal, 11: conditional
- uint8 hasText1, hasText2;
- int target;
- int count = 0;
- int var, val;
- int messageIndex = 0;
- int unk = 0;
-
- while (true) {
- chunk = convS->readByte();
- if (convS->eos()) break;
-
- type = convS->readByte();
-
- switch (chunk) {
- case 1:
- debugCN(kDebugConversations, "TODO: chunk type %i\n", chunk);
- break;
- case 2:
- debugCN(kDebugConversations, "HIDE\n");
- convS->readByte();
- count = convS->readByte();
- debugCN(kDebugConversations, "%i entries: ", count);
- for (int i = 0; i < count; i++)
- debugCN(kDebugConversations, "%i %d", i, convS->readUint16LE());
- debugCN(kDebugConversations, "\n");
- break;
- case 3:
- debugCN(kDebugConversations, "UNHIDE\n");
- convS->readByte();
- count = convS->readByte();
- debugCN(kDebugConversations, "%i entries: ", count);
- for (int i = 0; i < count; i++)
- debugCN(kDebugConversations, "%i %d", i, convS->readUint16LE());
- debugCN(kDebugConversations, "\n");
- break;
- case 4: // MESSAGE
- debugCN(kDebugConversations, "MESSAGE\n");
-
- if (type == 255) {
- //debugCN(kDebugConversations, "unconditional\n");
- } else if (type == 11) {
- //debugCN(kDebugConversations, "conditional\n");
- } else {
- debugCN(kDebugConversations, "unknown type: %i\n", type);
- }
-
- // Conditional part
- if (type == 11) {
- unk = convS->readUint16LE(); // 1
- if (unk != 1)
- debugCN(kDebugConversations, "Message: unk != 1 (it's %i)\n", unk);
-
- var = convS->readUint16LE();
- val = convS->readUint16LE();
- debugCN(kDebugConversations, "Var %i == %i\n", var, val);
- }
- unk = convS->readUint16LE(); // 256
- if (unk != 256)
- debugCN(kDebugConversations, "Message: unk != 256 (it's %i)\n", unk);
-
- // it seems that the first text entry is set when the message
- // chunk is supposed to be shown unconditionally, whereas the second text
- // entry is set when the message is supposed to be shown conditionally
- hasText1 = convS->readByte();
- hasText2 = convS->readByte();
-
- if (hasText1 == 1) {
- messageIndex = convS->readUint16LE();
- debugCN(kDebugConversations, "Message 1 index: %i, text:\n", messageIndex);
- for (uint32 i = 0; i < _madsMessageList[messageIndex]->messageStrings.size(); i++) {
- debugCN(kDebugConversations, "%s\n", _madsMessageList[messageIndex]->messageStrings[i]);
- }
- }
-
- if (hasText2 == 1) {
- messageIndex = convS->readUint16LE();
- if (hasText1 == 0) {
- debugCN(kDebugConversations, "Message 2 index: %i, text:\n", messageIndex);
- for (uint32 i = 0; i < _madsMessageList[messageIndex]->messageStrings.size(); i++) {
- debugCN(kDebugConversations, "%s\n", _madsMessageList[messageIndex]->messageStrings[i]);
- }
- }
- }
-
- break;
- case 5: // AUTO
- debugCN(kDebugConversations, "AUTO\n");
- for (int k = 0; k < 4; k++)
- convS->readByte();
- messageIndex = convS->readUint16LE();
- debugCN(kDebugConversations, "Message index: %i, text:\n", messageIndex);
- for (uint32 i = 0; i < _madsMessageList[messageIndex]->messageStrings.size(); i++) {
- debugCN(kDebugConversations, "%s\n", _madsMessageList[messageIndex]->messageStrings[i]);
- }
-
- convS->readUint16LE();
- break;
- case 6:
- debugCN(kDebugConversations, "TODO: chunk type %i\n", chunk);
- break;
- case 7: // GOTO
- unk = convS->readUint32LE(); // 0
- if (unk != 0 && unk != 1)
- debugCN(kDebugConversations, "Goto: unk != 0 or 1 (it's %i)\n", unk);
-
- target = convS->readUint16LE();
- convS->readUint16LE(); // 255
-
- if (unk != 0)
- debugCN(kDebugConversations, "Goto: unk != 0 (it's %i)\n", unk);
-
- if (target != 65535)
- debugCN(kDebugConversations, "GOTO node %i\n", target);
- else
- debugCN(kDebugConversations, "GOTO exit\n");
- break;
- case 8:
- debugCN(kDebugConversations, "TODO: chunk type %i\n", chunk);
- break;
- case 9: // ASSIGN
- //debugCN(kDebugConversations, "ASSIGN\n");
- unk = convS->readUint32LE(); // 0
-
- if (unk != 0)
- debugCN(kDebugConversations, "Assign: unk != 0 (it's %i)\n", unk);
-
- val = convS->readUint16LE();
- var = convS->readUint16LE();
- //debugCN(kDebugConversations, "Var %i = %i\n", var, val);
- break;
- default:
- debugCN(kDebugConversations, "Unknown chunk type! (%i)\n", chunk);
- break;
- }
- }
- debugCN(kDebugConversations, "\n");
-}
-
-void Converse::setEntryInfo(int32 offset, EntryType type, int32 nodeIndex, int32 entryIndex) {
- char hashOffset[10];
- sprintf(hashOffset, "%i", offset);
- EntryInfo info;
- info.targetType = type;
- info.nodeIndex = nodeIndex;
- info.entryIndex = entryIndex;
- _offsetMap[hashOffset] = info;
- //debugCN(kDebugConversations, "Set entry info: offset %i, type %i, node %i, entry %i\n", offset, type, nodeIndex, entryIndex);
-}
-
-const EntryInfo* Converse::getEntryInfo(int32 offset) {
- char hashOffset[10];
- sprintf(hashOffset, "%i", offset);
- OffsetHashMap::const_iterator entry = _offsetMap.find(hashOffset);
- if (entry != _offsetMap.end())
- return &(entry->_value);
- else
- error("Undeclared entry offset: %i", offset);
-}
-
-void Converse::setValue(int32 offset, int32 value) {
- char hashOffset[10];
- sprintf(hashOffset, "%i", offset);
- _variables[hashOffset] = value;
-}
-
-int32 Converse::getValue(int32 offset) {
- char hashOffset[10];
- sprintf(hashOffset, "%i", offset);
- ConvVarHashMap::const_iterator entry = _variables.find(hashOffset);
- if (entry != _variables.end())
- return entry->_value;
- else
- error("Undeclared variable offset: %i", offset);
-}
-
-bool Converse::evaluateCondition(int32 leftVal, int32 op, int32 rightVal) {
- switch (op) {
- case kOpPercent:
- return (leftVal % rightVal == 0);
- case kOpGreaterOrEqual:
- return leftVal >= rightVal;
- case kOpLessOrEqual:
- return leftVal <= rightVal;
- case kOpGreaterThan:
- return leftVal > rightVal;
- case kOpLessThan:
- return leftVal < rightVal;
- case kOpNotEqual:
- case kOpCondNotEqual:
- return leftVal != rightVal;
- case kOpAssign:
- return leftVal == rightVal;
- case kOpAnd:
- return leftVal && rightVal;
- case kOpOr:
- return leftVal || rightVal;
- default:
- error("Unknown conditional operator: %i", op);
- }
-}
-
-bool Converse::performAction(EntryAction *action) {
- if (action->isConditional) {
- if (!evaluateCondition(getValue(action->condition.offset),
- action->condition.op, action->condition.val))
- return true; // don't perform this action
- }
-
- if (action->actionType == kAssignValue) {
- //debugCN(kDebugConversations, "Assigning variable at offset %i to value %i\n",
- // action->targetOffset, action->value);
- setValue(action->targetOffset, action->value);
- return true; // nothing else to do in an assignment action
- }
-
- const EntryInfo *entryInfo = getEntryInfo(action->targetOffset);
- ConvEntry *targetEntry;
-
- if (entryInfo->nodeIndex >= 0 && entryInfo->entryIndex >= 0)
- targetEntry = getNode(entryInfo->nodeIndex)->entries[entryInfo->entryIndex];
- else if (entryInfo->nodeIndex >= 0)
- targetEntry = getNode(entryInfo->nodeIndex);
- else
- error("Target node id is negative");
-
- switch (action->actionType) {
- case kGotoEntry:
- //debugCN(kDebugConversations, "Goto entry at offset %i. Associated node is %i, entry %i\n",
- // action->targetOffset, entryInfo->nodeIndex, entryInfo->entryIndex);
- _vm->_conversationView->setNode(entryInfo->nodeIndex);
- if (entryInfo->entryIndex >= 0)
- _vm->_conversationView->selectEntry(entryInfo->entryIndex);
- return false;
- case kHideEntry:
- //debugCN(kDebugConversations, "Hide entry at offset %i. Associated node is %i, entry %i\n",
- // targetEntry->offset, entryInfo->nodeIndex, entryInfo->entryIndex);
- targetEntry->visible = false;
- return true;
- case kUnhideEntry:
- //debugCN(kDebugConversations, "Show entry at offset %i. Associated node is %i, entry %i\n",
- // targetEntry->offset, entryInfo->nodeIndex, entryInfo->entryIndex);
- targetEntry->visible = true;
- return true;
- case kDestroyEntry:
- //debugCN(kDebugConversations, "Destroy entry at offset %i. Associated node is %i, entry %i\n",
- // targetEntry->offset, entryInfo->nodeIndex, entryInfo->entryIndex);
- if (entryInfo->entryIndex >= 0)
- getNode(entryInfo->nodeIndex)->entries.remove_at(entryInfo->entryIndex);
- else
- warning("Target entry is a node, not destroying it");
- targetEntry->visible = true;
- return true;
- case kExitConv:
- //debugCN(kDebugConversations, "Exit conversation\n");
- endConversation();
- return false;
- default:
- warning("Unknown entry action");
- return false;
- } // end switch
-}
-
-/*--------------------------------------------------------------------------*/
-
-MadsConversation::MadsConversation() {
- for (int i = 0; i < MADS_TALK_SIZE; ++i) {
- _talkList[i].desc = NULL;
- _talkList[i].id = 0;
- }
-}
-
-
-} // End of namespace M4
diff --git a/engines/m4/converse.h b/engines/m4/converse.h
deleted file mode 100644
index b47e8d2a6b..0000000000
--- a/engines/m4/converse.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/* 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 M4_CONVERSE_H
-#define M4_CONVERSE_H
-
-#include "common/array.h"
-#include "common/hashmap.h"
-
-#include "m4/globals.h"
-#include "m4/viewmgr.h"
-#include "m4/sound.h"
-
-namespace M4 {
-
-enum ConversationState {
- kConversationOptionsShown = 0,
- kEntryIsActive = 1,
- kReplyIsActive = 2,
- kNoConversation = 3
-};
-
-enum EntryType {
- kVariable = 0,
- kNode = 1,
- kLinearNode = 2,
- kEntry = 3,
- kReply = 4,
- kWeightedReply = 5
-};
-
-// Flags are:
-// bit 0: if it's 1, the entry is "initial", i.e. not hidden when the dialog starts
-// bit 1: if it's 1, the entry persists if selected
-enum EntryFlags {
- kEntryInitial = 1, // byte 0
- kEntryPersists = 2 // byte 1
-};
-
-enum EntryActionType {
- kUnknownAction = 0,
- kGotoEntry = 1,
- kHideEntry = 2,
- kUnhideEntry = 3,
- kDestroyEntry = 4,
- kAssignValue = 5,
- kExitConv = 6
-};
-
-enum LogicOp {
- kOpPercent = 405,
- kOpGreaterOrEqual = 421,
- kOpLessOrEqual = 420,
- kOpGreaterThan = 413,
- kOpLessThan = 412,
- kOpNotEqual = 422,
- kOpCondNotEqual = 448,
- kOpAssign = 407,
- kOpAnd = 444,
- kOpOr = 445
-};
-
-struct Condition {
- int32 offset;
- int32 op;
- int32 val;
-};
-
-struct EntryAction {
- int32 targetOffset; // absolute offset (inside the *.chk file) of the action's target
- int32 value; // the value set by assignment chunks
- EntryActionType actionType;
- EntryType targetType;
- int32 nodeId;
- int32 entryId;
- bool isConditional;
- Condition condition;
-};
-
-struct ConvEntry {
- EntryType entryType;
- int32 id;
- int32 offset; // absolute offset inside the *.chk file, referenced by other chunks
- int32 size; // entry action data size (for MADS games)
- int32 flags;
- int32 fallthroughMinEntries;
- int32 fallthroughOffset;
- int32 weight; // weight for weighted replies
- int32 totalWeight;
- uint16 entryCount; // entries inside this node (for MADS games)
- char voiceFile[10];
- char text[512];
- bool autoSelect;
- bool visible;
- bool isConditional;
- Condition condition;
- Common::Array<EntryAction*>actions;
- Common::Array<ConvEntry*>entries;
-};
-
-struct EntryInfo {
- EntryType targetType;
- int32 nodeIndex;
- int32 entryIndex;
-};
-
-struct MessageEntry {
- Common::Array<char*>messageStrings;
-};
-
-enum ConverseStyle {CONVSTYLE_EARTH, CONVSTYLE_SPACE};
-
-typedef Common::HashMap<Common::String,EntryInfo,Common::IgnoreCase_Hash,Common::IgnoreCase_EqualTo> OffsetHashMap;
-typedef Common::HashMap<Common::String,int32,Common::IgnoreCase_Hash,Common::IgnoreCase_EqualTo> ConvVarHashMap;
-
-class ConversationView : public View {
-public:
- ConversationView(MadsM4Engine *vm);
- ~ConversationView();
- void setNode(int32 nodeIndex);
-
- void onRefresh(RectList *rects, M4Surface *destSurface);
- bool onEvent(M4EventType eventType, int32 param, int x, int y, bool &captureEvents);
- int32 getCurrentNodeIndex() { return _currentNodeIndex; }
- void selectEntry(int entryIndex);
-
-private:
- void updateState();
- void playNextReply();
-
- int32 _currentNodeIndex;
- Common::Array<ConvEntry *> _activeItems;
- int _highlightedIndex;
- int _xEnd;
- bool _entriesShown;
- ConversationState _conversationState;
- SndHandle *_currentHandle;
-};
-
-class Converse {
-
-public:
- Converse(MadsM4Engine *vm) : _vm(vm) {}
- ~Converse() {}
-
- void startConversation(const char *convName, bool showConversebox = true, ConverseStyle style = CONVSTYLE_EARTH );
- void endConversation();
- const EntryInfo* getEntryInfo(int32 offset);
- ConvEntry *getNode(int32 index) { return _convNodes[index]; }
-
- void setValue(int32 offset, int32 value);
- int32 getValue(int32 offset);
- bool evaluateCondition(int32 leftVal, int32 op, int32 rightVal);
- bool performAction(EntryAction *action);
- /*
- void resume() { play(); }
- void play();
- */
-private:
- MadsM4Engine *_vm;
- Common::Array<ConvEntry*>_convNodes;
- Common::Array<MessageEntry*>_madsMessageList;
- Common::Array<char *>_convStrings;
- bool _playerCommandsAllowed;
- bool _interfaceWasVisible;
- ConverseStyle _style;
- OffsetHashMap _offsetMap;
- ConvVarHashMap _variables;
-
- void loadConversation(const char *convName);
- void loadConversationMads(const char *convName);
- void readConvEntryActions(Common::ReadStream *convS, ConvEntry *curEntry);
- void setEntryInfo(int32 offset, EntryType type, int32 nodeIndex, int32 entryIndex);
-};
-
-
-struct MadsTalkEntry {
- uint16 id;
- const char *desc;
-};
-
-#define MADS_TALK_SIZE 5
-
-class MadsConversation {
-private:
- MadsTalkEntry _talkList[MADS_TALK_SIZE];
-public:
- MadsConversation();
-
- MadsTalkEntry &operator[](int index) { return _talkList[index]; }
-};
-
-} // End of namespace M4
-
-#endif
diff --git a/engines/m4/detection.cpp b/engines/m4/detection.cpp
deleted file mode 100644
index 9c359c081f..0000000000
--- a/engines/m4/detection.cpp
+++ /dev/null
@@ -1,422 +0,0 @@
-/* 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 "base/plugins.h"
-
-#include "engines/advancedDetector.h"
-
-#include "m4/m4.h"
-#include "m4/resource.h"
-
-namespace M4 {
-
-struct M4GameDescription {
- ADGameDescription desc;
-
- int gameType;
- uint32 features;
-};
-
-int MadsM4Engine::getGameType() const { return _gameDescription->gameType; }
-uint32 MadsM4Engine::getFeatures() const { return _gameDescription->features; }
-Common::Language MadsM4Engine::getLanguage() const { return _gameDescription->desc.language; }
-Common::Platform MadsM4Engine::getPlatform() const { return _gameDescription->desc.platform; }
-
-} // End of namespace M4
-
-static const PlainGameDescriptor m4Games[] = {
- {"m4", "MADS/M4 engine game"},
- {"riddle", "Ripley's Believe It or Not!: The Riddle of Master Lu"},
- {"burger", "Orion Burger"},
- {"rex", "Rex Nebular and the Cosmic Gender Bender"},
- {"dragon", "DragonSphere"},
- {"dragoncd", "DragonSphere CD"},
- {"phantom", "Return of the Phantom"},
- {"phantomcd", "Return of the Phantom CD"},
- {0, 0}
-};
-
-namespace M4 {
-
-const char *MadsM4Engine::getGameFile(int fileType) {
- for (int i = 0; _gameDescription->desc.filesDescriptions[i].fileName; i++) {
- if (_gameDescription->desc.filesDescriptions[i].fileType == fileType)
- return _gameDescription->desc.filesDescriptions[i].fileName;
- }
- return NULL;
-}
-
-using Common::GUIO_NONE;
-using Common::GUIO_NOSPEECH;
-
-static const M4GameDescription gameDescriptions[] = {
- {
- {
- "burger",
- "",
- {
- { "burger.has", kFileTypeHash, "10c8064e9c771072122f50737ac97245", 730771},
- { NULL, 0, NULL, 0}
- },
- Common::EN_ANY,
- Common::kPlatformPC,
- ADGF_UNSTABLE,
- GUIO_NONE
- },
- GType_Burger,
- kFeaturesCD
- },
- {
- {
- "burger",
- "",
- {
- { "burger.has", kFileTypeHash, "55be8693a4c36e7efcdca0f0c77758ae", 724191},
- { NULL, 0, NULL, 0}
- },
- Common::DE_DEU,
- Common::kPlatformPC,
- ADGF_UNSTABLE,
- GUIO_NONE
- },
- GType_Burger,
- kFeaturesCD
- },
- {
- {
- "burger",
- "",
- {
- { "burger.has", kFileTypeHash, "795c98a74e351ec437a396bb29897daf", 730771},
- { NULL, 0, NULL, 0}
- },
- Common::RU_RUS,
- Common::kPlatformPC,
- ADGF_UNSTABLE,
- GUIO_NONE
- },
- GType_Burger,
- kFeaturesCD
- },
- {
- {
- "burger",
- "Demo",
- {
- { "burger.has", kFileTypeHash, "fc3f363b6153240a448bd3b7be9318da", 62159},
- { NULL, 0, NULL, 0}
- },
- Common::EN_ANY,
- Common::kPlatformPC,
- ADGF_DEMO | ADGF_UNSTABLE,
- GUIO_NONE
- },
- GType_Burger,
- kFeaturesDemo
- },
- {
- {
- "burger",
- "Demo",
- {
- { "overview.has", kFileTypeHash, "57aa43a3ef88a934a43e9b1890ef5e17", 10519},
- { NULL, 0, NULL, 0}
- },
- Common::EN_ANY,
- Common::kPlatformPC,
- ADGF_DEMO | ADGF_UNSTABLE,
- GUIO_NONE
- },
- GType_Burger,
- kFeaturesDemo
- },
- {
- {
- "riddle",
- "",
- {
- { "ripley.has", kFileTypeHash, "056d517360c89eb4c297a319f21a7071", 700469},
- { NULL, 0, NULL, 0}
- },
- Common::EN_ANY,
- Common::kPlatformPC,
- ADGF_UNSTABLE,
- GUIO_NONE
- },
- GType_Riddle,
- kFeaturesCD
- },
- {
- {
- "riddle",
- "",
- {
- { "ripley.has", kFileTypeHash, "d073582c9011d44dd0d7e2ede317a86d", 700469},
- { NULL, 0, NULL, 0}
- },
- Common::EN_ANY,
- Common::kPlatformPC,
- ADGF_UNSTABLE,
- GUIO_NONE
- },
- GType_Riddle,
- kFeaturesCD
- },
- {
- {
- "riddle",
- "",
- {
- { "ripley.has", kFileTypeHash, "d9e9f8befec432a047b1047fb2bc7aea", 710997},
- { NULL, 0, NULL, 0}
- },
- Common::DE_DEU,
- Common::kPlatformPC,
- ADGF_UNSTABLE,
- GUIO_NONE
- },
- GType_Riddle,
- kFeaturesCD
- },
- {
- {
- "riddle",
- "",
- {
- { "ripley.has", kFileTypeHash, "3d48c5700785d11e6a5bc832b95be918", 701973},
- { NULL, 0, NULL, 0}
- },
- Common::FR_FRA,
- Common::kPlatformPC,
- ADGF_UNSTABLE,
- GUIO_NONE
- },
- GType_Riddle,
- kFeaturesCD
- },
- {
- {
- "riddle",
- "",
- {
- { "ripley.has", kFileTypeHash, "5ee011cff7178dae3ddf6f9b7d4102ac", 701691},
- { NULL, 0, NULL, 0}
- },
- Common::ES_ESP,
- Common::kPlatformPC,
- ADGF_UNSTABLE,
- GUIO_NONE
- },
- GType_Riddle,
- kFeaturesCD
- },
- { // Demo
- {
- "riddle",
- "Demo",
- {
- { "ripley.has", kFileTypeHash, "3a90dd7052860b6e246ec7e0aaf202f6", 104527},
- { NULL, 0, NULL, 0}
- },
- Common::EN_ANY,
- Common::kPlatformPC,
- ADGF_DEMO | ADGF_UNSTABLE,
- GUIO_NONE
- },
- GType_Riddle,
- kFeaturesDemo
- },
- {
- {
- "rex",
- "",
- {
- { "global.hag", kFileTypeHAG, "0530cbeee109fc79cc24421128dea1ce", 2083078},
- { NULL, 0, NULL, 0}
- },
- Common::EN_ANY,
- Common::kPlatformPC,
- ADGF_UNSTABLE,
- GUIO_NOSPEECH
- },
- GType_RexNebular,
- kFeaturesNone
- },
- { // Demo
- {
- "rex",
- "Demo",
- {
- { "global.hag", kFileTypeHAG, "d5a481d14bc1bda66e46965a39badcc7", 220429},
- { NULL, 0, NULL, 0}
- },
- Common::EN_ANY,
- Common::kPlatformPC,
- ADGF_DEMO | ADGF_UNSTABLE,
- GUIO_NONE
- },
- GType_RexNebular,
- kFeaturesDemo
- },
- {
- {
- "dragon",
- "",
- {
- { "global.hag", kFileTypeHAG, "c3a6877665e7f21bf3d2b1e667155562", 2320567},
- { NULL, 0, NULL, 0}
- },
- Common::EN_ANY,
- Common::kPlatformPC,
- ADGF_UNSTABLE,
- GUIO_NOSPEECH
- },
- GType_DragonSphere,
- kFeaturesNone
- },
- { // CD version
- {
- "dragoncd",
- "",
- {
- { "global.hag", kFileTypeHAG, "c3a6877665e7f21bf3d2b1e667155562", 2320567},
- { "speech.hag", kFileTypeHAG, NULL, -1},
- { NULL, 0, NULL, 0}
- },
- Common::EN_ANY,
- Common::kPlatformPC,
- ADGF_UNSTABLE,
- GUIO_NONE
- },
- GType_DragonSphere,
- kFeaturesCD
- },
- { // Demo
- {
- "dragon",
- "Demo",
- {
- { "global.hag", kFileTypeHAG, "541e12d8e9aad0c65d65f150de47582e", 212718},
- { NULL, 0, NULL, 0}
- },
- Common::EN_ANY,
- Common::kPlatformPC,
- ADGF_DEMO | ADGF_UNSTABLE,
- GUIO_NONE
- },
- GType_DragonSphere,
- kFeaturesDemo
- },
- {
- {
- "phantom",
- "",
- {
- { "global.hag", kFileTypeHAG, "bdce9ca93a015f0883d1bc0fabd0cdfa", 812150},
- { NULL, 0, NULL, 0}
- },
- Common::EN_ANY,
- Common::kPlatformPC,
- ADGF_UNSTABLE,
- GUIO_NOSPEECH
- },
- GType_Phantom,
- kFeaturesNone
- },
- { // CD version
- {
- "phantomcd",
- "",
- {
- { "global.hag", kFileTypeHAG, "8a51c984eb4c64e8b30a7e6670f6bddb", 101154000},
- { NULL, 0, NULL, 0}
- },
- Common::EN_ANY,
- Common::kPlatformPC,
- ADGF_UNSTABLE,
- GUIO_NONE
- },
- GType_Phantom,
- kFeaturesCD
- },
- { // CD version
- {
- "phantom",
- "Demo",
- {
- { "global.hag", kFileTypeHAG, "e810adbc6fac77ac2fec841a9ec5e20e", 115266},
- { NULL, 0, NULL, 0}
- },
- Common::EN_ANY,
- Common::kPlatformPC,
- ADGF_DEMO | ADGF_UNSTABLE,
- GUIO_NONE
- },
- GType_Phantom,
- kFeaturesDemo
- },
- { AD_TABLE_END_MARKER, 0, 0 }
-};
-
-} // End of namespace M4
-
-static const char *directoryGlobs[] = {
- "option1",
- 0
-};
-
-class M4MetaEngine : public AdvancedMetaEngine {
-public:
- M4MetaEngine() : AdvancedMetaEngine(M4::gameDescriptions, sizeof(M4::M4GameDescription), m4Games) {
- _singleid = "m4";
- _guioptions = Common::GUIO_NOMIDI;
- _maxScanDepth = 2;
- _directoryGlobs = directoryGlobs;
- }
-
- virtual const char *getName() const {
- return "MADS/M4";
- }
-
- virtual const char *getOriginalCopyright() const {
- return "Riddle of Master Lu & Orion Burger (C) Sanctuary Woods";
- }
-
- virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
-};
-
-bool M4MetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
- const M4::M4GameDescription *gd = (const M4::M4GameDescription *)desc;
- if (gd) {
- if ((gd->gameType == M4::GType_Burger) || (gd->gameType == M4::GType_Riddle))
- *engine = new M4::M4Engine(syst, gd);
- else
- *engine = new M4::MadsEngine(syst, gd);
- }
- return gd != 0;
-}
-
-#if PLUGIN_ENABLED_DYNAMIC(M4)
- REGISTER_PLUGIN_DYNAMIC(M4, PLUGIN_TYPE_ENGINE, M4MetaEngine);
-#else
- REGISTER_PLUGIN_STATIC(M4, PLUGIN_TYPE_ENGINE, M4MetaEngine);
-#endif
diff --git a/engines/m4/dialogs.cpp b/engines/m4/dialogs.cpp
deleted file mode 100644
index 2b2c479673..0000000000
--- a/engines/m4/dialogs.cpp
+++ /dev/null
@@ -1,560 +0,0 @@
-/* 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 "m4/dialogs.h"
-#include "common/file.h"
-#include "common/textconsole.h"
-
-namespace M4 {
-
-static void strToUpper(char *s) {
- while (*s) {
- *s = toupper(*s);
- ++s;
- }
-}
-
-static void strToLower(char *s) {
- while (*s) {
- *s = tolower(*s);
- ++s;
- }
-}
-
-const RGB8 DIALOG_PALETTE[8] = {
- {0x80, 0x80, 0x80}, {0x90, 0x90, 0x90}, {0x70, 0x70, 0x70}, {0x9c, 0x9c, 0x9c},
- {0x80, 0x80, 0x80}, {0x90, 0x90, 0x90}, {0xDC, 0xDC, 0xDC}, {0x00, 0x00, 0x00}
-};
-
-#define ROR16(v,amt) (((uint16)(v) >> amt) | ((uint16)(v) << (16 - amt)))
-
-const int DIALOG_SPACING = 1;
-
-/**
- * Handles any dialog initialisation
- */
-void Dialog::initDialog() {
- incLine();
-}
-
-/**
- * Adds a new line to the dialog output
- */
-void Dialog::incLine() {
- _lineX = 0;
- _widthX = 0;
-
- _lines.push_back(*new DialogLine());
- assert(_lines.size() <= 20);
-}
-
-/**
- * Writes some text to the dialog output, taking care of word wrapping if the text size
- * exceeds the dialog's width
- */
-void Dialog::writeChars(const char *srcLine) {
- char wordStr[80];
- char line[80];
- int lineLen, lineWidth;
- const char *srcP = srcLine;
-
- while (*srcP) {
- bool wordEndedP = false, newlineP = false;
- char *destP = &wordStr[0];
- Common::set_to(&wordStr[0], &wordStr[80], 0);
-
- // Try and get the next word
- for (;;) {
- char v = *srcP;
- *destP++ = v;
-
- if (v == '\0') break;
- if (v == '\n') {
- newlineP = true;
- ++srcP;
- --destP;
- break;
- }
-
- if (v == ' ') {
- // Word separator
- ++srcP;
- --destP;
- wordEndedP = true;
- } else {
- // Standard character
- if (!wordEndedP)
- // Still in the initial word
- ++srcP;
- else {
- // First character of next word, so time to break
- --destP;
- break;
- }
- }
- }
-
- if (destP < &wordStr[0])
- destP = &wordStr[0];
- *destP = '\0';
-
- lineLen = strlen(wordStr);
-
- strcpy(line, "");
- if (_lineX > 0)
- strcat(line, " ");
- strcat(line, wordStr);
-
- lineLen = strlen(line);
- lineWidth = _vm->_font->current()->getWidth(line, DIALOG_SPACING);
-
- if (((_lineX + lineLen) > _widthChars) || ((_widthX + lineWidth) > _dialogWidth)) {
- incLine();
- appendText(wordStr);
- } else {
- appendText(line);
- }
-
- if (newlineP)
- incLine();
- }
-}
-
-/**
- * Appends some text to the current dialog line
- */
-void Dialog::appendText(const char *line) {
- _lineX += strlen(line);
- _widthX += _vm->_font->current()->getWidth(line, DIALOG_SPACING);
-
- strcat(_lines[_lines.size() - 1].data, line);
-}
-
-/**
- * Adds a line of text to the dialog lines list
- */
-void Dialog::addLine(const char *line, bool underlineP) {
- if ((_widthX > 0) || (_lineX > 0))
- incLine();
-
- int lineWidth = _vm->_font->current()->getWidth(line, DIALOG_SPACING);
- int lineLen = strlen(line);
-
- if ((lineWidth > _dialogWidth) || (lineLen >= _widthChars))
- writeChars(line);
- else {
- _lines[_lines.size() - 1].xp = (_dialogWidth - 10 - lineWidth) / 2;
- strcpy(_lines[_lines.size() - 1].data, line);
- }
-
- if (underlineP)
- _lines[_lines.size() - 1].underline = true;
-
- incLine();
-}
-
-/**
- * Adds a bar separation line to the dialog lines list
- */
-void Dialog::addBarLine() {
- if ((_widthX > 0) || (_lineX > 0))
- incLine();
-
- // Flag the line as being a bar separator
- _lines[_lines.size() - 1].barLine = true;
- incLine();
-}
-
-/**
- * Retrieves a specified vocab entry
- */
-void Dialog::getVocab(int vocabId, char **line) {
- assert(vocabId > 0);
- const char *vocabStr = _madsVm->globals()->getVocab(vocabId);
- strcpy(*line, vocabStr);
-
- if (_commandCase)
- strToUpper(*line);
- else
- strToLower(*line);
-
- // Move the string pointer to after the added string
- while (!**line)
- ++*line;
-}
-
-bool Dialog::handleNounSuffix(char *destP, int nounNum, const char *srcP) {
- char srcLine[40];
-
- // The next source character must be a colon in front of the first verb
- if (*srcP != ':')
- return false;
-
- // Copy the remainder of the line into a temporary buffer to get the seperate verbs
- strcpy(srcLine, ++srcP);
- char *altP = strchr(srcLine, ':');
- if (altP)
- *altP = '\0';
-
- if (*srcP != '\0') {
- while (*srcP != ':') {
- ++srcP;
- if (!*srcP) break;
- }
- }
-
- if (*srcP != '\0')
- ++srcP;
-
- //
- char var_FC[40];
- char tempLine[40];
- strcpy(var_FC, srcP);
- char *tmpP = &tempLine[0];
- char *tmp2P = tmpP;
-
- uint16 _vocabIds[2] = {1, 1}; // FIXME/TODO: Proper vocab ids
- getVocab(_vocabIds[nounNum], &tmpP);
-
- if ((*(tmpP - 1) != 'S') && (*(tmpP - 1) != 's')) {
- // Singular object
- tmpP = &var_FC[0];
- } else if (!strcmp(tempLine, "a ")) {
- // Pontially plural
- char ch = tolower(*tmp2P);
-
- if (!((ch > 'U') || ((ch != 'A') && (ch != 'E') && (ch != 'I') && (ch != 'O'))))
- strcpy(tempLine, "an ");
- }
-
- strcpy(destP, tmpP);
- return true;
-}
-
-/**
- * Sets up an area within the dialog for textual input
- */
-void Dialog::setupInputArea() {
- _askPosition.x = _lineX + 1;
- _askPosition.y = _lines.size();
-
- incLine();
-}
-
-/**
- * Checks whether the start of an extracted command matches a specified given command constant
- */
-bool Dialog::matchCommand(const char *s1, const char *s2) {
- bool result = scumm_strnicmp(s1, s2, strlen(s2)) == 0;
- _commandCase = isupper(static_cast<unsigned char>(*s1));
- return result;
-}
-
-Dialog::Dialog(MadsM4Engine *vm, const char *msgData, const char *title): View(vm, Common::Rect(0, 0, 0, 0)) {
- assert(msgData);
- _vm->_font->setFont(FONT_INTERFACE_MADS);
-
- const char *srcP = msgData;
- bool skipLine = false;
- bool initFlag = false;
- bool cmdFlag = false;
- bool crFlag = false;
- bool underline = false;
-
- _screenType = LAYER_DIALOG;
- _widthChars = 0;
- _dialogIndex = 0;
- _askPosition.x = 0;
- _askPosition.y = 0;
- _lineX = 0;
- _widthX = 0;
- _dialogWidth = 0;
- _commandCase = false;
-
- char dialogLine[256];
- char cmdText[80];
- char *lineP = &dialogLine[0];
- char *cmdP = NULL;
-
- while (srcP && *(srcP - 1) != '\0') {
- if ((*srcP == '\n') || (*srcP == '\0')) {
- // Line completed
- *lineP = '\0';
- ++srcP;
-
- if (!initFlag) {
- initDialog();
- initFlag = true;
- }
-
- if (!skipLine)
- writeChars(dialogLine);
- else {
- addLine(dialogLine, underline);
-
- if (crFlag)
- incLine();
- }
-
- // Clear the current line contents
- dialogLine[0] = '\0';
- lineP = &dialogLine[0];
- skipLine = crFlag = underline = false;
- continue;
-
- } else if (*srcP == '[') {
- // Start of a command sequence
- cmdFlag = true;
- cmdP = &cmdText[0];
- ++srcP;
- continue;
- } else if (*srcP == ']') {
- // End of a command sequence
- *cmdP = '\0';
- cmdFlag = false;
- strToUpper(cmdText);
-
- if (matchCommand(cmdText, "ASK")) {
- setupInputArea();
-
- } else if (matchCommand(cmdText, "BAR")) {
- // Adds a full-width line instead of normal text
- addBarLine();
-
- } else if (matchCommand(cmdText, "CENTER")) {
- // Center command
- skipLine = true;
-
- } else if (matchCommand(cmdText, "CR")) {
- // CR command
- if (skipLine)
- crFlag = true;
- else if (!initFlag) {
- initDialog();
- initFlag = true;
- }
-
- } else if (matchCommand(cmdText, "NOUN1")) {
- // Noun command 1
- handleNounSuffix(lineP, 1, cmdText + 5);
-
- } else if (matchCommand(cmdText, "NOUN2")) {
- // Noun command 2
- handleNounSuffix(lineP, 2, cmdText + 5);
-
- } else if (matchCommand(cmdText, "SENTENCE")) {
- // Sentence command - loads the title into the line buffer
- strcpy(dialogLine, title);
- strToUpper(dialogLine);
- lineP += strlen(dialogLine) + 1;
-
- } else if (matchCommand(cmdText, "TAB")) {
- // Specifies the X offset for the current line
- _lines[_lines.size() - 1].xp = atoi(cmdText + 3);
-
- } else if (matchCommand(cmdText, "TITLE")) {
- // Title command - specifies the dialog width in number of characters
- skipLine = true;
- crFlag = true;
- underline = true;
-
- int id = atoi(cmdText + 5);
- if (id > 0) {
- // Suffix provided - specifies the dialog width in number of chars
- _widthChars = id * 2;
- _dialogWidth = id * (_vm->_font->current()->getMaxWidth() + DIALOG_SPACING) + 10;
- }
-
- } else if (matchCommand(cmdText, "UNDER")) {
- // Underline command
- underline = true;
-
- } else if (matchCommand(cmdText, "VERB")) {
- // Verb/vocab retrieval
- int verbId = 1; // TODO: Get correct vocab
- getVocab(verbId, &lineP);
-
-
- } else if (matchCommand(cmdText, "INDEX")) {
- // Index command
- _dialogIndex = atoi(cmdText + 5);
- } else {
- error("Unknown dialog command '%s' encountered", cmdText);
- }
- }
-
- *lineP++ = *srcP;
- if (cmdFlag)
- *cmdP++ = *srcP;
- ++srcP;
- }
-
- draw();
-}
-
-Dialog::Dialog(MadsM4Engine *vm, int widthChars): View(vm, Common::Rect(0, 0, 0, 0)) {
- _vm->_font->setFont(FONT_INTERFACE_MADS);
- _widthChars = widthChars * 2;
- _dialogWidth = widthChars * (_vm->_font->current()->getMaxWidth() + DIALOG_SPACING) + 10;
- _screenType = LAYER_DIALOG;
- _lineX = 0;
- _widthX = 0;
- _askPosition.x = 0;
- _askPosition.y = 0;
-}
-
-Dialog::~Dialog() {
- _vm->_palette->deleteRange(_palette);
- delete _palette;
-}
-
-void Dialog::draw() {
- assert(_widthChars != 0);
-
- // Set up the palette for this view
- _palette = new RGBList(8, NULL);
- _palette->setRange(0, 8, DIALOG_PALETTE);
- _vm->_palette->addRange(_palette);
-
- // Calculate bounds
- int dlgWidth = _dialogWidth;
- int dlgHeight = _lines.size() * (_vm->_font->current()->getHeight() + 1) + 10;
- int dialogX = (_vm->_screen->width() - dlgWidth) / 2;
- int dialogY = (_vm->_screen->height() - dlgHeight) / 2;
-
- // Create the surface for the dialog
- create(dlgWidth, dlgHeight, Graphics::PixelFormat::createFormatCLUT8());
- _coords.left = dialogX;
- _coords.top = dialogY;
- _coords.right = dialogX + dlgWidth + 1;
- _coords.bottom = dialogY + dlgHeight + 1;
-
- // Set up the dialog
- fillRect(Common::Rect(0, 0, width(), height()), 3);
- setColor(2);
- hLine(1, width() - 1, height() - 2); // Bottom edge
- hLine(0, width(), height() - 1);
- vLine(width() - 2, 2, height()); // Right edge
- vLine(width() - 1, 1, height());
-
- // Render dialog interior
- uint16 seed = 0xb78e;
- for (int yp = 2; yp < (height() - 2); ++yp) {
- byte *destP = this->getBasePtr(2, yp);
-
- for (int xp = 2; xp < (width() - 2); ++xp) {
- // Adjust the random seed
- uint16 v = seed;
- seed += 0x181D;
- v = ROR16(v, 9);
- seed = (seed ^ v) + ROR16(v, 3);
-
- *destP++ = ((seed & 0x10) != 0) ? 1 : 0;
- }
- }
-
- // If an ask position is set, create the input area frame
- if (_askPosition.y > 0) {
-
- }
-
- // Handle drawing the text contents
- _vm->_font->current()->setColors(7, 7, 7);
- setColor(7);
-
- for (uint lineCtr = 0, yp = 5; lineCtr < _lines.size(); ++lineCtr, yp += _vm->_font->current()->getHeight() + 1) {
-
- if (_lines[lineCtr].barLine) {
- // Bar separation line
- hLine(5, width() - 6, ((_vm->_font->current()->getHeight() + 1) >> 1) + yp);
- } else {
- // Standard line
- Common::Point pt(_lines[lineCtr].xp + 5, yp);
- if (_lines[lineCtr].xp & 0x40)
- ++pt.y;
-
- _vm->_font->current()->writeString(this, _lines[lineCtr].data, pt.x, pt.y, 0, DIALOG_SPACING);
-
- if (_lines[lineCtr].underline)
- // Underline needed
- hLine(pt.x, pt.x + _vm->_font->current()->getWidth(_lines[lineCtr].data, DIALOG_SPACING),
- pt.y + _vm->_font->current()->getHeight());
- }
- }
-
- // Do final translation of the dialog to game palette
- this->translate(_palette);
-}
-
-bool Dialog::onEvent(M4EventType eventType, int32 param1, int x, int y, bool &captureEvents) {
- if (_vm->_mouse->getCursorNum() != CURSOR_ARROW)
- _vm->_mouse->setCursorNum(CURSOR_ARROW);
-
- captureEvents = true;
-
- if (eventType == MEVENT_LEFT_CLICK) {
- captureEvents = false;
- _vm->_viewManager->deleteView(this);
- }
-
- return true;
-}
-
-void Dialog::display(MadsM4Engine *vm, int widthChars, const char **descEntries) {
- Dialog *dlg = new Dialog(vm, widthChars);
-
- while (*descEntries != NULL) {
- dlg->incLine();
- dlg->writeChars(*descEntries);
-
- int lineWidth = vm->_font->current()->getWidth(*descEntries, DIALOG_SPACING);
- dlg->_lines[dlg->_lines.size() - 1].xp = (dlg->_dialogWidth - 10 - lineWidth) / 2;
- ++descEntries;
- }
-
- dlg->_lines[0].underline = true;
-
- dlg->draw();
- vm->_viewManager->addView(dlg);
- vm->_viewManager->moveToFront(dlg);
-}
-
-void Dialog::getValue(MadsM4Engine *vm, const char *title, const char *text, int numChars, int currentValue) {
- int titleLen = strlen(title);
- Dialog *dlg = new Dialog(vm, titleLen + 4);
-
- dlg->addLine(title, true);
- dlg->writeChars("\n");
-
- dlg->writeChars(text);
- dlg->setupInputArea();
- dlg->writeChars("\n");
-
- dlg->draw();
- vm->_viewManager->addView(dlg);
- vm->_viewManager->moveToFront(dlg);
-
- // TODO: How to wait until the dialog is closed
-
-}
-
-} // End of namespace M4
diff --git a/engines/m4/dialogs.h b/engines/m4/dialogs.h
deleted file mode 100644
index ea3519c9e3..0000000000
--- a/engines/m4/dialogs.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* 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 M4_DIALOGS_H
-#define M4_DIALOGS_H
-
-#include "m4/m4.h"
-#include "m4/viewmgr.h"
-#include "common/list.h"
-
-namespace M4 {
-
-class DialogLine {
-public:
- char data[100];
- uint8 xp;
- bool underline;
- bool barLine;
-
- DialogLine() { data[0] = '\0'; xp = 0; underline = barLine = false; }
-};
-
-typedef void (*GetValueFn)(MadsM4Engine *vm, int result);
-
-class Dialog : public View {
-private:
- Common::Array<DialogLine> _lines;
- int _widthChars;
- int _dialogWidth;
- int _dialogIndex;
- Common::Point _askPosition;
- RGBList *_palette;
- int _lineX;
- int _widthX;
- bool _commandCase;
-
- void initDialog();
- void incLine();
- bool matchCommand(const char *s1, const char *s2);
- void writeChars(const char *line);
- void addLine(const char *line, bool underlineP = false);
- void appendText(const char *line);
- void addBarLine();
- void getVocab(int vocabId, char **line);
- bool handleNounSuffix(char *destP, int nounNum, const char *srcP);
- void setupInputArea();
- void draw();
-public:
- Dialog(MadsM4Engine *vm, const char *msgData, const char *title = NULL);
- Dialog(MadsM4Engine *vm, int widthChars);
- virtual ~Dialog();
-
- static void display(MadsM4Engine *vm, int widthChars, const char **descEntries);
- static void getValue(MadsM4Engine *vm, const char *title, const char *text, int numChars, int currentValue);
-
- bool onEvent(M4EventType eventType, int32 param1, int x, int y, bool &captureEvents);
-};
-
-} // End of namespace M4
-
-#endif
diff --git a/engines/m4/events.cpp b/engines/m4/events.cpp
deleted file mode 100644
index b476d08c9c..0000000000
--- a/engines/m4/events.cpp
+++ /dev/null
@@ -1,365 +0,0 @@
-/* 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.
- *
- */
-
-// TODO: There is a 'please_hyperwalk' variable that gets accessed that is meant to be global, but
-// at the moment it's implemented as a local variable
-
-#include "graphics/cursorman.h"
-
-#include "m4/events.h"
-#include "m4/graphics.h"
-#include "m4/scene.h"
-#include "m4/viewmgr.h"
-#include "m4/m4.h"
-
-namespace M4 {
-
-bool please_hyperwalk = false;
-
-/*--------------------------------------------------------------------------*
- * Events *
- * *
- * Implements an interface to the event system *
- *--------------------------------------------------------------------------*/
-
-Events::Events(MadsM4Engine *vm) : _vm(vm) {
- _mouseState = MSTATE_NO_EVENT;
- quitFlag = false;
- _keyCode = 0;
- _mouseButtons = 0;
- _ctrlFlag = false;
-
- if (_vm->isM4())
- _console = new M4Console(_m4Vm);
- else
- _console = new MadsConsole(_madsVm);
-}
-
-Events::~Events() {
- delete _console;
-}
-
-M4EventType Events::handleEvents() {
- static int oldX = -1, oldY = -1;
- static uint32 dclickTime = 0;
-
- // Handle event types
- while (g_system->getEventManager()->pollEvent(_event)) {
- switch (_event.type) {
- case Common::EVENT_QUIT:
- quitFlag = true;
- break;
- case Common::EVENT_KEYDOWN:
- // Note: The Ctrl-D ScummVM shortcut has been specialised so it will only activate the debugger
- // if it's the first key pressed after the Ctrl key is held down
- if ((_event.kbd.keycode == Common::KEYCODE_LCTRL) || (_event.kbd.keycode == Common::KEYCODE_RCTRL))
- _ctrlFlag = true;
-
- else if (_event.kbd.hasFlags(Common::KBD_CTRL)) {
- if ((_event.kbd.keycode == Common::KEYCODE_d) && _ctrlFlag) {
- _console->attach();
- _console->onFrame();
- }
- _ctrlFlag = false;
- }
- _keyCode = (int32)_event.kbd.keycode | ((_event.kbd.flags & (Common::KBD_CTRL | Common::KBD_ALT | Common::KBD_SHIFT)) << 24);
-
-
- break;
- case Common::EVENT_LBUTTONDOWN:
- case Common::EVENT_LBUTTONUP:
- case Common::EVENT_RBUTTONDOWN:
- case Common::EVENT_RBUTTONUP:
- case Common::EVENT_MBUTTONDOWN:
- case Common::EVENT_MBUTTONUP:
- case Common::EVENT_MOUSEMOVE:
- case Common::EVENT_WHEELUP:
- case Common::EVENT_WHEELDOWN:
- _vm->_mouse->handleEvent(_event);
- break;
- default:
- break;
- }
- }
-
- _mouseButtons = g_system->getEventManager()->getButtonState();
-
- // State machine for moving between states
- switch (_mouseState) {
- case MSTATE_NO_EVENT:
- if (_mouseButtons & LEFT_BUTTON_DOWN) {
- if ((dclickTime != 0) && (g_system->getMillis() < dclickTime)) {
- _mouseState = MSTATE_DOUBLECLICK_DOWN;
- dclickTime = 0;
- return MEVENT_DOUBLECLICK;
- }
- dclickTime = 0;
- _mouseState = MSTATE_LEFT_CLICK_DOWN;
- return MEVENT_LEFT_CLICK;
- }
- if (_mouseButtons & RIGHT_BUTTON_DOWN) {
- _mouseState = MSTATE_RIGHT_CLICK_DOWN;
- return MEVENT_RIGHT_CLICK;
- }
- if ((_event.mouse.x != oldX) || (_event.mouse.y != oldY)) {
- oldX = _event.mouse.x; oldY = _event.mouse.y;
- return MEVENT_MOVE;
- }
- return MEVENT_NO_EVENT;
-
- case MSTATE_LEFT_CLICK_DOWN:
- if (!(_mouseButtons & LEFT_BUTTON_DOWN)) {
- dclickTime = g_system->getMillis() + 1000 * 15 / 60;
- _mouseState = MSTATE_NO_EVENT;
- return MEVENT_LEFT_RELEASE;
- }
- if ((_event.mouse.x != oldX) || (_event.mouse.y != oldY)) {
- oldX = _event.mouse.x; oldY = _event.mouse.y;
- return MEVENT_LEFT_DRAG;
- }
- return MEVENT_LEFT_HOLD;
-
- case MSTATE_RIGHT_CLICK_DOWN:
- if (!(_mouseButtons & RIGHT_BUTTON_DOWN)) {
- _mouseState = MSTATE_NO_EVENT;
- please_hyperwalk = true;
- return MEVENT_RIGHT_RELEASE;
- }
- if ((_event.mouse.x != oldX) || (_event.mouse.y != oldY)) {
- oldX = _event.mouse.x; oldY = _event.mouse.y;
- return MEVENT_RIGHT_DRAG;
- }
- return MEVENT_RIGHT_HOLD;
-
- case MSTATE_DOUBLECLICK_DOWN:
- if (!(_mouseButtons & LEFT_BUTTON_DOWN)) {
- _mouseState = MSTATE_NO_EVENT;
- return MEVENT_DOUBLECLICK_RELEASE;
- }
- if ((_event.mouse.x != oldX) || (_event.mouse.y != oldY)) {
- oldX = _event.mouse.x; oldY = _event.mouse.y;
- return MEVENT_DOUBLECLICK_DRAG;
- }
- return MEVENT_DOUBLECLICK_HOLD;
-
- default:
- return MEVENT_NO_EVENT;
- }
-}
-
-bool Events::kbdCheck(uint32 &keyCode) {
- if (_keyCode == 0)
- return false;
-
- keyCode = _keyCode;
- _keyCode = 0;
- return true;
-}
-
-
-/*--------------------------------------------------------------------------*
- * Mouse *
- * *
- * Implements an interface to the mouse *
- *--------------------------------------------------------------------------*/
-
-Mouse::Mouse(MadsM4Engine *vm) : _vm(vm) {
- _locked = false;
- _cursorOn = false;
- _cursor = NULL;
- _cursorSprites = NULL;
- resetMouse();
-}
-
-Mouse::~Mouse() {
- delete _cursorSprites;
-}
-
-bool Mouse::init(const char *seriesName, RGB8 *palette) {
- Common::SeekableReadStream *stream = _vm->res()->get(seriesName);
- int colorCount = 0;
- RGB8* cursorPalette;
-
- _cursorSprites = new SpriteAsset(_vm, stream, stream->size(), seriesName);
-
- // Remove cursor special pixels and set the mouse cursor hotspot in MADS games
- if (!_vm->isM4()) {
- byte *data = NULL;
- for (int i = 0; i < _cursorSprites->getCount(); i++) {
- bool hotSpotSet = false;
-
- for (int x = 0; x < _cursorSprites->getFrame(i)->width(); x++) {
- for (int y = 0; y < _cursorSprites->getFrame(i)->height(); y++) {
- data = _cursorSprites->getFrame(i)->getBasePtr(x, y);
- if (*data == 1) {
- // It seems that some cursors have more than one hotspot
- // In such a case, the first hotspot seems to set the x and
- // the second one the y hotspot offset
- if (!hotSpotSet) {
- _cursorSprites->getFrame(i)->xOffset = x;
- _cursorSprites->getFrame(i)->yOffset = y;
- hotSpotSet = true;
- } else {
- _cursorSprites->getFrame(i)->yOffset = y;
- }
- *data = 0;
- }
- } // for y
- } // for x
- } // for i
- }
-
- colorCount = _cursorSprites->getColorCount();
- cursorPalette = _cursorSprites->getPalette();
- _vm->_palette->setPalette(cursorPalette, 0, colorCount);
-
- //debugCN(kDebugCore, "Cursor count: %d\n", _cursorSprites->getCount());
-
- _vm->res()->toss(seriesName);
-
- _currentCursor = -1;
- return true;
-}
-
-bool Mouse::setCursorNum(int cursorIndex) {
- if ((cursorIndex < 0) || (cursorIndex >= (int)_cursorSprites->getCount()))
- return false;
-
- _lockedCursor = cursorIndex;
- if (_locked)
- // Cursor is locked, so don't go ahead with changing cursor
- return true;
-
- _currentCursor = _lockedCursor;
- _cursor = _cursorSprites->getFrame(cursorIndex);
-
- // Set the cursor to the sprite
- CursorMan.replaceCursor((const byte *)_cursor->getBasePtr(), _cursor->width(), _cursor->height(),
- _cursor->xOffset, _cursor->yOffset, TRANSPARENT_COLOR_INDEX);
-
- return true;
-}
-
-int Mouse::cursorCount() {
- return _cursorSprites->getCount();
-}
-
-void Mouse::cursorOn() {
- _cursorOn = true;
- CursorMan.showMouse(!inHideArea());
-}
-
-void Mouse::cursorOff() {
- _cursorOn = false;
- CursorMan.showMouse(false);
-}
-
-void Mouse::lockCursor(int cursorIndex) {
- _locked = false;
- setCursorNum(cursorIndex);
- _locked = true;
-}
-
-void Mouse::unlockCursor() {
- _locked = false;
- setCursorNum(_lockedCursor);
-}
-
-const char *Mouse::getVerb() {
- switch (_vm->_mouse->getCursorNum()) {
- case CURSOR_LOOK:
- return "LOOK AT";
- case CURSOR_TAKE:
- return "TAKE";
- case CURSOR_USE:
- return "GEAR";
- default:
- return NULL;
- }
-}
-
-void Mouse::resetMouse() {
- _hideRect.left = -1;
- _hideRect.top = -1;
- _hideRect.right = -1;
- _hideRect.bottom = -1;
- _showRect.left = -1;
- _showRect.top = -1;
- _showRect.right = -1;
- _showRect.bottom = -1;
-}
-
-void Mouse::setHideRect(Common::Rect &r) {
- _hideRect = r;
-}
-
-void Mouse::setShowRect(Common::Rect &r) {
- _showRect = r;
-}
-
-const Common::Rect *Mouse::getHideRect() {
- return &_hideRect;
-}
-
-const Common::Rect *Mouse::getShowRect() {
- if ((_showRect.top == -1) || (_showRect.left == -1)) {
- // Show rectangle uninitialised - set it to current screen dimensions
- _showRect.top = 0;
- _showRect.left = 0;
- _showRect.right = _vm->_screen->width() - 1;
- _showRect.bottom = _vm->_screen->height() -1;
- }
-
- return &_showRect;
-}
-
-void Mouse::handleEvent(Common::Event &event) {
- _currentPos.x = event.mouse.x;
- _currentPos.y = event.mouse.y;
-
- // If mouse is turned on, check to see if the position is in the hide rect, or outside the show rect.
- // If so, handle toggling the visibility of the mouse
- bool showFlag = !inHideArea();
- if (_cursorOn && (CursorMan.isVisible() != showFlag)) {
- CursorMan.showMouse(showFlag);
- }
-}
-
-bool Mouse::inHideArea() {
- // Returns true if the mouse is inside a specified hide rect, or if a show rect is specified and
- // the mouse is currently outside it
- if ((_currentPos.x >= _hideRect.left) && (_currentPos.x <= _hideRect.right) &&
- (_currentPos.y >= _hideRect.top) && (_currentPos.y <= _hideRect.bottom))
- // Inside a hide area
- return true;
-
-
- if ((_showRect.top == -1) && (_showRect.left == -1))
- // No show rect defined
- return false;
-
- // Return true if the mouse is outside the show area
- return (_currentPos.x < _showRect.left) || (_currentPos.x > _showRect.right) ||
- (_currentPos.y < _showRect.top) || (_currentPos.y > _showRect.bottom);
-}
-
-} // End of namespace M4
diff --git a/engines/m4/events.h b/engines/m4/events.h
deleted file mode 100644
index 6e7cf68555..0000000000
--- a/engines/m4/events.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/* 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 M4_EVENTS_H
-#define M4_EVENTS_H
-
-#include "common/events.h"
-#include "common/rect.h"
-
-#include "m4/globals.h"
-#include "m4/assets.h"
-#include "m4/sprite.h"
-#include "m4/graphics.h"
-#include "m4/console.h"
-
-namespace M4 {
-
-#define LEFT_BUTTON_DOWN 1 << 0
-#define RIGHT_BUTTON_DOWN 1 << 1
-
-enum M4EventType {
- MEVENT_NO_EVENT, MEVENT_MOVE,
- MEVENT_LEFT_CLICK, MEVENT_LEFT_HOLD, MEVENT_LEFT_DRAG, MEVENT_LEFT_RELEASE,
- MEVENT_RIGHT_CLICK, MEVENT_RIGHT_HOLD, MEVENT_RIGHT_DRAG, MEVENT_RIGHT_RELEASE,
- MEVENT_BOTH_CLICK, MEVENT_BOTH_HOLD, MEVENT_BOTH_DRAG, MEVENT_BOTH_RELEASE,
- MEVENT_DOUBLECLICK, MEVENT_DOUBLECLICK_HOLD, MEVENT_DOUBLECLICK_DRAG, MEVENT_DOUBLECLICK_RELEASE,
- KEVENT_KEY
-};
-
-enum M4MouseState {
- MSTATE_NO_EVENT, MSTATE_LEFT_CLICK_DOWN, MSTATE_RIGHT_CLICK_DOWN, MSTATE_BOTH_CLICK_DOWN,
- MSTATE_DOUBLECLICK_DOWN
-};
-
-enum M4CommonCursors {
- CURSOR_ARROW = 0,
- CURSOR_WAIT = 1,
- CURSOR_HOURGLASS = 5,
- CURSOR_LOOK = 6,
- CURSOR_TAKE = 8,
- CURSOR_USE = 9
-};
-
-class M4Sprite;
-class SpriteAsset;
-
-class Events {
-private:
- MadsM4Engine *_vm;
- Common::Event _event;
- M4MouseState _mouseState;
- int32 _keyCode;
- int _mouseButtons;
- Console *_console;
- bool _ctrlFlag;
-public:
- bool quitFlag;
- Events(MadsM4Engine *vm);
- virtual ~Events();
-
- Common::Event &event() { return _event; }
- Common::EventType type() { return _event.type; }
-
- // M4-centric methods
- M4EventType handleEvents();
- bool kbdCheck(uint32 &keyCode);
- int getMouseButtonsState() { return _mouseButtons; }
- Console* getConsole() { return _console; }
-};
-
-
-class Mouse {
-private:
- MadsM4Engine *_vm;
- int _currentCursor, _lockedCursor;
- bool _locked;
- bool _cursorOn;
- M4Sprite *_cursor;
- SpriteAsset *_cursorSprites;
- Common::Rect _hideRect, _showRect;
- Common::Point _currentPos;
-
- void handleEvent(Common::Event &event);
- bool inHideArea();
- friend class Events;
-public:
- Mouse(MadsM4Engine *vm);
- ~Mouse();
-
- bool init(const char *seriesName, RGB8 *palette);
- bool setCursorNum(int cursorIndex);
- int getCursorNum() { return _currentCursor; }
- int cursorCount();
- Common::Point currentPos() const { return _currentPos; }
- M4Sprite *cursor() { return _cursor; }
- void cursorOn();
- void cursorOff();
- bool getCursorOn() { return _cursorOn; }
- void lockCursor(int cursorIndex);
- void unlockCursor();
-
- const char *getVerb();
-
- void resetMouse();
- void setHideRect(Common::Rect &r);
- void setShowRect(Common::Rect &r);
- const Common::Rect *getHideRect();
- const Common::Rect *getShowRect();
-};
-
-}
-
-#endif
diff --git a/engines/m4/font.cpp b/engines/m4/font.cpp
deleted file mode 100644
index d4ba714d73..0000000000
--- a/engines/m4/font.cpp
+++ /dev/null
@@ -1,291 +0,0 @@
-/* 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 "m4/font.h"
-#include "m4/m4.h"
-#include "m4/compression.h"
-
-namespace M4 {
-
-FontManager::~FontManager() {
- for (uint i = 0; i < _entries.size(); ++i)
- delete _entries[i];
- _entries.clear();
-}
-
-Font *FontManager::getFont(const char *filename) {
- // Append an extension if the filename doesn't already have one
- char buffer[20];
- strncpy(buffer, filename, 19);
- if (!strchr(buffer, '.'))
- strcat(buffer, ".ff");
-
- // Check if the font is already loaded
- for (uint i = 0; i < _entries.size(); ++i) {
- if (!strcmp(_entries[i]->_filename, buffer))
- return _entries[i];
- }
-
- Font *f = new Font(_vm, buffer);
- _entries.push_back(f);
- return f;
-}
-
-void FontManager::setFont(const char *filename) {
- _currentFont = getFont(filename);
-}
-
-//--------------------------------------------------------------------------
-
-Font::Font(MadsM4Engine *vm, const char *filename) : _vm(vm) {
- _sysFont = true;
- strncpy(_filename, filename, 19);
- _filename[19] = '\0';
-
- //TODO: System font
- _fontColors[0] = _vm->_palette->BLACK;
- _fontColors[1] = _vm->_palette->WHITE;
- _fontColors[2] = _vm->_palette->BLACK;
- _fontColors[3] = _vm->_palette->DARK_GRAY;
-
- _sysFont = false;
-
- if (_vm->isM4())
- setFontM4(filename);
- else
- setFontMads(filename);
-}
-
-void Font::setFontM4(const char *filename) {
- Common::SeekableReadStream *fontFile = _vm->res()->openFile(filename);
-
- if (fontFile->readUint32LE() != MKTAG('F','O','N','T')) {
- debugCN(kDebugGraphics, "Font::Font: FONT tag expected\n");
- return;
- }
-
- _maxHeight = fontFile->readByte();
- _maxWidth = fontFile->readByte();
- uint32 fontSize = fontFile->readUint32LE();
-
- //debugCN(kDebugGraphics, "Font::Font: _maxWidth = %d, _maxHeight = %d, fontSize = %d\n", _maxWidth, _maxHeight, fontSize);
-
- if (fontFile->readUint32LE() != MKTAG('W','I','D','T')) {
- debugCN(kDebugGraphics, "Font::Font: WIDT tag expected\n");
- return;
- }
-
- _charWidths = new uint8[256];
- fontFile->read(_charWidths, 256);
-
- if (fontFile->readUint32LE() != MKTAG('O','F','F','S')) {
- debugCN(kDebugGraphics, "Font::Font: OFFS tag expected\n");
- return;
- }
-
- _charOffs = new uint16[256];
-
- for (int i = 0; i < 256; i++)
- _charOffs[i] = fontFile->readUint16LE();
-
- if (fontFile->readUint32LE() != MKTAG('P','I','X','S')) {
- debugCN(kDebugGraphics, "Font::Font: PIXS tag expected\n");
- return;
- }
-
- _charData = new uint8[fontSize];
- fontFile->read(_charData, fontSize);
-
- _vm->res()->toss(filename);
-}
-
-void Font::setFontMads(const char *filename) {
- MadsPack fontData(filename, _vm);
- Common::SeekableReadStream *fontFile = fontData.getItemStream(0);
-
- _maxHeight = fontFile->readByte();
- _maxWidth = fontFile->readByte();
-
- _charWidths = new uint8[128];
- // Char data is shifted by 1
- _charWidths[0] = 0;
- fontFile->read(_charWidths + 1, 127);
- fontFile->readByte(); // remainder
-
- _charOffs = new uint16[128];
-
- uint32 startOffs = 2 + 128 + 256;
- uint32 fontSize = fontFile->size() - startOffs;
-
- // Char data is shifted by 1
- _charOffs[0] = 0;
- for (int i = 1; i < 128; i++)
- _charOffs[i] = fontFile->readUint16LE() - startOffs;
- fontFile->readUint16LE(); // remainder
-
- _charData = new uint8[fontSize];
- fontFile->read(_charData, fontSize);
-
- delete fontFile;
-}
-
-Font::~Font() {
- if (!_sysFont) {
- delete[] _charWidths;
- delete[] _charOffs;
- delete[] _charData;
- }
-}
-
-void Font::setColor(uint8 color) {
- if (_sysFont)
- _fontColors[1] = color;
- else
- _fontColors[3] = color;
-}
-
-void Font::setColors(uint8 col1, uint8 col2, uint8 col3) {
- if (_sysFont)
- _fontColors[1] = col3;
- else {
- _fontColors[0] = 0xFF;
- _fontColors[1] = col1;
- _fontColors[2] = col2;
- _fontColors[3] = col3;
- }
-}
-
-int32 Font::write(M4Surface *surface, const char *text, int x, int y, int width, int spaceWidth, uint8 colors[]) {
-
- /*TODO
- if (custom_ascii_converter) { // if there is a function to convert the extended ASCII characters
- custom_ascii_converter(out_string); // call it with the string
- }
- */
-
- int right;
- if (width > 0)
- right = MIN(surface->width(), x + width + 1);
- else
- right = surface->width();
-
- x++;
- y++;
-
- int skipY = 0;
- if (y < 0) {
- skipY = -y;
- y = 0;
- }
-
- int height = MAX(0, _maxHeight - skipY);
- if (height == 0)
- return x;
-
- int bottom = y + height - 1;
- if (bottom > surface->height() - 1) {
- height -= MIN(height, bottom - (surface->height() - 1));
- }
-
- if (height <= 0)
- return x;
-
- uint8 *destPtr = (uint8*)surface->getBasePtr(x, y);
- uint8 *oldDestPtr = destPtr;
-
- int xPos = x;
-
- while (*text) {
-
- unsigned char theChar = (*text++) & 0x7F;
- int charWidth = _charWidths[theChar];
-
- if (charWidth > 0) {
-
- if (xPos + charWidth > right)
- return xPos;
-
- uint8 *charData = &_charData[_charOffs[theChar]];
- int bpp = charWidth / 4 + 1;
-
- if (!_vm->isM4()) {
- if (charWidth > 12)
- bpp = 4;
- else if (charWidth > 8)
- bpp = 3;
- else if (charWidth > 4)
- bpp = 2;
- else
- bpp = 1;
- }
-
- if (skipY != 0)
- charData += bpp * skipY;
-
- for (int i = 0; i < height; i++) {
- for (int j = 0; j < bpp; j++) {
- if (*charData & 0xc0)
- *destPtr = colors[(*charData & 0xc0) >> 6];
- destPtr++;
- if (*charData & 0x30)
- *destPtr = colors[(*charData & 0x30) >> 4];
- destPtr++;
- if (*charData & 0x0C)
- *destPtr = colors[(*charData & 0x0C) >> 2];
- destPtr++;
- if (*charData & 0x03)
- *destPtr = colors[*charData & 0x03];
- destPtr++;
- charData++;
- }
-
- destPtr += surface->width() - bpp * 4;
-
- }
-
- destPtr = oldDestPtr + charWidth + spaceWidth;
- oldDestPtr = destPtr;
-
- }
-
- xPos += charWidth + spaceWidth;
-
- }
-
- surface->freeData();
- return xPos;
-
-}
-
-int32 Font::getWidth(const char *text, int spaceWidth) {
- /*
- if (custom_ascii_converter) { // if there is a function to convert the extended ASCII characters
- custom_ascii_converter(out_string); // call it with the string
- }
- */
- int width = -spaceWidth; // Accomodate final character not needing spacing
- while (*text)
- width += _charWidths[*text++ & 0x7F] + spaceWidth;
- return width;
-}
-
-} // End of namespace M4
diff --git a/engines/m4/font.h b/engines/m4/font.h
deleted file mode 100644
index 5a9c73e5d5..0000000000
--- a/engines/m4/font.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/* 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 M4_FONT_H
-#define M4_FONT_H
-
-#include "common/util.h"
-#include "common/endian.h"
-
-#include "m4/graphics.h"
-
-/*
- TODO:
- - make a FontSystem class that creates/manages the fonts
- (similar to FileSystem)
-*/
-
-namespace M4 {
-
-#define FONT_MENU "fontmenu.fnt"
-#define FONT_INTERFACE "fontintr.fnt"
-#define FONT_TINY "small.fnt"
-#define FONT_SMALL "small.fnt"
-#define FONT_MEDIUM "medium.fnt"
-#define FONT_LINE "fontline.fnt"
-#define FONT_CONVERSATION "fontconv.fnt"
-#define FONT_4X6 "4x6pp.fnt"
-#define FONT_5X6 "5x6pp.fnt"
-
-#define FONT_CONVERSATION_MADS "fontconv.ff"
-#define FONT_INTERFACE_MADS "fontintr.ff"
-#define FONT_MAIN_MADS "fontmain.ff"
-#define FONT_MENU_MADS "fontmenu.ff" // Not in Rex (uses bitmap files for menu strings)
-#define FONT_MISC_MADS "fontmisc.ff"
-#define FONT_TELE_MADS "fonttele.ff" // Not in Phantom
-#define FONT_PHAN_MADS "fontphan.ff" // Phantom only
-
-class Font {
-public:
- Font(MadsM4Engine *vm, const char *filename);
- ~Font();
-
- void setColor(uint8 color);
- void setColors(uint8 col1, uint8 col2, uint8 col3);
-
- int32 getWidth(const char *text, int spaceWidth = -1);
- int32 getHeight() const { return _maxHeight; }
- int32 getMaxWidth() const { return _maxWidth; }
- int32 write(M4Surface *surface, const char *text, int x, int y, int width, int spaceWidth, uint8 colors[]);
- int32 writeString(M4Surface *surface, const char *text, int x, int y, int width = 0, int spaceWidth = -1) {
- return write(surface, text, x, y, width, spaceWidth, _fontColors);
- }
-public:
- char _filename[20];
-private:
- void setFontM4(const char *filename);
- void setFontMads(const char *filename);
-
- MadsM4Engine *_vm;
- uint8 _maxWidth, _maxHeight;
- uint8 *_charWidths;
- uint16 *_charOffs;
- uint8 *_charData;
- bool _sysFont;
- uint8 _fontColors[4];
-};
-
-class FontEntry {
-public:
- Font *_font;
-
- FontEntry() {
- _font = NULL;
- }
- ~FontEntry() {
- delete _font;
- }
-};
-
-class FontManager {
-private:
- MadsM4Engine *_vm;
- Common::Array<Font *> _entries;
- Font *_currentFont;
-public:
- FontManager(MadsM4Engine *vm): _vm(vm) { _currentFont = NULL; }
- ~FontManager();
-
- Font *getFont(const char *filename);
- void setFont(const char *filename);
-
- Font *current() {
- assert(_currentFont);
- return _currentFont;
- }
-};
-
-} // End of namespace M4
-
-#endif
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
deleted file mode 100644
index 7a0b776eb8..0000000000
--- a/engines/m4/globals.cpp
+++ /dev/null
@@ -1,554 +0,0 @@
-/* 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/textconsole.h"
-
-#include "m4/m4.h"
-#include "m4/globals.h"
-#include "m4/graphics.h"
-#include "m4/gui.h"
-#include "m4/viewmgr.h"
-#include "m4/script.h"
-#include "m4/m4_views.h"
-#include "m4/compression.h"
-
-namespace M4 {
-
-Kernel::Kernel(MadsM4Engine *vm) : _vm(vm) {
- daemonTriggerAvailable = true;
- firstFadeColorIndex = 0;
- paused = false;
- betweenRooms = false;
- currentSection = 0;
- newSection = 0;
- previousSection = 0;
- currentRoom = 0;
- newRoom = 0;
- previousRoom = 0;
- trigger = 0;
- triggerMode = KT_DAEMON;
-
- _globalDaemonFn = NULL;
- _globalParserFn = NULL;
-
- _sectionInitFn = NULL;
- _sectionDaemonFn = NULL;
- _sectionParserFn = NULL;
-
- _roomInitFn = NULL;
- _roomDaemonFn = NULL;
- _roomPreParserFn = NULL;
- _roomParserFn = NULL;
-
-}
-
-int32 Kernel::createTrigger(int32 triggerNum) {
- if (triggerNum < 0)
- return triggerNum;
- else
- return triggerNum | (currentRoom << 16) | (triggerMode << 28);
-}
-
-bool Kernel::sendTrigger(int32 triggerNum) {
- return handleTrigger(createTrigger(triggerNum));
-}
-
-bool Kernel::handleTrigger(int32 triggerNum) {
-
- debugCN(kDebugScript, "betweenRooms = %d; triggerNum = %08X\n", betweenRooms, (uint)triggerNum);
-
- if (betweenRooms)
- return true;
-
- if (triggerNum < 0)
- return false;
-
- KernelTriggerType saveTriggerMode = triggerMode;
- int32 saveTrigger = trigger;
- bool result = false;
-
- int room = (triggerNum >> 16) & 0xFFF;
-
- debugCN(kDebugScript, "room = %d; currentRoom = %d\n", room, currentRoom);
-
- if (room != currentRoom) {
- debugCN(kDebugScript, "Kernel::handleTrigger() Trigger from another room\n");
- return false;
- }
-
- trigger = triggerNum & 0xFFFF;
- KernelTriggerType mode = (KernelTriggerType)(triggerNum >> 28);
-
- switch (mode) {
-
- case KT_PREPARSE:
- if (trigger < 32000) {
- triggerMode = KT_PREPARSE;
- roomPreParser();
- result = true;
- }
- break;
-
- case KT_PARSE:
- if (trigger < 32000) {
- triggerMode = KT_PARSE;
- // TODO player.commandReady = TRUE;
- roomParser();
- /* TODO
- if (player.commandReady)
- globalParser();
- */
- result = true;
- }
- break;
-
- case KT_DAEMON:
- debugCN(kDebugScript, "KT_DAEMON\n");
- triggerMode = KT_DAEMON;
- daemonTriggerAvailable = false;
- roomDaemon();
- if (daemonTriggerAvailable) {
- daemonTriggerAvailable = false;
- sectionDaemon();
- }
- if (daemonTriggerAvailable) {
- daemonTriggerAvailable = false;
- globalDaemon();
- }
-
- break;
-
- default:
- debugCN(kDebugScript, "Kernel::handleTrigger() Unknown trigger mode %d\n", mode);
-
- }
-
- triggerMode = saveTriggerMode;
- trigger = saveTrigger;
-
- return result;
-}
-
-void Kernel::loadGlobalScriptFunctions() {
- _globalDaemonFn = _vm->_script->loadFunction("global_daemon");
- _globalParserFn = _vm->_script->loadFunction("global_parser");
-}
-
-void Kernel::loadSectionScriptFunctions() {
- Common::String tempFnName;
- tempFnName = Common::String::format("section_init_%d", currentSection);
- _sectionInitFn = _vm->_script->loadFunction(tempFnName);
- tempFnName = Common::String::format("section_daemon_%d", currentSection);
- _sectionDaemonFn = _vm->_script->loadFunction(tempFnName);
- tempFnName = Common::String::format("section_parser_%d", currentSection);
- _sectionParserFn = _vm->_script->loadFunction(tempFnName);
-}
-
-void Kernel::loadRoomScriptFunctions() {
- Common::String tempFnName;
- tempFnName = Common::String::format("room_init_%d", currentRoom);
- _roomInitFn = _vm->_script->loadFunction(tempFnName);
- tempFnName = Common::String::format("room_daemon_%d", currentRoom);
- _roomDaemonFn = _vm->_script->loadFunction(tempFnName);
- tempFnName = Common::String::format("room_pre_parser_%d", currentRoom);
- _roomPreParserFn = _vm->_script->loadFunction(tempFnName);
- tempFnName = Common::String::format("room_parser_%d", currentRoom);
- _roomParserFn = _vm->_script->loadFunction(tempFnName);
-}
-
-void Kernel::globalDaemon() {
- if (_globalDaemonFn)
- _vm->_script->runFunction(_globalDaemonFn);
- else {
- debugCN(kDebugScript, "Kernel::globalDaemon() _globalDaemonFn is NULL\n");
- }
-}
-
-void Kernel::globalParser() {
- if (_globalParserFn)
- _vm->_script->runFunction(_globalParserFn);
- else {
- debugCN(kDebugScript, "Kernel::globalParser() _globalParserFn is NULL\n");
- }
-}
-
-void Kernel::sectionInit() {
- if (_sectionInitFn)
- _vm->_script->runFunction(_sectionInitFn);
- else {
- debugCN(kDebugScript, "Kernel::sectionInit() _sectionInitFn is NULL\n");
- }
-}
-
-void Kernel::sectionDaemon() {
- if (_sectionDaemonFn)
- _vm->_script->runFunction(_sectionDaemonFn);
- else {
- debugCN(kDebugScript, "Kernel::sectionDaemon() _sectionDaemonFn is NULL\n");
- }
-}
-
-void Kernel::sectionParser() {
- if (_sectionParserFn)
- _vm->_script->runFunction(_sectionParserFn);
- else {
- debugCN(kDebugScript, "Kernel::sectionParser() _sectionParserFn is NULL\n");
- }
-}
-
-void Kernel::roomInit() {
- if (_roomInitFn)
- _vm->_script->runFunction(_roomInitFn);
- else {
- debugCN(kDebugScript, "Kernel::roomInit() _roomInitFn is NULL\n");
- }
-}
-
-void Kernel::roomDaemon() {
- if (_roomDaemonFn)
- _vm->_script->runFunction(_roomDaemonFn);
- else {
- debugCN(kDebugScript, "Kernel::roomDaemon() _roomDaemonFn is NULL\n");
- }
-}
-
-void Kernel::roomPreParser() {
- if (_roomPreParserFn)
- _vm->_script->runFunction(_roomPreParserFn);
- else {
- debugCN(kDebugScript, "Kernel::roomPreParser() _roomPreParserFn is NULL\n");
- }
-}
-
-void Kernel::roomParser() {
- if (_roomParserFn)
- _vm->_script->runFunction(_roomParserFn);
- else {
- debugCN(kDebugScript, "Kernel::roomParser() _roomParserFn is NULL\n");
- }
-}
-
-void Kernel::pauseGame(bool value) {
- paused = value;
-
- if (paused) pauseEngines();
- else unpauseEngines();
-}
-
-void Kernel::pauseEngines() {
- // TODO: A proper implementation of game pausing. At the moment I'm using a hard-coded
- // check in events.cpp on Kernel::paused to prevent any events going to the scene
-}
-
-void Kernel::unpauseEngines() {
- // TODO: A proper implementation of game unpausing
-}
-
-/*--------------------------------------------------------------------------*/
-
-Globals::Globals(MadsM4Engine *vm): _vm(vm) {
-}
-
-bool Globals::isInterfaceVisible() {
- return _m4Vm->scene()->getInterface()->isVisible();
-}
-
-/*--------------------------------------------------------------------------*/
-
-MadsGlobals::MadsGlobals(MadsEngine *vm): Globals(vm) {
- _vm = vm;
-
- playerSpriteChanged = false;
- dialogType = DIALOG_NONE;
- sceneNumber = -1;
- for (int i = 0; i < 3; ++i)
- actionNouns[i] = 0;
- _difficultyLevel = 0;
-}
-
-MadsGlobals::~MadsGlobals() {
- uint32 i;
-
- for (i = 0; i < _madsVocab.size(); i++)
- free(_madsVocab[i]);
- _madsVocab.clear();
-
- for (i = 0; i < _madsQuotes.size(); i++)
- free(_madsQuotes[i]);
- _madsQuotes.clear();
-
- _madsMessages.clear();
-}
-
-void MadsGlobals::loadMadsVocab() {
- Common::SeekableReadStream *vocabS = _vm->res()->get("vocab.dat");
- int curPos = 0;
-
- char buffer[30];
- strcpy(buffer, "");
-
- while (true) {
- uint8 b = vocabS->readByte();
- if (vocabS->eos()) break;
-
- buffer[curPos++] = b;
- if (buffer[curPos - 1] == '\0') {
- // end of string, add it to the strings list
- _madsVocab.push_back(strdup(buffer));
- curPos = 0;
- strcpy(buffer, "");
- }
- }
-
- _vm->res()->toss("vocab.dat");
-}
-
-void MadsGlobals::loadQuotes() {
- Common::SeekableReadStream *quoteS = _vm->res()->get("quotes.dat");
- int curPos = 0;
-
- char buffer[128];
- strcpy(buffer, "");
-
- while (true) {
- uint8 b = quoteS->readByte();
- if (quoteS->eos()) break;
-
- buffer[curPos++] = b;
- if (buffer[curPos - 1] == '\0') {
- // end of string, add it to the strings list
- _madsQuotes.push_back(strdup(buffer));
- curPos = 0;
- strcpy(buffer, "");
- }
- }
-
- _vm->res()->toss("quotes.dat");
-}
-
-void MadsGlobals::loadMadsMessagesInfo() {
- Common::SeekableReadStream *messageS = _vm->res()->get("messages.dat");
-
- int16 count = messageS->readUint16LE();
- //debugCN(kDebugScript, "%i messages\n", count);
-
- for (int i = 0; i < count; i++) {
- MessageItem curMessage;
- curMessage.id = messageS->readUint32LE();
- curMessage.offset = messageS->readUint32LE();
- curMessage.uncompSize = messageS->readUint16LE();
-
- if (i > 0)
- _madsMessages[i - 1].compSize = curMessage.offset - _madsMessages[i - 1].offset;
-
- if (i == count - 1)
- curMessage.compSize = messageS->size() - curMessage.offset;
-
- //debugCN(kDebugScript, "id: %i, offset: %i, uncomp size: %i\n", curMessage->id, curMessage->offset, curMessage->uncompSize);
- _madsMessages.push_back(curMessage);
- }
-
- _vm->res()->toss("messages.dat");
-}
-
-void MadsGlobals::loadMadsObjects() {
- Common::SeekableReadStream *objList = _vm->res()->get("objects.dat");
- int numObjects = objList->readUint16LE();
-
- for (int i = 0; i < numObjects; ++i)
- _madsObjects.push_back(MadsObjectArray::value_type(new MadsObject(objList)));
-
- _vm->res()->toss("objects.dat");
-}
-
-int MadsGlobals::getObjectIndex(uint16 descId) {
- for (uint i = 0; i < _madsObjects.size(); ++i) {
- if (_madsObjects[i].get()->_descId == descId)
- return i;
- }
-
- return -1;
-}
-
-int MadsGlobals::messageIndexOf(uint32 messageId) {
- for (uint i = 0; i < _madsMessages.size(); ++i)
- {
- if (_madsMessages[i].id == messageId)
- return i;
- }
- return -1;
-}
-
-const char *MadsGlobals::loadMessage(uint index) {
- if (index > _madsMessages.size() - 1) {
- warning("Invalid message index: %i", index);
- return NULL;
- }
-
- FabDecompressor fab;
- byte *compData = new byte[_madsMessages[index].compSize];
- byte *buffer = new byte[_madsMessages[index].uncompSize];
-
- Common::SeekableReadStream *messageS = _vm->res()->get("messages.dat");
- messageS->seek(_madsMessages[index].offset, SEEK_SET);
- messageS->read(compData, _madsMessages[index].compSize);
- fab.decompress(compData, _madsMessages[index].compSize, buffer, _madsMessages[index].uncompSize);
-
- for (int i = 0; i < _madsMessages[index].uncompSize - 1; i++)
- if (buffer[i] == '\0') buffer[i] = '\n';
-
- _vm->res()->toss("messages.dat");
- delete[] compData;
-
- return (char*)buffer;
-}
-
-/**
- * Adds the specified scene number to list of scenes previously visited
- */
-void MadsGlobals::addVisitedScene(int newSceneNumber) {
- if (!isSceneVisited(newSceneNumber))
- _visitedScenes.push_back(newSceneNumber);
-}
-
-/**
- * Returns true if the specified scene has been previously visited
- */
-bool MadsGlobals::isSceneVisited(int checkSceneNumber) {
- Common::List<int>::iterator i;
- for (i = _visitedScenes.begin(); i != _visitedScenes.end(); ++i)
- if (*i == checkSceneNumber)
- return true;
- return false;
-}
-
-void MadsGlobals::removeVisitedScene(int oldSceneNumber) {
- _visitedScenes.remove(oldSceneNumber);
-}
-
-/*--------------------------------------------------------------------------*/
-
-M4Globals::M4Globals(M4Engine *vm): Globals(vm) {
- _vm = vm;
-}
-
-/*--------------------------------------------------------------------------*/
-
-Player::Player(MadsM4Engine *vm) : _vm(vm) {
- commandsAllowed = true;
- needToWalk = false;
- readyToWalk = false;
- waitingForWalk = false;
- commandReady = false;
- strcpy(verb, "");
- strcpy(noun, "");
- strcpy(prep, "");
- strcpy(object, "");
-}
-
-void Player::setCommandsAllowed(bool value) {
- setCommandsAllowedFlag = true;
- commandsAllowed = value;
- if (value) {
- // Player commands are enabled again
- _vm->_mouse->lockCursor(CURSOR_ARROW);
- //_m4Vm->scene()->getInterface()->cancelSentence();
- } else {
- // Player commands are disabled, so show hourglass cursor
- _vm->_mouse->lockCursor(CURSOR_HOURGLASS);
- }
-}
-
-bool Player::said(const char *word1, const char *word2, const char *word3) {
- const char *words[3];
- words[0] = word1;
- words[1] = word2;
- words[2] = word2;
- for (int i = 0; i < 3; i++) {
- if (words[i])
- if ((scumm_stricmp(noun, words[i])) &&
- (scumm_stricmp(object, words[i])) &&
- (scumm_stricmp(verb, words[i])))
- return false;
- }
- return true;
-}
-
-bool Player::saidAny(const char *word1, const char *word2, const char *word3,
- const char *word4, const char *word5, const char *word6, const char *word7,
- const char *word8, const char *word9, const char *word10) {
- const char *words[10];
- words[0] = word1;
- words[1] = word2;
- words[2] = word3;
- words[3] = word4;
- words[4] = word5;
- words[5] = word6;
- words[6] = word7;
- words[7] = word8;
- words[8] = word9;
- words[9] = word10;
- for (int i = 0; i < 10; i++) {
- if (words[i]) {
- if (!scumm_stricmp(noun, words[i]))
- return true;
- if (!scumm_stricmp(object, words[i]))
- return true;
- if (!scumm_stricmp(verb, words[i]))
- return true;
- }
- }
- return false;
-}
-
-/*--------------------------------------------------------------------------*/
-
-MadsObject::MadsObject(Common::SeekableReadStream *stream) {
- load(stream);
-}
-
-void MadsObject::load(Common::SeekableReadStream *stream) {
- // Get the next data block
- uint8 obj[0x30];
- stream->read(obj, 0x30);
-
- // Extract object data fields
- _descId = READ_LE_UINT16(&obj[0]);
- _roomNumber = READ_LE_UINT16(&obj[2]);
- _article = (MADSArticles)obj[4];
- _vocabCount = obj[5] & 0x7f;
- // Phantom / Dragon
- if (_vocabCount > 3)
- warning("MadsObject::load(), vocab cound > 3 (it's %d)", _vocabCount);
-
- for (int i = 0; i < _vocabCount; ++i) {
- _vocabList[i].flags1 = obj[6 + i * 4];
- _vocabList[i].flags2 = obj[7 + i * 4];
- _vocabList[i].vocabId = READ_LE_UINT16(&obj[8 + i * 4]);
- }
-}
-
-void MadsObject::setRoom(int roomNumber) {
-
-}
-
-} // End of namespace M4
diff --git a/engines/m4/globals.h b/engines/m4/globals.h
deleted file mode 100644
index 693dc9d6c9..0000000000
--- a/engines/m4/globals.h
+++ /dev/null
@@ -1,346 +0,0 @@
-/* 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 M4_GLOBALS_H
-#define M4_GLOBALS_H
-
-#include "common/scummsys.h"
-#include "common/array.h"
-#include "common/hashmap.h"
-#include "common/rect.h"
-#include "common/list.h"
-#include "common/ptr.h"
-
-namespace Common {
-class SeekableReadStream;
-}
-
-namespace M4 {
-
-class MadsM4Engine;
-class M4Engine;
-class MadsEngine;
-class ScriptInterpreter;
-class ScriptFunction;
-
-// Globals
-enum WoodScriptGlobals {
- kGlobTime = 0,
- kGlobTimeDelta = 1,
- kGlobMinY = 2,
- kGlobMaxY = 3,
- kGlobMinScale = 4,
- kGlobMaxScale = 5,
- kGlobScaler = 6,
- kGlobTemp1 = 7,
- kGlobTemp2 = 8,
- kGlobTemp3 = 9,
- kGlobTemp4 = 10,
- kGlobTemp5 = 11,
- kGlobTemp6 = 12,
- kGlobTemp7 = 13,
- kGlobTemp8 = 14,
- kGlobTemp9 = 15,
- kGlobTemp10 = 16,
- kGlobTemp11 = 17,
- kGlobTemp12 = 18,
- kGlobTemp13 = 19,
- kGlobTemp14 = 20,
- kGlobTemp15 = 21,
- kGlobTemp16 = 22,
- kGlobTemp17 = 23,
- kGlobTemp18 = 24,
- kGlobTemp19 = 25,
- kGlobTemp20 = 26,
- kGlobTemp21 = 27,
- kGlobTemp22 = 28,
- kGlobTemp23 = 29,
- kGlobTemp24 = 30,
- kGlobTemp25 = 31,
- kGlobTemp26 = 32,
- kGlobTemp27 = 33,
- kGlobTemp28 = 34,
- kGlobTemp29 = 35,
- kGlobTemp30 = 36,
- kGlobTemp31 = 37,
- kGlobTemp32 = 38
-};
-
-const uint32 SERIES_FORWARD = 0;
-const uint32 SERIES_PINGPONG = 1;
-const uint32 SERIES_BACKWARD = 2;
-const uint32 SERIES_RANDOM = 4;
-const uint32 SERIES_NO_TOSS = 8;
-const uint32 SERIES_STICK = 16;
-const uint32 SERIES_LOOP_TRIGGER = 32;
-const uint32 SERIES_LOAD_PALETTE = 64;
-const uint32 SERIES_HORZ_FLIP =128;
-
-enum KernelTriggerType {
- KT_PARSE = 1,
- KT_DAEMON,
- KT_PREPARSE
-};
-
-class Kernel {
-private:
- MadsM4Engine *_vm;
- ScriptFunction *_globalDaemonFn, *_globalParserFn;
- ScriptFunction *_sectionInitFn, *_sectionDaemonFn, *_sectionParserFn;
- ScriptFunction *_roomInitFn, *_roomDaemonFn, *_roomPreParserFn, *_roomParserFn;
- void pauseEngines();
- void unpauseEngines();
-public:
- Kernel(MadsM4Engine *vm);
-
- // TODO: Move to some palette/fading class
- int fadeUpDuration, firstFadeColorIndex;
- int minPalEntry, maxPalEntry;
-
- bool paused;
- //machine* myWalker;
- bool repeatedlyCallDeamon;
- bool daemonTriggerAvailable;
- bool betweenRooms;
- int currentSection, newSection, previousSection;
- int currentRoom, newRoom, previousRoom;
-
- int32 trigger;
- KernelTriggerType triggerMode;
-
- int32 createTrigger(int32 triggerNum);
- bool sendTrigger(int32 triggerNum);
- bool handleTrigger(int32 triggerNum);
-
- void loadGlobalScriptFunctions();
- void loadSectionScriptFunctions();
- void loadRoomScriptFunctions();
-
- void globalDaemon();
- void globalParser();
-
- void sectionInit();
- void sectionDaemon();
- void sectionParser();
-
- void roomInit();
- void roomDaemon();
- void roomPreParser();
- void roomParser();
-
- void pauseGame(bool value);
-};
-
-#define TOTAL_NUM_VARIABLES 210
-
-#define PLAYER_INVENTORY 2
-
-enum MADSArticles {
- kArticleNone = 0,
- kArticleWith = 1,
- kArticleTo = 2,
- kArticleAt = 3,
- kArticleFrom = 4,
- kArticleOn = 5,
- kArticleIn = 6,
- kArticleUnder = 7,
- kArticleBehind = 8
-};
-
-struct VocabEntry {
- uint8 flags1;
- uint8 flags2;
- uint16 vocabId;
-};
-
-class MadsObject {
-public:
- MadsObject() {}
- MadsObject(Common::SeekableReadStream *stream);
- void load(Common::SeekableReadStream *stream);
- bool isInInventory() const { return _roomNumber == PLAYER_INVENTORY; }
- void setRoom(int roomNumber);
-
- uint16 _descId;
- uint16 _roomNumber;
- MADSArticles _article;
- uint8 _vocabCount;
- VocabEntry _vocabList[3];
-};
-
-typedef Common::Array<Common::SharedPtr<MadsObject> > MadsObjectArray;
-
-class Globals {
-private:
- MadsM4Engine *_vm;
-public:
- Globals(MadsM4Engine *vm);
- virtual ~Globals() {}
-
- bool isInterfaceVisible();
-
-};
-
-class M4Globals : public Globals {
-private:
- M4Engine *_vm;
-public:
- M4Globals(M4Engine *vm);
- virtual ~M4Globals() {}
-
- bool invSuppressClickSound;
-};
-
-enum RexPlayerSex { SEX_MALE = 0, SEX_FEMALE = 2, SEX_UNKNOWN = 1};
-
-enum MadsDialogType { DIALOG_NONE = 0, DIALOG_GAME_MENU = 1, DIALOG_SAVE = 2, DIALOG_RESTORE = 3, DIALOG_OPTIONS = 4,
- DIALOG_DIFFICULTY = 5, DIALOG_ERROR = 6};
-
-struct MadsConfigData {
- bool musicFlag;
- bool soundFlag;
- bool easyMouse;
- bool invObjectsStill;
- bool textWindowStill;
- int storyMode;
- int screenFades;
-};
-
-#define GET_GLOBAL(x) (_madsVm->globals()->_globals[x])
-#define GET_GLOBAL32(x) (((uint32)_madsVm->globals()->_globals[x + 1] << 16) | _madsVm->globals()->_globals[x])
-#define SET_GLOBAL(x,y) _madsVm->globals()->_globals[x] = y
-#define SET_GLOBAL32(x,y) { _madsVm->globals()->_globals[x] = (y) & 0xffff; _madsVm->globals()->_globals[(x) + 1] = (y) >> 16; }
-
-typedef int (*IntFunctionPtr)();
-
-union DataMapEntry {
- bool *boolValue;
- uint16 *uint16Value;
- int *intValue;
- IntFunctionPtr fnPtr;
-};
-
-typedef Common::HashMap<uint16, uint16> DataMapHash;
-
-class MadsGlobals : public Globals {
-private:
- struct MessageItem {
- uint32 id;
- uint32 offset;
- uint16 uncompSize;
- uint16 compSize;
- };
-
- MadsEngine *_vm;
- Common::Array<char* > _madsVocab;
- Common::Array<char* > _madsQuotes;
- Common::Array<MessageItem> _madsMessages;
- MadsObjectArray _madsObjects;
- Common::List<int> _visitedScenes;
-public:
- MadsGlobals(MadsEngine *vm);
- ~MadsGlobals();
-
- // MADS variables
- uint16 _globals[TOTAL_NUM_VARIABLES];
- MadsConfigData _config;
- bool playerSpriteChanged;
- MadsDialogType dialogType;
- int sceneNumber;
- int previousScene;
- int16 _nextSceneId;
- uint16 actionNouns[3];
- DataMapHash _dataMap;
- int _difficultyLevel;
-
- void loadMadsVocab();
- uint32 getVocabSize() { return _madsVocab.size(); }
- const char *getVocab(uint32 index) {
- // Vocab list is 1-based, so always subtract one from index provided
- assert((index > 0) && (index <= _madsVocab.size()));
- return _madsVocab[index - 1];
- }
-
- void loadQuotes();
- uint32 getQuotesSize() { return _madsQuotes.size(); }
- const char *getQuote(uint32 index) { return _madsQuotes[index - 1]; }
- // DEPRECATED: ScummVM re-implementation keeps all the quotes loaded, so the methods below are stubs
- void clearQuotes() {}
- void loadQuoteRange(int startNum, int endNum) {}
- void loadQuoteSet(...) {}
- void loadQuote(int quoteNum) {}
-
- void loadMadsMessagesInfo();
- uint32 getMessagesSize() { return _madsMessages.size(); }
- int messageIndexOf(uint32 messageId);
- const char *loadMessage(uint index);
-
- void loadMadsObjects();
- uint32 getObjectsSize() { return _madsObjects.size(); }
- MadsObject *getObject(uint32 index) { return _madsObjects[index].get(); }
- int getObjectIndex(uint16 descId);
- int getObjectFolder(uint32 folderId) { warning("TODO: getObjectFolder"); return -1; }
-
- void addVisitedScene(int sceneNumber);
- bool isSceneVisited(int sceneNumber);
- void removeVisitedScene(int sceneNumber);
-};
-
-#define PLAYER_FIELD_LENGTH 40
-
-class Player {
-public:
- Player(MadsM4Engine *vm);
- void setCommandsAllowed(bool value);
-
- // Variables
- Common::Point position; // Player's current position
- int facing; // Facing direction
-
- char verb[PLAYER_FIELD_LENGTH]; // Action strings
- char noun[PLAYER_FIELD_LENGTH];
- char prep[PLAYER_FIELD_LENGTH];
- char object[PLAYER_FIELD_LENGTH];
- Common::String assetName, shadowName;
- int walkerType, shadowType;
- bool needToWalk, readyToWalk, waitingForWalk;
- bool commandsAllowed;
- bool commandReady;
- bool visible;
- bool beenInRoomBefore;
- bool walkerInCurrentRoom;
- int32 walkerTriggerNum;
- int walkFacing;
- bool setCommandsAllowedFlag;
-
- bool said(const char *word1, const char *word2 = NULL, const char *word3 = NULL);
- bool saidAny(const char *word1, const char *word2, const char *word3,
- const char *word4, const char *word5, const char *word6, const char *word7,
- const char *word8, const char *word9, const char *word10);
-
-private:
- MadsM4Engine *_vm;
-};
-
-} // End of namespace M4
-
-#endif
diff --git a/engines/m4/graphics.cpp b/engines/m4/graphics.cpp
deleted file mode 100644
index 4c272de32c..0000000000
--- a/engines/m4/graphics.cpp
+++ /dev/null
@@ -1,1361 +0,0 @@
-/* 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/system.h"
-#include "common/util.h"
-#include "common/ptr.h"
-#include "common/textconsole.h"
-
-#include "graphics/palette.h"
-
-#include "m4/globals.h"
-#include "m4/graphics.h"
-#include "m4/sprite.h"
-#include "m4/m4.h"
-#include "m4/compression.h"
-
-namespace M4 {
-
-RGBList::RGBList(int numEntries, RGB8 *srcData, bool freeData) {
- _size = numEntries;
- assert(numEntries <= 256);
-
- if (srcData == NULL) {
- _data = new RGB8[numEntries];
- _freeData = true;
- } else {
- _data = srcData;
- _freeData = freeData;
- }
-
- _palIndexes = new byte[numEntries];
- Common::set_to(&_palIndexes[0], &_palIndexes[numEntries], 0);
-}
-
-RGBList::~RGBList() {
- if (_freeData)
- delete[] _data;
- delete[] _palIndexes;
-}
-
-void RGBList::setRange(int start, int count, const RGB8 *src) {
- assert((start + count) <= _size);
-
- Common::copy(&src[0], &src[count], &_data[start]);
-}
-
-/**
- * Creates a duplicate of the given rgb list
- */
-RGBList *RGBList::clone() const {
- RGBList *dest = new RGBList(_size, _data, false);
- _madsVm->_palette->addRange(dest);
- return dest;
-}
-
-//--------------------------------------------------------------------------
-
-#define VGA_COLOR_TRANS(x) (x == 0x3f ? 255 : x << 2)
-
-M4Surface::~M4Surface() {
- if (_rgbList) {
- _madsVm->_palette->deleteRange(_rgbList);
- delete _rgbList;
- }
- if (_ownsData)
- free();
-}
-
-void M4Surface::loadCodesM4(Common::SeekableReadStream *source) {
- if (!source) {
- free();
- return;
- }
-
- uint16 widthVal = source->readUint16LE();
- uint16 heightVal = source->readUint16LE();
-
- create(widthVal, heightVal, Graphics::PixelFormat::createFormatCLUT8());
- source->read(pixels, widthVal * heightVal);
-}
-
-void M4Surface::loadCodesMads(Common::SeekableReadStream *source) {
- if (!source) {
- free();
- return;
- }
-
- uint16 widthVal = 320;
- uint16 heightVal = 156;
- byte *walkMap = new byte[source->size()];
-
- create(widthVal, heightVal, Graphics::PixelFormat::createFormatCLUT8());
- source->read(walkMap, source->size());
-
- byte *ptr = (byte *)getBasePtr(0, 0);
-
- for (int y = 0; y < heightVal; y++) {
- for (int x = 0; x < widthVal; x++) {
- int ofs = x + (y * widthVal);
- if ((walkMap[ofs / 8] << (ofs % 8)) & 0x80)
- *ptr++ = 1; // walkable
- else
- *ptr++ = 0;
- }
- }
-
- delete[] walkMap;
-}
-
-// Sprite related methods
-
-void M4Surface::vLine(int x, int y1, int y2) {
- Graphics::Surface::vLine(x, y1, y2, _color);
-}
-
-void M4Surface::hLine(int x1, int x2, int y) {
- Graphics::Surface::hLine(x1, y, x2, _color);
-}
-
-void M4Surface::vLineXor(int x, int y1, int y2) {
- // Clipping
- if (x < 0 || x >= w)
- return;
-
- if (y2 < y1)
- SWAP(y2, y1);
-
- if (y1 < 0)
- y1 = 0;
- if (y2 >= h)
- y2 = h - 1;
-
- byte *ptr = (byte *)getBasePtr(x, y1);
- while (y1++ <= y2) {
- *ptr ^= 0xFF;
- ptr += pitch;
- }
-
-}
-
-void M4Surface::hLineXor(int x1, int x2, int y) {
- // Clipping
- if (y < 0 || y >= h)
- return;
-
- if (x2 < x1)
- SWAP(x2, x1);
-
- if (x1 < 0)
- x1 = 0;
- if (x2 >= w)
- x2 = w - 1;
-
- if (x2 < x1)
- return;
-
- byte *ptr = (byte *)getBasePtr(x1, y);
- while (x1++ <= x2)
- *ptr++ ^= 0xFF;
-
-}
-
-void M4Surface::drawLine(int x1, int y1, int x2, int y2, byte color) {
- Graphics::Surface::drawLine(x1, y1, x2, y2, color);
-}
-
-
-void M4Surface::frameRect(int x1, int y1, int x2, int y2) {
- Graphics::Surface::frameRect(Common::Rect(x1, y1, x2, y2), _color);
-}
-
-void M4Surface::fillRect(int x1, int y1, int x2, int y2) {
- Graphics::Surface::fillRect(Common::Rect(x1, y1, x2, y2), _color);
-}
-
-void M4Surface::drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &clipRect) {
-
- enum {
- kStatusSkip,
- kStatusScale,
- kStatusDraw
- };
-
- // NOTE: The current clipping code assumes that the top left corner of the clip
- // rectangle is always 0, 0
- assert(clipRect.top == 0 && clipRect.left == 0);
-
- // TODO: Put err* and scaled* into SpriteInfo
- int errX = info.hotX * info.scaleX % 100;
- int errY = info.hotY * info.scaleY % 100;
- int scaledWidth = scaleValue(info.width, info.scaleX, errX);
- int scaledHeight = scaleValue(info.height, info.scaleY, errY);
-
- /*
- debugCN(kDebugGraphics, "M4Surface::drawSprite() info.width = %d; info.scaleX = %d; info.height = %d; info.scaleY = %d; scaledWidth = %d; scaledHeight = %d\n",
- info.width, info.scaleX, info.height, info.scaleY, scaledWidth, scaledHeight);
- */
-
- int clipX = 0, clipY = 0;
- // Clip the sprite's width and height according to the clip rectangle's dimensions
- // This clips the sprite to the bottom and right
- if (x >= 0) {
- scaledWidth = MIN<int>(x + scaledWidth, clipRect.right) - x;
- } else {
- clipX = x;
- scaledWidth = x + scaledWidth;
- }
- if (y >= 0) {
- scaledHeight = MIN<int>(y + scaledHeight, clipRect.bottom) - y;
- } else {
- clipY = y;
- scaledHeight = y + scaledHeight;
- }
-
- //debugCN(kDebugGraphics, "M4Surface::drawSprite() width = %d; height = %d; scaledWidth = %d; scaledHeight = %d\n", info.width, info.height, scaledWidth, scaledHeight);
-
- // Check if sprite is inside the screen. If it's not, there's no need to draw it
- if (scaledWidth + x <= 0 || scaledHeight + y <= 0) // check left and top (in case x,y are negative)
- return;
- if (scaledWidth <= 0 || scaledHeight <= 0) // check right and bottom
- return;
- int heightAmt = scaledHeight;
-
- byte *src = info.sprite->getBasePtr();
- byte *dst = getBasePtr(x - info.hotX - clipX, y - info.hotY - clipY);
-
- int status = kStatusSkip;
- byte *scaledLineBuf = new byte[scaledWidth];
-
- while (heightAmt > 0) {
-
- if (status == kStatusSkip) {
- // Skip line
- errY -= info.scaleY;
- if (errY < 0)
- status = kStatusScale;
- else
- src += info.width;
- } else {
-
- if (status == kStatusScale) {
- // Scale current line
- byte *lineDst = scaledLineBuf;
- int curErrX = errX;
- int widthVal = scaledWidth;
- byte *tempSrc = src;
- int startX = clipX;
- while (widthVal > 0) {
- byte pixel = *tempSrc++;
- curErrX -= info.scaleX;
- while (curErrX < 0) {
- if (startX == 0) {
- *lineDst++ = pixel;
- widthVal--;
- } else {
- startX++;
- }
- curErrX += 100;
- }
- }
- src += info.width;
- status = kStatusDraw;
- }
-
- if (status == kStatusDraw && clipY == 0) {
- // Draw previously scaled line
- // TODO Implement different drawing types (depth, shadow etc.)
- byte *tempDst = dst;
- for (int lineX = 0; lineX < scaledWidth; lineX++) {
- byte pixel = scaledLineBuf[lineX];
-
- if (info.encoding & 0x80) {
-
- if (pixel == 0x80) {
- pixel = 0;
- } else {
- byte destPixel = *tempDst;
- byte r, g, b;
- r = CLIP((info.palette[destPixel].r * pixel) >> 10, 0, 31);
- g = CLIP((info.palette[destPixel].g * pixel) >> 10, 0, 31);
- b = CLIP((info.palette[destPixel].b * pixel) >> 10, 0, 31);
- pixel = info.inverseColorTable[(b << 10) | (g << 5) | r];
- }
- }
-
- if (pixel)
- *tempDst = pixel;
-
- tempDst++;
- }
- dst += pitch;
- heightAmt--;
- // TODO depth etc.
- //depthAddress += Destination -> Width;
-
- errY += 100;
- if (errY >= 0)
- status = kStatusSkip;
- } else if (status == kStatusDraw && clipY < 0) {
- clipY++;
-
- errY += 100;
- if (errY >= 0)
- status = kStatusSkip;
- }
-
- }
-
- }
-
- delete[] scaledLineBuf;
-
-}
-
-// Surface methods
-
-void M4Surface::freeData() {
-}
-
-void M4Surface::clear() {
- Common::set_to((byte *)pixels, (byte *)pixels + w * h, _vm->_palette->BLACK);
-}
-
-void M4Surface::reset() {
- ::free(pixels);
- pixels = NULL;
- if (_rgbList) {
- _vm->_palette->deleteRange(_rgbList);
- delete _rgbList;
- _rgbList = NULL;
- }
-}
-
-void M4Surface::frameRect(const Common::Rect &r, uint8 color) {
- Graphics::Surface::frameRect(r, color);
-}
-
-void M4Surface::fillRect(const Common::Rect &r, uint8 color) {
- Graphics::Surface::fillRect(r, color);
-}
-
-void M4Surface::copyFrom(M4Surface *src, const Common::Rect &srcBounds, int destX, int destY,
- int transparentColor) {
- // Validation of the rectangle and position
- if ((destX >= w) || (destY >= h))
- return;
-
- Common::Rect copyRect = srcBounds;
- if (destX < 0) {
- copyRect.left += -destX;
- destX = 0;
- } else if (destX + copyRect.width() > w) {
- copyRect.right -= destX + copyRect.width() - w;
- }
- if (destY < 0) {
- copyRect.top += -destY;
- destY = 0;
- } else if (destY + copyRect.height() > h) {
- copyRect.bottom -= destY + copyRect.height() - h;
- }
-
- if (!copyRect.isValidRect())
- return;
-
- // Copy the specified area
-
- byte *data = src->getBasePtr();
- byte *srcPtr = data + (src->width() * copyRect.top + copyRect.left);
- byte *destPtr = (byte *)pixels + (destY * width()) + destX;
-
- for (int rowCtr = 0; rowCtr < copyRect.height(); ++rowCtr) {
- if (transparentColor == -1)
- // No transparency, so copy line over
- Common::copy(srcPtr, srcPtr + copyRect.width(), destPtr);
- else {
- // Copy each byte one at a time checking for the transparency color
- for (int xCtr = 0; xCtr < copyRect.width(); ++xCtr)
- if (srcPtr[xCtr] != transparentColor) destPtr[xCtr] = srcPtr[xCtr];
- }
-
- srcPtr += src->width();
- destPtr += width();
- }
-
- src->freeData();
-}
-
-/**
- * Copies a given image onto a destination surface with scaling, transferring only pixels that meet
- * the specified depth requirement on a secondary surface contain depth information
- */
-void M4Surface::copyFrom(M4Surface *src, int destX, int destY, int depth,
- M4Surface *depthsSurface, int scale, int transparentColor) {
-
- if (scale == 100) {
- // Copy the specified area
- Common::Rect copyRect(0, 0, src->width(), src->height());
-
- if (destX < 0) {
- copyRect.left += -destX;
- destX = 0;
- } else if (destX + copyRect.width() > w) {
- copyRect.right -= destX + copyRect.width() - w;
- }
- if (destY < 0) {
- copyRect.top += -destY;
- destY = 0;
- } else if (destY + copyRect.height() > h) {
- copyRect.bottom -= destY + copyRect.height() - h;
- }
-
- if (!copyRect.isValidRect())
- return;
-
- byte *data = src->getBasePtr();
- byte *srcPtr = data + (src->width() * copyRect.top + copyRect.left);
- byte *depthsData = depthsSurface->getBasePtr();
- byte *depthsPtr = depthsData + (depthsSurface->pitch * destY) + destX;
- byte *destPtr = (byte *)pixels + (destY * pitch) + destX;
-
- // 100% scaling variation
- for (int rowCtr = 0; rowCtr < copyRect.height(); ++rowCtr) {
- // Copy each byte one at a time checking against the depth
- for (int xCtr = 0; xCtr < copyRect.width(); ++xCtr) {
- if ((depth <= (depthsPtr[xCtr] & 0x7f)) && (srcPtr[xCtr] != transparentColor))
- destPtr[xCtr] = srcPtr[xCtr];
- }
-
- srcPtr += src->width();
- depthsPtr += depthsSurface->width();
- destPtr += width();
- }
-
- src->freeData();
- depthsSurface->freeData();
- return;
- }
-
- // Start of draw logic for scaled sprites
- const byte *srcPixelsP = src->getBasePtr();
-
- int destRight = this->width() - 1;
- int destBottom = this->height() - 1;
- bool normalFrame = true; // TODO: false for negative frame numbers
- int frameWidth = src->width();
- int frameHeight = src->height();
-
- int highestDim = MAX(frameWidth, frameHeight);
- bool lineDist[MADS_SURFACE_WIDTH];
- int distIndex = 0;
- int distXCount = 0, distYCount = 0;
-
- int distCtr = 0;
- do {
- distCtr += scale;
- if (distCtr < 100) {
- lineDist[distIndex] = false;
- } else {
- lineDist[distIndex] = true;
- distCtr -= 100;
-
- if (distIndex < frameWidth)
- ++distXCount;
-
- if (distIndex < frameHeight)
- ++distYCount;
- }
- } while (++distIndex < highestDim);
-
- destX -= distXCount / 2;
- destY -= distYCount - 1;
-
- // Check x bounding area
- int spriteLeft = 0;
- int spriteWidth = distXCount;
- int widthAmount = destX + distXCount - 1;
-
- if (destX < 0) {
- spriteWidth += destX;
- spriteLeft -= destX;
- }
- widthAmount -= destRight;
- if (widthAmount > 0)
- spriteWidth -= widthAmount;
-
- int spriteRight = spriteLeft + spriteWidth;
- if (spriteWidth <= 0)
- return;
- if (!normalFrame) {
- destX += distXCount - 1;
- spriteLeft = -(distXCount - spriteRight);
- spriteRight = (-spriteLeft + spriteWidth);
- }
-
- // Check y bounding area
- int spriteTop = 0;
- int spriteHeight = distYCount;
- int heightAmount = destY + distYCount - 1;
-
- if (destY < 0) {
- spriteHeight += destY;
- spriteTop -= destY;
- }
- heightAmount -= destBottom;
- if (heightAmount > 0)
- spriteHeight -= heightAmount;
- int spriteBottom = spriteTop + spriteHeight;
-
- if (spriteHeight <= 0)
- return;
-
- byte *destPixelsP = this->getBasePtr(destX + spriteLeft, destY + spriteTop);
- const byte *depthPixelsP = depthsSurface->getBasePtr(destX + spriteLeft, destY + spriteTop);
-
- spriteLeft = (spriteLeft * (normalFrame ? 1 : -1));
-
- // Loop through the lines of the sprite
- for (int yp = 0, sprY = -1; yp < frameHeight; ++yp, srcPixelsP += src->pitch) {
- if (!lineDist[yp])
- // Not a display line, so skip it
- continue;
- // Check whether the sprite line is in the display range
- ++sprY;
- if ((sprY >= spriteBottom) || (sprY < spriteTop))
- continue;
-
- // Found a line to display. Loop through the pixels
- const byte *srcP = srcPixelsP;
- const byte *depthP = depthPixelsP;
- byte *destP = destPixelsP;
- for (int xp = 0, sprX = 0; xp < frameWidth; ++xp, ++srcP) {
- if (xp < spriteLeft)
- // Not yet reached start of display area
- continue;
- if (!lineDist[sprX++])
- // Not a display pixel
- continue;
-
- if ((*srcP != transparentColor) && (depth <= (*depthP & 0x7f)))
- *destP = *srcP;
-
- ++destP;
- ++depthP;
- }
-
- // Move to the next destination line
- destPixelsP += this->pitch;
- depthPixelsP += depthsSurface->pitch;
- }
-
- src->freeData();
- depthsSurface->freeData();
- this->freeData();
-}
-
-void M4Surface::loadBackgroundRiddle(const char *sceneName) {
- char resourceName[20];
- Common::SeekableReadStream *stream;
- // Loads a Riddle scene
- sprintf(resourceName, "%s.tt", sceneName);
- stream = _vm->_resourceManager->get(resourceName);
- m4LoadBackground(stream);
- _vm->_resourceManager->toss(resourceName);
-}
-
-void M4Surface::loadBackground(int sceneNumber, RGBList **palData) {
- if (_vm->isM4() || (_vm->getGameType() == GType_RexNebular)) {
- char resourceName[20];
- Common::SeekableReadStream *stream;
-
- if (_vm->getGameType() == GType_RexNebular) {
- // Load Rex Nebular screen
- bool hasPalette = palData != NULL;
- if (!hasPalette)
- palData = &_rgbList;
-
- sprintf(resourceName, "rm%d.art", sceneNumber);
- stream = _vm->_resourceManager->get(resourceName);
- rexLoadBackground(stream, palData);
-
- if (!hasPalette) {
- _vm->_palette->addRange(_rgbList);
- this->translate(_rgbList);
- }
- } else {
- // Loads M4 game scene
- if (palData)
- *palData = NULL;
- sprintf(resourceName, "%i.tt", sceneNumber);
- stream = _vm->_resourceManager->get(resourceName);
- m4LoadBackground(stream);
- }
-
- _vm->_resourceManager->toss(resourceName);
-
- } else {
- madsLoadBackground(sceneNumber, palData);
- }
-}
-
-void M4Surface::madsLoadBackground(int roomNumber, RGBList **palData) {
- // Get a MadsPack reference to the tile set and mapping
- char resourceName[20];
- int i;
-
- // Uncompressed tile map resource
- sprintf(resourceName, "rm%d.mm", roomNumber);
- MadsPack tileMapFile(resourceName, _vm);
- Common::SeekableReadStream *mapStream = tileMapFile.getItemStream(0);
-
- // Get the details of the tiles and map
- mapStream->readUint32LE();
- int tileCountX = mapStream->readUint16LE();
- int tileCountY = mapStream->readUint16LE();
- int tileWidthMap = mapStream->readUint16LE();
- int tileHeightMap = mapStream->readUint16LE();
- int screenWidth = mapStream->readUint16LE();
- int screenHeight = mapStream->readUint16LE();
- int tileCountMap = tileCountX * tileCountY;
- delete mapStream;
-
- // Obtain tile map information
- typedef Common::List<Common::SharedPtr<M4Surface> > TileSetList;
- typedef TileSetList::iterator TileSetIterator;
- TileSetList tileSet;
- uint16 *tileMap = new uint16[tileCountMap];
- mapStream = tileMapFile.getItemStream(1);
- for (i = 0; i < tileCountMap; ++i)
- tileMap[i] = mapStream->readUint16LE();
- delete mapStream;
- _vm->res()->toss(resourceName);
-
- // --------------------------------------------------------------------------------
-
- // Tile map data, which needs to be kept compressed, as the tile offsets refer to
- // the compressed data. Each tile is then uncompressed separately
- sprintf(resourceName, "rm%d.tt", roomNumber);
- Common::SeekableReadStream *tileDataComp = _vm->_resourceManager->get(resourceName);
- MadsPack tileData(tileDataComp);
- Common::SeekableReadStream *tileDataUncomp = tileData.getItemStream(0);
-
- // Validate that the data matches between the tiles and tile map file and is valid
- int tileCount = tileDataUncomp->readUint16LE();
- int tileWidth = tileDataUncomp->readUint16LE();
- int tileHeight = tileDataUncomp->readUint16LE();
- delete tileDataUncomp;
- assert(tileCountMap == tileCount);
- assert(tileWidth == tileWidthMap);
- assert(tileHeight == tileHeightMap);
- assert(screenWidth == _vm->_screen->width());
- assert(screenHeight <= _vm->_screen->height());
-
- // --------------------------------------------------------------------------------
-
- // Get the palette to use
- tileDataUncomp = tileData.getItemStream(2);
- // Set palette
- if (!palData) {
- _vm->_palette->setMadsPalette(tileDataUncomp, 4);
- } else {
- int numColors;
- RGB8 *rgbList = _vm->_palette->decodeMadsPalette(tileDataUncomp, &numColors);
- *palData = new RGBList(numColors, rgbList, true);
- }
- delete tileDataUncomp;
-
- // --------------------------------------------------------------------------------
-
- // Get tile data
-
- tileDataUncomp = tileData.getItemStream(1);
- FabDecompressor fab;
- uint32 compressedTileDataSize = 0;
-
- for (i = 0; i < tileCount; i++) {
- tileDataUncomp->seek(i * 4, SEEK_SET);
- uint32 tileOfs = tileDataUncomp->readUint32LE();
- M4Surface* newTile = new M4Surface(tileWidth, tileHeight);
-
- if (i == tileCount - 1)
- compressedTileDataSize = tileDataComp->size() - tileOfs;
- else
- compressedTileDataSize = tileDataUncomp->readUint32LE() - tileOfs;
-
- //debugCN(kDebugGraphics, "Tile: %i, compressed size: %i\n", i, compressedTileDataSize);
-
- newTile->clear();
-
- byte *compressedTileData = new byte[compressedTileDataSize];
-
- tileDataComp->seek(tileData.getDataOffset() + tileOfs, SEEK_SET);
- tileDataComp->read(compressedTileData, compressedTileDataSize);
-
- fab.decompress(compressedTileData, compressedTileDataSize, (byte*)newTile->pixels, tileWidth * tileHeight);
- tileSet.push_back(TileSetList::value_type(newTile));
- delete[] compressedTileData;
- }
-
- delete tileDataUncomp;
-
- // --------------------------------------------------------------------------------
-
- // Loop through the mapping data to place the tiles on the screen
-
- uint16 *tIndex = &tileMap[0];
- for (int y = 0; y < tileCountY; y++) {
- for (int x = 0; x < tileCountX; x++) {
- int tileIndex = *tIndex++;
- assert(tileIndex < tileCount);
- TileSetIterator tile = tileSet.begin();
- for (i = 0; i < tileIndex; i++)
- ++tile;
- ((*tile).get())->copyTo(this, x * tileWidth, y * tileHeight);
- }
- }
- tileSet.clear();
- _vm->res()->toss(resourceName);
-}
-
-void M4Surface::rexLoadBackground(Common::SeekableReadStream *source, RGBList **palData) {
- MadsPack packData(source);
- Common::SeekableReadStream *sourceUnc = packData.getItemStream(0);
-
- int sceneWidth = sourceUnc->readUint16LE();
- int sceneHeight = sourceUnc->readUint16LE();
- int sceneSize = sceneWidth * sceneHeight;
-
- // Set palette
- if (!palData) {
- _vm->_palette->setMadsPalette(sourceUnc, 4);
- } else {
- int numColors;
- RGB8 *rgbList = _vm->_palette->decodeMadsPalette(sourceUnc, &numColors);
- *palData = new RGBList(numColors, rgbList, true);
- }
- delete sourceUnc;
-
- // Get the raw data for the background
- sourceUnc = packData.getItemStream(1);
- assert((int)sourceUnc->size() >= sceneSize);
-
- create(sceneWidth, sceneHeight, Graphics::PixelFormat::createFormatCLUT8());
- byte *pData = (byte *)pixels;
- sourceUnc->read(pData, sceneSize);
-
- freeData();
- delete sourceUnc;
-}
-
-#undef COL_TRANS
-
-void M4Surface::m4LoadBackground(Common::SeekableReadStream *source) {
- M4Surface *tileBuffer = new M4Surface();
- uint curTileX = 0, curTileY = 0;
- int clipX = 0, clipY = 0;
- RGB8 palette[256];
-
- source->readUint32LE(); // magic, unused
- /*uint32 size =*/ source->readUint32LE();
- uint32 widthVal = source->readUint32LE();
- uint32 heightVal = source->readUint32LE();
- uint32 tilesX = source->readUint32LE();
- uint32 tilesY = source->readUint32LE();
- uint32 tileWidth = source->readUint32LE();
- uint32 tileHeight = source->readUint32LE();
- uint8 blackIndex = 0;
-
- // Debug
- //debugCN(kDebugGraphics, "loadBackground(): %dx%d picture (%d bytes) - %dx%d tiles of size %dx%d\n",
- // widthVal, heightVal, size, tilesX, tilesY, tileWidth, tileHeight);
-
- // BGR data, which is converted to RGB8
- for (uint i = 0; i < 256; i++) {
- palette[i].b = source->readByte() << 2;
- palette[i].g = source->readByte() << 2;
- palette[i].r = source->readByte() << 2;
- // FIXME - Removed u field from RGB8 as the OSystem palette is now RGB.
- // If this is needed, then the system setPalette() call will need changing to skip this.
- uint8 u = source->readByte() << 2;
- if (u != 0)
- debugC(1, kDebugGraphics, "Unused u field in Palette data non-zero: %d", u);
-
- if ((blackIndex == 0) && !palette[i].r && !palette[i].g && !palette[i].b)
- blackIndex = i;
- }
-
- _vm->_palette->setPalette(palette, 0, 256);
-
- // resize or create the surface
- // note that the height of the scene in game scenes is smaller than 480, as the bottom part of the
- // screen is the inventory
- assert(width() == (int)widthVal);
- //debugCN(kDebugGraphics, "width(): %d, widthVal: %d, height(): %d, heightVal: %d\n", width(), widthVal, height(), heightVal);
-
- tileBuffer->create(tileWidth, tileHeight, Graphics::PixelFormat::createFormatCLUT8());
-
- for (curTileY = 0; curTileY < tilesY; curTileY++) {
- clipY = MIN(heightVal, (1 + curTileY) * tileHeight) - (curTileY * tileHeight);
-
- for (curTileX = 0; curTileX < tilesX; curTileX++) {
- clipX = MIN(widthVal, (1 + curTileX) * tileWidth) - (curTileX * tileWidth);
-
- // Read a tile and copy it to the destination surface
- source->read(tileBuffer->pixels, tileWidth * tileHeight);
- Common::Rect srcBounds(0, 0, clipX, clipY);
- copyFrom(tileBuffer, srcBounds, curTileX * tileWidth, curTileY * tileHeight);
- }
- }
-
- if (heightVal < (uint)height())
- fillRect(Common::Rect(0, heightVal, width(), height()), blackIndex);
-
- delete tileBuffer;
-}
-
-void M4Surface::madsLoadInterface(const Common::String &filename) {
- MadsPack intFile(filename.c_str(), _vm);
- RGB8 *palette = new RGB8[16];
-
- // Chunk 0, palette
- Common::SeekableReadStream *intStream = intFile.getItemStream(0);
-
- for (int i = 0; i < 16; i++) {
- palette[i].r = intStream->readByte() << 2;
- palette[i].g = intStream->readByte() << 2;
- palette[i].b = intStream->readByte() << 2;
- intStream->readByte();
- intStream->readByte();
- intStream->readByte();
- }
- _rgbList = new RGBList(16, palette, true);
- delete intStream;
-
- // Chunk 1, data
- intStream = intFile.getItemStream(1);
- create(320, 44, Graphics::PixelFormat::createFormatCLUT8());
- intStream->read(pixels, 320 * 44);
- delete intStream;
-
- // Translate the interface palette
- _vm->_palette->addRange(_rgbList);
- this->translate(_rgbList);
-}
-
-void M4Surface::scrollX(int xAmount) {
- if (xAmount == 0)
- return;
-
- byte buffer[80];
- int direction = (xAmount > 0) ? -1 : 1;
- int xSize = ABS(xAmount);
- assert(xSize <= 80);
-
- byte *srcP = (byte *)getBasePtr(0, 0);
-
- for (int y = 0; y < height(); ++y, srcP += pitch) {
- if (direction < 0) {
- // Copy area to be overwritten
- Common::copy(srcP, srcP + xSize, &buffer[0]);
- // Shift the remainder of the line over the given area
- Common::copy(srcP + xSize, srcP + width(), srcP);
- // Move buffered area to the end of the line
- Common::copy(&buffer[0], &buffer[xSize], srcP + width() - xSize);
- } else {
- // Copy area to be overwritten
- Common::copy_backward(srcP + width() - xSize, srcP + width(), &buffer[80]);
- // Shift the remainder of the line over the given area
- Common::copy_backward(srcP, srcP + width() - xSize, srcP + width());
- // Move buffered area to the start of the line
- Common::copy_backward(&buffer[80 - xSize], &buffer[80], srcP + xSize);
- }
- }
-}
-
-void M4Surface::scrollY(int yAmount) {
- if (yAmount == 0)
- return;
-
- int direction = (yAmount > 0) ? 1 : -1;
- int ySize = ABS(yAmount);
- assert(ySize < (height() / 2));
- assert(width() == pitch);
-
- int blockSize = ySize * width();
- byte *tempData = (byte *)malloc(blockSize);
- byte *pixelsP = (byte *)getBasePtr(0, 0);
-
- if (direction > 0) {
- // Buffer the lines to be overwritten
- byte *srcP = (byte *)getBasePtr(0, height() - ySize);
- Common::copy(srcP, srcP + (pitch * ySize), tempData);
- // Vertically shift all the lines
- Common::copy_backward(pixelsP, pixelsP + (pitch * (height() - ySize)),
- pixelsP + (pitch * height()));
- // Transfer the buffered lines top the top of the screen
- Common::copy(tempData, tempData + blockSize, pixelsP);
- } else {
- // Buffer the lines to be overwritten
- Common::copy(pixelsP, pixelsP + (pitch * ySize), tempData);
- // Vertically shift all the lines
- Common::copy(pixelsP + (pitch * ySize), pixelsP + (pitch * height()), pixelsP);
- // Transfer the buffered lines to the bottom of the screen
- Common::copy(tempData, tempData + blockSize, pixelsP + (pitch * (height() - ySize)));
- }
-
- ::free(tempData);
-}
-
-
-void M4Surface::translate(RGBList *list, bool isTransparent) {
- byte *p = getBasePtr(0, 0);
- byte *palIndexes = list->palIndexes();
-
- for (int i = 0; i < width() * height(); ++i, ++p) {
- if (!isTransparent || (*p != TRANSPARENT_COLOR_INDEX)) {
- if (*p < list->size())
- *p = palIndexes[*p];
- else
- warning("Pal index %d exceeds list size %d", *p, list->size());
- }
- }
-
- freeData();
-}
-
-M4Surface *M4Surface::flipHorizontal() const {
- M4Surface *dest = new M4Surface(width(), height());
- dest->_rgbList = (this->_rgbList == NULL) ? NULL : this->_rgbList->clone();
-
- byte *destP = dest->getBasePtr();
-
- for (int y = 0; y < height(); ++y) {
- const byte *srcP = getBasePtr(width() - 1, y);
- for (int x = 0; x < width(); ++x)
- *destP++ = *srcP--;
- }
-
- return dest;
-}
-
-//--------------------------------------------------------------------------
-// Palette class
-//
-
-#define GREEN_START 32
-#define NUM_GREENS 32
-#define GREEN_END (GREEN_START + NUM_GREENS - 1)
-#define NORMAL_START 64
-#define NORMAL_END 255
-#define NUM_NORMAL (NORMAL_END - NORMAL_START + 1)
-
-// Support function for creating a list of palette indexes to change entries in the shaded range to
-
-static void makeTranslationList(RGB8 *palData, byte transList[NUM_GREENS]) {
- int i, j, minDistance;
- byte bestIndex;
-
- for (i = 0; i < NUM_GREENS; ++i) {
- bestIndex = NORMAL_START;
- minDistance = 255;
-
- uint8 findCol = palData[GREEN_START + i].g;
-
- // Find the closest matching palette color
- for (j = NORMAL_START; j <= NORMAL_END; ++j) {
- int greenVal = palData[j].g;
- if (ABS(findCol - greenVal) < minDistance) {
- minDistance = ABS(findCol - greenVal);
- bestIndex = j;
- }
-
- if (minDistance == 0)
- break;
- }
-
- transList[i] = bestIndex;
- }
-}
-
-// Support function for fading in or out
-
-static void fadeRange(MadsM4Engine *vm, RGB8 *srcPal, RGB8 *destPal, int startIndex, int endIndex,
- int numSteps, uint delayAmount) {
- RGB8 tempPal[256];
-
- // perform the fade
- for (int stepCtr = 1; stepCtr <= numSteps; ++stepCtr) {
- // Delay the specified amount
- uint32 startTime = g_system->getMillis();
- while ((g_system->getMillis() - startTime) < delayAmount) {
- vm->_events->handleEvents();
- g_system->delayMillis(10);
- }
-
- for (int i = startIndex; i <= endIndex; ++i) {
- // Handle the intermediate rgb values for fading
- tempPal[i].r = (byte) (srcPal[i].r + (destPal[i].r - srcPal[i].r) * stepCtr / numSteps);
- tempPal[i].g = (byte) (srcPal[i].g + (destPal[i].g - srcPal[i].g) * stepCtr / numSteps);
- tempPal[i].b = (byte) (srcPal[i].b + (destPal[i].b - srcPal[i].b) * stepCtr / numSteps);
- }
-
- vm->_palette->setPalette(&tempPal[startIndex], startIndex, endIndex - startIndex + 1);
- vm->_viewManager->refreshAll();
- }
-
- // Make sure the end palette exactly matches what is wanted
- vm->_palette->setPalette(&destPal[startIndex], startIndex, endIndex - startIndex + 1);
-}
-
-Palette::Palette(MadsM4Engine *vm) : _vm(vm) {
- reset();
- _fading_in_progress = false;
- Common::set_to(&_usageCount[0], &_usageCount[256], 0);
-}
-
-void Palette::setPalette(const byte *colors, uint start, uint num) {
- g_system->getPaletteManager()->setPalette(colors, start, num);
- reset();
-}
-
-void Palette::setPalette(const RGB8 *colors, uint start, uint num) {
- g_system->getPaletteManager()->setPalette((const byte *)colors, start, num);
- reset();
-}
-
-void Palette::grabPalette(byte *colors, uint start, uint num) {
- g_system->getPaletteManager()->grabPalette(colors, start, num);
-}
-
-void Palette::setEntry(uint index, uint8 r, uint8 g, uint8 b) {
- RGB8 c;
- c.r = r;
- c.g = g;
- c.b = b;
- g_system->getPaletteManager()->setPalette((const byte *)&c, index, 1);
-}
-
-uint8 Palette::palIndexFromRgb(byte r, byte g, byte b, RGB8 *paletteData) {
- byte index = 0;
- int32 minDist = 0x7fffffff;
- RGB8 palData[256];
- int Rdiff, Gdiff, Bdiff;
-
- if (paletteData == NULL) {
- g_system->getPaletteManager()->grabPalette((byte *)palData, 0, 256);
- paletteData = &palData[0];
- }
-
- for (int palIndex = 0; palIndex < 256; ++palIndex) {
- Rdiff = r - paletteData[palIndex].r;
- Gdiff = g - paletteData[palIndex].g;
- Bdiff = b - paletteData[palIndex].b;
-
- if (Rdiff * Rdiff + Gdiff * Gdiff + Bdiff * Bdiff < minDist) {
- minDist = Rdiff * Rdiff + Gdiff * Gdiff + Bdiff * Bdiff;
- index = (uint8)palIndex;
- }
- }
-
- return (uint8)index;
-}
-
-void Palette::reset() {
- RGB8 palData[256];
- g_system->getPaletteManager()->grabPalette((byte *)palData, 0, 256);
-
- BLACK = palIndexFromRgb(0, 0, 0, palData);
- BLUE = palIndexFromRgb(0, 0, 255, palData);
- GREEN = palIndexFromRgb(0, 255, 0, palData);
- CYAN = palIndexFromRgb(0, 255, 255, palData);
- RED = palIndexFromRgb(255, 0, 0, palData);
- VIOLET = palIndexFromRgb(255, 0, 255, palData);
- BROWN = palIndexFromRgb(168, 84, 84, palData);
- LIGHT_GRAY = palIndexFromRgb(168, 168, 168, palData);
- DARK_GRAY = palIndexFromRgb(84, 84, 84, palData);
- LIGHT_BLUE = palIndexFromRgb(0, 0, 127, palData);
- LIGHT_GREEN = palIndexFromRgb(0, 127, 0, palData);
- LIGHT_CYAN = palIndexFromRgb(0, 127, 127, palData);
- LIGHT_RED = palIndexFromRgb(84, 0, 0, palData);
- PINK = palIndexFromRgb(84, 0, 0, palData);
- YELLOW = palIndexFromRgb(0, 84, 84, palData);
- WHITE = palIndexFromRgb(255, 255, 255, palData);
-}
-
-void Palette::fadeToGreen(int numSteps, uint delayAmount) {
- if (_fading_in_progress)
- return;
- _fading_in_progress = true;
- byte translationList[NUM_GREENS];
-
- int i;
- byte *tempP;
- uint8 greenAmount = 0;
- RGB8 *srcPalette = (RGB8 *) &_originalPalette[0];
- RGB8 *destPalette = (RGB8 *) &_fadedPalette[0];
-
- _vm->_palette->grabPalette(srcPalette, 0, 256);
-
- // Create the destination 'greenish' palette to fade to by setting the green component
- // to the average of the RGB bytes, and leaving the Red and Blue parts as 0
-
- Common::copy(&srcPalette[0], &srcPalette[256], &destPalette[0]);
- for (i = 32; i < 256; ++i) {
- byte luminance = (byte)((destPalette[i].r + destPalette[i].g + destPalette[i].b) / 3);
- destPalette[i].g = MIN((byte)255, luminance);
- destPalette[i].r = destPalette[i].b = 0;
- }
-
- // Handle the actual fading
- fadeRange(_vm, srcPalette, destPalette, 21, 255, numSteps, delayAmount);
-
- // Create a translation table to be used in translating pixels in the game surface
- // using palette indexes in the range the range #32-63 into values from #64-255
-
- makeTranslationList(destPalette, translationList);
-
- // Use palette indexes from #32-63 for the range of possible shades
-
- for (i = GREEN_START; i <= GREEN_END; ++i, greenAmount += 8) {
- destPalette[i].g = greenAmount;
- destPalette[i].r = destPalette[i].b = 0;
- }
-
- // Remap all pixels into the #32-63 range
-
- tempP = _vm->_scene->getBasePtr();
- for (int pixelCtr = 0; pixelCtr < _vm->_scene->width() * _vm->_scene->height();
- ++pixelCtr, ++tempP) {
- // If pixel is in #32-63 range already, remap to higher palette entries
- if ((*tempP >= GREEN_START) && (*tempP <= GREEN_END))
- *tempP = translationList[*tempP - GREEN_START];
-
- *tempP = (uint8) (GREEN_START + (destPalette[*tempP].g >> 3));
- }
-
- _vm->_palette->setPalette(&destPalette[GREEN_START], GREEN_START, NUM_GREENS);
- _vm->_viewManager->refreshAll();
- _fading_in_progress = false;
-}
-
-void Palette::fadeFromGreen(int numSteps, uint delayAmount, bool fadeToBlack) {
- if (_fading_in_progress)
- return;
- _fading_in_progress = true;
- RGB8 blackPalette[256];
- RGB8 *fadedPalette = (RGB8 *) &_fadedPalette[0];
- RGB8 *destPalette = (RGB8 *) &_originalPalette[0];
-
- if (fadeToBlack) {
- Common::set_to((byte *)&blackPalette[0], (byte *)&blackPalette[256], 0);
- destPalette = &blackPalette[0];
- }
-
- // Initially restore the faded palette
- _vm->_palette->setPalette(fadedPalette, 0, 256);
- _vm->_viewManager->refreshAll();
-
- // Restore the pixel data from the original screen
- _vm->_scene->update();
-
- // Handle the actual fading
- fadeRange(_vm, fadedPalette, destPalette, GREEN_START, NORMAL_END, numSteps, delayAmount);
-
- _fading_in_progress = false;
-}
-
-void Palette::fadeIn(int numSteps, uint delayAmount, RGBList *destPalette) {
- fadeIn(numSteps, delayAmount, destPalette->data(), destPalette->size());
-}
-
-void Palette::fadeIn(int numSteps, uint delayAmount, RGB8 *destPalette, int numColors) {
- if (_fading_in_progress)
- return;
-
- _fading_in_progress = true;
- RGB8 blackPalette[256];
- Common::set_to((byte *)&blackPalette[0], (byte *)&blackPalette[256], 0);
-
- // Initially set the black palette
- _vm->_palette->setPalette(blackPalette, 0, numColors);
-
- // Handle the actual fading
- fadeRange(_vm, blackPalette, destPalette, 0, numColors - 1, numSteps, delayAmount);
-
- _fading_in_progress = false;
-}
-
-RGB8 *Palette::decodeMadsPalette(Common::SeekableReadStream *palStream, int *numColors) {
- *numColors = palStream->readUint16LE();
- assert(*numColors <= 252);
-
- RGB8 *palData = new RGB8[*numColors];
- Common::set_to((byte *)&palData[0], (byte *)&palData[*numColors], 0);
-
- for (int i = 0; i < *numColors; ++i) {
- byte r = palStream->readByte();
- byte g = palStream->readByte();
- byte b = palStream->readByte();
- palData[i].r = VGA_COLOR_TRANS(r);
- palData[i].g = VGA_COLOR_TRANS(g);
- palData[i].b = VGA_COLOR_TRANS(b);
-
- // The next 3 bytes are unused
- palStream->skip(3);
- }
-
- return palData;
-}
-
-int Palette::setMadsPalette(Common::SeekableReadStream *palStream, int indexStart) {
- int colorCount;
- RGB8 *palData = Palette::decodeMadsPalette(palStream, &colorCount);
- _vm->_palette->setPalette(palData, indexStart, colorCount);
- delete palData;
- return colorCount;
-}
-
-void Palette::setMadsSystemPalette() {
- // Rex Nebular default system palette
- resetColorCounts();
-
- RGB8 palData[4];
- palData[0].r = palData[0].g = palData[0].b = 0;
- palData[1].r = palData[1].g = palData[1].b = 0x54;
- palData[2].r = palData[2].g = palData[2].b = 0xb4;
- palData[3].r = palData[3].g = palData[3].b = 0xff;
-
- setPalette(palData, 0, 4);
- blockRange(0, 4);
-}
-
-void Palette::resetColorCounts() {
- Common::set_to(&_usageCount[0], &_usageCount[256], 0);
-}
-
-void Palette::blockRange(int startIndex, int size) {
- // Use a reference count of -1 to signal a palette index shouldn't be used
- Common::set_to(&_usageCount[startIndex], &_usageCount[startIndex + size], -1);
-}
-
-void Palette::addRange(RGBList *list) {
- RGB8 *data = list->data();
- byte *palIndexes = list->palIndexes();
- RGB8 palData[256];
- g_system->getPaletteManager()->grabPalette((byte *)&palData[0], 0, 256);
- bool paletteChanged = false;
-
- for (int colIndex = 0; colIndex < list->size(); ++colIndex) {
- // Scan through for an existing copy of the RGB value
- int palIndex = -1;
- while (++palIndex < 256) {
- if (_usageCount[palIndex] <= 0)
- // Palette index is to be skipped
- continue;
-
- if ((palData[palIndex].r == data[colIndex].r) &&
- (palData[palIndex].g == data[colIndex].g) &&
- (palData[palIndex].b == data[colIndex].b))
- // Match found
- break;
- }
-
- if (palIndex == 256) {
- // No match found, so find a free slot to use
- palIndex = -1;
- while (++palIndex < 256) {
- if (_usageCount[palIndex] == 0)
- break;
- }
-
- if (palIndex == 256)
- error("addRange - Ran out of palette space to allocate");
-
- palData[palIndex].r = data[colIndex].r;
- palData[palIndex].g = data[colIndex].g;
- palData[palIndex].b = data[colIndex].b;
- paletteChanged = true;
- }
-
- palIndexes[colIndex] = palIndex;
- ++_usageCount[palIndex];
- }
-
- if (paletteChanged) {
- g_system->getPaletteManager()->setPalette((byte *)&palData[0], 0, 256);
- reset();
- }
-}
-
-void Palette::deleteRange(RGBList *list) {
- // Release the reference count on each of the palette entries
- for (int colIndex = 0; colIndex < list->size(); ++colIndex) {
- int palIndex = list->palIndexes()[colIndex];
- assert(_usageCount[palIndex] > 0);
- --_usageCount[palIndex];
- }
-}
-
-void Palette::deleteAllRanges() {
- for (int colIndex = 0; colIndex < 255; ++colIndex)
- _usageCount[colIndex] = 0;
-}
-
-//--------------------------------------------------------------------------
-// Support methods
-
-void decompressRle(byte *rleData, int rleSize, byte *celData, int w, int h) {
- byte *src = rleData;
- byte *dst = celData;
- byte len;
- while (1) {
- len = *src++;
- if (len == 0) {
- len = *src++;
- if (len <= 2) {
- if (len == 1) // end of sprite marker
- break;
- } else {
- while (len--)
- *dst++ = *src++;
- }
- } else {
- while (len--)
- *dst++ = *src;
- src++;
- }
- }
-}
-
-int scaleValue(int value, int scale, int err) {
- int scaled = 0;
- while (value--) {
- err -= scale;
- while (err < 0) {
- scaled++;
- err += 100;
- }
- }
- return scaled;
-}
-
-} // End of namespace M4
diff --git a/engines/m4/graphics.h b/engines/m4/graphics.h
deleted file mode 100644
index f3dde454f3..0000000000
--- a/engines/m4/graphics.h
+++ /dev/null
@@ -1,270 +0,0 @@
-/* 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 M4_GRAPHICS_H
-#define M4_GRAPHICS_H
-
-#include "common/rect.h"
-#include "common/system.h"
-#include "common/stream.h"
-#include "graphics/surface.h"
-
-#include "m4/globals.h"
-
-namespace M4 {
-
-#define MADS_SURFACE_WIDTH 320
-#define MADS_SURFACE_HEIGHT 156
-#define MADS_SCREEN_HEIGHT 200
-#define MADS_Y_OFFSET ((MADS_SCREEN_HEIGHT - MADS_SURFACE_HEIGHT) / 2)
-
-#define TRANSPARENT_COLOR_INDEX 0xFF
-
-struct BGR8 {
- uint8 b, g, r;
-};
-
-struct RGB8 {
- uint8 r, g, b;
-};
-
-//later use ScummVM's Rect?
-struct M4Rect {
- int32 x1, y1, x2, y2;
-};
-
-class M4Surface;
-
-// RGBList
-// Implements a list of RGB entries
-
-class RGBList {
-private:
- int _size;
- RGB8 *_data;
- byte *_palIndexes;
- bool _freeData;
-public:
- RGBList(int numEntries = 256, RGB8 *srcData = NULL, bool freeData = true);
- ~RGBList();
-
- RGB8 *data() { return _data; }
- byte *palIndexes() { return _palIndexes; }
- int size() { return _size; }
- RGB8 &operator[](int idx) { return _data[idx]; }
- void setRange(int start, int count, const RGB8 *src);
- RGBList *clone() const;
-};
-
-// M4Surface
-// Class representing either a buffered surface or the physical screen.
-
-class M4Sprite;
-
-struct SpriteInfo {
- M4Sprite *sprite;
- int hotX, hotY;
- int width, height;
- int scaleX, scaleY;
- uint8 encoding;
- byte *inverseColorTable;
- RGB8 *palette;
-};
-
-class M4Surface : protected Graphics::Surface {
-private:
- byte _color;
- bool _isScreen;
- RGBList *_rgbList;
- bool _ownsData;
-
- void rexLoadBackground(Common::SeekableReadStream *source, RGBList **palData = NULL);
- void madsLoadBackground(int roomNumber, RGBList **palData = NULL);
- void m4LoadBackground(Common::SeekableReadStream *source);
-public:
- M4Surface(bool isScreen = false) {
- create(g_system->getWidth(), isScreen ? g_system->getHeight() : MADS_SURFACE_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
- _isScreen = isScreen;
- _rgbList = NULL;
- _ownsData = true;
- }
- M4Surface(int width_, int height_) {
- create(width_, height_, Graphics::PixelFormat::createFormatCLUT8());
- _isScreen = false;
- _rgbList = NULL;
- _ownsData = true;
- }
- M4Surface(int width_, int height_, byte *srcPixels, int pitch_) {
- format = Graphics::PixelFormat::createFormatCLUT8();
- w = width_;
- h = height_;
- pitch = pitch_;
- pixels = srcPixels;
- _rgbList = NULL;
- _ownsData = false;
- }
-
- virtual ~M4Surface();
-
- // loads a .COD file into the M4Surface
- // TODO: maybe move this to the rail system? check where it makes sense
- // The sprite drawing needs this, too, so should be more global.
- void loadCodesM4(Common::SeekableReadStream *source);
- void loadCodesMads(Common::SeekableReadStream *source);
-
- // loads the specified background
- void loadBackground(int sceneNumber, RGBList **palData = NULL);
- void loadBackgroundRiddle(const char *sceneName);
- void madsLoadInterface(int index, RGBList **palData = NULL);
- void madsLoadInterface(const Common::String &filename);
-
- void setColor(byte value) { _color = value; }
- inline byte getColor() const { return _color; }
- void vLine(int x, int y1, int y2);
- void hLine(int x1, int x2, int y);
- void vLineXor(int x, int y1, int y2);
- void hLineXor(int x1, int x2, int y);
- void drawLine(int x1, int y1, int x2, int y2, byte color);
- void frameRect(int x1, int y1, int x2, int y2);
- void fillRect(int x1, int y1, int x2, int y2);
-
- void drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &clipRect);
-
- // Surface methods
- inline Common::Rect bounds() const { return Common::Rect(0, 0, width(), height()); }
- inline int width() const { return w; }
- inline int height() const { return h; }
- inline int getPitch() const { return pitch; }
- void setSize(int sizeX, int sizeY) { create(sizeX, sizeY, Graphics::PixelFormat::createFormatCLUT8()); }
- inline byte *getBasePtr() {
- return (byte *)pixels;
- }
- inline byte *getBasePtr(int x, int y) {
- return (byte *)Graphics::Surface::getBasePtr(x, y);
- }
- inline const byte *getBasePtr(int x, int y) const {
- return (const byte *)Graphics::Surface::getBasePtr(x, y);
- }
- void freeData();
- void clear();
- void reset();
- void frameRect(const Common::Rect &r, uint8 color);
- void fillRect(const Common::Rect &r, uint8 color);
- void copyFrom(M4Surface *src, const Common::Rect &srcBounds, int destX, int destY, int transparentColor = -1);
- void copyFrom(M4Surface *src, int destX, int destY, int depth, M4Surface *depthSurface,
- int scale, int transparentColor = -1);
-
- void update() {
- if (_isScreen) {
- g_system->copyRectToScreen((const byte *)pixels, pitch, 0, 0, w, h);
- g_system->updateScreen();
- }
- }
-
- // copyTo methods
- inline void copyTo(M4Surface *dest, int transparentColor = -1) {
- dest->copyFrom(this, Common::Rect(width(), height()), 0, 0, transparentColor);
- }
- inline void copyTo(M4Surface *dest, int x, int y, int transparentColor = -1) {
- dest->copyFrom(this, Common::Rect(width(), height()), x, y, transparentColor);
- }
- inline void copyTo(M4Surface *dest, const Common::Rect &srcBounds, int destX, int destY,
- int transparentColor = -1) {
- dest->copyFrom(this, srcBounds, destX, destY, transparentColor);
- }
- inline void copyTo(M4Surface *dest, int destX, int destY, int depth, M4Surface *depthsSurface, int scale,
- int transparentColor = -1) {
- dest->copyFrom(this, destX, destY, depth, depthsSurface, scale, transparentColor);
- }
-
- void scrollX(int xAmount);
- void scrollY(int yAmount);
-
- void translate(RGBList *list, bool isTransparent = false);
- M4Surface *flipHorizontal() const;
-};
-
-enum FadeType {FT_TO_GREY, FT_TO_COLOR, FT_TO_BLOCK};
-
-class Palette {
-private:
- MadsM4Engine *_vm;
- bool _colorsChanged;
- bool _fading_in_progress;
- byte _originalPalette[256 * 3];
- byte _fadedPalette[256 * 3];
- int _usageCount[256];
-
- void reset();
-public:
- Palette(MadsM4Engine *vm);
-
- void setPalette(const byte *colors, uint start, uint num);
- void setPalette(const RGB8 *colors, uint start, uint num);
- void grabPalette(byte *colors, uint start, uint num);
- void grabPalette(RGB8 *colors, uint start, uint num) {
- grabPalette((byte *)colors, start, num);
- }
- void setEntry(uint index, uint8 r, uint8 g, uint8 b);
- uint8 palIndexFromRgb(byte r, byte g, byte b, RGB8 *paletteData = NULL);
-
- void fadeToGreen(int numSteps, uint delayAmount);
- void fadeFromGreen(int numSteps, uint delayAmount, bool fadeToBlack);
- void fadeIn(int numSteps, uint delayAmount, RGB8 *destPalette, int numColors);
- void fadeIn(int numSteps, uint delayAmount, RGBList *destPalette);
- static RGB8 *decodeMadsPalette(Common::SeekableReadStream *palStream, int *numColors);
- int setMadsPalette(Common::SeekableReadStream *palStream, int indexStart = 0);
- void setMadsSystemPalette();
-
- // Methods used for reference counting color usage
- void resetColorCounts();
- void blockRange(int startIndex, int size);
- void addRange(RGBList *list);
- void deleteRange(RGBList *list);
- void deleteAllRanges();
-
- // Color indexes
- uint8 BLACK;
- uint8 BLUE;
- uint8 GREEN;
- uint8 CYAN;
- uint8 RED;
- uint8 VIOLET;
- uint8 BROWN;
- uint8 LIGHT_GRAY;
- uint8 DARK_GRAY;
- uint8 LIGHT_BLUE;
- uint8 LIGHT_GREEN;
- uint8 LIGHT_CYAN;
- uint8 LIGHT_RED;
- uint8 PINK;
- uint8 YELLOW;
- uint8 WHITE;
-};
-
-void decompressRle(byte *rleData, int rleSize, byte *celData, int w, int h);
-void decompressRle(Common::SeekableReadStream &rleData, byte *celData, int w, int h);
-int scaleValue(int value, int scale, int err);
-
-} // End of namespace M4
-
-#endif
diff --git a/engines/m4/gui.cpp b/engines/m4/gui.cpp
deleted file mode 100644
index 6bedfa7e9b..0000000000
--- a/engines/m4/gui.cpp
+++ /dev/null
@@ -1,1215 +0,0 @@
-/* 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/events.h"
-#include "common/keyboard.h"
-#include "common/textconsole.h"
-
-#include "m4/globals.h"
-#include "m4/events.h"
-#include "m4/font.h"
-#include "m4/graphics.h"
-#include "m4/viewmgr.h"
-#include "m4/gui.h"
-#include "m4/midi.h"
-#include "m4/scene.h"
-#include "m4/m4.h"
-
-namespace M4 {
-
-//--------------------------------------------------------------------------
-// DialogView class
-//
-// Defines a generic base class for dialogs, that some of the classes
-// in the object hierharchy require as a parent
-//--------------------------------------------------------------------------
-
-void DialogView::close() {
- // Default to simply destroying the given dialog
- _vm->_viewManager->deleteView(this);
-}
-
-//--------------------------------------------------------------------------
-// GUIObject class
-//
-// Defines a generic object that appears in a view
-//--------------------------------------------------------------------------
-
-GUIObject::GUIObject(View *owner, const Common::Rect &bounds) {
- _parent = owner;
- _bounds = bounds;
-}
-
-//--------------------------------------------------------------------------
-// MenuObject class
-//
-// Defines a specialised GUI object that appears in a dialog
-//--------------------------------------------------------------------------
-
-MenuObject::MenuObject(DialogView *owner, int objectId, int xs, int ys, int width, int height,
- bool greyed, bool transparent):
- GUIObject(owner, Common::Rect(xs, ys, xs + width, ys + height)) {
-
- _objectId = objectId;
- _bounds.top = ys;
- _bounds.bottom = ys + height - 1;
- _bounds.left = xs;
- _bounds.right = xs + width - 1;
- _transparent = transparent;
- _objectState = greyed ? OS_GREYED : OS_NORMAL;
- _callback = NULL;
-
- if (transparent) {
- _background = new M4Surface(width, height);
- Common::Rect srcBounds(xs, ys, xs + width - 1, ys + height - 1);
- _background->copyFrom(owner, srcBounds, 0, 0);
- } else {
- _background = NULL;
- }
-}
-
-MenuObject::~MenuObject() {
- delete _background;
-}
-
-void MenuObject::onExecute() {
- // If a callback function has been specified, then execute it
- if (_callback)
- _callback(parent(), this);
-}
-
-//--------------------------------------------------------------------------
-// MenuButton class
-//
-// Defines a button object
-//--------------------------------------------------------------------------
-
-MenuButton::MenuButton(DialogView *owner, int buttonId, int xs, int ys, int width, int height,
- MenuButton::Callback callbackFn, bool greyed, bool transparent,
- ObjectType buttonType):
- MenuObject(owner, buttonId, xs, ys, width, height, greyed, transparent) {
-
- _objectType = buttonType;
- _callback = callbackFn;
-}
-
-bool MenuButton::onEvent(M4EventType event, int32 param, int x, int y, MenuObject *&currentItem) {
- bool redrawFlag = false;
- bool callbackFlag = false;
- bool handledFlag = true;
-
- if (_objectState == OS_GREYED)
- return false;
-
- switch (event) {
- case MEVENT_LEFT_CLICK:
- case MEVENT_DOUBLECLICK:
- if (isInside(x, y)) {
- _objectState = OS_PRESSED;
- if (currentItem != NULL)
- currentItem = this;
- redrawFlag = true;
- } else {
- currentItem = NULL;
- if (_objectState != OS_NORMAL) {
- _objectState = OS_PRESSED;
- redrawFlag = true;
- }
- }
- break;
-
- case MEVENT_LEFT_DRAG:
- case MEVENT_DOUBLECLICK_DRAG:
- if (!currentItem) {
- return true;
- }
- if (isInside(x, y)) {
- if (_objectState != OS_PRESSED) {
- _objectState = OS_PRESSED;
- redrawFlag = true;
- }
- }
- else {
- if (_objectState != OS_MOUSEOVER) {
- _objectState = OS_MOUSEOVER;
- redrawFlag = true;
- }
- }
- break;
-
- case MEVENT_LEFT_RELEASE:
- case MEVENT_DOUBLECLICK_RELEASE:
- if (isInside(x, y)) {
- if (currentItem) {
- callbackFlag = true;
- if (_objectType == OBJTYPE_OM_SWITCH_ON)
- _objectType = OBJTYPE_OM_SWITCH_OFF;
- else if (_objectType == OBJTYPE_OM_SWITCH_OFF)
- _objectType = OBJTYPE_OM_SWITCH_ON;
- }
- else {
- currentItem = this;
- }
-
- _objectState = OS_MOUSEOVER;
- redrawFlag = true;
-
- } else {
- currentItem = NULL;
- _objectState = OS_MOUSEOVER;
- redrawFlag = true;
- handledFlag = false;
- }
- break;
-
- case MEVENT_MOVE:
- if (isInside(x, y)) {
- currentItem = this;
- if (_objectState != OS_MOUSEOVER) {
- _objectState = OS_MOUSEOVER;
- redrawFlag = true;
- }
- }
- else {
- currentItem = NULL;
- if (_objectState != OS_NORMAL) {
- _objectState = OS_NORMAL;
- redrawFlag = true;
- handledFlag = false;
- }
- }
- break;
-
- case MEVENT_LEFT_HOLD:
- case MEVENT_DOUBLECLICK_HOLD:
- break;
-
- default:
- break;
- }
-
- //see if we need to redraw the button
- if (redrawFlag) {
- onRefresh();
-
- // TODO: There may be a more efficient mechanism than refreshing the entire screen
- // when a menu object refreshes itself
- if (parent()->screenFlags().visible)
- _vm->_viewManager->refreshAll();
- }
-
- // If a callback is flagged, then handle it
-
- if (callbackFlag)
- onExecute();
-
- return handledFlag;
-}
-
-void MenuButton::onRefresh() {
- M4Sprite *sprite = NULL;
- SpriteAsset &sprites = *parent()->sprites();
-
- // Switch handling for the various button types
- switch (_objectType) {
- case OBJTYPE_BUTTON:
- sprite = sprites[GM_BUTTON_GREYED + _objectState];
- break;
-
- case OBJTYPE_OM_SWITCH_ON:
- switch (_objectState) {
- case OS_MOUSEOVER:
- sprite = sprites[MENU_SS_SWITCH_ON_MOUSEOVER];
- break;
- case OS_PRESSED:
- sprite = sprites[MENU_SS_SWITCH_ON_PRESSED];
- break;
- default:
- sprite = sprites[MENU_SS_SWITCH_ON_NORMAL];
- break;
- }
- break;
-
- case OBJTYPE_OM_SWITCH_OFF:
- switch (_objectState) {
- case OS_MOUSEOVER:
- sprite = sprites[MENU_SS_SWITCH_OFF_MOUSEOVER];
- break;
- case OS_PRESSED:
- sprite = sprites[MENU_SS_SWITCH_OFF_PRESSED];
- break;
- default:
- sprite = sprites[MENU_SS_SWITCH_OFF_NORMAL];
- break;
- }
- break;
-
- case OBJTYPE_OM_DONE:
- sprite = sprites[OM_DONE_BTN_GREYED + _objectState];
- break;
-
- case OBJTYPE_OM_CANCEL:
- sprite = (_objectState == OS_GREYED) ? sprites[OM_CANCEL_BTN_NORMAL] :
- sprites[OM_CANCEL_BTN_NORMAL + _objectState - 1];
- break;
-
- case OBJTYPE_SL_SAVE:
- sprite = sprites[SL_SAVE_BTN_GREYED + _objectState];
- break;
-
- case OBJTYPE_SL_LOAD:
- sprite = sprites[SL_LOAD_BTN_GREYED + _objectState];
- break;
-
- case OBJTYPE_SL_CANCEL:
- sprite = (_objectState == OS_GREYED) ? sprites[SL_CANCEL_BTN_NORMAL] :
- sprites[SL_CANCEL_BTN_NORMAL + _objectState - 1];
- break;
-
- case OBJTYPE_SL_TEXT:
- switch (_objectState) {
- case OS_MOUSEOVER:
- _vm->_font->current()->setColors(TEXT_COLOR_MOUSEOVER_SHADOW, TEXT_COLOR_MOUSEOVER_FOREGROUND,
- TEXT_COLOR_MOUSEOVER_HILIGHT);
- sprite = sprites[SL_LINE_MOUSEOVER];
- break;
-
- case OS_PRESSED:
- _vm->_font->current()->setColors(TEXT_COLOR_PRESSED_SHADOW, TEXT_COLOR_PRESSED_FOREGROUND,
- TEXT_COLOR_PRESSED_HILIGHT);
- sprite = sprites[SL_LINE_PRESSED];
- break;
-
- case OS_GREYED:
- _vm->_font->current()->setColors(TEXT_COLOR_GREYED_SHADOW, TEXT_COLOR_GREYED_FOREGROUND,
- TEXT_COLOR_GREYED_HILIGHT);
- sprite = sprites[SL_LINE_NORMAL];
- break;
-
- default:
- case OS_NORMAL:
- _vm->_font->current()->setColors(TEXT_COLOR_NORMAL_SHADOW, TEXT_COLOR_NORMAL_FOREGROUND,
- TEXT_COLOR_NORMAL_HILIGHT);
- sprite = sprites[SL_LINE_NORMAL];
- break;
- }
- break;
-
- default:
- error("Unknown object type");
- break;
- }
-
- // If no sprite object was set, then exit without doing anything
- if (!sprite)
- return;
-
- // Draw the button
- if (_transparent) {
- // Transparent button, so restore original background
- if (!_background)
- return;
- else
- _background->copyTo(parent(), _bounds.left, _bounds.top);
- }
-
- sprite->copyTo(parent(), _bounds.left, _bounds.top, 0);
-}
-
-//--------------------------------------------------------------------------
-// MenuHorizSlider class
-//
-// Defines a horizontal slider that allows selection of a percentage
-//--------------------------------------------------------------------------
-
-MenuHorizSlider::MenuHorizSlider(DialogView *owner, int objectId, int xs, int ys,
- int width, int height, int initialPercentage, Callback callbackFn, bool transparent):
- MenuObject(owner, objectId, xs, ys, width, height, false, transparent) {
-
- _objectType = OBJTYPE_SLIDER;
- _callback = callbackFn;
-
- SpriteAsset &sprites = *owner->sprites();
- _sliderState = HSLIDER_THUMB_NORMAL;
- _thumbSize.x = sprites[OM_SLIDER_BTN_NORMAL]->width();
- _thumbSize.y = sprites[OM_SLIDER_BTN_NORMAL]->height();
- _maxThumbX = width - _thumbSize.x;
- _percent = MAX(MIN(initialPercentage, 100), 0);
- _thumbX = initialPercentage * _maxThumbX / 100;
-}
-
-void MenuHorizSlider::onRefresh() {
- // If the slider is transparent, first copy in the background
- if (_transparent) {
- // Transparent button
- if (!_background)
- return;
-
- _background->copyTo(parent(), _bounds.left, _bounds.top, 0);
- }
-
- // Get the thumb sprite for the slider
- SpriteAsset &sprites = *parent()->sprites();
- M4Sprite *sprite = sprites[OM_SLIDER_BTN_NORMAL + _sliderState];
- assert(sprite);
-
- // Fill in the area to the left of the thumbnail
- if (_thumbX > 2) {
- Common::Rect leftBounds(_bounds.left + 3, _bounds.top + 9, _bounds.left + _thumbX,
- _bounds.top + _thumbSize.y - 9);
- parent()->fillRect(leftBounds, SLIDER_BAR_COLOR);
- }
-
- // Draw the thumbnail
- sprite->copyTo(parent(), _bounds.left + _thumbX, _bounds.top, 0);
-}
-
-bool MenuHorizSlider::onEvent(M4EventType event, int32 param, int x, int y, MenuObject *&currentItem) {
- static bool movingFlag = false;
- static int movingX = 0;
- bool redrawFlag = false, handledFlag = false, callbackFlag = false;
-
- if (event == KEVENT_KEY)
- return false;
-
- switch (event) {
- case MEVENT_LEFT_CLICK:
- case MEVENT_DOUBLECLICK:
- if (isInside(x, y) && (x - _bounds.left >= _thumbX) &&
- (x - _bounds.left <= _thumbX + _thumbSize.x - 1)) {
- // The thumbnail has been clicked
- _sliderState = HSLIDER_THUMB_PRESSED;
- movingFlag = true;
- movingX = x;
- currentItem = this;
- redrawFlag = true;
- } else {
- currentItem = NULL;
- _sliderState = HSLIDER_THUMB_NORMAL;
- redrawFlag = true;
- }
- redrawFlag = true;
- break;
-
- case MEVENT_LEFT_DRAG:
- case MEVENT_DOUBLECLICK_DRAG:
- if (!currentItem)
- return true;
-
- if (movingFlag) {
- if (x != movingX) {
- if (x < movingX)
- _thumbX -= MIN(_thumbX, movingX - x);
- else
- _thumbX += MIN(_maxThumbX - _thumbX, x - movingX);
- _percent = _thumbX * 100 / _maxThumbX;
- redrawFlag = callbackFlag = true;
- }
- movingX = CLIP(x, _bounds.left + _thumbX,
- _bounds.left + _thumbX + _thumbSize.x - 1);
- } else {
- currentItem = NULL;
- }
- break;
-
- case MEVENT_LEFT_RELEASE:
- case MEVENT_DOUBLECLICK_RELEASE:
- if (!currentItem)
- return true;
-
- movingFlag = false;
- if (isInside(x, y) && (x - _bounds.left >= _thumbX) &&
- (x - _bounds.left <= _thumbX + _thumbSize.x - 1)) {
- _sliderState = HSLIDER_THUMB_MOUSEOVER;
- currentItem = this;
- } else {
- _sliderState = HSLIDER_THUMB_NORMAL;
- currentItem = NULL;
- }
-
- redrawFlag = true;
- callbackFlag = true;
- break;
-
- case MEVENT_MOVE:
- if (isInside(x, y) && (x - _bounds.left >= _thumbX) &&
- (x - _bounds.left <= _thumbX + _thumbSize.x - 1)) {
- if (_sliderState != HSLIDER_THUMB_MOUSEOVER) {
- _sliderState = HSLIDER_THUMB_MOUSEOVER;
- currentItem = this;
- }
- } else {
- if (_sliderState != HSLIDER_THUMB_NORMAL) {
- _sliderState = HSLIDER_THUMB_NORMAL;
- currentItem = NULL;
- handledFlag = false;
- }
- }
- redrawFlag = true;
- break;
-
- default:
- break;
- }
-
- if (redrawFlag)
- onRefresh();
-
- if (callbackFlag)
- onExecute();
-
- return handledFlag;
-}
-
-//--------------------------------------------------------------------------
-// MenuVertSlider class
-//
-// Defines a vertical slider that's used in the save/load dialog
-//--------------------------------------------------------------------------
-
-MenuVertSlider::MenuVertSlider(DialogView *owner, int objectId, int xs, int ys,
- int width, int height, int initialPercentage, Callback callbackFn, bool transparent):
- MenuObject(owner, objectId, xs, ys, width, height, false, transparent) {
-
- _objectType = OBJTYPE_SLIDER;
- _callback = callbackFn;
-
- SpriteAsset &sprites = *owner->sprites();
- _sliderState = VSLIDER_NONE;
- _thumbSize.x = sprites[SL_SLIDER_BTN_NORMAL]->width();
- _thumbSize.y = sprites[SL_SLIDER_BTN_NORMAL]->height();
- _minThumbY = sprites[SL_UP_BTN_NORMAL]->height() + 1;
- _maxThumbY = sprites[SL_UP_BTN_NORMAL]->height() + sprites[SL_SCROLLBAR]->height() -
- sprites[SL_SLIDER_BTN_NORMAL]->height() - 1;
-
- _percent = MAX(MIN(initialPercentage, 100), 0);
- _thumbY = _minThumbY + ((_percent * (_maxThumbY - _minThumbY)) / 100);
-}
-
-MenuVertSliderState MenuVertSlider::getSliderArea(int y) {
- if (y < _minThumbY)
- return VSLIDER_UP;
- else if (y < _thumbY)
- return VSLIDER_PAGE_UP;
- else if (y < _thumbY + _thumbSize.y)
- return VSLIDER_THUMBNAIL;
- else if (y < _maxThumbY + _thumbSize.y)
- return VSLIDER_PAGE_DOWN;
- else
- return VSLIDER_DOWN;
-}
-
-void MenuVertSlider::onRefresh() {
- // If the slider is transparent, first copy in the background
- if (_transparent) {
- // Transparent button
- if (!_background)
- return;
-
- _background->copyTo(parent(), _bounds.left, _bounds.top, 0);
- }
-
- // Get the various needed sprites
- SpriteAsset &sprites = *parent()->sprites();
- M4Sprite *barSprite = sprites[SL_SCROLLBAR];
- M4Sprite *thumbSprite = sprites[SL_SLIDER_BTN_NORMAL];
- M4Sprite *upSprite = sprites[SL_UP_BTN_NORMAL];
- M4Sprite *downSprite = sprites[SL_DOWN_BTN_NORMAL];
-
- if (_objectState == OS_GREYED) {
- upSprite = sprites[SL_UP_BTN_GREYED];
- downSprite = sprites[SL_DOWN_BTN_GREYED];
- thumbSprite = NULL;
-
- } else if (_objectState == OS_MOUSEOVER) {
- if (_sliderState == VSLIDER_UP)
- upSprite = sprites[SL_UP_BTN_MOUSEOVER];
- else if (_sliderState == VSLIDER_THUMBNAIL)
- thumbSprite = sprites[SL_SLIDER_BTN_MOUSEOVER];
- else if (_sliderState == VSLIDER_DOWN)
- downSprite = sprites[SL_DOWN_BTN_MOUSEOVER];
- }
- else if (_objectState == OS_PRESSED) {
- if (_sliderState == VSLIDER_UP)
- upSprite = sprites[SL_UP_BTN_PRESSED];
- else if (_sliderState == VSLIDER_THUMBNAIL)
- thumbSprite = sprites[SL_SLIDER_BTN_PRESSED];
- else if (_sliderState == VSLIDER_DOWN)
- downSprite = sprites[SL_DOWN_BTN_PRESSED];
- }
-
- // Draw the sprites
- upSprite->copyTo(parent(), _bounds.left, _bounds.top, 0);
- barSprite->copyTo(parent(), _bounds.left, _bounds.top + upSprite->height(), 0);
- downSprite->copyTo(parent(), _bounds.left, _bounds.top + upSprite->height() + barSprite->height(), 0);
- if (thumbSprite)
- thumbSprite->copyTo(parent(), _bounds.left, _bounds.top + _thumbY, 0);
-}
-
-bool MenuVertSlider::onEvent(M4EventType event, int32 param, int x, int y, MenuObject *&currentItem) {
- static bool movingFlag = false;
- static int movingY = 0;
- static uint32 callbackTime;
- MenuVertSliderState tempState;
- int delta;
- uint32 currentTime = g_system->getMillis();
- bool redrawFlag = false;
- bool handledFlag = true;
- bool callbackFlag = false;
-
- if (event == KEVENT_KEY)
- return false;
-
- if (_objectState == OS_GREYED) {
- currentItem = NULL;
- return false;
- }
-
- switch (event) {
- case MEVENT_LEFT_CLICK:
- case MEVENT_DOUBLECLICK:
- if (isInside(x, y)) {
- currentItem = this;
- tempState = getSliderArea(y - _bounds.top);
- if (tempState == VSLIDER_THUMBNAIL) {
- movingFlag = true;
- movingY = y;
- }
- if ((tempState == VSLIDER_PAGE_UP) || (tempState == VSLIDER_PAGE_DOWN)) {
- _sliderState = tempState;
- setState(OS_NORMAL);
- } else {
- _sliderState = tempState;
- setState(OS_PRESSED);
- redrawFlag = true;
- }
- callbackFlag = true;
- } else {
- currentItem = NULL;
- setState(OS_NORMAL);
- redrawFlag = true;
- }
- break;
-
- case MEVENT_LEFT_DRAG:
- case MEVENT_DOUBLECLICK_DRAG:
- if (!currentItem)
- return true;
-
- if (movingFlag) {
- if (y < movingY) {
- delta = MIN(_thumbY - _minThumbY, movingY - y);
- if (delta > 0) {
- _thumbY -= delta;
- _percent = ((_thumbY - _minThumbY) * 100) / (_maxThumbY - _minThumbY);
- redrawFlag = true;
- callbackFlag = true;
- }
- }
- else if (y > movingY) {
- delta = MIN(_maxThumbY - _thumbY, y - movingY);
- if (delta > 0) {
- _thumbY += delta;
- _percent = ((_thumbY - _minThumbY) * 100) / (_maxThumbY - _minThumbY);
- redrawFlag = true;
- callbackFlag = true;
- }
- }
- movingY = y;
-
- if (movingY < (_thumbY + _bounds.top))
- movingY = _thumbY + _bounds.top;
- else if (movingY > (_bounds.top + _thumbY + _thumbSize.y - 1))
- movingY = _bounds.top + _thumbY + _thumbSize.y - 1;
-
- } else {
- if (isInside(x, y)) {
- tempState = getSliderArea(y - _bounds.top);
- if (_sliderState == tempState) {
- if ((tempState != VSLIDER_PAGE_UP) && (tempState != VSLIDER_PAGE_DOWN) &&
- (_objectState != OS_PRESSED)) {
- _sliderState = tempState;
- setState(OS_PRESSED);
- redrawFlag = true;
- }
- if (currentTime - callbackTime > 100)
- callbackFlag = true;
-
- } else {
- if (_objectState != OS_MOUSEOVER)
- setState(OS_MOUSEOVER);
- redrawFlag = true;
- }
- callbackFlag = true;
-
- } else {
- if (_objectState != OS_MOUSEOVER) {
- setState(OS_MOUSEOVER);
- redrawFlag = true;
- }
- }
- }
- break;
-
- case MEVENT_LEFT_RELEASE:
- case MEVENT_DOUBLECLICK_RELEASE:
- movingFlag = false;
- if (isInside(x, y)) {
- tempState = getSliderArea(y - _bounds.top);
- if ((tempState == VSLIDER_PAGE_UP) || (tempState == VSLIDER_PAGE_DOWN))
- setState(OS_NORMAL);
- else {
- setState(OS_MOUSEOVER);
- currentItem = this;
- }
- } else {
- setState(OS_NORMAL);
- currentItem = NULL;
- }
-
- redrawFlag = true;
- if (parent()->getMenuType() == LOAD_MENU)
- updateThumbnails();
- break;
-
- case MEVENT_MOVE:
- if (isInside(x, y)) {
- currentItem = this;
- tempState = getSliderArea(y - _bounds.top);
- if (_sliderState != tempState) {
- if ((tempState == VSLIDER_PAGE_UP) || (tempState == VSLIDER_PAGE_DOWN))
- _objectState = OS_NORMAL;
- else {
- _sliderState = tempState;
- _objectState = OS_MOUSEOVER;
- }
- redrawFlag = true;
- }
- } else {
- currentItem = NULL;
-
- if (_objectState != OS_NORMAL) {
- _objectState = OS_NORMAL;
- redrawFlag = true;
- handledFlag = false;
- }
- }
- break;
-
- case MEVENT_LEFT_HOLD:
- case MEVENT_DOUBLECLICK_HOLD:
- if (!currentItem)
- return true;
-
- if (isInside(x, y)) {
- tempState = getSliderArea(y - _bounds.top);
-
- if (_sliderState == tempState) {
- if (currentTime - callbackTime > 100)
- callbackFlag = true;
- }
- }
- break;
-
- default:
- break;
- }
-
- if (redrawFlag)
- onRefresh();
-
- if (callbackFlag) {
- callbackTime = currentTime;
- onExecute();
- }
-
- return handledFlag;
-}
-
-void MenuVertSlider::setPercentage(int value) {
- _percent = value;
- _thumbY = _minThumbY + ((_percent * (_maxThumbY - _minThumbY)) / 100);
- onRefresh();
-}
-
-//--------------------------------------------------------------------------
-// MenuMessage class
-//
-// Defines a message menu object
-//--------------------------------------------------------------------------
-
-MenuMessage::MenuMessage(DialogView *owner, int objectId, int xs, int ys, int width, int height,
- bool transparent):
- MenuObject(owner, objectId, xs, ys, width, height, false, transparent) {
-}
-
-void MenuMessage::onRefresh() {
- SpriteAsset &sprites = *parent()->sprites();
- M4Surface *sprite = NULL;
-
- // Get the correct sprite to use
- switch (_objectId) {
- case SLTAG_SAVELOAD_LABEL:
- sprite = (parent()->getMenuType() == SAVE_MENU) ? sprites[SL_SAVE_LABEL] :
- sprites[SL_LOAD_LABEL];
- break;
- }
- assert(sprite);
-
- // Draw the sprite
- if (_transparent) {
- // Transparent button
- if (!_background)
- return;
-
- // Restore original background and then do a transparent copy of the sprite
- _background->copyTo(parent(), _bounds.left, _bounds.top);
- }
-
- sprite->copyTo(parent(), _bounds.left, _bounds.top, 0);
-}
-
-//--------------------------------------------------------------------------
-// MenuImage class
-//
-// Defines a menu item that displays a given surface
-//--------------------------------------------------------------------------
-
-MenuImage::MenuImage(DialogView *owner, int objectId, int xs, int ys, int width, int height,
- M4Surface *image, bool transparent):
- MenuObject(owner, objectId, xs, ys, width, height, false, transparent) {
-
- _sprite = image;
-}
-
-void MenuImage::onRefresh() {
- if (!_sprite)
- return;
-
- // Draw the sprite
- if (_transparent) {
- // Transparent button
- if (!_background)
- return;
-
- // Restore original background and then do a transparent copy of the sprite
- _background->copyTo(parent(), _bounds.left, _bounds.top);
- }
-
- _sprite->copyTo(parent(), _bounds.left + (_bounds.width() - _sprite->width()) / 2,
- _bounds.top + (_bounds.height() - _sprite->height()) / 2, 0);
-}
-
-//--------------------------------------------------------------------------
-// MenuSaveLoadText class
-//
-// Defines a save/load dialog text entry
-//--------------------------------------------------------------------------
-
-MenuSaveLoadText::MenuSaveLoadText(DialogView *owner, int textId, int xs, int ys,
- int width, int height, Callback callbackFn, bool greyed, bool transparent,
- bool loadFlag, const char *displayText, int displayValue):
- MenuButton(owner, textId, xs, ys, width, height, callbackFn, greyed, transparent, OBJTYPE_SL_TEXT) {
-
- _loadFlag = loadFlag;
- _displayText = displayText;
- _displayValue = displayValue;
- _index = textId - SLTAG_SLOTS_START;
- _visible = true;
-}
-
-void MenuSaveLoadText::onRefresh() {
- if (!_visible) return;
- _vm->_font->setFont(FONT_MENU);
- MenuButton::onRefresh();
-
- if ((_objectType == OBJTYPE_SL_TEXT) && (_displayText != NULL)) {
- int xp = _bounds.left + 4;
- if (_displayValue != 0) {
- char tempBuffer[5];
- sprintf(tempBuffer, "%02d", _displayValue);
- _vm->_font->current()->writeString(_parent, tempBuffer, xp, _bounds.top + 1, 0, -1);
- xp = _bounds.left + 26;
- }
-
- _vm->_font->current()->writeString(_parent, _displayText, xp, _bounds.top + 1, 0, -1);
- }
-}
-
-bool MenuSaveLoadText::onEvent(M4::M4EventType event, int32 param, int x, int y, M4::MenuObject *&currentItem) {
- if (!_visible) return false;
- bool handledFlag = MenuButton::onEvent(event, param, x, y, currentItem);
-
- // Further handling will only be done when in load mode and a slot hasn't been selected
- if (!_loadFlag || (parent()->_selectedSlot != -1))
- return handledFlag;
-
- // Only handling for certain event types
- if ((event != MEVENT_MOVE) && (event != MEVENT_LEFT_DRAG) &&
- (event != MEVENT_LEFT_RELEASE) && (event != MEVENT_DOUBLECLICK_DRAG) &&
- (event != MEVENT_DOUBLECLICK_RELEASE))
- return handledFlag;
-
- MenuImage *thumbnail = (MenuImage *) parent()->getItem(SLTAG_THUMBNAIL);
-
- // Check whether the cursor is over the button
- if ((_objectState == OS_MOUSEOVER) || (_objectState == OS_PRESSED)) {
- if (_index != parent()->_highlightedSlot) {
- // Selected slot has changed
- if (parent()->_savegameThumbnail != NULL)
- delete parent()->_savegameThumbnail;
-
- parent()->_highlightedSlot = _index;
- parent()->_savegameThumbnail = _vm->_saveLoad->getThumbnail(_index + 1);
- thumbnail->setSprite(parent()->_savegameThumbnail);
- }
-
- } else {
- // If the mouse has moved outside the area of all the save slots, then the
- // thumbnail needs to be removed
-
- Common::Rect slotArea(50, 256, 288, 377);
- if (isInside(x, y) || !slotArea.contains(x, y)) {
- if (parent()->_savegameThumbnail) {
- delete parent()->_savegameThumbnail;
- parent()->_savegameThumbnail = NULL;
- }
-
- thumbnail->setSprite(parent()->sprites()->getFrame(SL_EMPTY_THUMBNAIL));
- parent()->_highlightedSlot = -1;
- }
- }
-
- return handledFlag;
-}
-
-void MenuSaveLoadText::setVisible(bool value) {
- _visible = value;
- parent()->refresh(_bounds);
-}
-
-//--------------------------------------------------------------------------
-// MenuTextField class
-//
-// Defines a text entry field
-//--------------------------------------------------------------------------
-
-MenuTextField::MenuTextField(DialogView *owner, int fieldId, int xs, int ys, int width,
- int height, bool greyed, Callback callbackFn,
- const char *displayText, int displayValue, bool transparent):
- MenuObject(owner, fieldId, xs, ys, width, height, greyed, transparent) {
-
- _displayValue = displayValue;
- _callback = callbackFn;
- _pixelWidth = width - 27;
- if (displayText) {
- strcpy(_displayText, displayText);
- _promptEnd = &_displayText[strlen(_displayText)];
- } else {
- _displayText[0] = '\0';
- _promptEnd = &_displayText[0];
- }
- _cursor = _promptEnd;
-}
-
-void MenuTextField::onRefresh() {
- bool focused = _objectState != OS_GREYED;
-
- // Get the thumb sprite for the slider
- SpriteAsset &sprites = *parent()->sprites();
- M4Sprite *sprite = sprites[SL_LINE_NORMAL + OS_MOUSEOVER - 1];
-
- // If the slider is transparent, first copy in the background
- if (_transparent) {
- // Transparent button
- if (!_background)
- return;
-
- _background->copyTo(parent(), _bounds.left, _bounds.top, 0);
- }
-
- // Draw the sprite
- sprite->copyTo(parent(), _bounds.left, _bounds.top, 0);
-
- // Draw the text
-
- _vm->_font->setFont(FONT_MENU);
- _vm->_font->current()->setColors(TEXT_COLOR_NORMAL_SHADOW, TEXT_COLOR_NORMAL_FOREGROUND,
- TEXT_COLOR_NORMAL_HILIGHT);
- int xp = _bounds.left + 4;
-
- if (_displayValue != 0) {
- char tempBuffer[5];
- sprintf(tempBuffer, "%02d", _displayValue);
- _vm->_font->current()->writeString(_parent, tempBuffer, xp, _bounds.top + 1, 0, -1);
- xp = _bounds.left + 26;
- }
-
- _vm->_font->current()->writeString(_parent, _displayText, xp, _bounds.top + 1, 0, -1);
-
- if (focused) {
- // Draw in the cursor
-
- if (_cursor) {
- // Get the width of the string up to the cursor position
- char tempCh = *_cursor;
- *_cursor = '\0';
- int stringWidth = _vm->_font->current()->getWidth(_displayText);
- *_cursor = tempCh;
-
- parent()->setColor(TEXT_COLOR_MOUSEOVER_FOREGROUND);
- parent()->vLine(xp + stringWidth + 1, _bounds.top + 1, _bounds.top + 12);
- }
- }
-}
-
-bool MenuTextField::onEvent(M4EventType event, int32 param, int x, int y, MenuObject *&currentItem) {
- char tempStr[MAX_SAVEGAME_NAME];
- int tempLen;
- char *tempP;
- bool handledFlag = false, redrawFlag = false, callbackFlag = false;
-
- if (_objectState == OS_GREYED)
- return false;
-
- switch (event) {
- case MEVENT_LEFT_CLICK:
- case MEVENT_DOUBLECLICK:
- parent()->_deleteSaveDesc = false;
- if (isInside(x, y))
- currentItem = this;
- break;
-
- case MEVENT_LEFT_RELEASE:
- case MEVENT_DOUBLECLICK_RELEASE:
- if (!currentItem)
- return true;
- currentItem = NULL;
-
- if (isInside(x, y)) {
- if (_objectState == OS_MOUSEOVER) {
- tempLen = strlen(_displayText);
- if (tempLen > 0) {
- strcpy(tempStr, _displayText);
- tempP = &tempStr[tempLen];
- _vm->_font->setFont(FONT_MENU);
-
- tempLen = _vm->_font->current()->getWidth(tempStr);
- while ((tempP != &tempStr[0]) && (tempLen > x - _bounds.left - 26)) {
- *--tempP = '\0';
- tempLen = _vm->_font->current()->getWidth(tempStr);
- }
-
- _cursor = &_displayText[tempP - &tempStr[0]];
- redrawFlag = true;
- }
- } else if (event == MEVENT_DOUBLECLICK_RELEASE) {
- callbackFlag = true;
- }
- }
- break;
-
- case KEVENT_KEY:
- switch (param) {
- case Common::KEYCODE_RETURN:
- case Common::KEYCODE_KP_ENTER:
- parent()->_deleteSaveDesc = false;
- callbackFlag = true;
- break;
- break;
-
- case Common::KEYCODE_HOME:
- parent()->_deleteSaveDesc = false;
- _cursor = &_displayText[0];
- redrawFlag = true;
- break;
-
- case Common::KEYCODE_END:
- parent()->_deleteSaveDesc = false;
- _cursor = _promptEnd;
- redrawFlag = true;
- break;
-
- case Common::KEYCODE_LEFT:
- case Common::KEYCODE_KP4:
- parent()->_deleteSaveDesc = false;
- if (_cursor > &_displayText[0]) {
- --_cursor;
- redrawFlag = true;
- }
- break;
-
- case Common::KEYCODE_RIGHT:
- case Common::KEYCODE_KP6:
- parent()->_deleteSaveDesc = false;
- if (_cursor < _promptEnd) {
- ++_cursor;
- redrawFlag = true;
- }
- break;
-
- case Common::KEYCODE_DELETE:
- if (parent()->_deleteSaveDesc) {
- _displayText[0] = '\0';
- _promptEnd = &_displayText[0];
- _cursor = _promptEnd;
- redrawFlag = true;
- } else if (_cursor < _promptEnd) {
- strcpy(tempStr, _cursor + 1);
- strcpy(_cursor, tempStr);
- --_promptEnd;
- redrawFlag = true;
- }
- break;
-
- case Common::KEYCODE_BACKSPACE:
- parent()->_deleteSaveDesc = false;
- if (_cursor > &_displayText[0]) {
- strcpy(tempStr, _cursor);
- --_promptEnd;
- --_cursor;
- strcpy(_cursor, tempStr);
- redrawFlag = true;
- }
- break;
-
- default:
- parent()->_deleteSaveDesc = false;
- _vm->_font->setFont(FONT_MENU);
-
- tempLen = _vm->_font->current()->getWidth(_displayText);
- if ((strlen(_displayText) < MAX_SAVEGAME_NAME - 1) &&
- (tempLen < _pixelWidth - 12) && (param >= 32) && (param <= 127)) {
-
- // Valid displayable character
- if (_cursor < _promptEnd) {
- strcpy(tempStr, _cursor);
- sprintf(_cursor, "%c%s", (char)param, tempStr);
- } else {
- *_cursor = (char)param;
- *(_cursor + 1) = '\0';
- }
- ++_cursor;
- ++_promptEnd;
-
- redrawFlag = true;
- }
- break;
- }
- break;
-
- default:
- break;
- }
-
- if (redrawFlag)
- onRefresh();
-
- if (callbackFlag)
- onExecute();
-
- return handledFlag;
-}
-
-//--------------------------------------------------------------------------
-
-
-GUITextField::GUITextField(View *owner, const Common::Rect &bounds): GUIRect(owner, bounds, 0) {
-}
-
-void GUITextField::onRefresh() {
- _parent->fillRect(_bounds, _vm->_palette->BLACK);
- _vm->_font->current()->setColors(3, 3, 3);
- _vm->_font->setFont(FONT_INTERFACE);
- _vm->_font->current()->writeString(_parent, _text.c_str(), _bounds.left, _bounds.top, 0, 1);
-}
-
-//--------------------------------------------------------------------------
-
-GUIButton::GUIButton(View *owner, const Common::Rect &bounds, int tag,
- M4Surface *normalSprite, M4Surface *mouseOverSprite, M4Surface *pressedSprite):
- GUIRect(owner, bounds, tag) {
-
- _normalSprite = normalSprite;
- _mouseOverSprite = mouseOverSprite;
- _pressedSprite = pressedSprite;
- _visible = true;
- _tracking = false;
-}
-
-void GUIButton::onRefresh() {
- _parent->fillRect(_bounds, _vm->_palette->BLACK);
-
- if (_visible) {
- switch (_buttonState) {
- case BUTTON_MOUSEOVER:
- _mouseOverSprite->copyTo(_parent, _bounds.left, _bounds.top, 0);
- break;
- case BUTTON_PRESSED:
- _pressedSprite->copyTo(_parent, _bounds.left, _bounds.top, 0);
- break;
- default:
- _normalSprite->copyTo(_parent, _bounds.left, _bounds.top, 0);
- break;
- }
- }
-}
-
-bool GUIButton::onEvent(M4EventType eventType, int32 param, int x, int y, GUIObject *&currentItem) {
- bool result = false;
- bool isPressed = (eventType == MEVENT_LEFT_CLICK) || (eventType == MEVENT_LEFT_HOLD) ||
- (eventType == MEVENT_LEFT_DRAG);
- bool isOver = isInside(x, y);
- GUIButtonState oldState = _buttonState;
-
- if (isOver) {
- if (isPressed) {
- // Button is pressed
- if (!_tracking) {
- _tracking = true;
- _buttonState = BUTTON_PRESSED;
- }
-
- if (_vm->isM4())
- _m4Vm->globals()->invSuppressClickSound = false;
- } else {
- // Button isn't pressed
- if (_tracking)
- result = true;
- else {
- result = false;
- _buttonState = BUTTON_MOUSEOVER;
- _tracking = false;
- }
- }
- } else {
- _tracking = false;
- _buttonState = BUTTON_NORMAL;
- }
-
- if (oldState != _buttonState)
- onRefresh();
-
- return result;
-}
-
-} // End of namespace M4
diff --git a/engines/m4/gui.h b/engines/m4/gui.h
deleted file mode 100644
index 2b673d624c..0000000000
--- a/engines/m4/gui.h
+++ /dev/null
@@ -1,453 +0,0 @@
-/* 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 M4_GUI_H
-#define M4_GUI_H
-
-#include "common/list.h"
-#include "common/rect.h"
-
-#include "m4/viewmgr.h"
-#include "m4/events.h"
-#include "m4/globals.h"
-#include "m4/graphics.h"
-#include "m4/saveload.h"
-#include "m4/sprite.h"
-#include "m4/assets.h"
-
-namespace M4 {
-
-class GUIObject;
-class MenuObject;
-class GUIObjectButton;
-class SpriteAsset;
-class View;
-
-enum MenuType {GAME_MENU, OPTIONS_MENU, SAVE_MENU, LOAD_MENU, MAIN_MENU};
-
-enum {
- BTNID_QUIT = 1,
- BTNID_OPTIONS = 2,
- BTNID_RESUME = 3,
- BTNID_SAVE = 4,
- BTNID_LOAD = 5,
- BTNID_MAIN = 6,
-
- OPTIONID_DONE = 1,
- OPTIONID_CANCEL = 2,
- OPTIONID_HSLIDER_DIGI = 3,
- OPTIONID_HSLIDER_MIDI = 4,
-
- SAVELOADID_SAVE = 1,
- SAVELOADID_CANCELSAVE = 2,
- SAVELOADID_LOAD = 3,
- SAVELOADID_CANCELLOAD = 4,
-
- SLTAG_SAVELOAD = 100,
- SLTAG_SAVELOAD_LABEL = 101,
- SLTAG_CANCEL = 102,
- SLTAG_VSLIDER = 103,
- SLTAG_THUMBNAIL = 104,
-
- SLTAG_SLOTS_START = 1001,
- SLTAG_TEXTFIELD = 2000
-};
-
-enum ObjectType {
- OBJTYPE_BUTTON,
-
- OBJTYPE_SLIDER,
- OBJTYPE_OM_SWITCH_ON,
- OBJTYPE_OM_SWITCH_OFF,
- OBJTYPE_OM_DONE,
- OBJTYPE_OM_CANCEL,
-
- OBJTYPE_SL_SAVE,
- OBJTYPE_SL_LOAD,
- OBJTYPE_SL_CANCEL,
- OBJTYPE_SL_TEXT
-};
-
-enum GameMenuSpriteType {
- GM_DIALOG_BOX,
-
- GM_BUTTON_GREYED,
- GM_BUTTON_NORMAL,
- GM_BUTTON_MOUSEOVER,
- GM_BUTTON_PRESSED
-};
-
-enum OptionMenuSpriteType {
- OM_DIALOG_BOX,
-
- OM_SLIDER_BTN_NORMAL,
- OM_SLIDER_BTN_MOUSEOVER,
- OM_SLIDER_BTN_PRESSED,
- OM_SLIDER_BAR,
- OM_DONE_BTN_GREYED,
- OM_DONE_BTN_NORMAL,
- OM_DONE_BTN_MOUSEOVER,
- OM_DONE_BTN_PRESSED,
- OM_CANCEL_BTN_NORMAL,
- OM_CANCEL_BTN_MOUSEOVER,
- OM_CANCEL_BTN_PRESSED
-};
-
-
-enum SaveLoadSpriteType {
- SL_DIALOG_BOX,
- SL_EMPTY_THUMBNAIL,
-
- SL_SAVE_BTN_GREYED,
- SL_SAVE_BTN_NORMAL,
- SL_SAVE_BTN_MOUSEOVER,
- SL_SAVE_BTN_PRESSED,
-
- SL_LOAD_BTN_GREYED,
- SL_LOAD_BTN_NORMAL,
- SL_LOAD_BTN_MOUSEOVER,
- SL_LOAD_BTN_PRESSED,
-
- SL_CANCEL_BTN_NORMAL,
- SL_CANCEL_BTN_MOUSEOVER,
- SL_CANCEL_BTN_PRESSED,
-
- SL_UP_BTN_GREYED,
- SL_UP_BTN_NORMAL,
- SL_UP_BTN_MOUSEOVER,
- SL_UP_BTN_PRESSED,
-
- SL_DOWN_BTN_GREYED,
- SL_DOWN_BTN_NORMAL,
- SL_DOWN_BTN_MOUSEOVER,
- SL_DOWN_BTN_PRESSED,
-
- SL_SAVE_LABEL,
- SL_LOAD_LABEL,
-
- SL_SLIDER_BTN_NORMAL,
- SL_SLIDER_BTN_MOUSEOVER,
- SL_SLIDER_BTN_PRESSED,
-
- SL_LINE_NORMAL,
- SL_LINE_MOUSEOVER,
- SL_LINE_PRESSED,
-
- SL_SCROLLBAR
-};
-
-enum TextColors {
- TEXT_COLOR_NORMAL = 1,
- TEXT_COLOR_GREYED = 1,
- TEXT_COLOR_MOUSEOVER = 2,
- TEXT_COLOR_PRESSED = 2,
-
- TEXT_COLOR_GREYED_HILIGHT = 236,
- TEXT_COLOR_GREYED_FOREGROUND = 131,
- TEXT_COLOR_GREYED_SHADOW = 186,
-
- TEXT_COLOR_NORMAL_HILIGHT = 129,
- TEXT_COLOR_NORMAL_FOREGROUND = 130,
- TEXT_COLOR_NORMAL_SHADOW = 236,
-
- TEXT_COLOR_MOUSEOVER_HILIGHT = 129,
- TEXT_COLOR_MOUSEOVER_FOREGROUND = 130,
- TEXT_COLOR_MOUSEOVER_SHADOW = 236,
-
- TEXT_COLOR_PRESSED_HILIGHT = 236,
- TEXT_COLOR_PRESSED_FOREGROUND = 130,
- TEXT_COLOR_PRESSED_SHADOW = 129
-};
-
-#define MENU_SS_FIELD_NORMAL 5
-#define MENU_SS_FIELD_MOUSEOVER 6
-
-#define MENU_SS_H_SLIDER_NORMAL 5
-#define MENU_SS_H_SLIDER_MOUSE_OVER 6
-#define MENU_SS_H_SLIDER_PRESSED 7
-
-#define MENU_SS_SWITCH_ON_NORMAL 8
-#define MENU_SS_SWITCH_ON_MOUSEOVER 9
-#define MENU_SS_SWITCH_ON_PRESSED 13
-
-#define MENU_SS_SWITCH_OFF_PRESSED 10
-#define MENU_SS_SWITCH_OFF_NORMAL 11
-#define MENU_SS_SWITCH_OFF_MOUSEOVER 12
-
-#define MENU_GUI "gui menu"
-#define MENU_GAME "gamemenu"
-#define MENU_OPTIONS "opmenu"
-#define MENU_ERROR "errmenu"
-#define MENU_SAVELOAD "slmenu"
-#define MENU_BURGMAIN "903menu"
-#define MENU_BURGDEMOMAIN "901menu"
-
-#define SL_NUM_VISIBLE_SLOTS 8
-#define SL_THUMBNAIL_WIDTH 215
-#define SL_THUMBNAIL_HEIGHT 162
-
-enum MenuObjectState {OS_GREYED = 0, OS_NORMAL = 1, OS_MOUSEOVER = 2, OS_PRESSED = 3};
-
-class DialogView : public View {
-public:
- DialogView(MadsM4Engine *Vm, const Common::Rect &viewBounds, bool transparent = false):
- View(Vm, viewBounds, transparent) {}
- DialogView(MadsM4Engine *Vm, int x = 0, int y = 0, bool transparent = false):
- View(Vm, x, y, transparent) {}
-
- MadsM4Engine *vm() { return _vm; }
- virtual SpriteAsset *sprites() = 0;
- virtual MenuType getMenuType() = 0;
- virtual MenuObject *getItem(int objectId) { return NULL; }
- virtual void refresh(const Common::Rect &areaRect) {}
- virtual void close();
-
- int _topSaveSlotIndex, _selectedSlot;
- int _highlightedSlot;
- bool _deleteSaveDesc;
- M4Surface *_savegameThumbnail;
-};
-
-class GUIObject {
-protected:
- View *_parent;
- Common::Rect _bounds;
- M4Surface *_background;
-public:
- GUIObject(View *owner, const Common::Rect &bounds);
- virtual ~GUIObject() {}
-
- bool isInside(int x, int y) { return _bounds.contains(x, y); }
- Common::Rect getBounds() const { return _bounds; }
-
- virtual void onRefresh() {}
-};
-
-class MenuObject : public GUIObject {
-public:
- typedef void (*Callback)(DialogView *view, MenuObject *item);
-protected:
- MenuObject::Callback _callback;
- ObjectType _objectType;
- MenuObjectState _objectState;
- bool _transparent;
- int _objectId;
-public:
- MenuObject(DialogView *owner, int objectId, int xs, int ys, int width, int height,
- bool greyed = false, bool transparent = false);
- ~MenuObject();
-
- DialogView *parent() { return (DialogView *)_parent; }
- MenuObjectState getState() { return _objectState; }
- virtual void setState(MenuObjectState state) {
- _objectState = state;
- onRefresh();
- }
- int getObjectId() { return _objectId; }
-
- void onExecute();
- virtual bool onEvent(M4EventType event, int32 param, int x, int y, MenuObject *&currentItem) { return false; }
-};
-
-class MenuButton : public MenuObject {
-public:
- MenuButton(DialogView *owner, int buttonId, int xs, int ys, int width, int height,
- Callback callbackFn = NULL, bool greyed = false, bool transparent = false,
- ObjectType buttonType = OBJTYPE_BUTTON);
-
- void onRefresh();
- bool onEvent(M4EventType event, int32 param, int x, int y, MenuObject *&currentItem);
- bool getToggled() { return _objectType == OBJTYPE_OM_SWITCH_ON; }
-};
-
-enum MenuHorizSliderState {HSLIDER_THUMB_NORMAL = 0, HSLIDER_THUMB_MOUSEOVER = 1, HSLIDER_THUMB_PRESSED = 2};
-#define SLIDER_BAR_COLOR 129
-
-class MenuHorizSlider : public MenuObject {
-protected:
- MenuHorizSliderState _sliderState;
- Common::Point _thumbSize;
- int _maxThumbX;
- int _percent;
- int _thumbX;
-public:
- MenuHorizSlider(DialogView *owner, int sliderId, int xs, int ys, int width, int height,
- int initialPercentage, Callback callbackFn = NULL, bool transparent = false);
-
- void onRefresh();
- bool onEvent(M4EventType event, int32 param, int x, int y, MenuObject *&currentItem);
- int percent() { return _percent; }
-};
-
-enum MenuVertSliderState {
- VSLIDER_NONE = 0x0000,
- VSLIDER_UP = 0x0010,
- VSLIDER_PAGE_UP = 0x0020,
- VSLIDER_THUMBNAIL = 0x0030,
- VSLIDER_PAGE_DOWN = 0x0040,
- VSLIDER_DOWN = 0x0050
-};
-
-class MenuVertSlider : public MenuObject {
-protected:
- MenuVertSliderState _sliderState;
- Common::Point _thumbSize;
- int _percent;
- int _thumbY;
- int _minThumbY;
- int _maxThumbY;
-
- MenuVertSliderState getSliderArea(int y);
- void updateThumbnails() {}
-public:
- MenuVertSlider(DialogView *owner, int sliderId, int xs, int ys, int width, int height,
- int initialPercentage, Callback callbackFn = NULL, bool transparent = false);
-
- void onRefresh();
- bool onEvent(M4EventType event, int32 param, int x, int y, MenuObject *&currentItem);
- MenuVertSliderState sliderState() { return _sliderState; }
- int percent() { return _percent; }
- void setPercentage(int value);
-};
-
-class MenuMessage : public MenuObject {
-public:
- MenuMessage(DialogView *owner, int objectId, int x, int y, int w, int h, bool transparent = false);
-
- void onRefresh();
-};
-
-class MenuImage : public MenuObject {
-private:
- M4Surface *_sprite;
-public:
- MenuImage(DialogView *owner, int objectId, int xs, int ys, int width, int height,
- M4Surface *image, bool transparent = false);
-
- void onRefresh();
- const M4Surface *sprite() { return _sprite; }
- void setSprite(M4Surface *v) {
- _sprite = v;
- onRefresh();
- }
-};
-
-class MenuSaveLoadText : public MenuButton {
-private:
- bool _loadFlag;
- const char *_displayText;
- int _displayValue;
- int _index;
- bool _visible;
-public:
- MenuSaveLoadText(DialogView *owner, int textId, int xs, int ys, int width, int height,
- Callback callbackFn = NULL, bool greyed = false, bool transparent = false,
- bool loadFlag = false, const char *displayText = NULL, int displayValue = 0);
-
- void onRefresh();
- bool onEvent(M4EventType event, int32 param, int x, int y, MenuObject *&currentItem);
- void setDisplay(int value, const char *text) { _displayValue = value; _displayText = text; }
- int getIndex() { return _index; }
- const char *getText() { return _displayText; }
- bool getVisible() const { return _visible; }
- void setVisible(bool value);
-};
-
-class MenuTextField : public MenuObject {
-private:
- int _displayValue;
- char _displayText[MAX_SAVEGAME_NAME];
- int _pixelWidth;
- char *_promptEnd;
- char *_cursor;
-public:
- MenuTextField(DialogView *owner, int fieldId, int xs, int ys, int width, int height,
- bool greyed, Callback callbackFn = NULL, const char *displayText = NULL,
- int displayValue = 0, bool transparent = true);
-
- void onRefresh();
- bool onEvent(M4EventType event, int32 param, int x, int y, MenuObject *&currentItem);
-
- const char *getText() { return _displayText; }
- int getDisplayValue() { return _displayValue; }
-
-};
-
-class GUIRect : public GUIObject {
-private:
- int _tag;
-public:
- GUIRect(View *owner, const Common::Rect &bounds, int tag): GUIObject(owner, bounds) { _tag = tag; }
-
- virtual bool onEvent(M4EventType eventType, int32 param, int x, int y, GUIObject *&currentItem) { return false; }
- int getTag() const { return _tag; }
-};
-
-enum GUIButtonState {BUTTON_NORMAL, BUTTON_MOUSEOVER, BUTTON_PRESSED};
-
-class GUIButton : public GUIRect {
-protected:
- M4Surface *_normalSprite, *_mouseOverSprite, *_pressedSprite;
- GUIButtonState _buttonState;
- bool _visible;
- bool _tracking;
-public:
- GUIButton(View *owner, const Common::Rect &bounds, int tag,
- M4Surface *normalSprite, M4Surface *mouseOverSprite, M4Surface *pressedSprite);
-
- void onRefresh();
- bool onEvent(M4EventType eventType, int32 param, int x, int y, GUIObject *&currentItem);
- GUIButtonState getState() const { return _buttonState; }
-};
-
-class GUITextField : public GUIRect {
-private:
- Common::String _text;
-public:
- GUITextField(View *owner, const Common::Rect &bounds);
- void setText(const char *value) {
- _text = value;
- onRefresh();
- }
-
- void onRefresh();
-};
-
-
-class Dialogs {
-public:
- void keyMouseCollision() {}
-};
-
-class GameInterfaceView : public View {
-public:
- GameInterfaceView(MadsM4Engine *vm, const Common::Rect &rect): View(vm, rect) {}
- ~GameInterfaceView() {}
-
- virtual void initialize() {}
- virtual void setSelectedObject(int objectNumber) {}
- virtual void addObjectToInventory(int objectNumber) {}
-};
-
-}
-
-#endif
diff --git a/engines/m4/hotspot.cpp b/engines/m4/hotspot.cpp
deleted file mode 100644
index a585a9af3d..0000000000
--- a/engines/m4/hotspot.cpp
+++ /dev/null
@@ -1,283 +0,0 @@
-/* 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 "m4/m4.h"
-#include "m4/events.h"
-#include "m4/hotspot.h"
-#include "gui/debugger.h"
-
-namespace M4 {
-
-/*
- HotSpot
-*/
-
-HotSpot::HotSpot(int x1, int y1, int x2, int y2) :
- _vocab(NULL), _verb(NULL), _prep(NULL), _sprite(NULL) {
-
- _rect.left = x1;
- _rect.top = y1;
- _rect.right = x2 + 1;
- _rect.bottom = y2 + 1;
- _active = true;
-
- _syntax = 0;
- _cursor = 0;
- _facing = 5;
- _feetX = 32767;
- _feetY = 32767;
-}
-
-HotSpot::~HotSpot() {
- free(_vocab);
-}
-
-void HotSpot::setRect(int x1, int y1, int x2, int y2) {
- _rect.left = x1;
- _rect.top = y1;
- _rect.right = x2 + 1;
- _rect.bottom = y2 + 1;
-}
-
-void HotSpot::setFeet(int x, int y) {
- _feetX = x;
- _feetY = y;
-}
-
-void HotSpot::setVocab(const char *value) {
- free(_vocab);
- _vocab = strdup(value);
-}
-
-void HotSpot::setVerb(const char *value) {
- free(_verb);
- _verb = strdup(value);
-}
-
-void HotSpot::setPrep(const char *value) {
- free(_prep);
- _prep = strdup(value);
-}
-
-void HotSpot::setSprite(const char *value) {
- free(_sprite);
- _sprite = strdup(value);
-}
-
-Common::Rect HotSpot::getRect() const {
- Common::Rect tempRect;
- tempRect.left = _rect.left;
- tempRect.top = _rect.top;
- tempRect.right = _rect.right - 1;
- tempRect.bottom = _rect.bottom - 1;
-
- return tempRect;
-}
-
-/*
- HotSpotList
-*/
-
-HotSpotList::HotSpotList() {
-}
-
-HotSpotList::~HotSpotList() {
- clear();
-}
-
-int HotSpotList::add(HotSpot *hotspot, bool head) {
- if (head || _hotspots.size() == 0) {
- _hotspots.insert_at(0, hotspot);
- return 0;
- } else {
- int32 area = hotspot->area();
- int index = _hotspots.size();
- for (uint i = 0; i < _hotspots.size(); i++) {
- if (area < _hotspots[i]->area()) {
- index = i;
- break;
- }
- }
- _hotspots.insert_at(index, hotspot);
- return index;
- }
-}
-
-void HotSpotList::remove(HotSpot *hotspot) {
- unlinkItem(hotspot);
- delete hotspot; //TODO: check this?
-}
-
-void HotSpotList::unlinkItem(HotSpot *hotspot) {
- uint index = 0;
- while (index < _hotspots.size()) {
- if (_hotspots[index] == hotspot) {
- _hotspots.remove_at(index);
- } else {
- index++;
- }
- }
-}
-
-void HotSpotList::clear() {
- for (uint i = 0; i < _hotspots.size(); i++)
- delete _hotspots[i];
- _hotspots.clear();
-}
-
-HotSpot *HotSpotList::findByXY(int x, int y) {
- for (uint i = 0; i < _hotspots.size(); i++) {
- if (_hotspots[i]->getActive() && _hotspots[i]->pointInside(x, y)) {
- return _hotspots[i];
- }
- }
- return NULL;
-}
-
-void HotSpotList::setActive(const char *name, bool active) {
- for (uint i = 0; i < _hotspots.size(); i++) {
- if (!scumm_stricmp(_hotspots[i]->_vocab, name)) {
- _hotspots[i]->setActive(active);
- }
- }
-}
-
-void HotSpotList::setActiveXY(const char *name, int x, int y, bool active) {
- for (uint i = 0; i < _hotspots.size(); i++) {
- if (_hotspots[i]->pointInside(x, y) && !scumm_stricmp(_hotspots[i]->_vocab, name)) {
- _hotspots[i]->setActive(active);
- }
- }
-}
-
-void HotSpotList::dump() {
- _vm->_events->getConsole()->DebugPrintf("%d hotspots in the list\n", _hotspots.size());
-
- for (uint index = 0; index < _hotspots.size(); index++) {
- _vm->_events->getConsole()->DebugPrintf("(%d): %p x1 = %d; y1 = %d; x2 = %d; y2 = %d\n",
- index, (void *)_hotspots[index],
- _hotspots[index]->_rect.left, _hotspots[index]->_rect.top,
- _hotspots[index]->_rect.right - 1, _hotspots[index]->_rect.bottom - 1);
- }
-}
-
-uint32 HotSpotList::readHotSpotInteger(Common::SeekableReadStream* hotspotStream) {
- if (_vm->isM4())
- return hotspotStream->readSint32LE();
- else
- return hotspotStream->readSint16LE();
-}
-
-void HotSpotList::loadHotSpots(Common::SeekableReadStream* hotspotStream, int hotspotCount) {
- HotSpot *currentHotSpot;
- uint32 x1, y1, x2, y2;
- char buffer[256];
- uint32 strLength = 0;
- uint32 index = 0;
- int feetX, feetY;
- int cursorOffset = (_vm ->isM4()) ? 0 : 1;
-
- for (int i = 0; i < hotspotCount; i++) {
- x1 = readHotSpotInteger(hotspotStream);
- y1 = readHotSpotInteger(hotspotStream);
- x2 = readHotSpotInteger(hotspotStream);
- y2 = readHotSpotInteger(hotspotStream);
- index = add(new HotSpot(x1, y1, x2, y2), i == 0);
- currentHotSpot = get(index);
- currentHotSpot->setIndex(index);
- feetX = readHotSpotInteger(hotspotStream);
- feetY = readHotSpotInteger(hotspotStream);
- currentHotSpot->setFeet(feetX, feetY);
- currentHotSpot->setFacing((uint8)hotspotStream->readByte());
- currentHotSpot->setActive(hotspotStream->readByte() != 0);
-
- if (!_vm->isM4())
- hotspotStream->readByte(); // unused (always 255)
-
- index = hotspotStream->readByte(); // cursor
- if (index == 0)
- currentHotSpot->setCursor(0);
- else
- currentHotSpot->setCursor(index - cursorOffset);
-
- // Rex Nebular doesn't have this field
- if (!_vm->isM4() && _vm->getGameType() != GType_RexNebular) {
- // This looks to be some sort of bitmask. Perhaps it signifies
- // the valid verbs for this hotspot
- index = hotspotStream->readUint16LE(); // unknown
- //debugC(kDebugCore, "%i ", index);
- }
-
- if (_vm->isM4())
- hotspotStream->readByte(); // syntax (unused)
-
- currentHotSpot->setVocabID(readHotSpotInteger(hotspotStream));
- currentHotSpot->setVerbID(readHotSpotInteger(hotspotStream));
-
- // Load hotspot related strings (verb, vocab/noun etc)
- // These are loaded inside the hotspot data in M4 games,
- // and inside the global vocab data (vocab.dat) in MADS games
- if (_vm->isM4()) {
- strLength = hotspotStream->readUint32LE(); // vocabLength
- hotspotStream->read(buffer, strLength); // vocab (the hotspot's name)
- // Capitalize the hotspot's name here
- str_upper(buffer);
- currentHotSpot->setVocab(buffer);
- // Verbs are used internally by the game scripts in Orion Burger
- strLength = hotspotStream->readUint32LE(); // verbLength
- hotspotStream->read(buffer, strLength); // verb
- // Capitalize the hotspot's verb here
- str_upper(buffer);
- currentHotSpot->setVerb(buffer);
-
- /* Hotspot names for non-English versions are stored in prep.
- Prep can be set two ways: For English versions, copy the
- text from vocab. For non-English versions, use the prep text
- from the room file.
- */
- strLength = hotspotStream->readUint32LE(); // prepLength
- hotspotStream->read(buffer, strLength); // prep
- str_upper(buffer);
-
- if (strlen(buffer) > 0 && strcmp(buffer, "--") != 0 && strcmp(buffer, "ON") != 0)
- currentHotSpot->setPrep(buffer);
- else
- currentHotSpot->setPrep(currentHotSpot->getVocab());
-
- // The following values are not used at all by Orion Burger
- strLength = hotspotStream->readUint32LE(); // spriteLength
- hotspotStream->read(buffer, strLength); // sprite
- hotspotStream->readUint16LE(); // sprite hash
- } else {
- currentHotSpot->setVocab("");
- currentHotSpot->setVerb("");
-
- if (currentHotSpot->getVocabID() > 0)
- currentHotSpot->setVocab(_madsVm->globals()->getVocab(currentHotSpot->getVocabID()));
-
- if (currentHotSpot->getVerbID() > 0)
- currentHotSpot->setVerb(_madsVm->globals()->getVocab(currentHotSpot->getVerbID()));
- }
- }
-}
-
-} // End of namespace M4
diff --git a/engines/m4/hotspot.h b/engines/m4/hotspot.h
deleted file mode 100644
index 86fe21bcab..0000000000
--- a/engines/m4/hotspot.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/* 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 M4_HOTSPOT_H
-#define M4_HOTSPOT_H
-
-#include "common/array.h"
-#include "common/rect.h"
-#include "common/util.h"
-
-/*
- TODO:
- - check if hotspot_duplicate is needed
- NOTES:
- - hotspot_add_dynamic unused in Orion Burger
-*/
-
-//???: should String be used instead of char* here?
-
-namespace M4 {
-
-class HotSpot {
- friend class HotSpotList;//just for debugging, to be removed later
-public:
-
- HotSpot(int x1 = 0, int y1 = 0, int x2 = 0, int y2 = 0);
- ~HotSpot();
-
- void setVocab(const char *value);
- void setVocabID(int32 value) { _vocabID = value; }
- void setVerb(const char *value);
- void setVerbID(int32 value) { _verbID = value; }
- void setPrep(const char *value);
- void setSprite(const char *value);
- void setActive(bool value) { _active = value; }
- void setCursor(uint8 value) { _cursor = value; }
- void setRect(int x1, int y1, int x2, int y2);
- void setFeet(int x, int y);
- void setFacing(uint8 facing) { _facing = facing; }
- void setArticle(int8 v) { _articleNumber = v; }
- char *getVocab() const { return _vocab; }
- int32 getVocabID() { return _vocabID; }
- char *getVerb() const { return _verb; }
- int32 getVerbID() { return _verbID; }
- char *getPrep() const { return _prep; }
- char *getSprite() const { return _sprite; }
- uint8 getCursor() const { return _cursor; }
- bool getActive() const { return _active; }
- uint8 getFacing() const { return _facing; }
- int getFeetX() { return _feetX; }
- int getFeetY() { return _feetY; }
- int8 getArticle() const { return _articleNumber; }
- Common::Rect getRect() const;
- int getIndex() const { return _index; }
- void setIndex(int index) { _index = index; }
-
- int32 area() const { return (_rect.width() - 1) * (_rect.height() - 1); }
- bool pointInside(int x, int y) { return _rect.contains(x, y); }
-
-private:
- char *_vocab, *_verb, *_prep, *_sprite;
- Common::Rect _rect;
- bool _active;
- int _feetX, _feetY;
- uint8 _facing, _cursor;
- int _index;
-
- // Unused in Orion Burger, used in MADS games
- uint8 _syntax;
- int32 _vocabID, _verbID;
- int8 _articleNumber;
-
- //TODO: check if this is actually needed by the game
- int16 _hash;
-};
-
-class HotSpotList {
-public:
- HotSpotList();
- ~HotSpotList();
-
- int add(HotSpot *hotspot, bool head = false);
- HotSpot *get(int index) { return _hotspots[index]; }
- HotSpot &operator[](int idx) { return *get(idx); }
- int size() const { return _hotspots.size(); }
- void remove(HotSpot *hotspot);
- void unlinkItem(HotSpot *hotspot);
- void clear();
- HotSpot *findByXY(int x, int y);
- void setActive(const char *name, bool active);
- void setActiveXY(const char *name, int x, int y, bool active);
-
- void dump();
-
- void loadHotSpots(Common::SeekableReadStream* hotspotStream, int hotspotCount);
-
- uint32 readHotSpotInteger(Common::SeekableReadStream* hotspotStream);
-private:
- typedef Common::Array<HotSpot*> HotSpotArray;
- HotSpotArray _hotspots;
-};
-
-
-} // End of namespace M4
-
-
-#endif
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
deleted file mode 100644
index efc7943114..0000000000
--- a/engines/m4/m4.cpp
+++ /dev/null
@@ -1,606 +0,0 @@
-/* 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.
- *
- */
-
-//#define SCRIPT_TEST
-//#define INTRO_TEST
-
-#include "m4/globals.h"
-#include "m4/burger_data.h"
-#include "m4/m4.h"
-#include "m4/resource.h"
-#include "m4/hotspot.h"
-#include "m4/font.h"
-#include "m4/rails.h"
-#include "m4/midi.h"
-#include "m4/events.h"
-#include "m4/graphics.h"
-#include "m4/viewmgr.h"
-#include "m4/gui.h"
-#include "m4/woodscript.h"
-#include "m4/actor.h"
-#include "m4/sound.h"
-#include "m4/script.h"
-#include "m4/compression.h"
-#include "m4/animation.h"
-#include "m4/m4_menus.h"
-#include "m4/m4_views.h"
-#include "m4/mads_anim.h"
-#include "m4/mads_menus.h"
-
-#include "common/error.h"
-#include "common/file.h"
-#include "common/fs.h"
-#include "common/system.h"
-#include "common/config-manager.h"
-#include "common/debug-channels.h"
-#include "common/textconsole.h"
-#include "engines/util.h"
-
-namespace M4 {
-
-// FIXME: remove global
-MadsM4Engine *_vm;
-MadsEngine *_madsVm;
-M4Engine *_m4Vm;
-
-void escapeHotkeyHandler(MadsM4Engine *vm, View *view, uint32 key) {
- // For now, simply exit the game
- vm->_events->quitFlag = true;
-}
-
-// Temporary hotkey handler for use in testing the TextviewView class
-
-void textviewHotkeyHandler(MadsM4Engine *vm, View *view, uint32 key) {
- // Deactivate the scene if it's currently active
- View *sceneView = vm->_viewManager->getView(VIEWID_SCENE);
- if (sceneView != NULL)
- vm->_viewManager->deleteView(sceneView);
-
- // Activate the textview view
- vm->_font->setFont(FONT_CONVERSATION_MADS);
- TextviewView *textView = new TextviewView(vm);
- vm->_viewManager->addView(textView);
- textView->setScript("quotes", NULL);
-}
-
-void saveGameHotkeyHandler(MadsM4Engine *vm, View *view, uint32 key) {
- // TODO: See CreateF2SaveMenu - save menu should only be activated when
- // certain conditions are met, such as player_commands_allowed, and isInterfaceVisible
- vm->loadMenu(SAVE_MENU, true);
-}
-
-void loadGameHotkeyHandler(MadsM4Engine *vm, View *view, uint32 key) {
- // TODO: See CreateF3LoadMenu - save menu should only be activated when
- // certain conditions are met, such as player_commands_allowed, and isInterfaceVisible
- vm->loadMenu(LOAD_MENU, true);
-}
-
-void gameMenuHotkeyHandler(MadsM4Engine *vm, View *view, uint32 key) {
- vm->loadMenu(GAME_MENU);
-}
-
-MadsM4Engine::MadsM4Engine(OSystem *syst, const M4GameDescription *gameDesc) :
- Engine(syst), _gameDescription(gameDesc) {
- // Setup mixer
- syncSoundSettings();
-
- // FIXME
- _vm = this;
- _madsVm = NULL;
-
- const Common::FSNode gameDataDir(ConfMan.get("path"));
-
- SearchMan.addSubDirectoryMatching(gameDataDir, "goodstuf");
- SearchMan.addSubDirectoryMatching(gameDataDir, "resource");
- SearchMan.addSubDirectoryMatching(gameDataDir, "option1");
-
- DebugMan.addDebugChannel(kDebugScript, "script", "Script debug level");
- DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics debug level");
- DebugMan.addDebugChannel(kDebugConversations, "conversations", "Conversations debugging");
- DebugMan.addDebugChannel(kDebugSound, "sound", "Sounds debug level");
- DebugMan.addDebugChannel(kDebugCore, "core", "Core debug level");
-
- _resourceManager = NULL;
- _globals = NULL;
-}
-
-
-MadsM4Engine::~MadsM4Engine() {
- delete _midi;
- delete _saveLoad;
- delete _kernel;
- delete _player;
- delete _mouse;
- delete _events;
- delete _font;
- delete _actor;
-// delete _scene; // deleted by the viewmanager
- delete _dialogs;
- delete _screen;
- delete _inventory;
- delete _viewManager;
- delete _rails;
- delete _script;
- delete _ws;
- delete _random;
- delete _palette;
- delete _globals;
- delete _sound;
- delete _resourceManager;
-}
-
-Common::Error MadsM4Engine::run() {
- // Initialize backend
- _screen = new M4Surface(true); // Special form for creating screen reference
-
- _midi = new MidiPlayer(this);
- _midi->setGM(true); // FIXME: Really? Always?
-
- _saveLoad = new SaveLoad(this);
- _palette = new Palette(this);
- _mouse = new Mouse(this);
- _events = new Events(this);
- _kernel = new Kernel(this);
- _player = new Player(this);
- _font = new FontManager(this);
- if (getGameType() == GType_Burger) {
- _actor = new Actor(this);
- _conversationView = new ConversationView(this);
- } else {
- _actor = NULL;
- }
- _rails = new Rails(); // needs to be initialized before _scene
- _dialogs = new Dialogs();
- _viewManager = new ViewManager(this);
- _inventory = new Inventory(this);
- _sound = new Sound(this, _mixer, 255);
- _script = new ScriptInterpreter(this);
- _ws = new WoodScript(this);
- //_callbacks = new Callbacks(this);
- _random = new Common::RandomSource("m4");
-
- return Common::kNoError;
-}
-
-void MadsM4Engine::eventHandler() {
- M4EventType event;
- uint32 keycode = 0;
-
- if ((event = _events->handleEvents()) != MEVENT_NO_EVENT) {
- if (_viewManager->containsViews())
- _viewManager->handleMouseEvents(event);
- }
-
- if (_events->kbdCheck(keycode))
- _viewManager->handleKeyboardEvents(keycode);
-}
-
-bool MadsM4Engine::delay(int duration, bool keyAborts, bool clickAborts) {
- uint32 endTime = g_system->getMillis() + duration;
- M4EventType event;
- uint32 keycode = 0;
-
- while (!_events->quitFlag && (g_system->getMillis() < endTime)) {
- event = _events->handleEvents();
- if (clickAborts && ((event == MEVENT_LEFT_RELEASE) || (event == MEVENT_RIGHT_RELEASE)))
- return true;
-
- if (_events->kbdCheck(keycode)) {
- if (keyAborts)
- return true;
- }
-
- g_system->delayMillis(10);
- }
-
- return false;
-}
-
-void MadsM4Engine::loadMenu(MenuType menuType, bool loadSaveFromHotkey, bool calledFromMainMenu) {
- if (isM4() && (menuType != MAIN_MENU)) {
- bool menuActive = _viewManager->getView(VIEWID_MENU) != NULL;
-
- if (!menuActive)
- _palette->fadeToGreen(M4_DIALOG_FADE_STEPS, M4_DIALOG_FADE_DELAY);
- }
-
- View *view;
-
- switch (menuType) {
- case MAIN_MENU:
- if (getGameType() == GType_RexNebular)
- view = new RexMainMenuView(this);
- else if (getGameType() == GType_DragonSphere)
- view = new DragonMainMenuView(this);
- else
- view = new MadsMainMenuView(this);
- break;
- case GAME_MENU:
- view = new OrionMenuView(this, 200, 100, GAME_MENU, calledFromMainMenu, loadSaveFromHotkey);
- break;
- case OPTIONS_MENU:
- view = new OrionMenuView(this, 172, 160, OPTIONS_MENU, calledFromMainMenu, loadSaveFromHotkey);
- break;
- case LOAD_MENU:
- case SAVE_MENU:
- view = new OrionMenuView(this, 145, 10, menuType, calledFromMainMenu, loadSaveFromHotkey);
- break;
- default:
- error("Unknown menu type");
- break;
- }
-
- _viewManager->addView(view);
- _viewManager->moveToFront(view);
-}
-
-#define DUMP_BUFFER_SIZE 1024
-
-void MadsM4Engine::dumpFile(const char *filename, bool uncompress) {
- Common::DumpFile f;
- byte buffer[DUMP_BUFFER_SIZE];
- Common::SeekableReadStream *fileS = res()->get(filename);
-
- if (!f.open(filename))
- error("Could not open '%s' for writing", filename);
-
- int bytesRead = 0;
- warning("Dumping %s, size: %i\n", filename, fileS->size());
-
- if (!uncompress) {
- while (!fileS->eos()) {
- bytesRead = fileS->read(buffer, DUMP_BUFFER_SIZE);
- f.write(buffer, bytesRead);
- }
- } else {
- MadsPack packData(fileS);
- Common::SeekableReadStream *sourceUnc;
- for (int i = 0; i < packData.getCount(); i++) {
- sourceUnc = packData.getItemStream(i);
- debugCN(kDebugCore, "Dumping compressed chunk %i of %i, size is %i\n", i + 1, packData.getCount(), sourceUnc->size());
- while (!sourceUnc->eos()) {
- bytesRead = sourceUnc->read(buffer, DUMP_BUFFER_SIZE);
- f.write(buffer, bytesRead);
- }
- delete sourceUnc;
- }
- }
-
- f.close();
- res()->toss(filename);
- res()->purge();
-}
-
-/*--------------------------------------------------------------------------*/
-
-M4Engine::M4Engine(OSystem *syst, const M4GameDescription *gameDesc): MadsM4Engine(syst, gameDesc) {
- // FIXME
- _m4Vm = this;
-
- _globals = new M4Globals(this);
-}
-
-M4Engine::~M4Engine() {
- delete _converse;
-}
-
-Common::Error M4Engine::run() {
- // Set up the graphics mode
- initGraphics(640, 480, true);
-
- // Necessary pre-initialisation
- _resourceManager = new M4ResourceManager(this);
-
- // Set up needed common functionality
- MadsM4Engine::run();
-
- // M4 specific initialisation
- _converse = new Converse(this);
-
- _scene = new M4Scene(this);
- _script->open("m4.dat");
-
-#ifdef SCRIPT_TEST
-
-#if 0
- ScriptFunction *func = _script->loadFunction("room_parser_142");
- _script->runFunction(func);
-#endif
-
-#if 1
- ScriptFunction *func = _script->loadFunction("room_daemon_951");
- for (int i = 1; i < 58; i++) {
- _vm->_kernel->trigger = i;
- _script->runFunction(func);
- debugCN(kDebugCore, "=================================\n");
- }
-#endif
-
- return Common::kNoError;
-#endif
-
- // Set up the inventory
-
- // Set up the game interface view
- //_interfaceView->inventoryAdd("Money", "", 55); // Sample item
-
- if (getGameType() == GType_Burger) {
- for (int i = 0; i < ARRAYSIZE(burger_inventory); i++) {
- char* itemName = strdup(burger_inventory[i].name);
- _inventory->registerObject(itemName, burger_inventory[i].scene,
- burger_inventory[i].icon);
- _inventory->addToBackpack(i); // debug: this adds ALL objects to the player's backpack
- }
- }
-
- // Show intro
-
- if (getGameType() == GType_Burger) {
- _kernel->newRoom = TITLE_SCENE_BURGER;
- } else {
- _scene->getBackgroundSurface()->loadBackgroundRiddle("main menu");
- _ws->setBackgroundSurface(_scene->getBackgroundSurface());
- }
-
- _viewManager->addView(_scene);
-
- // Setup game wide hotkeys. Note that Orion Burger used F2/F3 for Save/Restore,
- // but for standardisation with most other games, F5/F7 are also mapped
-
- _viewManager->systemHotkeys().add(Common::KEYCODE_ESCAPE, &escapeHotkeyHandler);
- _viewManager->systemHotkeys().add(Common::KEYCODE_F2, &saveGameHotkeyHandler);
- _viewManager->systemHotkeys().add(Common::KEYCODE_F3, &loadGameHotkeyHandler);
- _viewManager->systemHotkeys().add(Common::KEYCODE_F5, &saveGameHotkeyHandler);
- _viewManager->systemHotkeys().add(Common::KEYCODE_F7, &loadGameHotkeyHandler);
- _viewManager->systemHotkeys().add(Common::KEYCODE_F9, &gameMenuHotkeyHandler);
-
- // Start playing Orion Burger intro music
- //_midi->playMusic("999intro", 255, false, -1, -1);
-
- // TODO: start playing intro animations
-
- // TODO: Master Lu
-
- // Test for mouse
- _mouse->init("cursor", NULL);
- _mouse->setCursorNum(0);
- _mouse->cursorOn();
-
- _ws->assets()->loadAsset("SHOW SCRIPT", NULL);
- _ws->assets()->loadAsset("STREAM SCRIPT", NULL);
-
-#ifdef INTRO_TEST
- int curPart = 0;
- Machine *mach = NULL;
-#endif
-
- _ws->setSurfaceView(_scene);
-
- uint32 nextFrame = g_system->getMillis();
- while (!_events->quitFlag) {
-
- // This should probably be moved to either Scene or Kernel
- if (_kernel->currentRoom != _kernel->newRoom) {
-
- _ws->clear();
-
- _kernel->currentSection = _kernel->newRoom / 100;
- _kernel->currentRoom = _kernel->newRoom;
-
- _scene->loadScene(_kernel->currentRoom);
-
- _ws->setBackgroundSurface(_scene->getBackgroundSurface());
- _ws->setInverseColorTable(scene()->getInverseColorTable());
-
- _kernel->loadSectionScriptFunctions();
- _kernel->loadRoomScriptFunctions();
-
- _kernel->roomInit();
-
- _scene->show();
-
-#ifdef INTRO_TEST
- if (_kernel->currentRoom == 951) {
- curPart = 0;
- mach = _ws->streamSeries("PLANET X HILLTOP A", 1, 0x1000, 0);
- }
-#endif
-
- }
-
- eventHandler();
-
- // Call the updateState method of all views
- _viewManager->updateState();
-
- // Handle frame updates
- if (g_system->getMillis() >= nextFrame) {
-#ifdef INTRO_TEST
- // Orion Burger intro test (scene 951)
- // This is ugly and bad, machine is not deleted so there's a huge memory
- // leak too. But hey, we can see some of the intro!
- if (mach && mach->getState() == -1) {
- if (curPart == 0)
- mach = _ws->streamSeries("Planet X Low Ground Shot", 1, 0x1000, 0);
- else if (curPart == 1)
- mach = _ws->streamSeries("Planet X Hilltop B", 1, 0x1000, 0);
- else if (curPart == 2)
- mach = _ws->streamSeries("Space Station Panorama A", 1, 0x1000, 0);
- else if (curPart == 3)
- mach = _ws->streamSeries("Cargo Transfer Area A", 1, 0x1000, 0);
- else if (curPart == 4)
- mach = _ws->streamSeries("VP's Office A", 1, 0x1000, 0);
- else if (curPart == 5)
- mach = _ws->streamSeries("Hologram", 1, 0x1000, 0);
- else if (curPart == 6)
- mach = _ws->streamSeries("VP's Office B", 1, 0x1000, 0);
- else if (curPart == 7)
- mach = _ws->streamSeries("Cargo Transfer Area B", 1, 0x1000, 0);
- else if (curPart == 8)
- mach = _ws->streamSeries("Cargo Transfer Controls", 1, 0x1000, 0);
- else if (curPart == 9)
- mach = _ws->streamSeries("Space Station Panorama B", 1, 0x1000, 0);
- // This last scene is from the rolling demo
- //else if (curPart == 10)
- // mach = _ws->streamSeries("Call To Action", 1, 0x1000, 0);
- curPart++;
- }
-#endif
- _ws->update();
- _viewManager->refreshAll();
- nextFrame = g_system->getMillis();// + GAME_FRAME_DELAY;
-
- // TEST STUFF ONLY
- if (_player->commandReady) {
- _kernel->roomParser();
- _player->commandReady = false;
- }
-
- }
-
- g_system->delayMillis(10);
- }
-
- return Common::kNoError;
-}
-
-/*--------------------------------------------------------------------------*/
-
-MadsEngine::MadsEngine(OSystem *syst, const M4GameDescription *gameDesc): MadsM4Engine(syst, gameDesc) {
- // FIXME
- _madsVm = this;
-
- _globals = new MadsGlobals(this);
- _currentTimer = 0;
-}
-
-MadsEngine::~MadsEngine() {
-}
-
-Common::Error MadsEngine::run() {
- // Set up the graphics mode
- initGraphics(320, 200, false);
-
- // Necessary pre-initialisation
- _resourceManager = new MADSResourceManager(this);
-
- // Set up needed common functionality
- MadsM4Engine::run();
-
- _palette->setMadsSystemPalette();
-
- _mouse->init("cursor.ss", NULL);
- _mouse->setCursorNum(0);
-
- // Load MADS data files
- MadsGlobals *globs = (MadsGlobals *)_globals;
- globs->loadMadsVocab(); // vocab.dat
- globs->loadQuotes(); // quotes.dat
- globs->loadMadsMessagesInfo(); // messages.dat
- globs->loadMadsObjects();
-
- // Setup globals
- globs->_config.easyMouse = true;
- globs->_config.invObjectsStill = false;
- globs->_config.textWindowStill = false;
- globs->_config.storyMode = 1; // Naughty
- globs->_config.screenFades = 0;
-
- // Test code to dump all messages to the console
- //for (int i = 0; i < _globals->getMessagesSize(); i++)
- //debugCN(kDebugCore, "%s\n----------\n", _globals->loadMessage(i));
-
- if (getGameType() == GType_RexNebular) {
- MadsGameLogic::initializeGlobals();
-
- _scene = NULL;
- loadMenu(MAIN_MENU);
- } else {
- // Test code
- _scene = new MadsScene(this);
-
- startScene(FIRST_SCENE);
- RGBList *_bgPalData;
- _scene->loadBackground(FIRST_SCENE, &_bgPalData);
- _palette->addRange(_bgPalData);
- _scene->translate(_bgPalData);
-
- _scene->show();
-
- _font->setFont(FONT_MAIN_MADS);
- _font->current()->setColors(2, 1, 3);
- _font->current()->writeString(_scene->getBackgroundSurface(), "Testing the M4/MADS ScummVM engine", 5, 160, 310, 2);
- _font->current()->writeString(_scene->getBackgroundSurface(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 5, 180, 310, 2);
-
- if (getGameType() == GType_DragonSphere) {
- //_scene->showMADSV2TextBox("Test", 10, 10, NULL);
- }
-
- _mouse->cursorOn();
- }
-
- _viewManager->systemHotkeys().add(Common::KEYCODE_ESCAPE, &escapeHotkeyHandler);
- _viewManager->systemHotkeys().add(Common::KEYCODE_KP_MULTIPLY, &textviewHotkeyHandler);
-
- uint32 nextFrame = g_system->getMillis();
- while (!_events->quitFlag) {
- eventHandler();
-
- if (g_system->getMillis() >= nextFrame) {
- nextFrame = g_system->getMillis() + GAME_FRAME_DELAY;
- ++_currentTimer;
-
- // Call the updateState method of all views
- _viewManager->updateState();
-
- // Refresh the display
- _viewManager->refreshAll();
- }
-
- g_system->delayMillis(10);
-
- if (globals()->dialogType != DIALOG_NONE)
- showDialog();
- }
-
- return Common::kNoError;
-}
-
-void MadsEngine::showDialog() {
- // Switch to showing the given dialog
- RexDialogView *dlg = NULL;
- switch (globals()->dialogType) {
- case DIALOG_GAME_MENU:
- dlg = new RexGameMenuDialog();
- break;
- case DIALOG_OPTIONS:
- dlg = new RexOptionsDialog();
- break;
- default:
- error("Unknown dialog type");
- };
-
- globals()->dialogType = DIALOG_NONE;
- _viewManager->addView(dlg);
-}
-
-} // End of namespace M4
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
deleted file mode 100644
index b40ba0e878..0000000000
--- a/engines/m4/m4.h
+++ /dev/null
@@ -1,252 +0,0 @@
-/* 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 M4_H
-#define M4_H
-
-#include "common/scummsys.h"
-#include "common/util.h"
-#include "common/random.h"
-
-#include "engines/engine.h"
-
-#include "m4/globals.h"
-#include "m4/graphics.h"
-#include "m4/resource.h"
-#include "m4/saveload.h"
-#include "m4/viewmgr.h"
-#include "m4/gui.h"
-#include "m4/events.h"
-#include "m4/font.h"
-#include "m4/scene.h"
-#include "m4/mads_player.h"
-#include "m4/mads_scene.h"
-#include "m4/m4_scene.h"
-#include "m4/actor.h"
-#include "m4/sound.h"
-#include "m4/rails.h"
-#include "m4/converse.h"
-#include "m4/animation.h"
-
-//#define DUMP_SCRIPTS
-
-/**
- * This is the namespace of the M4 engine.
- *
- * Status of this engine:
- * This engine is eventually intended to compromise two evolutions of the same engine: 'MADS' for the
- * first generation of the engine, and 'M4' for the second generation. This engine is called M4 overall
- * simply because work first began on the M4 side (focusing on the game 'Orion Burger').
- *
- * MADS Status: The current game being focused on is 'Rex Nebular' by DreamMaster, who is implementing
- * functionality as he disassembles the games original executables. Currently the engine has no particular
- * game logic implemented, although it does have the title screen implemented, and displays the initial
- * game screen and some game interface elements
- *
- * M4 Status: Work on this engine began with the game 'Orion Burger'. Some of the user interface
- * functionality has been implemented. No further work has been done on this for some time, so progress
- * on this part of the engine can be considered frozen.
- *
- * Games using this engine:
- * MADS Games: Dragonsphere, Return of the Phantom, Rex Nebular and the Cosmic Gender Bender
- * M4 Games: Orion Burger, The Riddle of Master Lu
- */
-namespace M4 {
-
-class MidiPlayer;
-class FileSystem;
-class ResourceManager;
-class Mouse;
-class Events;
-class Scene;
-class ViewManager;
-class View;
-class Inventory;
-class M4InterfaceView;
-class ConversationView;
-class Actor;
-class Converse;
-class MadsConversation;
-class ScriptInterpreter;
-class WoodScript;
-class Animation;
-
-enum M4GameType {
- GType_Riddle = 1,
- GType_Burger = 2,
- GType_RexNebular = 3,
- GType_DragonSphere = 4,
- GType_Phantom = 5
-};
-
-enum Features {
- kFeaturesNone = 0,
- kFeaturesCD = 1 << 0,
- kFeaturesDemo = 1 << 1
-};
-
-enum {
- kFileTypeHash,
- kFileTypeHAG
-};
-
-enum {
- kDebugScript = 1 << 0,
- kDebugConversations = 1 << 1,
- kDebugGraphics = 1 << 2,
- kDebugSound = 1 << 3,
- kDebugCore = 1 << 4
-};
-
-#define MESSAGE_BASIC 1
-#define MESSAGE_INTERMEDIATE 2
-#define MESSAGE_DETAILED 3
-
-struct M4GameDescription;
-
-#define GAME_FRAME_DELAY 20
-
-#define VALIDATE_MADS assert(!_vm->isM4())
-
-inline void str_lower(char *s) { while (*s) { *s = tolower(*s); s++; } }
-inline void str_upper(char *s) { while (*s) { *s = toupper(*s); s++; } }
-
-inline long FixedMul(long a, long b) { return (long)(((float)a * (float)b) / 65536.0); }
-inline long FixedDiv(long a, long b) { return (long)(((float)a / (float)b) * 65536.0); }
-
-class MadsM4Engine : public Engine {
-private:
- Common::Error goMADS();
- Common::Error goM4();
-
-protected:
- // Engine APIs
- virtual Common::Error run();
-
- void shutdown();
-
- MidiPlayer *_midi;
-
-public:
- MadsM4Engine(OSystem *syst, const M4GameDescription *gameDesc);
- virtual ~MadsM4Engine();
-
- int getGameType() const;
- uint32 getFeatures() const;
- Common::Language getLanguage() const;
- Common::Platform getPlatform() const;
- bool isM4() const { return (getGameType() == GType_Riddle) || (getGameType() == GType_Burger); }
-
- const char *getGameFile(int fileType);
- Common::EventManager *eventMan() { return _eventMan; }
-
- const M4GameDescription *_gameDescription;
-
- ResourceManager *res() const { return _resourceManager; }
- MidiPlayer *midi() { return _midi; }
- Common::SaveFileManager *saveManager() { return _saveFileMan; }
- void dumpFile(const char *filename, bool uncompress);
- void eventHandler();
- bool delay(int duration, bool keyAborts = true, bool clickAborts = true);
- void loadMenu(MenuType menuType, bool loadSaveFromHotkey = false,
- bool calledFromMainMenu = false);
-
- // TODO: eventually these have to be removed
- int32 seed;
- void imath_seed(int32 seednum) { seed = seednum; }
- uint32 imath_random() { return(seed = (25173*seed + 13849) & 0xffff); }
- int32 imath_ranged_rand(int32 a, int32 b) { return (a + (((1 + ABS<int32>(b-a))*imath_random())>>16)); }
- long imath_ranged_rand16(long a, long b) { return ((a + FixedMul(1+ABS<int32>(b-a),imath_random()))); }
- //
-
- ResourceManager *_resourceManager;
- Globals *_globals;
-
- SaveLoad *_saveLoad;
- ViewManager *_viewManager;
- Palette *_palette;
- Kernel *_kernel;
- Player *_player;
- Mouse *_mouse;
- Events *_events;
- FontManager *_font;
- Actor *_actor;
- Scene *_scene;
- Dialogs *_dialogs;
- M4Surface *_screen;
- Inventory *_inventory;
- ConversationView *_conversationView;
- Sound *_sound;
- Rails *_rails;
- ScriptInterpreter *_script;
- WoodScript *_ws;
- Common::RandomSource *_random;
-
- Scene *scene() { return _scene; }
-};
-
-class MadsEngine : public MadsM4Engine {
-private:
- void showDialog();
-public:
- MadsConversation _converse;
- uint32 _currentTimer;
- MadsPlayer _player;
-public:
- MadsEngine(OSystem *syst, const M4GameDescription *gameDesc);
- virtual ~MadsEngine();
-
- virtual Common::Error run();
-
- MadsGlobals *globals() { return (MadsGlobals *)_globals; }
- MadsScene *scene() { return (MadsScene *)_scene; }
- void startScene(int sceneNum) {
- if (!_scene) {
- _scene = new MadsScene(this);
- ((MadsScene *)_scene)->initialize();
- }
- _scene->show();
- _scene->loadScene(101);
- }
-};
-
-class M4Engine : public MadsM4Engine {
-public:
- Converse *_converse;
-public:
- M4Engine(OSystem *syst, const M4GameDescription *gameDesc);
- virtual ~M4Engine();
-
- virtual Common::Error run();
-
- M4Globals *globals() { return (M4Globals *)_globals; }
- M4Scene *scene() { return (M4Scene *)_scene; }
-};
-
-// FIXME: remove globals
-extern MadsM4Engine *_vm;
-extern MadsEngine *_madsVm;
-extern M4Engine *_m4Vm;
-
-} // End of namespace M4
-
-#endif
diff --git a/engines/m4/m4_menus.cpp b/engines/m4/m4_menus.cpp
deleted file mode 100644
index 3384a82c8b..0000000000
--- a/engines/m4/m4_menus.cpp
+++ /dev/null
@@ -1,724 +0,0 @@
-/* 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/algorithm.h" // for find()
-#include "common/textconsole.h"
-#include "common/translation.h"
-#include "gui/dialog.h"
-#include "gui/message.h"
-
-#include "m4/m4_menus.h"
-#include "m4/m4_views.h"
-#include "m4/woodscript.h"
-#include "m4/midi.h"
-
-namespace M4 {
-
-const char *EmptySaveString = "<empty>";
-
-//--------------------------------------------------------------------------
-// Callback methods
-//
-// Following is a set of callback methods used to handle the execution
-// of buttons in the various dialogs
-//--------------------------------------------------------------------------
-
-// General function which simply closes the active menu
-
-void OrionCallbacks::closeMenuFn(DialogView *view, MenuObject *item) {
- view->close();
-}
-
-void OrionCallbacks::closeMenuFn(OrionMenuView *view) {
- closeMenuFn(view, NULL);
-}
-
-/* Game menu functions */
-
-void OrionCallbacks::gameOptionsMenuFn(DialogView *view, MenuObject *item) {
- view->vm()->loadMenu(OPTIONS_MENU);
- view->close();
-}
-
-void OrionCallbacks::gameSaveGameFn(DialogView *view, MenuObject *item) {
- view->vm()->loadMenu(SAVE_MENU);
- view->close();
-}
-
-void OrionCallbacks::gameLoadGameFn(DialogView *view, MenuObject *item) {
- view->vm()->loadMenu(LOAD_MENU);
- view->close();
-}
-
-void OrionCallbacks::gameExitFn(DialogView *view, MenuObject *item) {
- view->vm()->_events->quitFlag = true;
- view->close();
-}
-
-/* Options menu */
-
-void OrionCallbacks::optionsDigiSliderFn(DialogView *view, MenuObject *item) {
- // Digi volume slider changed
- int percent = ((MenuHorizSlider *) item)->percent();
-
- view->vm()->_sound->setVolume(percent * 255 / 100);
-}
-
-void OrionCallbacks::optionsMidiSliderFn(DialogView *view, MenuObject *item) {
- // Midi volume slider changed
- int percent = ((MenuHorizSlider *) item)->percent();
-
- view->vm()->midi()->setVolume(percent * 255 / 100);
-}
-
-void OrionCallbacks::optionsScrollingFn(DialogView *view, MenuObject *item) {
- // TODO: Change current Digi volume settings here
-}
-
-void OrionCallbacks::optionsCancelFn(DialogView *view, MenuObject *item) {
- // TODO: Reset original option settings here
- OrionMenuView *vw = (OrionMenuView *) view;
-
- vw->vm()->midi()->setVolume(vw->_originalMidiVolume);
-
- vw->vm()->loadMenu(GAME_MENU);
- vw->close();
-}
-
-void OrionCallbacks::optionsDoneFn(DialogView *view, MenuObject *item) {
- view->vm()->loadMenu(GAME_MENU);
- view->close();
-}
-
-void OrionCallbacks::optionsReturnFn(OrionMenuView *view) {
- optionsDoneFn(view, NULL);
-}
-
-void OrionCallbacks::optionsEscapeFn(OrionMenuView *view) {
- optionsCancelFn(view, NULL);
-}
-
-/* Save/Load dialog functions */
-
-// Save the current game
-
-void OrionCallbacks::saveLoadSaveFn(DialogView *view, MenuObject *item) {
- if (view->_selectedSlot == -1)
- return;
-
- MenuTextField *textItem = (MenuTextField *) view->getItem(SLTAG_TEXTFIELD);
- if (!textItem)
- return;
-
- textItem->setState(OS_NORMAL);
-
- // Save the game
- bool succeeded = view->vm()->_saveLoad->save(view->_selectedSlot + 1, textItem->getText());
-
- if (!succeeded) {
- GUI::MessageDialog dialog(_("Save game failed!"));
- dialog.runModal();
- }
-
- // Close the menu
- closeMenuFn(view, item);
-}
-
-void OrionCallbacks::saveLoadLoadFn(DialogView *view, MenuObject *item) {
- // TODO: load the selected save game
- closeMenuFn(view, item);
-}
-
-void OrionCallbacks::saveLoadSlotFn(DialogView *view, MenuObject *item) {
- OrionMenuView *vw = (OrionMenuView *) view;
- MenuSaveLoadText *button = (MenuSaveLoadText *) item;
-
- view->_selectedSlot = button->getIndex();
- view->_deleteSaveDesc = true;
-
- // Disable all the slots except the selected one
- for (int index = 0; index < SL_NUM_VISIBLE_SLOTS; ++index) {
- MenuSaveLoadText *currentItem = (MenuSaveLoadText *) view->getItem(SLTAG_SLOTS_START + index);
- if (currentItem->getIndex() != button->getIndex()) {
- currentItem->setState(OS_GREYED);
- }
- }
-
- // Get a copy of the slot bounds
- Common::Rect slotBounds = button->getBounds();
-
- if (view->getMenuType() == SAVE_MENU) {
- // Add in a text field for entry of the savegame name
- vw->items().push_back(new MenuTextField(view, SLTAG_TEXTFIELD,
- slotBounds.left, slotBounds.top, slotBounds.width(), slotBounds.height(), false,
- saveLoadSaveFn, (button->getText() == EmptySaveString) ? NULL : button->getText(),
- button->getIndex() + 1));
-
- } else {
- vw->items().push_back(new MenuTextField(view, SLTAG_TEXTFIELD,
- slotBounds.left, slotBounds.top, slotBounds.width(), slotBounds.height(), true,
- saveLoadLoadFn, button->getText(), button->getIndex() + 1));
- }
-
- // Hide the existing slot
- button->setVisible(false);
-
- // Disable the slider
-
- MenuVertSlider *slider = (MenuVertSlider *) view->getItem(SLTAG_VSLIDER);
- slider->setState(OS_GREYED);
-
- // Enable the save/load button
- MenuButton *btn = (MenuButton *) view->getItem(SLTAG_SAVELOAD);
- btn->setState(OS_NORMAL);
-}
-
-void OrionCallbacks::saveLoadCancelFn(DialogView *view, MenuObject *item) {
- OrionMenuView *vw = (OrionMenuView *) view;
-
- if (view->_selectedSlot != -1) {
- // Pressed cancel with a save selected, so revert back to no selection
-
- // Re-enable all the other slots
-
- for (int index = 0; index < SL_NUM_VISIBLE_SLOTS; ++index) {
- if (index != view->_selectedSlot) {
- MenuSaveLoadText *currentItem = (MenuSaveLoadText *) view->getItem(SLTAG_SLOTS_START + index);
- currentItem->setState(OS_NORMAL);
- }
- }
-
- // Show the previously hidden slot again
- MenuSaveLoadText *slot = (MenuSaveLoadText *) view->getItem(SLTAG_SLOTS_START + view->_selectedSlot);
- slot->setVisible(true);
- slot->setState(OS_NORMAL);
-
- // Remove the text selection
- MenuTextField *textField = (MenuTextField *) view->getItem(SLTAG_TEXTFIELD);
- delete textField;
- vw->items().remove(textField);
-
- // Set button enablement
- MenuButton *btn = (MenuButton *) view->getItem(SLTAG_SAVELOAD);
- btn->setState(OS_GREYED);
- btn = (MenuButton *) view->getItem(SLTAG_CANCEL);
- btn->setState(OS_NORMAL);
-
- // Re-enable the slider
-
- MenuVertSlider *slider = (MenuVertSlider *) view->getItem(SLTAG_VSLIDER);
- slider->setState(OS_NORMAL);
-
- view->_selectedSlot = -1;
-
- } else {
- // Close the dialog
- if (vw->_loadSaveFromHotkey)
- // Since dialog was called from hotkey, return directly to the game
- closeMenuFn(view, item);
- else {
- // Return to the game menu
- view->vm()->loadMenu(GAME_MENU);
- view->close();
- }
- }
-}
-
-void OrionCallbacks::saveLoadSliderFn(DialogView *view, MenuObject *item) {
- OrionMenuView *vw = (OrionMenuView *) view;
- MenuVertSlider *slider = (MenuVertSlider *) item;
-
- if (slider->sliderState() == VSLIDER_THUMBNAIL) {
- // Callback generated by slider thumb, so set top slot using slider percentage
- vw->setTopSaveSlot(slider->percent() * 89 / 100);
-
- } else {
- int newIndex = view->_topSaveSlotIndex;
-
- switch (slider->sliderState()) {
- case VSLIDER_UP:
- if (newIndex > 0)
- --newIndex;
- break;
-
- case VSLIDER_PAGE_UP:
- if (newIndex > 0)
- newIndex = MAX(newIndex - 10, 0);
- break;
-
- case VSLIDER_PAGE_DOWN:
- if (newIndex < 89)
- newIndex = MIN(newIndex + 10, 89);
- break;
-
- case VSLIDER_DOWN:
- if (newIndex < 89)
- ++newIndex;
- break;
-
- default:
- break;
- }
-
- if (newIndex != view->_topSaveSlotIndex) {
- // Set the new top slot
- vw->setTopSaveSlot(newIndex);
-
- // Set the new slider position
- slider->setPercentage(newIndex * 100 / 89);
- }
- }
-}
-
-void OrionCallbacks::saveLoadEscapeFn(OrionMenuView *view) {
- saveLoadCancelFn(view, NULL);
-}
-
-void OrionCallbacks::saveLoadReturnFn(OrionMenuView *view) {
- MenuTextField *textItem = (MenuTextField *) view->getItem(SLTAG_TEXTFIELD);
- if (textItem) {
- if (view->getMenuType() == SAVE_MENU)
- saveLoadSaveFn(view, NULL);
- else
- saveLoadLoadFn(view, NULL);
- }
-}
-
-//--------------------------------------------------------------------------
-
-OrionMenuView::OrionMenuView(MadsM4Engine *Vm, int x, int y, MenuType menuType, bool calledFromMainMenu,
- bool loadSaveFromHotkey): DialogView(Vm, x, y, true) {
- _menuType = menuType;
- _screenType = VIEWID_MENU;
- _screenFlags.layer = LAYER_MENU;
- _screenFlags.get = SCREVENT_ALL;
- _screenFlags.blocks = SCREVENT_ALL;
- _screenFlags.immovable = true;
- //_screenFlags.immovable = false; // uncomment to make menu movable
- _coords.left = x;
- _coords.top = y;
- _currentItem = NULL;
- _escapeHandler = &OrionCallbacks::closeMenuFn;
- _returnHandler = NULL;
- _saveNames = NULL;
- _savegameThumbnail = NULL;
- _deleteSaveDesc = false;
- _closeFlag = false;
-
- _calledFromMainMenu = calledFromMainMenu;
- _loadSaveFromHotkey = loadSaveFromHotkey;
-
- _interfaceWasVisible = _m4Vm->scene()->getInterface()->isVisible();
- if (_interfaceWasVisible)
- _m4Vm->scene()->getInterface()->hide();
-
- _vm->_mouse->setCursorNum(CURSOR_ARROW);
-
- switch (menuType) {
- case GAME_MENU:
- loadSprites(MENU_GAME);
-
- // Add menu contents
- _menuObjects.push_back(new MenuButton(this, BTNID_MAIN, 45, 53, 24, 24, &OrionCallbacks::closeMenuFn));
- _menuObjects.push_back(new MenuButton(this, BTNID_OPTIONS, 45, 94, 24, 24, &OrionCallbacks::gameOptionsMenuFn));
- _menuObjects.push_back(new MenuButton(this, BTNID_RESUME, 45, 135, 24, 24, &OrionCallbacks::closeMenuFn));
- _menuObjects.push_back(new MenuButton(this, BTNID_QUIT, 141, 135, 24, 24, &OrionCallbacks::gameExitFn));
- _menuObjects.push_back(new MenuButton(this, BTNID_SAVE, 141, 53, 24, 24, &OrionCallbacks::gameSaveGameFn, _calledFromMainMenu));
- _menuObjects.push_back(new MenuButton(this, BTNID_LOAD, 141, 94, 24, 24, &OrionCallbacks::gameLoadGameFn,
- !_vm->_saveLoad->hasSaves()));
-
- _escapeHandler = &OrionCallbacks::closeMenuFn;
- _returnHandler = &OrionCallbacks::closeMenuFn;
- break;
-
- case OPTIONS_MENU:
- loadSprites(MENU_OPTIONS);
-
- // Store the original settings in case user aborts dialog
- _originalMidiVolume = _vm->midi()->getVolume();
-
- // Add menu contents
- // TODO: Currently the Digi slider isn't hooked up to anything
- _menuObjects.push_back(new MenuButton(this, OPTIONID_CANCEL, 93, 141, 74, 43,
- &OrionCallbacks::optionsCancelFn, false, false, OBJTYPE_OM_CANCEL));
- _menuObjects.push_back(new MenuButton(this, OPTIONID_DONE, 168, 141, 74, 43,
- &OrionCallbacks::optionsDoneFn, false, false, OBJTYPE_OM_DONE));
- _menuObjects.push_back(new MenuHorizSlider(this, OPTIONID_HSLIDER_MIDI, 47, 64, 212, 24,
- _originalMidiVolume * 100 / 255, &OrionCallbacks::optionsMidiSliderFn, true));
- _menuObjects.push_back(new MenuHorizSlider(this, OPTIONID_HSLIDER_DIGI, 47, 104, 212, 24,
- 0, &OrionCallbacks::optionsDigiSliderFn, true));
-
- _escapeHandler = &OrionCallbacks::optionsEscapeFn;
- _returnHandler = &OrionCallbacks::optionsReturnFn;
- break;
-
- case SAVE_MENU:
- case LOAD_MENU:
- loadSprites(MENU_SAVELOAD);
-
- // Set up the defaults for the window
- _topSaveSlotIndex = 0;
- _selectedSlot = -1;
- _highlightedSlot = -1;
- _saveNames = _vm->_saveLoad->getSaves();
-
- // Set up menu elements
- _menuObjects.push_back(new MenuMessage(this, SLTAG_SAVELOAD_LABEL, 50, 241, 70, 16));
- _menuObjects.push_back(new MenuButton(this, SLTAG_SAVELOAD, 214, 384, 72, 41,
- (menuType == SAVE_MENU) ? &OrionCallbacks::saveLoadSaveFn : &OrionCallbacks::saveLoadLoadFn,
- true, true, (menuType == SAVE_MENU) ? OBJTYPE_SL_SAVE : OBJTYPE_SL_LOAD));
- _menuObjects.push_back(new MenuButton(this, SLTAG_CANCEL, 139, 384, 74, 43,
- &OrionCallbacks::saveLoadCancelFn, false, false, OBJTYPE_SL_CANCEL));
- _menuObjects.push_back(new MenuVertSlider(this, SLTAG_VSLIDER, 291, 255, 23, 127, 0,
- &OrionCallbacks::saveLoadSliderFn));
-
- if (_menuType == SAVE_MENU)
- _savegameThumbnail = createThumbnail();
-
- _menuObjects.push_back(new MenuImage(this, SLTAG_THUMBNAIL, 66, 28, 215, 162,
- (_savegameThumbnail == NULL) ? _sprites->getFrame(SL_EMPTY_THUMBNAIL) : _savegameThumbnail));
-
-
- {
- SaveGameIterator slot = _saveNames->begin();
- for (uint slotIndex = 0; slotIndex < SL_NUM_VISIBLE_SLOTS; ++slotIndex, ++slot) {
- // Get save slot
- bool isEmpty = (slotIndex >= _saveNames->size()) || (*slot).empty();
-
- _menuObjects.push_back(new MenuSaveLoadText(this, SLTAG_SLOTS_START + slotIndex,
- 50, 256 + slotIndex * 15, 238, 15, &OrionCallbacks::saveLoadSlotFn,
- (menuType == LOAD_MENU) && isEmpty, true, (menuType == LOAD_MENU),
- isEmpty ? EmptySaveString : slot->c_str(), slotIndex + 1));
- }
- }
-
- _escapeHandler = &OrionCallbacks::saveLoadEscapeFn;
- _returnHandler = &OrionCallbacks::saveLoadReturnFn;
- break;
-
- default:
- error("Unknown menu type");
- break;
- }
-
- // Draw all the items onto the background surface
- for (MenuObjectsIterator i = _menuObjects.begin(); i != _menuObjects.end(); ++i)
- (*i)->onRefresh();
-}
-
-OrionMenuView::~OrionMenuView() {
- delete _sprites;
-
- for (MenuObjectList::iterator i = _menuObjects.begin(); i != _menuObjects.end(); ++i)
- delete *i;
- _menuObjects.clear();
-
- delete _saveNames;
- delete _savegameThumbnail;
-}
-
-bool OrionMenuView::loadSprites(const char *seriesName) {
- Common::SeekableReadStream *data = _vm->res()->get(seriesName);
- RGB8 *palette;
-
- _sprites = new SpriteAsset(_vm, data, data->size(), seriesName);
- palette = _sprites->getPalette();
- _vm->_palette->setPalette(palette, 0, _sprites->getColorCount());
-
- _vm->res()->toss(seriesName);
-
- // Update the palette
- //_vm->setPalette((byte *) _menuPalette, 59, 197);
-
- // The first sprite is the menu background
-
- M4Sprite *bg = _sprites->getFrame(0);
- this->setSize(bg->width(), bg->height());
- _coords.setWidth(bg->width());
- _coords.setHeight(bg->height());
- bg->copyTo(this);
-
- return true;
-}
-
-// Creates a thumbnail based on the current background screen
-
-M4Surface *OrionMenuView::createThumbnail() {
- M4Surface srcSurface(_vm->_screen->width(), _vm->_screen->height());
- M4Surface *result = new M4Surface(_vm->_screen->width() / 3, _vm->_screen->height() / 3);
-
- // Translate the scene data
-
- _vm->_scene->onRefresh(NULL, &srcSurface);
- byte *srcP = srcSurface.getBasePtr(0, 0);
- byte *destP = result->getBasePtr(0, 0);
-
- for (int yCtr = 0; yCtr < _vm->_scene->height() / 3; ++yCtr, srcP += g_system->getWidth() * 3) {
- byte *src0P = srcP;
- byte *src1P = srcP + _vm->_screen->width();
- byte *src2P = src1P + _vm->_screen->width();
-
- for (int xCtr = 0; xCtr < result->width(); ++xCtr) {
- *destP = (byte)((uint32)((
- *src0P + *(src0P + 1) + *(src0P + 2) +
- *src1P + *(src1P + 1) + *(src1P + 2) +
- *src2P + *(src2P + 1) + *(src2P + 2)) / 9));
- if (*destP == 0)
- *destP = 21;
-
- ++destP;
- src0P += 3;
- src1P += 3;
- src2P += 3;
- }
- }
-
- // Translate the game interface view - since it's using standard colors that can't be
- // averaged, simply take the top left pixel of every 3x3 pixel block
-
- _m4Vm->scene()->getInterface()->onRefresh(NULL, &srcSurface);
- destP = result->getBasePtr(0, 0) + (_vm->_screen->width() / 3) * (_m4Vm->scene()->getInterface()->bounds().top / 3);
-
- int yStart = _m4Vm->scene()->getInterface()->bounds().top;
- int yEnd = MIN(_vm->_screen->height() - 1, (int) _m4Vm->scene()->getInterface()->bounds().bottom - 1);
- for (int yCtr = yStart; yCtr <= yEnd; yCtr += 3) {
- srcP = (byte *)srcSurface.getBasePtr(0, yCtr) + (yCtr * _vm->_screen->width());
-
- for (int xCtr = 0; xCtr < result->width(); ++xCtr, srcP += 3)
- *destP++ = *srcP;
- }
-
- return result;
-}
-
-void OrionMenuView::destroyView() {
- MadsM4Engine *engine = _vm;
- bool interfaceVisible = _interfaceWasVisible;
- engine->_viewManager->deleteView(this);
-
- // Fade the game back in if no menu views are active (such as if a button was pressed in one menu
- // to activate another menu dialog)
- bool fadeIn = engine->_viewManager->getView(VIEWID_MENU) == NULL;
-
- if (fadeIn) {
- bool fadeToBlack = engine->_events->quitFlag;
- engine->_ws->update();
- engine->_palette->fadeFromGreen(M4_DIALOG_FADE_STEPS, M4_DIALOG_FADE_DELAY, fadeToBlack);
-
- if (interfaceVisible)
- engine->scene()->showInterface();
- }
-}
-
-bool OrionMenuView::onEvent(M4EventType eventType, int32 param, int x, int y, bool &captureEvents) {
- static Common::Point movingPos(0, 0);
- static bool movingFlag = false;
-
- bool handledFlag = false;
- int localX, localY;
- MenuObjectsIterator i;
-
- if (!_screenFlags.visible)
- return false;
-
- if (!movingFlag)
- captureEvents = false;
-
- // If the escape key is pressed, then pass onto the Escape handler
-
- if (eventType == KEVENT_KEY) {
- if ((param == Common::KEYCODE_ESCAPE) && (_escapeHandler != NULL)) {
- // Execute the Escape handler function
- _currentItem = NULL;
- captureEvents = false;
- _escapeHandler(this);
- destroyView();
- return true;
- }
-
- if (((param == Common::KEYCODE_RETURN) || (param == Common::KEYCODE_KP_ENTER)) &&
- (_returnHandler != NULL)) {
- // Execute the Return handler function
- _currentItem = NULL;
- captureEvents = false;
- _returnHandler(this);
- return true;
- }
-
- MenuTextField *textItem = (MenuTextField *) getItem(SLTAG_TEXTFIELD);
- if (textItem && textItem->onEvent(KEVENT_KEY, param, x, y, _currentItem))
- return true;
- }
-
- // Convert the screen position to a relative position within the menu surface
- localX = x - _coords.left;
- localY = y - _coords.top;
-
- // If there is an active object handling events, pass it on until it releases control
-
- if (_currentItem) {
- handledFlag = _currentItem->onEvent(eventType, param, localX, localY, _currentItem);
-
- if (_closeFlag) {
- // Dialog has been flagged to be closed
- captureEvents = false;
- destroyView();
- return true;
- }
-
- if (_currentItem) {
- captureEvents =
- (Common::find(_menuObjects.begin(), _menuObjects.end(), _currentItem) != _menuObjects.end());
- if (!captureEvents)
- // The menu object is no longer active, so reset current item
- _currentItem = NULL;
- } else {
- captureEvents = false;
- }
-
- if (handledFlag)
- return true;
- }
-
- if (eventType == KEVENT_KEY) {
- // Handle keypresses by looping through the item list to see if any of them want it
-
- for (i = _menuObjects.begin(); (i != _menuObjects.end()) && !handledFlag; ++i) {
- MenuObject *menuObj = *i;
- MenuObject *dummyItem;
- handledFlag = menuObj->onEvent(eventType, param, localX, localY, dummyItem);
- }
-
- return handledFlag;
-
- } else {
- // Handle mouse events by scanning the item list to see if the cursor is within any
-
- for (i = _menuObjects.begin(); (i != _menuObjects.end()) && !handledFlag; ++i) {
- MenuObject *menuObj = *i;
-
- if (menuObj->isInside(localX, localY)) {
- // Found an item, so pass it the event
- menuObj->onEvent(eventType, param, localX, localY, _currentItem);
-
- if (_closeFlag) {
- // Dialog has been flagged to be closed
- captureEvents = false;
- destroyView();
- return true;
- }
-
- if (_currentItem) {
- captureEvents =
- (Common::find(_menuObjects.begin(), _menuObjects.end(), _currentItem) != _menuObjects.end());
- if (!captureEvents)
- // The menu object is no longer active, so reset current item
- _currentItem = NULL;
- } else {
- captureEvents = false;
- }
-
- return true;
- }
- }
- }
-
- // None of the items have handled the event, so fall back on menu-wide event handling
-
- switch (eventType) {
- case MEVENT_LEFT_CLICK:
- case MEVENT_DOUBLECLICK:
- if (!_screenFlags.immovable) {
- // Move the entire dialog
- captureEvents = true;
- movingFlag = true;
- movingPos.x = x;
- movingPos.y = y;
- }
- break;
-
- case MEVENT_LEFT_DRAG:
- case MEVENT_DOUBLECLICK_DRAG:
- if (movingFlag) {
- moveRelative(x - movingPos.x, y - movingPos.y);
- movingPos.x = x;
- movingPos.y = y;
- }
- break;
-
- case MEVENT_LEFT_RELEASE:
- case MEVENT_DOUBLECLICK_RELEASE:
- captureEvents = false;
- movingFlag = false;
- break;
-
- default:
- break;
- }
-
- return true;
-}
-
-MenuObject *OrionMenuView::getItem(int objectId) {
- MenuObjectsIterator i;
- for (i = _menuObjects.begin(); i != _menuObjects.end(); ++i) {
- MenuObject *obj = *i;
- if (obj->getObjectId() == objectId)
- return obj;
- }
-
- return NULL;
-}
-
-void OrionMenuView::setTopSaveSlot(int slotNumber) {
- _topSaveSlotIndex = MAX(MIN(slotNumber, 89), 0);
-
- // Update the details of the load/save slots
-
- // Get save slot
- SaveGameIterator slot = _saveNames->begin();
- for (int i = 0; i < _topSaveSlotIndex; ++i)
- ++slot;
-
- for (uint index = 0; index < SL_NUM_VISIBLE_SLOTS; ++index, ++slot) {
- MenuSaveLoadText *item = (MenuSaveLoadText *) getItem(SLTAG_SLOTS_START + index);
- uint slotIndex = _topSaveSlotIndex + index;
-
- bool isEmpty = (slotIndex >= _saveNames->size()) || slot->empty();
- item->setDisplay(slotIndex + 1, isEmpty ? EmptySaveString : slot->c_str());
-
- item->setState((_menuType == SAVE_MENU) || !isEmpty ? OS_NORMAL : OS_GREYED);
- }
-}
-
-void OrionMenuView::refresh(const Common::Rect &areaRect) {
- // Copy the selected portion of the background
- _sprites->getFrame(0)->copyTo(this, areaRect, areaRect.left, areaRect.top);
-
- for (MenuObjectsIterator i = _menuObjects.begin(); i != _menuObjects.end(); ++i) {
- MenuObject *obj = *i;
- if (obj->getBounds().intersects(areaRect))
- obj->onRefresh();
- }
-}
-
-}
diff --git a/engines/m4/m4_menus.h b/engines/m4/m4_menus.h
deleted file mode 100644
index 9abf71e9db..0000000000
--- a/engines/m4/m4_menus.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* 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 M4_M4_MENUS_H
-#define M4_M4_MENUS_H
-
-#include "common/list.h"
-#include "common/ptr.h"
-
-#include "m4/viewmgr.h"
-#include "m4/m4.h"
-#include "m4/gui.h"
-#include "m4/saveload.h"
-
-namespace M4 {
-
-#define M4_DIALOG_FADE_STEPS 5
-#define M4_DIALOG_FADE_DELAY 30
-
-typedef Common::List<MenuObject *> MenuObjectList;
-
-class OrionMenuView : public DialogView {
- typedef MenuObjectList::iterator MenuObjectsIterator;
-private:
- MenuType _menuType;
- SpriteAsset *_sprites;
- MenuObjectList _menuObjects;
- MenuObject *_currentItem;
- typedef void (*Callback)(OrionMenuView *view);
- OrionMenuView::Callback _escapeHandler, _returnHandler;
- bool _closeFlag;
- bool _calledFromMainMenu;
- bool _interfaceWasVisible;
- int _firstSlotIndex;
-
- bool loadSprites(const char *seriesName);
- M4Surface *createThumbnail();
- void destroyView();
-public:
- OrionMenuView(MadsM4Engine *vm, int x, int y, MenuType menuType, bool calledFromMainMenu,
- bool loadSaveFromHotkey);
- ~OrionMenuView();
- MenuType getMenuType() { return _menuType; }
- SpriteAsset *sprites() { return _sprites; }
- MenuObjectList &items() { return _menuObjects; }
- MenuObject *getItem(int objectId);
- void setTopSaveSlot(int slotNumber);
- void refresh(const Common::Rect &areaRect);
- void close() { _closeFlag = true; }
-
- bool onEvent(M4EventType eventType, int32 param, int x, int y, bool &captureEvents);
-
- int _originalMidiVolume;
- SaveGameList *_saveNames;
- bool _loadSaveFromHotkey;
-};
-
-class OrionCallbacks {
-public:
- static void closeMenuFn(DialogView *view, MenuObject *item);
- static void closeMenuFn(OrionMenuView *view);
- static void gameOptionsMenuFn(DialogView *view, MenuObject *item);
- static void gameSaveGameFn(DialogView *view, MenuObject *item);
- static void gameLoadGameFn(DialogView *view, MenuObject *item);
- static void gameExitFn(DialogView *view, MenuObject *item);
- static void optionsDigiSliderFn(DialogView *view, MenuObject *item);
- static void optionsMidiSliderFn(DialogView *view, MenuObject *item);
- static void optionsScrollingFn(DialogView *view, MenuObject *item);
- static void optionsCancelFn(DialogView *view, MenuObject *item);
- static void optionsDoneFn(DialogView *view, MenuObject *item);
- static void optionsReturnFn(OrionMenuView *view);
- static void optionsEscapeFn(OrionMenuView *view);
- static void saveLoadSaveFn(DialogView *view, MenuObject *item);
- static void saveLoadLoadFn(DialogView *view, MenuObject *item);
- static void saveLoadSlotFn(DialogView *view, MenuObject *item);
- static void saveLoadCancelFn(DialogView *view, MenuObject *item);
- static void saveLoadSliderFn(DialogView *view, MenuObject *item);
- static void saveLoadEscapeFn(OrionMenuView *view);
- static void saveLoadReturnFn(OrionMenuView *view);
-};
-
-}
-
-#endif
diff --git a/engines/m4/m4_scene.cpp b/engines/m4/m4_scene.cpp
deleted file mode 100644
index 1a2e00e50d..0000000000
--- a/engines/m4/m4_scene.cpp
+++ /dev/null
@@ -1,326 +0,0 @@
-/* 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/system.h"
-#include "common/textconsole.h"
-
-#include "m4/m4_scene.h"
-#include "m4/dialogs.h"
-#include "m4/globals.h"
-#include "m4/events.h"
-#include "m4/graphics.h"
-#include "m4/rails.h"
-#include "m4/font.h"
-#include "m4/m4_views.h"
-#include "m4/mads_views.h"
-#include "m4/compression.h"
-
-namespace M4 {
-
-M4Scene::M4Scene(M4Engine *vm): _sceneResources(), Scene(vm, &_sceneResources) {
- _vm = vm;
- _sceneSprites = NULL;
- _inverseColorTable = NULL;
-
- _sceneResources.hotspots = new HotSpotList();
- _sceneResources.parallax = new HotSpotList();
- _sceneResources.dynamicHotspots = new HotSpotList();
- _interfaceSurface = new M4InterfaceView(vm);
-}
-
-M4Scene::~M4Scene() {
- delete _sceneSprites;
-}
-
-void M4Scene::loadSceneSprites(int sceneNumber) {
- char filename[kM4MaxFilenameSize];
- sprintf(filename, "%i.ssb", sceneNumber);
-
- Common::SeekableReadStream *sceneS = _vm->res()->get(filename);
- _sceneSprites = new SpriteAsset(_vm, sceneS, sceneS->size(), filename);
- _vm->res()->toss(filename);
-
- debugCN(kDebugGraphics, "Scene has %d sprites, each one having %d colors\n", _sceneSprites->getCount(), _sceneSprites->getColorCount());
-}
-
-void M4Scene::loadSceneResources(int sceneNumber) {
- char filename[kM4MaxFilenameSize];
- int i = 0, x = 0, y = 0;
- sprintf(filename, "%i.chk", sceneNumber);
-
- Common::SeekableReadStream *sceneS = _vm->res()->get(filename);
-
- if (sceneS != NULL) {
- sceneS->read(_sceneResources.artBase, MAX_CHK_FILENAME_SIZE);
- sceneS->read(_sceneResources.pictureBase, MAX_CHK_FILENAME_SIZE);
- int hotspotCount = sceneS->readUint32LE();
- _sceneResources.parallaxCount = sceneS->readUint32LE();
- int dynHotspotCount = sceneS->readUint32LE();
- _sceneResources.frontY = sceneS->readUint32LE();
- _sceneResources.backY = sceneS->readUint32LE();
- _sceneResources.frontScale = sceneS->readUint32LE();
- _sceneResources.backScale = sceneS->readUint32LE();
- for (i = 0; i < 16; i++)
- _sceneResources.depthTable[i] = sceneS->readUint16LE();
- _sceneResources.railNodeCount = sceneS->readUint32LE();
-
- // Clear rails from previous scene
- _vm->_rails->clearRails();
-
- for (i = 0; i < _sceneResources.railNodeCount; i++) {
- x = sceneS->readUint32LE();
- y = sceneS->readUint32LE();
- if (_vm->_rails->addRailNode(x, y, true) < 0) {
- warning("Too many rail nodes defined for scene");
- }
- }
-
- // Clear current hotspot lists
- _sceneResources.hotspots->clear();
- _sceneResources.parallax->clear();
- _sceneResources.dynamicHotspots->clear();
-
- _sceneResources.hotspots->loadHotSpots(sceneS, hotspotCount);
- _sceneResources.parallax->loadHotSpots(sceneS, _sceneResources.parallaxCount);
- _sceneResources.dynamicHotspots->loadHotSpots(sceneS, dynHotspotCount);
-
- // Note that toss() deletes the MemoryReadStream
- _vm->res()->toss(filename);
- }
-}
-
-void M4Scene::loadSceneInverseColorTable(int sceneNumber) {
- char filename[kM4MaxFilenameSize];
- Common::SeekableReadStream *iplS;
-
- sprintf(filename, "%i.ipl", sceneNumber);
- iplS = _vm->res()->openFile(filename);
- delete[] _inverseColorTable;
- _inverseColorTable = new byte[iplS->size()];
- iplS->read(_inverseColorTable, iplS->size());
- _vm->res()->toss(filename);
-}
-
-void M4Scene::loadSceneSpriteCodes(int sceneNumber) {
- char filename[kM4MaxFilenameSize];
- sprintf(filename, "%i.ssc", sceneNumber);
-
- Common::SeekableReadStream *sceneS = _vm->res()->get(filename);
-
- // TODO
-
- if (sceneS != NULL) {
- SpriteAsset* _sceneSpriteCodes = new SpriteAsset(_vm, sceneS, sceneS->size(), filename);
- int colorCount = _sceneSpriteCodes->getColorCount();
-// RGB8* spritePalette = _sceneSpriteCodes->getPalette();
- //_vm->_palette->setPalette(spritePalette, 0, colorCount);
-
- debugCN(kDebugGraphics, "Scene has %d sprite codes, each one having %d colors\n", _sceneSpriteCodes->getCount(), colorCount);
-
- // Note that toss() deletes the MemoryReadStream
- _vm->res()->toss(filename);
- }
-}
-
-void M4Scene::loadScene(int sceneNumber) {
- Scene::loadScene(sceneNumber);
-
- _backgroundSurface->loadBackground(sceneNumber);
- _palData = NULL;
-
- if (_vm->getGameType() == GType_Burger &&
- sceneNumber != TITLE_SCENE_BURGER && sceneNumber != MAINMENU_SCENE_BURGER)
- setStatusText("");
-
- // Load scene def file (*.CHK)
- loadSceneResources(sceneNumber);
-
- // TODO: set walker scaling
- // TODO: destroy woodscript buffer
-
- // Load scene walk path file (*.COD/*.WW?)
- loadSceneCodes(sceneNumber);
-
- // Load inverse color table file (*.IPL)
- loadSceneInverseColorTable(sceneNumber);
-
- if (_vm->getGameType() != GType_Burger) {
- // Load scene sprites file (*.SSB)
- loadSceneSprites(sceneNumber);
-
- // Load scene sprite codes file (*.SSC)
- loadSceneSpriteCodes(sceneNumber);
- }
-
-
- if (sceneNumber != TITLE_SCENE_BURGER && sceneNumber != MAINMENU_SCENE_BURGER) {
- _m4Vm->scene()->getInterface()->show();
- showSprites();
- }
-
- // Purge resources
- _vm->res()->purge();
-}
-
-void M4Scene::loadSceneCodes(int sceneNumber, int index) {
- char filename[kM4MaxFilenameSize];
- Common::SeekableReadStream *sceneS;
-
- sprintf(filename, "%i.cod", sceneNumber);
- sceneS = _vm->res()->openFile(filename);
- _walkSurface->loadCodesM4(sceneS);
- _vm->res()->toss(filename);
-}
-
-void M4Scene::show() {
- Scene::show();
- _vm->_viewManager->addView(_interfaceSurface);
-}
-
-void M4Scene::leaveScene() {
- _sceneResources.parallax->clear();
-
- delete _sceneResources.parallax;
- delete[] _inverseColorTable;
-
- Scene::leaveScene();
-}
-
-void M4Scene::mouseMove(int x, int y) {
- if (_vm->getGameType() == GType_Riddle)
- return;
-
- // TODO: loads of things to do here, only the mouse cursor and the status
- // text is changed for now
-
- // Only scene hotspots are checked for now, not parallax/props, as the
- // latter ones are not used by Orion Burger
- HotSpot *currentHotSpot = _sceneResources.hotspots->findByXY(x, y);
- if (currentHotSpot != NULL && currentHotSpot->getActive()) {
- if (_vm->_mouse->getCursorNum() != CURSOR_LOOK &&
- _vm->_mouse->getCursorNum() != CURSOR_TAKE &&
- _vm->_mouse->getCursorNum() != CURSOR_USE &&
- _m4Vm->scene()->getInterface()->_inventory.getSelectedIndex() == -1) {
- _vm->_mouse->setCursorNum(currentHotSpot->getCursor());
- }
- _m4Vm->scene()->getInterface()->setStatusText(currentHotSpot->getPrep());
- } else {
- if (_vm->_mouse->getCursorNum() != CURSOR_LOOK &&
- _vm->_mouse->getCursorNum() != CURSOR_TAKE &&
- _vm->_mouse->getCursorNum() != CURSOR_USE &&
- _m4Vm->scene()->getInterface()->_inventory.getSelectedIndex() == -1) {
- _vm->_mouse->setCursorNum(0);
- } else {
-
- }
- }
-}
-
-void M4Scene::leftClick(int x, int y) {
- if (_vm->getGameType() == GType_Burger) {
- // Place a Wilbur sprite with the correct facing
- HotSpot *currentHotSpot = _sceneResources.hotspots->findByXY(x, y);
- if (currentHotSpot != NULL && currentHotSpot->getActive()) {
- update();
- _vm->_actor->setWalkerDirection(currentHotSpot->getFacing());
- /*
- int posX = currentHotSpot->getFeetX();
- int posY = currentHotSpot->getFeetY() -
- scaleValue(_vm->_actor->getWalkerHeight(), _vm->_actor->getWalkerScaling(), 0);
- //_vm->_actor->placeWalkerSpriteAt(0, posX, posY);
- */
-
- // Player said.... (for scene scripts)
- debugCN(kDebugGraphics, "Player said: %s %s\n", currentHotSpot->getVerb(), currentHotSpot->getVocab());
-
- // FIXME: This should be moved somewhere else, and is incomplete
- if (_m4Vm->scene()->getInterface()->_inventory.getSelectedIndex() == -1) {
- if (_vm->_mouse->getVerb() == NULL) {
- strcpy(_vm->_player->verb, currentHotSpot->getVerb());
- } else {
- strcpy(_vm->_player->verb, _vm->_mouse->getVerb());
- }
- } else {
- strcpy(_vm->_player->verb, _m4Vm->scene()->getInterface()->_inventory.getSelectedObjectName());
- }
- strcpy(_vm->_player->noun, currentHotSpot->getVocab());
- strcpy(_vm->_player->object, "");
- _vm->_player->commandReady = true;
-
- debugCN(kDebugGraphics, "## Player said: %s %s\n", _vm->_player->verb, _vm->_player->noun);
-
- }
- }
-}
-
-void M4Scene::rightClick(int x, int y) {
- if (_vm->getGameType() == GType_Burger) {
- nextCommonCursor();
- _m4Vm->scene()->getInterface()->_inventory.clearSelected();
- }
-}
-
-void M4Scene::setAction(int action, int objectId) {
-}
-
-void M4Scene::setStatusText(const char *text) {
- getInterface()->setStatusText(text);
-}
-
-void M4Scene::update() {
-
-}
-
-void M4Scene::nextCommonCursor() {
- int cursorIndex = _vm->_mouse->getCursorNum();
-
- switch (cursorIndex) {
- case CURSOR_ARROW:
- cursorIndex = CURSOR_LOOK;
- break;
- case CURSOR_LOOK:
- cursorIndex = CURSOR_TAKE;
- break;
- case CURSOR_TAKE:
- cursorIndex = CURSOR_USE;
- break;
- case CURSOR_USE:
- cursorIndex = CURSOR_ARROW;
- break;
- default:
- cursorIndex = CURSOR_ARROW;
- }
-
- _vm->_mouse->setCursorNum(cursorIndex);
-}
-
-void M4Scene::showHotSpots() {
- Scene::showHotSpots();
-
- // parallax (yellow)
- for (int i = 0; i < _sceneResources.parallaxCount; i++) {
- HotSpot *currentHotSpot = _sceneResources.parallax->get(i);
- _backgroundSurface->frameRect(currentHotSpot->getRect(), _vm->_palette->YELLOW);
- }
-}
-
-} // End of namespace M4
diff --git a/engines/m4/m4_scene.h b/engines/m4/m4_scene.h
deleted file mode 100644
index a0ba497cf7..0000000000
--- a/engines/m4/m4_scene.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* 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 M4_M4_SCENE_H
-#define M4_M4_SCENE_H
-
-class View;
-
-#include "m4/scene.h"
-
-namespace M4 {
-
-#define TITLE_SCENE_BURGER 951 // 951 = intro, 901 = demo menu, 971 = first scene
-#define MAINMENU_SCENE_BURGER 903
-#define FIRST_SCENE 101
-
-class M4SceneResources : public SceneResources {
-public:
- int32 frontY, backY;
- int32 frontScale, backScale;
- int16 depthTable[16];
- int32 railNodeCount; // # of rails
-
- int32 parallaxCount;
- HotSpotList *parallax;
-};
-
-class M4Scene : public Scene {
-private:
- M4Engine *_vm;
- M4SceneResources _sceneResources;
- SpriteAsset *_sceneSprites;
- SpriteAsset *_walkerSprite;
- byte *_inverseColorTable;
-
- void loadSceneSprites(int sceneNumber);
- void loadSceneResources(int sceneNumber);
- void loadSceneInverseColorTable(int sceneNumber);
- void loadSceneSpriteCodes(int sceneNumber);
- void nextCommonCursor();
-public:
- M4Scene(M4Engine *vm);
- virtual ~M4Scene();
-
- // Methods that differ between engines
- virtual void loadScene(int sceneNumber);
- virtual void leaveScene();
- virtual void loadSceneCodes(int sceneNumber, int index = 0);
- virtual void show();
- virtual void mouseMove(int x, int y);
- virtual void leftClick(int x, int y);
- virtual void rightClick(int x, int y);
- virtual void update();
- virtual void showHotSpots();
-
- byte *getInverseColorTable() const { return _inverseColorTable; }
- M4InterfaceView *getInterface() { return (M4InterfaceView *)_interfaceSurface; }
- M4SceneResources &getSceneResources() { return _sceneResources; }
- void setStatusText(const char *text);
- void setAction(int action, int objectId = -1);
-};
-
-} // End of namespace M4
-
-#endif
diff --git a/engines/m4/m4_views.cpp b/engines/m4/m4_views.cpp
deleted file mode 100644
index 78c409252b..0000000000
--- a/engines/m4/m4_views.cpp
+++ /dev/null
@@ -1,344 +0,0 @@
-/* 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/textconsole.h"
-
-#include "m4/m4_views.h"
-#include "m4/events.h"
-#include "m4/font.h"
-#include "m4/globals.h"
-#include "m4/m4.h"
-
-namespace M4 {
-
-GUIInventory::GUIInventory(View *owner, MadsM4Engine *vm, const Common::Rect &bounds, int horizCells,
- int vertCells, int cellWidth, int cellHeight, int tag): GUIRect(owner, bounds, tag) {
-
- _vm = vm;
- _cellCount.x = horizCells;
- _cellCount.y = vertCells;
- _cellSize.x = cellWidth;
- _cellSize.y = cellHeight;
-
- // Validate the cell settings
- if ((_cellCount.x * _cellSize.x > _bounds.width()) ||
- (_cellCount.y * _cellSize.y > _bounds.height()))
- error("Cell settings for inventory display exceeded control size");
-
- _visible = true;
- _scrollPosition = 0;
- _scrollable = false;
- _highlightedIndex = -1;
- _selectedIndex = -1;
-}
-
-void GUIInventory::onRefresh() {
- _parent->fillRect(_bounds, _vm->_palette->BLACK);
- //_parent->frameRect(_bounds, _vm->_palette->LIGHT_GRAY);
-
- if (_visible) {
- //kernel_trigger_dispatch(kernel_trigger_create(TRIG_INV_CLICK));
-
- _scrollable = false;
-
- // Get to the starting inventory position for display
- ItemsIterator i = _inventoryItems.begin();
- int index = _scrollPosition;
- while (index-- > 0) ++i;
-
- // Loop through displaying entries
- for (index = 0; (i != _inventoryItems.end()) && (index < _cellCount.x * _cellCount.y); ++index, ++i) {
- GUIInventoryItem *item = (*i).get();
- const Common::Point cellPos = getCellPosition(index);
-/* Common::Rect cellBounds(_bounds.left + cellPos.x + xOffset,
- _bounds.top + cellPos.y + yOffset,
- _bounds.left + cellPos.x + xOffset + _cellSize.x,
- _bounds.top + cellPos.y + _cellSize.y);*/
- Common::Rect cellBounds(_bounds.left + cellPos.x, _bounds.top + cellPos.y,
- _bounds.left + cellPos.x + _cellSize.x, _bounds.top + cellPos.y + _cellSize.y);
-
- Common::Point iconPt(
- cellBounds.left + (cellBounds.width() - item->icon->width()) / 2,
- cellBounds.top + (cellBounds.height() - item->icon->height()) / 2);
-
- item->icon->copyTo(_parent, iconPt.x, iconPt.y, 0);
-
- if (_highlightedIndex == index)
- _parent->frameRect(Common::Rect(iconPt.x - 2, iconPt.y - 2,
- iconPt.x + item->icon->width() + 2, iconPt.y + item->icon->height() + 2),
- _vm->_palette->LIGHT_GRAY);
- }
- }
-}
-
-bool GUIInventory::onEvent(M4EventType eventType, int32 param, int x, int y, GUIObject *&currentItem) {
- bool result = false;
- int overIndex = getInsideIndex(x, y);
- bool isPressed = (eventType == MEVENT_LEFT_CLICK) || (eventType == MEVENT_LEFT_HOLD) ||
- (eventType == MEVENT_LEFT_DRAG);
- ItemsIterator curItem = _inventoryItems.begin();
-
- if (isPressed) {
- if (_selectedIndex == -1 && overIndex != -1) {
- setHighlight(overIndex);
- _selectedIndex = overIndex;
- for (int i = 0; i < _scrollPosition + _selectedIndex; i++)
- ++curItem;
- if (_scrollPosition + _selectedIndex < (int)_inventoryItems.size())
- _vm->_mouse->setCursorNum(curItem->get()->iconIndex);
- result = true;
- } else {
- // We are over something being tracked
- if (_selectedIndex == overIndex) {
- setHighlight(overIndex);
- result = true;
- } else {
- // Otherwise reset highlighting
- setHighlight(-1);
- result = false;
- }
- }
- } else {
- // No button pressed
- if (_selectedIndex == overIndex) {
- result = (_selectedIndex != -1);
- } else {
- result = (overIndex + _scrollPosition < (int)_inventoryItems.size());
- if (result) {
- for (int i = 0; i < overIndex + _scrollPosition; i++)
- ++curItem;
- _m4Vm->scene()->getInterface()->setStatusText(curItem->get()->name);
- }
- }
-
- // Stop tracking anything
- setHighlight(overIndex);
- }
-
- return result;
-}
-
-void GUIInventory::add(const char *name, const char *verb, M4Surface *icon, int iconIndex) {
- // First scan through the list to prevent duplicate objects
- for (ItemsIterator i = _inventoryItems.begin(); i != _inventoryItems.end(); ++i) {
- if (!strcmp(name, ((*i).get())->name))
- return;
- }
-
- _inventoryItems.push_back(InventoryList::value_type(new GUIInventoryItem(name, verb, icon, iconIndex)));
-}
-
-bool GUIInventory::remove(const char *name) {
- for (ItemsIterator i = _inventoryItems.begin(); i != _inventoryItems.end(); ++i) {
- if (!strcmp(name, ((*i).get())->name)) {
- _inventoryItems.erase(i);
- _scrollPosition = 0;
- return true;
- }
- }
-
- return false;
-}
-
-int GUIInventory::getInsideIndex(int x, int y) {
- if (!_bounds.contains(x, y))
- return -1;
-
- int localX = x - _bounds.left;
- int localY = y - _bounds.top;
- return (localX / _cellSize.x) * _cellCount.y + (localY / _cellSize.y);
-}
-
-const char *GUIInventory::getSelectedObjectName() {
- if (_selectedIndex != -1) {
- ItemsIterator curItem = _inventoryItems.begin();
- for (int i = 0; i < _selectedIndex; i++)
- ++curItem;
- return curItem->get()->name;
- } else {
- return NULL;
- }
-}
-
-const Common::Point &GUIInventory::getCellPosition(int index) {
- static Common::Point result;
-
- if (_cellCount.x > _cellCount.y) {
- // Horizontal orientation
- result.x = (index / _cellCount.y) * _cellSize.x;
- result.y = (index % _cellCount.y) * _cellSize.x;
- } else {
- // Vertical orientation
- result.x = (index / _cellCount.x) * _cellSize.y;
- result.y = (index % _cellCount.x) * _cellSize.y;
- }
-
- return result;
-}
-
-void GUIInventory::setHighlight(int index) {
- if (_highlightedIndex == index)
- return;
-
- _highlightedIndex = index;
-}
-
-void GUIInventory::setScrollPosition(int value) {
- if (value < 0)
- return;
- else if (value >= (int)_inventoryItems.size() - (_cellCount.x * _cellCount.y))
- return;
-
- _scrollPosition = value;
-}
-
-//--------------------------------------------------------------------------
-
-const char *INTERFACE_SERIES = "999intr";
-
-#define SPR(x) _sprites->getFrame(x)
-
-M4InterfaceView::M4InterfaceView(MadsM4Engine *vm):
- GameInterfaceView(vm, Common::Rect(0, vm->_screen->height() - INTERFACE_HEIGHT,
- vm->_screen->width(), vm->_screen->height())),
- _statusText(GUITextField(this, Common::Rect(200, 1, 450, 21))),
- _inventory(GUIInventory(this, vm, Common::Rect(188, 22, 539, 97), 9, 1, 39, 75, 3)) {
-
- _screenType = VIEWID_INTERFACE;
- _screenFlags.layer = LAYER_INTERFACE;
- _screenFlags.visible = false;
- _screenFlags.get = SCREVENT_MOUSE;
- _highlightedIndex = -1;
- _selected = false;
-
- Common::SeekableReadStream *data = _vm->res()->get(INTERFACE_SERIES);
- RGB8 *palette;
-
- _sprites = new SpriteAsset(_vm, data, data->size(), INTERFACE_SERIES);
- palette = _sprites->getPalette();
-
- //Palette.setPalette(palette, 0, _sprites->getColorCount());
-
- _vm->res()->toss(INTERFACE_SERIES);
-
- // Setup the interface buttons
-
- _buttons.push_back(ButtonList::value_type(new GUIButton(this, Common::Rect(15, 35, 47, 66), 0, SPR(0), SPR(1), SPR(2)))); // look
- _buttons.push_back(ButtonList::value_type(new GUIButton(this, Common::Rect(60, 35, 92, 66), 1, SPR(3), SPR(4), SPR(5)))); // take
- _buttons.push_back(ButtonList::value_type(new GUIButton(this, Common::Rect(105, 35, 137, 66), 2, SPR(6), SPR(7), SPR(8)))); // manipulate
-
- _buttons.push_back(ButtonList::value_type(new GUIButton(this, Common::Rect(580, 10, 620, 69), 3, SPR(69), SPR(70), SPR(71)))); // abduction
- _buttons.push_back(ButtonList::value_type(new GUIButton(this, Common::Rect(582, 70, 619, 105), 4, SPR(76), SPR(77), SPR(78)))); // menu
-
- _buttons.push_back(ButtonList::value_type(new GUIButton(this, Common::Rect(168, 22, 188, 97), 5, SPR(60), SPR(61), SPR(62)))); // Scroll left
- _buttons.push_back(ButtonList::value_type(new GUIButton(this, Common::Rect(539, 22, 559, 97), 6, SPR(64), SPR(65), SPR(66)))); // Scroll right
-}
-
-#undef SPR
-
-M4InterfaceView::~M4InterfaceView() {
- delete _sprites;
-}
-
-void M4InterfaceView::setHighlightedButton(int index) {
- if (index == _highlightedIndex)
- return;
-
- _selected = (index == -1);
- _highlightedIndex = index;
-}
-
-bool M4InterfaceView::onEvent(M4EventType eventType, int32 param, int x, int y, bool &captureEvents) {
- static bool selectionFlag = false;
- if (eventType == MEVENT_LEFT_RELEASE)
- selectionFlag = false;
-
- captureEvents = isInside(x, y);
- if (!captureEvents)
- return false;
-
- int localX = x - _coords.left;
- int localY = y - _coords.top;
- GUIObject *currentItem;
-
- _statusText.onEvent(eventType, param, localX, localY, currentItem);
- _inventory.onEvent(eventType, param, localX, localY, currentItem);
-
- if (_vm->_mouse->getCursorNum() != CURSOR_LOOK &&
- _vm->_mouse->getCursorNum() != CURSOR_TAKE &&
- _vm->_mouse->getCursorNum() != CURSOR_USE &&
- _m4Vm->scene()->getInterface()->_inventory.getSelectedIndex() == -1) {
- if (_vm->_mouse->getCursorNum() != 0)
- _vm->_mouse->setCursorNum(0);
- }
-
- for (ButtonsIterator i = _buttons.begin(); i != _buttons.end(); ++i) {
- GUIButton *btn = (*i).get();
- btn->onEvent(eventType, param, localX, localY, currentItem);
- if ((btn->getState() == BUTTON_PRESSED) && !selectionFlag) {
- selectionFlag = true;
- _highlightedIndex = btn->getTag();
-
- switch (_highlightedIndex) {
- case 0:
- _vm->_mouse->setCursorNum(CURSOR_LOOK);
- break;
- case 1:
- _vm->_mouse->setCursorNum(CURSOR_TAKE);
- break;
- case 2:
- _vm->_mouse->setCursorNum(CURSOR_USE);
- break;
- case 3:
- // TODO: Jump to abduction
- break;
- case 4:
- _vm->loadMenu(GAME_MENU);
- break;
- case 5:
- _inventory.scrollLeft();
- break;
- case 6:
- _inventory.scrollRight();
- break;
- default:
- break;
- }
- }
- }
-
- return true;
-}
-
-void M4InterfaceView::onRefresh(RectList *rects, M4Surface *destSurface) {
- clear();
-
- _statusText.onRefresh();
- _inventory.onRefresh();
- for (ButtonsIterator i = _buttons.begin(); i != _buttons.end(); ++i)
- ((*i).get())->onRefresh();
-
- View::onRefresh(rects, destSurface);
-}
-
-
-} // End of namespace M4
diff --git a/engines/m4/m4_views.h b/engines/m4/m4_views.h
deleted file mode 100644
index 4ca2a74593..0000000000
--- a/engines/m4/m4_views.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* 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 M4_M4_VIEWS_H
-#define M4_M4_VIEWS_H
-
-#include "m4/gui.h"
-#include "m4/viewmgr.h"
-#include "common/rect.h"
-#include "common/list.h"
-#include "common/ptr.h"
-
-namespace M4 {
-
-class GUIInventoryItem {
-public:
- const char *name;
- const char *verb;
- M4Surface *icon;
- int iconIndex;
-
- GUIInventoryItem(const char *_name, const char *_verb, M4Surface *_icon, int _iconIndex) {
- name = _name; verb = _verb; icon = _icon; iconIndex = _iconIndex;
- }
-};
-
-class GUIInventory : public GUIRect {
- typedef Common::List<Common::SharedPtr<GUIInventoryItem> > InventoryList;
- typedef InventoryList::iterator ItemsIterator;
-private:
- InventoryList _inventoryItems;
- Common::Point _cellSize;
- Common::Point _cellCount;
- bool _visible;
- bool _scrollable;
- int _scrollPosition;
- int _highlightedIndex;
- int _selectedIndex;
- MadsM4Engine *_vm;
-public:
- GUIInventory(View *owner, MadsM4Engine *vm, const Common::Rect &bounds,
- int horizCells, int vertCells, int cellWidth, int cellHeight, int tag);
-
- void onRefresh();
- bool onEvent(M4EventType eventType, int32 param, int x, int y, GUIObject *&currentItem);
-
- void add(const char *name, const char *verb, M4Surface *icon, int iconIndex);
- bool remove(const char *name);
- int getInsideIndex(int x, int y);
- int getSelectedIndex() { return _selectedIndex; }
- const char *getSelectedObjectName();
- void clearSelected() {
- _selectedIndex = -1;
- setHighlight(-1);
- }
- const Common::Point &getCellPosition(int index);
- void setHighlight(int index);
- bool needLeftButton() { return _scrollPosition != 0; }
- bool needRightButton() {
- return (uint)(_inventoryItems.size() - _scrollPosition) > (uint)(_cellCount.x * _cellCount.y);
- }
- void setScrollPosition(int value);
- void scrollLeft() { setScrollPosition(_scrollPosition - 1); }
- void scrollRight() { setScrollPosition(_scrollPosition + 1); }
- void setVisible(bool value) { _visible = value; }
-};
-
-class M4InterfaceView : public GameInterfaceView {
- typedef Common::List<Common::SharedPtr<GUIButton> > ButtonList;
- typedef ButtonList::iterator ButtonsIterator;
-public:
- SpriteAsset *_sprites;
- ButtonList _buttons;
- GUITextField _statusText;
- GUIInventory _inventory;
- int _highlightedIndex;
- bool _selected;
-private:
- void setHighlightedButton(int index);
-public:
- M4InterfaceView(MadsM4Engine *vm);
- ~M4InterfaceView();
-
- void onRefresh(RectList *rects, M4Surface *destSurface);
- bool onEvent(M4EventType eventType, int32 param, int x, int y, bool &captureEvents);
- void setStatusText(const char *text) { _statusText.setText(text); }
- void cancelSentence() { setStatusText(NULL); }
- void inventoryAdd(const char *name, const char *verb, int iconIndex) {
- _inventory.add(name, verb, _sprites->getFrame(iconIndex), iconIndex);
- }
- bool inventoryRemove(const char *name) { return _inventory.remove(name); }
-};
-
-}
-
-#endif
diff --git a/engines/m4/mads_anim.cpp b/engines/m4/mads_anim.cpp
deleted file mode 100644
index 2ea576dfa4..0000000000
--- a/engines/m4/mads_anim.cpp
+++ /dev/null
@@ -1,745 +0,0 @@
-/* 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/textconsole.h"
-
-#include "m4/mads_anim.h"
-#include "m4/m4.h"
-#include "m4/compression.h"
-
-namespace M4 {
-
-#define TEXTVIEW_LINE_SPACING 2
-#define TEXT_ANIMATION_DELAY 100
-#define TV_NUM_FADE_STEPS 40
-#define TV_FADE_DELAY_MILLI 50
-
-TextviewView::TextviewView(MadsM4Engine *vm):
- View(vm, Common::Rect(0, 0, vm->_screen->width(), vm->_screen->height())),
- _bgSurface(vm->_screen->width(), MADS_SURFACE_HEIGHT),
- _textSurface(vm->_screen->width(), MADS_SURFACE_HEIGHT + vm->_font->current()->getHeight() +
- TEXTVIEW_LINE_SPACING) {
-
- _screenType = VIEWID_TEXTVIEW;
- _screenFlags.layer = LAYER_BACKGROUND;
- _screenFlags.visible = true;
- _screenFlags.get = SCREVENT_ALL;
- _callback = NULL;
- _script = NULL;
- _spareScreen = NULL;
- _bgCurrent = NULL;
- _bgSpare = NULL;
- reset();
-
- // Set up system palette colors and the two colors for text display
- _vm->_palette->setMadsSystemPalette();
- RGB8 palData[3];
- palData[0].r = palData[0].g = palData[0].b = 0;
- palData[1].r = 0; palData[1].g = palData[1].b = 252;
- palData[2].r = 0; palData[2].g = palData[2].b = 180;
- _vm->_palette->setPalette(&palData[0], 4, 3);
- _vm->_palette->blockRange(4, 3);
-
- _vm->_font->current()->setColors(5, 6, 4);
-
- clear();
- _bgSurface.clear();
- _textSurface.clear();
-
- int y = (height() - MADS_SURFACE_HEIGHT) / 2;
- setColor(2);
- hLine(0, width() - 1, y - 2);
- hLine(0, width() - 1, height() - y + 1);
-}
-
-TextviewView::~TextviewView() {
- if (_script)
- _vm->res()->toss(_resourceName);
- delete _spareScreen;
- delete _bgCurrent;
- delete _bgSpare;
-}
-
-void TextviewView::reset() {
- _bgSurface.clear();
- _textSurface.clear();
- _animating = false;
- _panX = 0;
- _panY = 0;
- _panSpeed = 0;
- _soundDriverLoaded = false;
- Common::set_to(&_spareScreens[0], &_spareScreens[10], 0);
- _scrollCount = 0;
- _lineY = -1;
- _scrollTimeout = 0;
- _panCountdown = 0;
- _processEvents = true;
-}
-
-void TextviewView::setScript(const char *resourceName, TextviewCallback callback) {
- _callback = callback;
- if (_script)
- _vm->res()->toss(_resourceName);
- if (_spareScreen) {
- delete _spareScreen;
- _spareScreen = NULL;
- }
-
- reset();
-
- strncpy(_resourceName, resourceName, 15);
- _resourceName[15] = '\0';
- if (!strchr(_resourceName, '.'))
- strcat(_resourceName, ".txr");
-
- _script = _vm->res()->get(_resourceName);
-
- processLines();
-}
-
-bool TextviewView::onEvent(M4EventType eventType, int32 param, int x, int y, bool &captureEvents) {
- if (!_processEvents)
- return false;
-
- // Wait for the Escape key or a mouse press
- if (((eventType == KEVENT_KEY) && (param == Common::KEYCODE_ESCAPE)) ||
- (eventType == MEVENT_LEFT_RELEASE) || (eventType == MEVENT_RIGHT_RELEASE)) {
- scriptDone();
- captureEvents = false;
- return true;
- }
-
- return false;
-}
-
-void TextviewView::updateState() {
- if (!_animating)
- return;
-
- // Only update state if wait period has expired
- uint32 currTime = g_system->getMillis();
-
- // If a screen transition is in progress and it's time for another column, handle it
- if (_spareScreen) {
- byte *srcP = _spareScreen->getBasePtr(_translationX, 0);
- byte *destP = _bgSurface.getBasePtr(_translationX, 0);
-
- for (int y = 0; y < _bgSurface.height(); ++y, srcP += _spareScreen->width(),
- destP += _bgSurface.width()) {
- *destP = *srcP;
- }
-
- if (++_translationX >= _bgSurface.width()) {
- // Surface transition is complete
- delete _spareScreen;
- _spareScreen = NULL;
-
- _vm->_palette->deleteRange(_bgCurrent);
- delete _bgCurrent;
- _bgCurrent = _bgSpare;
- _bgSpare = NULL;
- }
- }
-
- // Make sure it's time for an update
- if (currTime < _scrollTimeout)
- return;
- _scrollTimeout = g_system->getMillis() + TEXT_ANIMATION_DELAY;
-
- // If any panning values are set, pan the background surface
- if ((_panX != 0) || (_panY != 0)) {
- if (_panCountdown > 0) {
- --_panCountdown;
- return;
- }
-
- // Handle horizontal panning
- if (_panX != 0) {
- byte *lineTemp = new byte[_panX];
- for (int y = 0; y < _bgSurface.height(); ++y) {
- byte *pixelsP = _bgSurface.getBasePtr(0, y);
-
- // Copy the first X pixels into temp buffer, move the rest of the line
- // to the start of the line, and then move temp buffer pixels to end of line
- Common::copy(pixelsP, pixelsP + _panX, lineTemp);
- Common::copy(pixelsP + _panX, pixelsP + _bgSurface.width(), pixelsP);
- Common::copy(lineTemp, lineTemp + _panX, pixelsP + _bgSurface.width() - _panX);
- }
-
- delete[] lineTemp;
- }
-
- // Handle vertical panning
- if (_panY != 0) {
- // Store the bottom Y lines into a temp buffer, move the rest of the lines down,
- // and then copy the stored lines back to the top of the screen
- byte *linesTemp = new byte[_panY * _bgSurface.width()];
- byte *pixelsP = _bgSurface.getBasePtr(0, _bgSurface.height() - _panY);
- Common::copy(pixelsP, pixelsP + _bgSurface.width() * _panY, linesTemp);
-
- for (int y = _bgSurface.height() - 1; y >= _panY; --y) {
- byte *destP = _bgSurface.getBasePtr(0, y);
- byte *srcP = _bgSurface.getBasePtr(0, y - _panY);
- Common::copy(srcP, srcP + _bgSurface.width(), destP);
- }
-
- Common::copy(linesTemp, linesTemp + _panY * _bgSurface.width(), _bgSurface.getBasePtr(0, 0));
- delete[] linesTemp;
- }
- }
-
- // Scroll the text surface up by one row
- byte *pixelsP = _textSurface.getBasePtr(0, 0);
- Common::copy(pixelsP + width(), pixelsP + _textSurface.width() * _textSurface.height(), pixelsP);
- pixelsP = _textSurface.getBasePtr(0, _textSurface.height() - 1);
- Common::set_to(pixelsP, pixelsP + _textSurface.width(), _vm->_palette->BLACK);
-
- if (_scrollCount > 0) {
- // Handling final scrolling of text off of screen
- if (--_scrollCount == 0) {
- scriptDone();
- return;
- }
- } else {
- // Handling a text row
- if (++_lineY == (_vm->_font->current()->getHeight() + TEXTVIEW_LINE_SPACING))
- processLines();
- }
-
- // Refresh the view
- int yp = (height() - _bgSurface.height()) / 2;
- _bgSurface.copyTo(this, 0, yp);
- _textSurface.copyTo(this, Common::Rect(0, 0, _textSurface.width(), _bgSurface.height()),
- 0, yp, _vm->_palette->BLACK);
-}
-
-void TextviewView::scriptDone() {
- TextviewCallback fn = _callback;
- MadsM4Engine *vm = _vm;
-
- // Remove this view from manager and destroy it
- _vm->_viewManager->deleteView(this);
-
- if (fn)
- fn(vm);
-}
-
-void TextviewView::processLines() {
- strncpy(_currentLine, _script->readLine().c_str(), 79);
- if (_script->eos() || _script->err())
- error("Attempted to read past end of response file");
-
- while (!_script->eos() && !_script->err()) {
- // Commented out line, so go loop for another
- if (_currentLine[0] == '#') {
- strncpy(_currentLine, _script->readLine().c_str(), 79);
- continue;
- }
-
- // Process the line
- char *cStart = strchr(_currentLine, '[');
- if (cStart) {
- while (cStart) {
- // Loop for possible multiple commands on one line
- char *cEnd = strchr(_currentLine, ']');
- if (!cEnd)
- error("Unterminated command '%s' in response file", _currentLine);
-
- *cEnd = '\0';
- processCommand();
-
- // Copy rest of line (if any) to start of buffer
- strcpy(_currentLine, cEnd + 1);
-
- cStart = strchr(_currentLine, '[');
- }
-
- if (_currentLine[0]) {
- processText();
- break;
- }
-
- } else {
- processText();
- break;
- }
-
- strncpy(_currentLine, _script->readLine().c_str(), 79);
- }
-}
-
-void TextviewView::processCommand() {
- char commandStr[80];
- char *paramP;
- strcpy(commandStr, _currentLine + 1);
- str_upper(commandStr);
-
- if (!strncmp(commandStr, "BACKGROUND", 10)) {
- // Set the background
- paramP = commandStr + 10;
- int screenId = getParameter(&paramP);
- _bgSurface.loadBackground(screenId, &_bgCurrent);
- _vm->_palette->addRange(_bgCurrent);
- _bgSurface.translate(_bgCurrent);
-
- } else if (!strncmp(commandStr, "GO", 2)) {
- _animating = true;
-
- // Grab what the final palete will be
- RGB8 destPalette[256];
- _vm->_palette->grabPalette(destPalette, 0, 256);
-
- // Copy the loaded background, if any, to the view surface
- int yp = (height() - _bgSurface.height()) / 2;
- _bgSurface.copyTo(this, 0, yp);
-
- // Handle fade-in
- _processEvents = false; // stop processing events during fade-in
- _vm->_palette->fadeIn(TV_NUM_FADE_STEPS, TV_FADE_DELAY_MILLI, destPalette, 256);
- _processEvents = true;
-
- } else if (!strncmp(commandStr, "PAN", 3)) {
- // Set panning values
- paramP = commandStr + 3;
- int panX = getParameter(&paramP);
- int panY = getParameter(&paramP);
- int panSpeed = getParameter(&paramP);
-
- if ((panX != 0) || (panY != 0)) {
- _panX = panX;
- _panY = panY;
- _panSpeed = panSpeed;
- }
-
- } else if (!strncmp(commandStr, "DRIVER", 6)) {
- // Set the driver to use
- // TODO: Handling of the sound drivers
-
- } else if (!strncmp(commandStr, "SOUND", 5)) {
- // Set sound number
- paramP = commandStr + 5;
- //int soundId = getParameter(&paramP);
-
- //TODO: Proper handling of the sound drivers/sounds
- //if (!_soundDriverLoaded)
- // error("Attempted to set sound without loading any driver");
-
- } else if (!strncmp(commandStr, "COLOR", 5) && ((commandStr[5] == '0') || (commandStr[5] == '1'))) {
- // Set the text colors
- int index = commandStr[5] - '0';
- paramP = commandStr + 6;
-
- RGB8 palEntry;
- palEntry.r = getParameter(&paramP) << 2;
- palEntry.g = getParameter(&paramP) << 2;
- palEntry.b = getParameter(&paramP) << 2;
- _vm->_palette->setPalette(&palEntry, 5 + index, 1);
-
- } else if (!strncmp(commandStr, "SPARE", 5)) {
- // Sets a secondary background number that can be later switched in with a PAGE command
- paramP = commandStr + 6;
- int spareIndex = commandStr[5] - '0';
- if ((spareIndex >= 0) && (spareIndex <= 9)) {
- int screenId = getParameter(&paramP);
-
- _spareScreens[spareIndex] = screenId;
- }
-
- } else if (!strncmp(commandStr, "PAGE", 4)) {
- // Signals to change to a previous specified secondary background
- paramP = commandStr + 4;
- int spareIndex = getParameter(&paramP);
-
- // Only allow background switches if one isn't currently in progress
- if (!_spareScreen && (_spareScreens[spareIndex] != 0)) {
- _spareScreen = new M4Surface(width(), MADS_SURFACE_HEIGHT);
- _spareScreen->loadBackground(_spareScreens[spareIndex], &_bgSpare);
- _vm->_palette->addRange(_bgSpare);
- _spareScreen->translate(_bgSpare);
-
- _translationX = 0;
- }
-
- } else {
- error("Unknown response command: '%s'", commandStr);
- }
-}
-
-int TextviewView::getParameter(char **paramP) {
- if ((**paramP != '=') && (**paramP != ','))
- return 0;
-
- int result = 0;
- ++*paramP;
- while ((**paramP >= '0') && (**paramP <= '9')) {
- result = result * 10 + (**paramP - '0');
- ++*paramP;
- }
-
- return result;
-}
-
-void TextviewView::processText() {
- int lineWidth, xStart;
-
- if (!strcmp(_currentLine, "***")) {
- // Special signifier for end of script
- _scrollCount = _vm->_font->current()->getHeight() * 13;
- _lineY = -1;
- return;
- }
-
- _lineY = 0;
-
- // Lines are always centered, except if line contains a '@', in which case the
- // '@' marks the position that must be horizontally centered
- char *centerP = strchr(_currentLine, '@');
- if (centerP) {
- *centerP = '\0';
- xStart = (width() / 2) - _vm->_font->current()->getWidth(_currentLine);
-
- // Delete the @ character and shift back the remainder of the string
- char *p = centerP + 1;
- if (*p == ' ') ++p;
- strcpy(centerP, p);
-
- } else {
- lineWidth = _vm->_font->current()->getWidth(_currentLine);
- xStart = (width() - lineWidth) / 2;
- }
-
- // Copy the text line onto the bottom of the textSurface surface, which will allow it
- // to gradually scroll onto the screen
- int yp = _textSurface.height() - _vm->_font->current()->getHeight() - TEXTVIEW_LINE_SPACING;
- _textSurface.fillRect(Common::Rect(0, yp, _textSurface.width(), _textSurface.height()),
- _vm->_palette->BLACK);
- _vm->_font->current()->writeString(&_textSurface, _currentLine, xStart, yp);
-}
-
-
-//--------------------------------------------------------------------------
-
-AnimviewView::AnimviewView(MadsM4Engine *vm):
- View(vm, Common::Rect(0, 0, vm->_screen->width(), vm->_screen->height())),
- MadsView(this), _backgroundSurface(MADS_SURFACE_WIDTH, MADS_SURFACE_HEIGHT),
- _codeSurface(MADS_SURFACE_WIDTH, MADS_SURFACE_HEIGHT) {
-
- MadsView::_bgSurface = &_backgroundSurface;
- MadsView::_depthSurface = &_codeSurface;
- MadsView::setViewport(Common::Rect(0, MADS_Y_OFFSET, MADS_SURFACE_WIDTH, MADS_Y_OFFSET + MADS_SURFACE_HEIGHT));
-
- _screenType = VIEWID_ANIMVIEW;
- _screenFlags.layer = LAYER_BACKGROUND;
- _screenFlags.visible = true;
- _screenFlags.get = SCREVENT_ALL;
- _callback = NULL;
- _script = NULL;
- _palData = NULL;
- _previousUpdate = 0;
- _transition = kTransitionNone;
- _activeAnimation = NULL;
- _bgLoadFlag = true;
- _startFrame = -1;
- _scriptDone = false;
-
- reset();
-
- // Set up system palette colors
- _vm->_palette->setMadsSystemPalette();
-
- // Block reserved palette ranges
- _vm->_palette->blockRange(16, 2);
- _vm->_palette->blockRange(250, 4);
-
- clear();
- _backgroundSurface.clear();
-
- setColor(2);
- hLine(0, width() - 1, MADS_Y_OFFSET - 2);
- hLine(0, width() - 1, MADS_Y_OFFSET + MADS_SURFACE_HEIGHT + 2);
-}
-
-AnimviewView::~AnimviewView() {
- if (_script)
- _vm->res()->toss(_resourceName);
- delete _activeAnimation;
-}
-
-void AnimviewView::reset() {
- _backgroundSurface.clear();
- _soundDriverLoaded = false;
-}
-
-void AnimviewView::setScript(const char *resourceName, AnimviewCallback callback) {
- _callback = callback;
- if (_script)
- _vm->res()->toss(_resourceName);
-
- reset();
-
- strncpy(_resourceName, resourceName, 15);
- _resourceName[15] = '\0';
- if (!strchr(_resourceName, '.'))
- strcat(_resourceName, ".res");
-
- _script = _vm->res()->get(_resourceName);
-}
-
-bool AnimviewView::onEvent(M4EventType eventType, int32 param, int x, int y, bool &captureEvents) {
- // Wait for the Escape key or a mouse press
- if (((eventType == KEVENT_KEY) && (param == Common::KEYCODE_ESCAPE)) ||
- (eventType == MEVENT_LEFT_RELEASE) || (eventType == MEVENT_RIGHT_RELEASE)) {
- scriptDone();
- captureEvents = false;
- return true;
- }
-
- return false;
-}
-
-void AnimviewView::updateState() {
- MadsView::update();
-
- if (!_script || _scriptDone)
- return;
-
- if (!_activeAnimation) {
- readNextCommand();
- assert(_activeAnimation);
- }
-
- // Update the current animation
- _activeAnimation->update();
- if (_activeAnimation->freeFlag()) {
- delete _activeAnimation;
- _activeAnimation = NULL;
-
- // Clear up current background and sprites
- _backgroundSurface.reset();
- clearLists();
-
- // Reset flags
- _startFrame = -1;
-
- readNextCommand();
-
- // Check if script is finished
- if (_scriptDone) {
- scriptDone();
- return;
- }
- }
-
- refresh();
-}
-
-void AnimviewView::readNextCommand() {
-static bool tempFlag = true;//****DEBUG - Temporarily allow me to skip several intro scenes ****
-
- while (!_script->eos() && !_script->err()) {
- if (!tempFlag) {
- tempFlag = true;
- strncpy(_currentLine, _script->readLine().c_str(), 79);
- strncpy(_currentLine, _script->readLine().c_str(), 79);
- }
-
- strncpy(_currentLine, _script->readLine().c_str(), 79);
-
- // Process any switches on the line
- char *cStart = strchr(_currentLine, '-');
- while (cStart) {
- // Loop for possible multiple commands on one line
- char *cEnd = strchr(_currentLine, ' ');
- if (!cEnd)
- error("Unterminated command '%s' in response file", _currentLine);
-
- *cEnd = '\0';
- processCommand();
-
- // Copy rest of line (if any) to start of buffer
- // Don't use strcpy() here, because if the
- // rest of the line is the longer of the two
- // strings, the memory areas will overlap.
- memmove(_currentLine, cEnd + 1, strlen(cEnd + 1) + 1);
-
- cStart = strchr(_currentLine, '-');
- }
-
- // If there's something left, presume it's a resource name to process
- if (_currentLine[0])
- break;
- }
-
- if (!_currentLine[0]) {
- // A blank line at this point means that the end of the animation has been reached
- _scriptDone = true;
- return;
- }
-
- if (strchr(_currentLine, '.') == NULL)
- strcat(_currentLine, ".aa");
-
- uint16 flags = 0;
- if (_bgLoadFlag)
- flags |= 0x100;
-
- _activeAnimation = new MadsAnimation(_vm, this);
- _activeAnimation->initialize(_currentLine, flags, &_backgroundSurface, &_codeSurface);
-
- if (_startFrame != -1)
- _activeAnimation->setCurrentFrame(_startFrame);
-
- _spriteSlots.fullRefresh();
-/*
- // Handle scene transition
- switch (_transition) {
- case kTransitionNone:
- // nothing to do
- break;
- case kTransitionFadeIn:
- case kTransitionFadeIn2:
- _vm->_palette->fadeIn(TV_NUM_FADE_STEPS, TV_FADE_DELAY_MILLI, destPalette, 256);
- break;
- case kTransitionBoxInBottomLeft:
- case kTransitionBoxInBottomRight:
- case kTransitionBoxInTopLeft:
- case kTransitionBoxInTopRight:
- // unused
- warning("Unsupported box in scene effect");
- break;
- case kTransitionPanLeftToRight:
- // TODO
- break;
- case kTransitionPanRightToLeft:
- // TODO
- break;
- case kTransitionCircleIn:
- // TODO
- break;
- default:
- // nothing to do
- break;
- }
-*/
-
- _vm->_resourceManager->toss(_currentLine);
-}
-
-
-void AnimviewView::scriptDone() {
-return;
- AnimviewCallback fn = _callback;
- MadsM4Engine *vm = _vm;
-
- // Remove this view from manager and destroy it
- _vm->_viewManager->deleteView(this);
-
- if (fn)
- fn(vm);
-}
-
-/*
-Switches are: (taken from the help of the original executable)
- -b Toggle background load status off/on.
- -c:char Specify sound card id letter.
- -f:num Specify a specific starting frame number
- -g Stay in graphics mode on exit.
- -h[:ex] Disable EMS/XMS high memory support.
- -i Switch sound interrupts mode off/on.
- -j Wait for music to finish at end.
- -k Keystroke jumps to end instead of abort.
- -m Operate in non-MADS mode.
- -o:xxx Specify opening special effect.
- -p Switch MADS path mode to CONCAT.
- -r[:abn] Resynch timer (always, beginning, never).
- -s:file Specify sound file.
- -u[:...] Use DMA speech [optional: addr,type,irq,drq].
- -w Toggle white bars off/on.
- -x Exit immediately after last frame.
- -y Do not clear screen initially
- -z Display statistics after run.
-
- Opening special effects are:
- 0: no effect
- 1: fade in
- 2: fade in (looks to be the same as 1)
- 3: box in from bottom left (unused)
- 4: box in from bottom right (unused)
- 5: box in from top left (unused)
- 6: box in from top right (unused)
- 7: pan in from left to right
- 8: pan in from right to left
- 9: circle in (new scene appears in a circle that expands)
-
- Animview is ran like this from the original games:
- animview.exe @resfilename -c:P,220,20 -u:220,20,07,01 -p -a:mainmenu -p
-
- Note that the first -p is necessary to watch the animation, otherwise
- the program just exits
-
- To watch an animation within the *.res file, just run animview like this:
- animview.exe -x -r:b -o:2 animfilename -p
-*/
-void AnimviewView::processCommand() {
- char commandStr[80];
- strcpy(commandStr, _currentLine + 1);
- str_upper(commandStr);
- char *param = commandStr;
-
- switch (commandStr[0]) {
- case 'B':
- // Toggle background load flag
- _bgLoadFlag = !_bgLoadFlag;
- break;
-
- case 'F':
- // Start animation at a specific frame
- ++param;
- assert(*param == ':');
- _startFrame = atoi(++param);
- break;
-
- case 'O':
- param = param + 2;
- //warning(kDebugGraphics, "O:%i ", atoi(param));
- _transition = atoi(param);
- break;
-
- case 'R':
- param = param + 2;
- //warning(kDebugGraphics, "R:%s ", param);
- break;
-
- case 'W':
- //warning(kDebugGraphics, "W ");
- break;
-
- case 'X':
- //warning(kDebugGraphics, "X ");
- break;
-
- default:
- error("Unknown response command: '%s'", commandStr);
- }
-}
-
-}
diff --git a/engines/m4/mads_anim.h b/engines/m4/mads_anim.h
deleted file mode 100644
index 411d575d59..0000000000
--- a/engines/m4/mads_anim.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/* 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 M4_MADS_ANIM_H
-#define M4_MADS_ANIM_H
-
-#include "m4/viewmgr.h"
-#include "m4/compression.h"
-#include "m4/animation.h"
-
-#include "common/str-array.h"
-
-namespace M4 {
-
-typedef void (*TextviewCallback)(MadsM4Engine *vm);
-
-class TextviewView : public View {
-private:
- bool _animating;
-
- char _resourceName[80];
- Common::SeekableReadStream *_script;
- uint16 _spareScreens[10];
- M4Surface *_spareScreen;
- RGBList *_bgCurrent, *_bgSpare;
- int _translationX;
- int _panX, _panY, _panSpeed;
- int _panCountdown;
- char _currentLine[80];
- uint32 _scrollTimeout;
- int _scrollCount;
- int _lineY;
- M4Surface _bgSurface;
- M4Surface _textSurface;
- TextviewCallback _callback;
- bool _soundDriverLoaded;
- bool _processEvents;
-
- void reset();
- void processLines();
- void processCommand();
- void processText();
- int getParameter(char **paramP);
-public:
- TextviewView(MadsM4Engine *vm);
- ~TextviewView();
-
- void setScript(const char *resourceName, TextviewCallback callback);
- bool isAnimating() { return _animating; }
- void scriptDone();
-
- bool onEvent(M4EventType eventType, int32 param1, int x, int y, bool &captureEvents);
- void updateState();
-};
-
-typedef void (*AnimviewCallback)(MadsM4Engine *vm);
-
-class AnimviewView : public View, MadsView {
-private:
- char _resourceName[80];
- Common::SeekableReadStream *_script;
- bool _scriptDone;
- uint32 _previousUpdate;
- char _currentLine[80];
- M4Surface _backgroundSurface;
- M4Surface _codeSurface;
- AnimviewCallback _callback;
- bool _soundDriverLoaded;
- RGBList *_palData;
- int _transition;
- MadsAnimation *_activeAnimation;
- bool _bgLoadFlag;
- int _startFrame;
-
- void reset();
- void readNextCommand();
- void processCommand();
-public:
- AnimviewView(MadsM4Engine *vm);
- ~AnimviewView();
-
- void setScript(const char *resourceName, AnimviewCallback callback);
- void scriptDone();
-
- bool onEvent(M4EventType eventType, int32 param1, int x, int y, bool &captureEvents);
- void updateState();
-};
-
-}
-
-#endif
diff --git a/engines/m4/mads_logic.cpp b/engines/m4/mads_logic.cpp
deleted file mode 100644
index 335127393e..0000000000
--- a/engines/m4/mads_logic.cpp
+++ /dev/null
@@ -1,1038 +0,0 @@
-/* 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/textconsole.h"
-
-#include "m4/m4.h"
-#include "m4/dialogs.h"
-#include "m4/mads_logic.h"
-#include "m4/scene.h"
-
-#define MAX_CALL_PARAMS 10
-
-namespace M4 {
-
-void MadsGameLogic::initializeGlobals() {
- // Clear the entire globals list
- Common::set_to(&_madsVm->globals()->_globals[0], &_madsVm->globals()->_globals[TOTAL_NUM_VARIABLES], 0);
-
- SET_GLOBAL(4, 8);
- SET_GLOBAL(33, 1);
- SET_GLOBAL(10, 0xFFFF);
- SET_GLOBAL(13, 0xFFFF);
- SET_GLOBAL(15, 0xFFFF);
- SET_GLOBAL(19, 0xFFFF);
- SET_GLOBAL(20, 0xFFFF);
- SET_GLOBAL(21, 0xFFFF);
- SET_GLOBAL(95, 0xFFFF);
-
- // TODO: unknown sub call
-
- // Put the values 0 through 3 in a random ordering in global slots 83 - 86
- for (int idx = 0; idx < 4; ) {
- int randVal = _madsVm->_random->getRandomNumber(4);
- SET_GLOBAL(83 + idx, randVal);
-
- // Check whether the given value has already been used
- bool flag = false;
- for (int idx2 = 0; idx2 < idx; ++idx2) {
- if (randVal == GET_GLOBAL(83 + idx2))
- flag = true;
- }
-
- if (!flag)
- ++idx;
- }
-
- // Put the values 0 through 3 in a random ordering in global slots 87 - 90
- for (int idx = 0; idx < 4; ) {
- int randVal = _madsVm->_random->getRandomNumber(3);
- SET_GLOBAL(87 + idx, randVal);
-
- // Check whether the given value has already been used
- bool flag = false;
- for (int idx2 = 0; idx2 < idx; ++idx2) {
- if (randVal == GET_GLOBAL(87 + idx2))
- flag = true;
- }
-
- if (!flag)
- ++idx;
- }
-
- // Miscellaneous global settings
- SET_GLOBAL(120, 501);
- SET_GLOBAL(121, 0xFFFF);
- SET_GLOBAL(110, 0xFFFF);
- SET_GLOBAL(119, 1);
- SET_GLOBAL(134, 4);
- SET_GLOBAL(190, 201);
- SET_GLOBAL(191, 301);
- SET_GLOBAL(192, 413);
- SET_GLOBAL(193, 706);
- SET_GLOBAL(194, 801);
- SET_GLOBAL(195, 551);
- SET_GLOBAL(196, 752);
-
- // Fill out the globals 200 - 209 with unique random number values less than 10000
- for (int idx = 0; idx < 10; ) {
- int randVal = _madsVm->_random->getRandomNumber(9999);
- SET_GLOBAL(200 + idx, randVal);
-
- // Check whether the given value has already been used
- bool flag = false;
- for (int idx2 = 0; idx2 < idx; ++idx2) {
- if (randVal == GET_GLOBAL(87 + idx2))
- flag = true;
- }
-
- if (!flag)
- ++idx;
- }
-
- switch (_madsVm->globals()->_difficultyLevel) {
- case 1:
- // Very hard
- SET_GLOBAL(35, 0);
- // TODO: object set room
- SET_GLOBAL(137, 5);
- SET_GLOBAL(136, 0);
- break;
-
- case 2:
- // Hard
- SET_GLOBAL(35, 0);
- // TODO: object set room
- SET_GLOBAL(136, 0xFFFF);
- SET_GLOBAL(137, 6);
- break;
-
- case 3:
- // Easy
- SET_GLOBAL(35, 2);
- // TODO: object set room
- break;
- }
-
- _madsVm->_player._direction = 8;
- _madsVm->_player._newDirection = 8;
-
- // TODO: unknown processing routine getting called for 'RXM' and 'ROX'
-}
-
-/*--------------------------------------------------------------------------*/
-
-const char *MadsSceneLogic::subFormatList[] = {"scene%d_enter", "scene%d_step", "scene%d_preaction", "scene%d_actions"};
-
-#define OPSIZE8 0x40 ///< when this bit is set - the operand size is 8 bits
-#define OPSIZE16 0x80 ///< when this bit is set - the operand size is 16 bits
-#define OPMASK 0x3F ///< mask to isolate the opcode
-
-enum Opcodes {
- OP_HALT = 0, OP_IMM = 1, OP_ZERO = 2, OP_ONE = 3, OP_MINUSONE = 4, OP_STR = 5, OP_DLOAD = 6,
- OP_DSTORE = 7, OP_PAL = 8, OP_LOAD = 9, OP_GLOAD = 10, OP_STORE = 11, OP_GSTORE = 12,
- OP_CALL = 13, OP_LIBCALL = 14, OP_RET = 15, OP_ALLOC = 16, OP_JUMP = 17, OP_JMPFALSE = 18,
- OP_JMPTRUE = 19, OP_EQUAL = 20, OP_LESS = 21, OP_LEQUAL = 22, OP_NEQUAL = 23, OP_GEQUAL = 24,
- OP_GREAT = 25, OP_PLUS = 26, OP_MINUS = 27, OP_LOR = 28, OP_MULT = 29, OP_DIV = 30,
- OP_MOD = 31, OP_AND = 32, OP_OR = 33, OP_EOR = 34, OP_LAND = 35, OP_NOT = 36, OP_COMP = 37,
- OP_NEG = 38, OP_DUP = 39,
- TOTAL_OPCODES = 40
-};
-
-const char *MadsSceneLogic::_opcodeStrings[] = {
- "HALT", "IMM", "ZERO", "ONE", "MINUSONE", "STR", "DLOAD", "DSTORE", NULL, "LOAD", "GLOAD",
- "STORE", "GSTORE", "CALL", "LIBCALL", "RET", "ALLOC", "JUMP", "JMPFALSE", "JMPTRUE", "EQUAL",
- "LESS", "LEQUAL", "NEQUAL", "GEQUAL", "GREAT", "PLUS", "MINUS", "LOR", "MULT", "DIV",
- "MOD", "AND", "OR", "EOR", "LAND", "NOT", "COMP", "NEG", "DUP"
-};
-
-/**
- * This method sets up the data map with pointers to all the common game objects. This allows the script engine to
- * convert game specific offsets for various fields in the original game's data segment into a generic data index
- * that will be common across all the MADS games
-
-void MadsSceneLogic::initializeDataMap() {
- // The unique order of these items must be maintained
-}
-*/
-
-uint32 MadsSceneLogic::getDataValue(int dataId) {
- switch (dataId) {
- case 1:
- return _madsVm->scene()->_abortTimersMode2;
- case 2:
- return _madsVm->scene()->_abortTimers;
- case 3:
- return _madsVm->_player._stepEnabled ? 0xffff : 0;
- case 4:
- return _madsVm->scene()->_nextScene;
- case 5:
- return _madsVm->scene()->_previousScene;
- case 6:
- return _madsVm->_player._playerPos.x;
- case 7:
- return _madsVm->_player._playerPos.y;
- case 8:
- return _madsVm->_player._direction;
- case 9:
- return _madsVm->_player._visible ? 0xffff : 0;
- case 10:
- return getActiveAnimationBool();
- case 11:
- return getAnimationCurrentFrame();
- case 12:
- return _madsVm->scene()->_action._inProgress;
- case 13:
- return _madsVm->globals()->_difficultyLevel;
- default:
- // All other data variables get stored in the hash table
- return _madsVm->globals()->_dataMap[dataId];
- break;
- }
-}
-
-void MadsSceneLogic::setDataValue(int dataId, uint16 dataValue) {
- switch (dataId) {
- case 1:
- _madsVm->scene()->_abortTimersMode2 = (AbortTimerMode)dataValue;
- break;
- case 2:
- _madsVm->scene()->_abortTimers = dataValue;
- break;
- case 3:
- _madsVm->_player._stepEnabled = dataValue != 0;
- break;
- case 4:
- _madsVm->scene()->_nextScene = dataValue;
- break;
- case 5:
- _madsVm->scene()->_previousScene = dataValue;
- break;
- case 6:
- _madsVm->_player._playerPos.x = dataValue;
- break;
- case 7:
- _madsVm->_player._playerPos.y = dataValue;
- break;
- case 8:
- _madsVm->_player._direction = dataValue;
- break;
- case 9:
- _madsVm->_player._visible = dataValue != 0;
- break;
- case 10:
- case 11:
- error("Tried to set read only data field %d", dataId);
- break;
- case 12:
- _madsVm->scene()->_action._inProgress = dataValue != 0;
- break;
- case 13:
- _madsVm->globals()->_difficultyLevel = dataValue;
- break;
- default:
- // All other data variables get stored in the hash table
- _madsVm->globals()->_dataMap[dataId] = dataValue;
- break;
- }
-}
-
-const char *MadsSceneLogic::formAnimName(char sepChar, int16 suffixNum) {
- return MADSResourceManager::getResourceName(sepChar, _sceneNumber, EXTTYPE_NONE, NULL, suffixNum);
-}
-
-void MadsSceneLogic::getSceneSpriteSet() {
- char prefix[100];
-
- // Room change sound
- _madsVm->_sound->playSound(5);
-
- // Set up sprite set prefix to use
- if ((_sceneNumber <= 103) || (_sceneNumber == 111)) {
- if (_madsVm->globals()->_globals[0] == SEX_FEMALE)
- strcpy(prefix, "ROX");
- else
- strcpy(prefix, "RXM");
- } else if (_sceneNumber <= 110) {
- strcpy(prefix, "RXSW");
- _madsVm->globals()->_globals[0] = SEX_UNKNOWN;
- } else if (_sceneNumber == 112)
- strcpy(prefix, "");
-
- _madsVm->globals()->playerSpriteChanged = true;
- _madsVm->_player.loadSprites(prefix);
-
-// if ((_sceneNumber == 105) ((_sceneNumber == 109) && (word_84800 != 0)))
-// _madsVm->globals()->playerSpriteChanged = true;
-
- _vm->_palette->setEntry(16, 0x38, 0xFF, 0xFF);
- _vm->_palette->setEntry(17, 0x38, 0xb4, 0xb4);
-}
-
-void MadsSceneLogic::getAnimName() {
- const char *newName = MADSResourceManager::getAAName(
- ((_sceneNumber <= 103) || (_sceneNumber > 111)) ? 0 : 1);
- strcpy(_madsVm->scene()->_aaName, newName);
-}
-
-/*--------------------------------------------------------------------------*/
-
-uint16 MadsSceneLogic::loadSpriteSet(uint16 suffixNum, uint16 sepChar) {
- assert(sepChar < 256);
- const char *resName = formAnimName((char)sepChar, (int16)suffixNum);
- return _madsVm->scene()->loadSceneSpriteSet(resName);
-}
-
-uint16 MadsSceneLogic::startReversibleSpriteSequence(uint16 srcSpriteIdx, bool flipped, int numTicks, int triggerCountdown, int timeoutTicks, int extraTicks) {
- M4Sprite *spriteFrame = _madsVm->scene()->_spriteSlots.getSprite(srcSpriteIdx).getFrame(0);
- uint8 depth = _madsVm->_rails->getDepth(Common::Point(spriteFrame->x + (spriteFrame->width() / 2),
- spriteFrame->y + (spriteFrame->height() / 2)));
-
- return _madsVm->scene()->_sequenceList.add(srcSpriteIdx, flipped, 1, triggerCountdown, timeoutTicks, extraTicks, numTicks, 0, 0,
- true, 100, depth - 1, 1, ANIMTYPE_REVERSIBLE, 0, 0);
-}
-
-uint16 MadsSceneLogic::startCycledSpriteSequence(uint16 srcSpriteIdx, bool flipped, int numTicks, int triggerCountdown, int timeoutTicks, int extraTicks) {
- M4Sprite *spriteFrame = _madsVm->scene()->_spriteSlots.getSprite(srcSpriteIdx).getFrame(0);
- uint8 depth = _madsVm->_rails->getDepth(Common::Point(spriteFrame->x + (spriteFrame->width() / 2),
- spriteFrame->y + (spriteFrame->height() / 2)));
-
- return _madsVm->scene()->_sequenceList.add(srcSpriteIdx, flipped, 1, triggerCountdown, timeoutTicks, extraTicks, numTicks, 0, 0,
- true, 100, depth - 1, 1, ANIMTYPE_CYCLED, 0, 0);
-}
-
-uint16 MadsSceneLogic::startSpriteSequence3(uint16 srcSpriteIdx, bool flipped, int numTicks, int triggerCountdown, int timeoutTicks, int extraTicks) {
- M4Sprite *spriteFrame = _madsVm->scene()->_spriteSlots.getSprite(srcSpriteIdx).getFrame(0);
- uint8 depth = _madsVm->_rails->getDepth(Common::Point(spriteFrame->x + (spriteFrame->width() / 2),
- spriteFrame->y + (spriteFrame->height() / 2)));
-
- return _madsVm->scene()->_sequenceList.add(srcSpriteIdx, flipped, 1, triggerCountdown, timeoutTicks, extraTicks, numTicks, 0, 0,
- true, 100, depth - 1, -1, ANIMTYPE_CYCLED, 0, 0);
-}
-
-void MadsSceneLogic::activateHotspot(int idx, bool active) {
- // TODO:
-}
-
-void MadsSceneLogic::getPlayerSpritesPrefix() {
- _madsVm->_sound->playSound(5);
-
- char oldName[80];
- strcpy(oldName, _madsVm->_player._spritesPrefix);
-
- if ((_madsVm->globals()->_nextSceneId <= 103) || (_madsVm->globals()->_nextSceneId == 111))
- strcpy(_madsVm->_player._spritesPrefix, (_madsVm->globals()->_globals[0] == SEX_FEMALE) ? "ROX" : "RXM");
- else if (_madsVm->globals()->_nextSceneId <= 110)
- strcpy(_madsVm->_player._spritesPrefix, "RXSM");
- else if (_madsVm->globals()->_nextSceneId == 112)
- strcpy(_madsVm->_player._spritesPrefix, "");
-
- if (strcmp(oldName, _madsVm->_player._spritesPrefix) != 0)
- _madsVm->_player._spritesChanged = true;
-
- if ((_madsVm->globals()->_nextSceneId == 105) ||
- ((_madsVm->globals()->_nextSceneId == 109) && (_madsVm->globals()->_globals[15] != 0))) {
- // TODO: unknown flag setting
- _madsVm->_player._spritesChanged = true;
- }
-
- _madsVm->_palette->setEntry(16, 40, 255, 255);
- _madsVm->_palette->setEntry(17, 40, 180, 180);
-
-}
-
-void MadsSceneLogic::getPlayerSpritesPrefix2() {
- _madsVm->_sound->playSound(5);
-
- char oldName[80];
- strcpy(oldName, _madsVm->_player._spritesPrefix);
-
- if ((_madsVm->globals()->_nextSceneId == 213) || (_madsVm->globals()->_nextSceneId == 216))
- strcpy(_madsVm->_player._spritesPrefix, "");
- else if (_madsVm->globals()->_globals[0] == SEX_MALE)
- strcpy(_madsVm->_player._spritesPrefix, "RXM");
- else
- strcpy(_madsVm->_player._spritesPrefix, "ROX");
-
- // TODO: unknown flag setting for next scene Id > 212
-
- if (strcmp(oldName, _madsVm->_player._spritesPrefix) != 0)
- _madsVm->_player._spritesChanged = true;
-
-/* if ((_madsVm->globals()->_nextSceneId == 203) && (_madsVm->globals()->_nextSceneId == 204) &&
- (_madsVm->globals()->_globals[0x22] == 0))
- // TODO: unknown flag set
-*/
- _madsVm->_palette->setEntry(16, 40, 255, 255);
- _madsVm->_palette->setEntry(17, 40, 180, 180);
-}
-
-
-/*--------------------------------------------------------------------------*/
-
-/**
- * Loads the MADS.DAT file and loads the script data for the correct game/language
- */
-void MadsSceneLogic::initializeScripts() {
- Common::File f;
- if (!f.open("mads.dat")) {
- warning("Could not locate mads.dat file");
- return;
- }
-
- // Validate that the file being read is a valid mads.dat file
- char header[4];
- f.read(&header[0], 4);
- if (strncmp(header, "MADS", 4) != 0) {
- warning("Invalid mads.dat file");
- return;
- }
-
- // Get a list of the offsets of game blocks
- uint32 v;
- Common::Array<uint32> offsets;
- while ((v = f.readUint32LE()) != 0)
- offsets.push_back(v);
-
- // Check the header of each block in turn
- _scriptsData = NULL;
- _scriptsSize = 0;
-
- for (uint i = 0; i < offsets.size(); ++i) {
- // Get the block header
- f.seek(offsets[i]);
- byte gameId = f.readByte();
- byte language = f.readByte();
- f.readByte(); // Language currently unused
-
- // If this block isn't for the current game, skip it
- if (_madsVm->getGameType() != (gameId + 2))
- continue;
- if ((language != 1) || (_madsVm->getLanguage() != Common::EN_ANY))
- continue;
-
- // Found script block for the given game and language.
- _scriptsSize = (i < (offsets.size() - 1)) ? offsets[i + 1] - offsets[i] : f.size() - offsets[i];
- break;
- }
-
- if (!_scriptsSize) {
- warning("Could not find appropriate scripts block for game in mads.dat file");
- f.close();
- return;
- }
-
- // Load up the list of subroutines into a hash map
- uint32 blockOffset = f.pos() - 3;
- uint32 subsStart = 0;
- for (;;) {
- // Get next entry
- Common::String subName;
- char c;
- while ((c = (char)f.readByte()) != '\0')
- subName += c;
- if (subName.empty())
- // Reached end of subroutine list
- break;
-
- // Read in the offset of the routine
- uint32 offset = f.readUint32LE();
- if (_subroutines.empty()) {
- // The first subroutine offset is used to reduce the amount of data to later load in. In essence,
- // the subroutine index will not be separately loaded, since it's contents will be in the hash map
- subsStart = offset;
- _scriptsSize -= offset;
- }
-
- _subroutines[subName] = offset - subsStart;
- _subroutineOffsets.push_back(offset - subsStart);
- }
-
- // Read in the remaining data
- f.seek(blockOffset + subsStart, SEEK_SET);
- _scriptsData = (byte *)malloc(_scriptsSize);
- f.read(_scriptsData, _scriptsSize);
-
- f.close();
-}
-
-void MadsSceneLogic::selectScene(int sceneNum) {
- assert(sceneNum == 101);
- _sceneNumber = sceneNum;
-
- Common::set_to(&_spriteIndexes[0], &_spriteIndexes[50], 0);
-
- // If debugging is turned on, show a debug warning if any of the scene methods aren't present
- if (gDebugLevel > 0) {
- for (int i = 0; i < 4; ++i) {
- char buffer[20];
- sprintf(buffer, subFormatList[i], sceneNum);
- Common::HashMap<Common::String, uint32>::iterator it = _subroutines.find(Common::String(buffer));
- if (it == _subroutines.end())
- debugC(1, kDebugScript, "Scene method %s not found", buffer);
- }
- }
-}
-
-void MadsSceneLogic::setupScene() {
- // FIXME: This is the hardcoded logic for Rex scene 101 only
- const char *animName = formAnimName('A', -1);
- warning("anim - %s", animName);
-
-// sub_1e754(animName, 3);
-
- if ((_sceneNumber >= 101) && (_sceneNumber <= 112))
- getPlayerSpritesPrefix();
- else
- getPlayerSpritesPrefix2();
-
- getAnimName();
-}
-
-/**
- * Handles the logic when a scene is entered
- */
-void MadsSceneLogic::doEnterScene() {
- char buffer[20];
- sprintf(buffer, subFormatList[SUBFORMAT_ENTER], _sceneNumber);
- execute(Common::String(buffer));
-}
-
-/**
- * Handles the script execution which is called regularly every frame
- */
-void MadsSceneLogic::doSceneStep() {
- char buffer[20];
- sprintf(buffer, subFormatList[SUBFORMAT_STEP], _sceneNumber);
- execute(Common::String(buffer));
-}
-
-/**
- * Handles and preactions before an action is started
- */
-void MadsSceneLogic::doPreactions() {
- char buffer[20];
- sprintf(buffer, subFormatList[SUBFORMAT_PREACTIONS], _sceneNumber);
- execute(Common::String(buffer));
-}
-
-/**
- * Handles any action that has been selected
- */
-void MadsSceneLogic::doAction() {
- char buffer[20];
- sprintf(buffer, subFormatList[SUBFORMAT_ACTIONS], _sceneNumber);
- execute(Common::String(buffer));
-}
-
-/**
- * Executes the script with the specified name
- */
-void MadsSceneLogic::execute(const Common::String &scriptName) {
- Common::HashMap<Common::String, uint32>::iterator it = _subroutines.find(scriptName);
- if (it != _subroutines.end())
- execute(it->_value);
-}
-
-#define UNUSED_VAL 0xEAEAEAEA
-/**
- * Executes the script at the specified offset
- */
-void MadsSceneLogic::execute(uint32 subOffset) {
- Common::Array<ScriptVar> locals;
- Common::Stack<ScriptVar> stack;
- char opcodeBuffer[100];
- uint32 scriptOffset = subOffset;
- uint32 param;
-
- debugC(1, kDebugScript, "executing script at %xh", subOffset);
-
- bool done = false;
- while (!done) {
- param = UNUSED_VAL;
- byte opcode = _scriptsData[scriptOffset++];
- sprintf(opcodeBuffer, "%.4x[%.2d] - %s", scriptOffset - 1, stack.size(), _opcodeStrings[opcode & OPMASK]);
-
- switch (opcode & OPMASK) {
- case OP_HALT: // end of program
- case OP_RET:
- done = true;
- break;
-
- case OP_IMM: // Loads immediate value onto stack
- param = getParam(scriptOffset, opcode);
- stack.push(ScriptVar(param));
- break;
-
- case OP_ZERO: // loads zero onto stack
- stack.push(ScriptVar((uint32)0));
- break;
-
- case OP_ONE: // loads one onto stack
- stack.push(ScriptVar(1));
- break;
-
- case OP_MINUSONE: // loads minus one (0xffff) onto stack
- stack.push(ScriptVar(0xffff));
- break;
-
- case OP_DLOAD: { // Gets data variable
- param = getParam(scriptOffset, opcode);
- uint16 v = getDataValue(param);
- stack.push(ScriptVar(v));
- break;
- }
-
- case OP_DSTORE: { // Stores data variable
- param = getParam(scriptOffset, opcode);
- ScriptVar v = stack.pop();
- setDataValue(param, v.isInt() ? v.get() : 0);
- break;
- }
-
- case OP_LOAD: // loads local variable onto stack
- param = getParam(scriptOffset, opcode);
- stack.push(locals[param]);
- break;
-
- case OP_STORE: // Pops a value and stores it in a local
- // Get the local index and expand the locals store if necessary
- param = getParam(scriptOffset, opcode);
- while (param >= locals.size())
- locals.push_back(ScriptVar());
-
- locals[param] = stack.pop();
- break;
-
- case OP_GLOAD: // loads global variable onto stack
- param = getParam(scriptOffset, opcode);
- assert(param < TOTAL_NUM_VARIABLES);
- stack.push(_madsVm->globals()->_globals[param]);
- break;
-
- case OP_GSTORE: // pops stack and stores in global variable
- param = getParam(scriptOffset, opcode);
- assert(param < TOTAL_NUM_VARIABLES);
- _madsVm->globals()->_globals[param] = stack.pop().get();
- break;
-
- case OP_CALL: // procedure call
- param = getParam(scriptOffset, opcode);
- assert(param < _subroutineOffsets.size());
- execute(_subroutineOffsets[param]);
- break;
-
- case OP_LIBCALL: // library procedure or function call
- param = getParam(scriptOffset, opcode);
- callSubroutine(param, stack);
- break;
-
- case OP_JUMP: // unconditional jump
- param = subOffset + getParam(scriptOffset, opcode);
- scriptOffset = param;
- break;
-
- case OP_JMPFALSE: // conditional jump
- param = subOffset + getParam(scriptOffset, opcode);
- if (stack.pop().get() == 0)
- // Condition satisfied - do the jump
- scriptOffset = param;
- break;
-
- case OP_JMPTRUE: // conditional jump
- param = subOffset + getParam(scriptOffset, opcode);
- if (stack.pop().get() != 0)
- // Condition satisfied - do the jump
- scriptOffset = param;
- break;
-
- case OP_EQUAL: // tests top two items on stack for equality
- case OP_LESS: // tests top two items on stack
- case OP_LEQUAL: // tests top two items on stack
- case OP_NEQUAL: // tests top two items on stack
- case OP_GEQUAL: // tests top two items on stack
- case OP_GREAT: // tests top two items on stack
- case OP_LOR: // logical or of top two items on stack and replaces with result
- case OP_LAND: // logical ands top two items on stack and replaces with result
- {
- uint32 param2 = stack.pop().get();
- uint32 param1 = stack.pop().get();
-
- // Do the comparison
- uint32 tmp = 0;
- switch (opcode) {
- case OP_EQUAL: tmp = (param1 == param2); break;
- case OP_LESS: tmp = (param1 < param2); break;
- case OP_LEQUAL: tmp = (param1 <= param2); break;
- case OP_NEQUAL: tmp = (param1 != param2); break;
- case OP_GEQUAL: tmp = (param1 >= param2); break;
- case OP_GREAT: tmp = (param1 > param2); break;
-
- case OP_LOR: tmp = (param1 || param2); break;
- case OP_LAND: tmp = (param1 && param2); break;
- }
-
- stack.push(ScriptVar(tmp));
- }
- break;
-
- case OP_PLUS: // adds top two items on stack and replaces with result
- case OP_MINUS: // subs top two items on stack and replaces with result
- case OP_MULT: // multiplies top two items on stack and replaces with result
- case OP_DIV: // divides top two items on stack and replaces with result
- case OP_MOD: // divides top two items on stack and replaces with modulus
- case OP_AND: // bitwise ands top two items on stack and replaces with result
- case OP_OR: // bitwise ors top two items on stack and replaces with result
- case OP_EOR: // bitwise exclusive ors top two items on stack and replaces with result
- {
- uint32 param2 = stack.pop().get();
- uint32 param1 = stack.pop().get();
-
- // replace other operand with result of operation
- switch (opcode) {
- case OP_PLUS: param1 += param2; break;
- case OP_MINUS: param1 -= param2; break;
- case OP_MULT: param1 *= param2; break;
- case OP_DIV: param1 /= param2; break;
- case OP_MOD: param1 %= param2; break;
- case OP_AND: param1 &= param2; break;
- case OP_OR: param1 |= param2; break;
- case OP_EOR: param1 ^= param2; break;
- }
-
- stack.push(ScriptVar(param1));
- }
- break;
-
- case OP_NOT: // logical nots top item on stack
- param = stack.pop().get();
- stack.push(ScriptVar((uint32)(!param) & 0xffff));
- break;
-
- case OP_COMP: // complements top item on stack
- param = stack.pop().get();
- stack.push(ScriptVar((~param) & 0xffff));
- break;
-
- case OP_NEG: // negates top item on stack
- param = stack.pop().get();
- stack.push(ScriptVar(((uint32)-(int32)param) & 0xffff));
- break;
-
- case OP_DUP: // duplicates top item on stack
- stack.push(stack.top());
- break;
-
- default:
- error("execute() - Unknown opcode");
- }
-
- // check for stack size
- assert(stack.size() < 100);
-
- if (gDebugLevel > 0) {
- if (param != UNUSED_VAL)
- sprintf(opcodeBuffer + strlen(opcodeBuffer), "\t%d", param);
- debugC(2, kDebugScript, "%s", opcodeBuffer);
- }
- }
-
- debugC(1, kDebugScript, "finished executing script");
-
- // make sure stack is unwound
- assert(stack.size() == 0);
-}
-
-uint32 MadsSceneLogic::getParam(uint32 &scriptOffset, int opcode) {
- switch (opcode & (~OPMASK)) {
- case OPSIZE8:
- return _scriptsData[scriptOffset++];
- case OPSIZE16: {
- uint16 v = READ_LE_UINT16(&_scriptsData[scriptOffset]);
- scriptOffset += sizeof(uint16);
- return v;
- }
- default: {
- uint32 v = READ_LE_UINT32(&_scriptsData[scriptOffset]);
- scriptOffset += sizeof(uint32);
- return v;
- }
- }
-}
-
-/**
- * Support method for extracting the required number of parameters needed for a library routine call
- */
-void MadsSceneLogic::getCallParameters(int numParams, Common::Stack<ScriptVar> &stack, ScriptVar *callParams) {
- assert(numParams <= MAX_CALL_PARAMS);
- for (int i = 0; i < numParams; ++i, ++callParams)
- *callParams = stack.pop();
-}
-
-#define EXTRACT_PARAMS(n) getCallParameters(n, stack, p)
-
-void MadsSceneLogic::callSubroutine(int subIndex, Common::Stack<ScriptVar> &stack) {
- ScriptVar p[MAX_CALL_PARAMS];
-
- switch (subIndex) {
- case 1: {
- // dialog_show
- EXTRACT_PARAMS(1);
- Dialog *dlg = new Dialog(_vm, p[0].getStr(), "TODO: Proper Title");
- _vm->_viewManager->addView(dlg);
- _vm->_viewManager->moveToFront(dlg);
- break;
- }
-
- case 2:
- // SequenceList_remove
- EXTRACT_PARAMS(1);
- _madsVm->scene()->_sequenceList.remove(p[0]);
- break;
-
- case 3:
- case 6:
- case 20: {
- // 3: start_reversible_sprite_sequence
- // 6: start_cycled_sprite_sequence
- // 20: start_sprite_sequence3
- EXTRACT_PARAMS(6);
- int idx;
- if (subIndex == 3)
- idx = startReversibleSpriteSequence(p[0], p[1] != 0, p[2], p[3], p[4], p[5]);
- else if (subIndex == 6)
- idx = startCycledSpriteSequence(p[0], p[1], p[2], p[3], p[4], p[5]);
- else
- idx = startSpriteSequence3(p[0], p[1] != 0, p[2], p[3], p[4], p[5]);
- stack.push(ScriptVar(idx));
- break;
- }
-
- case 4:
- // SequenceList_setAnimRange
- EXTRACT_PARAMS(3);
- _madsVm->scene()->_sequenceList.setAnimRange(p[0], p[1], p[2]);
- break;
-
- case 5:
- // SequenceList_addSubEntry
- EXTRACT_PARAMS(4);
- stack.push(ScriptVar(_madsVm->scene()->_sequenceList.addSubEntry(p[0], (SequenceSubEntryMode)p[1].get(), p[2], p[3])));
- break;
-
- case 7: {
- // quotes_get_pointer
- EXTRACT_PARAMS(1);
- const char *quoteStr = _madsVm->globals()->getQuote(p[0]);
- stack.push(ScriptVar(quoteStr));
- break;
- }
-
- case 8: {
- // KernelMessageList_add
- EXTRACT_PARAMS(8);
- int msgIndex = _madsVm->scene()->_kernelMessages.add(Common::Point(p[0], p[1]), p[2],
- p[3], p[4], p[5] | (p[6] << 16), p[7].getStr());
- stack.push(ScriptVar(msgIndex));
- break;
- }
-
- case 9:
- // SequenceList_unk3
- EXTRACT_PARAMS(1);
- // TODO: Implement unk3 method
-// stack.push(ScriptVar(_madsVm->scene()->_sequenceList.unk3(p[0])));
- break;
-
- case 10:
- // start_sound
- EXTRACT_PARAMS(1);
- _madsVm->_sound->playSound(p[0]);
- break;
-
- case 11:
- // SceneLogic_formAnimName
- EXTRACT_PARAMS(2);
- stack.push(ScriptVar(formAnimName((char)p[0], p[1])));
- break;
-
- case 12:
- // SpriteList_addSprites
- EXTRACT_PARAMS(2);
- stack.push(ScriptVar(_madsVm->scene()->_spriteSlots.addSprites(p[0].getStr(), false, p[1])));
- break;
-
- case 13:
- // hotspot_activate
- EXTRACT_PARAMS(2);
- // TODO: Implement setActive version that takes in a hotspot Id
-// _madsVm->scene()->getSceneResources().hotspots->setActive(p[0], p[1] != 0);
- break;
-
- case 14: {
- // DynamicHotspots_add
- EXTRACT_PARAMS(7);
- int idx = _madsVm->scene()->_dynamicHotspots.add(p[0], p[1], p[2],
- Common::Rect(p[6], p[5], p[6] + p[4], p[5] + p[3]));
- stack.push(ScriptVar(idx));
- break;
- }
-
- case 15:
- // SequenceList_setDepth
- EXTRACT_PARAMS(2);
- _madsVm->scene()->_sequenceList.setDepth(p[0], p[1]);
- break;
-
- case 16: {
- // quotes_load
- // Quotes loading can take an arbitrary number of quote Ids, terminated by a 0
- int firstId = -1;
- int quoteId;
- while ((quoteId = stack.pop()) != 0) {
- if (firstId == -1)
- firstId = quoteId;
- _madsVm->globals()->loadQuote(quoteId);
- }
-
- if (firstId != -1)
- stack.push(ScriptVar(_madsVm->globals()->getQuote(firstId)));
- break;
- }
-
- case 17: {
- // form_resource_name
- EXTRACT_PARAMS(4);
- const char *suffix = NULL;
- if (p[4].isInt()) {
- // If integer provided for suffix, it must be a value of 0 (NULL)
- uint32 vTemp = p[4] | stack.pop();
- assert(!vTemp);
- } else
- suffix = p[4].getStr();
-
- stack.push(ScriptVar(MADSResourceManager::getResourceName((char)p[1], p[0], (ExtensionType)p[3].get(),
- suffix, (int16)p[2])));
- break;
- }
-
- case 18:
- // MadsScene_loadAnimation
- EXTRACT_PARAMS(3);
- _madsVm->scene()->loadAnimation(p[1].getStr(), p[0]);
- break;
-
- case 19: {
- // Action_isAction
- int verbId = stack.pop();
- int objectNameId = (verbId == 0) ? 0 : stack.pop().get();
- int indirectObjectId = (objectNameId == 0) ? 0 : stack.pop().get();
-
- stack.push(ScriptVar(_madsVm->scene()->_action.isAction(verbId, objectNameId, indirectObjectId)));
- break;
- }
-
- case 21:
- // DynamicHotspots_remove
- EXTRACT_PARAMS(1);
- _madsVm->scene()->_dynamicHotspots.remove(p[0]);
- break;
-
- case 22: {
- // object_is_present
- EXTRACT_PARAMS(1);
- const MadsObject *obj = _madsVm->globals()->getObject(p[0]);
- stack.push(ScriptVar((obj->_roomNumber == _madsVm->scene()->_currentScene)));
- break;
- }
-
- case 23:
- // inventory_add
- EXTRACT_PARAMS(1);
- _madsVm->scene()->getInterface()->addObjectToInventory(p[0]);
- break;
-
- case 24: {
- // dialog_picture_show
- EXTRACT_PARAMS(3);
- int messageId = p[0] | (p[1] << 16);
- int objectNum = p[2];
- warning("TODO: Implement dialog with picture. MessageId=%d, objectNum=%d", messageId, objectNum);
- break;
- }
-
- case 25: {
- // object_is_in_inventory
- EXTRACT_PARAMS(1);
- const MadsObject *obj = _madsVm->globals()->getObject(p[0]);
- stack.push(ScriptVar(obj->isInInventory()));
- break;
- }
-
- case 26: {
- // object_set_room
- EXTRACT_PARAMS(2);
- MadsObject *obj = _madsVm->globals()->getObject(p[0]);
- obj->setRoom(p[1]);
- break;
- }
-
- case 27: {
- // object_get_id_from_desc
- EXTRACT_PARAMS(1);
- stack.push(_madsVm->globals()->getObjectIndex(p[0]));
- break;
- }
-
- case 28: {
- // object_get_folder
- EXTRACT_PARAMS(1);
- stack.push(_madsVm->globals()->getObjectFolder(p[0]));
- break;
- }
-
- case 29:
- // inventory_remove
- EXTRACT_PARAMS(1);
- _madsVm->scene()->getInterface()->addObjectToInventory(p[0]);
- break;
-
- case 30:
- // image_inter_list_call
- EXTRACT_PARAMS(1);
- warning("TODO: image_inter_list_call");
- break;
-
- case 31:
- // dialog_flags_show
- warning("todo: dialog_flags_show");
- break;
-
- default:
- error("Unknown subroutine %d called", subIndex);
- break;
- }
-}
-
-#undef EXTRACT_PARAMS
-
-}
diff --git a/engines/m4/mads_logic.h b/engines/m4/mads_logic.h
deleted file mode 100644
index 4f0b0d5ba2..0000000000
--- a/engines/m4/mads_logic.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* 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 MADS game logic is all hard-coded into the games, although for Rex at least
- * it seems to use only a fairly basic set of instructions and function calls, so it should be
- * possible
- */
-
-#ifndef M4_MADS_LOGIC_H
-#define M4_MADS_LOGIC_H
-
-#include "common/hashmap.h"
-#include "common/hash-str.h"
-#include "common/stack.h"
-#include "m4/mads_views.h"
-
-namespace M4 {
-
-union ScriptVarValue {
- const char *strValue;
- uint32 intValue;
-};
-
-/**
- * Specifies a script variable that either be a 32-bit unsigned integer or a string pointer
- */
-class ScriptVar {
-private:
- ScriptVarValue _value;
- bool _isInt;
-public:
- ScriptVar(uint32 v = 0) { _value.intValue = v; _isInt = true; }
- ScriptVar(const char *s) { _value.strValue = s; _isInt = false; }
-
- void set(uint32 v) { _value.intValue = v; _isInt = true; }
- void set(const char *s) { _value.strValue = s; _isInt = false; }
- const char *getStr() const { assert(!_isInt); return _value.strValue; }
- uint32 get() const { assert(_isInt); return _value.intValue; }
- bool isInt() const { return _isInt; }
-
- operator int() { return get(); }
-};
-
-class MadsSceneLogic {
-private:
- // Library interface methods
- uint16 loadSpriteSet(uint16 suffixNum, uint16 sepChar);
- uint16 startReversibleSpriteSequence(uint16 srcSpriteIdx, bool flipped, int numTicks, int triggerCountdown, int timeoutTicks, int extraTicks);
- uint16 startCycledSpriteSequence(uint16 srcSpriteIdx, bool flipped, int numTicks, int triggerCountdown, int timeoutTicks, int extraTicks);
- uint16 startSpriteSequence3(uint16 srcSpriteIdx, bool flipped, int numTicks, int triggerCountdown, int timeoutTicks, int extraTicks);
- void activateHotspot(int idx, bool active);
- void getPlayerSpritesPrefix();
- void getPlayerSpritesPrefix2();
-private:
- int _sceneNumber;
- int16 _spriteIndexes[50];
- byte *_scriptsData;
- int _scriptsSize;
- Common::HashMap<Common::String, uint32> _subroutines;
- Common::Array<uint32> _subroutineOffsets;
-
- enum SubFormatIndex {SUBFORMAT_ENTER, SUBFORMAT_STEP, SUBFORMAT_PREACTIONS, SUBFORMAT_ACTIONS};
- static const char *subFormatList[];
- static const char *_opcodeStrings[];
-
- // Support functions
- const char *formAnimName(char sepChar, int16 suffixNum);
- void getSceneSpriteSet();
- void getAnimName();
-
- uint32 getDataValue(int dataId);
- void setDataValue(int dataId, uint16 dataValue);
- void getCallParameters(int numParams, Common::Stack<ScriptVar> &stack, ScriptVar *callParams);
-public:
- MadsSceneLogic() { _scriptsData = NULL; }
- ~MadsSceneLogic() { delete _scriptsData; }
-
- void initializeScripts();
- void selectScene(int sceneNum);
-
- void setupScene();
- void doEnterScene();
- void doPreactions();
- void doAction();
- void doSceneStep();
-
- void execute(const Common::String &scriptName);
- void execute(uint32 scriptOffset);
- uint32 getParam(uint32 &scriptOffset, int opcode);
- void callSubroutine(int subIndex, Common::Stack<ScriptVar> &stack);
-};
-
-class MadsGameLogic {
-public:
- static void initializeGlobals();
-};
-
-}
-
-#endif
diff --git a/engines/m4/mads_menus.cpp b/engines/m4/mads_menus.cpp
deleted file mode 100644
index 8a2ab67f11..0000000000
--- a/engines/m4/mads_menus.cpp
+++ /dev/null
@@ -1,1173 +0,0 @@
-/* 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/textconsole.h"
-
-#include "m4/mads_menus.h"
-#include "m4/m4.h"
-
-namespace M4 {
-
-#define REX_MENUSCREEN 990
-#define PHANTOM_MENUSCREEN 920
-#define DRAGON_MENUSCREEN 922
-
-#define DRAGON_MENU_BUTTON_W = 45
-#define DRAGON_MENU_BUTTON_H = 11
-
-RexMainMenuView::RexMainMenuView(MadsM4Engine *vm):
- View(vm, Common::Rect(0, 0, vm->_screen->width(), vm->_screen->height())) {
-
- _screenType = VIEWID_MAINMENU;
- _screenFlags.get = SCREVENT_ALL;
-
- _delayTimeout = 0;
- _menuItem = NULL;
- _menuItemIndex = 0;
- _frameIndex = 0;
- _highlightedIndex = -1;
- _skipFlag = false;
-
- // Load the background for the Rex Nebular game
- _bgSurface = new M4Surface();
- _bgSurface->loadBackground(REX_MENUSCREEN, &_bgPalData);
- _vm->_palette->addRange(_bgPalData);
- _bgSurface->translate(_bgPalData);
-
- int row = (height() - MADS_SURFACE_HEIGHT) / 2;
- _bgSurface->copyTo(this, 0, row);
-
- // Add in the bounding lines for the background
- setColor(2);
- hLine(0, width() - 1, row - 1);
- hLine(0, width() - 1, height() - row + 1);
-
- // Set up the menu item pos list
- _menuItemPosList[0] = Common::Point(12, 68);
- _menuItemPosList[1] = Common::Point(12, 87);
- _menuItemPosList[2] = Common::Point(12, 107);
- _menuItemPosList[3] = Common::Point(184, 75);
- _menuItemPosList[4] = Common::Point(245, 75);
- _menuItemPosList[5] = Common::Point(184, 99);
-}
-
-RexMainMenuView::~RexMainMenuView() {
- delete _menuItem;
-
- _vm->_palette->deleteRange(_bgPalData);
-
- delete _bgPalData;
- delete _bgSurface;
-
- for (uint i = 0; i < _itemPalData.size(); ++i) {
- _vm->_palette->deleteRange(_itemPalData[i]);
- delete _itemPalData[i];
- }
-}
-
-bool RexMainMenuView::onEvent(M4EventType eventType, int32 param, int x, int y, bool &captureEvents) {
- // Handle keypresses - these can be done at any time, even when the menu items are being drawn
- if (eventType == KEVENT_KEY) {
- switch (param) {
- case Common::KEYCODE_ESCAPE:
- case Common::KEYCODE_F6:
- handleAction(EXIT);
- break;
-
- case Common::KEYCODE_F1:
- handleAction(START_GAME);
- break;
-
- case Common::KEYCODE_F2:
- handleAction(RESUME_GAME);
- break;
-
- case Common::KEYCODE_F3:
- handleAction(SHOW_INTRO);
- break;
-
- case Common::KEYCODE_F4:
- handleAction(CREDITS);
- break;
-
- case Common::KEYCODE_F5:
- handleAction(QUOTES);
- break;
-
- case Common::KEYCODE_s:
- // Goodness knows why, but Rex has a key to restart the menuitem animations
-
- // Delete the current menu items
- delete _menuItem;
-
- _vm->_palette->deleteRange(_bgPalData);
- delete _bgPalData;
- for (uint i = 0; i < _itemPalData.size(); ++i) {
- _vm->_palette->deleteRange(_itemPalData[i]);
- delete _itemPalData[i];
- }
- _itemPalData.clear();
-
- // Reload the background surface, and restart the animation
- _bgSurface->loadBackground(REX_MENUSCREEN, &_bgPalData);
- _vm->_palette->addRange(_bgPalData);
- _bgSurface->translate(_bgPalData);
-
- _menuItemIndex = 0;
- _skipFlag = false;
- _menuItem = NULL;
- _vm->_mouse->cursorOff();
- break;
-
- default:
- // Any other key skips the menu animation
- _skipFlag = true;
- return false;
- }
-
- return true;
- }
-
- int row = (height() - MADS_SURFACE_HEIGHT) / 2;
- int menuIndex;
-
- switch (eventType) {
- case MEVENT_LEFT_CLICK:
- case MEVENT_LEFT_DRAG:
- if (_vm->_mouse->getCursorOn()) {
- menuIndex = getHighlightedItem(x, y);
- if (menuIndex != _highlightedIndex) {
- _bgSurface->copyTo(this, 0, row);
-
- _highlightedIndex = menuIndex;
- if (_highlightedIndex != -1) {
- M4Sprite *spr = _menuItem->getFrame(_highlightedIndex);
- const Common::Point &pt = _menuItemPosList[_highlightedIndex];
- spr->copyTo(this, pt.x, row + pt.y, spr->getTransparencyIndex());
- }
- }
- } else {
- // Skip the menu animation
- _skipFlag = true;
- }
- return true;
-
- case MEVENT_LEFT_RELEASE:
- if (_highlightedIndex != -1)
- handleAction((MadsGameAction) _highlightedIndex);
- return true;
-
- default:
- break;
- }
-
- return false;
-}
-
-void RexMainMenuView::updateState() {
- char resName[20];
- Common::SeekableReadStream *data;
- int row = (height() - MADS_SURFACE_HEIGHT) / 2;
- int itemSize;
-
- uint32 currTime = g_system->getMillis();
- if (currTime < _delayTimeout)
- return;
- _delayTimeout = currTime + MADS_MENU_ANIM_DELAY;
-
- // Rex Nebular handling to cycle through the animated display of the menu items
- if (_menuItemIndex == 7)
- return;
-
- // If the user has chosen to skip the menu animation, show the menu immediately
- if (_skipFlag && !_vm->_mouse->getCursorOn()) {
- // Clear any pending animation
- _bgSurface->copyTo(this, 0, row);
- // Quickly loop through all the menuitems to display each's final frame
- while (_menuItemIndex < 7) {
-
- if (_menuItem) {
- // Draw the final frame of the menuitem
- M4Sprite *spr = _menuItem->getFrame(0);
- itemSize = _menuItem->getFrame(0)->height();
- spr->copyTo(this, _menuItemPosList[_menuItemIndex - 1].x,
- _menuItemPosList[_menuItemIndex - 1].y + row + (itemSize / 2) - (spr->height() / 2),
- spr->getTransparencyIndex());
-
- delete _menuItem;
- copyTo(_bgSurface, Common::Rect(0, row, width(), row + MADS_SURFACE_HEIGHT), 0, 0,
- spr->getTransparencyIndex());
- }
-
- // Get the next sprite set
- sprintf(resName, "RM%dA%d.SS", REX_MENUSCREEN, ++_menuItemIndex);
- data = _vm->res()->get(resName);
- _menuItem = new SpriteAsset(_vm, data, data->size(), resName);
- _vm->res()->toss(resName);
-
- // Slot it into available palette space
- RGBList *palData = _menuItem->getRgbList();
- _vm->_palette->addRange(palData);
- _menuItem->translate(palData, true);
- _itemPalData.push_back(palData);
- }
-
- _vm->_mouse->cursorOn();
- return;
- }
-
- if ((_menuItemIndex == 0) || (_frameIndex == 0)) {
- // Get the next menu item
- if (_menuItem) {
- delete _menuItem;
-
- // Copy over the current display surface area to the background, so the final frame
- // of the previous menuitem should be kept on the screen
- copyTo(_bgSurface, Common::Rect(0, row, width(), row + MADS_SURFACE_HEIGHT), 0, 0);
- }
-
- // Get the next menuitem resource
- sprintf(resName, "RM%dA%d.SS", REX_MENUSCREEN, ++_menuItemIndex);
- data = _vm->res()->get(resName);
- _menuItem = new SpriteAsset(_vm, data, data->size(), resName);
- _vm->res()->toss(resName);
-
- // Slot it into available palette space
- RGBList *palData = _menuItem->getRgbList();
- _vm->_palette->addRange(palData);
- _menuItem->translate(palData, true);
- _itemPalData.push_back(palData);
-
- _frameIndex = _menuItem->getCount() - 1;
-
- // If the final resource is now loaded, which contains the highlighted versions of
- // each menuitem, then the startup animation is complete
- if (_menuItemIndex == 7) {
- _vm->_mouse->cursorOn();
- return;
- }
- } else {
- --_frameIndex;
- }
-
- // Move to the next menuitem frame
-
- itemSize = _menuItem->getFrame(0)->height();
-
- _bgSurface->copyTo(this, 0, row);
- M4Sprite *spr = _menuItem->getFrame(_frameIndex);
- spr->copyTo(this, _menuItemPosList[_menuItemIndex - 1].x, _menuItemPosList[_menuItemIndex - 1].y +
- row + (itemSize / 2) - (spr->height() / 2), spr->getTransparencyIndex());
-}
-
-int RexMainMenuView::getHighlightedItem(int x, int y) {
- y -= (height() - MADS_SURFACE_HEIGHT) / 2;
-
- for (int index = 0; index < 6; ++index) {
- const Common::Point &pt = _menuItemPosList[index];
- M4Sprite *spr = _menuItem->getFrame(index);
-
- if ((x >= pt.x) && (y >= pt.y) && (x < (pt.x + spr->width())) && (y < (pt.y + spr->height())))
- return index;
- }
-
- return -1;
-}
-
-void RexMainMenuView::handleAction(MadsGameAction action) {
- MadsEngine *vm = (MadsEngine *)_vm;
- vm->_mouse->cursorOff();
- vm->_viewManager->deleteView(this);
-
- switch (action) {
- case START_GAME:
- case RESUME_GAME:
- // Load a sample starting scene - note that, currently, calling loadScene automatically
- // removes this menu screen from being displayed
- vm->_mouse->cursorOn();
- vm->startScene(101);
- return;
-
- case SHOW_INTRO:
- vm->_viewManager->showAnimView("@rexopen");
- break;
-
- case CREDITS:
- vm->_viewManager->showTextView("credits");
- return;
-
- case QUOTES:
- vm->_viewManager->showTextView("quotes");
- return;
-
- case EXIT:
- {
- // When the Exit action is done from the menu, show one of two possible advertisements
-
- // Activate the scene display with the specified scene
- bool altAdvert = vm->_random->getRandomNumber(1000) >= 500;
- vm->startScene(altAdvert ? 995 : 996);
- vm->_viewManager->addView(vm->_scene);
-
- vm->_viewManager->refreshAll();
- vm->delay(10000);
-
- vm->_events->quitFlag = true;
- return;
- }
- break;
- default:
- break;
- }
-}
-
-//--------------------------------------------------------------------------
-
-MadsMainMenuView::MadsMainMenuView(MadsM4Engine *vm):
- View(vm, Common::Rect(0, 0, vm->_screen->width(), vm->_screen->height())) {
-
-}
-
-bool MadsMainMenuView::onEvent(M4EventType eventType, int32 param, int x, int y, bool &captureEvents) {
- return false;
-}
-
-void MadsMainMenuView::updateState() {
- // TODO: Implement me
-}
-
-//--------------------------------------------------------------------------
-
-DragonMainMenuView::DragonMainMenuView(MadsM4Engine *vm):
- View(vm, Common::Rect(0, 0, vm->_screen->width(), vm->_screen->height())) {
-
- _screenType = VIEWID_MAINMENU;
- _screenFlags.get = SCREVENT_ALL;
-
- _delayTimeout = 0;
- _menuItem = NULL;
- _menuItemIndex = 0;
- _frameIndex = 0;
- _highlightedIndex = -1;
- _skipFlag = false;
-
- // Load the background for the Dragonsphere game
- this->loadBackground(942, &_bgPalData);
- _vm->_palette->addRange(_bgPalData);
- this->translate(_bgPalData);
-
- // Set up the menu item pos list
- _menuItemPosList[0] = Common::Point(46, 187);
- _menuItemPosList[1] = Common::Point(92, 187);
- _menuItemPosList[2] = Common::Point(138, 187);
- _menuItemPosList[3] = Common::Point(184, 187);
- _menuItemPosList[4] = Common::Point(230, 187);
- _menuItemPosList[5] = Common::Point(276, 187);
-}
-
-DragonMainMenuView::~DragonMainMenuView() {
- //if (_menuItem)
- // delete _menuItem;
-
- _vm->_palette->deleteRange(_bgPalData);
-
- delete _bgPalData;
-
- for (uint i = 0; i < _itemPalData.size(); ++i) {
- _vm->_palette->deleteRange(_itemPalData[i]);
- delete _itemPalData[i];
- }
-}
-
-bool DragonMainMenuView::onEvent(M4EventType eventType, int32 param, int x, int y, bool &captureEvents) {
- char resName[20];
- Common::SeekableReadStream *data;
-
- // Handle keypresses - these can be done at any time, even when the menu items are being drawn
- if (eventType == KEVENT_KEY) {
- switch (param) {
- case Common::KEYCODE_ESCAPE:
- case Common::KEYCODE_F6:
- handleAction(EXIT);
- break;
-
- case Common::KEYCODE_F1:
- handleAction(START_GAME);
- break;
-
- case Common::KEYCODE_F2:
- handleAction(RESUME_GAME);
- break;
-
- case Common::KEYCODE_F3:
- handleAction(SHOW_INTRO);
- break;
-
- case Common::KEYCODE_F4:
- handleAction(CREDITS);
- break;
-
- default:
- // Any other key skips the menu animation
- _skipFlag = true;
- return false;
- }
-
- return true;
- }
-
- int menuIndex;
-
- switch (eventType) {
- case MEVENT_LEFT_CLICK:
- case MEVENT_LEFT_DRAG:
- if (_vm->_mouse->getCursorOn()) {
- menuIndex = getHighlightedItem(x, y);
- if (menuIndex != _highlightedIndex) {
-
- _highlightedIndex = menuIndex;
- if (_highlightedIndex != -1) {
- sprintf(resName, "MAIN%d.SS", menuIndex);
- data = _vm->res()->get(resName);
- _menuItem = new SpriteAsset(_vm, data, data->size(), resName);
- _vm->res()->toss(resName);
-
- M4Sprite *spr = _menuItem->getFrame(1);
- spr->copyTo(this, spr->xOffset - 25, spr->yOffset - spr->height());
- }
- }
- } else {
- // Skip the menu animation
- _skipFlag = true;
- }
- return true;
-
- case MEVENT_LEFT_RELEASE:
- if (_highlightedIndex != -1)
- handleAction((MadsGameAction) _highlightedIndex);
- return true;
-
- default:
- break;
- }
-
- return false;
-}
-
-void DragonMainMenuView::updateState() {
- char resName[20];
- Common::SeekableReadStream *data;
- RGBList *palData;
- M4Sprite *spr;
-
- if (_menuItemIndex == 6)
- return;
-
- while (_menuItemIndex < 6) {
- sprintf(resName, "MAIN%d.SS", _menuItemIndex);
- data = _vm->res()->get(resName);
- _menuItem = new SpriteAsset(_vm, data, data->size(), resName);
- _vm->res()->toss(resName);
-
- // Slot it into available palette space
- palData = _menuItem->getRgbList();
- _vm->_palette->addRange(palData);
- _menuItem->translate(palData, true);
- _itemPalData.push_back(palData);
-
- spr = _menuItem->getFrame(0);
- spr->copyTo(this, spr->xOffset - 25, spr->yOffset - spr->height());
-
- if (_menuItemIndex != 5)
- delete _menuItem;
- _menuItemIndex++;
- }
-
- // Sphere
- sprintf(resName, "RM920X0.SS");
- data = _vm->res()->get(resName);
- _menuItem = new SpriteAsset(_vm, data, data->size(), resName);
- _vm->res()->toss(resName);
-
- // Slot it into available palette space
- palData = _menuItem->getRgbList();
- _vm->_palette->addRange(palData);
- _menuItem->translate(palData, true);
- _itemPalData.push_back(palData);
-
- spr = _menuItem->getFrame(0); // empty sphere
- spr->copyTo(this, spr->xOffset - 75, spr->yOffset - spr->height());
- spr = _menuItem->getFrame(1); // dragon inside sphere
- spr->copyTo(this, spr->xOffset - 75, spr->yOffset - spr->height());
-
- // Dragonsphere letters
- sprintf(resName, "RM920X3.SS");
- data = _vm->res()->get(resName);
- _menuItem = new SpriteAsset(_vm, data, data->size(), resName);
- _vm->res()->toss(resName);
-
- // Slot it into available palette space
- palData = _menuItem->getRgbList();
- _vm->_palette->addRange(palData);
- _menuItem->translate(palData, true);
- _itemPalData.push_back(palData);
-
- spr = _menuItem->getFrame(1);
- spr->copyTo(this, spr->xOffset - 140, spr->yOffset - spr->height(), spr->getTransparencyIndex());
-
- _vm->_mouse->cursorOn();
-}
-
-int DragonMainMenuView::getHighlightedItem(int x, int y) {
- y -= (height() - MADS_SURFACE_HEIGHT) / 2;
-
- for (int index = 0; index < 6; ++index) {
- const Common::Point &pt = _menuItemPosList[index];
- M4Sprite *spr = _menuItem->getFrame(0);
-
- if ((x >= pt.x - 25) && (y >= pt.y - spr->height()) && (x < (pt.x - 25 + spr->width())) && (y < (pt.y))) {
- debugCN(kDebugGraphics, "x = %d, y = %d, index = %d\n", x, y, index);
- return index;
- }
- }
-
- return -1;
-}
-
-void DragonMainMenuView::handleAction(MadsGameAction action) {
- MadsM4Engine *vm = _vm;
- vm->_mouse->cursorOff();
- vm->_viewManager->deleteView(this);
-
- switch (action) {
- case START_GAME:
- case RESUME_GAME:
- // Load a sample starting scene - note that, currently, calling loadScene automatically
- // removes this menu screen from being displayed
- vm->_mouse->cursorOn();
- vm->_viewManager->addView(vm->_scene);
- vm->_scene->loadScene(101);
- return;
-
- case SHOW_INTRO:
- vm->_viewManager->showAnimView("@dragon");
- break;
-
- case CREDITS:
- vm->_viewManager->showTextView("credits");
- return;
-
- case EXIT:
- vm->_events->quitFlag = true;
- return;
-
- default:
- break;
- }
-}
-
-
-/*--------------------------------------------------------------------------
- * RexDialogView is the base class for the different full-screen dialogs
- * in at least Rex Nebular
- *--------------------------------------------------------------------------
- */
-
-RexDialogView::RexDialogView(): View(_madsVm, Common::Rect(0, 0, _madsVm->_screen->width(), _madsVm->_screen->height())),
- MadsView(this) {
- _screenType = VIEWID_MENU;
-
- // Initialize class variables
- _priorSceneId = _madsVm->_scene->getCurrentScene();
- _dialogType = DIALOG_NONE;
-
- // Load necessary quotes
- _madsVm->globals()->loadQuoteRange(1, 48);
-
- initializeLines();
- initializeGraphics();
-}
-
-void RexDialogView::initializeLines() {
- // Set up a list of blank entries for use in the various dialogs
- for (int i = 0; i < DIALOG_LINES_SIZE; ++i) {
- DialogTextEntry rec;
- rec.in_use = false;
- _dialogText.push_back(rec);
- }
- _totalTextEntries = 0;
-
- // Set up a default sprite slot entry for a full screen refresh
- _spriteSlots.startIndex = 1;
- _spriteSlots[0].spriteType = FULL_SCREEN_REFRESH;
- _spriteSlots[0].seqIndex = -1;
-}
-
-void RexDialogView::initializeGraphics() {
- // Set needed palette entries
- _madsVm->_palette->blockRange(0, 16);
- _madsVm->_palette->setEntry(10, 0, 255, 0);
- _madsVm->_palette->setEntry(11, 0, 180, 0);
- _madsVm->_palette->setEntry(12, 255, 255, 0);
- _madsVm->_palette->setEntry(13, 180, 180, 0);
- _madsVm->_palette->setEntry(14, 255, 255, 180);
- _madsVm->_palette->setEntry(15, 180, 180, 180);
-
- // Load an appropriate background and menu sprites
- loadBackground();
- loadMenuSprites();
-
- // Set the current cursor
- _madsVm->_mouse->setCursorNum(CURSOR_ARROW);
-}
-
-
-RexDialogView::~RexDialogView() {
- _madsVm->_palette->deleteRange(_bgPalData);
- delete _bgPalData;
- delete _backgroundSurface;
-}
-
-void RexDialogView::loadBackground() {
- int bgIndex = _madsVm->globals()->sceneNumber / 100;
- int screenId = 0;
-
- switch (bgIndex) {
- case 1:
- case 2:
- screenId = 921;
- break;
- case 3:
- case 4:
- screenId = 922;
- break;
- case 5:
- case 6:
- case 7:
- screenId = 923;
- break;
- case 8:
- screenId = 924;
- break;
- case 9:
- screenId = 920;
- break;
- default:
- error("Unknown scene number");
- }
-
- _backgroundSurface = new M4Surface(width(), MADS_SURFACE_HEIGHT);
- _backgroundSurface->loadBackground(screenId, &_bgPalData);
- _vm->_palette->addRange(_bgPalData);
- _backgroundSurface->translate(_bgPalData);
-}
-
-void RexDialogView::loadMenuSprites() {
- const char *SPRITES_NAME = "*MENU.SS";
-
- _spriteSlots.addSprites(SPRITES_NAME);
-}
-
-
-void RexDialogView::updateState() {
-}
-
-void RexDialogView::onRefresh(RectList *rects, M4Surface *destSurface) {
- // Draw the framed base area
- fillRect(this->bounds(), _madsVm->_palette->BLACK);
- setColor(2);
- hLine(0, width(), MADS_Y_OFFSET - 2);
- hLine(0, width(), MADS_Y_OFFSET + MADS_SURFACE_HEIGHT + 2);
-
- // Add in the loaded background vertically centered
- _backgroundSurface->copyTo(this, 0, (height() - MADS_SURFACE_HEIGHT) / 2);
-
- // Check whether any of the dialog text entries need to be refreshed
- refreshText();
-
- // Handle the drawing of the various Mads elements
- refresh();
-
- View::onRefresh(rects, destSurface);
-}
-
-/**
- * Handles item selection within dialogs
- */
-bool RexDialogView::onEvent(M4EventType eventType, int32 param1, int x, int y, bool &captureEvents) {
- static bool word_7F28C = false;
- int word_7FED2 = 0;
- int word_8502A = 0;
-
- // If it's a keypress, handle it immediately
- if (eventType == KEVENT_KEY) {
- switch (param1) {
- case Common::KEYCODE_q | (Common::KBD_CTRL << 24):
- case Common::KEYCODE_q | (Common::KBD_ALT << 24):
- _madsVm->quitGame();
- return true;
- case Common::KEYCODE_RETURN:
- _enterFlag = true;
- _selectedLine = 0;
- break;
- case Common::KEYCODE_ESCAPE:
- _selectedLine = 0;
- break;
- default:
- return false;
- }
- }
-
- // Mark all the dialog text entries as not being seelcted
- for (uint i = 0; i < _dialogText.size(); ++i)
- _dialogText[i].state = STATE_DESELECTED;
-
- // Check if the mouse is over a registered screen object
- int idx = _screenObjects.scan(x, y, LAYER_GUI);
-
- if (word_7F28C) {
- if (y < _screenObjects[2].bounds.top) {
- if (eventType != MEVENT_LEFT_RELEASE)
- _dialogText[1].state = STATE_SELECTED;
- idx = 19;
- }
-
- if (y > _screenObjects[8].bounds.bottom) {
- if (eventType != MEVENT_LEFT_RELEASE)
- _dialogText[7].state = STATE_SELECTED;
- idx = 20;
- }
- }
-
- int objIndex = -1;
- if ((idx > 0) && ((eventType == MEVENT_LEFT_HOLD) || (eventType == MEVENT_LEFT_DRAG) ||
- (eventType == MEVENT_LEFT_RELEASE))) {
- objIndex = _screenObjects[idx].index;
-
- if ((_dialogType == DIALOG_SAVE) || (_dialogType == DIALOG_RESTORE)) {
- if ((objIndex > 7) && (objIndex <= 14))
- _dialogText[objIndex].state = STATE_SELECTED;
- }
-
- if (word_7FED2)
- word_7F28C = (objIndex > 0) && (objIndex <= 7);
-
- if (_screenObjects[idx].category == 1)
- _dialogText[objIndex].state = STATE_SELECTED;
- } else {
- idx = -1;
- }
-
- if (idx == 0)
- idx = -1;
-
- if (_dialogType == DIALOG_ERROR) {
- if (idx == 1)
- idx = -1;
- }
-
- if (eventType == MEVENT_LEFT_RELEASE) {
- if (!word_7F28C || (objIndex <= 18))
- _selectedLine = objIndex;
-
- word_8502A = -1;
- }
-
- return true;
-}
-
-void RexDialogView::setFrame(int frameNumber, int depth) {
- int slotIndex = _spriteSlots.getIndex();
- _spriteSlots[slotIndex].spriteType = FOREGROUND_SPRITE;
- _spriteSlots[slotIndex].seqIndex = 1;
- _spriteSlots[slotIndex].spriteListIndex = 0; //_menuSpritesIndex;
- _spriteSlots[slotIndex].frameNumber = frameNumber;
-
- M4Sprite *spr = _spriteSlots.getSprite(0).getFrame(frameNumber - 1);
- _spriteSlots[slotIndex].xp = spr->x;
- _spriteSlots[slotIndex].yp = spr->y;
- _spriteSlots[slotIndex].depth = depth;
- _spriteSlots[slotIndex].scale = 100;
-}
-
-void RexDialogView::initVars() {
- _v8502C = -1;
- _selectedLine = -1;
- _lineIndex = 0;
- _enterFlag = false;
- _textLines.clear();
-}
-
-void RexDialogView::addLine(const char *msg_p, Font *font, MadsTextAlignment alignment, int left, int top) {
- DialogTextEntry *rec = NULL;
-
- if (_lineIndex < _totalTextEntries) {
- if (strcmp(msg_p, _dialogText[_lineIndex].text) == 0) {
- rec = &_dialogText[_lineIndex];
- if (rec->textDisplay_index != 0) {
- MadsTextDisplayEntry &tdEntry = _textDisplay[rec->textDisplay_index];
- if (tdEntry.active) {
- if (_textLines.size() < 20) {
- // Add entry to line list
- _textLines.push_back(tdEntry.msg);
- tdEntry.msg = _textLines[_textLines.size() - 1].c_str();
- }
- }
- }
- }
- } else {
- if (_lineIndex < DIALOG_LINES_SIZE) {
- rec = &_dialogText[_lineIndex];
- _totalTextEntries = _lineIndex + 1;
- }
- }
-
- // Handling for if a line needs to be added
- if (rec) {
- strcpy(rec->text, msg_p);
- rec->font = font;
- rec->state = STATE_DESELECTED;
- rec->pos.y = top;
- rec->widthAdjust = -1;
- rec->in_use = true;
- rec->textDisplay_index = -1;
-
- switch (alignment) {
- case ALIGN_CENTER:
- // Center text
- rec->pos.x = (width() - font->getWidth(rec->text)) / 2 + left;
- break;
-
- case ALIGN_CHAR_CENTER: {
- // Text is center aligned on the '@' character within the string
- char *p = strchr(rec->text, '@');
-
- if (p) {
- // '@' string handling
- // Get length of string up to the '@' character
- *p = '\0';
- int strWidth = font->getWidth(rec->text, rec->widthAdjust);
- // Remove the character from the string. strcpy isn't used here because it's unsafe for
- // copying within the same string
- while ((*p = *(p + 1)) != '\0') ++p;
-
- rec->pos.x = (width() / 2) - strWidth;
- } else {
- rec->pos.x = left;
- }
- break;
- }
-
- case RIGHT_ALIGN:
- // Right align (moving left from given passed left)
- rec->pos.x = left - font->getWidth(rec->text);
- break;
-
- default:
- break;
- }
- }
-
- ++_lineIndex;
-}
-
-/**
- * Adds a line consisting of either a single quote, or the combination of two quote Ids
- */
-void RexDialogView::addQuote(Font *font, MadsTextAlignment alignment, int left, int top, int id1, int id2) {
- char buffer[80];
-
- // Copy the first quote string into the buffer
- const char *quoteStr = _madsVm->globals()->getQuote(id1);
- strcpy(buffer, quoteStr);
-
- // Handle the optional second quote Id
- if (id2 != 0) {
- quoteStr = _madsVm->globals()->getQuote(id2);
- strcat(buffer, " ");
- strcat(buffer, quoteStr);
- }
-
- // Add in the generated line
- addLine(buffer, font, alignment, left, top);
-}
-
-/**
- * Sets any previously created dialog text entries as clickable items
- */
-void RexDialogView::setClickableLines() {
- _screenObjects.clear();
-
- for (int i = 0; i < DIALOG_LINES_SIZE; ++i) {
- if (_dialogText[i].in_use) {
- // Add an entry for the line
- _screenObjects.add(Common::Rect(_dialogText[i].pos.x, _dialogText[i].pos.y,
- _dialogText[i].pos.x + _dialogText[i].font->getWidth(_dialogText[i].text, _dialogText[i].widthAdjust),
- _dialogText[i].pos.y + _dialogText[i].font->getHeight()), 19, i, 1);
- }
- }
-
- if ((_madsVm->globals()->dialogType == DIALOG_SAVE) || (_madsVm->globals()->dialogType == DIALOG_RESTORE)) {
- // Extra entries for the scroller areas of the Save and Restor dialogs
- _screenObjects.add(Common::Rect(293, 26, 312, 75), LAYER_GUI, 50, 2);
- _screenObjects.add(Common::Rect(293, 78, 312, 127), LAYER_GUI, 51, 2);
- }
-}
-
-/**
- * Handles creating text display objects for each dialog line initially, and when the selected state
- * of any entry changes
- */
-void RexDialogView::refreshText() {
- for (uint i = 0; i < _dialogText.size(); ++i) {
- if (!_dialogText[i].in_use)
- continue;
-
- // Get the item's colors
- uint color;
- if (_dialogText[i].state == STATE_DESELECTED)
- color = 0xB0A;
- else if (_dialogText[i].state == STATE_SELECTED)
- color = 0xD0C;
- else
- color = 0xF0E;
-
- // If there's an associated text display entry, check to see if it's color needs to change
- if (_dialogText[i].textDisplay_index >= 0) {
- MadsTextDisplayEntry &tdEntry = _textDisplay[_dialogText[i].textDisplay_index];
-
- if ((tdEntry.color1 == (color & 0xff)) && (tdEntry.color2 == (color >> 8)))
- // It's still the same, so no further action needed
- continue;
-
- // Flag the currently assigned text display to be expired, so it can be re-created
- _textDisplay.expire(_dialogText[i].textDisplay_index);
- _dialogText[i].textDisplay_index = -1;
- }
-
- // Create a new text display entry for the dialog text line
- _dialogText[i].textDisplay_index = _textDisplay.add(_dialogText[i].pos.x, _dialogText[i].pos.y,
- color, _dialogText[i].widthAdjust, _dialogText[i].text, _dialogText[i].font);
- }
-}
-
-/*--------------------------------------------------------------------------
- * RexGameMenuDialog is the main game dialog for the game
- *--------------------------------------------------------------------------
- */
-
-RexGameMenuDialog::RexGameMenuDialog(): RexDialogView() {
- _dialogType = DIALOG_GAME_MENU;
- setFrame(1, 2);
- initVars();
-
- _vm->_font->setFont(FONT_CONVERSATION_MADS);
- addLines();
- setClickableLines();
-}
-
-void RexGameMenuDialog::addLines() {
- // Add the title
- int top = MADS_Y_OFFSET - 2 - ((((_vm->_font->current()->getHeight() + 2) * 6) >> 1) - 78);
-
- addQuote(_vm->_font->current(), ALIGN_CENTER, 0, top, 10);
-
- // Loop for adding the option lines of the dialog
- top += 6;
- for (int idx = 0; idx < 5; ++idx) {
- top += _vm->_font->current()->getHeight() + 1;
- addQuote(_vm->_font->current(), ALIGN_CENTER, 0, top, 11 + idx);
- }
-}
-
-bool RexGameMenuDialog::onEvent(M4EventType eventType, int32 param1, int x, int y, bool &captureEvents) {
- // Call the parent event handler to handle line selection
- bool handled = RexDialogView::onEvent(eventType, param1, x, y, captureEvents);
-
- if (_selectedLine > 0) {
- switch (_selectedLine) {
- case 1:
- // Save Game
- _madsVm->globals()->dialogType = DIALOG_SAVE;
- break;
- case 2:
- // Restore Game
- _madsVm->globals()->dialogType = DIALOG_RESTORE;
- break;
- case 3:
- // Game Play Options
- _madsVm->globals()->dialogType = DIALOG_OPTIONS;
- break;
- case 4:
- // Resume Current Game
- _madsVm->globals()->dialogType = DIALOG_NONE;
- break;
- case 5:
- // Exit From Game
- _madsVm->quitGame();
- break;
- default:
- // TODO: Extra logic for such as resuming scene if necessary
- _madsVm->globals()->dialogType = DIALOG_NONE;
- break;
- }
-
- // Close this dialog
- _madsVm->_viewManager->deleteView(this);
- }
-
- return handled;
-}
-
-/*--------------------------------------------------------------------------
- * RexOptionsDialog is the game options dialog for Rex Nebular
- *--------------------------------------------------------------------------
- */
-
-RexOptionsDialog::RexOptionsDialog(): RexDialogView() {
- _dialogType = DIALOG_OPTIONS;
- _tempConfig = _madsVm->globals()->_config;
-
- setFrame(2, 2);
- initVars();
-
- _vm->_font->setFont(FONT_CONVERSATION_MADS);
- addLines();
- setClickableLines();
-}
-
-void RexOptionsDialog::reload() {
- for (int i = 0; i < DIALOG_LINES_SIZE; ++i)
- _dialogText[i].in_use = false;
- _totalTextEntries = 0;
- _textDisplay.clear();
- _screenObjects.clear();
-
- initVars();
-
- _vm->_font->setFont(FONT_CONVERSATION_MADS);
- addLines();
- setClickableLines();
-}
-
-void RexOptionsDialog::addLines() {
- // Add the title
- int top = MADS_Y_OFFSET - 2 - ((((_vm->_font->current()->getHeight() + 1) * 9 + 12) >> 1) - 78);
-
- addQuote(_vm->_font->current(), ALIGN_CENTER, 0, top, 16);
-
- // Music state line
- top += _vm->_font->current()->getHeight() + 1 + 6;
- addQuote(_vm->_font->current(), ALIGN_CHAR_CENTER, 0, top, 17, _tempConfig.musicFlag ? 24 : 25);
-
- // Sound state line
- top += _vm->_font->current()->getHeight() + 1;
- addQuote(_vm->_font->current(), ALIGN_CHAR_CENTER, 0, top, 18, _tempConfig.soundFlag ? 26 : 27);
-
- // Interface easy state line
- top += _vm->_font->current()->getHeight() + 1;
- addQuote(_vm->_font->current(), ALIGN_CHAR_CENTER, 0, top, 19, _tempConfig.easyMouse ? 29 : 28);
-
- // Inventory sppinng state line
- top += _vm->_font->current()->getHeight() + 1;
- addQuote(_vm->_font->current(), ALIGN_CHAR_CENTER, 0, top, 20, _tempConfig.invObjectsStill ? 31 : 30);
-
- // Text window state line
- top += _vm->_font->current()->getHeight() + 1;
- addQuote(_vm->_font->current(), ALIGN_CHAR_CENTER, 0, top, 21, _tempConfig.textWindowStill ? 33 : 32);
-
- // Screen fade state line
- top += _vm->_font->current()->getHeight() + 1;
- addQuote(_vm->_font->current(), ALIGN_CHAR_CENTER, 0, top, 22, _tempConfig.screenFades + 34);
-
- // Storyline mode line
- top += _vm->_font->current()->getHeight() + 1;
- addQuote(_vm->_font->current(), ALIGN_CHAR_CENTER, 0, top, 23, (_tempConfig.storyMode == 1) ? 37 : 38);
-
- // Add Done and Cancel button texts
- top += _vm->_font->current()->getHeight() + 1 + 6;
- addQuote(_vm->_font->current(), ALIGN_CENTER, -54, top, 1, 0);
- addQuote(_vm->_font->current(), ALIGN_CENTER, 54, top, 2, 0);
-}
-
-bool RexOptionsDialog::onEvent(M4EventType eventType, int32 param1, int x, int y, bool &captureEvents) {
- // Call the parent event handler to handle line selection
- bool handled = RexDialogView::onEvent(eventType, param1, x, y, captureEvents);
-
- if (_selectedLine > 0) {
- switch (_selectedLine) {
- case 0:
- // Enter or Escape
- _selectedLine = _enterFlag ? 8 : 9;
- return true;
- case 1:
- // Music line
- _tempConfig.musicFlag = !_tempConfig.musicFlag;
- break;
- case 2:
- // Sound line
- _tempConfig.soundFlag = !_tempConfig.soundFlag;
- break;
- case 3:
- // Interface line
- _tempConfig.easyMouse = !_tempConfig.easyMouse;
- break;
- case 4:
- // Inventory line
- _tempConfig.invObjectsStill = !_tempConfig.invObjectsStill;
- break;
- case 5:
- // Text window line
- _tempConfig.textWindowStill = !_tempConfig.textWindowStill;
- break;
- case 6:
- // Screen fades line
- if (++_tempConfig.screenFades > 2)
- _tempConfig.screenFades = 0;
- break;
- case 7:
- // Story mode line
- if (_tempConfig.storyMode == 2)
- _tempConfig.storyMode = 1;
- else if (_tempConfig.storyMode == 1)
- _tempConfig.storyMode = 2;
- break;
- case 8:
- case 9:
- // Done and Cancel buttons
- // TODO: Proper re-loading of settings if Cancel button clicked
- _madsVm->globals()->_config = _tempConfig;
-
- // Closing the dialog, so return to the game menu
- _madsVm->globals()->dialogType = DIALOG_GAME_MENU;
- _madsVm->_viewManager->deleteView(this);
- return true;
- }
-
- // Update the option selections
- reload();
- }
-
- return handled;
-}
-
-}
diff --git a/engines/m4/mads_menus.h b/engines/m4/mads_menus.h
deleted file mode 100644
index 4d3ea5da39..0000000000
--- a/engines/m4/mads_menus.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/* 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 M4_MADS_MENUS_H
-#define M4_MADS_MENUS_H
-
-#include "common/str-array.h"
-#include "m4/viewmgr.h"
-#include "m4/mads_views.h"
-#include "m4/font.h"
-
-namespace M4 {
-
-#define MADS_MENU_ANIM_DELAY 70
-
-enum MadsGameAction {START_GAME, RESUME_GAME, SHOW_INTRO, CREDITS, QUOTES, EXIT};
-
-enum MadsLayers {LAYER_GUI = 19};
-
-class RexMainMenuView : public View {
-private:
- Common::Point _menuItemPosList[6];
-private:
- M4Surface *_bgSurface;
- RGBList *_bgPalData;
- int _menuItemIndex;
- int _frameIndex;
- bool _skipFlag;
- SpriteAsset *_menuItem;
- Common::Array<RGBList *> _itemPalData;
- uint32 _delayTimeout;
- int _highlightedIndex;
-
- int getHighlightedItem(int x, int y);
- void handleAction(MadsGameAction action);
-public:
- RexMainMenuView(MadsM4Engine *vm);
- ~RexMainMenuView();
-
- bool onEvent(M4EventType eventType, int32 param, int x, int y, bool &captureEvents);
- void updateState();
-};
-
-class DragonMainMenuView : public View {
-private:
- Common::Point _menuItemPosList[6];
-private:
- //M4Surface *_bgSurface;
- RGBList *_bgPalData;
- int _menuItemIndex;
- int _frameIndex;
- bool _skipFlag;
- SpriteAsset *_menuItem;
- Common::Array<RGBList *> _itemPalData;
- uint32 _delayTimeout;
- int _highlightedIndex;
-
- int getHighlightedItem(int x, int y);
- void handleAction(MadsGameAction action);
-public:
- DragonMainMenuView(MadsM4Engine *vm);
- ~DragonMainMenuView();
-
- bool onEvent(M4EventType eventType, int32 param, int x, int y, bool &captureEvents);
- void updateState();
-};
-
-class MadsMainMenuView : public View {
-public:
- MadsMainMenuView(MadsM4Engine *vm);
-
- bool onEvent(M4EventType eventType, int32 param, int x, int y, bool &captureEvents);
- void updateState();
-};
-
-enum DialogTextState {STATE_DESELECTED = 0, STATE_SELECTED = 1, STATE_UNKNOWN = 2};
-
-class DialogTextEntry {
-public:
- bool in_use;
- DialogTextState state;
- Common::Point pos;
- char text[80];
- Font *font;
- int widthAdjust;
-
- int textDisplay_index;
-
- DialogTextEntry() { in_use = false; }
-};
-
-#define DIALOG_LINES_SIZE 20
-
-enum MadsTextAlignment { ALIGN_CENTER = -1, ALIGN_CHAR_CENTER = -2, RIGHT_ALIGN = -3 };
-
-
-class RexDialogView : public View, public MadsView {
-private:
- int _priorSceneId;
-
- void initializeLines();
- void initializeGraphics();
- void loadBackground();
- void loadMenuSprites();
-protected:
- MadsDialogType _dialogType;
- M4Surface *_backgroundSurface;
- RGBList *_bgPalData;
- SpriteAsset *_menuSprites;
-
- Common::Array<DialogTextEntry> _dialogText;
- Common::StringArray _textLines;
- int _totalTextEntries;
- int _dialogSelectedLine;
- Common::StringArray _saveList;
-
- int _v8502C;
- int _selectedLine;
- int _lineIndex;
- bool _enterFlag;
-
- void setFrame(int frameNumber, int depth);
- void initVars();
- void addLine(const char *msg_p, Font *font, MadsTextAlignment alignment, int left, int top);
- void addQuote(Font *font, MadsTextAlignment alignment, int left, int top, int id1, int id2 = 0);
- void setClickableLines();
- void refreshText();
-public:
- RexDialogView();
- ~RexDialogView();
-
- virtual void updateState();
- virtual void onRefresh(RectList *rects, M4Surface *destSurface);
- virtual bool onEvent(M4EventType eventType, int32 param1, int x, int y, bool &captureEvents);
-};
-
-class RexGameMenuDialog : public RexDialogView {
-private:
- void addLines();
-public:
- RexGameMenuDialog();
-
- virtual bool onEvent(M4EventType eventType, int32 param1, int x, int y, bool &captureEvents);
-};
-
-class RexOptionsDialog : public RexDialogView {
-private:
- MadsConfigData _tempConfig;
-
- void reload();
- void addLines();
-public:
- RexOptionsDialog();
-
- virtual bool onEvent(M4EventType eventType, int32 param1, int x, int y, bool &captureEvents);
-};
-
-}
-
-#endif
diff --git a/engines/m4/mads_player.cpp b/engines/m4/mads_player.cpp
deleted file mode 100644
index 73480088ee..0000000000
--- a/engines/m4/mads_player.cpp
+++ /dev/null
@@ -1,789 +0,0 @@
-/* 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 "m4/m4.h"
-#include "m4/mads_player.h"
-#include "m4/mads_scene.h"
-
-namespace M4 {
-
-const int MadsPlayer::_directionListIndexes[32] = {
- 0, 7, 4, 3, 6, 0, 2, 5, 0, 1, 9, 4, 1, 2, 7, 9, 3, 8, 9, 6, 7, 2, 3, 6, 1, 7, 9, 4, 7, 8, 0, 0
-};
-
-MadsPlayer::MadsPlayer() {
- _playerPos = Common::Point(160, 78);
- _ticksAmount = 3;
- _forceRefresh = true;
- _stepEnabled = true;
- _visible = true;
- _yScale = 0;
- _moving = false;
-
- _spriteListStart = 0;
- //TODO:unknown vars
- _special = 0;
- _next = 0;
- _unk4 = false;
-
- _spritesChanged = true;
-
- _direction = 0;
- _newDirection = 0;
- _priorTimer = 0;
- _priorVisible = false;
- _visible3 = false;
- _spriteListIdx = 0;
- _currentScale = 0;
- strcpy(_spritesPrefix, "");
- for (int idx = 0; idx < 8; ++idx)
- _spriteSetsPresent[idx] = false;
- _frameNum = 0;
- _frameOffset = 0;
- _unk1 = 0;
- _frameCount = 0;
- _frameListIndex = 0;
- _actionIndex = 0;
- _routeCount = 0;
-
- resetActionList();
-}
-
-/**
- * Loads the sprite set for the player
- */
-bool MadsPlayer::loadSprites(const char *prefix) {
- const char suffixList[8] = { '8', '9', '6', '3', '2', '7', '4', '1' };
- char setName[80];
- bool result = true;
-
- if (prefix)
- strcpy(_spritesPrefix, prefix);
-
- _spriteSetCount = 0;
- int prefixLen = strlen(_spritesPrefix);
-
- if (prefixLen == 0) {
- // No player sprites at at all
- for (int idx = 0; idx < 8; ++idx)
- _spriteSetsPresent[idx] = false;
- } else {
- strcpy(setName, "*");
- strcat(setName, _spritesPrefix);
- strcat(setName, "_0.SS");
-
- char *digitP = strchr(setName, '_') + 1;
-
- for (int idx = 0; idx < 8; ++idx) {
- *digitP = suffixList[idx];
- _spriteSetsPresent[idx] = true;
-
- int setIndex = _madsVm->scene()->_spriteSlots.addSprites(setName, true, SPRITE_SET_CHAR_INFO);
- if (setIndex < 0) {
- if (idx < 5)
- break;
- _spriteSetsPresent[idx] = false;
- } else {
- ++_spriteSetCount;
- }
-
- if (idx == 0)
- _spriteListStart = setIndex;
- }
-
- result = 0;
- // TODO: Unknown flag
- _spritesChanged = false;
- }
-
- return result;
-}
-
-/**
- * Called each frame to update the display of the player
- */
-void MadsPlayer::update() {
- if (_forceRefresh || (_visible != _priorVisible)) {
- // If there's an existing player sprite visible, flag it for expiry
- int slotIndex = getSpriteSlot();
- if (slotIndex >= 0)
- _madsVm->scene()->_spriteSlots[slotIndex].spriteType = EXPIRED_SPRITE;
-
- // Figure out the depth for the sprite
- int newDepth = 1;
- int yp = MIN(_playerPos.y, (int16)155);
-
- for (int idx = 1; idx < 15; ++idx) {
- if (_madsVm->scene()->getSceneResources()._depthBands[newDepth] >= yp)
- newDepth = idx + 1;
- }
- _currentDepth = newDepth;
-
- // Get the scale
- int newScale = getScale(_playerPos.y);
- _currentScale = MIN(newScale, 100);
-
- if (_visible) {
- // Player sprite needs to be rendered
- MadsSpriteSlot slot;
- slot.spriteType = FOREGROUND_SPRITE;
- slot.seqIndex = PLAYER_SEQ_INDEX;
- slot.spriteListIndex = _spriteListStart + _spriteListIdx;
- slot.frameNumber = _frameOffset + _frameNum;
- slot.xp = _playerPos.x;
- slot.yp = _playerPos.y + (_yScale * newScale) / 100;
- slot.depth = newDepth;
- slot.scale = newScale;
-
- if (slotIndex >= 0) {
- // Check if the existing player slot has the same details, and can be re-used
- MadsSpriteSlot &s2 = _madsVm->scene()->_spriteSlots[slotIndex];
- bool equal = (s2.seqIndex == slot.seqIndex) && (s2.spriteListIndex == slot.spriteListIndex)
- && (s2.frameNumber == slot.frameNumber) && (s2.xp == slot.xp) && (s2.yp == slot.yp)
- && (s2.depth == slot.depth) && (s2.scale == slot.scale);
-
- if (equal)
- // Undo the prior expiry of the player sprite
- s2.spriteType = SPRITE_ZERO;
- else
- slotIndex = -1;
- }
-
- if (slotIndex < 0) {
- // New slot needed, so allocate one and copy the slot data
- slotIndex = _madsVm->scene()->_spriteSlots.getIndex();
- _madsVm->scene()->_spriteSlots[slotIndex] = slot;
- }
-
- // TODO: Meaning of _v844c0 block
-
- }
- }
-
- _visible3 = _priorVisible = _visible;
- _forceRefresh = false;
-}
-
-/**
- * Updates the animation frame for the player
- */
-void MadsPlayer::updateFrame() {
- SpriteAsset &spriteSet = _madsVm->scene()->_spriteSlots.getSprite(_spriteListStart + _spriteListIdx);
- assert(spriteSet._charInfo);
-
- if (!spriteSet._charInfo->_numEntries) {
- _frameNum = 1;
- } else {
- _frameListIndex = _actionList[_actionIndex];
-
- if (!_visible) {
- _unk2 = 0;
- } else {
- _unk2 = _actionList2[_actionIndex];
-
- if (_actionIndex > 0)
- --_actionIndex;
- }
-
- // Set the player frame number
- int frameIndex = ABS(_frameListIndex);
- _frameNum = (_frameListIndex <= 0) ? spriteSet._charInfo->_frameList[frameIndex] :
- spriteSet._charInfo->_frameList2[frameIndex];
-
- // Set next waiting period in ticks
- if (frameIndex == 0)
- setTicksAmount();
- else
- _madsVm->_player._ticksAmount = spriteSet._charInfo->_ticksList[frameIndex];
- }
-}
-
-void MadsPlayer::setupFrame() {
- resetActionList();
- _frameOffset = 0;
- _spriteListIdx = _directionListIndexes[_direction];
- if (!_spriteSetsPresent[_spriteListIdx]) {
- // Direction isn't present, so use alternate direction, with entries flipped
- _spriteListIdx -= 4;
- _frameOffset = 0x8000;
- }
-
- SpriteAsset &spriteSet = _madsVm->scene()->_spriteSlots.getSprite(_spriteListStart + _spriteListIdx);
- assert(spriteSet._charInfo);
- _unk1 = MAX(spriteSet._charInfo->_unk1, 100);
- setTicksAmount();
-
- _frameCount = spriteSet._charInfo->_totalFrames;
- if (_frameCount == 0)
- _frameCount = spriteSet.getCount();
-
- _yScale = spriteSet._charInfo->_yScale;
-
- if ((_frameNum <= 0) || (_frameNum > _frameCount))
- _frameNum = 1;
- _forceRefresh = true;
-}
-
-void MadsPlayer::step() {
- if (_visible && _stepEnabled && !_moving && (_direction == _newDirection) && (_madsVm->_currentTimer >= GET_GLOBAL32(2))) {
- if (_actionIndex == 0) {
- int randVal = _vm->_random->getRandomNumber(29999);
-
- if (GET_GLOBAL(0) == SEX_MALE) {
- switch (_direction) {
- case 1:
- case 3:
- case 7:
- case 9:
- if (randVal < 200) {
- queueAction(-1, 0);
- queueAction(1, 0);
- }
- break;
-
- case 2:
- if (randVal < 500) {
- for (int i = 0; i < 10; ++i)
- queueAction((randVal < 250) ? 1 : 2, 0);
- } else if (randVal < 750) {
- for (int i = 0; i < 5; ++i)
- queueAction(1, 0);
- queueAction(0, 0);
- for (int i = 0; i < 5; ++i)
- queueAction(2, 0);
- }
- break;
-
- case 4:
- case 6:
- if (randVal < 500) {
- for (int i = 0; i < 10; ++i)
- queueAction(1, 0);
- }
- break;
-
- case 5:
- case 8:
- if (randVal < 200) {
- queueAction(-1, 0);
- queueAction(1, 0);
- }
- break;
- }
- }
- }
-
- SET_GLOBAL32(2, GET_GLOBAL32(2) + 6);
- }
-
- if (GET_GLOBAL(138) == 1) {
- uint32 diff = _madsVm->_currentTimer - GET_GLOBAL32(142);
- if (diff > 60) {
- SET_GLOBAL32(144, GET_GLOBAL32(144) + 1);
- } else {
- SET_GLOBAL32(144, GET_GLOBAL32(144) + diff);
- }
-
- SET_GLOBAL32(142, _madsVm->_currentTimer);
- }
-}
-
-void MadsPlayer::nextFrame() {
- if (_madsVm->_currentTimer >= (_priorTimer + _ticksAmount)) {
- _priorTimer = _madsVm->_currentTimer;
-
- if (_moving)
- move();
- else
- idle();
-
- // Post update logic
- if (_moving) {
- ++_frameNum;
- if (_frameNum > _frameCount)
- _frameNum = 1;
- _forceRefresh = true;
- } else if (!_forceRefresh) {
- idle();
- }
-
- // Final update
- update();
- }
-}
-
-void MadsPlayer::setDest(int destX, int destY, int facing) {
- resetActionList();
- setTicksAmount();
- _moving = true;
- _destFacing = facing;
-
- _madsVm->scene()->getSceneResources().setRouteNode(_madsVm->scene()->getSceneResources()._nodes.size() - 2,
- _playerPos, _madsVm->scene()->_depthSurface);
- _madsVm->scene()->getSceneResources().setRouteNode(_madsVm->scene()->getSceneResources()._nodes.size() - 1,
- Common::Point(destX, destY), _madsVm->scene()->_depthSurface);
-
- bool v = _madsVm->scene()->getDepthHighBit(Common::Point(destX, destY));
- setupRoute(v);
- _next = 0;
-
- if (_routeCount > 0) {
- Common::Point srcPos = _playerPos;
- for (int routeCtr = _routeCount - 1; (routeCtr >= 0) && (_next == 0); --routeCtr) {
- int idx = _routeIndexes[routeCtr];
- const Common::Point &pt = _madsVm->scene()->getSceneResources()._nodes[idx].pt;
-
- _next = scanPath(_madsVm->scene()->_depthSurface, srcPos, pt);
- srcPos = pt;
- }
- }
-}
-
-
-int MadsPlayer::getScale(int yp) {
- MadsSceneResources &r = _madsVm->scene()->getSceneResources();
-
- int scale = (r.bandsRange() == 0) ? r._maxScale : (yp - r._yBandsStart) * r.scaleRange() / r.bandsRange()
- + r._minScale;
-
- return MIN(scale, 100);
-}
-
-/**
- * Scans through the scene's sprite slot list to find any sprite displaying the player
- */
-int MadsPlayer::getSpriteSlot() {
- MadsSpriteSlots &slots = _madsVm->scene()->_spriteSlots;
- for (int i = 0; i < slots.startIndex; ++i) {
- if ((slots[i].seqIndex == PLAYER_SEQ_INDEX) && (slots[i].spriteType >= SPRITE_ZERO))
- return i;
- }
- return -1;
-}
-
-void MadsPlayer::setTicksAmount() {
- SpriteAsset &spriteSet = _madsVm->scene()->_spriteSlots.getSprite(_spriteListStart + _spriteListIdx);
- assert(spriteSet._charInfo);
- _madsVm->_player._ticksAmount = spriteSet._charInfo->_ticksAmount;
- if (_madsVm->_player._ticksAmount == 0)
- _madsVm->_player._ticksAmount = 6;
-}
-
-void MadsPlayer::resetActionList() {
- _actionList[0] = 0;
- _actionList2[0] = 0;
- _actionIndex = 0;
- _unk2 = 0;
- _unk3 = 0;
-}
-
-int MadsPlayer::queueAction(int action1, int action2) {
- SpriteAsset &spriteSet = _madsVm->scene()->_spriteSlots.getSprite(_spriteListStart + _spriteListIdx);
- assert(spriteSet._charInfo);
-
- if ((action1 < spriteSet._charInfo->_numEntries) && (_actionIndex < 11)) {
- ++_actionIndex;
- _actionList[_actionIndex] = action1;
- _actionList2[_actionIndex] = action2;
- return false;
- }
-
- return true;
-}
-
-void MadsPlayer::idle() {
- if (_direction != _newDirection) {
- // The direction has changed, so reset for new direction
- dirChanged();
- return;
- }
-
- SpriteAsset &spriteSet = _madsVm->scene()->_spriteSlots.getSprite(_spriteListStart + _spriteListIdx);
- assert(spriteSet._charInfo);
- if (spriteSet._charInfo->_numEntries == 0)
- // No entries, so exit immediately
- return;
-
- int frameIndex = ABS(_frameListIndex);
- int direction = (_frameListIndex < 0) ? -1 : 1;
-
- if (frameIndex >= spriteSet._charInfo->_numEntries)
- // Reset back to the start of the list
- _frameListIndex = 0;
- else {
- _frameNum += direction;
- _forceRefresh = true;
-
- if (spriteSet._charInfo->_frameList2[frameIndex] < _frameNum) {
- _unk3 = _unk2;
- updateFrame();
- }
- if (spriteSet._charInfo->_frameList[frameIndex] < _frameNum) {
- _unk3 = _unk2;
- updateFrame();
- }
- }
-}
-
-void MadsPlayer::move() {
- bool routeFlag = false;
-
- if (_moving) {
- int idx = _routeCount;
- while (!_v844C0 && (_destPos.x == _playerPos.x) && (_destPos.y == _playerPos.y)) {
- if (idx != 0) {
- --idx;
- SceneNode &node = _madsVm->scene()->getSceneResources()._nodes[_routeIndexes[idx]];
- _destPos = node.pt;
- routeFlag = true;
- } else if (_v844BE == idx) {
- // End of walking path
- _routeCount = 0;
- _moving = false;
- turnToDestFacing();
- routeFlag = true;
- idx = _routeCount;
- } else {
- _v844C0 = _v844BE;
- _v844BC = true;
- _v844BE = 0;
- _stepEnabled = true;
- routeFlag = false;
- }
-
- if (!_moving)
- break;
- }
- _routeCount = idx;
- }
-
- if (routeFlag && _moving)
- startMovement();
-
- if (_newDirection != _direction)
- dirChanged();
- else if (!_moving)
- updateFrame();
-
- int var1 = _unk1;
- if (_unk4 && (_hypotenuse > 0)) {
- int v1 = -(_currentScale - 100) * (_posDiff.x - 1) / _hypotenuse + _currentScale;
- var1 = MAX(1, 10000 / (v1 * _currentScale * var1));
- }
-
- if (!_moving || (_direction != _newDirection))
- return;
-
- Common::Point newPos = _playerPos;
-
- if (_v8452E < var1) {
- do {
- if (_v8452C < _posDiff.x)
- _v8452C += _posDiff.y;
- if (_v8452C >= _posDiff.x) {
- if ((_posChange.y > 0) || (_v844C0 != 0))
- newPos.y += _yDirection;
- --_posChange.y;
- _v8452C -= _posDiff.x;
- }
-
- if (_v8452C < _posDiff.x) {
- if ((_posChange.x > 0) || (_v844C0 != 0))
- newPos.x += _xDirection;
- --_posChange.x;
- }
-
- if ((_v844BC == 0) && (_v844C0 == 0) && (_v844BE == 0)) {
- routeFlag = _madsVm->scene()->getDepthHighBit(newPos);
-
- if (_special == 0)
- _special = _madsVm->scene()->getDepthHighBits(newPos);
- }
-
- _v8452E += _v84530;
-
- } while ((_v8452E < var1) && !routeFlag && ((_posChange.x > 0) || (_posChange.y > 0) || (_v844C0 != 0)));
- }
-
- _v8452E -= var1;
-
- if (routeFlag)
- moveComplete();
- else {
- if (!_v844C0) {
- // If the move is complete, make sure the position is exactly on the given destination
- if (_posChange.x == 0)
- newPos.x = _destPos.x;
- if (_posChange.y == 0)
- newPos.y = _destPos.y;
- }
-
- _playerPos = newPos;
- }
-}
-
-void MadsPlayer::dirChanged() {
- int dirIndex = 0, dirIndex2 = 0;
- int newDir = 0, newDir2 = 0;
-
- if (_direction != _newDirection) {
- // Find the index for the given direction in the player direction list
- int tempDir = _direction;
- do {
- ++dirIndex;
- newDir += tempDir;
- tempDir = _directionListIndexes[tempDir + 10];
- } while (tempDir != _newDirection);
- }
-
-
- if (_direction != _newDirection) {
- // Find the index for the given direction in the player direction list
- int tempDir = _direction;
- do {
- ++dirIndex2;
- newDir2 += tempDir;
- tempDir = _directionListIndexes[tempDir + 20];
- } while (tempDir != _newDirection);
- }
-
- int diff = dirIndex - dirIndex2;
- if (diff == 0)
- diff = newDir - newDir2;
-
- _direction = (diff >= 0) ? _directionListIndexes[_direction + 20] : _directionListIndexes[_direction + 10];
- setupFrame();
- if ((_direction == _newDirection) && !_moving)
- updateFrame();
-
- _priorTimer += 1;
-}
-
-void MadsPlayer::moveComplete() {
- reset();
- //todo: Unknown flag
-}
-
-void MadsPlayer::reset() {
- _destPos = _playerPos;
- _destFacing = 5;
- _newDirection = _direction;
-
- _madsVm->scene()->_action._startWalkFlag = false;
- _madsVm->scene()->_action._walkFlag = false;
- _moving = false;
- _v844BC = false;
- _v844C0 = false;
- _v844BE = 0;
- _next = 0;
- _routeCount = 0;
-}
-
-/**
- * Scans along an edge connecting two points within the depths/walk surface, and returns the information of the first
- * pixel high nibble encountered with a non-zero value
- */
-int MadsPlayer::scanPath(M4Surface *depthSurface, const Common::Point &srcPos, const Common::Point &destPos) {
- // For compressed depth surfaces, always return 0
- if (_madsVm->scene()->getSceneResources()._depthStyle != 2)
- return 0;
-
- int yDiff = destPos.y - srcPos.y;
- int yAmount = MADS_SURFACE_WIDTH;
-
- if (yDiff < 0) {
- yDiff = -yDiff;
- yAmount = -yAmount;
- }
-
- int xDiff = destPos.x - srcPos.y;
- int xDirection = 1;
- int xAmount = 0;
- if (xDiff < 0) {
- xDiff = -xDiff;
- xDirection = -xDirection;
- xAmount = MIN(yDiff, xDiff);
- }
-
- ++xDiff;
- ++yDiff;
-
- const byte *srcP = depthSurface->getBasePtr(srcPos.x, srcPos.y);
- int index = xAmount;
-
- // Outer horizontal movement loop
- for (int yIndex = 0; yIndex < yDiff; ++yIndex) {
- index += yDiff;
- int v = (*srcP & 0x7F) >> 4;
- if (v)
- return v;
-
- // Inner loop for handling vertical movement
- while (index >= xDiff) {
- index -= xDiff;
-
- v = (*srcP & 0x7F) >> 4;
- if (v)
- return v;
-
- srcP += yAmount;
- }
-
- srcP += xDirection;
- }
-
- return 0;
-}
-
-/**
- * Starts a player moving to a given destination
- */
-void MadsPlayer::startMovement() {
- int xDiff = _destPos.x - _playerPos.x;
- int yDiff = _destPos.y - _playerPos.y;
- int srcScale = getScale(_playerPos.y);
- int destScale = getScale(_destPos.y);
-
- // Sets the X direction
- if (xDiff > 0)
- _xDirection = 1;
- else if (xDiff < 0)
- _xDirection = -1;
- else
- _xDirection = 0;
-
- // Sets the Y direction
- if (yDiff > 0)
- _yDirection = 1;
- else if (yDiff < 0)
- _yDirection = -1;
- else
- _yDirection = 0;
-
- xDiff = ABS(xDiff);
- yDiff = ABS(yDiff);
- int scaleDiff = ABS(srcScale - destScale);
-
- int xAmt100 = xDiff * 100;
- int yAmt100 = yDiff * 100;
- int xAmt33 = xDiff * 33;
-
- int scaleAmount = (_unk4 ? scaleDiff * 3 : 0) + 100 * yDiff / 100;
- int scaleAmount100 = scaleAmount * 100;
-
- // Figure out direction that will need to be moved in
- int majorDir;
- if (xDiff == 0)
- majorDir = 1;
- else if (yDiff == 0)
- majorDir = 3;
- else {
- if ((scaleAmount < xDiff) && ((xAmt33 / scaleAmount) >= 141))
- majorDir = 3;
- else if (yDiff <= xDiff)
- majorDir = 2;
- else if ((scaleAmount100 / xDiff) >= 141)
- majorDir = 1;
- else
- majorDir = 2;
- }
-
- switch (majorDir) {
- case 1:
- _newDirection = (_yDirection <= 0) ? 8 : 2;
- break;
- case 2: {
- _newDirection = ((_yDirection <= 0) ? 9 : 3) - ((_xDirection <= 0) ? 2 : 0);
- break;
- }
- case 3:
- _newDirection = (_xDirection <= 0) ? 4 : 6;
- break;
- default:
- break;
- }
-
- _hypotenuse = SqrtF16(xAmt100 * xAmt100 + yAmt100 * yAmt100);
- _posDiff.x = xDiff + 1;
- _posDiff.y = yDiff + 1;
- _posChange.x = xDiff;
- _posChange.y = yDiff;
-
- int majorChange = MAX(xDiff, yDiff);
- _v84530 = (majorChange == 0) ? 0 : _hypotenuse / majorChange;
-
- if (_playerPos.x > _destPos.x)
- _v8452C = MAX(_posChange.x, _posChange.y);
- else
- _v8452C = 0;
-
- _hypotenuse /= 100;
- _v8452E = -_v84530;
-}
-
-void MadsPlayer::turnToDestFacing() {
- if (_destFacing != 5)
- _newDirection = _destFacing;
-}
-
-void MadsPlayer::setupRoute(bool bitFlag) {
- // Reset the flag set of nodes in use
- SceneNodeList &nodes = _madsVm->scene()->getSceneResources()._nodes;
- for (uint i = 0; i < nodes.size(); ++i)
- nodes[i].active = false;
-
- // Start constructing route node list
- _routeLength = 0x3FFF;
- _routeCount = 0;
-
- setupRouteNode(_tempRoute, nodes.size() - 1, bitFlag ? 0xC000 : 0x8000, 0);
-}
-
-void MadsPlayer::setupRouteNode(int *routeIndexP, int nodeIndex, int flags, int routeLength) {
- SceneNodeList &nodes = _madsVm->scene()->getSceneResources()._nodes;
- SceneNode &currentNode = nodes[nodeIndex];
- currentNode.active = true;
-
- *routeIndexP++ = nodeIndex;
-
- int subIndex = nodes.size() - 2;
- int indexVal = nodes[nodeIndex].indexes[subIndex];
- if (indexVal & flags) {
- routeLength += indexVal & 0x3FFF;
- if (routeLength < _routeLength) {
- // Found a new shorter route to destination, so set up the route with the found one
- Common::copy(_tempRoute, routeIndexP, _routeIndexes);
- _routeCount = routeIndexP - _tempRoute;
- _routeLength = indexVal & 0x3FFF;
- }
- } else {
- for (int idx = nodes.size() - 2; idx > 0; --idx) {
- int nodePos = idx - 1;
- if (!nodes[nodePos].active && ((currentNode.indexes[nodePos] & flags) != 0))
- setupRouteNode(routeIndexP, nodePos, 0x8000, indexVal & 0x3fff);
- }
- }
-
- currentNode.active = false;
-}
-
-} // End of namespace M4
diff --git a/engines/m4/mads_player.h b/engines/m4/mads_player.h
deleted file mode 100644
index bbeefaf3d5..0000000000
--- a/engines/m4/mads_player.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* 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 M4_MADS_PLAYER_H
-#define M4_MADS_PLAYER_H
-
-#include "common/scummsys.h"
-#include "m4/mads_scene.h"
-
-namespace M4 {
-
-#define PLAYER_SEQ_INDEX -2
-
-class MadsPlayer {
-private:
- int getScale(int yp);
- int getSpriteSlot();
- void setTicksAmount();
- void resetActionList();
- int queueAction(int v0, int v1);
- void idle();
- void move();
- void dirChanged();
- void reset();
- int scanPath(M4Surface *depthSurface, const Common::Point &srcPos, const Common::Point &destPos);
- void startMovement();
- void setupRouteNode(int *routeIndexP, int nodeIndex, int flags, int routeLength);
-public:
- char _spritesPrefix[16];
- int _spriteSetCount;
- bool _spriteSetsPresent[8];
- Common::Point _playerPos;
- Common::Point _destPos;
- Common::Point _posChange;
- Common::Point _posDiff;
- int _hypotenuse;
- uint32 _priorTimer;
- uint _ticksAmount;
- int16 _direction, _newDirection;
- bool _stepEnabled;
- bool _visible, _priorVisible;
- bool _visible3;
- bool _forceRefresh;
- int16 _currentScale;
- int16 _yScale;
- int16 _currentDepth;
- int16 _spriteListStart, _spriteListIdx;
- bool _spritesChanged;
- uint16 _frameOffset, _frameNum;
- bool _moving;
- int _unk1;
- int _frameCount;
- int _frameListIndex;
- int _actionIndex;
- int _actionList[12];
- int _actionList2[12];
- int _unk2;
- int _unk3;
- int _xDirection, _yDirection;
- int _destFacing;
- int _special;
- int _next;
- int _routeCount;
- int _routeOffset;
- int _tempRoute[MAX_ROUTE_NODES];
- int _routeIndexes[MAX_ROUTE_NODES];
- bool _unk4;
- bool _v844BC;
- int _v844BE;
- bool _v844C0;
- int _v8452E;
- int _v8452C;
- int _v84530;
- int _routeLength;
-
- static const int _directionListIndexes[32];
-public:
- MadsPlayer();
-
- bool loadSprites(const char *prefix);
- void update();
- void updateFrame();
- void setupFrame();
- void step();
- void nextFrame();
- void setDest(int destX, int destY, int facing);
- void turnToDestFacing();
- void setupRoute(bool bitFlag);
- void moveComplete();
-};
-
-} // End of namespace M4
-
-#endif
diff --git a/engines/m4/mads_scene.cpp b/engines/m4/mads_scene.cpp
deleted file mode 100644
index 5f160aa300..0000000000
--- a/engines/m4/mads_scene.cpp
+++ /dev/null
@@ -1,1272 +0,0 @@
-/* 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/system.h"
-#include "common/textconsole.h"
-
-#include "m4/mads_scene.h"
-#include "m4/dialogs.h"
-#include "m4/globals.h"
-#include "m4/scene.h"
-#include "m4/events.h"
-#include "m4/graphics.h"
-#include "m4/rails.h"
-#include "m4/font.h"
-#include "m4/m4_views.h"
-#include "m4/mads_views.h"
-#include "m4/compression.h"
-#include "m4/staticres.h"
-#include "m4/animation.h"
-
-namespace M4 {
-
-static const int INV_ANIM_FRAME_SPEED = 2;
-static const int INVENTORY_X = 160;
-static const int INVENTORY_Y = 159;
-static const int SCROLLER_DELAY = 200;
-
-//--------------------------------------------------------------------------
-
-void SceneNode::load(Common::SeekableReadStream *stream) {
- // Get the next data block
- pt.x = stream->readUint16LE();
- pt.y = stream->readUint16LE();
-
- for (int i = 0; i < MAX_ROUTE_NODES; ++i)
- indexes[i] = stream->readUint16LE();
-}
-
-//--------------------------------------------------------------------------
-
-MadsScene::MadsScene(MadsEngine *vm): _sceneResources(), Scene(vm, &_sceneResources), MadsView(this) {
- _vm = vm;
- _activeAnimation = NULL;
-
- MadsView::_bgSurface = Scene::_backgroundSurface;
- MadsView::_depthSurface = Scene::_walkSurface;
- _interfaceSurface = new MadsInterfaceView(vm);
- _showMousePos = false;
- _mouseMsgIndex = -1;
- _previousScene = -1;
-}
-
-MadsScene::~MadsScene() {
- delete _activeAnimation;
- _activeAnimation = NULL;
- leaveScene();
- _vm->_viewManager->deleteView(_interfaceSurface);
-}
-
-/**
- * Secondary scene loading code
- */
-void MadsScene::loadScene2(const char *aaName, int sceneNumber) {
- // TODO: Completely finish
- _madsVm->globals()->previousScene = _madsVm->globals()->sceneNumber;
- _madsVm->globals()->sceneNumber = sceneNumber;
-
- _spriteSlots.clear();
- _sequenceList.clear();
- _kernelMessages.clear();
-
- // Load up the properties for the scene
- _sceneResources.load(_currentScene, NULL, 0/*word_83546*/, _walkSurface, _backgroundSurface);
-
- // Load scene walk paths
- loadSceneCodes(_currentScene);
-
- // Initialize the scene animation
- uint16 flags = 0x4100;
- if (_madsVm->globals()->_config.textWindowStill)
- flags |= 0x200;
-
- _sceneAnimation->initialize(aaName, flags, _interfaceSurface, NULL);
-}
-
-/**
- * Existing ScummVM code that needs to be eventually replaced with MADS code
- */
-void MadsScene::loadSceneTemporary() {
- /* Existing code that eventually needs to be replaced with the proper MADS code */
- // Set system palette entries
- _vm->_palette->blockRange(0, 18);
- RGB8 sysColors[3] = { {0x1f<<2, 0x2d<<2, 0x31<<2}, {0x24<<2, 0x37<<2, 0x3a<<2},
- {0x00<<2, 0x10<<2, 0x16<<2}};
- _vm->_palette->setPalette(&sysColors[0], 4, 3);
-
- _interfaceSurface->initialize();
-
- loadSceneHotspots(_currentScene);
-
- _action.clear();
-}
-
-void MadsScene::loadScene(int sceneNumber) {
- // Close the menu if it's active
- View *mainMenu = _vm->_viewManager->getView(VIEWID_MAINMENU);
- if (mainMenu != NULL) {
- _vm->_viewManager->deleteView(mainMenu);
- }
-
- // Handle common scene setting
- Scene::loadScene(sceneNumber);
- _madsVm->globals()->_nextSceneId = sceneNumber;
-
- // Existing ScummVM code that needs to be eventually replaced with MADS code
- loadSceneTemporary();
-
- _madsVm->_player._spritesChanged = true;
- _madsVm->globals()->clearQuotes();
- _dynamicHotspots.reset();
-
- // Signal the script engine what scene is to be active
- _sceneLogic.selectScene(sceneNumber);
-
- // Add the scene if necessary to the list of scenes that have been visited
- _vm->globals()->addVisitedScene(sceneNumber);
-
- if (_vm->getGameType() == GType_RexNebular)
- _sceneLogic.setupScene();
-
- // TODO: Unknown code
-
- // Secondary scene load routine
- if (_vm->getGameType() == GType_RexNebular)
- // Secondary scene load routine
- loadScene2("*I0.AA", sceneNumber);
-
- _madsVm->_player.loadSprites(NULL);
-
- switch (_madsVm->globals()->_config.screenFades) {
- case 0:
- _abortTimers2 = 2;
- break;
- case 2:
- _abortTimers2 = 21;
- break;
- default:
- _abortTimers2 = 20;
- break;
- }
- _abortTimers = 0;
- _abortTimersMode2 = ABORTMODE_1;
-
-
- // Do any scene specific setup
- if (_vm->getGameType() == GType_RexNebular)
- _sceneLogic.doEnterScene();
-
- // Miscellaneous player setup
- _madsVm->_player._destPos = _madsVm->_player._destPos;
- _madsVm->_player._newDirection = _madsVm->_player._direction;
- _madsVm->_player.setupFrame();
- _madsVm->_player.updateFrame();
-
- // Purge resources
- _vm->res()->purge();
-}
-
-void MadsScene::loadSceneHotspots(int sceneNumber) {
- char filename[kM4MaxFilenameSize];
- sprintf(filename, "rm%i.hh", sceneNumber);
- MadsPack hotSpotData(filename, _vm);
- Common::SeekableReadStream *hotspotStream = hotSpotData.getItemStream(0);
-
- int hotspotCount = hotspotStream->readUint16LE();
- delete hotspotStream;
-
- hotspotStream = hotSpotData.getItemStream(1);
-
- // Clear current hotspot lists
- _sceneResources.hotspots->clear();
- _sceneResources.hotspots->loadHotSpots(hotspotStream, hotspotCount);
-
- delete hotspotStream;
-}
-
-void MadsScene::leaveScene() {
- _sceneResources.hotspots->clear();
- _sceneResources.dynamicHotspots->clear();
-
- delete _sceneResources.hotspots;
- delete _sceneResources.dynamicHotspots;
- delete _walkSurface;
-
- if (_activeAnimation) {
- delete _activeAnimation;
- _activeAnimation = NULL;
- }
-
- Scene::leaveScene();
-}
-
-void MadsScene::show() {
- Scene::show();
- _vm->_viewManager->addView(_interfaceSurface);
-}
-
-void MadsScene::loadSceneCodes(int sceneNumber, int index) {
- char filename[kM4MaxFilenameSize];
- Common::SeekableReadStream *sceneS;
-
- if (_vm->getGameType() == GType_Phantom || _vm->getGameType() == GType_DragonSphere) {
- sprintf(filename, "rm%i.ww%i", sceneNumber, index);
- MadsPack walkData(filename, _vm);
- sceneS = walkData.getItemStream(0);
- _walkSurface->loadCodesMads(sceneS);
- _vm->res()->toss(filename);
- }
-}
-
-void MadsScene::mouseMove(int x, int y) {
- HotSpot *currentHotSpot = _sceneResources.hotspots->findByXY(x, y);
- if (currentHotSpot != NULL) {
- _vm->_mouse->setCursorNum(currentHotSpot->getCursor());
-
- _action._selectedRow = -1;
- _action._actionMode = ACTMODE_NONE;
- _action._actionMode2 = ACTMODE2_4;
- _action._hotspotId = currentHotSpot->getIndex();
-
- } else {
- _vm->_mouse->setCursorNum(0);
- }
-}
-
-void MadsScene::leftClick(int x, int y) {
- // TODO: figure out the rest of Scene_leftClick, and implements relevant parts in the interface class
- _action._v86F4C = -1;
- _action._v86F4E = 0;
- _customDest = _madsVm->_mouse->currentPos();
- _action._selectedAction = -1;
- _action._v86F4A = true;
-}
-
-void MadsScene::rightClick(int x, int y) {
- if (_vm->getGameType() == GType_RexNebular) {
- // ***DEBUG*** - sample dialog display
- int idx = 3; //_madsVm->_globals->messageIndexOf(0x277a);
- const char *msg = _madsVm->globals()->loadMessage(idx);
- Dialog *dlg = new Dialog(_vm, msg, "TEST DIALOG");
- _vm->_viewManager->addView(dlg);
- _vm->_viewManager->moveToFront(dlg);
- }
-}
-
-void MadsScene::setAction(int action, int objectId) {
- VALIDATE_MADS;
-
- error("todo");
- // TODO: Actually executing actions directly for objects. Also, some object actions are special in that
- // a second object can be selected, as in 'use gun to shoot person', with requires a target
-/*
- // Set up the new action
- strcpy(statusText, _madsVm->globals()->getVocab(action));
- statusText[0] = toupper(statusText[0]); // capitalize first letter
-
- if (objectId != -1) {
- MadsObject *obj = _madsVm->globals()->getObject(objectId);
- sprintf(statusText + strlen(statusText), " %s", _madsVm->globals()->getVocab(obj->descId));
- } else {
- _currentAction = action;
- }
-*/
-// setStatusText(statusText);
-}
-
-/**
- * Draws all the elements of the scene
- */
-void MadsScene::drawElements() {
- refresh();
-
- // Copy the user interface surface onto the surface
- _interfaceSurface->copyTo(this, 0, this->height() - _interfaceSurface->height());
-}
-
-
-void MadsScene::update() {
- // Draw all the various elements
- drawElements();
-
- _action.set();
-}
-
-void MadsScene::updateState() {
- if (!_abortTimers && !_madsVm->_player._unk3) {
- if (_dynamicHotspots._changed)
- _dynamicHotspots.refresh();
-
-// int v = (_madsVm->_player._stepEnabled && !_action._startWalkFlag && !_abortTimers2) ? 1 : 0;
-// _screenObjects.check(v, false);
- }
-
- // Handle starting off any selected action
- bool doPreAction = false;
- if ((_action._selectedAction != 0) && _madsVm->_player._stepEnabled &&
- !_action._startWalkFlag && !_abortTimers && !_madsVm->_player._unk3) {
- // Start the action
- _action.startAction();
-
- if (_action._action.verbId == kVerbLookAt) {
- _action._action.verbId = kVerbLook;
- _action._savedFields.selectedRow = 0;
- }
- doPreAction = true;
- }
- if (doPreAction || ((_abortTimers != 0) && (_abortTimersMode == ABORTMODE_2)))
- doPreactions();
-
- checkStartWalk();
-
- if (_action._inProgress && !_madsVm->_player._moving && !_action._startWalkFlag &&
- (_madsVm->_player._newDirection == _madsVm->_player._direction)) {
- // Reached the end of action movement, so ready to actually do action
- doAction();
- } else if ((_abortTimers != 0) && (_abortTimersMode == ABORTMODE_0))
- // Do an action designated by scripts
- doAction();
-
- bool freeFlag = false;
- if (_currentScene != _nextScene)
- freeFlag = true;
- else {
- doSceneStep();
-
- if (_currentScene != _nextScene)
- freeFlag = true;
- else {
- // Update the player
- _madsVm->_player.nextFrame();
-
- // Handle updating the animation
- if (!_abortTimers && (_activeAnimation))
- _activeAnimation->update();
-
- // Handle refreshing the mouse position display
- if (_mouseMsgIndex != -1)
- _madsVm->scene()->_kernelMessages.remove(_mouseMsgIndex);
- if (_showMousePos) {
- char buffer[20];
- sprintf(buffer, "(%d,%d)", _madsVm->_mouse->currentPos().x, _madsVm->_mouse->currentPos().y);
-
- _mouseMsgIndex = _madsVm->scene()->_kernelMessages.add(Common::Point(5, 5), 0x203, 0, 0, 1, buffer);
- }
- }
- }
-
- if (_madsVm->globals()->_config.easyMouse)
- _action.refresh();
-
- if ((_activeAnimation) && !_abortTimers) {
- _activeAnimation->update();
- if (((MadsAnimation *) _activeAnimation)->freeFlag() || freeFlag) {
- delete _activeAnimation;
- _activeAnimation = NULL;
- }
- }
-
- MadsView::update();
-
- // Remove the animation if it's been completed
- if ((_activeAnimation) && ((MadsAnimation *)_activeAnimation)->freeFlag())
- freeAnimation();
-
- if ((_action._selectedAction != 0) || !_madsVm->_player._stepEnabled) {
- _action.clear();
- _action._selectedAction = 0;
- }
-}
-
-void MadsScene::checkStartWalk() {
- if (_action._startWalkFlag && _action._walkFlag) {
- _madsVm->_player.setDest(_destPos.x, _destPos.y, _destFacing);
- _action._startWalkFlag = false;
- }
-}
-
-void MadsScene::doPreactions() {
- if ((_screenObjects._v832EC == 0) || (_screenObjects._v832EC == 2)) {
- _abortTimersMode2 = ABORTMODE_2;
- _action.checkAction();
-
- _sceneLogic.doPreactions();
-
- if (_abortTimersMode == ABORTMODE_2)
- _abortTimers = 0;
- }
-}
-
-void MadsScene::doSceneStep() {
- // Step through the scene
- _sceneLogic.doSceneStep();
-
- _madsVm->_player.step();
- _madsVm->_player._unk3 = 0;
-
- if (_abortTimersMode == ABORTMODE_1)
- _abortTimers = 0;
-}
-
-void MadsScene::doAction() {
- AbortTimerMode mode = ABORTMODE_0;
- _abortTimersMode2 = mode;
-
- if ((_action._inProgress || (_abortTimers != 0)) && !_action._v8453A) {
- _sceneLogic.doAction();
- mode = _action._inProgress ? ABORTMODE_0 : ABORTMODE_1;
- }
-
- if (_screenObjects._v832EC)
- _action._inProgress = false;
- else {
- if ((_action._inProgress || (_abortTimers != 0)) && (mode == ABORTMODE_0) && (_action._v8453A == mode)) {
- // TODO: sound_fn_p();
- mode = _action._inProgress ? ABORTMODE_0 : ABORTMODE_1;
-
- }
-
- if ((_action._inProgress || (_abortTimers != 0)) && (mode == ABORTMODE_0) && (_action._v8453A == mode)) {
- // Perform a core scene-indepedant action on an object
- // object_do_action
- }
- }
-
-}
-
-
-/**
- * Does extra work at cleaning up the animation, and then deletes it
- */
-void MadsScene::freeAnimation() {
- if (!_activeAnimation)
- return;
-
- MadsAnimation *anim = (MadsAnimation *)_activeAnimation;
- if (anim->freeFlag()) {
- _madsVm->scene()->_spriteSlots.clear();
- _madsVm->scene()->_spriteSlots.fullRefresh();
- _madsVm->scene()->_sequenceList.scan();
- }
-
- if (_madsVm->_player._visible) {
- _madsVm->_player._forceRefresh = true;
- _madsVm->_player.update();
- }
-
- delete _activeAnimation;
- _activeAnimation = NULL;
-}
-
-
-int MadsScene::loadSceneSpriteSet(const char *setName) {
- char resName[100];
- strcpy(resName, setName);
-
- // Append a '.SS' if it doesn't alreayd have an extension
- if (!strchr(resName, '.'))
- strcat(resName, ".SS");
-
- return _spriteSlots.addSprites(resName);
-}
-
-enum boxSprites {
- topLeft = 0,
- topRight = 1,
- bottomLeft = 2,
- bottomRight = 3,
- left = 4,
- right = 5,
- top = 6,
- bottom = 7,
- topMiddle = 8,
- filler1 = 9,
- filler2 = 10
- // TODO: finish this
-};
-
-// TODO: calculate width and height, show text, show face if it exists
-// TODO: this has been tested with Dragonsphere only, there are some differences
-// in the sprites used in Phantom
-void MadsScene::showMADSV2TextBox(char *text, int x, int y, char *faceName) {
- int repeatX = 40; // FIXME: this is hardcoded
- int repeatY = 30; // FIXME: this is hardcoded
- int curX = x, curY = y;
- int topRightX = x; // TODO: this is probably not needed
- Common::SeekableReadStream *data = _vm->res()->get("box.ss");
- SpriteAsset *boxSprites = new SpriteAsset(_vm, data, data->size(), "box.ss");
- _vm->res()->toss("box.ss");
-
- RGBList *palData = new RGBList(boxSprites->getColorCount(), boxSprites->getPalette(), true);
- _vm->_palette->addRange(palData);
-
- for (int i = 0; i < boxSprites->getCount(); i++)
- boxSprites->getFrame(i)->translate(palData); // sprite pixel translation
-
- // Top left corner
- boxSprites->getFrame(topLeft)->copyTo(_backgroundSurface, x, curY);
- curX += boxSprites->getFrame(topLeft)->width();
-
- // Top line
- for (int i = 0; i < repeatX; i++) {
- boxSprites->getFrame(top)->copyTo(_backgroundSurface, curX, curY + 3);
- curX += boxSprites->getFrame(top)->width();
- }
-
- // Top right corner
- boxSprites->getFrame(topRight)->copyTo(_backgroundSurface, curX, curY);
- topRightX = curX;
-
- // Top middle
- // FIXME: the transparent color for this is also the black border color
- boxSprites->getFrame(topMiddle)->copyTo(_backgroundSurface,
- x + (curX - x) / 2 - boxSprites->getFrame(topMiddle)->width() / 2,
- curY - 5, 167);
- curX = x;
- curY += boxSprites->getFrame(topLeft)->height();
-
- // -----------------------------------------------------------------------------------------------
-
- // Draw contents
- for (int i = 0; i < repeatY; i++) {
- for (int j = 0; j < repeatX; j++) {
- if (j == 0) {
- boxSprites->getFrame(left)->copyTo(_backgroundSurface, curX + 3, curY);
- curX += boxSprites->getFrame(left)->width();
- } else if (j == repeatX - 1) {
- curX = topRightX - 2;
- boxSprites->getFrame(right)->copyTo(_backgroundSurface, curX + 3, curY + 1);
- } else {
- // TODO: the background of the contents follows a pattern which is not understood yet
- if (j % 2 == 0) {
- boxSprites->getFrame(filler1)->copyTo(_backgroundSurface, curX + 3, curY);
- curX += boxSprites->getFrame(filler1)->width();
- } else {
- boxSprites->getFrame(filler2)->copyTo(_backgroundSurface, curX + 3, curY);
- curX += boxSprites->getFrame(filler2)->width();
- }
- }
- } // for j
- curX = x;
- curY += boxSprites->getFrame(left)->height();
- } // for i
-
- // -----------------------------------------------------------------------------------------------
- curX = x;
-
- // Bottom left corner
- boxSprites->getFrame(bottomLeft)->copyTo(_backgroundSurface, curX, curY);
- curX += boxSprites->getFrame(bottomLeft)->width();
-
- // Bottom line
- for (int i = 0; i < repeatX; i++) {
- boxSprites->getFrame(bottom)->copyTo(_backgroundSurface, curX, curY + 1);
- curX += boxSprites->getFrame(bottom)->width();
- }
-
- // Bottom right corner
- boxSprites->getFrame(bottomRight)->copyTo(_backgroundSurface, curX, curY + 1);
-}
-
-void MadsScene::loadAnimation(const Common::String &animName, int abortTimers) {
- if (_activeAnimation)
- error("Multiple active animations are not allowed");
-
- MadsAnimation *anim = new MadsAnimation(_vm, this);
- anim->load(animName.c_str(), abortTimers);
- _activeAnimation = anim;
-}
-
-bool MadsScene::getDepthHighBit(const Common::Point &pt) {
- const byte *p = _depthSurface->getBasePtr(pt.x, pt.y);
- if (_sceneResources._depthStyle == 2)
- return ((*p << 4) & 0x80) != 0;
-
- return (*p & 0x80) != 0;
-}
-
-bool MadsScene::getDepthHighBits(const Common::Point &pt) {
- if (_sceneResources._depthStyle == 2)
- return 0;
-
- const byte *p = _depthSurface->getBasePtr(pt.x, pt.y);
- return (*p & 0x70) >> 4;
-}
-
-/*--------------------------------------------------------------------------*/
-
-void MadsSceneResources::load(int sceneNumber, const char *resName, int v0, M4Surface *depthSurface, M4Surface *surface) {
- char buffer1[80];
- const char *sceneName;
-
- // TODO: Initialize spriteSet / xp_list
-
- if (sceneNumber > 0) {
- sceneName = MADSResourceManager::getResourceName(RESPREFIX_RM, sceneNumber, ".DAT");
- } else {
- strcpy(buffer1, "*");
- strcat(buffer1, resName);
- sceneName = buffer1; // TODO: Check whether this needs to be converted to 'HAG form'
- }
-
- Common::SeekableReadStream *rawStream = _vm->_resourceManager->get(sceneName);
- MadsPack sceneInfo(rawStream);
-
- // Chunk 0:
- // Basic scene info
- Common::SeekableReadStream *stream = sceneInfo.getItemStream(0);
-
- if (_vm->getGameType() == GType_RexNebular) {
- int resSceneId = stream->readUint16LE();
- assert(resSceneId == sceneNumber);
- } else {
- char roomFilename[10];
- char roomFilenameExpected[10];
- sprintf(roomFilenameExpected, "*RM%d", sceneNumber);
-
- stream->read(roomFilename, 6);
- roomFilename[6] = 0;
- assert(!strcmp(roomFilename, roomFilenameExpected));
- }
-
- // TODO: The following is wrong for Phantom/Dragon
- _artFileNum = stream->readUint16LE();
- _depthStyle = stream->readUint16LE();
- _width = stream->readUint16LE();
- _height = stream->readUint16LE();
-
- stream->skip(24);
-
- int nodeCount = stream->readUint16LE();
- _yBandsEnd = stream->readUint16LE();
- _yBandsStart = stream->readUint16LE();
- _maxScale = stream->readSint16LE();
- _minScale = stream->readSint16LE();
- for (int i = 0; i < DEPTH_BANDS_SIZE; ++i)
- _depthBands[i] = stream->readUint16LE();
- stream->skip(2);
-
- // Load in any scene objects
- for (int i = 0; i < nodeCount; ++i) {
- SceneNode rec;
- rec.load(stream);
- _nodes.push_back(rec);
- }
- for (int i = 0; i < 20 - nodeCount; ++i)
- stream->skip(48);
-
- // Add two extra nodes in that will be used for player movement
- for (int i = 0; i < 2; ++i) {
- SceneNode rec;
- _nodes.push_back(rec);
- }
-
- int setCount = stream->readUint16LE();
- stream->readUint16LE();
- for (int i = 0; i < setCount; ++i) {
- char buffer2[64];
- Common::String s(buffer2, 64);
- _setNames.push_back(s);
- }
-
- delete stream;
-
- // Initialize a copy of the surfaces if they weren't provided
- bool dsFlag = false, ssFlag = false;
- if (!surface) {
- surface = new M4Surface(_width, _height);
- ssFlag = true;
- } else if ((_width != surface->width()) || (_height != surface->height()))
- surface->setSize(_width, _height);
-
- if (!depthSurface) {
- depthSurface = new M4Surface(_width, _height);
- dsFlag = true;
- } else if ((_width != depthSurface->width()) || (_height != depthSurface->height()))
- depthSurface->setSize(_width, _height);
-
-
- // For Rex Nebular, read in the scene's compressed walk surface information
- if (_vm->getGameType() == GType_RexNebular) {
- assert(depthSurface);
- stream = sceneInfo.getItemStream(1);
- byte *walkData = (byte *)malloc(stream->size());
- stream->read(walkData, stream->size());
-
- // For Rex Nebular, the walk areas are part of the scene info
- byte *destP = depthSurface->getBasePtr(0, 0);
- const byte *srcP = walkData;
- byte runLength;
-
- // Run length encoded depth data
- while ((runLength = *srcP++) != 0) {
- if (_depthStyle == 2) {
- // 2-bit depth pixels
- byte byteVal = *srcP++;
- for (int byteCtr = 0; byteCtr < runLength; ++byteCtr) {
- byte v = byteVal;
- for (int bitCtr = 0; bitCtr < 4; ++bitCtr, v >>= 2)
- *destP++ = (((v & 1) + 1) << 3) - 1;
- }
- } else {
- // 8-bit depth pixels
- Common::set_to(destP, destP + runLength, *srcP++);
- destP += runLength;
- }
- }
-
- free(walkData);
- delete stream;
- }
-
- _vm->_resourceManager->toss(sceneName);
-
- // Load the surface artwork
- surface->loadBackground(_artFileNum);
-
- // Final cleanup
- if (ssFlag)
- delete surface;
- if (dsFlag)
- delete depthSurface;
-}
-
-void MadsSceneResources::setRouteNode(int nodeIndex, const Common::Point &pt, M4Surface *depthSurface) {
- int flags, hypotenuse;
-
- _nodes[nodeIndex].pt = pt;
-
- // Recalculate inter-node lengths
- for (uint idx = 0; idx < _nodes.size(); ++idx) {
- int entry;
- if (idx == (uint)nodeIndex) {
- entry = 0x3FFF;
- } else {
- // Process the node
- flags = getRouteFlags(pt, _nodes[idx].pt, depthSurface);
-
- int xDiff = ABS(_nodes[idx].pt.x - pt.x);
- int yDiff = ABS(_nodes[idx].pt.y - pt.y);
- hypotenuse = SqrtF16(xDiff * xDiff + yDiff * yDiff);
-
- if (hypotenuse >= 0x3FFF)
- // Shouldn't ever be this large
- hypotenuse = 0x3FFF;
-
- entry = hypotenuse | flags;
- _nodes[idx].indexes[nodeIndex] = entry;
- _nodes[nodeIndex].indexes[idx] = entry;
- }
- }
-}
-
-int MadsSceneResources::getRouteFlags(const Common::Point &src, const Common::Point &dest, M4Surface *depthSurface) {
- int result = 0x8000;
- bool flag = false;
-
- int xDiff = ABS(dest.x - src.x);
- int yDiff = ABS(dest.y - src.y);
- int xDirection = dest.x >= src.x ? 1 : -1;
- int yDirection = dest.y >= src.y ? depthSurface->width() : -depthSurface->width();
- int majorDiff = 0;
- if (dest.x < src.x)
- majorDiff = MAX(xDiff, yDiff);
- ++xDiff;
- ++yDiff;
-
- byte *srcP = depthSurface->getBasePtr(src.x, src.y);
-
- int totalCtr = majorDiff;
- for (int xCtr = 0; xCtr < xDiff; ++xCtr, srcP += xDirection) {
- totalCtr += yDiff;
-
- if ((*srcP & 0x80) == 0)
- flag = false;
- else if (!flag) {
- flag = true;
- result -= 0x4000;
- if (result == 0)
- break;
- }
-
- while (totalCtr >= xDiff) {
- totalCtr -= xDiff;
-
- if ((*srcP & 0x80) == 0)
- flag = false;
- else if (!flag) {
- flag = true;
- result -= 0x4000;
- if (result == 0)
- break;
- }
-
- srcP += yDirection;
- }
- if (result == 0)
- break;
- }
-
- return result;
-}
-
-/*--------------------------------------------------------------------------*/
-
-/*--------------------------------------------------------------------------
- * MadsInterfaceView handles the user interface section at the bottom of
- * game screens in MADS games
- *--------------------------------------------------------------------------
- */
-
-MadsInterfaceView::MadsInterfaceView(MadsM4Engine *vm): GameInterfaceView(vm,
- Common::Rect(0, MADS_SURFACE_HEIGHT, vm->_screen->width(), vm->_screen->height())) {
- _screenType = VIEWID_INTERFACE;
- _highlightedElement = -1;
- _topIndex = 0;
- _selectedObject = -1;
- _cheatKeyCtr = 0;
-
- _objectSprites = NULL;
- _objectPalData = NULL;
-
- /* Set up the rect list for screen elements */
- // Actions
- for (int i = 0; i < 10; ++i)
- _screenObjects.addRect((i / 5) * 32 + 1, (i % 5) * 8 + MADS_SURFACE_HEIGHT + 2,
- ((i / 5) + 1) * 32 + 3, ((i % 5) + 1) * 8 + MADS_SURFACE_HEIGHT + 2);
-
- // Scroller elements (up arrow, scroller, down arrow)
- _screenObjects.addRect(73, 160, 82, 167);
- _screenObjects.addRect(73, 168, 82, 190);
- _screenObjects.addRect(73, 191, 82, 198);
-
- // Inventory object names
- for (int i = 0; i < 5; ++i)
- _screenObjects.addRect(89, 158 + i * 8, 160, 166 + i * 8);
-
- // Full rectangle area for all vocab actions
- for (int i = 0; i < 5; ++i)
- _screenObjects.addRect(239, 158 + i * 8, 320, 166 + i * 8);
-}
-
-MadsInterfaceView::~MadsInterfaceView() {
- delete _objectSprites;
-}
-
-void MadsInterfaceView::setFontMode(InterfaceFontMode newMode) {
- switch (newMode) {
- case ITEM_NORMAL:
- _vm->_font->current()->setColors(4, 4, 0xff);
- break;
- case ITEM_HIGHLIGHTED:
- _vm->_font->current()->setColors(5, 5, 0xff);
- break;
- case ITEM_SELECTED:
- _vm->_font->current()->setColors(6, 6, 0xff);
- break;
- }
-}
-
-void MadsInterfaceView::initialize() {
- // Build up the inventory list
- _inventoryList.clear();
-
- for (uint i = 0; i < _madsVm->globals()->getObjectsSize(); ++i) {
- MadsObject *obj = _madsVm->globals()->getObject(i);
- if (obj->_roomNumber == PLAYER_INVENTORY)
- _inventoryList.push_back(i);
- }
-
- // If the inventory has at least one object, select it
- if (_inventoryList.size() > 0)
- setSelectedObject(_inventoryList[0]);
-}
-
-void MadsInterfaceView::setSelectedObject(int objectNumber) {
- char resName[80];
-
- // Load inventory resource
- if (_objectSprites) {
- _vm->_palette->deleteRange(_objectPalData);
- delete _objectSprites;
- }
-
- // Check to make sure the object is in the inventory, and also visible on-screen
- int idx = _inventoryList.indexOf(objectNumber);
- if (idx == -1) {
- // Object wasn't found, so return
- _selectedObject = -1;
- return;
- }
-
- // Found the object
- if (idx < _topIndex)
- _topIndex = idx;
- else if (idx >= (_topIndex + 5))
- _topIndex = MAX(0, idx - 4);
-
- _selectedObject = objectNumber;
- sprintf(resName, "*OB%.3dI.SS", objectNumber);
-
- Common::SeekableReadStream *data = _vm->res()->get(resName);
- _objectSprites = new SpriteAsset(_vm, data, data->size(), resName);
- _vm->res()->toss(resName);
-
- // Slot it into available palette space
- _objectPalData = _objectSprites->getRgbList();
- _vm->_palette->addRange(_objectPalData);
- _objectSprites->translate(_objectPalData, true);
-
- _objectFrameNumber = 0;
-}
-
-void MadsInterfaceView::addObjectToInventory(int objectNumber) {
- if (_inventoryList.indexOf(objectNumber) == -1) {
- _madsVm->globals()->getObject(objectNumber)->_roomNumber = PLAYER_INVENTORY;
- _inventoryList.push_back(objectNumber);
- }
-
- setSelectedObject(objectNumber);
-}
-
-void MadsInterfaceView::onRefresh(RectList *rects, M4Surface *destSurface) {
- _vm->_font->setFont(FONT_INTERFACE_MADS);
- char buffer[100];
-
- // Check to see if any dialog is currently active
- bool dialogVisible = _vm->_viewManager->getView(LAYER_DIALOG) != NULL;
-
- // Highlighting logic for action list
- int actionIndex = 0;
- for (int x = 0; x < 2; ++x) {
- for (int y = 0; y < 5; ++y, ++actionIndex) {
- // Determine the font color depending on whether an item is selected. Note that the first action,
- // 'Look', is always 'selected', even when another action is clicked on
- setFontMode((_highlightedElement == actionIndex) ? ITEM_HIGHLIGHTED :
- ((actionIndex == 0) ? ITEM_SELECTED : ITEM_NORMAL));
-
- // Get the verb action and capitalise it
- const char *verbStr = _madsVm->globals()->getVocab(kVerbLook + actionIndex);
- strcpy(buffer, verbStr);
- if ((buffer[0] >= 'a') && (buffer[0] <= 'z')) buffer[0] -= 'a' - 'A';
-
- // Display the verb
- const Common::Rect r(_screenObjects[actionIndex]);
- _vm->_font->current()->writeString(destSurface, buffer, r.left, r.top, r.width(), 0);
- }
- }
-
- // Check for highlighting of the scrollbar controls
- if ((_highlightedElement == SCROLL_UP) || (_highlightedElement == SCROLL_SCROLLER) || (_highlightedElement == SCROLL_DOWN)) {
- // Highlight the control's borders
- const Common::Rect r(_screenObjects[_highlightedElement]);
- destSurface->frameRect(r, 5);
- }
-
- // Draw the horizontal line in the scroller representing the current top selected
- const Common::Rect scroller(_screenObjects[SCROLL_SCROLLER]);
- int yP = (_inventoryList.size() < 2) ? 0 : (scroller.height() - 5) * _topIndex / (_inventoryList.size() - 1);
- destSurface->setColor(4);
- destSurface->hLine(scroller.left + 2, scroller.right - 3, scroller.top + 2 + yP);
-
- // List inventory items
- for (uint i = 0; i < 5; ++i) {
- if ((_topIndex + i) >= _inventoryList.size())
- break;
-
- const char *descStr = _madsVm->globals()->getVocab(_madsVm->globals()->getObject(
- _inventoryList[_topIndex + i])->_descId);
- strcpy(buffer, descStr);
- if ((buffer[0] >= 'a') && (buffer[0] <= 'z')) buffer[0] -= 'a' - 'A';
-
- const Common::Rect r(_screenObjects[INVLIST_START + i]);
-
- // Set the highlighting of the inventory item
- if (_highlightedElement == (int)(INVLIST_START + i)) setFontMode(ITEM_HIGHLIGHTED);
- else if (_selectedObject == _inventoryList[_topIndex + i]) setFontMode(ITEM_SELECTED);
- else setFontMode(ITEM_NORMAL);
-
- // Write out it's description
- _vm->_font->current()->writeString(destSurface, buffer, r.left, r.top, r.width(), 0);
- }
-
- // Handle the display of any currently selected object
- if (_objectSprites) {
- // Display object sprite. Note that the frame number isn't used directly, because it would result
- // in too fast an animation
- M4Sprite *spr = _objectSprites->getFrame(_objectFrameNumber / INV_ANIM_FRAME_SPEED);
- spr->copyTo(destSurface, INVENTORY_X, INVENTORY_Y, TRANSPARENT_COLOR_INDEX);
-
- if (!_madsVm->globals()->_config.invObjectsStill && !dialogVisible) {
- // If objects need to be animated, move to the next frame
- if (++_objectFrameNumber >= (_objectSprites->getCount() * INV_ANIM_FRAME_SPEED))
- _objectFrameNumber = 0;
- }
-
- // List the vocab actions for the currently selected object
- MadsObject *obj = _madsVm->globals()->getObject(_selectedObject);
- int yIndex = MIN(_highlightedElement - VOCAB_START, obj->_vocabCount - 1);
-
- for (int i = 0; i < obj->_vocabCount; ++i) {
- const Common::Rect r(_screenObjects[VOCAB_START + i]);
-
- // Get the vocab description and capitalise it
- const char *descStr = _madsVm->globals()->getVocab(obj->_vocabList[i].vocabId);
- strcpy(buffer, descStr);
- if ((buffer[0] >= 'a') && (buffer[0] <= 'z')) buffer[0] -= 'a' - 'A';
-
- // Set the highlighting and display the entry
- setFontMode((i == yIndex) ? ITEM_HIGHLIGHTED : ITEM_NORMAL);
- _vm->_font->current()->writeString(destSurface, buffer, r.left, r.top, r.width(), 0);
- }
- }
-}
-
-bool MadsInterfaceView::onEvent(M4EventType eventType, int32 param1, int x, int y, bool &captureEvents) {
- MadsAction &act = _madsVm->scene()->_action;
-
- // If the mouse isn't being held down, then reset the repeated scroll timer
- if (eventType != MEVENT_LEFT_HOLD)
- _nextScrollerTicks = 0;
-
- // Handle various event types
- switch (eventType) {
- case MEVENT_MOVE:
- // If the cursor isn't in "wait mode", don't do any processing
- if (_vm->_mouse->getCursorNum() == CURSOR_WAIT)
- return true;
-
- // Ensure the cursor is the standard arrow
- _vm->_mouse->setCursorNum(CURSOR_ARROW);
-
- // Check if any interface element is currently highlighted
- _highlightedElement = _screenObjects.find(Common::Point(x, y));
-
- return true;
-
- case MEVENT_LEFT_CLICK:
- // Left mouse click
- {
- // Check if an inventory object was selected
- if ((_highlightedElement >= INVLIST_START) && (_highlightedElement < (INVLIST_START + 5))) {
- // Ensure there is an inventory item listed in that cell
- uint idx = _highlightedElement - INVLIST_START;
- if ((_topIndex + idx) < _inventoryList.size()) {
- // Set the selected object
- setSelectedObject(_inventoryList[_topIndex + idx]);
- }
- } else if ((_highlightedElement >= ACTIONS_START) && (_highlightedElement < (ACTIONS_START + 10))) {
- // A standard action was selected
- int verbId = kVerbLook + (_highlightedElement - ACTIONS_START);
- warning("Selected action #%d", verbId);
-
- } else if ((_highlightedElement >= VOCAB_START) && (_highlightedElement < (VOCAB_START + 5))) {
- // A vocab action was selected
- MadsObject *obj = _madsVm->globals()->getObject(_selectedObject);
- int vocabIndex = MIN(_highlightedElement - VOCAB_START, obj->_vocabCount - 1);
- if (vocabIndex >= 0) {
- act._actionMode = ACTMODE_OBJECT;
- act._actionMode2 = ACTMODE2_2;
- act._flags1 = obj->_vocabList[1].flags1;
- act._flags2 = obj->_vocabList[1].flags2;
-
- act._action.verbId = _selectedObject;
- act._articleNumber = act._flags2;
- }
- }
- }
- return true;
-
- case MEVENT_LEFT_HOLD:
- // Left mouse hold
- // Handle the scroller - the up/down buttons allow for multiple actions whilst the mouse is held down
- if ((_highlightedElement == SCROLL_UP) || (_highlightedElement == SCROLL_DOWN)) {
- if ((_nextScrollerTicks == 0) || (g_system->getMillis() >= _nextScrollerTicks)) {
- // Handle scroll up/down action
- _nextScrollerTicks = g_system->getMillis() + SCROLLER_DELAY;
-
- if ((_highlightedElement == SCROLL_UP) && (_topIndex > 0))
- --_topIndex;
- if ((_highlightedElement == SCROLL_DOWN) && (_topIndex < (int)(_inventoryList.size() - 1)))
- ++_topIndex;
- }
- }
- return true;
-
- case MEVENT_LEFT_DRAG:
- // Left mouse drag
- // Handle the the the scroller area that can be dragged to adjust the top displayed index
- if (_highlightedElement == SCROLL_SCROLLER) {
- // Calculate the new top index based on the Y position
- const Common::Rect r(_screenObjects[SCROLL_SCROLLER]);
- _topIndex = CLIP((int)(_inventoryList.size() - 1) * (y - r.top - 2) / (r.height() - 5),
- 0, (int)_inventoryList.size() - 1);
- }
- return true;
-
- case KEVENT_KEY:
- if (_cheatKeyCtr == CHEAT_SEQUENCE_MAX)
- handleCheatKey(param1);
- handleKeypress(param1);
- return true;
-
- default:
- break;
- }
-
- return false;
-}
-
-bool MadsInterfaceView::handleCheatKey(int32 keycode) {
- switch (keycode) {
- case Common::KEYCODE_SPACE:
- // TODO: Move player to current destination
- return true;
-
- case Common::KEYCODE_c | (Common::KBD_CTRL << 24):
- // Toggle display of mouse position
- _madsVm->scene()->_showMousePos = !_madsVm->scene()->_showMousePos;
- break;
-
- case Common::KEYCODE_t | (Common::KBD_ALT << 24): {
- // Teleport to room
- //Scene *sceneView = (Scene *)vm->_viewManager->getView(VIEWID_SCENE);
- // TODO: Implement teleport code
-
- return true;
- }
-
- default:
- break;
- }
-
- return false;
-}
-
-const char *CHEAT_SEQUENCE = "widepipe";
-
-bool MadsInterfaceView::handleKeypress(int32 keycode) {
- int flags = keycode >> 24;
- int kc = keycode & 0xffff;
-
- // Capitalise the letter if necessary
- if (_cheatKeyCtr < CHEAT_SEQUENCE_MAX) {
- if ((flags & Common::KBD_CTRL) && (kc == CHEAT_SEQUENCE[_cheatKeyCtr])) {
- ++_cheatKeyCtr;
- if (_cheatKeyCtr == CHEAT_SEQUENCE_MAX)
- Dialog::display(_vm, 22, cheatingEnabledDesc);
- return true;
- } else {
- _cheatKeyCtr = 0;
- }
- }
-
- // Handle the various keys
- if ((keycode == Common::KEYCODE_ESCAPE) || (keycode == Common::KEYCODE_F1)) {
- // Game menu
- _madsVm->globals()->dialogType = DIALOG_GAME_MENU;
- leaveScene();
- return false;
- } else if (flags & Common::KBD_CTRL) {
- // Handling of the different control key combinations
- switch (kc) {
- case Common::KEYCODE_i:
- // Mouse to inventory
- warning("TODO: Mouse to inventory");
- break;
-
- case Common::KEYCODE_k:
- // Toggle hotspots
- warning("TODO: Toggle hotspots");
- break;
-
- case Common::KEYCODE_p:
- // Player stats
- warning("TODO: Player stats");
- break;
-
- case Common::KEYCODE_q:
- // Quit game
- break;
-
- case Common::KEYCODE_s:
- // Activate sound
- warning("TODO: Activate sound");
- break;
-
- case Common::KEYCODE_t:
- // Rotate player - This was Ctrl-U in the original, but in ScummVM Ctrl-U is a global mute key
- _madsVm->_player._newDirection = _madsVm->_player._directionListIndexes[_madsVm->_player._newDirection + 10];
- break;
-
- case Common::KEYCODE_v: {
- // Release version
- Dialog *dlg = new Dialog(_vm, GameReleaseInfoStr, GameReleaseTitleStr);
- _vm->_viewManager->addView(dlg);
- _vm->_viewManager->moveToFront(dlg);
- return false;
- }
-
- default:
- break;
- }
- } else if ((flags & Common::KBD_ALT) && (kc == Common::KEYCODE_q)) {
- // Quit Game
-
- } else {
- // Standard keypresses
- switch (kc) {
- case Common::KEYCODE_F2:
- // Save game
- _madsVm->globals()->dialogType = DIALOG_SAVE;
- leaveScene();
- break;
- case Common::KEYCODE_F3:
- // Restore game
- _madsVm->globals()->dialogType = DIALOG_RESTORE;
- leaveScene();
- break;
- }
- }
-//DIALOG_OPTIONS
- return false;
-}
-
-void MadsInterfaceView::leaveScene() {
- // Close the scene
- View *view = _madsVm->_viewManager->getView(VIEWID_SCENE);
- _madsVm->_viewManager->deleteView(view);
-}
-
-//--------------------------------------------------------------------------
-
-int getActiveAnimationBool() {
- return (_madsVm->scene()->activeAnimation()) ? 1 : 0;
-}
-
-int getAnimationCurrentFrame() {
- Animation *anim = _madsVm->scene()->activeAnimation();
- return anim ? anim->getCurrentFrame() : 0;
-}
-
-
-} // End of namespace M4
diff --git a/engines/m4/mads_scene.h b/engines/m4/mads_scene.h
deleted file mode 100644
index 9835de4daf..0000000000
--- a/engines/m4/mads_scene.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/* 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 M4_MADS_SCENE_H
-#define M4_MADS_SCENE_H
-
-#include "m4/scene.h"
-#include "m4/mads_logic.h"
-#include "m4/mads_views.h"
-
-namespace M4 {
-
-#define INTERFACE_HEIGHT 106
-class MadsInterfaceView;
-
-#define DEPTH_BANDS_SIZE 15
-#define MAX_ROUTE_NODES 22
-
-enum ScreenCategory {CAT_NONE = 0, CAT_ACTION = 1, CAT_INV_LIST = 2, CAT_INV_VOCAB, CAT_HOTSPOT = 4,
- CAT_INV_ANIM = 6, CAT_6, CAT_INV_SCROLLER = 7, CAT_12 = 12};
-
-class SceneNode {
-public:
- Common::Point pt;
- int indexes[MAX_ROUTE_NODES];
-
- bool active;
-
- SceneNode() {
- active = false;
- }
-
- void load(Common::SeekableReadStream *stream);
-};
-
-typedef Common::Array<SceneNode> SceneNodeList;
-
-class MadsSceneResources: public SceneResources {
-private:
- int getRouteFlags(const Common::Point &src, const Common::Point &dest, M4Surface *depthSurface);
-public:
- int _sceneId;
- int _artFileNum;
- int _depthStyle;
- int _width;
- int _height;
- SceneNodeList _nodes;
- Common::Array<Common::String> _setNames;
- int _yBandsStart, _yBandsEnd;
- int _maxScale, _minScale;
- int _depthBands[DEPTH_BANDS_SIZE];
-
- MadsSceneResources() {}
- ~MadsSceneResources() {}
- void load(int sceneId, const char *resName, int v0, M4Surface *depthSurface, M4Surface *surface);
- int bandsRange() const { return _yBandsEnd - _yBandsStart; }
- int scaleRange() const { return _maxScale - _minScale; }
- void setRouteNode(int nodeIndex, const Common::Point &pt, M4Surface *depthSurface);
-};
-
-class MadsScene : public Scene, public MadsView {
-private:
- MadsEngine *_vm;
- MadsSceneResources _sceneResources;
- Animation *_activeAnimation;
-
- MadsSceneLogic _sceneLogic;
- SpriteAsset *_playerSprites;
- int _mouseMsgIndex;
- int _highlightedHotspot;
-
- void drawElements();
- void loadScene2(const char *aaName, int sceneNumber);
- void loadSceneTemporary();
- void loadSceneHotspots(int sceneNumber);
- void clearAction();
- void appendActionVocab(int vocabId, bool capitalise);
- void setAction();
- void checkStartWalk();
- void doPreactions();
- void doSceneStep();
- void doAction();
-public:
- char _aaName[100];
- bool _showMousePos;
- Common::Point _destPos;
- int _destFacing;
- Common::Point _customDest;
-public:
- MadsScene(MadsEngine *vm);
- virtual ~MadsScene();
- void initialize() {
- _sceneLogic.initializeScripts();
- }
-
- // Methods that differ between engines
- virtual void loadScene(int sceneNumber);
- virtual void leaveScene();
- virtual void loadSceneCodes(int sceneNumber, int index = 0);
- virtual void show();
- virtual void mouseMove(int x, int y);
- virtual void leftClick(int x, int y);
- virtual void rightClick(int x, int y);
- virtual void setAction(int action, int objectId = -1);
- virtual void update();
-
- virtual void updateState();
-
- int loadSceneSpriteSet(const char *setName);
- void showMADSV2TextBox(char *text, int x, int y, char *faceName);
- void loadAnimation(const Common::String &animName, int abortTimers);
- Animation *activeAnimation() const { return _activeAnimation; }
- void freeAnimation();
-
- MadsInterfaceView *getInterface() { return (MadsInterfaceView *)_interfaceSurface; }
- MadsSceneResources &getSceneResources() { return _sceneResources; }
- bool getDepthHighBit(const Common::Point &pt);
- bool getDepthHighBits(const Common::Point &pt);
-};
-
-#define CHEAT_SEQUENCE_MAX 8
-
-class IntegerList : public Common::Array<int> {
-public:
- int indexOf(int v) {
- for (uint i = 0; i < size(); ++i)
- if (operator [](i) == v)
- return i;
- return -1;
- }
-};
-
-enum InterfaceFontMode {ITEM_NORMAL, ITEM_HIGHLIGHTED, ITEM_SELECTED};
-
-enum InterfaceObjects {ACTIONS_START = 0, SCROLL_UP = 10, SCROLL_SCROLLER = 11, SCROLL_DOWN = 12,
- INVLIST_START = 13, VOCAB_START = 18};
-
-class MadsInterfaceView : public GameInterfaceView {
-private:
- IntegerList _inventoryList;
- RectList _screenObjects;
- int _highlightedElement;
- int _topIndex;
- uint32 _nextScrollerTicks;
- int _cheatKeyCtr;
-
- // Object display fields
- int _selectedObject;
- SpriteAsset *_objectSprites;
- RGBList *_objectPalData;
- int _objectFrameNumber;
-
- void setFontMode(InterfaceFontMode newMode);
- bool handleCheatKey(int32 keycode);
- bool handleKeypress(int32 keycode);
- void leaveScene();
-public:
- MadsInterfaceView(MadsM4Engine *vm);
- ~MadsInterfaceView();
-
- virtual void initialize();
- virtual void setSelectedObject(int objectNumber);
- virtual void addObjectToInventory(int objectNumber);
- int getSelectedObject() { return _selectedObject; }
- int getInventoryObject(int objectIndex) { return _inventoryList[objectIndex]; }
-
- void onRefresh(RectList *rects, M4Surface *destSurface);
- bool onEvent(M4EventType eventType, int32 param1, int x, int y, bool &captureEvents);
-};
-
-extern int getActiveAnimationBool();
-extern int getAnimationCurrentFrame();
-
-} // End of namespace M4
-
-#endif
diff --git a/engines/m4/mads_views.cpp b/engines/m4/mads_views.cpp
deleted file mode 100644
index 0521903c95..0000000000
--- a/engines/m4/mads_views.cpp
+++ /dev/null
@@ -1,1632 +0,0 @@
-/* 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 "m4/m4_views.h"
-#include "m4/animation.h"
-#include "m4/dialogs.h"
-#include "m4/events.h"
-#include "m4/font.h"
-#include "m4/globals.h"
-#include "m4/mads_menus.h"
-#include "m4/m4.h"
-#include "m4/staticres.h"
-
-#include "common/algorithm.h"
-#include "common/textconsole.h"
-
-namespace M4 {
-
-MadsAction::MadsAction(MadsView &owner): _owner(owner) {
- clear();
- _currentAction = kVerbNone;
- _startWalkFlag = false;
- _statusTextIndex = -1;
- _selectedAction = 0;
- _inProgress = false;
-}
-
-void MadsAction::clear() {
- _v83338 = 1;
- _actionMode = ACTMODE_NONE;
- _actionMode2 = ACTMODE2_0;
- _v86F42 = 0;
- _v86F4E = 0;
- _articleNumber = 0;
- _lookFlag = false;
- _v86F4A = 0;
- _statusText[0] = '\0';
- _selectedRow = -1;
- _hotspotId = -1;
- _v86F3A = -1;
- _v86F4C = -1;
- _action.verbId = -1;
- _action.objectNameId = -1;
- _action.indirectObjectId = -1;
- _textChanged = true;
- _walkFlag = false;
-}
-
-void MadsAction::appendVocab(int vocabId, bool capitalise) {
- char *s = _statusText + strlen(_statusText);
- const char *vocabStr = _madsVm->globals()->getVocab(vocabId);
- strcpy(s, vocabStr);
- if (capitalise)
- *s = toupper(*s);
-
- strcat(s, " ");
-}
-
-void MadsAction::set() {
- int hotspotCount = _madsVm->scene()->getSceneResources().hotspots->size();
- bool flag = false;
- strcpy(_statusText, "");
-
- _currentAction = -1;
- _action.objectNameId = -1;
- _action.indirectObjectId = -1;
-
- if (_actionMode == ACTMODE_TALK) {
- // Handle showing the conversation selection. Rex at least doesn't actually seem to use this
- if (_selectedRow >= 0) {
- const char *desc = _madsVm->_converse[_selectedRow].desc;
- if (desc)
- strcpy(_statusText, desc);
- }
- } else if (_lookFlag && (_selectedRow == 0)) {
- // Two 'look' actions in succession, so the action becomes 'Look around'
- strcpy(_statusText, lookAroundStr);
- } else {
- if ((_actionMode == ACTMODE_OBJECT) && (_selectedRow >= 0) && (_flags1 == 2) && (_flags2 == 0)) {
- // Use/to action
- int selectedObject = _madsVm->scene()->getInterface()->getSelectedObject();
- MadsObject *objEntry = _madsVm->globals()->getObject(selectedObject);
-
- _action.objectNameId = objEntry->_descId;
- _currentAction = objEntry->_vocabList[_selectedRow].vocabId;
-
- // Set up the status text stirng
- strcpy(_statusText, useStr);
- appendVocab(_action.objectNameId);
- strcpy(_statusText, toStr);
- appendVocab(_currentAction);
- } else {
- // Handling for if an action has been selected
- if (_selectedRow >= 0) {
- if (_actionMode == ACTMODE_VERB) {
- // Standard verb action
- _currentAction = verbList[_selectedRow].verb;
- } else {
- // Selected action on an inventory object
- int selectedObject = _madsVm->scene()->getInterface()->getSelectedObject();
- MadsObject *objEntry = _madsVm->globals()->getObject(selectedObject);
-
- _currentAction = objEntry->_vocabList[_selectedRow].vocabId;
- }
-
- appendVocab(_currentAction, true);
-
- if (_currentAction == kVerbLook) {
- // Add in the word 'add'
- strcat(_statusText, atStr);
- strcat(_statusText, " ");
- }
- }
-
- // Handling for if a hotspot has been selected/highlighted
- if ((_hotspotId >= 0) && (_selectedRow >= 0) && (_articleNumber > 0) && (_flags1 == 2)) {
- flag = true;
-
- strcat(_statusText, englishMADSArticleList[_articleNumber]);
- strcat(_statusText, " ");
- }
-
- if (_hotspotId >= 0) {
- if (_selectedRow < 0) {
- int verbId;
-
- if (_hotspotId < hotspotCount) {
- // Get the verb Id from the hotspot
- verbId = (*_madsVm->scene()->getSceneResources().hotspots)[_hotspotId].getVerbID();
- } else {
- // Get the verb Id from the scene object
- verbId = (*_madsVm->scene()->getSceneResources().dynamicHotspots)[_hotspotId - hotspotCount].getVerbID();
- }
-
- if (verbId > 0) {
- // Set the specified action
- _currentAction = verbId;
- appendVocab(_currentAction, true);
- } else {
- // Default to a standard 'walk to'
- _currentAction = kVerbWalkTo;
- strcat(_statusText, walkToStr);
- }
- }
-
- if ((_actionMode2 == ACTMODE2_2) || (_actionMode2 == ACTMODE2_5)) {
- // Get name from given inventory object
- int objectId = _madsVm->scene()->getInterface()->getInventoryObject(_hotspotId);
- _action.objectNameId = _madsVm->globals()->getObject(objectId)->_descId;
- } else if (_hotspotId < hotspotCount) {
- // Get name from scene hotspot
- _action.objectNameId = (*_madsVm->scene()->getSceneResources().hotspots)[_hotspotId].getVocabID();
- } else {
- // Get name from temporary scene hotspot
- _action.objectNameId = (*_madsVm->scene()->getSceneResources().dynamicHotspots)[_hotspotId].getVocabID();
- }
- appendVocab(_action.objectNameId);
- }
- }
-
- if ((_hotspotId >= 0) && (_articleNumber > 0) && !flag) {
- if (_articleNumber == -1) {
- if (_v86F3A >= 0) {
- int articleNum = 0;
-
- if ((_v86F42 == 2) || (_v86F42 == 5)) {
- int objectId = _madsVm->scene()->getInterface()->getInventoryObject(_hotspotId);
- articleNum = _madsVm->globals()->getObject(objectId)->_article;
- } else if (_v86F3A < hotspotCount) {
- articleNum = (*_madsVm->scene()->getSceneResources().hotspots)[_hotspotId].getArticle();
- } else {
-
- }
- }
-
- } else if ((_articleNumber == kVerbLook) || (_vm->getGameType() != GType_RexNebular) ||
- (strcmp(_madsVm->globals()->getVocab(_action.indirectObjectId), fenceStr) != 0)) {
- // Write out the article
- strcat(_statusText, englishMADSArticleList[_articleNumber]);
- } else {
- // Special case for a 'fence' entry in Rex Nebular
- strcat(_statusText, overStr);
- }
-
- strcat(_statusText, " ");
- }
-
- // Append object description if necessary
- if (_v86F3A >= 0)
- appendVocab(_action.indirectObjectId);
-
- // Remove any trailing space character
- int statusLen = strlen(_statusText);
- if ((statusLen > 0) && (_statusText[statusLen - 1] == ' '))
- _statusText[statusLen - 1] = '\0';
- }
-
- _textChanged = true;
-}
-
-void MadsAction::refresh() {
- // Exit immediately if nothing has changed
- if (!_textChanged)
- return;
-
- // Remove any old copy of the status text
- if (_statusTextIndex >= 0) {
- _owner._textDisplay.expire(_statusTextIndex);
- _statusTextIndex = -1;
- }
-
- if (strlen(_statusText) != 0) {
- if ((_owner._screenObjects._v832EC == 0) || (_owner._screenObjects._v832EC == 2)) {
- Font *font = _madsVm->_font->getFont(FONT_MAIN_MADS);
- int textSpacing = -1;
-
- int strWidth = font->getWidth(_statusText);
- if (strWidth > 320) {
- // Too large to fit, so fall back on interface font
- font = _madsVm->_font->getFont(FONT_INTERFACE_MADS);
- strWidth = font->getWidth(_statusText, 0);
- textSpacing = 0;
- }
-
- // Add a new text display entry to display the status text at the bottom of the screen area
- uint colors = (_vm->getGameType() == GType_DragonSphere) ? 0x0300 : 0x0003;
-
- _statusTextIndex = _owner._textDisplay.add(160 - (strWidth / 2),
- MADS_SURFACE_HEIGHT + _owner._posAdjust.y - 13, colors, textSpacing, _statusText, font);
- }
- }
-
- _textChanged = false;
-}
-
-void MadsAction::startAction() {
- _madsVm->_player.moveComplete();
-
- _inProgress = true;
- _v8453A = ABORTMODE_0;
- _savedFields.selectedRow = _selectedRow;
- _savedFields.articleNumber = _articleNumber;
- _savedFields.actionMode = _actionMode;
- _savedFields.actionMode2 = _actionMode2;
- _savedFields.lookFlag = _lookFlag;
- int savedHotspotId = _hotspotId;
- int savedV86F3A = _v86F3A;
- int savedV86F42 = _v86F42;
-
- // Copy the action to be active
- _activeAction = _action;
- strcpy(_dialogTitle, _statusText);
-
- if ((_savedFields.actionMode2 == ACTMODE2_4) && (savedV86F42 == 0))
- _v8453A = ABORTMODE_1;
-
- _startWalkFlag = false;
- int hotspotId = -1;
- HotSpotList &dynHotspots = *_madsVm->scene()->getSceneResources().dynamicHotspots;
- HotSpotList &hotspots = *_madsVm->scene()->getSceneResources().hotspots;
-
- if (!_savedFields.lookFlag && (_madsVm->scene()->_screenObjects._v832EC != 1)) {
- if (_savedFields.actionMode2 == ACTMODE2_4)
- hotspotId = savedHotspotId;
- else if (savedV86F42 == 4)
- hotspotId = savedV86F3A;
-
- if (hotspotId >= hotspots.size()) {
- HotSpot &hs = dynHotspots[hotspotId - hotspots.size()];
- if ((hs.getFeetX() == -1) || (hs.getFeetX() == -3)) {
- if (_v86F4A && ((hs.getFeetX() == -3) || (_savedFields.selectedRow < 0))) {
- _startWalkFlag = true;
- _madsVm->scene()->_destPos = _madsVm->scene()->_customDest;
- }
- } else if ((hs.getFeetX() >= 0) && ((_savedFields.actionMode == ACTMODE_NONE) || (hs.getCursor() < 2))) {
- _startWalkFlag = true;
- _madsVm->scene()->_destPos.x = hs.getFeetX();
- _madsVm->scene()->_destPos.y = hs.getFeetY();
- }
- _madsVm->scene()->_destFacing = hs.getFacing();
- hotspotId = -1;
- }
- }
-
- if (hotspotId >= 0) {
- HotSpot &hs = hotspots[hotspotId];
- if ((hs.getFeetX() == -1) || (hs.getFeetX() == -3)) {
- if (_v86F4A && ((hs.getFeetX() == -3) || (_savedFields.selectedRow < 0))) {
- _startWalkFlag = true;
- _madsVm->scene()->_destPos = _madsVm->scene()->_customDest;
- }
- } else if ((hs.getFeetX() >= 0) && ((_savedFields.actionMode == ACTMODE_NONE) || (hs.getCursor() < 2))) {
- _startWalkFlag = true;
- _madsVm->scene()->_destPos.x = hs.getFeetX();
- _madsVm->scene()->_destPos.y = hs.getFeetY();
- }
- _madsVm->scene()->_destFacing = hs.getFacing();
- }
-
- _walkFlag = _startWalkFlag;
-}
-
-void MadsAction::checkAction() {
- if (isAction(kVerbLookAt) || isAction(kVerbThrow))
- _startWalkFlag = 0;
-}
-
-bool MadsAction::isAction(int verbId, int objectNameId, int indirectObjectId) {
- if (_activeAction.verbId != verbId)
- return false;
- if ((objectNameId != 0) && (_activeAction.objectNameId != objectNameId))
- return false;
- if ((indirectObjectId != 0) && (_activeAction.indirectObjectId != indirectObjectId))
- return false;
- return true;
-}
-
-//--------------------------------------------------------------------------
-
-bool MadsSpriteSlot::operator==(const SpriteSlotSubset &other) const {
- return (spriteListIndex == other.spriteListIndex) && (frameNumber == other.frameNumber) &&
- (xp == other.xp) && (yp == other.yp) && (depth == other.depth) && (scale == other.scale);
-}
-
-void MadsSpriteSlot::copy(const SpriteSlotSubset &other) {
- spriteListIndex = other.spriteListIndex;
- frameNumber = other.frameNumber;
- xp = other.xp;
- yp = other.yp;
- depth = other.depth;
- scale = other.scale;
-}
-
-//--------------------------------------------------------------------------
-
-MadsSpriteSlots::MadsSpriteSlots(MadsView &owner): _owner(owner) {
- for (int i = 0; i < SPRITE_SLOTS_SIZE; ++i) {
- MadsSpriteSlot rec;
- _entries.push_back(rec);
- }
-
- startIndex = 0;
-}
-
-MadsSpriteSlots::~MadsSpriteSlots() {
- for (uint i = 0; i < _sprites.size(); ++i)
- delete _sprites[i];
-}
-
-void MadsSpriteSlots::clear() {
- _owner._textDisplay.clear();
- for (uint i = 0; i < _sprites.size(); ++i)
- delete _sprites[i];
- _sprites.clear();
-
- // Reset the sprite slots list back to a single entry for a full screen refresh
- startIndex = 1;
- _entries[0].spriteType = FULL_SCREEN_REFRESH;
- _entries[0].seqIndex = -1;
-}
-
-int MadsSpriteSlots::getIndex() {
- if (startIndex == SPRITE_SLOTS_SIZE)
- error("Run out of sprite slots");
-
- return startIndex++;
-}
-
-int MadsSpriteSlots::addSprites(const char *resName, bool suppressErrors, int flags) {
- // If errors are suppressed, first check if the resource exists
- if (suppressErrors) {
- if (!_vm->res()->resourceExists(resName))
- return -1;
- }
-
- // Append on a '.SS' suffix if the resource doesn't already have an extension
- char buffer[100];
- strncpy(buffer, resName, 95);
- buffer[95] = '\0';
- if (!strchr(buffer, '.'))
- strcat(buffer, ".SS");
-
- // Get the sprite set
- Common::SeekableReadStream *data = _vm->res()->get(buffer);
- SpriteAsset *spriteSet = new SpriteAsset(_vm, data, data->size(), buffer, false, flags);
- spriteSet->translate(_madsVm->_palette);
- assert(spriteSet != NULL);
-
- _sprites.push_back(spriteSet);
- _vm->res()->toss(buffer);
-
- return _sprites.size() - 1;
-}
-
-int MadsSpriteSlots::addSprites(SpriteAsset *spriteSet) {
- _sprites.push_back(spriteSet);
-
- return _sprites.size() - 1;
-}
-
-void MadsSpriteSlots::deleteSprites(int listIndex) {
- if (listIndex < 0)
- return;
-
- delete _sprites[listIndex];
- _sprites[listIndex] = NULL;
- if (listIndex == ((int)_sprites.size() - 1))
- _sprites.remove_at(listIndex);
-}
-
-/*
- * Deletes the sprite slot with the given timer entry
- */
-void MadsSpriteSlots::deleteTimer(int seqIndex) {
- for (int idx = 0; idx < startIndex; ++idx) {
- if (_entries[idx].seqIndex == seqIndex)
- _entries[idx].spriteType = EXPIRED_SPRITE;
- }
-}
-
-class DepthEntry {
-public:
- int depth;
- int index;
-
- DepthEntry(int depthAmt, int indexVal) { depth = depthAmt; index = indexVal; }
-};
-
-bool sortHelper(const DepthEntry &entry1, const DepthEntry &entry2) {
- return entry1.depth < entry2.depth;
-}
-
-typedef Common::List<DepthEntry> DepthList;
-
-void MadsSpriteSlots::drawBackground() {
- // Draw all active sprites onto the background surface
- for (int i = 0; i < startIndex; ++i) {
- MadsSpriteSlot &slot = _entries[i];
-
- if (slot.spriteType >= 0) {
- _owner._dirtyAreas[i].active = false;
- } else {
- _owner._dirtyAreas[i].textActive = true;
- _owner._dirtyAreas.setSpriteSlot(i, slot);
-
- if (slot.spriteType == BACKGROUND_SPRITE) {
- SpriteAsset &spriteSet = getSprite(slot.spriteListIndex);
- M4Sprite *frame = spriteSet.getFrame((slot.frameNumber & 0x7fff) - 1);
- int xp = slot.xp;
- int yp = slot.yp;
-
- if (_entries[i].scale != -1) {
- // Adjust position based on frame size
- xp -= frame->width() / 2;
- yp -= frame->height() / 2;
- }
-
- if (slot.depth > 1) {
- // Draw the frame with depth processing
- _owner._bgSurface->copyFrom(frame, xp, yp, slot.depth, _owner._depthSurface, 100,
- frame->getTransparencyIndex());
- } else {
- // No depth, so simply draw the image
- frame->copyTo(_owner._bgSurface, xp, yp, frame->getTransparencyIndex());
- }
- }
- }
- }
-
- // Flag any remaining dirty areas as inactive
- for (uint i = startIndex; i < DIRTY_AREAS_TEXT_DISPLAY_IDX; ++i)
- _owner._dirtyAreas[i].active = false;
-}
-
-void MadsSpriteSlots::drawForeground(M4Surface *viewport) {
- DepthList depthList;
-
- // Get a list of sprite object depths for active objects
- for (int i = 0; i < startIndex; ++i) {
- if (_entries[i].spriteType >= SPRITE_ZERO) {
- DepthEntry rec(16 - _entries[i].depth, i);
- depthList.push_back(rec);
- }
- }
-
- // Sort the list in order of the depth
- Common::sort(depthList.begin(), depthList.end(), sortHelper);
-
- // Loop through each of the objects
- DepthList::iterator i;
- for (i = depthList.begin(); i != depthList.end(); ++i) {
- DepthEntry &de = *i;
- MadsSpriteSlot &slot = _entries[de.index];
- assert(slot.spriteListIndex < (int)_sprites.size());
- SpriteAsset &spriteSet = *_sprites[slot.spriteListIndex];
-
- // Get the sprite frame
- int frameNumber = slot.frameNumber & 0x7fff;
- bool flipped = (slot.frameNumber & 0x8000) != 0;
- M4Sprite *sprite = spriteSet.getFrame(frameNumber - 1);
-
- M4Surface *spr = sprite;
- if (flipped) {
- // Create a flipped copy of the sprite temporarily
- spr = sprite->flipHorizontal();
- }
-
- if ((slot.scale < 100) && (slot.scale != -1)) {
- // Minimalised drawing
- viewport->copyFrom(spr, slot.xp, slot.yp, slot.depth, _owner._depthSurface, slot.scale,
- sprite->getTransparencyIndex());
- } else {
- int xp, yp;
-
- if (slot.scale == -1) {
- xp = slot.xp - _owner._posAdjust.x;
- yp = slot.yp - _owner._posAdjust.y;
- } else {
- xp = slot.xp - (spr->width() / 2) - _owner._posAdjust.x;
- yp = slot.yp - spr->height() - _owner._posAdjust.y + 1;
- }
-
- if (slot.depth > 1) {
- // Draw the frame with depth processing
- viewport->copyFrom(spr, xp, yp, slot.depth, _owner._depthSurface, 100, sprite->getTransparencyIndex());
- } else {
- // No depth, so simply draw the image
- spr->copyTo(viewport, xp, yp, sprite->getTransparencyIndex());
- }
- }
-
- // Free sprite if it was a flipped one
- if (flipped)
- delete spr;
- }
-}
-
-void MadsSpriteSlots::setDirtyAreas() {
- for (int i = 0; i < startIndex; ++i) {
- if (_entries[i].spriteType >= 0) {
- _owner._dirtyAreas.setSpriteSlot(i, _entries[i]);
-
- _owner._dirtyAreas[i].textActive = (_entries[i].spriteType <= 0) ? 0 : 1;
- _entries[i].spriteType = 0;
- }
- }
-}
-
-/**
- * Flags the entire screen to be redrawn during the next drawing cycle
- */
-void MadsSpriteSlots::fullRefresh() {
- int idx = getIndex();
-
- _entries[idx].spriteType = FULL_SCREEN_REFRESH;
- _entries[idx].seqIndex = -1;
-}
-
-/**
- * Removes any sprite slots that are no longer needed
- */
-void MadsSpriteSlots::cleanUp() {
- // Delete any entries that aren't needed
- int idx = 0;
- while (idx < startIndex) {
- if (_entries[idx].spriteType < 0) {
- _entries.remove_at(idx);
- --startIndex;
- } else {
- ++idx;
- }
- }
-
- // Original engine sprite slot list was a fixed array, so to keep the engine similiar, for
- // now I'm adding in new entries to make up the original fixed total again
- while (_entries.size() < SPRITE_SLOTS_SIZE) {
- MadsSpriteSlot rec;
- _entries.push_back(rec);
- }
-}
-
-//--------------------------------------------------------------------------
-
-MadsTextDisplay::MadsTextDisplay(MadsView &owner): _owner(owner) {
- for (int i = 0; i < TEXT_DISPLAY_SIZE; ++i) {
- MadsTextDisplayEntry rec;
- rec.active = false;
- rec.expire = 0;
- _entries.push_back(rec);
- }
-}
-
-void MadsTextDisplay::clear() {
- for (int i = 0; i < TEXT_DISPLAY_SIZE; ++i)
- _entries[i].active = false;
-}
-
-int MadsTextDisplay::add(int xp, int yp, uint fontColor, int charSpacing, const char *msg, Font *font) {
- int usedSlot = -1;
-
- for (int idx = 0; idx < TEXT_DISPLAY_SIZE; ++idx) {
- if (!_entries[idx].active) {
- usedSlot = idx;
-
- _entries[idx].bounds.left = xp;
- _entries[idx].bounds.top = yp;
- _entries[idx].font = font;
- _entries[idx].msg = msg;
- _entries[idx].bounds.setWidth(font->getWidth(msg, charSpacing));
- _entries[idx].bounds.setHeight(font->getHeight());
- _entries[idx].color1 = fontColor & 0xff;
- _entries[idx].color2 = fontColor >> 8;
- _entries[idx].spacing = charSpacing;
- _entries[idx].expire = 1;
- _entries[idx].active = true;
- break;
- }
- }
-
- return usedSlot;
-}
-
-void MadsTextDisplay::setDirtyAreas() {
- // Determine dirty areas for active text areas
- for (uint idx = 0, dirtyIdx = DIRTY_AREAS_TEXT_DISPLAY_IDX; dirtyIdx < DIRTY_AREAS_SIZE; ++idx, ++dirtyIdx) {
- if ((_entries[idx].expire >= 0) || !_entries[idx].active)
- _owner._dirtyAreas[dirtyIdx].active = false;
- else {
- _owner._dirtyAreas[dirtyIdx].textActive = true;
- _owner._dirtyAreas.setTextDisplay(dirtyIdx, _entries[idx]);
- }
- }
-}
-
-void MadsTextDisplay::setDirtyAreas2() {
- // Determine dirty areas for active text areas
- for (uint idx = 0, dirtyIdx = DIRTY_AREAS_TEXT_DISPLAY_IDX; dirtyIdx < DIRTY_AREAS_SIZE; ++idx, ++dirtyIdx) {
- if (_entries[idx].active && (_entries[idx].expire >= 0)) {
- _owner._dirtyAreas.setTextDisplay(dirtyIdx, _entries[idx]);
- _owner._dirtyAreas[dirtyIdx].textActive = (_entries[idx].expire <= 0) ? 0 : 1;
- }
- }
-}
-
-void MadsTextDisplay::draw(M4Surface *view) {
- for (uint idx = 0; idx < _entries.size(); ++idx) {
- if (_entries[idx].active && (_entries[idx].expire >= 0)) {
- _entries[idx].font->setColors(_entries[idx].color1, _entries[idx].color2, 0);
- _entries[idx].font->writeString(view, _entries[idx].msg,
- _entries[idx].bounds.left, _entries[idx].bounds.top, _entries[idx].bounds.width(),
- _entries[idx].spacing);
- }
- }
-}
-
-/**
- * Deactivates any text display entries that are finished
- */
-void MadsTextDisplay::cleanUp() {
- for (uint idx = 0; idx < _entries.size(); ++idx) {
- if (_entries[idx].expire < 0) {
- _entries[idx].active = false;
- _entries[idx].expire = 0;
- }
- }
-}
-
-//--------------------------------------------------------------------------
-
-MadsKernelMessageList::MadsKernelMessageList(MadsView &owner): _owner(owner) {
- for (int i = 0; i < TIMED_TEXT_SIZE; ++i) {
- MadsKernelMessageEntry rec;
- _entries.push_back(rec);
- }
-
- _owner._textSpacing = -1;
- _talkFont = _vm->_font->getFont(FONT_CONVERSATION_MADS);
- word_8469E = 0;
-}
-
-void MadsKernelMessageList::clear() {
- for (uint i = 0; i < _entries.size(); ++i)
- _entries[i].flags = 0;
-
- _owner._textSpacing = -1;
- _talkFont = _vm->_font->getFont(FONT_CONVERSATION_MADS);
-}
-
-int MadsKernelMessageList::add(const Common::Point &pt, uint fontColor, uint8 flags, uint8 abortTimers, uint32 timeout, const char *msg) {
- // Find a free slot
- uint idx = 0;
- while ((idx < _entries.size()) && ((_entries[idx].flags & KMSG_ACTIVE) != 0))
- ++idx;
- if (idx == _entries.size()) {
- if (abortTimers == 0)
- return -1;
-
- error("MadsKernelList overflow");
- }
-
- MadsKernelMessageEntry &rec = _entries[idx];
- strcpy(rec.msg, msg);
- rec.flags = flags | KMSG_ACTIVE;
- rec.color1 = fontColor & 0xff;
- rec.color2 = fontColor >> 8;
- rec.position = pt;
- rec.textDisplayIndex = -1;
- rec.timeout = timeout;
- rec.frameTimer = _madsVm->_currentTimer;
- rec.abortTimers = abortTimers;
- rec.abortMode = _owner._abortTimersMode2;
-
- for (int i = 0; i < 3; ++i)
- rec.actionNouns[i] = _madsVm->globals()->actionNouns[i];
-
- if (flags & KMSG_PLAYER_TIMEOUT)
- rec.frameTimer = _madsVm->_player._ticksAmount + _madsVm->_player._priorTimer;
-
- return idx;
-}
-
-int MadsKernelMessageList::addQuote(int quoteId, int abortTimers, uint32 timeout) {
- const char *quoteStr = _madsVm->globals()->getQuote(quoteId);
- return add(Common::Point(0, 0), 0x1110, KMSG_PLAYER_TIMEOUT | KMSG_CENTER_ALIGN, abortTimers, timeout, quoteStr);
-}
-
-void MadsKernelMessageList::scrollMessage(int msgIndex, int numTicks, bool quoted) {
- if (msgIndex < 0)
- return;
-
- _entries[msgIndex].flags |= quoted ? (KMSG_SCROLL | KMSG_QUOTED) : KMSG_SCROLL;
- _entries[msgIndex].msgOffset = 0;
- _entries[msgIndex].numTicks = numTicks;
- _entries[msgIndex].frameTimer2 = _madsVm->_currentTimer;
-
- const char *msgP = _entries[msgIndex].msg;
- _entries[msgIndex].asciiChar = *msgP;
- _entries[msgIndex].asciiChar2 = *(msgP + 1);
-
- if (_entries[msgIndex].flags & KMSG_PLAYER_TIMEOUT)
- _entries[msgIndex].frameTimer2 = _madsVm->_player._ticksAmount + _madsVm->_player._priorTimer;
-
- _entries[msgIndex].frameTimer = _entries[msgIndex].frameTimer2;
-}
-
-void MadsKernelMessageList::setSeqIndex(int msgIndex, int seqIndex) {
- if (msgIndex >= 0) {
- _entries[msgIndex].flags |= KMSG_SEQ_ENTRY;
- _entries[msgIndex].sequenceIndex = seqIndex;
- }
-}
-
-void MadsKernelMessageList::remove(int msgIndex) {
- MadsKernelMessageEntry &rec = _entries[msgIndex];
-
- if (rec.flags & KMSG_ACTIVE) {
- if (rec.flags & KMSG_SCROLL) {
- *(rec.msg + rec.msgOffset) = rec.asciiChar;
- *(rec.msg + rec.msgOffset + 1) = rec.asciiChar2;
- }
-
- if (rec.textDisplayIndex >= 0)
- _owner._textDisplay.expire(rec.textDisplayIndex);
-
- rec.flags &= ~KMSG_ACTIVE;
- }
-}
-
-void MadsKernelMessageList::reset() {
- for (uint i = 0; i < _entries.size(); ++i)
- remove(i);
-
- // sub_20454
-}
-
-void MadsKernelMessageList::update() {
- uint32 currentTimer = _madsVm->_currentTimer;
-
- for (uint i = 0; i < _entries.size(); ++i) {
- if (((_entries[i].flags & KMSG_ACTIVE) != 0) && (currentTimer >= _entries[i].frameTimer))
- processText(i);
- }
-}
-
-void MadsKernelMessageList::processText(int msgIndex) {
- MadsKernelMessageEntry &msg = _entries[msgIndex];
- uint32 currentTimer = _madsVm->_currentTimer;
- bool flag = false;
-
- if ((msg.flags & KMSG_EXPIRE) != 0) {
- _owner._textDisplay.expire(msg.textDisplayIndex);
- msg.flags &= !KMSG_ACTIVE;
- return;
- }
-
- if ((msg.flags & KMSG_SCROLL) == 0) {
- msg.timeout -= 3;
- }
-
- if (msg.flags & KMSG_SEQ_ENTRY) {
- MadsSequenceEntry &seqEntry = _owner._sequenceList[msg.sequenceIndex];
- if (seqEntry.doneFlag || !seqEntry.active)
- msg.timeout = 0;
- }
-
- if ((msg.timeout <= 0) && (_owner._abortTimers == 0)) {
- msg.flags |= KMSG_EXPIRE;
- if (msg.abortTimers != 0) {
- _owner._abortTimers = msg.abortTimers;
- _owner._abortTimersMode = msg.abortMode;
-
- if (_owner._abortTimersMode != ABORTMODE_1) {
- for (int i = 0; i < 3; ++i)
- _madsVm->globals()->actionNouns[i] = msg.actionNouns[i];
- }
- }
- }
-
- msg.frameTimer = currentTimer + 3;
- int x1 = 0, y1 = 0;
-
- if (msg.flags & KMSG_SEQ_ENTRY) {
- MadsSequenceEntry &seqEntry = _owner._sequenceList[msg.sequenceIndex];
- if (!seqEntry.nonFixed) {
- SpriteAsset &spriteSet = _owner._spriteSlots.getSprite(seqEntry.spriteListIndex);
- M4Sprite *frame = spriteSet.getFrame(seqEntry.frameIndex - 1);
- x1 = frame->bounds().left;
- y1 = frame->bounds().top;
- } else {
- x1 = seqEntry.msgPos.x;
- y1 = seqEntry.msgPos.y;
- }
- }
-
- if (msg.flags & KMSG_PLAYER_TIMEOUT) {
- if (word_8469E != 0) {
- // TODO: Figure out various flags
- } else {
- x1 = 160;
- y1 = 78;
- }
- }
-
- x1 += msg.position.x;
- y1 += msg.position.y;
-
- if ((msg.flags & KMSG_SCROLL) && (msg.frameTimer >= currentTimer)) {
- msg.msg[msg.msgOffset] = msg.asciiChar;
- char *msgP = &msg.msg[++msg.msgOffset];
- *msgP = msg.asciiChar2;
-
- msg.asciiChar = *msgP;
- msg.asciiChar2 = *(msgP + 1);
-
- if (!msg.asciiChar) {
- // End of message
- *msgP = '\0';
- msg.flags &= ~KMSG_SCROLL;
- } else if (msg.flags & KMSG_QUOTED) {
- *msgP = '"';
- *(msgP + 1) = '\0';
- }
-
- msg.frameTimer = msg.frameTimer2 = currentTimer + msg.numTicks;
- flag = true;
- }
-
- int strWidth = _talkFont->getWidth(msg.msg, _owner._textSpacing);
-
- if (msg.flags & (KMSG_RIGHT_ALIGN | KMSG_CENTER_ALIGN)) {
- x1 -= (msg.flags & KMSG_CENTER_ALIGN) ? strWidth / 2 : strWidth;
- }
-
- // Make sure text appears entirely on-screen
- int x2 = x1 + strWidth;
- if (x2 > MADS_SURFACE_WIDTH)
- x1 -= x2 - MADS_SURFACE_WIDTH;
- if (x1 > (MADS_SURFACE_WIDTH - 1))
- x1 = MADS_SURFACE_WIDTH - 1;
- if (x1 < 0)
- x1 = 0;
-
- if (y1 > (MADS_SURFACE_HEIGHT - 1))
- y1 = MADS_SURFACE_HEIGHT - 1;
- if (y1 < 0)
- y1 = 0;
-
- if (msg.textDisplayIndex >= 0) {
- MadsTextDisplayEntry textEntry = _owner._textDisplay[msg.textDisplayIndex];
-
- if (flag || (textEntry.bounds.left != x1) || (textEntry.bounds.top != y1)) {
- // Mark the associated text entry as deleted, so it can be re-created
- _owner._textDisplay.expire(msg.textDisplayIndex);
- msg.textDisplayIndex = -1;
- }
- }
-
- if (msg.textDisplayIndex < 0) {
- // Need to create a new text display entry for this message
- int idx = _owner._textDisplay.add(x1, y1, msg.color1 | (msg.color2 << 8), _owner._textSpacing, msg.msg, _talkFont);
- if (idx >= 0)
- msg.textDisplayIndex = idx;
- }
-}
-
-//--------------------------------------------------------------------------
-
-ScreenObjects::ScreenObjects(MadsView &owner): _owner(owner) {
- _v832EC = 0;
- _v7FECA = 0;
- _v7FED6 = 0;
- _v8332A = 0;
- _yp = 0;
- _v8333C = 0;
- _selectedObject = 0;
- _category = 0;
- _objectIndex = 0;
-}
-
-/**
- * Clears the entries list
- */
-void ScreenObjects::clear() {
- _entries.clear();
-}
-
-/**
- * Adds a new entry to the list of screen objects
- */
-void ScreenObjects::add(const Common::Rect &bounds, int layer, int idx, int category) {
- ScreenObjectEntry rec;
- rec.bounds = bounds;
- rec.layer = layer;
- rec.index = idx;
- rec.category = category;
- rec.active = true;
-
- _entries.push_back(rec);
-}
-
-/**
- * Scans the list for an element that contains the given mode. The result will be 1 based for a match,
- * with 0 indicating no entry was found
- */
-int ScreenObjects::scan(int xp, int yp, int layer) {
- for (uint i = 0; i < _entries.size(); ++i) {
- if (_entries[i].active && _entries[i].bounds.contains(xp, yp) && (_entries[i].layer == layer))
- return i + 1;
- }
-
- // Entry not found
- return 0;
-}
-
-int ScreenObjects::scanBackwards(int xp, int yp, int layer) {
- for (int i = (int)_entries.size() - 1; i >= 0; --i) {
- if (_entries[i].active && _entries[i].bounds.contains(xp, yp) && (_entries[i].layer == layer))
- return i + 1;
- }
-
- // Entry not found
- return 0;
-}
-
-void ScreenObjects::setActive(int category, int idx, bool active) {
- for (uint i = 0; i < _entries.size(); ++i) {
- if (_entries[i].active && (_entries[i].category == category) && (_entries[i].index == idx))
- _entries[i].active = active;
- }
-}
-
-void ScreenObjects::check(bool scanFlag, bool mouseClick) {
- if (!mouseClick || _v832EC)
- _v7FECA = 0;
-
- if (!_v7FED6 && !_v8332A && !_yp && (_v8333C != 0)) {
- if (scanFlag) {
- _category = CAT_NONE;
- _selectedObject = scanBackwards(_madsVm->_mouse->currentPos().x, _madsVm->_mouse->currentPos().y,
- LAYER_GUI);
-
- if (_selectedObject > 0) {
- ScreenObjectEntry &obj = _entries[_selectedObject];
- _category = obj.category & 7;
- _objectIndex = obj.index;
- }
-
- // TODO: Other stuff related to the user interface
- }
- }
-
- _owner._action.refresh();
-}
-
-/*--------------------------------------------------------------------------*/
-
-MadsDynamicHotspots::MadsDynamicHotspots(MadsView &owner): _owner(owner) {
- for (int i = 0; i < DYNAMIC_HOTSPOTS_SIZE; ++i) {
- DynamicHotspot rec;
- rec.active = false;
- _entries.push_back(rec);
- }
- _changed = true;
- _count = 0;
-}
-
-int MadsDynamicHotspots::add(int descId, int field14, int seqIndex, const Common::Rect &bounds) {
- // Find a free slot
- uint idx = 0;
- while ((idx < _entries.size()) && _entries[idx].active)
- ++idx;
- if (idx == _entries.size())
- error("MadsDynamicHotspots overflow");
-
- _entries[idx].active = true;
- _entries[idx].descId = descId;
- _entries[idx].seqIndex = seqIndex;
- _entries[idx].bounds = bounds;
- _entries[idx].pos.x = -3;
- _entries[idx].pos.y = 0;
- _entries[idx].facing = 5;
- _entries[idx].field_14 = field14;
- _entries[idx].articleNumber = 6;
- _entries[idx].field_17 = 0;
-
- ++_count;
- _changed = true;
-
- if (seqIndex >= 0)
- _owner._sequenceList[seqIndex].dynamicHotspotIndex = idx;
-
- return idx;
-}
-
-int MadsDynamicHotspots::setPosition(int index, int xp, int yp, int facing) {
- if (index >= 0) {
- _entries[index].pos.x = xp;
- _entries[index].pos.y = yp;
- _entries[index].facing = facing;
- }
-
- return index;
-}
-
-int MadsDynamicHotspots::set17(int index, int v) {
- if (index >= 0)
- _entries[index].field_17 = v;
-
- return index;
-}
-
-void MadsDynamicHotspots::remove(int index) {
- if (_entries[index].active) {
- if (_entries[index].seqIndex >= 0)
- _owner._sequenceList[_entries[index].seqIndex].dynamicHotspotIndex = -1;
- _entries[index].active = false;
-
- --_count;
- _changed = true;
- }
-}
-
-void MadsDynamicHotspots::reset() {
- for (uint i = 0; i < _entries.size(); ++i)
- _entries[i].active = false;
-
- _count = 0;
- _changed = false;
-}
-
-/*--------------------------------------------------------------------------*/
-
-void MadsDirtyArea::setArea(int width, int height, int maxWidth, int maxHeight) {
- if (bounds.left % 2) {
- --bounds.left;
- ++width;
- }
-
- if (bounds.left < 0)
- bounds.left = 0;
- else if (bounds.left > maxWidth)
- bounds.left = maxWidth;
- int right = bounds.left + width;
- if (right < 0)
- right = 0;
- if (right > maxWidth)
- right = maxWidth;
-
- bounds.right = right;
- bounds2.left = bounds.width() / 2;
- bounds2.right = bounds.left + (bounds.width() + 1) / 2 - 1;
-
- if (bounds.top < 0)
- bounds.top = 0;
- else if (bounds.top > maxHeight)
- bounds.top = maxHeight;
- int bottom = bounds.top + height;
- if (bottom < 0)
- bottom = 0;
- if (bottom > maxHeight)
- bottom = maxHeight;
-
- bounds.bottom = bottom;
- bounds2.top = bounds.height() / 2;
- bounds2.bottom = bounds.top + (bounds.height() + 1) / 2 - 1;
-
- active = true;
-}
-
-/*--------------------------------------------------------------------------*/
-
-MadsDirtyAreas::MadsDirtyAreas(MadsView &owner): _owner(owner) {
- for (int i = 0; i < DIRTY_AREAS_SIZE; ++i) {
- MadsDirtyArea rec;
- rec.active = false;
- _entries.push_back(rec);
- }
-}
-
-void MadsDirtyAreas::setSpriteSlot(int dirtyIdx, const MadsSpriteSlot &spriteSlot) {
- int width, height;
- MadsDirtyArea &dirtyArea = _entries[dirtyIdx];
-
- if (spriteSlot.spriteType == FULL_SCREEN_REFRESH) {
- // Special entry to refresh the entire screen
- dirtyArea.bounds.left = 0;
- dirtyArea.bounds.top = 0;
- width = MADS_SURFACE_WIDTH;
- height = MADS_SURFACE_HEIGHT;
- } else {
- // Standard sprite slots
- dirtyArea.bounds.left = spriteSlot.xp - _owner._posAdjust.x;
- dirtyArea.bounds.top = spriteSlot.yp - _owner._posAdjust.y;
-
- SpriteAsset &spriteSet = _owner._spriteSlots.getSprite(spriteSlot.spriteListIndex);
- M4Sprite *frame = spriteSet.getFrame(((spriteSlot.frameNumber & 0x7fff) - 1) & 0x7f);
-
- if (spriteSlot.scale == -1) {
- width = frame->width();
- height = frame->height();
- } else {
- width = frame->width() * spriteSlot.scale / 100;
- height = frame->height() * spriteSlot.scale / 100;
-
- dirtyArea.bounds.left -= width / 2;
- dirtyArea.bounds.top += -(height - 1);
- }
- }
-
- dirtyArea.setArea(width, height, MADS_SURFACE_WIDTH, MADS_SURFACE_HEIGHT);
-}
-
-void MadsDirtyAreas::setTextDisplay(int dirtyIdx, const MadsTextDisplayEntry &textDisplay) {
- MadsDirtyArea &dirtyArea = _entries[dirtyIdx];
- dirtyArea.bounds.left = textDisplay.bounds.left;
- dirtyArea.bounds.top = textDisplay.bounds.top;
-
- dirtyArea.setArea(textDisplay.bounds.width(), textDisplay.bounds.height(), MADS_SURFACE_WIDTH, MADS_SURFACE_HEIGHT);
-}
-
-/**
- * Merge together any designated dirty areas that overlap
- * @param startIndex 1-based starting dirty area starting index
- * @param count Number of entries to process
- */
-void MadsDirtyAreas::merge(int startIndex, int count) {
-return;//***DEBUG***
- if (startIndex >= count)
- return;
-
- for (int outerCtr = startIndex - 1, idx = 0; idx < count; ++outerCtr, ++idx) {
- if (!_entries[outerCtr].active)
- continue;
-
- for (int innerCtr = outerCtr + 1; innerCtr < count; ++innerCtr) {
- if (!_entries[innerCtr].active || !intersects(outerCtr, innerCtr))
- continue;
-
- if (_entries[outerCtr].textActive && _entries[innerCtr].textActive)
- mergeAreas(outerCtr, innerCtr);
- }
- }
-}
-
-/**
- * Returns true if two dirty areas intersect
- */
-bool MadsDirtyAreas::intersects(int idx1, int idx2) {
- return _entries[idx1].bounds2.intersects(_entries[idx2].bounds2);
-}
-
-void MadsDirtyAreas::mergeAreas(int idx1, int idx2) {
- MadsDirtyArea &da1 = _entries[idx1];
- MadsDirtyArea &da2 = _entries[idx2];
-
- da1.bounds.extend(da2.bounds);
-
- da1.bounds2.left = da1.bounds.width() / 2;
- da1.bounds2.right = da1.bounds.left + (da1.bounds.width() + 1) / 2 - 1;
- da1.bounds2.top = da1.bounds.height() / 2;
- da1.bounds2.bottom = da1.bounds.top + (da1.bounds.height() + 1) / 2 - 1;
-
- da2.active = false;
- da1.textActive = true;
-}
-
-void MadsDirtyAreas::copy(M4Surface *dest, M4Surface *src, const Common::Point &posAdjust) {
- for (uint i = 0; i < _entries.size(); ++i) {
- const Common::Rect &srcBounds = _entries[i].bounds;
-
- Common::Rect bounds(srcBounds.left + posAdjust.x, srcBounds.top + posAdjust.y,
- srcBounds.right + posAdjust.x, srcBounds.bottom + posAdjust.y);
-
- if (_entries[i].active && _entries[i].bounds.isValidRect())
- src->copyTo(dest, bounds, _entries[i].bounds.left, _entries[i].bounds.top);
- }
-}
-
-void MadsDirtyAreas::clear() {
- for (uint i = 0; i < _entries.size(); ++i)
- _entries[i].active = false;
-}
-
-/*--------------------------------------------------------------------------*/
-
-MadsSequenceList::MadsSequenceList(MadsView &owner): _owner(owner) {
- for (int i = 0; i < TIMER_LIST_SIZE; ++i) {
- MadsSequenceEntry rec;
- rec.active = 0;
- rec.dynamicHotspotIndex = -1;
- _entries.push_back(rec);
- }
-}
-
-void MadsSequenceList::clear() {
- for (uint i = 0; i < _entries.size(); ++i) {
- _entries[i].active = 0;
- _entries[i].dynamicHotspotIndex = -1;
- }
-}
-
-bool MadsSequenceList::addSubEntry(int index, SequenceSubEntryMode mode, int frameIndex, int abortVal) {
- if (_entries[index].entries.count >= TIMER_ENTRY_SUBSET_MAX)
- return true;
-
- int subIndex = _entries[index].entries.count++;
- _entries[index].entries.mode[subIndex] = mode;
- _entries[index].entries.frameIndex[subIndex] = frameIndex;
- _entries[index].entries.abortVal[subIndex] = abortVal;
-
- return false;
-}
-
-int MadsSequenceList::add(int spriteListIndex, bool flipped, int frameIndex, int triggerCountdown, int delayTicks, int extraTicks, int numTicks,
- int msgX, int msgY, bool nonFixed, char scale, uint8 depth, int frameInc, SpriteAnimType animType, int numSprites,
- int frameStart) {
-
- // Find a free slot
- uint seqIndex = 0;
- while ((seqIndex < _entries.size()) && (_entries[seqIndex].active))
- ++seqIndex;
- if (seqIndex == _entries.size())
- error("TimerList full");
-
- if (frameStart <= 0)
- frameStart = 1;
- if (numSprites == 0)
- numSprites = _madsVm->scene()->_spriteSlots.getSprite(spriteListIndex).getCount();
- if (frameStart == numSprites)
- frameInc = 0;
-
- // Set the list entry fields
- _entries[seqIndex].active = true;
- _entries[seqIndex].spriteListIndex = spriteListIndex;
- _entries[seqIndex].flipped = flipped;
- _entries[seqIndex].frameIndex = frameIndex;
- _entries[seqIndex].frameStart = frameStart;
- _entries[seqIndex].numSprites = numSprites;
- _entries[seqIndex].animType = animType;
- _entries[seqIndex].frameInc = frameInc;
- _entries[seqIndex].depth = depth;
- _entries[seqIndex].scale = scale;
- _entries[seqIndex].nonFixed = nonFixed;
- _entries[seqIndex].msgPos.x = msgX;
- _entries[seqIndex].msgPos.y = msgY;
- _entries[seqIndex].numTicks = numTicks;
- _entries[seqIndex].extraTicks = extraTicks;
-
- _entries[seqIndex].timeout = _madsVm->_currentTimer + delayTicks;
-
- _entries[seqIndex].triggerCountdown = triggerCountdown;
- _entries[seqIndex].doneFlag = false;
- _entries[seqIndex].field_13 = 0;
- _entries[seqIndex].dynamicHotspotIndex = -1;
- _entries[seqIndex].entries.count = 0;
- _entries[seqIndex].abortMode = _owner._abortTimersMode2;
-
- for (int i = 0; i < 3; ++i)
- _entries[seqIndex].actionNouns[i] = _madsVm->globals()->actionNouns[i];
-
- return seqIndex;
-}
-
-void MadsSequenceList::remove(int seqIndex) {
- if (_entries[seqIndex].active) {
- if (_entries[seqIndex].dynamicHotspotIndex >= 0)
- _owner._dynamicHotspots.remove(_entries[seqIndex].dynamicHotspotIndex);
- }
-
- _entries[seqIndex].active = false;
- _owner._spriteSlots.deleteTimer(seqIndex);
-}
-
-void MadsSequenceList::setSpriteSlot(int seqIndex, MadsSpriteSlot &spriteSlot) {
- MadsSequenceEntry &timerEntry = _entries[seqIndex];
- SpriteAsset &spriteSet = _owner._spriteSlots.getSprite(timerEntry.spriteListIndex);
-
- spriteSlot.spriteType = spriteSet.isBackground() ? BACKGROUND_SPRITE : FOREGROUND_SPRITE;
- spriteSlot.seqIndex = seqIndex;
- spriteSlot.spriteListIndex = timerEntry.spriteListIndex;
- spriteSlot.frameNumber = (timerEntry.flipped ? 0x8000 : 0) | timerEntry.frameIndex;
- spriteSlot.depth = timerEntry.depth;
- spriteSlot.scale = timerEntry.scale;
-
- if (!timerEntry.nonFixed) {
- spriteSlot.xp = timerEntry.msgPos.x;
- spriteSlot.yp = timerEntry.msgPos.y;
- } else {
- spriteSlot.xp = spriteSet.getFrame(timerEntry.frameIndex - 1)->x;
- spriteSlot.yp = spriteSet.getFrame(timerEntry.frameIndex - 1)->y;
- }
-}
-
-bool MadsSequenceList::loadSprites(int seqIndex) {
- MadsSequenceEntry &seqEntry = _entries[seqIndex];
- int slotIndex;
- bool result = false;
- int idx = -1;
-
- _owner._spriteSlots.deleteTimer(seqIndex);
- if (seqEntry.doneFlag) {
- remove(seqIndex);
- return false;
- }
-
- if (seqEntry.spriteListIndex == -1) {
- // Doesn't have an associated sprite anymore, so mark as done
- seqEntry.doneFlag = true;
- } else if ((slotIndex = _owner._spriteSlots.getIndex()) >= 0) {
- MadsSpriteSlot &spriteSlot = _owner._spriteSlots[slotIndex];
- setSpriteSlot(seqIndex, spriteSlot);
-
- int x2 = 0, y2 = 0;
-
- if ((seqEntry.field_13 != 0) || (seqEntry.dynamicHotspotIndex >= 0)) {
- SpriteAsset &spriteSet = _owner._spriteSlots.getSprite(seqEntry.spriteListIndex);
- M4Sprite *frame = spriteSet.getFrame(seqEntry.frameIndex - 1);
- int width = frame->width() * seqEntry.scale / 200;
- int height = frame->height() * seqEntry.scale / 100;
-
- warning("frame size %d x %d", width, height);
-
- // TODO: Missing stuff here, and I'm not certain about the dynamic hotspot stuff below
-
- if (seqEntry.dynamicHotspotIndex >= 0) {
- DynamicHotspot &dynHotspot = _owner._dynamicHotspots[seqEntry.dynamicHotspotIndex];
-
- dynHotspot.bounds.left = MAX(x2 - width, 0);
- dynHotspot.bounds.right = MAX(x2 - width, 319) - dynHotspot.bounds.left + 1;
- dynHotspot.bounds.top = MAX(y2 - height, 0);
- dynHotspot.bounds.bottom = MIN(y2, 155) - dynHotspot.bounds.top;
-
- _owner._dynamicHotspots._changed = true;
- }
- }
-
- // Frame adjustments
- if (seqEntry.frameStart != seqEntry.numSprites)
- seqEntry.frameIndex += seqEntry.frameInc;
-
- if (seqEntry.frameIndex >= seqEntry.frameStart) {
- if (seqEntry.frameIndex > seqEntry.numSprites) {
- result = true;
- if (seqEntry.animType == ANIMTYPE_CYCLED) {
- // Reset back to the starting frame (cyclic)
- seqEntry.frameIndex = seqEntry.frameStart;
- } else {
- // Switch into reverse mode
- seqEntry.frameIndex = seqEntry.numSprites - 1;
- seqEntry.frameInc = -1;
- }
- }
- } else {
- // Currently in reverse mode and moved past starting frame
- result = true;
-
- if (seqEntry.animType == ANIMTYPE_CYCLED)
- {
- // Switch back to forward direction again
- seqEntry.frameIndex = seqEntry.frameStart + 1;
- seqEntry.frameInc = 1;
- } else {
- // Otherwise reset back to last sprite for further reverse animating
- seqEntry.frameIndex = seqEntry.numSprites;
- }
- }
-
- if (result && (seqEntry.triggerCountdown != 0)) {
- if (--seqEntry.triggerCountdown == 0)
- seqEntry.doneFlag = true;
- }
- } else {
- // Out of sprite display slots, so mark entry as done
- seqEntry.doneFlag = true;
- }
-
- if (seqEntry.entries.count > 0) {
- for (int i = 0; i <= seqEntry.entries.count; ++i) {
- switch (seqEntry.entries.mode[i]) {
- case SM_0:
- case SM_1:
- if (((seqEntry.entries.mode[i] == SM_0) && seqEntry.doneFlag) ||
- ((seqEntry.entries.mode[i] == SM_1) && result))
- idx = i;
- break;
-
- case SM_FRAME_INDEX: {
- int v = seqEntry.entries.frameIndex[i];
- if ((v == seqEntry.frameIndex) || (v == 0))
- idx = i;
- }
-
- default:
- break;
- }
- }
- }
-
- if (idx >= 0) {
- _owner._abortTimers = seqEntry.entries.abortVal[idx];
- _owner._abortTimersMode = seqEntry.abortMode;
- }
-
- return result;
-}
-
-/**
- * Handles counting down entries in the timer list for action
- */
-void MadsSequenceList::tick() {
- for (uint idx = 0; idx < _entries.size(); ++idx) {
- if ((_owner._abortTimers2 == 0) && (_owner._abortTimers != 0))
- break;
-
- MadsSequenceEntry &seqEntry = _entries[idx];
- uint32 currentTimer = _madsVm->_currentTimer;
-
- if (!seqEntry.active || (currentTimer < seqEntry.timeout))
- continue;
-
- // Set the next timeout for the timer entry
- seqEntry.timeout = currentTimer + seqEntry.numTicks;
-
- // Action the sprite
- if (loadSprites(idx)) {
- seqEntry.timeout += seqEntry.extraTicks;
- }
- }
-}
-
-void MadsSequenceList::delay(uint32 v1, uint32 v2) {
- for (uint idx = 0; idx < _entries.size(); ++idx) {
- if (_entries[idx].active) {
- _entries[idx].timeout += v1 - v2;
- }
- }
-}
-
-void MadsSequenceList::setAnimRange(int seqIndex, int startVal, int endVal) {
- MadsSequenceEntry &seqEntry = _entries[seqIndex];
- SpriteAsset &spriteSet = _owner._spriteSlots.getSprite(seqEntry.spriteListIndex);
- int numSprites = spriteSet.getCount();
- int tempStart = startVal, tempEnd = endVal;
-
- switch (startVal) {
- case -2:
- tempStart = numSprites;
- break;
- case -1:
- tempStart = 1;
- break;
- }
-
- switch (endVal) {
- case -2:
- case 0:
- tempEnd = numSprites;
- break;
- case -1:
- tempEnd = 1;
- break;
- default:
- tempEnd = numSprites;
- break;
- }
-
- seqEntry.frameStart = tempStart;
- seqEntry.numSprites = tempEnd;
-
- seqEntry.frameIndex = (seqEntry.frameInc < 0) ? tempStart : tempEnd;
-}
-
-void MadsSequenceList::scan() {
- for (uint i = 0; i < _entries.size(); ++i) {
- if (!_entries[i].active && (_entries[i].spriteListIndex != -1)) {
- int idx = _owner._spriteSlots.getIndex();
- setSpriteSlot(i, _owner._spriteSlots[idx]);
- }
- }
-}
-
-/**
- * Sets the depth of the specified entry in the sequence list
- */
-void MadsSequenceList::setDepth(int seqIndex, int depth) {
- _entries[seqIndex].depth = depth;
-}
-
-//--------------------------------------------------------------------------
-
-Animation::Animation(MadsM4Engine *vm): _vm(vm) {
-}
-
-Animation::~Animation() {
-}
-
-//--------------------------------------------------------------------------
-
-MadsView::MadsView(View *view): _view(view), _dynamicHotspots(*this), _sequenceList(*this),
- _kernelMessages(*this), _spriteSlots(*this), _dirtyAreas(*this), _textDisplay(*this),
- _screenObjects(*this), _action(*this) {
-
- _textSpacing = -1;
- _newTimeout = 0;
- _abortTimers = 0;
- _abortTimers2 = 0;
- _abortTimersMode = ABORTMODE_0;
- _abortTimersMode2 = ABORTMODE_0;
-
- _depthSurface = NULL;
- _bgSurface = NULL;
- _viewport = NULL;
- _sceneAnimation = new MadsAnimation(_vm, this);
-}
-
-MadsView::~MadsView() {
- delete _sceneAnimation;
- delete _viewport;
-}
-
-void MadsView::refresh() {
- if (!_viewport)
- setViewport(_view->bounds());
-
- // Draw any sprites
- _dirtyAreas.clear();
- _spriteSlots.drawBackground();
-
- // Process dirty areas
- _textDisplay.setDirtyAreas();
-
- // Merge any identified dirty areas
- _dirtyAreas.merge(1, DIRTY_AREAS_SIZE);
-
- // Copy dirty areas to the main display surface
- _dirtyAreas.copy(_viewport, _bgSurface, _posAdjust);
-
- // Handle dirty areas for foreground objects
- _spriteSlots.setDirtyAreas();
- _textDisplay.setDirtyAreas2();
- _dirtyAreas.merge(1, DIRTY_AREAS_SIZE);
-
- // Draw foreground sprites
- _spriteSlots.drawForeground(_viewport);
-
- // Draw text elements onto the view
- _textDisplay.draw(_viewport);
-
- // Remove any sprite slots that are no longer needed
- _spriteSlots.cleanUp();
-
- // Deactivate any text display entries that are no longer needed
- _textDisplay.cleanUp();
-}
-
-void MadsView::update() {
- _sequenceList.tick();
- _kernelMessages.update();
-}
-
-void MadsView::clearLists() {
- _textDisplay.clear();
- _kernelMessages.clear();
- _spriteSlots.clear();
-}
-
-void MadsView::setViewport(const Common::Rect &bounds) {
- delete _viewport;
- _viewport = new M4Surface(bounds.width(), bounds.height(), _view->getBasePtr(bounds.left, bounds.top),
- _view->getPitch());
-}
-
-} // End of namespace M4
diff --git a/engines/m4/mads_views.h b/engines/m4/mads_views.h
deleted file mode 100644
index 41caaa2ded..0000000000
--- a/engines/m4/mads_views.h
+++ /dev/null
@@ -1,494 +0,0 @@
-/* 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 M4_MADS_VIEWS_H
-#define M4_MADS_VIEWS_H
-
-#include "m4/gui.h"
-#include "m4/viewmgr.h"
-#include "common/rect.h"
-#include "common/list.h"
-#include "common/ptr.h"
-
-namespace M4 {
-
-class MadsView;
-
-enum MadsActionMode {ACTMODE_NONE = 0, ACTMODE_VERB = 1, ACTMODE_OBJECT = 3, ACTMODE_TALK = 6};
-enum MadsActionMode2 {ACTMODE2_0 = 0, ACTMODE2_2 = 2, ACTMODE2_4 = 4, ACTMODE2_5 = 5};
-enum AbortTimerMode {ABORTMODE_0 = 0, ABORTMODE_1 = 1, ABORTMODE_2 = 2};
-
-struct ActionDetails {
- int verbId;
- int objectNameId;
- int indirectObjectId;
-};
-
-struct MadsActionSavedFields {
- int articleNumber;
- int actionMode;
- int actionMode2;
- bool lookFlag;
- int selectedRow;
-};
-
-class MadsAction {
-private:
- MadsView &_owner;
- char _statusText[100];
- char _dialogTitle[100];
-
- void appendVocab(int vocabId, bool capitalise = false);
-public:
- ActionDetails _action, _activeAction;
- int _currentAction;
- int8 _flags1, _flags2;
- MadsActionMode _actionMode;
- MadsActionMode2 _actionMode2;
- int _articleNumber;
- bool _lookFlag;
- int _selectedRow;
- bool _textChanged;
- int _selectedAction;
- bool _startWalkFlag;
- int _statusTextIndex;
- int _hotspotId;
- MadsActionSavedFields _savedFields;
- bool _walkFlag;
-
- // Unknown fields
- int16 _v86F3A;
- int16 _v86F42;
- int16 _v86F4E;
- bool _v86F4A;
- int16 _v86F4C;
- int _v83338;
- bool _inProgress;
- AbortTimerMode _v8453A;
-
-public:
- MadsAction(MadsView &owner);
-
- void clear();
- void set();
- const char *statusText() const { return _statusText; }
- void refresh();
- void startAction();
- void checkAction();
- bool isAction(int verbId, int objectNameId = 0, int indirectObjectId = 0);
-};
-
-class SpriteSlotSubset {
-public:
- int spriteListIndex;
- int frameNumber;
- int xp;
- int yp;
- int depth;
- int scale;
-};
-
-class MadsSpriteSlot {
-public:
- int spriteType;
- int seqIndex;
- int spriteListIndex;
- int frameNumber;
- int xp;
- int yp;
- int depth;
- int scale;
-
- MadsSpriteSlot() { }
-
- bool operator==(const SpriteSlotSubset &other) const;
- void copy(const SpriteSlotSubset &other);
-};
-
-#define SPRITE_SLOTS_SIZE 50
-
-enum SpriteIdSpecial {
- BACKGROUND_SPRITE = -4, FULL_SCREEN_REFRESH = -2, EXPIRED_SPRITE = -1, SPRITE_ZERO = 0, FOREGROUND_SPRITE = 1
-};
-
-class MadsSpriteSlots {
-private:
- MadsView &_owner;
- Common::Array<MadsSpriteSlot> _entries;
- Common::Array<SpriteAsset *> _sprites;
-public:
- int startIndex;
-
- MadsSpriteSlots(MadsView &owner);
- ~MadsSpriteSlots();
-
- MadsSpriteSlot &operator[](int idx) {
- assert(idx < SPRITE_SLOTS_SIZE);
- return _entries[idx];
- }
- SpriteAsset &getSprite(int idx) {
- assert(idx < (int)_sprites.size());
- return *_sprites[idx];
- }
-
- int getIndex();
- int addSprites(const char *resName, bool suppressErrors = false, int flags = 0);
- int addSprites(SpriteAsset *spriteSet);
- void deleteSprites(int listIndex);
- void clear();
- void deleteTimer(int seqIndex);
-
- void drawBackground();
- void drawForeground(M4Surface *viewport);
- void setDirtyAreas();
- void fullRefresh();
- void cleanUp();
-};
-
-class MadsTextDisplayEntry {
-public:
- bool active;
- int expire;
- int spacing;
- Common::Rect bounds;
- uint8 color1;
- uint8 color2;
- Font *font;
- const char *msg;
-
- MadsTextDisplayEntry() { active = false; }
-};
-
-#define TEXT_DISPLAY_SIZE 40
-
-class MadsTextDisplay {
-private:
- MadsView &_owner;
- Common::Array<MadsTextDisplayEntry> _entries;
-public:
- MadsTextDisplay(MadsView &owner);
-
- MadsTextDisplayEntry &operator[](int idx) {
- assert(idx < TEXT_DISPLAY_SIZE);
- return _entries[idx];
- }
-
- void expire(int idx) {
- assert(idx < TEXT_DISPLAY_SIZE);
- _entries[idx].expire = -1;
- }
-
- int add(int xp, int yp, uint fontColor, int charSpacing, const char *msg, Font *font);
- void clear();
- void draw(M4Surface *view);
- void setDirtyAreas();
- void setDirtyAreas2();
- void cleanUp();
-};
-
-#define TIMED_TEXT_SIZE 10
-#define INDEFINITE_TIMEOUT 9999999
-
-enum KernelMessageFlags {KMSG_QUOTED = 1, KMSG_PLAYER_TIMEOUT = 2, KMSG_SEQ_ENTRY = 4, KMSG_SCROLL = 8, KMSG_RIGHT_ALIGN = 0x10,
- KMSG_CENTER_ALIGN = 0x20, KMSG_EXPIRE = 0x40, KMSG_ACTIVE = 0x80};
-
-class MadsKernelMessageEntry {
-public:
- uint8 flags;
- int sequenceIndex;
- char asciiChar;
- char asciiChar2;
- int color1;
- int color2;
- Common::Point position;
- int textDisplayIndex;
- int msgOffset;
- int numTicks;
- uint32 frameTimer2;
- uint32 frameTimer;
- uint32 timeout;
- int abortTimers;
- AbortTimerMode abortMode;
- uint16 actionNouns[3];
- char msg[100];
-
- MadsKernelMessageEntry() {
- flags = 0;
- }
-};
-
-class MadsKernelMessageList {
-private:
- MadsView &_owner;
- Common::Array<MadsKernelMessageEntry> _entries;
- Font *_talkFont;
-public:
- int word_8469E;
-public:
- MadsKernelMessageList(MadsView &owner);
-
- void clear();
- int add(const Common::Point &pt, uint fontColor, uint8 flags, uint8 abortTimers, uint32 timeout, const char *msg);
- int addQuote(int quoteId, int abortTimers, uint32 timeout);
- void scrollMessage(int msgIndex, int numTicks, bool quoted);
- void setSeqIndex(int msgIndex, int seqIndex);
- void remove(int msgIndex);
- void reset();
- void update();
- void processText(int msgIndex);
-};
-
-class ScreenObjectEntry {
-public:
- Common::Rect bounds;
- int category;
- int index;
- int layer;
- bool active;
-
- ScreenObjectEntry() { active = false; }
-};
-
-class ScreenObjects {
-private:
- MadsView &_owner;
- Common::Array<ScreenObjectEntry> _entries;
-public:
- int _v832EC;
- int _v7FECA;
- int _v7FED6;
- int _v8332A;
- int _yp;
- int _v8333C;
- int _selectedObject;
- int _category;
- int _objectIndex;
-
- ScreenObjects(MadsView &owner);
- ScreenObjectEntry &operator[](uint idx) {
- assert(idx <= _entries.size());
- return _entries[idx - 1];
- }
-
- void clear();
- void add(const Common::Rect &bounds, int layer, int idx, int category);
- void draw(View *view);
- int scan(int xp, int yp, int layer);
- int scanBackwards(int xp, int yp, int layer);
- void setActive(int category, int idx, bool active);
- void check(bool scanFlag, bool mouseClick);
-};
-
-class DynamicHotspot {
-public:
- bool active;
- int seqIndex;
- Common::Rect bounds;
- Common::Point pos;
- int facing;
- int descId;
- int field_14;
- int articleNumber;
- int field_17;
-
- DynamicHotspot() { active = false; }
-};
-
-#define DYNAMIC_HOTSPOTS_SIZE 8
-
-class MadsDynamicHotspots {
-private:
- MadsView &_owner;
- Common::Array<DynamicHotspot> _entries;
- int _count;
-public:
- bool _changed;
-public:
- MadsDynamicHotspots(MadsView &owner);
-
- DynamicHotspot &operator[](uint idx) { return _entries[idx]; }
- int add(int descId, int field14, int seqIndex, const Common::Rect &bounds);
- int setPosition(int index, int xp, int yp, int facing);
- int set17(int index, int v);
- void remove(int index);
- void reset();
- void refresh() {
- // TODO
- }
-};
-
-class MadsDirtyArea {
-public:
- Common::Rect bounds;
- Common::Rect bounds2;
- bool textActive;
- bool active;
-
- MadsDirtyArea() { active = false; }
- void setArea(int width, int height, int maxWidth, int maxHeight);
-};
-
-#define DIRTY_AREAS_SIZE 90
-#define DIRTY_AREAS_TEXT_DISPLAY_IDX 50
-
-class MadsDirtyAreas {
-private:
- MadsView &_owner;
- Common::Array<MadsDirtyArea> _entries;
-public:
- MadsDirtyAreas(MadsView &owner);
-
- MadsDirtyArea &operator[](uint idx) {
- assert(idx < _entries.size());
- return _entries[idx];
- }
-
- void setSpriteSlot(int dirtyIdx, const MadsSpriteSlot &spriteSlot);
- void setTextDisplay(int dirtyIdx, const MadsTextDisplayEntry &textDisplay);
- void merge(int startIndex, int count);
- bool intersects(int idx1, int idx2);
- void mergeAreas(int idx1, int idx2);
- void copy(M4Surface *dest, M4Surface *src, const Common::Point &posAdjust);
- void clear();
-};
-
-enum SpriteAnimType {ANIMTYPE_CYCLED = 1, ANIMTYPE_REVERSIBLE = 2};
-
-enum SequenceSubEntryMode {SM_0 = 0, SM_1 = 1, SM_FRAME_INDEX = 2};
-
-#define TIMER_ENTRY_SUBSET_MAX 5
-
-struct MadsSequenceSubEntries {
- int count;
- SequenceSubEntryMode mode[TIMER_ENTRY_SUBSET_MAX];
- int16 frameIndex[TIMER_ENTRY_SUBSET_MAX];
- int8 abortVal[TIMER_ENTRY_SUBSET_MAX];
-};
-
-struct MadsSequenceEntry {
- int8 active;
- int8 spriteListIndex;
- bool flipped;
-
- int frameIndex;
- int frameStart;
- int numSprites;
-
- SpriteAnimType animType;
- int frameInc;
-
- int depth;
- int scale;
- int dynamicHotspotIndex;
-
- bool nonFixed;
- int field_13;
-
- Common::Point msgPos;
- int triggerCountdown;
- bool doneFlag;
- MadsSequenceSubEntries entries;
- AbortTimerMode abortMode;
-
- uint16 actionNouns[3];
- int numTicks;
- int extraTicks;
- uint32 timeout;
-};
-
-#define TIMER_LIST_SIZE 30
-
-class MadsSequenceList {
-private:
- MadsView &_owner;
- Common::Array<MadsSequenceEntry> _entries;
-public:
- MadsSequenceList(MadsView &owner);
-
- MadsSequenceEntry &operator[](int index) { return _entries[index]; }
- void clear();
- bool addSubEntry(int index, SequenceSubEntryMode mode, int frameIndex, int abortVal);
- int add(int spriteListIndex, bool flipped, int frameIndex, int triggerCountdown, int delayTicks,
- int extraTicks, int numTicks, int msgX, int msgY, bool nonFixed, char scale, uint8 depth,
- int frameInc, SpriteAnimType animType, int numSprites, int frameStart);
- void remove(int seqIndex);
- void setSpriteSlot(int seqIndex, MadsSpriteSlot &spriteSlot);
- bool loadSprites(int seqIndex);
- void tick();
- void delay(uint32 v1, uint32 v2);
- void setAnimRange(int seqIndex, int startVal, int endVal);
- void scan();
- void setDepth(int seqIndex, int depth);
-};
-
-class Animation {
-protected:
- MadsM4Engine *_vm;
-public:
- Animation(MadsM4Engine *vm);
- virtual ~Animation();
- virtual void initialize(const Common::String &filename, uint16 flags, M4Surface *surface, M4Surface *depthSurface) = 0;
- virtual void load(const Common::String &filename, int v0) = 0;
- virtual void update() = 0;
- virtual void setCurrentFrame(int frameNumber) = 0;
- virtual int getCurrentFrame() = 0;
-};
-
-
-class MadsView {
-private:
- View *_view;
-public:
- Animation *_sceneAnimation;
- MadsSpriteSlots _spriteSlots;
- MadsTextDisplay _textDisplay;
- MadsKernelMessageList _kernelMessages;
- ScreenObjects _screenObjects;
- MadsDynamicHotspots _dynamicHotspots;
- MadsSequenceList _sequenceList;
- MadsDirtyAreas _dirtyAreas;
- MadsAction _action;
-
- int _textSpacing;
- uint32 _newTimeout;
- int _abortTimers;
- int8 _abortTimers2;
- AbortTimerMode _abortTimersMode;
- AbortTimerMode _abortTimersMode2;
- Common::Point _posAdjust;
-
- M4Surface *_depthSurface;
- M4Surface *_bgSurface;
- M4Surface *_viewport;
-public:
- MadsView(View *view);
- ~MadsView();
-
- void refresh();
- void update();
- void clearLists();
- void setViewport(const Common::Rect &bounds);
-};
-
-}
-
-#endif
diff --git a/engines/m4/midi.cpp b/engines/m4/midi.cpp
deleted file mode 100644
index bfe77828da..0000000000
--- a/engines/m4/midi.cpp
+++ /dev/null
@@ -1,256 +0,0 @@
-/* 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.
- *
- */
-
-// FIXME: This is cribbed together from the SAGA music player. It needs cleanup
-// and testing.
-
-#include "m4/m4.h"
-#include "m4/midi.h"
-#include "audio/midiparser.h"
-#include "common/config-manager.h"
-#include "common/memstream.h"
-#include "common/textconsole.h"
-
-namespace M4 {
-
-MidiPlayer::MidiPlayer(MadsM4Engine *vm) : _vm(vm), _isGM(false) {
-
- MidiPlayer::createDriver();
-
- int ret = _driver->open();
- if (ret == 0) {
- _driver->setTimerCallback(this, &timerCallback);
- }
-}
-
-void MidiPlayer::send(uint32 b) {
- if ((b & 0xF0) == 0xC0 && !_isGM && !_nativeMT32) {
- b = (b & 0xFFFF00FF) | MidiDriver::_mt32ToGm[(b >> 8) & 0xFF] << 8;
- }
-
- Audio::MidiPlayer::send(b);
-}
-
-void MidiPlayer::playMusic(const char *name, int32 vol, bool loop, int32 trigger, int32 scene) {
- Common::StackLock lock(_mutex);
-
- stop();
-
- char fullname[144];
- _vm->res()->changeExtension(fullname, name, "HMP");
-
- Common::SeekableReadStream *midiFile = _vm->res()->get(fullname);
- byte *hmpData = new byte[midiFile->size()];
- uint32 smfSize;
-
- midiFile->read(hmpData, midiFile->size());
- _midiData = convertHMPtoSMF(hmpData, midiFile->size(), smfSize);
- delete[] hmpData;
- _vm->res()->toss(fullname);
- _vm->res()->purge();
-
- if (_midiData) {
- _parser = MidiParser::createParser_SMF();
- _parser->setMidiDriver(this);
- _parser->setTimerRate(_driver->getBaseTempo());
-
- _parser->loadMusic(_midiData, smfSize);
- _parser->property(MidiParser::mpAutoLoop, loop);
- }
-
- setVolume(255);
-
- _isPlaying = true;
-}
-
-// This function will convert HMP music into type 1 SMF, which our SMF parser
-// will be able to handle. It is based on Hans de Goede's HMP 2 MIDI file
-// converter, which in turn is "based on the conversion algorithms found in
-// d1x, d2x-xl and jjffe". Hans's original code is licensed under the LGPL.
-//
-// TODO: It would probably be nicer to write a MIDI parser class to deal with
-// HMP data directly. Though the multi-track nature of HMP makes that tricky.
-
-byte *MidiPlayer::convertHMPtoSMF(byte *data, uint32 inSize, uint32 &outSize) {
- Common::MemoryReadStream readS(data, inSize);
- Common::MemoryWriteStreamDynamic writeS;
-
- byte buf[8];
-
- readS.read(buf, sizeof(buf));
- if (memcmp(buf, "HMIMIDIP", 8) != 0) {
- warning("convertHMPtoSMF: Invalid HMP header");
- return NULL;
- }
-
- // Read the number of tracks. Note that all the tracks are still part
- // of the same song, just like in type 1 SMF files.
-
- readS.seek(0x30);
-
- uint32 numTracks = readS.readUint32LE();
-
- // The first track starts on offset 0x300. It's currently unknown what
- // the skipped data is for.
-
- readS.seek(0x300);
-
- // For some reason, we skip the first track entirely.
-
- byte a = readS.readByte();
- byte b = readS.readByte();
- byte c = readS.readByte();
-
- while (a != 0xFF || b != 0x2F || c != 0x00) {
- a = b;
- b = c;
- c = readS.readByte();
- }
-
- // The beginning of the MIDI header
- static const byte midiHeader1[] = { 'M', 'T', 'h', 'd', 0, 0, 0, 6, 0, 1 };
- // The last 2 bytes of the midi header and track 0
- static const byte midiHeader2[] = { 0, 0xC0, 'M', 'T', 'r', 'k', 0, 0, 0, 0x0B, 0, 0xFF, 0x51, 0x03, 0x18, 0x80, 0, 0, 0xFF, 0x2F, 0 };
-
-
- // Write the MIDI header
- writeS.write(midiHeader1, sizeof(midiHeader1));
-
- // Write the number of tracks
- writeS.writeUint16BE(numTracks);
-
- // Write the rest of the MIDI header and track 0.
- writeS.write(midiHeader2, sizeof(midiHeader2));
-
- // Read and convert all the tracks
- for (uint i = 1; i < numTracks; i++) {
- if (readS.readUint32LE() != i) {
- warning("convertHMPtoSMF: Invalid HMP track number");
- delete[] writeS.getData();
- return NULL;
- }
-
- uint32 trackLength = readS.readUint32LE() - 12;
- readS.readUint32LE(); // Unused?
-
- // Write the track header
- writeS.write("MTrk", 4);
-
- // This is where we will write the length of the track.
- uint32 trackLengthPos = writeS.pos();
- writeS.writeUint32LE(0);
-
- // In the original, this is cleared once at the beginning of
- // the function, but surely the last command does not carry
- // over to the next track?
-
- byte lastCmd = 0;
-
- // Now we can finally convert the track
- int32 endPos = readS.pos() + trackLength;
- while (readS.pos() < endPos) {
- // Convert the VLQ
- byte vlq[4];
- int j = -1;
-
- do {
- j++;
- vlq[j] = readS.readByte();
- } while (!(vlq[j] & 0x80));
-
- for (int k = 0; k <= j; k++) {
- a = vlq[j - k] & 0x7F;
- if (k != j)
- a |= 0x80;
- writeS.writeByte(a);
- }
-
- a = readS.readByte();
-
- if (a == 0xFF) {
- // META event
- b = readS.readByte();
- c = readS.readByte();
-
- writeS.writeByte(a);
- writeS.writeByte(b);
- writeS.writeByte(c);
-
- if (c > 0) {
- byte *metaBuf = new byte[c];
- readS.read(metaBuf, c);
- writeS.write(metaBuf, c);
- delete[] metaBuf;
- }
-
- if (b == 0x2F) {
- if (c != 0x00) {
- warning("convertHMPtoSMF: End of track with non-zero size");
- delete[] writeS.getData();
- return NULL;
- }
- break;
- }
- } else {
- if (a != lastCmd)
- writeS.writeByte(a);
-
- switch (a & 0xF0) {
- case 0x80:
- case 0x90:
- case 0xA0:
- case 0xB0:
- case 0xE0:
- b = readS.readByte();
- c = readS.readByte();
- writeS.writeByte(b);
- writeS.writeByte(c);
- break;
- case 0xC0:
- case 0xD0:
- b = readS.readByte();
- writeS.writeByte(b);
- break;
- default:
- warning("convertHMPtoSMF: Invalid HMP command %02X", a);
- delete[] writeS.getData();
- return NULL;
- }
-
- lastCmd = a;
- }
- }
-
- if (readS.pos() != endPos) {
- warning("convertHMPtoSMF: Invalid track length");
- delete[] writeS.getData();
- return NULL;
- }
-
- WRITE_BE_UINT32(writeS.getData() + trackLengthPos, writeS.pos() - trackLengthPos - 4);
- }
-
- outSize = writeS.size();
- return writeS.getData();
-}
-
-} // End of namespace M4
diff --git a/engines/m4/module.mk b/engines/m4/module.mk
deleted file mode 100644
index f60757ba3b..0000000000
--- a/engines/m4/module.mk
+++ /dev/null
@@ -1,49 +0,0 @@
-MODULE := engines/m4
-
-MODULE_OBJS = \
- actor.o \
- animation.o \
- assets.o \
- compression.o \
- console.o \
- converse.o \
- detection.o \
- dialogs.o \
- events.o \
- font.o \
- globals.o \
- graphics.o \
- gui.o \
- hotspot.o \
- m4.o \
- m4_menus.o \
- m4_scene.o \
- m4_views.o \
- mads_anim.o \
- mads_logic.o \
- mads_menus.o \
- mads_player.o \
- mads_scene.o \
- mads_views.o \
- midi.o \
- rails.o \
- resource.o \
- saveload.o \
- scene.o \
- script.o \
- sound.o \
- sprite.o \
- staticres.o \
- viewmgr.o \
- woodscript.o \
- ws_machine.o \
- ws_sequence.o
-
-
-# This module can be built as a plugin
-ifeq ($(ENABLE_M4), DYNAMIC_PLUGIN)
-PLUGIN := 1
-endif
-
-# Include common rules
-include $(srcdir)/rules.mk
diff --git a/engines/m4/rails.cpp b/engines/m4/rails.cpp
deleted file mode 100644
index f51d81c8f4..0000000000
--- a/engines/m4/rails.cpp
+++ /dev/null
@@ -1,358 +0,0 @@
-/* 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.
- *
- */
-
-/*
- TODO:
- - rewrite functions (GetShortestPath etc.)
-*/
-
-#include "graphics/primitives.h"
-#include "common/list.h"
-#include "common/rect.h"
-#include "common/util.h"
-
-#include "m4/rails.h"
-#include "m4/m4.h"
-
-namespace M4 {
-
-#define TOP_EDGE 1 << 0
-#define LEFT_EDGE 1 << 1
-#define BOTTOM_EDGE 1 << 2
-#define RIGHT_EDGE 1 << 3
-
-
-Rails::Rails() {
-}
-
-
-Rails::~Rails() {
- clearRails();
-}
-
-
-void Rails::clearRails() {
- uint32 i;
- Common::List<NoWalkRect *>::iterator j;
- RailNode *tempNode;
-
- for (i = 0; i < _nodes.size(); i++) {
- tempNode = _nodes[i];
- _nodes.remove_at(i);
- delete tempNode;
- }
-
- _edges.clear();
-
- for (j = _noWalkRects.begin(); j != _noWalkRects.end(); ++j)
- delete (*j);
- _noWalkRects.clear();
-}
-
-static void checkPoint(int x, int y, int color, void *data) {
- IsWalkableData *isWalkableData = (IsWalkableData*)data;
- if (!isWalkableData->result)
- return;
- else {
- M4Surface *codes = isWalkableData->codes;
- if (x >= 0 && x < codes->width() && y >= 0 && y < codes->height()) {
- isWalkableData->result = !((*((uint8*)codes->getBasePtr(x, y))) & 0x10);
- } else {
- isWalkableData->result = false;
- }
- }
-}
-
-bool Rails::isLineWalkable(int x0, int y0, int x1, int y1) {
- IsWalkableData isWalkableData;
- isWalkableData.codes = _walkCodes;
- isWalkableData.result = true;
- Graphics::drawLine(x0, y0, x1, y1, 0, &checkPoint, &isWalkableData);
- return isWalkableData.result;
-}
-
-uint8 Rails::getDepth(const Common::Point &pt) {
- // TODO: Check based on sceneResources
- const byte *b = _walkCodes->getBasePtr(pt.x, pt.y);
- return *b & 0xf;
-}
-
-// helper function
-uint8 getEndCode(int32 x, int32 y, Common::Rect rect) {
- uint8 endCode = 0;
- endCode = (x < rect.left) ? LEFT_EDGE : endCode;
- endCode = (x > rect.right) ? RIGHT_EDGE : endCode;
- endCode = (y < rect.top) ? endCode | TOP_EDGE : endCode;
- endCode = (y > rect.bottom) ? endCode | BOTTOM_EDGE : endCode;
- return endCode;
-}
-
-bool Rails::lineCrossesRect(int32 x1, int32 y1, int32 x2, int32 y2, Common::Rect rect) {
- int32 mX, mY;
- int32 pX1 = x1, pX2 = x2, pY1 = y1, pY2 = y2;
- uint8 endCode1, endCode2, midCode;
-
- if (rect.left > rect.right || rect.top > rect.bottom)
- return false;
-
- // Cohen-Sutherland line clipping algorithm
-
- endCode1 = getEndCode(pX1, pY1, rect);
- endCode2 = getEndCode(pX2, pY2, rect);
-
- if (!endCode1 || !endCode2) // if both endcodes are zero
- return true; // point is inside the rectangle, therefore the line intersects
-
- while (true) {
- if (endCode1 & endCode2) // if both endcodes have a common bitset
- return false; // line is completely off one edge
-
- // calculate midpoint
- mX = (pX1 + pX2)>>1;
- mY = (pY1 + pY2)>>1;
-
- // avoid round-off error: make sure that the midpoint isn't the same as one of the
- // two endpoints
- if (((mX == pX1) && (mY == pY1)) || ((mX == pX2) && (mY == pY2)))
- return false;
-
- midCode = getEndCode(mX, mY, rect);
-
- if (!midCode) {
- return true;
- } else if (midCode & endCode1) {
- // the midCode and an end point form a line segment completely off one edge, so
- // remove that half of the line segment
- pX1 = mX;
- pY1 = mY;
- endCode1 = midCode;
- } else {
- pX2 = mX;
- pY2 = mY;
- endCode2 = midCode;
- }
- }
-}
-
-
-bool Rails::linePassesThroughRect(int32 x1, int32 y1, int32 x2, int32 y2) {
- if (_noWalkRects.empty())
- return false;
-
- bool intersected = false;
- Common::List<NoWalkRect *>::iterator i;
-
- for (i = _noWalkRects.begin(); i != _noWalkRects.end(); ++i) {
- intersected = lineCrossesRect(x1, y1, x2, y2, Common::Rect((*i)->x1, (*i)->y1, (*i)->x2, (*i)->y2));
- if (intersected)
- break;
- }
-
- return intersected;
-}
-
-long SqrtF16(long n) {
- uint32 r = 0, s;
- uint32 v = (uint32)n;
-
- for (int i = 15; i >= 0; --i) {
- s = r + (1L << i * 2);
- r >>= 1;
- if (s <= v) {
- v -= s;
- r |= (1L << i * 2);
- }
- }
-
- return (long)r;
-}
-
-void Rails::createEdge(int32 node1, int32 node2) {
- uint32 index;
- int32 x1, y1, x2, y2;
- bool valid;
- long deltaX, deltaY, distance;
-
- if ((node1 < 0) || (node1 >= MAXRAILNODES) || (node2 < 0) || (node2 >= MAXRAILNODES))
- return;
-
- if (node1 == node2)
- return;
-
- if (node2 < node1)
- SWAP(node1, node2); // ensure node1 < node2
-
- // Find the table entry i.e. tableWidth * node1 + node2 and then subtract
- // n(n+1)/2, since only the upper triangle of the table is stored
- index = (MAXRAILNODES-1) * node1 + node2 - 1 - (node1*(node1+1)>>1);
- if (index > _edges.size() - 1)
- _edges.resize(index + 1);
- _edges.insert_at(index, 0);
- valid = true;
-
- if (_nodes.size() <= (uint32)node1 || _nodes.size() <= (uint32)node2)
- return;
-
- x1 = _nodes[node1]->x;
- y1 = _nodes[node1]->y;
- x2 = _nodes[node2]->x;
- y2 = _nodes[node2]->y;
-
- // Make sure that the algorithm is symmetric
- if (x2 < x1) {
- SWAP(x1, x2);
- SWAP(y1, y2);
- }
-
- valid = isLineWalkable(_nodes[node1]->x, _nodes[node1]->y,
- _nodes[node2]->x, _nodes[node2]->y);
- debugCN(kDebugCore, "test code says: %d\n", valid);
-
- // Check if the line passes through a forbidden rectangle
- if (valid) {
- if (linePassesThroughRect(x1, y1, x2, y2)) {
- valid = false;
- }
- }
-
- if (valid) {
- deltaX = ABS(((long)(x2 - x1)) << 16);
- deltaY = ABS(((long)(y2 - y1)) << 16);
- if ((deltaX >= 0x800000) || (deltaY >= 0x800000)) {
- deltaX >>= 16;
- deltaY >>= 16;
- distance = (long)(SqrtF16(deltaX * deltaX + deltaY * deltaY) << 16);
- } else {
- distance = SqrtF16(FixedMul(deltaX, deltaX) + FixedMul(deltaY, deltaY)) << 8;
- }
- _edges.insert_at(index, distance >> 16);
- }
-
- debugCN(kDebugCore, "node1 = %d, node2 = %d, valid = %d\n", node1, node2, valid);
-
-}
-
-
-void Rails::restoreNodeEdges(int32 nodeID) {
- for (int32 i = 0; i < MAXRAILNODES; i++) {
- createEdge(i, nodeID);
- }
-}
-
-void Rails::restoreEdgeList() {
- int32 j;
- for (int32 i = 0; i < MAXRAILNODES; i++) {
- for (j = i + 1; j < MAXRAILNODES; j++) {
- createEdge(i, j);
- }
- }
-}
-
-int32 Rails::addRailNode(int32 x, int32 y, bool restoreEdges) {
- uint32 i = _nodes.size();
- if (i >= MAXRAILNODES)
- return -1;
-
- RailNode *newNode = new RailNode();
- newNode->nodeID = i;
- newNode->x = x;
- newNode->y = y;
- _nodes.insert_at(i, newNode);
- if (restoreEdges) {
- for (uint32 j=0; j<_nodes.size(); j++)
- createEdge(i, j);
- }
- return i;
-}
-
-bool Rails::removeRailNode(int32 nodeID, bool restoreEdges) {
- if (nodeID < 0 || nodeID >= MAXRAILNODES)
- return false;
-
- if (_nodes.empty() || _edges.empty())
- return false;
-
- RailNode *tempNode = _nodes[nodeID];
- _nodes.remove_at(nodeID);
- delete tempNode;
-
- if (restoreEdges) {
- restoreNodeEdges(nodeID);
- }
- return true;
-}
-
-int16 Rails::getEdgeLength(int32 node1, int32 node2) {
- int32 index;
- if (_edges.empty() || node1 == node2)
- return 0;
- if (node2 < node1)
- SWAP(node1, node2);
- // Find the table entry i.e. tableWidth * node1 + node2 and then subtract
- // n(n+1)/2, since only the upper triangle of the table is stored
- index = (MAXRAILNODES-1)*node1 + node2 - 1 - (node1*(node1+1)>>1);
- return _edges[index];
-}
-
-void Rails::disposePath(RailNode *pathStart) {
- RailNode *tempNode = pathStart;
- while (tempNode) {
- pathStart = pathStart->shortPath;
- delete tempNode;
- tempNode = pathStart;
- }
-}
-
-/*
-static RailNode* duplicatePath(RailNode *pathStart) {
- RailNode *newNode = NULL;
- RailNode *firstNode = NULL;
- RailNode *prevNode = NULL;
- // A valid path is assumed
- RailNode *pathNode = pathStart;
-
- while (pathNode) {
- newNode = new RailNode();
- newNode->x = pathNode->x;
- newNode->y = pathNode->y;
- newNode->shortPath = NULL;
-
- if (!firstNode)
- firstNode = newNode;
- else
- prevNode->shortPath = newNode;
-
- prevNode = newNode;
- // Get the next node
- pathNode = pathNode->shortPath;
- }
-
- return firstNode;
-}
-*/
-
-bool Rails::getShortestPath(int32 origID, int32 destID, RailNode **shortPath) {
- // TODO
- return true;
-}
-
-} // End of namespace M4
diff --git a/engines/m4/rails.h b/engines/m4/rails.h
deleted file mode 100644
index 80bb55e9de..0000000000
--- a/engines/m4/rails.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* 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 M4_RAILS_H
-#define M4_RAILS_H
-
-#include "m4/graphics.h"
-#include "common/list.h"
-#include "common/array.h"
-#include "common/rect.h"
-
-// TODO: This needs cleaning up
-
-namespace M4 {
-
-#define MAXRAILNODES 32
-#define PATH_END 0xffff
-
-struct RailNode {
- uint8 nodeID;
- int32 x, y;
- RailNode *shortPath;
- int32 pathWeight;
-};
-
-struct NoWalkRect {
- int32 x1, y1, x2, y2;
- int32 alternateWalkToNode;
- int32 walkAroundNode1;
- int32 walkAroundNode2;
- int32 walkAroundNode3;
- int32 walkAroundNode4;
-};
-
-struct PathNode {
- PathNode *next;
- int8 nodeID;
-};
-
-struct IsWalkableData {
- M4Surface *codes;
- bool result;
-};
-
-class Rails {
-public:
- Rails();
- ~Rails();
-
- void setCodeSurface(M4Surface *surface) { _walkCodes = surface; }
- void clearRails();
- int32 addRailNode(int32 x, int32 y, bool restoreEdges);
- uint8 getDepth(const Common::Point &pt);
-
-private:
- Common::Array<RailNode *> _nodes;
- Common::Array<int16> _edges;
- Common::List<NoWalkRect *> _noWalkRects;
- M4Surface *_walkCodes;
-
- bool lineCrossesRect(int32 x1, int32 y1, int32 x2, int32 y2, Common::Rect rect);
- bool linePassesThroughRect(int32 x1, int32 y1, int32 x2, int32 y2);
- void createEdge(int32 node1, int32 node2);
- bool removeRailNode(int32 nodeID, bool restoreEdges);
- int16 getEdgeLength(int32 node1, int32 node2);
-
- void restoreNodeEdges(int32 nodeID);
- void restoreEdgeList();
- void disposePath(RailNode *pathStart);
- bool getShortestPath(int32 origID, int32 destID, RailNode **shortPath);
- bool isLineWalkable(int x0, int y0, int x1, int y1);
-};
-
-long SqrtF16(long n);
-
-} // End of namespace M4
-
-#endif
diff --git a/engines/m4/resource.cpp b/engines/m4/resource.cpp
deleted file mode 100644
index f5b2050052..0000000000
--- a/engines/m4/resource.cpp
+++ /dev/null
@@ -1,530 +0,0 @@
-/* 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 "m4/m4.h"
-#include "m4/resource.h"
-#include "m4/events.h"
-
-#include "common/substream.h"
-#include "common/textconsole.h"
-
-namespace M4 {
-
-FileSystem::FileSystem(const char *hashFilename) {
-
- for (int i = 0; i < 10; i++) {
- _hagEntries[i].filename[0] = '\0';
- _hagEntries[i].fileIndex = 0; // Was -1
- _hagEntries[i].hagFile = 0;
- }
-
- Common::File hashFile;
- uint32 hashSize;
-
- hashFile.open(hashFilename);
-
- if (!hashFile.isOpen()) {
- debugCN(kDebugCore, "FileSystem::FileSystem: error opening hash %s\n", hashFilename);
- }
-
- hashSize = hashFile.readUint32LE();
-
- //debugCN(kDebugCore, "FileSystem::FileSystem: hashSize = %d\n", hashSize);
-
- /* load file records and add them to the hash list */
- for (uint i = 0; i < hashSize; i++) {
- HashFileEntry entry;
- hashFile.read(entry.filename, kM4MaxFilenameSize);
- str_lower(entry.filename);
- entry.hagfile = hashFile.readByte();
- hashFile.readByte();
- entry.offset = hashFile.readUint32LE();
- entry.size = hashFile.readUint32LE();
- hashFile.readUint32LE();
-
- if (entry.filename[0]) {
- /*
- debugCN(kDebugCore, " filename: %s\n", entry.filename);
- debugCN(kDebugCore, " hagfile: %d\n", entry.hagfile);
- debugCN(kDebugCore, " disks: %d\n", entry.disks);
- debugCN(kDebugCore, " offset: %08X\n", entry.offset);
- debugCN(kDebugCore, " size: %d\n", entry.size);
- debugCN(kDebugCore, " next: %08X\n", entry.next);
- */
- _fileEntries[entry.filename] = entry;
- }
-
- }
-
- /* load hagfile records and update the list */
- while (!hashFile.eos()) {
- HashHagEntry entry;
- hashFile.read(entry.filename, kM4MaxFilenameSize);
- entry.fileIndex = hashFile.readByte();
- if (hashFile.eos())
- break;
-
- changeExtension(_hagEntries[entry.fileIndex].filename, entry.filename, "HAG");
- _hagEntries[entry.fileIndex].fileIndex = entry.fileIndex;
-
- _hagEntries[entry.fileIndex].hagFile = new Common::File();
- _hagEntries[entry.fileIndex].hagFile->open(_hagEntries[entry.fileIndex].filename);
-
- if (!_hagEntries[entry.fileIndex].hagFile->isOpen()) {
- debugCN(kDebugCore, "FileSystem::FileSystem: error opening hag %s\n", _hagEntries[entry.fileIndex].filename);
- }
-
- }
-
- hashFile.close();
-
-}
-
-FileSystem::~FileSystem() {
-
- for (int i = 0; i < 10; i++) {
- if (_hagEntries[i].hagFile)
- delete _hagEntries[i].hagFile;
- }
-
-}
-
-Common::SeekableReadStream *FileSystem::loadFile(const char *resourceName, bool preloadFlag) {
- const HashFileEntry *hfe = getHashFileEntry(resourceName);
- Common::SeekableReadStream *result = NULL;
-
- if (hfe) {
- //debugCN(kDebugCore, "FileSystem::loadFile() success opening %s\n", filename);
- HashHagEntry *hagEntry = &_hagEntries[hfe->hagfile];
-
- if (preloadFlag) {
- // Creates a MemoryReadStream object that contains all of the resource in memory
- hagEntry->hagFile->seek(hfe->offset);
- result = _hagEntries[hfe->hagfile].hagFile->readStream(hfe->size);
- }
- else
- // Creates a SeekableSubReadStream, which will read the data in from disk as the
- // caller reads in data
- result = new Common::SeekableSubReadStream(hagEntry->hagFile, hfe->offset,
- hfe->offset + hfe->size);
-
- } else {
- debugCN(kDebugCore, "FileSystem::loadFile() error opening %s\n", resourceName);
- }
-
- return result;
-}
-
-const FileSystem::HashFileEntry *FileSystem::getHashFileEntry(const char *filename) {
- char resourceName[20];
- strcpy(resourceName, filename);
- str_lower(resourceName);
-
- FileHashMap::const_iterator entry = _fileEntries.find(filename);
- if (entry != _fileEntries.end())
- return &(entry->_value);
- else
- return NULL;
-}
-
-void FileSystem::changeExtension(char *destName, const char *sourceName, const char *extension) {
- if (sourceName != destName)
- strcpy(destName, sourceName);
- char *dot = strrchr(destName, '.');
- if (dot != NULL)
- *dot = 0;
-
- strcat(destName, ".");
- strcat(destName, extension);
-
- str_upper(destName);
-}
-
-//--------------------------------------------------------------------------
-
-ResourceManager::~ResourceManager() {
- ResourceIterator i;
- for (i = _resources.begin(); i != _resources.end(); ++i) {
- Resource *r = (*i).get();
- delete r->stream;
- }
-}
-
-Common::SeekableReadStream *ResourceManager::get(const char *resourceName, bool preloadFlag) {
- char lowerName[kM4MaxFilenameSize];
-
- strcpy(lowerName, resourceName);
- str_lower(lowerName);
-
- // Check whether the resource is already loaded
- ResourceIterator i;
- for (i = _resources.begin(); i != _resources.end(); ++i) {
- Resource *r = (*i).get();
- if (!strcmp(r->name, resourceName)) {
- // Just in case resource was marked to be purged, reactive it again
- r->flags &= ~kResourcePurge;
-
- // Return the existing copy of the resource
- r->stream->seek(0, SEEK_SET);
- return r->stream;
- }
- }
-
- // the resource wasn't found in the list, load it from disk
- Resource *newRes = new Resource();
- strncpy(newRes->name, resourceName, 63);
- newRes->name[63] = '\0';
- newRes->flags = 0;
- newRes->stream = loadResource(resourceName, preloadFlag);
-
- _resources.push_back(ResourceList::value_type(newRes));
- return newRes->stream;
-}
-
-void ResourceManager::toss(const char *resourceName) {
- ResourceIterator i;
- for (i = _resources.begin(); i != _resources.end(); ++i) {
- Resource *r = (*i).get();
-
- if (!strcmp(r->name, resourceName)) {
- r->flags |= kResourcePurge;
- //debugCN(kDebugCore, "M4ResourceManager::toss: mark resource %s to be purged\n", resourceName);
- }
- }
-}
-
-void ResourceManager::purge() {
- ResourceIterator i = _resources.begin();
- while (i != _resources.end()) {
- Resource *r = (*i).get();
-
- if (r->flags & kResourcePurge) {
- delete r->stream;
- i = _resources.erase(i);
- } else {
- ++i;
- }
- }
-}
-
-void ResourceManager::dump() {
- _vm->_events->getConsole()->DebugPrintf("Scene resources:\n");
-
- int index = 0;
- ResourceIterator i;
- for (i = _resources.begin(); i != _resources.end(); ++i) {
- Resource *r = (*i).get();
-
- if (!(r->flags & kResourcePurge)) {
- _vm->_events->getConsole()->DebugPrintf(
- "Resource #%i, name: %s, handle pointer: %p, size: %d, flags: %02X\n",
- index++, r->name, r->buffer, r->stream->size(), r->flags);
- }
- }
-}
-
-//--------------------------------------------------------------------------
-
-const char *madsConcatString = "MADSCONCAT";
-
-ResourceType MADSResourceManager::getResourceType(const char *resourceName) {
- if (!strncmp(resourceName, "RM", 2)) {
- // Room resource
- return RESTYPE_ROOM;
- } else if (!strncmp(resourceName, "SC", 2)) {
- // SC resource
- return RESTYPE_SC;
- } else if (strstr(resourceName, ".TXT")) {
- // Text resource
- return RESTYPE_TEXT;
- } else if (strstr(resourceName, ".QUO")) {
- // QUO resource
- return RESTYPE_QUO;
- } else if (*resourceName == 'I') {
- // I resource
- return RESTYPE_I;
- } else if (!strncmp(resourceName, "OB", 2)) {
- // OB resource
- return RESTYPE_OB;
- } else if (!strncmp(resourceName, "FONT", 4)) {
- // FONT resource
- return RESTYPE_FONT;
- } else if (!strncmp(resourceName, "SOUND", 5)) {
- // SOUND resource
- return RESTYPE_SOUND;
- } else if (!strncmp(resourceName, "SPCHC", 5)) {
- // SPEECH resource
- return RESTYPE_SPEECH;
- }
-
- // Check for a known extension
- const char *extPos = strchr(resourceName, '.');
- if (extPos) {
- ++extPos;
- if (!strcmp(extPos, "FL") || !strcmp(extPos, "LBM") || !strcmp(extPos, "ANM") ||
- !strcmp(extPos, "AA") || !strcmp(extPos, "SS")) {
- return RESTYPE_HAS_EXT;
- }
- }
-
- return RESTYPE_NO_EXT;
-}
-
-const char *MADSResourceManager::getResourceFilename(const char *resourceName) {
- static char outputFilename[64];
-
- ResourceType resType = getResourceType(resourceName);
-
- strcpy(outputFilename, "GLOBAL.HAG");
-
- if ((resType == RESTYPE_ROOM) || (resType == RESTYPE_SC)) {
- int value = atoi(resourceName + 2);
- int hagFileNum = (resType == RESTYPE_ROOM) ? value / 100 : value;
-
- if (hagFileNum > 0)
- sprintf(outputFilename, "SECTION%d.HAG", hagFileNum);
- }
-
- if (resType == RESTYPE_SPEECH)
- strcpy(outputFilename, "SPEECH.HAG");
-
- return outputFilename;
-}
-
-/**
- * Forms a resource name based on the passed specifiers
- */
-const char *MADSResourceManager::getResourceName(char asciiCh, int prefix, ExtensionType extType,
- const char *suffix, int index) {
- static char resourceName[100];
-
- if (prefix <= 0)
- strcpy(resourceName, "*");
- else {
- if (prefix < 100)
- strcpy(resourceName, "*SC");
- else
- strcpy(resourceName, "*RM");
- sprintf(resourceName + 3, "%.3d", prefix);
- }
-
- // Append the specified ascii prefix character
- char asciiStr[2];
- asciiStr[0] = asciiCh;
- asciiStr[1] = '\0';
- strcat(resourceName, asciiStr);
-
- // Add in the index specified
- if (index >= 0)
- sprintf(resourceName + strlen(resourceName), "%d", index);
-
- // Add in any suffix
- if (suffix)
- strcat(resourceName, suffix);
-
- // Handle extension types
- switch (extType) {
- case EXTTYPE_SS:
- strcat(resourceName, ".SS");
- break;
- case EXTTYPE_AA:
- strcat(resourceName, ".AA");
- break;
- case EXTTYPE_DAT:
- strcat(resourceName, ".DAT");
- break;
- case EXTTYPE_HH:
- strcat(resourceName, ".HH");
- break;
- case EXTTYPE_ART:
- strcat(resourceName, ".ART");
- break;
- case EXTTYPE_INT:
- strcat(resourceName, ".INT");
- break;
- default:
- break;
- }
-
- return &resourceName[0];
-}
-
-/**
- * Another variation for forming resource names
- */
-const char *MADSResourceManager::getResourceName(ResourcePrefixType prefixType, int idx, const char *extension) {
- static char resourceName[100];
-
- strcpy(resourceName, "*");
-
- if (extension) {
- switch (prefixType) {
- case RESPREFIX_GL:
- strcat(resourceName, "GL000");
- break;
- case RESPREFIX_SC:
- case RESPREFIX_RM:
- strcat(resourceName, (prefixType == RESPREFIX_SC) ? "SC" : "RM");
- sprintf(resourceName + 3, "%.3d", idx);
- break;
- default:
- break;
- }
-
- strcat(resourceName, extension);
- }
-
- return &resourceName[0];
-}
-
-/**
- * Forms an AA resource name based on the given passed index
- */
-const char *MADSResourceManager::getAAName(int index) {
- return getResourceName('I', 0, EXTTYPE_AA, NULL, index);
-}
-
-Common::SeekableReadStream *MADSResourceManager::loadResource(const char *resourceName, bool loadFlag) {
- Common::File hagFile;
- uint32 offset = 0, size = 0;
-
- // If the first character is a '@' then look for an external file
-
- if (*resourceName == '@') {
- ++resourceName;
-
- hagFile.open(resourceName);
- if (loadFlag)
- return hagFile.readStream(hagFile.size());
- else
- return new Common::SeekableSubReadStream(&hagFile, 0, hagFile.size());
- }
-
- // If the first character is the wildcard (resource indicator), skip over it
- if (*resourceName == '*')
- ++resourceName;
-
- char resName[20];
- strcpy(resName, resourceName);
- str_upper(resName);
-
- hagFile.open(getResourceFilename(resName));
-
- // Validate hag file header
- char headerBuffer[16];
- if ((hagFile.read(headerBuffer, 16) != 16) || (strncmp(headerBuffer, madsConcatString, 10) != 0))
- error("Invalid HAG file opened");
-
- int numEntries = hagFile.readUint16LE();
-
- int resIndex = -1;
- while (++resIndex < numEntries) {
- // Read in the details of the next resource
- char resourceBuffer[14];
- offset = hagFile.readUint32LE();
- size = hagFile.readUint32LE();
- hagFile.read(resourceBuffer, 14);
-
- if (!strcmp(resName, resourceBuffer))
- break;
- }
-
- if (resIndex == numEntries)
- error("Invalid resource '%s' specified", resourceName);
-
- // Get the resource, either loading it in it's entirely or getting a stream reference
-
- if (loadFlag) {
- hagFile.seek(offset);
- return hagFile.readStream(size);
- } else {
- return new Common::SeekableSubReadStream(&hagFile, offset, offset + size);
- }
-}
-
-bool MADSResourceManager::resourceExists(const char *resourceName) {
- Common::File hagFile;
-
- // If the first character is the wildcard (resource indicator), skip over it
- if (*resourceName == '*')
- ++resourceName;
-
- char resName[20];
- strcpy(resName, resourceName);
- str_upper(resName);
-
- hagFile.open(getResourceFilename(resName));
-
- // Validate hag file header
- char headerBuffer[16];
- if ((hagFile.read(headerBuffer, 16) != 16) || (strncmp(headerBuffer, madsConcatString, 10) != 0))
- error("Invalid HAG file opened");
-
- int numEntries = hagFile.readUint16LE();
-
- int resIndex = -1;
- while (++resIndex < numEntries) {
- // Read in the details of the next resource
- char resourceBuffer[14];
- hagFile.readUint32LE(); // offset
- hagFile.readUint32LE(); // size
- hagFile.read(resourceBuffer, 14);
-
- if (!strcmp(resName, resourceBuffer))
- break;
- }
-
- if (resIndex == numEntries)
- return false;
- else
- return true;
-}
-
-//--------------------------------------------------------------------------
-
-M4ResourceManager::M4ResourceManager(MadsM4Engine *vm): ResourceManager(vm) {
- _hfs = new FileSystem(_vm->getGameFile(kFileTypeHash));
-}
-
-M4ResourceManager::~M4ResourceManager() {
-}
-
-Common::SeekableReadStream *M4ResourceManager::loadResource(const char *resourceName, bool preloadFlag) {
- //debugCN(kDebugCore, "M4ResourceManager::loadResource() loading resource %s\n", resourceName);
- Common::SeekableReadStream* result = NULL;
- if (_hfs) {
- // actually load the resource
- result = _hfs->loadFile(resourceName, preloadFlag);
- if (!result) {
- error("M4ResourceManager::loadResource() Resource %s not found", resourceName);
- }
- } else {
- error("M4ResourceManager::loadResource() No FileSystem attached");
- }
- return result;
-}
-
-bool M4ResourceManager::resourceExists(const char *resourceName) {
- return (_hfs->getHashFileEntry(resourceName) != NULL);
-}
-
-} // End of namespace M4
diff --git a/engines/m4/resource.h b/engines/m4/resource.h
deleted file mode 100644
index c13c293544..0000000000
--- a/engines/m4/resource.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/* 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 M4_RESOURCE_H
-#define M4_RESOURCE_H
-
-#include "common/scummsys.h"
-#include "common/stream.h"
-#include "common/endian.h"
-#include "common/file.h"
-#include "common/hashmap.h"
-#include "common/hash-str.h"
-#include "common/list.h"
-#include "common/ptr.h"
-
-/*
- TODO:
- - change array to HashMap if it turns out to be slow
-*/
-
-namespace M4 {
-
-#define MAX_RESOURCES 128
-#define kM4MaxFilenameSize 33
-
-enum {
- kResourcePurge = 1 << 1
-};
-
-
-class FileSystem {
-public:
- struct HashHagEntry {
- char filename[kM4MaxFilenameSize];
- byte fileIndex;
- Common::File *hagFile;
- };
-
- struct HashFileEntry {
- char filename[kM4MaxFilenameSize];
- byte hagfile;
- uint32 offset, size;
- };
-
- FileSystem(const char *hashFilename);
- ~FileSystem();
-
- Common::SeekableReadStream *loadFile(const char *resourceName, bool preloadFlag);
- static void changeExtension(char *destName, const char *sourceName, const char *extension);
- const HashFileEntry *getHashFileEntry(const char *filename);
-
-private:
- typedef Common::HashMap<Common::String,HashFileEntry,Common::IgnoreCase_Hash,Common::IgnoreCase_EqualTo> FileHashMap;
-
- HashHagEntry _hagEntries[10]; // GLOBAL.HAG and SECTION1.HAG to SECTION9.HAG
- FileHashMap _fileEntries;
-};
-
-struct Resource {
- char name[64];
- Common::SeekableReadStream *stream;
- uint8 *buffer;
- uint8 flags;
-};
-
-class ResourceManager {
-protected:
- typedef Common::List<Common::SharedPtr<Resource> > ResourceList;
- typedef ResourceList::iterator ResourceIterator;
- ResourceList _resources;
- MadsM4Engine *_vm;
-
- virtual Common::SeekableReadStream *loadResource(const char *resourceName, bool loadFlag) = 0;
-public:
- ResourceManager(MadsM4Engine *vm): _vm(vm) {}
- virtual ~ResourceManager();
-
- Common::SeekableReadStream *get(const char *resourceName, bool loadFlag = true);
- void toss(const char *resourceName);
- void purge();
- void dump();
- virtual bool resourceExists(const char *resourceName) = 0;
-
- Common::SeekableReadStream *openFile(const char *resourceName) { return get(resourceName, false); }
- void changeExtension(char *destName, const char *sourceName, const char *extension) {
- FileSystem::changeExtension(destName, sourceName, extension);
- }
-};
-
-enum ResourceType {RESTYPE_ROOM, RESTYPE_SC, RESTYPE_TEXT, RESTYPE_QUO, RESTYPE_I,
- RESTYPE_OB, RESTYPE_FONT, RESTYPE_SOUND, RESTYPE_SPEECH, RESTYPE_HAS_EXT, RESTYPE_NO_EXT};
-
-enum ExtensionType {EXTTYPE_SS = 1, EXTTYPE_AA = 2, EXTTYPE_DAT = 3, EXTTYPE_HH = 4, EXTTYPE_ART = 5,
- EXTTYPE_INT = 6, EXTTYPE_NONE = -1};
-
-enum ResourcePrefixType {RESPREFIX_GL = 1, RESPREFIX_SC = 2, RESPREFIX_RM = 3};
-
-class MADSResourceManager : public ResourceManager {
-private:
- ResourceType getResourceType(const char *resourceName);
- const char *getResourceFilename(const char *resourceName);
-protected:
- Common::SeekableReadStream *loadResource(const char *resourceName, bool loadFlag);
-public:
- MADSResourceManager(MadsM4Engine *vm): ResourceManager(vm) {}
- bool resourceExists(const char *resourceName);
-
- static const char *getResourceName(char asciiCh, int prefix, ExtensionType extType, const char *suffix, int index);
- static const char *getResourceName(ResourcePrefixType prefixType, int idx, const char *extension);
- static const char *getAAName(int index);
-};
-
-class M4ResourceManager : public ResourceManager {
-protected:
- Common::SeekableReadStream *loadResource(const char *resourceName, bool loadFlag);
-public:
- M4ResourceManager(MadsM4Engine *vm);
- ~M4ResourceManager();
- bool resourceExists(const char *resourceName);
-
-private:
- FileSystem *_hfs;
-};
-
-} // End of namespace M4
-
-
-#endif
diff --git a/engines/m4/saveload.cpp b/engines/m4/saveload.cpp
deleted file mode 100644
index a7615fa4b6..0000000000
--- a/engines/m4/saveload.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-/* 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/file.h"
-#include "common/savefile.h"
-
-#include "m4/m4.h"
-#include "m4/saveload.h"
-#include "m4/sprite.h"
-
-namespace M4 {
-
-const char *orionSavesList = "saves.dir";
-
-SaveLoad::SaveLoad(MadsM4Engine *vm) : _vm(vm) {
- // For Orion Burger, check the existance of a 'saves.dir' file to determine whether to
- // act exactly like the original. Otherwise, we'll use the ScummVM standard, where we'll
- // keep all the data for a savegame in a single file
-
- Common::File file;
- _emulateOriginal = file.exists(orionSavesList);
-}
-
-const char *SaveLoad::generateSaveName(int slotNumber) {
- static char buffer[15];
-
- sprintf(buffer, _emulateOriginal ? "burg%.3d.sav" : "burger.%.3d", slotNumber);
- return buffer;
-}
-
-bool SaveLoad::hasSaves() {
- // Return true if a savegame file exists for the first slot
-
- if (_emulateOriginal) {
- Common::File f;
- return f.exists(generateSaveName(1));
-
- } else {
- Common::ReadStream *f = _vm->saveManager()->openForLoading(generateSaveName(1));
- if (f == NULL)
- return false;
-
- delete f;
- return true;
- }
-}
-
-SaveGameList *SaveLoad::getSaves() {
- SaveGameList *result = new SaveGameList();
- char saveName[MAX_SAVEGAME_NAME];
- Common::ReadStream *f = NULL;
-
- if (_emulateOriginal) {
- Common::File *saveFile = new Common::File();
- saveFile->open(orionSavesList);
- f = saveFile;
- }
-
- for (int slotNumber = 1; slotNumber <= 99; ++slotNumber) {
- if (_emulateOriginal) {
- // Read in savegame name from save directory
- bool isPresent = (f->readByte() != 0);
- f->read(&saveName[0], MAX_SAVEGAME_NAME);
-
- if (isPresent)
- result->push_back(Common::String(saveName));
- else {
- result->push_back(Common::String());
- }
-
- } else {
- // Read in savegame name from savegame files directly
- Common::ReadStream *saveFile = _vm->saveManager()->openForLoading(
- generateSaveName(slotNumber));
- if (!saveFile) {
- // No savegame prsent at that slot
- result->push_back(Common::String());
- } else {
- // Skip over byte offset
- uint32 offset = saveFile->readUint32LE();
- assert(offset < 0x100);
-
- // Read in savegame name
- saveFile->read(&saveName[0], MAX_SAVEGAME_NAME);
- result->push_back(Common::String(saveName));
-
- delete saveFile;
- }
- }
- }
-
- if (_emulateOriginal)
- delete f;
-
- return result;
-}
-
-M4Surface *SaveLoad::getThumbnail(int slotNumber) {
- Common::SeekableReadStream *saveFile;
- uint32 dataOffset;
-
- if (_emulateOriginal) {
- // Get savegame file from original game folder
- Common::File *f = new Common::File();
- if (!f->open(generateSaveName(slotNumber))) {
- delete f;
- return NULL;
- }
-
- saveFile = f;
- } else {
- // Open up savegame for access via savefile manager
- saveFile = _vm->saveManager()->openForLoading(generateSaveName(slotNumber));
- }
- if (!saveFile)
- return NULL;
-
- dataOffset = saveFile->readUint32LE();
- assert(dataOffset < 0x100);
- saveFile->seek(dataOffset, SEEK_CUR);
-
- // Read in the sprite data
-
- saveFile->seek(16, SEEK_CUR);
- int width = saveFile->readUint32LE();
- int height = saveFile->readUint32LE();
- saveFile->seek(21, SEEK_CUR);
- saveFile->readUint32LE(); // sprite data size
-
- M4Sprite *result = new M4Sprite(saveFile, 0, 0, width, height);
- delete saveFile;
-
- return result;
-}
-
-bool SaveLoad::load(int slotNumber) {
- // TODO: Currently it's hardcoded to return a failure
- return false;
-}
-
-bool SaveLoad::save(int slotNumber, Common::String saveName) {
- // TODO: Currently it's hardcoded to return a failure
- return false;
-}
-
-
-} // End of namespace M4
diff --git a/engines/m4/scene.cpp b/engines/m4/scene.cpp
deleted file mode 100644
index be49dcb13f..0000000000
--- a/engines/m4/scene.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-/* 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/system.h"
-
-#include "m4/dialogs.h"
-#include "m4/globals.h"
-#include "m4/scene.h"
-#include "m4/events.h"
-#include "m4/graphics.h"
-#include "m4/rails.h"
-#include "m4/font.h"
-#include "m4/m4_views.h"
-#include "m4/mads_views.h"
-#include "m4/compression.h"
-#include "m4/staticres.h"
-
-namespace M4 {
-
-Scene::Scene(MadsM4Engine *vm, SceneResources *res): View(vm, Common::Rect(0, 0, vm->_screen->width(),
- vm->_screen->height())), _sceneResources(res) {
- _screenType = VIEWID_SCENE;
-
- _sceneResources->hotspots = new HotSpotList();
- _sceneResources->dynamicHotspots = new HotSpotList();
- _backgroundSurface = new M4Surface();
- _walkSurface = new M4Surface();
- _palData = NULL;
- _interfacePal = NULL;
- _interfaceSurface = NULL;
- _vm->_rails->setCodeSurface(_walkSurface);
- _currentScene = -1;
-}
-
-Scene::~Scene() {
- leaveScene();
- _vm->_scene = NULL;
-}
-
-void Scene::loadScene(int sceneNumber) {
- _previousScene = _currentScene;
- _currentScene = sceneNumber;
- _nextScene = sceneNumber;
-}
-
-void Scene::leaveScene() {
- if (_palData) {
- _vm->_palette->deleteRange(_palData);
- delete _palData;
- _palData = NULL;
- }
- if (_interfacePal) {
- _vm->_palette->deleteRange(_interfacePal);
- delete _interfacePal;
- _interfacePal = NULL;
- }
-}
-
-void Scene::show() {
- _vm->_viewManager->addView(this);
-}
-
-void Scene::showInterface() {
- _vm->_viewManager->addView(_interfaceSurface);
-}
-
-void Scene::hideInterface() {
- _vm->_viewManager->deleteView(_interfaceSurface);
-}
-
-void Scene::showSprites() {
- // TODO: This is all experimental code, it needs heavy restructuring
- // and cleanup
-
- // taken from set_walker_scaling() in adv_walk.cpp. A proper implementation will need
- // to store these in global variables
- int minScaling = FixedDiv(_sceneResources->backScale << 16, 100 << 16);
- int maxScaling = FixedDiv(_sceneResources->frontScale << 16, 100 << 16);
- int scaler;
-
- _vm->_actor->setWalkerDirection(kFacingSouthEast);
- //_vm->_actor->setWalkerPalette();
-
- // taken from set_walker_scaling() in adv_walk.cpp
- if (_sceneResources->frontY == _sceneResources->backY)
- scaler = 0;
- else
- scaler = FixedDiv(maxScaling - minScaling,
- (_sceneResources->frontY << 16) - (_sceneResources->backY << 16));
-
- // FIXME: For now, we (incorrectly) scale the walker to 50% of the scene's max scaling
- _vm->_actor->setWalkerScaling(scaler / 2);
- // Test code to display the protagonist
- _vm->_actor->placeWalkerSpriteAt(0, 320, 200);
-
- // Test code to display scene sprites
- // TODO
-}
-
-// Test function, shows all scene hotspots
-void Scene::showHotSpots() {
- int i = 0;
- HotSpot *currentHotSpot;
-
- // hotspots (green)
- for (i = 0; i < _sceneResources->hotspots->size(); i++) {
- currentHotSpot = _sceneResources->hotspots->get(i);
- _backgroundSurface->frameRect(currentHotSpot->getRect(), _vm->_palette->GREEN);
- }
-
- // Dynamic hotspots (red)
- for (i = 0; i < _sceneResources->dynamicHotspots->size(); i++) {
- currentHotSpot = _sceneResources->dynamicHotspots->get(i);
- _backgroundSurface->frameRect(currentHotSpot->getRect(), _vm->_palette->RED);
- }
-}
-
-/**
- * Debug function that shows the walkable areas by copying them over the current background surface
- */
-void Scene::showCodes() {
- if (_vm->isM4()) {
- // Show the walk areas for the M4 engine in black and white
- const byte *srcP = (const byte *)_walkSurface->getBasePtr(0, 0);
- byte *destP = _backgroundSurface->getBasePtr(0, 0);
-
- for (int i = 0; i < _walkSurface->width() * _walkSurface->height(); i++)
- destP[i] = (srcP[i] & 0x10) ? 0xFF : 0;
-
- byte colors[256 * 3];
- memset(colors, 0, sizeof(colors));
- colors[255 * 3 + 0] = 255;
- colors[255 * 3 + 1] = 255;
- colors[255 * 3 + 2] = 255;
- _vm->_palette->setPalette(colors, 0, 256);
- } else {
- // MADS handling
-
- // copy the walk data to the background, in whatever current palette is active
- _walkSurface->copyTo(_backgroundSurface);
-
- // Show all the scene's walk nodes
- SceneNodeList &nodeList = _madsVm->scene()->getSceneResources()._nodes;
- _backgroundSurface->setColor(_madsVm->_palette->WHITE);
- for (uint i = 0; i < nodeList.size() - 2; ++i) {
- // Draw a little cross at the node's position
- _backgroundSurface->hLine(nodeList[i].pt.x - 2, nodeList[i].pt.x + 2, nodeList[i].pt.y);
- _backgroundSurface->vLine(nodeList[i].pt.x, nodeList[i].pt.y - 2, nodeList[i].pt.y + 2);
- }
-
- ((MadsScene *)this)->_spriteSlots.fullRefresh();
- }
-}
-
-void Scene::playIntro() {
-
-}
-
-void Scene::onRefresh(RectList *rects, M4Surface *destSurface) {
- update();
- View::onRefresh(rects, destSurface);
-}
-
-bool Scene::onEvent(M4EventType eventType, int32 param1, int x, int y, bool &captureEvents) {
- //if (_vm->getGameType() != GType_Burger)
- // return false;
-
- // If the game is currently paused, don't do any scene processing
- if (_vm->_kernel->paused)
- return false;
-
- switch (eventType) {
- case MEVENT_LEFT_CLICK:
- leftClick(x, y);
- break;
- case MEVENT_RIGHT_CLICK:
- rightClick(x, y);
- break;
- case MEVENT_MOVE:
- mouseMove(x, y);
- break;
- default:
- return false;
- }
-
- return true;
-}
-
-} // End of namespace M4
diff --git a/engines/m4/scene.h b/engines/m4/scene.h
deleted file mode 100644
index 5086cc0db0..0000000000
--- a/engines/m4/scene.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/* 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 M4_SCENE_H
-#define M4_SCENE_H
-
-class View;
-
-#include "m4/assets.h"
-#include "m4/font.h"
-#include "m4/hotspot.h"
-#include "m4/graphics.h"
-#include "m4/viewmgr.h"
-#include "m4/gui.h"
-#include "m4/m4_views.h"
-#include "common/array.h"
-
-namespace M4 {
-
-#define MAX_CHK_FILENAME_SIZE 144
-
-enum MADSVerbs {
- kVerbNone = 0,
- kVerbLook = 3,
- kVerbTake = 4,
- kVerbPush = 5,
- kVerbOpen = 6,
- kVerbPut = 7,
- kVerbTalkTo = 8,
- kVerbGive = 9,
- kVerbPull = 10,
- kVerbClose = 11,
- kVerbThrow = 12,
- kVerbWalkTo = 13,
- kVerbLookAt = 209
-};
-
-class SceneResources {
-public:
- char artBase[MAX_CHK_FILENAME_SIZE];
- char pictureBase[MAX_CHK_FILENAME_SIZE];
- HotSpotList *hotspots;
- HotSpotList *dynamicHotspots;
- int32 frontY, backY;
- int32 frontScale, backScale;
- int16 depthTable[16];
- int32 railNodeCount; // # of rails
-};
-
-class M4Engine;
-class MadsEngine;
-class InterfaceView;
-
-class Scene : public View {
-private:
- HotSpotList _sceneHotspots;
-protected:
- GameInterfaceView *_interfaceSurface;
- M4Surface *_backgroundSurface;
- M4Surface *_walkSurface;
- RGBList *_palData;
- RGBList *_interfacePal;
- SceneResources *_sceneResources;
-public:
- int _currentScene;
- int _previousScene;
- int _nextScene;
-public:
- Scene(MadsM4Engine *vm, SceneResources *res);
- virtual ~Scene();
-
- // Methods that differ between engines
- virtual void loadScene(int sceneNumber);
- virtual void leaveScene();
- virtual void loadSceneCodes(int sceneNumber, int index = 0) = 0;
- virtual void show();
- virtual void mouseMove(int x, int y) = 0;
- virtual void leftClick(int x, int y) = 0;
- virtual void rightClick(int x, int y) = 0;
- virtual void update() = 0;
- virtual void showHotSpots();
-
- // TODO: perhaps move playIntro() someplace else?
- void playIntro();
- void showSprites();
- void showCodes();
- int getCurrentScene() { return _currentScene; }
- M4Surface *getBackgroundSurface() const { return _backgroundSurface; }
- void showInterface();
- void hideInterface();
- GameInterfaceView *getInterface() { return _interfaceSurface; }
- SceneResources &getSceneResources() { return *_sceneResources; }
- M4Surface *getWalkSurface() const { return _walkSurface; }
-
- void onRefresh(RectList *rects, M4Surface *destSurface);
- bool onEvent(M4EventType eventType, int32 param1, int x, int y, bool &captureEvents);
-};
-
-} // End of namespace M4
-
-#endif
diff --git a/engines/m4/script.cpp b/engines/m4/script.cpp
deleted file mode 100644
index 026c025f45..0000000000
--- a/engines/m4/script.cpp
+++ /dev/null
@@ -1,1389 +0,0 @@
-/* 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/system.h"
-#include "common/textconsole.h"
-
-#include "m4/m4.h"
-#include "m4/script.h"
-#include "m4/resource.h"
-
-namespace M4 {
-
-enum OpcodeType {
- opRet = 0,
- opCall,
- opCallKernel,
- opPush,
- opPush0,
- opPush1,
- opPushNeg1,
- opPop,
- opMov,
- opAdd,
- opSub,
- opInc,
- opDec,
- opCmp,
- opJmp,
- opJmpByTable,
- opJz,
- opJnz,
- opJe,
- opJne,
- opJl,
- opJle,
- opJg,
- opJge,
- opXor,
- opShl,
- opShr,
-
- opDebug,
-
- opInvalid
-};
-
-const char *opcodeNames[] = {
- "opRet",
- "opCall",
- "opCallKernel",
- "opPush",
- "opPush0",
- "opPush1",
- "opPushNeg1",
- "opPop",
- "opMov",
- "opAdd",
- "opSub",
- "opInc",
- "opDec",
- "opCmp",
- "opJmp",
- "opJmpByTable",
- "opJz",
- "opJnz",
- "opJe",
- "opJne",
- "opJl",
- "opJle",
- "opJg",
- "opJge",
- "opXor",
- "opShl",
- "opShr",
- "opDebug",
- "opInvalid"
-};
-
-StringTable::StringTable() : _stringsData(NULL) {
-}
-
-StringTable::~StringTable() {
- delete[] _stringsData;
-}
-
-void StringTable::load(Common::File *fd) {
- int stringSize = fd->readUint32LE();
- int stringCount = fd->readUint32LE();
- _stringsData = new char[stringSize];
- fd->read(_stringsData, stringSize);
- char *stringPtr = _stringsData;
- for (int i = 0; i < stringCount; i++) {
- _strings.push_back((const char*)stringPtr);
- stringPtr += strlen(stringPtr) + 1;
- }
-}
-
-SeriesStreamBreakList::~SeriesStreamBreakList() {
-}
-
-void SeriesStreamBreakList::load(Common::File *fd) {
- uint32 count = fd->readUint32LE();
- debugCN(kDebugScript, "SeriesStreamBreakList::load() count = %d\n", count);
- for (uint32 i = 0; i < count; i++) {
- SeriesStreamBreakItem *item = new SeriesStreamBreakItem();
- item->frameNum = fd->readUint32LE();
- item->digiName = _inter->loadGlobalString(fd);
- item->digiChannel = fd->readUint32LE();
- item->digiVolume = fd->readUint32LE();
- item->trigger = fd->readUint32LE();
- item->flags = fd->readUint32LE();
- item->variable.type = kGameVar;
- item->variable.value = fd->readUint32LE();
- item->value = fd->readUint32LE();
- _items.push_back(item);
-
- debugCN(kDebugScript, "%02d: frameNum = %d; digiName = %s; digiChannel = %d; digiVolume = %d; trigger = %d; flags = %d; variable = %d; value = %d\n",
- i, item->frameNum, item->digiName, item->digiChannel, item->digiVolume, item->trigger, item->flags, item->variable.value, item->value);
-
- }
-}
-
-SaidArray::~SaidArray() {
-}
-
-void SaidArray::load(Common::File *fd) {
- uint32 count = fd->readUint32LE();
- debugCN(kDebugScript, "SaidArray::load() count = %d\n", count);
- for (uint32 i = 0; i < count; i++) {
- SaidArrayItem *item = new SaidArrayItem();
- item->itemName = _inter->loadGlobalString(fd);
- item->digiNameLook = _inter->loadGlobalString(fd);
- item->digiNameTake = _inter->loadGlobalString(fd);
- item->digiNameGear = _inter->loadGlobalString(fd);
- _items.push_back(item);
-
- debugCN(kDebugScript, "itemName = %s; digiNameLook = %s; digiNameTake = %s; digiNameGear = %s\n",
- item->itemName, item->digiNameLook, item->digiNameTake, item->digiNameGear);
-
- }
-}
-
-ParserArray::~ParserArray() {
-}
-
-void ParserArray::load(Common::File *fd) {
- uint32 count = fd->readUint32LE();
- debugCN(kDebugScript, "ParserArray::load() count = %d\n", count);
- for (uint32 i = 0; i < count; i++) {
- ParserArrayItem *item = new ParserArrayItem();
- item->w0 = _inter->loadGlobalString(fd);
- item->w1 = _inter->loadGlobalString(fd);
- item->trigger = fd->readUint32LE();
- item->testVariable.type = kGameVar;
- item->testVariable.value = fd->readUint32LE();
- item->testValue = fd->readUint32LE();
- item->variable.type = kGameVar;
- item->variable.value = fd->readUint32LE();
- item->value = fd->readUint32LE();
- _items.push_back(item);
-
- debugCN(kDebugScript, "w0 = %s; w1 = %s; trigger = %d; testVariable = %d; testValue = %d; variable = %d; value = %d\n",
- item->w0, item->w1, item->trigger, item->testVariable.value, item->testValue, item->variable.value, item->value);
-
- }
-}
-
-ScriptFunction::ScriptFunction(ScriptInterpreter *inter) : _inter(inter) {
-}
-
-ScriptFunction::~ScriptFunction() {
- delete _code;
-}
-
-void ScriptFunction::load(Common::File *fd) {
- debugCN(kDebugScript, "ScriptFunction::load()\n");
- uint32 size = fd->readUint32LE();
- debugCN(kDebugScript, "ScriptFunction::load() size = %d\n", size);
- _code = fd->readStream(size);
-}
-
-void ScriptFunction::jumpAbsolute(uint32 ofs) {
- _code->seek(ofs);
-}
-
-void ScriptFunction::jumpRelative(int32 ofs) {
- _code->seek(ofs, SEEK_CUR);
-}
-
-byte ScriptFunction::readByte() {
- return _code->readByte();
-}
-
-uint32 ScriptFunction::readUint32() {
- return _code->readUint32LE();
-}
-
-
-ScriptInterpreter::ScriptInterpreter(MadsM4Engine *vm) : _scriptFile(NULL), _vm(vm) {
- initScriptKernel();
- _dataCache = new ScriptDataCache(this);
- _runningFunction = NULL;
-}
-
-ScriptInterpreter::~ScriptInterpreter() {
- close();
- delete _dataCache;
-}
-
-void ScriptInterpreter::open(const char *filename) {
- if (_scriptFile)
- close();
- _scriptFile = new Common::File();
- _scriptFile->open(filename);
- if (!_scriptFile->isOpen())
- error("ScriptInterpreter::open() Error opening %s", filename);
-
- _scriptFile->readUint32LE(); // skip magic for now
- uint32 version = _scriptFile->readUint32LE();
- if (version != kScriptFileVersion) {
- error("ScriptInterpreter::open() DAT file version mismatch; requested %li, got %i", kScriptFileVersion, version);
- }
-
- int functionCount = _scriptFile->readUint32LE();
- debugCN(kDebugScript, "functionCount = %d\n", functionCount);
- for (int i = 0; i < functionCount; i++) {
- uint32 offset = _scriptFile->readUint32LE();
- debugCN(kDebugScript, "func(%d) offset = %08X\n", i, offset);
- uint32 len = _scriptFile->readUint32LE();
- if (len > 0) {
- char *funcName = new char[len + 1];
- _scriptFile->read(funcName, len);
- funcName[len] = '\0';
- debugCN(kDebugScript, "func(%d) name = %s\n", i, funcName);
- _functionNames[Common::String(funcName)] = _functions.size();
- // DEBUG
- _scriptFunctionNames.push_back(Common::String(funcName));
- delete[] funcName;
- }
- _functions.push_back(new ScriptFunctionEntry(offset));
- }
-
- int dataCount = _scriptFile->readUint32LE();
- debugCN(kDebugScript, "dataCount = %d\n", dataCount);
- for (int i = 0; i < dataCount; i++) {
- uint32 offset = _scriptFile->readUint32LE();
- ScriptDataType type = (ScriptDataType)_scriptFile->readUint32LE();
- debugCN(kDebugScript, "data(%d) offset = %08X; type = %d\n", i, offset, type);
- _data.push_back(new ScriptDataEntry(offset, type));
- }
-
- _globalVarCount = _scriptFile->readUint32LE();
- debugCN(kDebugScript, "_globalVarCount = %d\n", _globalVarCount);
-
- uint32 stringOfs = _scriptFile->readUint32LE();
- _scriptFile->seek(stringOfs);
- _constStrings.load(_scriptFile);
-
- for (int i = 0; i < ARRAYSIZE(_globalVars); i++) {
- _globalVars[i].type = kInteger;
- _globalVars[i].value = 0;
- }
-
- memset(_logicGlobals, 0, sizeof(_logicGlobals));
-
- memset(_registers, 0, sizeof(_registers));
- memset(_stack, 0, sizeof(_stack));
- _stackPtr = 0;
-
-}
-
-void ScriptInterpreter::close() {
- delete _scriptFile;
-}
-
-void ScriptInterpreter::initScriptKernel() {
-
-#include "m4/scripttab.h"
-
- _kernelFunctions = kernelFunctions;
- _kernelFunctionsMax = ARRAYSIZE(kernelFunctions) + 1;
-
- _kernelVars = kernelVars;
- _kernelVarsMax = ARRAYSIZE(kernelVars) + 1;
-
-}
-
-
-ScriptFunction *ScriptInterpreter::loadFunction(uint32 index) {
- //GONE WHILE DEBUGGING assert(index < _functions.size());
- if (index >= _functions.size()) return NULL;
- ScriptFunction *scriptFunction;
- scriptFunction = _functions[index]->func;
- if (!scriptFunction) {
- scriptFunction = new ScriptFunction(this);
- _scriptFile->seek(_functions[index]->offset);
- scriptFunction->load(_scriptFile);
- _functions[index]->func = scriptFunction;
- }
- return scriptFunction;
-}
-
-ScriptFunction *ScriptInterpreter::loadFunction(const Common::String &name) {
- FunctionNameMap::iterator iter = _functionNames.find(name);
- if (iter == _functionNames.end()) {
- debugCN(kDebugScript, "ScriptInterpreter::loadFunction() Function '%s' not found!\n", name.c_str());
- return NULL;
- }
- uint32 funcIndex = (*iter)._value;
- debugCN(kDebugScript, "ScriptInterpreter::loadFunction() index('%s') = %d\n", name.c_str(), funcIndex);
- return loadFunction(funcIndex);
-}
-
-void ScriptInterpreter::unloadFunctions() {
- for (uint32 i = 0; i < _functions.size(); i++) {
- if (_functions[i]->func) {
- delete _functions[i]->func;
- _functions[i]->func = NULL;
- }
- }
-}
-
-int ScriptInterpreter::runFunction(ScriptFunction *scriptFunction) {
- bool done = false;
-
- int oldLocalStackPtr = _localStackPtr;
- ScriptFunction *oldRunningFunction = _runningFunction;
-
- // TODO: Also initialize _localStackPtr
-
- _runningFunction = scriptFunction;
- _runningFunction->jumpAbsolute(0);
- while (!done) {
- byte opcode = _runningFunction->readByte();
- done = !execOpcode(opcode);
- }
-
- _localStackPtr = oldLocalStackPtr;
- _runningFunction = oldRunningFunction;
-
- return 0;
-}
-
-void ScriptInterpreter::push(const ScriptValue &value) {
- if (_stackPtr == ARRAYSIZE(_stack))
- error("ScriptInterpreter::push() Stack overflow");
- _stack[_stackPtr++] = value;
-}
-
-void ScriptInterpreter::pop(ScriptValue &value) {
- if (_stackPtr == 0)
- error("ScriptInterpreter::pop() Stack underflow");
- value = _stack[_stackPtr--];
-}
-
-void ScriptInterpreter::dumpStack() {
- debugCN(kDebugScript, "ScriptInterpreter::dumpStack()\n");
- for (int i = 0; i < _stackPtr; i++) {
- debugCN(kDebugScript, "%03d. type = %02d; value = %d\n", i, _stack[i].type, _stack[i].value);
- }
-}
-
-void ScriptInterpreter::dumpRegisters() {
- debugCN(kDebugScript, "ScriptInterpreter::dumpRegisters()\n");
- for (int i = 0; i < ARRAYSIZE(_registers); i++) {
- debugCN(kDebugScript, "%03d. type = %02d; value = %d\n", i, _registers[i].type, _registers[i].value);
- }
-}
-
-void ScriptInterpreter::dumpGlobalVars() {
- debugCN(kDebugScript, "ScriptInterpreter::dumpGlobalVars()\n");
- for (int i = 0; i < ARRAYSIZE(_globalVars); i++) {
- if (_globalVars[i].type != -1)
- debugCN(kDebugScript, "%03d. type = %02d; value = %d\n", i, _globalVars[i].type, _globalVars[i].value);
- }
-}
-
-int ScriptInterpreter::toInteger(const ScriptValue &value) {
-
- switch (value.type) {
-
- case kInteger:
- return value.value;
-
- default:
- debugCN(kDebugScript, "ScriptInterpreter::toInteger() Invalid type %d!\n", value.type);
- return 0;
-
- }
-
-}
-
-const char *ScriptInterpreter::toString(const ScriptValue &value) {
-
- switch (value.type) {
-
- case kInteger:
- return NULL;
-
- case kConstString:
- return _constStrings[value.value];
-
- default:
- debugCN(kDebugScript, "ScriptInterpreter::toString() Invalid type %d!\n", value.type);
- return NULL;
-
- }
-
-}
-
-const char *ScriptInterpreter::loadGlobalString(Common::File *fd) {
- uint32 index = fd->readUint32LE();
- if (index != 0xFFFFFFFF)
- return getGlobalString(index);
- else
- return NULL;
-}
-
-void ScriptInterpreter::test() {
-}
-
-void ScriptInterpreter::loadValue(ScriptValue &value) {
-
- value.type = (ScriptValueType)_runningFunction->readByte();
-
- switch (value.type) {
-
- case kGameVar:
- case kInteger:
- case kConstString:
- case kDataRef:
- case kLogicVar:
- case kLogicVarRef:
- case kKernelVar:
- value.value = _runningFunction->readUint32();
- break;
-
- case kRegister:
- value.value = _runningFunction->readByte();
- break;
-
- default:
- debugCN(kDebugScript, "ScriptInterpreter::loadValue() Invalid value type %d!\n", value.type);
-
- }
-
-}
-
-void ScriptInterpreter::copyValue(ScriptValue &destValue, ScriptValue &sourceValue) {
-
- if (sourceValue.type == -1) {
- debugCN(kDebugScript, "ScriptInterpreter::copyValue() Trying to read uninitialized value!\n");
- }
-
- switch (destValue.type) {
-
- case kGameVar:
- _globalVars[destValue.value] = sourceValue;
- break;
-
- case kRegister:
- _registers[destValue.value] = sourceValue;
- break;
-
- case kLogicVar:
- // TODO: Move to own method
- if (sourceValue.type == kInteger) {
- _logicGlobals[destValue.value] = sourceValue.value;
- } else {
- debugCN(kDebugScript, "ScriptInterpreter::copyValue() Invalid source value type %d!\n", sourceValue.type);
- }
- break;
-
- case kKernelVar:
- setKernelVar(destValue.value, sourceValue);
- break;
-
- default:
- debugCN(kDebugScript, "ScriptInterpreter::copyValue() Invalid dest value type %d!\n", destValue.type);
-
- }
-
-}
-
-void ScriptInterpreter::derefValue(ScriptValue &value) {
-
- switch (value.type) {
-
- case kGameVar:
- value = _globalVars[value.value];
- break;
-
- case kInteger:
- case kConstString:
- case kDataRef:
- case kLogicVarRef:
- // These need no dereferencing
- break;
-
- case kRegister:
- value = _registers[value.value];
- break;
-
- case kLogicVar:
- // TODO: Move to own method
- value = _logicGlobals[value.value];
- break;
-
- case kKernelVar:
- getKernelVar(value.value, value);
- break;
-
- default:
- debugCN(kDebugScript, "ScriptInterpreter::derefValue() Invalid value type %d!\n", value.type);
-
- }
-
-}
-
-void ScriptInterpreter::callKernelFunction(uint32 index) {
-
- debugCN(kDebugScript, "ScriptInterpreter::callKernelFunction() index = %d\n", index);
-
- if (index > _kernelFunctionsMax) {
- debugCN(kDebugScript, "ScriptInterpreter::callKernelFunction() Invalid kernel functionindex (%d)\n", index);
- return;
- }
-
- debugCN(kDebugScript, "ScriptInterpreter::callKernelFunction() name = %s\n", _kernelFunctions[index].desc);
-
- int args = (this->*(_kernelFunctions[index].proc))();
- // Now remove values from the stack if the function used any
- if (args > 4)
- _stackPtr -= args - 4;
-
- debugCN(kDebugScript, "-------------\n");
-
-}
-
-ScriptValue ScriptInterpreter::getArg(uint32 index) {
- if (index < 4) {
- return _registers[index];
- } else {
- index -= 4;
- return _stack[_stackPtr - index - 1];
- }
-}
-
-void ScriptInterpreter::dumpArgs(uint32 count) {
- debugCN(kDebugScript, "ScriptInterpreter::dumpArgs() ");
- for (uint32 i = 0; i < count; i++) {
- ScriptValue argValue = getArg(i);
- if (argValue.type == kConstString) {
- debugCN(kDebugScript, "'%s'", toString(argValue));
- } else {
- debugCN(kDebugScript, "%d", argValue.value);
- }
- if (i + 1 < count)
- debugCN(kDebugScript, ", ");
- }
- debugCN(kDebugScript, "\n");
-}
-
-void ScriptInterpreter::callFunction(uint32 index) {
- // NOTE: This is a temporary hack for script functions not yet in the m4.dat
- if (index == 0xFFFFFFFF)
- return;
- debugCN(kDebugScript, "ScriptInterpreter::callFunction() index = %d [%s]\n", index, _scriptFunctionNames[index].c_str());
- ScriptFunction *subFunction = loadFunction(index);
- if (!subFunction) {
- // This *should* never happen since the linker checks this
- debugCN(kDebugScript, "ScriptInterpreter::callFunction() Function %d could not be loaded!\n", index);
- return;
- }
- runFunction(subFunction);
-}
-
-bool ScriptInterpreter::execOpcode(byte opcode) {
-
- debugCN(kDebugScript, "opcode = %d (%s)\n", opcode, opcodeNames[opcode]);
-
- ScriptValue value1, value2, value3;
- uint32 temp;
-
- /* TODO: Put all opcodes into separate functions and into an array
- (but only after all needed opcodes are known and frozen)
- */
-
- switch (opcode) {
-
- case opRet:
- return false;
-
- case opPush:
- loadValue(value1);
- derefValue(value1);
- push(value1);
- return true;
-
- case opPush0:
- push(ScriptValue(0));
- return true;
-
- case opPush1:
- push(ScriptValue(1));
- return true;
-
- case opPushNeg1:
- push(ScriptValue(-1));
- return true;
-
- case opPop:
- loadValue(value1);
- pop(value2);
- copyValue(value1, value2);
- return true;
-
- case opMov:
- loadValue(value1);
- loadValue(value2);
- derefValue(value2);
- copyValue(value1, value2);
- return true;
-
- // Possibly join all jump variants into one opcode
-
- case opJmp:
- temp = _runningFunction->readUint32();
- debugCN(kDebugScript, "-> ofs = %08X\n", temp);
- _runningFunction->jumpAbsolute(temp);
- return true;
-
- case opJl:
- temp = _runningFunction->readUint32();
- if (_cmpFlags < 0) {
- debugCN(kDebugScript, "-> ofs = %08X\n", temp);
- _runningFunction->jumpAbsolute(temp);
- }
- return true;
-
- case opJle:
- temp = _runningFunction->readUint32();
- if (_cmpFlags <= 0) {
- debugCN(kDebugScript, "-> ofs = %08X\n", temp);
- _runningFunction->jumpAbsolute(temp);
- }
- return true;
-
- case opJg:
- temp = _runningFunction->readUint32();
- if (_cmpFlags > 0) {
- debugCN(kDebugScript, "-> ofs = %08X\n", temp);
- _runningFunction->jumpAbsolute(temp);
- }
- return true;
-
- case opJge:
- temp = _runningFunction->readUint32();
- if (_cmpFlags >= 0) {
- debugCN(kDebugScript, "-> ofs = %08X\n", temp);
- _runningFunction->jumpAbsolute(temp);
- }
- return true;
-
- case opJz:
- temp = _runningFunction->readUint32();
- if (_cmpFlags == 0) {
- debugCN(kDebugScript, "-> ofs = %08X\n", temp);
- _runningFunction->jumpAbsolute(temp);
- }
- return true;
-
- case opJnz:
- temp = _runningFunction->readUint32();
- if (_cmpFlags != 0) {
- debugCN(kDebugScript, "-> ofs = %08X\n", temp);
- _runningFunction->jumpAbsolute(temp);
- }
- return true;
-
- case opJmpByTable:
- temp = _runningFunction->readUint32();
- debugCN(kDebugScript, "-> index = %d\n", _registers[0].value);
- _runningFunction->jumpRelative(_registers[0].value * 4);
- temp = _runningFunction->readUint32();
- debugCN(kDebugScript, "-> ofs = %08X\n", temp);
- _runningFunction->jumpAbsolute(temp);
- return true;
-
- case opCmp:
- loadValue(value1);
- loadValue(value2);
- derefValue(value1);
- derefValue(value2);
- if (value1.type != kInteger || value2.type != kInteger)
- warning("ScriptInterpreter::execOpcode() Trying to compare non-integer values (%d, %d, line %d)", value1.type, value2.type, _lineNum);
- _cmpFlags = value1.value - value2.value;
- debugCN(kDebugScript, "-> cmp %d, %d\n", value1.value, value2.value);
- debugCN(kDebugScript, "-> _cmpFlags = %d\n", _cmpFlags);
- return true;
-
- case opCall:
- temp = _runningFunction->readUint32();
- callFunction(temp);
- return true;
-
- case opCallKernel:
- temp = _runningFunction->readUint32();
- callKernelFunction(temp);
- return true;
-
- case opInc:
- loadValue(value1);
- value2 = value1;
- derefValue(value2);
- value2.value++;
- copyValue(value1, value2);
- return true;
-
- case opDec:
- loadValue(value1);
- value2 = value1;
- derefValue(value2);
- value2.value--;
- copyValue(value1, value2);
- return true;
-
- case opAdd:
- loadValue(value1);
- value3 = value1;
- loadValue(value2);
- derefValue(value3);
- derefValue(value2);
- value3.value += value2.value;
- copyValue(value1, value3);
- return true;
-
- case opSub:
- loadValue(value1);
- value3 = value1;
- loadValue(value2);
- derefValue(value3);
- derefValue(value2);
- value3.value -= value2.value;
- copyValue(value1, value3);
- return true;
-
- case opDebug:
- _lineNum = (int)_runningFunction->readUint32();
- return true;
-
- default:
- debugCN(kDebugScript, "Invalid opcode %d!\n", opcode);
- return false;
-
- }
-
-}
-
-// Kernel functions
-
-#define STRING(arg) (toString(getArg(arg)))
-#define INTEGER(arg) (toInteger(getArg(arg)))
-#define DATA(arg, T) (toData<T>(getArg(arg)))
-#define RETURN(value) (_registers[0] = (value))
-
-int ScriptInterpreter::o1_handleStreamBreak() {
- return 0;
-}
-
-int ScriptInterpreter::o1_handlePlayBreak() {
- return 0;
-}
-
-int ScriptInterpreter::o1_dispatchTriggerOnSoundState() {
- return 0;
-}
-
-int ScriptInterpreter::o1_getTicks() {
- return 0;
-}
-
-int ScriptInterpreter::o1_setSoundVolume() {
- return 0;
-}
-
-int ScriptInterpreter::o1_getSoundStatus() {
- return 0;
-}
-
-int ScriptInterpreter::o1_getSoundDuration() {
- return 0;
-}
-
-int ScriptInterpreter::o1_setSeriesFrameRate() {
- return 0;
-}
-
-int ScriptInterpreter::o1_terminateMachine() {
- return 0;
-}
-
-int ScriptInterpreter::o1_sendWoodScriptMessage() {
- return 0;
-}
-
-int ScriptInterpreter::o1_runConversation() {
- return 0;
-}
-
-int ScriptInterpreter::o1_exportConversationValue() {
- return 0;
-}
-
-int ScriptInterpreter::o1_exportConversationPointer() {
- return 0;
-}
-
-int ScriptInterpreter::o1_playBreakSeries() {
- return 0;
-}
-
-int ScriptInterpreter::o1_hideWalker() {
- return 0;
-}
-
-int ScriptInterpreter::o1_showWalker() {
- return 0;
-}
-
-int ScriptInterpreter::o1_walk() {
- return 0;
-}
-
-int ScriptInterpreter::o1_overrideCrunchTime() {
- return 0;
-}
-
-int ScriptInterpreter::o1_addBlockingRect() {
- return 0;
-}
-
-int ScriptInterpreter::o1_setPlayerCommandsAllowed() {
- return 0;
-}
-
-int ScriptInterpreter::o1_getPlayerCommandsAllowed() {
- return 0;
-}
-
-int ScriptInterpreter::o1_setPlayerFacingAngle() {
- return 0;
-}
-
-int ScriptInterpreter::o1_disablePlayerFadeToBlack() {
- return 0;
-}
-
-int ScriptInterpreter::o1_enablePlayer() {
- return 0;
-}
-
-int ScriptInterpreter::o1_disablePlayer() {
- return 0;
-}
-
-int ScriptInterpreter::o1_freshenSentence() {
- return 0;
-}
-
-int ScriptInterpreter::o1_playerGiveItem() {
- return 0;
-}
-
-int ScriptInterpreter::o1_moveObject() {
- return 0;
-}
-
-int ScriptInterpreter::o1_setStopSoundsBetweenRooms() {
- return 0;
-}
-
-int ScriptInterpreter::o1_backupPalette() {
- return 0;
-}
-
-int ScriptInterpreter::o1_unloadWilburWalker() {
- return 0;
-}
-
-int ScriptInterpreter::o1_wilburTalk() {
- return 0;
-}
-
-int ScriptInterpreter::o1_wilburFinishedTalking() {
- return 0;
-}
-
-int ScriptInterpreter::o1_preloadSound() {
- const char *name = STRING(0);
- int room = INTEGER(1);
- debugCN(kDebugScript, "name = %s; room = %d\n", name, room);
- return 2;
-}
-
-int ScriptInterpreter::o1_unloadSound() {
- const char *name = STRING(0);
- int room = INTEGER(1);
- debugCN(kDebugScript, "name = %s; room = %d\n", name, room);
- return 2;
-}
-
-int ScriptInterpreter::o1_playSound() {
- const char *name = STRING(0);
- int channel = INTEGER(1);
- int volume = INTEGER(2);
- int trigger = INTEGER(3);
- int room = INTEGER(4);
- debugCN(kDebugScript, "name = %s; channel = %d; volume = %d; trigger = %d; room = %d\n",
- name, channel, volume, trigger, room);
-
- Common::String soundName = Common::String(name) + ".raw";
- _vm->_sound->playVoice(soundName.c_str(), 100);
-
- // HACK until fixed
- _vm->_kernel->sendTrigger(trigger);
-
- return 5;
-}
-
-int ScriptInterpreter::o1_playLoopingSound() {
- const char *name = STRING(0);
- int channel = INTEGER(1);
- int volume = INTEGER(2);
- int trigger = INTEGER(3);
- int room = INTEGER(4);
- debugCN(kDebugScript, "name = %s; channel = %d; volume = %d; trigger = %d; room = %d\n",
- name, channel, volume, trigger, room);
-
- // HACK until fixed
- _vm->_kernel->sendTrigger(trigger);
-
- return 5;
-}
-
-int ScriptInterpreter::o1_stopSound() {
- int channel = INTEGER(0);
- debugCN(kDebugScript, "channel = %d\n", channel);
- return 1;
-}
-
-int ScriptInterpreter::o1_fadeSetStart() {
- // skip arg 0: palette ptr
- int percent = INTEGER(1);
- debugCN(kDebugScript, "percent = %d\n", percent);
- return 2;
-}
-
-int ScriptInterpreter::o1_fadeInit() {
- // skip arg 0: palette ptr
- int first = INTEGER(1);
- int last = INTEGER(2);
- int percent = INTEGER(3);
- int ticks = INTEGER(4);
- int trigger = INTEGER(5);
- debugCN(kDebugScript, "first = %d; last = %d; percent = %d; ticks = %d; trigger = %d\n",
- first, last, percent, ticks, trigger);
-
- // HACK until palette fading is implemented
- _vm->_kernel->sendTrigger(trigger);
-
- return 6;
-}
-
-int ScriptInterpreter::o1_fadeToBlack() {
- return 0;
-}
-
-int ScriptInterpreter::o1_initPaletteCycle() {
- int first = INTEGER(0);
- int last = INTEGER(1);
- int delay = INTEGER(2);
- int ticks = INTEGER(3);
- int trigger = INTEGER(4);
- debugCN(kDebugScript, "first = %d; last = %d; delay = %d; ticks = %d; trigger = %d\n",
- first, last, delay, ticks, trigger);
-
- // HACK until palette cycling is implemented
- _vm->_kernel->sendTrigger(trigger);
-
- return 5;
-}
-
-int ScriptInterpreter::o1_stopPaletteCycle() {
- return 0;
-}
-
-int ScriptInterpreter::o1_hasPlayerSaid() {
- const char *words[3];
- for (int i = 0; i < 3; i++)
- words[i] = STRING(i);
- debugCN(kDebugScript, "'%s', '%s', '%s'\n", words[0], words[1], words[2]);
-
- int result = _vm->_player->said(words[0], words[1], words[2]);
-
- debugCN(kDebugScript, " -> '%d'\n", result);
-
- RETURN(result);
- return 3;
-}
-
-int ScriptInterpreter::o1_hasPlayerSaidAny() {
- const char *words[10];
- for (int i = 0; i < 10; i++)
- words[i] = STRING(i);
-
- debugCN(kDebugScript, "'%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'\n",
- words[0], words[1], words[2], words[3], words[4], words[5], words[6], words[7], words[8], words[9]);
-
- int result = _vm->_player->saidAny(words[0], words[1], words[2], words[3], words[4], words[5], words[6], words[7], words[8], words[9]);
- debugCN(kDebugScript, " -> '%d'\n", result);
-
- RETURN(result);
- return 10;
-}
-
-int ScriptInterpreter::o1_updatePlayerInfo() {
- // skip arg 0: player info struct
- return 1;
-}
-
-int ScriptInterpreter::o1_playerHotspotWalkOverride() {
- int x1 = INTEGER(0);
- int y1 = INTEGER(1);
- int x2 = INTEGER(2);
- int y2 = INTEGER(3);
- debugCN(kDebugScript, "(%d, %d); (%d, %d)\n", x1, y1, x2, y2);
- return 4;
-}
-
-int ScriptInterpreter::o1_playerHasItem() {
- const char *name = STRING(0);
- debugCN(kDebugScript, "item = '%s'\n", name);
- // TODO
- RETURN(0);
- return 1;
-}
-
-int ScriptInterpreter::o1_setWalkerLocation() {
- // skip arg 0: walker
- int x = INTEGER(1);
- int y = INTEGER(2);
- debugCN(kDebugScript, "x = %d; y = %d\n", x, y);
- return 3;
-}
-
-int ScriptInterpreter::o1_setWalkerFacing() {
- // skip arg 0: walker
- int facing = INTEGER(1);
- debugCN(kDebugScript, "facing = %d\n", facing);
- return 2;
-}
-
-int ScriptInterpreter::o1_setHotspot() {
- // skip arg 0: hotspot list
- const char *name = STRING(1);
- int value = INTEGER(2);
- debugCN(kDebugScript, "name = '%s' -> %d\n", name, value);
-
- _vm->_scene->getSceneResources().hotspots->setActive(name, (value != 0));
-
- return 2;
-}
-
-int ScriptInterpreter::o1_loadConversation() {
- const char *name = STRING(0);
- //int trigger = INTEGER(1);
- //int flag = INTEGER(2);
-
- // TODO; just to show something
- _m4Vm->_converse->startConversation(name);
-
- return 3;
-}
-
-int ScriptInterpreter::o1_playSeries() {
- const char *name = STRING(0);
- int layer = INTEGER(1);
- int flags = INTEGER(2);
- int trigger = INTEGER(3);
- int frameRate = INTEGER(4);
- int loopCount = INTEGER(5);
- int scale = INTEGER(6);
- int x = INTEGER(7);
- int y = INTEGER(8);
- int firstFrame = INTEGER(9);
- int lastFrame = INTEGER(10);
-
- debugCN(kDebugScript, "name = %s; layer = %04X; flags = %08X; trigger = %d; frameRate = %d; loopCount = %d; scale = %d; x = %d; y = %d: firstFrame = %d; lastFrame = %d\n",
- name, layer, flags, trigger, frameRate, loopCount, scale, x, y, firstFrame, lastFrame);
-
- // TODO: Return the machine to the script
- _vm->_ws->playSeries(name, layer, flags, trigger, frameRate, loopCount, scale, x, y, firstFrame, lastFrame);
-
- return 11;
-}
-
-int ScriptInterpreter::o1_showSeries() {
- const char *name = STRING(0);
- int layer = INTEGER(1);
- int flags = INTEGER(2);
- int trigger = INTEGER(3);
- int duration = INTEGER(4);
- int frameIndex = INTEGER(5);
- int scale = INTEGER(6);
- int x = INTEGER(7);
- int y = INTEGER(8);
-
- debugCN(kDebugScript, "name = %s; layer = %04X; flags = %08X; trigger = %d; duration = %d; frameIndex = %d; scale = %d; x = %d; y = %d\n",
- name, layer, flags, trigger, duration, frameIndex, scale, x, y);
-
- // TODO: Return the machine to the script
- _vm->_ws->showSeries(name, layer, flags, trigger, duration, frameIndex, scale, x, y);
-
- return 9;
-}
-
-int ScriptInterpreter::o1_loadSeries() {
- const char *name = STRING(0);
- int hash = INTEGER(1);
- // skip arg 3: palette ptr
-
- debugCN(kDebugScript, "name = %s; hash = %d\n", name, hash);
-
- int result = _vm->_ws->loadSeries(name, hash, NULL);
-
- RETURN(result);
- return 3;
-}
-
-int ScriptInterpreter::o1_unloadSeries() {
- return 0;
-}
-
-int ScriptInterpreter::o1_preloadBreakSeries() {
- //const SeriesStreamBreakList& seriesStreamBreakList = DATA(0, SeriesStreamBreakList);
- return 1;
-}
-
-int ScriptInterpreter::o1_unloadBreakSeries() {
- //const SeriesStreamBreakList& seriesStreamBreakList = DATA(0, SeriesStreamBreakList);
- return 1;
-}
-
-int ScriptInterpreter::o1_startBreakSeries() {
- //const SeriesStreamBreakList& seriesStreamBreakList = DATA(0, SeriesStreamBreakList);
- return 1;
-}
-
-int ScriptInterpreter::o1_globalTriggerProc() {
- int value1 = INTEGER(0);
- int value2 = INTEGER(1);
- int value3 = INTEGER(2);
- debugCN(kDebugScript, "%d; %d; %d\n", value1, value2, value3);
- return 3;
-}
-
-int ScriptInterpreter::o1_triggerTimerProc() {
- int value1 = INTEGER(0);
- int value2 = INTEGER(1);
- int value3 = INTEGER(2);
- debugCN(kDebugScript, "%d; %d; %d\n", value1, value2, value3);
- return 3;
-}
-
-int ScriptInterpreter::o1_dispatchTrigger() {
- int trigger = INTEGER(0);
- debugCN(kDebugScript, "trigger = %d\n", trigger);
-
- _vm->_kernel->sendTrigger(trigger);
- //g_system->delayMillis(5000);
-
- return 1;
-}
-
-int ScriptInterpreter::o1_getRangedRandomValue() {
- int minValue = INTEGER(0);
- int maxValue = INTEGER(1);
- RETURN(_vm->imath_ranged_rand(minValue, maxValue));
- return 2;
-}
-
-int ScriptInterpreter::o1_wilburSaid() {
- const SaidArray& saidArray = DATA(0, SaidArray);
-
- int result = 0;
-
- // NOTE: The "Common::String soundName" stuff is just temporary until playVoice is fixed.
-
- for (int i = 0; i < saidArray.size(); i++) {
- SaidArrayItem *item = saidArray[i];
-
- if (_vm->_player->said("LOOK AT", item->itemName) && item->digiNameLook) {
- debugCN(kDebugScript, " -> LOOK AT: '%s'\n", item->digiNameLook);
- Common::String soundName = Common::String(item->digiNameLook) + ".raw";
- _vm->_sound->playVoice(soundName.c_str(), 100);
- result = 1;
- break;
- }
-
- if (_vm->_player->said("TAKE", item->itemName) && item->digiNameTake) {
- debugCN(kDebugScript, " -> TAKE: '%s'\n", item->digiNameTake);
- Common::String soundName = Common::String(item->digiNameTake) + ".raw";
- _vm->_sound->playVoice(soundName.c_str(), 100);
- result = 1;
- break;
- }
-
- if (_vm->_player->said("GEAR", item->itemName) && item->digiNameGear) {
- debugCN(kDebugScript, " -> GEAR: '%s'\n", item->digiNameGear);
- Common::String soundName = Common::String(item->digiNameGear) + ".raw";
- _vm->_sound->playVoice(soundName.c_str(), 100);
- result = 1;
- break;
- }
-
- /*
- debugCN(kDebugScript, "##### itemName = '%s'; digiNameLook = %s; digiNameTake = %s; digiNameGear = %s\n",
- item->itemName, item->digiNameLook, item->digiNameTake, item->digiNameGear);
- */
- }
- debugCN(kDebugScript, " -> '%d'\n", result);
-
- RETURN(result);
- return 1;
-}
-
-int ScriptInterpreter::o1_wilburParse() {
- //const ParserArray& parserArray = DATA(0, ParserArray);
- RETURN(0);
- return 1;
-}
-
-int ScriptInterpreter::o1_wilburSpeech() {
- const char *name = STRING(0);
- int trigger = INTEGER(1);
- int room = INTEGER(2);
- int flag = INTEGER(3);
- int volume = INTEGER(4);
- int slot = INTEGER(5);
-
- debugCN(kDebugScript, "%s; %d; %d; %d; %d; %d\n", name, trigger, room, flag, volume, slot);
- //g_system->delayMillis(5000);
-
- KernelTriggerType oldTriggerMode = _vm->_kernel->triggerMode;
-
- // TODO
- Common::String soundName = Common::String(name) + ".raw";
- _vm->_sound->playVoice(soundName.c_str(), 100);
-
- _vm->_kernel->triggerMode = oldTriggerMode;
-
- return 6;
-}
-
-// Kernel vars
-
-void ScriptInterpreter::getKernelVar(int index, ScriptValue &value) {
-
- debugCN(kDebugScript, "ScriptInterpreter::getKernelVar() index = %d\n", index);
-
- if (index > _kernelVarsMax) {
- debugCN(kDebugScript, "ScriptInterpreter::getKernelVar() Invalid kernel var index %d!\n", index);
- return;
- }
-
- debugCN(kDebugScript, "ScriptInterpreter::getKernelVar() name = %s\n", _kernelVars[index].desc);
-
- ScriptKernelVariable var = _kernelVars[index].var;
-
- switch (var) {
-
- case kKernelTrigger:
- value = _vm->_kernel->trigger;
- break;
-
- case kKernelTriggerMode:
- value = (int)_vm->_kernel->triggerMode;
- break;
-
- case kKernelContinueHandlingTrigger:
- value = (int)_vm->_kernel->daemonTriggerAvailable;
- break;
-
- case kGameVersion:
- // TODO
- value = 0;
- break;
-
- case kGameLanguage:
- // TODO
- value = 0;
- break;
-
- case kGameNewRoom:
- // TODO
- value = 0;
- break;
-
- case kPlayerCommandReady:
- value = (int)_vm->_player->commandReady;
- break;
-
- default:
- debugCN(kDebugScript, "ScriptInterpreter::getKernelVar() Invalid kernel var %d!\n", var);
- //g_system->delayMillis(2000);
-
- }
-
-}
-
-void ScriptInterpreter::setKernelVar(int index, const ScriptValue &value) {
-
- debugCN(kDebugScript, "ScriptInterpreter::setKernelVar() index = %d\n", index);
-
- if (index > _kernelVarsMax) {
- debugCN(kDebugScript, "ScriptInterpreter::setKernelVar() Invalid kernel var index %d!\n", index);
- return;
- }
-
- debugCN(kDebugScript, "ScriptInterpreter::setKernelVar() name = %s\n", _kernelVars[index].desc);
-
- ScriptKernelVariable var = _kernelVars[index].var;
-
- switch (var) {
-
- case kKernelTrigger:
- _vm->_kernel->trigger = toInteger(value);
- debugCN(kDebugScript, "kKernelTrigger -> %d\n", toInteger(value));
- break;
-
- case kKernelTriggerMode:
- _vm->_kernel->triggerMode = (KernelTriggerType)toInteger(value);
- debugCN(kDebugScript, "kKernelTrigger -> %d\n", toInteger(value));
- break;
-
- case kKernelContinueHandlingTrigger:
- _vm->_kernel->daemonTriggerAvailable = (toInteger(value) != 0);
- debugCN(kDebugScript, "kKernelContinueHandlingTrigger -> %d\n", toInteger(value));
- break;
-
- case kGameNewRoom:
- _vm->_kernel->newRoom = toInteger(value);
- debugCN(kDebugScript, "kGameNewRoom -> %d\n", toInteger(value));
- break;
-
- case kPlayerCommandReady:
- // TODO
- debugCN(kDebugScript, "kPlayerCommandReady -> %d\n", toInteger(value));
- break;
-
- default:
- debugCN(kDebugScript, "ScriptInterpreter::setKernelVar() Invalid kernel var %d!\n", var);
- //g_system->delayMillis(2000);
-
- }
-
-}
-
-} // End of namespace M4
diff --git a/engines/m4/script.h b/engines/m4/script.h
deleted file mode 100644
index 22f07fd062..0000000000
--- a/engines/m4/script.h
+++ /dev/null
@@ -1,463 +0,0 @@
-/* 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 M4_SCRIPT_H
-#define M4_SCRIPT_H
-
-#include "common/file.h"
-#include "common/stream.h"
-#include "common/hashmap.h"
-#include "common/str.h"
-#include "common/stack.h"
-
-#include "m4/woodscript.h"
-
-namespace M4 {
-
-const unsigned long kScriptFileMagic = 0x5845344D;
-const unsigned long kScriptFileVersion = 1;
-
-enum ScriptValueType {
- kInteger,
- kConstString,
- kLogicVar,
- kLogicVarRef,
- kGameVar,
- kKernelVar,
- kDataRef,
- kRegister,
- kStackVar
-};
-
-enum ScriptDataType {
- kStreamBreakSeries,
- kStreamPlaySeries,
- kSaidArray,
- kParserArray,
- kSpeechArray,
- kCreditsArray,
- kInvObj,
- kMineRoom,
- kButtonItem
-};
-
-class ScriptInterpreter;
-
-class StringTable {
-public:
- StringTable();
- ~StringTable();
- void load(Common::File *fd);
- int size() { return _strings.size(); }
- const char *operator[](uint32 index) const {
- assert(index < _strings.size() );
- return _strings[index];
- }
-protected:
- Common::Array<const char*> _strings;
- char *_stringsData;
-};
-
-struct ScriptValue {
-
- ScriptValueType type;
-
- union {
- int value;
- };
-
- ScriptValue() : type(kInteger), value(0) {}
- ScriptValue(ScriptValueType itype, int ivalue) : type(itype), value(ivalue) {}
-
- ScriptValue(const int intValue) : type(kInteger), value(intValue) {}
-
- ScriptValue& operator=(const int intValue) {
- type = kInteger;
- value = intValue;
- return *this;
- }
-
-};
-
-class ScriptDataItem {
-public:
- ScriptDataItem() : _inter(NULL) {}
- ScriptDataItem(ScriptInterpreter *inter) : _inter(inter) {}
- virtual ~ScriptDataItem() {}
- virtual void load(Common::File *fd) = 0;
- static int type() { return -1; }
-protected:
- ScriptInterpreter *_inter;
-};
-
-class ScriptDataCache {
-public:
- ScriptDataCache(ScriptInterpreter *inter) : _inter(inter) {
- }
- ~ScriptDataCache() {
- clear();
- }
-
- // WORKAROUND: The old prototype for this function was:
- // template<class T> T *load(Common::File *fd, uint32 ofs);
- // that caused a parser error in g++ 3.3.6 used by our
- // "motoezx" target of our buildbot. The actual parser
- // error happended, when calling the function like this:
- // "T *result = _dataCache->load<T>(_scriptFile, _data[value.value]->offset);"
- // in ScriptInterpreter::toData. To work around this
- // we moved the return value as parameter instead.
- template<class T>
- void load(Common::File *fd, uint32 ofs, T *&item) {
- if (_cache.contains(ofs)) {
- item = (T*)(_cache[ofs]);
- } else {
- item = new T(_inter);
- fd->seek(ofs + 4); // "+4" skips the data size
- item->load(fd);
- _cache[ofs] = item;
- }
- }
- void clear() {
- // TODO: Free all cached items
- }
-protected:
- typedef Common::HashMap<uint32, ScriptDataItem*> CacheMap;
- CacheMap _cache;
- ScriptInterpreter *_inter;
-};
-
-struct SeriesStreamBreakItem {
- int frameNum;
- const char *digiName;
- int digiChannel;
- int digiVolume;
- int trigger;
- int flags;
- ScriptValue variable;
- int value;
-};
-
-class SeriesStreamBreakList : public ScriptDataItem {
-public:
- SeriesStreamBreakList(ScriptInterpreter *inter) : ScriptDataItem(inter) {}
- ~SeriesStreamBreakList();
- void load(Common::File *fd);
- int size() const { return _items.size(); }
- SeriesStreamBreakItem *operator[](int index) const { return _items[index]; }
- static int type() { return 0; }
-protected:
- Common::Array<SeriesStreamBreakItem*> _items;
-};
-
-struct SaidArrayItem {
- const char *itemName;
- const char *digiNameLook;
- const char *digiNameTake;
- const char *digiNameGear;
-};
-
-class SaidArray : public ScriptDataItem {
-public:
- SaidArray(ScriptInterpreter *inter) : ScriptDataItem(inter) {}
- ~SaidArray();
- void load(Common::File *fd);
- int size() const { return _items.size(); }
- SaidArrayItem *operator[](int index) const { return _items[index]; }
- static int type() { return 2; }
-protected:
- Common::Array<SaidArrayItem*> _items;
-};
-
-struct ParserArrayItem {
- const char *w0;
- const char *w1;
- int trigger;
- ScriptValue testVariable;
- int testValue;
- ScriptValue variable;
- int value;
-};
-
-class ParserArray : public ScriptDataItem {
-public:
- ParserArray(ScriptInterpreter *inter) : ScriptDataItem(inter) {}
- ~ParserArray();
- void load(Common::File *fd);
- int size() const { return _items.size(); }
- ParserArrayItem *operator[](int index) const { return _items[index]; }
- static int type() { return 3; }
-protected:
- Common::Array<ParserArrayItem*> _items;
-};
-
-class ScriptFunction {
-public:
- ScriptFunction(ScriptInterpreter *inter);
- ~ScriptFunction();
- void load(Common::File *fd);
- void jumpAbsolute(uint32 ofs);
- void jumpRelative(int32 ofs);
- byte readByte();
- uint32 readUint32();
-protected:
- ScriptInterpreter *_inter;
- Common::SeekableReadStream *_code;
-};
-
-struct ScriptFunctionEntry {
- uint32 offset;
- ScriptFunction *func;
- ScriptFunctionEntry(uint32 funcOffset) : offset(funcOffset), func(NULL) {
- }
-};
-
-struct ScriptDataEntry {
- uint32 offset;
- ScriptDataType type;
- ScriptDataEntry(uint32 dataOffset, ScriptDataType dataType) : offset(dataOffset), type(dataType) {
- }
-};
-
-enum ScriptKernelVariable {
- kGameLanguage,
- kGameVersion,
- kGameCurrentRoom,
- kGameNewRoom,
- kGamePreviousRoom,
- kGameNewSection,
- kKernelTrigger,
- kKernelTriggerMode,
- kKernelFirstFade,
- kKernelSuppressFadeUp,
- kKernelContinueHandlingTrigger,
- kKernelUseDebugMonitor,
- kPlayerPosX,
- kPlayerPosY,
- kPlayerFacing,
- kPlayerScale,
- kPlayerDepth,
- kPlayerWalkX,
- kPlayerWalkY,
- kPlayerReadyToWalk,
- kPlayerNeedToWalk,
- kPlayerCommandReady,
- kPlayerWalkerInThisScene,
- kPlayerVerb,
- kWalkerInitialized,
- kCallDaemonEveryLoop,
- kConvCurrentTalker,
- kConvCurrentNode,
- kConvCurrentEntry,
- kConvSoundToPlay,
- kInterfaceVisible
-};
-
-class ScriptInterpreter {
-public:
- ScriptInterpreter(MadsM4Engine *vm);
- ~ScriptInterpreter();
- /* Opens a M4 program file */
- void open(const char *filename);
- void close();
- /* Loads a function via the index. Creates the function object if it's not already loaded. */
- ScriptFunction *loadFunction(uint32 index);
- /* Loads a function via the exported name. */
- ScriptFunction *loadFunction(const Common::String &name);
- /* Unload all loaded functions.
- This should be called before entering a new room to free unused functions. */
- void unloadFunctions();
- //TODO void unloadData();
- /* Executes a function. */
- int runFunction(ScriptFunction *scriptFunction);
-
- void push(const ScriptValue &value);
- void pop(ScriptValue &value);
- void dumpStack();
- void dumpRegisters();
- void dumpGlobalVars();
-
- int toInteger(const ScriptValue &value);
-
- const char *toString(const ScriptValue &value);
-
- // Is this ok?
- template<class T>
- const T& toData(const ScriptValue &value) {
- debugCN(kDebugScript, "ScriptInterpreter::toData() index = %d; type = %d; max = %d\n", value.value, _data[value.value]->type, _data.size());
- assert((uint32)value.value < _data.size());
- T *result = 0;
- _dataCache->load(_scriptFile, _data[value.value]->offset, result);
- return *result;
- }
-
- const char *getGlobalString(int index) const {
- return _constStrings[index];
- }
-
- const char *loadGlobalString(Common::File *fd);
-
- void test();
-
-protected:
-
- MadsM4Engine *_vm;
-
- typedef Common::HashMap<Common::String, uint32, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> FunctionNameMap;
- Common::File *_scriptFile;
- /* An array of offset/ScriptFunction* pairs for each script function */
- Common::Array<ScriptFunctionEntry*> _functions;
-
- // DEBUG only
- Common::Array<Common::String> _scriptFunctionNames;
-
- Common::Array<ScriptDataEntry*> _data;
- /* Maps function name -> index of function in _functions array */
- FunctionNameMap _functionNames;
- StringTable _constStrings;
- /* The currently running function */
- ScriptFunction *_runningFunction;
- int _localStackPtr;
-
- ScriptValue _registers[8];
-
- ScriptValue _stack[512];
- int _stackPtr;
-
- int _globalVarCount;
- ScriptValue _globalVars[1024];
-
- int _logicGlobals[512];
-
- int _cmpFlags;
-
- ScriptDataCache *_dataCache;
-
- int _lineNum;
-
- typedef int (ScriptInterpreter::*KernelFunction)();
- struct KernelFunctionEntry {
- KernelFunction proc;
- const char *desc;
- };
- const KernelFunctionEntry *_kernelFunctions;
- uint16 _kernelFunctionsMax;
-
- struct KernelVariableEntry {
- ScriptKernelVariable var;
- const char *desc;
- };
- const KernelVariableEntry *_kernelVars;
- int16 _kernelVarsMax;
-
- void initScriptKernel();
-
- void loadValue(ScriptValue &value);
- void writeValue(ScriptValue &value);
- void copyValue(ScriptValue &destValue, ScriptValue &sourceValue);
- void derefValue(ScriptValue &value);
-
- void callKernelFunction(uint32 index);
- ScriptValue getArg(uint32 index);
- void dumpArgs(uint32 count);
-
- void callFunction(uint32 index);
-
- bool execOpcode(byte opcode);
-
- // Kernel functions
- int o1_handleStreamBreak();
- int o1_handlePlayBreak();
- int o1_dispatchTriggerOnSoundState();
- int o1_getRangedRandomValue();
- int o1_getTicks();
- int o1_preloadSound();
- int o1_unloadSound();
- int o1_stopSound();
- int o1_playSound();
- int o1_playLoopingSound();
- int o1_setSoundVolume();
- int o1_getSoundStatus();
- int o1_getSoundDuration();
- int o1_loadSeries();
- int o1_unloadSeries();
- int o1_showSeries();
- int o1_playSeries();
- int o1_setSeriesFrameRate();
- int o1_playBreakSeries();
- int o1_preloadBreakSeries();
- int o1_unloadBreakSeries();
- int o1_startBreakSeries();
- int o1_dispatchTrigger();
- int o1_terminateMachine();
- int o1_sendWoodScriptMessage();
- int o1_runConversation();
- int o1_loadConversation();
- int o1_exportConversationValue();
- int o1_exportConversationPointer();
- int o1_fadeInit();
- int o1_fadeSetStart();
- int o1_fadeToBlack();
- int o1_initPaletteCycle();
- int o1_stopPaletteCycle();
- int o1_setHotspot();
- int o1_hideWalker();
- int o1_showWalker();
- int o1_setWalkerLocation();
- int o1_setWalkerFacing();
- int o1_walk();
- int o1_overrideCrunchTime();
- int o1_addBlockingRect();
- int o1_triggerTimerProc();
- int o1_setPlayerCommandsAllowed();
- int o1_getPlayerCommandsAllowed();
- int o1_updatePlayerInfo();
- int o1_hasPlayerSaid();
- int o1_hasPlayerSaidAny();
- int o1_playerHotspotWalkOverride();
- int o1_setPlayerFacingAngle();
- int o1_disablePlayerFadeToBlack();
- int o1_enablePlayer();
- int o1_disablePlayer();
- int o1_freshenSentence();
- int o1_playerHasItem();
- int o1_playerGiveItem();
- int o1_moveObject();
- int o1_setStopSoundsBetweenRooms();
- int o1_backupPalette();
- int o1_unloadWilburWalker();
- int o1_globalTriggerProc();
- int o1_wilburSpeech();
- int o1_wilburSaid();
- int o1_wilburParse();
- int o1_wilburTalk();
- int o1_wilburFinishedTalking();
- //int ();
-
- // Kernel vars
- void getKernelVar(int index, ScriptValue &value);
- void setKernelVar(int index, const ScriptValue &value);
-
-};
-
-} // End of namespace M4
-
-#endif
diff --git a/engines/m4/scripttab.h b/engines/m4/scripttab.h
deleted file mode 100644
index 3264ae743c..0000000000
--- a/engines/m4/scripttab.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* This file has been autogenerated by the linker.
- Do not edit it or merge it with script.cpp! */
-#define FUNCTION(x) { &ScriptInterpreter::x, #x }
- static KernelFunctionEntry kernelFunctions[] = {
- /* 000 */
- FUNCTION(o1_handleStreamBreak),
- FUNCTION(o1_handlePlayBreak),
- FUNCTION(o1_dispatchTriggerOnSoundState),
- FUNCTION(o1_getRangedRandomValue),
- /* 004 */
- FUNCTION(o1_getTicks),
- FUNCTION(o1_preloadSound),
- FUNCTION(o1_unloadSound),
- FUNCTION(o1_stopSound),
- /* 008 */
- FUNCTION(o1_playSound),
- FUNCTION(o1_playLoopingSound),
- FUNCTION(o1_setSoundVolume),
- FUNCTION(o1_getSoundStatus),
- /* 012 */
- FUNCTION(o1_getSoundDuration),
- FUNCTION(o1_loadSeries),
- FUNCTION(o1_unloadSeries),
- FUNCTION(o1_showSeries),
- /* 016 */
- FUNCTION(o1_playSeries),
- FUNCTION(o1_setSeriesFrameRate),
- FUNCTION(o1_playBreakSeries),
- FUNCTION(o1_preloadBreakSeries),
- /* 020 */
- FUNCTION(o1_unloadBreakSeries),
- FUNCTION(o1_startBreakSeries),
- FUNCTION(o1_dispatchTrigger),
- FUNCTION(o1_terminateMachine),
- /* 024 */
- FUNCTION(o1_sendWoodScriptMessage),
- FUNCTION(o1_runConversation),
- FUNCTION(o1_runConversation),
- FUNCTION(o1_loadConversation),
- /* 028 */
- FUNCTION(o1_exportConversationValue),
- FUNCTION(o1_exportConversationPointer),
- FUNCTION(o1_runConversation),
- FUNCTION(o1_fadeInit),
- /* 032 */
- FUNCTION(o1_fadeSetStart),
- FUNCTION(o1_fadeToBlack),
- FUNCTION(o1_initPaletteCycle),
- FUNCTION(o1_stopPaletteCycle),
- /* 036 */
- FUNCTION(o1_setHotspot),
- FUNCTION(o1_hideWalker),
- FUNCTION(o1_showWalker),
- FUNCTION(o1_setWalkerLocation),
- /* 040 */
- FUNCTION(o1_setWalkerFacing),
- FUNCTION(o1_walk),
- FUNCTION(o1_overrideCrunchTime),
- FUNCTION(o1_addBlockingRect),
- /* 044 */
- FUNCTION(o1_triggerTimerProc),
- FUNCTION(o1_setPlayerCommandsAllowed),
- FUNCTION(o1_getPlayerCommandsAllowed),
- FUNCTION(o1_updatePlayerInfo),
- /* 048 */
- FUNCTION(o1_hasPlayerSaid),
- FUNCTION(o1_hasPlayerSaidAny),
- FUNCTION(o1_playerHotspotWalkOverride),
- FUNCTION(o1_setPlayerFacingAngle),
- /* 052 */
- FUNCTION(o1_disablePlayerFadeToBlack),
- FUNCTION(o1_enablePlayer),
- FUNCTION(o1_disablePlayer),
- FUNCTION(o1_freshenSentence),
- /* 056 */
- FUNCTION(o1_playerHasItem),
- FUNCTION(o1_playerGiveItem),
- FUNCTION(o1_moveObject),
- FUNCTION(o1_setStopSoundsBetweenRooms),
- /* 060 */
- FUNCTION(o1_backupPalette),
- FUNCTION(o1_unloadWilburWalker),
- FUNCTION(o1_globalTriggerProc),
- FUNCTION(o1_wilburSpeech),
- /* 064 */
- FUNCTION(o1_wilburParse),
- FUNCTION(o1_wilburSaid),
- FUNCTION(o1_wilburTalk),
- FUNCTION(o1_wilburFinishedTalking)
- };
-#undef FUNCTION
-
-#define VARIABLE(x) { x, #x }
- static KernelVariableEntry kernelVars[] = {
- /* 000 */
- VARIABLE(kGameLanguage),
- VARIABLE(kGameVersion),
- VARIABLE(kGameCurrentRoom),
- VARIABLE(kGameNewRoom),
- /* 004 */
- VARIABLE(kGamePreviousRoom),
- VARIABLE(kGameNewSection),
- VARIABLE(kKernelTrigger),
- VARIABLE(kKernelTriggerMode),
- /* 008 */
- VARIABLE(kKernelFirstFade),
- VARIABLE(kKernelSuppressFadeUp),
- VARIABLE(kKernelContinueHandlingTrigger),
- VARIABLE(kKernelUseDebugMonitor),
- /* 012 */
- VARIABLE(kPlayerPosX),
- VARIABLE(kPlayerPosY),
- VARIABLE(kPlayerFacing),
- VARIABLE(kPlayerScale),
- /* 016 */
- VARIABLE(kPlayerDepth),
- VARIABLE(kPlayerWalkX),
- VARIABLE(kPlayerWalkY),
- VARIABLE(kPlayerReadyToWalk),
- /* 020 */
- VARIABLE(kPlayerNeedToWalk),
- VARIABLE(kPlayerCommandReady),
- VARIABLE(kPlayerWalkerInThisScene),
- VARIABLE(kPlayerVerb),
- /* 024 */
- VARIABLE(kWalkerInitialized),
- VARIABLE(kCallDaemonEveryLoop),
- VARIABLE(kConvCurrentTalker),
- VARIABLE(kConvCurrentNode),
- /* 028 */
- VARIABLE(kConvCurrentEntry),
- VARIABLE(kConvSoundToPlay),
- VARIABLE(kInterfaceVisible)
- };
-#undef VARIABLE
diff --git a/engines/m4/sound.cpp b/engines/m4/sound.cpp
deleted file mode 100644
index 76eae8a661..0000000000
--- a/engines/m4/sound.cpp
+++ /dev/null
@@ -1,276 +0,0 @@
-/* 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 "m4/m4.h"
-#include "m4/sound.h"
-#include "m4/compression.h"
-
-#include "common/stream.h"
-#include "common/textconsole.h"
-
-#include "audio/audiostream.h"
-#include "audio/mixer.h"
-#include "audio/decoders/raw.h"
-
-namespace M4 {
-
-Sound::Sound(MadsM4Engine *vm, Audio::Mixer *mixer, int volume) :
- _vm(vm), _mixer(mixer) {
-
- for (int i = 0; i < SOUND_HANDLES; i++)
- _handles[i].type = kFreeHandle;
-
- _dsrFileLoaded = false;
-
- setVolume(volume);
-}
-
-Sound::~Sound() {
- unloadDSRFile();
-}
-
-SndHandle *Sound::getHandle() {
- for (int i = 0; i < SOUND_HANDLES; i++) {
- if (_handles[i].type == kFreeHandle)
- return &_handles[i];
-
- if (!_mixer->isSoundHandleActive(_handles[i].handle)) {
- _handles[i].type = kFreeHandle;
- return &_handles[i];
- }
- }
-
- error("Sound::getHandle(): Too many sound handles");
- return NULL; // for compilers that don't support NORETURN
-}
-
-bool Sound::isHandleActive(SndHandle *handle) {
- return (_mixer->isSoundHandleActive(handle->handle));
-}
-
-void Sound::playSound(const char *soundName, int volume, bool loop, int channel) {
- Common::SeekableReadStream *soundStream = _vm->res()->get(soundName);
- SndHandle *handle;
- if (channel < 0) {
- handle = getHandle();
- } else {
- if (_handles[channel].type == kFreeHandle) {
- handle = &_handles[channel];
- } else {
- warning("Attempted to play a sound on a channel that isn't free");
- return;
- }
- }
-
- int bufferSize = soundStream->size();
- byte *buffer = new byte[bufferSize];
- soundStream->read(buffer, bufferSize);
- _vm->res()->toss(soundName);
-
- handle->type = kEffectHandle;
-
- _vm->res()->toss(soundName);
-
- // Sound format is 8bit mono, unsigned, 11025kHz
- Audio::AudioStream *stream = Audio::makeLoopingAudioStream(
- Audio::makeRawStream(buffer, bufferSize, 11025, Audio::FLAG_UNSIGNED),
- loop ? 0 : 1);
- _mixer->playStream(Audio::Mixer::kSFXSoundType, &handle->handle, stream, -1, volume);
-}
-
-void Sound::playSound(int soundNum) {
- warning("TODO: playSound(%d)", soundNum);
-}
-
-void Sound::pauseSound() {
- for (int i = 0; i < SOUND_HANDLES; i++) {
- if (_handles[i].type == kEffectHandle)
- _mixer->pauseHandle(_handles[i].handle, true);
- }
-}
-
-void Sound::resumeSound() {
- for (int i = 0; i < SOUND_HANDLES; i++) {
- if (_handles[i].type == kEffectHandle)
- _mixer->pauseHandle(_handles[i].handle, false);
- }
-}
-
-void Sound::stopSound(int channel) {
- if (channel >= 0) {
- if (_handles[channel].type == kEffectHandle) {
- _mixer->stopHandle(_handles[channel].handle);
- _handles[channel].type = kFreeHandle;
- return;
- } else {
- warning("Attempted to stop a sound on a channel that is already free");
- return;
- }
- }
-
- for (int i = 0; i < SOUND_HANDLES; i++) {
- if (_handles[i].type == kEffectHandle) {
- _mixer->stopHandle(_handles[i].handle);
- _handles[i].type = kFreeHandle;
- }
- }
-}
-
-void Sound::playVoice(const char *soundName, int volume) {
- Common::SeekableReadStream *soundStream = _vm->res()->get(soundName);
- SndHandle *handle = getHandle();
- byte *buffer;
-
- buffer = (byte *)malloc(soundStream->size());
- soundStream->read(buffer, soundStream->size());
-
- handle->type = kEffectHandle;
-
- _vm->res()->toss(soundName);
-
- // Voice format is 8bit mono, unsigned, 11025kHz
- Audio::AudioStream *stream = Audio::makeRawStream(buffer, soundStream->size(), 11025, Audio::FLAG_UNSIGNED);
- _mixer->playStream(Audio::Mixer::kSFXSoundType, &handle->handle, stream, -1, volume);
-}
-
-void Sound::pauseVoice() {
- for (int i = 0; i < SOUND_HANDLES; i++)
- if (_handles[i].type == kVoiceHandle)
- _mixer->pauseHandle(_handles[i].handle, true);
-}
-
-void Sound::resumeVoice() {
- for (int i = 0; i < SOUND_HANDLES; i++)
- if (_handles[i].type == kVoiceHandle)
- _mixer->pauseHandle(_handles[i].handle, false);
-}
-
-void Sound::stopVoice() {
- for (int i = 0; i < SOUND_HANDLES; i++)
- if (_handles[i].type == kVoiceHandle) {
- _mixer->stopHandle(_handles[i].handle);
- _handles[i].type = kFreeHandle;
- }
-}
-
-void Sound::stopAll() {
- stopVoice();
- stopSound();
-}
-
-void Sound::setVolume(int volume) {
- _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, volume);
- _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, volume);
-}
-
-void Sound::loadDSRFile(const char *fileName) {
- if (_dsrFileLoaded)
- unloadDSRFile();
-
- Common::SeekableReadStream *fileStream = _vm->res()->get(fileName);
-
- sprintf(_dsrFile.fileName, "%s", fileName);
-
- // Read header
- _dsrFile.entryCount = fileStream->readUint16LE();
- //warning(kDebugSound, "DSR has %i entries\n", _dsrFile.entryCount);
-
- for (int i = 0; i < _dsrFile.entryCount; i++) {
- DSREntry newEntry;
- newEntry.frequency = fileStream->readUint16LE();
- newEntry.channels = fileStream->readUint32LE();
- newEntry.compSize = fileStream->readUint32LE();
- newEntry.uncompSize = fileStream->readUint32LE();
- newEntry.offset = fileStream->readUint32LE();
- _dsrFile.dsrEntries.push_back(newEntry);
-
- /*
- warning(kDebugSound, "%i: ", i);
- warning(kDebugSound, "frequency: %i ", newEntry->frequency);
- warning(kDebugSound, "channels: %i ", newEntry->channels);
- warning(kDebugSound, "comp: %i ", newEntry.compSize);
- warning(kDebugSound, "uncomp: %i ", newEntry.uncompSize);
- warning(kDebugSound, "offset: %i ", newEntry->offset);
- warning(kDebugSound, "\n");
- */
- }
-
- _vm->res()->toss(fileName);
-
- _dsrFileLoaded = true;
-}
-
-void Sound::unloadDSRFile() {
- if (!_dsrFileLoaded)
- return;
-
- _dsrFile.dsrEntries.clear();
-
- _dsrFile.entryCount = 0;
- strcpy(_dsrFile.fileName, "");
- _dsrFileLoaded = false;
-}
-
-void Sound::playDSRSound(int soundIndex, int volume, bool loop) {
- if (!_dsrFileLoaded) {
- warning("DSR file not loaded, not playing sound");
- return;
- }
-
- if (soundIndex < 0 || soundIndex > _dsrFile.entryCount - 1) {
- warning("Invalid sound index: %i, not playing sound", soundIndex);
- return;
- }
-
- SndHandle *handle = getHandle();
-
- handle->type = kEffectHandle;
-
- // Get sound data
- FabDecompressor fab;
- byte *compData = new byte[_dsrFile.dsrEntries[soundIndex].compSize];
- byte *buffer = new byte[_dsrFile.dsrEntries[soundIndex].uncompSize];
- Common::SeekableReadStream *fileStream = _vm->res()->get(_dsrFile.fileName);
- fileStream->seek(_dsrFile.dsrEntries[soundIndex].offset, SEEK_SET);
- fileStream->read(compData, _dsrFile.dsrEntries[soundIndex].compSize);
- _vm->res()->toss(_dsrFile.fileName);
-
- fab.decompress(compData, _dsrFile.dsrEntries[soundIndex].compSize,
- buffer, _dsrFile.dsrEntries[soundIndex].uncompSize);
-
- // Play sound
- Audio::AudioStream *stream = Audio::makeLoopingAudioStream(
- Audio::makeRawStream(buffer,
- _dsrFile.dsrEntries[soundIndex].uncompSize,
- _dsrFile.dsrEntries[soundIndex].frequency, Audio::FLAG_UNSIGNED),
- loop ? 0 : 1);
- _mixer->playStream(Audio::Mixer::kSFXSoundType, &handle->handle, stream, -1, volume);
-
- /*
- // Dump the sound file
- FILE *destFile = fopen("sound.raw", "wb");
- fwrite(_dsrFile.dsrEntries[soundIndex]->data, _dsrFile.dsrEntries[soundIndex].uncompSize, 1, destFile);
- fclose(destFile);
- */
-}
-
-} // End of namespace M4
diff --git a/engines/m4/sound.h b/engines/m4/sound.h
deleted file mode 100644
index 99a2292d83..0000000000
--- a/engines/m4/sound.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/* 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.
- *
- */
-
-// Sound class
-
-#ifndef M4_SOUND_H
-#define M4_SOUND_H
-
-#include "common/file.h"
-#include "common/array.h"
-#include "audio/mixer.h"
-#include "audio/decoders/mp3.h"
-#include "audio/decoders/vorbis.h"
-#include "audio/decoders/flac.h"
-
-namespace M4 {
-
-#define SOUND_HANDLES 10
-
-enum SOUND_FLAGS {
- SOUND_LOOP = 1
-};
-
-enum sndHandleType {
- kFreeHandle,
- kEffectHandle,
- kVoiceHandle
-};
-
-struct SndHandle {
- Audio::SoundHandle handle;
- sndHandleType type;
-};
-
-struct DSREntry {
- int16 frequency;
- int channels;
- int32 compSize;
- int32 uncompSize;
- int32 offset;
-};
-
-struct DSRFile {
- char fileName[20];
- int entryCount;
- Common::Array<DSREntry> dsrEntries;
-};
-
-class MadsM4Engine;
-
-class Sound {
-public:
-
- Sound(MadsM4Engine *vm, Audio::Mixer *mixer, int volume);
- ~Sound();
-
- void playSound(const char *soundName, int volume, bool loop, int channel = -1);
- void playSound(int soundNum);
- void pauseSound();
- void resumeSound();
- void stopSound(int channel = -1);
-
- void playVoice(const char *soundName, int volume);
- void pauseVoice();
- void resumeVoice();
- void stopVoice();
-
- void stopAll();
-
- void setVolume(int volume);
-
- bool isHandleActive(SndHandle *handle);
- SndHandle *getHandle();
-
- void loadDSRFile(const char *fileName);
- void unloadDSRFile();
- void playDSRSound(int soundIndex, int volume, bool loop);
-
- private:
-
- MadsM4Engine *_vm;
- Audio::Mixer *_mixer;
- SndHandle _handles[SOUND_HANDLES];
-
- DSRFile _dsrFile;
- bool _dsrFileLoaded;
-};
-
-} // End of namespace M4
-
-#endif
diff --git a/engines/m4/sprite.cpp b/engines/m4/sprite.cpp
deleted file mode 100644
index d0741732f3..0000000000
--- a/engines/m4/sprite.cpp
+++ /dev/null
@@ -1,207 +0,0 @@
-/* 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/rect.h"
-#include "common/textconsole.h"
-
-#include "m4/globals.h"
-#include "m4/graphics.h"
-#include "m4/m4.h"
-#include "m4/resource.h"
-#include "m4/sprite.h"
-
-namespace M4 {
-
-enum {
- kEndOfLine = 0,
- kEndOfSprite = 1,
- kMarker = 2
-};
-
-M4Sprite::M4Sprite(Common::SeekableReadStream* source, int xOfs, int yOfs, int widthVal, int heightVal, bool decodeRle, uint8 encodingVal)
- : M4Surface(widthVal, heightVal), encoding(encodingVal) {
-
- if (_vm->isM4()) {
- if (decodeRle) {
- loadRle(source);
- } else {
- // Raw sprite data, load directly
- byte *dst = getBasePtr();
- source->read(dst, widthVal * heightVal);
- }
- } else {
- loadMadsSprite(source);
- }
-
- x = xOffset = xOfs;
- y = yOffset = yOfs;
-
-}
-
-void M4Sprite::loadRle(Common::SeekableReadStream* rleData) {
- byte *dst = getBasePtr();
- while (1) {
- byte len = rleData->readByte();
- if (len == 0) {
- len = rleData->readByte();
- if (len <= kMarker) {
- if (len == kEndOfSprite)
- break;
- } else {
- while (len--) {
- *dst++ = rleData->readByte();
- }
- }
- } else {
- byte value = rleData->readByte();
- while (len--)
- *dst++ = value;
- }
- }
-}
-
-void M4Sprite::loadDeltaRle(Common::SeekableReadStream* rleData, int destX, int destY) {
- int lineNum = 0;
- byte *dst = getBasePtr(destX, destY);
- while (1) {
- byte len = rleData->readByte();
- if (len == 0) {
- len = rleData->readByte();
- if (len <= kMarker) {
- if (len == kEndOfLine) {
- dst = getBasePtr(destX, destY + lineNum);
- lineNum++;
- } else if (len == kEndOfSprite)
- break;
- } else {
- while (len--) {
- byte pixel = rleData->readByte();
- if (pixel == 0)
- dst++;
- else
- *dst++ = pixel;
- /* NOTE: The change below behaved differently than the old code,
- so I put the old code back in again above.
- If the pixel value is 0, nothing should be written to the
- output buffer, since 0 means transparent. */
- //*dst++ = (pixel == 0xFD) ? 0 : pixel;
- }
- }
- } else {
- byte value = rleData->readByte();
- if (value == 0)
- dst += len;
- else
- while (len--)
- *dst++ = value;
- }
- }
-}
-
-// TODO: The sprite outlines (pixel value 0xFD) are not shown
-void M4Sprite::loadMadsSprite(Common::SeekableReadStream* source) {
- bool spriteEnd = false;
-
- // Set entire sprite contents to transparent pixels
- fillRect(bounds(), TRANSPARENT_COLOR_INDEX);
-
- // Major line loop
- for (int yp = 0; yp < h; ++yp) {
- byte *destP = getBasePtr(0, yp);
- bool newLine = false;
- byte cmd = source->readByte();
- int x2 = 0;
-
- if (cmd == 0xfc) {
- // End of entire sprite
- spriteEnd = true;
- break;
- } else if (cmd == 0xff) {
- // The entire line is empty
- newLine = true;
- } else if (cmd == 0xFD) {
- // Lines contains only run lenghs of pixels
- while (x2 < w) {
- cmd = source->readByte();
- if (cmd == 0xff) {
- // End of line reached
- newLine = true;
- break;
- }
-
- byte v = source->readByte();
- while (cmd-- > 0) {
- if (x2 < w)
- *destP++ = (v == 0xFD) ? TRANSPARENT_COLOR_INDEX : v;
- ++x2;
- }
- }
- } else {
- // Line intermixes run lengths with individual pixels
- while (x2 < w) {
- cmd = source->readByte();
- if (cmd == 0xff) {
- // End of line reached
- newLine = true;
- break;
- }
-
- if (cmd == 0xFE) {
- // Handle repeated sequence
- cmd = source->readByte();
- byte v = source->readByte();
- while (cmd-- > 0) {
- if (x2 < w) {
- *destP++ = (v == 0xFD) ? TRANSPARENT_COLOR_INDEX : v;
- }
- ++x2;
- }
- } else {
- // Handle writing out single pixel
- *destP++ = (cmd == 0xFD) ? TRANSPARENT_COLOR_INDEX : cmd;
- ++x2;
- }
- }
- }
-
- // Check if we need to scan forward to find the end of the line
- if (!newLine) {
- do {
- if (source->eos()) {
- warning("M4Sprite::loadMadsSprite: unexpected end of data");
- break;
- }
- } while (source->readByte() != 0xff);
- }
- }
-
- if (!spriteEnd) {
- byte v = source->readByte();
- assert(v == 0xFC);
- }
-}
-
-byte M4Sprite::getTransparencyIndex() const {
- return TRANSPARENT_COLOR_INDEX;
-}
-
-} // End of namespace M4
diff --git a/engines/m4/sprite.h b/engines/m4/sprite.h
deleted file mode 100644
index af49d8cbaf..0000000000
--- a/engines/m4/sprite.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/* 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 M4_SPRITE_H
-#define M4_SPRITE_H
-
-#include "common/util.h"
-#include "common/endian.h"
-#include "common/stream.h"
-#include "m4/graphics.h"
-
-/*
- TODO:
- - change DrawRequestX and RendCell
-*/
-
-namespace M4 {
-
-typedef struct
-{
- int32 x; // x position relative to GrBuff(0, 0)
- int32 y; // y position relative to GrBuff(0, 0)
- int32 scale_x; // x scale factor (can be negative for reverse draw)
- int32 scale_y; // y scale factor (can't be negative)
- uint8* depth_map; // depth code array for destination (doesn't care if srcDepth is 0)
- BGR8 *Pal; // palette for shadow draw (doesn't care if SHADOW bit is not set in Src.encoding)
- uint8* ICT; // Inverse Color Table (doesn't care if SHADOW bit is not set in Src.encoding)
- uint8 depth; // depth code for source (0 if no depth processing)
-} DrawRequestX;
-
-typedef struct
-{
- uint32 Pack;
- uint32 Stream;
- long hot_x;
- long hot_y;
- uint32 Width;
- uint32 Height;
- uint32 Comp;
- uint32 Reserved[8];
- uint8* data;
-} RendCell;
-
-#define SS_HEADER_NUM_FIELDS 14
-struct SpriteSeriesHeader {
- uint32 header;
- uint32 size;
- uint32 packing;
- uint32 frameRate;
- uint32 pixSpeed;
- uint32 maxWidth;
- uint32 maxHeight;
- uint32 reserved3;
- uint32 reserved4;
- uint32 reserved5;
- uint32 reserved6;
- uint32 reserved7;
- uint32 reserved8;
- uint32 count;
-};
-
-#define SF_HEADER_NUM_FIELDS 15
-struct SpriteFrameHeader {
- uint32 pack;
- uint32 stream;
- uint32 x;
- uint32 y;
- uint32 width;
- uint32 height;
- uint32 comp;
- uint32 reserved1;
- uint32 reserved2;
- uint32 reserved3;
- uint32 reserved4;
- uint32 reserved5;
- uint32 reserved6;
- uint32 reserved7;
- uint32 reserved8;
-};
-
-class M4Sprite : public M4Surface {
-public:
- int x, y;
- int xOffset, yOffset;
- uint8 encoding;
-
- M4Sprite(MadsM4Engine *vm): M4Surface() {}
- M4Sprite(MadsM4Engine *vm, int widthVal, int heightVal): M4Surface(widthVal, heightVal), xOffset(0), yOffset(0) {}
- // Loads a sprite from the given stream, and optionally decompresses the RLE-encoded data
- M4Sprite(Common::SeekableReadStream* source, int xOfs, int yOfs, int widthVal, int heightVal, bool decodeRle = true, uint8 encodingVal = 0);
- // Loads an RLE compressed sprite; the surface must have been created before
- void loadRle(Common::SeekableReadStream* rleData);
- void loadDeltaRle(Common::SeekableReadStream* rleData, int destX, int destY);
- void loadMadsSprite(Common::SeekableReadStream* source);
-
- byte getTransparencyIndex() const;
-protected:
-};
-
-} // End of namespace M4
-
-#endif
diff --git a/engines/m4/viewmgr.cpp b/engines/m4/viewmgr.cpp
deleted file mode 100644
index 8eb40f0f17..0000000000
--- a/engines/m4/viewmgr.cpp
+++ /dev/null
@@ -1,444 +0,0 @@
-/* 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.
- *
- */
-
-// TODO: Views have a _coords rect, so I'm not sure if x/y is needed in the onRefresh
-
-#include "m4/m4.h"
-#include "m4/viewmgr.h"
-#include "m4/mads_anim.h"
-
-namespace M4 {
-
-void returnToMainMenuFn(MadsM4Engine *vm) {
- vm->_palette->resetColorCounts();
- vm->_palette->setMadsSystemPalette();
-
- vm->loadMenu(MAIN_MENU);
-}
-
-RectList::RectList() {
-}
-
-RectList::~RectList() {
-}
-
-void RectList::addRect(int x1, int y1, int x2, int y2) {
- addRect(Common::Rect(x1, y1, x2, y2));
-}
-
-void RectList::addRect(const Common::Rect &rect) {
- /* TODO:
- Implement the following:
- - Don't add the Rect if it's contained in any Rect in the list
- - Split up the Rect if it intersects any Rect in the list
- and add the resulting partial Rects instead
- */
- push_back(rect);
-}
-
-int RectList::find(const Common::Point &pt) {
- for (uint idx = 0; idx < size(); ++idx) {
- if (this->operator [](idx).contains(pt.x, pt.y))
- return idx;
- }
- return -1;
-}
-
-//--------------------------------------------------------------------------
-
-HotkeyList::HotkeyList(View *owner) : _view(owner) {
-}
-
-HotkeyList::~HotkeyList() {
- for (uint32 i = 0; i < _hotkeys.size(); i++)
- delete _hotkeys[i];
-}
-
-void HotkeyList::add(uint32 key, Hotkey::Callback callback) {
- _hotkeys.push_back(new Hotkey(key, callback));
-}
-
-void HotkeyList::remove(uint32 key) {
- for (uint32 i = 0; i < _hotkeys.size(); i++) {
- if (_hotkeys[i]->key == key) {
- delete _hotkeys[i];
- _hotkeys.remove_at(i);
- break;
- }
- }
-}
-
-bool HotkeyList::call(uint32 key) {
- for (uint32 i = 0; i < _hotkeys.size(); i++) {
- if (_hotkeys[i]->key == key) {
- if (_hotkeys[i]->callback)
- (_hotkeys[i]->callback)(_vm, _view, key);
- return true;
- }
- }
- return false;
-}
-
-//--------------------------------------------------------------------------
-
-// View constructor
-
-View::View(MadsM4Engine *vm, const Common::Rect &viewBounds, bool transparent)
- : M4Surface(viewBounds.width(), viewBounds.height()), _hotkeys(this), _vm(vm) {
- SCREEN_FLAGS_DEFAULT;
- _coords = viewBounds;
- _transparent = transparent;
-}
-
-View::View(MadsM4Engine *vm, int x, int y, bool transparent)
- : M4Surface(), _hotkeys(this), _vm(vm) {
- SCREEN_FLAGS_DEFAULT;
- _coords.left = x;
- _coords.top = y;
- _coords.right = _vm->_screen->width();
- _coords.bottom = _vm->_screen->height();
- _transparent = transparent;
-}
-
-void View::getCoordinates(Common::Rect &rect) {
- rect = _coords;
-}
-
-void View::extract(int *status) {
-}
-
-void View::show() {
- _screenFlags.visible = true;
- _vm->_viewManager->moveToFront(this);
- _vm->_viewManager->restore(_coords);
-}
-
-void View::hide() {
- _screenFlags.visible = false;
- _vm->_viewManager->restore(_coords);
-}
-
-void View::moveToBack() {
- _vm->_viewManager->moveToBack(this);
-}
-
-void View::moveAbsolute(int x, int y) {
- // TODO: Handle clipping and offscreen
- Common::Rect oldCoords = _coords;
- _coords.moveTo(x, y);
- _vm->_viewManager->restore(oldCoords);
- _vm->_viewManager->restore(_coords);
-}
-
-void View::moveRelative(int x, int y) {
- // TODO: Handle clipping and offscreen
- Common::Rect oldCoords = _coords;
- _coords.translate(x, y);
- _vm->_viewManager->restore(oldCoords);
- _vm->_viewManager->restore(_coords);
-}
-
-void View::resize(int newWidth, int newHeight) {
- Common::Rect oldCoords = _coords;
- if (newWidth >= 0)
- _coords.setWidth(newWidth);
- if (newHeight >= 0)
- _coords.setHeight(newHeight);
- _vm->_viewManager->restore(oldCoords);
- _vm->_viewManager->restore(_coords);
-}
-
-void View::restore(int x1, int y1, int x2, int y2) {
- _vm->_viewManager->restore(_coords.left + x1, _coords.top + y1, _coords.left + x2, _coords.top + y2);
-}
-
-void View::onRefresh(RectList *rects, M4Surface *destSurface) {
- assert(destSurface);
-
- if (rects == NULL)
- // No rect list specified, so copy entire surface
- copyTo(destSurface, _coords.left, _coords.top, _transparent ? 0 : -1);
- else {
- // Loop through the set of specified rectangles
- RectList::iterator i;
- for (i = rects->begin(); i != rects->end(); ++i) {
- Common::Rect &destRect = *i;
- Common::Rect srcBounds(destRect.left - _coords.left, destRect.top - _coords.top,
- destRect.right - _coords.left, destRect.bottom - _coords.top);
- copyTo(destSurface, srcBounds, destRect.left, destRect.top, _transparent ? 0 : -1);
- }
- }
-}
-
-//--------------------------------------------------------------------------
-
-ViewManager::ViewManager(MadsM4Engine *vm): _systemHotkeys(HotkeyList(NULL)), _vm(vm) {
- _captureScreen = NULL;
- _captureEvents = false;
-}
-
-ViewManager::~ViewManager() {
- // Delete any remaining active views
- ListIterator i;
- for (i = _views.begin(); i != _views.end(); ++i)
- delete (*i);
-}
-
-void ViewManager::addView(View *view) {
- _views.push_back(view);
- moveToFront(view);
-}
-
-// Warning: After calling this method, the passed view object will no longer be valid
-
-void ViewManager::deleteView(View *view) {
- _views.remove(view);
- delete view;
-}
-
-void ViewManager::handleEvents(const Common::Event &event) {
-}
-
-void ViewManager::handleKeyboardEvents(uint32 keycode) {
- Common::Point mousePos = _vm->_mouse->currentPos();
- View *view;
- bool blockedFlag;
- bool foundFlag;
- bool handledFlag;
-
- // Scan view list for one which accepts or blocks keyboard events. If one is found,
- // then the event is passed to it
-
- view = NULL;
- handledFlag = false;
- foundFlag = false;
- blockedFlag = false;
-
- // Loop from the front to back view
- ListIterator i;
- for (i = _views.reverse_begin(); (i != _views.end()) && !foundFlag; --i) {
- view = *i;
- if (!view->isVisible()) continue;
-
- if (view->screenFlags().blocks & SCREVENT_KEY)
- blockedFlag = true;
- if (view->screenFlags().get & SCREVENT_KEY) {
- foundFlag = true;
- handledFlag = (view->onEvent)(KEVENT_KEY, keycode, mousePos.x, mousePos.y, _captureEvents);
- if (_captureEvents)
- _captureScreen = view;
- }
- }
-
- // Scan view list for one with a hotkey list, aborting if a view is found that either
- // blocks keyboard events, or has a hotkey list that includes the keycode
-
- blockedFlag = false;
- for (i = _views.reverse_begin(); (i != _views.end()) && !foundFlag && !blockedFlag; --i) {
- view = *i;
- if (!view->isVisible()) continue;
-
- if (view->screenFlags().blocks & SCREVENT_KEY)
- blockedFlag = true;
- if (view->screenFlags().get & SCREVENT_KEY) {
- if (view->hotkeys().call(keycode)) {
- handledFlag = true;
- _captureEvents = false;
- //_vm->_dialogs->keyMouseCollision(); // TODO
- }
- }
- }
-
- // Final check: if no view handled or blocked the key, check against the system hotkey list
-
- if (!handledFlag && !blockedFlag) {
- handledFlag = _systemHotkeys.call(keycode);
- if (handledFlag) {
- _captureEvents = false;
- //_vm->_dialogs->keyMouseCollision(); // TODO
- }
- }
-}
-
-void ViewManager::handleMouseEvents(M4EventType event) {
- Common::Point mousePos = _vm->_mouse->currentPos();
- ListIterator i;
- View *view;
- bool blockedFlag;
- bool foundFlag;
-
- // If a window sets the _captureEvents flag to true, it will receive all events until
- // it sets it to false, even if it's not the top window
- if (_captureEvents) {
- assert(_captureScreen);
- if (_captureScreen->screenFlags().get & SCREVENT_MOUSE)
- (_captureScreen->onEvent)(event, 0, mousePos.x, mousePos.y, _captureEvents);
-
- } else {
- blockedFlag = false;
- foundFlag = false;
- view = NULL;
-
- // Loop from the front to back view
- for (i = _views.reverse_begin(); (i != _views.end()) && !foundFlag && !blockedFlag; --i) {
- view = *i;
- if (!view->isVisible()) continue;
-
- if (view->screenFlags().blocks & SCREVENT_MOUSE)
- blockedFlag = true;
- if ((view->screenFlags().get & SCREVENT_MOUSE) && view->isInside(mousePos.x, mousePos.y))
- foundFlag = true;
- }
-
- if (foundFlag)
- view->onEvent(event, 0, mousePos.x, mousePos.y, _captureEvents);
- else
- _captureEvents = false;
- if (_captureEvents)
- _captureScreen = view;
- }
-}
-
-void ViewManager::restore(int x1, int y1, int x2, int y2) {
- RectList *rl = new RectList();
- Common::Rect redrawBounds(x1, y1, x2, y2);
- rl->addRect(x1, y1, x2, y2);
-
- for (ListIterator i = _views.begin(); i != _views.end(); ++i) {
- View *v = *i;
-
- if (v->isVisible() && v->bounds().intersects(redrawBounds))
- v->onRefresh(rl, _vm->_screen);
- }
-
- _vm->_screen->update();
-
-}
-
-void ViewManager::restore(const Common::Rect &rect) {
- restore(rect.left, rect.top, rect.right, rect.bottom);
-}
-
-void ViewManager::moveToFront(View *view) {
- if (_views.size() < 2)
- return;
-
- _views.remove(view);
-
- ListIterator i = _views.begin();
- while ((i != _views.end()) && ((*i)->layer() <= view->layer()))
- ++i;
-
- _views.insert(i, view);
-}
-
-void ViewManager::moveToBack(View *view) {
- if (_views.size() < 2)
- return;
-
- _views.remove(view);
-
- ListIterator i = _views.begin();
- while ((i != _views.end()) && ((*i)->layer() < view->layer()))
- ++i;
-
- _views.insert(i, view);
-}
-
-View *ViewManager::getView(int screenType) {
- ListIterator i = _views.begin();
- while (i != _views.end()) {
- if ((*i)->screenType() == screenType)
- return *i;
- ++i;
- }
-
- return NULL;
-}
-
-void ViewManager::updateState() {
- Common::List<View *> viewList = _views;
-
- for (ListIterator i = viewList.begin(); i != viewList.end(); ++i) {
- if (_vm->_events->quitFlag)
- return;
-
- View *v = *i;
- v->updateState();
- }
-}
-
-void ViewManager::refreshAll() {
- _vm->_screen->clear();
-
- for (ListIterator i = _views.begin(); i != _views.end(); ++i) {
- View *v = *i;
-
- if (v->isVisible())
- v->onRefresh(NULL, _vm->_screen);
- }
-
- _vm->_screen->update();
-}
-
-void ViewManager::showTextView(const char *textViewName, bool returnToMainMenu) {
- // Deactivate the scene if it's currently active
- View *view = _vm->_viewManager->getView(VIEWID_SCENE);
- if (view != NULL)
- _vm->_viewManager->deleteView(view);
-
- // Deactivate the main menu if it's currently active
- view = _vm->_viewManager->getView(VIEWID_MAINMENU);
- if (view != NULL)
- _vm->_viewManager->deleteView(view);
-
- // Activate the textview view
- _vm->_font->setFont(FONT_CONVERSATION_MADS);
- TextviewView *textView = new TextviewView(_vm);
- _vm->_viewManager->addView(textView);
- if (returnToMainMenu)
- textView->setScript(textViewName, returnToMainMenuFn);
- else
- textView->setScript(textViewName, NULL);
-}
-
-void ViewManager::showAnimView(const char *animViewName, bool returnToMainMenu) {
- // Deactivate the scene if it's currently active
- View *view = _vm->_viewManager->getView(VIEWID_SCENE);
- if (view != NULL)
- _vm->_viewManager->deleteView(view);
-
- // Deactivate the main menu if it's currently active
- view = _vm->_viewManager->getView(VIEWID_MAINMENU);
- if (view != NULL)
- _vm->_viewManager->deleteView(view);
-
- // Activate the animview view
- AnimviewView *animView = new AnimviewView(_vm);
- _vm->_viewManager->addView(animView);
- if (returnToMainMenu)
- animView->setScript(animViewName, returnToMainMenuFn);
- else
- animView->setScript(animViewName, NULL);
-}
-
-} // End of namespace M4
diff --git a/engines/m4/viewmgr.h b/engines/m4/viewmgr.h
deleted file mode 100644
index bb4f76cfaa..0000000000
--- a/engines/m4/viewmgr.h
+++ /dev/null
@@ -1,204 +0,0 @@
-/* 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 M4_VIEWMGR_H
-#define M4_VIEWMGR_H
-
-#include "common/algorithm.h"
-#include "common/array.h"
-#include "common/list.h"
-#include "common/events.h"
-#include "common/rect.h"
-
-#include "m4/font.h"
-#include "m4/globals.h"
-#include "m4/events.h"
-#include "m4/graphics.h"
-
-namespace M4 {
-
-class View;
-class ViewManager;
-
-enum SceneTransition {
- kTransitionNone = 0,
- kTransitionFadeIn = 1,
- kTransitionFadeIn2 = 2,
- kTransitionBoxInBottomLeft = 3,
- kTransitionBoxInBottomRight = 4,
- kTransitionBoxInTopLeft = 5,
- kTransitionBoxInTopRight = 6,
- kTransitionPanLeftToRight = 7,
- kTransitionPanRightToLeft = 8,
- kTransitionCircleIn = 9
-};
-
-enum {SCREEN_DIALOG, SCREEN_BUFFER, SCREEN_TEXT, SCREEN_TRANSPARENT};
-enum ScreenEventType {SCREVENT_NONE = 0, SCREVENT_KEY = 1, SCREVENT_MOUSE = 2, SCREVENT_ALL = 3};
-enum ScreenLayers {
- LAYER_BACKGROUND = 0, LAYER_DRIFTER = 1, LAYER_INTERFACE = 1, LAYER_FLOATER = 2,
- LAYER_SURFACE = 3, LAYER_MENU = 9, LAYER_DIALOG = 10, LAYER_MOUSE = 15
-};
-
-enum ViewIds {
- VIEWID_MAINMENU = 1,
- VIEWID_SCENE = 2,
- VIEWID_TEXTVIEW = 3,
- VIEWID_ANIMVIEW = 4,
- VIEWID_MENU = 69,
- VIEWID_CONVERSATION = 48,
- VIEWID_INTERFACE = 49
-};
-
-struct ScreenFlags {
- bool visible:1;
- bool transparent:1;
- bool immovable:1;
-
- enum ScreenEventType blocks:2;
- enum ScreenEventType get:2;
-
- uint layer:4;
-};
-
-#define SCREEN_FLAGS_DEFAULT _screenFlags.layer = LAYER_DRIFTER; \
- _screenFlags.get = SCREVENT_ALL; _screenFlags.blocks = SCREVENT_NONE; \
- _screenFlags.visible = true;
-#define SCREEN_FLAGS_ALERT _screenFlags.layer = LAYER_FLOATER \
- _screenFlags.get = SCREVENT_ALL; _screenFlags.blocks = SCREVENT_ALL; \
- _screenFlags.visible = true;
-
-class RectList : public Common::Array<Common::Rect> {
-public:
- RectList();
- ~RectList();
- void addRect(int x1, int y1, int x2, int y2);
- void addRect(const Common::Rect &rect);
-
-// Common::Rect& operator [](int idx) { return _rects[idx]; }
- int find(const Common::Point &pt);
-};
-
-struct Hotkey {
-public:
- typedef void (*Callback)(MadsM4Engine *vm, View *view, uint32 key);
- Hotkey(uint32 keyVal, Hotkey::Callback callbackFn) : key(keyVal), callback(callbackFn) {}
- uint32 key;
- Hotkey::Callback callback;
-};
-
-class HotkeyList {
-public:
- HotkeyList(View *owner);
- ~HotkeyList();
- void add(uint32 key, Hotkey::Callback callback);
- void remove(uint32 key);
- bool call(uint32 key);
-private:
- Common::Array<Hotkey*> _hotkeys;
- View *_view;
-};
-
-class View : public M4Surface {
-public:
- View(MadsM4Engine *vm, const Common::Rect &viewBounds, bool transparent = false);
- View(MadsM4Engine *vm, int x = 0, int y = 0, bool transparent = false);
- virtual ~View() {}
-
- void getCoordinates(Common::Rect &rect);
- void extract(int *status);
- virtual void show();
- virtual void hide();
- void moveToFront() {}
- void moveToBack();
- void moveAbsolute(int x, int y);
- void moveRelative(int x, int y);
- void resize(int newWidth, int newHeight);
- void restore(int x1, int y1, int x2, int y2);
-
- Common::Rect bounds() const { return _coords; }
- bool isInside(int x, int y) const { return _coords.contains(x, y); }
- ScreenFlags screenFlags() const { return _screenFlags; }
- int screenType() const { return _screenType; }
- bool isOffscreen() const { return !_screenFlags.visible; }
- bool isTransparent() const { return _screenFlags.transparent; }
- bool isVisible() const { return _screenFlags.visible; }
- uint layer() const { return _screenFlags.layer; }
- HotkeyList &hotkeys() { return _hotkeys; }
-
- virtual void onRefresh(RectList *rects, M4Surface *destSurface);
- virtual bool onEvent(M4EventType eventType, int32 param, int x, int y, bool &captureEvents) { return false; }
- virtual void updateState() {}
-
-protected:
- MadsM4Engine *_vm;
- Common::Rect _coords;
- HotkeyList _hotkeys;
- int _screenType;
- ScreenFlags _screenFlags;
- bool _transparent;
-};
-
-class ViewManager {
-private:
- MadsM4Engine *_vm;
- HotkeyList _systemHotkeys;
- Common::List<View *> _views;
- View *_captureScreen;
- bool _captureEvents;
-public:
- typedef Common::List<View *>::iterator ListIterator;
-
- ViewManager(MadsM4Engine *vm);
- ~ViewManager();
-
- void addView(View *view);
- void deleteView(View *view);
-
- void handleEvents(const Common::Event &event);
- void handleKeyboardEvents(uint32 keycode);
- void handleMouseEvents(M4EventType event);
- void restore(int x1, int y1, int x2, int y2);
- void restore(const Common::Rect &rect);
-
- void moveToFront(View *view);
- void moveToBack(View *view);
-
- Common::List<View *> views() const { return _views; }
- bool contains(View *key) const {
- return Common::find(_views.begin(), _views.end(), key) != _views.end();
- }
- bool contains(int screenType) { return getView(screenType) != NULL; }
- View *getView(int screenType);
- int containsViews() { return !_views.empty(); }
-
- void showTextView(const char *textViewName, bool returnToMainMenu = true);
- void showAnimView(const char *animViewName, bool returnToMainMenu = true);
-
- void updateState();
- void refreshAll();
- HotkeyList &systemHotkeys() { return _systemHotkeys; }
-};
-
-}
-
-#endif
diff --git a/engines/m4/woodscript.cpp b/engines/m4/woodscript.cpp
deleted file mode 100644
index 42f4fbce98..0000000000
--- a/engines/m4/woodscript.cpp
+++ /dev/null
@@ -1,398 +0,0 @@
-/* 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 "m4/woodscript.h"
-
-#include "common/memstream.h"
-#include "graphics/palette.h"
-
-namespace M4 {
-
-// FIXME: Put in Engine/WoodScript class
-RGB8 _mainPalette[256];
-
-//Woodscript Assembler/Compiler
-
-int32 Bytecode::_dataFormats[] = {0, 5, 8, 12, 16};
-
-Bytecode::Bytecode(WoodScript *ws, byte *code, int32 codeSize, Sequence *seq) {
- _ws = ws;
- _code = new Common::MemoryReadStream(code, codeSize);
- _sequence = seq;
-}
-
-Bytecode::~Bytecode() {
- delete _code;
-}
-
-int Bytecode::loadInstruction(Instruction &instruction) {
-
- //debugCN(kDebugScript, "Bytecode::loadInstruction() ip = %08X\n", _code->pos());
-
- int32 format, data;
- uint32 code, code2;
-
- code = _code->readUint32LE();
-
- instruction.instr = (code >> 25) & 0xFF;
- instruction.argp[0] = NULL;
- instruction.argp[1] = NULL;
- instruction.argp[2] = NULL;
- instruction.argc = 0;
-
- // Maybe make this a for-loop?
-
- format = (code >> 22) & 7;
- if (format) {
- /* Load argument 1 */
- data = code & 0xFFFF;
- decodeArgument(format, data, instruction.argp[0], instruction.argv[0]);
- instruction.argc++;
- /* Load argument 2 */
- format = (code >> 19) & 7;
- if (format) {
- code2 = _code->readUint32LE();
- data = (code2 >> 16) & 0xFFFF;
- decodeArgument(format, data, instruction.argp[1], instruction.argv[1]);
- instruction.argc++;
- /* Load argument 3 */
- format = (code >> 16) & 7;
- if (format) {
- data = code2 & 0xFFFF;
- decodeArgument(format, data, instruction.argp[2], instruction.argv[2]);
- instruction.argc++;
- }
- }
- }
-
- return 0; //FIXME check if instruction size is needed by caller
-
-}
-
-void Bytecode::jumpAbsolute(int32 ofs) {
- _code->seek(ofs * 4);
- //debugCN(kDebugScript, "Bytecode::jumpAbsolute() ofs = %08X\n", _code->pos());
-}
-
-void Bytecode::jumpRelative(int32 ofs) {
- _code->seek(ofs * 4, SEEK_CUR);
-}
-
-void Bytecode::setSequence(Sequence *seq) {
- _sequence = seq;
-}
-
-void Bytecode::setCode(byte *code, int32 codeSize) {
- delete _code;
- _code = new Common::MemoryReadStream(code, codeSize);
-}
-
-Sequence *Bytecode::sequence() const {
- assert(_sequence);
- return _sequence;
-}
-
-bool Bytecode::decodeArgument(int32 format, int32 data, long *&arg, long &value) {
-
- int32 index;
-
- if (format == 1) {
- if (data & 0x8000)
- index = _sequence->indexReg();
- else
- index = data & 0x0FFF;
- switch (data & 0x7000) {
- case 0x0000:
- arg = sequence()->getParentVarPtr(index);
- value = *arg;
- break;
- case 0x1000:
- arg = sequence()->getVarPtr(index);
- value = *arg;
- break;
- case 0x2000:
- arg = sequence()->getDataPtr(index);
- value = *arg;
- break;
- }
- } else if (format == 2) {
- if (data & 0x8000)
- index = _sequence->indexReg();
- else
- index = data & 0x0FFF;
- arg = _ws->getGlobalPtr(index);
- value = *arg;
- } else {
- if (data & 0x8000) {
- value = -(data & 0x7FFF) << (_dataFormats[format - 3]);
- } else {
- value = (data & 0x7FFF) << (_dataFormats[format - 3]);
- }
- arg = &value;
- }
-
- return true;
-}
-
-WoodScript::WoodScript(MadsM4Engine *vm) {
- _vm = vm;
- _machineId = 0;
- _assets = new AssetManager(vm);
- _globals = new long[256]; //FIXME Find out how many globals there should be
- memset(_globals, 0, sizeof(long));
-
- _backgroundSurface = NULL;
-
- //Common::Rect viewBounds = Common::Rect(0, 0, 640, 480);
- //_surfaceView = new View(viewBounds);
-}
-
-WoodScript::~WoodScript() {
- delete _assets;
- delete[] _globals;
-}
-
-Sequence *WoodScript::createSequence(Machine *machine, int32 sequenceHash) {
- Sequence *sequence = new Sequence(this, machine, sequenceHash);
- _sequences.push_back(sequence);
- _layers.push_back(sequence);
- return sequence;
-}
-
-void WoodScript::runSequencePrograms() {
- // A lot TODO
- for (Common::Array<Sequence*>::iterator it = _sequences.begin(); it != _sequences.end(); ++it) {
- Sequence *sequence = *it;
- if (sequence->isActive()) {
- sequence->runProgram();
- if (sequence->isTerminated() && sequence->hasEndOfSequenceRequestPending()) {
- _endOfSequenceRequestList.push_back(sequence);
- }
- }
- }
-}
-
-void WoodScript::runEndOfSequenceRequests() {
-}
-
-void WoodScript::runTimerSequenceRequests() {
-}
-
-Machine *WoodScript::createMachine(int32 machineHash, Sequence *parentSeq,
- int32 dataHash, int32 dataRowIndex, int callbackHandler, const char *machineName) {
-
- //debugCN(kDebugScript, "WoodScript::createMachine(%d)\n", machineHash);
-
- Machine *machine = new Machine(this, machineHash, parentSeq, dataHash, dataRowIndex, callbackHandler, machineName, _machineId);
- _machineId++;
-
- _machines.push_back(machine);
-
- // goto first state for initialization
- machine->enterState();
-
- return machine;
-}
-
-int32 WoodScript::loadSeries(const char* seriesName, int32 hash, RGB8* palette) {
- return _assets->addSpriteAsset(seriesName, hash, palette);
-}
-
-void WoodScript::unloadSeries(int32 hash) {
- _assets->clearAssets(kAssetTypeCELS, hash, hash);
-}
-
-void WoodScript::setSeriesFramerate(Machine *machine, int32 frameRate) {
-}
-
-Machine *WoodScript::playSeries(const char *seriesName, long layer, uint32 flags, int32 triggerNum,
- int32 frameRate, int32 loopCount, int32 s, int32 x, int32 y,
- int32 firstFrame, int32 lastFrame) {
-
- //debugCN(kDebugScript, "WoodScript::playSeries(%s)\n", seriesName);
-
- RGB8 *palette = NULL;
- if (flags & SERIES_LOAD_PALETTE)
- palette = &_mainPalette[0];
-
- int32 spriteHash = _assets->addSpriteAsset(seriesName, -1, palette);
-
- _globals[kGlobTemp1] = (long)spriteHash << 24;
- _globals[kGlobTemp2] = layer << 16;
- _globals[kGlobTemp3] = _vm->_kernel->createTrigger(triggerNum);
- _globals[kGlobTemp4] = frameRate << 16;
- _globals[kGlobTemp5] = loopCount << 16;
- _globals[kGlobTemp6] = (s << 16) / 100;
- _globals[kGlobTemp7] = x << 16;
- _globals[kGlobTemp8] = y << 16;
- _globals[kGlobTemp9] = firstFrame << 16;
- _globals[kGlobTemp10] = lastFrame << 16;
- _globals[kGlobTemp11] = (flags & SERIES_PINGPONG) ? 0x10000 : 0;
- _globals[kGlobTemp12] = (flags & SERIES_BACKWARD) ? 0x10000 : 0;
- _globals[kGlobTemp13] = (flags & SERIES_RANDOM) ? 0x10000 : 0;
- _globals[kGlobTemp14] = (flags & SERIES_STICK) ? 0x10000 : 0;
- _globals[kGlobTemp15] = (flags & SERIES_LOOP_TRIGGER) ? 0x10000 : 0;
- _globals[kGlobTemp16] = (flags & SERIES_HORZ_FLIP) ? 0x10000 : 0;
-
- return createMachine(0, NULL, -1, -1, kCallbackTriggerDispatch, seriesName);
-
-}
-
-Machine *WoodScript::showSeries(const char *seriesName, long layer, uint32 flags, int32 triggerNum,
- int32 duration, int32 index, int32 s, int32 x, int32 y) {
-
- RGB8 *palette = NULL;
- if (flags & SERIES_LOAD_PALETTE)
- palette = &_mainPalette[0];
-
- int32 spriteHash = _assets->addSpriteAsset(seriesName, -1, palette);
-
- _globals[kGlobTemp1] = spriteHash << 24;
- _globals[kGlobTemp2] = layer << 16;
- _globals[kGlobTemp3] = _vm->_kernel->createTrigger(triggerNum);
- _globals[kGlobTemp4] = duration << 16;
- _globals[kGlobTemp5] = index << 16;
- _globals[kGlobTemp6] = (s << 16) / 100;
- _globals[kGlobTemp7] = x << 16;
- _globals[kGlobTemp8] = y << 16;
- _globals[kGlobTemp14] = (flags & SERIES_STICK) ? 0x10000 : 0;
- _globals[kGlobTemp16] = (flags & SERIES_HORZ_FLIP) ? 0x10000 : 0;
-
- return createMachine(1, NULL, -1, -1, kCallbackTriggerDispatch, seriesName);
-
-}
-
-Machine *WoodScript::streamSeries(const char *seriesName, int32 frameRate, long layer, int32 triggerNum) {
- //debugCN(kDebugScript, "WoodScript::streamSeries(%s)\n", seriesName);
- _globals[kGlobTemp1] = frameRate << 16;
- /* FIXME: Single frames from a stream series will be decompressed on-the-fly, contrary to
- "normal" sprite series, to save some memory, and since no random access to single
- frames is needed, this is ok.
- */
- _globals[kGlobTemp4] = 0; // The actual stream is opened in the Sequence
- _globals[kGlobTemp5] = 0;//TODO: kernel_trigger_create(triggerNum); // trigger
- _globals[kGlobTemp6] = layer << 16; // layer
- return createMachine(6, NULL, -1, -1, kCallbackTriggerDispatch, seriesName);
-}
-
-void WoodScript::update() {
- // TODO: Don't show hidden sequences etc.
-
- // TODO: For now, prevent any engine action if a menu is being displayed - eventually this should be
- // changed to a proper check of the engine paused variable, which the menus should set while active
- if (_vm->_viewManager->getView(VIEWID_MENU) != NULL)
- return;
-
- //TODO: Include _pauseTime
- uint32 clockTime = g_system->getMillis() / 60; // FIXME: g_system
- _globals[kGlobTimeDelta] = clockTime - _globals[kGlobTime];
- _globals[kGlobTime] += _globals[kGlobTimeDelta];
-
- runSequencePrograms();
-
- if (_backgroundSurface) {
- // FIXME: For now, copy the whole surface. Later, copy only the rectangles that need updating.
- _backgroundSurface->copyTo(_surfaceView);
- } else {
- // "This should never happen."
- _surfaceView->fillRect(Common::Rect(0, 0, 640, 480), 0);
- }
-
- {
- // FIXME: This should be done when a new palette is set
- byte palette[768];
- g_system->getPaletteManager()->grabPalette(palette, 0, 256);
- for (int i = 0; i < 256; i++) {
- _mainPalette[i].r = palette[i * 3 + 0];
- _mainPalette[i].g = palette[i * 3 + 1];
- _mainPalette[i].b = palette[i * 3 + 2];
- }
- }
-
- for (Common::Array<Sequence*>::iterator it = _layers.begin(); it != _layers.end(); ++it) {
- Sequence *sequence = *it;
-
- // TODO: Use correct clipRect etc.
- Common::Rect clipRect = Common::Rect(0, 0, 640, 480);
- Common::Rect updateRect;
-
- sequence->draw(_surfaceView, clipRect, updateRect);
-
- }
-
- // Handle end-of-sequence requests
- if (_endOfSequenceRequestList.size() > 0) {
- for (Common::Array<Sequence*>::iterator it = _endOfSequenceRequestList.begin(); it != _endOfSequenceRequestList.end(); ++it) {
- Sequence *sequence = *it;
-
- EndOfSequenceRequestItem endOfSequenceRequestItem = sequence->getEndOfSequenceRequestItem();
- sequence->getMachine()->execBlock(endOfSequenceRequestItem.codeOffset, endOfSequenceRequestItem.count);
- }
- _endOfSequenceRequestList.clear();
- }
-
-}
-
-void WoodScript::clear() {
-
- for (Common::Array<Sequence*>::iterator it = _sequences.begin(); it != _sequences.end(); ++it)
- delete *it;
- _sequences.clear();
-
- for (Common::Array<Machine*>::iterator it = _machines.begin(); it != _machines.end(); ++it)
- delete *it;
- _machines.clear();
-
- _layers.clear();
- _endOfSequenceRequestList.clear();
-
-}
-
-void WoodScript::setDepthTable(int16 *depthTable) {
- _depthTable = depthTable;
-}
-
-long *WoodScript::getGlobalPtr(int index) {
- return &_globals[index];
-}
-
-long WoodScript::getGlobal(int index) {
- return _globals[index];
-}
-
-void WoodScript::setGlobal(int index, long value) {
- _globals[index] = value;
-}
-
-void WoodScript::setBackgroundSurface(M4Surface *backgroundSurface) {
- _backgroundSurface = backgroundSurface;
-}
-
-void WoodScript::setSurfaceView(View *view) {
- _surfaceView = view;
-}
-
-RGB8 *WoodScript::getMainPalette() const {
- return _mainPalette;
-}
-
-}
diff --git a/engines/m4/woodscript.h b/engines/m4/woodscript.h
deleted file mode 100644
index 95033b9179..0000000000
--- a/engines/m4/woodscript.h
+++ /dev/null
@@ -1,348 +0,0 @@
-/* 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 M4_WOODSCRIPT_H
-#define M4_WOODSCRIPT_H
-
-#include "common/scummsys.h"
-#include "common/util.h"
-#include "common/str.h"
-#include "common/array.h"
-#include "common/stream.h"
-#include "graphics/surface.h"
-
-#include "m4/globals.h"
-#include "m4/assets.h"
-#include "m4/resource.h"
-#include "m4/sprite.h"
-#include "m4/m4.h"
-#include "m4/graphics.h"
-#include "m4/viewmgr.h"
-
-namespace M4 {
-
-class MadsM4Engine;
-class WoodScript;
-class Machine;
-class Sequence;
-class AssetManager;
-class View;
-
-struct Instruction {
- int32 instr;
- long *argp[3];
- long argv[3];
- int argc;
- // Helper method; many opcode functions can get either a defined value or a random value
- long getValue() {
- if (argc == 3)
- return _vm->imath_ranged_rand16(argv[1], argv[2]);
- else
- return argv[1];
- }
-};
-
-class Bytecode {
-public:
- Bytecode(WoodScript *ws, byte *code, int32 codeSize, Sequence *seq);
- ~Bytecode();
- int loadInstruction(Instruction &instruction);
- void jumpAbsolute(int32 ofs);
- void jumpRelative(int32 ofs);
- void setSequence(Sequence *sequence);
- void setCode(byte *code, int32 codeSize);
- Sequence *sequence() const;
- uint32 pos() const { return _code->pos() / 4; }
-protected:
- WoodScript *_ws;
- Common::SeekableReadStream *_code;
- Sequence *_sequence;
- static int32 _dataFormats[];
- bool decodeArgument(int32 format, int32 data, long *&arg, long &value);
-};
-
-struct EndOfSequenceRequestItem {
- int32 codeOffset, count;
- EndOfSequenceRequestItem() : codeOffset(-1) {}
- bool isValid() const { return codeOffset >= 0; }
-};
-
-typedef Common::Array<EndOfSequenceRequestItem> EndOfSequenceRequestList;
-
-class Sequence {
-public:
- Sequence(WoodScript *ws, Machine *machine, int32 sequenceHash);
- ~Sequence();
-
- void pause();
- void resume();
- void issueEndOfSequenceRequest(int32 codeOffset, int32 count);
- void cancelEndOfSequenceRequest();
-
- bool runProgram();
-
- bool changeProgram(int32 sequenceHash);
-
- void clearVars();
-
- long *getVarPtr(int index);
- long *getParentVarPtr(int index);
- long *getDataPtr(int index);
-
- void setActive(bool active) { _active = active; }
- bool isActive() const { return _active; }
-
- bool isTerminated() const { return _terminated; }
-
- void draw(M4Surface *surface, const Common::Rect &clipRect, Common::Rect &updateRect);
-
- bool s1_end(Instruction &instruction);
- bool s1_clearVars(Instruction &instruction);
- bool s1_set(Instruction &instruction);
- bool s1_compare(Instruction &instruction);
- bool s1_add(Instruction &instruction);
- bool s1_sub(Instruction &instruction);
- bool s1_mul(Instruction &instruction);
- bool s1_div(Instruction &instruction);
- bool s1_and(Instruction &instruction);
- bool s1_or(Instruction &instruction);
- bool s1_not(Instruction &instruction);
- bool s1_sin(Instruction &instruction);
- bool s1_cos(Instruction &instruction);
- bool s1_abs(Instruction &instruction);
- bool s1_min(Instruction &instruction);
- bool s1_max(Instruction &instruction);
- bool s1_mod(Instruction &instruction);
- bool s1_floor(Instruction &instruction);
- bool s1_round(Instruction &instruction);
- bool s1_ceil(Instruction &instruction);
- bool s1_point(Instruction &instruction);
- bool s1_dist2d(Instruction &instruction);
- bool s1_crunch(Instruction &instruction);
- bool s1_branch(Instruction &instruction);
- bool s1_setFrame(Instruction &instruction);
- bool s1_sendMessage(Instruction &instruction);
- bool s1_push(Instruction &instruction);
- bool s1_pop(Instruction &instruction);
- bool s1_jumpSub(Instruction &instruction);
- bool s1_return(Instruction &instruction);
- bool s1_getFrameCount(Instruction &instruction);
- bool s1_getFrameRate(Instruction &instruction);
- bool s1_getCelsPixSpeed(Instruction &instruction);
- bool s1_setIndex(Instruction &instruction);
- bool s1_setLayer(Instruction &instruction);
- bool s1_setDepth(Instruction &instruction);
- bool s1_setData(Instruction &instruction);
- bool s1_openStream(Instruction &instruction);
- bool s1_streamNextFrame(Instruction &instruction);
- bool s1_closeStream(Instruction &instruction);
-
- int32 indexReg() const { return _indexReg; }
-
- EndOfSequenceRequestItem getEndOfSequenceRequestItem() const { return _endOfSequenceRequest; }
- bool hasEndOfSequenceRequestPending() const { return _endOfSequenceRequest.isValid(); }
- void resetEndOfSequenceRequest() { _endOfSequenceRequest.codeOffset = -1; }
-
- Machine *getMachine() const { return _machine; }
-
-
-protected:
- WoodScript *_ws;
- Bytecode *_code;
-
- long *_vars;
- bool _active, _terminated;
- Machine *_machine;
- Sequence *_parentSequence;
- int32 _layer;
- int32 _startTime, _switchTime;
- long *_dataRow;
- int32 _localVarCount;
- int32 _cmpFlags;
-
- EndOfSequenceRequestItem _endOfSequenceRequest;
-
- int32 _indexReg;
-
- M4Sprite *_curFrame;
-
- int32 _sequenceHash;
-
- int32 _returnHashes[8]; //FIXME: Use constant instead of 8
- uint32 _returnOffsets[8];
- int32 _returnStackIndex;
-
- Common::SeekableReadStream *_stream;
- SpriteAsset *_streamSpriteAsset;
-
- bool streamOpen();
- bool streamNextFrame();
- void streamClose();
-
-};
-
-class Machine {
-public:
- Machine(WoodScript *ws, int32 machineHash, Sequence *parentSeq, int32 dataHash,
- int32 dataRowIndex, int callbackHandler, Common::String machineName, int32 id);
- ~Machine();
-
- void clearMessages();
- void clearPersistentMessages();
- void restorePersistentMessages();
- void sendMessage(uint32 messageHash, long messageValue, Machine *sender);
- void resetSwitchTime();
- bool changeSequenceProgram(int32 sequenceHash);
-
- bool searchMessages(uint32 messageHash, uint32 messageValue, Machine *sender);
- bool searchPersistentMessages(uint32 messageHash, uint32 messageValue, Machine *sender);
-
- void enterState();
- int32 execInstruction();
- void execBlock(int32 offset, int32 count);
- int32 getState() { return _currentState; }
-
- int32 getId() const { return _id; }
-
- bool m1_gotoState(Instruction &instruction);
- bool m1_jump(Instruction &instruction);
- bool m1_terminate(Instruction &instruction);
- bool m1_startSequence(Instruction &instruction);
- bool m1_pauseSequence(Instruction &instruction);
- bool m1_resumeSequence(Instruction &instruction);
- bool m1_storeValue(Instruction &instruction);
- bool m1_sendMessage(Instruction &instruction);
- bool m1_broadcastMessage(Instruction &instruction);
- bool m1_replyMessage(Instruction &instruction);
- bool m1_sendSystemMessage(Instruction &instruction);
- bool m1_createMachine(Instruction &instruction);
- bool m1_createMachineEx(Instruction &instruction);
- bool m1_clearVars(Instruction &instruction);
-
- void m1_onEndSequence(Instruction &instruction);
- void m1_onMessage(Instruction &instruction);
- void m1_switchLt(Instruction &instruction);
- void m1_switchLe(Instruction &instruction);
- void m1_switchEq(Instruction &instruction);
- void m1_switchNe(Instruction &instruction);
- void m1_switchGe(Instruction &instruction);
- void m1_switchGt(Instruction &instruction);
-
- long *dataRow() const { return _dataRow; }
- Sequence *parentSequence() const { return _parentSequence; }
- Common::String name() const { return _name; }
-
-protected:
- WoodScript *_ws;
- Bytecode *_code;
-
- Common::String _name;
- Sequence *_sequence, *_parentSequence;
- byte *_mach;
- int32 _machHash, _machineCodeOffset;
- int32 _stateCount, _stateTableOffset;
- long *_dataRow;
- int32 _id, _recursionLevel, _currentState, _targetCount;
- /* TODO:
- m->msgReplyXM = NULL;
- m->CintrMsg = CintrMsg;
- _walkPath
- _messages
- _persistentMessages
- _usedPersistentMessages
- */
-};
-
-class WoodScript {
-public:
-
- WoodScript(MadsM4Engine *vm);
- ~WoodScript();
-
- Machine *createMachine(int32 machineHash, Sequence *parentSeq, int32 dataHash, int32 dataRowIndex, int callbackHandler, const char *machineName);
- Sequence *createSequence(Machine *machine, int32 sequenceHash);
-
- void runSequencePrograms();
- void runEndOfSequenceRequests();
- void runTimerSequenceRequests();
-
- /* Series */
- // Move to own class, e.g. SeriesPlayer
- int32 loadSeries(const char* seriesName, int32 hash, RGB8* palette);
- void unloadSeries(int32 hash);
- void setSeriesFramerate(Machine *machine, int32 frameRate);
- Machine *playSeries(const char *seriesName, long layer, uint32 flags, int32 triggerNum,
- int32 frameRate, int32 loopCount, int32 s, int32 x, int32 y,
- int32 firstFrame, int32 lastFrame);
- Machine *showSeries(const char *seriesName, long layer, uint32 flags, int32 triggerNum,
- int32 duration, int32 index, int32 s, int32 x, int32 y);
- Machine *streamSeries(const char *seriesName, int32 frameRate, long layer, int32 triggerNum);
-
- void update();
- void clear();
-
- /* Misc */
- void setDepthTable(int16 *depthTable);
-
- long *getGlobalPtr(int index);
- long getGlobal(int index);
- void setGlobal(int index, long value);
-
- AssetManager *assets() const { return _assets; }
-
- // Sets the untouched, clean surface which contains the room background
- void setBackgroundSurface(M4Surface *backgroundSurface);
- // Sets the view which is used for drawing
- void setSurfaceView(View *view);
-
- RGB8 *getMainPalette() const;
-
- void setInverseColorTable(byte *inverseColorTable) { _inverseColorTable = inverseColorTable; }
- byte *getInverseColorTable() const { return _inverseColorTable; }
-
-protected:
- MadsM4Engine *_vm;
- AssetManager *_assets;
-
- Common::Array<Sequence*> _sequences, _layers;
- Common::Array<Machine*> _machines;
- int32 _machineId;
-
- long *_globals;
-
- Common::Array<Sequence*> _endOfSequenceRequestList;
-
- int32 _indexReg;
-
- /* Misc */
- int16 *_depthTable;
- byte *_inverseColorTable;
- M4Surface *_backgroundSurface;
- View *_surfaceView;
-
-};
-
-
-} // End of namespace M4
-
-
-#endif
diff --git a/engines/m4/ws_machine.cpp b/engines/m4/ws_machine.cpp
deleted file mode 100644
index 18a8af76a8..0000000000
--- a/engines/m4/ws_machine.cpp
+++ /dev/null
@@ -1,423 +0,0 @@
-/* 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 "m4/woodscript.h"
-
-namespace M4 {
-
-bool (Machine::*machineCommandsTable[])(Instruction &instruction) = {
- NULL,
- NULL,//TODO: nop
- &Machine::m1_gotoState,
- &Machine::m1_jump,
- &Machine::m1_terminate,
- &Machine::m1_startSequence,
- &Machine::m1_pauseSequence,
- &Machine::m1_resumeSequence,
- &Machine::m1_storeValue,
- &Machine::m1_sendMessage,
- &Machine::m1_broadcastMessage,
- &Machine::m1_replyMessage,
- &Machine::m1_sendSystemMessage,
- &Machine::m1_createMachine,
- &Machine::m1_createMachineEx,
- &Machine::m1_clearVars
-};
-
-void (Machine::*machineConditionalsTable[])(Instruction &instruction) = {
- NULL,//TODO: after
- &Machine::m1_onEndSequence,
- &Machine::m1_onMessage,
- NULL,//TODO: on_p_msg
- &Machine::m1_switchLt,
- &Machine::m1_switchLe,
- &Machine::m1_switchEq,
- &Machine::m1_switchNe,
- &Machine::m1_switchGe,
- &Machine::m1_switchGt,
-};
-
-Machine::Machine(WoodScript *ws, int32 machineHash, Sequence *parentSeq, int32 dataHash,
- int32 dataRowIndex, int callbackHandler, Common::String machineName, int32 id) {
-
- _ws = ws;
-
- _machHash = machineHash;
- _name = machineName;
- _id = id;
-
- // initialize the machine's bytecode
- MachineAsset *machineAsset = _ws->assets()->getMachine(_machHash);
- byte *code;
- uint32 codeSize;
- machineAsset->getCode(code, codeSize);
- _code = new Bytecode(_ws, code, codeSize, NULL);
-
- // initialize the machine's data
- if (dataHash >= 0) {
- DataAsset *dataAsset = _ws->assets()->getData(dataHash);
- _dataRow = dataAsset->getRow(dataRowIndex);
- } else {
- _dataRow = NULL;
- }
-
- _recursionLevel = 0;
- _currentState = 0;
- _sequence = NULL;
- _parentSequence = parentSeq;
- _targetCount = 0;
-
-}
-
-Machine::~Machine() {
- delete _code;
-}
-
-void Machine::clearMessages() {
-}
-
-void Machine::clearPersistentMessages() {
-}
-
-void Machine::restorePersistentMessages() {
-}
-
-void Machine::sendMessage(uint32 messageHash, long messageValue, Machine *sender) {
-}
-
-void Machine::resetSwitchTime() {
-}
-
-bool Machine::changeSequenceProgram(int32 sequenceHash) {
- return _sequence->changeProgram(sequenceHash);
-}
-
-bool Machine::searchMessages(uint32 messageHash, uint32 messageValue, Machine *sender) {
- return false;
-}
-
-bool Machine::searchPersistentMessages(uint32 messageHash, uint32 messageValue, Machine *sender) {
- return false;
-}
-
-void Machine::enterState() {
-
- MachineAsset *machineAsset = _ws->assets()->getMachine(_machHash);
-
- _code->jumpAbsolute(machineAsset->getStateOffset(_currentState));
-
- int32 instruction = -1;
-
- _recursionLevel++;
-
- int32 oldId = _id;
- int32 oldRecursionLevel = _recursionLevel;
-
- while (instruction && instruction != 4 && _id == oldId && _recursionLevel == oldRecursionLevel) {
- instruction = execInstruction();
- }
-
- if (instruction != 4 && _id == oldId && _recursionLevel == oldRecursionLevel) {
- _recursionLevel--;
- }
-
-}
-
-int32 Machine::execInstruction() {
-
- //debugCN(kDebugScript, "Machine::execInstruction()\n");
-
- bool done = false;
- Instruction instruction;
- //Sequence *sequence;
- int32 machID = _id;
-
- _code->loadInstruction(instruction);
-
- if (instruction.instr >= 64) {
- if (machineConditionalsTable[instruction.instr - 64] != 0)
- (this->*machineConditionalsTable[instruction.instr - 64])(instruction);
- /* The next line is to yield on unimplemented opcodes */
- else {
- g_system->delayMillis(5000);
- }
- } else if (instruction.instr > 0) {
- if (machineCommandsTable[instruction.instr] != 0)
- done = !(this->*machineCommandsTable[instruction.instr])(instruction);
- /* The next line is to yield on unimplemented opcodes */
- else {
- g_system->delayMillis(5000);
- }
- if (done) {
- if (_id == machID) {
- //TODO: Cancel all requests
- if (_currentState == -1) {
- // TODO: Set terminated flag and delete machine in WoodScript update
- }
- else {
- // initialize new state
- enterState();
- }
- }
- }
- }
-
- return instruction.instr;
-
-}
-
-void Machine::execBlock(int32 offset, int32 count) {
-
- // MachineAsset *machineAsset = _ws->assets()->getMachine(_machHash);
-
- int32 startOffset = offset, endOffset = offset + count;
-
- _recursionLevel++;
-
- int32 oldId = _id;
- int32 oldRecursionLevel = _recursionLevel;
-
- _code->jumpAbsolute(offset);
-
- int32 instruction = -1;
-
- //debugCN(kDebugScript, "---------------------------------------\n");
-
- while (instruction && instruction != 4 && _id == oldId && _recursionLevel == oldRecursionLevel &&
- _code->pos() >= (uint32)startOffset && _code->pos() < (uint32)endOffset) {
-
- instruction = execInstruction();
- //g_system->delayMillis(500);
- }
-
- //debugCN(kDebugScript, "---------------------------------------\n");
-
- if (instruction == 3) {
- execInstruction();
- }
-
- if (instruction != 4 && _id == oldId && _recursionLevel == oldRecursionLevel) {
- _recursionLevel--;
- }
-
-}
-
-bool Machine::m1_gotoState(Instruction &instruction) {
- //debugCN(kDebugScript, "Machine::m1_gotoState() state = %d\n", (int32)instruction.argv[0] >> 16);
-
- _currentState = (int32)instruction.argv[0] >> 16;
- _recursionLevel = 0;
- return false;
-}
-
-bool Machine::m1_jump(Instruction &instruction) {
- //debugCN(kDebugScript, "Machine::m1_jump() ofs = %08X\n", (int32)instruction.argv[0] >> 16);
-
- _code->jumpRelative((int32)instruction.argv[0] >> 16);
- return true;
-}
-
-bool Machine::m1_terminate(Instruction &instruction) {
- //debugCN(kDebugScript, "Machine::m1_terminate()\n");
-
- _currentState = -1;
- _recursionLevel = 0;
- return false;
-}
-
-bool Machine::m1_startSequence(Instruction &instruction) {
- //debugCN(kDebugScript, "Machine::m1_startSequence() sequence hash = %d\n", (uint32)instruction.argv[0] >> 16);
-
- int32 sequenceHash = instruction.argv[0] >> 16;
- if (_sequence == NULL) {
- //debugCN(kDebugScript, "Machine::m1_startSequence() creating new sequence\n");
- _sequence = _ws->createSequence(this, sequenceHash);
- _code->setSequence(_sequence);
- } else {
- //debugCN(kDebugScript, "Machine::m1_startSequence() using existing sequence\n");
- _sequence->changeProgram(sequenceHash);
- //_code->setSequence(_sequence);
- }
- return true;
-}
-
-bool Machine::m1_pauseSequence(Instruction &instruction) {
- //debugCN(kDebugScript, "Machine::m1_pauseSequence()\n");
-
- _sequence->pause();
- return true;
-}
-
-bool Machine::m1_resumeSequence(Instruction &instruction) {
- //debugCN(kDebugScript, "Machine::m1_resumeSequence()\n");
-
- _sequence->resume();
- return true;
-}
-
-bool Machine::m1_storeValue(Instruction &instruction) {
- //debugCN(kDebugScript, "Machine::m1_storeValue() %p = %d (%08X)\n", (void*)instruction.argp[0], (uint32)instruction.argv[1], (uint32)instruction.argv[1]);
-
- *instruction.argp[0] = instruction.getValue();
- return true;
-}
-
-bool Machine::m1_sendMessage(Instruction &instruction) {
- //debugCN(kDebugScript, "Machine::m1_sendMessage() %p = %d (%08X)\n", (void*)instruction.argp[0], (uint32)instruction.argv[1], (uint32)instruction.argv[1]);
-
-#if 0
-//TODO
- long messageValue;
-
- if (instruction.argc == 3) {
- messageValue = instruction.argv[2];
- } else {
- messageValue = 0;
- }
- //_ws->sendMessage((uint32)instruction.argv[1], messageValue, (uint32)instruction.argv[0] >> 16);
- //void SendWSMessage(uint32 msgHash, long msgValue, machine *recvM, uint32 machHash, machine *sendM, int32 msgCount) {
-#endif
- return true;
-
-}
-
-bool Machine::m1_broadcastMessage(Instruction &instruction) {
- //debugCN(kDebugScript, "Machine::m1_broadcastMessage() %p = %d (%08X)\n", (void*)instruction.argp[0], (uint32)instruction.argv[1], (uint32)instruction.argv[1]);
-
-#if 0
-//TODO
- long messageValue;
-
- if (instruction.argc == 3) {
- messageValue = instruction.argv[2];
- } else {
- messageValue = 0;
- }
- //_ws->sendMessage((uint32)instruction.argv[1], messageValue, (uint32)instruction.argv[0] >> 16);
-#endif
- return true;
-}
-
-bool Machine::m1_replyMessage(Instruction &instruction) {
- //debugCN(kDebugScript, "Machine::m1_replyMessage() messageHash = %d; messageValue = %d\n", (uint32)instruction.argv[0], (uint32)instruction.argv[1]);
-#if 0
- if (myArg2) {
- msgValue = *myArg2;
- }
- else {
- msgValue = 0;
- }
- SendWSMessage(*myArg1, msgValue, m->msgReplyXM, 0, m, 1);
-#endif
- return true;
-}
-
-bool Machine::m1_sendSystemMessage(Instruction &instruction) {
- //debugCN(kDebugScript, "Machine::m1_sendSystemMessage() messageValue = %d\n", (uint32)instruction.argv[0]);
-#if 0
-#endif
- return true;
-}
-
-bool Machine::m1_createMachine(Instruction &instruction) {
- //debugCN(kDebugScript, "Machine::m1_createMachine()\n");
-#if 0
-#endif
- return true;
-}
-
-bool Machine::m1_createMachineEx(Instruction &instruction) {
- //debugCN(kDebugScript, "Machine::m1_createMachineEx()\n");
-#if 0
-#endif
- return true;
-}
-
-bool Machine::m1_clearVars(Instruction &instruction) {
- //debugCN(kDebugScript, "Machine::m1_clearVars()\n");
-
- _sequence->clearVars();
- return true;
-}
-
-
-void Machine::m1_onEndSequence(Instruction &instruction) {
- //debugCN(kDebugScript, "Machine::m1_onEndSequence() count = %08X\n", (uint32)instruction.argv[0] >> 16);
-
- int32 count = instruction.argv[0] >> 16;
- _sequence->issueEndOfSequenceRequest(_code->pos(), count);
- _code->jumpRelative(count);
-}
-
-void Machine::m1_onMessage(Instruction &instruction) {
- //debugCN(kDebugScript, "Machine::m1_onEndSequence() count = %08X\n", (uint32)instruction.argv[0] >> 16);
-
- // TODO: Add message to list
-
- int32 count = instruction.argv[0] >> 16;
- _code->jumpRelative(count);
-
-}
-
-void Machine::m1_switchLt(Instruction &instruction) {
- //debugCN(kDebugScript, "Machine::m1_switchLt() %d < %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
-
- if (instruction.argv[1] >= instruction.argv[2])
- _code->jumpRelative(instruction.argv[0] >> 16);
-}
-
-void Machine::m1_switchLe(Instruction &instruction) {
- //debugCN(kDebugScript, "Machine::m1_switchLe() %d <= %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
-
- if (instruction.argv[1] > instruction.argv[2])
- _code->jumpRelative(instruction.argv[0] >> 16);
-}
-
-void Machine::m1_switchEq(Instruction &instruction) {
- //debugCN(kDebugScript, "Machine::m1_switchEq() %d == %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
-
- if (instruction.argv[1] != instruction.argv[2])
- _code->jumpRelative(instruction.argv[0] >> 16);
-}
-
-void Machine::m1_switchNe(Instruction &instruction) {
- //debugCN(kDebugScript, "Machine::m1_switchNe() %d != %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
-
- if (instruction.argv[1] == instruction.argv[2])
- _code->jumpRelative(instruction.argv[0] >> 16);
-}
-
-void Machine::m1_switchGe(Instruction &instruction) {
- //debugCN(kDebugScript, "Machine::m1_switchGe() %d >= %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
-
- if (instruction.argv[1] < instruction.argv[2])
- _code->jumpRelative(instruction.argv[0] >> 16);
-}
-
-void Machine::m1_switchGt(Instruction &instruction) {
- //debugCN(kDebugScript, "Machine::m1_switchGt() %d > %d -> %08X\n", (uint32)instruction.argv[1], (uint32)instruction.argv[2], (uint32)instruction.argv[0] >> 16);
-
- if (instruction.argv[1] <= instruction.argv[2])
- _code->jumpRelative(instruction.argv[0] >> 16);
-}
-
-}
diff --git a/engines/m4/ws_sequence.cpp b/engines/m4/ws_sequence.cpp
deleted file mode 100644
index 01776ef6ec..0000000000
--- a/engines/m4/ws_sequence.cpp
+++ /dev/null
@@ -1,768 +0,0 @@
-/* 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 "m4/woodscript.h"
-
-namespace M4 {
-
-static const long sinCosTable[320] = {
- 0, 1608, 3215, 4821, 6423, 8022, 9616, 11204,
- 12785, 14359, 15923, 17479, 19024, 20557, 22078, 23586,
- 25079, 26557, 28020, 29465, 30893, 32302, 33692, 35061,
- 36409, 37736, 39039, 40319, 41575, 42806, 44011, 45189,
- 46340, 47464, 48558, 49624, 50660, 51665, 52639, 53581,
- 54491, 55368, 56212, 57022, 57797, 58538, 59243, 59913,
- 60547, 61144, 61705, 62228, 62714, 63162, 63571, 63943,
- 64276, 64571, 64826, 65043, 65220, 65358, 65457, 65516,
- 65536, 65516, 65457, 65358, 65220, 65043, 64826, 64571,
- 64276, 63943, 63571, 63162, 62714, 62228, 61705, 61144,
- 60547, 59913, 59243, 58538, 57797, 57022, 56212, 55368,
- 54491, 53581, 52639, 51665, 50660, 49624, 48558, 47464,
- 46340, 45189, 44011, 42806, 41575, 40319, 39039, 37736,
- 36409, 35061, 33692, 32302, 30893, 29465, 28020, 26557,
- 25079, 23586, 22078, 20557, 19024, 17479, 15923, 14359,
- 12785, 11204, 9616, 8022, 6423, 4821, 3215, 1608,
- 0, -1608, -3215, -4821, -6423, -8022, -9616, -11204,
- -12785, -14359, -15923, -17479, -19024, -20557, -22078, -23586,
- -25079, -26557, -28020, -29465, -30893, -32302, -33692, -35061,
- -36409, -37736, -39039, -40319, -41575, -42806, -44011, -45189,
- -46340, -47464, -48558, -49624, -50660, -51665, -52639, -53581,
- -54491, -55368, -56212, -57022, -57797, -58538, -59243, -59913,
- -60547, -61144, -61705, -62228, -62714, -63162, -63571, -63943,
- -64276, -64571, -64826, -65043, -65220, -65358, -65457, -65516,
- -65536, -65516, -65457, -65358, -65220, -65043, -64826, -64571,
- -64276, -63943, -63571, -63162, -62714, -62228, -61705, -61144,
- -60547, -59913, -59243, -58538, -57797, -57022, -56212, -55368,
- -54491, -53581, -52639, -51665, -50660, -49624, -48558, -47464,
- -46340, -45189, -44011, -42806, -41575, -40319, -39039, -37736,
- -36409, -35061, -33692, -32302, -30893, -29465, -28020, -26557,
- -25079, -23586, -22078, -20557, -19024, -17479, -15923, -14359,
- -12785, -11204, -9616, -8022, -6423, -4821, -3215, -1608,
- 0, 1608, 3215, 4821, 6423, 8022, 9616, 11204,
- 12785, 14359, 15923, 17479, 19024, 20557, 22078, 23586,
- 25079, 26557, 28020, 29465, 30893, 32302, 33692, 35061,
- 36409, 37736, 39039, 40319, 41575, 42806, 44011, 45189,
- 46340, 47464, 48558, 49624, 50660, 51665, 52639, 53581,
- 54491, 55368, 56212, 57022, 57797, 58538, 59243, 59913,
- 60547, 61144, 61705, 62228, 62714, 63162, 63571, 63943,
- 64276, 64571, 64826, 65043, 65220, 65358, 65457, 65516
-};
-
-const long *sinTable = &(sinCosTable[0]);
-const long *cosTable = &(sinCosTable[64]);
-
-// FIXME: Tables
-
-const int sequenceVariableCount = 33;
-
-enum SequenceVariables {
- kSeqVarTimer = 0,
- kSeqVarTag = 1,
- kSeqVarLayer = 2,
- kSeqVarWidth = 3,
- kSeqVarHeight = 4,
- kSeqVarX = 5,
- kSeqVarY = 6,
- kSeqVarScale = 7,
- kSeqVarR = 8,
- kSeqVarSpriteHash = 9,
- kSeqVarSpriteFrameNumber = 10,
- kSeqVarSpriteFrameCount = 11,
- kSeqVarSpriteFrameRate = 12,
- kSeqVarSpriteFramePixelSpeed = 13,
- kSeqVarTargetS = 14,
- kSeqVarTargetR = 15,
- kSeqVarTargetX = 16,
- kSeqVarTargetY = 17,
- kSeqVarDeltaS = 18,
- kSeqVarDeltaR = 19,
- kSeqVarDeltaX = 20,
- kSeqVarDeltaY = 21,
- kSeqVarVelocity = 22,
- kSeqVarTheta = 23,
- kSeqVarTemp1 = 24,
- kSeqVarTemp2 = 25,
- kSeqVarTemp3 = 26,
- kSeqVarTemp4 = 27,
- kSeqVarTemp5 = 28,
- kSeqVarTemp6 = 29,
- kSeqVarTemp7 = 30,
- kSeqVarTemp8 = 31,
- kSeqVarMachineID = 32
-};
-
-bool (Sequence::*sequenceCommandsTable[])(Instruction &instruction) = {
- &Sequence::s1_end,
- &Sequence::s1_clearVars,
- &Sequence::s1_set,
- &Sequence::s1_compare,
- &Sequence::s1_add,
- &Sequence::s1_sub,
- &Sequence::s1_mul,
- &Sequence::s1_div,
- &Sequence::s1_and,
- &Sequence::s1_or,
- &Sequence::s1_not,
- &Sequence::s1_sin,
- &Sequence::s1_cos,
- &Sequence::s1_abs,
- &Sequence::s1_min,
- &Sequence::s1_max,
- &Sequence::s1_mod,
- &Sequence::s1_floor,
- &Sequence::s1_round,
- &Sequence::s1_ceil,
- &Sequence::s1_point,
- &Sequence::s1_dist2d,
- &Sequence::s1_crunch,
- &Sequence::s1_branch,
- &Sequence::s1_setFrame,
- &Sequence::s1_sendMessage,
- &Sequence::s1_push,
- &Sequence::s1_pop,
- &Sequence::s1_jumpSub,
- &Sequence::s1_return,
- &Sequence::s1_getFrameCount,
- &Sequence::s1_getFrameRate,
- &Sequence::s1_getCelsPixSpeed,
- &Sequence::s1_setIndex,
- &Sequence::s1_setLayer,
- &Sequence::s1_setDepth,
- &Sequence::s1_setData,
- &Sequence::s1_openStream,
- &Sequence::s1_streamNextFrame,
- &Sequence::s1_closeStream
-};
-
-Sequence::Sequence(WoodScript *ws, Machine *machine, int32 sequenceHash) {
-
- _ws = ws;
-
- SequenceAsset *sequenceAsset = _ws->assets()->getSequence(sequenceHash);
-
- // initialize the sequence's bytecode
- byte *code;
- uint32 codeSize;
- sequenceAsset->getCode(code, codeSize);
- _code = new Bytecode(_ws, code, codeSize, this);
-
- _active = true;
- _sequenceHash = sequenceHash;
- _machine = machine;
- _parentSequence = _machine->parentSequence();
- _dataRow = _machine->dataRow();
- _startTime = 0;
- _switchTime = 0;
- //TODO _flags = 0;
- _localVarCount = sequenceAsset->localVarCount();
- _vars = new long[sequenceVariableCount + _localVarCount];
- _returnStackIndex = 0;
- _layer = 0;
- _terminated = false;
-
- clearVars();
- _vars[kSeqVarMachineID] = _machine->getId();
-
-}
-
-Sequence::~Sequence() {
- delete _code;
-}
-
-void Sequence::pause() {
- _active = false;
-}
-
-void Sequence::resume() {
- _active = true;
-}
-
-void Sequence::issueEndOfSequenceRequest(int32 codeOffset, int32 count) {
-
- //debugCN(kDebugScript, "Sequence::issueEndOfSequenceRequest(%04X, %04X)\n", codeOffset, count);
- //g_system->delayMillis(5000);
-
- _endOfSequenceRequest.codeOffset = codeOffset;
- _endOfSequenceRequest.count = count;
-}
-
-void Sequence::cancelEndOfSequenceRequest() {
- _endOfSequenceRequest.codeOffset = -1;
-}
-
-bool Sequence::runProgram() {
-
- bool done = true;
-
- //debugCN(kDebugScript, "_ws->getGlobal(kGlobTime) = %ld, _switchTime = %d\n", _ws->getGlobal(kGlobTime), _switchTime);
-
- if (_switchTime >= 0 && _ws->getGlobal(kGlobTime) >= _switchTime)
- done = false;
-
- _vars[kSeqVarTimer] -= _ws->getGlobal(kGlobTimeDelta) << 16;
-
- while (!done) {
- Instruction instruction;
- _code->loadInstruction(instruction);
- if (sequenceCommandsTable[instruction.instr] != 0)
- done = !(this->*sequenceCommandsTable[instruction.instr])(instruction);
- else {
- //g_system->delayMillis(1000);
- }
- }
-
- return _terminated;
-}
-
-void Sequence::clearVars() {
- for (int i = 0; i < sequenceVariableCount + _localVarCount; i++)
- _vars[i] = 0;
- // set default scaling to 100%
- _vars[kSeqVarScale] = 0x10000;
-}
-
-bool Sequence::changeProgram(int32 sequenceHash) {
-
- SequenceAsset *sequenceAsset = _ws->assets()->getSequence(sequenceHash);
-
- if (sequenceAsset->localVarCount() > _localVarCount) {
- //debugCN(kDebugScript, "Sequence::changeProgram(%d) sequenceAsset->localVarCount() > _localVarCount\n", sequenceHash);
- return false;
- }
-
- // Initialize the sequence's bytecode
- byte *code;
- uint32 codeSize;
- sequenceAsset->getCode(code, codeSize);
- _code->setCode(code, codeSize);
-
- // Reset status variables
- _switchTime = 0;
- _active = true;
- _terminated = false;
- _endOfSequenceRequest.codeOffset = -1;
-
- _sequenceHash = sequenceHash;
- _returnStackIndex = 0;
-
- return true;
-
-}
-
-long *Sequence::getVarPtr(int index) {
- return &_vars[index];
-}
-
-long *Sequence::getParentVarPtr(int index) {
- return _parentSequence->getVarPtr(index);
-}
-
-long *Sequence::getDataPtr(int index) {
- return &_dataRow[index];
-}
-
-void Sequence::draw(M4Surface *surface, const Common::Rect &clipRect, Common::Rect &updateRect) {
-
- SpriteInfo info;
-
- info.sprite = _curFrame;
- info.hotX = _curFrame->xOffset;
- info.hotY = _curFrame->yOffset;
- info.encoding = _curFrame->encoding;
- info.inverseColorTable = _m4Vm->scene()->getInverseColorTable();
- info.palette = _ws->getMainPalette();
- info.width = _curFrame->width();
- info.height = _curFrame->height();
- int32 scaler = FixedMul(_vars[kSeqVarScale], 100 << 16) >> 16;
- info.scaleX = _vars[kSeqVarWidth] < 0 ? -scaler : scaler;
- info.scaleY = scaler;
- surface->drawSprite(_vars[kSeqVarX] >> 16, _vars[kSeqVarY] >> 16, info, clipRect);
-
-}
-
-bool Sequence::s1_end(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_end()\n");
-
- _terminated = true;
- return false;
-}
-
-bool Sequence::s1_clearVars(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_clearVars()\n");
-
- clearVars();
- _vars[kSeqVarMachineID] = _machine->getId();
- return true;
-}
-
-bool Sequence::s1_set(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_set()\n");
-
- *instruction.argp[0] = instruction.getValue();
- return true;
-}
-
-bool Sequence::s1_compare(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_compare()\n");
-
- long value = instruction.getValue();
- if (instruction.argv[0] < value)
- _cmpFlags = -1;
- else if (instruction.argv[0] > value)
- _cmpFlags = 1;
- else
- _cmpFlags = 0;
- return true;
-}
-
-bool Sequence::s1_add(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_add()\n");
-
- *instruction.argp[0] += instruction.getValue();
- return true;
-}
-
-bool Sequence::s1_sub(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_sub()\n");
-
- *instruction.argp[0] -= instruction.getValue();
- return true;
-}
-
-bool Sequence::s1_mul(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_mul()\n");
-
- *instruction.argp[0] = FixedMul(instruction.argv[0], instruction.getValue());
- return true;
-}
-
-bool Sequence::s1_div(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_div()\n");
-
- // TODO: Catch divisor = 0 in FixedDiv
- *instruction.argp[0] = FixedDiv(instruction.argv[0], instruction.getValue());
- return true;
-}
-
-bool Sequence::s1_and(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_and()\n");
-
- *instruction.argp[0] = instruction.argv[0] & instruction.getValue();
- if (*instruction.argp[0])
- _cmpFlags = 0;
- else
- _cmpFlags = 1;
- return true;
-}
-
-bool Sequence::s1_or(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_or()\n");
-
- *instruction.argp[0] = instruction.argv[0] | instruction.getValue();
- if (*instruction.argp[0])
- _cmpFlags = 0;
- else
- _cmpFlags = 1;
- return true;
-}
-
-bool Sequence::s1_not(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_not()\n");
-
- if (instruction.argv[0] == 0) {
- *instruction.argp[0] = 0x10000;
- _cmpFlags = 1;
- } else {
- *instruction.argp[0] = 0;
- _cmpFlags = 0;
- }
- return true;
-}
-
-bool Sequence::s1_sin(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_sin()\n");
-
- int32 tempAngle = *instruction.argp[1] >> 16;
- if (tempAngle < 0)
- tempAngle = 0x0100 - ((-tempAngle) & 0xff);
- else
- tempAngle &= 0xff;
-
- // FIXME: Why use the cosTable in s1_sin() ?
- // Note that sin(0) 0 and sinTable[0] = 0 but cos(0)=1, and indeed
- // cosTable[0] = 65536, which is 1 considered as a fixed point.
- *instruction.argp[0] = -cosTable[tempAngle];
-
- return true;
-}
-
-bool Sequence::s1_cos(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_cos()\n");
-
- int32 tempAngle = *instruction.argp[1] >> 16;
- if (tempAngle < 0)
- tempAngle = 0x0100 - ((-tempAngle) & 0xff);
- else
- tempAngle &= 0xff;
-
- // FIXME: Why use the sinTable in s1_cos() ?
- // Note that sin(0) 0 and sinTable[0] = 0 but cos(0)=1, and indeed
- // cosTable[0] = 65536, which is 1 considered as a fixed point.
- *instruction.argp[0] = sinTable[tempAngle];
-
- return true;
-}
-
-bool Sequence::s1_abs(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_abs()\n");
-
- *instruction.argp[0] = ABS(instruction.argv[1]);
- return true;
-}
-
-bool Sequence::s1_min(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_min()\n");
-
- *instruction.argp[0] = MIN(instruction.argv[1], instruction.argv[2]);
- return true;
-}
-
-bool Sequence::s1_max(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_max()\n");
-
- *instruction.argp[0] = MAX(instruction.argv[1], instruction.argv[2]);
- return true;
-}
-
-bool Sequence::s1_mod(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_mod()\n");
-
- *instruction.argp[0] = instruction.argv[0] % instruction.getValue();
- return true;
-}
-
-bool Sequence::s1_floor(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_floor()\n");
-
- *instruction.argp[0] = instruction.getValue() & 0xffff0000;
- return true;
-}
-
-bool Sequence::s1_round(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_round()\n");
-
- if ((*instruction.argp[1] & 0xffff) >= 0x8000)
- *instruction.argp[0] = (*instruction.argp[1] + 0x10000) & 0xffff0000;
- else
- *instruction.argp[0] = *instruction.argp[1] & 0xffff0000;
- return true;
-}
-
-bool Sequence::s1_ceil(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_ceil()\n");
-
- if ((*instruction.argp[1] & 0xffff) >= 0)
- *instruction.argp[0] = (*instruction.argp[1] + 0x10000) & 0xffff0000;
- else
- *instruction.argp[0] = *instruction.argp[1] & 0xffff0000;
- return true;
-}
-
-bool Sequence::s1_point(Instruction &instruction) {
- debugCN(kDebugScript, "Sequence::s1_point()\n");
- // TODO
- return true;
-}
-
-bool Sequence::s1_dist2d(Instruction &instruction) {
- debugCN(kDebugScript, "Sequence::s1_dist2d()\n");
- // TODO
- return true;
-}
-
-bool Sequence::s1_crunch(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_crunch()\n");
-
- long deltaTime;
-
- if (instruction.argc == 2) {
- deltaTime = _vm->imath_ranged_rand16(instruction.argv[0], instruction.argv[1]);
- } else if (instruction.argc == 1) {
- deltaTime = instruction.argv[0];
- } else {
- deltaTime = 0;
- }
-
- _startTime = _ws->getGlobal(kGlobTime);
-
- //debugCN(kDebugScript, "deltaTime = %ld\n", deltaTime >> 16);
- //g_system->delayMillis(5000);
-
- if (deltaTime >= 0) {
- _switchTime = _ws->getGlobal(kGlobTime) + (deltaTime >> 16);
- //debugCN(kDebugScript, "_ws->getGlobal(kGlobTime) = %ld\n", _ws->getGlobal(kGlobTime));
- //g_system->delayMillis(5000);
- } else {
- _switchTime = -1;
- }
-
- // TODO: Update if walking etc.
-
- return false;
-}
-
-bool Sequence::s1_branch(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_branch()\n");
-
- uint32 ofs = instruction.argv[1] >> 16;
- switch (instruction.argv[0] >> 16) {
- case 0: // jmp
- _code->jumpRelative(ofs);
- break;
- case 1: // <
- if (_cmpFlags < 0)
- _code->jumpRelative(ofs);
- break;
- case 2: // <=
- if (_cmpFlags <= 0)
- _code->jumpRelative(ofs);
- break;
- case 3: // ==
- if (_cmpFlags == 0)
- _code->jumpRelative(ofs);
- break;
- case 4: // !=
- if (_cmpFlags != 0)
- _code->jumpRelative(ofs);
- break;
- case 5: // >=
- if (_cmpFlags >= 0)
- _code->jumpRelative(ofs);
- break;
- case 6: // >
- if (_cmpFlags > 0)
- _code->jumpRelative(ofs);
- break;
- }
-
- return true;
-}
-
-bool Sequence::s1_setFrame(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_setFrame()\n");
-
- int32 frameIndex;
- if (instruction.argc == 3) {
- frameIndex = _vm->imath_ranged_rand(instruction.argv[1] >> 16, instruction.argv[2] >> 16);
- } else if (instruction.argc == 2) {
- frameIndex = instruction.argv[1] >> 16;
- } else {
- frameIndex = (instruction.argv[0] & 0xFF0000) >> 16;
- }
-
- //debugCN(kDebugScript, "Sequence::s1_setFrame() spriteHash = %d\n", (uint32)instruction.argv[0] >> 24);
- //debugCN(kDebugScript, "Sequence::s1_setFrame() frameIndex = %d\n", frameIndex);
-
- SpriteAsset *spriteAsset = _ws->assets()->getSprite((uint32)instruction.argv[0] >> 24);
- _curFrame = spriteAsset->getFrame(frameIndex);
-
- return true;
-}
-
-bool Sequence::s1_sendMessage(Instruction &instruction) {
- debugCN(kDebugScript, "Sequence::s1_sendMessage()\n");
- // TODO
- return true;
-}
-
-bool Sequence::s1_push(Instruction &instruction) {
- debugCN(kDebugScript, "Sequence::s1_push()\n");
- // TODO
- return true;
-}
-
-bool Sequence::s1_pop(Instruction &instruction) {
- debugCN(kDebugScript, "Sequence::s1_pop()\n");
- // TODO
- return true;
-}
-
-bool Sequence::s1_jumpSub(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_jumpSub()\n");
-
- _returnHashes[_returnStackIndex] = _sequenceHash;
- _returnOffsets[_returnStackIndex] = _code->pos();
- _returnStackIndex++;
-
- _sequenceHash = instruction.argv[0] >> 16;
-
- SequenceAsset *sequenceAsset = _ws->assets()->getSequence(_sequenceHash);
-
- // initialize the sequence's bytecode
- byte *code;
- uint32 codeSize;
- sequenceAsset->getCode(code, codeSize);
- _code->setCode(code, codeSize);
-
- return true;
-}
-
-bool Sequence::s1_return(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_return()\n");
-
- if (_returnStackIndex <= 0)
- return s1_end(instruction);
-
- _returnStackIndex--;
-
- _sequenceHash = _returnHashes[_returnStackIndex];
- uint32 ofs = _returnOffsets[_returnStackIndex];
-
- SequenceAsset *sequenceAsset = _ws->assets()->getSequence(_sequenceHash);
-
- // initialize the sequence's bytecode
- byte *code;
- uint32 codeSize;
- sequenceAsset->getCode(code, codeSize);
- _code->setCode(code, codeSize);
- _code->jumpAbsolute(ofs);
-
-
- return true;
-}
-
-bool Sequence::s1_getFrameCount(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_getFrameCount()\n");
-
- SpriteAsset *spriteAsset = _ws->assets()->getSprite(instruction.argv[1] >> 24);
- *instruction.argp[0] = spriteAsset->getCount() << 16;
- return true;
-}
-
-bool Sequence::s1_getFrameRate(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_getFrameRate()\n");
-
- SpriteAsset *spriteAsset = _ws->assets()->getSprite(instruction.argv[1] >> 24);
- *instruction.argp[0] = spriteAsset->getFrameRate();
- return true;
-}
-
-bool Sequence::s1_getCelsPixSpeed(Instruction &instruction) {
- debugCN(kDebugScript, "Sequence::s1_getCelsPixSpeed()\n");
- // TODO
- return true;
-}
-
-bool Sequence::s1_setIndex(Instruction &instruction) {
- debugCN(kDebugScript, "Sequence::s1_setIndex()\n");
- // TODO
- return true;
-}
-
-bool Sequence::s1_setLayer(Instruction &instruction) {
- debugCN(kDebugScript, "Sequence::s1_setLayer()\n");
- //TODO
- return true;
-}
-
-bool Sequence::s1_setDepth(Instruction &instruction) {
- debugCN(kDebugScript, "Sequence::s1_setDepth()\n");
- //TODO
- return true;
-}
-
-bool Sequence::s1_setData(Instruction &instruction) {
- debugCN(kDebugScript, "Sequence::s1_setData()\n");
- //TODO
- return true;
-}
-
-bool Sequence::s1_openStream(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_openStream()\n");
-
- _stream = _vm->res()->openFile(_machine->name().c_str());
- streamOpen();
- return true;
-}
-
-bool Sequence::s1_streamNextFrame(Instruction &instruction) {
- //debugCN(kDebugScript, "Sequence::s1_streamNextFrame()\n");
-
- streamNextFrame();
- return true;
-}
-
-bool Sequence::s1_closeStream(Instruction &instruction) {
- debugCN(kDebugScript, "Sequence::s1_closeStream()\n");
- //TODO
- return true;
-}
-
-bool Sequence::streamOpen() {
-
- _streamSpriteAsset = new SpriteAsset(_vm, _stream, _stream->size(), "stream", true);
-
- _vars[kSeqVarSpriteFrameNumber] = -0x10000;
- _vars[kSeqVarSpriteFrameCount] = _streamSpriteAsset->getCount() << 16;
- _vars[kSeqVarSpriteFrameRate] = _streamSpriteAsset->getFrameRate() << 16;
-
- //debugCN(kDebugScript, "Sequence::streamOpen() frames = %d; max = %d x %d\n", _streamSpriteAsset->getCount(), _streamSpriteAsset->getMaxFrameWidth(), _streamSpriteAsset->getMaxFrameHeight());
-
- _curFrame = new M4Sprite(_vm, _streamSpriteAsset->getMaxFrameWidth(), _streamSpriteAsset->getMaxFrameHeight());
- streamNextFrame();
-
- // TODO: Just a hack to see the series with the correct palette.
- _vm->_palette->setPalette(_streamSpriteAsset->getPalette(), 0, 256);
-
- return true;
-}
-
-bool Sequence::streamNextFrame() {
-
- _vars[kSeqVarSpriteFrameNumber] += 0x10000;
-
- int32 frameNum = _vars[kSeqVarSpriteFrameNumber] >> 16;
- if (frameNum >= _streamSpriteAsset->getCount()) {
- // End reached
- return false;
- }
-
- _streamSpriteAsset->loadStreamingFrame(_curFrame, frameNum, _vars[kSeqVarX], _vars[kSeqVarY]);
-
- _vars[kSeqVarWidth] = _curFrame->width() << 16;
- _vars[kSeqVarHeight] = _curFrame->height() << 16;
-
- return true;
-}
-
-void Sequence::streamClose() {
- _stream = NULL;
- _vm->res()->toss(_machine->name().c_str());
- //_vm->res()->purge();
- delete _streamSpriteAsset;
- delete _curFrame;
- _stream = NULL;
- _streamSpriteAsset = NULL;
- _curFrame = NULL;
-}
-
-}
diff --git a/engines/made/database.cpp b/engines/made/database.cpp
index 004f1462a6..454fe09a38 100644
--- a/engines/made/database.cpp
+++ b/engines/made/database.cpp
@@ -20,13 +20,15 @@
*
*/
-#include "common/system.h"
+#include "made/database.h"
+#include "made/redreader.h"
+
#include "common/endian.h"
-#include "common/util.h"
+#include "common/stream.h"
+#include "common/debug.h"
+#include "common/file.h"
#include "common/savefile.h"
-#include "common/textconsole.h"
-
-#include "made/database.h"
+#include "common/system.h"
namespace Made {
@@ -494,6 +496,7 @@ int16 GameDatabaseV2::savegame(const char *filename, const char *description, in
out->write(_gameState + 2, _gameStateSize - 2);
for (uint i = 0; i < _objects.size(); i++)
_objects[i]->save(*out);
+ out->finalize();
delete out;
return result;
}
@@ -697,6 +700,7 @@ int16 GameDatabaseV3::savegame(const char *filename, const char *description, in
out->writeUint16LE(version);
out->write(desc, 64);
out->write(_gameState, _gameStateSize);
+ out->finalize();
delete out;
return result;
}
diff --git a/engines/made/database.h b/engines/made/database.h
index 3bf69ca116..63f0557196 100644
--- a/engines/made/database.h
+++ b/engines/made/database.h
@@ -23,18 +23,18 @@
#ifndef MADE_DATABASE_H
#define MADE_DATABASE_H
-#include "common/array.h"
#include "common/hashmap.h"
-#include "common/util.h"
-#include "common/file.h"
-#include "common/stream.h"
-#include "common/str.h"
-#include "made/made.h"
-#include "made/redreader.h"
+namespace Common {
+class SeekableReadStream;
+class WriteStream;
+class String;
+}
namespace Made {
+class MadeEngine;
+
class Object {
public:
diff --git a/engines/made/detection.cpp b/engines/made/detection.cpp
index fa08923e44..2591e92af3 100644
--- a/engines/made/detection.cpp
+++ b/engines/made/detection.cpp
@@ -20,13 +20,9 @@
*
*/
-#include "base/plugins.h"
-
-#include "engines/advancedDetector.h"
-#include "common/file.h"
-
#include "made/made.h"
+#include "engines/advancedDetector.h"
namespace Made {
@@ -69,9 +65,6 @@ static const PlainGameDescriptor madeGames[] = {
namespace Made {
-using Common::GUIO_NONE;
-using Common::GUIO_NOSPEECH;
-
static const MadeGameDescription gameDescriptions[] = {
{
// NOTE: Return to Zork entries with *.dat are used to detect the game via rtzcd.dat,
@@ -87,7 +80,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
GID_RTZ,
0,
@@ -105,7 +98,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_RTZ,
0,
@@ -122,7 +115,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_RTZ,
0,
@@ -139,7 +132,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_RTZ,
0,
@@ -157,7 +150,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_RTZ,
0,
@@ -174,7 +167,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_RTZ,
0,
@@ -192,7 +185,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_RTZ,
0,
@@ -210,7 +203,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_RTZ,
0,
@@ -228,7 +221,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_RTZ,
0,
@@ -246,7 +239,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_RTZ,
0,
@@ -264,7 +257,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_RTZ,
0,
@@ -282,7 +275,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_RTZ,
0,
@@ -299,7 +292,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_RTZ,
0,
@@ -316,7 +309,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- GUIO_NONE
+ GUIO0()
},
GID_RTZ,
0,
@@ -334,7 +327,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::JA_JPN,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_RTZ,
0,
@@ -352,7 +345,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::JA_JPN,
Common::kPlatformFMTowns,
ADGF_CD,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GID_RTZ,
0,
@@ -370,7 +363,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::JA_JPN,
Common::kPlatformPC98,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_RTZ,
0,
@@ -387,7 +380,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_MANHOLE,
0,
@@ -404,7 +397,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_MANHOLE,
0,
@@ -421,7 +414,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_LGOP2,
0,
@@ -439,7 +432,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_LGOP2,
0,
@@ -457,7 +450,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_LGOP2,
0,
@@ -475,7 +468,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_LGOP2,
0,
@@ -492,7 +485,7 @@ static const MadeGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_RODNEY,
0,
@@ -515,7 +508,7 @@ static MadeGameDescription g_fallbackDesc = {
Common::UNK_LANG,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
0,
0,
diff --git a/engines/made/graphics.cpp b/engines/made/graphics.cpp
index 3ac73617c1..30496d8595 100644
--- a/engines/made/graphics.cpp
+++ b/engines/made/graphics.cpp
@@ -20,11 +20,14 @@
*
*/
-#include "common/debug.h"
+#include "made/graphics.h"
+
#include "common/endian.h"
#include "common/textconsole.h"
+#include "common/debug.h"
+#include "common/util.h"
-#include "made/graphics.h"
+#include "graphics/surface.h"
namespace Made {
diff --git a/engines/made/graphics.h b/engines/made/graphics.h
index 691f1127c2..15704c7792 100644
--- a/engines/made/graphics.h
+++ b/engines/made/graphics.h
@@ -23,10 +23,11 @@
#ifndef MADE_GRAPHICS_H
#define MADE_GRAPHICS_H
-#include "common/util.h"
-#include "common/file.h"
-#include "common/stream.h"
-#include "graphics/surface.h"
+#include "common/scummsys.h"
+
+namespace Graphics {
+struct Surface;
+}
namespace Made {
diff --git a/engines/made/made.cpp b/engines/made/made.cpp
index 75d39fa205..3843040961 100644
--- a/engines/made/made.cpp
+++ b/engines/made/made.cpp
@@ -20,31 +20,23 @@
*
*/
-#include "common/events.h"
-#include "common/keyboard.h"
-#include "common/config-manager.h"
-#include "common/stream.h"
-
-#include "graphics/cursorman.h"
-
-#include "engines/util.h"
-
-#include "backends/audiocd/audiocd.h"
-
-#include "base/plugins.h"
-#include "base/version.h"
-
-#include "audio/mixer.h"
-
#include "made/made.h"
-#include "made/database.h"
+#include "made/console.h"
#include "made/pmvplayer.h"
#include "made/resource.h"
#include "made/screen.h"
+#include "made/database.h"
#include "made/script.h"
-#include "made/sound.h"
#include "made/music.h"
-#include "made/redreader.h"
+
+#include "common/config-manager.h"
+#include "common/events.h"
+#include "common/system.h"
+#include "common/error.h"
+
+#include "engines/util.h"
+
+#include "backends/audiocd/audiocd.h"
namespace Made {
@@ -143,6 +135,10 @@ int16 MadeEngine::getTicks() {
return g_system->getMillis() * 30 / 1000;
}
+GUI::Debugger *MadeEngine::getDebugger() {
+ return _console;
+}
+
int16 MadeEngine::getTimer(int16 timerNum) {
if (timerNum > 0 && timerNum <= ARRAYSIZE(_timers) && _timers[timerNum - 1] != -1)
return (getTicks() - _timers[timerNum - 1]);
diff --git a/engines/made/made.h b/engines/made/made.h
index e9673eed3c..c0b86bb0a8 100644
--- a/engines/made/made.h
+++ b/engines/made/made.h
@@ -20,30 +20,14 @@
*
*/
-#ifndef MADE_H
-#define MADE_H
-
-#include "common/scummsys.h"
-#include "common/endian.h"
-#include "common/events.h"
-#include "common/file.h"
-#include "common/hash-str.h"
-#include "common/keyboard.h"
-#include "common/random.h"
-#include "common/savefile.h"
-#include "common/system.h"
-#include "common/util.h"
-
-#include "graphics/surface.h"
+#ifndef MADE_MADE_H
+#define MADE_MADE_H
-#include "audio/audiostream.h"
-#include "audio/mixer.h"
-#include "audio/decoders/voc.h"
+#include "made/sound.h"
#include "engines/engine.h"
-#include "made/sound.h"
-#include "made/console.h"
+#include "common/random.h"
/**
* This is the namespace of the Made engine.
@@ -82,6 +66,7 @@ class Screen;
class ScriptInterpreter;
class GameDatabase;
class MusicPlayer;
+class MadeConsole;
class MadeEngine : public ::Engine {
int _gameId;
@@ -98,7 +83,7 @@ public:
virtual bool hasFeature(EngineFeature f) const;
virtual void syncSoundSettings();
- GUI::Debugger *getDebugger() { return _console; }
+ virtual GUI::Debugger *getDebugger();
int getGameId() {
return _gameId;
diff --git a/engines/made/music.cpp b/engines/made/music.cpp
index 146d8d6371..04ac13eeda 100644
--- a/engines/made/music.cpp
+++ b/engines/made/music.cpp
@@ -24,11 +24,10 @@
// MIDI and digital music class
-#include "audio/audiostream.h"
-#include "audio/mididrv.h"
-#include "audio/midiparser.h"
-
#include "made/music.h"
+#include "made/resource.h"
+
+#include "audio/midiparser.h"
namespace Made {
diff --git a/engines/made/music.h b/engines/made/music.h
index 1a5bae3040..3cfbd50ce7 100644
--- a/engines/made/music.h
+++ b/engines/made/music.h
@@ -26,13 +26,11 @@
#define MADE_MUSIC_H
#include "audio/midiplayer.h"
-#include "audio/midiparser.h"
-#include "common/mutex.h"
-
-#include "made/resource.h"
namespace Made {
+class GenericResource;
+
enum MusicFlags {
MUSIC_NORMAL = 0,
MUSIC_LOOP = 1
diff --git a/engines/made/pmvplayer.cpp b/engines/made/pmvplayer.cpp
index 386d618273..6c4749f44d 100644
--- a/engines/made/pmvplayer.cpp
+++ b/engines/made/pmvplayer.cpp
@@ -21,9 +21,19 @@
*/
#include "made/pmvplayer.h"
+#include "made/made.h"
#include "made/screen.h"
+#include "made/graphics.h"
+
+#include "common/file.h"
+#include "common/debug.h"
+#include "common/system.h"
+#include "common/events.h"
#include "audio/decoders/raw.h"
+#include "audio/audiostream.h"
+
+#include "graphics/surface.h"
namespace Made {
diff --git a/engines/made/pmvplayer.h b/engines/made/pmvplayer.h
index 58b6eafd2b..3821ca8de1 100644
--- a/engines/made/pmvplayer.h
+++ b/engines/made/pmvplayer.h
@@ -23,20 +23,24 @@
#ifndef MADE_PMVPLAYER_H
#define MADE_PMVPLAYER_H
-#include "common/system.h"
-#include "common/events.h"
-#include "common/file.h"
-#include "common/endian.h"
-#include "graphics/surface.h"
#include "audio/mixer.h"
-#include "audio/audiostream.h"
-#include "made/graphics.h"
-#include "made/sound.h"
-#include "made/made.h"
+namespace Common {
+class File;
+}
+
+namespace Graphics {
+struct Surface;
+}
+
+namespace Audio {
+class QueuingAudioStream;
+}
namespace Made {
+class MadeEngine;
+
class PmvPlayer {
public:
PmvPlayer(MadeEngine *vm, Audio::Mixer *mixer);
diff --git a/engines/made/redreader.cpp b/engines/made/redreader.cpp
index a18c719110..7e92cfe71b 100644
--- a/engines/made/redreader.cpp
+++ b/engines/made/redreader.cpp
@@ -21,8 +21,9 @@
*/
#include "made/redreader.h"
+
+#include "common/file.h"
#include "common/memstream.h"
-#include "common/textconsole.h"
namespace Made {
diff --git a/engines/made/redreader.h b/engines/made/redreader.h
index 84181fb722..3025d31ce1 100644
--- a/engines/made/redreader.h
+++ b/engines/made/redreader.h
@@ -23,9 +23,12 @@
#ifndef MADE_REDREADER_H
#define MADE_REDREADER_H
-#include "common/util.h"
-#include "common/file.h"
-#include "common/stream.h"
+#include "common/scummsys.h"
+
+namespace Common {
+class SeekableReadStream;
+class File;
+}
namespace Made {
diff --git a/engines/made/resource.cpp b/engines/made/resource.cpp
index 246241561c..28fee8ce57 100644
--- a/engines/made/resource.cpp
+++ b/engines/made/resource.cpp
@@ -20,15 +20,17 @@
*
*/
-#include "common/debug.h"
-#include "common/endian.h"
-#include "common/memstream.h"
-#include "audio/mixer.h"
-#include "audio/decoders/raw.h"
-
#include "made/resource.h"
#include "made/graphics.h"
-#include "made/sound.h"
+
+#include "common/file.h"
+#include "common/memstream.h"
+#include "common/debug.h"
+
+#include "graphics/surface.h"
+
+#include "audio/decoders/raw.h"
+#include "audio/audiostream.h"
namespace Made {
diff --git a/engines/made/resource.h b/engines/made/resource.h
index 8ffebfef50..9e0a729c58 100644
--- a/engines/made/resource.h
+++ b/engines/made/resource.h
@@ -23,15 +23,23 @@
#ifndef MADE_RESOURCE_H
#define MADE_RESOURCE_H
-#include "common/util.h"
-#include "common/file.h"
-#include "common/stream.h"
+#include "made/sound.h"
+
+#include "common/endian.h"
+#include "common/array.h"
#include "common/hashmap.h"
-#include "common/textconsole.h"
-#include "graphics/surface.h"
-#include "audio/audiostream.h"
-#include "made/sound.h"
+namespace Common {
+class File;
+}
+
+namespace Audio {
+class AudioStream;
+}
+
+namespace Graphics {
+struct Surface;
+}
namespace Made {
diff --git a/engines/made/screen.cpp b/engines/made/screen.cpp
index 7a8b4603dc..168902d577 100644
--- a/engines/made/screen.cpp
+++ b/engines/made/screen.cpp
@@ -20,12 +20,16 @@
*
*/
-#include "made/made.h"
#include "made/screen.h"
-#include "made/resource.h"
+#include "made/made.h"
+#include "made/screenfx.h"
#include "made/database.h"
+#include "common/system.h"
+
+#include "graphics/surface.h"
#include "graphics/palette.h"
+#include "graphics/cursorman.h"
namespace Made {
@@ -433,15 +437,15 @@ uint16 Screen::placeSprite(uint16 channelIndex, uint16 flexIndex, int16 x, int16
PictureResource *flex = _vm->_res->getPicture(flexIndex);
if (flex) {
- Graphics::Surface *surf = flex->getPicture();
+ //Graphics::Surface *surf = flex->getPicture();
int16 state = 1;
- int16 x1, y1, x2, y2;
+ /*int16 x1, y1, x2, y2;
x1 = x;
y1 = y;
x2 = x + surf->w + 1;
- y2 = y + surf->h + 1;
+ y2 = y + surf->h + 1;*/
if (_ground == 0)
state |= 2;
@@ -481,12 +485,12 @@ uint16 Screen::placeAnim(uint16 channelIndex, uint16 animIndex, int16 x, int16 y
if (anim) {
int16 state = 1;
- int16 x1, y1, x2, y2;
+ /*int16 x1, y1, x2, y2;
x1 = x;
y1 = y;
x2 = x + anim->getWidth();
- y2 = y + anim->getHeight();
+ y2 = y + anim->getHeight();*/
if (anim->getFlags() == 1 || _ground == 0)
state |= 2;
@@ -539,7 +543,7 @@ uint16 Screen::placeText(uint16 channelIndex, uint16 textObjectIndex, int16 x, i
Object *obj = _vm->_dat->getObject(textObjectIndex);
const char *text = obj->getString();
- int16 x1, y1, x2, y2;
+ //int16 x1, y1, x2, y2;
setFont(fontNum);
@@ -553,10 +557,10 @@ uint16 Screen::placeText(uint16 channelIndex, uint16 textObjectIndex, int16 x, i
y--;
}
- x1 = x;
+ /*x1 = x;
y1 = y;
x2 = x + textWidth;
- y2 = y + textHeight;
+ y2 = y + textHeight;*/
if (textWidth > 0 && outlineColor != -1) {
x++;
diff --git a/engines/made/screen.h b/engines/made/screen.h
index 8485c1c4d7..a61ecabdce 100644
--- a/engines/made/screen.h
+++ b/engines/made/screen.h
@@ -23,15 +23,9 @@
#ifndef MADE_SCREEN_H
#define MADE_SCREEN_H
-#include "common/endian.h"
-#include "common/util.h"
-#include "common/rect.h"
-
-#include "graphics/surface.h"
-#include "graphics/cursorman.h"
-
#include "made/resource.h"
-#include "made/screenfx.h"
+
+#include "common/rect.h"
namespace Made {
@@ -56,6 +50,7 @@ struct SpriteListItem {
};
class MadeEngine;
+class ScreenEffects;
static const byte defaultMouseCursor[256] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
diff --git a/engines/made/screenfx.cpp b/engines/made/screenfx.cpp
index 77220a0ff5..ff0d393885 100644
--- a/engines/made/screenfx.cpp
+++ b/engines/made/screenfx.cpp
@@ -20,9 +20,10 @@
*
*/
-#include "made/made.h"
-#include "made/screen.h"
#include "made/screenfx.h"
+#include "made/screen.h"
+
+#include "graphics/surface.h"
namespace Made {
diff --git a/engines/made/screenfx.h b/engines/made/screenfx.h
index 6011da7d6f..1fcdd5f0d4 100644
--- a/engines/made/screenfx.h
+++ b/engines/made/screenfx.h
@@ -23,17 +23,16 @@
#ifndef MADE_SCREENFX_H
#define MADE_SCREENFX_H
-#include "common/endian.h"
-#include "common/util.h"
-#include "common/rect.h"
+#include "common/scummsys.h"
-#include "graphics/surface.h"
-
-#include "made/made.h"
-#include "made/screen.h"
+namespace Graphics {
+struct Surface;
+}
namespace Made {
+class Screen;
+
struct BlendedPaletteStatus {
bool _active;
byte *_palette, *_newPalette;
diff --git a/engines/made/script.cpp b/engines/made/script.cpp
index 2776008828..7658d20eb5 100644
--- a/engines/made/script.cpp
+++ b/engines/made/script.cpp
@@ -20,15 +20,13 @@
*
*/
-#include "common/endian.h"
-#include "common/util.h"
-
-#include "made/made.h"
#include "made/script.h"
-#include "made/database.h"
#include "made/scriptfuncs.h"
+#include "made/made.h"
+#include "made/database.h"
#include "made/screen.h"
+#include "common/util.h"
namespace Made {
diff --git a/engines/made/script.h b/engines/made/script.h
index 0a7cf8e974..f3db43485f 100644
--- a/engines/made/script.h
+++ b/engines/made/script.h
@@ -23,9 +23,6 @@
#ifndef MADE_SCRIPT_H
#define MADE_SCRIPT_H
-#include "common/util.h"
-#include "common/file.h"
-#include "common/stream.h"
#include "common/textconsole.h"
namespace Made {
diff --git a/engines/made/scriptfuncs.cpp b/engines/made/scriptfuncs.cpp
index aa172bbe74..de7b5b70f9 100644
--- a/engines/made/scriptfuncs.cpp
+++ b/engines/made/scriptfuncs.cpp
@@ -20,21 +20,19 @@
*
*/
-#include "common/util.h"
-
-#include "backends/audiocd/audiocd.h"
-#include "graphics/cursorman.h"
-#include "audio/softsynth/pcspk.h"
-
+#include "made/scriptfuncs.h"
#include "made/made.h"
-#include "made/resource.h"
-#include "made/database.h"
#include "made/screen.h"
-#include "made/script.h"
-#include "made/sound.h"
-#include "made/pmvplayer.h"
-#include "made/scriptfuncs.h"
#include "made/music.h"
+#include "made/database.h"
+#include "made/pmvplayer.h"
+
+#include "audio/softsynth/pcspk.h"
+
+#include "backends/audiocd/audiocd.h"
+
+#include "graphics/cursorman.h"
+#include "graphics/surface.h"
namespace Made {
diff --git a/engines/made/scriptfuncs.h b/engines/made/scriptfuncs.h
index 481c131248..6b3301755d 100644
--- a/engines/made/scriptfuncs.h
+++ b/engines/made/scriptfuncs.h
@@ -23,13 +23,13 @@
#ifndef MADE_SCRIPTFUNCS_H
#define MADE_SCRIPTFUNCS_H
-#include "common/util.h"
-#include "common/file.h"
-#include "common/func.h"
-#include "common/stream.h"
-
#include "made/resource.h"
+#include "audio/mixer.h"
+
+#include "common/debug.h"
+#include "common/system.h"
+
namespace Audio {
class PCSpeaker;
}
diff --git a/engines/made/sound.cpp b/engines/made/sound.cpp
index 54333eb3d4..f73c580560 100644
--- a/engines/made/sound.cpp
+++ b/engines/made/sound.cpp
@@ -20,12 +20,10 @@
*
*/
-#include "common/endian.h"
-#include "common/list.h"
-#include "common/util.h"
-
#include "made/sound.h"
+#include "common/endian.h"
+
namespace Made {
void ManholeEgaSoundDecompressor::decompress(byte *source, byte *dest, uint32 size) {
diff --git a/engines/made/sound.h b/engines/made/sound.h
index 8358d279cf..b8399fd90a 100644
--- a/engines/made/sound.h
+++ b/engines/made/sound.h
@@ -24,9 +24,6 @@
#define MADE_SOUND_H
#include "common/array.h"
-#include "common/util.h"
-#include "common/file.h"
-#include "common/stream.h"
namespace Made {
diff --git a/engines/mohawk/bitmap.cpp b/engines/mohawk/bitmap.cpp
index f61516c91d..4edde31236 100644
--- a/engines/mohawk/bitmap.cpp
+++ b/engines/mohawk/bitmap.cpp
@@ -887,7 +887,7 @@ void DOSBitmap::expandEGAPlanes(Graphics::Surface *surface, Common::SeekableRead
assert(surface->format.bytesPerPixel == 1);
// Note that the image is in EGA planar form and not just standard 4bpp
- // This seems to contradict the PoP specs which seem to do
+ // This seems to contradict the PoP specs which seem to do something else
byte *dst = (byte *)surface->pixels;
diff --git a/engines/mohawk/detection_tables.h b/engines/mohawk/detection_tables.h
index 25ca9cd916..998c2ef56d 100644
--- a/engines/mohawk/detection_tables.h
+++ b/engines/mohawk/detection_tables.h
@@ -34,7 +34,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_MYST,
0,
@@ -52,7 +52,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO | ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_MYST,
GF_DEMO,
@@ -70,7 +70,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_MYST,
0,
@@ -88,7 +88,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_MYST,
0,
@@ -106,7 +106,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_MYST,
0,
@@ -124,7 +124,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::JA_JPN,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_MYST,
0,
@@ -142,7 +142,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_MYST,
0,
@@ -160,7 +160,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_MAKINGOF,
0,
@@ -178,7 +178,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::JA_JPN,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_MAKINGOF,
0,
@@ -196,7 +196,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_MYST,
GF_ME,
@@ -214,7 +214,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_MYST,
GF_ME,
@@ -232,7 +232,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_MYST,
GF_ME,
@@ -250,7 +250,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_MYST,
GF_ME,
@@ -268,7 +268,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_RIVEN,
0,
@@ -286,7 +286,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_RIVEN,
0,
@@ -304,7 +304,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_RIVEN,
0,
@@ -322,7 +322,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_RIVEN,
GF_DVD,
@@ -340,7 +340,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_RIVEN,
GF_DVD,
@@ -358,7 +358,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_RIVEN,
GF_DVD,
@@ -376,7 +376,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO | ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_RIVEN,
GF_DEMO,
@@ -391,7 +391,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_CSTIME,
0,
@@ -406,7 +406,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO | ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_CSTIME,
GF_DEMO,
@@ -422,7 +422,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_ZOOMBINI,
GF_HASMIDI,
@@ -437,7 +437,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_ZOOMBINI,
GF_HASMIDI,
@@ -452,7 +452,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_ZOOMBINI,
GF_HASMIDI,
@@ -467,7 +467,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_ZOOMBINI,
GF_HASMIDI,
@@ -482,7 +482,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_ZOOMBINI,
GF_HASMIDI,
@@ -497,7 +497,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_CSWORLD,
0,
@@ -512,7 +512,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_CSWORLD,
0,
@@ -527,7 +527,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_CSAMTRAK,
0,
@@ -545,7 +545,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_GRB,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -563,7 +563,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -581,7 +581,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -597,7 +597,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_GRB,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -613,7 +613,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -629,7 +629,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -646,7 +646,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
0,
@@ -663,7 +663,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
0,
@@ -678,7 +678,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV5,
0,
@@ -693,7 +693,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV5,
0,
@@ -709,7 +709,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV3,
0,
@@ -724,7 +724,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV3,
0,
@@ -739,7 +739,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV3,
0,
@@ -754,7 +754,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_JAMESMATH,
GF_HASMIDI,
@@ -770,7 +770,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_JAMESMATH,
GF_HASMIDI,
@@ -785,7 +785,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_TREEHOUSE,
GF_HASMIDI,
@@ -800,7 +800,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV3,
0,
@@ -816,7 +816,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV3,
0,
@@ -831,7 +831,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV3,
0,
@@ -846,7 +846,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -862,7 +862,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -877,7 +877,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -892,7 +892,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
GF_DEMO,
@@ -907,7 +907,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_1STDEGREE,
GF_HASMIDI,
@@ -925,7 +925,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_1STDEGREE,
GF_HASMIDI,
@@ -940,7 +940,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_CSUSA,
0,
@@ -955,7 +955,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
0,
@@ -972,7 +972,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
0,
@@ -988,7 +988,23 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_GRB,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_LIVINGBOOKSV2,
+ 0,
+ 0,
+ },
+
+ // From Torsten in bug#3422652
+ {
+ {
+ "tortoise",
+ "",
+ AD_ENTRY1("TORTB.LB", "9a80b66e7d95c7f59bdfd2c280e03e6e"),
+ Common::EN_GRB,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -1004,7 +1020,23 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_LIVINGBOOKSV2,
+ 0,
+ 0,
+ },
+
+ // From Torsten in bug#3422652
+ {
+ {
+ "tortoise",
+ "",
+ AD_ENTRY1("TORTD.LB", "5d4d830116fe965ee35e328db85743b7"),
+ Common::DE_DEU,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -1020,7 +1052,23 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_LIVINGBOOKSV2,
+ 0,
+ 0,
+ },
+
+ // From Torsten in bug#3422652
+ {
+ {
+ "tortoise",
+ "",
+ AD_ENTRY1("TORTF.LB", "89f23bc3a1d1797bfe07dd0eaa7c13c4"),
+ Common::FR_FRA,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -1035,7 +1083,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO,
@@ -1050,7 +1098,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO,
@@ -1066,7 +1114,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO,
@@ -1081,7 +1129,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO,
@@ -1096,7 +1144,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_LB_10,
@@ -1113,7 +1161,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_LB_10,
@@ -1129,7 +1177,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_LB_10,
@@ -1145,7 +1193,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_LB_10,
@@ -1160,7 +1208,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO | GF_LB_10,
@@ -1175,7 +1223,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO,
@@ -1191,7 +1239,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO,
@@ -1206,7 +1254,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO | GF_LB_10,
@@ -1221,7 +1269,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO,
@@ -1238,7 +1286,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV3,
0,
@@ -1255,7 +1303,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_LB_10,
@@ -1271,13 +1319,61 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_LB_10,
"GRANDMA.EXE"
},
+ // From Torsten in bug#3422652
+ {
+ {
+ "grandma",
+ "",
+ AD_ENTRY1("JGMB.LB", "400b68a6f23b88ca23a01cfd11c6ef9f"),
+ Common::EN_GRB,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_LIVINGBOOKSV2,
+ 0,
+ 0,
+ },
+
+ // From Torsten in bug#3422652
+ {
+ {
+ "grandma",
+ "",
+ AD_ENTRY1("JGMD.LB", "c4fbfd73f805a2266cf9e15caa1b7462"),
+ Common::DE_DEU,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_LIVINGBOOKSV2,
+ 0,
+ 0,
+ },
+
+ // From Torsten in bug#3422652
+ {
+ {
+ "grandma",
+ "",
+ AD_ENTRY1("JGMF.LB", "0c3305e109a027f8b62a6bd8c5d2addb"),
+ Common::FR_FRA,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_LIVINGBOOKSV2,
+ 0,
+ 0,
+ },
+
{
{
"grandma",
@@ -1286,7 +1382,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO | GF_LB_10,
@@ -1301,7 +1397,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO,
@@ -1317,7 +1413,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO,
@@ -1332,7 +1428,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO | GF_LB_10,
@@ -1347,7 +1443,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO,
@@ -1364,7 +1460,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
0,
@@ -1380,7 +1476,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
0,
@@ -1395,7 +1491,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO,
@@ -1411,7 +1507,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO,
@@ -1426,7 +1522,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO,
@@ -1442,7 +1538,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
0,
@@ -1459,7 +1555,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
0,
@@ -1475,7 +1571,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
0,
@@ -1490,7 +1586,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO,
@@ -1505,7 +1601,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO,
@@ -1521,7 +1617,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO,
@@ -1536,7 +1632,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO,
@@ -1551,7 +1647,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV3,
0,
@@ -1567,7 +1663,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV3,
0,
@@ -1582,7 +1678,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV3,
0,
@@ -1598,7 +1694,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
0,
@@ -1614,13 +1710,61 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
0,
"Living Books Player"
},
+ // From Torsten in bug#3422652
+ {
+ {
+ "arthurbday",
+ "",
+ AD_ENTRY1("AB16B.LB", "54223967c507a48e572902802650412f"),
+ Common::EN_GRB,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_LIVINGBOOKSV2,
+ 0,
+ 0,
+ },
+
+ // From Torsten in bug#3422652
+ {
+ {
+ "arthurbday",
+ "",
+ AD_ENTRY1("AB16D.LB", "1154bfdb9fe8c42ad8692e68071ec175"),
+ Common::DE_DEU,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_LIVINGBOOKSV2,
+ 0,
+ 0,
+ },
+
+ // From Torsten in bug#3422652
+ {
+ {
+ "arthurbday",
+ "",
+ AD_ENTRY1("AB16F.LB", "60f439aa56c22a400bda27c9574115a9"),
+ Common::FR_FRA,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GType_LIVINGBOOKSV2,
+ 0,
+ 0,
+ },
+
// Arthur Birthday (English) Version 2.0 Windows(R) August 8, 1997
// From jacecen in bug #3413119
{
@@ -1631,7 +1775,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV3,
0,
@@ -1646,7 +1790,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO,
@@ -1662,7 +1806,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO,
@@ -1677,7 +1821,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO,
@@ -1692,7 +1836,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
0,
@@ -1707,7 +1851,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
0,
@@ -1723,7 +1867,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_GRB,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -1739,7 +1883,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -1755,7 +1899,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -1771,7 +1915,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_GRB,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -1787,7 +1931,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -1803,7 +1947,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -1819,7 +1963,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
GF_DEMO,
@@ -1834,7 +1978,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV3,
0,
@@ -1849,7 +1993,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV3,
0,
@@ -1864,7 +2008,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV4,
0,
@@ -1879,7 +2023,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV4,
0,
@@ -1897,7 +2041,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV4,
0,
@@ -1912,7 +2056,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
0,
@@ -1927,7 +2071,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
0,
@@ -1942,7 +2086,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -1958,7 +2102,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
0,
@@ -1973,7 +2117,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV3,
0,
@@ -1988,7 +2132,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV3,
0,
@@ -2003,7 +2147,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
0,
@@ -2020,7 +2164,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
0,
@@ -2035,7 +2179,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV1,
0,
@@ -2051,7 +2195,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV3,
0,
@@ -2068,7 +2212,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV3,
0,
@@ -2084,7 +2228,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV3,
0,
@@ -2099,7 +2243,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV4,
0,
@@ -2114,7 +2258,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV4,
0,
@@ -2131,7 +2275,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -2147,7 +2291,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -2163,7 +2307,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -2180,7 +2324,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -2196,7 +2340,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -2212,7 +2356,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_GRB,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -2228,7 +2372,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -2244,7 +2388,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -2260,7 +2404,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::EN_GRB,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -2276,7 +2420,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -2292,7 +2436,7 @@ static const MohawkGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_LIVINGBOOKSV2,
0,
@@ -2315,7 +2459,7 @@ static const MohawkGameDescription fallbackDescs[] = {
Common::UNK_LANG,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_MYST,
0,
@@ -2330,7 +2474,7 @@ static const MohawkGameDescription fallbackDescs[] = {
Common::UNK_LANG,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_MAKINGOF,
0,
@@ -2345,7 +2489,7 @@ static const MohawkGameDescription fallbackDescs[] = {
Common::UNK_LANG,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_MYST,
GF_ME,
@@ -2360,7 +2504,7 @@ static const MohawkGameDescription fallbackDescs[] = {
Common::UNK_LANG,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_RIVEN,
0,
@@ -2375,7 +2519,7 @@ static const MohawkGameDescription fallbackDescs[] = {
Common::UNK_LANG,
Common::kPlatformWindows,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GType_RIVEN,
GF_DVD,
diff --git a/engines/mohawk/graphics.cpp b/engines/mohawk/graphics.cpp
index c4326d175f..dcb0c7940d 100644
--- a/engines/mohawk/graphics.cpp
+++ b/engines/mohawk/graphics.cpp
@@ -308,16 +308,19 @@ MystGraphics::~MystGraphics() {
delete _backBuffer;
}
-static const char* picFileNames[] = {
+static const char *s_picFileNames[] = {
"CHpics",
"",
+ "",
"DUpics",
"INpics",
+ "",
"MEpics",
"MYpics",
"SEpics",
- "STpics",
- ""
+ "",
+ "",
+ "STpics"
};
void MystGraphics::loadExternalPictureFile(uint16 stack) {
@@ -328,11 +331,11 @@ void MystGraphics::loadExternalPictureFile(uint16 stack) {
_pictureFile.picFile.close();
delete[] _pictureFile.entries;
- if (!scumm_stricmp(picFileNames[stack], ""))
+ if (!scumm_stricmp(s_picFileNames[stack], ""))
return;
- if (!_pictureFile.picFile.open(picFileNames[stack]))
- error ("Could not open external picture file \'%s\'", picFileNames[stack]);
+ if (!_pictureFile.picFile.open(s_picFileNames[stack]))
+ error ("Could not open external picture file \'%s\'", s_picFileNames[stack]);
_pictureFile.pictureCount = _pictureFile.picFile.readUint32BE();
_pictureFile.entries = new PictureFile::PictureEntry[_pictureFile.pictureCount];
diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index 65073bd970..08f3b86c7c 100644
--- a/engines/mohawk/livingbooks.cpp
+++ b/engines/mohawk/livingbooks.cpp
@@ -102,6 +102,14 @@ void LBPage::open(Archive *mhk, uint16 baseId) {
for (uint32 i = 0; i < _items.size(); i++)
_items[i]->init();
+
+ for (uint32 i = 0; i < _items.size(); i++)
+ _items[i]->startPhase(kLBPhaseLoad);
+}
+
+void LBPage::addClonedItem(LBItem *item) {
+ _vm->addItem(item);
+ _items.push_back(item);
}
void LBPage::itemDestroyed(LBItem *item) {
@@ -138,8 +146,12 @@ MohawkEngine_LivingBooks::MohawkEngine_LivingBooks(OSystem *syst, const MohawkGa
const Common::FSNode gameDataDir(ConfMan.get("path"));
// Rugrats
- SearchMan.addSubDirectoryMatching(gameDataDir, "program");
- SearchMan.addSubDirectoryMatching(gameDataDir, "Rugrats Adventure Game");
+ const Common::FSNode ProgPath = gameDataDir.getChild("program");
+ if (ProgPath.exists())
+ SearchMan.addDirectory(ProgPath.getPath(), ProgPath, 0, 2);
+ const Common::FSNode RugPath = gameDataDir.getChild("Rugrats Adventure Game");
+ if (RugPath.exists())
+ SearchMan.addDirectory(RugPath.getPath(), RugPath, 0, 2);
// CarmenTQ
const Common::FSNode CTQPath = gameDataDir.getChild("95instal");
if (CTQPath.exists())
@@ -304,8 +316,9 @@ void MohawkEngine_LivingBooks::loadBookInfo(const Common::String &filename) {
const Common::ConfigFile::SectionKeyList globals = _bookInfoFile.getKeys("Globals");
for (Common::ConfigFile::SectionKeyList::const_iterator i = globals.begin(); i != globals.end(); i++) {
Common::String command = Common::String::format("%s = %s", i->key.c_str(), i->value.c_str());
- debug("global: %s", command.c_str());
- // TODO: run command
+ LBCode tempCode(this, 0);
+ uint offset = tempCode.parseCode(command);
+ tempCode.runCode(NULL, offset);
}
}
}
@@ -436,12 +449,9 @@ bool MohawkEngine_LivingBooks::loadPage(LBMode mode, uint page, uint subpage) {
void MohawkEngine_LivingBooks::updatePage() {
switch (_phase) {
- case 0:
- for (uint32 i = 0; i < _items.size(); i++)
- _items[i]->startPhase(0xFFFE);
-
+ case kLBPhaseInit:
for (uint32 i = 0; i < _items.size(); i++)
- _items[i]->startPhase(0xFFFF);
+ _items[i]->startPhase(kLBPhaseCreate);
for (uint32 i = 0; i < _items.size(); i++)
_items[i]->startPhase(_phase);
@@ -537,7 +547,7 @@ void MohawkEngine_LivingBooks::updatePage() {
_phase++;
break;
- case 1:
+ case kLBPhaseIntro:
for (uint32 i = 0; i < _items.size(); i++)
_items[i]->startPhase(_phase);
@@ -550,7 +560,7 @@ void MohawkEngine_LivingBooks::updatePage() {
_phase++;
break;
- case 2:
+ case kLBPhaseMain:
if (!_introDone)
break;
@@ -593,8 +603,8 @@ void MohawkEngine_LivingBooks::updatePage() {
_items[i]->update();
if (_needsRedraw) {
- for (uint16 i = 0; i < _items.size(); i++)
- _items[i]->draw();
+ for (Common::List<LBItem *>::const_iterator i = _orderedItems.reverse_begin(); i != _orderedItems.end(); --i)
+ (*i)->draw();
_needsRedraw = false;
_needsUpdate = true;
@@ -1854,6 +1864,35 @@ void LBAnimation::seek(uint16 pos) {
}
}
+void LBAnimation::seekToTime(uint32 time) {
+ _lastTime = 0;
+ _currentFrame = 0;
+
+ if (_currentSound != 0xffff) {
+ _vm->_sound->stopSound(_currentSound);
+ _currentSound = 0xffff;
+ }
+
+ for (uint32 i = 0; i < _nodes.size(); i++)
+ _nodes[i]->reset();
+
+ uint32 elapsed = 0;
+ while (elapsed <= time) {
+ bool ranSomething = false;
+ // nodes don't wait while seeking
+ for (uint32 i = 0; i < _nodes.size(); i++)
+ ranSomething |= (_nodes[i]->update(true) != kLBNodeDone);
+
+ elapsed += _tempo;
+ _currentFrame++;
+
+ if (!ranSomething) {
+ _running = false;
+ break;
+ }
+ }
+}
+
void LBAnimation::stop() {
_running = false;
if (_currentSound != 0xffff) {
@@ -1920,7 +1959,10 @@ LBScriptEntry::~LBScriptEntry() {
}
LBItem::LBItem(MohawkEngine_LivingBooks *vm, LBPage *page, Common::Rect rect) : _vm(vm), _page(page), _rect(rect) {
- _phase = 0;
+ if (_vm->getGameType() == GType_LIVINGBOOKSV1 || _vm->getGameType() == GType_LIVINGBOOKSV2)
+ _phase = kLBPhaseInit;
+ else
+ _phase = kLBPhaseLoad;
_loopMode = 0;
_delayMin = 0;
@@ -1931,7 +1973,7 @@ LBItem::LBItem(MohawkEngine_LivingBooks *vm, LBPage *page, Common::Rect rect) :
_controlMode = kLBControlNone;
_soundMode = 0;
- _neverEnabled = true;
+ _loaded = false;
_enabled = false;
_visible = true;
_playing = false;
@@ -2338,6 +2380,22 @@ void LBItem::readData(uint16 type, uint16 size, Common::MemoryReadStreamEndian *
}
break;
+ case kLBSetRolloverData:
+ {
+ assert(size == 2);
+ uint16 flag = stream->readUint16();
+ warning("ignoring kLBSetRolloverData: item %s, flag %d", _desc.c_str(), flag);
+ }
+ break;
+
+ case kLBSetParent:
+ {
+ assert(size == 2);
+ uint16 parent = stream->readUint16();
+ warning("ignoring kLBSetParent: item %s, parent id %d", _desc.c_str(), parent);
+ }
+ break;
+
case kLBUnknown194:
{
assert(size == 4);
@@ -2365,25 +2423,27 @@ void LBItem::destroySelf() {
}
void LBItem::setEnabled(bool enabled) {
- if (enabled && _neverEnabled && !_playing) {
+ if (enabled && !_loaded && !_playing) {
if (_timingMode == kLBAutoUserIdle) {
setNextTime(_periodMin, _periodMax);
debug(2, "Enable time startup");
}
}
- _neverEnabled = false;
_enabled = enabled;
}
void LBItem::setGlobalEnabled(bool enabled) {
- bool wasEnabled = !_neverEnabled && _enabled && _globalEnabled;
+ bool wasEnabled = _loaded && _enabled && _globalEnabled;
_globalEnabled = enabled;
- if (wasEnabled != (!_neverEnabled && _enabled && _globalEnabled))
+ if (wasEnabled != (_loaded && _enabled && _globalEnabled))
setEnabled(enabled);
}
bool LBItem::contains(Common::Point point) {
+ if (!_loaded)
+ return false;
+
if (_playing && _loopMode == 0xFFFF)
stop();
@@ -2394,7 +2454,7 @@ bool LBItem::contains(Common::Point point) {
}
void LBItem::update() {
- if (_phase != 0x7FFF && (_neverEnabled || !_enabled || !_globalEnabled))
+ if (_phase != kLBPhaseNone && (!_loaded || !_enabled || !_globalEnabled))
return;
if (_nextTime == 0 || _nextTime > (uint32)(_vm->_system->getMillis() / 16))
@@ -2409,7 +2469,7 @@ void LBItem::update() {
}
void LBItem::handleMouseDown(Common::Point pos) {
- if (_neverEnabled || !_enabled || !_globalEnabled)
+ if (!_loaded || !_enabled || !_globalEnabled)
return;
_vm->setFocus(this);
@@ -2432,7 +2492,7 @@ bool LBItem::togglePlaying(bool playing, bool restart) {
_vm->queueDelayedEvent(DelayedEvent(this, kLBDelayedEventDone));
return true;
}
- if (((!_neverEnabled && _enabled && _globalEnabled) || _phase == 0x7FFF) && !_playing) {
+ if (((_loaded && _enabled && _globalEnabled) || _phase == kLBPhaseNone) && !_playing) {
_playing = togglePlaying(true, restart);
if (_playing) {
_nextTime = 0;
@@ -2501,6 +2561,10 @@ void LBItem::done(bool onlyNotify) {
notify(0xFFFF, _itemId);
}
+void LBItem::init() {
+ runScript(kLBEventInit);
+}
+
void LBItem::setVisible(bool visible) {
if (visible == _visible)
return;
@@ -2517,38 +2581,40 @@ void LBItem::setGlobalVisible(bool visible) {
}
void LBItem::startPhase(uint phase) {
- if (_phase == phase)
- setEnabled(true);
+ if (_phase == phase) {
+ if (_phase != kLBPhaseNone) {
+ setEnabled(true);
+ }
+
+ load();
+ }
switch (phase) {
- case 0xFFFE:
- if (_timingMode == kLBAutoLoad) {
- debug(2, "Phase load: time startup");
- setNextTime(_periodMin, _periodMax);
- }
+ case kLBPhaseLoad:
+ runScript(kLBEventListLoad);
break;
- case 0xFFFF:
+ case kLBPhaseCreate:
runScript(kLBEventPhaseCreate);
if (_timingMode == kLBAutoCreate) {
debug(2, "Phase create: time startup");
setNextTime(_periodMin, _periodMax);
}
break;
- case 0:
+ case kLBPhaseInit:
runScript(kLBEventPhaseInit);
if (_timingMode == kLBAutoInit) {
debug(2, "Phase init: time startup");
setNextTime(_periodMin, _periodMax);
}
break;
- case 1:
+ case kLBPhaseIntro:
runScript(kLBEventPhaseIntro);
if (_timingMode == kLBAutoIntro || _timingMode == kLBAutoUserIdle) {
debug(2, "Phase intro: time startup");
setNextTime(_periodMin, _periodMax);
}
break;
- case 2:
+ case kLBPhaseMain:
runScript(kLBEventPhaseMain);
if (_timingMode == kLBAutoUserIdle || _timingMode == kLBAutoMain) {
debug(2, "Phase main: time startup");
@@ -2579,6 +2645,54 @@ void LBItem::notify(uint16 data, uint16 from) {
runScript(kLBEventNotified, data, from);
}
+void LBItem::load() {
+ if (_loaded)
+ return;
+
+ _loaded = true;
+
+ // FIXME: events etc
+ if (_timingMode == kLBAutoLoad) {
+ debug(2, "Load: time startup");
+ setNextTime(_periodMin, _periodMax);
+ }
+}
+
+void LBItem::unload() {
+ if (!_loaded)
+ return;
+
+ _loaded = false;
+
+ // FIXME: stuff
+}
+
+void LBItem::moveBy(const Common::Point &pos) {
+ _rect.translate(pos.x, pos.y);
+}
+
+void LBItem::moveTo(const Common::Point &pos) {
+ _rect.moveTo(pos);
+}
+
+LBItem *LBItem::clone(uint16 newId, const Common::String &newName) {
+ LBItem *item = createClone();
+
+ item->_itemId = newId;
+ item->_desc = newName;
+
+ item->_resourceId = _resourceId;
+ // FIXME: the rest
+
+ _page->addClonedItem(item);
+ // FIXME: zorder?
+ return item;
+}
+
+LBItem *LBItem::createClone() {
+ return new LBItem(_vm, _page, _rect);
+}
+
void LBItem::runScript(uint event, uint16 data, uint16 from) {
for (uint i = 0; i < _scriptEntries.size(); i++) {
LBScriptEntry *entry = _scriptEntries[i];
@@ -2819,9 +2933,7 @@ int LBItem::runScriptEntry(LBScriptEntry *entry) {
break;
case kLBOpLoad:
- // FIXME
- warning("ignoring kLBOpLoad (event 0x%04x, param 0x%04x, target '%s')",
- entry->event, entry->param, target->_desc.c_str());
+ target->load();
break;
case kLBOpPreload:
@@ -2831,9 +2943,7 @@ int LBItem::runScriptEntry(LBScriptEntry *entry) {
break;
case kLBOpUnload:
- // FIXME
- warning("ignoring kLBOpUnload (event 0x%04x, param 0x%04x, target '%s')",
- entry->event, entry->param, target->_desc.c_str());
+ target->unload();
break;
case kLBOpSeekToPrev:
@@ -2882,6 +2992,7 @@ int LBItem::runScriptEntry(LBScriptEntry *entry) {
case kLBOpBreakExpression:
debug(2, "BreakExpression");
i = entry->subentries.size();
+ break;
case kLBOpJumpToExpression:
debug(2, "JumpToExpression got %d (on %d, of %d)", e, i, entry->subentries.size());
i = e - 1;
@@ -2969,7 +3080,7 @@ bool LBSoundItem::togglePlaying(bool playing, bool restart) {
_vm->_sound->stopSound(_resourceId);
}
- if (_neverEnabled || !_enabled || !_globalEnabled)
+ if (!_loaded || !_enabled || !_globalEnabled)
return false;
_running = true;
@@ -2987,6 +3098,10 @@ void LBSoundItem::stop() {
LBItem::stop();
}
+LBItem *LBSoundItem::createClone() {
+ return new LBSoundItem(_vm, _page, _rect);
+}
+
LBGroupItem::LBGroupItem(MohawkEngine_LivingBooks *vm, LBPage *page, Common::Rect rect) : LBItem(vm, page, rect) {
debug(3, "new LBGroupItem");
_starting = false;
@@ -3102,6 +3217,44 @@ void LBGroupItem::stop() {
}
}
+void LBGroupItem::load() {
+ for (uint i = 0; i < _groupEntries.size(); i++) {
+ LBItem *item = _vm->getItemById(_groupEntries[i].entryId);
+ if (item)
+ item->load();
+ }
+}
+
+void LBGroupItem::unload() {
+ for (uint i = 0; i < _groupEntries.size(); i++) {
+ LBItem *item = _vm->getItemById(_groupEntries[i].entryId);
+ if (item)
+ item->unload();
+ }
+}
+
+void LBGroupItem::moveBy(const Common::Point &pos) {
+ for (uint i = 0; i < _groupEntries.size(); i++) {
+ LBItem *item = _vm->getItemById(_groupEntries[i].entryId);
+ if (item)
+ item->moveBy(pos);
+ }
+}
+
+void LBGroupItem::moveTo(const Common::Point &pos) {
+ for (uint i = 0; i < _groupEntries.size(); i++) {
+ LBItem *item = _vm->getItemById(_groupEntries[i].entryId);
+ if (item)
+ item->moveTo(pos);
+ }
+}
+
+LBItem *LBGroupItem::createClone() {
+ // TODO: needed?
+ error("LBGroupItem::createClone unimplemented");
+ return new LBGroupItem(_vm, _page, _rect);
+}
+
LBPaletteItem::LBPaletteItem(MohawkEngine_LivingBooks *vm, LBPage *page, Common::Rect rect) : LBItem(vm, page, rect) {
debug(3, "new LBPaletteItem");
@@ -3187,6 +3340,10 @@ void LBPaletteItem::update() {
LBItem::update();
}
+LBItem *LBPaletteItem::createClone() {
+ error("can't clone LBPaletteItem");
+}
+
LBLiveTextItem::LBLiveTextItem(MohawkEngine_LivingBooks *vm, LBPage *page, Common::Rect rect) : LBItem(vm, page, rect) {
_currentPhrase = 0xFFFF;
_currentWord = 0xFFFF;
@@ -3350,7 +3507,7 @@ void LBLiveTextItem::drawWord(uint word, uint yPos) {
}
void LBLiveTextItem::handleMouseDown(Common::Point pos) {
- if (_neverEnabled || !_enabled || !_globalEnabled || _playing)
+ if (!_loaded || !_enabled || !_globalEnabled || _playing)
return LBItem::handleMouseDown(pos);
pos.x -= _rect.left;
@@ -3381,7 +3538,7 @@ void LBLiveTextItem::handleMouseDown(Common::Point pos) {
bool LBLiveTextItem::togglePlaying(bool playing, bool restart) {
if (!playing)
return LBItem::togglePlaying(playing, restart);
- if (_neverEnabled || !_enabled || !_globalEnabled)
+ if (!_loaded || !_enabled || !_globalEnabled)
return _playing;
// TODO: handle this properly
@@ -3400,7 +3557,7 @@ void LBLiveTextItem::stop() {
}
void LBLiveTextItem::notify(uint16 data, uint16 from) {
- if (_neverEnabled || !_enabled || !_globalEnabled || !_playing)
+ if (!_loaded || !_enabled || !_globalEnabled || !_playing)
return LBItem::notify(data, from);
if (_currentWord != 0xFFFF) {
@@ -3434,6 +3591,10 @@ void LBLiveTextItem::notify(uint16 data, uint16 from) {
LBItem::notify(data, from);
}
+LBItem *LBLiveTextItem::createClone() {
+ error("can't clone LBLiveTextItem");
+}
+
LBPictureItem::LBPictureItem(MohawkEngine_LivingBooks *vm, LBPage *page, Common::Rect rect) : LBItem(vm, page, rect) {
debug(3, "new LBPictureItem");
}
@@ -3468,15 +3629,21 @@ bool LBPictureItem::contains(Common::Point point) {
void LBPictureItem::init() {
_vm->_gfx->preloadImage(_resourceId);
+
+ LBItem::init();
}
void LBPictureItem::draw() {
- if (!_visible || !_globalVisible)
+ if (!_loaded || !_visible || !_globalVisible)
return;
_vm->_gfx->copyAnimImageToScreen(_resourceId, _rect.left, _rect.top);
}
+LBItem *LBPictureItem::createClone() {
+ return new LBPictureItem(_vm, _page, _rect);
+}
+
LBAnimationItem::LBAnimationItem(MohawkEngine_LivingBooks *vm, LBPage *page, Common::Rect rect) : LBItem(vm, page, rect) {
_anim = NULL;
_running = false;
@@ -3489,9 +3656,9 @@ LBAnimationItem::~LBAnimationItem() {
void LBAnimationItem::setEnabled(bool enabled) {
if (_running) {
- if (enabled && _globalEnabled && _neverEnabled)
+ if (enabled && _globalEnabled && !_loaded)
_anim->start();
- else if (!_neverEnabled && !enabled && _enabled && _globalEnabled)
+ else if (_loaded && !enabled && _enabled && _globalEnabled)
_anim->stop();
}
@@ -3509,7 +3676,7 @@ bool LBAnimationItem::contains(Common::Point point) {
}
void LBAnimationItem::update() {
- if (!_neverEnabled && _enabled && _globalEnabled && _running) {
+ if (_loaded && _enabled && _globalEnabled && _running) {
bool wasDone = _anim->update();
if (wasDone) {
_running = false;
@@ -3522,7 +3689,7 @@ void LBAnimationItem::update() {
bool LBAnimationItem::togglePlaying(bool playing, bool restart) {
if (playing) {
- if (!_neverEnabled && _enabled && _globalEnabled) {
+ if (_loaded && _enabled && _globalEnabled) {
if (restart)
seek(1);
_running = true;
@@ -3545,6 +3712,8 @@ void LBAnimationItem::done(bool onlyNotify) {
void LBAnimationItem::init() {
_anim = new LBAnimation(_vm, this, _resourceId);
+
+ LBItem::init();
}
void LBAnimationItem::stop() {
@@ -3562,6 +3731,10 @@ void LBAnimationItem::seek(uint16 pos) {
_anim->seek(pos);
}
+void LBAnimationItem::seekToTime(uint32 time) {
+ _anim->seekToTime(time);
+}
+
void LBAnimationItem::startPhase(uint phase) {
if (phase == _phase)
seek(1);
@@ -3576,6 +3749,12 @@ void LBAnimationItem::draw() {
_anim->draw();
}
+LBItem *LBAnimationItem::createClone() {
+ LBAnimationItem *item = new LBAnimationItem(_vm, _page, _rect);
+ item->_anim = new LBAnimation(_vm, item, _resourceId);
+ return item;
+}
+
LBMovieItem::LBMovieItem(MohawkEngine_LivingBooks *vm, LBPage *page, Common::Rect rect) : LBItem(vm, page, rect) {
debug(3, "new LBMovieItem");
}
@@ -3595,7 +3774,7 @@ void LBMovieItem::update() {
bool LBMovieItem::togglePlaying(bool playing, bool restart) {
if (playing) {
- if ((!_neverEnabled && _enabled && _globalEnabled) || _phase == 0x7FFF) {
+ if ((_loaded && _enabled && _globalEnabled) || _phase == kLBPhaseNone) {
_vm->_video->playMovie(_resourceId, _rect.left, _rect.top);
return true;
@@ -3605,6 +3784,10 @@ bool LBMovieItem::togglePlaying(bool playing, bool restart) {
return LBItem::togglePlaying(playing, restart);
}
+LBItem *LBMovieItem::createClone() {
+ return new LBMovieItem(_vm, _page, _rect);
+}
+
LBMiniGameItem::LBMiniGameItem(MohawkEngine_LivingBooks *vm, LBPage *page, Common::Rect rect) : LBItem(vm, page, rect) {
debug(3, "new LBMiniGameItem");
}
@@ -3640,6 +3823,10 @@ bool LBMiniGameItem::togglePlaying(bool playing, bool restart) {
return false;
}
+LBItem *LBMiniGameItem::createClone() {
+ error("can't clone LBMiniGameItem");
+}
+
LBProxyItem::LBProxyItem(MohawkEngine_LivingBooks *vm, LBPage *page, Common::Rect rect) : LBItem(vm, page, rect) {
debug(3, "new LBProxyItem");
@@ -3650,7 +3837,10 @@ LBProxyItem::~LBProxyItem() {
delete _page;
}
-void LBProxyItem::init() {
+void LBProxyItem::load() {
+ if (_loaded)
+ return;
+
Common::String leftover;
Common::String filename = _vm->getFileNameFromConfig("Proxies", _desc.c_str(), leftover);
if (!leftover.empty())
@@ -3669,6 +3859,19 @@ void LBProxyItem::init() {
error("failed to open archive '%s' (for proxy '%s')", filename.c_str(), _desc.c_str());
_page = new LBPage(_vm);
_page->open(pageArchive, baseId);
+
+ LBItem::load();
+}
+
+void LBProxyItem::unload() {
+ delete _page;
+ _page = NULL;
+
+ LBItem::unload();
+}
+
+LBItem *LBProxyItem::createClone() {
+ return new LBProxyItem(_vm, _page, _rect);
}
} // End of namespace Mohawk
diff --git a/engines/mohawk/livingbooks.h b/engines/mohawk/livingbooks.h
index 008a7dbf23..23ab0acfb1 100644
--- a/engines/mohawk/livingbooks.h
+++ b/engines/mohawk/livingbooks.h
@@ -68,6 +68,15 @@ enum LBMode {
kLBPlayMode = 6
};
+enum {
+ kLBPhaseInit = 0x0,
+ kLBPhaseIntro = 0x1,
+ kLBPhaseMain = 0x2,
+ kLBPhaseNone = 0x7fff,
+ kLBPhaseLoad = 0xfffe,
+ kLBPhaseCreate = 0xffff
+};
+
// automatic modes used in _timingMode
enum {
kLBAutoNone = 0,
@@ -178,10 +187,10 @@ enum {
kLBGlobalSetNotVisible = 0x79,
kLBGlobalSetVisible = 0x7a, // unused?
kLBSetAmbient = 0x7b,
- kLBUnknown7C = 0x7c, // unused?
+ kLBSetDragParams = 0x7c,
kLBSetKeyEvent = 0x7d,
- kLBUnknown7E = 0x7e, // unused? (rect flag)
- kLBSetParent = 0x7f, // unused?
+ kLBSetRolloverData = 0x7e,
+ kLBSetParent = 0x7f,
kLBSetHitTest = 0x80,
// from here, rugrats
kLBUnknown194 = 0x194
@@ -331,6 +340,7 @@ public:
void start();
void seek(uint16 pos);
+ void seekToTime(uint32 time);
void stop();
void playSound(uint16 resourceId);
@@ -391,23 +401,34 @@ public:
virtual void handleMouseUp(Common::Point pos); // 0xD
virtual bool togglePlaying(bool playing, bool restart = false); // 0xF
virtual void done(bool onlyNotify); // 0x10
- virtual void init() { } // 0x11
+ virtual void init(); // 0x11
virtual void seek(uint16 pos) { } // 0x13
+ virtual void seekToTime(uint32 time) { }
virtual void setFocused(bool focused) { } // 0x14
virtual void setVisible(bool visible); // 0x17
virtual void setGlobalVisible(bool enabled);
virtual void startPhase(uint phase); // 0x18
virtual void stop(); // 0x19
virtual void notify(uint16 data, uint16 from); // 0x1A
+ virtual void load();
+ virtual void unload();
+ virtual void moveBy(const Common::Point &pos);
+ virtual void moveTo(const Common::Point &pos);
+
+ LBItem *clone(uint16 newId, const Common::String &newName);
uint16 getId() { return _itemId; }
const Common::String &getName() { return _desc; }
const Common::Rect &getRect() { return _rect; }
uint16 getSoundPriority() { return _soundMode; }
+ bool isLoaded() { return _loaded; }
bool isAmbient() { return _isAmbient; }
Common::List<LBItem *>::iterator _iterator;
+ // TODO: make private
+ Common::HashMap<Common::String, LBValue, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _variables;
+
protected:
MohawkEngine_LivingBooks *_vm;
LBPage *_page;
@@ -420,7 +441,7 @@ protected:
uint16 _resourceId;
uint16 _itemId;
- bool _visible, _globalVisible, _playing, _enabled, _neverEnabled, _globalEnabled;
+ bool _loaded, _visible, _globalVisible, _playing, _enabled, _globalEnabled;
uint32 _nextTime, _startTime;
uint16 _loops;
@@ -433,6 +454,8 @@ protected:
bool _isAmbient;
bool _doHitTest;
+ virtual LBItem *createClone();
+
Common::Array<LBScriptEntry *> _scriptEntries;
void runScript(uint event, uint16 data = 0, uint16 from = 0);
int runScriptEntry(LBScriptEntry *entry);
@@ -453,6 +476,8 @@ public:
void stop();
protected:
+ LBItem *createClone();
+
bool _running;
};
@@ -478,8 +503,14 @@ public:
void setGlobalVisible(bool visible);
void startPhase(uint phase);
void stop();
+ void load();
+ void unload();
+ void moveBy(const Common::Point &pos);
+ void moveTo(const Common::Point &pos);
protected:
+ LBItem *createClone();
+
bool _starting;
Common::Array<GroupEntry> _groupEntries;
@@ -496,6 +527,8 @@ public:
void update();
protected:
+ LBItem *createClone();
+
uint16 _fadeInPeriod, _fadeInStep, _drawStart, _drawCount;
uint32 _fadeInStart, _fadeInCurrent;
byte *_palette;
@@ -527,6 +560,8 @@ public:
void notify(uint16 data, uint16 from);
protected:
+ LBItem *createClone();
+
void paletteUpdate(uint16 word, bool on);
void drawWord(uint word, uint yPos);
@@ -550,6 +585,9 @@ public:
bool contains(Common::Point point);
void draw();
void init();
+
+protected:
+ LBItem *createClone();
};
class LBAnimationItem : public LBItem {
@@ -565,10 +603,13 @@ public:
void done(bool onlyNotify);
void init();
void seek(uint16 pos);
+ void seekToTime(uint32 time);
void startPhase(uint phase);
void stop();
protected:
+ LBItem *createClone();
+
LBAnimation *_anim;
bool _running;
};
@@ -580,6 +621,9 @@ public:
void update();
bool togglePlaying(bool playing, bool restart);
+
+protected:
+ LBItem *createClone();
};
class LBMiniGameItem : public LBItem {
@@ -588,6 +632,9 @@ public:
~LBMiniGameItem();
bool togglePlaying(bool playing, bool restart);
+
+protected:
+ LBItem *createClone();
};
class LBProxyItem : public LBItem {
@@ -595,9 +642,12 @@ public:
LBProxyItem(MohawkEngine_LivingBooks *_vm, LBPage *page, Common::Rect rect);
~LBProxyItem();
- void init();
+ void load();
+ void unload();
protected:
+ LBItem *createClone();
+
class LBPage *_page;
};
@@ -634,6 +684,7 @@ public:
void open(Archive *mhk, uint16 baseId);
uint16 getResourceVersion();
+ void addClonedItem(LBItem *item);
void itemDestroyed(LBItem *item);
LBCode *_code;
@@ -697,7 +748,7 @@ public:
void nextPage();
// TODO: make private
- Common::HashMap<Common::String, LBValue> _variables;
+ Common::HashMap<Common::String, LBValue, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _variables;
// helper functions, also used by LBProxyItem
Common::String getFileNameFromConfig(const Common::String &section, const Common::String &key, Common::String &leftover);
diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp
index 80b5fe9660..41acea19c4 100644
--- a/engines/mohawk/livingbooks_code.cpp
+++ b/engines/mohawk/livingbooks_code.cpp
@@ -21,8 +21,10 @@
*/
#include "mohawk/livingbooks.h"
+#include "mohawk/livingbooks_lbx.h"
#include "mohawk/resource.h"
+#include "common/events.h"
#include "common/system.h"
#include "common/textconsole.h"
@@ -99,12 +101,17 @@ double LBValue::toDouble() const {
Common::Point LBValue::toPoint() const {
switch (type) {
case kLBValueString:
- // FIXME
- return Common::Point();
+ {
+ Common::Point ret;
+ sscanf(string.c_str(), "%hd , %hd", &ret.x, &ret.y);
+ return ret;
+ }
case kLBValueInteger:
return Common::Point(integer, integer);
case kLBValuePoint:
return point;
+ case kLBValueRect:
+ return Common::Point(rect.left, rect.top);
default:
error("failed to convert to point");
}
@@ -113,10 +120,15 @@ Common::Point LBValue::toPoint() const {
Common::Rect LBValue::toRect() const {
switch (type) {
case kLBValueString:
- // FIXME
- return Common::Rect();
+ {
+ Common::Rect ret;
+ sscanf(string.c_str(), "%hd , %hd , %hd , %hd", &ret.left, &ret.top, &ret.right, &ret.bottom);
+ return ret;
+ }
case kLBValueInteger:
return Common::Rect(integer, integer, integer, integer);
+ case kLBValuePoint:
+ return Common::Rect(point.x, point.y, point.x, point.y);
case kLBValueRect:
return rect;
case kLBValueItemPtr:
@@ -476,26 +488,84 @@ void LBCode::parseMain() {
if (_currToken == kTokenAssign)
error("attempted assignment to self");
break;
- } else if (_currToken == kTokenAssign) {
+ }
+ bool indexing = false;
+ Common::Array<LBValue> index;
+ while (_currToken == kTokenListStart) {
+ debugN("[");
+ nextToken();
+ parseStatement();
+ if (_currToken != kTokenListEnd)
+ error("expected list end");
+ debugN("]");
+ nextToken();
+ if (!_stack.size())
+ error("index failed");
+ indexing = true;
+ index.push_back(_stack.pop());
+ }
+ if (_currToken == kTokenAssign) {
debugN(" = ");
nextToken();
parseStatement();
if (!_stack.size())
error("assignment failed");
- LBValue *val = &_vm->_variables[varname];
- *val = _stack.pop();
- _stack.push(*val);
+ LBValue *val;
+ if (indexing)
+ val = getIndexedVar(varname, index);
+ else
+ val = &_vm->_variables[varname];
+ if (val) {
+ *val = _stack.pop();
+ _stack.push(*val);
+ } else
+ _stack.push(LBValue());
+ } else if (_currToken == kTokenAndEquals) {
+ debugN(" &= ");
+ nextToken();
+ parseStatement();
+ if (!_stack.size())
+ error("assignment failed");
+ LBValue *val;
+ if (indexing)
+ val = getIndexedVar(varname, index);
+ else
+ val = &_vm->_variables[varname];
+ if (val) {
+ if (val->type != kLBValueString)
+ error("operator &= used on non-string");
+ val->string = val->string + _stack.pop().toString();
+ _stack.push(*val);
+ } else
+ _stack.push(LBValue());
} else {
- _stack.push(_vm->_variables[varname]);
+ if (indexing) {
+ LBValue *val = getIndexedVar(varname, index);
+ if (val)
+ _stack.push(*val);
+ else
+ _stack.push(LBValue());
+ } else
+ _stack.push(_vm->_variables[varname]);
}
// FIXME: pre/postincrement for non-integers
if (_currToken == kTokenPlusPlus) {
debugN("++");
- _vm->_variables[varname].integer++;
+ if (indexing) {
+ LBValue *val = getIndexedVar(varname, index);
+ if (val)
+ val->integer++;
+ } else
+ _vm->_variables[varname].integer++;
nextToken();
} else if (_currToken == kTokenMinusMinus) {
debugN("--");
- _vm->_variables[varname].integer--;
+ if (indexing) {
+ LBValue *val = getIndexedVar(varname, index);
+ if (val)
+ val->integer--;
+ } else
+ _vm->_variables[varname].integer--;
nextToken();
}
}
@@ -567,6 +637,28 @@ void LBCode::parseMain() {
nextToken();
break;
+ case kTokenListStart:
+ debugN("[");
+ nextToken();
+ {
+ Common::SharedPtr<LBList> list = Common::SharedPtr<LBList>(new LBList);
+ while (_currToken != kTokenListEnd) {
+ parseStatement();
+ if (!_stack.size())
+ error("unexpected empty stack during literal list evaluation");
+ list->array.push_back(_stack.pop());
+ if (_currToken == kTokenComma) {
+ debugN(", ");
+ nextToken();
+ } else if (_currToken != kTokenListEnd)
+ error("encountered unexpected token %02x during literal list", _currToken);
+ }
+ debugN("]");
+ nextToken();
+ _stack.push(list);
+ }
+ break;
+
case kTokenNot:
debugN("!");
nextToken();
@@ -607,6 +699,20 @@ void LBCode::parseMain() {
}
}
+LBValue *LBCode::getIndexedVar(Common::String varname, const Common::Array<LBValue> &index) {
+ LBValue *var = &_vm->_variables[varname];
+ for (uint i = 0; i < index.size(); i++) {
+ if (var->type != kLBValueList)
+ error("variable '%s' was indexed, but isn't a list after %d indexes", varname.c_str(), i);
+ if (index[i].type != kLBValueInteger)
+ error("index %d wasn't an integer", i);
+ if (index[i].integer < 1 || index[i].integer > (int)var->list->array.size())
+ return NULL;
+ var = &var->list->array[index[i].integer - 1];
+ }
+ return var;
+}
+
LBItem *LBCode::resolveItem(const LBValue &value) {
if (value.type == kLBValueItemPtr)
return value.item;
@@ -626,7 +732,7 @@ Common::Array<LBValue> LBCode::readParams() {
byte numParams = _data[_currOffset++];
if (!numParams) {
- debugN("()\n");
+ debugN("()");
nextToken();
return params;
}
@@ -688,14 +794,14 @@ CodeCommandInfo generalCommandInfo[NUM_GENERAL_COMMANDS] = {
{ "random", &LBCode::cmdRandom },
{ "stringLen", &LBCode::cmdStringLen },
{ "substring", &LBCode::cmdSubstring },
- { "max", 0 },
- { "min", 0 },
- { "abs", 0 },
+ { "max", &LBCode::cmdMax },
+ { "min", &LBCode::cmdMin },
+ { "abs", &LBCode::cmdAbs },
{ "getRect", &LBCode::cmdGetRect }, // also "makeRect"
- { "makePt", 0 }, // also "makePair"
+ { "makePt", &LBCode::cmdMakePoint }, // also "makePair"
{ "topLeft", &LBCode::cmdTopLeft },
{ "bottomRight", &LBCode::cmdBottomRight },
- { "mousePos", 0 },
+ { "mousePos", &LBCode::cmdMousePos },
{ "top", &LBCode::cmdTop },
{ "left", &LBCode::cmdLeft },
{ "bottom", &LBCode::cmdBottom },
@@ -704,7 +810,7 @@ CodeCommandInfo generalCommandInfo[NUM_GENERAL_COMMANDS] = {
{ "xpos", 0 },
{ "ypos", 0 },
{ "playFrom", 0 },
- { "move", 0 },
+ { "move", &LBCode::cmdMove },
{ 0, 0 },
{ 0, 0 },
{ "setDragParams", &LBCode::cmdSetDragParams },
@@ -727,26 +833,26 @@ CodeCommandInfo generalCommandInfo[NUM_GENERAL_COMMANDS] = {
{ "getPage", 0 },
{ "getWorldRect", 0 },
{ "isWorldWrap", 0 },
- { "newList", 0 },
+ { "newList", &LBCode::cmdNewList },
{ "deleteList", 0 },
- { "add", 0 },
+ { "add", &LBCode::cmdAdd },
{ 0, 0 },
- { "addAt", 0 },
+ { "addAt", &LBCode::cmdAddAt },
{ "getAt", 0 },
// 0x30
{ 0, 0 },
{ "getIndex", 0 },
- { "setAt", 0 },
- { "listLen", 0 },
- { "deleteAt", 0 },
- { "clearList", 0 },
+ { "setAt", &LBCode::cmdSetAt },
+ { "listLen", &LBCode::cmdListLen },
+ { "deleteAt", &LBCode::cmdDeleteAt },
+ { "clearList", &LBCode::cmdUnimplemented },
{ "setWorld", 0 },
- { "setProperty", 0 },
- { "getProperty", 0 },
+ { "setProperty", &LBCode::cmdSetProperty },
+ { "getProperty", &LBCode::cmdGetProperty },
{ "copyList", 0 },
{ "invoke", 0 },
- { "exec", 0 },
- { "return", 0 },
+ { "exec", &LBCode::cmdExec },
+ { "return", &LBCode::cmdReturn },
{ "sendSync", 0 },
{ "moveViewOrigin", 0 },
{ "addToGroup", 0 },
@@ -775,8 +881,8 @@ CodeCommandInfo generalCommandInfo[NUM_GENERAL_COMMANDS] = {
{ "setDisplay", &LBCode::cmdUnimplemented },
{ "getDisplay", 0 },
{ 0, 0 },
- { "lbxCreate", 0 },
- { "lbxFunc", 0 },
+ { "lbxCreate", &LBCode::cmdLBXCreate },
+ { "lbxFunc", &LBCode::cmdLBXFunc },
{ "waitCursor", 0 },
{ "debugBreak", 0 },
{ "menuItemEnable", 0 },
@@ -886,6 +992,35 @@ void LBCode::cmdSubstring(const Common::Array<LBValue> &params) {
_stack.push(substring);
}
+void LBCode::cmdMax(const Common::Array<LBValue> &params) {
+ if (params.size() != 2)
+ error("incorrect number of parameters (%d) to max", params.size());
+
+ // FIXME: fp
+ int a = params[0].toInt();
+ int b = params[1].toInt();
+ _stack.push(MAX(a, b));
+}
+
+void LBCode::cmdMin(const Common::Array<LBValue> &params) {
+ if (params.size() != 2)
+ error("incorrect number of parameters (%d) to min", params.size());
+
+ // FIXME: fp
+ int a = params[0].toInt();
+ int b = params[1].toInt();
+ _stack.push(MIN(a, b));
+}
+
+void LBCode::cmdAbs(const Common::Array<LBValue> &params) {
+ if (params.size() != 1)
+ error("incorrect number of parameters (%d) to abs", params.size());
+
+ // FIXME: fp
+ int a = params[0].toInt();
+ _stack.push(ABS(a));
+}
+
void LBCode::cmdGetRect(const Common::Array<LBValue> &params) {
if (params.size() < 2) {
_stack.push(getRectFromParams(params));
@@ -899,6 +1034,12 @@ void LBCode::cmdGetRect(const Common::Array<LBValue> &params) {
error("incorrect number of parameters (%d) to getRect", params.size());
}
+void LBCode::cmdMakePoint(const Common::Array<LBValue> &params) {
+ if (params.size() != 2)
+ error("incorrect number of parameters (%d) to makePoint", params.size());
+ _stack.push(Common::Point(params[0].toInt(), params[1].toInt()));
+}
+
void LBCode::cmdTopLeft(const Common::Array<LBValue> &params) {
if (params.size() > 1)
error("too many parameters (%d) to topLeft", params.size());
@@ -915,6 +1056,14 @@ void LBCode::cmdBottomRight(const Common::Array<LBValue> &params) {
_stack.push(Common::Point(rect.bottom, rect.right));
}
+void LBCode::cmdMousePos(const Common::Array<LBValue> &params) {
+ if (params.size() != 0)
+ error("too many parameters (%d) to mousePos", params.size());
+
+ Common::Point pt = _vm->_system->getEventManager()->getMousePos();
+ _stack.push(pt);
+}
+
void LBCode::cmdTop(const Common::Array<LBValue> &params) {
if (params.size() > 1)
error("too many parameters (%d) to top", params.size());
@@ -947,10 +1096,170 @@ void LBCode::cmdRight(const Common::Array<LBValue> &params) {
_stack.push(rect.right);
}
+void LBCode::cmdMove(const Common::Array<LBValue> &params) {
+ if (params.size() != 1 && params.size() != 2)
+ error("incorrect number of parameters (%d) to move", params.size());
+
+ LBItem *target = _currSource;
+ Common::Point pt;
+ if (params.size() == 1) {
+ pt = params[0].toPoint();
+ } else {
+ target = resolveItem(params[0]);
+ if (!target)
+ error("attempted move on invalid item (%s)", params[0].toString().c_str());
+ pt = params[1].toPoint();
+ }
+
+ target->moveBy(pt);
+}
+
void LBCode::cmdSetDragParams(const Common::Array<LBValue> &params) {
warning("ignoring setDragParams");
}
+void LBCode::cmdNewList(const Common::Array<LBValue> &params) {
+ if (params.size() != 0)
+ error("incorrect number of parameters (%d) to newList", params.size());
+
+ _stack.push(Common::SharedPtr<LBList>(new LBList));
+}
+
+void LBCode::cmdAdd(const Common::Array<LBValue> &params) {
+ if (params.size() != 2)
+ error("incorrect number of parameters (%d) to add", params.size());
+
+ if (params[0].type != kLBValueList || !params[0].list)
+ error("invalid lbx object passed to add");
+
+ params[0].list->array.push_back(params[1]);
+}
+
+void LBCode::cmdAddAt(const Common::Array<LBValue> &params) {
+ if (params.size() != 3)
+ error("incorrect number of parameters (%d) to addAt", params.size());
+
+ if (params[0].type != kLBValueList || !params[0].list)
+ error("invalid lbx object passed to addAt");
+
+ if (params[1].type != kLBValueInteger || params[1].integer < 1)
+ error("invalid index passed to addAt");
+
+ if ((uint)params[1].integer > params[0].list->array.size())
+ params[0].list->array.resize(params[1].integer);
+ params[0].list->array.insert_at(params[1].integer - 1, params[2]);
+}
+
+void LBCode::cmdSetAt(const Common::Array<LBValue> &params) {
+ if (params.size() != 3)
+ error("incorrect number of parameters (%d) to setAt", params.size());
+
+ if (params[0].type != kLBValueList || !params[0].list)
+ error("invalid lbx object passed to setAt");
+
+ if (params[1].type != kLBValueInteger || params[1].integer < 1)
+ error("invalid index passed to setAt");
+
+ if ((uint)params[1].integer > params[0].list->array.size())
+ params[0].list->array.resize(params[1].integer);
+ params[0].list->array[params[1].integer - 1] = params[2];
+}
+
+void LBCode::cmdListLen(const Common::Array<LBValue> &params) {
+ if (params.size() != 1)
+ error("incorrect number of parameters (%d) to listLen", params.size());
+
+ if (params[0].type != kLBValueList || !params[0].list)
+ error("invalid lbx object passed to lbxFunc");
+
+ _stack.push(params[0].list->array.size());
+}
+
+void LBCode::cmdDeleteAt(const Common::Array<LBValue> &params) {
+ if (params.size() != 2)
+ error("incorrect number of parameters (%d) to deleteAt", params.size());
+
+ if (params[0].type != kLBValueList || !params[0].list)
+ error("invalid lbx object passed to deleteAt");
+
+ if (params[1].type != kLBValueInteger)
+ error("invalid index passed to deleteAt");
+ if (params[1].integer < 1 || params[1].integer > (int)params[0].list->array.size())
+ return;
+ params[0].list->array.remove_at(params[1].integer - 1);
+}
+
+void LBCode::cmdSetProperty(const Common::Array<LBValue> &params) {
+ if (params.size() < 2 || params.size() > 3)
+ error("incorrect number of parameters (%d) to setProperty", params.size());
+
+ Common::String name;
+ LBValue val;
+ LBItem *target = _currSource;
+ if (params.size() == 3) {
+ target = resolveItem(params[0]);
+ if (!target)
+ error("attempted setProperty on invalid item (%s)", params[0].toString().c_str());
+ name = params[1].toString();
+ val = params[2];
+ } else {
+ name = params[0].toString();
+ val = params[1];
+ }
+
+ target->_variables[name] = val;
+}
+
+void LBCode::cmdGetProperty(const Common::Array<LBValue> &params) {
+ if (params.size() < 1 || params.size() > 2)
+ error("incorrect number of parameters (%d) to getProperty", params.size());
+
+ Common::String name;
+ LBItem *target = _currSource;
+ if (params.size() == 2) {
+ target = resolveItem(params[0]);
+ if (!target)
+ error("attempted getProperty on invalid item (%s)", params[0].toString().c_str());
+ name = params[1].toString();
+ } else {
+ name = params[0].toString();
+ }
+
+ _stack.push(target->_variables[name]);
+}
+
+void LBCode::cmdExec(const Common::Array<LBValue> &params) {
+ if (params.size() != 1)
+ error("incorrect number of parameters (%d) to exec", params.size());
+ if (params[0].type != kLBValueInteger || params[0].integer < 0)
+ error("invalid offset passed to exec");
+ uint offset = (uint)params[0].integer;
+
+ uint32 oldOffset = _currOffset;
+ byte oldToken = _currToken;
+ LBValue val = runCode(_currSource, offset);
+ _currOffset = oldOffset;
+ _currToken = oldToken;
+
+ _stack.push(val);
+ _stack.push(val);
+}
+
+void LBCode::cmdReturn(const Common::Array<LBValue> &params) {
+ if (params.size() != 2)
+ error("incorrect number of parameters (%d) to return", params.size());
+
+ if (!_stack.size())
+ error("empty stack on entry to return");
+
+ if (params[0] == _stack.top()) {
+ _stack.pop();
+ _stack.push(params[1]);
+ _currToken = kTokenEndOfFile;
+ } else
+ _stack.push(_stack.top());
+}
+
void LBCode::cmdSetPlayParams(const Common::Array<LBValue> &params) {
if (params.size() > 8)
error("too many parameters (%d) to setPlayParams", params.size());
@@ -994,6 +1303,32 @@ void LBCode::cmdSetHitTest(const Common::Array<LBValue> &params) {
warning("ignoring setHitTest");
}
+void LBCode::cmdLBXCreate(const Common::Array<LBValue> &params) {
+ if (params.size() != 1)
+ error("incorrect number of parameters (%d) to lbxCreate", params.size());
+
+ _stack.push(createLBXObject(_vm, params[0].toInt()));
+}
+
+void LBCode::cmdLBXFunc(const Common::Array<LBValue> &params) {
+ if (params.size() < 2)
+ error("incorrect number of parameters (%d) to lbxFunc", params.size());
+
+ if (params[0].type != kLBValueLBX || !params[0].lbx)
+ error("invalid lbx object passed to lbxFunc");
+
+ Common::SharedPtr<LBXObject> lbx = params[0].lbx;
+ uint callId = params[1].toInt();
+
+ Common::Array<LBValue> callParams;
+ for (uint i = 0; i < params.size() - 2; i++)
+ callParams.push_back(params[i + 2]);
+
+ LBValue result;
+ if (lbx->call(callId, callParams, result))
+ _stack.push(result);
+}
+
void LBCode::cmdKey(const Common::Array<LBValue> &params) {
_stack.push(0); // FIXME
warning("ignoring Key");
@@ -1001,7 +1336,7 @@ void LBCode::cmdKey(const Common::Array<LBValue> &params) {
#define NUM_ITEM_COMMANDS 34
CodeCommandInfo itemCommandInfo[NUM_ITEM_COMMANDS] = {
- { "clone", 0 },
+ { "clone", &LBCode::itemClone },
{ "destroy", 0 },
{ "dragBeginFrom", 0 },
{ "dragEnd", 0 },
@@ -1022,14 +1357,14 @@ CodeCommandInfo itemCommandInfo[NUM_ITEM_COMMANDS] = {
{ "isMuted", 0 },
{ "isPlaying", &LBCode::itemIsPlaying },
{ "isVisible", 0 },
- { "isLoaded", 0 },
+ { "isLoaded", &LBCode::itemIsLoaded },
{ "isDragging", 0 },
{ "load", 0 },
{ "moveTo", &LBCode::itemMoveTo },
{ "mute", 0 },
{ "play", 0 },
{ "seek", &LBCode::itemSeek },
- { "seekToFrame", 0 },
+ { "seekToFrame", &LBCode::itemSeekToFrame },
{ "setParent", &LBCode::itemSetParent },
{ "setZOrder", 0 },
{ "setText", 0 },
@@ -1054,14 +1389,50 @@ void LBCode::runItemCommand() {
(this->*(info.func))(params);
}
+void LBCode::itemClone(const Common::Array<LBValue> &params) {
+ // TODO: first param can be target?
+ if (params.size() != 2)
+ error("incorrect number of parameters (%d) to setParent", params.size());
+
+ uint id = params[0].toInt();
+ const Common::String &name = params[1].toString();
+
+ _currSource->clone(id, name);
+}
+
void LBCode::itemIsPlaying(const Common::Array<LBValue> &params) {
// TODO
warning("ignoring isPlaying");
_stack.push(0);
}
+void LBCode::itemIsLoaded(const Common::Array<LBValue> &params) {
+ if (params.size() != 1)
+ error("incorrect number of parameters (%d) to isLoaded", params.size());
+
+ LBItem *item = resolveItem(params[0]);
+ if (!item || !item->isLoaded())
+ _stack.push(0);
+ else
+ _stack.push(1);
+}
+
void LBCode::itemMoveTo(const Common::Array<LBValue> &params) {
- warning("ignoring moveTo");
+ if (params.size() != 1 && params.size() != 2)
+ error("incorrect number of parameters (%d) to moveTo", params.size());
+
+ LBItem *target = _currSource;
+ Common::Point pt;
+ if (params.size() == 1) {
+ pt = params[0].toPoint();
+ } else {
+ target = resolveItem(params[0]);
+ if (!target)
+ error("attempted moveTo on invalid item (%s)", params[0].toString().c_str());
+ pt = params[1].toPoint();
+ }
+
+ target->moveTo(pt);
}
void LBCode::itemSeek(const Common::Array<LBValue> &params) {
@@ -1072,6 +1443,17 @@ void LBCode::itemSeek(const Common::Array<LBValue> &params) {
if (!item)
error("attempted seek on invalid item (%s)", params[0].toString().c_str());
uint seekTo = params[1].toInt();
+ item->seekToTime(seekTo);
+}
+
+void LBCode::itemSeekToFrame(const Common::Array<LBValue> &params) {
+ if (params.size() != 2)
+ error("incorrect number of parameters (%d) to seekToFrame", params.size());
+
+ LBItem *item = resolveItem(params[0]);
+ if (!item)
+ error("attempted seekToFrame on invalid item (%s)", params[0].toString().c_str());
+ uint seekTo = params[1].toInt();
item->seek(seekTo);
}
@@ -1091,7 +1473,7 @@ void LBCode::runNotifyCommand() {
debugN("goto");
Common::Array<LBValue> params = readParams();
// TODO: type-checking
- NotifyEvent notifyEvent(kLBNotifyChangePage, 0);
+ NotifyEvent notifyEvent(kLBNotifyChangePage, 1);
switch (params.size()) {
case 4:
notifyEvent.type = kLBNotifyChangeMode; // FIXME: type 8?
@@ -1327,6 +1709,8 @@ uint LBCode::parseCode(const Common::String &source) {
break;
// open bracket
case '(':
+ bool parameterless;
+ parameterless = false;
if (wasFunction) {
// function call parameters
wasFunction = false;
@@ -1342,6 +1726,7 @@ uint LBCode::parseCode(const Common::String &source) {
continue;
if (source[i] != ')')
break;
+ parameterless = true;
code[code.size() - 1] = 0;
break;
}
@@ -1349,14 +1734,20 @@ uint LBCode::parseCode(const Common::String &source) {
// brackets around expression
counterPositions.push_back(0);
}
- code.push_back(kTokenOpenBracket);
+ if (!parameterless)
+ code.push_back(kTokenOpenBracket);
break;
// close bracket
case ')':
if (counterPositions.empty())
error("while parsing script '%s', encountered unmatched )", source.c_str());
+
+ // don't push a kTokenCloseBracket for a parameterless function call
+ uint counterPos2;
+ counterPos2 = counterPositions.back();
+ if (!counterPos2 || code[counterPos2])
+ code.push_back(kTokenCloseBracket);
counterPositions.pop_back();
- code.push_back(kTokenCloseBracket);
break;
// comma (seperating function params)
case ',':
@@ -1409,7 +1800,13 @@ uint LBCode::parseCode(const Common::String &source) {
break;
tempString += source[pos++];
}
- wasFunction = parseCodeSymbol(tempString, pos, code);
+ if (tempString.equalsIgnoreCase("true")) {
+ code.push_back(kTokenTrue);
+ } else if (tempString.equalsIgnoreCase("false")) {
+ code.push_back(kTokenFalse);
+ } else {
+ wasFunction = parseCodeSymbol(tempString, pos, code);
+ }
} else {
error("while parsing script '%s', couldn't parse '%c'", source.c_str(), token);
}
diff --git a/engines/mohawk/livingbooks_code.h b/engines/mohawk/livingbooks_code.h
index 79c9af94f7..47dd90f814 100644
--- a/engines/mohawk/livingbooks_code.h
+++ b/engines/mohawk/livingbooks_code.h
@@ -23,6 +23,7 @@
#ifndef MOHAWK_LIVINGBOOKS_CODE_H
#define MOHAWK_LIVINGBOOKS_CODE_H
+#include "common/ptr.h"
#include "common/rect.h"
#include "common/stack.h"
#include "common/substream.h"
@@ -31,6 +32,8 @@ namespace Mohawk {
class MohawkEngine_LivingBooks;
class LBItem;
+class LBXObject;
+struct LBList;
enum LBValueType {
kLBValueString,
@@ -38,7 +41,9 @@ enum LBValueType {
kLBValueReal,
kLBValuePoint,
kLBValueRect,
- kLBValueItemPtr
+ kLBValueItemPtr,
+ kLBValueLBX,
+ kLBValueList
};
struct LBValue {
@@ -66,6 +71,14 @@ struct LBValue {
type = kLBValueItemPtr;
item = itm;
}
+ LBValue(Common::SharedPtr<LBXObject> l) {
+ type = kLBValueLBX;
+ lbx = l;
+ }
+ LBValue(Common::SharedPtr<LBList> l) {
+ type = kLBValueList;
+ list = l;
+ }
LBValue(const LBValue &val) {
type = val.type;
switch (type) {
@@ -87,6 +100,12 @@ struct LBValue {
case kLBValueItemPtr:
item = val.item;
break;
+ case kLBValueLBX:
+ lbx = val.lbx;
+ break;
+ case kLBValueList:
+ list = val.list;
+ break;
}
}
@@ -97,6 +116,8 @@ struct LBValue {
Common::Point point;
Common::Rect rect;
LBItem *item;
+ Common::SharedPtr<LBXObject> lbx;
+ Common::SharedPtr<LBList> list;
bool operator==(const LBValue &x) const;
bool operator!=(const LBValue &x) const;
@@ -111,6 +132,10 @@ struct LBValue {
Common::Rect toRect() const;
};
+struct LBList {
+ Common::Array<LBValue> array;
+};
+
enum {
kLBCodeLiteralInteger = 0x1
};
@@ -207,6 +232,7 @@ protected:
void parseArithmetic2();
void parseMain();
+ LBValue *getIndexedVar(Common::String varname, const Common::Array<LBValue> &index);
LBItem *resolveItem(const LBValue &value);
Common::Array<LBValue> readParams();
Common::Rect getRectFromParams(const Common::Array<LBValue> &params);
@@ -224,22 +250,43 @@ public:
void cmdRandom(const Common::Array<LBValue> &params);
void cmdStringLen(const Common::Array<LBValue> &params);
void cmdSubstring(const Common::Array<LBValue> &params);
+ void cmdMax(const Common::Array<LBValue> &params);
+ void cmdMin(const Common::Array<LBValue> &params);
+ void cmdAbs(const Common::Array<LBValue> &params);
void cmdGetRect(const Common::Array<LBValue> &params);
+ void cmdMakePoint(const Common::Array<LBValue> &params);
void cmdTopLeft(const Common::Array<LBValue> &params);
void cmdBottomRight(const Common::Array<LBValue> &params);
+ void cmdMousePos(const Common::Array<LBValue> &params);
void cmdTop(const Common::Array<LBValue> &params);
void cmdLeft(const Common::Array<LBValue> &params);
void cmdBottom(const Common::Array<LBValue> &params);
void cmdRight(const Common::Array<LBValue> &params);
+ void cmdMove(const Common::Array<LBValue> &params);
void cmdSetDragParams(const Common::Array<LBValue> &params);
+ void cmdNewList(const Common::Array<LBValue> &params);
+ void cmdAdd(const Common::Array<LBValue> &params);
+ void cmdAddAt(const Common::Array<LBValue> &params);
+ void cmdSetAt(const Common::Array<LBValue> &params);
+ void cmdListLen(const Common::Array<LBValue> &params);
+ void cmdDeleteAt(const Common::Array<LBValue> &params);
+ void cmdSetProperty(const Common::Array<LBValue> &params);
+ void cmdGetProperty(const Common::Array<LBValue> &params);
+ void cmdExec(const Common::Array<LBValue> &params);
+ void cmdReturn(const Common::Array<LBValue> &params);
void cmdSetPlayParams(const Common::Array<LBValue> &params);
void cmdSetKeyEvent(const Common::Array<LBValue> &params);
void cmdSetHitTest(const Common::Array<LBValue> &params);
+ void cmdLBXCreate(const Common::Array<LBValue> &params);
+ void cmdLBXFunc(const Common::Array<LBValue> &params);
void cmdKey(const Common::Array<LBValue> &params);
+ void itemClone(const Common::Array<LBValue> &params);
void itemIsPlaying(const Common::Array<LBValue> &params);
+ void itemIsLoaded(const Common::Array<LBValue> &params);
void itemMoveTo(const Common::Array<LBValue> &params);
void itemSeek(const Common::Array<LBValue> &params);
+ void itemSeekToFrame(const Common::Array<LBValue> &params);
void itemSetParent(const Common::Array<LBValue> &params);
};
diff --git a/engines/mohawk/livingbooks_lbx.cpp b/engines/mohawk/livingbooks_lbx.cpp
new file mode 100644
index 0000000000..9628e06294
--- /dev/null
+++ b/engines/mohawk/livingbooks_lbx.cpp
@@ -0,0 +1,141 @@
+/* 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 "engines/mohawk/livingbooks.h"
+#include "engines/mohawk/livingbooks_lbx.h"
+
+namespace Mohawk {
+
+class LBXDataFile : public LBXObject {
+public:
+ LBXDataFile(MohawkEngine_LivingBooks *vm);
+ ~LBXDataFile();
+
+ bool call(uint callId, const Common::Array<LBValue> &params, LBValue &result);
+
+protected:
+ Common::ConfigFile _dataFile;
+ Common::String _curSection;
+
+ void open(const Common::String &filename);
+ bool sectionExists(const Common::String &section);
+};
+
+LBXDataFile::LBXDataFile(MohawkEngine_LivingBooks *vm) : LBXObject(vm) {
+}
+
+LBXDataFile::~LBXDataFile() {
+}
+
+enum {
+ kLBXDataFileOpen = 1,
+ kLBXDataFileGetSectionList = 4,
+ kLBXDataFileSetCurSection = 5,
+ kLBXDataFileLoadCurSectionVars = 8,
+ kLBXDataFileDeleteCurSection = 10,
+ kLBXDataFileSectionExists = 14
+};
+
+bool LBXDataFile::call(uint callId, const Common::Array<LBValue> &params, LBValue &result) {
+ switch (callId) {
+ case kLBXDataFileOpen:
+ if (params.size() != 1)
+ error("incorrect number of parameters (%d) to LBXDataFile::open", params.size());
+
+ open(params[0].toString());
+ return false;
+
+ case kLBXDataFileGetSectionList:
+ {
+ Common::SharedPtr<LBList> list = Common::SharedPtr<LBList>(new LBList);
+ Common::ConfigFile::SectionList sections = _dataFile.getSections();
+ for (Common::List<Common::ConfigFile::Section>::const_iterator i = sections.begin(); i != sections.end(); ++i)
+ list->array.push_back(LBValue(i->name));
+ result = LBValue(list);
+ }
+ return true;
+
+ case kLBXDataFileSetCurSection:
+ if (params.size() != 1)
+ error("incorrect number of parameters (%d) to LBXDataFile::setCurSection", params.size());
+
+ _curSection = params[0].toString();
+ return false;
+
+ case kLBXDataFileLoadCurSectionVars:
+ if (params.size() != 0)
+ error("incorrect number of parameters (%d) to LBXDataFile::loadCurSectionVars", params.size());
+
+ {
+ const Common::ConfigFile::SectionKeyList globals = _dataFile.getKeys(_curSection);
+ for (Common::ConfigFile::SectionKeyList::const_iterator i = globals.begin(); i != globals.end(); i++) {
+ Common::String command = Common::String::format("%s = %s", i->key.c_str(), i->value.c_str());
+ LBCode tempCode(_vm, 0);
+ uint offset = tempCode.parseCode(command);
+ tempCode.runCode(NULL, offset);
+ }
+ }
+ return false;
+
+ case kLBXDataFileDeleteCurSection:
+ if (params.size() != 0)
+ error("incorrect number of parameters (%d) to LBXDataFile::deleteCurSection", params.size());
+
+ _dataFile.removeSection(_curSection);
+ return false;
+
+ case kLBXDataFileSectionExists:
+ if (params.size() != 1)
+ error("incorrect number of parameters (%d) to LBXDataFile::sectionExists", params.size());
+ if (_dataFile.hasSection(params[0].toString()))
+ result = 1;
+ else
+ result = 0;
+ return true;
+
+ default:
+ error("LBXDataFile call %d is unknown", callId);
+ }
+}
+
+void LBXDataFile::open(const Common::String &filename) {
+ _dataFile.clear();
+
+ if (_dataFile.loadFromFile(filename))
+ return;
+
+ // FIXME: try savegames
+
+ error("LBXDataFile::open: couldn't open '%s'", filename.c_str());
+}
+
+Common::SharedPtr<LBXObject> createLBXObject(MohawkEngine_LivingBooks *vm, uint16 type) {
+ switch (type) {
+ case 1001:
+ return Common::SharedPtr<LBXObject>(new LBXDataFile(vm));
+
+ default:
+ error("unknown LBX object type %d", type);
+ }
+}
+
+} // End of namespace Mohawk
diff --git a/engines/m4/saveload.h b/engines/mohawk/livingbooks_lbx.h
index 9b76054e65..3cca0a8e82 100644
--- a/engines/m4/saveload.h
+++ b/engines/mohawk/livingbooks_lbx.h
@@ -20,35 +20,28 @@
*
*/
-#ifndef M4_SAVELOAD_H
-#define M4_SAVELOAD_H
+#ifndef MOHAWK_LIVINGBOOKS_LBX_H
+#define MOHAWK_LIVINGBOOKS_LBX_H
-#include "m4/graphics.h"
-#include "common/ptr.h"
-
-#define MAX_SAVEGAME_NAME 80
-
-namespace M4 {
+#include "engines/mohawk/livingbooks_code.h"
-typedef Common::List<Common::String> SaveGameList;
-typedef SaveGameList::iterator SaveGameIterator;
+#include "common/ptr.h"
-class SaveLoad {
-private:
- MadsM4Engine *_vm;
- bool _emulateOriginal;
+namespace Mohawk {
- const char *generateSaveName(int slotNumber);
+class LBXObject {
public:
- SaveLoad(MadsM4Engine *vm);
+ LBXObject(MohawkEngine_LivingBooks *vm) : _vm(vm) { }
+ virtual ~LBXObject() { }
+
+ virtual bool call(uint callId, const Common::Array<LBValue> &params, LBValue &result) = 0;
- bool hasSaves();
- SaveGameList *getSaves();
- M4Surface *getThumbnail(int slotNumber);
- bool load(int slotNumber);
- bool save(int slotNumber, Common::String saveName);
+protected:
+ MohawkEngine_LivingBooks *_vm;
};
-}
+Common::SharedPtr<LBXObject> createLBXObject(MohawkEngine_LivingBooks *vm, uint16 type);
+
+} // End of namespace Mohawk
#endif
diff --git a/engines/mohawk/module.mk b/engines/mohawk/module.mk
index 30f1d40fdb..882f3966b2 100644
--- a/engines/mohawk/module.mk
+++ b/engines/mohawk/module.mk
@@ -10,6 +10,7 @@ MODULE_OBJS = \
installer_archive.o \
livingbooks.o \
livingbooks_code.o \
+ livingbooks_lbx.o \
mohawk.o \
resource.o \
sound.o \
diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp
index b67b333a85..b6c0a3212f 100644
--- a/engines/mohawk/myst_stacks/myst.cpp
+++ b/engines/mohawk/myst_stacks/myst.cpp
@@ -2138,7 +2138,7 @@ void Myst::rocketSliderMove() {
}
uint16 Myst::rocketSliderGetSound(uint16 pos) {
- return (uint16)(9530 + (pos - 216) * 35.0 * 0.01639344262295082);
+ return (uint16)(9530 + (pos - 216) * 35.0 / 61.0);
}
void Myst::rocketCheckSolution() {
diff --git a/engines/mohawk/myst_stacks/stoneship.cpp b/engines/mohawk/myst_stacks/stoneship.cpp
index e0c374a926..6d54d0c586 100644
--- a/engines/mohawk/myst_stacks/stoneship.cpp
+++ b/engines/mohawk/myst_stacks/stoneship.cpp
@@ -623,7 +623,7 @@ void Stoneship::o_hologramSelectionMove(uint16 op, uint16 var, uint16 argc, uint
uint16 selectionPos = position * 1500 / 243;
VideoHandle handleMovie = _hologramSelection->playMovie();
- _vm->_video->setVideoBounds(handleMovie, Audio::Timestamp(0, selectionPos, 600), Audio::Timestamp(0, selectionPos, 600));
+ _vm->_video->drawVideoFrame(handleMovie, Audio::Timestamp(0, selectionPos, 600));
_hologramDisplayPos = position * 1450 / 243 + 350;
@@ -631,7 +631,7 @@ void Stoneship::o_hologramSelectionMove(uint16 op, uint16 var, uint16 argc, uint
if (_hologramTurnedOn) {
_hologramDisplay->setBlocking(false);
VideoHandle displayMovie = _hologramDisplay->playMovie();
- _vm->_video->setVideoBounds(displayMovie, Audio::Timestamp(0, _hologramDisplayPos, 600), Audio::Timestamp(0, _hologramDisplayPos, 600));
+ _vm->_video->drawVideoFrame(displayMovie, Audio::Timestamp(0, _hologramDisplayPos, 600));
}
}
}
@@ -655,7 +655,7 @@ void Stoneship::o_compassButton(uint16 op, uint16 var, uint16 argc, uint16 *argv
_state.generatorPowerAvailable = 2;
_state.lightState = 0;
_state.generatorDepletionTime = 0;
- _state.generatorDepletionTime = 0;
+ _state.generatorDuration = 0;
_batteryDepleting = false;
}
diff --git a/engines/mohawk/video.cpp b/engines/mohawk/video.cpp
index cd8fc8ef80..7958906897 100644
--- a/engines/mohawk/video.cpp
+++ b/engines/mohawk/video.cpp
@@ -529,6 +529,15 @@ void VideoManager::setVideoBounds(VideoHandle handle, Audio::Timestamp start, Au
_videoStreams[handle]->seekToTime(start);
}
+void VideoManager::drawVideoFrame(VideoHandle handle, Audio::Timestamp time) {
+ assert(handle != NULL_VID_HANDLE);
+ _videoStreams[handle].end = Audio::Timestamp(0xffffffff, 1);
+ _videoStreams[handle]->seekToTime(time);
+ updateMovies();
+ delete _videoStreams[handle].video;
+ _videoStreams[handle].clear();
+}
+
void VideoManager::seekToTime(VideoHandle handle, Audio::Timestamp time) {
assert(handle != NULL_VID_HANDLE);
_videoStreams[handle]->seekToTime(time);
diff --git a/engines/mohawk/video.h b/engines/mohawk/video.h
index efa81edfbd..34c287497f 100644
--- a/engines/mohawk/video.h
+++ b/engines/mohawk/video.h
@@ -104,6 +104,7 @@ public:
uint32 getDuration(VideoHandle videoHandle);
bool endOfVideo(VideoHandle handle);
void setVideoBounds(VideoHandle handle, Audio::Timestamp start, Audio::Timestamp end);
+ void drawVideoFrame(VideoHandle handle, Audio::Timestamp time);
void seekToTime(VideoHandle handle, Audio::Timestamp time);
void setVideoLooping(VideoHandle handle, bool loop);
void waitUntilMovieEnds(VideoHandle videoHandle);
diff --git a/engines/parallaction/detection.cpp b/engines/parallaction/detection.cpp
index d0610f7a29..43176a0759 100644
--- a/engines/parallaction/detection.cpp
+++ b/engines/parallaction/detection.cpp
@@ -53,9 +53,6 @@ static const PlainGameDescriptor parallactionGames[] = {
namespace Parallaction {
-using Common::GUIO_NONE;
-using Common::GUIO_NOSPEECH;
-
static const PARALLACTIONGameDescription gameDescriptions[] = {
{
{
@@ -75,7 +72,7 @@ static const PARALLACTIONGameDescription gameDescriptions[] = {
Common::UNK_LANG,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_Nippon,
GF_LANG_EN | GF_LANG_FR | GF_LANG_DE | GF_LANG_IT | GF_LANG_MULT,
@@ -99,7 +96,7 @@ static const PARALLACTIONGameDescription gameDescriptions[] = {
Common::UNK_LANG,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_Nippon,
GF_LANG_EN | GF_LANG_FR | GF_LANG_DE | GF_LANG_MULT,
@@ -117,7 +114,7 @@ static const PARALLACTIONGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformAmiga,
ADGF_DEMO,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_Nippon,
GF_LANG_EN | GF_DEMO,
@@ -140,7 +137,7 @@ static const PARALLACTIONGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_Nippon,
GF_LANG_IT,
@@ -158,7 +155,7 @@ static const PARALLACTIONGameDescription gameDescriptions[] = {
Common::UNK_LANG,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_BRA,
GF_LANG_EN | GF_LANG_FR | GF_LANG_DE | GF_LANG_IT | GF_LANG_MULT,
@@ -175,7 +172,7 @@ static const PARALLACTIONGameDescription gameDescriptions[] = {
Common::UNK_LANG,
Common::kPlatformPC,
ADGF_DEMO,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_BRA,
GF_LANG_EN | GF_DEMO,
@@ -192,7 +189,7 @@ static const PARALLACTIONGameDescription gameDescriptions[] = {
Common::UNK_LANG,
Common::kPlatformAmiga,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_BRA,
GF_LANG_EN | GF_LANG_FR | GF_LANG_DE | GF_LANG_IT | GF_LANG_MULT,
@@ -209,7 +206,7 @@ static const PARALLACTIONGameDescription gameDescriptions[] = {
Common::UNK_LANG,
Common::kPlatformAmiga,
ADGF_DEMO,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GType_BRA,
GF_LANG_EN | GF_DEMO,
@@ -223,7 +220,7 @@ static const PARALLACTIONGameDescription gameDescriptions[] = {
class ParallactionMetaEngine : public AdvancedMetaEngine {
public:
ParallactionMetaEngine() : AdvancedMetaEngine(Parallaction::gameDescriptions, sizeof(Parallaction::PARALLACTIONGameDescription), parallactionGames) {
- _guioptions = Common::GUIO_NOLAUNCHLOAD;
+ _guioptions = GUIO1(GUIO_NOLAUNCHLOAD);
}
virtual const char *getName() const {
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index 1da61b68ae..a006edf114 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -596,20 +596,22 @@ void Gfx::updateFloatingLabel() {
Common::Rect r;
_floatingLabel->getRect(0, r);
+ FloatingLabelTraits traits_NS = {
+ Common::Point(16 - r.width()/2, 34),
+ Common::Point(8 - r.width()/2, 21),
+ 0, 0, _vm->_screenWidth - r.width(), 190
+ };
+
+ // FIXME: _maxY for BRA is not constant (390), but depends on _vm->_subtitleY
+ FloatingLabelTraits traits_BR = {
+ Common::Point(34 - r.width()/2, 70),
+ Common::Point(16 - r.width()/2, 37),
+ 0, 0, _vm->_screenWidth - r.width(), 390
+ };
+
if (_gameType == GType_Nippon) {
- FloatingLabelTraits traits_NS = {
- Common::Point(16 - r.width()/2, 34),
- Common::Point(8 - r.width()/2, 21),
- 0, 0, _vm->_screenWidth - r.width(), 190
- };
traits = &traits_NS;
} else {
- // FIXME: _maxY for BRA is not constant (390), but depends on _vm->_subtitleY
- FloatingLabelTraits traits_BR = {
- Common::Point(34 - r.width()/2, 70),
- Common::Point(16 - r.width()/2, 37),
- 0, 0, _vm->_screenWidth - r.width(), 390
- };
traits = &traits_BR;
}
diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp
index 44a8899304..658a8e8795 100644
--- a/engines/parallaction/parallaction_br.cpp
+++ b/engines/parallaction/parallaction_br.cpp
@@ -289,7 +289,7 @@ void Parallaction_br::changeLocation() {
_disk->selectArchive(_partNames[_part]);
- memset(_counters, 0, ARRAYSIZE(_counters));
+ memset(_counters, 0, sizeof(_counters));
_globalFlagsNames = _disk->loadTable("global");
_objectsNames = _disk->loadTable("objects");
diff --git a/engines/parallaction/saveload.cpp b/engines/parallaction/saveload.cpp
index 5a1daa256b..3ab25f203f 100644
--- a/engines/parallaction/saveload.cpp
+++ b/engines/parallaction/saveload.cpp
@@ -49,7 +49,7 @@ Common::String SaveLoad::genSaveFileName(uint slot) {
assert(slot < NUM_SAVESLOTS || slot == SPECIAL_SAVESLOT);
char s[20];
- sprintf(s, "%s.%.3d", _saveFilePrefix.c_str(), slot);
+ sprintf(s, "%s.%.3u", _saveFilePrefix.c_str(), slot);
return Common::String(s);
}
diff --git a/engines/pegasus/detection.cpp b/engines/pegasus/detection.cpp
index 76455e976f..64e7d3280f 100644
--- a/engines/pegasus/detection.cpp
+++ b/engines/pegasus/detection.cpp
@@ -65,7 +65,7 @@ static const PegasusGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_MACRESFORK,
- Common::GUIO_NONE
+ GUIO0()
},
},
@@ -77,7 +77,7 @@ static const PegasusGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_MACRESFORK|ADGF_DEMO,
- Common::GUIO_NOLAUNCHLOAD
+ GUIO1(GUIO_NOLAUNCHLOAD)
},
},
diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp
index a10e74bfd8..c610ef9921 100644
--- a/engines/queen/queen.cpp
+++ b/engines/queen/queen.cpp
@@ -120,13 +120,13 @@ GameList QueenMetaEngine::detectGames(const Common::FSList &fslist) const {
GameDescriptor dg(queenGameDescriptor.gameid, queenGameDescriptor.description, version.language, version.platform);
if (version.features & Queen::GF_DEMO) {
dg.updateDesc("Demo");
- dg.setGUIOptions(Common::GUIO_NOSPEECH);
+ dg.setGUIOptions(GUIO_NOSPEECH);
} else if (version.features & Queen::GF_INTERVIEW) {
dg.updateDesc("Interview");
- dg.setGUIOptions(Common::GUIO_NOSPEECH);
+ dg.setGUIOptions(GUIO_NOSPEECH);
} else if (version.features & Queen::GF_FLOPPY) {
dg.updateDesc("Floppy");
- dg.setGUIOptions(Common::GUIO_NOSPEECH);
+ dg.setGUIOptions(GUIO_NOSPEECH);
} else if (version.features & Queen::GF_TALKIE) {
dg.updateDesc("Talkie");
}
diff --git a/engines/queen/talk.cpp b/engines/queen/talk.cpp
index 1f8d9b29f9..f38c78c825 100644
--- a/engines/queen/talk.cpp
+++ b/engines/queen/talk.cpp
@@ -96,7 +96,7 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) {
}
int16 oldLevel = 0;
- bool personWalking = false;
+ bool personWalking = false; // FIXME: unused
// Lines 828-846 in talk.c
for (i = 1; i <= 4; i++) {
@@ -373,7 +373,6 @@ byte *Talk::loadDialogFile(const char *filename) {
void Talk::load(const char *filename) {
int i;
byte *ptr = _fileData = loadDialogFile(filename);
- bool canQuit;
// Load talk header
@@ -381,9 +380,9 @@ void Talk::load(const char *filename) {
if (_levelMax < 0) {
_levelMax = -_levelMax;
- canQuit = false;
+ _vm->input()->canQuit(false);
} else {
- canQuit = true;
+ _vm->input()->canQuit(true);
}
_uniqueKey = (int16)READ_BE_INT16(ptr); ptr += 2;
diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp
index 091ec8d427..d39ec34cc8 100644
--- a/engines/saga/detection.cpp
+++ b/engines/saga/detection.cpp
@@ -209,7 +209,7 @@ int SagaMetaEngine::getMaximumSaveSlot() const { return MAX_SAVES - 1; }
void SagaMetaEngine::removeSaveState(const char *target, int slot) const {
Common::String filename = target;
- filename += Common::String::format(".s%02d", slot);;
+ filename += Common::String::format(".s%02d", slot);
g_system->getSavefileManager()->removeSavefile(filename);
}
diff --git a/engines/saga/detection_tables.h b/engines/saga/detection_tables.h
index 3e83c30eef..234a10acfe 100644
--- a/engines/saga/detection_tables.h
+++ b/engines/saga/detection_tables.h
@@ -164,9 +164,6 @@ static const GamePatchDescription ITEMacPatch_Files[] = {
{ NULL, 0, 0}
};
-using Common::GUIO_NONE;
-using Common::GUIO_NOSPEECH;
-
static const SAGAGameDescription gameDescriptions[] = {
// ITE Section ////////////////////////////////////////////////////////////////////////////////////////////
@@ -193,7 +190,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_ITE, // Game id
GF_OLD_ITE_DOS, // features
@@ -218,7 +215,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_DEMO,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_ITE,
0,
@@ -244,7 +241,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_DEMO,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_ITE,
0,
@@ -270,7 +267,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
- GUIO_NONE
+ GUIO0()
},
GID_ITE,
0,
@@ -296,7 +293,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO,
- GUIO_NONE
+ GUIO0()
},
GID_ITE,
GF_8BIT_UNSIGNED_PCM,
@@ -329,7 +326,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_ITE,
GF_8BIT_UNSIGNED_PCM,
@@ -353,7 +350,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_ITE,
0,
@@ -385,7 +382,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformUnknown,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_ITE,
0,
@@ -415,7 +412,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformUnknown,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_ITE,
0,
@@ -439,7 +436,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_ITE,
GF_EXTRA_ITE_CREDITS,
@@ -463,7 +460,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_ITE,
0,
@@ -487,7 +484,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_ITE,
0,
@@ -512,7 +509,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_ITE,
0,
@@ -539,7 +536,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_ITE,
GF_ITE_FLOPPY,
@@ -563,7 +560,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_ITE,
GF_ITE_FLOPPY,
@@ -587,7 +584,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_ITE,
GF_ITE_FLOPPY,
@@ -620,7 +617,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GID_IHNM,
0,
@@ -652,7 +649,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GID_IHNM,
0,
@@ -682,7 +679,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GID_IHNM,
0,
@@ -710,7 +707,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GID_IHNM,
0,
@@ -739,7 +736,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GID_IHNM,
0,
@@ -767,7 +764,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GID_IHNM,
0,
@@ -792,7 +789,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GID_IHNM,
0,
@@ -822,7 +819,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_UNSTABLE,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GID_DINO,
0,
@@ -852,7 +849,7 @@ static const SAGAGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_UNSTABLE,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GID_FTA2,
0,
diff --git a/engines/saga/gfx.cpp b/engines/saga/gfx.cpp
index ab0c0f3e4c..8e98f0fbe7 100644
--- a/engines/saga/gfx.cpp
+++ b/engines/saga/gfx.cpp
@@ -123,7 +123,7 @@ void Surface::drawPolyLine(const Point *points, int count, int color) {
drawLine(points[i].x, points[i].y, points[i - 1].x, points[i - 1].y, color);
}
- drawLine(points[count - 1].x, points[count - 1].y, points->x, points->y, color);
+ drawLine(points[count - 1].x, points[count - 1].y, points[0].x, points[0].y, color);
}
}
diff --git a/engines/saga/isomap.cpp b/engines/saga/isomap.cpp
index e886f0df82..ec6b13f313 100644
--- a/engines/saga/isomap.cpp
+++ b/engines/saga/isomap.cpp
@@ -95,7 +95,7 @@ static const int16 directions[8][2] = {
IsoMap::IsoMap(SagaEngine *vm) : _vm(vm) {
_viewScroll.x = (128 - 8) * 16;
- _viewScroll.x = (128 - 8) * 16 - 64;
+ _viewScroll.y = (128 - 8) * 16 - 64;
_viewDiff = 1;
}
diff --git a/engines/saga/saveload.cpp b/engines/saga/saveload.cpp
index 9e0789fdaf..6a5a7d8e14 100644
--- a/engines/saga/saveload.cpp
+++ b/engines/saga/saveload.cpp
@@ -44,7 +44,7 @@ static SaveFileData emptySlot = {
char* SagaEngine::calcSaveFileName(uint slotNumber) {
static char name[MAX_FILE_NAME];
- sprintf(name, "%s.s%02d", _targetName.c_str(), slotNumber);
+ sprintf(name, "%s.s%02u", _targetName.c_str(), slotNumber);
return name;
}
diff --git a/engines/saga/scene.cpp b/engines/saga/scene.cpp
index 61e62d5626..35d923f821 100644
--- a/engines/saga/scene.cpp
+++ b/engines/saga/scene.cpp
@@ -454,7 +454,6 @@ void Scene::changeScene(int16 sceneNumber, int actorsEntrance, SceneTransitionTy
if (_vm->_hasITESceneSubstitutes) {
for (int i = 0; i < ARRAYSIZE(sceneSubstitutes); i++) {
if (sceneSubstitutes[i].sceneId == sceneNumber) {
- Surface bbmBuffer;
byte *pal, colors[768];
Common::File file;
Rect rect;
@@ -463,6 +462,7 @@ void Scene::changeScene(int16 sceneNumber, int actorsEntrance, SceneTransitionTy
_vm->_interface->setMode(kPanelSceneSubstitute);
if (file.open(sceneSubstitutes[i].image)) {
+ Graphics::Surface bbmBuffer;
Graphics::decodePBM(file, bbmBuffer, colors);
pal = colors;
rect.setWidth(bbmBuffer.w);
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 2f69d5caa1..571d2f834b 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -1498,10 +1498,22 @@ bool Console::cmdDrawPic(int argc, const char **argv) {
return true;
}
- uint16 resourceId = atoi(argv[1]);
+#ifndef USE_TEXT_CONSOLE_FOR_DEBUGGER
+ // If a graphical debugger overlay is used, hide it here, so that the
+ // results can be drawn.
+ g_system->hideOverlay();
+#endif
+ uint16 resourceId = atoi(argv[1]);
_engine->_gfxPaint->kernelDrawPicture(resourceId, 100, false, false, false, 0);
_engine->_gfxScreen->copyToScreen();
+ _engine->sleep(2000);
+
+#ifndef USE_TEXT_CONSOLE_FOR_DEBUGGER
+ // Show the graphical debugger overlay
+ g_system->showOverlay();
+#endif
+
return true;
}
@@ -1864,16 +1876,17 @@ bool Console::segmentInfo(int nr) {
DebugPrintf(" Synonyms: %4d\n", scr->getSynonymsNr());
- if (scr->_localsBlock)
- DebugPrintf(" Locals : %4d in segment 0x%x\n", scr->_localsBlock->_locals.size(), scr->_localsSegment);
+ if (scr->getLocalsCount() > 0)
+ DebugPrintf(" Locals : %4d in segment 0x%x\n", scr->getLocalsCount(), scr->getLocalsSegment());
else
DebugPrintf(" Locals : none\n");
- DebugPrintf(" Objects: %4d\n", scr->_objects.size());
+ ObjMap objects = scr->getObjectMap();
+ DebugPrintf(" Objects: %4d\n", objects.size());
ObjMap::iterator it;
- const ObjMap::iterator end = scr->_objects.end();
- for (it = scr->_objects.begin(); it != end; ++it) {
+ const ObjMap::iterator end = objects.end();
+ for (it = objects.begin(); it != end; ++it) {
DebugPrintf(" ");
// Object header
const Object *obj = _engine->_gamestate->_segMan->getObject(it->_value.getPos());
@@ -2930,9 +2943,10 @@ void Console::printKernelCallsFound(int kernelFuncNum, bool showFoundScripts) {
script = customSegMan->getScript(scriptSegment);
// Iterate through all the script's objects
+ ObjMap objects = script->getObjectMap();
ObjMap::iterator it;
- const ObjMap::iterator end = script->_objects.end();
- for (it = script->_objects.begin(); it != end; ++it) {
+ const ObjMap::iterator end = objects.end();
+ for (it = objects.begin(); it != end; ++it) {
const Object *obj = customSegMan->getObject(it->_value.getPos());
const char *objName = customSegMan->getObjectName(it->_value.getPos());
@@ -2964,7 +2978,8 @@ void Console::printKernelCallsFound(int kernelFuncNum, bool showFoundScripts) {
// there is a jump after a ret, we don't stop processing
if (opcode == op_bt || opcode == op_bnt || opcode == op_jmp) {
uint16 curJmpOffset = offset + (uint16)opparams[0];
- if (curJmpOffset > maxJmpOffset)
+ // QFG2 has invalid jumps outside the script buffer in script 260
+ if (curJmpOffset > maxJmpOffset && curJmpOffset < script->getScriptSize())
maxJmpOffset = curJmpOffset;
}
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index 56da696592..80f45b4325 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -373,7 +373,7 @@ static ADGameDescription s_fallbackDesc = {
Common::UNK_LANG,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO0()
};
static char s_fallbackGameIdBuf[256];
@@ -435,7 +435,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
s_fallbackDesc.flags = ADGF_NO_FLAGS;
s_fallbackDesc.platform = Common::kPlatformPC; // default to PC platform
s_fallbackDesc.gameid = "sci";
- s_fallbackDesc.guioptions = Common::GUIO_NONE;
+ s_fallbackDesc.guioptions = GUIO0();
if (allFiles.contains("resource.map") || allFiles.contains("Data1")
|| allFiles.contains("resmap.001") || allFiles.contains("resmap.001")) {
@@ -565,7 +565,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
const bool isCD = (s_fallbackDesc.flags & ADGF_CD);
if (!isCD)
- s_fallbackDesc.guioptions |= Common::GUIO_NOSPEECH;
+ s_fallbackDesc.guioptions = GUIO1(GUIO_NOSPEECH);
if (gameId.hasSuffix("sci")) {
s_fallbackDesc.extra = "SCI";
diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h
index 455223a086..63eda1c348 100644
--- a/engines/sci/detection_tables.h
+++ b/engines/sci/detection_tables.h
@@ -29,15 +29,11 @@ namespace Sci {
{"sci-fanmade", name, { \
{"resource.map", 0, resMapMd5, resMapSize}, \
{"resource.001", 0, resMd5, resSize}, \
- AD_LISTEND}, lang, Common::kPlatformPC, 0, GUIO_NOSPEECH \
+ AD_LISTEND}, lang, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) \
}
#define FANMADE(name, resMapMd5, resMapSize, resMd5, resSize) FANMADE_L(name, resMapMd5, resMapSize, resMd5, resSize, Common::EN_ANY)
-using Common::GUIO_NONE;
-using Common::GUIO_NOSPEECH;
-using Common::GUIO_MIDIGM;
-
// Game descriptions
static const struct ADGameDescription SciGameDescriptions[] = {
// Astro Chicken - English DOS
@@ -46,7 +42,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "f3d1be7752d30ba60614533d531e2e98", 474},
{"resource.001", 0, "6fd05926c2199af0af6f72f90d0d7260", 126895},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Castle of Dr. Brain - English Amiga (from www.back2roots.org)
// Executable scanning reports "1.005.000"
@@ -58,7 +54,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "d226d7d3b4f77c4a566913fc310487fc", 792380},
{"resource.003", 0, "d226d7d3b4f77c4a566913fc310487fc", 464348},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
// Castle of Dr. Brain - German Amiga (from www.back2roots.org, also includes English language)
// Executable scanning reports "1.005.001"
@@ -70,7 +66,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "85e51acb5f9c539d66e3c8fe40e17da5", 826309},
{"resource.003", 0, "85e51acb5f9c539d66e3c8fe40e17da5", 493638},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// Castle of Dr. Brain Macintosh (from omer_mor, bug report #3328251)
{"castlebrain", "", {
@@ -80,7 +76,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "e1a6b6f1060f60be9dcb6d28ad7a2a20", 1168310},
{"resource.003", 0, "6c3d1bb26ad532c94046bc9ac49b5ff4", 891295},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO1(GUIO_NOSPEECH) },
// Castle of Dr. Brain - English DOS Non-Interactive Demo
// SCI interpreter version 1.000.005
@@ -89,7 +85,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "9780f040d58182994e22d2e34fab85b0", 67367},
{"resource.001", 0, "2af49dbd8f2e1db4ab09f9310dc91259", 570553},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
// Castle of Dr. Brain - English DOS 5.25" Floppy EGA (from omer_mor, bug report #3035349)
{"castlebrain", "EGA", {
@@ -102,7 +98,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "8a5ed3ba96e2eaf18e36fedfaab89419", 297838},
{"resource.006", 0, "dceed92e709cad1bd9582809a235b0a0", 266682},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Castle of Dr. Brain - English DOS 3.5" Floppy EGA (from nozomi77, bug report #3405307)
{"castlebrain", "EGA", {
@@ -112,7 +108,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "de2f182529efaad2c4b510b452ab77ac", 633662},
{"resource.003", 0, "38b4b37febc6b4f5061c461a283df148", 430388},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// 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"
@@ -123,7 +119,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "d2f5a1be74ed963fa849a76892be5290", 794832},
{"resource.002", 0, "c0c29c51af66d65cb53f49e785a2d978", 1280907},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Castle of Dr. Brain - English DOS Floppy 1.1
{"castlebrain", "", {
@@ -132,7 +128,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "13e81e1839cd7b216d2bb5615c1ca160", 796776},
{"resource.002", 0, "930e416bec196b9703a331d81b3d66f2", 1283812},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Castle of Dr. Brain - English DOS Floppy 1.000
// Reported by graxer in bug report #3037942
@@ -147,7 +143,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "1d778a0c65cac9ddbab65495e50a94ee", 335281},
{"resource.007", 0, "063bb8ce4157c778cf30d1c912c006f1", 335631},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Castle of Dr. Brain - Spanish DOS (also includes english language)
// SCI interpreter version 1.000.510
@@ -156,7 +152,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "27ec5fa09cd12a7fd16e86d96a2ed245", 1197694},
{"resource.001", 0, "735be4e58957180cfc807d5e18fdffcd", 1433302},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// Christmas Card 1988 - English DOS
// SCI interpreter version 0.000.294
@@ -164,7 +160,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "39485580d34a72997f3d5b3aba4d24f1", 426},
{"resource.001", 0, "11391434f41c834090d7a1e9488ce936", 129739},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Christmas Card 1990: The Seasoned Professional - English DOS (16 Colors)
// SCI interpreter version 1.000.172
@@ -172,7 +168,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "8f656714a05b94423ac6eb10ee8797d0", 600},
{"resource.001", 0, "acde93e58fca4f7a2a5a220558a94aa8", 272629},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Christmas Card 1990: The Seasoned Professional - English DOS (256 Colors)
// SCI interpreter version 1.000.174
@@ -180,7 +176,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "44b8f45b841b9b5e17e939a35e443988", 600},
{"resource.001", 0, "acde93e58fca4f7a2a5a220558a94aa8", 335362},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Christmas Card 1992 - English DOS
// SCI interpreter version 1.001.055
@@ -188,7 +184,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "f1f8c8a8443f523422af70b4ec85b71c", 318},
{"resource.000", 0, "62fb9256f8e7e6e65a6875efdb7939ac", 203396},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Codename: Iceman - English Amiga (from www.back2roots.org)
// Executable scanning reports "1.002.031"
@@ -202,7 +198,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "8613c45fc771d658e5a505b9a4a54f31", 713382},
{"resource.005", 0, "605b67a9ef199a9bb015745e7c004cf4", 478384},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Codename: Iceman - English DOS Non-Interactive Demo
// Executable scanning reports "0.000.685"
@@ -210,7 +206,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "782974f29d8a824782d2d4aea39964e3", 1056},
{"resource.001", 0, "d4b75e280d1c3a97cfef1b0bebff387c", 573647},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Codename: Iceman - English DOS (from jvprat)
// Executable scanning reports "0.000.685", Floppy label reports "1.033, 6.8.90", VERSION file reports "1.033"
@@ -223,7 +219,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "d97a96f1ab91b41cf46a02cc89b0a04e", 624303},
{"resource.004", 0, "8613c45fc771d658e5a505b9a4a54f31", 670883},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Codename: Iceman - English DOS (from FRG)
// SCI interpreter version 0.000.668
@@ -235,7 +231,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "dc7c5280e7acfaffe6ef2a6c963c5f94", 622118},
{"resource.004", 0, "64f342463f6f35ba71b3509ef696ae3f", 669188},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Codename: Iceman - English DOS (supplied by ssburnout in bug report #3049193)
// 1.022 9x5.25" (label: Int#0.000.668)
@@ -250,7 +246,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "08050329aa113a9f14ed99cbfe3536ec", 232942},
{"resource.007", 0, "64f342463f6f35ba71b3509ef696ae3f", 267811},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Codename: Iceman - English DOS 1.023 (from abevi, bug report #2612718)
{"iceman", "", {
@@ -264,7 +260,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "08050329aa113a9f14ed99cbfe3536ec", 232942},
{"resource.007", 0, "64f342463f6f35ba71b3509ef696ae3f", 267702},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Conquests of Camelot - English Amiga (from www.back2roots.org)
// Executable scanning reports "1.002.030"
@@ -279,7 +275,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "c6e551bdc24f0acc193159038d4ca767", 605882},
{"resource.006", 0, "8f880a536908ab496bbc552f7f5c3738", 585255},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Conquests of Camelot - English DOS Non-Interactive Demo
// SCI interpreter version 0.000.668
@@ -287,7 +283,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "f4cd75c15be75e04cdca3acda2c0b0ea", 468},
{"resource.001", 0, "4930708722f34bfbaa4945fb08f55f61", 232523},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Conquests of Camelot - English DOS (from jvprat)
// Executable scanning reports "0.000.685", Floppy label reports "1.001, 0.000.685", VERSION file reports "1.001.000"
@@ -299,7 +295,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "8e1a3a8c588007404b532b8dfacc1460", 723712},
{"resource.004", 0, "8e1a3a8c588007404b532b8dfacc1460", 729143},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Conquests of Camelot - English DOS
// SCI interpreter version 0.000.685
@@ -313,7 +309,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "8e1a3a8c588007404b532b8dfacc1460", 332446},
{"resource.007", 0, "8e1a3a8c588007404b532b8dfacc1460", 358182},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Conquests of the Longbow - English Amiga (from www.back2roots.org)
// Executable scanning reports "1.005.001"
@@ -328,7 +324,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "1c3804e56b114028c5873a35c2f06d13", 653002},
{"resource.006", 0, "f9487732289a4f4966b4e34eea413325", 842817},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
// Conquests of the Longbow - English DOS
// SCI interpreter version 1.000.510
@@ -342,7 +338,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "d036df0872f2db19bca34601276be2d7", 1154950},
{"resource.006", 0, "b367a6a59f29ee30dde1d88a5a41152d", 1042966},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Conquests of the Longbow - English DOS Floppy (from jvprat)
// Executable scanning reports "1.000.168", Floppy label reports "1.1, 1.13.92", VERSION file reports "1.1"
@@ -356,7 +352,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "9cfce07e204a329e94fda8b5657621da", 1261462},
{"resource.005", 0, "21ebe6b39b57a73fc449f67f013765aa", 1284720},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Conquests of the Longbow - English DOS
// SCI interpreter version 1.000.510
@@ -369,7 +365,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "9cfce07e204a329e94fda8b5657621da", 1260237},
{"resource.005", 0, "21ebe6b39b57a73fc449f67f013765aa", 1284609},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Conquests of the Longbow EGA - English DOS
// SCI interpreter version 1.000.510
@@ -382,7 +378,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "b7bb35c027bb424ecefcd122768e5e60", 705631},
{"resource.005", 0, "58942b1aa6d6ffeb66e9f8897fd4435f", 469243},
{"resource.006", 0, "8c767b3939add63d11274065e46aad04", 713158},
- AD_LISTEND}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ AD_LISTEND}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Conquests of the Longbow DOS 1.0 EGA (4 x 5.25" disks)
// Provided by ssburnout in bug report #3046802
@@ -392,7 +388,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "76c729e563809170e6cc8b2f3f6cf0a4", 1196133},
{"resource.002", 0, "8c767b3939add63d11274065e46aad04", 1152478},
{"resource.003", 0, "7025b87e735b1df3f0e9488a621f4333", 1171439},
- AD_LISTEND}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ AD_LISTEND}, Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Conquests of the Longbow - English DOS Non-Interactive Demo
// SCI interpreter version 1.000.510
@@ -400,7 +396,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "cbc5cb73341de1bff1b1e20a640af220", 588},
{"resource.001", 0, "f05a20cc07eee85da8e999d0ac0f596b", 869916},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
// Conquests of the Longbow - German DOS (suplied by markcoolio in bug report #2727681, also includes english language)
// SCI interpreter version 1.000.510
@@ -414,7 +410,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "d036df0872f2db19bca34601276be2d7", 1176914},
{"resource.006", 0, "b367a6a59f29ee30dde1d88a5a41152d", 1123585},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// Eco Quest - English DOS Non-Interactive Demo (from FRG)
// Executable scanning reports "x.yyy.zzz"
@@ -423,7 +419,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "c819e171359b7c95f4c13b846d5c034e", 873},
{"resource.001", 0, "baf9393a9bfa73098adb501e5bc5487b", 657518},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
// Eco Quest - English DOS CD 1.1
// SCI interpreter version 1.001.064
@@ -431,7 +427,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a4b73d5d2b55bdb6e44345e99c8fbdd0", 4804},
{"resource.000", 0, "d908dbef56816ac6c60dd145fdeafb2b", 3536046},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO0() },
// Eco Quest - English DOS CD 1.1
// SCI interpreter version 1.001.064
@@ -441,7 +437,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a4b73d5d2b55bdb6e44345e99c8fbdd0", 4804},
{"resource.000", 0, "d908dbef56816ac6c60dd145fdeafb2b", 3536046},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO_MIDIGM },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO1(GUIO_MIDIGM) },
// Eco Quest - English DOS Floppy
// SCI interpreter version 1.000.510
@@ -452,7 +448,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "28fe9b4f0567e71feb198bc9f3a2c605", 1241816},
{"resource.003", 0, "f3146df0ad4297f5ce35aa8c4753bf6c", 586832},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Eco Quest - English DOS Floppy
// SCI interpreter version 1.000.510
@@ -463,7 +459,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "323b3b12f43d53f27d259beb225f0aa7", 1129316},
{"resource.003", 0, "83ac03e4bddb2c1ac2d36d2a587d0536", 1145616},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Eco Quest - German DOS Floppy (supplied by markcoolio in bug report #2723744, also includes english language)
// SCI interpreter version 1.000.510
@@ -474,7 +470,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "02d7d0411f7903aacb3bc8b0f8ca8a9a", 1202581},
{"resource.003", 0, "84dd11b6825255671c703aee5ceff620", 1175835},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// Eco Quest - Spanish DOS Floppy (from jvprat, also includes english language)
// Executable scanning reports "1.ECO.013", VERSION file reports "1.000, 11.12.92"
@@ -486,7 +482,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "2d21a1d2dcbffa551552e3e0725d2284", 1186033},
{"resource.003", 0, "84dd11b6825255671c703aee5ceff620", 1174993},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// Eco Quest - French DOS Floppy (from Strangerke, also includes english language)
// SCI interpreter version 1.ECO.013
@@ -497,7 +493,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "b836c6ee9de67d814ac5d1b05f5b9858", 1173872},
{"resource.003", 0, "f8f767f9d6351432621c6e54c1b2ba8c", 1141520},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::FR_FRA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// Eco Quest 2 - English DOS Non-Interactive Demo
// SCI interpreter version 1.001.055
@@ -505,7 +501,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "607cfa0d8a03b7d348c06ee727e3d939", 1321},
{"resource.000", 0, "dd6f614c43c029f063e93cd243af90a4", 525992},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
// Eco Quest 2 - English DOS Floppy (supplied by markcoolio in bug report #2723761)
// SCI interpreter version 1.001.065
@@ -513,7 +509,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "28fb7b6abb9fc1cb8882d7c2e701b63f", 5658},
{"resource.000", 0, "cc1d17e5637528dbe4a812699e1cbfc6", 4208192},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Eco Quest 2 - French DOS Floppy (from Strangerke)
// SCI interpreter version 1.001.081
@@ -521,7 +517,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "c22ab8b33c339c138b6b1697b77b9e79", 5588},
{"resource.000", 0, "1c4093f7248240329121fdf8c0d59152", 4231946},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::FR_FRA, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Eco Quest 2 - Spanish DOS Floppy (supplied by umbrio in bug report #3313962)
{"ecoquest2", "Floppy", {
@@ -529,7 +525,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "1c4093f7248240329121fdf8c0d59152", 4209150},
{"resource.msg", 0, "eff8be1925d42288de55e405983e9314", 117810},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::ES_ESP, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Freddy Pharkas - English DOS demo (from FRG)
// SCI interpreter version 1.001.069
@@ -537,7 +533,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "97aa9fcfe84c9993a64debd28c32393a", 1909},
{"resource.000", 0, "5ea8e7a3ea10cce6efd5c106dc62fd8c", 867724},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
// Freddy Pharkas - English CD DOS (from FRG)
// SCI interpreter version 1.001.132
@@ -545,7 +541,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "d46b282f228a67ba13bd4b4009e95f8f", 6058},
{"resource.000", 0, "ee3c64ffff0ba9fb08bea2624631c598", 5490246},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO0() },
// Freddy Pharkas - English DOS Floppy (updated information from markcoolio in bug reports #2723773 and #2724720)
// Executable scanning reports "1.cfs.081"
@@ -555,7 +551,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "96b07e9b914dba1c8dc6c78a176326df", 5233230},
{"resource.msg", 0, "554f65315d851184f6e38211489fdd8f", -1},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Freddy Pharkas - Windows (supplied by abevi in bug report #2612718)
// Executable scanning reports "1.cfs.081"
@@ -564,7 +560,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a32674e7fbf7b213b4a066c8037f16b6", 5816},
{"resource.000", 0, "fed4808fdb72486908ac7ad0044b14d8", 5233230},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformWindows, 0, GUIO1(GUIO_NOSPEECH) },
// Freddy Pharkas - German DOS Floppy (from Tobis87, updated information from markcoolio in bug reports #2723772 and #2724720)
// Executable scanning reports "1.cfs.081"
@@ -574,7 +570,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "96b07e9b914dba1c8dc6c78a176326df", 5233230},
{"resource.msg", 0, "304b5a5781800affd2235152a5794fa8", -1},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Freddy Pharkas - Spanish DOS (from jvprat)
// Executable scanning reports "1.cfs.081", VERSION file reports "1.000, March 30, 1995"
@@ -587,7 +583,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "05acdc256c742e79c50b9fe7ec2cc898", 863310},
{"resource.msg", 0, "45b5bf74933ac3727e4cc844446dc052", 796156},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_CD, GUIO_NONE },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_CD, GUIO0() },
// Freddy Pharkas - Spanish DOS (from jvprat)
// Executable scanning reports "1.cfs.081", VERSION file reports "1.000, March 30, 1995"
@@ -597,7 +593,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "96b07e9b914dba1c8dc6c78a176326df", 5233230},
{"resource.msg", 0, "45b5bf74933ac3727e4cc844446dc052", 796156},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::ES_ESP, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Freddy Pharkas - English DOS CD Demo
// SCI interpreter version 1.001.095
@@ -605,14 +601,14 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a62a7eae85dd1e6b07f39662b278437e", 1918},
{"resource.000", 0, "4962a3c4dd44e36e78ea4a7a374c2220", 957382},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO0() },
// Freddy Pharkas - English Macintosh
{"freddypharkas", "", {
{"Data1", 0, "ef7cbd62727989818f1cfae69c9fd61d", 3038492},
{"Data2", 0, "2424b418f7d52c385cea4701f529c69a", 4721732},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK, GUIO1(GUIO_NOSPEECH) },
// Fun Seeker's Guide - English DOS
// SCI interpreter version 0.000.506
@@ -620,7 +616,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "7ee6859ef74314f6d91938c3595348a9", 282},
{"resource.001", 0, "f1e680095424e31f7fae1255d36bacba", 40692},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Gabriel Knight - English DOS CD Demo
// SCI interpreter version 1.001.092
@@ -628,7 +624,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "39645952ae0ed8072c7e838f31b75464", 2490},
{"resource.000", 0, "eb3ed7477ca4110813fe1fcf35928561", 1718450},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO0() },
#ifdef ENABLE_SCI32
// Gabriel Knight - English DOS Floppy
@@ -637,7 +633,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "372d059f75856afa6d73dd84cbb8913d", 10783},
{"resource.000", 0, "69b7516962510f780d38519cc15fcc7c", 13022630},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOSPEECH) },
// Gabriel Knight - English DOS Floppy (supplied my markcoolio in bug report #2723777)
// SCI interpreter version 2.000.000
@@ -645,7 +641,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "65e8c14092e4c9b3b3538b7602c8c5ec", 10783},
{"resource.000", 0, "69b7516962510f780d38519cc15fcc7c", 13022630},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOSPEECH) },
// Gabriel Knight - English DOS Floppy
// SCI interpreter version 2.000.000, VERSION file reports "1.0\nGabriel Knight\n11/22/10:33 pm\n\x1A"
@@ -653,7 +649,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "ef41df08cf2c1f680216cdbeed0f8311", 10783},
{"resource.000", 0, "69b7516962510f780d38519cc15fcc7c", 13022630},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOSPEECH) },
// Gabriel Knight - German DOS Floppy (supplied my markcoolio in bug report #2723775)
// SCI interpreter version 2.000.000
@@ -661,7 +657,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "ad6508b0296b25c07b1f58828dc33696", 10789},
{"resource.000", 0, "091cf08910780feabc56f8551b09cb36", 13077029},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOSPEECH) },
// Gabriel Knight - English DOS CD (from jvprat)
// Executable scanning reports "2.000.000", VERSION file reports "01.100.000"
@@ -669,7 +665,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "372d059f75856afa6d73dd84cbb8913d", 10996},
{"resource.000", 0, "69b7516962510f780d38519cc15fcc7c", 12581736},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO0() },
// Gabriel Knight - English Windows CD (from jvprat)
// Executable scanning reports "2.000.000", VERSION file reports "01.100.000"
@@ -677,7 +673,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "372d059f75856afa6d73dd84cbb8913d", 10996},
{"resource.000", 0, "69b7516962510f780d38519cc15fcc7c", 12581736},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_CD | ADGF_UNSTABLE, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_CD | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// Gabriel Knight - German DOS CD (from Tobis87)
// SCI interpreter version 2.000.000
@@ -685,7 +681,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a7d3e55114c65647310373cb390815ba", 11392},
{"resource.000", 0, "091cf08910780feabc56f8551b09cb36", 13400497},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO_NONE },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO0() },
// Gabriel Knight - Spanish DOS CD (from jvprat)
// Executable scanning reports "2.000.000", VERSION file reports "1.000.000, April 13, 1995"
@@ -693,7 +689,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "7cb6e9bba15b544ec7a635c45bde9953", 11404},
{"resource.000", 0, "091cf08910780feabc56f8551b09cb36", 13381599},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO_NONE },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO0() },
// Gabriel Knight - French DOS CD (from Hkz)
// VERSION file reports "1.000.000, May 3, 1994"
@@ -701,7 +697,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "55f909ba93a2515042a08d8a2da8414e", 11392},
{"resource.000", 0, "091cf08910780feabc56f8551b09cb36", 13325145},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO_NONE },
+ Common::FR_FRA, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO0() },
// Gabriel Knight - German Windows CD (from Tobis87)
// SCI interpreter version 2.000.000
@@ -709,7 +705,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a7d3e55114c65647310373cb390815ba", 11392},
{"resource.000", 0, "091cf08910780feabc56f8551b09cb36", 13400497},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformWindows, ADGF_CD | ADGF_UNSTABLE, GUIO_NONE },
+ Common::DE_DEU, Common::kPlatformWindows, ADGF_CD | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// Gabriel Knight - Spanish Windows CD (from jvprat)
// Executable scanning reports "2.000.000", VERSION file reports "1.000.000, April 13, 1995"
@@ -717,7 +713,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "7cb6e9bba15b544ec7a635c45bde9953", 11404},
{"resource.000", 0, "091cf08910780feabc56f8551b09cb36", 13381599},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformWindows, ADGF_CD | ADGF_UNSTABLE, GUIO_NONE },
+ Common::ES_ESP, Common::kPlatformWindows, ADGF_CD | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// Gabriel Knight - English Macintosh
{"gk1", "", {
@@ -726,7 +722,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"Data3", 0, "f25068b408b09275d8b698866462f578", 3677599},
{"Data4", 0, "1cceebbe411b26c860a74f91c337fdf3", 3230086},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK | ADGF_UNSTABLE, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// Gabriel Knight 2 - English Windows Non-Interactive Demo
// Executable scanning reports "2.100.002"
@@ -734,7 +730,15 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "e0effce11c4908f4b91838741716c83d", 1351},
{"resource.000", 0, "d04cfc7f04b6f74d13025378be49ec2b", 4640330},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
+
+ // Gabriel Knight 2 - English DOS (GOG version) - ressci.* merged in ressci.000
+ // using Enrico Rolfi's HD/DVD installer: http://gkpatches.vogons.zetafleet.com/
+ {"gk2", "", {
+ {"resmap.000", 0, "b996fa1e57389a1e179a00a0049de1f4", 8110},
+ {"ressci.000", 0, "a19fc3604c6e5407abcf03d59ee87217", 168522221},
+ AD_LISTEND},
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// Gabriel Knight 2 - English DOS (from jvprat)
// Executable scanning reports "2.100.002", VERSION file reports "1.1"
@@ -752,7 +756,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.006", 0, "ce9359037277b7d7976da185c2fa0aad", 2977},
{"ressci.006", 0, "8e44e03890205a7be12f45aaba9644b4", 60659424},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// Gabriel Knight 2 - French DOS (6-CDs Sierra Originals reedition)
// Executable scanning reports "2.100.002", VERSION file reports "1.0"
@@ -770,8 +774,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.006", 0, "11b2e722170b8c93fdaa5428e2c7676f", 3001},
{"ressci.006", 0, "4037d941aec39d2e654e20960429aefc", 60568486},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, ADGF_UNSTABLE,
- GUIO_NOSPEECH },
+ Common::FR_FRA, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// Gabriel Knight 2 - English Macintosh
// NOTE: This only contains disc 1 files (as well as the persistent file:
@@ -783,7 +786,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"Data4", 0, "8b843c62eb53136a855d6e0087e3cb0d", 5889553},
{"Data5", 0, "f9fcf9ab2eb13b2125c33a1cda03a093", 14349984},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK | ADGF_UNSTABLE, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
#endif // ENABLE_SCI32
@@ -795,7 +798,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "e0dd44069a62a463fd124974b915f10d", 342149},
{"resource.003", 0, "e0dd44069a62a463fd124974b915f10d", 328925},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Hoyle 1 - English DOS (supplied by wibble92 in bug report #2644547)
// SCI interpreter version 0.000.530
@@ -805,7 +808,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "e0dd44069a62a463fd124974b915f10d", 342309},
{"resource.003", 0, "e0dd44069a62a463fd124974b915f10d", 328912},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Hoyle 1 - English DOS (supplied by merkur in bug report #2719227)
// SCI interpreter version 0.000.530
@@ -813,14 +816,14 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "1034a218943d12f1f36e753fa10c95b8", 4386},
{"resource.001", 0, "e0dd44069a62a463fd124974b915f10d", 518308},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Hoyle 1 3.5' - English DOS (supplied by eddydrama in bug report #3052366 and dinnerx in bug report #3090841)
{"hoyle1", "", {
{"resource.map", 0, "0af9a3dcd72a091960de070432e1f524", 4386},
{"resource.001", 0, "e0dd44069a62a463fd124974b915f10d", 518127},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
#if 0 // TODO: unknown if these files are corrupt
// Hoyle 1 - English Amiga (from www.back2roots.org)
@@ -830,7 +833,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "e0dd44069a62a463fd124974b915f10d", 218755},
{"resource.002", 0, "e0dd44069a62a463fd124974b915f10d", 439502},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
#endif
// Hoyle 2 - English DOS
@@ -840,7 +843,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "8f2dd70abe01112eca464cda818b5eb6", 98138},
{"resource.002", 0, "8f2dd70abe01112eca464cda818b5eb6", 196631},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Hoyle 2 - English DOS (supplied by ssburnout in bug report #3049193)
// 1.000.011 1x3.5" (label:Int#6.21.90)
@@ -848,7 +851,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "db0ba08b953e9904a4960ad99cd29c20", 1356},
{"resource.001", 0, "8f2dd70abe01112eca464cda818b5eb6", 216315},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Hoyle 2 - English Amiga (from www.back2roots.org)
// Executable scanning reports "1.002.032"
@@ -857,7 +860,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "62ed48d20c580e5a98f102f7cd93706a", 1356},
{"resource.001", 0, "8f2dd70abe01112eca464cda818b5eb6", 222704},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
// Hoyle 2 - English Macintosh
// Executable scanning reports "x.yyy.zzz"
@@ -865,7 +868,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "1af1d3aa3cf564f93477c9f87e53f495", 1728},
{"resource.001", 0, "b73b8131669d69d41a326415e4519138", 482882},
{NULL, 0, NULL, 0}},
- Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO1(GUIO_NOSPEECH) },
#if 0 // TODO: unknown if these files are corrupt
// Hoyle 3 - English Amiga (from www.back2roots.org)
@@ -876,7 +879,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "595b6039ea1356e7f96a52c58eedcf22", 355791},
{"resource.001", 0, "143df8aef214a2db34c2d48190742012", 632273},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
#endif
// Hoyle 3 - English DOS Non-Interactive Demo
@@ -886,7 +889,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "0d06cacc87dc21a08cd017e73036f905", 735},
{"resource.001", 0, "24db2bccda0a3c43ac4a7b5edb116c7e", 797678},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
// Hoyle 3 - English DOS Floppy (from jvprat)
// Executable scanning reports "x.yyy.zzz", Floppy label reports "1.0, 11.2.91", VERSION file reports "1.000"
@@ -896,7 +899,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "6ef28cac094dcd97fdb461662ead6f92", 541845},
{"resource.001", 0, "0a98a268ee99b92c233a0d7187c1f0fa", 845795},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Hoyle 3 - English DOS Floppy (supplied by eddydrama in bug report #3038837)
{"hoyle3", "", {
@@ -907,7 +910,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "97cfd72633f8f9b2a0b1d4116cf3ee81", 346116},
{"resource.004", 0, "2884fb91b225fabd9ca87ea231293b48", 351218},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Hoyle 3 EGA - English DOS Floppy 1.0 (supplied by abevi in bug report #2612718)
{"hoyle3", "EGA", {
@@ -915,14 +918,14 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "6ef28cac094dcd97fdb461662ead6f92", 319905},
{"resource.001", 0, "0a98a268ee99b92c233a0d7187c1f0fa", 526438},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Hoyle 4 (Hoyle Classic Card Games) - English DOS Demo
{"hoyle4", "Demo", {
{"resource.map", 0, "60f764020a6b788bbbe415dbc2ccb9f3", 931},
{"resource.000", 0, "5fe3670e3ddcd4f85c10013b5453141a", 615522},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
// Hoyle 4 (Hoyle Classic Card Games) - English DOS Demo
// SCI interpreter version 1.001.200 (just a guess)
@@ -931,7 +934,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "662087cb383e52e3cc4ae7ecb10e20aa", 938},
{"resource.000", 0, "24c10844792c54d476d272213cbac300", 675252},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
// Hoyle 4 (Hoyle Classic Card Games) - English DOS/Win
// Supplied by abevi in bug report #3039291
@@ -939,7 +942,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "2b577c975cc8d8d43f61b6a756129fe3", 4352},
{"resource.000", 0, "43e2c15ce436aab611a462ad0603e12d", 2000132},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Hoyle 4 (Hoyle Classic Card Games) - English Macintosh Floppy
// VERSION file reports "2.0"
@@ -947,7 +950,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"Data1", 0, "99575fae4579540a314bbedd72d51e8c", 7682887},
{"Data2", 0, "7d4bf5bdf3c02edbf35cb8471c84ec13", 1539134},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK, GUIO1(GUIO_NOSPEECH) },
// Jones in the Fast Lane EGA - English DOS
// SCI interpreter version 1.000.172 (not 100% sure FIXME)
@@ -956,14 +959,14 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "bac3ec6cb3e3920984ab0f32becf5163", 202105},
{"resource.002", 0, "b86daa3ba2784d1502da881eedb80d9b", 341771},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Jones in the Fast Lane EGA - English DOS (supplied by EddyDrama in bug report #3038761)
{"jones", "EGA", {
{"resource.map", 0, "8e92cf319180cc8b5b87b2ce93a4fe22", 1602},
{"resource.001", 0, "bac3ec6cb3e3920984ab0f32becf5163", 511528},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Jones in the Fast Lane VGA - English DOS
// SCI interpreter version 1.000.172
@@ -972,7 +975,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "bac3ec6cb3e3920984ab0f32becf5163", 313476},
{"resource.002", 0, "b86daa3ba2784d1502da881eedb80d9b", 719747},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Jones in the Fast Lane VGA - English DOS (supplied by omer_mor in bug report #3037054)
// VERSION file reports "1.000.060"
@@ -980,14 +983,14 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "db175ab494ab0666f19ab8f2597a8e49", 1602},
{"resource.001", 0, "bac3ec6cb3e3920984ab0f32becf5163", 994487},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Jones in the Fast Lane - English DOS CD
{"jones", "CD", {
{"resource.map", 0, "459f5b04467bc2107aec02f5c4b71b37", 4878},
{"resource.001", 0, "3876da2ce16fb7dea2f5d943d946fa84", 1652150},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO0() },
// Jones in the Fast Lane - English DOS CD
// Same entry as the DOS version above. This one is used for the alternate
@@ -996,7 +999,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "459f5b04467bc2107aec02f5c4b71b37", 4878},
{"resource.001", 0, "3876da2ce16fb7dea2f5d943d946fa84", 1652150},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO_MIDIGM },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO1(GUIO_MIDIGM) },
// King's Quest 1 SCI Remake - English Amiga (from www.back2roots.org)
// Executable scanning reports "1.003.007"
@@ -1008,7 +1011,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "9ae2a13708d691cd42f9129173c4b39d", 763224},
{"resource.004", 0, "9ae2a13708d691cd42f9129173c4b39d", 820443},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
// King's Quest 1 SCI Remake - English DOS Non-Interactive Demo
// Executable scanning reports "S.old.010"
@@ -1016,7 +1019,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "59b13619078bd47011421468959ee5d4", 954},
{"resource.001", 0, "4cfb9040db152868f7cb6a1e8151c910", 296555},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// King's Quest 1 SCI Remake - English DOS (from the King's Quest Collection)
// Executable scanning reports "S.old.010", VERSION file reports "1.000.051"
@@ -1027,7 +1030,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "fed9e0072ffd511d248674e60dee2099", 714062},
{"resource.003", 0, "fed9e0072ffd511d248674e60dee2099", 717478},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// King's Quest 1 SCI Remake - English DOS (supplied by ssburnout in bug report #3049193)
// 1.000.051 9x5.25" (label: INT#9.19.90)
@@ -1041,7 +1044,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "fed9e0072ffd511d248674e60dee2099", 351062},
{"resource.007", 0, "fed9e0072ffd511d248674e60dee2099", 330472},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// King's Quest 4 - English Amiga (from www.back2roots.org)
// Executable scanning reports "1.002.032"
@@ -1054,7 +1057,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "fd16c9c223f7dc5b65f06447615224ff", 683016},
{"resource.004", 0, "3fac034c7d130e055d05bc43a1f8d5f8", 549993},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// King's Quest 4 - English DOS Non-Interactive Demo
// Executable scanning reports "0.000.494"
@@ -1062,7 +1065,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "992ac7cc31d3717fe53818a9bb6d1dae", 594},
{"resource.001", 0, "143e1c14f15ad0fbfc714f648a65f661", 205330},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// King's Quest 4 - English DOS (original boxed release, 3 1/2" disks)
// SCI interpreter version 0.000.247
@@ -1073,7 +1076,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "851a62d00972dc4002f472cc0d84e71d", 683145},
{"resource.004", 0, "851a62d00972dc4002f472cc0d84e71d", 649441},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// King's Quest 4 - English DOS (from the King's Quest Collection)
// Executable scanning reports "0.000.502"
@@ -1085,7 +1088,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "77615c595388acf3d1df8e107bfb6b52", 707591},
{"resource.004", 0, "77615c595388acf3d1df8e107bfb6b52", 479562},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// King's Quest 4 - English DOS (supplied by ssburnout in bug report #3049193)
// 1.006.003 8x5.25" (label: Int.#0.000.502)
@@ -1099,7 +1102,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "6db7de6f93c6ea62dca78abee677f8c0", 324789},
{"resource.007", 0, "6db7de6f93c6ea62dca78abee677f8c0", 334441},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// King's Quest 4 - English DOS
// SCI interpreter version 0.000.274
@@ -1113,7 +1116,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "851a62d00972dc4002f472cc0d84e71d", 333777},
{"resource.007", 0, "851a62d00972dc4002f472cc0d84e71d", 341038},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// King's Quest 4 - English DOS
// SCI interpreter version 0.000.253
@@ -1127,7 +1130,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "0c8566848a76eea19a6d6220914030a7", 337288},
{"resource.007", 0, "0c8566848a76eea19a6d6220914030a7", 343882},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// King's Quest 4 - English Atari ST (double-sided diskettes)
// Game version 1.003.006 (January 12, 1989)
@@ -1140,7 +1143,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "a3cdb4848fb859fdd302976fff56490f", 705074},
{"resource.004", 0, "a3cdb4848fb859fdd302976fff56490f", 478366},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAtariST, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAtariST, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// King's Quest 5 - English Amiga (from www.back2roots.org)
// Executable scanning reports "1.004.018"
@@ -1156,7 +1159,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "26c0c25399b6715fec03fc3e12544fe3", 823048},
{"resource.007", 0, "b914b5901e786327213e779725d30dd1", 778772},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
// King's Quest 5 - German Amiga (also includes english language)
// Executable scanning reports "1.004.024"
@@ -1172,7 +1175,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "56546b20db11a4836f900efa6d3a3e74", 672099},
{"resource.007", 0, "56546b20db11a4836f900efa6d3a3e74", 794194},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// King's Quest 5 - Italian Amiga (also includes english language)
// Executable scanning reports "1.004.024"
@@ -1188,7 +1191,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "11cb750f5f816445ad0f4b9f50a4f59a", 672527},
{"resource.007", 0, "11cb750f5f816445ad0f4b9f50a4f59a", 794259},
AD_LISTEND},
- Common::IT_ITA, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::IT_ITA, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// King's Quest 5 - English DOS CD (from the King's Quest Collection)
// Executable scanning reports "x.yyy.zzz", VERSION file reports "1.000.052"
@@ -1198,7 +1201,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "449471bfd77be52f18a3773c7f7d843d", 571368},
{"resource.001", 0, "b45a581ff8751e052c7e364f58d3617f", 16800210},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO0() },
// King's Quest 5 - English DOS CD (from the King's Quest Collection)
// Executable scanning reports "x.yyy.zzz", VERSION file reports "1.000.052"
@@ -1210,7 +1213,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "449471bfd77be52f18a3773c7f7d843d", 571368},
{"resource.001", 0, "b45a581ff8751e052c7e364f58d3617f", 16800210},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO_MIDIGM },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO1(GUIO_MIDIGM) },
// King's Quest 5 - English DOS Floppy
// SCI interpreter version 1.000.060
@@ -1225,7 +1228,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "672ede1136e9e401658538e51bd5dc22", 1172619},
{"resource.007", 0, "2f48faf27666b58c276dda20f91f4a93", 1240456},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// King's Quest 5 - English DOS Floppy (supplied by omer_mor in bug report #3036996)
// VERSION file reports "0.000.051"
@@ -1240,7 +1243,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "06cb3f689836086ebe08b1efc0126592", 921113},
{"resource.007", 0, "252249753c6e850eacceb8af634986d3", 1133608},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// King's Quest 5 EGA (supplied by markcoolio in bug report #2829470)
// SCI interpreter version 1.000.060
@@ -1256,7 +1259,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "698c698570cde9015e4d51eb8d2e9db1", 666527},
{"resource.007", 0, "703d8df30e89541af337d7706540d5c4", 541743},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// King's Quest 5 EGA 1.2M disk version (from LordHoto)
// VERSION file reports "0.000.055"
@@ -1268,7 +1271,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "53206afb4fd73871a484e83acab80f31", 7608},
{"resource.004", 0, "83568edf7fde18b3eed988bc5d22ceb1", 1188053},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// King's Quest 5 EGA (supplied by omer_mor in bug report #3035421)
// VERSION file reports "0.000.062"
@@ -1283,7 +1286,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "698c698570cde9015e4d51eb8d2e9db1", 666541},
{"resource.007", 0, "703d8df30e89541af337d7706540d5c4", 541762},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// King's Quest V DOS 0.000.062 EGA (5 x 5.25" disks)
// Supplied by ssburnout in bug report #3046780
@@ -1295,7 +1298,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "3cca5b2dae8afe94532edfdc98d7edbe", 1092325},
{"resource.004", 0, "8e5c1bc4d738cf7316ff506f59d265e2", 1187803},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// King's Quest 5 - German DOS Floppy (supplied by markcoolio in bug report #2727101, also includes english language)
// SCI interpreter version 1.000.060
@@ -1310,7 +1313,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "d1a75fdc01840664d00366cff6919366", 1208972},
{"resource.007", 0, "c07494f0cce7c05210893938786a955b", 1337361},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// King's Quest 5 - French DOS Floppy (from the King's Quest Collector's Edition 1994, also includes english language)
// Supplied by aroenai in bug report #2812611
@@ -1326,7 +1329,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "f7dc85307632ef657ceb1651204f6f51", 1210081},
{"resource.007", 0, "7db4d0a1d8d547c0019cb7d2a6acbdd4", 1338473},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::FR_FRA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// King's Quest 5 - Italian DOS Floppy (from glorifindel, includes english language)
// SCI interpreter version 1.000.060
@@ -1341,7 +1344,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "8eeabd92af71e766e323db2100879102", 1209325},
{"resource.007", 0, "dc10c107e0923b902326a040b9c166b9", 1337859},
AD_LISTEND},
- Common::IT_ITA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::IT_ITA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// King's Quest 5 - Polish DOS Floppy (supplied by jacek909 in bug report #2725722, includes english language?!)
// SCI interpreter version 1.000.060
@@ -1356,7 +1359,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "da82e4beb744731d0a151f1d4922fafa", 1170456},
{"resource.007", 0, "431def14ca29cdb5e6a5e84d3f38f679", 1240176},
AD_LISTEND},
- Common::PL_POL, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::PL_POL, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// King's Quest 5 - English Macintosh
// VERSION file reports "1.000.055"
@@ -1371,7 +1374,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "3d22904a374c192f51e5665b74364133", 1264079},
{"resource.007", 0, "ffe17e23d5833a79f3695addfc149a56", 1361965},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO1(GUIO_NOSPEECH) },
// King's Quest 5 - FM-Towns (supplied by abevi in bug report #3038720)
{"kq5", "", {
@@ -1379,7 +1382,13 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "71afd220d46bde1109c58e6acc0f3a01", 469094},
{"resource.001", 0, "72a569f46f1abf2d9d2b1526ad3799c3", 12808839},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformFMTowns, 0, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformFMTowns, 0, GUIO2(GUIO_NOASPECT, GUIO_MIDITOWNS) },
+ {"kq5", "", {
+ {"resource.map", 0, "20c7cd248ff1a349ed354568eebd972b", 12733},
+ {"resource.000", 0, "71afd220d46bde1109c58e6acc0f3a01", 469094},
+ {"resource.001", 0, "72a569f46f1abf2d9d2b1526ad3799c3", 12808839},
+ AD_LISTEND},
+ Common::JA_JPN, Common::kPlatformFMTowns, 0, GUIO2(GUIO_NOASPECT, GUIO_MIDITOWNS) },
// King's Quest 5 - Japanese PC-98 Floppy 0.000.015 (supplied by omer_mor in bug report #3073583)
{"kq5", "", {
@@ -1391,7 +1400,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "e114ce8f884601c43308fb5cbbea4874", 1174129},
{"resource.005", 0, "349ad9438172265d00680075c5a988d0", 1019669},
AD_LISTEND},
- Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// King's Quest 6 - English DOS Non-Interactive Demo
// Executable scanning reports "1.001.055", VERSION file reports "1.000.000"
@@ -1401,7 +1410,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "535b1b920441ec73f42eaa4ccfd47b89", 264116},
{"resource.msg", 0, "54d1fdc936f98c81f9e4c19e04fb1510", 8260},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
// King's Quest 6 - English DOS Floppy
// SCI interpreter version 1.001.054
@@ -1410,7 +1419,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "f2b7f753992c56a0c7a08d6a5077c895", 7863324},
{"resource.msg", 0, "3cf5de44de36191f109d425b8450efc8", 258590},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// King's Quest 6 - German DOS Floppy (supplied by markcoolio in bug report #2727156)
// SCI interpreter version 1.001.054
@@ -1419,7 +1428,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "f2b7f753992c56a0c7a08d6a5077c895", 7863324},
{"resource.msg", 0, "756297b2155db9e43f621c6f6fb763c3", 282822},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// King's Quest 6 - English DOS CD (from the King's Quest Collection)
// Executable scanning reports "1.cfs.158", VERSION file reports "1.034 9/11/94 - KQ6 version 1.000.00G"
@@ -1428,7 +1437,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "7a550ebfeae2575ca00d47703a6a774c", 9215},
{"resource.000", 0, "233394a5f33b475ae5975e7e9a420865", 8376352},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO0() },
// King's Quest 6 - English Windows CD (from the King's Quest Collection)
// Executable scanning reports "1.cfs.158", VERSION file reports "1.034 9/11/94 - KQ6 version 1.000.00G"
@@ -1437,7 +1446,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "7a550ebfeae2575ca00d47703a6a774c", 9215},
{"resource.000", 0, "233394a5f33b475ae5975e7e9a420865", 8376352},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO1(GUIO_NOASPECT) },
// King's Quest 6 - Spanish DOS CD (from jvprat)
// Executable scanning reports "1.cfs.158", VERSION file reports "1.000.000, July 5, 1994"
@@ -1447,7 +1456,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "4da3ad5868a775549a7cc4f72770a58e", 8537260},
{"resource.msg", 0, "41eed2d3893e1ca6c3695deba4e9d2e8", 267102},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_CD, GUIO_NONE },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_CD, GUIO0() },
// King's Quest 6 - English Macintosh Floppy
// VERSION file reports "1.0"
@@ -1455,7 +1464,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"Data1", 0, "a183fc0c22fcbd9be4c8800d974b5599", 3892124},
{"Data2", 0, "b3722460dfd3097a1fbaf99a21ad8ea5", 15031272},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK, GUIO1(GUIO_NOSPEECH) },
#ifdef ENABLE_SCI32
@@ -1466,7 +1475,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "4948e4e1506f1e1c4e1d47abfa06b7f8", 204385195},
{"resource.map", 0, "40ccafb2195301504eba2e4f4f2c7f3d", 18925},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// King's Quest 7 - English Windows (from the King's Quest Collection)
// Executable scanning reports "2.100.002", VERSION file reports "1.4"
@@ -1474,7 +1483,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "2be9ab94429c721af8e05c507e048a15", 18697},
{"resource.000", 0, "eb63ea3a2c2469dc2d777d351c626404", 203882535},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// King's Quest 7 - English DOS (from FRG)
// SCI interpreter version 2.100.002, VERSION file reports "2.00b"
@@ -1482,7 +1491,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "8676b0fbbd7362989a029fe72fea14c6", 18709},
{"resource.000", 0, "51c1ead1163e19a2de8f121c39df7a76", 200764100},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// King's Quest 7 - English Windows (from FRG)
// SCI interpreter version 2.100.002, VERSION file reports "2.00b"
@@ -1490,7 +1499,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "8676b0fbbd7362989a029fe72fea14c6", 18709},
{"resource.000", 0, "51c1ead1163e19a2de8f121c39df7a76", 200764100},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// King's Quest 7 - German Windows (supplied by markcoolio in bug report #2727402)
// SCI interpreter version 2.100.002
@@ -1498,7 +1507,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "838b9ff132bd6962026fee832e8a7ddb", 18697},
{"resource.000", 0, "eb63ea3a2c2469dc2d777d351c626404", 206626576},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// King's Quest 7 - Spanish DOS (from jvprat)
// Executable scanning reports "2.100.002", VERSION file reports "2.00"
@@ -1506,7 +1515,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "0b62693cbe87e3aaca3e8655a437f27f", 18709},
{"resource.000", 0, "51c1ead1163e19a2de8f121c39df7a76", 200764100},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// King's Quest 7 - English DOS Non-Interactive Demo
// SCI interpreter version 2.100.002
@@ -1514,7 +1523,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "b44f774108d63faa1d021101221c5a54", 1690},
{"resource.000", 0, "d9659d2cf0c269c6a9dc776707f5bea0", 2433827},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
#endif // ENABLE_SCI32
@@ -1530,7 +1539,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "aa553977f7e5804081de293800d3bcce", 695067},
{"resource.005", 0, "bfd870d51dc97729f0914095f58e6957", 676881},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Laura Bow - English Atari ST (from jvprat)
// Executable scanning reports "1.002.030", Floppy label reports "1.000.062, 9.23.90"
@@ -1542,7 +1551,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "e45c888d9c7c04aec0a20e9f820b79ff", 667365},
{"resource.004", 0, "e45c888d9c7c04aec0a20e9f820b79ff", 683737},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAtariST, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAtariST, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Laura Bow - English DOS Non-Interactive Demo
// Executable scanning reports "x.yyy.zzz"
@@ -1550,7 +1559,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "e625726268ff4e123ada11f31f0249f3", 768},
{"resource.001", 0, "0c8912290af0890f8d95faeb4ddb2d68", 333031},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Laura Bow - English DOS 3.5" Floppy (from "The Roberta Williams Anthology"/1996)
// SCI interpreter version 0.000.631
@@ -1561,7 +1570,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "e45c888d9c7c04aec0a20e9f820b79ff", 667468},
{"resource.004", 0, "e45c888d9c7c04aec0a20e9f820b79ff", 683807},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Laura Bow - English DOS (from FRG)
// SCI interpreter version 0.000.631
@@ -1575,7 +1584,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "e45c888d9c7c04aec0a20e9f820b79ff", 328390},
{"resource.007", 0, "e45c888d9c7c04aec0a20e9f820b79ff", 317687},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Laura Bow 2 - English DOS Non-Interactive Demo (from FRG)
// Executable scanning reports "x.yyy.zzz"
@@ -1584,7 +1593,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "24dffc5db1d88c7999f13e8767ed7346", 855},
{"resource.000", 0, "2b2b1b4f7584f9b38fd13f6ab95634d1", 781912},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
// Laura Bow 2 - English DOS Floppy
// Executable scanning reports "2.000.274"
@@ -1593,7 +1602,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "610bfd9a852004222f0faaf5fc9e630a", 6489},
{"resource.000", 0, "57084910bc923bff5d6d9bc1b56e9604", 5035964},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Laura Bow 2 - English DOS CD (from "The Roberta Williams Antology"/1996)
// Executable scanning reports "1.001.072", VERSION file reports "1.1" (from jvprat)
@@ -1602,7 +1611,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a70945e61ba7ac7bfea6b7bd72c6aec5", 7274},
{"resource.000", 0, "82578b8d5a7e09c4c58891ca49fae35b", 5598672},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO0() },
// Laura Bow 2 v1.1 - French DOS Floppy (from Hkz)
{"laurabow2", "", {
@@ -1610,7 +1619,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "57084910bc923bff5d6d9bc1b56e9604", 5028766},
{"resource.msg", 0, "0fceedfbdd85a4bc7851fdd9dd2d2f19", 278253},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::FR_FRA, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Laura Bow 2 v1.1 - German DOS Floppy (from Tobis87, updated info from markcoolio in bug report #2723787, updated info from #2797962))
// Executable scanning reports "2.000.274"
@@ -1619,7 +1628,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "57084910bc923bff5d6d9bc1b56e9604", 5028766},
{"resource.msg", 0, "795c928cd00dfec9fbc62ebcd12e1f65", 303185},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Laura Bow 2 - Spanish DOS CD (from jvprat)
// Executable scanning reports "2.000.274", VERSION file reports "1.000.000, May 10, 1994"
@@ -1628,7 +1637,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "57084910bc923bff5d6d9bc1b56e9604", 5028766},
{"resource.msg", 0, "71f1f0cd9f082da2e750c793a8ed9d84", 286141},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_CD, GUIO_NONE },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_CD, GUIO0() },
// Larry 1 EGA Remake - English DOS (from spookypeanut)
// SCI interpreter version 0.000.510 (or 0.000.577?)
@@ -1639,7 +1648,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "24c958bc922b07f91e25e8c93aa01fcf", 491230},
{"resource.003", 0, "685cd6c1e05a695ab1e0db826337ee2a", 553279},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
#if 0
// The resource.002 file, contained in disk 3, is broken in this version
@@ -1657,7 +1666,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "5790ac0505f7ca98d4567132b875eb1e", 681041},
{"resource.003", 0, "4a34c3367c2fe7eb380d741374da1989", 572251},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
#endif
// Larry 1 VGA Remake - English DOS (from spookypeanut)
@@ -1668,7 +1677,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "ec20246209d7b19f38989261e5c8f5b8", 1111226},
{"resource.002", 0, "85d6935ef77e6b0e16bc307640a0d913", 1088312},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Larry 1 VGA Remake - English DOS (from FRG)
// SCI interpreter version 1.000.510
@@ -1678,7 +1687,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "d34cadb11e1aefbb497cf91bc1d3baa7", 1114688},
{"resource.002", 0, "85b030bb66d5342b0a068f1208c431a8", 1078443},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Larry 1 VGA Remake - English Macintosh (from omer_mor, bug report #3328262)
{"lsl1sci", "SCI", {
@@ -1687,7 +1696,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "aa6f153f70f1e32d1bde465fff08eecf", 1137418},
{"resource.002", 0, "b22c616aa789ebef990290c7ffd86548", 1097477},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO1(GUIO_NOSPEECH) },
// Larry 1 VGA Remake - English DOS Non-Interactive Demo
// SCI interpreter version 1.000.084
@@ -1695,7 +1704,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "434e1f6c39d71647b34f0ee57b2bbd68", 444},
{"resource.001", 0, "0c0768215c562d9dace4a5ca53696cf3", 359913},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
// Larry 1 VGA Remake - Spanish DOS (from the Leisure Suit Larry Collection, also includes english language)
// Executable scanning reports "1.SQ4.057", VERSION file reports "1.000"
@@ -1708,7 +1717,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "3fe2a3aec0ed53c7d6db1845a67e3aa2", 1095908},
{"resource.003", 0, "ac175df0ea9a2cba57f0248651856d27", 376556},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// Larry 1 VGA Remake - Russian DOS (also includes english language?!)
// Executable scanning reports "1.000.510", VERSION file reports "2.0"
@@ -1719,7 +1728,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "bc8ca10c807515d959cbd91f9ba47735", 1123759},
{"resource.002", 0, "b7409ab32bc3bee2d6cce887cd33f2b6", 1092160},
AD_LISTEND},
- Common::RU_RUS, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::RU_RUS, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// Larry 1 VGA Remake - Polish DOS (from Polish Leisure Suit Larry Collection, official release)
// SCI interpreter version 1.000.577, VERSION file reports "2.1" (this release does NOT include english text)
@@ -1727,7 +1736,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "58330a85767e42a2487129913283ab5b", 3228},
{"resource.000", 0, "b6097ff35cdc8469f02150fe2f824198", 4781210},
AD_LISTEND},
- Common::PL_POL, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::PL_POL, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Larry 2 - English Amiga (from www.back2roots.org)
// Executable scanning reports "x.yyy.zzz"
@@ -1739,7 +1748,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "a0d4a625311d307257da7fc43d00459d", 570356},
{"resource.004", 0, "a0d4a625311d307257da7fc43d00459d", 717844},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Larry 2 - English DOS Non-Interactive Demo
// Executable scanning reports "x.yyy.zzz"
@@ -1748,7 +1757,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "03dba704bb77da55a91ad27b5a3cac09", 528},
{"resource.001", 0, "9f5520f0297206928df0b0b36493cd33", 127532},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Larry 2 - English DOS
// SCI interpreter version 0.000.409
@@ -1761,7 +1770,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "4a24443a25e2b1492462a52809605dc2", 277732},
{"resource.006", 0, "4a24443a25e2b1492462a52809605dc2", 345683},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Larry 2 - English DOS
// SCI interpreter version 0.000.343
@@ -1776,7 +1785,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
//{"resource.006", 0, "96033f57accfca903750413fd09193c8", 345818},
{"resource.006", 0, "96033f57accfca903750413fd09193c8", -1}, // 345818 or 208739
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Larry 2 - English DOS (supplied by ssburnout in bug report #3049193)
// 1.000.011 3x3.5" (label: Int. #0.000.343)
@@ -1786,7 +1795,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "96033f57accfca903750413fd09193c8", 407014},
{"resource.003", 0, "96033f57accfca903750413fd09193c8", 592834},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Larry 2 - English DOS (supplied by ssburnout in bug report #3049193)
// 1.002.000 3x3.5" (label: INT#0.000.409)
@@ -1796,7 +1805,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "4a24443a25e2b1492462a52809605dc2", 406935},
{"resource.003", 0, "4a24443a25e2b1492462a52809605dc2", 592533},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Larry 3 - English Amiga (from www.back2roots.org)
// Executable scanning reports "1.002.032"
@@ -1810,7 +1819,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "f408e59cbee1457f042e5773b8c53951", 651634},
{"resource.005", 0, "433911eb764089d493aed1f958a5615a", 524259},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
// Larry 3 - English DOS
// SCI interpreter version 0.000.572
@@ -1821,7 +1830,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "f18441027154292836b973c655fa3175", 506807},
{"resource.004", 0, "f18441027154292836b973c655fa3175", 513651},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Larry 3 - English DOS (supplied by ssburnout in bug report #3049193)
// 1.021 8x5.25" (label: Int#5.15.90)
@@ -1835,7 +1844,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "f18441027154292836b973c655fa3175", 282649},
{"resource.007", 0, "f18441027154292836b973c655fa3175", 257178},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Larry 3 - English DOS
// SCI interpreter version 0.000.572
@@ -1849,7 +1858,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "f18441027154292836b973c655fa3175", 282465},
{"resource.007", 0, "f18441027154292836b973c655fa3175", 257174},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Larry 3 - English DOS Non-Interactive Demo
// SCI interpreter version 0.000.530
@@ -1858,7 +1867,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "f773d79b93dfd4052ec8c1cc64c1e6ab", 76525},
{"resource.002", 0, "f773d79b93dfd4052ec8c1cc64c1e6ab", 268299},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Larry 3 - German DOS (from Tobis87, updated info from markcoolio in bug report #2723832, also includes english language)
// Executable scanning reports "S.old.123"
@@ -1870,7 +1879,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "3827a9b17b926e12dcc336860f50612a", 587036},
{"resource.004", 0, "3827a9b17b926e12dcc336860f50612a", 691932},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Larry 3 - French DOS (provided by richiefs in bug report #2670691, also includes english language)
// Executable scanning reports "S.old.123"
@@ -1882,7 +1891,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "65f1bdaa20f6d0470e9d969f22473873", 586921},
{"resource.004", 0, "65f1bdaa20f6d0470e9d969f22473873", 690826},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::FR_FRA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Larry 3 1.050 Fr/En (9 x 5.25" disks)
// Provided by ssburnout in bug report #3046779
@@ -1896,7 +1905,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "65f1bdaa20f6d0470e9d969f22473873", 325292},
{"resource.007", 0, "65f1bdaa20f6d0470e9d969f22473873", 308982},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::FR_FRA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// Larry 5 - English Amiga
// Executable scanning reports "1.004.023"
@@ -1911,7 +1920,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "f8b2d1137bb767e5d232056b99dd69eb", 623621},
{"resource.006", 0, "bafc64e3144f115dc58c6aee02de98fb", 715598},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
// Larry 5 - German Amiga (also includes english language)
// Executable scanning reports "1.004.024"
@@ -1927,7 +1936,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "bafc64e3144f115dc58c6aee02de98fb", 754966},
{"resource.007", 0, "59eba83ad465b08d763b44f86afa86f6", 683135},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// Larry 5 - English DOS Non-Interactive Demo (from FRG)
// SCI interpreter version 1.000.181
@@ -1935,7 +1944,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "efe8d3f45ce4f6bd9a6643e0ac8d2a97", 504},
{"resource.001", 0, "8bd8d9c0b5f455ee1269d63ce86c50dd", 531380},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
// Larry 5 - English DOS (from spookypeanut)
// SCI interpreter version 1.000.510
@@ -1950,7 +1959,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "dda27ce00682aa76198dac124bbbe334", 1024810},
{"resource.007", 0, "ac443fae1285fb359bf2b2bc6a7301ae", 1030656},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Larry 5 - English Macintosh (from omer_mor, bug report #3328257)
{"lsl5", "", {
@@ -1964,7 +1973,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "dda27ce00682aa76198dac124bbbe334", 1110043},
{"resource.007", 0, "ac443fae1285fb359bf2b2bc6a7301ae", 989801},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO1(GUIO_NOSPEECH) },
// Larry 5 - German DOS (from Tobis87)
// SCI interpreter version T.A00.196
@@ -1979,7 +1988,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "dda27ce00682aa76198dac124bbbe334", 1021774},
{"resource.007", 0, "ac443fae1285fb359bf2b2bc6a7301ae", 993408},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// Larry 5 - French DOS (provided by richiefs in bug report #2670691)
// Executable scanning reports "1.lsl5.019"
@@ -1995,7 +2004,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "dda27ce00682aa76198dac124bbbe334", 946540},
{"resource.007", 0, "ac443fae1285fb359bf2b2bc6a7301ae", 958842},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::FR_FRA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// Larry 5 - Spanish DOS (from the Leisure Suit Larry Collection)
// Executable scanning reports "1.ls5.006", VERSION file reports "1.000, 4/21/92"
@@ -2011,7 +2020,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "dda27ce00682aa76198dac124bbbe334", 1015136},
{"resource.007", 0, "ac443fae1285fb359bf2b2bc6a7301ae", 987222},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// Larry 5 - Italian DOS Floppy (from glorifindel)
// SCI interpreter version 1.000.510 (just a guess)
@@ -2019,7 +2028,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a99776df795127f387cb35dae872d4e4", 5919},
{"resource.000", 0, "a8989a5a89e7d4f702b26b378c7a357a", 7001981},
AD_LISTEND},
- Common::IT_ITA, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::IT_ITA, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Larry 5 1.0 EGA DOS (8 x 3.5" disks)
// Provided by ssburnout in bug report #3046806
@@ -2034,7 +2043,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "f6046a8445422f17d40b1b10ab21ebf3", 568551},
{"resource.007", 0, "640ee65595d40372ef95462f2c1ae28a", 593429},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Larry 5 EGA
// Supplied by omer_mor in bug report #3049771
@@ -2045,7 +2054,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "5a55af4e40728b1a8103dc47ad2afa8d", 1100539},
{"resource.003", 0, "16f4d8fb1b526125edaca4fc6cbb7530", 1064563},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Larry 6 - English DOS (from spookypeanut)
// SCI interpreter version 1.001.113
@@ -2053,7 +2062,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "bb8a39d9e2a77ba449a1e591109ad9a8", 6973},
{"resource.000", 0, "4462fe48c7452d98fddcec327a3e738d", 5789138},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Larry 6 - English/German/French DOS CD - LOWRES
// SCI interpreter version 1.001.115
@@ -2061,7 +2070,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "0b91234b7112782962cb480b7791b6e2", 7263},
{"resource.000", 0, "57d5fe8bb9e044158514476ea7678eb0", 5754790},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO0() },
// Larry 6 - German DOS CD - LOWRES (provided by richiefs in bug report #2670691)
// SCI interpreter version 1.001.115
@@ -2069,7 +2078,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "bafe85f32738854135991d4324ad147e", 7268},
{"resource.000", 0, "f6cbc6da7b90ea135883e0759848ca2c", 5773160},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_CD, GUIO_NONE },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_CD, GUIO0() },
// Larry 6 - French DOS CD - LOWRES (provided by richiefs in bug report #2670691)
// SCI interpreter version 1.001.115
@@ -2077,7 +2086,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "97797ea775baaf18a1907d357d3c0ea6", 7268},
{"resource.000", 0, "f6cbc6da7b90ea135883e0759848ca2c", 5776092},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, ADGF_CD, GUIO_NONE },
+ Common::FR_FRA, Common::kPlatformPC, ADGF_CD, GUIO0() },
// Larry 6 - Spanish DOS - LOWRES (from the Leisure Suit Larry Collection)
// Executable scanning reports "1.001.113", VERSION file reports "1.000, 11.06.93, FIVE PATCHES ADDED TO DISK 6 ON 11-18-93"
@@ -2085,7 +2094,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "633bf8f42170b6271019917c8009989b", 6943},
{"resource.000", 0, "7884a8db9253e29e6b37a2651fd90ba3", 5733116},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::ES_ESP, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Crazy Nick's Software Picks: Leisure Suit Larry's Casino - English DOS (from the Leisure Suit Larry Collection)
// Executable scanning reports "1.001.029", VERSION file reports "1.000"
@@ -2093,60 +2102,60 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "194f1578f2624db813c9072359ad1639", 783},
{"resource.001", 0, "3733433b517ec3d14a3331d9ab3842ae", 344830},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Crazy Nick's Software Picks: King Graham's Board Game Challenge
{"cnick-kq", "", {
{"resource.map", 0, "44bc538a5cd24b39ffccc967c0ebf84d", 1137},
{"resource.001", 0, "470e7a4a3504635e70b623c44461e1ac", 451272},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Crazy Nick's Software Picks: Parlor Games with Laura Bow
{"cnick-laurabow", "", {
{"resource.map", 0, "3b826bfe64f8ff1ccf30eef93cd2f727", 999},
{"resource.001", 0, "985ac8db6f636f2b4334c04b0fbb44fb", 336698},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Crazy Nick's Software Picks: Robin Hood's Game of Skill and Chance
{"cnick-longbow", "", {
{"resource.map", 0, "4a5c81f485a2416bde12978506f2fb5f", 897},
{"resource.001", 0, "ef16dc9e867eb8eeb5b13e110b90bd4b", 571466},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Crazy Nick's Software Picks: Roger Wilco's Spaced Out Game Pack
{"cnick-sq", "", {
{"resource.map", 0, "b4d95b02d84e297441bd999d34eaa6b1", 879},
{"resource.001", 0, "82ff2b64a60117886fbcd6a3a8c977c6", 364921},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
#ifdef ENABLE_SCI32
// Larry 6 - English/German DOS CD - HIRES
// SCI interpreter version 2.100.002
- {"lsl6hires", "", {
+ {"lsl6hires", "Hi-res", {
{"resource.map", 0, "0c0804434ea62278dd15032b1947426c", 8872},
{"resource.000", 0, "9a9f4870504444cda863dd14d077a680", 18520872},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// Larry 6 - German DOS CD - HIRES (provided by richiefs in bug report #2670691)
// SCI interpreter version 2.100.002
- {"lsl6hires", "", {
+ {"lsl6hires", "Hi-res", {
{"resource.map", 0, "badfdf446ffed569a310d2c63a249421", 8896},
{"resource.000", 0, "bd944d2b06614a5b39f1586906f0ee88", 18534274},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NONE },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// Larry 6 - French DOS CD - HIRES (provided by richiefs in bug report #2670691)
// SCI interpreter version 2.100.002
- {"lsl6hires", "", {
+ {"lsl6hires", "Hi-res", {
{"resource.map", 0, "d184e9aa4f2d4b5670ddb3669db82cda", 8896},
{"resource.000", 0, "bd944d2b06614a5b39f1586906f0ee88", 18538987},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NONE },
+ Common::FR_FRA, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// Larry 7 - English DOS Demo (provided by richiefs in bug report #2670691)
// SCI interpreter version 2.100.002
@@ -2154,7 +2163,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"ressci.000", 0, "5cc6159688b2dc03790a67c90ccc67f9", 10195878},
{"resmap.000", 0, "6a2b2811eef82e87cde91cf1de845af8", 2695},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
#ifdef ENABLE_SCI3_GAMES
// Larry 7 - English DOS CD (from spookypeanut)
@@ -2163,7 +2172,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "eae93e1b1d1ccc58b4691c371281c95d", 8188},
{"ressci.000", 0, "89353723488219e25589165d73ed663e", 66965678},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// Larry 7 - German DOS (from Tobis87)
// SCI interpreter version 3.000.000
@@ -2171,7 +2180,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "c11e6bfcfc2f2d05da47e5a7df3e9b1a", 8188},
{"ressci.000", 0, "a8c6817bb94f332ff498a71c8b47f893", 66971724},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// Larry 7 - French DOS (provided by richiefs in bug report #2670691)
// SCI interpreter version 3.000.000
@@ -2179,7 +2188,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "4407849fd52fe3efb0c30fba60cd5cd4", 8206},
{"ressci.000", 0, "dc37c3055fffbefb494ff22b145d377b", 66964472},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// Larry 7 - Italian DOS CD (from glorifindel)
// SCI interpreter version 3.000.000
@@ -2187,7 +2196,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "9852a97141f789413f29bf956052acdb", 8212},
{"ressci.000", 0, "440b9fed89590abb4e4386ed6f948ee2", 67140181},
AD_LISTEND},
- Common::IT_ITA, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NONE },
+ Common::IT_ITA, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// Larry 7 - Spanish DOS (from the Leisure Suit Larry Collection)
// Executable scanning reports "3.000.000", VERSION file reports "1.0s"
@@ -2195,7 +2204,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "8f3d603e1acc834a5d598b30cdfc93f3", 8188},
{"ressci.000", 0, "32792f9bc1bf3633a88b382bb3f6e40d", 67071418},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
#endif
// Lighthouse - English Windows Demo (from jvprat)
@@ -2204,7 +2213,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "543124606352bfa5e07696ddf2a669be", 64},
{"resource.000", 0, "5d7714416b612463d750fb9c5690c859", 28952},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
#ifdef ENABLE_SCI3_GAMES
// Lighthouse - English Windows Demo
@@ -2213,7 +2222,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "3bdee7a16926975a4729f75cf6b80a92", 1525},
{"ressci.000", 0, "3c585827fa4a82f4c04a56a0bc52ccee", 11494351},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// Lighthouse - English DOS (from jvprat)
// Executable scanning reports "3.000.000", VERSION file reports "1.1"
@@ -2223,7 +2232,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.002", 0, "c68db5333f152fea6ca2dfc75cad8b34", 7573},
{"ressci.002", 0, "175468431a979b9f317c294ce3bc1430", 94628315},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// Lighthouse - Spanish DOS (from jvprat)
// Executable scanning reports "3.000.000", VERSION file reports "1.1"
@@ -2233,7 +2242,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.002", 0, "e7dc85884a2417e2eff9de0c63dd65fa", 7630},
{"ressci.002", 0, "3c8d627c555b0e3e4f1d9955bc0f0df4", 94631127},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
#endif // ENABLE_SCI3_GAMES
#endif // ENABLE_SCI32
@@ -2244,7 +2253,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "8be56a3a88c065ee00c02c0e29199f3a", 14643},
{"resource.001", 0, "9e33566515b18bee7915db448063bba2", 871853},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
// Mixed-Up Fairy Tales - English DOS Floppy EGA (from omer_mor, bug report #3035350)
{"fairytales", "EGA", {
@@ -2255,7 +2264,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "509b2467ba779100d5933ed51a9ae32f", 560255},
{"resource.004", 0, "93afc85d5ffa60ea555d6cc336d22c03", 651109},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Mixed-Up Fairy Tales v1.000 - English DOS (supplied by markcoolio in bug report #2723791)
// Executable scanning reports "1.000.145"
@@ -2267,7 +2276,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "b1288e0821ee358d1ffe877e5900c8ec", 1047565},
{"resource.004", 0, "f79daa70390d73746742ffcfc3dc4471", 937580},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Mixed-Up Fairy Tales - English DOS Floppy (from jvprat)
// Executable scanning reports "1.000.145", Floppy label reports "1.0, 11.13.91", VERSION file reports "1.000"
@@ -2278,7 +2287,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "564f516d991032e781492592a4eaa275", 1414142},
{"resource.003", 0, "dd6cef0c592eadb7e6be9a25307c57a2", 1344719},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Mixed-Up Mother Goose - English Amiga (from www.back2roots.org)
// Executable scanning reports "1.003.009"
@@ -2288,7 +2297,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "fb552ae550ca1dac19ed8f6a3767612d", 262885},
{"resource.002", 0, "fb552ae550ca1dac19ed8f6a3767612d", 817191},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
// Mixed-Up Mother Goose - English DOS Floppy EGA (from omer_mor, bug report #3035354)
{"mothergoose", "EGA", {
@@ -2296,7 +2305,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "d893892d62b3f061357291d66775e360", 239906},
{"resource.002", 0, "d893892d62b3f061357291d66775e360", 719398},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Mixed-Up Mother Goose - English DOS Floppy EGA (supplied by ssburnout in bug report #3049193)
// 1.011 5x5.25" (label: Int#8.2.90)
@@ -2309,7 +2318,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "dbbc22f124533ce308bc386b08956326", 146251},
{"resource.005", 0, "2ba5348e7fad641b9c4c7ff7c7cf4e68", 110979},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Mixed-Up Mother Goose v2.000 - English DOS Floppy (supplied by markcoolio in bug report #2723795)
// Executable scanning reports "1.001.031"
@@ -2317,7 +2326,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "52aae15e493cafd1da7e1c9b657a5bb9", 7026},
{"resource.000", 0, "b7ecd8ae9e254e80310b5a668b276e6e", 2948975},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Mixed-Up Mother Goose - English DOS CD (from jvprat)
// Executable scanning reports "x.yyy.zzz"
@@ -2326,7 +2335,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "1c7f311b0a2c927b2fbe81ae341fb2f6", 5790},
{"resource.001", 0, "5a0ed1d745855148364de1b3be099bac", 4369438},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO0() },
// Mixed-Up Mother Goose - English Windows Interactive Demo
// Executable scanning reports "x.yyy.zzz"
@@ -2334,14 +2343,19 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "87f9dc1cafc4d4fa835fb2f00cf3a6ef", 4560},
{"resource.001", 0, "5a0ed1d745855148364de1b3be099bac", 2070072},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
// Mixed-Up Mother Goose - FM-Towns (supplied by abevi in bug report #3038720)
{"mothergoose256", "", {
{"resource.map", 0, "b11e971ccd2040bebba59dfb409a08ef", 5772},
{"resource.001", 0, "d49625d9b8005ec01c852f8322a82867", 4330713},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformFMTowns, 0, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformFMTowns, 0, GUIO1(GUIO_NOASPECT) },
+ {"mothergoose256", "", {
+ {"resource.map", 0, "b11e971ccd2040bebba59dfb409a08ef", 5772},
+ {"resource.001", 0, "d49625d9b8005ec01c852f8322a82867", 4330713},
+ AD_LISTEND},
+ Common::JA_JPN, Common::kPlatformFMTowns, 0, GUIO1(GUIO_NOASPECT) },
#ifdef ENABLE_SCI32
// Mixed-Up Mother Goose Deluxe - English Windows/DOS CD (supplied by markcoolio in bug report #2723810)
@@ -2350,7 +2364,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "5159a1578c4306bfe070a3e4d8c2e1d3", 4741},
{"resource.000", 0, "1926925c95d82f0999590e93b02887c5", 15150768},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// Mixed-Up Mother Goose Deluxe - Multilingual Windows CD (English/French/German/Spanish)
// Executable scanning reports "2.100.002"
@@ -2358,7 +2372,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "ef611af561898dcfea87846919ebf3eb", 4969},
{"ressci.000", 0, "227685bc59d90821978d330713e44a7a", 17205800},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
#endif // ENABLE_SCI32
// Ms. Astro Chicken - English DOS
@@ -2367,7 +2381,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "5b457cbe5042f557e5b610148171f6c0", 1158},
{"resource.001", 0, "453ea81ef66a50cbe33ce06302afe47f", 229737},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
#ifdef ENABLE_SCI32
// Phantasmagoria - English DOS (from jvprat)
@@ -2388,7 +2402,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.007", 0, "afbd16ea77869a720afa1c5371de107d", 7972},
//{"ressci.007", 0, "3aae6559aa1df273bc542d5ac6330d75", 25859038},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// Phantasmagoria - English DOS Demo
// Executable scanning reports "2.100.002"
@@ -2396,7 +2410,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.001", 0, "416138651ea828219ca454cae18341a3", 11518},
{"ressci.001", 0, "3aae6559aa1df273bc542d5ac6330d75", 65844612},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// Phantasmagoria - English DOS/Windows (GOG version) - ressci.* merged in ressci.000
// Windows executable scanning reports "2.100.002" - "Sep 19 1995 15:09:43"
@@ -2407,7 +2421,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"ressci.000", 0, "cd5967f9b9586e3380645961c0765be3", 116822037},
{"resmap.000", 0, "3cafc1c6a53945c1f3babbfd6380c64c", 16468},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// Phantasmagoria - English Macintosh
// NOTE: This only contains disc 1 files (as well as the two persistent files:
@@ -2423,7 +2437,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
// Data8-12 are empty
{"Data13", 0, "6d2c450fca19a69b5af74ed5b03c0a17", 14923328},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK | ADGF_UNSTABLE, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
#ifdef ENABLE_SCI3_GAMES
// Phantasmagoria 2 - English Windows (from jvprat)
@@ -2440,7 +2454,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.005", 0, "8bd5ceeedcbe16dfe55d1b90dcd4be84", 1942},
{"ressci.005", 0, "05f9fe2bee749659acb3cd2c90252fc5", 67905112},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// Phantasmagoria 2 - English DOS (GOG version) - ressci.* merged in ressci.000
// Executable scanning reports "3.000.000" - "Dec 07 1996 09:29:03"
@@ -2450,7 +2464,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"ressci.000", 0, "c54f26d9f43f908151263254b6d97053", 108134481},
{"resmap.000", 0, "de154a223a9ef4ea7358b76adc38ef5b", 2956},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
#endif // ENABLE_SCI3_GAMES
#endif // ENABLE_SCI32
@@ -2461,7 +2475,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "72726dc81c1b4c1110c486be77369bc8", 5179},
{"resource.000", 0, "670d0c53622429f4b11275caf7f8d292", 5459574},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Pepper - English DOS Non-Interactive Demo
// Executable scanning reports "1.001.060", VERSION file reports "1.000"
@@ -2469,7 +2483,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "379bb4fb896630b14f2d91ed21e36ba1", 984},
{"resource.000", 0, "118f6c31a93ec7fd9a231c61125229e3", 645494},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
// Pepper - English DOS/Windows Interactive Demo
// Executable scanning reports "1.001.069", VERSION file reports ".001"
@@ -2477,7 +2491,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "975e8df76106a5c13d12ab674f906a02", 2514},
{"resource.000", 0, "e6a918a2dd7a4bcecd8fb389f43287c2", 1698164},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
// Pepper - English DOS Interactive Demo
// Executable scanning reports "1.001.072", VERSION file reports "1.000"
@@ -2485,7 +2499,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "9c9b7b900651a370dd3fb38d478b1798", 2524},
{"resource.000", 0, "e6a918a2dd7a4bcecd8fb389f43287c2", 1713544},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
// Police Quest 1 VGA Remake - English DOS (from the Police Quest Collection)
// Executable scanning reports "1.001.029", VERSION file reports "2.000"
@@ -2493,7 +2507,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "35efa814fb994b1cbdac9611e401da67", 5013},
{"resource.000", 0, "e0d5ddf34eda903a38f0837e2aa7145b", 6401433},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Police Quest 2 - English Amiga (from www.back2roots.org)
// SCI interpreter version 0.000.685 (just a guess)
@@ -2504,7 +2518,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "499737c21a28ac026e11ab817100d610", 511099},
{"resource.003", 0, "e008f5d6e2a7c4d4a0da0173e4fa8f8b", 553970},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Police Quest 2 - English DOS Non-Interactive Demo
// Executable scanning reports "0.000.413"
@@ -2512,7 +2526,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "8b77d0d4650c2052b356cece28294b58", 576},
{"resource.001", 0, "376ef6d6eaaeed66e1424bd219c4b9ab", 215398},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Police Quest 2 - English DOS (provided by richiefs in bug report #2670691)
// SCI interpreter version 0.000.395
@@ -2525,7 +2539,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "77f02def3094af804fd2371db25b7100", 349899},
{"resource.006", 0, "77f02def3094af804fd2371db25b7100", 354991},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Police Quest 2 - English DOS (from the Police Quest Collection)
// Executable scanning reports "0.000.490"
@@ -2535,7 +2549,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "77f02def3094af804fd2371db25b7100", 546000},
{"resource.003", 0, "77f02def3094af804fd2371db25b7100", 591851},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Police Quest 2 - English DOS (from FRG)
// SCI interpreter version 0.000.395
@@ -2545,7 +2559,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "77f02def3094af804fd2371db25b7100", 542897},
{"resource.003", 0, "77f02def3094af804fd2371db25b7100", 586857},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Police Quest 2 English DOS 1.001.006 (supplied by merkur-kun in bug report #3028479)
{"pq2", "", {
@@ -2554,7 +2568,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "77f02def3094af804fd2371db25b7100", 541261},
{"resource.003", 0, "77f02def3094af804fd2371db25b7100", 587511},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Police Quest 2 - Japanese PC-98 (also includes english language)
// SCI interpreter version unknown
@@ -2564,7 +2578,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "05fdee43a228dd6ea4d1a92ccae3f788", 637662},
{"resource.003", 0, "05fdee43a228dd6ea4d1a92ccae3f788", 684395},
AD_LISTEND},
- Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// Police Quest 3 - English Amiga
// Executable scanning reports "1.004.024"
@@ -2577,7 +2591,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "630bfa65beb05f743552704ac2899dae", 759891},
{"resource.004", 0, "7b229fbdf30d670d0728cede3e984a7e", 838663},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
// Police Quest 3 - German Amiga (also includes english language)
// Executable scanning reports "1.004.024"
@@ -2591,7 +2605,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "6258d5dd85898d8e218eb8113ebc9059", 722738},
{"resource.005", 0, "6258d5dd85898d8e218eb8113ebc9059", 704485},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// Police Quest 3 - English DOS (from the Police Quest Collection)
// Executable scanning reports "T.A00.178", VERSION file reports "1.00"
@@ -2604,7 +2618,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "8791b9eef53edf77c2dac950142221d3", 1159791},
{"resource.004", 0, "1b91e891a3c60a941dac0eecdf83375b", 1143606},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Police Quest 3 - English DOS Non-Interactive Demo
// Executable scanning reports "T.A00.052"
@@ -2614,7 +2628,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "277f97771f7a6d89677141f02da313d6", 65150},
{"resource.001", 0, "5c5a551b6c86cce2ee75becb90e0b586", 624411},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
// Police Quest 3 - German DOS (supplied by markcoolio in bug report #2723837, also includes english language)
// Executable scanning reports "T.A00.178"
@@ -2627,7 +2641,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "4836f460f4cfc8de61e2df4c45775504", 1180956},
{"resource.004", 0, "0c3eb84b9755852d9e795e0d5c9373c7", 1171760},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// Police Quest 3 EGA
// Reported by musiclyinspired in bug report #3046573
@@ -2640,7 +2654,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "b96a86ab681769e4cbb439670d967ca6", 449682},
{"resource.005", 0, "9e6c53a0e7eef53694d260fade8b1fc7", 724000},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Police Quest 4 - English DOS Non-Interactive Demo (from FRG)
// SCI interpreter version 1.001.096
@@ -2648,7 +2662,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "be56f87a1c4a13062a30a362df860c2f", 1472},
{"resource.000", 0, "527d5684016e6816157cd15d9071b11b", 1121310},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
#ifdef ENABLE_SCI32
// Police Quest 4 - English DOS CD (from the Police Quest Collection)
@@ -2657,7 +2671,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "379dfe80ed6bd16c47e4b950c4722eac", 11374},
{"resource.000", 0, "fd316a09b628b7032248139003369022", 18841068},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO0() },
// Police Quest 4 - German DOS CD (German text, English speech)
// Supplied by markcoolio in bug report #3392955
@@ -2665,7 +2679,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a398076371ed0e1e706c8f9fb9fc7ac5", 11386},
{"resource.000", 0, "6ff21954e0a2c5992279e7eb787c8d56", 18918747},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO_NONE },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO0() },
// Police Quest 4 - English DOS
// SCI interpreter version 2.000.000 (a guess?)
@@ -2673,7 +2687,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "aed9643158ccf01b71f359db33137f82", 9895},
{"resource.000", 0, "da383857b3be1e4514daeba2524359e0", 15141432},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOSPEECH) },
// Police Quest 4 - French DOS (supplied by abevi in bug report #2612718)
// SCI interpreter version 2.000.000
@@ -2681,7 +2695,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "008030846edcc7c5c7a812c7f4ae4ceb", 9256},
{"resource.000", 0, "6ba98bd2e436739d87ecd2a9b99cabb4", 14730153},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::FR_FRA, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOSPEECH) },
// Police Quest 4 - German DOS (supplied by markcoolio in bug report #2723840)
// SCI interpreter version 2.000.000 (a guess?)
@@ -2689,7 +2703,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "2393ee728ab930b2762cb5889f9b5aff", 9256},
{"resource.000", 0, "6ba98bd2e436739d87ecd2a9b99cabb4", 14730155},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOSPEECH) },
// Police Quest: SWAT - English DOS/Windows Demo (from jvprat)
// Executable scanning reports "2.100.002", VERSION file reports "0.001.200"
@@ -2697,7 +2711,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "8c96733ef94c21526792f7ca4e3f2120", 1648},
{"resource.000", 0, "d8892f1b8c56c8f7704325460f49b300", 3676175},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// Police Quest: SWAT - English DOS (from GOG.com)
// Executable scanning reports "2.100.002", VERSION file reports "1.0c"
@@ -2705,7 +2719,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "1c2563fee189885e29d9348f37306d94", 12175},
{"ressci.000", 0, "b2e1826ca81ce2e7e764587f5a14eee9", 127149181},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// Police Quest: SWAT - English Windows (from the Police Quest Collection)
// Executable scanning reports "2.100.002", VERSION file reports "1.0c"
@@ -2720,7 +2734,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.004", 0, "4228038906f041623e65789500b22285", 6835},
{"ressci.004", 0, "b7e619e6ecf62fe65d5116a3a422e5f0", 46223872},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
#endif // ENABLE_SCI32
// Quest for Glory 1 / Hero's Quest - English DOS 3.5" Floppy (supplied by merkur in bug report #2718784)
@@ -2733,7 +2747,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "7ab2bf8e224b57f75e0cd6e4ba790761", 642203},
{"resource.004", 0, "7ab2bf8e224b57f75e0cd6e4ba790761", 641688},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Quest for Glory 1 / Hero's Quest - English DOS 3.5" Floppy (supplied by alonzotg in bug report #3206006)
{"qfg1", "", {
@@ -2744,7 +2758,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "7ab2bf8e224b57f75e0cd6e4ba790761", 642203},
{"resource.004", 0, "7ab2bf8e224b57f75e0cd6e4ba790761", 641688},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Quest for Glory 1 / Hero's Quest - English DOS 5.25" Floppy (supplied by markcoolio in bug report #2723843)
// Executable scanning reports "0.000.566"
@@ -2759,7 +2773,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "69366c2a2f99917199fe1b60a4fee19d", 267852},
{"resource.007", 0, "7ab2bf8e224b57f75e0cd6e4ba790761", 272747},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Quest for Glory 1 / Hero's Quest - English DOS 5.25" Floppy (supplied by ssburnout in bug report #3049193)
// 1.001 10x5.25" (label: INT.#0.000.566)
@@ -2774,7 +2788,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "69366c2a2f99917199fe1b60a4fee19d", 267852},
{"resource.007", 0, "7ab2bf8e224b57f75e0cd6e4ba790761", 272747},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Quest for Glory 1 / Hero's Quest - English DOS 5.25" Floppy (supplied by ssburnout in bug report #3049193)
// 1.200 10x5.25" (label: INT#9.10.90)
@@ -2789,7 +2803,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "f46690dca714abc8c89357d30e363dd3", 278387},
{"resource.007", 0, "951299a82a8134ed12c5c18118d45c2f", 269173},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Quest for Glory 1 / Hero's Quest - English DOS Demo
// Executable scanning reports "0.000.685"
@@ -2797,7 +2811,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "df34c758cbb9026da175793ff686b0e6", 882},
{"resource.001", 0, "73fbaafdd313b39aeedb80fbf85ecef1", 389884},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Quest for Glory 1 - Japanese PC-98 5.25" Floppy (also includes English language)
// Executable scanning reports "S.old.201"
@@ -2807,7 +2821,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "a21451ef6fa8179bd4b22c4950004c44", 1136968},
{"resource.003", 0, "a21451ef6fa8179bd4b22c4950004c44", 769897},
AD_LISTEND},
- Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO3(GUIO_NOSPEECH, GUIO_NOASPECT, GUIO_EGAUNDITHER) },
// Quest for Glory 1 - Japanese PC-98 5.25" Floppy (also includes English language)
// Executable scanning reports "S.old.201"
@@ -2817,7 +2831,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "a21451ef6fa8179bd4b22c4950004c44", 1147121},
{"resource.003", 0, "a21451ef6fa8179bd4b22c4950004c44", 777575},
AD_LISTEND},
- Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO3(GUIO_NOSPEECH, GUIO_NOASPECT, GUIO_EGAUNDITHER) },
// Quest for Glory 1 - English Amiga
// Executable scanning reports "1.002.020"
@@ -2831,7 +2845,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "16cd4414c37ae3bb6d6da33dce8e25e8", 689124},
{"resource.005", 0, "5f3386ef2f2b1254e4a066f5d9027324", 609529},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Quest for Glory 1 (from abevi, bug report #2612718)
{"qfg1", "", {
@@ -2842,7 +2856,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "f0af87c60ec869946da442833aa5afa8", 640502},
{"resource.004", 0, "f0af87c60ec869946da442833aa5afa8", 644575},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Quest for Glory 1 - English DOS
// SCI interpreter version 0.000.629
@@ -2854,7 +2868,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "951299a82a8134ed12c5c18118d45c2f", 640483},
{"resource.004", 0, "951299a82a8134ed12c5c18118d45c2f", 644443},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Quest for Glory 1 VGA Remake - English DOS
// Executable scanning reports "2.000.411"
@@ -2862,7 +2876,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a731fb6c9c0b282443f7027bc8694d4c", 8469},
{"resource.000", 0, "ecace1a2771846b1a8aa1afdd44111a0", 6570147},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Quest for Glory 1 VGA Remake - English DOS Non-Interactive Demo (from FRG)
// SCI interpreter version 1.001.029
@@ -2870,7 +2884,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "ac0257051c95a59c0cdc0be24d9b11fa", 729},
{"resource.000", 0, "ec6f5cf369054dd3e5392995e9975b9e", 768218},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
// Quest for Glory 1 VGA Remake - English Macintosh Floppy
// VERSION file reports "2.0"
@@ -2878,7 +2892,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"Data1", 0, "106527ff8756e4e1a795d63d23e8b833", 1752358},
{"Data2", 0, "5cdd92033231159c6e9c71d43e9f194d", 6574746},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK, GUIO1(GUIO_NOSPEECH) },
// Quest for Glory 2 - English Amiga
// Executable scanning reports "1.003.004"
@@ -2894,7 +2908,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "ccf5dba33e5cab6d5872838c0f8db44c", 500039},
{"resource.007", 0, "4c9fc1587545879295cb9627f56a2cb8", 575056},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
// Quest for Glory 2 - English (supplied by ssburnout in bug report #3049193)
// 1.000 5x5.25" (label: INT#10.31.90)
@@ -2906,7 +2920,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "0790f67d87642132be515cab05026baa", 972144},
{"resource.004", 0, "2ac1e6fea9aa1f5b91a06693a67b9766", 982830},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Quest for Glory 2 - English (supplied by ssburnout in bug report #3049193)
// 1.000 9x3.5" (label: INT#10.31.90)
@@ -2921,7 +2935,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "5e9deacbdb17198ad844988e04833520", 498593},
{"resource.007", 0, "2ac1e6fea9aa1f5b91a06693a67b9766", 490151},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Quest for Glory 2 - English (from FRG)
// Executable scanning reports "1.000.072"
@@ -2933,7 +2947,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "b192607c42f6960ecdf2ad2e4f90e9bc", 972804},
{"resource.004", 0, "cd2de58e27665d5853530de93fae7cd6", 983617},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Quest for Glory 2 - English DOS
// Executable scanning reports "1.000.072"
@@ -2948,7 +2962,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "b1944bd664ddbd2859cdaa0c4a0d6281", 507489},
{"resource.007", 0, "cd2de58e27665d5853530de93fae7cd6", 490794},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Quest for Glory 2 - English DOS Non-Interactive Demo
// Executable scanning reports "1.000.046"
@@ -2956,7 +2970,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "e75eb86bdd517b3ef709058249986a87", 906},
{"resource.001", 0, "9b098f9e1008abe30e56c93b896494e6", 362123},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
// Quest for Glory 3 - English DOS Non-Interactive Demo (from FRG)
// Executable scanning reports "1.001.021", VERSION file reports "1.000, 0.001.059, 6.12.92"
@@ -2964,7 +2978,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "fd71de9b588a45f085317caacf050e91", 687},
{"resource.000", 0, "b6c69bf6c18bf177492249fe81fc6a6d", 648702},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
// Quest for Glory 3 - English DOS
// SCI interpreter version 1.001.050
@@ -2972,7 +2986,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "19e2bf9b693932b5e2bb59b9f9ab86c9", 5958},
{"resource.000", 0, "6178ad2e83e58e4671ca03315f7a6498", 5868000},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Quest for Glory 3 - English DOS (supplied by abevi in bug report #2612718)
// SCI interpreter version 1.001.050
@@ -2980,7 +2994,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "62c185d190363d7df06330fa0cc45b36", 5958},
{"resource.000", 0, "6178ad2e83e58e4671ca03315f7a6498", 5867442},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Quest for Glory 3 - English DOS (supplied by dknute in bug report #3125559)
{"qfg3", "", {
@@ -2988,7 +3002,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "6178ad2e83e58e4671ca03315f7a6498", 5868042},
{"resource.msg", 0, "27e5419c98ce444253f88c95dced14a9", 246888},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Quest for Glory 3 - German DOS (supplied by markcoolio in bug report #2723846)
// Executable scanning reports "L.rry.083"
@@ -2996,7 +3010,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "19e2bf9b693932b5e2bb59b9f9ab86c9", 5958},
{"resource.000", 0, "6178ad2e83e58e4671ca03315f7a6498", 5868042},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Quest for Glory 3 - Spanish DOS CD (from jvprat)
// Executable scanning reports "L.rry.083", VERSION file reports "1.000.000, June 30, 1994"
@@ -3005,7 +3019,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "ba7ac86155e4c531e46cd73c86daa80a", 5884098},
{"resource.msg", 0, "a63974730d294dec0bea10057c36e506", 256014},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NONE },
+ Common::ES_ESP, Common::kPlatformPC, 0, GUIO0() },
// Quest for Glory 3 - Italian DOS
// Supplied by ghoost in bug report #3053457
@@ -3014,7 +3028,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "6178ad2e83e58e4671ca03315f7a6498", 5868000},
{"resource.msg", 0, "5a0a896ff3e4a628db38a75eb6c84114", 259018},
AD_LISTEND},
- Common::IT_ITA, Common::kPlatformPC, 0, GUIO_NONE },
+ Common::IT_ITA, Common::kPlatformPC, 0, GUIO0() },
// Quest for Glory 4 - English DOS Non-Interactive Demo (from FRG)
// SCI interpreter version 1.001.069 (just a guess)
@@ -3022,7 +3036,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "1ba7c7ae1efb315326d45cb931569b1b", 922},
{"resource.000", 0, "41ba03f0b188b029132daa3ece0d3e14", 623154},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
#ifdef ENABLE_SCI32
// Quest for Glory 4 1.1 Floppy - English DOS (supplied by markcool in bug report #2723852)
@@ -3031,7 +3045,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "685bdb1ed47bbbb0e5e25db392da83ce", 9301},
{"resource.000", 0, "f64fd6aa3977939a86ff30783dd677e1", 11004993},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOSPEECH) },
// Quest for Glory 4 1.1 Floppy - English DOS (supplied by abevi in bug report #2612718)
// SCI interpreter version 2.000.000
@@ -3039,7 +3053,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "d10a4cc177d2091d744e2ad8c049b0ae", 9295},
{"resource.000", 0, "f64fd6aa3977939a86ff30783dd677e1", 11003589},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOSPEECH) },
// Quest for Glory 4 1.1 Floppy - German DOS (supplied by markcool in bug report #2723850)
// Executable scanning reports "2.000.000", VERSION file reports "1.1"
@@ -3047,7 +3061,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "9e0abba8746f40565bc7eb5720522ecd", 9301},
{"resource.000", 0, "57f22cdc54eeb35fce1f26b31b5c3ee1", 11076197},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_UNSTABLE, GUIO1(GUIO_NOSPEECH) },
// Quest for Glory 4 CD - English DOS/Windows (from jvprat)
// Executable scanning reports "2.100.002", VERSION file reports "1.0"
@@ -3055,7 +3069,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "aba367f2102e81782d961b14fbe3d630", 10246},
{"resource.000", 0, "263dce4aa34c49d3ad29bec889007b1c", 11571394},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// RAMA - English DOS/Windows Demo
// Executable scanning reports "2.100.002", VERSION file reports "000.000.008"
@@ -3063,7 +3077,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.001", 0, "775304e9b2a545156be4d94209550094", 1393},
{"ressci.001", 0, "259437fd75fdf51e8207fda8c01fa4fd", 2334384},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
#ifdef ENABLE_SCI3_GAMES
// RAMA - English Windows (from jvprat)
@@ -3076,7 +3090,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.003", 0, "31ef4c0621711585d031f0ae81707251", 1636},
{"ressci.003", 0, "2a68edd064e5e4937b5e9c74b38f2082", 6860492},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// RAMA - English Windows (from Quietust, in bug report #2850645)
{"rama", "", {
@@ -3087,7 +3101,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.003", 0, "48841e4b84ef1b98b48d43566fda9e13", 1636},
{"ressci.003", 0, "2a68edd064e5e4937b5e9c74b38f2082", 6870356},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// RAMA - Italian Windows CD (from glorifindel)
// SCI interpreter version 3.000.000 (a guess?)
@@ -3095,7 +3109,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"ressci.001", 0, "2a68edd064e5e4937b5e9c74b38f2082", 70611091},
{"resmap.001", 0, "70ba2ff04a2b7fb2c52420ba7fbd47c2", 8338},
AD_LISTEND},
- Common::IT_ITA, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO_NONE },
+ Common::IT_ITA, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
#endif // ENABLE_SCI3_GAMES
// Shivers - English Windows (from jvprat)
@@ -3104,14 +3118,14 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "f2ead37749ed8f6535a2445a7d05a0cc", 46525},
{"ressci.000", 0, "4294c6d7510935f2e0a52e302073c951", 262654836},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// Shivers - German Windows (from Tobis87)
{"shivers", "", {
{"resmap.000", 0, "f483d0a1f78334c18052e92785c3086e", 46537},
{"ressci.000", 0, "6751b144671e2deed919eb9d284b07eb", 262390692},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO_NONE },
+ Common::DE_DEU, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// Shivers - English Windows Demo
// Executable scanning reports "2.100.002"
@@ -3119,7 +3133,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "d9e0bc5eddefcbe47f528760085d8927", 1186},
{"ressci.000", 0, "3a93c6340b54e07e65d0e5583354d186", 10505469},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// Shivers 2 doesn't contain SCI scripts. The whole game logic has
// been reimplemented from SCI in native code placed in DLL files.
@@ -3137,7 +3151,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "d8659188b84beaef076bd869837cd530", 634},
{"ressci.000", 0, "7fbac0807a044c9543e8ac376d200e59", 4925003},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// Shivers 2 - English Windows (from abevi)
// VERSION.TXT Version 1.0 (3/25/97)
@@ -3145,7 +3159,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"ressci.001", 0, "a79d03d6eb75be0a79324f14e3d2ace4", 95346793},
{"resmap.001", 0, "a4804d436d90c4ec2e46b537f5e954db", 6268},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
#endif
@@ -3158,7 +3172,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.msg", 0, "1aeafe2b495de288d002109650b66614", 1364},
{"resource.000", 0, "8e10d4f05c1fd9f883384fa38a898489", 377394},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
// Slater & Charlie Go Camping - English DOS/Windows
{"slater", "", {
@@ -3166,7 +3180,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "21f85414124dc23e54544a5536dc35cd", 4044},
{"resource.msg", 0, "c44f51fb955eae266fecf360ebcd5ad2", 1132},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Slater & Charlie Go Camping - English DOS/Windows (Sierra Originals)
@@ -3175,7 +3189,14 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "21f85414124dc23e54544a5536dc35cd", 4044},
{"resource.msg", 0, "c44f51fb955eae266fecf360ebcd5ad2", 1132},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
+
+ // Slater & Charlie Go Camping - English Macintosh
+ {"slater", "", {
+ {"Data1", 0, "7243b4390e5f0182d8133fbcae4b50c5", 2298853},
+ {"Data2", 0, "6b6f18f9b502dc0923eeae0ef47f02d5", 2276956},
+ AD_LISTEND},
+ Common::EN_ANY, Common::kPlatformMacintosh, ADGF_MACRESFORK, GUIO1(GUIO_NONE) },
// Space Quest 1 VGA Remake - English Amiga (from www.back2roots.org)
// SCI interpreter version 1.000.510 (just a guess)
@@ -3188,7 +3209,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "b25a1539c71701f7715f738c5037e9a6", 775515},
{"resource.005", 0, "640ffe1a9acde392cc33cc1b1a528328", 806324},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
// Space Quest 1 VGA Remake - English DOS (from the Space Quest Collection)
// Executable scanning reports "T.A00.081", VERSION file reports "2.000"
@@ -3201,7 +3222,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "c47600e50c6fc591957ae0c5020ee7b8", 1213262},
{"resource.004", 0, "e19ea4ad131472f9238590f2e1d40289", 1203051},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Space Quest 1 VGA Remake - English Mac (from Fingolfin)
{"sq1sci", "SCI", {
@@ -3212,7 +3233,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "ae46e195e66df5a131917f0aa80b5669", 1242794},
{"resource.004", 0, "91d58a9eb2187c38424990afe4c12bc6", 1250949},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO1(GUIO_NOSPEECH) },
// Space Quest 1 VGA Remake - English Non-Interactive Demo (from FRG)
// SCI interpreter version 1.000.181
@@ -3220,7 +3241,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "5af709ac5e0e923e0b8174f49978c30e", 636},
{"resource.001", 0, "fd99ea43f57576ded7c86036996346cf", 507642},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
// Space Quest 1 VGA Remake - Spanish DOS Floppy (from jvprat)
// Executable scanning reports "T.A00.081", VERSION file reports "2.000"
@@ -3234,7 +3255,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "9b78228ad4f9f335fedf74f1812dcfca", 513325},
{"resource.005", 0, "7d4ebcb745c0bf8fc42e4013f52ecd49", 1101812},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::ES_ESP, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Space Quest I 2.0 EGA DOS (6 x 3.5" disks)
// Provided by ssburnout in bug report #3046805
@@ -3247,7 +3268,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "975c6e81194ae6b65e960a248129ecaa", 684119},
{"resource.005", 0, "13d96f7905637552c0647175ff816145", 695589},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Space Quest 3 - English Amiga (from www.back2roots.org)
// SCI interpreter version 0.000.453 (just a guess)
@@ -3258,7 +3279,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.003", 0, "ceeda7202b96e5c85ecaa88a40a540fc", 746496},
{"resource.004", 0, "ceeda7202b96e5c85ecaa88a40a540fc", 761984},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Space Quest 3 - German Amiga (also includes english language)
// Executable scanning reports "1.004.006"
@@ -3271,7 +3292,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "6d8f34090503ce937e7dbef6cb6cdb6a", 545053},
{"resource.005", 0, "6d8f34090503ce937e7dbef6cb6cdb6a", 687507},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Space Quest 3 - English DOS Non-Interactive Demo
// SCI interpreter version 0.000.453
@@ -3279,7 +3300,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "ec66ac2b1ce58b2575ba00b65058de1a", 612},
{"resource.001", 0, "ceeda7202b96e5c85ecaa88a40a540fc", 180245},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Space Quest 3 - English DOS (provided by richiefs in bug report #2670691)
// SCI interpreter version 0.000.453
@@ -3289,7 +3310,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "ceeda7202b96e5c85ecaa88a40a540fc", 720244},
{"resource.003", 0, "ceeda7202b96e5c85ecaa88a40a540fc", 688367},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Space Quest 3 - English DOS (from the Space Quest Collection)
// Executable scanning reports "0.000.685", VERSION file reports "1.018"
@@ -3299,7 +3320,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "8b55c4875298f45ea5696a5ee8f6a7fe", 715777},
{"resource.003", 0, "8b55c4875298f45ea5696a5ee8f6a7fe", 703370},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Space Quest 3 - English DOS (from abevi, bug report #2612718)
{"sq3", "", {
@@ -3311,7 +3332,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "ceeda7202b96e5c85ecaa88a40a540fc", 328278},
{"resource.006", 0, "ceeda7202b96e5c85ecaa88a40a540fc", 356702},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Space Quest 3 - English Mac (from Fingolfin)
{"sq3", "", {
@@ -3320,7 +3341,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "0d8dfe42683b46f3131823233a91ce6a", 794072},
{"resource.003", 0, "0d8dfe42683b46f3131823233a91ce6a", 776536},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Space Quest 3 - German DOS (from Tobis87, also includes english language)
// SCI interpreter version 0.000.453 (?)
@@ -3334,7 +3355,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.006", 0, "9107c2aa5398e28b5c5406df13491f85", 320643},
{"resource.007", 0, "9107c2aa5398e28b5c5406df13491f85", 344287},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Space Quest 3 v1.052 - German DOS (supplied by markcoolio in bug report #2723860, also includes english language)
// Executable scanning reports "S.old.114"
@@ -3344,7 +3365,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "9107c2aa5398e28b5c5406df13491f85", 596768},
{"resource.003", 0, "9107c2aa5398e28b5c5406df13491f85", 693573},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// Space Quest 4 - English Amiga
// Executable scanning reports "1.004.024"
@@ -3359,7 +3380,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "3540d1cc84d674cf4b2c898b88a3b563", 790296},
{"resource.006", 0, "ade814bc4d56244c156d9e9bcfebbc11", 664085},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformAmiga, 0, GUIO1(GUIO_NOSPEECH) },
// Space Quest 4 - German Amiga (from www.back2roots.org, also includes english language)
// SCI interpreter version 1.000.200 (just a guess)
@@ -3373,7 +3394,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "10ee1709e6559c724676d058199b75b5", 818745},
{"resource.006", 0, "67fb188b191d88efe8414af6ea297b93", 672675},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformAmiga, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// Space Quest 4 - English DOS - THIS VERSION IS PIRATED/CRACKED AND REPACKAGED =DO NOT RE-ADD=
// Executable scanning reports "1.000.753"
@@ -3382,7 +3403,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a18088c8aceb06025dbc945f29e02935", 5124},
{"resource.000", 0, "e1f46832cd2458796028e054a0466031", 5502009},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_PIRATED, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_PIRATED, GUIO1(GUIO_NOSPEECH) },
// Space Quest 4 - English DOS
// Executable scanning reports "1.000.753"
@@ -3391,7 +3412,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "71ccf4f82ac4efb588731acfb7bf2603", 5646},
{"resource.000", 0, "e1f46832cd2458796028e054a0466031", 933928},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Space Quest 4 1.052 - English DOS Floppy (supplied by markcoolio in bug report #2723865)
// Executable scanning reports "1.000.753"
@@ -3405,7 +3426,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "ff9c87da3bc53473fdee8b9d3edbc93c", 1200631},
{"resource.005", 0, "e33019ac19f755ae33fbf49b4fc9066c", 1053294},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Space Quest 4 1.000 - English DOS Floppy (from abevi, bug report #2612718)
{"sq4", "", {
@@ -3417,7 +3438,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "c06350184a490c10eb4585fff0aa3192", 1254368},
{"resource.005", 0, "b8d6efbd3235329bfe844c794097b2c9", 1098717},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Space Quest IV DOS 1.060 EGA (6 x 3.5" disks)
// Supplied by ssburnout in bug report #3046781
@@ -3430,7 +3451,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "9a673e33c3f6dd560b993ffed77eeb49", 534994},
{"resource.005", 0, "3c4841d0a3ebba4404af588c93620c22", 595465},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO2(GUIO_NOSPEECH, GUIO_EGAUNDITHER) },
// Space Quest 4 - German DOS (from Tobis87, also includes english language)
// SCI interpreter version 1.000.200 (just a guess)
@@ -3444,7 +3465,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "47ee647b5b12232d27e63cc627c25899", 1156765},
{"resource.006", 0, "dfb023e4e2a1e7a00fa18f9ede72a91b", 924059},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// Space Quest 4 - Italian DOS Floppy (from glorifindel, also includes english language)
// SCI interpreter version 1.000.200 (just a guess)
@@ -3457,7 +3478,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "4277c61bed40a50dadc4b5a344520af2", 1251000},
{"resource.005", 0, "5f885abd335978e2fd4e5f886d7676c8", 1102880},
AD_LISTEND},
- Common::IT_ITA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::IT_ITA, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// Space Quest 4 - Japanese PC-98 5.25" Floppy (also includes english language)
// SCI interpreter version 1.000.1068
@@ -3467,7 +3488,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "454684e3a7a68cbca073945e50778447", 1187088},
{"resource.002", 0, "6dc668326cc22cb9e8bd8ca9e68d2a66", 1181249},
AD_LISTEND},
- Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// Space Quest 4 - Japanese PC-98 5.25" Floppy (also includes english language)
// SCI interpreter version 1.000.1068
@@ -3477,7 +3498,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.001", 0, "454684e3a7a68cbca073945e50778447", 1187088},
{"resource.002", 0, "6dc668326cc22cb9e8bd8ca9e68d2a66", 1181249},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// Space Quest 4 - English DOS CD (from the Space Quest Collection)
// Executable scanning reports "1.001.064", VERSION file reports "1.0"
@@ -3485,7 +3506,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "ed90a8e3ccc53af6633ff6ab58392bae", 7054},
{"resource.000", 0, "63247e3901ab8963d4eece73747832e0", 5157378},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD, GUIO0() },
// Space Quest 4 - English Windows CD (from the Space Quest Collection)
// Executable scanning reports "1.001.064", VERSION file reports "1.0"
@@ -3495,7 +3516,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "ed90a8e3ccc53af6633ff6ab58392bae", 7054},
{"resource.000", 0, "63247e3901ab8963d4eece73747832e0", 5157378},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO_MIDIGM },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_CD, GUIO1(GUIO_MIDIGM) },
// Space Quest 4 - Spanish DOS CD (from jvprat, is still text only, not talkie, also includes english language)
// Executable scanning reports "1.SQ4.057", VERSION file reports "1.000"
@@ -3509,7 +3530,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "776fba81c110d1908776232cbe190e20", 1253752},
{"resource.005", 0, "55fae26c2a92f16ef72c1e216e827c0f", 1098328},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NONE },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO0() },
// Space Quest 4 - Spanish DOS Floppy (from jvprat, also includes english language)
// Executable scanning reports "1.SQ4.056", VERSION file reports "1.000"
@@ -3521,7 +3542,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "74c62fa2146ff3b3b2ea2b3fb95b9af9", 1140801},
{"resource.003", 0, "42a307941edeb1a3be31daeb2e4be90b", 1088408},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::ES_ESP, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// Space Quest 4 1.000 - German DOS Floppy (supplied by markcoolio in bug report #2723862, also includes english language)
// Executable scanning reports "1.SQ4.030"
@@ -3535,7 +3556,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "c06350184a490c10eb4585fff0aa3192", 1254368},
{"resource.005", 0, "b8d6efbd3235329bfe844c794097b2c9", 1098717},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_ADDENGLISH, GUIO1(GUIO_NOSPEECH) },
// Space Quest 4 - English Macintosh
// Executable scanning reports "x.yyy.zzz"
@@ -3550,7 +3571,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.005", 0, "869d16cab6641c80b06f4dcee18f86bc", 1426228},
{"resource.006", 0, "91d23407bc0447a3722fbeb952d7edee", 1402451},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformMacintosh, 0, GUIO1(GUIO_NOSPEECH) },
// Space Quest 4 - Russian DOS
// Executable scanning reports "1.000.753", VERSION file reports "1.994"
@@ -3563,7 +3584,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.004", 0, "2763fe4f0cb74df716ec8b0c464b0988", 1217428},
{"resource.005", 0, "d608713197c5ba1cd8c6ed46299c3069", 1057924},
AD_LISTEND},
- Common::RU_RUS, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::RU_RUS, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Space Quest 5 - English DOS (from the Space Quest Collection)
// Executable scanning reports "1.001.068", VERSION file reports "1.04"
@@ -3572,7 +3593,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "4147edc5045e6d62998018b5614c58ec", 5496486},
{"resource.msg", 0, "bb8ad78793c26bdb3f77498b1d6515a9", 125988},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Space Quest 5 - English DOS - THIS IS THE UNOFFICIAL BETA VERSION, WHICH IS OBVIOUSLY PIRATED AND CONTAINS MANY BUGS
// ffs. http://www.akril15.com/sr/sq5alt/sq5alt.html =DO NOT RE-ADD=
@@ -3581,7 +3602,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "8bde0a9adb9a3e9aaa861826874c9834", 6473},
{"resource.000", 0, "f4a48705764544d7cc64a7bb22a610df", 6025184},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_PIRATED, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_PIRATED, GUIO1(GUIO_NOSPEECH) },
// Space Quest 5 v1.04 - German DOS (from Tobis87, updated information by markcool from bug reports #2723935 and #2724762)
// SCI interpreter version 1.001.068
@@ -3590,7 +3611,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "4147edc5045e6d62998018b5614c58ec", 5496486},
{"resource.msg", 0, "7c71cfc36153cfe07b450423a51f7e68", 146282},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Space Quest 5 v1.04 - French DOS (from Hkz, Included in Space Quest Collector's Edition, with chapters I-V)
{"sq5", "", {
@@ -3598,7 +3619,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "4147edc5045e6d62998018b5614c58ec", 5496486},
{"resource.msg", 0, "877c42380320eb1db7dad83ccd261214", 140374},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::FR_FRA, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Space Quest 5 - Italian DOS Floppy (from glorifindel)
// SCI interpreter version 1.001.068 (just a guess)
@@ -3606,7 +3627,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "5040026519f37199f3616fb1d4704dff", 6047170},
{"resource.map", 0, "5b09168baa2f6e2e22787429b2d72f54", 6492},
AD_LISTEND},
- Common::IT_ITA, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::IT_ITA, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Space Quest 5 - Spanish DOS Floppy (from mirir, bug report #3090664)
{"sq5", "", {
@@ -3614,7 +3635,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "5714a899033bdebf2d61ad333c8c6637", 6492},
{"resource.msg", 0, "46deca7ef9cf057f7d442df98c1a2ae2", 134612},
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::ES_ESP, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// Space Quest 5 - Russian DOS
// Executable scanning reports "1.001.068", VERSION file reports "1.994"
@@ -3623,7 +3644,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "6f9ed21e1001526b4137f6703ed476af", 6103778},
{"resource.msg", 0, "0a8931990cd2eac1691602391c68ab85", 147580},
AD_LISTEND},
- Common::RU_RUS, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::RU_RUS, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
#ifdef ENABLE_SCI32
// Space Quest 6 - English DOS/Win3.11 CD (from the Space Quest Collection)
@@ -3632,7 +3653,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "6dddfa3a8f3a3a513ec9dfdfae955005", 10528},
{"resource.000", 0, "c4259ab7355aead07773397b1052827d", 41150806},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// Space Quest 6 - English DOS/Win3.11 CD ver 1.11 (from FRG)
// SCI interpreter version 2.100.002 (just a guess)
@@ -3640,7 +3661,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "e0615d6e4e10e37ae42e6a2a95aaf145", 10528},
{"resource.000", 0, "c4259ab7355aead07773397b1052827d", 41150806},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// Space Quest 6 - French DOS/Win3.11 CD (from French magazine Joystick - September 1997)
// Executable scanning reports "2.100.002", VERSION file reports "1.0"
@@ -3648,7 +3669,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "3c831625931d5079b73ae8c275f52c95", 10534},
{"resource.000", 0, "4195ca940f759424f62b90e262cc1737", 40932397},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO_NONE },
+ Common::FR_FRA, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// Space Quest 6 - German DOS (from Tobis87, updated info from markcoolio in bug report #2723884)
// SCI interpreter version 2.100.002 (just a guess)
@@ -3656,7 +3677,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "664d797415484f85c90b1b45aedc7686", 10534},
{"resource.000", 0, "ba87ba91e5bdabb4169dd0df75777722", 40933685},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO_NONE },
+ Common::DE_DEU, Common::kPlatformPC, ADGF_CD | ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
// Space Quest 6 - English DOS/Win3.11 Interactive Demo (from FRG)
// SCI interpreter version 2.100.002 (just a guess)
@@ -3664,7 +3685,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "368f07b07433db3f819fa3fa0e5efee5", 2572},
{"resource.000", 0, "ab12724e078dea34b624e0d2a38dcd7c", 2272050},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO | ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
#endif // ENABLE_SCI32
// The Island of Dr. Brain - English DOS CD (from jvprat)
@@ -3673,7 +3694,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "2388efef8430b041b0f3b00b9050e4a2", 3281},
{"resource.000", 0, "b3acd9b9dd7fe53c4ee133ac9a1acfab", 2103560},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NONE },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO0() },
// The Island of Dr. Brain - English DOS (from Quietust)
// Executable scanning reports "1.001.053", VERSION file reports "1.1 2.3.93"
@@ -3681,7 +3702,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "3c07da06bdd1689f9d07af78fb94d0ec", 3101},
{"resource.000", 0, "ecc686e0034fb4d41de077ac7167b3cf", 1947866},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO1(GUIO_NOSPEECH) },
// The Island of Dr. Brain - English DOS Non-Interactive Demo
// SCI interpreter version 1.001.053 (just a guess)
@@ -3689,7 +3710,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.map", 0, "a8e5ca8ed1996974afa59f4c45e06195", 986},
{"resource.000", 0, "b3acd9b9dd7fe53c4ee133ac9a1acfab", 586560},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO1(GUIO_NOSPEECH) },
#ifdef ENABLE_SCI32
// Torin's Passage - English Windows Interactive Demo
@@ -3698,7 +3719,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "9a3e172cde9963d0a969f26469318cec", 3403},
{"ressci.000", 0, "db3e290481c35c3224e9602e71e4a1f1", 5073868},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_DEMO | ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// Torin's Passage - English Windows
// SCI interpreter version 2.100.002 (just a guess)
@@ -3706,7 +3727,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "bb3b0b22ff08df54fbe2d06263409be6", 9799},
{"ressci.000", 0, "693a259d346c9360f4a0c11fdaae430a", 55973887},
AD_LISTEND},
- Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::EN_ANY, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// Torin's Passage - Spanish Windows (from jvprat)
// Executable scanning reports "2.100.002", VERSION file reports "1.0"
@@ -3715,7 +3736,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"ressci.000", 0, "693a259d346c9360f4a0c11fdaae430a", 55973887},
// TODO: depend on one of the patches?
AD_LISTEND},
- Common::ES_ESP, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::ES_ESP, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// Torin's Passage - French Windows
// SCI interpreter version 2.100.002 (just a guess)
@@ -3723,7 +3744,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "bb3b0b22ff08df54fbe2d06263409be6", 9799},
{"ressci.000", 0, "693a259d346c9360f4a0c11fdaae430a", 55973887},
AD_LISTEND},
- Common::FR_FRA, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::FR_FRA, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// Torin's Passage - German Windows
// SCI interpreter version 2.100.002 (just a guess)
@@ -3731,7 +3752,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "bb3b0b22ff08df54fbe2d06263409be6", 9799},
{"ressci.000", 0, "693a259d346c9360f4a0c11fdaae430a", 55973887},
AD_LISTEND},
- Common::DE_DEU, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO_NOSPEECH },
+ Common::DE_DEU, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO2(GUIO_NOSPEECH, GUIO_NOASPECT) },
// Torin's Passage - Italian Windows CD (from glorifindel)
// SCI interpreter version 2.100.002 (just a guess)
@@ -3739,7 +3760,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resmap.000", 0, "bb3b0b22ff08df54fbe2d06263409be6", 9799},
{"ressci.000", 0, "693a259d346c9360f4a0c11fdaae430a", 55973887},
AD_LISTEND},
- Common::IT_ITA, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO_NONE },
+ Common::IT_ITA, Common::kPlatformWindows, ADGF_UNSTABLE, GUIO1(GUIO_NOASPECT) },
#endif // ENABLE_SCI32
// SCI Fanmade Games
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index a83a026762..c99bc4fe47 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -828,7 +828,8 @@ void Kernel::setDefaultKernelNames(GameFeatures *features) {
enum {
kKernelEntriesSci2 = 0x8b,
kKernelEntriesGk2Demo = 0xa0,
- kKernelEntriesSci21 = 0x9d
+ kKernelEntriesSci21 = 0x9d,
+ kKernelEntriesSci3 = 0xa1
};
void Kernel::setKernelNamesSci2() {
@@ -856,8 +857,11 @@ void Kernel::setKernelNamesSci21(GameFeatures *features) {
// OnMe is IsOnMe here, but they should be compatible
_kernelNames[0x23] = "Robot"; // Graph in SCI2
_kernelNames[0x2e] = "Priority"; // DisposeTextBitmap in SCI2
- } else
+ } else if (getSciVersion() != SCI_VERSION_3) {
_kernelNames = Common::StringArray(sci21_default_knames, kKernelEntriesSci21);
+ } else if (getSciVersion() == SCI_VERSION_3) {
+ _kernelNames = Common::StringArray(sci21_default_knames, kKernelEntriesSci3);
+ }
}
#endif
@@ -910,28 +914,32 @@ Common::String Kernel::lookupText(reg_t address, int index) {
// TODO: script_adjust_opcode_formats should probably be part of the
// constructor (?) of a VirtualMachine or a ScriptManager class.
void script_adjust_opcode_formats() {
+
+ g_sci->_opcode_formats = new opcode_format[128][4];
+ memcpy(g_sci->_opcode_formats, g_base_opcode_formats, 128*4*sizeof(opcode_format));
+
if (g_sci->_features->detectLofsType() != SCI_VERSION_0_EARLY) {
- g_opcode_formats[op_lofsa][0] = Script_Offset;
- g_opcode_formats[op_lofss][0] = Script_Offset;
+ g_sci->_opcode_formats[op_lofsa][0] = Script_Offset;
+ g_sci->_opcode_formats[op_lofss][0] = Script_Offset;
}
#ifdef ENABLE_SCI32
// In SCI32, some arguments are now words instead of bytes
if (getSciVersion() >= SCI_VERSION_2) {
- g_opcode_formats[op_calle][2] = Script_Word;
- g_opcode_formats[op_callk][1] = Script_Word;
- g_opcode_formats[op_super][1] = Script_Word;
- g_opcode_formats[op_send][0] = Script_Word;
- g_opcode_formats[op_self][0] = Script_Word;
- g_opcode_formats[op_call][1] = Script_Word;
- g_opcode_formats[op_callb][1] = Script_Word;
+ g_sci->_opcode_formats[op_calle][2] = Script_Word;
+ g_sci->_opcode_formats[op_callk][1] = Script_Word;
+ g_sci->_opcode_formats[op_super][1] = Script_Word;
+ g_sci->_opcode_formats[op_send][0] = Script_Word;
+ g_sci->_opcode_formats[op_self][0] = Script_Word;
+ g_sci->_opcode_formats[op_call][1] = Script_Word;
+ g_sci->_opcode_formats[op_callb][1] = Script_Word;
}
if (getSciVersion() >= SCI_VERSION_3) {
// TODO: There are also opcodes in
// here to get the superclass, and possibly the species too.
- g_opcode_formats[0x4d/2][0] = Script_None;
- g_opcode_formats[0x4e/2][0] = Script_None;
+ g_sci->_opcode_formats[0x4d/2][0] = Script_None;
+ g_sci->_opcode_formats[0x4e/2][0] = Script_None;
}
#endif
}
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index b605908dc1..e549c1f8ae 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -442,11 +442,11 @@ reg_t kUpdateScreenItem(EngineState *s, int argc, reg_t *argv);
reg_t kDeleteScreenItem(EngineState *s, int argc, reg_t *argv);
// Text
reg_t kCreateTextBitmap(EngineState *s, int argc, reg_t *argv);
+reg_t kDisposeTextBitmap(EngineState *s, int argc, reg_t *argv);
// "Planes" in SCI32 are pictures
reg_t kAddPlane(EngineState *s, int argc, reg_t *argv);
reg_t kDeletePlane(EngineState *s, int argc, reg_t *argv);
reg_t kUpdatePlane(EngineState *s, int argc, reg_t *argv);
-reg_t kRepaintPlane(EngineState *s, int argc, reg_t *argv);
reg_t kSetShowStyle(EngineState *s, int argc, reg_t *argv);
reg_t kGetHighPlanePri(EngineState *s, int argc, reg_t *argv);
reg_t kFrameOut(EngineState *s, int argc, reg_t *argv);
@@ -456,6 +456,8 @@ reg_t kListEachElementDo(EngineState *s, int argc, reg_t *argv);
reg_t kListFirstTrue(EngineState *s, int argc, reg_t *argv);
reg_t kListAllTrue(EngineState *s, int argc, reg_t *argv);
reg_t kInPolygon(EngineState *s, int argc, reg_t *argv);
+reg_t kObjectIntersect(EngineState *s, int argc, reg_t *argv);
+reg_t kEditText(EngineState *s, int argc, reg_t *argv);
// SCI2.1 Kernel Functions
reg_t kText(EngineState *s, int argc, reg_t *argv);
@@ -477,6 +479,9 @@ 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);
+
+// SCI3 Kernel functions
+reg_t kPlayDuck(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 d3adcaccbf..fe0c9fc2ef 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -24,7 +24,7 @@
#define SCI_ENGINE_KERNEL_TABLES_H
#include "sci/engine/workarounds.h"
-#include "sci/engine/vm.h" // for opcode_formats
+#include "sci/engine/vm_types.h" // for opcode_formats
namespace Sci {
@@ -477,6 +477,7 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_CALL(CreateTextBitmap), SIG_EVERYWHERE, "i(.*)", NULL, NULL },
{ MAP_CALL(DeletePlane), SIG_EVERYWHERE, "o", NULL, NULL },
{ MAP_CALL(DeleteScreenItem), SIG_EVERYWHERE, "o", NULL, NULL },
+ { MAP_CALL(DisposeTextBitmap), SIG_EVERYWHERE, "r", NULL, NULL },
{ MAP_CALL(FrameOut), SIG_EVERYWHERE, "", NULL, NULL },
{ MAP_CALL(GetHighPlanePri), SIG_EVERYWHERE, "", NULL, NULL },
{ MAP_CALL(InPolygon), SIG_EVERYWHERE, "iio", NULL, NULL },
@@ -493,25 +494,46 @@ static SciKernelMapEntry s_kernelMap[] = {
// our own memory manager and garbage collector, thus we simply call FlushResources, which in turn invokes
// our garbage collector (i.e. the SCI0-SCI1.1 semantics).
{ "Purge", kFlushResources, SIG_EVERYWHERE, "i", NULL, NULL },
- { MAP_CALL(RepaintPlane), SIG_EVERYWHERE, "o", NULL, NULL },
{ MAP_CALL(SetShowStyle), SIG_EVERYWHERE, "ioiiiii([ri])(i)", NULL, NULL },
{ MAP_CALL(String), SIG_EVERYWHERE, "(.*)", NULL, NULL },
{ MAP_CALL(UpdatePlane), SIG_EVERYWHERE, "o", NULL, NULL },
{ MAP_CALL(UpdateScreenItem), SIG_EVERYWHERE, "o", NULL, NULL },
+ { MAP_CALL(ObjectIntersect), SIG_EVERYWHERE, "oo", NULL, NULL },
+ { MAP_CALL(EditText), SIG_EVERYWHERE, "o", NULL, NULL },
// SCI2 unmapped functions - TODO!
- // SetScroll
- // AddMagnify // most probably similar to the SCI1.1 functions. We need a test case
- // DeleteMagnify
- // EditText
- // DisposeTextBitmap
- // VibrateMouse - used in QFG4 floppy
- // PalCycle
- // ObjectIntersect - used in QFG4 floppy
- // MakeSaveCatName - used in the Save/Load dialog of GK1CD (SRDialog, script 64990)
- // MakeSaveFileName - used in the Save/Load dialog of GK1CD (SRDialog, script 64990)
+
+ // SetScroll - called by script 64909, Styler::doit()
+ // PalCycle - called by Game::newRoom. Related to RemapColors.
+ // VibrateMouse - used in QFG4
+
+ // SCI2 Empty functions
+
+ // Debug function used to track resources
+ { MAP_EMPTY(ResourceTrack), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+
+ // SCI2 functions that are used in the original save/load menus. Marked as dummy, so
+ // that the engine errors out on purpose. TODO: Implement once the original save/load
+ // menus are implemented.
+
+ // Creates the name of the save catalogue/directory to save into.
+ // TODO: Implement once the original save/load menus are implemented.
+ { MAP_DUMMY(MakeSaveCatName), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+
+ // Creates the name of the save file to save into
+ // TODO: Implement once the original save/load menus are implemented.
+ { MAP_DUMMY(MakeSaveFileName), SIG_EVERYWHERE, "(.*)", NULL, NULL },
// Unused / debug SCI2 unused functions, always mapped to kDummy
+
+ // AddMagnify/DeleteMagnify are both called by script 64979 (the Magnifier
+ // object) in GK1 only. There is also an associated empty magnifier view
+ // (view 1), however, it doesn't seem to be used anywhere, as all the
+ // magnifier closeups (e.g. in scene 470) are normal views. Thus, these
+ // are marked as dummy, so if they're ever used the engine will error out.
+ { MAP_DUMMY(AddMagnify), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+ { MAP_DUMMY(DeleteMagnify), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+ { MAP_DUMMY(RepaintPlane), SIG_EVERYWHERE, "o", NULL, NULL },
{ MAP_DUMMY(InspectObject), SIG_EVERYWHERE, "(.*)", NULL, NULL },
// Profiler (same as SCI0-SCI1.1)
// Record (same as SCI0-SCI1.1)
@@ -590,7 +612,6 @@ static SciKernelMapEntry s_kernelMap[] = {
// SCI2.1 unmapped functions - TODO!
- // Bitmap
// MovePlaneItems - used by SQ6 to scroll through the inventory via the up/down buttons
// AddLine - used by Torin's Passage to highlight the chapter buttons
// DeleteLine - used by Torin's Passage to delete the highlight from the chapter buttons
@@ -599,6 +620,9 @@ static SciKernelMapEntry s_kernelMap[] = {
// (inclusive) are set to 0
// MorphOn - used by SQ6, script 900, the datacorder reprogramming puzzle (from room 270)
// SetHotRectangles - used by Phantasmagoria 1
+
+ // SCI3 Kernel Functions
+ { MAP_CALL(PlayDuck), SIG_EVERYWHERE, "(.*)", NULL, NULL },
#endif
{ NULL, NULL, SIG_EVERYWHERE, NULL, NULL, NULL }
@@ -771,7 +795,7 @@ static const char *const sci2_default_knames[] = {
/*0x0d*/ "CelWide",
/*0x0e*/ "CelHigh",
/*0x0f*/ "GetHighPlanePri",
- /*0x10*/ "GetHighItemPri",
+ /*0x10*/ "GetHighItemPri", // unused function
/*0x11*/ "ShakeScreen",
/*0x12*/ "OnMe",
/*0x13*/ "ShowMovie",
@@ -783,9 +807,9 @@ static const char *const sci2_default_knames[] = {
/*0x19*/ "AddPlane",
/*0x1a*/ "DeletePlane",
/*0x1b*/ "UpdatePlane",
- /*0x1c*/ "RepaintPlane",
+ /*0x1c*/ "RepaintPlane", // unused function
/*0x1d*/ "SetShowStyle",
- /*0x1e*/ "ShowStylePercent",
+ /*0x1e*/ "ShowStylePercent", // unused function
/*0x1f*/ "SetScroll",
/*0x20*/ "AddMagnify",
/*0x21*/ "DeleteMagnify",
@@ -799,7 +823,7 @@ static const char *const sci2_default_knames[] = {
/*0x29*/ "Dummy",
/*0x2a*/ "SetQuitStr",
/*0x2b*/ "EditText",
- /*0x2c*/ "InputText",
+ /*0x2c*/ "InputText", // unused function
/*0x2d*/ "CreateTextBitmap",
/*0x2e*/ "DisposeTextBitmap",
/*0x2f*/ "GetEvent",
@@ -944,8 +968,8 @@ static const char *const sci21_default_knames[] = {
/*0x15*/ "NumLoops",
/*0x16*/ "NumCels",
/*0x17*/ "IsOnMe",
- /*0x18*/ "AddMagnify",
- /*0x19*/ "DeleteMagnify",
+ /*0x18*/ "AddMagnify", // dummy in SCI3
+ /*0x19*/ "DeleteMagnify", // dummy in SCI3
/*0x1a*/ "CelRect",
/*0x1b*/ "BaseLineSpan",
/*0x1c*/ "CelWide",
@@ -965,10 +989,10 @@ static const char *const sci21_default_knames[] = {
/*0x2a*/ "UpdatePlane",
/*0x2b*/ "RepaintPlane",
/*0x2c*/ "GetHighPlanePri",
- /*0x2d*/ "GetHighItemPri",
+ /*0x2d*/ "GetHighItemPri", // unused function
/*0x2e*/ "SetShowStyle",
- /*0x2f*/ "ShowStylePercent",
- /*0x30*/ "SetScroll",
+ /*0x2f*/ "ShowStylePercent", // unused function
+ /*0x30*/ "SetScroll", // dummy in SCI3
/*0x31*/ "MovePlaneItems",
/*0x32*/ "ShakeScreen",
/*0x33*/ "Dummy",
@@ -977,7 +1001,7 @@ static const char *const sci21_default_knames[] = {
/*0x36*/ "Dummy",
/*0x37*/ "IsHiRes",
/*0x38*/ "SetVideoMode",
- /*0x39*/ "ShowMovie",
+ /*0x39*/ "ShowMovie", // dummy in SCI3
/*0x3a*/ "Robot",
/*0x3b*/ "CreateTextBitmap",
/*0x3c*/ "Random",
@@ -995,7 +1019,7 @@ static const char *const sci21_default_knames[] = {
/*0x48*/ "Message",
/*0x49*/ "Font",
/*0x4a*/ "EditText",
- /*0x4b*/ "InputText",
+ /*0x4b*/ "InputText", // unused function
/*0x4c*/ "ScrollWindow", // Dummy in SCI3
/*0x4d*/ "Dummy",
/*0x4e*/ "Dummy",
@@ -1020,9 +1044,9 @@ static const char *const sci21_default_knames[] = {
/*0x61*/ "InitBresen",
/*0x62*/ "DoBresen",
/*0x63*/ "SetJump",
- /*0x64*/ "AvoidPath",
+ /*0x64*/ "AvoidPath", // dummy in SCI3
/*0x65*/ "InPolygon",
- /*0x66*/ "MergePoly",
+ /*0x66*/ "MergePoly", // dummy in SCI3
/*0x67*/ "ObjectIntersect",
/*0x68*/ "Dummy",
/*0x69*/ "MemoryInfo",
@@ -1051,7 +1075,7 @@ static const char *const sci21_default_knames[] = {
/*0x80*/ "Dummy",
/*0x81*/ "Dummy", // called when changing rooms in most SCI2.1 games (e.g. KQ7, GK2, MUMG deluxe, Phant1)
/*0x82*/ "Dummy",
- /*0x83*/ "PrintDebug", // debug function, used by Shivers 2 (demo and full)
+ /*0x83*/ "PrintDebug", // debug function, used by Shivers (demo and full)
/*0x84*/ "Dummy",
/*0x85*/ "Dummy",
/*0x86*/ "Dummy",
@@ -1086,7 +1110,9 @@ static const char *const sci21_default_knames[] = {
#endif
-opcode_format g_opcode_formats[128][4] = {
+// Base set of opcode formats. They're copied and adjusted slightly in
+// script_adjust_opcode_format depending on SCI version.
+static const opcode_format g_base_opcode_formats[128][4] = {
/*00*/
{Script_None}, {Script_None}, {Script_None}, {Script_None},
/*04*/
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 0c73125bdb..ce903626e7 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -22,6 +22,7 @@
#include "common/archive.h"
#include "common/config-manager.h"
+#include "common/debug-channels.h"
#include "common/file.h"
#include "common/str.h"
#include "common/savefile.h"
@@ -52,9 +53,10 @@ struct SavegameDesc {
* arbitrary data files, simply because many of our target platforms do not
* support this. The only files one can create are savestates. But SCI has an
* opcode to create and write to seemingly 'arbitrary' files. This is mainly
- * used in LSL3 for LARRY3.DRV (which is a game data file, not a driver) and
- * in LSL5 for MEMORY.DRV (which is again a game data file and contains the
- * game's password).
+ * used in LSL3 for LARRY3.DRV (which is a game data file, not a driver, used
+ * for persisting the results of the "age quiz" across restarts) and in LSL5
+ * for MEMORY.DRV (which is again a game data file and contains the game's
+ * password, XOR encrypted).
* To implement that opcode, we combine the SaveFileManager with regular file
* code, similarly to how the SCUMM HE engine does it.
*
@@ -115,20 +117,6 @@ reg_t file_open(EngineState *s, const Common::String &filename, int mode, bool u
if (!inFile)
inFile = SearchMan.createReadStreamForMember(englishName);
- // Special case for LSL3: It tries to create a new dummy file,
- // LARRY3.DRV. Apparently, if the file doesn't exist here, it should be
- // created. The game scripts then go ahead and fill its contents with
- // data. It seems to be a similar case as the dummy MEMORY.DRV file in
- // LSL5, but LSL5 creates the file if it can't find it with a separate
- // call to file_open().
- if (!inFile && englishName == "LARRY3.DRV") {
- outFile = saveFileMan->openForSaving(wrappedName);
- outFile->finalize();
- delete outFile;
- outFile = 0;
- inFile = SearchMan.createReadStreamForMember(wrappedName);
- }
-
if (!inFile)
debugC(kDebugLevelFile, " -> file_open(_K_FILE_MODE_OPEN_OR_FAIL): failed to open file '%s'", englishName.c_str());
} else if (mode == _K_FILE_MODE_CREATE) {
@@ -365,9 +353,12 @@ reg_t kDeviceInfo(EngineState *s, int argc, reg_t *argv) {
reg_t kGetSaveDir(EngineState *s, int argc, reg_t *argv) {
#ifdef ENABLE_SCI32
- // TODO: SCI32 uses a parameter here.
- if (argc > 0)
- warning("kGetSaveDir called with %d parameter(s): %04x:%04x", argc, PRINT_REG(argv[0]));
+ // SCI32 uses a parameter here. It is used to modify a string, stored in a
+ // global variable, so that game scripts store the save directory. We
+ // don't really set a save game directory, thus not setting the string to
+ // anything is the correct thing to do here.
+ //if (argc > 0)
+ // warning("kGetSaveDir called with %d parameter(s): %04x:%04x", argc, PRINT_REG(argv[0]));
#endif
return s->_segMan->getSaveDirPtr();
}
@@ -1057,6 +1048,18 @@ reg_t kFileIOExists(EngineState *s, int argc, reg_t *argv) {
exists = !saveFileMan->listSavefiles(wrappedName).empty();
}
+ // SCI2+ debug mode
+ if (DebugMan.isDebugChannelEnabled(kDebugLevelDebugMode)) {
+ if (!exists && name == "1.scr") // PQ4
+ exists = true;
+ if (!exists && name == "18.scr") // QFG4
+ exists = true;
+ if (!exists && name == "99.scr") // GK1, KQ7
+ exists = true;
+ if (!exists && name == "classes") // GK2, SQ6, LSL7
+ exists = true;
+ }
+
// Special case for non-English versions of LSL5: The English version of
// LSL5 calls kFileIO(), case K_FILEIO_OPEN for reading to check if
// memory.drv exists (which is where the game's password is stored). If
@@ -1164,8 +1167,17 @@ reg_t kSave(EngineState *s, int argc, reg_t *argv) {
return kRestoreGame(s, argc - 1,argv + 1);
case 2:
return kGetSaveDir(s, argc - 1, argv + 1);
+ case 3:
+ return kCheckSaveGame(s, argc - 1, argv + 1);
case 5:
return kGetSaveFiles(s, argc - 1, argv + 1);
+ case 6:
+ // This is used in Shivers to delete saved games, however it
+ // always passes the same file name (SHIVER), so it doesn't
+ // actually delete anything...
+ // TODO: Check why this happens
+ // argv[1] is a string (most likely the save game directory)
+ return kFileIOUnlink(s, argc - 2, argv + 2);
case 8:
// TODO
// This is a timer callback, with 1 parameter: the timer object
@@ -1176,10 +1188,9 @@ reg_t kSave(EngineState *s, int argc, reg_t *argv) {
// This function has to return something other than 0 to proceed
return s->r_acc;
default:
- warning("Unknown/unhandled kSave subop %d", argv[0].toUint16());
+ kStub(s, argc, argv);
+ return NULL_REG;
}
-
- return NULL_REG;
}
#endif
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 9f309aeab7..76c6778f0a 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -39,7 +39,7 @@
#include "sci/graphics/animate.h"
#include "sci/graphics/cache.h"
#include "sci/graphics/compare.h"
-#include "sci/graphics/controls.h"
+#include "sci/graphics/controls16.h"
#include "sci/graphics/cursor.h"
#include "sci/graphics/palette.h"
#include "sci/graphics/paint16.h"
@@ -49,9 +49,10 @@
#include "sci/graphics/text16.h"
#include "sci/graphics/view.h"
#ifdef ENABLE_SCI32
+#include "sci/graphics/controls32.h"
+#include "sci/graphics/font.h" // TODO: remove once kBitmap is moved in a separate class
#include "sci/graphics/text32.h"
#include "sci/graphics/frameout.h"
-#include "sci/video/robot_decoder.h"
#endif
namespace Sci {
@@ -354,11 +355,9 @@ reg_t kTextSize(EngineState *s, int argc, reg_t *argv) {
textWidth = dest[3].toUint16(); textHeight = dest[2].toUint16();
#ifdef ENABLE_SCI32
- if (!g_sci->_gfxText16) {
- // TODO: Implement this
- textWidth = 0; textHeight = 0;
- warning("TODO: implement kTextSize for SCI32");
- } else
+ if (g_sci->_gfxText32)
+ g_sci->_gfxText32->kernelTextSize(g_sci->strSplit(text.c_str(), sep).c_str(), font_nr, maxwidth, &textWidth, &textHeight);
+ else
#endif
g_sci->_gfxText16->kernelTextSize(g_sci->strSplit(text.c_str(), sep).c_str(), font_nr, maxwidth, &textWidth, &textHeight);
@@ -381,8 +380,13 @@ reg_t kTextSize(EngineState *s, int argc, reg_t *argv) {
}
debugC(kDebugLevelStrings, "GetTextSize '%s' -> %dx%d", text.c_str(), textWidth, textHeight);
- dest[2] = make_reg(0, textHeight);
- dest[3] = make_reg(0, textWidth);
+ if (getSciVersion() <= SCI_VERSION_1_1) {
+ dest[2] = make_reg(0, textHeight);
+ dest[3] = make_reg(0, textWidth);
+ } else {
+ dest[2] = make_reg(0, textWidth);
+ dest[3] = make_reg(0, textHeight);
+ }
return s->r_acc;
}
@@ -807,13 +811,13 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) {
switch (type) {
case SCI_CONTROLS_TYPE_BUTTON:
debugC(kDebugLevelGraphics, "drawing button %04x:%04x to %d,%d", PRINT_REG(controlObject), x, y);
- g_sci->_gfxControls->kernelDrawButton(rect, controlObject, g_sci->strSplit(text.c_str(), NULL).c_str(), fontId, style, hilite);
+ g_sci->_gfxControls16->kernelDrawButton(rect, controlObject, g_sci->strSplit(text.c_str(), NULL).c_str(), fontId, style, hilite);
return;
case SCI_CONTROLS_TYPE_TEXT:
alignment = readSelectorValue(s->_segMan, controlObject, SELECTOR(mode));
debugC(kDebugLevelGraphics, "drawing text %04x:%04x ('%s') to %d,%d, mode=%d", PRINT_REG(controlObject), text.c_str(), x, y, alignment);
- g_sci->_gfxControls->kernelDrawText(rect, controlObject, g_sci->strSplit(text.c_str()).c_str(), fontId, alignment, style, hilite);
+ g_sci->_gfxControls16->kernelDrawText(rect, controlObject, g_sci->strSplit(text.c_str()).c_str(), fontId, alignment, style, hilite);
s->r_acc = g_sci->_gfxText16->allocAndFillReferenceRectArray();
return;
@@ -827,7 +831,7 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) {
writeSelectorValue(s->_segMan, controlObject, SELECTOR(cursor), cursorPos);
}
debugC(kDebugLevelGraphics, "drawing edit control %04x:%04x (text %04x:%04x, '%s') to %d,%d", PRINT_REG(controlObject), PRINT_REG(textReference), text.c_str(), x, y);
- g_sci->_gfxControls->kernelDrawTextEdit(rect, controlObject, g_sci->strSplit(text.c_str(), NULL).c_str(), fontId, mode, style, cursorPos, maxChars, hilite);
+ g_sci->_gfxControls16->kernelDrawTextEdit(rect, controlObject, g_sci->strSplit(text.c_str(), NULL).c_str(), fontId, mode, style, cursorPos, maxChars, hilite);
return;
case SCI_CONTROLS_TYPE_ICON:
@@ -844,7 +848,7 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) {
priority = -1;
}
debugC(kDebugLevelGraphics, "drawing icon control %04x:%04x to %d,%d", PRINT_REG(controlObject), x, y - 1);
- g_sci->_gfxControls->kernelDrawIcon(rect, controlObject, viewId, loopNo, celNo, priority, style, hilite);
+ g_sci->_gfxControls16->kernelDrawIcon(rect, controlObject, viewId, loopNo, celNo, priority, style, hilite);
return;
case SCI_CONTROLS_TYPE_LIST:
@@ -892,7 +896,7 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) {
}
debugC(kDebugLevelGraphics, "drawing list control %04x:%04x to %d,%d, diff %d", PRINT_REG(controlObject), x, y, SCI_MAX_SAVENAME_LENGTH);
- g_sci->_gfxControls->kernelDrawList(rect, controlObject, maxChars, listCount, listEntries, fontId, style, upperPos, cursorPos, isAlias, hilite);
+ g_sci->_gfxControls16->kernelDrawList(rect, controlObject, maxChars, listCount, listEntries, fontId, style, upperPos, cursorPos, isAlias, hilite);
free(listEntries);
delete[] listStrings;
return;
@@ -972,7 +976,10 @@ reg_t kEditControl(EngineState *s, int argc, reg_t *argv) {
switch (controlType) {
case SCI_CONTROLS_TYPE_TEXTEDIT:
// Only process textedit controls in here
- g_sci->_gfxControls->kernelTexteditChange(controlObject, eventObject);
+ g_sci->_gfxControls16->kernelTexteditChange(controlObject, eventObject);
+ break;
+ default:
+ break;
}
}
return s->r_acc;
@@ -1285,7 +1292,10 @@ reg_t kCantBeHere32(EngineState *s, int argc, reg_t *argv) {
}
reg_t kAddScreenItem(EngineState *s, int argc, reg_t *argv) {
- g_sci->_gfxFrameout->kernelAddScreenItem(argv[0]);
+ if (g_sci->_gfxFrameout->findScreenItem(argv[0]) == NULL)
+ g_sci->_gfxFrameout->kernelAddScreenItem(argv[0]);
+ else
+ g_sci->_gfxFrameout->kernelUpdateScreenItem(argv[0]);
return s->r_acc;
}
@@ -1314,11 +1324,6 @@ reg_t kUpdatePlane(EngineState *s, int argc, reg_t *argv) {
return s->r_acc;
}
-reg_t kRepaintPlane(EngineState *s, int argc, reg_t *argv) {
- g_sci->_gfxFrameout->kernelRepaintPlane(argv[0]);
- return s->r_acc;
-}
-
reg_t kAddPicAt(EngineState *s, int argc, reg_t *argv) {
reg_t planeObj = argv[0];
GuiResourceId pictureId = argv[1].toUint16();
@@ -1338,30 +1343,23 @@ reg_t kFrameOut(EngineState *s, int argc, reg_t *argv) {
return NULL_REG;
}
+reg_t kObjectIntersect(EngineState *s, int argc, reg_t *argv) {
+ Common::Rect objRect1 = g_sci->_gfxCompare->getNSRect(argv[0]);
+ Common::Rect objRect2 = g_sci->_gfxCompare->getNSRect(argv[1]);
+ return make_reg(0, objRect1.intersects(objRect2));
+}
+
// Tests if the coordinate is on the passed object
reg_t kIsOnMe(EngineState *s, int argc, reg_t *argv) {
uint16 x = argv[0].toUint16();
uint16 y = argv[1].toUint16();
reg_t targetObject = argv[2];
uint16 illegalBits = argv[3].offset;
- Common::Rect nsRect;
+ Common::Rect nsRect = g_sci->_gfxCompare->getNSRect(targetObject, true);
// we assume that x, y are local coordinates
- // Get the bounding rectangle of the object
- nsRect.left = readSelectorValue(s->_segMan, targetObject, SELECTOR(nsLeft));
- nsRect.top = readSelectorValue(s->_segMan, targetObject, SELECTOR(nsTop));
- nsRect.right = readSelectorValue(s->_segMan, targetObject, SELECTOR(nsRight));
- nsRect.bottom = readSelectorValue(s->_segMan, targetObject, SELECTOR(nsBottom));
-
- // nsRect top/left may be negative, adjust accordingly
- Common::Rect checkRect = nsRect;
- if (checkRect.top < 0)
- checkRect.top = 0;
- if (checkRect.left < 0)
- checkRect.left = 0;
-
- bool contained = checkRect.contains(x, y);
+ bool contained = nsRect.contains(x, y);
if (contained && illegalBits) {
// If illegalbits are set, we check the color of the pixel that got clicked on
// for now, we return false if the pixel is transparent
@@ -1387,70 +1385,29 @@ reg_t kCreateTextBitmap(EngineState *s, int argc, reg_t *argv) {
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;
+ uint16 maxWidth = argv[1].toUint16(); // nsRight - nsLeft + 1
+ uint16 maxHeight = argv[2].toUint16(); // nsBottom - nsTop + 1
+ return g_sci->_gfxText32->createTextBitmap(object, maxWidth, maxHeight);
}
case 1: {
if (argc != 2) {
- warning("kCreateTextBitmap(0): expected 2 arguments, got %i", argc);
+ warning("kCreateTextBitmap(1): 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)));
debugC(kDebugLevelStrings, "kCreateTextBitmap case 1 (%04x:%04x)", PRINT_REG(argv[1]));
debugC(kDebugLevelStrings, "%s", text.c_str());
- g_sci->_gfxText32->createTextBitmap(object);
- break;
+ return g_sci->_gfxText32->createTextBitmap(object);
}
default:
warning("CreateTextBitmap(%d)", argv[0].toUint16());
+ return NULL_REG;
}
-
- return NULL_REG;
}
-reg_t kRobot(EngineState *s, int argc, reg_t *argv) {
-
- int16 subop = argv[0].toUint16();
-
- switch (subop) {
- case 0: { // init
- int id = argv[1].toUint16();
- reg_t obj = argv[2];
- int16 flag = argv[3].toSint16();
- int16 x = argv[4].toUint16();
- int16 y = argv[5].toUint16();
- warning("kRobot(init), id %d, obj %04x:%04x, flag %d, x=%d, y=%d", id, PRINT_REG(obj), flag, x, y);
- g_sci->_robotDecoder->load(id);
- g_sci->_robotDecoder->setPos(x, y);
- }
- break;
- case 1: // LSL6 hires (startup)
- // TODO
- return NULL_REG; // an integer is expected
- case 4: { // start - we don't really have a use for this one
- //int id = argv[1].toUint16();
- //warning("kRobot(start), id %d", id);
- }
- break;
- case 7: // unknown, called e.g. by Phantasmagoria
- warning("kRobot(%d)", subop);
- break;
- case 8: // sync
- if ((uint32)g_sci->_robotDecoder->getCurFrame() != g_sci->_robotDecoder->getFrameCount() - 1) {
- writeSelector(s->_segMan, argv[1], SELECTOR(signal), NULL_REG);
- } else {
- g_sci->_robotDecoder->close();
- // Signal the engine scripts that the video is done
- writeSelector(s->_segMan, argv[1], SELECTOR(signal), SIGNAL_REG);
- }
- break;
- default:
- warning("kRobot(%d)", subop);
- break;
- }
-
+reg_t kDisposeTextBitmap(EngineState *s, int argc, reg_t *argv) {
+ g_sci->_gfxText32->disposeTextBitmap(argv[0]);
return s->r_acc;
}
@@ -1484,22 +1441,30 @@ reg_t kWinHelp(EngineState *s, int argc, reg_t *argv) {
}
/**
- * Used to programmatically mass set properties of the target plane
+ * Used for scene transitions, replacing (but reusing parts of) the old
+ * transition code.
*/
reg_t kSetShowStyle(EngineState *s, int argc, reg_t *argv) {
- // TODO: This is all a stub/skeleton, thus we're invoking kStub() for now
- kStub(s, argc, argv);
-
// Can be called with 7 or 8 parameters
- // showStyle matches the style selector of the associated plane object
+ // The style defines which transition to perform. Related to the transition
+ // tables inside graphics/transitions.cpp
uint16 showStyle = argv[0].toUint16(); // 0 - 15
- reg_t planeObj = argv[1];
- //argv[2] // seconds
- //argv[3] // back
+ reg_t planeObj = argv[1]; // the affected plane
+ //argv[2] // seconds that the transition lasts
+ //argv[3] // back color to be used(?)
//int16 priority = argv[4].toSint16();
- //argv[5] // animate
+ //argv[5] // boolean, animate or not while the transition lasts
//argv[6] // refFrame
- //int16 unk7 = (argc >= 8) ? argv[7].toSint16() : 0; // divisions
+
+ // If the game has the pFadeArray selector, another parameter is used here,
+ // before the optional last parameter
+ /*bool hasFadeArray = g_sci->getKernel()->findSelector("pFadeArray") > 0;
+ if (hasFadeArray) {
+ // argv[7]
+ //int16 unk7 = (argc >= 9) ? argv[8].toSint16() : 0; // divisions (transition steps?)
+ } else {
+ //int16 unk7 = (argc >= 8) ? argv[7].toSint16() : 0; // divisions (transition steps?)
+ }*/
if (showStyle > 15) {
warning("kSetShowStyle: Illegal style %d for plane %04x:%04x", showStyle, PRINT_REG(planeObj));
@@ -1508,36 +1473,36 @@ reg_t kSetShowStyle(EngineState *s, int argc, reg_t *argv) {
// TODO: Check if the plane is in the list of planes to draw
- return s->r_acc;
-}
-
-reg_t kCelInfo(EngineState *s, int argc, reg_t *argv) {
// TODO: This is all a stub/skeleton, thus we're invoking kStub() for now
kStub(s, argc, argv);
- // Used by Shivers 1, room 23601
-
- // 6 arguments, all integers:
- // argv[0] - subop (0 - 4). It's constantly called with 4 in Shivers 1
- // argv[1] - view (used with view 23602 in Shivers 1)
- // argv[2] - loop
- // argv[3] - cel
- // argv[4] - unknown (row?)
- // argv[5] - unknown (column?)
-
- // Subops:
- // 0 - return the view
- // 1 - return the loop
- // 2, 3 - nop
- // 4 - returns some kind of hash (?) based on the view and the two last params
-
- // This seems to be a debug function, but it could be used to check if
- // the jigsaw pieces "stick" together (they currently don't, unless I'm missing
- // something)
-
return s->r_acc;
}
+reg_t kCelInfo(EngineState *s, int argc, reg_t *argv) {
+ // Used by Shivers 1, room 23601 to determine what blocks on the red door puzzle board
+ // are occupied by pieces already
+
+ switch (argv[0].toUint16()) { // subops 0 - 4
+ // 0 - return the view
+ // 1 - return the loop
+ // 2, 3 - nop
+ case 4: {
+ GuiResourceId viewId = argv[1].toSint16();
+ int16 loopNo = argv[2].toSint16();
+ int16 celNo = argv[3].toSint16();
+ int16 x = argv[4].toUint16();
+ int16 y = argv[5].toUint16();
+ byte color = g_sci->_gfxCache->kernelViewGetColorAtCoordinate(viewId, loopNo, celNo, x, y);
+ return make_reg(0, color);
+ }
+ default: {
+ kStub(s, argc, argv);
+ return s->r_acc;
+ }
+ }
+}
+
reg_t kScrollWindow(EngineState *s, int argc, reg_t *argv) {
// Used by Phantasmagoria 1 and SQ6. In SQ6, it is used for the messages
// shown in the scroll window at the bottom of the screen.
@@ -1670,6 +1635,11 @@ reg_t kFont(EngineState *s, int argc, reg_t *argv) {
return s->r_acc;
}
+// TODO: Eventually, all of the kBitmap operations should be put
+// in a separate class
+
+#define BITMAP_HEADER_SIZE 46
+
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.
@@ -1681,21 +1651,28 @@ reg_t kBitmap(EngineState *s, int argc, reg_t *argv) {
// 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
+ //uint16 skip = argv[3].toUint16();
+ uint16 back = argv[4].toUint16(); // usually equals skip
+ //uint16 width2 = (argc >= 6) ? argv[5].toUint16() : 0;
+ //uint16 height2 = (argc >= 7) ? argv[6].toUint16() : 0;
+ //uint16 transparentFlag = (argc >= 8) ? argv[7].toUint16() : 0;
+
+ // TODO: skip, width2, height2, transparentFlag
+ // (used for transparent bitmaps)
+ int entrySize = width * height + BITMAP_HEADER_SIZE;
+ reg_t memoryId = s->_segMan->allocateHunkEntry("Bitmap()", entrySize);
+ byte *memoryPtr = s->_segMan->getHunkPointer(memoryId);
+ memset(memoryPtr, 0, BITMAP_HEADER_SIZE); // zero out the bitmap header
+ memset(memoryPtr + BITMAP_HEADER_SIZE, back, width * height);
+ // Save totalWidth, totalHeight
+ // TODO: Save the whole bitmap header, like SSCI does
+ WRITE_LE_UINT16(memoryPtr, width);
+ WRITE_LE_UINT16(memoryPtr + 2, height);
+ return memoryId;
}
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 1: // dispose text bitmap surface
+ return kDisposeTextBitmap(s, argc - 1, argv + 1);
case 2: // dispose bitmap surface, with extra param
// 2 params, called e.g. from MenuItem::dispose in Torin's Passage,
// script 64893
@@ -1705,50 +1682,113 @@ reg_t kBitmap(EngineState *s, int argc, reg_t *argv) {
{
// 6 params, called e.g. from TiledBitmap::resize() in Torin's Passage,
// script 64869
- reg_t bitmapPtr = argv[1]; // obtained from kBitmap(0)
+ reg_t hunkId = 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 viewNum = 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);
+
+ byte *memoryPtr = s->_segMan->getHunkPointer(hunkId);
+ // Get totalWidth, totalHeight
+ uint16 totalWidth = READ_LE_UINT16(memoryPtr);
+ uint16 totalHeight = READ_LE_UINT16(memoryPtr + 2);
+ byte *bitmap = memoryPtr + BITMAP_HEADER_SIZE;
+
+ GfxView *view = g_sci->_gfxCache->getView(viewNum);
+ uint16 tileWidth = view->getWidth(loop, cel);
+ uint16 tileHeight = view->getHeight(loop, cel);
+ const byte *tileBitmap = view->getBitmap(loop, cel);
+ uint16 width = MIN<uint16>(totalWidth - x, tileWidth);
+ uint16 height = MIN<uint16>(totalHeight - y, tileHeight);
+
+ for (uint16 curY = 0; curY < height; curY++) {
+ for (uint16 curX = 0; curX < width; curX++) {
+ bitmap[(curY + y) * totalWidth + (curX + x)] = tileBitmap[curY * tileWidth + curX];
+ }
+ }
+
}
break;
- case 4: // process text
+ case 4: // add text to bitmap
{
// 13 params, called e.g. from TextButton::createBitmap() in Torin's Passage,
// script 64894
- reg_t bitmapPtr = argv[1]; // obtained from kBitmap(0)
+ reg_t hunkId = 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 textX = argv[3].toUint16();
+ uint16 textY = argv[4].toUint16();
+ //reg_t unk5 = argv[5];
+ //reg_t unk6 = argv[6];
+ //reg_t unk7 = argv[7]; // skip?
+ //reg_t unk8 = argv[8]; // back?
+ //reg_t unk9 = argv[9];
+ uint16 fontId = argv[10].toUint16();
+ //uint16 mode = argv[11].toUint16();
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());
+ //warning("kBitmap(4): bitmap ptr %04x:%04x, font %d, mode %d, dimmed %d - text: \"%s\"",
+ // PRINT_REG(bitmapPtr), font, mode, dimmed, text.c_str());
+ uint16 foreColor = 255; // TODO
+
+ byte *memoryPtr = s->_segMan->getHunkPointer(hunkId);
+ // Get totalWidth, totalHeight
+ uint16 totalWidth = READ_LE_UINT16(memoryPtr);
+ uint16 totalHeight = READ_LE_UINT16(memoryPtr + 2);
+ byte *bitmap = memoryPtr + BITMAP_HEADER_SIZE;
+
+ GfxFont *font = g_sci->_gfxCache->getFont(fontId);
+
+ int16 charCount = 0;
+ uint16 curX = textX, curY = textY;
+ const char *txt = text.c_str();
+
+ while (*txt) {
+ charCount = g_sci->_gfxText32->GetLongest(txt, totalWidth, font);
+ if (charCount == 0)
+ break;
+
+ for (int i = 0; i < charCount; i++) {
+ unsigned char curChar = txt[i];
+ font->drawToBuffer(curChar, curY, curX, foreColor, dimmed, bitmap, totalWidth, totalHeight);
+ curX += font->getCharWidth(curChar);
+ }
+
+ curX = textX;
+ curY += font->getHeight();
+ txt += charCount;
+ while (*txt == ' ')
+ txt++; // skip over breaking spaces
+ }
+
}
break;
- case 5:
+ case 5: // fill with color
{
// 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
+ reg_t hunkId = argv[1]; // obtained from kBitmap(0)
+ uint16 x = argv[2].toUint16();
+ uint16 y = argv[3].toUint16();
+ uint16 fillWidth = argv[4].toUint16(); // width - 1
+ uint16 fillHeight = 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);
+
+ byte *memoryPtr = s->_segMan->getHunkPointer(hunkId);
+ // Get totalWidth, totalHeight
+ uint16 totalWidth = READ_LE_UINT16(memoryPtr);
+ uint16 totalHeight = READ_LE_UINT16(memoryPtr + 2);
+ uint16 width = MIN<uint16>(totalWidth - x, fillWidth);
+ uint16 height = MIN<uint16>(totalHeight - y, fillHeight);
+ byte *bitmap = memoryPtr + BITMAP_HEADER_SIZE;
+
+ for (uint16 curY = 0; curY < height; curY++) {
+ for (uint16 curX = 0; curX < width; curX++) {
+ bitmap[(curY + y) * totalWidth + (curX + x)] = back;
+ }
+ }
+
}
break;
default:
@@ -1759,6 +1799,20 @@ reg_t kBitmap(EngineState *s, int argc, reg_t *argv) {
return s->r_acc;
}
+// Used for edit boxes in save/load dialogs. It's a rewritten version of kEditControl,
+// but it handles events on its own, using an internal loop, instead of using SCI
+// scripts for event management like kEditControl does. Called by script 64914,
+// DEdit::hilite().
+reg_t kEditText(EngineState *s, int argc, reg_t *argv) {
+ reg_t controlObject = argv[0];
+
+ if (!controlObject.isNull()) {
+ g_sci->_gfxControls32->kernelTexteditChange(controlObject);
+ }
+
+ return s->r_acc;
+}
+
#endif
} // End of namespace Sci
diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp
index 68469f5c9a..83e59c9c20 100644
--- a/engines/sci/engine/klists.cpp
+++ b/engines/sci/engine/klists.cpp
@@ -409,7 +409,7 @@ int sort_temp_cmp(const void *p1, const void *p2) {
const sort_temp_t *st1 = (const sort_temp_t *)p1;
const sort_temp_t *st2 = (const sort_temp_t *)p2;
- if (st1->order.segment < st1->order.segment || (st1->order.segment == st1->order.segment && st1->order.offset < st2->order.offset))
+ if (st1->order.segment < st2->order.segment || (st1->order.segment == st2->order.segment && st1->order.offset < st2->order.offset))
return -1;
if (st1->order.segment > st2->order.segment || (st1->order.segment == st2->order.segment && st1->order.offset > st2->order.offset))
@@ -691,6 +691,16 @@ reg_t kArray(EngineState *s, int argc, reg_t *argv) {
}
case 2: { // At (return value at an index)
SciArray<reg_t> *array = s->_segMan->lookupArray(argv[1]);
+ if (g_sci->getGameId() == GID_PHANTASMAGORIA2) {
+ // HACK: Phantasmagoria 2 keeps trying to access past the end of an
+ // array when it starts. I'm assuming it's trying to see where the
+ // array ends, or tries to resize it. Adjust the array size
+ // accordingly, and return NULL for now.
+ if (array->getSize() == argv[2].toUint16()) {
+ array->setSize(argv[2].toUint16());
+ return NULL_REG;
+ }
+ }
return array->getValue(argv[2].toUint16());
}
case 3: { // Atput (put value at an index)
diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp
index 14f7db47a0..649a1428a0 100644
--- a/engines/sci/engine/kmovement.cpp
+++ b/engines/sci/engine/kmovement.cpp
@@ -505,116 +505,6 @@ reg_t kDoAvoider(EngineState *s, int argc, reg_t *argv) {
}
writeSelectorValue(segMan, avoider, SELECTOR(heading), avoiderHeading);
return s->r_acc;
-
-#if 0
- reg_t client, looper, mover;
- int angle;
- int dx, dy;
- int destx, desty;
-
- s->r_acc = SIGNAL_REG;
-
- if (!s->_segMan->isHeapObject(avoider)) {
- error("DoAvoider() where avoider %04x:%04x is not an object", PRINT_REG(avoider));
- return NULL_REG;
- }
-
- client = readSelector(segMan, avoider, SELECTOR(client));
-
- if (!s->_segMan->isHeapObject(client)) {
- error("DoAvoider() where client %04x:%04x is not an object", PRINT_REG(client));
- return NULL_REG;
- }
-
- looper = readSelector(segMan, client, SELECTOR(looper));
- mover = readSelector(segMan, client, SELECTOR(mover));
-
- if (!s->_segMan->isHeapObject(mover)) {
- if (mover.segment) {
- error("DoAvoider() where mover %04x:%04x is not an object", PRINT_REG(mover));
- }
- return s->r_acc;
- }
-
- destx = readSelectorValue(segMan, mover, SELECTOR(x));
- desty = readSelectorValue(segMan, mover, SELECTOR(y));
-
- debugC(kDebugLevelBresen, "Doing avoider %04x:%04x (dest=%d,%d)", PRINT_REG(avoider), destx, desty);
-
- invokeSelector(s, mover, SELECTOR(doit), argc, argv);
-
- mover = readSelector(segMan, client, SELECTOR(mover));
- if (!mover.segment) // Mover has been disposed?
- return s->r_acc; // Return gracefully.
-
- invokeSelector(s, client, SELECTOR(isBlocked), argc, argv);
-
- dx = destx - readSelectorValue(segMan, client, SELECTOR(x));
- dy = desty - readSelectorValue(segMan, client, SELECTOR(y));
- angle = getAngle(dx, dy);
-
- debugC(kDebugLevelBresen, "Movement (%d,%d), angle %d is %sblocked", dx, dy, angle, (s->r_acc.offset) ? " " : "not ");
-
- if (s->r_acc.offset) { // isBlocked() returned non-zero
- int rotation = (g_sci->getRNG().getRandomBit() == 1) ? 45 : (360 - 45); // Clockwise/counterclockwise
- int oldx = readSelectorValue(segMan, client, SELECTOR(x));
- int oldy = readSelectorValue(segMan, client, SELECTOR(y));
- int xstep = readSelectorValue(segMan, client, SELECTOR(xStep));
- int ystep = readSelectorValue(segMan, client, SELECTOR(yStep));
- int moves;
-
- debugC(kDebugLevelBresen, " avoider %04x:%04x", PRINT_REG(avoider));
-
- for (moves = 0; moves < 8; moves++) {
- int move_x = (int)(sin(angle * M_PI / 180.0) * (xstep));
- int move_y = (int)(-cos(angle * M_PI / 180.0) * (ystep));
-
- writeSelectorValue(segMan, client, SELECTOR(x), oldx + move_x);
- writeSelectorValue(segMan, client, SELECTOR(y), oldy + move_y);
-
- debugC(kDebugLevelBresen, "Pos (%d,%d): Trying angle %d; delta=(%d,%d)", oldx, oldy, angle, move_x, move_y);
-
- invokeSelector(s, client, SELECTOR(canBeHere), argc, argv);
-
- writeSelectorValue(segMan, client, SELECTOR(x), oldx);
- writeSelectorValue(segMan, client, SELECTOR(y), oldy);
-
- if (s->r_acc.offset) { // We can be here
- debugC(kDebugLevelBresen, "Success");
- writeSelectorValue(segMan, client, SELECTOR(heading), angle);
-
- return make_reg(0, angle);
- }
-
- angle += rotation;
-
- if (angle > 360)
- angle -= 360;
- }
-
- error("DoAvoider failed for avoider %04x:%04x", PRINT_REG(avoider));
- } else {
- int heading = readSelectorValue(segMan, client, SELECTOR(heading));
-
- if (heading == -1)
- return s->r_acc; // No change
-
- writeSelectorValue(segMan, client, SELECTOR(heading), angle);
-
- s->r_acc = make_reg(0, angle);
-
- if (looper.segment) {
- reg_t params[2] = { make_reg(0, angle), client };
- invokeSelector(s, looper, SELECTOR(doit), argc, argv, 2, params);
- return s->r_acc;
- } else {
- // No looper? Fall back to DirLoop
- kDirLoopWorker(client, (uint16)angle, s, argc, argv);
- }
- }
-
- return s->r_acc;
-#endif
}
} // End of namespace Sci
diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp
index 33bef58e52..c469f775f9 100644
--- a/engines/sci/engine/ksound.cpp
+++ b/engines/sci/engine/ksound.cpp
@@ -195,6 +195,13 @@ reg_t kDoAudio(EngineState *s, int argc, reg_t *argv) {
return make_reg(0, 1);
} else {
int16 language = argv[1].toSint16();
+
+ // athrxx: It seems from disasm that the original KQ5 FM-Towns loads a default language (Japanese) audio map at the beginning
+ // right after loading the video and audio drivers. The -1 language argument in here simply means that the original will stick
+ // with Japanese. Instead of doing that we switch to the language selected in the launcher.
+ if (g_sci->getPlatform() == Common::kPlatformFMTowns && language == -1)
+ language = (g_sci->getLanguage() == Common::JA_JPN) ? K_LANG_JAPANESE : K_LANG_ENGLISH;
+
debugC(kDebugLevelSound, "kDoAudio: set language to %d", language);
if (language != -1)
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index 1a9359bb26..5ae18c1367 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -697,13 +697,15 @@ reg_t kString(EngineState *s, int argc, reg_t *argv) {
case 6: { // Cpy
const char *string2 = 0;
uint32 string2Size = 0;
+ Common::String string;
if (argv[3].segment == s->_segMan->getStringSegmentId()) {
- SciString *string = s->_segMan->lookupString(argv[3]);
- string2 = string->getRawData();
- string2Size = string->getSize();
+ SciString *sstr;
+ sstr = s->_segMan->lookupString(argv[3]);
+ string2 = sstr->getRawData();
+ string2Size = sstr->getSize();
} else {
- Common::String string = s->_segMan->getString(argv[3]);
+ string = s->_segMan->getString(argv[3]);
string2 = string.c_str();
string2Size = string.size() + 1;
}
diff --git a/engines/sci/engine/kvideo.cpp b/engines/sci/engine/kvideo.cpp
index 6d810d516c..c9cf652013 100644
--- a/engines/sci/engine/kvideo.cpp
+++ b/engines/sci/engine/kvideo.cpp
@@ -21,6 +21,7 @@
*/
#include "engines/util.h"
+#include "sci/engine/kernel.h"
#include "sci/engine/state.h"
#include "sci/graphics/helpers.h"
#include "sci/graphics/cursor.h"
@@ -39,6 +40,7 @@
#include "sci/video/seq_decoder.h"
#ifdef ENABLE_SCI32
#include "video/coktel_decoder.h"
+#include "sci/video/robot_decoder.h"
#endif
namespace Sci {
@@ -230,6 +232,49 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {
#ifdef ENABLE_SCI32
+reg_t kRobot(EngineState *s, int argc, reg_t *argv) {
+ int16 subop = argv[0].toUint16();
+
+ switch (subop) {
+ case 0: { // init
+ int id = argv[1].toUint16();
+ reg_t obj = argv[2];
+ int16 flag = argv[3].toSint16();
+ int16 x = argv[4].toUint16();
+ int16 y = argv[5].toUint16();
+ warning("kRobot(init), id %d, obj %04x:%04x, flag %d, x=%d, y=%d", id, PRINT_REG(obj), flag, x, y);
+ g_sci->_robotDecoder->load(id);
+ g_sci->_robotDecoder->setPos(x, y);
+ }
+ break;
+ case 1: // LSL6 hires (startup)
+ // TODO
+ return NULL_REG; // an integer is expected
+ case 4: { // start - we don't really have a use for this one
+ //int id = argv[1].toUint16();
+ //warning("kRobot(start), id %d", id);
+ }
+ break;
+ case 7: // unknown, called e.g. by Phantasmagoria
+ warning("kRobot(%d)", subop);
+ break;
+ case 8: // sync
+ if ((uint32)g_sci->_robotDecoder->getCurFrame() != g_sci->_robotDecoder->getFrameCount() - 1) {
+ writeSelector(s->_segMan, argv[1], SELECTOR(signal), NULL_REG);
+ } else {
+ g_sci->_robotDecoder->close();
+ // Signal the engine scripts that the video is done
+ writeSelector(s->_segMan, argv[1], SELECTOR(signal), SIGNAL_REG);
+ }
+ break;
+ default:
+ warning("kRobot(%d)", subop);
+ break;
+ }
+
+ return s->r_acc;
+}
+
reg_t kPlayVMD(EngineState *s, int argc, reg_t *argv) {
uint16 operation = argv[0].toUint16();
Video::VideoDecoder *videoDecoder = 0;
@@ -331,6 +376,55 @@ reg_t kPlayVMD(EngineState *s, int argc, reg_t *argv) {
return s->r_acc;
}
+reg_t kPlayDuck(EngineState *s, int argc, reg_t *argv) {
+ uint16 operation = argv[0].toUint16();
+ Video::VideoDecoder *videoDecoder = 0;
+ bool reshowCursor = g_sci->_gfxCursor->isVisible();
+
+ switch (operation) {
+ case 1: // Play
+ // 6 params
+ s->_videoState.reset();
+ s->_videoState.fileName = Common::String::format("%d.duk", argv[1].toUint16());
+
+ videoDecoder = new Video::AviDecoder(g_system->getMixer());
+
+ if (!videoDecoder->loadFile(s->_videoState.fileName)) {
+ warning("Could not open Duck %s", s->_videoState.fileName.c_str());
+ break;
+ }
+
+ if (reshowCursor)
+ g_sci->_gfxCursor->kernelHide();
+
+ {
+ // Duck videos are 16bpp, so we need to change the active pixel format
+ int oldWidth = g_system->getWidth();
+ int oldHeight = g_system->getHeight();
+ Common::List<Graphics::PixelFormat> formats;
+ formats.push_back(videoDecoder->getPixelFormat());
+ initGraphics(640, 480, true, formats);
+
+ if (g_system->getScreenFormat().bytesPerPixel != videoDecoder->getPixelFormat().bytesPerPixel)
+ error("Could not switch screen format for the duck video");
+
+ playVideo(videoDecoder, s->_videoState);
+
+ // Switch back to 8bpp
+ initGraphics(oldWidth, oldHeight, oldWidth > 320);
+ }
+
+ if (reshowCursor)
+ g_sci->_gfxCursor->kernelShow();
+ break;
+ default:
+ kStub(s, argc, argv);
+ break;
+ }
+
+ return s->r_acc;
+}
+
#endif
} // End of namespace Sci
diff --git a/engines/sci/engine/object.cpp b/engines/sci/engine/object.cpp
index a1854a2723..78e216cdb5 100644
--- a/engines/sci/engine/object.cpp
+++ b/engines/sci/engine/object.cpp
@@ -202,9 +202,10 @@ bool Object::initBaseObject(SegManager *segMan, reg_t addr, bool doInitSuperClas
name = "<invalid name>";
}
- warning("Object %04x:%04x (name %s, script %d) varnum doesn't "
- "match baseObj's: obj %d, base %d", PRINT_REG(_pos),
- name, objScript, originalVarCount, baseObj->getVarCount());
+ debugC(kDebugLevelVM, "Object %04x:%04x (name %s, script %d) "
+ "varnum doesn't match baseObj's: obj %d, base %d",
+ PRINT_REG(_pos), name, objScript,
+ originalVarCount, baseObj->getVarCount());
#if 0
// We enumerate the methods selectors which could be hidden here
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index c30518ab42..f1c7133d01 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -203,7 +203,8 @@ void SegManager::saveLoadWithSerializer(Common::Serializer &s) {
// Now, load the script itself
scr->load(g_sci->getResMan());
- for (ObjMap::iterator it = scr->_objects.begin(); it != scr->_objects.end(); ++it)
+ ObjMap objects = scr->getObjectMap();
+ for (ObjMap::iterator it = objects.begin(); it != objects.end(); ++it)
it->_value.syncBaseObject(scr->getBuf(it->_value.getPos().offset));
}
@@ -226,9 +227,10 @@ void SegManager::saveLoadWithSerializer(Common::Serializer &s) {
continue;
Script *scr = (Script *)_heap[i];
- scr->_localsBlock = (scr->_localsSegment == 0) ? NULL : (LocalVariables *)(_heap[scr->_localsSegment]);
+ scr->syncLocalsBlock(this);
- for (ObjMap::iterator it = scr->_objects.begin(); it != scr->_objects.end(); ++it) {
+ ObjMap objects = scr->getObjectMap();
+ for (ObjMap::iterator it = objects.begin(); it != objects.end(); ++it) {
reg_t addr = it->_value.getPos();
Object *obj = scr->scriptObjInit(addr, false);
@@ -237,7 +239,7 @@ void SegManager::saveLoadWithSerializer(Common::Serializer &s) {
// TODO/FIXME: This should not be happening at all. It might indicate a possible issue
// with the garbage collector. It happens for example in LSL5 (German, perhaps English too).
warning("Failed to locate base object for object at %04X:%04X; skipping", PRINT_REG(addr));
- scr->_objects.erase(addr.toUint16());
+ objects.erase(addr.toUint16());
}
}
}
@@ -545,8 +547,6 @@ void DataStack::saveLoadWithSerializer(Common::Serializer &s) {
void SciMusic::saveLoadWithSerializer(Common::Serializer &s) {
// Sync song lib data. When loading, the actual song lib will be initialized
// afterwards in gamestate_restore()
- Common::StackLock lock(_mutex);
-
int songcount = 0;
byte masterVolume = soundGetMasterVolume();
byte reverb = _pMidiDrv->getReverb();
@@ -576,9 +576,12 @@ void SciMusic::saveLoadWithSerializer(Common::Serializer &s) {
songcount = _playList.size();
s.syncAsUint32LE(songcount);
- if (s.isLoading()) {
+ if (s.isLoading())
clearPlayList();
+ Common::StackLock lock(_mutex);
+
+ if (s.isLoading()) {
for (int i = 0; i < songcount; i++) {
MusicEntry *curSong = new MusicEntry();
curSong->saveLoadWithSerializer(s);
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp
index 01e1afe5ea..8b26969f4a 100644
--- a/engines/sci/engine/script.cpp
+++ b/engines/sci/engine/script.cpp
@@ -492,8 +492,29 @@ SegmentRef Script::dereference(reg_t pointer) {
return ret;
}
+LocalVariables *Script::allocLocalsSegment(SegManager *segMan) {
+ if (!getLocalsCount()) { // No locals
+ return NULL;
+ } else {
+ LocalVariables *locals;
+
+ if (_localsSegment) {
+ locals = (LocalVariables *)segMan->getSegment(_localsSegment, SEG_TYPE_LOCALS);
+ if (!locals || locals->getType() != SEG_TYPE_LOCALS || locals->script_id != getScriptNumber())
+ error("Invalid script locals segment while allocating locals");
+ } else
+ locals = (LocalVariables *)segMan->allocSegment(new LocalVariables(), &_localsSegment);
+
+ _localsBlock = locals;
+ locals->script_id = getScriptNumber();
+ locals->_locals.resize(getLocalsCount());
+
+ return locals;
+ }
+}
+
void Script::initializeLocals(SegManager *segMan) {
- LocalVariables *locals = segMan->allocLocalsSegment(this);
+ LocalVariables *locals = allocLocalsSegment(segMan);
if (locals) {
if (getSciVersion() > SCI_VERSION_0_EARLY) {
const byte *base = (const byte *)(_buf + getLocalsOffset());
@@ -508,6 +529,10 @@ void Script::initializeLocals(SegManager *segMan) {
}
}
+void Script::syncLocalsBlock(SegManager *segMan) {
+ _localsBlock = (_localsSegment == 0) ? NULL : (LocalVariables *)(segMan->getSegment(_localsSegment, SEG_TYPE_LOCALS));
+}
+
void Script::initializeClasses(SegManager *segMan) {
const byte *seeker = 0;
uint16 mult = 0;
diff --git a/engines/sci/engine/script.h b/engines/sci/engine/script.h
index ff061e0e36..1ebae3b7a8 100644
--- a/engines/sci/engine/script.h
+++ b/engines/sci/engine/script.h
@@ -62,23 +62,18 @@ private:
const uint16 *_exportTable; /**< Abs. offset of the export table or 0 if not present */
uint16 _numExports; /**< Number of entries in the exports table */
- const byte *_synonyms; /**< Synonyms block or 0 if not present*/
+ const byte *_synonyms; /**< Synonyms block or 0 if not present */
uint16 _numSynonyms; /**< Number of entries in the synonyms block */
int _localsOffset;
uint16 _localsCount;
bool _markedAsDeleted;
-
-public:
- /**
- * Table for objects, contains property variables.
- * Indexed by the TODO offset.
- */
- ObjMap _objects;
SegmentId _localsSegment; /**< The local variable segment */
LocalVariables *_localsBlock;
+ ObjMap _objects; /**< Table for objects, contains property variables */
+
public:
int getLocalsOffset() const { return _localsOffset; }
uint16 getLocalsCount() const { return _localsCount; }
@@ -89,6 +84,11 @@ public:
const byte *getBuf(uint offset = 0) const { return _buf + offset; }
int getScriptNumber() const { return _nr; }
+ SegmentId getLocalsSegment() const { return _localsSegment; }
+ reg_t *getLocalsBegin() { return _localsBlock ? _localsBlock->_locals.begin() : NULL; }
+ void syncLocalsBlock(SegManager *segMan);
+ ObjMap &getObjectMap() { return _objects; }
+ const ObjMap &getObjectMap() const { return _objects; }
public:
Script();
@@ -295,6 +295,8 @@ private:
* @param segmentId The script's segment id
*/
void initializeObjectsSci3(SegManager *segMan, SegmentId segmentId);
+
+ LocalVariables *allocLocalsSegment(SegManager *segMan);
};
} // End of namespace Sci
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index ad3f4fb788..554a6b6a2c 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -122,8 +122,8 @@ reg_t disassemble(EngineState *s, reg_t pos, bool printBWTag, bool printBytecode
#endif
i = 0;
- while (g_opcode_formats[opcode][i]) {
- switch (g_opcode_formats[opcode][i++]) {
+ while (g_sci->_opcode_formats[opcode][i]) {
+ switch (g_sci->_opcode_formats[opcode][i++]) {
case Script_Invalid:
warning("-Invalid operation-");
break;
@@ -296,7 +296,7 @@ bool isJumpOpcode(EngineState *s, reg_t pos, reg_t& jumpTarget) {
Script *script_entity = (Script *)mobj;
const byte *scr = script_entity->getBuf();
- int scr_size = script_entity->getBufSize();
+ int scr_size = script_entity->getScriptSize();
if (pos.offset >= scr_size)
return false;
@@ -310,7 +310,13 @@ bool isJumpOpcode(EngineState *s, reg_t pos, reg_t& jumpTarget) {
case op_bt:
case op_bnt:
case op_jmp:
- jumpTarget = pos + bytecount + opparams[0];
+ {
+ reg_t jmpTarget = pos + bytecount + opparams[0];
+ // QFG2 has invalid jumps outside the script buffer in script 260
+ if (jmpTarget.offset >= scr_size)
+ return false;
+ jumpTarget = jmpTarget;
+ }
return true;
default:
return false;
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index 1510af8508..04c61f7b7c 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -151,8 +151,8 @@ void SegManager::deallocate(SegmentId seg) {
if (mobj->getType() == SEG_TYPE_SCRIPT) {
Script *scr = (Script *)mobj;
_scriptSegMap.erase(scr->getScriptNumber());
- if (scr->_localsSegment)
- deallocate(scr->_localsSegment);
+ if (scr->getLocalsSegment())
+ deallocate(scr->getLocalsSegment());
}
delete mobj;
@@ -270,12 +270,13 @@ reg_t SegManager::findObjectByName(const Common::String &name, int index) {
if (mobj->getType() == SEG_TYPE_SCRIPT) {
// It's a script, scan all objects in it
const Script *scr = (const Script *)mobj;
- for (ObjMap::const_iterator it = scr->_objects.begin(); it != scr->_objects.end(); ++it) {
+ const ObjMap &objects = scr->getObjectMap();
+ for (ObjMap::const_iterator it = objects.begin(); it != objects.end(); ++it) {
objpos.offset = it->_value.getPos().offset;
if (name == getObjectName(objpos))
result.push_back(objpos);
}
- } else if (mobj->getType() == SEG_TYPE_CLONES) {
+ } else if (mobj->getType() == SEG_TYPE_CLONES) {
// It's clone table, scan all objects in it
const CloneTable *ct = (const CloneTable *)mobj;
for (uint idx = 0; idx < ct->_table.size(); ++idx) {
@@ -341,29 +342,6 @@ SegmentId SegManager::getScriptSegment(int script_nr, ScriptLoadType load) {
return segment;
}
-LocalVariables *SegManager::allocLocalsSegment(Script *scr) {
- if (!scr->getLocalsCount()) { // No locals
- scr->_localsSegment = 0;
- scr->_localsBlock = NULL;
- return NULL;
- } else {
- LocalVariables *locals;
-
- if (scr->_localsSegment) {
- locals = (LocalVariables *)_heap[scr->_localsSegment];
- if (!locals || locals->getType() != SEG_TYPE_LOCALS || locals->script_id != scr->getScriptNumber())
- error("Invalid script locals segment while allocating locals");
- } else
- locals = (LocalVariables *)allocSegment(new LocalVariables(), &scr->_localsSegment);
-
- scr->_localsBlock = locals;
- locals->script_id = scr->getScriptNumber();
- locals->_locals.resize(scr->getLocalsCount());
-
- return locals;
- }
-}
-
DataStack *SegManager::allocateStack(int size, SegmentId *segid) {
SegmentObj *mobj = allocSegment(new DataStack(), segid);
DataStack *retval = (DataStack *)mobj;
diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h
index ab5aeacabf..62e711e686 100644
--- a/engines/sci/engine/seg_manager.h
+++ b/engines/sci/engine/seg_manager.h
@@ -463,8 +463,10 @@ private:
SegmentId _stringSegId;
#endif
-private:
+public:
SegmentObj *allocSegment(SegmentObj *mem, SegmentId *segid);
+
+private:
void deallocate(SegmentId seg);
void createClassTable();
@@ -477,9 +479,6 @@ private:
* 'seg' is a valid segment
*/
bool check(SegmentId seg);
-
-public:
- LocalVariables *allocLocalsSegment(Script *scr);
};
} // End of namespace Sci
diff --git a/engines/sci/engine/segment.cpp b/engines/sci/engine/segment.cpp
index 3f11d6ff49..73d81baf3a 100644
--- a/engines/sci/engine/segment.cpp
+++ b/engines/sci/engine/segment.cpp
@@ -143,9 +143,11 @@ SegmentRef LocalVariables::dereference(reg_t pointer) {
if (ret.maxSize > 0) {
ret.reg = &_locals[pointer.offset / 2];
} else {
- if ((g_sci->getEngineState()->currentRoomNumber() == 660 || g_sci->getEngineState()->currentRoomNumber() == 660)
+ if ((g_sci->getEngineState()->currentRoomNumber() == 160 ||
+ g_sci->getEngineState()->currentRoomNumber() == 220)
&& g_sci->getGameId() == GID_LAURABOW2) {
- // Happens in two places during the intro of LB2CD, both from kMemory(peek):
+ // WORKAROUND: Happens in two places during the intro of LB2CD, both
+ // from kMemory(peek):
// - room 160: Heap 160 has 83 local variables (0-82), and the game
// asks for variables at indices 83 - 90 too.
// - room 220: Heap 220 has 114 local variables (0-113), and the
diff --git a/engines/sci/engine/selector.cpp b/engines/sci/engine/selector.cpp
index c2f857f319..a8b1cf7ec2 100644
--- a/engines/sci/engine/selector.cpp
+++ b/engines/sci/engine/selector.cpp
@@ -167,6 +167,7 @@ void Kernel::mapSelectors() {
#ifdef ENABLE_SCI32
FIND_SELECTOR(data);
FIND_SELECTOR(picture);
+ FIND_SELECTOR(bitmap);
FIND_SELECTOR(plane);
FIND_SELECTOR(top);
FIND_SELECTOR(left);
@@ -177,6 +178,7 @@ void Kernel::mapSelectors() {
FIND_SELECTOR(dimmed);
FIND_SELECTOR(fore);
FIND_SELECTOR(back);
+ FIND_SELECTOR(skip);
FIND_SELECTOR(fixPriority);
FIND_SELECTOR(mirrored);
FIND_SELECTOR(useInsetRect);
diff --git a/engines/sci/engine/selector.h b/engines/sci/engine/selector.h
index 085dd6e832..4b913a866a 100644
--- a/engines/sci/engine/selector.h
+++ b/engines/sci/engine/selector.h
@@ -132,6 +132,7 @@ struct SelectorCache {
#ifdef ENABLE_SCI32
Selector data; // Used by Array()/String()
Selector picture; // Used to hold the picture ID for SCI32 pictures
+ Selector bitmap; // Used to hold the text bitmap for SCI32 texts
Selector plane;
Selector top;
@@ -143,6 +144,7 @@ struct SelectorCache {
Selector fore;
Selector back;
+ Selector skip;
Selector dimmed;
Selector fixPriority;
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index 4ea9f72054..28818cddef 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -145,12 +145,12 @@ void EngineState::wait(int16 ticks) {
void EngineState::initGlobals() {
Script *script_000 = _segMan->getScript(1);
- if (!script_000->_localsBlock)
+ if (script_000->getLocalsCount() == 0)
error("Script 0 has no locals block");
- variablesSegment[VAR_GLOBAL] = script_000->_localsSegment;
- variablesBase[VAR_GLOBAL] = variables[VAR_GLOBAL] = script_000->_localsBlock->_locals.begin();
- variablesMax[VAR_GLOBAL] = script_000->_localsBlock->_locals.size();
+ variablesSegment[VAR_GLOBAL] = script_000->getLocalsSegment();
+ variablesBase[VAR_GLOBAL] = variables[VAR_GLOBAL] = script_000->getLocalsBegin();
+ variablesMax[VAR_GLOBAL] = script_000->getLocalsCount();
}
uint16 EngineState::currentRoomNumber() const {
diff --git a/engines/sci/engine/static_selectors.cpp b/engines/sci/engine/static_selectors.cpp
index 8f3337743d..74d2851024 100644
--- a/engines/sci/engine/static_selectors.cpp
+++ b/engines/sci/engine/static_selectors.cpp
@@ -192,9 +192,6 @@ Common::StringArray Kernel::checkStaticSelectorNames() {
for (int i = count + countSci1; i < count + countSci1 + countSci11; i++)
names[i] = sci11Selectors[i - count - countSci1];
}
-
- findSpecificSelectors(names);
-
#ifdef ENABLE_SCI32
} else {
// SCI2+
@@ -203,6 +200,8 @@ Common::StringArray Kernel::checkStaticSelectorNames() {
#endif
}
+ findSpecificSelectors(names);
+
for (const SelectorRemap *selectorRemap = sciSelectorRemap; selectorRemap->slot; ++selectorRemap) {
if (getSciVersion() >= selectorRemap->minVersion && getSciVersion() <= selectorRemap->maxVersion) {
const uint32 slot = selectorRemap->slot;
@@ -223,13 +222,16 @@ void Kernel::findSpecificSelectors(Common::StringArray &selectorNames) {
// We need to initialize script 0 here, to make sure that it's always
// located at segment 1.
_segMan->instantiateScript(0);
+ uint16 sci2Offset = (getSciVersion() >= SCI_VERSION_2) ? 64000 : 0;
// The Actor class contains the init, xLast and yLast selectors, which
// we reference directly. It's always in script 998, so we need to
// explicitly load it here.
if ((getSciVersion() >= SCI_VERSION_1_EGA_ONLY)) {
- if (_resMan->testResource(ResourceId(kResourceTypeScript, 998))) {
- _segMan->instantiateScript(998);
+ uint16 actorScript = 998;
+
+ if (_resMan->testResource(ResourceId(kResourceTypeScript, actorScript + sci2Offset))) {
+ _segMan->instantiateScript(actorScript + sci2Offset);
const Object *actorClass = _segMan->getObject(_segMan->findObjectByName("Actor"));
@@ -237,9 +239,10 @@ void Kernel::findSpecificSelectors(Common::StringArray &selectorNames) {
// Find the xLast and yLast selectors, used in kDoBresen
const int offset = (getSciVersion() < SCI_VERSION_1_1) ? 3 : 0;
+ const int offset2 = (getSciVersion() >= SCI_VERSION_2) ? 12 : 0;
// xLast and yLast always come between illegalBits and xStep
- int illegalBitsSelectorPos = actorClass->locateVarSelector(_segMan, 15 + offset); // illegalBits
- int xStepSelectorPos = actorClass->locateVarSelector(_segMan, 51 + offset); // xStep
+ int illegalBitsSelectorPos = actorClass->locateVarSelector(_segMan, 15 + offset + offset2); // illegalBits
+ int xStepSelectorPos = actorClass->locateVarSelector(_segMan, 51 + offset + offset2); // xStep
if (xStepSelectorPos - illegalBitsSelectorPos != 3) {
error("illegalBits and xStep selectors aren't found in "
"known locations. illegalBits = %d, xStep = %d",
@@ -263,10 +266,10 @@ void Kernel::findSpecificSelectors(Common::StringArray &selectorNames) {
// Find selectors from specific classes
for (int i = 0; i < ARRAYSIZE(classReferences); i++) {
- if (!_resMan->testResource(ResourceId(kResourceTypeScript, classReferences[i].script)))
+ if (!_resMan->testResource(ResourceId(kResourceTypeScript, classReferences[i].script + sci2Offset)))
continue;
- _segMan->instantiateScript(classReferences[i].script);
+ _segMan->instantiateScript(classReferences[i].script + sci2Offset);
const Object *targetClass = _segMan->getObject(_segMan->findObjectByName(classReferences[i].className));
int targetSelectorPos = 0;
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 7c22b48ece..cbe4736ba2 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -232,11 +232,10 @@ ExecStack *execute_method(EngineState *s, uint16 script, uint16 pubfunct, StackP
if (!temp) {
#ifdef ENABLE_SCI32
- // HACK: Temporarily switch to a warning in SCI32 games until we can figure out why Torin has
- // an invalid exported function.
- if (getSciVersion() >= SCI_VERSION_2)
- warning("Request for invalid exported function 0x%x of script %d", pubfunct, script);
- else
+ if (g_sci->getGameId() == GID_TORIN && script == 64036) {
+ // Script 64036 in Torin's Passage is empty and contains an invalid
+ // (empty) export
+ } else
#endif
error("Request for invalid exported function 0x%x of script %d", pubfunct, script);
return NULL;
@@ -463,10 +462,10 @@ int readPMachineInstruction(const byte *src, byte &extOpcode, int16 opparams[4])
memset(opparams, 0, 4*sizeof(int16));
- for (int i = 0; g_opcode_formats[opcode][i]; ++i) {
+ for (int i = 0; g_sci->_opcode_formats[opcode][i]; ++i) {
//debugN("Opcode: 0x%x, Opnumber: 0x%x, temp: %d\n", opcode, opcode, temp);
assert(i < 3);
- switch (g_opcode_formats[opcode][i]) {
+ switch (g_sci->_opcode_formats[opcode][i]) {
case Script_Byte:
opparams[i] = src[offset++];
@@ -594,15 +593,9 @@ void run_vm(EngineState *s) {
if (!local_script) {
error("Could not find local script from segment %x", s->xs->local_segment);
} else {
- s->variablesSegment[VAR_LOCAL] = local_script->_localsSegment;
- if (local_script->_localsBlock)
- s->variablesBase[VAR_LOCAL] = s->variables[VAR_LOCAL] = local_script->_localsBlock->_locals.begin();
- else
- s->variablesBase[VAR_LOCAL] = s->variables[VAR_LOCAL] = NULL;
- if (local_script->_localsBlock)
- s->variablesMax[VAR_LOCAL] = local_script->_localsBlock->_locals.size();
- else
- s->variablesMax[VAR_LOCAL] = 0;
+ s->variablesSegment[VAR_LOCAL] = local_script->getLocalsSegment();
+ s->variablesBase[VAR_LOCAL] = s->variables[VAR_LOCAL] = local_script->getLocalsBegin();
+ s->variablesMax[VAR_LOCAL] = local_script->getLocalsCount();
s->variablesMax[VAR_TEMP] = s->xs->sp - s->xs->fp;
s->variablesMax[VAR_PARAM] = s->xs->argc + 1;
}
@@ -771,16 +764,28 @@ void run_vm(EngineState *s) {
// Branch relative if true
if (s->r_acc.offset || s->r_acc.segment)
s->xs->addr.pc.offset += opparams[0];
+
+ if (s->xs->addr.pc.offset >= local_script->getScriptSize())
+ error("[VM] op_bt: request to jump past the end of script %d (offset %d, script is %d bytes)",
+ local_script->getScriptNumber(), s->xs->addr.pc.offset, local_script->getScriptSize());
break;
case op_bnt: // 0x18 (24)
// Branch relative if not true
if (!(s->r_acc.offset || s->r_acc.segment))
s->xs->addr.pc.offset += opparams[0];
+
+ if (s->xs->addr.pc.offset >= local_script->getScriptSize())
+ error("[VM] op_bnt: request to jump past the end of script %d (offset %d, script is %d bytes)",
+ local_script->getScriptNumber(), s->xs->addr.pc.offset, local_script->getScriptSize());
break;
case op_jmp: // 0x19 (25)
s->xs->addr.pc.offset += opparams[0];
+
+ if (s->xs->addr.pc.offset >= local_script->getScriptSize())
+ error("[VM] op_jmp: request to jump past the end of script %d (offset %d, script is %d bytes)",
+ local_script->getScriptNumber(), s->xs->addr.pc.offset, local_script->getScriptSize());
break;
case op_ldi: // 0x1a (26)
diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h
index 36eadfa1c2..334d224baf 100644
--- a/engines/sci/engine/vm.h
+++ b/engines/sci/engine/vm.h
@@ -139,26 +139,6 @@ enum {
GC_INTERVAL = 0x8000
};
-// Opcode formats
-enum opcode_format {
- Script_Invalid = -1,
- Script_None = 0,
- Script_Byte,
- Script_SByte,
- Script_Word,
- Script_SWord,
- Script_Variable,
- Script_SVariable,
- Script_SRelative,
- Script_Property,
- Script_Global,
- Script_Local,
- Script_Temp,
- Script_Param,
- Script_Offset,
- Script_End
-};
-
enum sci_opcodes {
op_bnot = 0x00, // 000
op_add = 0x01, // 001
@@ -290,8 +270,6 @@ enum sci_opcodes {
op_minusspi = 0x7f // 127
};
-extern opcode_format g_opcode_formats[128][4];
-
void script_adjust_opcode_formats();
/**
diff --git a/engines/sci/engine/vm_types.h b/engines/sci/engine/vm_types.h
index dc87cf758a..7b155a4532 100644
--- a/engines/sci/engine/vm_types.h
+++ b/engines/sci/engine/vm_types.h
@@ -172,6 +172,26 @@ enum {
NULL_SELECTOR = -1
};
+// Opcode formats
+enum opcode_format {
+ Script_Invalid = -1,
+ Script_None = 0,
+ Script_Byte,
+ Script_SByte,
+ Script_Word,
+ Script_SWord,
+ Script_Variable,
+ Script_SVariable,
+ Script_SRelative,
+ Script_Property,
+ Script_Global,
+ Script_Local,
+ Script_Temp,
+ Script_Param,
+ Script_Offset,
+ Script_End
+};
+
} // End of namespace Sci
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index ac8d5fa262..f68b74e1e0 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -124,6 +124,7 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
{ GID_MOTHERGOOSEHIRES,-1,64950, 1, "View", "handleEvent", -1, 0, { WORKAROUND_FAKE, 0 } }, // see above
{ GID_PEPPER, -1, 894, 0, "Package", "doVerb", -1, 3, { WORKAROUND_FAKE, 0 } }, // using the hand on the book in the inventory - bug #3040012
{ GID_PEPPER, 150, 928, 0, "Narrator", "startText", -1, 0, { WORKAROUND_FAKE, 0 } }, // happens during the non-interactive demo of Pepper
+ { GID_PQ4, -1, 25, 0, "iconToggle", "select", -1, 1, { WORKAROUND_FAKE, 0 } }, // when toggling the icon bar to auto-hide or not
{ GID_PQSWAT, -1, 64950, 0, "View", "handleEvent", -1, 0, { WORKAROUND_FAKE, 0 } }, // Using the menu in the beginning
{ GID_QFG1, -1, 210, 0, "Encounter", "init", 0xbd0, 0, { WORKAROUND_FAKE, 0 } }, // hq1: going to the brigands hideout
{ GID_QFG1, -1, 210, 0, "Encounter", "init", 0xbe4, 0, { WORKAROUND_FAKE, 0 } }, // qfg1: going to the brigands hideout
@@ -154,6 +155,9 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
{ GID_SHIVERS, -1, 952, 0, "SoundManager", "stop", -1, 2, { WORKAROUND_FAKE, 0 } }, // Just after Sierra logo
{ GID_SHIVERS, -1, 64950, 0, "Feature", "handleEvent", -1, 0, { WORKAROUND_FAKE, 0 } }, // When clicking on the locked door at the beginning
{ GID_SHIVERS, -1, 64950, 0, "View", "handleEvent", -1, 0, { WORKAROUND_FAKE, 0 } }, // When clicking on the gargoyle eye at the beginning
+ { GID_SHIVERS, 20311, 64964, 0, "DPath", "init", -1, 1, { WORKAROUND_FAKE, 0 } }, // Just after door puzzle is solved and the metal balls start to roll
+ { GID_SHIVERS, 29260, 29260, 0, "spMars", "handleEvent", -1, 4, { WORKAROUND_FAKE, 0 } }, // When clicking mars after seeing fortune to align earth etc...
+ { GID_SHIVERS, 29260, 29260, 0, "spVenus", "handleEvent", -1, 4, { WORKAROUND_FAKE, 0 } }, // When clicking venus after seeing fortune to align earth etc...
{ GID_SQ1, 103, 103, 0, "hand", "internalEvent", -1, -1, { WORKAROUND_FAKE, 0 } }, // Spanish (and maybe early versions?) only: when moving cursor over input pad, temps 1 and 2
{ GID_SQ1, -1, 703, 0, "", "export 1", -1, 0, { WORKAROUND_FAKE, 0 } }, // sub that's called from several objects while on sarien battle cruiser
{ GID_SQ1, -1, 703, 0, "firePulsar", "changeState", 0x18a, 0, { WORKAROUND_FAKE, 0 } }, // export 1, but called locally (when shooting at aliens)
@@ -383,7 +387,7 @@ const SciWorkaroundEntry kStrLen_workarounds[] = {
const SciWorkaroundEntry kUnLoad_workarounds[] = {
{ GID_ECOQUEST, 380, 61, 0, "gotIt", "changeState", -1, 0, { WORKAROUND_IGNORE, 0 } }, // CD version: after talking to the dolphin the first time, a 3rd parameter is passed by accident
{ GID_ECOQUEST, 380, 69, 0, "lookAtBlackBoard", "changeState", -1, 0, { WORKAROUND_IGNORE, 0 } }, // German version, when closing the blackboard closeup in the dolphin room, a 3rd parameter is passed by accident - bug #3098353
- { GID_LAURABOW2, -1, 1, 0, "sCartoon", "changeState", -1, 0, { WORKAROUND_IGNORE, 0 } }, // DEMO: during the intro, a 3rd parameter is passed by accident - bug #3034902
+ { GID_LAURABOW2, -1, -1, 0, "sCartoon", "changeState", -1, 0, { WORKAROUND_IGNORE, 0 } }, // DEMO: during the intro, a 3rd parameter is passed by accident - bug #3034902
{ GID_LSL6, 130, 130, 0, "recruitLarryScr", "changeState", -1, 0, { WORKAROUND_IGNORE, 0 } }, // during intro, a 3rd parameter is passed by accident
{ GID_LSL6, 740, 740, 0, "showCartoon", "changeState", -1, 0, { WORKAROUND_IGNORE, 0 } }, // during ending, 4 additional parameters are passed by accident
{ GID_LSL6HIRES, 130, 130, 0, "recruitLarryScr", "changeState", -1, 0, { WORKAROUND_IGNORE, 0 } }, // during intro, a 3rd parameter is passed by accident
diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp
index c14cfada07..378e88b7df 100644
--- a/engines/sci/event.cpp
+++ b/engines/sci/event.cpp
@@ -253,14 +253,11 @@ SciEvent EventManager::getScummVMEvent() {
if ((modifiers & Common::KBD_ALT) && input.character > 0 && input.character < 27)
input.character += 96; // 0x01 -> 'a'
- if (getSciVersion() <= SCI_VERSION_1_MIDDLE) {
- // TODO: find out if altify is also not needed for sci1late+, couldnt find any game that uses those keys
- // Scancodify if appropriate
- if (modifiers & Common::KBD_ALT)
- input.character = altify(input.character);
- else if ((modifiers & Common::KBD_CTRL) && input.character > 0 && input.character < 27)
- input.character += 96; // 0x01 -> 'a'
- }
+ // Scancodify if appropriate
+ if (modifiers & Common::KBD_ALT)
+ input.character = altify(input.character);
+ else if ((modifiers & Common::KBD_CTRL) && input.character > 0 && input.character < 27)
+ input.character += 96; // 0x01 -> 'a'
// If no actual key was pressed (e.g. if only a modifier key was pressed),
// ignore the event
diff --git a/engines/sci/graphics/animate.cpp b/engines/sci/graphics/animate.cpp
index 18f8511953..983e697481 100644
--- a/engines/sci/graphics/animate.cpp
+++ b/engines/sci/graphics/animate.cpp
@@ -32,6 +32,7 @@
#include "sci/engine/selector.h"
#include "sci/engine/vm.h"
#include "sci/graphics/cache.h"
+#include "sci/graphics/compare.h"
#include "sci/graphics/cursor.h"
#include "sci/graphics/ports.h"
#include "sci/graphics/paint16.h"
@@ -307,10 +308,7 @@ void GfxAnimate::setNsRect(GfxView *view, AnimateList::iterator it) {
// This special handling is not included in the other SCI1.1 interpreters and MUST NOT be
// checked in those cases, otherwise we will break games (e.g. EcoQuest 2, room 200)
if ((g_sci->getGameId() == GID_HOYLE4) && (it->scaleSignal & kScaleSignalHoyle4SpecialHandling)) {
- it->celRect.left = readSelectorValue(_s->_segMan, it->object, SELECTOR(nsLeft));
- it->celRect.top = readSelectorValue(_s->_segMan, it->object, SELECTOR(nsTop));
- it->celRect.right = readSelectorValue(_s->_segMan, it->object, SELECTOR(nsRight));
- it->celRect.bottom = readSelectorValue(_s->_segMan, it->object, SELECTOR(nsBottom));
+ it->celRect = g_sci->_gfxCompare->getNSRect(it->object);
view->getCelSpecialHoyle4Rect(it->loopNo, it->celNo, it->x, it->y, it->z, it->celRect);
shouldSetNsRect = false;
} else {
@@ -319,10 +317,7 @@ void GfxAnimate::setNsRect(GfxView *view, AnimateList::iterator it) {
}
if (shouldSetNsRect) {
- writeSelectorValue(_s->_segMan, it->object, SELECTOR(nsLeft), it->celRect.left);
- writeSelectorValue(_s->_segMan, it->object, SELECTOR(nsTop), it->celRect.top);
- writeSelectorValue(_s->_segMan, it->object, SELECTOR(nsRight), it->celRect.right);
- writeSelectorValue(_s->_segMan, it->object, SELECTOR(nsBottom), it->celRect.bottom);
+ g_sci->_gfxCompare->setNSRect(it->object, it->celRect);
}
}
@@ -544,10 +539,7 @@ void GfxAnimate::addToPicDrawCels() {
applyGlobalScaling(it, view);
}
view->getCelScaledRect(it->loopNo, it->celNo, it->x, it->y, it->z, it->scaleX, it->scaleY, it->celRect);
- writeSelectorValue(_s->_segMan, curObject, SELECTOR(nsLeft), it->celRect.left);
- writeSelectorValue(_s->_segMan, curObject, SELECTOR(nsTop), it->celRect.top);
- writeSelectorValue(_s->_segMan, curObject, SELECTOR(nsRight), it->celRect.right);
- writeSelectorValue(_s->_segMan, curObject, SELECTOR(nsBottom), it->celRect.bottom);
+ g_sci->_gfxCompare->setNSRect(curObject, it->celRect);
} else {
view->getCelRect(it->loopNo, it->celNo, it->x, it->y, it->z, it->celRect);
}
diff --git a/engines/sci/graphics/cache.cpp b/engines/sci/graphics/cache.cpp
index d2bd76ac99..55f8624c49 100644
--- a/engines/sci/graphics/cache.cpp
+++ b/engines/sci/graphics/cache.cpp
@@ -102,4 +102,8 @@ int16 GfxCache::kernelViewGetCelCount(GuiResourceId viewId, int16 loopNo) {
return getView(viewId)->getCelCount(loopNo);
}
+byte GfxCache::kernelViewGetColorAtCoordinate(GuiResourceId viewId, int16 loopNo, int16 celNo, int16 x, int16 y) {
+ return getView(viewId)->getColorAtCoordinate(loopNo, celNo, x, y);
+}
+
} // End of namespace Sci
diff --git a/engines/sci/graphics/cache.h b/engines/sci/graphics/cache.h
index c090cda7d7..2f462fe042 100644
--- a/engines/sci/graphics/cache.h
+++ b/engines/sci/graphics/cache.h
@@ -49,6 +49,8 @@ public:
int16 kernelViewGetLoopCount(GuiResourceId viewId);
int16 kernelViewGetCelCount(GuiResourceId viewId, int16 loopNo);
+ byte kernelViewGetColorAtCoordinate(GuiResourceId viewId, int16 loopNo, int16 celNo, int16 x, int16 y);
+
private:
void purgeFontCache();
void purgeViewCache();
diff --git a/engines/sci/graphics/compare.cpp b/engines/sci/graphics/compare.cpp
index 3183ffa2b9..70dff15a86 100644
--- a/engines/sci/graphics/compare.cpp
+++ b/engines/sci/graphics/compare.cpp
@@ -147,10 +147,7 @@ void GfxCompare::kernelSetNowSeen(reg_t objectReference) {
#endif
if (lookupSelector(_segMan, objectReference, SELECTOR(nsTop), NULL, NULL) == kSelectorVariable) {
- writeSelectorValue(_segMan, objectReference, SELECTOR(nsLeft), celRect.left);
- writeSelectorValue(_segMan, objectReference, SELECTOR(nsRight), celRect.right);
- writeSelectorValue(_segMan, objectReference, SELECTOR(nsTop), celRect.top);
- writeSelectorValue(_segMan, objectReference, SELECTOR(nsBottom), celRect.bottom);
+ setNSRect(objectReference, celRect);
}
}
@@ -221,10 +218,7 @@ void GfxCompare::kernelBaseSetter(reg_t object) {
scaleSignal = 0;
if (scaleSignal & kScaleSignalDoScaling) {
- celRect.left = readSelectorValue(_segMan, object, SELECTOR(nsLeft));
- celRect.right = readSelectorValue(_segMan, object, SELECTOR(nsRight));
- celRect.top = readSelectorValue(_segMan, object, SELECTOR(nsTop));
- celRect.bottom = readSelectorValue(_segMan, object, SELECTOR(nsBottom));
+ celRect = getNSRect(object);
} else {
if (tmpView->isSci2Hires())
tmpView->adjustToUpscaledCoordinates(y, x);
@@ -247,4 +241,29 @@ void GfxCompare::kernelBaseSetter(reg_t object) {
}
}
+Common::Rect GfxCompare::getNSRect(reg_t object, bool fixRect) {
+ Common::Rect nsRect;
+ nsRect.top = readSelectorValue(_segMan, object, SELECTOR(nsTop));
+ nsRect.left = readSelectorValue(_segMan, object, SELECTOR(nsLeft));
+ nsRect.bottom = readSelectorValue(_segMan, object, SELECTOR(nsBottom));
+ nsRect.right = readSelectorValue(_segMan, object, SELECTOR(nsRight));
+
+ if (fixRect) {
+ // nsRect top/left may be negative, adjust accordingly
+ if (nsRect.top < 0)
+ nsRect.top = 0;
+ if (nsRect.left < 0)
+ nsRect.left = 0;
+ }
+
+ return nsRect;
+}
+
+void GfxCompare::setNSRect(reg_t object, Common::Rect nsRect) {
+ writeSelectorValue(_segMan, object, SELECTOR(nsLeft), nsRect.left);
+ writeSelectorValue(_segMan, object, SELECTOR(nsTop), nsRect.top);
+ writeSelectorValue(_segMan, object, SELECTOR(nsRight), nsRect.right);
+ writeSelectorValue(_segMan, object, SELECTOR(nsBottom), nsRect.bottom);
+}
+
} // End of namespace Sci
diff --git a/engines/sci/graphics/compare.h b/engines/sci/graphics/compare.h
index bacb6e71e2..91e3b90fdb 100644
--- a/engines/sci/graphics/compare.h
+++ b/engines/sci/graphics/compare.h
@@ -42,6 +42,8 @@ public:
reg_t kernelCanBeHere(reg_t curObject, reg_t listReference);
bool kernelIsItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position);
void kernelBaseSetter(reg_t object);
+ Common::Rect getNSRect(reg_t object, bool fixRect = false);
+ void setNSRect(reg_t object, Common::Rect nsRect);
private:
SegManager *_segMan;
diff --git a/engines/sci/graphics/controls.cpp b/engines/sci/graphics/controls16.cpp
index 8d4712a969..ab54e468d1 100644
--- a/engines/sci/graphics/controls.cpp
+++ b/engines/sci/graphics/controls16.cpp
@@ -30,31 +30,32 @@
#include "sci/engine/kernel.h"
#include "sci/engine/state.h"
#include "sci/engine/selector.h"
+#include "sci/graphics/compare.h"
#include "sci/graphics/ports.h"
#include "sci/graphics/paint16.h"
#include "sci/graphics/font.h"
#include "sci/graphics/screen.h"
#include "sci/graphics/text16.h"
-#include "sci/graphics/controls.h"
+#include "sci/graphics/controls16.h"
namespace Sci {
-GfxControls::GfxControls(SegManager *segMan, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen)
+GfxControls16::GfxControls16(SegManager *segMan, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen)
: _segMan(segMan), _ports(ports), _paint16(paint16), _text16(text16), _screen(screen) {
init();
}
-GfxControls::~GfxControls() {
+GfxControls16::~GfxControls16() {
}
-void GfxControls::init() {
+void GfxControls16::init() {
_texteditCursorVisible = false;
}
const char controlListUpArrow[2] = { 0x18, 0 };
const char controlListDownArrow[2] = { 0x19, 0 };
-void GfxControls::drawListControl(Common::Rect rect, reg_t obj, int16 maxChars, int16 count, const char **entries, GuiResourceId fontId, int16 upperPos, int16 cursorPos, bool isAlias) {
+void GfxControls16::drawListControl(Common::Rect rect, reg_t obj, int16 maxChars, int16 count, const char **entries, GuiResourceId fontId, int16 upperPos, int16 cursorPos, bool isAlias) {
Common::Rect workerRect = rect;
GuiResourceId oldFontId = _text16->GetFontId();
int16 oldPenColor = _ports->_curPort->penClr;
@@ -111,7 +112,7 @@ void GfxControls::drawListControl(Common::Rect rect, reg_t obj, int16 maxChars,
_text16->SetFont(oldFontId);
}
-void GfxControls::texteditCursorDraw(Common::Rect rect, const char *text, uint16 curPos) {
+void GfxControls16::texteditCursorDraw(Common::Rect rect, const char *text, uint16 curPos) {
int16 textWidth, i;
if (!_texteditCursorVisible) {
textWidth = 0;
@@ -129,7 +130,7 @@ void GfxControls::texteditCursorDraw(Common::Rect rect, const char *text, uint16
}
}
-void GfxControls::texteditCursorErase() {
+void GfxControls16::texteditCursorErase() {
if (_texteditCursorVisible) {
_paint16->invertRect(_texteditCursorRect);
_paint16->bitsShow(_texteditCursorRect);
@@ -138,11 +139,11 @@ void GfxControls::texteditCursorErase() {
texteditSetBlinkTime();
}
-void GfxControls::texteditSetBlinkTime() {
+void GfxControls16::texteditSetBlinkTime() {
_texteditBlinkTime = g_system->getMillis() + (30 * 1000 / 60);
}
-void GfxControls::kernelTexteditChange(reg_t controlObject, reg_t eventObject) {
+void GfxControls16::kernelTexteditChange(reg_t controlObject, reg_t eventObject) {
uint16 cursorPos = readSelectorValue(_segMan, controlObject, SELECTOR(cursor));
uint16 maxChars = readSelectorValue(_segMan, controlObject, SELECTOR(max));
reg_t textReference = readSelector(_segMan, controlObject, SELECTOR(text));
@@ -230,8 +231,8 @@ void GfxControls::kernelTexteditChange(reg_t controlObject, reg_t eventObject) {
if (textChanged) {
GuiResourceId oldFontId = _text16->GetFontId();
GuiResourceId fontId = readSelectorValue(_segMan, controlObject, SELECTOR(font));
- rect = Common::Rect(readSelectorValue(_segMan, controlObject, SELECTOR(nsLeft)), readSelectorValue(_segMan, controlObject, SELECTOR(nsTop)),
- readSelectorValue(_segMan, controlObject, SELECTOR(nsRight)), readSelectorValue(_segMan, controlObject, SELECTOR(nsBottom)));
+ rect = g_sci->_gfxCompare->getNSRect(controlObject);
+
_text16->SetFont(fontId);
if (textAddChar) {
@@ -276,13 +277,13 @@ void GfxControls::kernelTexteditChange(reg_t controlObject, reg_t eventObject) {
writeSelectorValue(_segMan, controlObject, SELECTOR(cursor), cursorPos);
}
-int GfxControls::getPicNotValid() {
+int GfxControls16::getPicNotValid() {
if (getSciVersion() >= SCI_VERSION_1_1)
return _screen->_picNotValidSci11;
return _screen->_picNotValid;
}
-void GfxControls::kernelDrawButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool hilite) {
+void GfxControls16::kernelDrawButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool hilite) {
int16 sci0EarlyPen = 0, sci0EarlyBack = 0;
if (!hilite) {
if (getSciVersion() == SCI_VERSION_0_EARLY) {
@@ -320,7 +321,7 @@ void GfxControls::kernelDrawButton(Common::Rect rect, reg_t obj, const char *tex
}
}
-void GfxControls::kernelDrawText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, TextAlignment alignment, int16 style, bool hilite) {
+void GfxControls16::kernelDrawText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, TextAlignment alignment, int16 style, bool hilite) {
if (!hilite) {
rect.grow(1);
_paint16->eraseRect(rect);
@@ -337,7 +338,7 @@ void GfxControls::kernelDrawText(Common::Rect rect, reg_t obj, const char *text,
}
}
-void GfxControls::kernelDrawTextEdit(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, int16 cursorPos, int16 maxChars, bool hilite) {
+void GfxControls16::kernelDrawTextEdit(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, int16 cursorPos, int16 maxChars, bool hilite) {
Common::Rect textRect = rect;
uint16 oldFontId = _text16->GetFontId();
@@ -358,7 +359,7 @@ void GfxControls::kernelDrawTextEdit(Common::Rect rect, reg_t obj, const char *t
_paint16->bitsShow(rect);
}
-void GfxControls::kernelDrawIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, int16 loopNo, int16 celNo, int16 priority, int16 style, bool hilite) {
+void GfxControls16::kernelDrawIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, int16 loopNo, int16 celNo, int16 priority, int16 style, bool hilite) {
if (!hilite) {
_paint16->drawCelAndShow(viewId, loopNo, celNo, rect.left, rect.top, priority, 0);
if (style & 0x20) {
@@ -372,7 +373,7 @@ void GfxControls::kernelDrawIcon(Common::Rect rect, reg_t obj, GuiResourceId vie
}
}
-void GfxControls::kernelDrawList(Common::Rect rect, reg_t obj, int16 maxChars, int16 count, const char **entries, GuiResourceId fontId, int16 style, int16 upperPos, int16 cursorPos, bool isAlias, bool hilite) {
+void GfxControls16::kernelDrawList(Common::Rect rect, reg_t obj, int16 maxChars, int16 count, const char **entries, GuiResourceId fontId, int16 style, int16 upperPos, int16 cursorPos, bool isAlias, bool hilite) {
if (!hilite) {
drawListControl(rect, obj, maxChars, count, entries, fontId, upperPos, cursorPos, isAlias);
rect.grow(1);
diff --git a/engines/sci/graphics/controls.h b/engines/sci/graphics/controls16.h
index 17e7c39318..90bd7beacb 100644
--- a/engines/sci/graphics/controls.h
+++ b/engines/sci/graphics/controls16.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef SCI_GRAPHICS_CONTROLS_H
-#define SCI_GRAPHICS_CONTROLS_H
+#ifndef SCI_GRAPHICS_CONTROLS16_H
+#define SCI_GRAPHICS_CONTROLS16_H
namespace Sci {
@@ -50,10 +50,10 @@ class GfxScreen;
/**
* Controls class, handles drawing of controls in SCI16 (SCI0-SCI1.1) games
*/
-class GfxControls {
+class GfxControls16 {
public:
- GfxControls(SegManager *segMan, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen);
- ~GfxControls();
+ GfxControls16(SegManager *segMan, GfxPorts *ports, GfxPaint16 *paint16, GfxText16 *text16, GfxScreen *screen);
+ ~GfxControls16();
void kernelDrawButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool hilite);
void kernelDrawText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 alignment, int16 style, bool hilite);
diff --git a/engines/sci/graphics/controls32.cpp b/engines/sci/graphics/controls32.cpp
new file mode 100644
index 0000000000..ad1d9e8623
--- /dev/null
+++ b/engines/sci/graphics/controls32.cpp
@@ -0,0 +1,204 @@
+/* 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/system.h"
+
+#include "sci/sci.h"
+#include "sci/event.h"
+#include "sci/engine/kernel.h"
+#include "sci/engine/seg_manager.h"
+#include "sci/graphics/cache.h"
+#include "sci/graphics/compare.h"
+#include "sci/graphics/controls32.h"
+#include "sci/graphics/font.h"
+#include "sci/graphics/screen.h"
+#include "sci/graphics/text32.h"
+
+namespace Sci {
+
+GfxControls32::GfxControls32(SegManager *segMan, GfxCache *cache, GfxScreen *screen, GfxText32 *text)
+ : _segMan(segMan), _cache(cache), _screen(screen), _text(text) {
+}
+
+GfxControls32::~GfxControls32() {
+}
+
+void GfxControls32::kernelTexteditChange(reg_t controlObject) {
+ SciEvent curEvent;
+ uint16 maxChars = 40; //readSelectorValue(_segMan, controlObject, SELECTOR(max)); // TODO
+ reg_t textReference = readSelector(_segMan, controlObject, SELECTOR(text));
+ GfxFont *font = _cache->getFont(readSelectorValue(_segMan, controlObject, SELECTOR(font)));
+ Common::String text;
+ uint16 textSize;
+ bool textChanged = false;
+ bool textAddChar = false;
+ Common::Rect rect;
+
+ if (textReference.isNull())
+ error("kEditControl called on object that doesnt have a text reference");
+ text = _segMan->getString(textReference);
+
+ // TODO: Finish this
+ warning("kEditText ('%s')", text.c_str());
+ return;
+
+ uint16 cursorPos = 0;
+ //uint16 oldCursorPos = cursorPos;
+ bool captureEvents = true;
+ EventManager* eventMan = g_sci->getEventManager();
+
+ while (captureEvents) {
+ curEvent = g_sci->getEventManager()->getSciEvent(SCI_EVENT_KEYBOARD | SCI_EVENT_PEEK);
+
+ if (curEvent.type == SCI_EVENT_NONE) {
+ eventMan->getSciEvent(SCI_EVENT_KEYBOARD); // consume the event
+ } else {
+ textSize = text.size();
+
+ switch (curEvent.type) {
+ case SCI_EVENT_MOUSE_PRESS:
+ // TODO: Implement mouse support for cursor change
+ break;
+ case SCI_EVENT_KEYBOARD:
+ switch (curEvent.data) {
+ case SCI_KEY_BACKSPACE:
+ if (cursorPos > 0) {
+ cursorPos--; text.deleteChar(cursorPos);
+ textChanged = true;
+ }
+ eventMan->getSciEvent(SCI_EVENT_KEYBOARD); // consume the event
+ break;
+ case SCI_KEY_DELETE:
+ if (cursorPos < textSize) {
+ text.deleteChar(cursorPos);
+ textChanged = true;
+ }
+ eventMan->getSciEvent(SCI_EVENT_KEYBOARD); // consume the event
+ break;
+ case SCI_KEY_HOME: // HOME
+ cursorPos = 0; textChanged = true;
+ eventMan->getSciEvent(SCI_EVENT_KEYBOARD); // consume the event
+ break;
+ case SCI_KEY_END: // END
+ cursorPos = textSize; textChanged = true;
+ eventMan->getSciEvent(SCI_EVENT_KEYBOARD); // consume the event
+ break;
+ case SCI_KEY_LEFT: // LEFT
+ if (cursorPos > 0) {
+ cursorPos--; textChanged = true;
+ }
+ eventMan->getSciEvent(SCI_EVENT_KEYBOARD); // consume the event
+ break;
+ case SCI_KEY_RIGHT: // RIGHT
+ if (cursorPos + 1 <= textSize) {
+ cursorPos++; textChanged = true;
+ }
+ eventMan->getSciEvent(SCI_EVENT_KEYBOARD); // consume the event
+ break;
+ case 3: // returned in SCI1 late and newer when Control - C is pressed
+ if (curEvent.modifiers & SCI_KEYMOD_CTRL) {
+ // Control-C erases the whole line
+ cursorPos = 0; text.clear();
+ textChanged = true;
+ }
+ eventMan->getSciEvent(SCI_EVENT_KEYBOARD); // consume the event
+ break;
+ case SCI_KEY_UP:
+ case SCI_KEY_DOWN:
+ case SCI_KEY_ENTER:
+ case SCI_KEY_ESC:
+ case SCI_KEY_TAB:
+ case SCI_KEY_SHIFT_TAB:
+ captureEvents = false;
+ break;
+ default:
+ if ((curEvent.modifiers & SCI_KEYMOD_CTRL) && curEvent.data == 99) {
+ // Control-C in earlier SCI games (SCI0 - SCI1 middle)
+ // Control-C erases the whole line
+ cursorPos = 0; text.clear();
+ textChanged = true;
+ } else if (curEvent.data > 31 && curEvent.data < 256 && textSize < maxChars) {
+ // insert pressed character
+ textAddChar = true;
+ textChanged = true;
+ }
+ eventMan->getSciEvent(SCI_EVENT_KEYBOARD); // consume the event
+ break;
+ }
+ break;
+ }
+ }
+
+ if (textChanged) {
+ rect = g_sci->_gfxCompare->getNSRect(controlObject);
+
+ if (textAddChar) {
+ const char *textPtr = text.c_str();
+
+ // We check if we are really able to add the new char
+ uint16 textWidth = 0;
+ while (*textPtr)
+ textWidth += font->getCharWidth((byte)*textPtr++);
+ textWidth += font->getCharWidth(curEvent.data);
+
+ // Does it fit?
+ if (textWidth >= rect.width()) {
+ return;
+ }
+
+ text.insertChar(curEvent.data, cursorPos++);
+
+ // Note: the following checkAltInput call might make the text
+ // too wide to fit, but SSCI fails to check that too.
+ }
+
+ reg_t hunkId = readSelector(_segMan, controlObject, SELECTOR(bitmap));
+ Common::Rect nsRect = g_sci->_gfxCompare->getNSRect(controlObject);
+ //texteditCursorErase(); // TODO: Cursor
+
+ // Write back string
+ _segMan->strcpy(textReference, text.c_str());
+ // Modify the buffer and show it
+ _text->createTextBitmap(controlObject, 0, 0, hunkId);
+
+ _text->drawTextBitmap(0, 0, nsRect, controlObject);
+ //texteditCursorDraw(rect, text.c_str(), cursorPos); // TODO: Cursor
+ g_system->updateScreen();
+ } else {
+ // TODO: Cursor
+ /*
+ if (g_system->getMillis() >= _texteditBlinkTime) {
+ _paint16->invertRect(_texteditCursorRect);
+ _paint16->bitsShow(_texteditCursorRect);
+ _texteditCursorVisible = !_texteditCursorVisible;
+ texteditSetBlinkTime();
+ }
+ */
+ }
+
+ textAddChar = false;
+ textChanged = false;
+ g_sci->sleep(10);
+ } // while
+}
+
+} // End of namespace Sci
diff --git a/engines/m4/staticres.h b/engines/sci/graphics/controls32.h
index e3ead3398b..68dca59462 100644
--- a/engines/m4/staticres.h
+++ b/engines/sci/graphics/controls32.h
@@ -20,37 +20,32 @@
*
*/
-#ifndef M4_STATICRES_H
-#define M4_STATICRES_H
+#ifndef SCI_GRAPHICS_CONTROLS32_H
+#define SCI_GRAPHICS_CONTROLS32_H
-#include "common/scummsys.h"
-#include "m4/m4.h"
+namespace Sci {
-namespace M4 {
+class GfxCache;
+class GfxScreen;
+class GfxText32;
-extern const char *englishMADSArticleList[9];
-
-extern const char *cheatingEnabledDesc[3];
-
-extern const char *atStr;
-extern const char *lookAroundStr;
-extern const char *toStr;
-extern const char *useStr;
-extern const char *walkToStr;
-extern const char *fenceStr;
-extern const char *overStr;
-
-extern const char *GameReleaseInfoStr;
-extern const char *GameReleaseTitleStr;
-
-struct VerbInit {
- int verb;
- int8 flag1;
- int8 flag2;
+/**
+ * Controls class, handles drawing of controls in SCI32 (SCI2, SCI2.1, SCI3) games
+ */
+class GfxControls32 {
+public:
+ GfxControls32(SegManager *segMan, GfxCache *cache, GfxScreen *screen, GfxText32 *text);
+ ~GfxControls32();
+
+ void kernelTexteditChange(reg_t controlObject);
+
+private:
+ SegManager *_segMan;
+ GfxCache *_cache;
+ GfxScreen *_screen;
+ GfxText32 *_text;
};
-extern VerbInit verbList[10];
-
-} // End of namespace M4
+} // End of namespace Sci
#endif
diff --git a/engines/sci/graphics/coordadjuster.cpp b/engines/sci/graphics/coordadjuster.cpp
index 2952d4da7b..1446888cf4 100644
--- a/engines/sci/graphics/coordadjuster.cpp
+++ b/engines/sci/graphics/coordadjuster.cpp
@@ -86,8 +86,8 @@ Common::Rect GfxCoordAdjuster16::pictureGetDisplayArea() {
#ifdef ENABLE_SCI32
GfxCoordAdjuster32::GfxCoordAdjuster32(SegManager *segMan)
: _segMan(segMan) {
- scriptsRunningWidth = 0;
- scriptsRunningHeight = 0;
+ _scriptsRunningWidth = 0;
+ _scriptsRunningHeight = 0;
}
GfxCoordAdjuster32::~GfxCoordAdjuster32() {
@@ -109,18 +109,18 @@ void GfxCoordAdjuster32::kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObje
}
void GfxCoordAdjuster32::setScriptsResolution(uint16 width, uint16 height) {
- scriptsRunningWidth = width;
- scriptsRunningHeight = height;
+ _scriptsRunningWidth = width;
+ _scriptsRunningHeight = height;
}
void GfxCoordAdjuster32::fromDisplayToScript(int16 &y, int16 &x) {
- y = ((y * scriptsRunningHeight) / g_sci->_gfxScreen->getHeight());
- x = ((x * scriptsRunningWidth) / g_sci->_gfxScreen->getWidth());
+ y = ((y * _scriptsRunningHeight) / g_sci->_gfxScreen->getHeight());
+ x = ((x * _scriptsRunningWidth) / g_sci->_gfxScreen->getWidth());
}
void GfxCoordAdjuster32::fromScriptToDisplay(int16 &y, int16 &x) {
- y = ((y * g_sci->_gfxScreen->getHeight()) / scriptsRunningHeight);
- x = ((x * g_sci->_gfxScreen->getWidth()) / scriptsRunningWidth);
+ y = ((y * g_sci->_gfxScreen->getHeight()) / _scriptsRunningHeight);
+ x = ((x * g_sci->_gfxScreen->getWidth()) / _scriptsRunningWidth);
}
void GfxCoordAdjuster32::pictureSetDisplayArea(Common::Rect displayArea) {
diff --git a/engines/sci/graphics/coordadjuster.h b/engines/sci/graphics/coordadjuster.h
index 23cf79d209..63f608be6b 100644
--- a/engines/sci/graphics/coordadjuster.h
+++ b/engines/sci/graphics/coordadjuster.h
@@ -96,8 +96,8 @@ private:
Common::Rect _pictureDisplayArea;
- uint16 scriptsRunningWidth;
- uint16 scriptsRunningHeight;
+ uint16 _scriptsRunningWidth;
+ uint16 _scriptsRunningHeight;
};
#endif
diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp
index 57c65aa6e0..50da48aaf3 100644
--- a/engines/sci/graphics/cursor.cpp
+++ b/engines/sci/graphics/cursor.cpp
@@ -179,6 +179,18 @@ void GfxCursor::kernelSetView(GuiResourceId viewNum, int loopNum, int celNum, Co
if (_useOriginalKQ6WinCursors)
viewNum += 2000; // Windows cursors
+ if (g_sci->getGameId() == GID_PHANTASMAGORIA2) {
+ // HACK: Ignore cursor views for Phantasmagoria 2. They've got
+ // differences from other SCI32 views, thus we skip them for
+ // now, otherwise our view decoding code will crash.
+ // The view code will crash with *any* view in P2, but this hack
+ // allows the game to start and show the menu.
+ // TODO: Remove once the view code is updated to handle
+ // Phantasmagoria 2 views.
+ warning("TODO: Cursor views for Phantasmagoria 2");
+ return;
+ }
+
if (!_cachedCursors.contains(viewNum))
_cachedCursors[viewNum] = new GfxView(_resMan, _screen, _palette, viewNum);
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index 6bd310f1a0..7bb4162020 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -37,6 +37,7 @@
#include "sci/engine/vm.h"
#include "sci/graphics/cache.h"
#include "sci/graphics/coordadjuster.h"
+#include "sci/graphics/compare.h"
#include "sci/graphics/font.h"
#include "sci/graphics/view.h"
#include "sci/graphics/screen.h"
@@ -55,8 +56,8 @@ GfxFrameout::GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCoordAd
: _segMan(segMan), _resMan(resMan), _cache(cache), _screen(screen), _palette(palette), _paint32(paint32) {
_coordAdjuster = (GfxCoordAdjuster32 *)coordAdjuster;
- scriptsRunningWidth = 320;
- scriptsRunningHeight = 200;
+ _scriptsRunningWidth = 320;
+ _scriptsRunningHeight = 200;
}
GfxFrameout::~GfxFrameout() {
@@ -79,17 +80,18 @@ void GfxFrameout::kernelAddPlane(reg_t object) {
// The above can be 0 in SCI3 (e.g. Phantasmagoria 2)
if (tmpRunningWidth > 0 && tmpRunningHeight > 0) {
- scriptsRunningWidth = tmpRunningWidth;
- scriptsRunningHeight = tmpRunningHeight;
+ _scriptsRunningWidth = tmpRunningWidth;
+ _scriptsRunningHeight = tmpRunningHeight;
}
- _coordAdjuster->setScriptsResolution(scriptsRunningWidth, scriptsRunningHeight);
+ _coordAdjuster->setScriptsResolution(_scriptsRunningWidth, _scriptsRunningHeight);
}
newPlane.object = object;
newPlane.priority = readSelectorValue(_segMan, object, SELECTOR(priority));
newPlane.lastPriority = 0xFFFF; // hidden
newPlane.planeOffsetX = 0;
+ newPlane.planeOffsetY = 0;
newPlane.pictureId = 0xFFFF;
newPlane.planePictureMirrored = false;
newPlane.planeBack = 0;
@@ -116,14 +118,14 @@ void GfxFrameout::kernelUpdatePlane(reg_t object) {
}
it->planeRect.top = readSelectorValue(_segMan, object, SELECTOR(top));
it->planeRect.left = readSelectorValue(_segMan, object, SELECTOR(left));
- it->planeRect.bottom = readSelectorValue(_segMan, object, SELECTOR(bottom)) + 1;
- it->planeRect.right = readSelectorValue(_segMan, object, SELECTOR(right)) + 1;
+ it->planeRect.bottom = readSelectorValue(_segMan, object, SELECTOR(bottom));
+ it->planeRect.right = readSelectorValue(_segMan, object, SELECTOR(right));
Common::Rect screenRect(_screen->getWidth(), _screen->getHeight());
- it->planeRect.top = (it->planeRect.top * screenRect.height()) / scriptsRunningHeight;
- it->planeRect.left = (it->planeRect.left * screenRect.width()) / scriptsRunningWidth;
- it->planeRect.bottom = (it->planeRect.bottom * screenRect.height()) / scriptsRunningHeight;
- it->planeRect.right = (it->planeRect.right * screenRect.width()) / scriptsRunningWidth;
+ it->planeRect.top = (it->planeRect.top * screenRect.height()) / _scriptsRunningHeight;
+ it->planeRect.left = (it->planeRect.left * screenRect.width()) / _scriptsRunningWidth;
+ it->planeRect.bottom = (it->planeRect.bottom * screenRect.height()) / _scriptsRunningHeight;
+ it->planeRect.right = (it->planeRect.right * screenRect.width()) / _scriptsRunningWidth;
// We get negative left in kq7 in scrolling rooms
if (it->planeRect.left < 0) {
@@ -132,9 +134,14 @@ void GfxFrameout::kernelUpdatePlane(reg_t object) {
} else {
it->planeOffsetX = 0;
}
-
- if (it->planeRect.top < 0)
+
+ if (it->planeRect.top < 0) {
+ it->planeOffsetY = -it->planeRect.top;
it->planeRect.top = 0;
+ } else {
+ it->planeOffsetY = 0;
+ }
+
// We get bad plane-bottom in sq6
if (it->planeRect.right > _screen->getWidth())
it->planeRect.right = _screen->getWidth();
@@ -170,10 +177,6 @@ void GfxFrameout::kernelUpdatePlane(reg_t object) {
error("kUpdatePlane called on plane that wasn't added before");
}
-void GfxFrameout::kernelRepaintPlane(reg_t object) {
- // TODO
-}
-
void GfxFrameout::kernelDeletePlane(reg_t object) {
deletePlanePictures(object);
for (PlaneList::iterator it = _planes.begin(); it != _planes.end(); it++) {
@@ -182,15 +185,18 @@ void GfxFrameout::kernelDeletePlane(reg_t object) {
Common::Rect planeRect;
planeRect.top = readSelectorValue(_segMan, object, SELECTOR(top));
planeRect.left = readSelectorValue(_segMan, object, SELECTOR(left));
- planeRect.bottom = readSelectorValue(_segMan, object, SELECTOR(bottom)) + 1;
- planeRect.right = readSelectorValue(_segMan, object, SELECTOR(right)) + 1;
+ planeRect.bottom = readSelectorValue(_segMan, object, SELECTOR(bottom));
+ planeRect.right = readSelectorValue(_segMan, object, SELECTOR(right));
Common::Rect screenRect(_screen->getWidth(), _screen->getHeight());
- planeRect.top = (planeRect.top * screenRect.height()) / scriptsRunningHeight;
- planeRect.left = (planeRect.left * screenRect.width()) / scriptsRunningWidth;
- planeRect.bottom = (planeRect.bottom * screenRect.height()) / scriptsRunningHeight;
- planeRect.right = (planeRect.right * screenRect.width()) / scriptsRunningWidth;
+ planeRect.top = (planeRect.top * screenRect.height()) / _scriptsRunningHeight;
+ planeRect.left = (planeRect.left * screenRect.width()) / _scriptsRunningWidth;
+ planeRect.bottom = (planeRect.bottom * screenRect.height()) / _scriptsRunningHeight;
+ planeRect.right = (planeRect.right * screenRect.width()) / _scriptsRunningWidth;
planeRect.clip(screenRect); // we need to do this, at least in gk1 on cemetary we get bottom right -> 201, 321
+ // FIXME: The code above incorrectly added 1 pixel to the plane's
+ // bottom and right, so probably the plane clipping code is no
+ // longer necessary
// Blackout removed plane rect
_paint32->fillRect(planeRect, 0);
return;
@@ -239,36 +245,45 @@ void GfxFrameout::kernelUpdateScreenItem(reg_t object) {
if (!_segMan->isObject(object))
return;
- for (FrameoutList::iterator listIterator = _screenItems.begin(); listIterator != _screenItems.end(); listIterator++) {
- FrameoutEntry *itemEntry = *listIterator;
-
- if (itemEntry->object == object) {
- itemEntry->viewId = readSelectorValue(_segMan, object, SELECTOR(view));
- itemEntry->loopNo = readSelectorValue(_segMan, object, SELECTOR(loop));
- itemEntry->celNo = readSelectorValue(_segMan, object, SELECTOR(cel));
- itemEntry->x = readSelectorValue(_segMan, object, SELECTOR(x));
- itemEntry->y = readSelectorValue(_segMan, object, SELECTOR(y));
- itemEntry->z = readSelectorValue(_segMan, object, SELECTOR(z));
- itemEntry->priority = readSelectorValue(_segMan, object, SELECTOR(priority));
- if (readSelectorValue(_segMan, object, SELECTOR(fixPriority)) == 0)
- itemEntry->priority = itemEntry->y;
-
- itemEntry->signal = readSelectorValue(_segMan, object, SELECTOR(signal));
- itemEntry->scaleX = readSelectorValue(_segMan, object, SELECTOR(scaleX));
- itemEntry->scaleY = readSelectorValue(_segMan, object, SELECTOR(scaleY));
- return;
- }
+ FrameoutEntry *itemEntry = findScreenItem(object);
+ if (!itemEntry) {
+ warning("kernelUpdateScreenItem: invalid object %04x:%04x", PRINT_REG(object));
+ return;
}
+
+ itemEntry->viewId = readSelectorValue(_segMan, object, SELECTOR(view));
+ itemEntry->loopNo = readSelectorValue(_segMan, object, SELECTOR(loop));
+ itemEntry->celNo = readSelectorValue(_segMan, object, SELECTOR(cel));
+ itemEntry->x = readSelectorValue(_segMan, object, SELECTOR(x));
+ itemEntry->y = readSelectorValue(_segMan, object, SELECTOR(y));
+ itemEntry->z = readSelectorValue(_segMan, object, SELECTOR(z));
+ itemEntry->priority = readSelectorValue(_segMan, object, SELECTOR(priority));
+ if (readSelectorValue(_segMan, object, SELECTOR(fixPriority)) == 0)
+ itemEntry->priority = itemEntry->y;
+
+ itemEntry->signal = readSelectorValue(_segMan, object, SELECTOR(signal));
+ itemEntry->scaleX = readSelectorValue(_segMan, object, SELECTOR(scaleX));
+ itemEntry->scaleY = readSelectorValue(_segMan, object, SELECTOR(scaleY));
}
void GfxFrameout::kernelDeleteScreenItem(reg_t object) {
+ FrameoutEntry *itemEntry = findScreenItem(object);
+ if (!itemEntry) {
+ warning("kernelDeleteScreenItem: invalid object %04x:%04x", PRINT_REG(object));
+ return;
+ }
+
+ _screenItems.remove(itemEntry);
+}
+
+FrameoutEntry *GfxFrameout::findScreenItem(reg_t object) {
for (FrameoutList::iterator listIterator = _screenItems.begin(); listIterator != _screenItems.end(); listIterator++) {
FrameoutEntry *itemEntry = *listIterator;
- if (itemEntry->object == object) {
- _screenItems.remove(itemEntry);
- return;
- }
+ if (itemEntry->object == object)
+ return itemEntry;
}
+
+ return NULL;
}
int16 GfxFrameout::kernelGetHighPlanePri() {
@@ -317,37 +332,149 @@ void GfxFrameout::sortPlanes() {
Common::sort(_planes.begin(), _planes.end(), planeSortHelper);
}
-void GfxFrameout::kernelFrameout() {
- if (g_sci->_robotDecoder->isVideoLoaded()) {
- bool skipVideo = false;
- RobotDecoder *videoDecoder = g_sci->_robotDecoder;
- uint16 x = videoDecoder->getPos().x;
- uint16 y = videoDecoder->getPos().y;
+int16 GfxFrameout::upscaleHorizontalCoordinate(int16 coordinate) {
+ return ((coordinate * _screen->getWidth()) / _scriptsRunningWidth);
+}
+
+int16 GfxFrameout::upscaleVerticalCoordinate(int16 coordinate) {
+ return ((coordinate * _screen->getHeight()) / _scriptsRunningHeight);
+}
- if (videoDecoder->hasDirtyPalette())
- videoDecoder->setSystemPalette();
+Common::Rect GfxFrameout::upscaleRect(Common::Rect &rect) {
+ rect.top = (rect.top * _scriptsRunningHeight) / _screen->getHeight();
+ rect.left = (rect.left * _scriptsRunningWidth) / _screen->getWidth();
+ rect.bottom = (rect.bottom * _scriptsRunningHeight) / _screen->getHeight();
+ rect.right = (rect.right * _scriptsRunningWidth) / _screen->getWidth();
- while (!g_engine->shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) {
- if (videoDecoder->needsUpdate()) {
- const Graphics::Surface *frame = videoDecoder->decodeNextFrame();
- if (frame) {
- g_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h);
+ return rect;
+}
- if (videoDecoder->hasDirtyPalette())
- videoDecoder->setSystemPalette();
+void GfxFrameout::showVideo() {
+ bool skipVideo = false;
+ RobotDecoder *videoDecoder = g_sci->_robotDecoder;
+ uint16 x = videoDecoder->getPos().x;
+ uint16 y = videoDecoder->getPos().y;
- g_system->updateScreen();
- }
+ if (videoDecoder->hasDirtyPalette())
+ videoDecoder->setSystemPalette();
+
+ while (!g_engine->shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) {
+ if (videoDecoder->needsUpdate()) {
+ const Graphics::Surface *frame = videoDecoder->decodeNextFrame();
+ if (frame) {
+ g_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h);
+
+ if (videoDecoder->hasDirtyPalette())
+ videoDecoder->setSystemPalette();
+
+ g_system->updateScreen();
}
+ }
+
+ Common::Event event;
+ while (g_system->getEventManager()->pollEvent(event)) {
+ if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) || event.type == Common::EVENT_LBUTTONUP)
+ skipVideo = true;
+ }
- Common::Event event;
- while (g_system->getEventManager()->pollEvent(event)) {
- if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) || event.type == Common::EVENT_LBUTTONUP)
- skipVideo = true;
+ g_system->delayMillis(10);
+ }
+}
+
+void GfxFrameout::createPlaneItemList(reg_t planeObject, FrameoutList &itemList) {
+ // Copy screen items of the current frame to the list of items to be drawn
+ for (FrameoutList::iterator listIterator = _screenItems.begin(); listIterator != _screenItems.end(); listIterator++) {
+ reg_t itemPlane = readSelector(_segMan, (*listIterator)->object, SELECTOR(plane));
+ if (planeObject == itemPlane) {
+ kernelUpdateScreenItem((*listIterator)->object); // TODO: Why is this necessary?
+ itemList.push_back(*listIterator);
+ }
+ }
+
+ for (PlanePictureList::iterator pictureIt = _planePictures.begin(); pictureIt != _planePictures.end(); pictureIt++) {
+ if (pictureIt->object == planeObject) {
+ GfxPicture *planePicture = pictureIt->picture;
+ // Allocate memory for picture cels
+ pictureIt->pictureCels = new FrameoutEntry[planePicture->getSci32celCount()];
+
+ // Add following cels to the itemlist
+ FrameoutEntry *picEntry = pictureIt->pictureCels;
+ int planePictureCels = planePicture->getSci32celCount();
+ for (int pictureCelNr = 0; pictureCelNr < planePictureCels; pictureCelNr++) {
+ picEntry->celNo = pictureCelNr;
+ picEntry->object = NULL_REG;
+ picEntry->picture = planePicture;
+ picEntry->y = planePicture->getSci32celY(pictureCelNr);
+ picEntry->x = planePicture->getSci32celX(pictureCelNr);
+ picEntry->picStartX = pictureIt->startX;
+ picEntry->picStartY = pictureIt->startY;
+
+ picEntry->priority = planePicture->getSci32celPriority(pictureCelNr);
+
+ itemList.push_back(picEntry);
+ picEntry++;
}
+ }
+ }
+
+ // Now sort our itemlist
+ Common::sort(itemList.begin(), itemList.end(), sortHelper);
+}
- g_system->delayMillis(10);
+bool GfxFrameout::isPictureOutOfView(FrameoutEntry *itemEntry, Common::Rect planeRect, int16 planeOffsetX, int16 planeOffsetY) {
+ // Out of view horizontally (sanity checks)
+ int16 pictureCelStartX = itemEntry->picStartX + itemEntry->x;
+ int16 pictureCelEndX = pictureCelStartX + itemEntry->picture->getSci32celWidth(itemEntry->celNo);
+ int16 planeStartX = planeOffsetX;
+ int16 planeEndX = planeStartX + planeRect.width();
+ if (pictureCelEndX < planeStartX)
+ return true;
+ if (pictureCelStartX > planeEndX)
+ return true;
+
+ // Out of view vertically (sanity checks)
+ int16 pictureCelStartY = itemEntry->picStartY + itemEntry->y;
+ int16 pictureCelEndY = pictureCelStartY + itemEntry->picture->getSci32celHeight(itemEntry->celNo);
+ int16 planeStartY = planeOffsetY;
+ int16 planeEndY = planeStartY + planeRect.height();
+ if (pictureCelEndY < planeStartY)
+ return true;
+ if (pictureCelStartY > planeEndY)
+ return true;
+
+ return false;
+}
+
+void GfxFrameout::drawPicture(FrameoutEntry *itemEntry, int16 planeOffsetX, int16 planeOffsetY, bool planePictureMirrored) {
+ int16 pictureOffsetX = planeOffsetX;
+ int16 pictureX = itemEntry->x;
+ if ((planeOffsetX) || (itemEntry->picStartX)) {
+ if (planeOffsetX <= itemEntry->picStartX) {
+ pictureX += itemEntry->picStartX - planeOffsetX;
+ pictureOffsetX = 0;
+ } else {
+ pictureOffsetX = planeOffsetX - itemEntry->picStartX;
+ }
+ }
+
+ int16 pictureOffsetY = planeOffsetY;
+ int16 pictureY = itemEntry->y;
+ if ((planeOffsetY) || (itemEntry->picStartY)) {
+ if (planeOffsetY <= itemEntry->picStartY) {
+ pictureY += itemEntry->picStartY - planeOffsetY;
+ pictureOffsetY = 0;
+ } else {
+ pictureOffsetY = planeOffsetY - itemEntry->picStartY;
}
+ }
+
+ itemEntry->picture->drawSci32Vga(itemEntry->celNo, pictureX, itemEntry->y, pictureOffsetX, pictureOffsetY, planePictureMirrored);
+ // warning("picture cel %d %d", itemEntry->celNo, itemEntry->priority);
+}
+
+void GfxFrameout::kernelFrameout() {
+ if (g_sci->_robotDecoder->isVideoLoaded()) {
+ showVideo();
return;
}
@@ -368,7 +495,10 @@ void GfxFrameout::kernelFrameout() {
continue;
}
- if (it->planeBack)
+ // There is a race condition lurking in SQ6, which causes the game to hang in the intro, when teleporting to Polysorbate LX.
+ // Since I first wrote the patch, the race has stopped occurring for me though.
+ // I'll leave this for investigation later, when someone can reproduce.
+ if (it->pictureId == 0xffff)
_paint32->fillRect(it->planeRect, it->planeBack);
GuiResourceId planeMainPictureId = it->pictureId;
@@ -378,43 +508,7 @@ void GfxFrameout::kernelFrameout() {
FrameoutList itemList;
- // Copy screen items of the current frame to the list of items to be drawn
- for (FrameoutList::iterator listIterator = _screenItems.begin(); listIterator != _screenItems.end(); listIterator++) {
- reg_t itemPlane = readSelector(_segMan, (*listIterator)->object, SELECTOR(plane));
- if (planeObject == itemPlane) {
- kernelUpdateScreenItem((*listIterator)->object); // TODO: Why is this necessary?
- itemList.push_back(*listIterator);
- }
- }
-
- for (PlanePictureList::iterator pictureIt = _planePictures.begin(); pictureIt != _planePictures.end(); pictureIt++) {
- if (pictureIt->object == planeObject) {
- GfxPicture *planePicture = pictureIt->picture;
- // Allocate memory for picture cels
- pictureIt->pictureCels = new FrameoutEntry[planePicture->getSci32celCount()];
-
- // Add following cels to the itemlist
- FrameoutEntry *picEntry = pictureIt->pictureCels;
- int planePictureCels = planePicture->getSci32celCount();
- for (int pictureCelNr = 0; pictureCelNr < planePictureCels; pictureCelNr++) {
- picEntry->celNo = pictureCelNr;
- picEntry->object = NULL_REG;
- picEntry->picture = planePicture;
- picEntry->y = planePicture->getSci32celY(pictureCelNr);
- picEntry->x = planePicture->getSci32celX(pictureCelNr);
- picEntry->picStartX = pictureIt->startX;
- picEntry->picStartY = pictureIt->startY;
-
- picEntry->priority = planePicture->getSci32celPriority(pictureCelNr);
-
- itemList.push_back(picEntry);
- picEntry++;
- }
- }
- }
-
- // Now sort our itemlist
- Common::sort(itemList.begin(), itemList.end(), sortHelper);
+ createPlaneItemList(planeObject, itemList);
// warning("Plane %s", _segMan->getObjectName(planeObject));
@@ -423,100 +517,76 @@ void GfxFrameout::kernelFrameout() {
if (itemEntry->object.isNull()) {
// Picture cel data
- 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 horizontally (sanity checks)
- int16 pictureCelStartX = itemEntry->picStartX + itemEntry->x;
- int16 pictureCelEndX = pictureCelStartX + itemEntry->picture->getSci32celWidth(itemEntry->celNo);
- int16 planeStartX = it->planeOffsetX;
- int16 planeEndX = planeStartX + it->planeRect.width();
- if (pictureCelEndX < planeStartX)
- continue;
- if (pictureCelStartX > planeEndX)
- continue;
-
- // Out of view vertically (sanity checks)
- // TODO
-
- int16 pictureOffsetX = it->planeOffsetX;
- int16 pictureX = itemEntry->x;
- if ((it->planeOffsetX) || (itemEntry->picStartX)) {
- if (it->planeOffsetX <= itemEntry->picStartX) {
- pictureX += itemEntry->picStartX - it->planeOffsetX;
- pictureOffsetX = 0;
- } else {
- pictureOffsetX = it->planeOffsetX - itemEntry->picStartX;
- }
- }
-
- // TODO: pictureOffsetY
- itemEntry->picture->drawSci32Vga(itemEntry->celNo, pictureX, itemEntry->y, pictureOffsetX, it->planePictureMirrored);
-// warning("picture cel %d %d", itemEntry->celNo, itemEntry->priority);
-
- } else if (itemEntry->viewId != 0xFFFF) {
- GfxView *view = _cache->getView(itemEntry->viewId);
-
-// warning("view %s %04x:%04x", _segMan->getObjectName(itemEntry->object), PRINT_REG(itemEntry->object));
+ itemEntry->x = upscaleHorizontalCoordinate(itemEntry->x);
+ itemEntry->y = upscaleVerticalCoordinate(itemEntry->y);
+ itemEntry->picStartX = upscaleHorizontalCoordinate(itemEntry->picStartX);
+ itemEntry->picStartY = upscaleVerticalCoordinate(itemEntry->picStartY);
-
- if (view->isSci2Hires()) {
+ if (!isPictureOutOfView(itemEntry, it->planeRect, it->planeOffsetX, it->planeOffsetY))
+ drawPicture(itemEntry, it->planeOffsetX, it->planeOffsetY, it->planePictureMirrored);
+ } else {
+ GfxView *view = (itemEntry->viewId != 0xFFFF) ? _cache->getView(itemEntry->viewId) : NULL;
+
+ if (view && view->isSci2Hires()) {
int16 dummyX = 0;
view->adjustToUpscaledCoordinates(itemEntry->y, itemEntry->x);
view->adjustToUpscaledCoordinates(itemEntry->z, dummyX);
} else if (getSciVersion() == SCI_VERSION_2_1) {
- itemEntry->y = (itemEntry->y * _screen->getHeight()) / scriptsRunningHeight;
- itemEntry->x = (itemEntry->x * _screen->getWidth()) / scriptsRunningWidth;
- itemEntry->z = (itemEntry->z * _screen->getHeight()) / scriptsRunningHeight;
+ itemEntry->x = upscaleHorizontalCoordinate(itemEntry->x);
+ itemEntry->y = upscaleVerticalCoordinate(itemEntry->y);
+ itemEntry->z = upscaleVerticalCoordinate(itemEntry->z);
}
// Adjust according to current scroll position
itemEntry->x -= it->planeOffsetX;
+ itemEntry->y -= it->planeOffsetY;
uint16 useInsetRect = readSelectorValue(_segMan, itemEntry->object, SELECTOR(useInsetRect));
if (useInsetRect) {
itemEntry->celRect.top = readSelectorValue(_segMan, itemEntry->object, SELECTOR(inTop));
itemEntry->celRect.left = readSelectorValue(_segMan, itemEntry->object, SELECTOR(inLeft));
- itemEntry->celRect.bottom = readSelectorValue(_segMan, itemEntry->object, SELECTOR(inBottom)) + 1;
- itemEntry->celRect.right = readSelectorValue(_segMan, itemEntry->object, SELECTOR(inRight)) + 1;
- if (view->isSci2Hires()) {
+ itemEntry->celRect.bottom = readSelectorValue(_segMan, itemEntry->object, SELECTOR(inBottom));
+ itemEntry->celRect.right = readSelectorValue(_segMan, itemEntry->object, SELECTOR(inRight));
+ if (view && view->isSci2Hires()) {
view->adjustToUpscaledCoordinates(itemEntry->celRect.top, itemEntry->celRect.left);
view->adjustToUpscaledCoordinates(itemEntry->celRect.bottom, itemEntry->celRect.right);
}
itemEntry->celRect.translate(itemEntry->x, itemEntry->y);
// TODO: maybe we should clip the cels rect with this, i'm not sure
// the only currently known usage is game menu of gk1
- } else {
- if ((itemEntry->scaleX == 128) && (itemEntry->scaleY == 128))
- view->getCelRect(itemEntry->loopNo, itemEntry->celNo, itemEntry->x, itemEntry->y, itemEntry->z, itemEntry->celRect);
- else
- view->getCelScaledRect(itemEntry->loopNo, itemEntry->celNo, itemEntry->x, itemEntry->y, itemEntry->z, itemEntry->scaleX, itemEntry->scaleY, itemEntry->celRect);
+ } else if (view) {
+ if ((itemEntry->scaleX == 128) && (itemEntry->scaleY == 128))
+ view->getCelRect(itemEntry->loopNo, itemEntry->celNo,
+ itemEntry->x, itemEntry->y, itemEntry->z, itemEntry->celRect);
+ else
+ view->getCelScaledRect(itemEntry->loopNo, itemEntry->celNo,
+ itemEntry->x, itemEntry->y, itemEntry->z, itemEntry->scaleX,
+ itemEntry->scaleY, itemEntry->celRect);
Common::Rect nsRect = itemEntry->celRect;
// Translate back to actual coordinate within scrollable plane
- nsRect.translate(it->planeOffsetX, 0);
+ nsRect.translate(it->planeOffsetX, it->planeOffsetY);
- if (view->isSci2Hires()) {
+ if (view && view->isSci2Hires()) {
view->adjustBackUpscaledCoordinates(nsRect.top, nsRect.left);
view->adjustBackUpscaledCoordinates(nsRect.bottom, nsRect.right);
} else if (getSciVersion() == SCI_VERSION_2_1) {
- nsRect.top = (nsRect.top * scriptsRunningHeight) / _screen->getHeight();
- nsRect.left = (nsRect.left * scriptsRunningWidth) / _screen->getWidth();
- nsRect.bottom = (nsRect.bottom * scriptsRunningHeight) / _screen->getHeight();
- nsRect.right = (nsRect.right * scriptsRunningWidth) / _screen->getWidth();
+ nsRect = upscaleRect(nsRect);
}
- writeSelectorValue(_segMan, itemEntry->object, SELECTOR(nsLeft), nsRect.left);
- writeSelectorValue(_segMan, itemEntry->object, SELECTOR(nsTop), nsRect.top);
- writeSelectorValue(_segMan, itemEntry->object, SELECTOR(nsRight), nsRect.right);
- writeSelectorValue(_segMan, itemEntry->object, SELECTOR(nsBottom), nsRect.bottom);
+ if (g_sci->getGameId() == GID_PHANTASMAGORIA2) {
+ // HACK: Some (?) objects in Phantasmagoria 2 have no NS rect. Skip them for now.
+ // TODO: Remove once we figure out how Phantasmagoria 2 draws objects on screen.
+ if (lookupSelector(_segMan, itemEntry->object, SELECTOR(nsLeft), NULL, NULL) != kSelectorVariable)
+ continue;
+ }
+
+ g_sci->_gfxCompare->setNSRect(itemEntry->object, nsRect);
}
int16 screenHeight = _screen->getHeight();
int16 screenWidth = _screen->getWidth();
- if (view->isSci2Hires()) {
+ if (view && view->isSci2Hires()) {
screenHeight = _screen->getDisplayHeight();
screenWidth = _screen->getDisplayWidth();
}
@@ -529,7 +599,8 @@ void GfxFrameout::kernelFrameout() {
Common::Rect clipRect, translatedClipRect;
clipRect = itemEntry->celRect;
- if (view->isSci2Hires()) {
+
+ if (view && view->isSci2Hires()) {
clipRect.clip(it->upscaledPlaneClipRect);
translatedClipRect = clipRect;
translatedClipRect.translate(it->upscaledPlaneRect.left, it->upscaledPlaneRect.top);
@@ -539,33 +610,20 @@ void GfxFrameout::kernelFrameout() {
translatedClipRect.translate(it->planeRect.left, it->planeRect.top);
}
- if (!clipRect.isEmpty()) {
- if ((itemEntry->scaleX == 128) && (itemEntry->scaleY == 128))
- view->draw(itemEntry->celRect, clipRect, translatedClipRect, itemEntry->loopNo, itemEntry->celNo, 255, 0, view->isSci2Hires());
- else
- view->drawScaled(itemEntry->celRect, clipRect, translatedClipRect, itemEntry->loopNo, itemEntry->celNo, 255, itemEntry->scaleX, itemEntry->scaleY);
- }
- } else {
- // Most likely a text entry
- if (lookupSelector(_segMan, itemEntry->object, SELECTOR(text), NULL, NULL) == kSelectorVariable) {
- 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;
-
- // Upscale the coordinates/width if the fonts are already upscaled
- if (_screen->fontIsUpscaled()) {
- startX = startX * _screen->getDisplayWidth() / _screen->getWidth();
- startY = startY * _screen->getDisplayHeight() / _screen->getHeight();
- w = w * _screen->getDisplayWidth() / _screen->getWidth();
+ if (view) {
+ if (!clipRect.isEmpty()) {
+ if ((itemEntry->scaleX == 128) && (itemEntry->scaleY == 128))
+ view->draw(itemEntry->celRect, clipRect, translatedClipRect,
+ itemEntry->loopNo, itemEntry->celNo, 255, 0, view->isSci2Hires());
+ else
+ view->drawScaled(itemEntry->celRect, clipRect, translatedClipRect,
+ itemEntry->loopNo, itemEntry->celNo, 255, itemEntry->scaleX, itemEntry->scaleY);
}
+ }
- g_sci->_gfxText32->drawTextBitmap(itemEntry->object, startX, startY, w);
+ // Draw text, if it exists
+ if (lookupSelector(_segMan, itemEntry->object, SELECTOR(text), NULL, NULL) == kSelectorVariable) {
+ g_sci->_gfxText32->drawTextBitmap(itemEntry->x, itemEntry->y, it->planeRect, itemEntry->object);
}
}
}
diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h
index d2c8086f5f..a4a0a853e4 100644
--- a/engines/sci/graphics/frameout.h
+++ b/engines/sci/graphics/frameout.h
@@ -32,6 +32,7 @@ struct PlaneEntry {
uint16 priority;
uint16 lastPriority;
int16 planeOffsetX;
+ int16 planeOffsetY;
GuiResourceId pictureId;
Common::Rect planeRect;
Common::Rect planeClipRect;
@@ -89,11 +90,11 @@ public:
void kernelAddPlane(reg_t object);
void kernelUpdatePlane(reg_t object);
- void kernelRepaintPlane(reg_t object);
void kernelDeletePlane(reg_t object);
void kernelAddScreenItem(reg_t object);
void kernelUpdateScreenItem(reg_t object);
void kernelDeleteScreenItem(reg_t object);
+ FrameoutEntry *findScreenItem(reg_t object);
int16 kernelGetHighPlanePri();
void kernelAddPicAt(reg_t planeObj, GuiResourceId pictureId, int16 pictureX, int16 pictureY);
void kernelFrameout();
@@ -103,6 +104,14 @@ public:
void clear();
private:
+ void showVideo();
+ void createPlaneItemList(reg_t planeObject, FrameoutList &itemList);
+ bool isPictureOutOfView(FrameoutEntry *itemEntry, Common::Rect planeRect, int16 planeOffsetX, int16 planeOffsetY);
+ void drawPicture(FrameoutEntry *itemEntry, int16 planeOffsetX, int16 planeOffsetY, bool planePictureMirrored);
+ int16 upscaleHorizontalCoordinate(int16 coordinate);
+ int16 upscaleVerticalCoordinate(int16 coordinate);
+ Common::Rect upscaleRect(Common::Rect &rect);
+
SegManager *_segMan;
ResourceManager *_resMan;
GfxCoordAdjuster32 *_coordAdjuster;
@@ -117,8 +126,8 @@ private:
void sortPlanes();
- uint16 scriptsRunningWidth;
- uint16 scriptsRunningHeight;
+ uint16 _scriptsRunningWidth;
+ uint16 _scriptsRunningHeight;
};
} // End of namespace Sci
diff --git a/engines/sci/graphics/paint.h b/engines/sci/graphics/paint.h
index efeaa38875..27f7e428b6 100644
--- a/engines/sci/graphics/paint.h
+++ b/engines/sci/graphics/paint.h
@@ -23,8 +23,6 @@
#ifndef SCI_GRAPHICS_PAINT_H
#define SCI_GRAPHICS_PAINT_H
-#include "common/hashmap.h"
-
namespace Sci {
class GfxPaint {
diff --git a/engines/sci/graphics/paint16.cpp b/engines/sci/graphics/paint16.cpp
index 75fef0a3ec..23177dfc7b 100644
--- a/engines/sci/graphics/paint16.cpp
+++ b/engines/sci/graphics/paint16.cpp
@@ -467,9 +467,9 @@ void GfxPaint16::kernelGraphRedrawBox(Common::Rect rect) {
#define SCI_DISPLAY_WIDTH 106
#define SCI_DISPLAY_SAVEUNDER 107
#define SCI_DISPLAY_RESTOREUNDER 108
-#define SCI_DISPLAY_DUMMY1 114 // used in longbow demo/qfg1 ega demo, not supported in sierra sci - no parameters
-#define SCI_DISPLAY_DUMMY2 115 // used in longbow demo, not supported in sierra sci - has 1 parameter
-#define SCI_DISPLAY_DUMMY3 117 // used in qfg1 ega demo, not supported in sierra sci - no parameters
+#define SCI_DISPLAY_DUMMY1 114
+#define SCI_DISPLAY_DUMMY2 115
+#define SCI_DISPLAY_DUMMY3 117
#define SCI_DISPLAY_DONTSHOWBITS 121
reg_t GfxPaint16::kernelDisplay(const char *text, int argc, reg_t *argv) {
@@ -539,26 +539,29 @@ reg_t GfxPaint16::kernelDisplay(const char *text, int argc, reg_t *argv) {
bRedraw = 0;
break;
- // 2 Dummy functions, longbow-demo is using those several times but sierra sci doesn't support them at all
- // The Quest for Glory 1 EGA demo also calls kDisplay(114) and kDisplay(117)
- case SCI_DISPLAY_DUMMY1:
- case SCI_DISPLAY_DUMMY2:
- case SCI_DISPLAY_DUMMY3:
- if (!g_sci->isDemo() || (g_sci->getGameId() != GID_LONGBOW && g_sci->getGameId() != GID_QFG1))
+ // The following three dummy calls are not supported by the Sierra SCI
+ // interpreter, but are erroneously called in some game scripts.
+ case SCI_DISPLAY_DUMMY1: // Longbow demo (all rooms) and QFG1 EGA demo (room 11)
+ case SCI_DISPLAY_DUMMY2: // Longbow demo (all rooms)
+ case SCI_DISPLAY_DUMMY3: // QFG1 EGA demo (room 11) and PQ2 (room 23)
+ if (!(g_sci->getGameId() == GID_LONGBOW && g_sci->isDemo()) &&
+ !(g_sci->getGameId() == GID_QFG1 && g_sci->isDemo()) &&
+ !(g_sci->getGameId() == GID_PQ2))
error("Unknown kDisplay argument %d", displayArg.offset);
+
if (displayArg.offset == SCI_DISPLAY_DUMMY2) {
- if (argc) {
- argc--; argv++;
- } else {
+ if (!argc)
error("No parameter left for kDisplay(115)");
- }
+ argc--; argv++;
}
break;
default:
SciTrackOriginReply originReply;
SciWorkaroundSolution solution = trackOriginAndFindWorkaround(0, kDisplay_workarounds, &originReply);
if (solution.type == WORKAROUND_NONE)
- error("Unknown kDisplay argument (%04x:%04x) from method %s::%s (script %d, localCall %x)", PRINT_REG(displayArg), originReply.objectName.c_str(), originReply.methodName.c_str(), originReply.scriptNr, originReply.localCallOffset);
+ error("Unknown kDisplay argument (%04x:%04x) from method %s::%s (script %d, localCall %x)",
+ PRINT_REG(displayArg), originReply.objectName.c_str(), originReply.methodName.c_str(),
+ originReply.scriptNr, originReply.localCallOffset);
assert(solution.type == WORKAROUND_IGNORE);
break;
}
diff --git a/engines/sci/graphics/paint16.h b/engines/sci/graphics/paint16.h
index 31916599ba..46df203200 100644
--- a/engines/sci/graphics/paint16.h
+++ b/engines/sci/graphics/paint16.h
@@ -25,8 +25,6 @@
#include "sci/graphics/paint.h"
-#include "common/hashmap.h"
-
namespace Sci {
class GfxPorts;
diff --git a/engines/sci/graphics/paint32.h b/engines/sci/graphics/paint32.h
index dd4246c507..66b31de282 100644
--- a/engines/sci/graphics/paint32.h
+++ b/engines/sci/graphics/paint32.h
@@ -25,8 +25,6 @@
#include "sci/graphics/paint.h"
-#include "common/hashmap.h"
-
namespace Sci {
class GfxPorts;
diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp
index 5f703b90e3..47d1647c6c 100644
--- a/engines/sci/graphics/palette.cpp
+++ b/engines/sci/graphics/palette.cpp
@@ -37,7 +37,7 @@
namespace Sci {
-GfxPalette::GfxPalette(ResourceManager *resMan, GfxScreen *screen, bool useMerging)
+GfxPalette::GfxPalette(ResourceManager *resMan, GfxScreen *screen)
: _resMan(resMan), _screen(screen) {
int16 color;
@@ -65,7 +65,14 @@ GfxPalette::GfxPalette(ResourceManager *resMan, GfxScreen *screen, bool useMergi
// the real merging done in earlier games. If we use the copying over, we
// will get issues because some views have marked all colors as being used
// and those will overwrite the current palette in that case
- _useMerging = useMerging;
+ if (getSciVersion() < SCI_VERSION_1_1)
+ _useMerging = true;
+ else if (getSciVersion() == SCI_VERSION_1_1)
+ // there are some games that use inbetween SCI1.1 interpreter, so we have
+ // to detect if the current game is merging or copying
+ _useMerging = _resMan->detectPaletteMergingSci11();
+ else // SCI32
+ _useMerging = false;
palVaryInit();
@@ -327,7 +334,9 @@ bool GfxPalette::insert(Palette *newPalette, Palette *destPalette) {
for (int i = 1; i < 255; i++) {
if (newPalette->colors[i].used) {
- if ((newPalette->colors[i].r != destPalette->colors[i].r) || (newPalette->colors[i].g != destPalette->colors[i].g) || (newPalette->colors[i].b != destPalette->colors[i].b)) {
+ if ((newPalette->colors[i].r != destPalette->colors[i].r) ||
+ (newPalette->colors[i].g != destPalette->colors[i].g) ||
+ (newPalette->colors[i].b != destPalette->colors[i].b)) {
destPalette->colors[i].r = newPalette->colors[i].r;
destPalette->colors[i].g = newPalette->colors[i].g;
destPalette->colors[i].b = newPalette->colors[i].b;
@@ -354,7 +363,9 @@ bool GfxPalette::merge(Palette *newPalette, bool force, bool forceRealMerge) {
// forced palette merging or dest color is not used yet
if (force || (!_sysPalette.colors[i].used)) {
_sysPalette.colors[i].used = newPalette->colors[i].used;
- if ((newPalette->colors[i].r != _sysPalette.colors[i].r) || (newPalette->colors[i].g != _sysPalette.colors[i].g) || (newPalette->colors[i].b != _sysPalette.colors[i].b)) {
+ if ((newPalette->colors[i].r != _sysPalette.colors[i].r) ||
+ (newPalette->colors[i].g != _sysPalette.colors[i].g) ||
+ (newPalette->colors[i].b != _sysPalette.colors[i].b)) {
_sysPalette.colors[i].r = newPalette->colors[i].r;
_sysPalette.colors[i].g = newPalette->colors[i].g;
_sysPalette.colors[i].b = newPalette->colors[i].b;
@@ -367,7 +378,9 @@ bool GfxPalette::merge(Palette *newPalette, bool force, bool forceRealMerge) {
// is the same color already at the same position? -> match it directly w/o lookup
// this fixes games like lsl1demo/sq5 where the same rgb color exists multiple times and where we would
// otherwise match the wrong one (which would result into the pixels affected (or not) by palette changes)
- if ((_sysPalette.colors[i].r == newPalette->colors[i].r) && (_sysPalette.colors[i].g == newPalette->colors[i].g) && (_sysPalette.colors[i].b == newPalette->colors[i].b)) {
+ if ((_sysPalette.colors[i].r == newPalette->colors[i].r) &&
+ (_sysPalette.colors[i].g == newPalette->colors[i].g) &&
+ (_sysPalette.colors[i].b == newPalette->colors[i].b)) {
newPalette->mapping[i] = i;
continue;
}
@@ -696,6 +709,13 @@ bool GfxPalette::palVaryLoadTargetPalette(GuiResourceId resourceId) {
}
void GfxPalette::palVaryInstallTimer() {
+ // Remove any possible leftover palVary timer callbacks.
+ // This happens for example in QFG1VGA, when sleeping at Erana's place
+ // (bug #3439240) - the nighttime to daytime effect clashes with the
+ // scene transition effect, as we load scene images too quickly for
+ // the SCI scripts in that case (also refer to kernelPalVaryInit).
+ palVaryRemoveTimer();
+
int16 ticks = _palVaryTicks > 0 ? _palVaryTicks : 1;
// Call signal increase every [ticks]
g_sci->getTimerManager()->installTimerProc(&palVaryCallback, 1000000 / 60 * ticks, this, "sciPalette");
@@ -953,7 +973,7 @@ void GfxPalette::loadMacIconBarPalette() {
}
bool GfxPalette::colorIsFromMacClut(byte index) {
- return index != 0 && _macClut && (_macClut[index * 3] != 0 || _macClut[index * 3 + 1] != 0 || _macClut[index * 3 + 1] != 0);
+ return index != 0 && _macClut && (_macClut[index * 3] != 0 || _macClut[index * 3 + 1] != 0 || _macClut[index * 3 + 2] != 0);
}
#ifdef ENABLE_SCI32
diff --git a/engines/sci/graphics/palette.h b/engines/sci/graphics/palette.h
index 243420cc47..a9ea1c32de 100644
--- a/engines/sci/graphics/palette.h
+++ b/engines/sci/graphics/palette.h
@@ -36,7 +36,7 @@ class GfxScreen;
*/
class GfxPalette : public Common::Serializable {
public:
- GfxPalette(ResourceManager *resMan, GfxScreen *screen, bool useMerging);
+ GfxPalette(ResourceManager *resMan, GfxScreen *screen);
~GfxPalette();
bool isMerging();
diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp
index dad2b77036..bb326b1d2f 100644
--- a/engines/sci/graphics/picture.cpp
+++ b/engines/sci/graphics/picture.cpp
@@ -77,7 +77,7 @@ void GfxPicture::draw(int16 animationNr, bool mirroredFlag, bool addToFlag, int1
#ifdef ENABLE_SCI32
case 0x0e: // SCI32 VGA picture
_resourceType = SCI_PICTURE_TYPE_SCI32;
- //drawSci32Vga();
+ drawSci32Vga(0, 0, 0, 0, 0, false);
break;
#endif
default:
@@ -132,7 +132,7 @@ void GfxPicture::drawSci11Vga() {
_palette->createFromData(inbuffer + palette_data_ptr, size - palette_data_ptr, &palette);
_palette->set(&palette, true);
- drawCelData(inbuffer, size, cel_headerPos, cel_RlePos, cel_LiteralPos, 0, 0, 0);
+ drawCelData(inbuffer, size, cel_headerPos, cel_RlePos, cel_LiteralPos, 0, 0, 0, 0);
}
// process vector data
@@ -148,18 +148,18 @@ int16 GfxPicture::getSci32celCount() {
return inbuffer[2];
}
-int16 GfxPicture::getSci32celY(int16 celNo) {
+int16 GfxPicture::getSci32celX(int16 celNo) {
byte *inbuffer = _resource->data;
int header_size = READ_SCI11ENDIAN_UINT16(inbuffer);
int cel_headerPos = header_size + 42 * celNo;
- return READ_SCI11ENDIAN_UINT16(inbuffer + cel_headerPos + 40);
+ return READ_SCI11ENDIAN_UINT16(inbuffer + cel_headerPos + 38);
}
-int16 GfxPicture::getSci32celX(int16 celNo) {
+int16 GfxPicture::getSci32celY(int16 celNo) {
byte *inbuffer = _resource->data;
int header_size = READ_SCI11ENDIAN_UINT16(inbuffer);
int cel_headerPos = header_size + 42 * celNo;
- return READ_SCI11ENDIAN_UINT16(inbuffer + cel_headerPos + 38);
+ return READ_SCI11ENDIAN_UINT16(inbuffer + cel_headerPos + 40);
}
int16 GfxPicture::getSci32celWidth(int16 celNo) {
@@ -169,6 +169,14 @@ int16 GfxPicture::getSci32celWidth(int16 celNo) {
return READ_SCI11ENDIAN_UINT16(inbuffer + cel_headerPos + 0);
}
+int16 GfxPicture::getSci32celHeight(int16 celNo) {
+ byte *inbuffer = _resource->data;
+ int header_size = READ_SCI11ENDIAN_UINT16(inbuffer);
+ int cel_headerPos = header_size + 42 * celNo;
+ return READ_SCI11ENDIAN_UINT16(inbuffer + cel_headerPos + 2);
+}
+
+
int16 GfxPicture::getSci32celPriority(int16 celNo) {
byte *inbuffer = _resource->data;
int header_size = READ_SCI11ENDIAN_UINT16(inbuffer);
@@ -176,7 +184,7 @@ int16 GfxPicture::getSci32celPriority(int16 celNo) {
return READ_SCI11ENDIAN_UINT16(inbuffer + cel_headerPos + 36);
}
-void GfxPicture::drawSci32Vga(int16 celNo, int16 drawX, int16 drawY, int16 pictureX, bool mirrored) {
+void GfxPicture::drawSci32Vga(int16 celNo, int16 drawX, int16 drawY, int16 pictureX, int16 pictureY, bool mirrored) {
byte *inbuffer = _resource->data;
int size = _resource->size;
int header_size = READ_SCI11ENDIAN_UINT16(inbuffer);
@@ -216,14 +224,14 @@ void GfxPicture::drawSci32Vga(int16 celNo, int16 drawX, int16 drawY, int16 pictu
cel_RlePos = READ_SCI11ENDIAN_UINT32(inbuffer + cel_headerPos + 24);
cel_LiteralPos = READ_SCI11ENDIAN_UINT32(inbuffer + cel_headerPos + 28);
- drawCelData(inbuffer, size, cel_headerPos, cel_RlePos, cel_LiteralPos, drawX, drawY, pictureX);
+ drawCelData(inbuffer, size, cel_headerPos, cel_RlePos, cel_LiteralPos, drawX, drawY, pictureX, pictureY);
cel_headerPos += 42;
}
#endif
extern void unpackCelData(byte *inBuffer, byte *celBitmap, byte clearColor, int pixelCount, int rlePos, int literalPos, ViewType viewType, uint16 width, bool isMacSci11ViewData);
-void GfxPicture::drawCelData(byte *inbuffer, int size, int headerPos, int rlePos, int literalPos, int16 drawX, int16 drawY, int16 pictureX) {
+void GfxPicture::drawCelData(byte *inbuffer, int size, int headerPos, int rlePos, int literalPos, int16 drawX, int16 drawY, int16 pictureX, int16 pictureY) {
byte *celBitmap = NULL;
byte *ptr = NULL;
byte *headerPtr = inbuffer + headerPos;
@@ -300,10 +308,11 @@ void GfxPicture::drawCelData(byte *inbuffer, int size, int headerPos, int rlePos
Common::Rect displayArea = _coordAdjuster->pictureGetDisplayArea();
+ // Horizontal clipping
uint16 skipCelBitmapPixels = 0;
int16 displayWidth = width;
if (pictureX) {
- // scroll position for picture active, we need to adjust drawX accordingly
+ // horizontal scroll position for picture active, we need to adjust drawX accordingly
drawX -= pictureX;
if (drawX < 0) {
skipCelBitmapPixels = -drawX;
@@ -312,7 +321,21 @@ void GfxPicture::drawCelData(byte *inbuffer, int size, int headerPos, int rlePos
}
}
- if (displayWidth > 0) {
+ // Vertical clipping
+ uint16 skipCelBitmapLines = 0;
+ int16 displayHeight = height;
+ if (pictureY) {
+ // vertical scroll position for picture active, we need to adjust drawY accordingly
+ // TODO: Finish this
+ /*drawY -= pictureY;
+ if (drawY < 0) {
+ skipCelBitmapLines = -drawY;
+ displayHeight -= skipCelBitmapLines;
+ drawY = 0;
+ }*/
+ }
+
+ if (displayWidth > 0 && displayHeight > 0) {
y = displayArea.top + drawY;
lastY = MIN<int16>(height + y, displayArea.bottom);
leftX = displayArea.left + drawX;
@@ -334,6 +357,7 @@ void GfxPicture::drawCelData(byte *inbuffer, int size, int headerPos, int rlePos
ptr = celBitmap;
ptr += skipCelBitmapPixels;
+ ptr += skipCelBitmapLines * width;
if (!_mirroredFlag) {
// Draw bitmap to screen
x = leftX;
@@ -714,7 +738,7 @@ void GfxPicture::drawVectorData(byte *data, int dataSize) {
vectorGetAbsCoordsNoMirror(data, curPos, x, y);
size = READ_LE_UINT16(data + curPos); curPos += 2;
_priority = pic_priority; // set global priority so the cel gets drawn using current priority as well
- drawCelData(data, _resource->size, curPos, curPos + 8, 0, x, y, 0);
+ drawCelData(data, _resource->size, curPos, curPos + 8, 0, x, y, 0, 0);
curPos += size;
break;
case PIC_OPX_EGA_SET_PRIORITY_TABLE:
@@ -757,7 +781,7 @@ void GfxPicture::drawVectorData(byte *data, int dataSize) {
vectorGetAbsCoordsNoMirror(data, curPos, x, y);
size = READ_LE_UINT16(data + curPos); curPos += 2;
_priority = pic_priority; // set global priority so the cel gets drawn using current priority as well
- drawCelData(data, _resource->size, curPos, curPos + 8, 0, x, y, 0);
+ drawCelData(data, _resource->size, curPos, curPos + 8, 0, x, y, 0, 0);
curPos += size;
break;
case PIC_OPX_VGA_PRIORITY_TABLE_EQDIST:
diff --git a/engines/sci/graphics/picture.h b/engines/sci/graphics/picture.h
index 78623d5e09..4f075a6226 100644
--- a/engines/sci/graphics/picture.h
+++ b/engines/sci/graphics/picture.h
@@ -56,15 +56,16 @@ public:
int16 getSci32celY(int16 celNo);
int16 getSci32celX(int16 celNo);
int16 getSci32celWidth(int16 celNo);
+ int16 getSci32celHeight(int16 celNo);
int16 getSci32celPriority(int16 celNo);
- void drawSci32Vga(int16 celNo, int16 callerX, int16 callerY, int16 pictureX, bool mirrored);
+ void drawSci32Vga(int16 celNo, int16 callerX, int16 callerY, int16 pictureX, int16 pictureY, bool mirrored);
#endif
private:
void initData(GuiResourceId resourceId);
void reset();
void drawSci11Vga();
- void drawCelData(byte *inbuffer, int size, int headerPos, int rlePos, int literalPos, int16 drawX, int16 drawY, int16 pictureX);
+ void drawCelData(byte *inbuffer, int size, int headerPos, int rlePos, int literalPos, int16 drawX, int16 drawY, int16 pictureX, int16 pictureY);
void drawVectorData(byte *data, int size);
bool vectorIsNonOpcode(byte pixel);
void vectorGetAbsCoords(byte *data, int &curPos, int16 &x, int16 &y);
diff --git a/engines/sci/graphics/text32.cpp b/engines/sci/graphics/text32.cpp
index 21372f1502..fd6637f313 100644
--- a/engines/sci/graphics/text32.cpp
+++ b/engines/sci/graphics/text32.cpp
@@ -32,169 +32,185 @@
#include "sci/engine/selector.h"
#include "sci/engine/state.h"
#include "sci/graphics/cache.h"
+#include "sci/graphics/compare.h"
#include "sci/graphics/font.h"
#include "sci/graphics/screen.h"
#include "sci/graphics/text32.h"
namespace Sci {
+#define BITMAP_HEADER_SIZE 46
+
+#define SCI_TEXT32_ALIGNMENT_RIGHT -1
+#define SCI_TEXT32_ALIGNMENT_CENTER 1
+#define SCI_TEXT32_ALIGNMENT_LEFT 0
+
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();
-}
+reg_t GfxText32::createTextBitmap(reg_t textObject, uint16 maxWidth, uint16 maxHeight, reg_t prevHunk) {
+ reg_t stringObject = readSelector(_segMan, textObject, SELECTOR(text));
-void GfxText32::createTextBitmap(reg_t textObject) {
- if (_textCache.size() >= MAX_CACHED_TEXTS)
- purgeCache();
+ // 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));
- uint32 textId = (textObject.segment << 16) | textObject.offset;
+ Common::String text = _segMan->getString(stringObject);
+ // HACK: The character offsets of the up and down arrow buttons are off by one
+ // in GK1, for some unknown reason. Fix them here.
+ if (text.size() == 1 && (text[0] == 29 || text[0] == 30)) {
+ text.setChar(text[0] + 1, 0);
+ }
+ GuiResourceId fontId = readSelectorValue(_segMan, textObject, SELECTOR(font));
+ GfxFont *font = _cache->getFont(fontId);
+ bool dimmed = readSelectorValue(_segMan, textObject, SELECTOR(dimmed));
+ int16 alignment = readSelectorValue(_segMan, textObject, SELECTOR(mode));
+ uint16 foreColor = readSelectorValue(_segMan, textObject, SELECTOR(fore));
+ uint16 backColor = readSelectorValue(_segMan, textObject, SELECTOR(back));
+
+ Common::Rect nsRect = g_sci->_gfxCompare->getNSRect(textObject);
+ uint16 width = nsRect.width() + 1;
+ uint16 height = nsRect.height() + 1;
+
+ // Limit rectangle dimensions, if requested
+ if (maxWidth > 0)
+ width = maxWidth;
+ if (maxHeight > 0)
+ height = maxHeight;
+
+ // Upscale the coordinates/width if the fonts are already upscaled
+ if (_screen->fontIsUpscaled()) {
+ width = width * _screen->getDisplayWidth() / _screen->getWidth();
+ height = height * _screen->getDisplayHeight() / _screen->getHeight();
+ }
- if (_textCache.contains(textId)) {
- // Delete the old entry
- TextEntry *oldEntry = _textCache[textId];
- delete[] oldEntry->surface;
- delete oldEntry;
- _textCache.erase(textId);
+ int entrySize = width * height + BITMAP_HEADER_SIZE;
+ reg_t memoryId = NULL_REG;
+ if (prevHunk.isNull()) {
+ memoryId = _segMan->allocateHunkEntry("TextBitmap()", entrySize);
+ writeSelector(_segMan, textObject, SELECTOR(bitmap), memoryId);
+ } else {
+ memoryId = prevHunk;
}
+ byte *memoryPtr = _segMan->getHunkPointer(memoryId);
- _textCache[textId] = createTextEntry(textObject);
-}
+ if (prevHunk.isNull())
+ memset(memoryPtr, 0, BITMAP_HEADER_SIZE);
-// TODO: Finish this!
-void GfxText32::drawTextBitmap(reg_t textObject, uint16 textX, uint16 textY, uint16 w) {
- uint32 textId = (textObject.segment << 16) | textObject.offset;
+ byte *bitmap = memoryPtr + BITMAP_HEADER_SIZE;
+ memset(bitmap, backColor, width * height);
- if (!_textCache.contains(textId))
- createTextBitmap(textObject);
+ // Save totalWidth, totalHeight
+ WRITE_LE_UINT16(memoryPtr, width);
+ WRITE_LE_UINT16(memoryPtr + 2, height);
- TextEntry *entry = _textCache[textId];
+ int16 charCount = 0;
+ uint16 curX = 0, curY = 0;
+ const char *txt = text.c_str();
+ int16 textWidth, textHeight, totalHeight = 0, offsetX = 0, offsetY = 0;
+ uint16 start = 0;
- // 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));
+ // Calculate total text height
+ while (*txt) {
+ charCount = GetLongest(txt, width, font);
+ if (charCount == 0)
+ break;
- const char *txt = entry->text.c_str();
- int16 charCount;
+ Width(txt, 0, (int16)strlen(txt), fontId, textWidth, textHeight, true);
+
+ totalHeight += textHeight;
+ txt += charCount;
+ while (*txt == ' ')
+ txt++; // skip over breaking spaces
+ }
+
+ txt = text.c_str();
+ // Draw text in buffer
while (*txt) {
- charCount = GetLongest(txt, w, font);
+ charCount = GetLongest(txt, width, font);
if (charCount == 0)
break;
+ Width(txt, start, charCount, fontId, textWidth, textHeight, true);
- uint16 curX = textX;
+ switch (alignment) {
+ case SCI_TEXT32_ALIGNMENT_RIGHT:
+ offsetX = width - textWidth;
+ break;
+ case SCI_TEXT32_ALIGNMENT_CENTER:
+ // Center text both horizontally and vertically
+ offsetX = (width - textWidth) / 2;
+ offsetY = (height - totalHeight) / 2;
+ break;
+ case SCI_TEXT32_ALIGNMENT_LEFT:
+ offsetX = 0;
+ break;
+
+ default:
+ warning("Invalid alignment %d used in TextBox()", alignment);
+ }
for (int i = 0; i < charCount; i++) {
unsigned char curChar = txt[i];
- font->draw(curChar, textY, curX, foreColor, dimmed);
+ font->drawToBuffer(curChar, curY + offsetY, curX + offsetX, foreColor, dimmed, bitmap, width, height);
curX += font->getCharWidth(curChar);
}
- textY += font->getHeight();
+ curX = 0;
+ curY += 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);
- }
- }
- */
+ return memoryId;
}
-TextEntry *GfxText32::getTextEntry(reg_t textObject) {
- uint32 textId = (textObject.segment << 16) | textObject.offset;
-
- if (!_textCache.contains(textId))
- createTextBitmap(textObject);
-
- return _textCache[textId];
+void GfxText32::disposeTextBitmap(reg_t hunkId) {
+ _segMan->freeHunkEntry(hunkId);
}
-// TODO: Finish this! Currently buggy.
-TextEntry *GfxText32::createTextEntry(reg_t textObject) {
- reg_t stringObject = readSelector(_segMan, textObject, SELECTOR(text));
+void GfxText32::drawTextBitmap(uint16 x, uint16 y, Common::Rect planeRect, reg_t textObject) {
+ reg_t hunkId = readSelector(_segMan, textObject, SELECTOR(bitmap));
+ // Sanity check: Check if the hunk is set. If not, either the game scripts
+ // didn't set it, or an old saved game has been loaded, where it wasn't set.
+ if (hunkId.isNull())
+ return;
- // 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));
+ byte *memoryPtr = _segMan->getHunkPointer(hunkId);
- 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();
- }
+ if (!memoryPtr)
+ error("Attempt to draw an invalid text bitmap");
- 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;
+ byte *surface = memoryPtr + BITMAP_HEADER_SIZE;
- maxTextWidth = 0;
- while (*text) {
- charCount = GetLongest(text, planeRect.width(), font);
- if (charCount == 0)
- break;
+ int curByte = 0;
+ uint16 skipColor = readSelectorValue(_segMan, textObject, SELECTOR(skip));
+ uint16 textX = planeRect.left + x;
+ uint16 textY = planeRect.top + y;
+ // Get totalWidth, totalHeight
+ uint16 width = READ_LE_UINT16(memoryPtr);
+ uint16 height = READ_LE_UINT16(memoryPtr + 2);
- 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
+ // Upscale the coordinates/width if the fonts are already upscaled
+ if (_screen->fontIsUpscaled()) {
+ textX = textX * _screen->getDisplayWidth() / _screen->getWidth();
+ textY = textY * _screen->getDisplayHeight() / _screen->getHeight();
}
- return newEntry;
+ for (int curY = 0; curY < height; curY++) {
+ for (int curX = 0; curX < width; curX++) {
+ byte pixel = surface[curByte++];
+ if (pixel != skipColor)
+ _screen->putFontPixel(textY, curX + textX, curY, pixel);
+ }
+ }
}
int16 GfxText32::GetLongest(const char *text, int16 maxWidth, GfxFont *font) {
@@ -235,4 +251,77 @@ int16 GfxText32::GetLongest(const char *text, int16 maxWidth, GfxFont *font) {
return maxChars;
}
+void GfxText32::kernelTextSize(const char *text, int16 font, int16 maxWidth, int16 *textWidth, int16 *textHeight) {
+ Common::Rect rect(0, 0, 0, 0);
+ Size(rect, text, font, maxWidth);
+ *textWidth = rect.width();
+ *textHeight = rect.height();
+}
+
+void GfxText32::StringWidth(const char *str, GuiResourceId fontId, int16 &textWidth, int16 &textHeight) {
+ Width(str, 0, (int16)strlen(str), fontId, textWidth, textHeight, true);
+}
+
+void GfxText32::Width(const char *text, int16 from, int16 len, GuiResourceId fontId, int16 &textWidth, int16 &textHeight, bool restoreFont) {
+ uint16 curChar;
+ textWidth = 0; textHeight = 0;
+
+ GfxFont *font = _cache->getFont(fontId);
+
+ if (font) {
+ text += from;
+ while (len--) {
+ curChar = (*(const byte *)text++);
+ switch (curChar) {
+ case 0x0A:
+ case 0x0D:
+ case 0x9781: // this one is used by SQ4/japanese as line break as well
+ textHeight = MAX<int16> (textHeight, font->getHeight());
+ break;
+ case 0x7C:
+ warning("Code processing isn't implemented in SCI32");
+ break;
+ default:
+ textHeight = MAX<int16> (textHeight, font->getHeight());
+ textWidth += font->getCharWidth(curChar);
+ break;
+ }
+ }
+ }
+}
+
+int16 GfxText32::Size(Common::Rect &rect, const char *text, GuiResourceId fontId, int16 maxWidth) {
+ int16 charCount;
+ int16 maxTextWidth = 0, textWidth;
+ int16 totalHeight = 0, textHeight;
+
+ rect.top = rect.left = 0;
+ GfxFont *font = _cache->getFont(fontId);
+
+ if (maxWidth < 0) { // force output as single line
+ StringWidth(text, fontId, textWidth, textHeight);
+ rect.bottom = textHeight;
+ rect.right = textWidth;
+ } else {
+ // rect.right=found widest line with RTextWidth and GetLongest
+ // rect.bottom=num. lines * GetPointSize
+ rect.right = (maxWidth ? maxWidth : 192);
+ const char *curPos = text;
+ while (*curPos) {
+ charCount = GetLongest(curPos, rect.right, font);
+ if (charCount == 0)
+ break;
+ Width(curPos, 0, charCount, fontId, textWidth, textHeight, false);
+ maxTextWidth = MAX(textWidth, maxTextWidth);
+ totalHeight += textHeight;
+ curPos += charCount;
+ while (*curPos == ' ')
+ curPos++; // skip over breaking spaces
+ }
+ rect.bottom = totalHeight;
+ rect.right = maxWidth ? maxWidth : MIN(rect.right, maxTextWidth);
+ }
+ return rect.right;
+}
+
} // End of namespace Sci
diff --git a/engines/sci/graphics/text32.h b/engines/sci/graphics/text32.h
index 39fe710a86..3a411ce663 100644
--- a/engines/sci/graphics/text32.h
+++ b/engines/sci/graphics/text32.h
@@ -26,24 +26,8 @@
#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
*/
@@ -51,18 +35,20 @@ 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);
+ reg_t createTextBitmap(reg_t textObject, uint16 maxWidth = 0, uint16 maxHeight = 0, reg_t prevHunk = NULL_REG);
+ void disposeTextBitmap(reg_t hunkId);
+ void drawTextBitmap(uint16 x, uint16 y, Common::Rect planeRect, reg_t textObject);
int16 GetLongest(const char *text, int16 maxWidth, GfxFont *font);
- TextEntry *getTextEntry(reg_t textObject);
+
+ void kernelTextSize(const char *text, int16 font, int16 maxWidth, int16 *textWidth, int16 *textHeight);
private:
- TextEntry *createTextEntry(reg_t textObject);
- void purgeCache();
+ int16 Size(Common::Rect &rect, const char *text, GuiResourceId fontId, int16 maxWidth);
+ void Width(const char *text, int16 from, int16 len, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight, bool restoreFont);
+ void StringWidth(const char *str, GuiResourceId orgFontId, int16 &textWidth, int16 &textHeight);
SegManager *_segMan;
GfxCache *_cache;
- TextCache _textCache;
GfxScreen *_screen;
};
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index a0d5b51a2b..a77bcccc52 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -172,6 +172,20 @@ void GfxView::initData(GuiResourceId resourceId) {
cel->displaceX = (signed char)celData[4];
cel->displaceY = celData[5];
cel->clearKey = celData[6];
+
+ // HACK: Fix Ego's odd displacement in the QFG3 demo, scene 740.
+ // For some reason, ego jumps above the rope, so we fix his rope
+ // hanging view by displacing it down by 40 pixels. Fixes bug
+ // #3035693.
+ // FIXME: Remove this once we figure out why Ego jumps so high.
+ // Likely culprits include kInitBresen, kDoBresen and kCantBeHere.
+ // The scripts have the y offset that hero reaches (11) hardcoded,
+ // so it might be collision detection. However, since this requires
+ // extensive work to fix properly for very little gain, this hack
+ // here will suffice until the actual issue is found.
+ if (g_sci->getGameId() == GID_QFG3 && g_sci->isDemo() && resourceId == 39)
+ cel->displaceY = 98;
+
if (isEGA) {
cel->offsetEGA = celOffset + 7;
cel->offsetRLE = 0;
@@ -418,10 +432,11 @@ void unpackCelData(byte *inBuffer, byte *celBitmap, byte clearColor, int pixelCo
// Skip the next YYYYY pixels (i.e. transparency)
if (literalPos && isMacSci11ViewData) {
- // KQ6/Freddy Pharkas use byte lengths, all others use uint16
+ // KQ6/Freddy Pharkas/Slater use byte lengths, all others use uint16
// The SCI devs must have realized that a max of 255 pixels wide
// was not very good for 320 or 640 width games.
- bool hasByteLengths = (g_sci->getGameId() == GID_KQ6 || g_sci->getGameId() == GID_FREDDYPHARKAS);
+ bool hasByteLengths = (g_sci->getGameId() == GID_KQ6 || g_sci->getGameId() == GID_FREDDYPHARKAS
+ || g_sci->getGameId() == GID_SLATER);
// compression for SCI1.1+ Mac
while (pixelNr < pixelCount) {
@@ -837,4 +852,13 @@ void GfxView::adjustBackUpscaledCoordinates(int16 &y, int16 &x) {
_screen->adjustBackUpscaledCoordinates(y, x, _sci2ScaleRes);
}
+byte GfxView::getColorAtCoordinate(int16 loopNo, int16 celNo, int16 x, int16 y) {
+ const CelInfo *celInfo = getCelInfo(loopNo, celNo);
+ const byte *bitmap = getBitmap(loopNo, celNo);
+ const int16 celWidth = celInfo->width;
+
+ bitmap += (celWidth * y);
+ return bitmap[x];
+}
+
} // End of namespace Sci
diff --git a/engines/sci/graphics/view.h b/engines/sci/graphics/view.h
index 19ef2e62f8..d3473f1024 100644
--- a/engines/sci/graphics/view.h
+++ b/engines/sci/graphics/view.h
@@ -85,6 +85,8 @@ public:
void adjustToUpscaledCoordinates(int16 &y, int16 &x);
void adjustBackUpscaledCoordinates(int16 &y, int16 &x);
+ byte getColorAtCoordinate(int16 loopNo, int16 celNo, int16 x, int16 y);
+
private:
void initData(GuiResourceId resourceId);
void unpackCel(int16 loopNo, int16 celNo, byte *outPtr, uint32 pixelCount);
diff --git a/engines/sci/module.mk b/engines/sci/module.mk
index c129ae5439..90a0f33f06 100644
--- a/engines/sci/module.mk
+++ b/engines/sci/module.mk
@@ -43,7 +43,7 @@ MODULE_OBJS := \
graphics/animate.o \
graphics/cache.o \
graphics/compare.o \
- graphics/controls.o \
+ graphics/controls16.o \
graphics/coordadjuster.o \
graphics/cursor.o \
graphics/font.o \
@@ -71,6 +71,7 @@ MODULE_OBJS := \
sound/drivers/amigamac.o \
sound/drivers/cms.o \
sound/drivers/fb01.o \
+ sound/drivers/fmtowns.o \
sound/drivers/midi.o \
sound/drivers/pcjr.o \
video/seq_decoder.o
@@ -78,6 +79,7 @@ MODULE_OBJS := \
ifdef ENABLE_SCI32
MODULE_OBJS += \
+ graphics/controls32.o \
graphics/frameout.o \
graphics/paint32.o \
graphics/text32.o \
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index bdd7d6692b..9171e5e5d9 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -169,8 +169,11 @@ ResourceType ResourceManager::convertResType(byte type) {
if (type < ARRAYSIZE(s_resTypeMapSci21)) {
// LSL6 hires doesn't have the chunk resource type, to match
// the resource types of the lowres version, thus we use the
- // older resource types here
- if (g_sci && g_sci->getGameId() == GID_LSL6HIRES)
+ // older resource types here.
+ // PQ4 CD and QFG4 CD are SCI2.1, but use the resource types of the
+ // corresponding SCI2 floppy disk versions.
+ if (g_sci && (g_sci->getGameId() == GID_LSL6HIRES ||
+ g_sci->getGameId() == GID_QFG4 || g_sci->getGameId() == GID_PQ4))
return s_resTypeMapSci0[type];
else
return s_resTypeMapSci21[type];
@@ -2181,15 +2184,16 @@ void ResourceManager::detectSciVersion() {
}
if (_volVersion == kResVersionSci11Mac) {
- // SCI32 doesn't have the resource.cfg file, so we can figure out
- // which of the games are SCI1.1. Note that there are no Mac SCI2 games.
- // Yes, that means that GK1 Mac is SCI2.1 and not SCI2.
+ Resource *res = testResource(ResourceId(kResourceTypeScript, 64920));
+ // Distinguish between SCI1.1 and SCI32 games here. SCI32 games will
+ // always include script 64920 (the Array class). Note that there are
+ // no Mac SCI2 games. Yes, that means that GK1 Mac is SCI2.1 and not SCI2.
// TODO: Decide between SCI2.1 and SCI3
- if (Common::File::exists("resource.cfg"))
- s_sciVersion = SCI_VERSION_1_1;
- else
+ if (res)
s_sciVersion = SCI_VERSION_2_1;
+ else
+ s_sciVersion = SCI_VERSION_1_1;
return;
}
@@ -2354,7 +2358,7 @@ bool ResourceManager::detectFontExtended() {
}
// detects, if SCI1.1 game uses palette merging or copying - this is supposed to only get used on SCI1.1 games
-bool ResourceManager::detectForPaletteMergingForSci11() {
+bool ResourceManager::detectPaletteMergingSci11() {
// Load palette 999 (default palette)
Resource *res = findResource(ResourceId(kResourceTypePalette, 999), false);
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index f450f1b397..47602de017 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -354,7 +354,7 @@ public:
// Detects, if standard font of current game includes extended characters (>0x80)
bool detectFontExtended();
// Detects, if SCI1.1 game uses palette merging
- bool detectForPaletteMergingForSci11();
+ bool detectPaletteMergingSci11();
// Detects, if SCI0EARLY game also has SCI0EARLY sound resources
bool detectEarlySound();
diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp
index f3a3c8dd5b..a3cf1b0c84 100644
--- a/engines/sci/resource_audio.cpp
+++ b/engines/sci/resource_audio.cpp
@@ -915,18 +915,23 @@ bool ResourceManager::addAudioSources() {
void ResourceManager::changeAudioDirectory(Common::String path) {
// Remove all of the audio map resource sources, as well as the audio resource sources
- for (Common::List<ResourceSource *>::iterator it = _sources.begin(); it != _sources.end(); ++it) {
+ for (Common::List<ResourceSource *>::iterator it = _sources.begin(); it != _sources.end();) {
ResourceSource *source = *it;
ResSourceType sourceType = source->getSourceType();
// Remove the resource source, if it's an audio map or an audio file
if (sourceType == kSourceIntMap || sourceType == kSourceAudioVolume) {
// Don't remove 65535.map (the SFX map) or resource.sfx
- if (source->_volumeNumber == 65535 || source->getLocationName() == "RESOURCE.SFX")
+ if (source->_volumeNumber == 65535 || source->getLocationName() == "RESOURCE.SFX") {
+ ++it;
continue;
+ }
+ // erase() will move the iterator to the next element
it = _sources.erase(it);
delete source;
+ } else {
+ ++it;
}
}
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 6c1b6e4dd6..00731fc1cf 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -46,7 +46,8 @@
#include "sci/graphics/animate.h"
#include "sci/graphics/cache.h"
#include "sci/graphics/compare.h"
-#include "sci/graphics/controls.h"
+#include "sci/graphics/controls16.h"
+#include "sci/graphics/controls32.h"
#include "sci/graphics/coordadjuster.h"
#include "sci/graphics/cursor.h"
#include "sci/graphics/maciconbar.h"
@@ -90,6 +91,7 @@ SciEngine::SciEngine(OSystem *syst, const ADGameDescription *desc, SciGameId gam
_vocabularyLanguage = 1; // we load english vocabulary on startup
_eventMan = 0;
_console = 0;
+ _opcode_formats = 0;
// Set up the engine specific debug levels
DebugMan.addDebugChannel(kDebugLevelError, "Error", "Script error debugging");
@@ -113,6 +115,7 @@ SciEngine::SciEngine(OSystem *syst, const ADGameDescription *desc, SciGameId gam
DebugMan.addDebugChannel(kDebugLevelGC, "GC", "Garbage Collector debugging");
DebugMan.addDebugChannel(kDebugLevelResMan, "ResMan", "Resource manager debugging");
DebugMan.addDebugChannel(kDebugLevelOnStartup, "OnStartup", "Enter debugger at start of game");
+ DebugMan.addDebugChannel(kDebugLevelDebugMode, "DebugMode", "Enable game debug mode at start of game");
const Common::FSNode gameDataDir(ConfMan.get("path"));
@@ -147,12 +150,13 @@ SciEngine::~SciEngine() {
DebugMan.clearAllDebugChannels();
#ifdef ENABLE_SCI32
+ delete _gfxControls32;
delete _gfxText32;
delete _robotDecoder;
delete _gfxFrameout;
#endif
delete _gfxMenu;
- delete _gfxControls;
+ delete _gfxControls16;
delete _gfxText16;
delete _gfxAnimate;
delete _gfxPaint;
@@ -176,6 +180,9 @@ SciEngine::~SciEngine() {
delete _eventMan;
delete _gamestate->_segMan;
delete _gamestate;
+
+ delete[] _opcode_formats;
+
delete _resMan; // should be deleted last
g_sci = 0;
}
@@ -588,7 +595,7 @@ void SciEngine::initGraphics() {
_gfxAnimate = 0;
_gfxCache = 0;
_gfxCompare = 0;
- _gfxControls = 0;
+ _gfxControls16 = 0;
_gfxCoordAdjuster = 0;
_gfxCursor = 0;
_gfxMacIconBar = 0;
@@ -600,6 +607,7 @@ void SciEngine::initGraphics() {
_gfxText16 = 0;
_gfxTransitions = 0;
#ifdef ENABLE_SCI32
+ _gfxControls32 = 0;
_gfxText32 = 0;
_robotDecoder = 0;
_gfxFrameout = 0;
@@ -609,16 +617,7 @@ void SciEngine::initGraphics() {
if (hasMacIconBar())
_gfxMacIconBar = new GfxMacIconBar();
- bool paletteMerging = true;
- if (getSciVersion() >= SCI_VERSION_1_1) {
- // there are some games that use inbetween SCI1.1 interpreter, so we have to detect if it's merging or copying
- if (getSciVersion() == SCI_VERSION_1_1)
- paletteMerging = _resMan->detectForPaletteMergingForSci11();
- else
- paletteMerging = false;
- }
-
- _gfxPalette = new GfxPalette(_resMan, _gfxScreen, paletteMerging);
+ _gfxPalette = new GfxPalette(_resMan, _gfxScreen);
_gfxCache = new GfxCache(_resMan, _gfxScreen, _gfxPalette);
_gfxCursor = new GfxCursor(_resMan, _gfxPalette, _gfxScreen);
@@ -631,6 +630,7 @@ void SciEngine::initGraphics() {
_gfxPaint32 = new GfxPaint32(_resMan, _gamestate->_segMan, _kernel, _gfxCoordAdjuster, _gfxCache, _gfxScreen, _gfxPalette);
_gfxPaint = _gfxPaint32;
_gfxText32 = new GfxText32(_gamestate->_segMan, _gfxCache, _gfxScreen);
+ _gfxControls32 = new GfxControls32(_gamestate->_segMan, _gfxCache, _gfxScreen, _gfxText32);
_robotDecoder = new RobotDecoder(g_system->getMixer(), getPlatform() == Common::kPlatformMacintosh);
_gfxFrameout = new GfxFrameout(_gamestate->_segMan, _resMan, _gfxCoordAdjuster, _gfxCache, _gfxScreen, _gfxPalette, _gfxPaint32);
} else {
@@ -645,7 +645,7 @@ void SciEngine::initGraphics() {
_gfxPaint = _gfxPaint16;
_gfxAnimate = new GfxAnimate(_gamestate, _gfxCache, _gfxPorts, _gfxPaint16, _gfxScreen, _gfxPalette, _gfxCursor, _gfxTransitions);
_gfxText16 = new GfxText16(_resMan, _gfxCache, _gfxPorts, _gfxPaint16, _gfxScreen);
- _gfxControls = new GfxControls(_gamestate->_segMan, _gfxPorts, _gfxPaint16, _gfxText16, _gfxScreen);
+ _gfxControls16 = new GfxControls16(_gamestate->_segMan, _gfxPorts, _gfxPaint16, _gfxText16, _gfxScreen);
_gfxMenu = new GfxMenu(_eventMan, _gamestate->_segMan, _gfxPorts, _gfxPaint16, _gfxText16, _gfxScreen, _gfxCursor);
_gfxMenu->reset();
diff --git a/engines/sci/sci.h b/engines/sci/sci.h
index 81bbdc51de..9f18219cb7 100644
--- a/engines/sci/sci.h
+++ b/engines/sci/sci.h
@@ -59,7 +59,8 @@ class SegManager;
class GfxAnimate;
class GfxCache;
class GfxCompare;
-class GfxControls;
+class GfxControls16;
+class GfxControls32;
class GfxCoordAdjuster;
class GfxCursor;
class GfxMacIconBar;
@@ -101,7 +102,8 @@ enum kDebugLevels {
kDebugLevelScripts = 1 << 17,
kDebugLevelGC = 1 << 18,
kDebugLevelResMan = 1 << 19,
- kDebugLevelOnStartup = 1 << 20
+ kDebugLevelOnStartup = 1 << 20,
+ kDebugLevelDebugMode = 1 << 21
};
enum SciGameId {
@@ -303,7 +305,8 @@ public:
GfxAnimate *_gfxAnimate; // Animate for 16-bit gfx
GfxCache *_gfxCache;
GfxCompare *_gfxCompare;
- GfxControls *_gfxControls; // Controls for 16-bit gfx
+ GfxControls16 *_gfxControls16; // Controls for 16-bit gfx
+ GfxControls32 *_gfxControls32; // Controls for 32-bit gfx
GfxCoordAdjuster *_gfxCoordAdjuster;
GfxCursor *_gfxCursor;
GfxMenu *_gfxMenu; // Menu for 16-bit gfx
@@ -327,6 +330,8 @@ public:
SoundCommandParser *_soundCmd;
GameFeatures *_features;
+ opcode_format (*_opcode_formats)[4];
+
DebugState _debugState;
Common::MacResManager *getMacExecutable() { return &_macExecutable; }
diff --git a/engines/sci/sound/drivers/adlib.cpp b/engines/sci/sound/drivers/adlib.cpp
index add3d8851f..db9317e071 100644
--- a/engines/sci/sound/drivers/adlib.cpp
+++ b/engines/sci/sound/drivers/adlib.cpp
@@ -613,8 +613,6 @@ void MidiDriver_AdLib::setNote(int voice, int note, bool key) {
_voices[voice].note = note;
- delta = 0;
-
n = note % 12;
if (bend < 8192)
diff --git a/engines/sci/sound/drivers/amigamac.cpp b/engines/sci/sound/drivers/amigamac.cpp
index 3c750401b9..41697d4a07 100644
--- a/engines/sci/sound/drivers/amigamac.cpp
+++ b/engines/sci/sound/drivers/amigamac.cpp
@@ -130,7 +130,7 @@ private:
};
bool _isSci1;
- bool _isSci1Early; // KQ1 Amiga, patch 5
+ bool _isSci1Early; // KQ1/MUMG Amiga, patch 5
bool _playSwitch;
int _masterVolume;
int _frequency;
@@ -586,12 +586,12 @@ int MidiDriver_AmigaMac::open() {
} else {
ResourceManager *resMan = g_sci->getResMan();
- Resource *resource = resMan->findResource(ResourceId(kResourceTypePatch, 7), false); // Mac
+ Resource *resource = resMan->findResource(ResourceId(kResourceTypePatch, 7), false); // Mac
if (!resource)
- resource = resMan->findResource(ResourceId(kResourceTypePatch, 9), false); // Amiga
+ resource = resMan->findResource(ResourceId(kResourceTypePatch, 9), false); // Amiga
if (!resource) {
- resource = resMan->findResource(ResourceId(kResourceTypePatch, 5), false); // KQ1 Amiga
+ resource = resMan->findResource(ResourceId(kResourceTypePatch, 5), false); // KQ1/MUMG Amiga
if (resource)
_isSci1Early = true;
}
@@ -892,7 +892,7 @@ bool MidiDriver_AmigaMac::loadInstrumentsSCI1(Common::SeekableReadStream &file)
_bank.size = 128;
if (_isSci1Early)
- file.skip(4); // TODO: What is this offset for?
+ file.readUint32BE(); // Skip size of bank
Common::Array<uint32> instrumentOffsets;
instrumentOffsets.resize(_bank.size);
@@ -911,12 +911,6 @@ bool MidiDriver_AmigaMac::loadInstrumentsSCI1(Common::SeekableReadStream &file)
// Read in the instrument name
file.read(_bank.instruments[i].name, 10); // last two bytes are always 0
- // TODO: Finish off support of SCI1 early patches (patch.005 - KQ1 Amiga)
- if (_isSci1Early) {
- warning("Music patch 5 isn't supported yet - ignoring instrument %d", i);
- continue;
- }
-
for (uint32 j = 0; ; j++) {
InstrumentSample *sample = new InstrumentSample;
memset(sample, 0, sizeof(InstrumentSample));
@@ -943,16 +937,30 @@ bool MidiDriver_AmigaMac::loadInstrumentsSCI1(Common::SeekableReadStream &file)
int16 loop = file.readSint16BE();
uint32 nextSamplePos = file.pos();
- file.seek(samplePtr);
+ file.seek(samplePtr + (_isSci1Early ? 4 : 0));
file.read(sample->name, 8);
- sample->isUnsigned = file.readUint16BE() == 0;
- uint16 phase1Offset = file.readUint16BE();
- uint16 phase1End = file.readUint16BE();
- uint16 phase2Offset = file.readUint16BE();
- uint16 phase2End = file.readUint16BE();
- sample->baseNote = file.readUint16BE();
- uint32 periodTableOffset = file.readUint32BE();
+ uint16 phase1Offset, phase1End;
+ uint16 phase2Offset, phase2End;
+
+ if (_isSci1Early) {
+ sample->isUnsigned = false;
+ file.readUint32BE(); // skip total sample size
+ phase2Offset = file.readUint16BE();
+ phase2End = file.readUint16BE();
+ sample->baseNote = file.readUint16BE();
+ phase1Offset = file.readUint16BE();
+ phase1End = file.readUint16BE();
+ } else {
+ sample->isUnsigned = file.readUint16BE() == 0;
+ phase1Offset = file.readUint16BE();
+ phase1End = file.readUint16BE();
+ phase2Offset = file.readUint16BE();
+ phase2End = file.readUint16BE();
+ sample->baseNote = file.readUint16BE();
+ }
+
+ uint32 periodTableOffset = _isSci1Early ? 0 : file.readUint32BE();
uint32 sampleDataPos = file.pos();
sample->size = phase1End - phase1Offset + 1;
@@ -974,8 +982,13 @@ bool MidiDriver_AmigaMac::loadInstrumentsSCI1(Common::SeekableReadStream &file)
_bank.instruments[i].push_back(sample);
- file.seek(periodTableOffset + 0xe0);
- sample->baseFreq = file.readUint16BE();
+ if (_isSci1Early) {
+ // There's no frequency specified by the sample and is hardcoded like in SCI0
+ sample->baseFreq = 11000;
+ } else {
+ file.seek(periodTableOffset + 0xe0);
+ sample->baseFreq = file.readUint16BE();
+ }
file.seek(nextSamplePos);
}
diff --git a/engines/sci/sound/drivers/fmtowns.cpp b/engines/sci/sound/drivers/fmtowns.cpp
new file mode 100644
index 0000000000..6d8bb2e525
--- /dev/null
+++ b/engines/sci/sound/drivers/fmtowns.cpp
@@ -0,0 +1,652 @@
+/* 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 "sci/sci.h"
+
+#include "common/file.h"
+#include "common/system.h"
+#include "common/textconsole.h"
+
+#include "audio/softsynth/fmtowns_pc98/towns_audio.h"
+
+#include "sci/resource.h"
+#include "sci/sound/drivers/mididriver.h"
+
+namespace Sci {
+
+class MidiDriver_FMTowns;
+
+class TownsChannel {
+public:
+ TownsChannel(MidiDriver_FMTowns *driver, uint8 id);
+ ~TownsChannel() {}
+
+ void noteOff();
+ void noteOn(uint8 note, uint8 velo);
+ void pitchBend(int16 val);
+ void updateVolume();
+ void updateDuration();
+
+ uint8 _assign;
+ uint8 _note;
+ uint8 _sustain;
+ uint16 _duration;
+
+private:
+ uint8 _id;
+ uint8 _velo;
+ uint8 _program;
+
+ MidiDriver_FMTowns *_drv;
+};
+
+class TownsMidiPart {
+friend class MidiDriver_FMTowns;
+public:
+ TownsMidiPart(MidiDriver_FMTowns *driver, uint8 id);
+ ~TownsMidiPart() {}
+
+ void noteOff(uint8 note);
+ void noteOn(uint8 note, uint8 velo);
+ void controlChangeVolume(uint8 vol);
+ void controlChangeSustain(uint8 sus);
+ void controlChangePolyphony(uint8 numChan);
+ void controlChangeAllNotesOff();
+ void programChange(uint8 prg);
+ void pitchBend(int16 val);
+
+ void addChannels(int num);
+ void dropChannels(int num);
+
+ uint8 currentProgram() const;
+
+private:
+ int allocateChannel();
+
+ uint8 _id;
+ uint8 _program;
+ uint8 _volume;
+ uint8 _sustain;
+ uint8 _chanMissing;
+ int16 _pitchBend;
+ uint8 _outChan;
+
+ MidiDriver_FMTowns *_drv;
+};
+
+class MidiDriver_FMTowns : public MidiDriver, public TownsAudioInterfacePluginDriver {
+friend class TownsChannel;
+friend class TownsMidiPart;
+public:
+ MidiDriver_FMTowns(Audio::Mixer *mixer, SciVersion version);
+ ~MidiDriver_FMTowns();
+
+ int open();
+ void loadInstruments(const uint8 *data);
+ bool isOpen() const { return _isOpen; }
+ void close();
+
+ void send(uint32 b);
+
+ uint32 property(int prop, uint32 param);
+ void setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc);
+
+ void setSoundOn(bool toggle);
+
+ uint32 getBaseTempo();
+ MidiChannel *allocateChannel() { return 0; }
+ MidiChannel *getPercussionChannel() { return 0; }
+
+ uint8 currentProgram();
+
+ void timerCallback(int timerId);
+
+private:
+ int getChannelVolume(uint8 midiPart);
+ void addMissingChannels();
+
+ void updateParser();
+ void updateChannels();
+
+ Common::TimerManager::TimerProc _timerProc;
+ void *_timerProcPara;
+
+ TownsMidiPart **_parts;
+ TownsChannel **_out;
+
+ uint8 _masterVolume;
+
+ bool _soundOn;
+
+ bool _isOpen;
+ bool _ready;
+
+ const uint16 _baseTempo;
+ SciVersion _version;
+
+ TownsAudioInterface *_intf;
+};
+
+class MidiPlayer_FMTowns : public MidiPlayer {
+public:
+ MidiPlayer_FMTowns(SciVersion version);
+ ~MidiPlayer_FMTowns();
+
+ int open(ResourceManager *resMan);
+
+ bool hasRhythmChannel() const;
+ byte getPlayId() const;
+ int getPolyphony() const;
+ void playSwitch(bool play);
+
+private:
+ MidiDriver_FMTowns *_townsDriver;
+};
+
+TownsChannel::TownsChannel(MidiDriver_FMTowns *driver, uint8 id) : _drv(driver), _id(id), _assign(0xff), _note(0xff), _velo(0), _sustain(0), _duration(0), _program(0xff) {
+}
+
+void TownsChannel::noteOn(uint8 note, uint8 velo) {
+ _duration = 0;
+
+ if (_drv->_version != SCI_VERSION_1_EARLY) {
+ if (_program != _drv->_parts[_assign]->currentProgram() && _drv->_soundOn) {
+ _program = _drv->_parts[_assign]->currentProgram();
+ _drv->_intf->callback(4, _id, _program);
+ }
+ }
+
+ _note = note;
+ _velo = velo;
+ _drv->_intf->callback(1, _id, _note, _velo);
+}
+
+void TownsChannel::noteOff() {
+ if (_sustain)
+ return;
+
+ _drv->_intf->callback(2, _id);
+ _note = 0xff;
+ _duration = 0;
+}
+
+void TownsChannel::pitchBend(int16 val) {
+ _drv->_intf->callback(7, _id, val);
+}
+
+void TownsChannel::updateVolume() {
+ if (_assign > 15 && _drv->_version != SCI_VERSION_1_EARLY)
+ return;
+ _drv->_intf->callback(8, _id, _drv->getChannelVolume((_drv->_version == SCI_VERSION_1_EARLY) ? 0 : _assign));
+}
+
+void TownsChannel::updateDuration() {
+ if (_note != 0xff)
+ _duration++;
+}
+
+TownsMidiPart::TownsMidiPart(MidiDriver_FMTowns *driver, uint8 id) : _drv(driver), _id(id), _program(0), _volume(0x3f), _sustain(0), _chanMissing(0), _pitchBend(0x2000), _outChan(0) {
+}
+
+void TownsMidiPart::noteOff(uint8 note) {
+ for (int i = 0; i < 6; i++) {
+ if ((_drv->_out[i]->_assign != _id && _drv->_version != SCI_VERSION_1_EARLY) || _drv->_out[i]->_note != note)
+ continue;
+ if (_sustain)
+ _drv->_out[i]->_sustain = 1;
+ else
+ _drv->_out[i]->noteOff();
+ return;
+ }
+}
+
+void TownsMidiPart::noteOn(uint8 note, uint8 velo) {
+ if (note < 12 || note > 107)
+ return;
+
+ if (velo == 0) {
+ noteOff(note);
+ return;
+ }
+
+ if (_drv->_version != SCI_VERSION_1_EARLY)
+ velo >>= 1;
+
+ for (int i = 0; i < 6; i++) {
+ if ((_drv->_out[i]->_assign != _id && _drv->_version != SCI_VERSION_1_EARLY) || _drv->_out[i]->_note != note)
+ continue;
+ _drv->_out[i]->_sustain = 0;
+ _drv->_out[i]->noteOff();
+ _drv->_out[i]->noteOn(note, velo);
+ return;
+ }
+
+ int chan = allocateChannel();
+ if (chan != -1)
+ _drv->_out[chan]->noteOn(note, velo);
+}
+
+void TownsMidiPart::controlChangeVolume(uint8 vol) {
+ if (_drv->_version == SCI_VERSION_1_EARLY)
+ return;
+
+ _volume = vol >> 1;
+ for (int i = 0; i < 6; i++) {
+ if (_drv->_out[i]->_assign == _id)
+ _drv->_out[i]->updateVolume();
+ }
+}
+
+void TownsMidiPart::controlChangeSustain(uint8 sus) {
+ if (_drv->_version == SCI_VERSION_1_EARLY)
+ return;
+
+ _sustain = sus;
+ if (_sustain)
+ return;
+
+ for (int i = 0; i < 6; i++) {
+ if (_drv->_out[i]->_assign == _id && _drv->_out[i]->_sustain) {
+ _drv->_out[i]->_sustain = 0;
+ _drv->_out[i]->noteOff();
+ }
+ }
+}
+
+void TownsMidiPart::controlChangePolyphony(uint8 numChan) {
+ if (_drv->_version == SCI_VERSION_1_EARLY)
+ return;
+
+ uint8 numAssigned = 0;
+ for (int i = 0; i < 6; i++) {
+ if (_drv->_out[i]->_assign == _id)
+ numAssigned++;
+ }
+
+ numAssigned += _chanMissing;
+ if (numAssigned < numChan) {
+ addChannels(numChan - numAssigned);
+ } else if (numAssigned > numChan) {
+ dropChannels(numAssigned - numChan);
+ _drv->addMissingChannels();
+ }
+}
+
+void TownsMidiPart::controlChangeAllNotesOff() {
+ for (int i = 0; i < 6; i++) {
+ if ((_drv->_out[i]->_assign == _id || _drv->_version == SCI_VERSION_1_EARLY) && _drv->_out[i]->_note != 0xff)
+ _drv->_out[i]->noteOff();
+ }
+}
+
+void TownsMidiPart::programChange(uint8 prg) {
+ _program = prg;
+}
+
+void TownsMidiPart::pitchBend(int16 val) {
+ _pitchBend = val;
+ val -= 0x2000;
+ for (int i = 0; i < 6; i++) {
+ // Strangely, the early version driver applies the setting to channel 0 only.
+ if (_drv->_out[i]->_assign == _id || (_drv->_version == SCI_VERSION_1_EARLY && i == 0))
+ _drv->_out[i]->pitchBend(val);
+ }
+}
+
+void TownsMidiPart::addChannels(int num) {
+ for (int i = 0; i < 6; i++) {
+ if (_drv->_out[i]->_assign != 0xff)
+ continue;
+
+ _drv->_out[i]->_assign = _id;
+ _drv->_out[i]->updateVolume();
+
+ if (_drv->_out[i]->_note != 0xff)
+ _drv->_out[i]->noteOff();
+
+ if (!--num)
+ break;
+ }
+
+ _chanMissing += num;
+ programChange(_program);
+}
+
+void TownsMidiPart::dropChannels(int num) {
+ if (_chanMissing == num) {
+ _chanMissing = 0;
+ return;
+ } else if (_chanMissing > num) {
+ _chanMissing -= num;
+ return;
+ }
+
+ num -= _chanMissing;
+ _chanMissing = 0;
+
+ for (int i = 0; i < 6; i++) {
+ if (_drv->_out[i]->_assign != _id || _drv->_out[i]->_note != 0xff)
+ continue;
+ _drv->_out[i]->_assign = 0xff;
+ if (!--num)
+ return;
+ }
+
+ for (int i = 0; i < 6; i++) {
+ if (_drv->_out[i]->_assign != _id)
+ continue;
+ _drv->_out[i]->_sustain = 0;
+ _drv->_out[i]->noteOff();
+ _drv->_out[i]->_assign = 0xff;
+ if (!--num)
+ return;
+ }
+}
+
+uint8 TownsMidiPart::currentProgram() const {
+ return _program;
+}
+
+int TownsMidiPart::allocateChannel() {
+ int chan = _outChan;
+ int ovrChan = 0;
+ int ld = 0;
+ bool found = false;
+
+ for (bool loop = true; loop; ) {
+ if (++chan == 6)
+ chan = 0;
+
+ if (chan == _outChan)
+ loop = false;
+
+ if (_id == _drv->_out[chan]->_assign || _drv->_version == SCI_VERSION_1_EARLY) {
+ if (_drv->_out[chan]->_note == 0xff) {
+ found = true;
+ break;
+ }
+
+ if (_drv->_out[chan]->_duration >= ld) {
+ ld = _drv->_out[chan]->_duration;
+ ovrChan = chan;
+ }
+ }
+ }
+
+ if (!found) {
+ if (!ld)
+ return -1;
+ chan = ovrChan;
+ _drv->_out[chan]->_sustain = 0;
+ _drv->_out[chan]->noteOff();
+ }
+
+ _outChan = chan;
+ return chan;
+}
+
+MidiDriver_FMTowns::MidiDriver_FMTowns(Audio::Mixer *mixer, SciVersion version) : _version(version), _timerProc(0), _timerProcPara(0), _baseTempo(10080), _ready(false), _isOpen(false), _masterVolume(0x0f), _soundOn(true) {
+ _intf = new TownsAudioInterface(mixer, this, true);
+ _out = new TownsChannel*[6];
+ for (int i = 0; i < 6; i++)
+ _out[i] = new TownsChannel(this, i);
+ _parts = new TownsMidiPart*[16];
+ for (int i = 0; i < 16; i++)
+ _parts[i] = new TownsMidiPart(this, i);
+}
+
+MidiDriver_FMTowns::~MidiDriver_FMTowns() {
+ delete _intf;
+
+ if (_parts) {
+ for (int i = 0; i < 16; i++) {
+ delete _parts[i];
+ _parts[i] = 0;
+ }
+ delete[] _parts;
+ _parts = 0;
+ }
+
+ if (_out) {
+ for (int i = 0; i < 6; i++) {
+ delete _out[i];
+ _out[i] = 0;
+ }
+ delete[] _out;
+ _out = 0;
+ }
+}
+
+int MidiDriver_FMTowns::open() {
+ if (_isOpen)
+ return MERR_ALREADY_OPEN;
+
+ if (!_ready) {
+ if (!_intf->init())
+ return MERR_CANNOT_CONNECT;
+
+ _intf->callback(0);
+
+ _intf->callback(21, 255, 1);
+ _intf->callback(21, 0, 1);
+ _intf->callback(22, 255, 221);
+
+ _intf->callback(33, 8);
+ _intf->setSoundEffectChanMask(~0x3f);
+
+ _ready = true;
+ }
+
+ _isOpen = true;
+
+ return 0;
+}
+
+void MidiDriver_FMTowns::loadInstruments(const uint8 *data) {
+ if (data) {
+ data += 6;
+ for (int i = 0; i < 128; i++) {
+ _intf->callback(5, 0, i, data);
+ data += 48;
+ }
+ }
+ _intf->callback(70, 3);
+ property(MIDI_PROP_MASTER_VOLUME, _masterVolume);
+}
+
+void MidiDriver_FMTowns::close() {
+ _isOpen = false;
+}
+
+void MidiDriver_FMTowns::send(uint32 b) {
+ if (!_isOpen)
+ return;
+
+ byte para2 = (b >> 16) & 0xFF;
+ byte para1 = (b >> 8) & 0xFF;
+ byte cmd = b & 0xF0;
+
+ TownsMidiPart *chan = _parts[b & 0x0F];
+
+ switch (cmd) {
+ case 0x80:
+ chan->noteOff(para1);
+ break;
+ case 0x90:
+ chan->noteOn(para1, para2);
+ break;
+ case 0xb0:
+ switch (para1) {
+ case 7:
+ chan->controlChangeVolume(para2);
+ break;
+ case 64:
+ chan->controlChangeSustain(para2);
+ break;
+ case SCI_MIDI_SET_POLYPHONY:
+ chan->controlChangePolyphony(para2);
+ break;
+ case SCI_MIDI_CHANNEL_NOTES_OFF:
+ chan->controlChangeAllNotesOff();
+ break;
+ default:
+ break;
+ }
+ break;
+ case 0xc0:
+ chan->programChange(para1);
+ break;
+ case 0xe0:
+ chan->pitchBend(para1 | (para2 << 7));
+ break;
+ default:
+ break;
+ }
+}
+
+uint32 MidiDriver_FMTowns::property(int prop, uint32 param) {
+ switch(prop) {
+ case MIDI_PROP_MASTER_VOLUME:
+ if (param != 0xffff) {
+ _masterVolume = param;
+ for (int i = 0; i < 6; i++)
+ _out[i]->updateVolume();
+ }
+ return _masterVolume;
+ default:
+ break;
+ }
+ return 0;
+}
+
+void MidiDriver_FMTowns::setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc) {
+ _timerProc = timer_proc;
+ _timerProcPara = timer_param;
+}
+
+void MidiDriver_FMTowns::setSoundOn(bool toggle) {
+ _soundOn = toggle;
+}
+
+uint32 MidiDriver_FMTowns::getBaseTempo() {
+ return _baseTempo;
+}
+
+void MidiDriver_FMTowns::timerCallback(int timerId) {
+ if (!_isOpen)
+ return;
+
+ switch (timerId) {
+ case 1:
+ updateParser();
+ updateChannels();
+ break;
+ default:
+ break;
+ }
+}
+
+int MidiDriver_FMTowns::getChannelVolume(uint8 midiPart) {
+ static const uint8 volumeTable[] = { 0x00, 0x0D, 0x1B, 0x28, 0x36, 0x43, 0x51, 0x5F, 0x63, 0x67, 0x6B, 0x6F, 0x73, 0x77, 0x7B, 0x7F };
+ int tableIndex = (_version == SCI_VERSION_1_EARLY) ? _masterVolume : (_parts[midiPart]->_volume * (_masterVolume + 1)) >> 6;
+ assert(tableIndex < 16);
+ return volumeTable[tableIndex];
+}
+
+void MidiDriver_FMTowns::addMissingChannels() {
+ uint8 avlChan = 0;
+ for (int i = 0; i < 6; i++) {
+ if (_out[i]->_assign == 0xff)
+ avlChan++;
+ }
+
+ if (!avlChan)
+ return;
+
+ for (int i = 0; i < 16; i++) {
+ if (!_parts[i]->_chanMissing)
+ continue;
+
+ if (_parts[i]->_chanMissing < avlChan) {
+ avlChan -= _parts[i]->_chanMissing;
+ uint8 m = _parts[i]->_chanMissing;
+ _parts[i]->_chanMissing = 0;
+ _parts[i]->addChannels(m);
+ } else {
+ _parts[i]->_chanMissing -= avlChan;
+ _parts[i]->addChannels(avlChan);
+ return;
+ }
+ }
+}
+
+void MidiDriver_FMTowns::updateParser() {
+ if (_timerProc)
+ _timerProc(_timerProcPara);
+}
+
+void MidiDriver_FMTowns::updateChannels() {
+ for (int i = 0; i < 6; i++)
+ _out[i]->updateDuration();
+}
+
+MidiPlayer_FMTowns::MidiPlayer_FMTowns(SciVersion version) : MidiPlayer(version) {
+ _driver = _townsDriver = new MidiDriver_FMTowns(g_system->getMixer(), version);
+}
+
+MidiPlayer_FMTowns::~MidiPlayer_FMTowns() {
+ delete _driver;
+}
+
+int MidiPlayer_FMTowns::open(ResourceManager *resMan) {
+ int result = MidiDriver::MERR_DEVICE_NOT_AVAILABLE;
+ if (_townsDriver) {
+ result = _townsDriver->open();
+ if (!result && _version == SCI_VERSION_1_LATE)
+ _townsDriver->loadInstruments((resMan->findResource(ResourceId(kResourceTypePatch, 8), true))->data);
+ }
+ return result;
+}
+
+bool MidiPlayer_FMTowns::hasRhythmChannel() const {
+ return false;
+}
+
+byte MidiPlayer_FMTowns::getPlayId() const {
+ return (_version == SCI_VERSION_1_EARLY) ? 0x00 : 0x16;
+}
+
+int MidiPlayer_FMTowns::getPolyphony() const {
+ return (_version == SCI_VERSION_1_EARLY) ? 1 : 6;
+}
+
+void MidiPlayer_FMTowns::playSwitch(bool play) {
+ if (_townsDriver)
+ _townsDriver->setSoundOn(play);
+}
+
+MidiPlayer *MidiPlayer_FMTowns_create(SciVersion _soundVersion) {
+ return new MidiPlayer_FMTowns(_soundVersion);
+}
+
+} // End of namespace Sci
+
diff --git a/engines/sci/sound/drivers/mididriver.h b/engines/sci/sound/drivers/mididriver.h
index ec66984bd4..8938eef62f 100644
--- a/engines/sci/sound/drivers/mididriver.h
+++ b/engines/sci/sound/drivers/mididriver.h
@@ -130,6 +130,7 @@ extern MidiPlayer *MidiPlayer_PCSpeaker_create(SciVersion version);
extern MidiPlayer *MidiPlayer_CMS_create(SciVersion version);
extern MidiPlayer *MidiPlayer_Midi_create(SciVersion version);
extern MidiPlayer *MidiPlayer_Fb01_create(SciVersion version);
+extern MidiPlayer *MidiPlayer_FMTowns_create(SciVersion version);
} // End of namespace Sci
diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp
index ad7ba7ca36..422948f975 100644
--- a/engines/sci/sound/midiparser_sci.cpp
+++ b/engines/sci/sound/midiparser_sci.cpp
@@ -355,17 +355,14 @@ void MidiParser_SCI::sendInitCommands() {
}
}
- // Send a velocity off signal to all channels
- for (int i = 0; i < 15; ++i) {
- if (_channelUsed[i])
- sendToDriver(0xB0 | i, 0x4E, 0); // Reset velocity
- }
-
- // Center the pitch wheels and hold pedal in preparation for the next piece of music
+ // Reset all the parameters of the channels used by this song
for (int i = 0; i < 16; ++i) {
if (_channelUsed[i]) {
- sendToDriver(0xE0 | i, 0, 0x40); // Reset pitch wheel
- sendToDriver(0xB0 | i, 0x40, 0); // Reset hold pedal
+ sendToDriver(0xB0 | i, 0x07, 127); // Reset volume to maximum
+ sendToDriver(0xB0 | i, 0x0A, 64); // Reset panning to center
+ sendToDriver(0xB0 | i, 0x40, 0); // Reset hold pedal to none
+ sendToDriver(0xB0 | i, 0x4E, 0); // Reset velocity to none
+ sendToDriver(0xE0 | i, 0, 64); // Reset pitch wheel to center
}
}
}
diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp
index 9610b6f847..4ffa8d7590 100644
--- a/engines/sci/sound/music.cpp
+++ b/engines/sci/sound/music.cpp
@@ -44,8 +44,10 @@ SciMusic::SciMusic(SciVersion soundVersion)
// operations
_playList.reserve(10);
- for (int i = 0; i < 16; i++)
+ for (int i = 0; i < 16; i++) {
_usedChannel[i] = 0;
+ _channelRemap[i] = -1;
+ }
_queuedCommands.reserve(1000);
}
@@ -76,6 +78,13 @@ void SciMusic::init() {
if (getSciVersion() >= SCI_VERSION_1_EGA_ONLY && getSciVersion() <= SCI_VERSION_1_1)
deviceFlags |= MDT_CMS;
+ if (g_sci->getPlatform() == Common::kPlatformFMTowns) {
+ if (getSciVersion() > SCI_VERSION_1_EARLY)
+ deviceFlags = MDT_TOWNS;
+ else
+ deviceFlags |= MDT_TOWNS;
+ }
+
uint32 dev = MidiDriver::detectDevice(deviceFlags);
_musicType = MidiDriver::getMusicType(dev);
@@ -96,6 +105,9 @@ void SciMusic::init() {
case MT_CMS:
_pMidiDrv = MidiPlayer_CMS_create(_soundVersion);
break;
+ case MT_TOWNS:
+ _pMidiDrv = MidiPlayer_FMTowns_create(_soundVersion);
+ break;
default:
if (ConfMan.getBool("native_fb01"))
_pMidiDrv = MidiPlayer_Fb01_create(_soundVersion);
@@ -349,6 +361,7 @@ int16 SciMusic::tryToOwnChannel(MusicEntry *caller, int16 bestChannel) {
if (!_usedChannel[bestChannel]) {
// currently unused, so give it to caller directly
_usedChannel[bestChannel] = caller;
+ _channelRemap[bestChannel] = bestChannel;
return bestChannel;
}
// otherwise look for unused channel
@@ -357,6 +370,7 @@ int16 SciMusic::tryToOwnChannel(MusicEntry *caller, int16 bestChannel) {
continue;
if (!_usedChannel[channelNr]) {
_usedChannel[channelNr] = caller;
+ _channelRemap[bestChannel] = channelNr;
return channelNr;
}
}
@@ -369,8 +383,24 @@ int16 SciMusic::tryToOwnChannel(MusicEntry *caller, int16 bestChannel) {
void SciMusic::freeChannels(MusicEntry *caller) {
// Remove used channels
for (int i = 0; i < 15; i++) {
- if (_usedChannel[i] == caller)
+ if (_usedChannel[i] == caller) {
+ if (_channelRemap[i] != -1) {
+ // athrxx: The original handles this differently. It seems to be checking for (and effecting) necessary
+ // remaps / resets etc. more or less all the time. There are several more tables to keep track of everything.
+ // I don't know whether all of that is needed and to which SCI versions it applies, though.
+ // At least it is necessary to release the allocated channels inside the driver. Otherwise these channels
+ // won't be available any more (e.g. after half of the KQ5 FM-Towns intro there will be no more music
+ // since the driver can't pick up any more channels). The channels also have to be reset to
+ // default values, since the original does the same (although in a different manny) and the music will be wrong
+ // otherwise (at least KQ5 FM-Towns).
+
+ sendMidiCommand(0x4000e0 | _channelRemap[i]); // Reset pitch wheel
+ sendMidiCommand(0x0040b0 | _channelRemap[i]); // Release pedal
+ sendMidiCommand(0x004bb0 | _channelRemap[i]); // Release assigned driver channels
+ }
_usedChannel[i] = 0;
+ _channelRemap[i] = -1;
+ }
}
// Also tell midiparser, that he lost ownership
caller->pMidiParser->lostChannels();
@@ -446,9 +476,9 @@ void SciMusic::soundPlay(MusicEntry *pSnd) {
// volume of the sound channels that the faded song occupies..
// Fixes bug #3266480 and partially fixes bug #3041738.
for (uint i = 0; i < playListCount; i++) {
- // Is another MIDI song being faded? If yes, stop it
+ // Is another MIDI song being faded down? If yes, stop it
// immediately instead
- if (_playList[i]->fadeStep && _playList[i]->pMidiParser) {
+ if (_playList[i]->fadeStep < 0 && _playList[i]->pMidiParser) {
_playList[i]->status = kSoundStopped;
if (_soundVersion <= SCI_VERSION_0_LATE)
_playList[i]->isQueued = false;
diff --git a/engines/sci/sound/music.h b/engines/sci/sound/music.h
index 8577ed7313..fa6f538a7e 100644
--- a/engines/sci/sound/music.h
+++ b/engines/sci/sound/music.h
@@ -219,6 +219,7 @@ private:
bool _soundOn;
byte _masterVolume;
MusicEntry *_usedChannel[16];
+ int8 _channelRemap[16];
int8 _globalReverb;
MidiCommandQueue _queuedCommands;
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index a91b103214..274c532779 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -37,7 +37,15 @@ SoundCommandParser::SoundCommandParser(ResourceManager *resMan, SegManager *segM
_music = new SciMusic(_soundVersion);
_music->init();
+ // Check if the user wants synthesized or digital sound effects in SCI1.1
+ // or later games
_bMultiMidi = ConfMan.getBool("multi_midi");
+ // In SCI2 and later games, this check should always be true - there was
+ // always only one version of each sound effect or digital music track
+ // (e.g. the menu music in GK1 - there is a sound effect with the same
+ // resource number, but it's totally unrelated to the menu music).
+ if (getSciVersion() >= SCI_VERSION_2)
+ _bMultiMidi = true;
}
SoundCommandParser::~SoundCommandParser() {
@@ -75,13 +83,16 @@ void SoundCommandParser::initSoundResource(MusicEntry *newSound) {
// 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
+ // Hoyle 4 has garbled audio resources in place of the sound resources.
+ // The demo of GK1 has no alternate sound effects.
+ if ((g_sci->getGameId() == GID_HOYLE4) ||
+ (g_sci->getGameId() == GID_GK1 && g_sci->isDemo()))
+ checkAudioResource = false;
if (checkAudioResource && _resMan->testResource(ResourceId(kResourceTypeAudio, newSound->resourceId))) {
- // Found a relevant audio resource, create an audio stream
+ // Found a relevant audio resource, create an audio stream if there is
+ // no associated sound resource, or if both resources exist and the
+ // user wants the digital version.
if (_bMultiMidi || !newSound->soundRes) {
int sampleLen;
newSound->pStreamAud = _audio->getAudioStream(newSound->resourceId, 65535, &sampleLen);
@@ -123,8 +134,6 @@ void SoundCommandParser::processInitSound(reg_t obj) {
writeSelectorValue(_segMan, obj, SELECTOR(state), kSoundInitialized);
else
writeSelector(_segMan, obj, SELECTOR(nodePtr), obj);
-
- writeSelector(_segMan, obj, SELECTOR(handle), obj);
}
}
@@ -138,9 +147,9 @@ void SoundCommandParser::processPlaySound(reg_t obj) {
MusicEntry *musicSlot = _music->getSlot(obj);
if (!musicSlot) {
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.
+ // The sound hasn't been initialized for some reason, so initialize it
+ // here. Happens in KQ6, room 460, when giving the creature (child) to
+ // the bookworm. Fixes bugs #3413301 and #3421098.
processInitSound(obj);
musicSlot = _music->getSlot(obj);
if (!musicSlot)
diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp
index 9cfdfbccc9..54f7fea97b 100644
--- a/engines/scumm/debugger.cpp
+++ b/engines/scumm/debugger.cpp
@@ -292,7 +292,7 @@ bool ScummDebugger::Cmd_ImportRes(int argc, const char** argv) {
if (_vm->_game.features & GF_SMALL_HEADER) {
size = file.readUint16LE();
file.seek(-2, SEEK_CUR);
- } else if (_vm->_game.features & GF_SMALL_HEADER) {
+ } else if (_vm->_game.features & GF_SMALL_HEADER) { // FIXME: This never was executed
if (_vm->_game.version == 4)
file.seek(8, SEEK_CUR);
size = file.readUint32LE();
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index 92face553c..2ae994040b 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -649,8 +649,15 @@ static void detectGames(const Common::FSList &fslist, Common::List<DetectorResul
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;
+ if (detectSpeech(fslist, g)) {
+ if (strchr(dr.game.guioptions, GUIO_NOSPEECH[0]) != NULL) {
+ if (g->id == GID_MONKEY || g->id == GID_MONKEY2)
+ // TODO: This may need to be updated if something important gets added in the top detection table for these game ids
+ dr.game.guioptions = GUIO0();
+ else
+ warning("FIXME: fix NOSPEECH fallback");
+ }
+ }
// Add the game/variant to the candidates list if it is consistent
// with the file(s) we are seeing.
@@ -1001,7 +1008,7 @@ GameList ScummMetaEngine::detectGames(const Common::FSList &fslist) const {
}
}
- dg.setGUIOptions(x->game.guioptions | MidiDriver::musicType2GUIO(x->game.midi));
+ dg.setGUIOptions(x->game.guioptions + MidiDriver::musicType2GUIO(x->game.midi));
dg.appendGUIOptions(getGameGUIOptionsDescriptionLanguage(x->language));
detectedGames.push_back(dg);
diff --git a/engines/scumm/detection.h b/engines/scumm/detection.h
index 720c4bb750..ad8b3cec12 100644
--- a/engines/scumm/detection.h
+++ b/engines/scumm/detection.h
@@ -89,7 +89,7 @@ struct GameSettings {
/**
* Game GUI options. Used to enable/disable certain GUI widgets
*/
- uint32 guioptions;
+ const char *guioptions;
};
enum FilenameGenMethod {
diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h
index 7463fa7dcc..cd055a5b78 100644
--- a/engines/scumm/detection_tables.h
+++ b/engines/scumm/detection_tables.h
@@ -179,14 +179,6 @@ static const Engines::ObsoleteGameID obsoleteGameIDsTable[] = {
{NULL, NULL, UNK}
};
-using Common::GUIO_NONE;
-using Common::GUIO_NOLAUNCHLOAD;
-using Common::GUIO_NOMIDI;
-using Common::GUIO_NOSPEECH;
-using Common::GUIO_MIDITOWNS;
-using Common::GUIO_MIDIADLIB;
-using Common::GUIO_MIDIMT32;
-
// The following table contains information about variants of our various
// games. We index into it with help of md5table (from scumm-md5.h), to find
// the correct GameSettings for a given game variant.
@@ -207,208 +199,207 @@ using Common::GUIO_MIDIMT32;
// only a single unique variant. This is used to help the detector quickly
// decide whether it has to worry about distinguishing multiple variants or not.
static const GameSettings gameVariantsTable[] = {
- {"maniac", "Apple II", 0, GID_MANIAC, 0, 0, MDT_APPLEIIGS, 0, Common::kPlatformApple2GS, GUIO_NOSPEECH | GUIO_NOMIDI},
- {"maniac", "C64", 0, GID_MANIAC, 0, 0, MDT_C64, 0, Common::kPlatformC64, GUIO_NOSPEECH | GUIO_NOMIDI},
- {"maniac", "V1", "v1", GID_MANIAC, 1, 0, MDT_PCSPK | MDT_PCJR, 0, Common::kPlatformPC, GUIO_NOSPEECH | GUIO_NOMIDI},
- {"maniac", "V1 Demo", "v1", GID_MANIAC, 1, 0, MDT_PCSPK | MDT_PCJR, GF_DEMO, Common::kPlatformPC, GUIO_NOSPEECH | GUIO_NOMIDI},
- {"maniac", "NES", 0, GID_MANIAC, 1, 0, MDT_NONE, 0, Common::kPlatformNES, GUIO_NOSPEECH | GUIO_NOMIDI},
- {"maniac", "V2", "v2", GID_MANIAC, 2, 0, MDT_PCSPK | MDT_PCJR, 0, UNK, GUIO_NOSPEECH | GUIO_NOMIDI},
- {"maniac", "V2 Demo", "v2", GID_MANIAC, 2, 0, MDT_PCSPK | MDT_PCJR, GF_DEMO, Common::kPlatformPC, GUIO_NOSPEECH | GUIO_NOMIDI},
-
- {"zak", "V1", "v1", GID_ZAK, 1, 0, MDT_PCSPK | MDT_PCJR, 0, UNK, GUIO_NOSPEECH | GUIO_NOMIDI},
- {"zak", "V2", "v2", GID_ZAK, 2, 0, MDT_PCSPK | MDT_PCJR, 0, UNK, GUIO_NOSPEECH | GUIO_NOMIDI},
- {"zak", "FM-TOWNS", 0, GID_ZAK, 3, 0, MDT_TOWNS, GF_OLD256 | GF_AUDIOTRACKS, Common::kPlatformFMTowns, GUIO_NOSPEECH | GUIO_NOMIDI | GUIO_MIDITOWNS},
-
-
- {"indy3", "EGA", "ega", GID_INDY3, 3, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB, 0, UNK, GUIO_NOSPEECH | GUIO_NOMIDI},
- {"indy3", "No AdLib", "ega", GID_INDY3, 3, 0, MDT_PCSPK | MDT_PCJR, 0, UNK, GUIO_NOSPEECH | GUIO_NOMIDI},
- {"indy3", "VGA", "vga", GID_INDY3, 3, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB, GF_OLD256 | GF_FEW_LOCALS, Common::kPlatformPC, GUIO_NOSPEECH | GUIO_NOMIDI},
- {"indy3", "FM-TOWNS", 0, GID_INDY3, 3, 0, MDT_TOWNS, GF_OLD256 | GF_FEW_LOCALS | GF_AUDIOTRACKS, Common::kPlatformFMTowns, GUIO_NOSPEECH | GUIO_NOMIDI | GUIO_MIDITOWNS},
-
- {"loom", "EGA", "ega", GID_LOOM, 3, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO_NOSPEECH},
- {"loom", "No AdLib", "ega", GID_LOOM, 3, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS, 0, UNK, GUIO_NOSPEECH | GUIO_NOMIDI},
+ {"maniac", "Apple II", 0, GID_MANIAC, 0, 0, MDT_APPLEIIGS, 0, Common::kPlatformApple2GS, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
+ {"maniac", "C64", 0, GID_MANIAC, 0, 0, MDT_C64, 0, Common::kPlatformC64, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI) },
+ {"maniac", "V1", "v1", GID_MANIAC, 1, 0, MDT_PCSPK | MDT_PCJR, 0, Common::kPlatformPC, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
+ {"maniac", "V1 Demo", "v1", GID_MANIAC, 1, 0, MDT_PCSPK | MDT_PCJR, GF_DEMO, Common::kPlatformPC, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
+ {"maniac", "NES", 0, GID_MANIAC, 1, 0, MDT_NONE, 0, Common::kPlatformNES, GUIO3(GUIO_NOSPEECH, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"maniac", "V2", "v2", GID_MANIAC, 2, 0, MDT_PCSPK | MDT_PCJR, 0, UNK, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
+ {"maniac", "V2 Demo", "v2", GID_MANIAC, 2, 0, MDT_PCSPK | MDT_PCJR, GF_DEMO, Common::kPlatformPC, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
+
+ {"zak", "V1", "v1", GID_ZAK, 1, 0, MDT_PCSPK | MDT_PCJR, 0, UNK, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
+ {"zak", "V2", "v2", GID_ZAK, 2, 0, MDT_PCSPK | MDT_PCJR, 0, UNK, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
+ {"zak", "FM-TOWNS", 0, GID_ZAK, 3, 0, MDT_TOWNS, GF_OLD256 | GF_AUDIOTRACKS, Common::kPlatformFMTowns, GUIO4(GUIO_NOSPEECH, GUIO_NOMIDI, GUIO_MIDITOWNS, GUIO_NOASPECT)},
+
+ {"indy3", "EGA", "ega", GID_INDY3, 3, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB, 0, UNK, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
+ {"indy3", "No AdLib", "ega", GID_INDY3, 3, 0, MDT_PCSPK | MDT_PCJR, 0, UNK, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
+ {"indy3", "VGA", "vga", GID_INDY3, 3, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB, GF_OLD256 | GF_FEW_LOCALS, Common::kPlatformPC, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
+ {"indy3", "FM-TOWNS", 0, GID_INDY3, 3, 0, MDT_TOWNS, GF_OLD256 | GF_FEW_LOCALS | GF_AUDIOTRACKS, Common::kPlatformFMTowns, GUIO4(GUIO_NOSPEECH, GUIO_NOMIDI, GUIO_MIDITOWNS, GUIO_NOASPECT)},
+
+ {"loom", "EGA", "ega", GID_LOOM, 3, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO1(GUIO_NOSPEECH)},
+ {"loom", "No AdLib", "ega", GID_LOOM, 3, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS, 0, UNK, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
#ifdef USE_RGB_COLOR
- {"loom", "PC-Engine", 0, GID_LOOM, 3, 0, MDT_NONE, GF_AUDIOTRACKS | GF_OLD256 | GF_16BIT_COLOR, Common::kPlatformPCEngine, GUIO_NOSPEECH | GUIO_NOMIDI},
+ {"loom", "PC-Engine", 0, GID_LOOM, 3, 0, MDT_NONE, GF_AUDIOTRACKS | GF_OLD256 | GF_16BIT_COLOR, Common::kPlatformPCEngine, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
#endif
- {"loom", "FM-TOWNS", 0, GID_LOOM, 3, 0, MDT_TOWNS, GF_AUDIOTRACKS | GF_OLD256, Common::kPlatformFMTowns, GUIO_NOSPEECH | GUIO_NOMIDI | GUIO_MIDITOWNS},
- {"loom", "VGA", "vga", GID_LOOM, 4, 0, MDT_NONE, GF_AUDIOTRACKS, Common::kPlatformPC, GUIO_NOSPEECH | GUIO_NOMIDI},
+ {"loom", "FM-TOWNS", 0, GID_LOOM, 3, 0, MDT_TOWNS, GF_AUDIOTRACKS | GF_OLD256, Common::kPlatformFMTowns, GUIO4(GUIO_NOSPEECH, GUIO_NOMIDI, GUIO_MIDITOWNS, GUIO_NOASPECT)},
+ {"loom", "VGA", "vga", GID_LOOM, 4, 0, MDT_NONE, GF_AUDIOTRACKS, Common::kPlatformPC, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
- {"pass", 0, 0, GID_PASS, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB, GF_16COLOR, Common::kPlatformPC, GUIO_NOSPEECH | GUIO_NOMIDI},
+ {"pass", 0, 0, GID_PASS, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB, GF_16COLOR, Common::kPlatformPC, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
- {"monkey", "VGA", "vga", GID_MONKEY_VGA, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO_NOSPEECH},
- {"monkey", "EGA", "ega", GID_MONKEY_EGA, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, GF_16COLOR, Common::kPlatformPC, GUIO_NOSPEECH},
- {"monkey", "No AdLib", "ega", GID_MONKEY_EGA, 4, 0, MDT_PCSPK | MDT_PCJR, GF_16COLOR, Common::kPlatformAtariST, GUIO_NOSPEECH | GUIO_NOMIDI},
- {"monkey", "Demo", "ega", GID_MONKEY_EGA, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_ADLIB, GF_16COLOR, Common::kPlatformPC, GUIO_NOSPEECH | GUIO_NOMIDI},
- {"monkey", "CD", 0, GID_MONKEY, 5, 0, MDT_ADLIB, GF_AUDIOTRACKS, UNK, GUIO_NOSPEECH | GUIO_NOMIDI},
- {"monkey", "FM-TOWNS", 0, GID_MONKEY, 5, 0, MDT_TOWNS, GF_AUDIOTRACKS, Common::kPlatformFMTowns, GUIO_NOSPEECH | GUIO_NOMIDI | GUIO_MIDITOWNS},
- {"monkey", "SEGA", 0, GID_MONKEY, 5, 0, MDT_NONE, GF_AUDIOTRACKS, Common::kPlatformSegaCD, GUIO_NOSPEECH | GUIO_NOMIDI},
+ {"monkey", "VGA", "vga", GID_MONKEY_VGA, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO1(GUIO_NOSPEECH)},
+ {"monkey", "EGA", "ega", GID_MONKEY_EGA, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_CMS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, GF_16COLOR, Common::kPlatformPC, GUIO1(GUIO_NOSPEECH)},
+ {"monkey", "No AdLib", "ega", GID_MONKEY_EGA, 4, 0, MDT_PCSPK | MDT_PCJR, GF_16COLOR, Common::kPlatformAtariST, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
+ {"monkey", "Demo", "ega", GID_MONKEY_EGA, 4, 0, MDT_PCSPK | MDT_PCJR | MDT_ADLIB, GF_16COLOR, Common::kPlatformPC, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
+ {"monkey", "CD", 0, GID_MONKEY, 5, 0, MDT_ADLIB, GF_AUDIOTRACKS, UNK, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
+ {"monkey", "FM-TOWNS", 0, GID_MONKEY, 5, 0, MDT_TOWNS, GF_AUDIOTRACKS, Common::kPlatformFMTowns, GUIO4(GUIO_NOSPEECH, GUIO_NOMIDI, GUIO_MIDITOWNS, GUIO_NOASPECT)},
+ {"monkey", "SEGA", 0, GID_MONKEY, 5, 0, MDT_NONE, GF_AUDIOTRACKS, Common::kPlatformSegaCD, GUIO2(GUIO_NOSPEECH, GUIO_NOMIDI)},
- {"monkey2", "", 0, GID_MONKEY2, 5, 0, MDT_PCSPK | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO_NOSPEECH},
- {"monkey2", "FM-TOWNS", 0, GID_MONKEY2, 5, 0, MDT_PCSPK | MDT_TOWNS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, Common::kPlatformFMTowns, GUIO_NOSPEECH | GUIO_MIDITOWNS | GUIO_MIDIADLIB | GUIO_MIDIMT32},
+ {"monkey2", "", 0, GID_MONKEY2, 5, 0, MDT_PCSPK | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO1(GUIO_NOSPEECH)},
+ {"monkey2", "FM-TOWNS", 0, GID_MONKEY2, 5, 0, MDT_PCSPK | MDT_TOWNS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, Common::kPlatformFMTowns, GUIO5(GUIO_NOSPEECH, GUIO_MIDITOWNS, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_NOASPECT)},
- {"atlantis", "", 0, GID_INDY4, 5, 0, MDT_PCSPK | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO_NONE},
- {"atlantis", "Floppy", 0, GID_INDY4, 5, 0, MDT_PCSPK | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO_NOSPEECH},
- {"atlantis", "FM-TOWNS", 0, GID_INDY4, 5, 0, MDT_TOWNS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, Common::kPlatformFMTowns, GUIO_MIDITOWNS | GUIO_MIDIADLIB | GUIO_MIDIMT32},
+ {"atlantis", "", 0, GID_INDY4, 5, 0, MDT_PCSPK | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO0()},
+ {"atlantis", "Floppy", 0, GID_INDY4, 5, 0, MDT_PCSPK | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, UNK, GUIO1(GUIO_NOSPEECH)},
+ {"atlantis", "FM-TOWNS", 0, GID_INDY4, 5, 0, MDT_TOWNS | MDT_ADLIB | MDT_MIDI | MDT_PREFER_MT32, 0, Common::kPlatformFMTowns, GUIO4(GUIO_MIDITOWNS, GUIO_MIDIADLIB, GUIO_MIDIMT32, GUIO_NOASPECT)},
- {"tentacle", "", 0, GID_TENTACLE, 6, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_GM, GF_USE_KEY, UNK, GUIO_NONE},
- {"tentacle", "Floppy", 0, GID_TENTACLE, 6, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_GM, GF_USE_KEY, UNK, GUIO_NOSPEECH},
+ {"tentacle", "", 0, GID_TENTACLE, 6, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_GM, GF_USE_KEY, UNK, GUIO0()},
+ {"tentacle", "Floppy", 0, GID_TENTACLE, 6, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_GM, GF_USE_KEY, UNK, GUIO1(GUIO_NOSPEECH)},
- {"samnmax", "", 0, GID_SAMNMAX, 6, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_GM, GF_USE_KEY, UNK, GUIO_NONE},
- {"samnmax", "Floppy", 0, GID_SAMNMAX, 6, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_GM, GF_USE_KEY, UNK, GUIO_NOSPEECH},
+ {"samnmax", "", 0, GID_SAMNMAX, 6, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_GM, GF_USE_KEY, UNK, GUIO0()},
+ {"samnmax", "Floppy", 0, GID_SAMNMAX, 6, 0, MDT_ADLIB | MDT_MIDI | MDT_PREFER_GM, GF_USE_KEY, UNK, GUIO1(GUIO_NOSPEECH)},
#ifdef ENABLE_SCUMM_7_8
- {"ft", 0, 0, GID_FT, 7, 0, MDT_NONE, 0, UNK, GUIO_NOMIDI},
+ {"ft", 0, 0, GID_FT, 7, 0, MDT_NONE, 0, UNK, GUIO1(GUIO_NOMIDI)},
- {"dig", 0, 0, GID_DIG, 7, 0, MDT_NONE, 0, UNK, GUIO_NOMIDI},
+ {"dig", 0, 0, GID_DIG, 7, 0, MDT_NONE, 0, UNK, GUIO1(GUIO_NOMIDI)},
- {"comi", 0, 0, GID_CMI, 8, 0, MDT_NONE, 0, Common::kPlatformWindows, GUIO_NOMIDI},
+ {"comi", 0, 0, GID_CMI, 8, 0, MDT_NONE, 0, Common::kPlatformWindows, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT)},
#endif
// Humongous Entertainment Scumm Version 6
- {"activity", "", 0, GID_HEGAME, 6, 62, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD},
- {"funpack", 0, 0, GID_FUNPACK, 6, 62, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD},
- {"fbpack", 0, 0, GID_HEGAME, 6, 62, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD},
+ {"activity", "", 0, GID_HEGAME, 6, 62, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO1(GUIO_NOLAUNCHLOAD)},
+ {"funpack", 0, 0, GID_FUNPACK, 6, 62, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO1(GUIO_NOLAUNCHLOAD)},
+ {"fbpack", 0, 0, GID_HEGAME, 6, 62, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO1(GUIO_NOLAUNCHLOAD)},
- {"brstorm", 0, 0, GID_FBEAR, 6, 62, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD},
- {"fbear", "HE 62", 0, GID_FBEAR, 6, 62, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD},
- {"fbear", "HE 70", 0, GID_FBEAR, 6, 70, MDT_NONE, GF_USE_KEY, Common::kPlatformWindows, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"brstorm", 0, 0, GID_FBEAR, 6, 62, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO1(GUIO_NOLAUNCHLOAD)},
+ {"fbear", "HE 62", 0, GID_FBEAR, 6, 62, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO1(GUIO_NOLAUNCHLOAD)},
+ {"fbear", "HE 70", 0, GID_FBEAR, 6, 70, MDT_NONE, GF_USE_KEY, Common::kPlatformWindows, GUIO2(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI)},
- {"puttmoon", "", 0, GID_PUTTMOON, 6, 62, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD},
- {"puttmoon", "HE 70", 0, GID_PUTTMOON, 6, 70, MDT_NONE, GF_USE_KEY, Common::kPlatformWindows, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"puttmoon", "", 0, GID_PUTTMOON, 6, 62, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO1(GUIO_NOLAUNCHLOAD)},
+ {"puttmoon", "HE 70", 0, GID_PUTTMOON, 6, 70, MDT_NONE, GF_USE_KEY, Common::kPlatformWindows, GUIO2(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI)},
- {"puttputt", "HE 60", 0, GID_HEGAME, 6, 60, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD},
- {"puttputt", "HE 61", 0, GID_HEGAME, 6, 61, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD},
- {"puttputt", "HE 62", 0, GID_HEGAME, 6, 62, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD},
- {"puttputt", "Demo", 0, GID_PUTTDEMO, 6, 60, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD},
+ {"puttputt", "HE 60", 0, GID_HEGAME, 6, 60, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO1(GUIO_NOLAUNCHLOAD)},
+ {"puttputt", "HE 61", 0, GID_HEGAME, 6, 61, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO1(GUIO_NOLAUNCHLOAD)},
+ {"puttputt", "HE 62", 0, GID_HEGAME, 6, 62, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO1(GUIO_NOLAUNCHLOAD)},
+ {"puttputt", "Demo", 0, GID_PUTTDEMO, 6, 60, MDT_ADLIB | MDT_MIDI, GF_USE_KEY, UNK, GUIO1(GUIO_NOLAUNCHLOAD)},
// The following are meant to be generic HE game variants and as such do
// not specify a game ID. Make sure that these are last in the table, else
// they'll override more specific entries that follow later on.
- {"", "HE 70", 0, GID_HEGAME, 6, 70, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"", "HE 70", 0, GID_HEGAME, 6, 70, MDT_NONE, GF_USE_KEY, UNK, GUIO2(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI)},
#ifdef ENABLE_HE
// HE CUP demos
- {"", "HE CUP", 0, GID_HECUP, 6, 200, MDT_NONE, 0, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI | GUIO_NOSPEECH},
+ {"", "HE CUP", 0, GID_HECUP, 6, 200, MDT_NONE, 0, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOSPEECH)},
// Humongous Entertainment Scumm Version 7.1
// The first version to use 640x480 resolution and wizImages
// There are also 7.1 versions of freddemo, airdemo and farmdemo
- {"catalog", "", 0, GID_HEGAME, 6, 71, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"freddi", "", 0, GID_HEGAME, 6, 71, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"catalog", "", 0, GID_HEGAME, 6, 71, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"freddi", "", 0, GID_HEGAME, 6, 71, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
// Humongous Entertainment Scumm Version 7.2
- {"airport", "", 0, GID_HEGAME, 6, 72, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"airport", "", 0, GID_HEGAME, 6, 72, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
// Changed o_getResourceSize to cover all resource types
- {"farm", "", 0, GID_HEGAME, 6, 73, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"puttzoo", "", 0, GID_HEGAME, 6, 73, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"farm", "", 0, GID_HEGAME, 6, 73, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"puttzoo", "", 0, GID_HEGAME, 6, 73, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
// Added VAR_PLATFORM variable
- {"jungle", "", 0, GID_HEGAME, 6, 74, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"jungle", "", 0, GID_HEGAME, 6, 74, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
// Humongous Entertainment Scumm Version 8.0 ? Scummsrc.80
- {"freddi2", "", 0, GID_HEGAME, 6, 80, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"pajama", "", 0, GID_HEGAME, 6, 80, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"freddi2", "", 0, GID_HEGAME, 6, 80, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"pajama", "", 0, GID_HEGAME, 6, 80, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
- {"balloon", "", 0, GID_HEGAME, 6, 80, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"dog", "", 0, GID_HEGAME, 6, 80, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"maze", "", 0, GID_HEGAME, 6, 80, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"balloon", "", 0, GID_HEGAME, 6, 80, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"dog", "", 0, GID_HEGAME, 6, 80, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"maze", "", 0, GID_HEGAME, 6, 80, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
- {"water", "", 0, GID_HEGAME, 6, 80, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"water", "", 0, GID_HEGAME, 6, 80, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
// condMaskCode value changed in setUserCondition & setTalkCondition
- {"putttime", "", 0, GID_HEGAME, 6, 85, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"socks", "", 0, GID_HEGAME, 6, 85, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"putttime", "", 0, GID_HEGAME, 6, 85, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"socks", "", 0, GID_HEGAME, 6, 85, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
// Humongous Entertainment Scumm Version 9.0 ? Scummsys.90
- {"baseball", "", 0, GID_HEGAME, 6, 90, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"thinkerk", "", 0, GID_HEGAME, 6, 90, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"thinker1", "", 0, GID_HEGAME, 6, 90, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"spyfox", "", 0, GID_HEGAME, 6, 90, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"baseball", "", 0, GID_HEGAME, 6, 90, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"thinkerk", "", 0, GID_HEGAME, 6, 90, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"thinker1", "", 0, GID_HEGAME, 6, 90, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"spyfox", "", 0, GID_HEGAME, 6, 90, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
- {"freddi3", "", 0, GID_FREDDI3, 6, 90, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"freddi3", "HE 99", 0, GID_FREDDI3, 6, 99, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"freddi3", "", 0, GID_FREDDI3, 6, 90, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"freddi3", "HE 99", 0, GID_FREDDI3, 6, 99, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
// Humongous Entertainment Scumm Version 9.5 ? Scummsys.95
- {"pajama2", "", 0, GID_HEGAME, 6, 95, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"chase", "", 0, GID_HEGAME, 6, 95, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"pajama2", "", 0, GID_HEGAME, 6, 95, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"chase", "", 0, GID_HEGAME, 6, 95, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
// Humongous Entertainment Scumm Version 9.8 ? Scummsys.98
// these and later games can easily be identified by the .(a) file instead of a .he1
// and INIB chunk in the .he0
- {"lost", "", 0, GID_HEGAME, 6, 98, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"lost", "", 0, GID_HEGAME, 6, 98, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
- {"puttrace", "HE 98", 0, GID_PUTTRACE, 6, 98, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"puttrace", "HE 98.5", 0, GID_PUTTRACE, 6, 98, MDT_NONE, GF_USE_KEY | GF_HE_985, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"puttrace", "HE 99", 0, GID_PUTTRACE, 6, 99, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"puttrace", "HE 98", 0, GID_PUTTRACE, 6, 98, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"puttrace", "HE 98.5", 0, GID_PUTTRACE, 6, 98, MDT_NONE, GF_USE_KEY | GF_HE_985, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"puttrace", "HE 99", 0, GID_PUTTRACE, 6, 99, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
- {"bluesabctime", "", 0, GID_HEGAME, 6, 98, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"BluesBirthday", "", 0, GID_HEGAME, 6, 98, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"BluesBirthday", "Red", 0, GID_BIRTHDAYRED, 6, 98, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"BluesBirthday", "Yellow", 0, GID_BIRTHDAYYELLOW, 6, 98, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"soccer", "", 0, GID_SOCCER, 6, 98, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"bluesabctime", "", 0, GID_HEGAME, 6, 98, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"BluesBirthday", "", 0, GID_HEGAME, 6, 98, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"BluesBirthday", "Red", 0, GID_BIRTHDAYRED, 6, 98, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"BluesBirthday", "Yellow", 0, GID_BIRTHDAYYELLOW, 6, 98, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"soccer", "", 0, GID_SOCCER, 6, 98, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
// Global scripts increased to 2048
- {"blues123time", "", 0, GID_HEGAME, 6, 98, MDT_NONE, GF_USE_KEY | GF_HE_985, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"freddi4", "", 0, GID_HEGAME, 6, 98, MDT_NONE, GF_USE_KEY | GF_HE_985, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"freddi4", "unenc", 0, GID_HEGAME, 6, 98, MDT_NONE, GF_HE_985, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"blues123time", "", 0, GID_HEGAME, 6, 98, MDT_NONE, GF_USE_KEY | GF_HE_985, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"freddi4", "", 0, GID_HEGAME, 6, 98, MDT_NONE, GF_USE_KEY | GF_HE_985, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"freddi4", "unenc", 0, GID_HEGAME, 6, 98, MDT_NONE, GF_HE_985, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
// Humongous Entertainment Scumm Version 9.9 ? Scummsys.99
- {"football", 0, 0, GID_FOOTBALL, 6, 99, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"pajama3", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"puttcircus", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"spyfox2", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"mustard", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"football", 0, 0, GID_FOOTBALL, 6, 99, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"pajama3", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"puttcircus", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"spyfox2", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"mustard", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
// Added the use of fonts
- {"FreddisFunShop", 0, 0, GID_FUNSHOP, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"SamsFunShop", 0, 0, GID_FUNSHOP, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"PuttsFunShop", 0, 0, GID_FUNSHOP, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"FreddisFunShop", 0, 0, GID_FUNSHOP, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"SamsFunShop", 0, 0, GID_FUNSHOP, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"PuttsFunShop", 0, 0, GID_FUNSHOP, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
// Added the use of smacker videos
- {"BluesTreasureHunt", 0, 0, GID_TREASUREHUNT, 6, 99, MDT_NONE, GF_HE_LOCALIZED | GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"BluesTreasureHunt", 0, 0, GID_TREASUREHUNT, 6, 99, MDT_NONE, GF_HE_LOCALIZED | GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
#ifdef USE_RGB_COLOR
// Added 16bit color
- {"arttime", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"baseball2001", 0, 0, GID_BASEBALL2001, 6, 99, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"readtime", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"SoccerMLS", 0, 0, GID_SOCCERMLS, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"spyozon", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"arttime", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"baseball2001", 0, 0, GID_BASEBALL2001, 6, 99, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"readtime", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"SoccerMLS", 0, 0, GID_SOCCERMLS, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"spyozon", 0, 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
- {"freddicove", "", 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"freddicove", "unenc", 0, GID_HEGAME, 6, 99, MDT_NONE, GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"freddicove", "HE 100", 0, GID_HEGAME, 6, 100, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"freddicove", "", 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"freddicove", "unenc", 0, GID_HEGAME, 6, 99, MDT_NONE, GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"freddicove", "HE 100", 0, GID_HEGAME, 6, 100, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
// Restructured the Scumm engine
- {"pjgames", 0, 0, GID_HEGAME, 6, 100, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"pjgames", 0, 0, GID_HEGAME, 6, 100, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
// Added the use of bink videos
- {"Baseball2003", 0, 0, GID_HEGAME, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"basketball", 0, 0, GID_BASKETBALL, 6, 100, MDT_NONE, GF_USE_KEY| GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"football2002", 0, 0, GID_FOOTBALL, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"Soccer2004", 0, 0, GID_SOCCER2004, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"Baseball2003", 0, 0, GID_HEGAME, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"basketball", 0, 0, GID_BASKETBALL, 6, 100, MDT_NONE, GF_USE_KEY| GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"football2002", 0, 0, GID_FOOTBALL, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"Soccer2004", 0, 0, GID_SOCCER2004, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
// U32 code required, for testing only
- {"moonbase", 0, 0, GID_MOONBASE, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"moonbase", "Demo", 0, GID_MOONBASE, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR | GF_DEMO, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"moonbase", 0, 0, GID_MOONBASE, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"moonbase", "Demo", 0, GID_MOONBASE, 6, 100, MDT_NONE, GF_USE_KEY | GF_16BIT_COLOR | GF_DEMO, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
#endif
// The following are meant to be generic HE game variants and as such do
// not specify a game ID. Make sure that these are last in the table, else
// they'll override more specific entries that follow later on.
- {"", "HE 71", 0, GID_HEGAME, 6, 71, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"", "HE 72", 0, GID_HEGAME, 6, 72, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"", "HE 73", 0, GID_HEGAME, 6, 73, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"", "HE 74", 0, GID_HEGAME, 6, 74, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"", "HE 80", 0, GID_HEGAME, 6, 80, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"", "HE 85", 0, GID_HEGAME, 6, 85, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"", "HE 90", 0, GID_HEGAME, 6, 90, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"", "HE 95", 0, GID_HEGAME, 6, 95, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"", "HE 98", 0, GID_HEGAME, 6, 98, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"", "HE 98.5", 0, GID_HEGAME, 6, 98, MDT_NONE, GF_USE_KEY | GF_HE_985, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"", "HE 99", 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
- {"", "HE 100", 0, GID_HEGAME, 6, 100, MDT_NONE, GF_USE_KEY, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
+ {"", "HE 71", 0, GID_HEGAME, 6, 71, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"", "HE 72", 0, GID_HEGAME, 6, 72, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"", "HE 73", 0, GID_HEGAME, 6, 73, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"", "HE 74", 0, GID_HEGAME, 6, 74, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"", "HE 80", 0, GID_HEGAME, 6, 80, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"", "HE 85", 0, GID_HEGAME, 6, 85, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"", "HE 90", 0, GID_HEGAME, 6, 90, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"", "HE 95", 0, GID_HEGAME, 6, 95, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"", "HE 98", 0, GID_HEGAME, 6, 98, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"", "HE 98.5", 0, GID_HEGAME, 6, 98, MDT_NONE, GF_USE_KEY | GF_HE_985, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"", "HE 99", 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
+ {"", "HE 100", 0, GID_HEGAME, 6, 100, MDT_NONE, GF_USE_KEY, UNK, GUIO3(GUIO_NOLAUNCHLOAD, GUIO_NOMIDI, GUIO_NOASPECT)},
#endif
{NULL, NULL, 0, 0, 0, MDT_NONE, 0, 0, UNK, 0}
};
@@ -839,6 +830,7 @@ static const GameFilenamePattern gameFilenamesTable[] = {
{ "puttzoo", "zoodemo", kGenHEPC, UNK_LANG, UNK, 0 },
{ "puttzoo", "Zoo Demo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "puttzoo", "Putt-Putt Saves the Zoo", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
+ { "puttzoo", "game", kGenHEPC, Common::EN_ANY, Common::kPlatformIOS, 0 },
{ "SamsFunShop", "SamsFunShop", kGenHEPC, UNK_LANG, UNK, 0 },
{ "SamsFunShop", "Sam's FunShop", kGenHEMac, UNK_LANG, Common::kPlatformMacintosh, 0 },
diff --git a/engines/scumm/he/script_v80he.cpp b/engines/scumm/he/script_v80he.cpp
index 9711f6415b..eb62b650a4 100644
--- a/engines/scumm/he/script_v80he.cpp
+++ b/engines/scumm/he/script_v80he.cpp
@@ -25,6 +25,7 @@
#include "common/archive.h"
#include "common/config-file.h"
#include "common/config-manager.h"
+#include "common/macresman.h"
#include "common/savefile.h"
#include "common/str.h"
@@ -158,19 +159,41 @@ void ScummEngine_v80he::o80_readConfigFile() {
memcpy(section, "BluesTreasureHunt-Disc2\0", 24);
}
- Common::ConfigFile ConfFile;
- if (!strcmp((char *)filename + r, "map.ini"))
- ConfFile.loadFromFile((const char *)filename + r);
- else
- ConfFile.loadFromSaveFile((const char *)filename + r);
+ if (!strcmp((const char *)filename, "map (i)")) {
+ // Mac resource fork config file
+ // (as used by only mustard mac for map data?)
+ Common::MacResManager resFork;
+
+ if (!resFork.open((const char *)filename) || !resFork.hasResFork())
+ error("Could not open '%s'", filename);
+
+ Common::String prefResName = Common::String::format("Pref:%s.%s", (const char *)section, (const char *)option);
+ Common::SeekableReadStream *res = resFork.getResource(prefResName);
+
+ if (res) {
+ // The string is inside the resource as a pascal string
+ byte length = res->readByte();
+ for (byte i = 0; i < length; i++)
+ entry += (char)res->readByte();
+
+ delete res;
+ }
+ } else {
+ // Normal Windows INI files
+ Common::ConfigFile confFile;
+ if (!strcmp((char *)filename + r, "map.ini"))
+ confFile.loadFromFile((const char *)filename + r);
+ else
+ confFile.loadFromSaveFile((const char *)filename + r);
+
+ confFile.getKey((const char *)option, (const char *)section, entry);
+ }
byte subOp = fetchScriptByte();
switch (subOp) {
case 43: // HE 100
case 6: // number
- ConfFile.getKey((const char *)option, (const char *)section, entry);
-
if (!strcmp((char *)option, "Benchmark"))
push(2);
else
@@ -178,8 +201,6 @@ void ScummEngine_v80he::o80_readConfigFile() {
break;
case 77: // HE 100
case 7: // string
- ConfFile.getKey((const char *)option, (const char *)section, entry);
-
writeVar(0, 0);
len = resStrLen((const byte *)entry.c_str());
data = defineArray(0, kStringArray, 0, 0, 0, len);
diff --git a/engines/scumm/he/script_v90he.cpp b/engines/scumm/he/script_v90he.cpp
index 877f8b239d..0beebdb7a1 100644
--- a/engines/scumm/he/script_v90he.cpp
+++ b/engines/scumm/he/script_v90he.cpp
@@ -2373,6 +2373,9 @@ void ScummEngine_v90he::o90_kernelSetFunctions() {
case 2001:
_logicHE->dispatch(args[1], num - 2, (int32 *)&args[2]);
break;
+ case 201102:
+ // Used in puttzoo iOS
+ break;
default:
error("o90_kernelSetFunctions: default case %d (param count %d)", args[0], num);
}
diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp
index 5c15a85929..85e2a2f1dd 100644
--- a/engines/scumm/he/sound_he.cpp
+++ b/engines/scumm/he/sound_he.cpp
@@ -770,24 +770,30 @@ void SoundHE::startHETalkSound(uint32 offset) {
if (ConfMan.getBool("speech_mute"))
return;
- assert(_sfxFile);
- if (!_sfxFile->isOpen()) {
+ if (_sfxFilename.empty()) {
// This happens in the Pajama Sam's Lost & Found demo, on the
// main menu screen, so don't make it a fatal error.
- warning("startHETalkSound: Speech file is not open");
+ warning("startHETalkSound: Speech file is not found");
return;
}
+ ScummFile file;
+ if (!_vm->openFile(file, _sfxFilename)) {
+ warning("startHETalkSound: Could not open speech file %s", _sfxFilename.c_str());
+ return;
+ }
+ file.setEnc(_sfxFileEncByte);
+
_sfxMode |= 2;
_vm->_res->nukeResource(rtSound, 1);
- _sfxFile->seek(offset + 4, SEEK_SET);
- size = _sfxFile->readUint32BE();
- _sfxFile->seek(offset, SEEK_SET);
+ file.seek(offset + 4, SEEK_SET);
+ size = file.readUint32BE();
+ file.seek(offset, SEEK_SET);
_vm->_res->createResource(rtSound, 1, size);
ptr = _vm->getResourceAddress(rtSound, 1);
- _sfxFile->read(ptr, size);
+ file.read(ptr, size);
int channel = (_vm->VAR_TALK_CHANNEL != 0xFF) ? _vm->VAR(_vm->VAR_TALK_CHANNEL) : 0;
addSoundToQueue2(1, 0, channel, 0);
diff --git a/engines/scumm/he/sprite_he.cpp b/engines/scumm/he/sprite_he.cpp
index 081110c7cd..ec69ae11b4 100644
--- a/engines/scumm/he/sprite_he.cpp
+++ b/engines/scumm/he/sprite_he.cpp
@@ -33,7 +33,12 @@
namespace Scumm {
-Sprite::Sprite(ScummEngine_v90he *vm) : _vm(vm) {
+Sprite::Sprite(ScummEngine_v90he *vm)
+ :
+ _vm(vm),
+ _spriteGroups(0),
+ _spriteTable(0),
+ _activeSpritesTable(0) {
}
Sprite::~Sprite() {
diff --git a/engines/scumm/imuse/imuse_player.cpp b/engines/scumm/imuse/imuse_player.cpp
index 73be2174cd..53ccfb3734 100644
--- a/engines/scumm/imuse/imuse_player.cpp
+++ b/engines/scumm/imuse/imuse_player.cpp
@@ -592,6 +592,7 @@ bool Player::setLoop(uint count, uint tobeat, uint totick, uint frombeat, uint f
if (tobeat == 0)
tobeat = 1;
+ // FIXME: Thread safety?
_loop_counter = 0; // Because of possible interrupts
_loop_to_beat = tobeat;
_loop_to_tick = totick;
diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp
index 6d9e1f3f72..ee2de49475 100644
--- a/engines/scumm/input.cpp
+++ b/engines/scumm/input.cpp
@@ -446,6 +446,23 @@ void ScummEngine_v6::processKeyboard(Common::KeyState lastKeyHit) {
}
void ScummEngine_v2::processKeyboard(Common::KeyState lastKeyHit) {
+ // RETURN is used to skip cutscenes in the Commodote 64 version of Zak McKracken
+ if (_game.id == GID_ZAK &&_game.platform == Common::kPlatformC64 && lastKeyHit.keycode == Common::KEYCODE_RETURN && lastKeyHit.hasFlags(0)) {
+ lastKeyHit = Common::KeyState(Common::KEYCODE_ESCAPE);
+ // F7 is used to skip cutscenes in the Commodote 64 version of Maniac Mansion
+ } else if (_game.id == GID_MANIAC &&_game.platform == Common::kPlatformC64) {
+ if (lastKeyHit.keycode == Common::KEYCODE_F7 && lastKeyHit.hasFlags(0))
+ lastKeyHit = Common::KeyState(Common::KEYCODE_ESCAPE);
+ // 'B' is used to skip cutscenes in the NES version of Maniac Mansion
+ } else if (_game.id == GID_MANIAC &&_game.platform == Common::kPlatformNES) {
+ if (lastKeyHit.keycode == Common::KEYCODE_b && lastKeyHit.hasFlags(Common::KBD_SHIFT))
+ lastKeyHit = Common::KeyState(Common::KEYCODE_ESCAPE);
+ // 'F4' is used to skip cutscenes in the other versions of Maniac Mansion
+ } else if (_game.id == GID_MANIAC) {
+ if (lastKeyHit.keycode == Common::KEYCODE_F4 && lastKeyHit.hasFlags(0))
+ lastKeyHit = Common::KeyState(Common::KEYCODE_ESCAPE);
+ }
+
// Fall back to default behavior
ScummEngine::processKeyboard(lastKeyHit);
diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp
index ae4bbc45a6..da238dc517 100644
--- a/engines/scumm/object.cpp
+++ b/engines/scumm/object.cpp
@@ -1842,7 +1842,7 @@ void ScummEngine::loadFlObject(uint object, uint room) {
if (_dumpScripts) {
char buf[32];
const byte *ptr = foir.obcd;
- sprintf(buf, "roomobj-%d-", room);
+ sprintf(buf, "roomobj-%u-", room);
ptr = findResource(MKTAG('V','E','R','B'), ptr);
dumpResource(buf, object, ptr);
}
diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp
index 2c10758730..bd085dd4d5 100644
--- a/engines/scumm/palette.cpp
+++ b/engines/scumm/palette.cpp
@@ -823,7 +823,7 @@ void ScummEngine::setShadowPalette(int slot, int redScale, int greenScale, int b
if (slot < 0 || slot >= NUM_SHADOW_PALETTE)
error("setShadowPalette: invalid slot %d", slot);
- if (startColor < 0 || startColor > 255 || endColor < 0 || startColor > 255 || endColor < startColor)
+ if (startColor < 0 || startColor > 255 || endColor < 0 || endColor > 255 || endColor < startColor)
error("setShadowPalette: invalid range from %d to %d", startColor, endColor);
table = _shadowPalette + slot * 256;
diff --git a/engines/scumm/player_towns.cpp b/engines/scumm/player_towns.cpp
index f6f493a1e1..2588026e59 100644
--- a/engines/scumm/player_towns.cpp
+++ b/engines/scumm/player_towns.cpp
@@ -75,10 +75,19 @@ void Player_Towns::saveLoadWithSerializer(Serializer *ser) {
}
void Player_Towns::restoreAfterLoad() {
+ Common::Array<uint16> restoredSounds;
+
for (int i = 1; i < 9; i++) {
if (!_pcmCurrentSound[i].index || _pcmCurrentSound[i].index == 0xffff)
continue;
+ // Don't restart multichannel sounds more than once
+ if (Common::find(restoredSounds.begin(), restoredSounds.end(), _pcmCurrentSound[i].index) != restoredSounds.end())
+ continue;
+
+ if (!_v2)
+ restoredSounds.push_back(_pcmCurrentSound[i].index);
+
uint8 *ptr = _vm->getResourceAddress(rtSound, _pcmCurrentSound[i].index);
if (!ptr)
continue;
diff --git a/engines/scumm/player_v2a.cpp b/engines/scumm/player_v2a.cpp
index ed97c4098f..07fc77b301 100644
--- a/engines/scumm/player_v2a.cpp
+++ b/engines/scumm/player_v2a.cpp
@@ -31,7 +31,7 @@ namespace Scumm {
static uint32 CRCtable[256];
-static void InitCRC () {
+static void InitCRC() {
const uint32 poly = 0xEDB88320;
int i, j;
uint32 n;
@@ -44,7 +44,7 @@ static void InitCRC () {
}
}
-static uint32 GetCRC (byte *data, int len) {
+static uint32 GetCRC(byte *data, int len) {
uint32 CRC = 0xFFFFFFFF;
int i;
for (i = 0; i < len; i++)
@@ -131,7 +131,7 @@ public:
_mod->stopChannel(_id | (_chan[i].chan << 8));
} else {
_mod->setChannelVol(_id | (_chan[i].chan << 8),
- READ_BE_UINT16(_data + _chan[i].volbase + (_chan[i].volptr++ << 1)));
+ READ_BE_UINT16(_data + _chan[i].volbase + (_chan[i].volptr++ << 1)));
if (_chan[i].volptr == 0) {
_mod->stopChannel(_id | (_chan[i].chan << 8));
_chan[i].dur = 0;
@@ -163,7 +163,7 @@ public:
_chan[i].volptr = 0;
_chan[i].chan = READ_BE_UINT16(_data + _chan[i].dataptr + 6) & 0x3;
- if (_chan[i].dur) // if there's something playing, stop it
+ if (_chan[i].dur) // if there's something playing, stop it
_mod->stopChannel(_id | (_chan[i].chan << 8));
_chan[i].dur = READ_BE_UINT16(_data + _chan[i].dataptr + 4);
@@ -173,7 +173,8 @@ public:
int pan;
if ((_chan[i].chan == 0) || (_chan[i].chan == 3))
pan = -127;
- else pan = 127;
+ else
+ pan = 127;
int offset = READ_BE_UINT16(_data + _instoff + (inst << 5) + 0x14);
int len = READ_BE_UINT16(_data + _instoff + (inst << 5) + 0x18);
int loopoffset = READ_BE_UINT16(_data + _instoff + (inst << 5) + 0x16);
@@ -873,7 +874,7 @@ private:
uint16 _freq4;
int16 _step4;
- void updatefreq (uint16 &freq, int16 &step, uint16 min, uint16 max) {
+ void updatefreq(uint16 &freq, int16 &step, uint16 min, uint16 max) {
freq += step;
if (freq <= min) {
freq = min;
@@ -1004,8 +1005,7 @@ public:
if (_curvol == 0)
return false;
_mod->setChannelVol(_id, (_curvol << 2) | (_curvol >> 4));
- }
- else {
+ } else {
if (_freq1 < _freq2)
_curfreq++;
else
@@ -1691,7 +1691,7 @@ public:
assert(_id);
const uint16 _minvol[2] = {0x2E, 0x32};
int i;
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < 4; i++) {
_mod->setChannelFreq(_id | (i << 8), BASE_FREQUENCY / _freq[i]);
_mod->setChannelVol(_id | (i << 8), _vol[i]);
}
@@ -1704,7 +1704,7 @@ public:
_vol[i] = _minvol[i];
_volmod[i] = -_volmod[i];
}
- _vol[i+2] = _vol[i];
+ _vol[i + 2] = _vol[i];
}
_freq[0] += _freqmod;
if (_freq[0] > 0x2BC) {
@@ -1731,113 +1731,113 @@ private:
if (crc == CRC) \
return new SOUND
-static V2A_Sound *findSound (unsigned long crc) {
- CRCToSound(0x8FAB08C4, V2A_Sound_SingleLooped(0x006C,0x2B58,0x016E,0x3F)); // Maniac 17
- CRCToSound(0xB673160A, V2A_Sound_SingleLooped(0x006C,0x1E78,0x01C2,0x1E)); // Maniac 38
- CRCToSound(0x4DB1D0B2, V2A_Sound_MultiLooped(0x0072,0x1BC8,0x023D,0x3F,0x0224,0x3F)); // Maniac 20
- CRCToSound(0x754D75EF, V2A_Sound_Single(0x0076,0x0738,0x01FC,0x3F)); // Maniac 10
- CRCToSound(0x6E3454AF, V2A_Sound_Single(0x0076,0x050A,0x017C,0x3F)); // Maniac 12
- CRCToSound(0x92F0BBB6, V2A_Sound_Single(0x0076,0x3288,0x012E,0x3F)); // Maniac 41
- CRCToSound(0xE1B13982, V2A_Sound_MultiLoopedDuration(0x0078,0x0040,0x007C,0x3F,0x007B,0x3F,0x001E)); // Maniac 21
- CRCToSound(0x288B16CF, V2A_Sound_MultiLoopedDuration(0x007A,0x0040,0x007C,0x3F,0x007B,0x3F,0x000A)); // Maniac 11
- CRCToSound(0xA7565268, V2A_Sound_MultiLoopedDuration(0x007A,0x0040,0x00F8,0x3F,0x00F7,0x3F,0x000A)); // Maniac 19
- CRCToSound(0x7D419BFC, V2A_Sound_MultiLoopedDuration(0x007E,0x0040,0x012C,0x3F,0x0149,0x3F,0x001E)); // Maniac 22
- CRCToSound(0x1B52280C, V2A_Sound_Single(0x0098,0x0A58,0x007F,0x32)); // Maniac 6
- CRCToSound(0x38D4A810, V2A_Sound_Single(0x0098,0x2F3C,0x0258,0x32)); // Maniac 7
- CRCToSound(0x09F98FC2, V2A_Sound_Single(0x0098,0x0A56,0x012C,0x32)); // Maniac 16
- CRCToSound(0x90440A65, V2A_Sound_Single(0x0098,0x0208,0x0078,0x28)); // Maniac 28
- CRCToSound(0x985C76EF, V2A_Sound_Single(0x0098,0x0D6E,0x00C8,0x32)); // Maniac 30
- CRCToSound(0x76156137, V2A_Sound_Single(0x0098,0x2610,0x017C,0x39)); // Maniac 39
- CRCToSound(0x5D95F88C, V2A_Sound_Single(0x0098,0x0A58,0x007F,0x1E)); // Maniac 65
- CRCToSound(0x92D704EA, V2A_Sound_SingleLooped(0x009C,0x29BC,0x012C,0x3F,0x1BD4,0x0DE8)); // Maniac 15
- CRCToSound(0x92F5513C, V2A_Sound_Single(0x009E,0x0DD4,0x01F4,0x3F)); // Maniac 13
- CRCToSound(0xCC2F3B5A, V2A_Sound_Single(0x009E,0x00DE,0x01AC,0x3F)); // Maniac 43
- CRCToSound(0x153207D3, V2A_Sound_Single(0x009E,0x0E06,0x02A8,0x3F)); // Maniac 67
- CRCToSound(0xC4F370CE, V2A_Sound_Single(0x00AE,0x0330,0x01AC,0x3F)); // Maniac 8
- CRCToSound(0x928C4BAC, V2A_Sound_Single(0x00AE,0x08D6,0x01AC,0x3F)); // Maniac 9
- CRCToSound(0x62D5B11F, V2A_Sound_Single(0x00AE,0x165C,0x01CB,0x3F)); // Maniac 27
- CRCToSound(0x3AB22CB5, V2A_Sound_Single(0x00AE,0x294E,0x012A,0x3F)); // Maniac 62
- CRCToSound(0x2D70BBE9, V2A_Sound_SingleLoopedPitchbend(0x00B4,0x1702,0x03E8,0x0190,0x3F,5)); // Maniac 64
- CRCToSound(0xFA4C1B1C, V2A_Sound_Special_Maniac69(0x00B2,0x1702,0x0190,0x3F)); // Maniac 69
- CRCToSound(0x19D50D67, V2A_Sound_Special_ManiacDing(0x00B6,0x0020,0x00C8,16,2)); // Maniac 14
- CRCToSound(0x3E6FBE15, V2A_Sound_Special_ManiacTentacle(0x00B2,0x0010,0x007C,0x016D,1)); // Maniac 25
- CRCToSound(0x5305753C, V2A_Sound_Special_ManiacTentacle(0x00B2,0x0010,0x007C,0x016D,7)); // Maniac 36
- CRCToSound(0x28895106, V2A_Sound_Special_Maniac59(0x00C0,0x00FE,0x00E9,0x0111,4,0x0A)); // Maniac 59
- CRCToSound(0xB641ACF6, V2A_Sound_Special_Maniac61(0x00C8,0x0100,0x00C8,0x01C2)); // Maniac 61
- CRCToSound(0xE1A91583, V2A_Sound_Special_ManiacPhone(0x00D0,0x0040,0x007C,0x3F,0x007B,0x3F,0x3C,5,6)); // Maniac 23
- CRCToSound(0x64816ED5, V2A_Sound_Special_ManiacPhone(0x00D0,0x0040,0x00BE,0x37,0x00BD,0x37,0x3C,5,6)); // Maniac 24
- CRCToSound(0x639D72C2, V2A_Sound_Special_Maniac46(0x00D0,0x10A4,0x0080,0x3F,0x28,3)); // Maniac 46
- CRCToSound(0xE8826D92, V2A_Sound_Special_ManiacTypewriter(0x00EC,0x025A,0x023C,0x3F,8,(const uint8 *)"\x20\x41\x04\x21\x08\x10\x13\x07", true)); // Maniac 45
- CRCToSound(0xEDFF3D41, V2A_Sound_Single(0x00F8,0x2ADE,0x01F8,0x3F)); // Maniac 42 (this should echo, but it's barely noticeable and I don't feel like doing it)
- CRCToSound(0x15606D06, V2A_Sound_Special_Maniac32(0x0148,0x0020,0x0168,0x0020,0x3F)); // Maniac 32
- CRCToSound(0x753EAFE3, V2A_Sound_Special_Maniac44(0x017C,0x0010,0x018C,0x0020,0x00C8,0x0080,0x3F)); // Maniac 44
- CRCToSound(0xB1AB065C, V2A_Sound_Music(0x0032,0x00B2,0x08B2,0x1222,0x1A52,0x23C2,0x3074,false)); // Maniac 50
- CRCToSound(0x091F5D9C, V2A_Sound_Music(0x0032,0x0132,0x0932,0x1802,0x23D2,0x3EA2,0x4F04,false)); // Maniac 58
-
- CRCToSound(0x8E2C8AB3, V2A_Sound_SingleLooped(0x005C,0x0F26,0x0168,0x3C)); // Zak 41
- CRCToSound(0x3792071F, V2A_Sound_SingleLooped(0x0060,0x1A18,0x06A4,0x3F)); // Zak 88
- CRCToSound(0xF192EDE9, V2A_Sound_SingleLooped(0x0062,0x0054,0x01FC,0x1E)); // Zak 68
- CRCToSound(0xC43B0245, V2A_Sound_Special_Zak70(0x006C,0x166E,0x00C8,0x0190,0x0320,0x0640,0x32)); // Zak 70
- CRCToSound(0xCEB51670, V2A_Sound_SingleLooped(0x00AC,0x26DC,0x012C,0x3F)); // Zak 42
- CRCToSound(0x10347B51, V2A_Sound_SingleLooped(0x006C,0x00E0,0x0594,0x3F)); // Zak 18
- CRCToSound(0x9D2FADC0, V2A_Sound_MultiLooped(0x0072,0x1FC8,0x016A,0x3F,0x01CE,0x3F)); // Zak 80
- CRCToSound(0xFAD2C676, V2A_Sound_MultiLooped(0x0076,0x0010,0x0080,0x3F,0x0090,0x3B)); // Zak 40
- CRCToSound(0x01508B48, V2A_Sound_Single(0x0076,0x0D8C,0x017C,0x3F)); // Zak 90
- CRCToSound(0x9C18DC46, V2A_Sound_Single(0x0076,0x0D8C,0x015E,0x3F)); // Zak 91
- CRCToSound(0xF98F7EAC, V2A_Sound_Single(0x0076,0x0D8C,0x0140,0x3F)); // Zak 92
- CRCToSound(0xC925FBEF, V2A_Sound_MultiLoopedDuration(0x0080,0x0010,0x0080,0x3F,0x0090,0x3B,0x0168)); // Zak 53
- CRCToSound(0xCAB35257, V2A_Sound_Special_Zak101(0x00DA,0x425C,0x023C,0x08F0,0x0640,0x0478,0x3F,0x012C)); // Zak 101
- CRCToSound(0xA31FE4FD, V2A_Sound_Single(0x0094,0x036A,0x00E1,0x3F)); // Zak 97
- CRCToSound(0x0A1AE0F5, V2A_Sound_Single(0x009E,0x0876,0x0168,0x3F)); // Zak 5
- CRCToSound(0xD01A66CB, V2A_Sound_Single(0x009E,0x04A8,0x0168,0x3F)); // Zak 47
- CRCToSound(0x5497B912, V2A_Sound_Single(0x009E,0x0198,0x01F4,0x3F)); // Zak 39
- CRCToSound(0x2B50362F, V2A_Sound_Single(0x009E,0x09B6,0x023D,0x3F)); // Zak 67
- CRCToSound(0x7BFB6E72, V2A_Sound_Single(0x009E,0x0D14,0x0078,0x3F)); // Zak 69
- CRCToSound(0xB803A792, V2A_Sound_Single(0x009E,0x2302,0x02BC,0x3F)); // Zak 78
- CRCToSound(0x7AB82E39, V2A_Sound_SingleLooped(0x00A0,0x2A3C,0x016E,0x3F,0x1018,0x1A24)); // Zak 100
- CRCToSound(0x28057CEC, V2A_Sound_Single(0x0098,0x0FEC,0x0140,0x32)); // Zak 63
- CRCToSound(0x1180A2FC, V2A_Sound_Single(0x0098,0x0F06,0x0190,0x32)); // Zak 64
- CRCToSound(0x12616755, V2A_Sound_Single(0x0098,0x14C8,0x023C,0x14)); // Zak 9
- CRCToSound(0x642723AA, V2A_Sound_Special_Zak37(0x00A2,0x1702,0x01F4,0x3F)); // Zak 37
- CRCToSound(0xDEE56848, V2A_Sound_Single(0x009A,0x0F86,0x0100,0x3F)); // Zak 93
- CRCToSound(0xF9BE27B8, V2A_Sound_Special_Zak37(0x011C,0x1704,0x0228,0x3F)); // Zak 113
- CRCToSound(0xC73487B2, V2A_Sound_Single(0x00B0,0x18BA,0x0478,0x3F)); // Zak 81
- CRCToSound(0x32D8F925, V2A_Sound_Single(0x00B0,0x2E46,0x00F0,0x3F)); // Zak 94
- CRCToSound(0x988C83A5, V2A_Sound_Single(0x00B0,0x0DE0,0x025B,0x3F)); // Zak 106
- CRCToSound(0x8F1E3B3D, V2A_Sound_Single(0x00B0,0x05FE,0x04E2,0x3F)); // Zak 107
- CRCToSound(0x0A2A7646, V2A_Sound_Single(0x00B0,0x36FE,0x016E,0x3F)); // Zak 43
- CRCToSound(0x6F1FC435, V2A_Sound_Single(0x00B0,0x2808,0x044C,0x3F)); // Zak 108
- CRCToSound(0x870EFC29, V2A_Sound_SingleLoopedPitchbend(0x00BA,0x0100,0x03E8,0x00C8,0x3F,3)); // Zak 55
- CRCToSound(0xED773699, V2A_Sound_Special_ManiacDing(0x00B4,0x0020,0x012C,8,4)); // Zak 3
- CRCToSound(0x0BF59774, V2A_Sound_Special_ZakStereoDing(0x00BE,0x0020,0x00F8,0x00F7,8,1)); // Zak 72
- CRCToSound(0x656FFEDE, V2A_Sound_Special_ZakStereoDing(0x00BE,0x0020,0x00C4,0x00C3,8,1)); // Zak 73
- CRCToSound(0xFC4D41E5, V2A_Sound_Special_ZakStereoDing(0x00BE,0x0020,0x00A5,0x00A4,8,1)); // Zak 74
- CRCToSound(0xC0DD2089, V2A_Sound_Special_ZakStereoDing(0x00BE,0x0020,0x009C,0x009B,8,1)); // Zak 75
- CRCToSound(0x627DFD92, V2A_Sound_Special_ZakStereoDing(0x00BE,0x0020,0x008B,0x008A,8,1)); // Zak 76
- CRCToSound(0x703E05C1, V2A_Sound_Special_ZakStereoDing(0x00BE,0x0020,0x007C,0x007B,8,1)); // Zak 77
- CRCToSound(0xB0F77006, V2A_Sound_Special_Zak52(0x00B0,0x01BC)); // Zak 52
- CRCToSound(0x5AE9D6A7, V2A_Sound_Special_ZakAirplane(0x00CA,0x22A4,0x0113,0x0227)); // Zak 109
- CRCToSound(0xABE0D3B0, V2A_Sound_Special_ZakAirplane(0x00CE,0x22A4,0x0227,0x0113)); // Zak 105
- CRCToSound(0x788CC749, V2A_Sound_Special_Zak71(0x00C8,0x0B37)); // Zak 71
- CRCToSound(0x2E2AB1FA, V2A_Sound_Special_Zak99(0x00D4,0x04F0,0x0FE3,0x0080,0x3F)); // Zak 99
- CRCToSound(0x1304CF20, V2A_Sound_Special_ManiacTypewriter(0x00DC,0x0624,0x023C,0x3C,2,(const uint8 *)"\x14\x11",false)); // Zak 79
- CRCToSound(0xAE68ED91, V2A_Sound_Special_Zak54(0x00D4,0x1A25,0x1E1E,0x0B80,0x01F4)); // Zak 54
- CRCToSound(0xA4F40F97, V2A_Sound_Special_Zak61(0x00E4,0x0020)); // Zak 61
- CRCToSound(0x348F85CE, V2A_Sound_Special_Zak62(0x00E4,0x0020)); // Zak 62
- CRCToSound(0xD473AB86, V2A_Sound_Special_ManiacTypewriter(0x0122,0x03E8,0x00BE,0x3F,7,(const uint8 *)"\x0F\x0B\x04\x0F\x1E\x0F\x66",false)); // Zak 46
- CRCToSound(0x84A0BA90, V2A_Sound_Special_Zak110(0x0126,0x0040,0x0136,0x0080,0x007C,0x0087)); // Zak 110
- CRCToSound(0x92680D9F, V2A_Sound_Special_Zak32(0x0140,0x0150,0x0010,0x0010)); // Zak 32
- CRCToSound(0xABFFDB02, V2A_Sound_Special_Zak86(0x01A2,0x2BAE)); // Zak 86
- CRCToSound(0x41045447, V2A_Sound_Special_Zak98(0x017A,0x0020)); // Zak 98
- CRCToSound(0xC8EEBD34, V2A_Sound_Special_Zak82(0x01A6,0x3900)); // Zak 82
- CRCToSound(0x42F9469F, V2A_Sound_Music(0x05F6,0x0636,0x0456,0x0516,0x05D6,0x05E6,0x0A36,true)); // Zak 96
- CRCToSound(0x038BBD78, V2A_Sound_Music(0x054E,0x05CE,0x044E,0x04BE,0x052E,0x053E,0x0BCE,true)); // Zak 85
- CRCToSound(0x06FFADC5, V2A_Sound_Music(0x0626,0x0686,0x0446,0x04F6,0x0606,0x0616,0x0C86,true)); // Zak 87
- CRCToSound(0xCE20ECF0, V2A_Sound_Music(0x0636,0x0696,0x0446,0x0576,0x0616,0x0626,0x0E96,true)); // Zak 114
- CRCToSound(0xBDA01BB6, V2A_Sound_Music(0x0678,0x06B8,0x0458,0x0648,0x0658,0x0668,0x0EB8,false)); // Zak 33
- CRCToSound(0x59976529, V2A_Sound_Music(0x088E,0x092E,0x048E,0x05EE,0x074E,0x07EE,0x112E,true)); // Zak 49
- CRCToSound(0xED1EED02, V2A_Sound_Music(0x08D0,0x0950,0x0440,0x07E0,0x08B0,0x08C0,0x1350,false)); // Zak 112
- CRCToSound(0x5A16C037, V2A_Sound_Music(0x634A,0x64CA,0x049A,0x18FA,0x398A,0x511A,0x6CCA,false)); // Zak 95
+static V2A_Sound *findSound(unsigned long crc) {
+ CRCToSound(0x8FAB08C4, V2A_Sound_SingleLooped(0x006C, 0x2B58, 0x016E, 0x3F)); // Maniac 17
+ CRCToSound(0xB673160A, V2A_Sound_SingleLooped(0x006C, 0x1E78, 0x01C2, 0x1E)); // Maniac 38
+ CRCToSound(0x4DB1D0B2, V2A_Sound_MultiLooped(0x0072, 0x1BC8, 0x023D, 0x3F, 0x0224, 0x3F)); // Maniac 20
+ CRCToSound(0x754D75EF, V2A_Sound_Single(0x0076, 0x0738, 0x01FC, 0x3F)); // Maniac 10
+ CRCToSound(0x6E3454AF, V2A_Sound_Single(0x0076, 0x050A, 0x017C, 0x3F)); // Maniac 12
+ CRCToSound(0x92F0BBB6, V2A_Sound_Single(0x0076, 0x3288, 0x012E, 0x3F)); // Maniac 41
+ CRCToSound(0xE1B13982, V2A_Sound_MultiLoopedDuration(0x0078, 0x0040, 0x007C, 0x3F, 0x007B, 0x3F, 0x001E)); // Maniac 21
+ CRCToSound(0x288B16CF, V2A_Sound_MultiLoopedDuration(0x007A, 0x0040, 0x007C, 0x3F, 0x007B, 0x3F, 0x000A)); // Maniac 11
+ CRCToSound(0xA7565268, V2A_Sound_MultiLoopedDuration(0x007A, 0x0040, 0x00F8, 0x3F, 0x00F7, 0x3F, 0x000A)); // Maniac 19
+ CRCToSound(0x7D419BFC, V2A_Sound_MultiLoopedDuration(0x007E, 0x0040, 0x012C, 0x3F, 0x0149, 0x3F, 0x001E)); // Maniac 22
+ CRCToSound(0x1B52280C, V2A_Sound_Single(0x0098, 0x0A58, 0x007F, 0x32)); // Maniac 6
+ CRCToSound(0x38D4A810, V2A_Sound_Single(0x0098, 0x2F3C, 0x0258, 0x32)); // Maniac 7
+ CRCToSound(0x09F98FC2, V2A_Sound_Single(0x0098, 0x0A56, 0x012C, 0x32)); // Maniac 16
+ CRCToSound(0x90440A65, V2A_Sound_Single(0x0098, 0x0208, 0x0078, 0x28)); // Maniac 28
+ CRCToSound(0x985C76EF, V2A_Sound_Single(0x0098, 0x0D6E, 0x00C8, 0x32)); // Maniac 30
+ CRCToSound(0x76156137, V2A_Sound_Single(0x0098, 0x2610, 0x017C, 0x39)); // Maniac 39
+ CRCToSound(0x5D95F88C, V2A_Sound_Single(0x0098, 0x0A58, 0x007F, 0x1E)); // Maniac 65
+ CRCToSound(0x92D704EA, V2A_Sound_SingleLooped(0x009C, 0x29BC, 0x012C, 0x3F, 0x1BD4, 0x0DE8)); // Maniac 15
+ CRCToSound(0x92F5513C, V2A_Sound_Single(0x009E, 0x0DD4, 0x01F4, 0x3F)); // Maniac 13
+ CRCToSound(0xCC2F3B5A, V2A_Sound_Single(0x009E, 0x00DE, 0x01AC, 0x3F)); // Maniac 43
+ CRCToSound(0x153207D3, V2A_Sound_Single(0x009E, 0x0E06, 0x02A8, 0x3F)); // Maniac 67
+ CRCToSound(0xC4F370CE, V2A_Sound_Single(0x00AE, 0x0330, 0x01AC, 0x3F)); // Maniac 8
+ CRCToSound(0x928C4BAC, V2A_Sound_Single(0x00AE, 0x08D6, 0x01AC, 0x3F)); // Maniac 9
+ CRCToSound(0x62D5B11F, V2A_Sound_Single(0x00AE, 0x165C, 0x01CB, 0x3F)); // Maniac 27
+ CRCToSound(0x3AB22CB5, V2A_Sound_Single(0x00AE, 0x294E, 0x012A, 0x3F)); // Maniac 62
+ CRCToSound(0x2D70BBE9, V2A_Sound_SingleLoopedPitchbend(0x00B4, 0x1702, 0x03E8, 0x0190, 0x3F, 5)); // Maniac 64
+ CRCToSound(0xFA4C1B1C, V2A_Sound_Special_Maniac69(0x00B2, 0x1702, 0x0190, 0x3F)); // Maniac 69
+ CRCToSound(0x19D50D67, V2A_Sound_Special_ManiacDing(0x00B6, 0x0020, 0x00C8, 16, 2)); // Maniac 14
+ CRCToSound(0x3E6FBE15, V2A_Sound_Special_ManiacTentacle(0x00B2, 0x0010, 0x007C, 0x016D, 1)); // Maniac 25
+ CRCToSound(0x5305753C, V2A_Sound_Special_ManiacTentacle(0x00B2, 0x0010, 0x007C, 0x016D, 7)); // Maniac 36
+ CRCToSound(0x28895106, V2A_Sound_Special_Maniac59(0x00C0, 0x00FE, 0x00E9, 0x0111, 4, 0x0A)); // Maniac 59
+ CRCToSound(0xB641ACF6, V2A_Sound_Special_Maniac61(0x00C8, 0x0100, 0x00C8, 0x01C2)); // Maniac 61
+ CRCToSound(0xE1A91583, V2A_Sound_Special_ManiacPhone(0x00D0, 0x0040, 0x007C, 0x3F, 0x007B, 0x3F, 0x3C, 5, 6)); // Maniac 23
+ CRCToSound(0x64816ED5, V2A_Sound_Special_ManiacPhone(0x00D0, 0x0040, 0x00BE, 0x37, 0x00BD, 0x37, 0x3C, 5, 6)); // Maniac 24
+ CRCToSound(0x639D72C2, V2A_Sound_Special_Maniac46(0x00D0, 0x10A4, 0x0080, 0x3F, 0x28, 3)); // Maniac 46
+ CRCToSound(0xE8826D92, V2A_Sound_Special_ManiacTypewriter(0x00EC, 0x025A, 0x023C, 0x3F, 8, (const uint8 *)"\x20\x41\x04\x21\x08\x10\x13\x07", true)); // Maniac 45
+ CRCToSound(0xEDFF3D41, V2A_Sound_Single(0x00F8, 0x2ADE, 0x01F8, 0x3F)); // Maniac 42 (this should echo, but it's barely noticeable and I don't feel like doing it)
+ CRCToSound(0x15606D06, V2A_Sound_Special_Maniac32(0x0148, 0x0020, 0x0168, 0x0020, 0x3F)); // Maniac 32
+ CRCToSound(0x753EAFE3, V2A_Sound_Special_Maniac44(0x017C, 0x0010, 0x018C, 0x0020, 0x00C8, 0x0080, 0x3F)); // Maniac 44
+ CRCToSound(0xB1AB065C, V2A_Sound_Music(0x0032, 0x00B2, 0x08B2, 0x1222, 0x1A52, 0x23C2, 0x3074, false)); // Maniac 50
+ CRCToSound(0x091F5D9C, V2A_Sound_Music(0x0032, 0x0132, 0x0932, 0x1802, 0x23D2, 0x3EA2, 0x4F04, false)); // Maniac 58
+
+ CRCToSound(0x8E2C8AB3, V2A_Sound_SingleLooped(0x005C, 0x0F26, 0x0168, 0x3C)); // Zak 41
+ CRCToSound(0x3792071F, V2A_Sound_SingleLooped(0x0060, 0x1A18, 0x06A4, 0x3F)); // Zak 88
+ CRCToSound(0xF192EDE9, V2A_Sound_SingleLooped(0x0062, 0x0054, 0x01FC, 0x1E)); // Zak 68
+ CRCToSound(0xC43B0245, V2A_Sound_Special_Zak70(0x006C, 0x166E, 0x00C8, 0x0190, 0x0320, 0x0640, 0x32)); // Zak 70
+ CRCToSound(0xCEB51670, V2A_Sound_SingleLooped(0x00AC, 0x26DC, 0x012C, 0x3F)); // Zak 42
+ CRCToSound(0x10347B51, V2A_Sound_SingleLooped(0x006C, 0x00E0, 0x0594, 0x3F)); // Zak 18
+ CRCToSound(0x9D2FADC0, V2A_Sound_MultiLooped(0x0072, 0x1FC8, 0x016A, 0x3F, 0x01CE, 0x3F)); // Zak 80
+ CRCToSound(0xFAD2C676, V2A_Sound_MultiLooped(0x0076, 0x0010, 0x0080, 0x3F, 0x0090, 0x3B)); // Zak 40
+ CRCToSound(0x01508B48, V2A_Sound_Single(0x0076, 0x0D8C, 0x017C, 0x3F)); // Zak 90
+ CRCToSound(0x9C18DC46, V2A_Sound_Single(0x0076, 0x0D8C, 0x015E, 0x3F)); // Zak 91
+ CRCToSound(0xF98F7EAC, V2A_Sound_Single(0x0076, 0x0D8C, 0x0140, 0x3F)); // Zak 92
+ CRCToSound(0xC925FBEF, V2A_Sound_MultiLoopedDuration(0x0080, 0x0010, 0x0080, 0x3F, 0x0090, 0x3B, 0x0168)); // Zak 53
+ CRCToSound(0xCAB35257, V2A_Sound_Special_Zak101(0x00DA, 0x425C, 0x023C, 0x08F0, 0x0640, 0x0478, 0x3F, 0x012C)); // Zak 101
+ CRCToSound(0xA31FE4FD, V2A_Sound_Single(0x0094, 0x036A, 0x00E1, 0x3F)); // Zak 97
+ CRCToSound(0x0A1AE0F5, V2A_Sound_Single(0x009E, 0x0876, 0x0168, 0x3F)); // Zak 5
+ CRCToSound(0xD01A66CB, V2A_Sound_Single(0x009E, 0x04A8, 0x0168, 0x3F)); // Zak 47
+ CRCToSound(0x5497B912, V2A_Sound_Single(0x009E, 0x0198, 0x01F4, 0x3F)); // Zak 39
+ CRCToSound(0x2B50362F, V2A_Sound_Single(0x009E, 0x09B6, 0x023D, 0x3F)); // Zak 67
+ CRCToSound(0x7BFB6E72, V2A_Sound_Single(0x009E, 0x0D14, 0x0078, 0x3F)); // Zak 69
+ CRCToSound(0xB803A792, V2A_Sound_Single(0x009E, 0x2302, 0x02BC, 0x3F)); // Zak 78
+ CRCToSound(0x7AB82E39, V2A_Sound_SingleLooped(0x00A0, 0x2A3C, 0x016E, 0x3F, 0x1018, 0x1A24)); // Zak 100
+ CRCToSound(0x28057CEC, V2A_Sound_Single(0x0098, 0x0FEC, 0x0140, 0x32)); // Zak 63
+ CRCToSound(0x1180A2FC, V2A_Sound_Single(0x0098, 0x0F06, 0x0190, 0x32)); // Zak 64
+ CRCToSound(0x12616755, V2A_Sound_Single(0x0098, 0x14C8, 0x023C, 0x14)); // Zak 9
+ CRCToSound(0x642723AA, V2A_Sound_Special_Zak37(0x00A2, 0x1702, 0x01F4, 0x3F)); // Zak 37
+ CRCToSound(0xDEE56848, V2A_Sound_Single(0x009A, 0x0F86, 0x0100, 0x3F)); // Zak 93
+ CRCToSound(0xF9BE27B8, V2A_Sound_Special_Zak37(0x011C, 0x1704, 0x0228, 0x3F)); // Zak 113
+ CRCToSound(0xC73487B2, V2A_Sound_Single(0x00B0, 0x18BA, 0x0478, 0x3F)); // Zak 81
+ CRCToSound(0x32D8F925, V2A_Sound_Single(0x00B0, 0x2E46, 0x00F0, 0x3F)); // Zak 94
+ CRCToSound(0x988C83A5, V2A_Sound_Single(0x00B0, 0x0DE0, 0x025B, 0x3F)); // Zak 106
+ CRCToSound(0x8F1E3B3D, V2A_Sound_Single(0x00B0, 0x05FE, 0x04E2, 0x3F)); // Zak 107
+ CRCToSound(0x0A2A7646, V2A_Sound_Single(0x00B0, 0x36FE, 0x016E, 0x3F)); // Zak 43
+ CRCToSound(0x6F1FC435, V2A_Sound_Single(0x00B0, 0x2808, 0x044C, 0x3F)); // Zak 108
+ CRCToSound(0x870EFC29, V2A_Sound_SingleLoopedPitchbend(0x00BA, 0x0100, 0x03E8, 0x00C8, 0x3F, 3)); // Zak 55
+ CRCToSound(0xED773699, V2A_Sound_Special_ManiacDing(0x00B4, 0x0020, 0x012C, 8, 4)); // Zak 3
+ CRCToSound(0x0BF59774, V2A_Sound_Special_ZakStereoDing(0x00BE, 0x0020, 0x00F8, 0x00F7, 8, 1)); // Zak 72
+ CRCToSound(0x656FFEDE, V2A_Sound_Special_ZakStereoDing(0x00BE, 0x0020, 0x00C4, 0x00C3, 8, 1)); // Zak 73
+ CRCToSound(0xFC4D41E5, V2A_Sound_Special_ZakStereoDing(0x00BE, 0x0020, 0x00A5, 0x00A4, 8, 1)); // Zak 74
+ CRCToSound(0xC0DD2089, V2A_Sound_Special_ZakStereoDing(0x00BE, 0x0020, 0x009C, 0x009B, 8, 1)); // Zak 75
+ CRCToSound(0x627DFD92, V2A_Sound_Special_ZakStereoDing(0x00BE, 0x0020, 0x008B, 0x008A, 8, 1)); // Zak 76
+ CRCToSound(0x703E05C1, V2A_Sound_Special_ZakStereoDing(0x00BE, 0x0020, 0x007C, 0x007B, 8, 1)); // Zak 77
+ CRCToSound(0xB0F77006, V2A_Sound_Special_Zak52(0x00B0, 0x01BC)); // Zak 52
+ CRCToSound(0x5AE9D6A7, V2A_Sound_Special_ZakAirplane(0x00CA, 0x22A4, 0x0113, 0x0227)); // Zak 109
+ CRCToSound(0xABE0D3B0, V2A_Sound_Special_ZakAirplane(0x00CE, 0x22A4, 0x0227, 0x0113)); // Zak 105
+ CRCToSound(0x788CC749, V2A_Sound_Special_Zak71(0x00C8, 0x0B37)); // Zak 71
+ CRCToSound(0x2E2AB1FA, V2A_Sound_Special_Zak99(0x00D4, 0x04F0, 0x0FE3, 0x0080, 0x3F)); // Zak 99
+ CRCToSound(0x1304CF20, V2A_Sound_Special_ManiacTypewriter(0x00DC, 0x0624, 0x023C, 0x3C, 2, (const uint8 *)"\x14\x11", false)); // Zak 79
+ CRCToSound(0xAE68ED91, V2A_Sound_Special_Zak54(0x00D4, 0x1A25, 0x1E1E, 0x0B80, 0x01F4)); // Zak 54
+ CRCToSound(0xA4F40F97, V2A_Sound_Special_Zak61(0x00E4, 0x0020)); // Zak 61
+ CRCToSound(0x348F85CE, V2A_Sound_Special_Zak62(0x00E4, 0x0020)); // Zak 62
+ CRCToSound(0xD473AB86, V2A_Sound_Special_ManiacTypewriter(0x0122, 0x03E8, 0x00BE, 0x3F, 7, (const uint8 *)"\x0F\x0B\x04\x0F\x1E\x0F\x66", false)); // Zak 46
+ CRCToSound(0x84A0BA90, V2A_Sound_Special_Zak110(0x0126, 0x0040, 0x0136, 0x0080, 0x007C, 0x0087)); // Zak 110
+ CRCToSound(0x92680D9F, V2A_Sound_Special_Zak32(0x0140, 0x0150, 0x0010, 0x0010)); // Zak 32
+ CRCToSound(0xABFFDB02, V2A_Sound_Special_Zak86(0x01A2, 0x2BAE)); // Zak 86
+ CRCToSound(0x41045447, V2A_Sound_Special_Zak98(0x017A, 0x0020)); // Zak 98
+ CRCToSound(0xC8EEBD34, V2A_Sound_Special_Zak82(0x01A6, 0x3900)); // Zak 82
+ CRCToSound(0x42F9469F, V2A_Sound_Music(0x05F6, 0x0636, 0x0456, 0x0516, 0x05D6, 0x05E6, 0x0A36, true)); // Zak 96
+ CRCToSound(0x038BBD78, V2A_Sound_Music(0x054E, 0x05CE, 0x044E, 0x04BE, 0x052E, 0x053E, 0x0BCE, true)); // Zak 85
+ CRCToSound(0x06FFADC5, V2A_Sound_Music(0x0626, 0x0686, 0x0446, 0x04F6, 0x0606, 0x0616, 0x0C86, true)); // Zak 87
+ CRCToSound(0xCE20ECF0, V2A_Sound_Music(0x0636, 0x0696, 0x0446, 0x0576, 0x0616, 0x0626, 0x0E96, true)); // Zak 114
+ CRCToSound(0xBDA01BB6, V2A_Sound_Music(0x0678, 0x06B8, 0x0458, 0x0648, 0x0658, 0x0668, 0x0EB8, false)); // Zak 33
+ CRCToSound(0x59976529, V2A_Sound_Music(0x088E, 0x092E, 0x048E, 0x05EE, 0x074E, 0x07EE, 0x112E, true)); // Zak 49
+ CRCToSound(0xED1EED02, V2A_Sound_Music(0x08D0, 0x0950, 0x0440, 0x07E0, 0x08B0, 0x08C0, 0x1350, false)); // Zak 112
+ CRCToSound(0x5A16C037, V2A_Sound_Music(0x634A, 0x64CA, 0x049A, 0x18FA, 0x398A, 0x511A, 0x6CCA, false)); // Zak 95
return NULL;
}
@@ -1860,11 +1860,11 @@ Player_V2A::~Player_V2A() {
delete _mod;
}
-void Player_V2A::setMusicVolume (int vol) {
+void Player_V2A::setMusicVolume(int vol) {
_mod->setMusicVolume(vol);
}
-int Player_V2A::getSoundSlot (int id) const {
+int Player_V2A::getSoundSlot(int id) const {
int i;
for (i = 0; i < V2A_MAXSLOTS; i++) {
if (_slot[i].id == id)
@@ -1914,8 +1914,10 @@ void Player_V2A::startSound(int nr) {
}
stopSound(nr);
int i = getSoundSlot();
- if (i == -1)
+ if (i == -1) {
+ delete snd;
return;
+ }
_slot[i].id = nr;
_slot[i].sound = snd;
_slot[i].sound->start(_mod, nr, data);
@@ -1938,7 +1940,7 @@ void Player_V2A::updateSound() {
}
int Player_V2A::getMusicTimer() {
- return 0; // FIXME - need to keep track of playing music resources
+ return 0; // FIXME - need to keep track of playing music resources
}
int Player_V2A::getSoundStatus(int nr) const {
diff --git a/engines/scumm/player_v2a.h b/engines/scumm/player_v2a.h
index 719d5491ea..fe20b43846 100644
--- a/engines/scumm/player_v2a.h
+++ b/engines/scumm/player_v2a.h
@@ -63,7 +63,7 @@ private:
Player_MOD *_mod;
soundSlot _slot[V2A_MAXSLOTS];
- int getSoundSlot (int id = 0) const;
+ int getSoundSlot(int id = 0) const;
static void update_proc(void *param);
void updateSound();
};
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp
index 3ab13df032..38dbd8270a 100644
--- a/engines/scumm/saveload.cpp
+++ b/engines/scumm/saveload.cpp
@@ -1286,14 +1286,35 @@ void ScummEngine::saveOrLoad(Serializer *s) {
//
// Save/load palette data
- //
- if (_16BitPalette && !(_game.platform == Common::kPlatformFMTowns && s->isLoading() && s->getVersion() < VER(82))) {
+ // Don't save 16 bit palette in FM-Towns and PCE games, since it gets regenerated afterwards anyway.
+ if (_16BitPalette && !(_game.platform == Common::kPlatformFMTowns && s->getVersion() < VER(82)) && !((_game.platform == Common::kPlatformFMTowns || _game.platform == Common::kPlatformPCEngine) && s->getVersion() > VER(87))) {
s->saveLoadArrayOf(_16BitPalette, 512, sizeof(_16BitPalette[0]), sleUint16);
}
-#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
+
// FM-Towns specific (extra palette data, color cycle data, etc.)
- if (s->getVersion() >= VER(82)) {
+ // In earlier save game versions (below 87) the FM-Towns specific data would get saved (and loaded) even in non FM-Towns games.
+ // This would cause an unnecessary save file incompatibility between DS (which uses the DISABLE_TOWNS_DUAL_LAYER_MODE setting)
+ // and other ports.
+ // In version 88 and later the save files from FM-Towns targets are compatible between DS and other platforms, too.
+
+#ifdef DISABLE_TOWNS_DUAL_LAYER_MODE
+ byte hasTownsData = 0;
+ if (_game.platform == Common::kPlatformFMTowns && s->getVersion() > VER(87))
+ s->saveLoadArrayOf(&hasTownsData, 1, sizeof(byte), sleByte);
+
+ if (hasTownsData) {
+ // Skip FM-Towns specific data
+ for (int i = 69 * sizeof(uint8) + 44 * sizeof(int16); i; i--)
+ s->loadByte();
+ }
+
+#else
+ byte hasTownsData = ((_game.platform == Common::kPlatformFMTowns && s->getVersion() >= VER(87)) || (s->getVersion() >= VER(82) && s->getVersion() < VER(87))) ? 1 : 0;
+ if (_game.platform == Common::kPlatformFMTowns && s->getVersion() > VER(87))
+ s->saveLoadArrayOf(&hasTownsData, 1, sizeof(byte), sleByte);
+
+ if (hasTownsData) {
const SaveLoadEntry townsFields[] = {
MKLINE(Common::Rect, left, sleInt16, VER(82)),
MKLINE(Common::Rect, top, sleInt16, VER(82)),
@@ -1316,6 +1337,8 @@ void ScummEngine::saveOrLoad(Serializer *s) {
s->saveLoadArrayOf(&_curStringRect, 1, sizeof(_curStringRect), townsFields);
s->saveLoadArrayOf(_townsCharsetColorMap, 16, sizeof(_townsCharsetColorMap[0]), sleUint8);
s->saveLoadEntries(this, townsExtraEntries);
+ } else if (_game.platform == Common::kPlatformFMTowns && s->getVersion() >= VER(82)) {
+ warning("Save file is missing FM-Towns specific graphic data (game was apparently saved on another platform)");
}
#endif
diff --git a/engines/scumm/saveload.h b/engines/scumm/saveload.h
index 16c225d20e..064bdf1406 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 86
+#define CURRENT_VER 88
/**
* An auxillary macro, used to specify savegame versions. We use this instead
diff --git a/engines/scumm/scumm-md5.h b/engines/scumm/scumm-md5.h
index 45c6e90a08..42ce74ec29 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 Sun Oct 02 03:05:23 2011
+ This file was generated by the md5table tool on Mon Nov 28 01:09:07 2011
DO NOT EDIT MANUALLY!
*/
@@ -249,6 +249,7 @@ static const MD5Table md5table[] = {
{ "5b08000a9c47b2887df6506ac767ca68", "fbear", "HE 62", "", -1, Common::EN_ANY, Common::kPlatform3DO },
{ "5bd335265a61caa3d78956ad9f88ba23", "football", "", "Demo", 23135, Common::EN_ANY, Common::kPlatformUnknown },
{ "5c21fc49aee8f46e58fef21579e614a1", "thinker1", "", "", -1, Common::EN_USA, Common::kPlatformUnknown },
+ { "5c9cecbd2952ccec14c9ecebf5822a34", "puttzoo", "HE 100", "", -1, Common::EN_ANY, Common::kPlatformIOS },
{ "5d88b9d6a88e6f8e90cded9d01b7f082", "loom", "VGA", "VGA", 8307, Common::EN_ANY, Common::kPlatformPC },
{ "5dda73606533d66a4c3f4f9ea6e842af", "farm", "", "", 87061, Common::RU_RUS, Common::kPlatformWindows },
{ "5e8fb66971a60e523e5afbc4c129c0e8", "socks", "HE 85", "", -1, Common::EN_USA, Common::kPlatformUnknown },
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 81f6af453c..f94496b14b 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -1171,11 +1171,8 @@ Common::Error ScummEngine::init() {
Common::List<Graphics::PixelFormat> tryModes = _system->getSupportedFormats();
for (Common::List<Graphics::PixelFormat>::iterator g = tryModes.begin(); g != tryModes.end(); ++g) {
if (g->bytesPerPixel != 2 || g->aBits()) {
- g = tryModes.erase(g);
- g--;
- }
-
- if (*g == _outputPixelFormat) {
+ g = tryModes.reverse_erase(g);
+ } else if (*g == _outputPixelFormat) {
tryModes.clear();
tryModes.push_back(_outputPixelFormat);
break;
diff --git a/engines/scumm/smush/channel.cpp b/engines/scumm/smush/channel.cpp
index fd822f56b6..7f9ca70080 100644
--- a/engines/scumm/smush/channel.cpp
+++ b/engines/scumm/smush/channel.cpp
@@ -99,11 +99,13 @@ void SmushChannel::processBuffer() {
byte *old = _tbuffer;
int32 new_size = _tbufferSize - offset;
_tbuffer = (byte *)malloc(new_size);
- // FIXME: _tbuffer might be 0 if new_size is 0.
// NB: Also check other "if (_tbuffer)" locations in smush
- if (!_tbuffer)
- error("smush channel failed to allocate memory");
- memcpy(_tbuffer, old + offset, new_size);
+ if (!_tbuffer) {
+ if (new_size)
+ error("smush channel failed to allocate memory");
+ } else {
+ memcpy(_tbuffer, old + offset, new_size);
+ }
_tbufferSize = new_size;
free(old);
}
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index ba8c6e2277..f058ef1a2c 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -23,6 +23,8 @@
#include "common/config-manager.h"
#include "common/timer.h"
#include "common/util.h"
+#include "common/ptr.h"
+#include "common/substream.h"
#include "scumm/actor.h"
#include "scumm/file.h"
@@ -62,7 +64,8 @@ Sound::Sound(ScummEngine *parent, Audio::Mixer *mixer)
_mixer(mixer),
_soundQuePos(0),
_soundQue2Pos(0),
- _sfxFile(0),
+ _sfxFilename(),
+ _sfxFileEncByte(0),
_offsetTable(0),
_numSoundEffects(0),
_soundMode(kVOCMode),
@@ -91,7 +94,6 @@ Sound::Sound(ScummEngine *parent, Audio::Mixer *mixer)
Sound::~Sound() {
stopCDTimer();
g_system->getAudioCDManager()->stop();
- delete _sfxFile;
}
void Sound::addSoundToQueue(int sound, int heOffset, int heChannel, int heFlags) {
@@ -490,6 +492,7 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle
int num = 0, i;
int size = 0;
int id = -1;
+ Common::ScopedPtr<ScummFile> file;
if (_vm->_game.id == GID_CMI) {
_sfxMode |= mode;
@@ -523,25 +526,29 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle
return;
}
- _sfxFile->close();
- sprintf(filename, "audio/%s.%d/%d.voc", roomname, offset, b);
- _vm->openFile(*_sfxFile, filename);
- if (!_sfxFile->isOpen()) {
- sprintf(filename, "audio/%s_%d/%d.voc", roomname, offset, b);
- _vm->openFile(*_sfxFile, filename);
+ file.reset(new ScummFile());
+ if (!file)
+ error("startTalkSound: Out of memory");
+
+ sprintf(filename, "audio/%s.%u/%u.voc", roomname, offset, b);
+ if (!_vm->openFile(*file, filename)) {
+ sprintf(filename, "audio/%s_%u/%u.voc", roomname, offset, b);
+ _vm->openFile(*file, filename);
}
- if (!_sfxFile->isOpen()) {
- sprintf(filename, "%d.%d.voc", offset, b);
- _vm->openFile(*_sfxFile, filename);
+
+ if (!file->isOpen()) {
+ sprintf(filename, "%u.%u.voc", offset, b);
+ _vm->openFile(*file, filename);
}
- if (!_sfxFile->isOpen()) {
+
+ if (!file->isOpen()) {
warning("startTalkSound: dig demo: voc file not found");
return;
}
} else {
- if (!_sfxFile->isOpen()) {
- warning("startTalkSound: SFX file is not open");
+ if (_sfxFilename.empty()) {
+ warning("startTalkSound: SFX file not found");
return;
}
@@ -581,11 +588,30 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle
size = -1;
}
- _sfxFile->seek(offset, SEEK_SET);
+ file.reset(new ScummFile());
+ if (!file)
+ error("startTalkSound: Out of memory");
+
+ if (!_vm->openFile(*file, _sfxFilename)) {
+ warning("startTalkSound: could not open sfx file %s", _sfxFilename.c_str());
+ return;
+ }
+
+ file->setEnc(_sfxFileEncByte);
+ file->seek(offset, SEEK_SET);
assert(num + 1 < (int)ARRAYSIZE(_mouthSyncTimes));
for (i = 0; i < num; i++)
- _mouthSyncTimes[i] = _sfxFile->readUint16BE();
+ _mouthSyncTimes[i] = file->readUint16BE();
+
+ // Adjust offset to account for the mouth sync times. It is noteworthy
+ // that we do not adjust the size here for compressed streams, since
+ // they only set size to the size of the compressed sound data.
+ offset += num * 2;
+ // TODO: In case we ever set up the size for VOC streams, we should
+ // really check whether the size contains the _mouthSyncTimes.
+ //if (_soundMode == kVOCMode)
+ // size -= num * 2;
_mouthSyncTimes[i] = 0xFFFF;
_sfxMode |= mode;
@@ -601,9 +627,7 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle
#ifdef USE_MAD
{
assert(size > 0);
- Common::SeekableReadStream *tmp = _sfxFile->readStream(size);
- assert(tmp);
- input = Audio::makeMP3Stream(tmp, DisposeAfterUse::YES);
+ input = Audio::makeMP3Stream(new Common::SeekableSubReadStream(file.release(), offset, offset + size, DisposeAfterUse::YES), DisposeAfterUse::YES);
}
#endif
break;
@@ -611,9 +635,7 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle
#ifdef USE_VORBIS
{
assert(size > 0);
- Common::SeekableReadStream *tmp = _sfxFile->readStream(size);
- assert(tmp);
- input = Audio::makeVorbisStream(tmp, DisposeAfterUse::YES);
+ input = Audio::makeVorbisStream(new Common::SeekableSubReadStream(file.release(), offset, offset + size, DisposeAfterUse::YES), DisposeAfterUse::YES);
}
#endif
break;
@@ -621,14 +643,12 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle
#ifdef USE_FLAC
{
assert(size > 0);
- Common::SeekableReadStream *tmp = _sfxFile->readStream(size);
- assert(tmp);
- input = Audio::makeFLACStream(tmp, DisposeAfterUse::YES);
+ input = Audio::makeFLACStream(new Common::SeekableSubReadStream(file.release(), offset, offset + size, DisposeAfterUse::YES), DisposeAfterUse::YES);
}
#endif
break;
default:
- input = Audio::makeVOCStream(_sfxFile, Audio::FLAG_UNSIGNED);
+ input = Audio::makeVOCStream(file.release(), Audio::FLAG_UNSIGNED, DisposeAfterUse::YES);
break;
}
@@ -847,20 +867,11 @@ void Sound::talkSound(uint32 a, uint32 b, int mode, int channel) {
_talk_sound_mode |= mode;
}
-/* The sound code currently only supports General Midi.
- * General Midi is used in Day Of The Tentacle.
- * Roland music is also playable, but doesn't sound well.
- * A mapping between roland instruments and GM instruments
- * is needed.
- */
-
void Sound::setupSound() {
- delete _sfxFile;
-
- _sfxFile = openSfxFile();
+ setupSfxFile();
if (_vm->_game.id == GID_FT) {
- _vm->VAR(_vm->VAR_VOICE_BUNDLE_LOADED) = _sfxFile->isOpen();
+ _vm->VAR(_vm->VAR_VOICE_BUNDLE_LOADED) = _sfxFilename.empty() ? 0 : 1;
}
}
@@ -892,7 +903,7 @@ void Sound::pauseSounds(bool pause) {
}
}
-BaseScummFile *Sound::openSfxFile() {
+void Sound::setupSfxFile() {
struct SoundFileExtensions {
const char *ext;
SoundMode mode;
@@ -912,8 +923,10 @@ BaseScummFile *Sound::openSfxFile() {
{ 0, kVOCMode }
};
- ScummFile *file = new ScummFile();
+ ScummFile file;
_offsetTable = NULL;
+ _sfxFileEncByte = 0;
+ _sfxFilename.clear();
/* Try opening the file <baseName>.sou first, e.g. tentacle.sou.
* That way, you can keep .sou files for multiple games in the
@@ -938,15 +951,20 @@ BaseScummFile *Sound::openSfxFile() {
tmp = basename[0] + "tlk";
}
- if (file->open(tmp) && _vm->_game.heversion <= 74)
- file->setEnc(0x69);
+ if (file.open(tmp))
+ _sfxFilename = tmp;
+
+ if (_vm->_game.heversion <= 74)
+ _sfxFileEncByte = 0x69;
+
_soundMode = kVOCMode;
} else {
- for (uint j = 0; j < 2 && !file->isOpen(); ++j) {
+ for (uint j = 0; j < 2 && !file.isOpen(); ++j) {
for (int i = 0; extensions[i].ext; ++i) {
tmp = basename[j] + extensions[i].ext;
- if (_vm->openFile(*file, tmp)) {
+ if (_vm->openFile(file, tmp)) {
_soundMode = extensions[i].mode;
+ _sfxFilename = tmp;
break;
}
}
@@ -970,23 +988,21 @@ BaseScummFile *Sound::openSfxFile() {
*/
int size, compressed_offset;
MP3OffsetTable *cur;
- compressed_offset = file->readUint32BE();
+ compressed_offset = file.readUint32BE();
_offsetTable = (MP3OffsetTable *) malloc(compressed_offset);
_numSoundEffects = compressed_offset / 16;
size = compressed_offset;
cur = _offsetTable;
while (size > 0) {
- cur->org_offset = file->readUint32BE();
- cur->new_offset = file->readUint32BE() + compressed_offset + 4; /* The + 4 is to take into accound the 'size' field */
- cur->num_tags = file->readUint32BE();
- cur->compressed_size = file->readUint32BE();
+ cur->org_offset = file.readUint32BE();
+ cur->new_offset = file.readUint32BE() + compressed_offset + 4; /* The + 4 is to take into accound the 'size' field */
+ cur->num_tags = file.readUint32BE();
+ cur->compressed_size = file.readUint32BE();
size -= 4 * 4;
cur++;
}
}
-
- return file;
}
bool Sound::isSfxFinished() const {
diff --git a/engines/scumm/sound.h b/engines/scumm/sound.h
index e9a37ac9fa..48f28d51ff 100644
--- a/engines/scumm/sound.h
+++ b/engines/scumm/sound.h
@@ -69,7 +69,8 @@ protected:
int16 flags;
} _soundQue2[10];
- BaseScummFile *_sfxFile;
+ Common::String _sfxFilename;
+ byte _sfxFileEncByte;
SoundMode _soundMode;
MP3OffsetTable *_offsetTable; // For compressed audio
int _numSoundEffects; // For compressed audio
@@ -126,7 +127,7 @@ public:
void saveLoadWithSerializer(Serializer *ser);
protected:
- BaseScummFile *openSfxFile();
+ void setupSfxFile();
bool isSfxFinished() const;
void processSfxQueues();
diff --git a/engines/sky/detection.cpp b/engines/sky/detection.cpp
index a1067496da..484958ca52 100644
--- a/engines/sky/detection.cpp
+++ b/engines/sky/detection.cpp
@@ -43,21 +43,21 @@ struct SkyVersion {
int dataDiskSize;
const char *extraDesc;
int version;
- uint32 guioptions;
+ const char *guioptions;
};
// TODO: Would be nice if Disk::determineGameVersion() used this table, too.
static const SkyVersion skyVersions[] = {
- { 232, -1, "floppy demo", 272, Common::GUIO_NOSPEECH }, // German
- { 243, -1, "pc gamer demo", 109, Common::GUIO_NOSPEECH },
- { 247, -1, "floppy demo", 267, Common::GUIO_NOSPEECH }, // English
- { 1404, -1, "floppy", 288, Common::GUIO_NOSPEECH },
- { 1413, -1, "floppy", 303, Common::GUIO_NOSPEECH },
- { 1445, 8830435, "floppy", 348, Common::GUIO_NOSPEECH },
- { 1445, -1, "floppy", 331, Common::GUIO_NOSPEECH },
- { 1711, -1, "cd demo", 365, Common::GUIO_NONE },
- { 5099, -1, "cd", 368, Common::GUIO_NONE },
- { 5097, -1, "cd", 372, Common::GUIO_NONE },
+ { 232, -1, "floppy demo", 272, GUIO1(GUIO_NOSPEECH) }, // German
+ { 243, -1, "pc gamer demo", 109, GUIO1(GUIO_NOSPEECH) },
+ { 247, -1, "floppy demo", 267, GUIO1(GUIO_NOSPEECH) }, // English
+ { 1404, -1, "floppy", 288, GUIO1(GUIO_NOSPEECH) },
+ { 1413, -1, "floppy", 303, GUIO1(GUIO_NOSPEECH) },
+ { 1445, 8830435, "floppy", 348, GUIO1(GUIO_NOSPEECH) },
+ { 1445, -1, "floppy", 331, GUIO1(GUIO_NOSPEECH) },
+ { 1711, -1, "cd demo", 365, GUIO0() },
+ { 5099, -1, "cd", 368, GUIO0() },
+ { 5097, -1, "cd", 372, GUIO0() },
{ 0, 0, 0, 0, 0 }
};
diff --git a/engines/sky/music/adlibmusic.cpp b/engines/sky/music/adlibmusic.cpp
index 1b5518fcb1..a41cd6a81d 100644
--- a/engines/sky/music/adlibmusic.cpp
+++ b/engines/sky/music/adlibmusic.cpp
@@ -30,9 +30,8 @@
namespace Sky {
-AdLibMusic::AdLibMusic(Audio::Mixer *pMixer, Disk *pDisk) : MusicBase(pDisk) {
+AdLibMusic::AdLibMusic(Audio::Mixer *pMixer, Disk *pDisk) : MusicBase(pMixer, pDisk) {
_driverFileBase = 60202;
- _mixer = pMixer;
_sampleRate = pMixer->getOutputRate();
_opl = makeAdLibOPL(_sampleRate);
diff --git a/engines/sky/music/adlibmusic.h b/engines/sky/music/adlibmusic.h
index 2782a07be6..2161795b4c 100644
--- a/engines/sky/music/adlibmusic.h
+++ b/engines/sky/music/adlibmusic.h
@@ -26,7 +26,6 @@
#include "sky/music/musicbase.h"
#include "audio/audiostream.h"
#include "audio/fmopl.h"
-#include "audio/mixer.h"
namespace Sky {
@@ -44,7 +43,6 @@ public:
private:
FM_OPL *_opl;
- Audio::Mixer *_mixer;
Audio::SoundHandle _soundHandle;
uint8 *_initSequence;
uint32 _sampleRate, _nextMusicPoll;
diff --git a/engines/sky/music/gmmusic.cpp b/engines/sky/music/gmmusic.cpp
index d0ba1505cb..85240ea82e 100644
--- a/engines/sky/music/gmmusic.cpp
+++ b/engines/sky/music/gmmusic.cpp
@@ -34,7 +34,7 @@ void GmMusic::passTimerFunc(void *param) {
((GmMusic*)param)->timerCall();
}
-GmMusic::GmMusic(MidiDriver *pMidiDrv, Disk *pDisk) : MusicBase(pDisk) {
+GmMusic::GmMusic(MidiDriver *pMidiDrv, Audio::Mixer *pMixer, Disk *pDisk) : MusicBase(pMixer, pDisk) {
_driverFileBase = 60200;
_midiDrv = pMidiDrv;
int midiRes = _midiDrv->open();
diff --git a/engines/sky/music/gmmusic.h b/engines/sky/music/gmmusic.h
index 0f54a930e4..068601ba1f 100644
--- a/engines/sky/music/gmmusic.h
+++ b/engines/sky/music/gmmusic.h
@@ -31,7 +31,7 @@ namespace Sky {
class GmMusic : public MusicBase {
public:
- GmMusic(MidiDriver *pMidiDrv, Disk *pDisk);
+ GmMusic(MidiDriver *pMidiDrv, Audio::Mixer *pMixer, Disk *pDisk);
~GmMusic();
virtual void setVolume(uint16 param);
private:
diff --git a/engines/sky/music/mt32music.cpp b/engines/sky/music/mt32music.cpp
index d068a221b2..18ebf123ff 100644
--- a/engines/sky/music/mt32music.cpp
+++ b/engines/sky/music/mt32music.cpp
@@ -34,7 +34,7 @@ void MT32Music::passTimerFunc(void *param) {
((MT32Music*)param)->timerCall();
}
-MT32Music::MT32Music(MidiDriver *pMidiDrv, Disk *pDisk) : MusicBase(pDisk) {
+MT32Music::MT32Music(MidiDriver *pMidiDrv, Audio::Mixer *pMixer, Disk *pDisk) : MusicBase(pMixer, pDisk) {
_driverFileBase = 60200;
_midiDrv = pMidiDrv;
int midiRes = _midiDrv->open();
diff --git a/engines/sky/music/mt32music.h b/engines/sky/music/mt32music.h
index 74962daac3..8f8e70f51b 100644
--- a/engines/sky/music/mt32music.h
+++ b/engines/sky/music/mt32music.h
@@ -31,7 +31,7 @@ namespace Sky {
class MT32Music : public MusicBase {
public:
- MT32Music(MidiDriver *pMidiDrv, Disk *pDisk);
+ MT32Music(MidiDriver *pMidiDrv, Audio::Mixer *pMixer, Disk *pDisk);
~MT32Music();
private:
static void passTimerFunc(void *param);
diff --git a/engines/sky/music/musicbase.cpp b/engines/sky/music/musicbase.cpp
index 60d0f352e7..c4e5ba4bd0 100644
--- a/engines/sky/music/musicbase.cpp
+++ b/engines/sky/music/musicbase.cpp
@@ -25,11 +25,13 @@
#include "common/util.h"
#include "common/endian.h"
#include "common/textconsole.h"
+#include "audio/audiostream.h"
namespace Sky {
-MusicBase::MusicBase(Disk *pDisk) {
+MusicBase::MusicBase(Audio::Mixer *pMixer, Disk *pDisk) {
_musicData = NULL;
+ _mixer = pMixer;
_skyDisk = pDisk;
_currentMusic = 0;
_musicVolume = 127;
@@ -59,6 +61,8 @@ void MusicBase::loadSection(uint8 pSection) {
}
bool MusicBase::musicIsPlaying() {
+ if (_mixer->isSoundHandleActive(_musicHandle))
+ return true;
for (uint8 cnt = 0; cnt < _numberOfChannels; cnt++)
if (_channels[cnt]->isActive())
return true;
@@ -71,6 +75,8 @@ void MusicBase::stopMusic() {
}
void MusicBase::stopMusicInternal() {
+ _mixer->stopHandle(_musicHandle);
+
for (uint8 cnt = 0; cnt < _numberOfChannels; cnt++)
delete _channels[cnt];
_numberOfChannels = 0;
@@ -94,18 +100,56 @@ void MusicBase::loadNewMusic() {
_currentMusic = _onNextPoll.musicToProcess;
- if (_currentMusic != 0) {
- musicPos = READ_LE_UINT16(_musicData + _musicDataLoc + 1);
- musicPos += _musicDataLoc + ((_currentMusic - 1) << 1);
- musicPos = READ_LE_UINT16(_musicData + musicPos) + _musicDataLoc;
+ if (_currentMusic == 0)
+ return;
+
+ // Try playing digital audio first (from the Music Enhancement Project).
+ // TODO: This always prefers digital music over the MIDI music types!
+ uint8 section = _currentSection;
+ uint8 song = _currentMusic;
+ // handle duplicates
+ if ((section == 2 && song == 1) || (section == 5 && song == 1)) {
+ section = 1;
+ song = 1;
+ } else if ((section == 2 && song == 4) || (section == 5 && song == 4)) {
+ section = 1;
+ song = 4;
+ } else if (section == 5 && song == 6) {
+ section = 4;
+ song = 4;
+ } else if (section == 0 && song == 1) {
+ // floppy intro
+ section = 5;
+ song = 3;
+ }
+ Common::String trackName = Common::String::format("music_%d%02d", section, song);
+ Audio::SeekableAudioStream *stream = Audio::SeekableAudioStream::openStreamFile(trackName);
+ if (stream) {
+ // not all tracks should loop
+ bool loops = true;
+ if ((section == 0 && song == 1)
+ || (section == 1 && song == 1) || (section == 1 && song == 4)
+ || (section == 2 && song == 1) || (section == 2 && song == 4)
+ || (section == 4 && song == 2) || (section == 4 && song == 3)
+ || (section == 4 && song == 5) || (section == 4 && song == 6)
+ || (section == 4 && song == 11) || (section == 5 && song == 1)
+ || (section == 5 && song == 3) || (section == 5 && song == 4))
+ loops = false;
+ _mixer->playStream(Audio::Mixer::kMusicSoundType, &_musicHandle, Audio::makeLoopingAudioStream(stream, loops ? 0 : 1));
+ return;
+ }
+
+ // no digital audio, resort to MIDI playback
+ musicPos = READ_LE_UINT16(_musicData + _musicDataLoc + 1);
+ musicPos += _musicDataLoc + ((_currentMusic - 1) << 1);
+ musicPos = READ_LE_UINT16(_musicData + musicPos) + _musicDataLoc;
- _musicTempo0 = _musicData[musicPos];
- _musicTempo1 = _musicData[musicPos+1];
+ _musicTempo0 = _musicData[musicPos];
+ _musicTempo1 = _musicData[musicPos+1];
- setupChannels(_musicData + musicPos + 2);
+ setupChannels(_musicData + musicPos + 2);
- updateTempo();
- }
+ updateTempo();
}
void MusicBase::pollMusic() {
diff --git a/engines/sky/music/musicbase.h b/engines/sky/music/musicbase.h
index c175876380..066ebe593c 100644
--- a/engines/sky/music/musicbase.h
+++ b/engines/sky/music/musicbase.h
@@ -27,6 +27,8 @@
#include "common/scummsys.h"
#include "common/mutex.h"
+#include "audio/mixer.h"
+
namespace Sky {
class Disk;
@@ -48,7 +50,7 @@ private:
class MusicBase {
public:
- MusicBase(Disk *pDisk);
+ MusicBase(Audio::Mixer *pMixer, Disk *pDisk);
virtual ~MusicBase();
void loadSection(uint8 pSection);
void startMusic(uint16 param);
@@ -60,6 +62,7 @@ public:
protected:
+ Audio::Mixer *_mixer;
Disk *_skyDisk;
uint8 *_musicData;
@@ -75,6 +78,7 @@ protected:
Actions _onNextPoll;
ChannelBase *_channels[10];
Common::Mutex _mutex;
+ Audio::SoundHandle _musicHandle;
virtual void setupPointers() = 0;
virtual void setupChannels(uint8 *channelData) = 0;
diff --git a/engines/sky/sky.cpp b/engines/sky/sky.cpp
index 72abc26f32..44ea3a305b 100644
--- a/engines/sky/sky.cpp
+++ b/engines/sky/sky.cpp
@@ -268,9 +268,9 @@ Common::Error SkyEngine::init() {
} else {
_systemVars.systemFlags |= SF_ROLAND;
if ((MidiDriver::getMusicType(dev) == MT_MT32) || ConfMan.getBool("native_mt32"))
- _skyMusic = new MT32Music(MidiDriver::createMidi(dev), _skyDisk);
+ _skyMusic = new MT32Music(MidiDriver::createMidi(dev), _mixer, _skyDisk);
else
- _skyMusic = new GmMusic(MidiDriver::createMidi(dev), _skyDisk);
+ _skyMusic = new GmMusic(MidiDriver::createMidi(dev), _mixer, _skyDisk);
}
if (isCDVersion()) {
diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp
index 324154f709..d55a08293e 100644
--- a/engines/sword1/animation.cpp
+++ b/engines/sword1/animation.cpp
@@ -28,6 +28,7 @@
#include "sword1/sword1.h"
#include "sword1/animation.h"
#include "sword1/text.h"
+#include "sword1/resman.h"
#include "common/str.h"
#include "common/system.h"
@@ -65,8 +66,8 @@ static const char *const sequenceList[20] = {
// Basic movie player
///////////////////////////////////////////////////////////////////////////////
-MoviePlayer::MoviePlayer(SwordEngine *vm, Text *textMan, Audio::Mixer *snd, OSystem *system, Audio::SoundHandle *bgSoundHandle, Video::VideoDecoder *decoder, DecoderType decoderType)
- : _vm(vm), _textMan(textMan), _snd(snd), _bgSoundHandle(bgSoundHandle), _system(system) {
+MoviePlayer::MoviePlayer(SwordEngine *vm, Text *textMan, ResMan *resMan, Audio::Mixer *snd, OSystem *system, Audio::SoundHandle *bgSoundHandle, Video::VideoDecoder *decoder, DecoderType decoderType)
+ : _vm(vm), _textMan(textMan), _resMan(resMan), _snd(snd), _bgSoundHandle(bgSoundHandle), _system(system) {
_bgSoundStream = NULL;
_decoderType = decoderType;
_decoder = decoder;
@@ -183,8 +184,8 @@ void MoviePlayer::performPostProcessing(byte *screen) {
_textMan->makeTextSprite(2, (const uint8 *)_movieTexts.front()._text.c_str(), 600, LETTER_COL);
FrameHeader *frame = _textMan->giveSpriteData(2);
- _textWidth = frame->width;
- _textHeight = frame->height;
+ _textWidth = _resMan->toUint16(frame->width);
+ _textHeight = _resMan->toUint16(frame->height);
_textX = 320 - _textWidth / 2;
_textY = 420 - _textHeight;
}
@@ -323,7 +324,7 @@ uint32 DXADecoderWithSound::getElapsedTime() const {
// Factory function for creating the appropriate cutscene player
///////////////////////////////////////////////////////////////////////////////
-MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, Audio::Mixer *snd, OSystem *system) {
+MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan *resMan, Audio::Mixer *snd, OSystem *system) {
Common::String filename;
Audio::SoundHandle *bgSoundHandle = new Audio::SoundHandle;
@@ -331,7 +332,7 @@ MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, Audio::M
if (Common::File::exists(filename)) {
Video::SmackerDecoder *smkDecoder = new Video::SmackerDecoder(snd);
- return new MoviePlayer(vm, textMan, snd, system, bgSoundHandle, smkDecoder, kVideoDecoderSMK);
+ return new MoviePlayer(vm, textMan, resMan, snd, system, bgSoundHandle, smkDecoder, kVideoDecoderSMK);
}
filename = Common::String::format("%s.dxa", sequenceList[id]);
@@ -339,7 +340,7 @@ MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, Audio::M
if (Common::File::exists(filename)) {
#ifdef USE_ZLIB
DXADecoderWithSound *dxaDecoder = new DXADecoderWithSound(snd, bgSoundHandle);
- return new MoviePlayer(vm, textMan, snd, system, bgSoundHandle, dxaDecoder, kVideoDecoderDXA);
+ return new MoviePlayer(vm, textMan, resMan, snd, system, bgSoundHandle, dxaDecoder, kVideoDecoderDXA);
#else
GUI::MessageDialog dialog(_("DXA cutscenes found but ScummVM has been built without zlib support"), _("OK"));
dialog.runModal();
diff --git a/engines/sword1/animation.h b/engines/sword1/animation.h
index fc3061bbf9..1c03c66342 100644
--- a/engines/sword1/animation.h
+++ b/engines/sword1/animation.h
@@ -67,7 +67,7 @@ private:
class MoviePlayer {
public:
- MoviePlayer(SwordEngine *vm, Text *textMan, Audio::Mixer *snd, OSystem *system, Audio::SoundHandle *bgSoundHandle, Video::VideoDecoder *decoder, DecoderType decoderType);
+ MoviePlayer(SwordEngine *vm, Text *textMan, ResMan *resMan, Audio::Mixer *snd, OSystem *system, Audio::SoundHandle *bgSoundHandle, Video::VideoDecoder *decoder, DecoderType decoderType);
virtual ~MoviePlayer();
bool load(uint32 id);
void play();
@@ -75,6 +75,7 @@ public:
protected:
SwordEngine *_vm;
Text *_textMan;
+ ResMan *_resMan;
Audio::Mixer *_snd;
OSystem *_system;
Common::List<MovieText> _movieTexts;
@@ -93,7 +94,7 @@ protected:
byte findWhitePalIndex();
};
-MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, Audio::Mixer *snd, OSystem *system);
+MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan *resMan, Audio::Mixer *snd, OSystem *system);
} // End of namespace Sword1
diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp
index e4c068e667..2214e72067 100644
--- a/engines/sword1/detection.cpp
+++ b/engines/sword1/detection.cpp
@@ -117,12 +117,12 @@ bool Sword1::SwordEngine::hasFeature(EngineFeature f) const {
GameList SwordMetaEngine::getSupportedGames() const {
GameList games;
- games.push_back(GameDescriptor(sword1FullSettings, Common::GUIO_NOMIDI));
- games.push_back(GameDescriptor(sword1DemoSettings, Common::GUIO_NOMIDI));
- games.push_back(GameDescriptor(sword1MacFullSettings, Common::GUIO_NOMIDI));
- games.push_back(GameDescriptor(sword1MacDemoSettings, Common::GUIO_NOMIDI));
- games.push_back(GameDescriptor(sword1PSXSettings, Common::GUIO_NOMIDI));
- games.push_back(GameDescriptor(sword1PSXDemoSettings, Common::GUIO_NOMIDI));
+ games.push_back(GameDescriptor(sword1FullSettings, GUIO_NOMIDI));
+ games.push_back(GameDescriptor(sword1DemoSettings, GUIO_NOMIDI));
+ games.push_back(GameDescriptor(sword1MacFullSettings, GUIO_NOMIDI));
+ games.push_back(GameDescriptor(sword1MacDemoSettings, GUIO_NOMIDI));
+ games.push_back(GameDescriptor(sword1PSXSettings, GUIO_NOMIDI));
+ games.push_back(GameDescriptor(sword1PSXDemoSettings, GUIO_NOMIDI));
return games;
}
@@ -198,17 +198,17 @@ GameList SwordMetaEngine::detectGames(const Common::FSList &fslist) const {
psxDemoFilesFound = false;
if (mainFilesFound && pcFilesFound && demoFilesFound)
- detectedGames.push_back(GameDescriptor(sword1DemoSettings, Common::GUIO_NOMIDI));
+ detectedGames.push_back(GameDescriptor(sword1DemoSettings, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT)));
else if (mainFilesFound && pcFilesFound && psxFilesFound)
- detectedGames.push_back(GameDescriptor(sword1PSXSettings, Common::GUIO_NOMIDI));
+ detectedGames.push_back(GameDescriptor(sword1PSXSettings, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT)));
else if (mainFilesFound && pcFilesFound && psxDemoFilesFound)
- detectedGames.push_back(GameDescriptor(sword1PSXDemoSettings, Common::GUIO_NOMIDI));
+ detectedGames.push_back(GameDescriptor(sword1PSXDemoSettings, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT)));
else if (mainFilesFound && pcFilesFound && !psxFilesFound)
- detectedGames.push_back(GameDescriptor(sword1FullSettings, Common::GUIO_NOMIDI));
+ detectedGames.push_back(GameDescriptor(sword1FullSettings, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT)));
else if (mainFilesFound && macFilesFound)
- detectedGames.push_back(GameDescriptor(sword1MacFullSettings, Common::GUIO_NOMIDI));
+ detectedGames.push_back(GameDescriptor(sword1MacFullSettings, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT)));
else if (mainFilesFound && macDemoFilesFound)
- detectedGames.push_back(GameDescriptor(sword1MacDemoSettings, Common::GUIO_NOMIDI));
+ detectedGames.push_back(GameDescriptor(sword1MacDemoSettings, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT)));
return detectedGames;
}
diff --git a/engines/sword1/logic.cpp b/engines/sword1/logic.cpp
index d1c69c80ff..8e04861edf 100644
--- a/engines/sword1/logic.cpp
+++ b/engines/sword1/logic.cpp
@@ -520,7 +520,7 @@ int Logic::interpretScript(Object *compact, int id, Header *scriptModule, int sc
case IT_PUSHVARIABLE:
debug(9, "IT_PUSHVARIABLE: ScriptVar[%d] => %d", scriptCode[pc], _scriptVars[scriptCode[pc]]);
varNum = scriptCode[pc++];
- if (SwordEngine::_systemVars.isDemo && SwordEngine::isPc()) {
+ if (SwordEngine::_systemVars.isDemo && SwordEngine::isWindows()) {
if (varNum >= 397) // BS1 Demo has different number of script variables
varNum++;
if (varNum >= 699)
@@ -611,7 +611,7 @@ int Logic::interpretScript(Object *compact, int id, Header *scriptModule, int sc
case IT_POPVAR: // pop a variable
debug(9, "IT_POPVAR: ScriptVars[%d] = %d", scriptCode[pc], stack[stackIdx - 1]);
varNum = scriptCode[pc++];
- if (SwordEngine::_systemVars.isDemo && SwordEngine::isPc()) {
+ if (SwordEngine::_systemVars.isDemo && SwordEngine::isWindows()) {
if (varNum >= 397) // BS1 Demo has different number of script variables
varNum++;
if (varNum >= 699)
@@ -959,7 +959,7 @@ int Logic::fnPlaySequence(Object *cpt, int32 id, int32 sequenceId, int32 d, int3
// meantime, we don't want any looping sound effects still playing.
_sound->quitScreen();
- MoviePlayer *player = makeMoviePlayer(sequenceId, _vm, _textMan, _mixer, _system);
+ MoviePlayer *player = makeMoviePlayer(sequenceId, _vm, _textMan, _resMan, _mixer, _system);
if (player) {
_screen->clearScreen();
if (player->load(sequenceId))
diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp
index b74cd8c393..3574074b00 100644
--- a/engines/sword1/sound.cpp
+++ b/engines/sword1/sound.cpp
@@ -62,11 +62,22 @@ Sound::~Sound() {
_mixer->stopAll();
for (uint8 cnt = 0; cnt < _endOfQueue; cnt++)
if (_fxQueue[cnt].delay == 0)
- _resMan->resClose(_fxList[_fxQueue[cnt].id].sampleId);
+ _resMan->resClose(getSampleId(_fxQueue[cnt].id));
_endOfQueue = 0;
closeCowSystem();
}
+uint32 Sound::getSampleId(int32 fxNo) {
+ byte cluster = _fxList[fxNo].sampleId.cluster;
+ byte id;
+ if (SwordEngine::_systemVars.isDemo && SwordEngine::_systemVars.platform == Common::kPlatformWindows) {
+ id = _fxList[fxNo].sampleId.idWinDemo;
+ } else {
+ id = _fxList[fxNo].sampleId.idStd;
+ }
+ return (cluster << 24) | id;
+}
+
void Sound::checkSpeechFileEndianness() {
// Some mac versions (not all of them) use big endian wav, although
// the wav header doesn't indicate it.
@@ -154,14 +165,18 @@ int Sound::addToQueue(int32 fxNo) {
warning("Sound queue overflow");
return 0;
}
- _resMan->resOpen(_fxList[fxNo].sampleId);
- _fxQueue[_endOfQueue].id = fxNo;
- if (_fxList[fxNo].type == FX_SPOT)
- _fxQueue[_endOfQueue].delay = _fxList[fxNo].delay + 1;
- else
- _fxQueue[_endOfQueue].delay = 1;
- _endOfQueue++;
- return 1;
+ uint32 sampleId = getSampleId(fxNo);
+ if ((sampleId & 0xFF) != 0xFF) {
+ _resMan->resOpen(sampleId);
+ _fxQueue[_endOfQueue].id = fxNo;
+ if (_fxList[fxNo].type == FX_SPOT)
+ _fxQueue[_endOfQueue].delay = _fxList[fxNo].delay + 1;
+ else
+ _fxQueue[_endOfQueue].delay = 1;
+ _endOfQueue++;
+ return 1;
+ }
+ return 0;
}
return 0;
}
@@ -186,7 +201,7 @@ void Sound::engine() {
playSample(&_fxQueue[cnt2]);
} else {
if (!_mixer->isSoundHandleActive(_fxQueue[cnt2].handle)) { // sound finished
- _resMan->resClose(_fxList[_fxQueue[cnt2].id].sampleId);
+ _resMan->resClose(getSampleId(_fxQueue[cnt2].id));
if (cnt2 != _endOfQueue - 1)
_fxQueue[cnt2] = _fxQueue[_endOfQueue - 1];
_endOfQueue--;
@@ -200,7 +215,7 @@ void Sound::fnStopFx(int32 fxNo) {
for (uint8 cnt = 0; cnt < _endOfQueue; cnt++)
if (_fxQueue[cnt].id == (uint32)fxNo) {
if (!_fxQueue[cnt].delay) // sound was started
- _resMan->resClose(_fxList[_fxQueue[cnt].id].sampleId);
+ _resMan->resClose(getSampleId(_fxQueue[cnt].id));
if (cnt != _endOfQueue - 1)
_fxQueue[cnt] = _fxQueue[_endOfQueue - 1];
_endOfQueue--;
@@ -243,7 +258,7 @@ void Sound::quitScreen() {
}
void Sound::playSample(QueueElement *elem) {
- uint8 *sampleData = (uint8 *)_resMan->fetchRes(_fxList[elem->id].sampleId);
+ uint8 *sampleData = (uint8 *)_resMan->fetchRes(getSampleId(elem->id));
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]) ||
diff --git a/engines/sword1/sound.h b/engines/sword1/sound.h
index 112ae5b6aa..4e1ac7ba34 100644
--- a/engines/sword1/sound.h
+++ b/engines/sword1/sound.h
@@ -53,8 +53,15 @@ struct RoomVol {
int32 roomNo, leftVol, rightVol;
};
+struct SampleId {
+ byte cluster;
+ byte idStd;
+ byte idWinDemo;
+};
+
struct FxDef {
- uint32 sampleId, type, delay;
+ SampleId sampleId;
+ uint32 type, delay;
RoomVol roomVolList[MAX_ROOMS_PER_FX];
};
@@ -100,6 +107,7 @@ private:
void playSample(QueueElement *elem);
void initCowSystem();
+ uint32 getSampleId(int32 fxNo);
int16 *uncompressSpeech(uint32 index, uint32 cSize, uint32 *size);
void calcWaveVolume(int16 *data, uint32 length);
bool _waveVolume[WAVE_VOL_TAB_LENGTH];
diff --git a/engines/sword1/staticres.cpp b/engines/sword1/staticres.cpp
index 60c6877232..5dabce1301 100644
--- a/engines/sword1/staticres.cpp
+++ b/engines/sword1/staticres.cpp
@@ -2894,7 +2894,7 @@ const char Music::_tuneList[TOTAL_TUNES][8] = {
const FxDef Sound::_fxList[312] = {
// 0
{
- 0, // sampleId
+ {0,0,0}, // sampleId
0, // type (FX_LOOP, FX_RANDOM or FX_SPOT)
0, // delay (random chance for FX_RANDOM sound fx)
{ // roomVolList
diff --git a/engines/sword1/sword1.h b/engines/sword1/sword1.h
index e973c12754..ccdc2d3a59 100644
--- a/engines/sword1/sword1.h
+++ b/engines/sword1/sword1.h
@@ -90,7 +90,7 @@ public:
static bool isMac() { return _systemVars.platform == Common::kPlatformMacintosh; }
static bool isPsx() { return _systemVars.platform == Common::kPlatformPSX; }
- static bool isPc() { return _systemVars.platform == Common::kPlatformPC; }
+ static bool isWindows() { return _systemVars.platform == Common::kPlatformWindows ; }
protected:
// Engine APIs
diff --git a/engines/sword1/swordres.h b/engines/sword1/swordres.h
index 384c240283..b1fc206b80 100644
--- a/engines/sword1/swordres.h
+++ b/engines/sword1/swordres.h
@@ -1298,66 +1298,66 @@ namespace Sword1 {
// 2 entities in TXTs, 2 in datafiles.
// paris_1
// sound_fx
-#define FX_CAMERA1 0x06000000
-#define FX_CAMERA2 0x06000001
-#define FX_CAMERA3 0x06000002
-#define FX_CANDO 0x06000003
-#define FX_CANUP 0x06000004
-#define FX_CAW1 0x06000005
-#define FX_DUST 0x06000006
-#define FX_HORN1 0x06000007
-#define FX_HORN2 0x06000008
-#define FX_HORN3 0x06000009
-#define FX_LVSFLY 0x0600000A
-#define FX_PAP1 0x0600000B
-#define FX_PAP2 0x0600000C
-#define FX_PICK1 0x0600000D
-#define FX_PICK2 0x0600000E
-#define FX_PICK3 0x0600000F
-#define FX_PICK4 0x06000010
-#define FX_PICK5 0x06000011
-#define FX_TRAFFIC2 0x06000012
-#define FX_TWEET1 0x06000013
-#define FX_TWEET2 0x06000014
-#define FX_TWEET3 0x06000015
-#define FX_TWEET4 0x06000016
-#define FX_TWEET5 0x06000017
-#define FX_BIN1 0x06000018
-#define FX_BIN2 0x06000019
-#define FX_BIN3 0x0600001A
-#define FX_CAT 0x0600001B
-#define FX_COVERON2 0x0600001C
-#define FX_CRATE 0x0600001D
-#define FX_DRAIN 0x0600001E
-#define FX_HOLE 0x0600001F
-#define FX_BODY 0x06000020
-#define FX_BOTDN 0x06000021
-#define FX_BOTUP 0x06000022
-#define FX_GULP 0x06000023
-#define FX_LIGHT 0x06000024
-#define FX_PIKUP 0x06000025
-#define FX_PAP3 0x06000026
-#define FX_PAP4 0x06000027
-#define FX_PAP5 0x06000028
-#define FX_PISTOL 0x06000029
-#define FX_TBOX 0x0600002A
-#define FX_KNOKKNOK 0x0600002B
-#define FX_ALBCLO 0x0600002C
-#define FX_ALBOP 0x0600002D
-#define FX_LADD1 0x0600002E
-#define FX_LADD2 0x0600002F
-#define FX_LADD3 0x06000030
-#define FX_RAT1 0x06000031
-#define FX_RAT2 0x06000032
-#define FX_SEWSTEP1 0x06000033
-#define FX_SEWSTEP2 0x06000034
-#define FX_SWATER3 0x06000035
-#define FX_DRIP1 0x06000036
-#define FX_DRIP2 0x06000037
-#define FX_DRIP3 0x06000038
-#define FX_SWATER1 0x06000039
-#define FX_SEWLADD7 0x0600003A
-#define FX_SEWLADU7 0x0600003B
+#define FX_CAMERA1 {0x06,0x00,0x00}
+#define FX_CAMERA2 {0x06,0x01,0x01}
+#define FX_CAMERA3 {0x06,0x02,0x02}
+#define FX_CANDO {0x06,0x03,0x03}
+#define FX_CANUP {0x06,0x04,0x04}
+#define FX_CAW1 {0x06,0x05,0x05}
+#define FX_DUST {0x06,0x06,0x06}
+#define FX_HORN1 {0x06,0x07,0x07}
+#define FX_HORN2 {0x06,0x08,0x08}
+#define FX_HORN3 {0x06,0x09,0x09}
+#define FX_LVSFLY {0x06,0x0A,0xFF}
+#define FX_PAP1 {0x06,0x0B,0x0A}
+#define FX_PAP2 {0x06,0x0C,0x0B}
+#define FX_PICK1 {0x06,0x0D,0x0C}
+#define FX_PICK2 {0x06,0x0E,0x0D}
+#define FX_PICK3 {0x06,0x0F,0x0E}
+#define FX_PICK4 {0x06,0x10,0x0F}
+#define FX_PICK5 {0x06,0x11,0x10}
+#define FX_TRAFFIC2 {0x06,0x12,0x11}
+#define FX_TWEET1 {0x06,0x13,0x12}
+#define FX_TWEET2 {0x06,0x14,0x13}
+#define FX_TWEET3 {0x06,0x15,0x14}
+#define FX_TWEET4 {0x06,0x16,0x15}
+#define FX_TWEET5 {0x06,0x17,0x16}
+#define FX_BIN1 {0x06,0x18,0x17}
+#define FX_BIN2 {0x06,0x19,0x18}
+#define FX_BIN3 {0x06,0x1A,0x19}
+#define FX_CAT {0x06,0x1B,0x1A}
+#define FX_COVERON2 {0x06,0x1C,0x1B}
+#define FX_CRATE {0x06,0x1D,0x1C}
+#define FX_DRAIN {0x06,0x1E,0x1D}
+#define FX_HOLE {0x06,0x1F,0x1E}
+#define FX_BODY {0x06,0x20,0x1F}
+#define FX_BOTDN {0x06,0x21,0x20}
+#define FX_BOTUP {0x06,0x22,0x21}
+#define FX_GULP {0x06,0x23,0x22}
+#define FX_LIGHT {0x06,0x24,0x23}
+#define FX_PIKUP {0x06,0x25,0x24}
+#define FX_PAP3 {0x06,0x26,0x25}
+#define FX_PAP4 {0x06,0x27,0x26}
+#define FX_PAP5 {0x06,0x28,0x27}
+#define FX_PISTOL {0x06,0x29,0x28}
+#define FX_TBOX {0x06,0x2A,0x29}
+#define FX_KNOKKNOK {0x06,0x2B,0x2A}
+#define FX_ALBCLO {0x06,0x2C,0x2B}
+#define FX_ALBOP {0x06,0x2D,0x2C}
+#define FX_LADD1 {0x06,0x2E,0x2D}
+#define FX_LADD2 {0x06,0x2F,0x2E}
+#define FX_LADD3 {0x06,0x30,0x2F}
+#define FX_RAT1 {0x06,0x31,0x30}
+#define FX_RAT2 {0x06,0x32,0x31}
+#define FX_SEWSTEP1 {0x06,0x33,0x32}
+#define FX_SEWSTEP2 {0x06,0x34,0x33}
+#define FX_SWATER3 {0x06,0x35,0x34}
+#define FX_DRIP1 {0x06,0x36,0x35}
+#define FX_DRIP2 {0x06,0x37,0x36}
+#define FX_DRIP3 {0x06,0x38,0x37}
+#define FX_SWATER1 {0x06,0x39,0x38}
+#define FX_SEWLADD7 {0x06,0x3A,0xFF}
+#define FX_SEWLADU7 {0x06,0x3B,0x39}
// 60 entities in TXTs, 60 in datafiles.
// room1
#define PARIS1_PAL 0x06010000
@@ -1767,52 +1767,52 @@ namespace Sword1 {
// 8 entities in TXTs, 8 in datafiles.
// paris_2
// sound_fx
-#define FX_BIRD 0x07000000
-#define FX_BIRD2 0x07000001
-#define FX_CARLTON 0x07000002
-#define FX_CARS 0x07000003
-#define FX_DOORTRY 0x07000004
-#define FX_FIESTA 0x07000005
-#define FX_FLATDOOR 0x07000006
-#define FX_HVYVEHR 0x07000007
-#define FX_HVYVEHL 0x07000008
-#define FX_LITEVEHR 0x07000009
-#define FX_LITEVEHL 0x0700000A
-#define FX_FONEUP 0x0700000B
-#define FX_FONEDN 0x0700000C
-#define FX_GEOCCH 0x0700000D
-#define FX_GEOCHAIR 0x0700000E
-#define FX_GEOCHR9 0x0700000F
-#define FX_NICOPEN 0x07000010
-#define FX_NICLOSE 0x07000011
-#define FX_PHONICO1 0x07000012
-#define FX_GRAMOFON 0x07000013
-#define FX_SHOCK1 0x07000014
-#define FX_WINDUP11 0x07000015
-#define FX_FRISK 0x07000016
-#define FX_TRAFFIC3 0x07000017
-#define FX_DESKBELL 0x07000018
-#define FX_KEY13 0x07000019
-#define FX_PAPER6 0x0700001A
-#define FX_PHONEDN2 0x0700001B
-#define FX_PHONEUP2 0x0700001C
-#define FX_PIANO14 0x0700001D
-#define FX_TRYDOR14 0x0700001E
-#define FX_CABCLOSE 0x0700001F
-#define FX_CABOPEN 0x07000020
-#define FX_DORCLOSE 0x07000021
-#define FX_WINDOPEN 0x07000022
-#define FX_COO 0x07000023
-#define FX_COO2 0x07000024
-#define FX_LEDGE1 0x07000025
-#define FX_LEDGE2 0x07000026
-#define FX_BRIEFOFF 0x07000027
-#define FX_BRIEFON 0x07000028
-#define FX_JUMPIN 0x07000029
-#define FX_WARDIN 0x0700002A
-#define FX_WARDOUT 0x0700002B
-#define FX_CLIMBIN 0x0700002C
-#define FX_CLIMBOUT 0x0700002D
+#define FX_BIRD {0x07,0x00,0x00}
+#define FX_BIRD2 {0x07,0x01,0x01}
+#define FX_CARLTON {0x07,0x02,0x02}
+#define FX_CARS {0x07,0x03,0x03}
+#define FX_DOORTRY {0x07,0x04,0x04}
+#define FX_FIESTA {0x07,0x05,0x05}
+#define FX_FLATDOOR {0x07,0x06,0x06}
+#define FX_HVYVEHR {0x07,0x07,0xFF}
+#define FX_HVYVEHL {0x07,0x08,0xFF}
+#define FX_LITEVEHR {0x07,0x09,0xFF}
+#define FX_LITEVEHL {0x07,0x0A,0xFF}
+#define FX_FONEUP {0x07,0x0B,0x07}
+#define FX_FONEDN {0x07,0x0C,0x08}
+#define FX_GEOCCH {0x07,0x0D,0x09}
+#define FX_GEOCHAIR {0x07,0x0E,0x0A}
+#define FX_GEOCHR9 {0x07,0x0F,0x0B}
+#define FX_NICOPEN {0x07,0x10,0x0D}
+#define FX_NICLOSE {0x07,0x11,0x0E}
+#define FX_PHONICO1 {0x07,0x12,0x0F}
+#define FX_GRAMOFON {0x07,0x13,0x10}
+#define FX_SHOCK1 {0x07,0x14,0x11}
+#define FX_WINDUP11 {0x07,0x15,0x12}
+#define FX_FRISK {0x07,0x16,0x13}
+#define FX_TRAFFIC3 {0x07,0x17,0x14}
+#define FX_DESKBELL {0x07,0x18,0x15}
+#define FX_KEY13 {0x07,0x19,0xFF}
+#define FX_PAPER6 {0x07,0x1A,0x16}
+#define FX_PHONEDN2 {0x07,0x1B,0x17}
+#define FX_PHONEUP2 {0x07,0x1C,0x18}
+#define FX_PIANO14 {0x07,0x1D,0x19}
+#define FX_TRYDOR14 {0x07,0x1E,0x1A}
+#define FX_CABCLOSE {0x07,0x1F,0x1B}
+#define FX_CABOPEN {0x07,0x20,0x1C}
+#define FX_DORCLOSE {0x07,0x21,0x1D}
+#define FX_WINDOPEN {0x07,0x22,0x1E}
+#define FX_COO {0x07,0x23,0x1F}
+#define FX_COO2 {0x07,0x24,0x20}
+#define FX_LEDGE1 {0x07,0x25,0x21}
+#define FX_LEDGE2 {0x07,0x26,0x22}
+#define FX_BRIEFOFF {0x07,0x27,0x23}
+#define FX_BRIEFON {0x07,0x28,0x24}
+#define FX_JUMPIN {0x07,0x29,0x25}
+#define FX_WARDIN {0x07,0x2A,0x26}
+#define FX_WARDOUT {0x07,0x2B,0x27}
+#define FX_CLIMBIN {0x07,0x2C,0x28}
+#define FX_CLIMBOUT {0x07,0x2D,0x29}
// 46 entities in TXTs, 46 in datafiles.
// room9
#define PARIS2_PAL 0x07010000
@@ -2349,38 +2349,38 @@ namespace Sword1 {
// 9 entities in TXTs, 9 in datafiles.
// paris_3
// sound_fx
-#define FX_MUESEXT 0x08000000
-#define FX_AIRCON28 0x08000001
-#define FX_SARCO28A 0x08000002
-#define FX_SARCO28B 0x08000003
-#define FX_SARCO28C 0x08000004
-#define FX_TOTEM28A 0x08000005
-#define FX_ALARM 0x08000006
-#define FX_CARABINE 0x08000007
-#define FX_DOOR29 0x08000008
-#define FX_FISHFALL 0x08000009
-#define FX_GDROP29 0x0800000A
-#define FX_GUI_HIT 0x0800000B
-#define FX_GUN1 0x0800000C
-#define FX_ROPEDOWN 0x0800000D
-#define FX_SARCO29 0x0800000E
-#define FX_SMASHGLA 0x0800000F
-#define FX_TOTEM29A 0x08000010
-#define FX_TOTEM29B 0x08000011
-#define FX_HOSPEXT 0x08000012
-#define FX_GRAVEL1 0x08000013
-#define FX_GRAVEL2 0x08000014
-#define FX_HOSPNOIS 0x08000015
-#define FX_CUPBOPEN 0x08000016
-#define FX_CUPBCLOS 0x08000017
-#define FX_KIKSHINY 0x08000018
-#define FX_SHINY 0x08000019
-#define FX_SHINYOFF 0x0800001A
-#define FX_SHINYON 0x0800001B
-#define FX_BLOODPRE 0x0800001C
-#define FX_GUN34 0x0800001D
-#define FX_PULSE2 0x0800001E
-#define FX_PULSE3 0x0800001F
+#define FX_MUESEXT {0x08,0x00,0x00}
+#define FX_AIRCON28 {0x08,0x01,0x01}
+#define FX_SARCO28A {0x08,0x02,0x02}
+#define FX_SARCO28B {0x08,0x03,0x03}
+#define FX_SARCO28C {0x08,0x04,0x04}
+#define FX_TOTEM28A {0x08,0x05,0x05}
+#define FX_ALARM {0x08,0x06,0x06}
+#define FX_CARABINE {0x08,0x07,0x07}
+#define FX_DOOR29 {0x08,0x08,0x08}
+#define FX_FISHFALL {0x08,0x09,0x09}
+#define FX_GDROP29 {0x08,0x0A,0x0A}
+#define FX_GUI_HIT {0x08,0x0B,0x0B}
+#define FX_GUN1 {0x08,0x0C,0x0C}
+#define FX_ROPEDOWN {0x08,0x0D,0x0D}
+#define FX_SARCO29 {0x08,0x0E,0x0E}
+#define FX_SMASHGLA {0x08,0x0F,0x0F}
+#define FX_TOTEM29A {0x08,0x10,0x10}
+#define FX_TOTEM29B {0x08,0x11,0x11}
+#define FX_HOSPEXT {0x08,0x12,0x12}
+#define FX_GRAVEL1 {0x08,0x13,0x13}
+#define FX_GRAVEL2 {0x08,0x14,0x14}
+#define FX_HOSPNOIS {0x08,0x15,0x15}
+#define FX_CUPBOPEN {0x08,0x16,0x16}
+#define FX_CUPBCLOS {0x08,0x17,0x17}
+#define FX_KIKSHINY {0x08,0x18,0xFF}
+#define FX_SHINY {0x08,0x19,0x18}
+#define FX_SHINYOFF {0x08,0x1A,0x19}
+#define FX_SHINYON {0x08,0x1B,0x1A}
+#define FX_BLOODPRE {0x08,0x1C,0x1B}
+#define FX_GUN34 {0x08,0x1D,0x1C}
+#define FX_PULSE2 {0x08,0x1E,0x1D}
+#define FX_PULSE3 {0x08,0x1F,0x1E}
// 32 entities in TXTs, 32 in datafiles.
// benoir
#define MEGABEN 0x08010000
@@ -2794,29 +2794,29 @@ namespace Sword1 {
// 30 entities in TXTs, 30 in datafiles.
// paris_4
// sound_fx
-#define FX_COVDWN 0x09000000
-#define FX_KEYIN 0x09000001
-#define FX_MANOP36 0x09000002
-#define FX_MONTAMB 0x09000003
-#define FX_OOH 0x09000004
-#define FX_PULLUP36 0x09000005
-#define FX_REPLCE36 0x09000006
-#define FX_AMBIEN37 0x09000007
-#define FX_CHAIN37 0x09000008
-#define FX_CHAIN37B 0x09000009
-#define FX_DOOR37 0x0900000A
-#define FX_HOLE37 0x0900000B
-#define FX_KNOCK37 0x0900000C
-#define FX_KNOCK37B 0x0900000D
-#define FX_WINCH37 0x0900000E
-#define FX_AIRCON41 0x0900000F
-#define FX_FONEDN41 0x09000010
-#define FX_FONEUP41 0x09000011
-#define FX_PHONCALL 0x09000012
-#define FX_THERMO1 0x09000013
-#define FX_TAPDRIP 0x09000014
-#define FX_DRIER1 0x09000015
-#define FX_CHURCHFX 0x09000016
+#define FX_COVDWN {0x09,0x00,0xFF}
+#define FX_KEYIN {0x09,0x01,0xFF}
+#define FX_MANOP36 {0x09,0x02,0x00}
+#define FX_MONTAMB {0x09,0x03,0x01}
+#define FX_OOH {0x09,0x04,0x02}
+#define FX_PULLUP36 {0x09,0x05,0x03}
+#define FX_REPLCE36 {0x09,0x06,0x04}
+#define FX_AMBIEN37 {0x09,0x07,0x05}
+#define FX_CHAIN37 {0x09,0x08,0x06}
+#define FX_CHAIN37B {0x09,0x09,0x06}
+#define FX_DOOR37 {0x09,0x0A,0x07}
+#define FX_HOLE37 {0x09,0x0B,0x08}
+#define FX_KNOCK37 {0x09,0x0C,0x09}
+#define FX_KNOCK37B {0x09,0x0D,0x0A}
+#define FX_WINCH37 {0x09,0x0E,0x0B}
+#define FX_AIRCON41 {0x09,0x0F,0x0C}
+#define FX_FONEDN41 {0x09,0x10,0x0D}
+#define FX_FONEUP41 {0x09,0x11,0x0E}
+#define FX_PHONCALL {0x09,0x12,0x0F}
+#define FX_THERMO1 {0x09,0x13,0x10}
+#define FX_TAPDRIP {0x09,0x14,0xFF}
+#define FX_DRIER1 {0x09,0x15,0x11}
+#define FX_CHURCHFX {0x09,0x16,0x12}
// 23 entities in TXTs, 23 in datafiles.
// room36
#define R36SPRPAL 0x09010000
@@ -3302,56 +3302,56 @@ namespace Sword1 {
// 39 entities in TXTs, 39 in datafiles.
// ireland
// sound_fx
-#define FX_EIRBIRD3 0x0A000000
-#define FX_SHOCK2 0x0A000001
-#define FX_EIRBIRD1 0x0A000002
-#define FX_EIRBIRD2 0x0A000003
-#define FX_SWITCH19 0x0A000004
-#define FX_TRAPOPEN 0x0A000005
-#define FX_VIOLIN19 0x0A000006
-#define FX_WHISTLE 0x0A000007
-#define FX_BARFLAP 0x0A000008
-#define FX_DORCLOSE20 0x0A000009
-#define FX_DRINK 0x0A00000A
-#define FX_FITZHIT 0x0A00000B
-#define FX_FITZRUN 0x0A00000C
-#define FX_FITZUP 0x0A00000D
-#define FX_FUSE20 0x0A00000E
-#define FX_PULLPINT 0x0A00000F
-#define FX_SNEEZE1 0x0A000010
-#define FX_SNEEZE2 0x0A000011
-#define FX_WASHER 0x0A000012
-#define FX_CELTAP 0x0A000013
-#define FX_DRIPIRE 0x0A000014
-#define FX_DRIPIRE2 0x0A000015
-#define FX_TAP 0x0A000016
-#define FX_TAP2 0x0A000017
-#define FX_CLIMBHAY 0x0A000018
-#define FX_FARMERGO 0x0A000019
-#define FX_CASTLWAL 0x0A00001A
-#define FX_CLIMBFAL 0x0A00001B
-#define FX_KEYSTEP 0x0A00001C
-#define FX_WIND 0x0A00001D
-#define FX_GEOGOAT 0x0A00001E
-#define FX_GOATBAA 0x0A00001F
-#define FX_GOATCHEW 0x0A000020
-#define FX_GOATDOH 0x0A000021
-#define FX_PLOUGH 0x0A000022
-#define FX_EIRDRIP1 0x0A000023
-#define FX_EIRDRIP2 0x0A000024
-#define FX_LADDWN25 0x0A000025
-#define FX_LADDUP25 0x0A000026
-#define FX_SECDOR25 0x0A000027
-#define FX_SLABFALL 0x0A000028
-#define FX_SLABUP 0x0A000029
-#define FX_TRIGER25 0x0A00002A
-#define FX_WRING 0x0A00002B
-#define FX_LEVER 0x0A00002C
-#define FX_LEVER2 0x0A00002D
-#define FX_RAT3A 0x0A00002E
-#define FX_RAT3B 0x0A00002F
-#define FX_RAT3C 0x0A000030
-#define FX_RAT3D 0x0A000031
+#define FX_EIRBIRD3 {0x0A,0x00,0x00}
+#define FX_SHOCK2 {0x0A,0x01,0x01}
+#define FX_EIRBIRD1 {0x0A,0x02,0x02}
+#define FX_EIRBIRD2 {0x0A,0x03,0x03}
+#define FX_SWITCH19 {0x0A,0x04,0x04}
+#define FX_TRAPOPEN {0x0A,0x05,0x05}
+#define FX_VIOLIN19 {0x0A,0x06,0x06}
+#define FX_WHISTLE {0x0A,0x07,0x07}
+#define FX_BARFLAP {0x0A,0x08,0x08}
+#define FX_DORCLOSE20 {0x0A,0x09,0x09}
+#define FX_DRINK {0x0A,0x0A,0x0A}
+#define FX_FITZHIT {0x0A,0x0B,0x0B}
+#define FX_FITZRUN {0x0A,0x0C,0x0C}
+#define FX_FITZUP {0x0A,0x0D,0x0D}
+#define FX_FUSE20 {0x0A,0x0E,0x0E}
+#define FX_PULLPINT {0x0A,0x0F,0x0F}
+#define FX_SNEEZE1 {0x0A,0x10,0xFF}
+#define FX_SNEEZE2 {0x0A,0x11,0xFF}
+#define FX_WASHER {0x0A,0x12,0x10}
+#define FX_CELTAP {0x0A,0x13,0x11}
+#define FX_DRIPIRE {0x0A,0x14,0xFF}
+#define FX_DRIPIRE2 {0x0A,0x15,0xFF}
+#define FX_TAP {0x0A,0x16,0x12}
+#define FX_TAP2 {0x0A,0x17,0x13}
+#define FX_CLIMBHAY {0x0A,0x18,0x14}
+#define FX_FARMERGO {0x0A,0x19,0x15}
+#define FX_CASTLWAL {0x0A,0x1A,0x16}
+#define FX_CLIMBFAL {0x0A,0x1B,0x17}
+#define FX_KEYSTEP {0x0A,0x1C,0x18}
+#define FX_WIND {0x0A,0x1D,0x19}
+#define FX_GEOGOAT {0x0A,0x1E,0x1A}
+#define FX_GOATBAA {0x0A,0x1F,0x1B}
+#define FX_GOATCHEW {0x0A,0x20,0x1C}
+#define FX_GOATDOH {0x0A,0x21,0x1D}
+#define FX_PLOUGH {0x0A,0x22,0x1E}
+#define FX_EIRDRIP1 {0x0A,0x23,0xFF}
+#define FX_EIRDRIP2 {0x0A,0x24,0xFF}
+#define FX_LADDWN25 {0x0A,0x25,0xFF}
+#define FX_LADDUP25 {0x0A,0x26,0xFF}
+#define FX_SECDOR25 {0x0A,0x27,0x21}
+#define FX_SLABFALL {0x0A,0x28,0x22}
+#define FX_SLABUP {0x0A,0x29,0x23}
+#define FX_TRIGER25 {0x0A,0x2A,0x24}
+#define FX_WRING {0x0A,0x2B,0x25}
+#define FX_LEVER {0x0A,0x2C,0x26}
+#define FX_LEVER2 {0x0A,0x2D,0x27}
+#define FX_RAT3A {0x0A,0x2E,0x28}
+#define FX_RAT3B {0x0A,0x2F,0x28}
+#define FX_RAT3C {0x0A,0x30,0x28}
+#define FX_RAT3D {0x0A,0x31,0x28}
// 50 entities in TXTs, 50 in datafiles.
// room19
#define R19SPRPAL 0x0A010000
@@ -3811,23 +3811,23 @@ namespace Sword1 {
// 16 entities in TXTs, 16 in datafiles.
// spain
// sound_fx
-#define FX_SPNBIRD1 0x0B000000
-#define FX_SPNBIRD2 0x0B000001
-#define FX_AMBIEN56 0x0B000002
-#define FX_DOGS56 0x0B000003
-#define FX_PENDULUM 0x0B000004
-#define FX_CANFALL 0x0B000005
-#define FX_HOSE57 0x0B000006
-#define FX_HOSE57B 0x0B000007
-#define FX_SPAIN 0x0B000008
-#define FX_CHESS 0x0B000009
-#define FX_SECDOR59 0x0B00000A
-#define FX_WINDOW59 0x0B00000B
-#define FX_LIONFALL 0x0B00000C
-#define FX_LIONFAL2 0x0B00000D
-#define FX_TOOTHPUL 0x0B00000E
-#define FX_SECDOR61 0x0B00000F
-#define FX_WELLDRIP 0x0B000010
+#define FX_SPNBIRD1 {0x0B,0x00,0x00}
+#define FX_SPNBIRD2 {0x0B,0x01,0x01}
+#define FX_AMBIEN56 {0x0B,0x02,0x02}
+#define FX_DOGS56 {0x0B,0x03,0x03}
+#define FX_PENDULUM {0x0B,0x04,0x04}
+#define FX_CANFALL {0x0B,0x05,0x05}
+#define FX_HOSE57 {0x0B,0x06,0x06}
+#define FX_HOSE57B {0x0B,0x07,0x07}
+#define FX_SPAIN {0x0B,0x08,0x08}
+#define FX_CHESS {0x0B,0x09,0x09}
+#define FX_SECDOR59 {0x0B,0x0A,0xFF}
+#define FX_WINDOW59 {0x0B,0x0B,0xFF}
+#define FX_LIONFALL {0x0B,0x0C,0x0B}
+#define FX_LIONFAL2 {0x0B,0x0D,0x0C}
+#define FX_TOOTHPUL {0x0B,0x0E,0x0D}
+#define FX_SECDOR61 {0x0B,0x0F,0x0E}
+#define FX_WELLDRIP {0x0B,0x10,0x0F}
// 17 entities in TXTs, 17 in datafiles.
// room56
#define SPAIN_PAL 0x0B010000
@@ -4186,34 +4186,34 @@ namespace Sword1 {
// 8 entities in TXTs, 8 in datafiles.
// syria
// sound_fx
-#define FX_CAMERA45 0x0C000000
-#define FX_SHOCK3 0x0C000001
-#define FX_STALLBEL 0x0C000002
-#define FX_AYUBDOOR 0x0C000003
-#define FX_BALLPLAY 0x0C000004
-#define FX_CATHIT 0x0C000005
-#define FX_MARIB 0x0C000006
-#define FX_NEWTON 0x0C000007
-#define FX_STALLCAT 0x0C000008
-#define FX_STATBREK 0x0C000009
-#define FX_KEYS49 0x0C00000A
-#define FX_MANG1 0x0C00000B
-#define FX_MANG2 0x0C00000C
-#define FX_MANG3 0x0C00000D
-#define FX_UNLOCK49 0x0C00000E
-#define FX_WCCHAIN 0x0C00000F
-#define FX_CUBDOR 0x0C000010
-#define FX_BREKSTIK 0x0C000011
-#define FX_CLIMBDWN 0x0C000012
-#define FX_CRICKET 0x0C000013
-#define FX_GEOFAL54 0x0C000014
-#define FX_KHANDOWN 0x0C000015
-#define FX_RINGPULL 0x0C000016
-#define FX_SECDOR54 0x0C000017
-#define FX_SHOTKHAN 0x0C000018
-#define FX_SYRIWIND 0x0C000019
-#define FX_THUMP1 0x0C00001A
-#define FX_SECDOR55 0x0C00001B
+#define FX_CAMERA45 {0x0C,0x00,0xFF}
+#define FX_SHOCK3 {0x0C,0x01,0x00}
+#define FX_STALLBEL {0x0C,0x02,0x01}
+#define FX_AYUBDOOR {0x0C,0x03,0x02}
+#define FX_BALLPLAY {0x0C,0x04,0x03}
+#define FX_CATHIT {0x0C,0x05,0x04}
+#define FX_MARIB {0x0C,0x06,0x05}
+#define FX_NEWTON {0x0C,0x07,0x06}
+#define FX_STALLCAT {0x0C,0x08,0x07}
+#define FX_STATBREK {0x0C,0x09,0x08}
+#define FX_KEYS49 {0x0C,0x0A,0x09}
+#define FX_MANG1 {0x0C,0x0B,0x0A}
+#define FX_MANG2 {0x0C,0x0C,0x0B}
+#define FX_MANG3 {0x0C,0x0D,0x0C}
+#define FX_UNLOCK49 {0x0C,0x0E,0x0D}
+#define FX_WCCHAIN {0x0C,0x0F,0x0E}
+#define FX_CUBDOR {0x0C,0x10,0x0F}
+#define FX_BREKSTIK {0x0C,0x11,0x10}
+#define FX_CLIMBDWN {0x0C,0x12,0x11}
+#define FX_CRICKET {0x0C,0x13,0x12}
+#define FX_GEOFAL54 {0x0C,0x14,0x13}
+#define FX_KHANDOWN {0x0C,0x15,0x14}
+#define FX_RINGPULL {0x0C,0x16,0x15}
+#define FX_SECDOR54 {0x0C,0x17,0x16}
+#define FX_SHOTKHAN {0x0C,0x18,0x17}
+#define FX_SYRIWIND {0x0C,0x19,0x18}
+#define FX_THUMP1 {0x0C,0x1A,0x19}
+#define FX_SECDOR55 {0x0C,0x1B,0x1A}
// 28 entities in TXTs, 28 in datafiles.
// duane
#define DUANE_MEGA 0x0C010000
@@ -4578,19 +4578,19 @@ namespace Sword1 {
// 37 entities in TXTs, 37 in datafiles.
// train
// sound_fx
-#define FX_SHOCK63 0x0D000000
-#define FX_TRAINEXT 0x0D000001
-#define FX_TRAININT 0x0D000002
-#define FX_DOOR65 0x0D000003
-#define FX_WIND66 0x0D000004
-#define FX_WINDOW66 0x0D000005
-#define FX_BRAKES 0x0D000006
-#define FX_DOOR69 0x0D000007
-#define FX_EKSHOOT 0x0D000008
-#define FX_FIGHT69 0x0D000009
-#define FX_PNEUMO69 0x0D00000A
-#define FX_TICK69 0x0D00000B
-#define FX_TRNPASS 0x0D00000C
+#define FX_SHOCK63 {0x0D,0x00,0x00}
+#define FX_TRAINEXT {0x0D,0x01,0x01}
+#define FX_TRAININT {0x0D,0x02,0x02}
+#define FX_DOOR65 {0x0D,0x03,0x03}
+#define FX_WIND66 {0x0D,0x04,0x04}
+#define FX_WINDOW66 {0x0D,0x05,0x05}
+#define FX_BRAKES {0x0D,0x06,0x06}
+#define FX_DOOR69 {0x0D,0x07,0x07}
+#define FX_EKSHOOT {0x0D,0x08,0x08}
+#define FX_FIGHT69 {0x0D,0x09,0xFF}
+#define FX_PNEUMO69 {0x0D,0x0A,0x09}
+#define FX_TICK69 {0x0D,0x0B,0x0A}
+#define FX_TRNPASS {0x0D,0x0C,0x0B}
// 13 entities in TXTs, 13 in datafiles.
// room63
#define TRAIN_PAL 0x0D010000
@@ -4828,33 +4828,33 @@ namespace Sword1 {
// 57 entities in TXTs, 57 in datafiles.
// scotland
// sound_fx
-#define FX_WIND71 0x0E000000
-#define FX_GUST71 0x0E000001
-#define FX_OWL71A 0x0E000002
-#define FX_OWL71B 0x0E000003
-#define FX_COG72A 0x0E000004
-#define FX_PING 0x0E000005
-#define FX_RUMMAGE1 0x0E000006
-#define FX_RUMMAGE2 0x0E000007
-#define FX_SECDOR72 0x0E000008
-#define FX_CHANT 0x0E000009
-#define FX_DAGGER1 0x0E00000A
-#define FX_GDROP73 0x0E00000B
-#define FX_GUNPOWDR 0x0E00000C
-#define FX_STAFF 0x0E00000D
-#define FX_TORCH73 0x0E00000E
-#define FX_BAPHAMB 0x0E00000F
-#define FX_FIGHT1 0x0E000010
-#define FX_REFORGE2 0x0E000011
-#define FX_ROSSODIE 0x0E000012
-#define FX_GKSWORD 0x0E000013
-#define FX_REFORGE1 0x0E000014
-#define FX_REFORGE4 0x0E000015
-#define FX_CHOKE1 0x0E000016
-#define FX_CHOKE2 0x0E000017
-#define FX_EKDIES 0x0E000018
-#define FX_FIGHT2 0x0E000019
-#define FX_GUN79 0x0E00001A
+#define FX_WIND71 {0x0E,0x00,0x00}
+#define FX_GUST71 {0x0E,0x01,0x01}
+#define FX_OWL71A {0x0E,0x02,0x02}
+#define FX_OWL71B {0x0E,0x03,0x03}
+#define FX_COG72A {0x0E,0x04,0x04}
+#define FX_PING {0x0E,0x05,0x05}
+#define FX_RUMMAGE1 {0x0E,0x06,0x06}
+#define FX_RUMMAGE2 {0x0E,0x07,0x07}
+#define FX_SECDOR72 {0x0E,0x08,0x08}
+#define FX_CHANT {0x0E,0x09,0xFF}
+#define FX_DAGGER1 {0x0E,0x0A,0x09}
+#define FX_GDROP73 {0x0E,0x0B,0xFF}
+#define FX_GUNPOWDR {0x0E,0x0C,0x0A}
+#define FX_STAFF {0x0E,0x0D,0xFF}
+#define FX_TORCH73 {0x0E,0x0E,0x0B}
+#define FX_BAPHAMB {0x0E,0x0F,0xFF}
+#define FX_FIGHT1 {0x0E,0x10,0xFF}
+#define FX_REFORGE2 {0x0E,0x11,0xFF}
+#define FX_ROSSODIE {0x0E,0x12,0x0C}
+#define FX_GKSWORD {0x0E,0x13,0xFF}
+#define FX_REFORGE1 {0x0E,0x14,0xFF}
+#define FX_REFORGE4 {0x0E,0x15,0xFF}
+#define FX_CHOKE1 {0x0E,0x16,0x0D}
+#define FX_CHOKE2 {0x0E,0x17,0x0E}
+#define FX_EKDIES {0x0E,0x18,0xFF}
+#define FX_FIGHT2 {0x0E,0x19,0x0F}
+#define FX_GUN79 {0x0E,0x1A,0x10}
// 27 entities in TXTs, 27 in datafiles.
// room71
#define R71L0 0x0E010000
diff --git a/engines/sword2/console.cpp b/engines/sword2/console.cpp
index 957b2431e0..28e2e8ce7b 100644
--- a/engines/sword2/console.cpp
+++ b/engines/sword2/console.cpp
@@ -446,7 +446,7 @@ bool Debugger::Cmd_ResLook(int argc, const char **argv) {
DebugPrintf("<menu icon> %s\n", _vm->_resman->fetchName(res));
break;
default:
- DebugPrintf("unrecognised fileType %d\n", type);
+ DebugPrintf("unrecognized fileType %d\n", type);
break;
}
diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp
index 87c7c12ad6..3b7965259c 100644
--- a/engines/sword2/sword2.cpp
+++ b/engines/sword2/sword2.cpp
@@ -145,7 +145,7 @@ GameList Sword2MetaEngine::detectGames(const Common::FSList &fslist) const {
if (0 == scumm_stricmp(g->detectname, fileName)) {
// Match found, add to list of candidates, then abort inner loop.
- detectedGames.push_back(GameDescriptor(g->gameid, g->description, Common::UNK_LANG, Common::kPlatformUnknown, Common::GUIO_NOMIDI));
+ detectedGames.push_back(GameDescriptor(g->gameid, g->description, Common::UNK_LANG, Common::kPlatformUnknown, GUIO2(GUIO_NOMIDI, GUIO_NOASPECT)));
break;
}
}
diff --git a/engines/sword25/detection.cpp b/engines/sword25/detection.cpp
index 25a3df167b..06e4ba2a7d 100644
--- a/engines/sword25/detection.cpp
+++ b/engines/sword25/detection.cpp
@@ -44,7 +44,7 @@ static const char *directoryGlobs[] = {
class Sword25MetaEngine : public AdvancedMetaEngine {
public:
Sword25MetaEngine() : AdvancedMetaEngine(Sword25::gameDescriptions, sizeof(ADGameDescription), sword25Game) {
- _guioptions = Common::GUIO_NOMIDI;
+ _guioptions = GUIO1(GUIO_NOMIDI);
_maxScanDepth = 2;
_directoryGlobs = directoryGlobs;
}
diff --git a/engines/sword25/detection_tables.h b/engines/sword25/detection_tables.h
index fe9e6e7934..94a5b55fed 100644
--- a/engines/sword25/detection_tables.h
+++ b/engines/sword25/detection_tables.h
@@ -22,11 +22,6 @@
namespace Sword25 {
-using Common::GUIO_NONE;
-using Common::GUIO_NOSPEECH;
-using Common::GUIO_NOSFX;
-using Common::GUIO_NOMUSIC;
-
static const ADGameDescription gameDescriptions[] = {
{
"sword25",
@@ -35,7 +30,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformUnknown,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
{
"sword25",
@@ -44,7 +39,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformUnknown,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
{
"sword25",
@@ -53,16 +48,16 @@ static const ADGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformUnknown,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
{
"sword25",
"",
AD_ENTRY1s("lang_hr.b25c", "e881054d1f8ec1e527422fc521c25405", 1273217),
- Common::HU_HUN,
+ Common::HR_HRV,
Common::kPlatformUnknown,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
{
"sword25",
@@ -71,7 +66,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformUnknown,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
{
"sword25",
@@ -80,7 +75,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::PL_POL,
Common::kPlatformUnknown,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
{
"sword25",
@@ -89,7 +84,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::PT_BRA,
Common::kPlatformUnknown,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
{
"sword25",
@@ -98,7 +93,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::RU_RUS,
Common::kPlatformUnknown,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
{
"sword25",
@@ -107,7 +102,18 @@ static const ADGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformUnknown,
ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
+ },
+ // Hungarian "psylog" version.
+ // Submitted by goodoldgeorg in bug report #3428644.
+ {
+ "sword25",
+ "psylog version",
+ AD_ENTRY1s("lang_hu.b25c", "7de51a3b4926a192549e75b1a7d81667", 1864915),
+ Common::HU_HUN,
+ Common::kPlatformUnknown,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NOASPECT)
},
// Extracted version
@@ -121,7 +127,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformUnknown,
GF_EXTRACTED | ADGF_UNSTABLE,
- Common::GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
AD_TABLE_END_MARKER
};
diff --git a/engines/sword25/gfx/image/renderedimage.cpp b/engines/sword25/gfx/image/renderedimage.cpp
index 3b29b0333f..b0d4853e5e 100644
--- a/engines/sword25/gfx/image/renderedimage.cpp
+++ b/engines/sword25/gfx/image/renderedimage.cpp
@@ -152,7 +152,7 @@ RenderedImage::RenderedImage(uint width, uint height, bool &result) :
_height(height) {
_data = new byte[width * height * 4];
- Common::set_to(_data, &_data[width * height * 4], 0);
+ Common::fill(_data, &_data[width * height * 4], 0);
_backSurface = Kernel::getInstance()->getGfx()->getSurface();
@@ -507,7 +507,7 @@ int *RenderedImage::scaleLine(int size, int srcSize) {
int scale = 100 * size / srcSize;
assert(scale > 0);
int *v = new int[size];
- Common::set_to(v, &v[size], 0);
+ Common::fill(v, &v[size], 0);
int distCtr = 0;
int *destP = v;
diff --git a/engines/sword25/gfx/renderobject.h b/engines/sword25/gfx/renderobject.h
index 0b54ccc24b..f963ccaeb3 100644
--- a/engines/sword25/gfx/renderobject.h
+++ b/engines/sword25/gfx/renderobject.h
@@ -402,7 +402,7 @@ protected:
@return Gibt false zurück, falls das Rendern fehlgeschlagen ist.
@remark
*/
- virtual bool doRender() = 0; // { return true; };
+ virtual bool doRender() = 0; // { return true; }
// RenderObject-Baum Variablen
// ---------------------------
diff --git a/engines/teenagent/actor.cpp b/engines/teenagent/actor.cpp
index 717c022c38..cb8c798fb6 100644
--- a/engines/teenagent/actor.cpp
+++ b/engines/teenagent/actor.cpp
@@ -37,7 +37,7 @@ Common::Rect Actor::renderIdle(Graphics::Surface *surface, const Common::Point &
debug(0, "switched to idle animation %u", idle_type);
}
- Resources * res = Resources::instance();
+ Resources *res = Resources::instance();
byte *frames_idle;
do {
frames_idle = res->dseg.ptr(res->dseg.get_word(0x6540 + idle_type * 2)) + index;
@@ -47,7 +47,7 @@ Common::Rect Actor::renderIdle(Graphics::Surface *surface, const Common::Point &
debug(0, "switched to idle animation %u[loop]", idle_type);
index = 3; //put 4th frame (base 1) if idle animation loops
}
- } while(*frames_idle == 0);
+ } while (*frames_idle == 0);
bool mirror = orientation == kActorLeft;
Surface *s = frames + *frames_idle - 1;
diff --git a/engines/teenagent/animation.h b/engines/teenagent/animation.h
index d9092d1707..6942cc74eb 100644
--- a/engines/teenagent/animation.h
+++ b/engines/teenagent/animation.h
@@ -35,7 +35,7 @@ public:
enum Type {kTypeLan, kTypeVaria, kTypeInventory};
Animation();
- void load(Common::SeekableReadStream&, Type type = kTypeLan);
+ void load(Common::SeekableReadStream &, Type type = kTypeLan);
void free();
Surface *firstFrame();
diff --git a/engines/teenagent/callbacks.cpp b/engines/teenagent/callbacks.cpp
index ae498478a4..8882531d27 100644
--- a/engines/teenagent/callbacks.cpp
+++ b/engines/teenagent/callbacks.cpp
@@ -34,7 +34,7 @@ namespace TeenAgent {
#define INC_FLAG(addr) (++*res->dseg.ptr(addr))
void TeenAgentEngine::rejectMessage() {
- Resources * res = Resources::instance();
+ Resources *res = Resources::instance();
//random reject message:
uint i = _rnd.getRandomNumber(3);
//debug(0, "reject message: %s", (const char *)res->dseg.ptr(res->dseg.get_word(0x339e + 2 * i)));
@@ -46,9 +46,9 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
if (addr == 0)
return false;
- Resources * res = Resources::instance();
+ Resources *res = Resources::instance();
debug(0, "processCallback(%04x)", addr);
- byte * code = res->cseg.ptr(addr);
+ byte *code = res->cseg.ptr(addr);
//try trivial callbacks first
if (code[0] == 0xbb && code[3] == 0xe8 && code[6] == 0xc3) {
@@ -1355,7 +1355,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
inventory->add(11);
disableObject(1);
- byte * scene_15_ons = scene->getOns(15); //patch ons for the scene 15
+ byte *scene_15_ons = scene->getOns(15); //patch ons for the scene 15
scene_15_ons[0] = 0;
byte f = GET_FLAG(0xDB98) + 1;
@@ -2501,7 +2501,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
return true;
case 0x862c:
- displayMessage(CHECK_FLAG(0xDBB0, 1)? 0x4882: 0x3457);
+ displayMessage(CHECK_FLAG(0xDBB0, 1) ? 0x4882 : 0x3457);
return true;
case 0x86a9: //correcting height of the pole with spanner
@@ -2561,7 +2561,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
setOns(4, 0);
{
- Walkbox * w = scene->getWalkbox(0);
+ Walkbox *w = scene->getWalkbox(0);
w->rect.clear();
w->save();
}
@@ -2747,21 +2747,21 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
inventory->remove(36);
SET_FLAG(0xDBAD, 1);
{
- Object * o = scene->getObject(7);
+ Object *o = scene->getObject(7);
o->actor_rect.left = o->actor_rect.right = 297;
o->actor_rect.top = o->actor_rect.bottom = 181;
o->actor_orientation = 1;
o->save();
}
{
- Object * o = scene->getObject(9);
+ Object *o = scene->getObject(9);
o->actor_rect.left = o->actor_rect.right = 297;
o->actor_rect.top = o->actor_rect.bottom = 181;
o->actor_orientation = 1;
o->save();
}
{
- Walkbox * w = scene->getWalkbox(0);
+ Walkbox *w = scene->getWalkbox(0);
w->rect.right = 266;
w->rect.bottom = 193;
w->save();
@@ -3110,7 +3110,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playSound(67, 4);
playActorAnimation(680);
SET_FLAG(0xDBB8, 0);
- } else if (CHECK_FLAG(0xDBB8, 1)) {
+ } else if (CHECK_FLAG(0xDBB7, 1)) {
processCallback(0x6b86);
} else if (CHECK_FLAG(0xDBB9, 1)) {
processCallback(0x6b86);
@@ -3177,7 +3177,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playSound(67, 5);
playActorAnimation(688);
SET_FLAG(0xdbbc, 0);
- } else if (CHECK_FLAG(0xdbbc, 1)) {
+ } else if (CHECK_FLAG(0xdbbb, 1)) {
processCallback(0x6b86);
} else {
playSound(66, 6);
@@ -3221,7 +3221,8 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
return true;
case 0x6c83:
- Dialog::pop(scene, 0xdb2e, 0, 0, 0xd1, 0xef, 0, 1);
+ waitLanAnimationFrame(1, 1);
+ Dialog::pop(scene, 0xdb2e, 0, 727, 0xd1, 0xef, 0, 1);
scene->getObject(1)->setName((const char *)res->dseg.ptr(0xaa94));
SET_FLAG(0xDBD1, 1);
return true;
@@ -3557,8 +3558,9 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playSound(5, 39);
displayAsyncMessage(0x5124, 40388, 9, 35, 0xd0);
playActorAnimation(728);
- //fixme: add 727 animation
- Dialog::show(scene, 0x3d17, 0, 0, 0xd1, 0xef, 0, 1);
+
+ waitLanAnimationFrame(1, 1);
+ Dialog::show(scene, 0x3d17, 0, 727, 0xd1, 0xef, 0, 1);
SET_FLAG(0xDBD2, 1);
processCallback(0x9175);
return true;
@@ -3572,13 +3574,14 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
return true;
}
displayMessage(0x5138);
- waitLanAnimationFrame(1, 1);
+ waitLanAnimationFrame(1, 1);
playSound(5, 3);
playSound(5, 23);
playActorAnimation(729);
- //fixme: add 727 animation
- Dialog::show(scene, 0x3d70, 0, 0, 0xd1, 0xef, 0, 1);
+
+ waitLanAnimationFrame(1, 1);
+ Dialog::show(scene, 0x3d70, 0, 727, 0xd1, 0xef, 0, 1);
SET_FLAG(0xDBD3, 1);
processCallback(0x9175);
return true;
@@ -3597,8 +3600,9 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
playSound(5, 3);
playSound(5, 25);
playActorAnimation(730);
- //fixme: add 727 animation
- Dialog::show(scene, 0x3dd6, 0, 0, 0xd1, 0xef, 0, 1);
+
+ waitLanAnimationFrame(1, 1);
+ Dialog::show(scene, 0x3dd6, 0, 727, 0xd1, 0xef, 0, 1);
SET_FLAG(0xDBD4, 1);
processCallback(0x9175);
return true;
@@ -3904,7 +3908,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
SET_FLAG(0, 0);
processCallback(0x9a7a);
INC_FLAG(0xDBA6);
- switch(GET_FLAG(0xDBA6)) {
+ switch (GET_FLAG(0xDBA6)) {
case 1:
displayMessage(0x39ae);
break;
@@ -4014,7 +4018,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
moveTo(186, 198, 2, true);
moveTo(220, 198, 4);
{
- Walkbox * w = scene->getWalkbox(0);
+ Walkbox *w = scene->getWalkbox(0);
w->rect.left = 0;
w->rect.bottom = 199;
w->save();
diff --git a/engines/teenagent/console.cpp b/engines/teenagent/console.cpp
index 2f4d7cc9c3..9ab6001d54 100644
--- a/engines/teenagent/console.cpp
+++ b/engines/teenagent/console.cpp
@@ -25,10 +25,13 @@
namespace TeenAgent {
Console::Console(TeenAgentEngine *engine) : _engine(engine) {
- DCmd_Register("enable_object", WRAP_METHOD(Console, enableObject));
- DCmd_Register("disable_object", WRAP_METHOD(Console, enableObject));
- DCmd_Register("set_ons", WRAP_METHOD(Console, setOns));
- DCmd_Register("set_music", WRAP_METHOD(Console, setMusic));
+ DCmd_Register("enable_object", WRAP_METHOD(Console, enableObject));
+ DCmd_Register("disable_object", WRAP_METHOD(Console, enableObject));
+ DCmd_Register("set_ons", WRAP_METHOD(Console, setOns));
+ DCmd_Register("set_music", WRAP_METHOD(Console, setMusic));
+ DCmd_Register("animation", WRAP_METHOD(Console, playAnimation));
+ DCmd_Register("actor_animation", WRAP_METHOD(Console, playActorAnimation));
+ DCmd_Register("call", WRAP_METHOD(Console, call));
}
bool Console::enableObject(int argc, const char **argv) {
@@ -97,13 +100,66 @@ bool Console::setMusic(int argc, const char **argv) {
DebugPrintf("usage: %s index(1-11)\n", argv[0]);
return true;
}
+
int index = atoi(argv[1]);
if (index <= 0 || index > 11) {
DebugPrintf("invalid value\n");
return true;
}
+
_engine->setMusic(index);
return true;
}
+bool Console::playAnimation(int argc, const char **argv) {
+ if (argc < 3) {
+ DebugPrintf("usage: %s id slot(0-3)\n", argv[0]);
+ return true;
+ }
+
+ int id = atoi(argv[1]);
+ int slot = atoi(argv[2]);
+ if (id < 0 || slot < 0 || slot > 3) {
+ DebugPrintf("invalid slot or animation id\n");
+ return true;
+ }
+
+ _engine->playAnimation(id, slot);
+ return true;
+}
+
+bool Console::playActorAnimation(int argc, const char **argv) {
+ if (argc < 2) {
+ DebugPrintf("usage: %s id\n", argv[0]);
+ return true;
+ }
+
+ int id = atoi(argv[1]);
+ if (id < 0) {
+ DebugPrintf("invalid animation id\n");
+ return true;
+ }
+
+ _engine->playActorAnimation(id);
+ return true;
+}
+
+bool Console::call(int argc, const char **argv) {
+ if (argc < 2) {
+ DebugPrintf("usage: %s 0xHEXADDR\n", argv[0]);
+ return true;
+ }
+
+ uint addr;
+ if (sscanf(argv[1], "0x%x", &addr) != 1) {
+ DebugPrintf("invalid address\n");
+ return true;
+ }
+
+ if (!_engine->processCallback(addr))
+ DebugPrintf("calling callback %04x failed\n", addr);
+
+ return true;
+}
+
}
diff --git a/engines/teenagent/console.h b/engines/teenagent/console.h
index ab2f068520..4dbdd3fc07 100644
--- a/engines/teenagent/console.h
+++ b/engines/teenagent/console.h
@@ -36,6 +36,9 @@ private:
bool enableObject(int argc, const char **argv);
bool setOns(int argc, const char **argv);
bool setMusic(int argc, const char **argv);
+ bool playAnimation(int argc, const char **argv);
+ bool playActorAnimation(int argc, const char **argv);
+ bool call(int argc, const char **argv);
TeenAgentEngine *_engine;
};
diff --git a/engines/teenagent/detection.cpp b/engines/teenagent/detection.cpp
index fa5a578636..dad876dd97 100644
--- a/engines/teenagent/detection.cpp
+++ b/engines/teenagent/detection.cpp
@@ -54,7 +54,7 @@ static const ADGameDescription teenAgentGameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
{
"teenagent",
@@ -74,13 +74,13 @@ static const ADGameDescription teenAgentGameDescriptions[] = {
Common::CZ_CZE,
Common::kPlatformPC,
ADGF_CD,
- Common::GUIO_NONE
+ GUIO0()
},
AD_TABLE_END_MARKER,
};
enum {
- MAX_SAVES = 20
+ MAX_SAVES = 20
};
class TeenAgentMetaEngine : public AdvancedMetaEngine {
diff --git a/engines/teenagent/inventory.cpp b/engines/teenagent/inventory.cpp
index 2b858bbb4d..59dd44baa3 100644
--- a/engines/teenagent/inventory.cpp
+++ b/engines/teenagent/inventory.cpp
@@ -286,10 +286,10 @@ void Inventory::Item::free() {
void Inventory::Item::backgroundEffect(Graphics::Surface *s) {
uint w = _rect.right - _rect.left, h = _rect.bottom - _rect.top;
byte *line = (byte *)s->getBasePtr(_rect.left, _rect.top);
- for(uint y = 0; y < h; ++y, line += s->pitch) {
+ for (uint y = 0; y < h; ++y, line += s->pitch) {
byte *dst = line;
- for(uint x = 0; x < w; ++x, ++dst) {
- *dst = (*dst == 232)? 214: 224;
+ for (uint x = 0; x < w; ++x, ++dst) {
+ *dst = (*dst == 232) ? 214 : 224;
}
}
}
diff --git a/engines/teenagent/music.cpp b/engines/teenagent/music.cpp
index 0f70f4b082..1f44e9cfcb 100644
--- a/engines/teenagent/music.cpp
+++ b/engines/teenagent/music.cpp
@@ -51,6 +51,7 @@ bool MusicPlayer::load(int id) {
stream->read(header, 4);
//check header?
+ Common::StackLock lock(_mutex);
// Load the samples
sampleCount = stream->readByte();
@@ -137,7 +138,7 @@ void MusicPlayer::interrupt() {
continue;
}
- setChannelData(chn, (const int8*)_samples[sample].data, NULL, _samples[sample].size, 0);
+ setChannelData(chn, (const int8 *)_samples[sample].data, NULL, _samples[sample].size, 0);
setChannelPeriod(chn, noteToPeriod[((note >> 4) & 0x0F) - 1][(note & 0x0F)]);
}
}
diff --git a/engines/teenagent/music.h b/engines/teenagent/music.h
index bf36ac7057..22b4fa5e8e 100644
--- a/engines/teenagent/music.h
+++ b/engines/teenagent/music.h
@@ -40,7 +40,7 @@ public:
void start();
void stop();
-protected:
+private:
int _id;
struct Row {
diff --git a/engines/teenagent/objects.cpp b/engines/teenagent/objects.cpp
index 74e3a4944d..748f342d54 100644
--- a/engines/teenagent/objects.cpp
+++ b/engines/teenagent/objects.cpp
@@ -26,7 +26,7 @@
namespace TeenAgent {
-void Rect::load(byte * src) {
+void Rect::load(byte *src) {
_base = src;
Common::MemoryReadStream ins(src, 8);
left = ins.readUint16LE();
@@ -52,7 +52,7 @@ void Rect::render(Graphics::Surface *surface, uint8 color) const {
}
-void Object::load(byte * src) {
+void Object::load(byte *src) {
_base = src;
id = *src++;
@@ -85,10 +85,10 @@ void Object::setName(const Common::String &new_name) {
void Object::dump(int level) const {
debug(level, "object: %u %u [%u,%u,%u,%u], actor: [%u,%u,%u,%u], orientation: %u, name: %s", id, enabled,
- rect.left, rect.top, rect.right, rect.bottom,
- actor_rect.left, actor_rect.top, actor_rect.right, actor_rect.bottom,
- actor_orientation, name.c_str()
- );
+ rect.left, rect.top, rect.right, rect.bottom,
+ actor_rect.left, actor_rect.top, actor_rect.right, actor_rect.bottom,
+ actor_orientation, name.c_str()
+ );
}
Common::String Object::parse_description(const char *name) {
@@ -139,16 +139,16 @@ void UseHotspot::load(byte *src) {
void UseHotspot::dump(int level) const {
debug(level,
- "hotspot: inv_id: %02x, obj_id: %02x, orientation?: %02x, actor position: (%d,%d), callback: %04x",
- inventory_id, object_id, orientation, actor_x, actor_y, callback
- );
+ "hotspot: inv_id: %02x, obj_id: %02x, orientation?: %02x, actor position: (%d,%d), callback: %04x",
+ inventory_id, object_id, orientation, actor_x, actor_y, callback
+ );
}
void Walkbox::dump(int level) const {
debug(level, "walkbox %02x %02x [%d, %d, %d, %d] top: %u, right: %u, bottom: %u, left: %u",
- type, orientation,
- rect.left, rect.top, rect.right, rect.bottom,
- side_hint[0], side_hint[1], side_hint[2], side_hint[3]);
+ type, orientation,
+ rect.left, rect.top, rect.right, rect.bottom,
+ side_hint[0], side_hint[1], side_hint[2], side_hint[3]);
}
void Walkbox::load(byte *src) {
@@ -158,7 +158,7 @@ void Walkbox::load(byte *src) {
orientation = *src++;
rect.load(src);
src += 8;
- for(byte i = 0; i < 4; ++i)
+ for (byte i = 0; i < 4; ++i)
side_hint[i] = *src++;
}
diff --git a/engines/teenagent/objects.h b/engines/teenagent/objects.h
index d1e4388a15..555287fc56 100644
--- a/engines/teenagent/objects.h
+++ b/engines/teenagent/objects.h
@@ -74,7 +74,7 @@ struct Rect {
return x >= left && x <= right && y1 <= bottom && y2 >= top;
}
- inline bool contains(const Rect & rect) const {
+ inline bool contains(const Rect &rect) const {
return rect.left >= left && rect.right <= right && rect.top >= top && rect.bottom <= bottom;
}
@@ -120,7 +120,7 @@ struct Rect {
}
void side(Common::Point &p1, Common::Point &p2, int o, const Common::Point &nearest) const {
- switch(o) {
+ switch (o) {
case kActorLeft:
p1 = Common::Point(left, top);
p2 = Common::Point(left, bottom);
@@ -150,7 +150,7 @@ struct Rect {
}
protected:
- byte * _base;
+ byte *_base;
};
struct Object {
@@ -172,7 +172,7 @@ struct Object {
static Common::String parse_description(const char *name);
protected:
- byte * _base;
+ byte *_base;
};
struct InventoryObject {
@@ -184,7 +184,7 @@ struct InventoryObject {
void load(byte *addr);
protected:
- byte * _base;
+ byte *_base;
};
struct UseHotspot {
@@ -209,7 +209,7 @@ struct Walkbox {
void save() const;
protected:
- byte * _base;
+ byte *_base;
};
struct FadeType {
@@ -220,7 +220,7 @@ struct FadeType {
};
//\todo move it to util.h?
-template<typename T> inline T SIGN (T x) { return (x > 0)? 1: ((x < 0)? -1: 0); }
+template<typename T> inline T SIGN(T x) { return (x > 0) ? 1 : ((x < 0) ? -1 : 0); }
} // End of namespace TeenAgent
diff --git a/engines/teenagent/pack.cpp b/engines/teenagent/pack.cpp
index aada922f7d..5302e2eceb 100644
--- a/engines/teenagent/pack.cpp
+++ b/engines/teenagent/pack.cpp
@@ -179,7 +179,7 @@ bool MemoryPack::open(const Common::String &filename) {
uint32 MemoryPack::getSize(uint32 id) const {
--id;
- return id < chunks.size()? chunks[id].size: 0;
+ return id < chunks.size() ? chunks[id].size : 0;
}
uint32 MemoryPack::read(uint32 id, byte *dst, uint32 size) const {
diff --git a/engines/teenagent/pack.h b/engines/teenagent/pack.h
index 09168676e2..1d6c471554 100644
--- a/engines/teenagent/pack.h
+++ b/engines/teenagent/pack.h
@@ -85,8 +85,13 @@ class MemoryPack : public Pack {
byte *data;
uint32 size;
inline Chunk(): data(0), size(0) {}
- inline Chunk(const Chunk &c): data(c.data), size(c.size) { c.reset(); }
- inline Chunk& operator=(const Chunk &c) { data = c.data; size = c.size; c.reset(); return *this; }
+ inline Chunk(const Chunk &c) : data(c.data), size(c.size) { c.reset(); }
+ inline Chunk &operator=(const Chunk &c) {
+ data = c.data;
+ size = c.size;
+ c.reset();
+ return *this;
+ }
inline ~Chunk() { delete[] data; }
inline void reset() const {
Chunk *c = const_cast<Chunk *>(this);
diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp
index 39b77ea447..e8c2dec4fa 100644
--- a/engines/teenagent/scene.cpp
+++ b/engines/teenagent/scene.cpp
@@ -38,9 +38,9 @@
namespace TeenAgent {
Scene::Scene(TeenAgentEngine *engine, OSystem *system) : intro(false), _id(0), ons(0),
- orientation(kActorRight), actor_talking(false),
- message_timer(0), message_first_frame(0), message_last_frame(0), message_animation(NULL),
- current_event(SceneEvent::kNone), hide_actor(false), callback(0), callback_timer(0), _idle_timer(0) {
+ orientation(kActorRight), actor_talking(false),
+ message_timer(0), message_first_frame(0), message_last_frame(0), message_animation(NULL),
+ current_event(SceneEvent::kNone), hide_actor(false), callback(0), callback_timer(0), _idle_timer(0) {
_engine = engine;
_system = system;
@@ -100,13 +100,13 @@ bool Scene::findPath(Scene::Path &p, const Common::Point &src, const Common::Poi
p.push_back(dst);
Common::List<uint> boxes;
- for(uint i = 0; i < scene_walkboxes.size(); ++i) {
- const Walkbox & w = scene_walkboxes[i];
+ for (uint i = 0; i < scene_walkboxes.size(); ++i) {
+ const Walkbox &w = scene_walkboxes[i];
if (!w.rect.in(src) && !w.rect.in(dst))
boxes.push_back(i);
}
- for(Path::iterator i = p.begin(); i != p.end() && !boxes.empty(); ) {
+ for (Path::iterator i = p.begin(); i != p.end() && !boxes.empty();) {
Path::iterator next = i;
++next;
if (next == p.end())
@@ -116,8 +116,8 @@ bool Scene::findPath(Scene::Path &p, const Common::Point &src, const Common::Poi
debug(1, "%d,%d -> %d,%d", p1.x, p1.y, p2.x, p2.y);
Common::List<uint>::iterator wi;
- for(wi = boxes.begin(); wi != boxes.end(); ++wi) {
- const Walkbox & w = scene_walkboxes[*wi];
+ for (wi = boxes.begin(); wi != boxes.end(); ++wi) {
+ const Walkbox &w = scene_walkboxes[*wi];
int mask = w.rect.intersects_line(p1, p2);
if (mask == 0) {
continue;
@@ -279,7 +279,7 @@ void Scene::loadObjectData() {
byte *fade_table = res->dseg.ptr(res->dseg.get_word(0x663e + i * 2));
Common::Array<FadeType> &scene_fades = fades[i];
- while(READ_LE_UINT16(fade_table) != 0xffff) {
+ while (READ_LE_UINT16(fade_table) != 0xffff) {
FadeType fade;
fade.load(fade_table);
fade_table += 9;
@@ -402,14 +402,14 @@ void Scene::init(int id, const Common::Point &pos) {
Common::ScopedPtr<Common::SeekableReadStream> stream(res->on.getStream(id));
int sub_hack = 0;
if (id == 7) { //something patched in the captains room
- switch(res->dseg.get_byte(0xdbe6)) {
- case 2:
- break;
- case 1:
- sub_hack = 1;
- break;
- default:
- sub_hack = 2;
+ switch (res->dseg.get_byte(0xdbe6)) {
+ case 2:
+ break;
+ case 1:
+ sub_hack = 1;
+ break;
+ default:
+ sub_hack = 2;
}
}
on.load(*stream, SurfaceList::kTypeOn, sub_hack);
@@ -428,7 +428,7 @@ void Scene::init(int id, const Common::Point &pos) {
}
void Scene::playAnimation(byte idx, uint id, bool loop, bool paused, bool ignore) {
- debug(0, "playAnimation(%u, %u, loop:%s, paused:%s, ignore:%s)", idx, id, loop?"true":"false", paused?"true":"false", ignore?"true":"false");
+ debug(0, "playAnimation(%u, %u, loop:%s, paused:%s, ignore:%s)", idx, id, loop ? "true" : "false", paused ? "true" : "false", ignore ? "true" : "false");
assert(idx < 4);
Common::ScopedPtr<Common::SeekableReadStream> s(Resources::instance()->loadLan(id + 1));
if (!s)
@@ -441,7 +441,7 @@ void Scene::playAnimation(byte idx, uint id, bool loop, bool paused, bool ignore
}
void Scene::playActorAnimation(uint id, bool loop, bool ignore) {
- debug(0, "playActorAnimation(%u, loop:%s, ignore:%s)", id, loop?"true":"false", ignore?"true":"false");
+ debug(0, "playActorAnimation(%u, loop:%s, ignore:%s)", id, loop ? "true" : "false", ignore ? "true" : "false");
Common::ScopedPtr<Common::SeekableReadStream> s(Resources::instance()->loadLan(id + 1));
if (!s)
error("playing animation %u failed", id);
@@ -452,13 +452,13 @@ void Scene::playActorAnimation(uint id, bool loop, bool ignore) {
actor_animation.id = id;
}
-Animation * Scene::getAnimation(byte slot) {
+Animation *Scene::getAnimation(byte slot) {
assert(slot < 4);
return custom_animation + slot;
}
byte Scene::peekFlagEvent(uint16 addr) const {
- for(EventList::const_iterator i = events.reverse_begin(); i != events.end(); --i) {
+ for (EventList::const_iterator i = events.reverse_begin(); i != events.end(); --i) {
const SceneEvent &e = *i;
if (e.type == SceneEvent::kSetFlag && e.callback == addr)
return e.color;
@@ -497,7 +497,7 @@ bool Scene::processEvent(const Common::Event &event) {
return false;
case Common::EVENT_KEYDOWN:
- switch(event.kbd.keycode) {
+ switch (event.kbd.keycode) {
case Common::KEYCODE_ESCAPE:
case Common::KEYCODE_SPACE: {
if (intro && event.kbd.keycode == Common::KEYCODE_ESCAPE) {
@@ -535,7 +535,7 @@ bool Scene::processEvent(const Common::Event &event) {
uint feature = event.kbd.keycode - '1';
if (feature < DebugFeatures::kMax) {
debug_features.feature[feature] = !debug_features.feature[feature];
- debug(0, "switched feature %u %s", feature, debug_features.feature[feature] ? "on": "off");
+ debug(0, "switched feature %u %s", feature, debug_features.feature[feature] ? "on" : "off");
}
}
break;
@@ -557,10 +557,9 @@ struct ZOrderCmp {
int Scene::lookupZoom(uint y) const {
Resources *res = Resources::instance();
- for(byte *zoom_table = res->dseg.ptr(res->dseg.get_word(0x70f4 + (_id - 1) * 2));
- zoom_table[0] != 0xff && zoom_table[1] != 0xff;
- zoom_table += 2
- ) {
+ for (byte *zoom_table = res->dseg.ptr(res->dseg.get_word(0x70f4 + (_id - 1) * 2));
+ zoom_table[0] != 0xff && zoom_table[1] != 0xff;
+ zoom_table += 2) {
//debug(0, "%d %d->%d", y, zoom_table[0], zoom_table[1]);
if (y <= zoom_table[0]) {
//debug(0, "%d %d->%d", y, zoom_table[0], zoom_table[1]);
@@ -575,9 +574,9 @@ void Scene::paletteEffect(byte step) {
Resources *res = Resources::instance();
byte *src = res->dseg.ptr(0x6609);
byte *dst = palette + 3 * 0xf2;
- for(byte i = 0; i < 0xd; ++i) {
- for(byte c = 0; c < 3; ++c, ++src)
- *dst++ = *src > step? *src - step: 0;
+ for (byte i = 0; i < 0xd; ++i) {
+ for (byte c = 0; c < 3; ++c, ++src)
+ *dst++ = *src > step ? *src - step : 0;
}
}
@@ -586,7 +585,7 @@ byte Scene::findFade() const {
return 0;
const Common::Array<FadeType> &scene_fades = fades[_id - 1];
- for(uint i = 0; i < scene_fades.size(); ++i) {
+ for (uint i = 0; i < scene_fades.size(); ++i) {
const FadeType &fade = scene_fades[i];
if (fade.rect.in(position)) {
return fade.value;
@@ -599,8 +598,8 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
Resources *res = Resources::instance();
bool busy;
bool restart;
- uint32 game_delta = tick_game? 1: 0;
- uint32 mark_delta = tick_mark? 1: 0;
+ uint32 game_delta = tick_game ? 1 : 0;
+ uint32 mark_delta = tick_mark ? 1 : 0;
do {
restart = false;
@@ -616,7 +615,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
}
}
- switch(current_event.type) {
+ switch (current_event.type) {
case SceneEvent::kCredits: {
_system->fillScreen(0);
///\todo: optimize me
@@ -729,7 +728,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
Surface *mark = actor_animation.currentFrame(game_delta);
int horizon = position.y;
- for(z_order_it = z_order.begin(); z_order_it != z_order.end(); ++z_order_it) {
+ for (z_order_it = z_order.begin(); z_order_it != z_order.end(); ++z_order_it) {
Surface *s = *z_order_it;
if (s->y + s->h > horizon)
break;
@@ -770,16 +769,16 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
if (tick_mark) {
int speed_x = zoom / 32; //8 * zoom / 256
- int speed_y = (o == kActorDown || o == kActorUp? 2: 1) * zoom / 256;
+ int speed_y = (o == kActorDown || o == kActorUp ? 2 : 1) * zoom / 256;
if (speed_x == 0)
speed_x = 1;
if (speed_y == 0)
speed_y = 1;
- position.y += (ABS(dp.y) < speed_y? dp.y: SIGN(dp.y) * speed_y);
- position.x += (o == kActorDown || o == kActorUp)?
- (ABS(dp.x) < speed_y? dp.x: SIGN(dp.x) * speed_y):
- (ABS(dp.x) < speed_x? dp.x: SIGN(dp.x) * speed_x);
+ position.y += (ABS(dp.y) < speed_y ? dp.y : SIGN(dp.y) * speed_y);
+ position.x += (o == kActorDown || o == kActorUp) ?
+ (ABS(dp.x) < speed_y ? dp.x : SIGN(dp.x) * speed_y) :
+ (ABS(dp.x) < speed_x ? dp.x : SIGN(dp.x) * speed_x);
}
_idle_timer = 0;
@@ -815,11 +814,11 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
//removed mark == null. In final scene of chapter 2 mark rendered above table.
//if it'd cause any bugs, add hack here. (_id != 23 && mark == NULL)
if (on_enabled &&
- debug_features.feature[DebugFeatures::kShowOn]) {
+ debug_features.feature[DebugFeatures::kShowOn]) {
on.render(surface, actor_animation_position);
}
- for(; z_order_it != z_order.end(); ++z_order_it) {
+ for (; z_order_it != z_order.end(); ++z_order_it) {
Surface *s = *z_order_it;
s->render(surface);
}
@@ -862,7 +861,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
}
Common::Point last_p = position;
- for(Path::const_iterator p = path.begin(); p != path.end(); ++p) {
+ for (Path::const_iterator p = path.begin(); p != path.end(); ++p) {
const Common::Point dp(p->x - last_p.x, p->y - last_p.y);
if (dp.x != 0) {
surface->hLine(last_p.x, last_p.y, p->x, 0xfe);
@@ -929,7 +928,7 @@ bool Scene::processEventQueue() {
ptr[on_id] = current_event.color;
} else {
on_enabled = current_event.color != 0;
- debug(0, "%s on rendering", on_enabled? "enabling": "disabling");
+ debug(0, "%s on rendering", on_enabled ? "enabling" : "disabling");
}
loadOns();
current_event.clear();
@@ -983,85 +982,85 @@ bool Scene::processEventQueue() {
case SceneEvent::kCreditsMessage:
case SceneEvent::kMessage: {
- message = current_event.message;
- message_animation = NULL;
- if (current_event.first_frame) {
- message_timer = 0;
- message_first_frame = current_event.first_frame;
- message_last_frame = current_event.last_frame;
- if (current_event.slot > 0) {
- message_animation = custom_animation + (current_event.slot - 1);
- //else if (!animation[current_event.slot].empty())
- // message_animation = animation + current_event.slot;
- } else
- message_animation = &actor_animation;
- debug(0, "async message %d-%d (slot %u)", message_first_frame, message_last_frame, current_event.slot);
- } else {
- message_timer = current_event.timer? current_event.timer * 110: messageDuration(message);
- message_first_frame = message_last_frame = 0;
- }
- Common::Point p;
- if (current_event.dst.x == 0 && current_event.dst.y == 0) {
- p = Common::Point((actor_animation_position.left + actor_animation_position.right) / 2,
- actor_animation_position.top);
- } else {
- p = current_event.dst;
- }
+ message = current_event.message;
+ message_animation = NULL;
+ if (current_event.first_frame) {
+ message_timer = 0;
+ message_first_frame = current_event.first_frame;
+ message_last_frame = current_event.last_frame;
+ if (current_event.slot > 0) {
+ message_animation = custom_animation + (current_event.slot - 1);
+ //else if (!animation[current_event.slot].empty())
+ // message_animation = animation + current_event.slot;
+ } else
+ message_animation = &actor_animation;
+ debug(0, "async message %d-%d (slot %u)", message_first_frame, message_last_frame, current_event.slot);
+ } else {
+ message_timer = current_event.timer ? current_event.timer * 110 : messageDuration(message);
+ message_first_frame = message_last_frame = 0;
+ }
+ Common::Point p;
+ if (current_event.dst.x == 0 && current_event.dst.y == 0) {
+ p = Common::Point((actor_animation_position.left + actor_animation_position.right) / 2,
+ actor_animation_position.top);
+ } else {
+ p = current_event.dst;
+ }
- byte message_slot = current_event.slot;
- if (message_slot != 0) {
- --message_slot;
- assert(message_slot < 4);
- const Surface *s = custom_animation[message_slot].currentFrame(0);
- if (s == NULL)
- s = animation[message_slot].currentFrame(0);
- if (s != NULL) {
- p.x = s->x + s->w / 2;
- p.y = s->y;
- } else
- warning("no animation in slot %u", message_slot);
- }
- message_pos = messagePosition(message, p);
- message_color = current_event.color;
+ byte message_slot = current_event.slot;
+ if (message_slot != 0) {
+ --message_slot;
+ assert(message_slot < 4);
+ const Surface *s = custom_animation[message_slot].currentFrame(0);
+ if (s == NULL)
+ s = animation[message_slot].currentFrame(0);
+ if (s != NULL) {
+ p.x = s->x + s->w / 2;
+ p.y = s->y;
+ } else
+ warning("no animation in slot %u", message_slot);
+ }
+ message_pos = messagePosition(message, p);
+ message_color = current_event.color;
- if (message_first_frame)
- current_event.clear(); //async message, clearing event
+ if (message_first_frame)
+ current_event.clear(); //async message, clearing event
}
break;
case SceneEvent::kPlayAnimation: {
- byte slot = current_event.slot & 7; //0 - mark's
- if (current_event.animation != 0) {
- debug(0, "playing animation %u in slot %u(%02x)", current_event.animation, slot, current_event.slot);
- if (slot != 0) {
- --slot;
- assert(slot < 4);
- playAnimation(slot, current_event.animation, (current_event.slot & 0x80) != 0, (current_event.slot & 0x40) != 0, (current_event.slot & 0x20) != 0);
- } else
- actor_talking = true;
- } else {
- if (slot != 0) {
- --slot;
- debug(0, "cancelling animation in slot %u", slot);
- assert(slot < 4);
- custom_animation[slot].free();
- } else
- actor_talking = true;
- }
- current_event.clear();
+ byte slot = current_event.slot & 7; //0 - mark's
+ if (current_event.animation != 0) {
+ debug(0, "playing animation %u in slot %u(%02x)", current_event.animation, slot, current_event.slot);
+ if (slot != 0) {
+ --slot;
+ assert(slot < 4);
+ playAnimation(slot, current_event.animation, (current_event.slot & 0x80) != 0, (current_event.slot & 0x40) != 0, (current_event.slot & 0x20) != 0);
+ } else
+ actor_talking = true;
+ } else {
+ if (slot != 0) {
+ --slot;
+ debug(0, "cancelling animation in slot %u", slot);
+ assert(slot < 4);
+ custom_animation[slot].free();
+ } else
+ actor_talking = true;
+ }
+ current_event.clear();
}
break;
case SceneEvent::kPauseAnimation: {
- byte slot = current_event.slot & 7; //0 - mark's
- if (slot != 0) {
- --slot;
- debug(1, "pause animation in slot %u", slot);
- custom_animation[slot].paused = (current_event.slot & 0x80) != 0;
- } else {
- actor_talking = false;
- }
- current_event.clear();
+ byte slot = current_event.slot & 7; //0 - mark's
+ if (slot != 0) {
+ --slot;
+ debug(1, "pause animation in slot %u", slot);
+ custom_animation[slot].paused = (current_event.slot & 0x80) != 0;
+ } else {
+ actor_talking = false;
+ }
+ current_event.clear();
}
break;
@@ -1097,8 +1096,8 @@ bool Scene::processEventQueue() {
obj->enabled = current_event.color;
obj->save();
current_event.clear();
- }
- break;
+ }
+ break;
case SceneEvent::kHideActor:
hide_actor = current_event.color != 0;
@@ -1141,7 +1140,7 @@ bool Scene::processEventQueue() {
break;
case SceneEvent::kFade:
- _fade_timer = current_event.orientation != 0? 5: -5;
+ _fade_timer = current_event.orientation != 0 ? 5 : -5;
current_event.clear();
break;
@@ -1177,9 +1176,9 @@ bool Scene::processEventQueue() {
void Scene::setPalette(unsigned mul) {
//debug(0, "setPalette(%u)", mul);
- byte p[3*256];
+ byte p[3 * 256];
- for (int i = 0; i < 3*256; ++i) {
+ for (int i = 0; i < 3 * 256; ++i) {
p[i] = (unsigned)palette[i] * mul;
}
@@ -1206,7 +1205,7 @@ Object *Scene::getObject(int id, int scene_id) {
Common::Point Scene::messagePosition(const Common::String &str, Common::Point message_position) {
Resources *res = Resources::instance();
int lines = 1;
- for(uint i = 0; i < str.size(); ++i)
+ for (uint i = 0; i < str.size(); ++i)
if (str[i] == '\n')
++lines;
@@ -1247,7 +1246,7 @@ void Scene::displayMessage(const Common::String &str, byte color, const Common::
//assert(!str.empty());
//debug(0, "displayMessage: %s", str.c_str());
message = str;
- message_pos = (pos.x | pos.y)? pos: messagePosition(str, position);
+ message_pos = (pos.x | pos.y) ? pos : messagePosition(str, position);
message_color = color;
message_timer = messageDuration(message);
}
@@ -1256,7 +1255,7 @@ void Scene::clear() {
clearMessage();
events.clear();
current_event.clear();
- for(int i = 0; i < 4; ++i) {
+ for (int i = 0; i < 4; ++i) {
animation[i].free();
custom_animation[i].free();
}
diff --git a/engines/teenagent/scene.h b/engines/teenagent/scene.h
index bc101847fa..32e784bb60 100644
--- a/engines/teenagent/scene.h
+++ b/engines/teenagent/scene.h
@@ -43,30 +43,30 @@ class Dialog;
struct SceneEvent {
enum Type {
- kNone, //0
- kMessage,
- kWalk,
- kPlayAnimation,
- kPlayActorAnimation, //4
- kPauseAnimation,
- kClearAnimations,
- kLoadScene,
- kSetOn, //8
- kSetLan,
- kPlayMusic,
- kPlaySound,
- kEnableObject, //12
- kHideActor,
- kWaitForAnimation,
- kWaitLanAnimationFrame,
- kCreditsMessage, //16
- kCredits,
- kTimer,
- kEffect,
- kFade,
- kWait,
- kSetFlag,
- kQuit
+ kNone, //0
+ kMessage,
+ kWalk,
+ kPlayAnimation,
+ kPlayActorAnimation, //4
+ kPauseAnimation,
+ kClearAnimations,
+ kLoadScene,
+ kSetOn, //8
+ kSetLan,
+ kPlayMusic,
+ kPlaySound,
+ kEnableObject, //12
+ kHideActor,
+ kWaitForAnimation,
+ kWaitLanAnimationFrame,
+ kCreditsMessage, //16
+ kCredits,
+ kTimer,
+ kEffect,
+ kFade,
+ kWait,
+ kSetFlag,
+ kQuit
} type;
Common::String message;
@@ -93,8 +93,8 @@ struct SceneEvent {
byte object;
SceneEvent(Type type_) :
- type(type_), message(), color(0xd1), slot(0), animation(0), timer(0), orientation(0), dst(),
- scene(0), ons(0), lan(0), music(0), sound(0), object(0) {}
+ type(type_), message(), color(0xd1), slot(0), animation(0), timer(0), orientation(0), dst(),
+ scene(0), ons(0), lan(0), music(0), sound(0), object(0) {}
void clear() {
type = kNone;
@@ -119,8 +119,8 @@ struct SceneEvent {
void dump() const {
debug(0, "event[%d]: \"%s\"[%02x], slot: %d, animation: %u, timer: %u, dst: (%d, %d) [%u], scene: %u, ons: %u, lan: %u, object: %u, music: %u, sound: %u",
- (int)type, message.c_str(), color, slot, animation, timer, dst.x, dst.y, orientation, scene, ons, lan, object, music, sound
- );
+ (int)type, message.c_str(), color, slot, animation, timer, dst.x, dst.y, orientation, scene, ons, lan, object, music, sound
+ );
}
};
@@ -144,7 +144,7 @@ public:
void setOrientation(uint8 o) { orientation = o; }
void push(const SceneEvent &event);
byte peekFlagEvent(uint16 addr) const;
- SceneEvent::Type last_event_type() const { return !events.empty()? events.back().type: SceneEvent::kNone; }
+ SceneEvent::Type last_event_type() const { return !events.empty() ? events.back().type : SceneEvent::kNone; }
bool processEvent(const Common::Event &event);
@@ -160,9 +160,9 @@ public:
Object *findObject(const Common::Point &point);
void loadObjectData();
- Animation * getAnimation(byte slot);
- inline Animation * getActorAnimation() { return &actor_animation; }
- inline const Common::String& getMessage() const { return message; }
+ Animation *getAnimation(byte slot);
+ inline Animation *getActorAnimation() { return &actor_animation; }
+ inline const Common::String &getMessage() const { return message; }
void setPalette(unsigned mul);
int lookupZoom(uint y) const;
@@ -219,7 +219,7 @@ private:
uint message_timer;
byte message_first_frame;
byte message_last_frame;
- Animation * message_animation;
+ Animation *message_animation;
typedef Common::List<SceneEvent> EventList;
EventList events;
@@ -240,17 +240,17 @@ private:
struct DebugFeatures {
enum {
- kShowBack,
- kShowLan,
- kShowOns,
- kShowOn,
- kHidePath,
- kMax
+ kShowBack,
+ kShowLan,
+ kShowOns,
+ kShowOn,
+ kHidePath,
+ kMax
};
bool feature[kMax];
DebugFeatures() {
- for(uint i = 0; i < kMax; ++i) {
+ for (uint i = 0; i < kMax; ++i) {
feature[i] = true;
}
}
diff --git a/engines/teenagent/surface.cpp b/engines/teenagent/surface.cpp
index e8b5a8ad59..63312990ee 100644
--- a/engines/teenagent/surface.cpp
+++ b/engines/teenagent/surface.cpp
@@ -94,7 +94,7 @@ Common::Rect Surface::render(Graphics::Surface *surface, int dx, int dy, bool mi
for (int i = src_rect.top; i < src_rect.bottom; ++i) {
byte *dst = dst_base;
for (int j = src_rect.left; j < src_rect.right; ++j) {
- byte p = src[(mirror? w - j - 1: j)];
+ byte p = src[(mirror ? w - j - 1 : j)];
if (p != 0xff)
*dst++ = p;
else
@@ -105,10 +105,10 @@ Common::Rect Surface::render(Graphics::Surface *surface, int dx, int dy, bool mi
}
} else {
byte *dst = (byte *)surface->getBasePtr(dst_rect.left, dst_rect.top);
- for(int i = 0; i < dst_rect.height(); ++i) {
+ for (int i = 0; i < dst_rect.height(); ++i) {
for (int j = 0; j < dst_rect.width(); ++j) {
int px = j * 256 / zoom;
- const byte *src = (const byte *)getBasePtr(src_rect.left + (mirror? w - px - 1: px), src_rect.top + i * 256 / zoom);
+ const byte *src = (const byte *)getBasePtr(src_rect.left + (mirror ? w - px - 1 : px), src_rect.top + i * 256 / zoom);
byte p = *src;
if (p != 0xff)
dst[j] = p;
diff --git a/engines/teenagent/surface.h b/engines/teenagent/surface.h
index 64e45a7330..51368c6bee 100644
--- a/engines/teenagent/surface.h
+++ b/engines/teenagent/surface.h
@@ -26,12 +26,11 @@
#include "graphics/surface.h"
namespace Common {
- class SeekableReadStream;
+class SeekableReadStream;
}
namespace TeenAgent {
-class Pack;
class Surface : public Graphics::Surface {
public:
enum Type {kTypeOns, kTypeLan};
@@ -40,7 +39,7 @@ public:
Surface();
~Surface();
- void load(Common::SeekableReadStream&, Type type);
+ void load(Common::SeekableReadStream &, Type type);
Common::Rect render(Graphics::Surface *surface, int dx = 0, int dy = 0, bool mirror = false, Common::Rect src_rect = Common::Rect(), uint zoom = 256) const;
bool empty() const { return pixels == NULL; }
diff --git a/engines/teenagent/surface_list.cpp b/engines/teenagent/surface_list.cpp
index 7f7eb1dc38..31387ac3cb 100644
--- a/engines/teenagent/surface_list.cpp
+++ b/engines/teenagent/surface_list.cpp
@@ -61,8 +61,8 @@ void SurfaceList::free() {
surfaces_n = 0;
}
-void SurfaceList::render(Graphics::Surface *surface, const Common::Rect & clip) const {
- for(uint i = 0; i < surfaces_n; ++i) {
+void SurfaceList::render(Graphics::Surface *surface, const Common::Rect &clip) const {
+ for (uint i = 0; i < surfaces_n; ++i) {
const Surface &s = surfaces[i];
Common::Rect r(s.x, s.y, s.x + s.w, s.y + s.h);
if (r.bottom < clip.bottom || !clip.intersects(r))
diff --git a/engines/teenagent/surface_list.h b/engines/teenagent/surface_list.h
index fcb4fb25c5..2d7be0d52b 100644
--- a/engines/teenagent/surface_list.h
+++ b/engines/teenagent/surface_list.h
@@ -33,12 +33,12 @@ public:
SurfaceList();
~SurfaceList();
- void load(Common::SeekableReadStream&, Type type, int sub_hack = 0);
+ void load(Common::SeekableReadStream &, Type type, int sub_hack = 0);
void free();
- void render(Graphics::Surface *surface, const Common::Rect & clip) const;
+ void render(Graphics::Surface *surface, const Common::Rect &clip) const;
protected:
- Surface * surfaces;
+ Surface *surfaces;
uint surfaces_n;
};
diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp
index e6a248334c..fb228ef2fc 100644
--- a/engines/teenagent/teenagent.cpp
+++ b/engines/teenagent/teenagent.cpp
@@ -49,7 +49,7 @@ namespace TeenAgent {
TeenAgentEngine::TeenAgentEngine(OSystem *system, const ADGameDescription *gd)
: Engine(system), action(kActionNone), _gameDescription(gd),
- _rnd("teenagent") {
+ _rnd("teenagent") {
music = new MusicPlayer();
console = 0;
@@ -70,10 +70,8 @@ bool TeenAgentEngine::trySelectedObject() {
debug(0, "checking active object %u on %u", inv->id, dst_object->id);
//mouse time challenge hack:
- if (
- (res->dseg.get_byte(0) == 1 && inv->id == 49 && dst_object->id == 5) ||
- (res->dseg.get_byte(0) == 2 && inv->id == 29 && dst_object->id == 5)
- ) {
+ if ((res->dseg.get_byte(0) == 1 && inv->id == 49 && dst_object->id == 5) ||
+ (res->dseg.get_byte(0) == 2 && inv->id == 29 && dst_object->id == 5)) {
//putting rock into hole or superglue on rock
processCallback(0x8d57);
return true;
@@ -176,12 +174,12 @@ void TeenAgentEngine::init() {
_mark_delay = 80;
_game_delay = 110;
- Resources * res = Resources::instance();
+ Resources *res = Resources::instance();
use_hotspots.resize(42);
byte *scene_hotspots = res->dseg.ptr(0xbb87);
for (byte i = 0; i < 42; ++i) {
Common::Array<UseHotspot> & hotspots = use_hotspots[i];
- byte * hotspots_ptr = res->dseg.ptr(READ_LE_UINT16(scene_hotspots + i * 2));
+ byte *hotspots_ptr = res->dseg.ptr(READ_LE_UINT16(scene_hotspots + i * 2));
while (*hotspots_ptr) {
UseHotspot h;
h.load(hotspots_ptr);
@@ -206,8 +204,7 @@ void TeenAgentEngine::deinit() {
Common::Error TeenAgentEngine::loadGameState(int slot) {
debug(0, "loading from slot %d", slot);
- Common::ScopedPtr<Common::InSaveFile>
- in(_saveFileMan->openForLoading(Common::String::format("teenagent.%02d", slot)));
+ Common::ScopedPtr<Common::InSaveFile> in(_saveFileMan->openForLoading(Common::String::format("teenagent.%02d", slot)));
if (!in)
in.reset(_saveFileMan->openForLoading(Common::String::format("teenagent.%d", slot)));
@@ -275,7 +272,7 @@ int TeenAgentEngine::skipEvents() const {
Common::EventManager *_event = _system->getEventManager();
Common::Event event;
while (_event->pollEvent(event)) {
- switch(event.type) {
+ switch (event.type) {
case Common::EVENT_QUIT:
case Common::EVENT_RTL:
return -1;
@@ -284,8 +281,8 @@ int TeenAgentEngine::skipEvents() const {
case Common::EVENT_RBUTTONDOWN:
return 1;
case Common::EVENT_KEYDOWN:
- if (event.kbd.ascii)
- return 1;
+ if (event.kbd.ascii)
+ return 1;
default:
break;
}
@@ -324,10 +321,10 @@ bool TeenAgentEngine::showCDLogo() {
free(bg);
free(palette);
- for(uint i = 0; i < 20; ++i) {
+ for (uint i = 0; i < 20; ++i) {
int r = skipEvents();
if (r != 0)
- return r > 0? true: false;
+ return r > 0 ? true : false;
_system->delayMillis(100);
}
cdlogo.close();
@@ -368,13 +365,13 @@ bool TeenAgentEngine::showLogo() {
free(palette);
uint n = logo.fileCount();
- for(uint f = 0; f < 4; ++f)
- for(uint i = 2; i <= n; ++i) {
+ for (uint f = 0; f < 4; ++f)
+ for (uint i = 2; i <= n; ++i) {
{
int r = skipEvents();
if (r != 0) {
free(bg);
- return r > 0? true: false;
+ return r > 0 ? true : false;
}
}
_system->copyRectToScreen(bg, 320, 0, 0, 320, 200);
@@ -448,14 +445,14 @@ bool TeenAgentEngine::showMetropolis() {
memset(colors, 0, colorsSize);
int logo_y = -56;
- for(uint f = 0; f < 300; ++f) {
+ for (uint f = 0; f < 300; ++f) {
{
int r = skipEvents();
if (r != 0) {
free(varia_6);
free(varia_9);
free(colors);
- return r > 0? true: false;
+ return r > 0 ? true : false;
}
}
@@ -467,19 +464,19 @@ bool TeenAgentEngine::showMetropolis() {
{
//generate colors matrix
memmove(colors + 320, colors + 480, 8480);
- for(uint c = 0; c < 17; ++c) {
+ for (uint c = 0; c < 17; ++c) {
byte x = (_rnd.getRandomNumber(184) + 5) & 0xff;
uint offset = 8800 + _rnd.getRandomNumber(158);
colors[offset++] = x;
colors[offset++] = x;
}
- for(uint y = 1; y < 56; ++y) {
- for(uint x = 1; x < 160; ++x) {
+ for (uint y = 1; y < 56; ++y) {
+ for (uint x = 1; x < 160; ++x) {
uint offset = y * 160 + x;
uint v =
- (uint)colors[offset - 161] + colors[offset - 160] + colors[offset - 159] +
- (uint)colors[offset - 1] + colors[offset + 1] +
- (uint)colors[offset + 161] + colors[offset + 160] + colors[offset + 159];
+ (uint)colors[offset - 161] + colors[offset - 160] + colors[offset - 159] +
+ (uint)colors[offset - 1] + colors[offset + 1] +
+ (uint)colors[offset + 161] + colors[offset + 160] + colors[offset + 159];
v >>= 3;
colors[offset + 8960] = v;
}
@@ -489,8 +486,8 @@ bool TeenAgentEngine::showMetropolis() {
byte *dst = (byte *)surface->getBasePtr(0, 131);
byte *src = varia_6;
- for(uint y = 0; y < 68; ++y) {
- for(uint x = 0; x < 320; ++x) {
+ for (uint y = 0; y < 68; ++y) {
+ for (uint x = 0; x < 320; ++x) {
if (*src++ == 1) {
*dst++ = colors[19 * 160 + y / 2 * 160 + x / 2];
} else
@@ -500,9 +497,9 @@ bool TeenAgentEngine::showMetropolis() {
_system->unlockScreen();
_system->copyRectToScreen(
- varia_9 + (logo_y < 0? -logo_y * 320: 0), 320,
- 0, logo_y >= 0? logo_y: 0,
- 320, logo_y >= 0? 57: 57 + logo_y);
+ varia_9 + (logo_y < 0 ? -logo_y * 320 : 0), 320,
+ 0, logo_y >= 0 ? logo_y : 0,
+ 320, logo_y >= 0 ? 57 : 57 + logo_y);
if (logo_y < 82 - 57)
++logo_y;
@@ -582,12 +579,12 @@ Common::Error TeenAgentEngine::run() {
switch (event.type) {
case Common::EVENT_KEYDOWN:
if ((event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_d) ||
- event.kbd.ascii == '~' || event.kbd.ascii == '#') {
+ event.kbd.ascii == '~' || event.kbd.ascii == '#') {
console->attach();
} else if (event.kbd.hasFlags(0) && event.kbd.keycode == Common::KEYCODE_F5) {
openMainMenuDialog();
} if (event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_f) {
- _mark_delay = _mark_delay == 80? 40: 80;
+ _mark_delay = _mark_delay == 80 ? 40 : 80;
debug(0, "mark_delay = %u", _mark_delay);
}
break;
@@ -679,7 +676,7 @@ Common::Error TeenAgentEngine::run() {
}
}
- inventory->render(surface, tick_game? 1: 0);
+ inventory->render(surface, tick_game ? 1 : 0);
_system->unlockScreen();
@@ -689,7 +686,7 @@ Common::Error TeenAgentEngine::run() {
uint32 next_tick = MIN(game_timer, mark_timer);
if (next_tick > 0) {
- _system->delayMillis(next_tick > 40? 40: next_tick);
+ _system->delayMillis(next_tick > 40 ? 40 : next_tick);
}
} while (!shouldQuit());
@@ -801,7 +798,7 @@ void TeenAgentEngine::displayCredits() {
event.dst.y = 200;
int lines = 1;
- for(uint i = 0; i < event.message.size(); ++i)
+ for (uint i = 0; i < event.message.size(); ++i)
if (event.message[i] == '\n')
++lines;
event.dst.x = (320 - Resources::instance()->font7.render(NULL, 0, 0, event.message, 0xd1)) / 2;
@@ -854,7 +851,7 @@ void TeenAgentEngine::moveRel(int16 x, int16 y, byte o, bool warp) {
void TeenAgentEngine::playAnimation(uint16 id, byte slot, bool async, bool ignore, bool loop) {
SceneEvent event(SceneEvent::kPlayAnimation);
event.animation = id;
- event.slot = (slot + 1) | (ignore? 0x20: 0) | (loop? 0x80: 0);
+ event.slot = (slot + 1) | (ignore ? 0x20 : 0) | (loop ? 0x80 : 0);
scene->push(event);
if (!async)
waitAnimation();
@@ -863,7 +860,7 @@ void TeenAgentEngine::playAnimation(uint16 id, byte slot, bool async, bool ignor
void TeenAgentEngine::playActorAnimation(uint16 id, bool async, bool ignore) {
SceneEvent event(SceneEvent::kPlayActorAnimation);
event.animation = id;
- event.slot = ignore? 0x20: 0;
+ event.slot = ignore ? 0x20 : 0;
scene->push(event);
if (!async)
waitAnimation();
@@ -890,7 +887,7 @@ void TeenAgentEngine::loadScene(byte id, uint16 x, uint16 y, byte o) {
void TeenAgentEngine::enableOn(bool enable) {
SceneEvent event(SceneEvent::kSetOn);
event.ons = 0;
- event.color = enable? 1: 0;
+ event.color = enable ? 1 : 0;
scene->push(event);
}
diff --git a/engines/teenagent/teenagent.h b/engines/teenagent/teenagent.h
index a054f72d25..737f07ba85 100644
--- a/engines/teenagent/teenagent.h
+++ b/engines/teenagent/teenagent.h
@@ -122,7 +122,7 @@ public:
Scene *scene;
Inventory *inventory;
MusicPlayer *music;
- Console * console;
+ Console *console;
void setMusic(byte id);
diff --git a/engines/testbed/detection.cpp b/engines/testbed/detection.cpp
index b869bb8ebb..02a9dfcb87 100644
--- a/engines/testbed/detection.cpp
+++ b/engines/testbed/detection.cpp
@@ -40,7 +40,7 @@ static const ADGameDescription testbedDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- Common::GUIO_NONE
+ GUIO0()
},
AD_TABLE_END_MARKER
};
diff --git a/engines/tinsel/actors.cpp b/engines/tinsel/actors.cpp
index 4e9847f8b4..acacd89667 100644
--- a/engines/tinsel/actors.cpp
+++ b/engines/tinsel/actors.cpp
@@ -314,10 +314,19 @@ static void ActorRestoredProcess(CORO_PARAM, const void *param) {
// get the stuff copied to process when it was created
const RATP_INIT *r = (const RATP_INIT *)param;
+ bool isSavegame = r->pic->resumeState == RES_SAVEGAME;
CORO_BEGIN_CODE(_ctx);
_ctx->pic = RestoreInterpretContext(r->pic);
+
+ // The newly added check here specially sets the process to RES_NOT when loading a savegame.
+ // This is needed particularly for the Psychiatrist scene in Discworld 1 - otherwise Rincewind
+ // can't go upstairs without leaving the building and returning. If this patch causes problems
+ // in other scenes, an added check for the hCode == 1174490602 could be added.
+ if (isSavegame && TinselV1)
+ _ctx->pic->resumeState = RES_NOT;
+
CORO_INVOKE_1(Interpret, _ctx->pic);
// If it gets here, actor's code has run to completion
@@ -326,8 +335,10 @@ static void ActorRestoredProcess(CORO_PARAM, const void *param) {
CORO_END_CODE;
}
-void RestoreActorProcess(int id, INT_CONTEXT *pic) {
+void RestoreActorProcess(int id, INT_CONTEXT *pic, bool savegameFlag) {
RATP_INIT r = { pic, id };
+ if (savegameFlag)
+ pic->resumeState = RES_SAVEGAME;
g_scheduler->createProcess(PID_TCODE, ActorRestoredProcess, &r, sizeof(r));
}
diff --git a/engines/tinsel/actors.h b/engines/tinsel/actors.h
index e707db77ba..6ebe32505a 100644
--- a/engines/tinsel/actors.h
+++ b/engines/tinsel/actors.h
@@ -156,7 +156,7 @@ struct Z_POSITIONS {
int z;
};
-void RestoreActorProcess(int id, INT_CONTEXT *pic);
+void RestoreActorProcess(int id, INT_CONTEXT *pic, bool savegameFlag);
int SaveActors(PSAVED_ACTOR sActorInfo);
void RestoreActors(int numActors, PSAVED_ACTOR sActorInfo);
diff --git a/engines/tinsel/config.cpp b/engines/tinsel/config.cpp
index fd278db972..050573028a 100644
--- a/engines/tinsel/config.cpp
+++ b/engines/tinsel/config.cpp
@@ -76,6 +76,9 @@ void Config::writeToDisk() {
case TXT_ITALIAN:
lang = Common::IT_ITA;
break;
+ case TXT_US:
+ lang = Common::EN_USA;
+ break;
default:
lang = Common::EN_ANY;
}
@@ -132,6 +135,9 @@ void Config::readFromDisk() {
case Common::IT_ITA:
_language = TXT_ITALIAN;
break;
+ case Common::EN_USA:
+ _language = TXT_US;
+ break;
default:
_language = TXT_ENGLISH;
}
diff --git a/engines/tinsel/detection_tables.h b/engines/tinsel/detection_tables.h
index bea0938fad..be44b1c462 100644
--- a/engines/tinsel/detection_tables.h
+++ b/engines/tinsel/detection_tables.h
@@ -22,11 +22,6 @@
namespace Tinsel {
-using Common::GUIO_NONE;
-using Common::GUIO_NOSPEECH;
-using Common::GUIO_NOSFX;
-using Common::GUIO_NOMUSIC;
-
static const TinselGameDescription gameDescriptions[] = {
// Note: The following is the (hopefully) definitive list of version details:
@@ -48,7 +43,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- GUIO_NOSPEECH | GUIO_NOSFX | GUIO_NOMUSIC
+ GUIO3(GUIO_NOSPEECH, GUIO_NOSFX, GUIO_NOMUSIC)
},
GID_DW1,
0,
@@ -67,7 +62,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- GUIO_NONE
+ GUIO0()
},
GID_DW1,
0,
@@ -87,7 +82,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_DEMO,
- GUIO_NONE
+ GUIO0()
},
GID_DW1,
0,
@@ -111,7 +106,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_DW1,
0,
@@ -134,7 +129,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_DW1,
0,
@@ -157,7 +152,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_DW1,
0,
@@ -180,7 +175,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_DROPLANGUAGE,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_DW1,
0,
@@ -196,7 +191,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NOSPEECH
+ GUIO1(GUIO_NOSPEECH)
},
GID_DW1,
0,
@@ -215,7 +210,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_DW1,
0,
@@ -237,7 +232,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_DW1,
0,
@@ -262,7 +257,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_DW1,
0,
@@ -286,7 +281,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_DW1,
0,
@@ -309,7 +304,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_DW1,
0,
@@ -332,7 +327,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_DROPLANGUAGE | ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_DW1,
0,
@@ -352,7 +347,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_DW1,
0,
@@ -372,7 +367,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::HE_ISR,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_DW1,
0,
@@ -391,7 +386,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPSX,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_DW1,
0,
@@ -414,7 +409,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPSX,
ADGF_DEMO,
- GUIO_NONE
+ GUIO0()
},
GID_DW1,
0,
@@ -435,7 +430,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_DW1,
0,
@@ -457,7 +452,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformMacintosh,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_DW1,
0,
@@ -476,7 +471,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO0()
},
GID_DW1,
0,
@@ -497,7 +492,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::RU_RUS,
Common::kPlatformPC,
ADGF_CD,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GID_DW1,
0,
@@ -517,7 +512,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GID_DW2,
0,
@@ -537,7 +532,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::EN_GRB,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GID_DW2,
0,
@@ -557,7 +552,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::EN_USA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GID_DW2,
0,
@@ -577,7 +572,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GID_DW2,
0,
@@ -597,7 +592,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GID_DW2,
0,
@@ -618,7 +613,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GID_DW2,
0,
@@ -638,7 +633,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GID_DW2,
0,
@@ -659,7 +654,7 @@ static const TinselGameDescription gameDescriptions[] = {
Common::RU_RUS,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO1(GUIO_NOASPECT)
},
GID_DW2,
0,
diff --git a/engines/tinsel/graphics.cpp b/engines/tinsel/graphics.cpp
index 6a5d626de8..545310185c 100644
--- a/engines/tinsel/graphics.cpp
+++ b/engines/tinsel/graphics.cpp
@@ -478,9 +478,9 @@ static void t2WrtNonZero(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool apply
// Non-transparent run length
color += pObj->constant;
if (horizFlipped)
- Common::set_to(tempP - runLength + 1, tempP + 1, color);
+ Common::fill(tempP - runLength + 1, tempP + 1, color);
else
- Common::set_to(tempP, tempP + runLength, color);
+ Common::fill(tempP, tempP + runLength, color);
}
}
@@ -533,7 +533,7 @@ static void WrtConst(DRAWOBJECT *pObj, uint8 *destP, bool applyClipping) {
// Loop through any remaining lines
while (pObj->height > 0) {
- Common::set_to(destP, destP + pObj->width, pObj->constant);
+ Common::fill(destP, destP + pObj->width, pObj->constant);
--pObj->height;
destP += SCREEN_WIDTH;
diff --git a/engines/tinsel/music.cpp b/engines/tinsel/music.cpp
index d6478f5cae..f552c49491 100644
--- a/engines/tinsel/music.cpp
+++ b/engines/tinsel/music.cpp
@@ -485,6 +485,7 @@ PCMMusicPlayer::PCMMusicPlayer() {
PCMMusicPlayer::~PCMMusicPlayer() {
_vm->_mixer->stopHandle(_handle);
+ delete _curChunk;
}
void PCMMusicPlayer::startPlay(int id) {
diff --git a/engines/tinsel/pcode.cpp b/engines/tinsel/pcode.cpp
index ae4c0d3ce1..2ab1e653d4 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_NOT;
+ ic->resumeState = RES_1;
LockCode(ic);
diff --git a/engines/tinsel/pcode.h b/engines/tinsel/pcode.h
index 971a42d7bd..5d16dae432 100644
--- a/engines/tinsel/pcode.h
+++ b/engines/tinsel/pcode.h
@@ -37,7 +37,7 @@ namespace Tinsel {
struct INV_OBJECT;
enum RESUME_STATE {
- RES_NOT, RES_1, RES_2
+ RES_NOT, RES_1, RES_2, RES_SAVEGAME
};
enum {
diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp
index 4ac172be43..a0801d8247 100644
--- a/engines/tinsel/saveload.cpp
+++ b/engines/tinsel/saveload.cpp
@@ -84,6 +84,8 @@ extern void syncPolyInfo(Common::Serializer &s);
extern int sceneCtr;
+extern bool ASceneIsSaved;
+
//----------------- LOCAL DEFINES --------------------
struct SaveGameHeader {
@@ -438,6 +440,11 @@ static void DoSync(Common::Serializer &s) {
SAVED_DATA *sdPtr = SaveSceneSsData;
for (int i = 0; i < *SaveSceneSsCount; ++i, ++sdPtr)
syncSavedData(s, *sdPtr);
+
+ // Flag that there is a saved scene to return to. Note that in this context 'saved scene'
+ // is a stored scene to return to from another scene, such as from the Summoning Book close-up
+ // in Discworld 1 to whatever scene Rincewind was in prior to that
+ ASceneIsSaved = true;
}
if (!TinselV2)
diff --git a/engines/tinsel/savescn.cpp b/engines/tinsel/savescn.cpp
index 89d68a611e..39a8033d45 100644
--- a/engines/tinsel/savescn.cpp
+++ b/engines/tinsel/savescn.cpp
@@ -83,7 +83,7 @@ extern SRSTATE SRstate;
// FIXME: Avoid non-const global vars
-static bool ASceneIsSaved = false;
+bool ASceneIsSaved = false;
static int savedSceneCount = 0;
@@ -281,7 +281,7 @@ void ResumeInterprets() {
if (TinselV2)
RestoreProcess(&rsd->SavedICInfo[i]);
else
- RestoreActorProcess(rsd->SavedICInfo[i].idActor, &rsd->SavedICInfo[i]);
+ RestoreActorProcess(rsd->SavedICInfo[i].idActor, &rsd->SavedICInfo[i], rsd == &sgData);
break;
case GS_POLYGON:
diff --git a/engines/toltecs/animation.cpp b/engines/toltecs/animation.cpp
new file mode 100644
index 0000000000..eef9cef9ed
--- /dev/null
+++ b/engines/toltecs/animation.cpp
@@ -0,0 +1,164 @@
+/* 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 "toltecs/toltecs.h"
+#include "toltecs/animation.h"
+#include "toltecs/palette.h"
+#include "toltecs/screen.h"
+
+namespace Toltecs {
+
+AnimationPlayer::AnimationPlayer(ToltecsEngine *vm) : _vm(vm) {
+ _animBuffer = new byte[262144];
+}
+
+AnimationPlayer::~AnimationPlayer() {
+ delete[] _animBuffer;
+}
+
+void AnimationPlayer::start(uint resIndex) {
+ debug(1, "AnimationPlayer::start(%d)", resIndex);
+
+ _resIndex = resIndex;
+
+ _vm->_arc->openResource(_resIndex);
+ _height = _vm->_arc->readUint16LE();
+ _width = _vm->_arc->readUint16LE();
+ _frameCount = _vm->_arc->readUint16LE();
+ _vm->_arc->read(_vm->_palette->getAnimPalette(), 768);
+ _curFrameSize = _vm->_arc->readUint32LE();
+ _nextFrameOffset = _curFrameSize + 782;
+ _vm->_arc->read(_animBuffer, _curFrameSize);
+ _nextFrameSize = _vm->_arc->readUint32LE();
+ _vm->_arc->closeResource();
+
+ debug(1, "AnimationPlayer::start() width = %d; height = %d; frameCount = %d", _width, _height, _frameCount);
+
+ _vm->_sceneWidth = _width;
+ _vm->_sceneHeight = _height;
+
+ unpackFrame();
+
+ _keepFrameCounter = 0;
+ _frameNumber = 0;
+ // TODO mov screenFlag01, 0FFFFh
+ // TODO mov animDrawFrameFlag, 0FFFFh
+
+ _firstNextFrameOffset = _nextFrameOffset;
+ _firstCurFrameSize = _curFrameSize;
+ _firstNextFrameSize = _nextFrameSize;
+
+}
+
+void AnimationPlayer::nextFrame() {
+ debug(1, "AnimationPlayer::nextFrame()");
+
+ if (_frameNumber == _frameCount) {
+ _nextFrameOffset = _firstNextFrameOffset;
+ _curFrameSize = _firstCurFrameSize;
+ _nextFrameSize = _firstNextFrameSize;
+ _frameNumber = 1;
+ } else {
+ _frameNumber++;
+ }
+
+ debug(1, "AnimationPlayer::nextFrame() frameNumber = %d", _frameNumber);
+
+ if (_keepFrameCounter > 0) {
+ _keepFrameCounter--;
+ return;
+ }
+
+ _vm->_arc->openResource(_resIndex);
+ _vm->_arc->seek(_nextFrameOffset, SEEK_CUR);
+ _curFrameSize = _nextFrameSize;
+
+ if (_curFrameSize == 0)
+ _curFrameSize = 1;
+
+ _vm->_arc->read(_animBuffer, _curFrameSize);
+ _nextFrameSize = _vm->_arc->readUint32LE();
+ _nextFrameOffset += _curFrameSize + 4;
+
+ if (_curFrameSize > 1) {
+ unpackFrame();
+ // TODO mov animDrawFrameFlag, 0FFFFh
+ } else {
+ _keepFrameCounter = _animBuffer[0] - 1;
+ // TODO mov animDrawFrameFlag, 0
+ }
+
+ _vm->_arc->closeResource();
+
+
+}
+
+int16 AnimationPlayer::getStatus() {
+ debug(1, "AnimationPlayer::getStatus()");
+ int16 status = -1;
+ if (_frameNumber == _frameCount)
+ status = 0;
+ else if (_frameNumber == _frameCount - 1)
+ status = 1;
+ debug(1, "AnimationPlayer::getStatus() status = %d", status);
+ return status;
+}
+
+void AnimationPlayer::unpackFrame() {
+ _vm->_screen->unpackRle(_animBuffer, _vm->_screen->_frontScreen, _width, _height);
+ _vm->_screen->unpackRle(_animBuffer, _vm->_screen->_backScreen, _width, _height);
+ _vm->_screen->_fullRefresh = true;
+}
+
+void AnimationPlayer::saveState(Common::WriteStream *out) {
+ out->writeUint16LE(_resIndex);
+ // NOTE: The original engine doesn't save width/height, but we do
+ out->writeUint16LE(_width);
+ out->writeUint16LE(_height);
+ out->writeUint16LE(_frameCount);
+ out->writeUint16LE(_frameNumber);
+ out->writeUint32LE(_keepFrameCounter);
+ out->writeUint32LE(_curFrameSize);
+ out->writeUint32LE(_nextFrameSize);
+ out->writeUint32LE(_nextFrameOffset);
+ out->writeUint32LE(_firstCurFrameSize);
+ out->writeUint32LE(_firstNextFrameSize);
+ out->writeUint32LE(_firstNextFrameOffset);
+}
+
+void AnimationPlayer::loadState(Common::ReadStream *in) {
+ _resIndex = in->readUint16LE();
+ _width = in->readUint16LE();
+ _height = in->readUint16LE();
+ _frameCount = in->readUint16LE();
+ _frameNumber = in->readUint16LE();
+ _keepFrameCounter = in->readUint32LE();
+ _curFrameSize = in->readUint32LE();
+ _nextFrameSize = in->readUint32LE();
+ _nextFrameOffset = in->readUint32LE();
+ _firstCurFrameSize = in->readUint32LE();
+ _firstNextFrameSize = in->readUint32LE();
+ _firstNextFrameOffset = in->readUint32LE();
+}
+
+} // End of namespace Toltecs
diff --git a/engines/m4/staticres.cpp b/engines/toltecs/animation.h
index 520c0ad58e..22576d7535 100644
--- a/engines/m4/staticres.cpp
+++ b/engines/toltecs/animation.h
@@ -18,44 +18,52 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
+ *
*/
-#include "m4/staticres.h"
+#ifndef TOLTECS_ANIMATION_H
+#define TOLTECS_ANIMATION_H
-namespace M4 {
+#include "toltecs/toltecs.h"
+#include "toltecs/resource.h"
-const char *englishMADSArticleList[9] = {
- NULL, "with", "to", "at", "from", "on", "in", "under", "behind"
-};
+namespace Toltecs {
-const char *cheatingEnabledDesc[3] = {
- "CHEATING ENABLED",
- "(For your convenience).",
- NULL
-};
+class AnimationPlayer {
+public:
+ AnimationPlayer(ToltecsEngine *vm);
+ ~AnimationPlayer();
+
+ void start(uint resIndex);
+ void nextFrame();
+ int16 getStatus();
+ uint16 getFrameNumber() const { return _frameNumber; }
+
+ void saveState(Common::WriteStream *out);
+ void loadState(Common::ReadStream *in);
+
+//protected:
+public:
+ ToltecsEngine *_vm;
+
+ // 262144
+ byte *_animBuffer;
+
+ uint16 _resIndex;
+
+ uint16 _width, _height;
+ uint16 _frameNumber, _frameCount;
+ uint32 _keepFrameCounter;
+
+ uint32 _curFrameSize;
+ uint32 _nextFrameSize, _nextFrameOffset;
+
+ uint32 _firstNextFrameOffset, _firstCurFrameSize, _firstNextFrameSize;
+
+ void unpackFrame();
-const char *atStr = "at";
-const char *lookAroundStr = "Look around";
-const char *toStr = "to ";
-const char *useStr = "Use ";
-const char *walkToStr = "Walk to ";
-const char *fenceStr = "fence";
-const char *overStr = "over";
-
-const char *GameReleaseInfoStr = "ScummVM rev: 8.43 14-Sept-92";
-const char *GameReleaseTitleStr = "GAME RELASE VERSION INFO";
-
-VerbInit verbList[10] = {
- {kVerbLook, 2, 0},
- {kVerbTake, 2, 0},
- {kVerbPush, 2, 0},
- {kVerbOpen, 2, 0},
- {kVerbPut, 1, -1},
- {kVerbTalkTo, 2, 0},
- {kVerbGive, 1, 2},
- {kVerbPull, 2, 0},
- {kVerbClose, 2, 0},
- {kVerbThrow, 1, 3}
};
-} // End of namespace M4
+} // End of namespace Toltecs
+
+#endif /* TOLTECS_ANIMATION_H */
diff --git a/engines/toltecs/detection.cpp b/engines/toltecs/detection.cpp
new file mode 100644
index 0000000000..c532bbbf09
--- /dev/null
+++ b/engines/toltecs/detection.cpp
@@ -0,0 +1,306 @@
+/* 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 "base/plugins.h"
+
+#include "engines/advancedDetector.h"
+#include "common/savefile.h"
+#include "common/str-array.h"
+#include "common/system.h"
+
+#include "toltecs/toltecs.h"
+
+
+namespace Toltecs {
+
+struct ToltecsGameDescription {
+ ADGameDescription desc;
+};
+
+uint32 ToltecsEngine::getFeatures() const {
+ return _gameDescription->desc.flags;
+}
+
+Common::Language ToltecsEngine::getLanguage() const {
+ return _gameDescription->desc.language;
+}
+
+}
+
+static const PlainGameDescriptor toltecsGames[] = {
+ {"toltecs", "3 Skulls of the Toltecs"},
+ {0, 0}
+};
+
+
+namespace Toltecs {
+
+static const ToltecsGameDescription gameDescriptions[] = {
+
+ {
+ // 3 Skulls of the Toltecs English version
+ {
+ "toltecs",
+ 0,
+ AD_ENTRY1s("WESTERN", "05472037e9cfde146e953c434e74f0f4", 337643527),
+ Common::EN_ANY,
+ Common::kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NONE)
+ },
+ },
+
+ {
+ // 3 Skulls of the Toltecs Russian version
+ {
+ "toltecs",
+ 0,
+ AD_ENTRY1s("WESTERN", "ba1742d3193b68ceb9434e2ab7a09a9b", 391462783),
+ Common::RU_RUS,
+ Common::kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NONE)
+ },
+ },
+
+ {
+ // 3 Skulls of the Toltecs German version
+ {
+ "toltecs",
+ 0,
+ AD_ENTRY1s("WESTERN", "1a3292bad8e0bb5701800c73531dd75e", 345176617),
+ Common::DE_DEU,
+ Common::kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NONE)
+ },
+ },
+
+ {
+ // 3 Skulls of the Toltecs German Demo version
+ {
+ "toltecs",
+ 0,
+ AD_ENTRY1s("WESTERN", "1c85e82712d24f1d5c1ea2a66ddd75c2", 47730038),
+ Common::DE_DEU,
+ Common::kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NONE)
+ },
+ },
+
+ {
+ // 3 Skulls of the Toltecs French version
+ {
+ "toltecs",
+ 0,
+ AD_ENTRY1s("WESTERN", "4fb845635cbdac732453fe23be350df9", 327269545),
+ Common::FR_FRA,
+ Common::kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NONE)
+ },
+ },
+
+ {
+ // 3 Skulls of the Toltecs Spanish version
+ {
+ "toltecs",
+ 0,
+ AD_ENTRY1s("WESTERN", "479f468beccc1b0ce5873ec523d1380e", 308391018),
+ Common::ES_ESP,
+ Common::kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NONE)
+ },
+ },
+
+ {
+ // 3 Skulls of the Toltecs Hungarian version
+ // From bug #3440641
+ {
+ "toltecs",
+ 0,
+ AD_ENTRY1s("WESTERN", "69a5572e75409d8c6230b787faa353af", 337647960),
+ Common::HU_HUN,
+ Common::kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NONE)
+ },
+ },
+
+ { AD_TABLE_END_MARKER }
+};
+
+} // End of namespace Toltecs
+
+class ToltecsMetaEngine : public AdvancedMetaEngine {
+public:
+ ToltecsMetaEngine() : AdvancedMetaEngine(Toltecs::gameDescriptions, sizeof(Toltecs::ToltecsGameDescription), toltecsGames) {
+ _singleid = "toltecs";
+ }
+
+ virtual const char *getName() const {
+ return "Toltecs Engine";
+ }
+
+ virtual const char *getOriginalCopyright() const {
+ return "Toltecs Engine Revistronic (C) 1996";
+ }
+
+ virtual bool hasFeature(MetaEngineFeature f) const;
+ virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
+ SaveStateList listSaves(const char *target) const;
+ virtual int getMaximumSaveSlot() const;
+ void removeSaveState(const char *target, int slot) const;
+ SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
+};
+
+bool ToltecsMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return
+ (f == kSupportsListSaves) ||
+ (f == kSupportsLoadingDuringStartup) ||
+ (f == kSupportsDeleteSave) ||
+ (f == kSavesSupportMetaInfo) ||
+ (f == kSavesSupportThumbnail) ||
+ (f == kSavesSupportCreationDate) ||
+ (f == kSavesSupportPlayTime);
+}
+
+bool Toltecs::ToltecsEngine::hasFeature(EngineFeature f) const {
+ return
+ (f == kSupportsRTL) ||
+ (f == kSupportsLoadingDuringRuntime) ||
+ (f == kSupportsSavingDuringRuntime);
+}
+
+bool ToltecsMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
+ const Toltecs::ToltecsGameDescription *gd = (const Toltecs::ToltecsGameDescription *)desc;
+ if (gd) {
+ *engine = new Toltecs::ToltecsEngine(syst, gd);
+ }
+ return gd != 0;
+}
+
+SaveStateList ToltecsMetaEngine::listSaves(const char *target) const {
+ Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
+ Toltecs::ToltecsEngine::SaveHeader header;
+ Common::String pattern = target;
+ pattern += ".???";
+
+ Common::StringArray filenames;
+ filenames = saveFileMan->listSavefiles(pattern.c_str());
+ Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
+
+ SaveStateList saveList;
+ for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); file++) {
+ // Obtain the last 3 digits of the filename, since they correspond to the save slot
+ int slotNum = atoi(file->c_str() + file->size() - 3);
+
+ if (slotNum >= 0 && slotNum <= 999) {
+ Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
+ if (in) {
+ if (Toltecs::ToltecsEngine::readSaveHeader(in, false, header) == Toltecs::ToltecsEngine::kRSHENoError) {
+ saveList.push_back(SaveStateDescriptor(slotNum, header.description));
+ }
+ delete in;
+ }
+ }
+ }
+
+ return saveList;
+}
+
+int ToltecsMetaEngine::getMaximumSaveSlot() const {
+ return 999;
+}
+
+void ToltecsMetaEngine::removeSaveState(const char *target, int slot) const {
+ Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
+ Common::String filename = Toltecs::ToltecsEngine::getSavegameFilename(target, slot);
+
+ saveFileMan->removeSavefile(filename.c_str());
+
+ Common::StringArray filenames;
+ Common::String pattern = target;
+ pattern += ".???";
+ filenames = saveFileMan->listSavefiles(pattern.c_str());
+ Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
+
+ for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
+ // Obtain the last 3 digits of the filename, since they correspond to the save slot
+ int slotNum = atoi(file->c_str() + file->size() - 3);
+
+ // Rename every slot greater than the deleted slot,
+ if (slotNum > slot) {
+ saveFileMan->renameSavefile(file->c_str(), filename.c_str());
+ filename = Toltecs::ToltecsEngine::getSavegameFilename(target, ++slot);
+ }
+ }
+}
+
+SaveStateDescriptor ToltecsMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
+ Common::String filename = Toltecs::ToltecsEngine::getSavegameFilename(target, slot);
+ Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename.c_str());
+
+ if (in) {
+ Toltecs::ToltecsEngine::SaveHeader header;
+ Toltecs::ToltecsEngine::kReadSaveHeaderError error;
+
+ error = Toltecs::ToltecsEngine::readSaveHeader(in, true, header);
+ delete in;
+
+ if (error == Toltecs::ToltecsEngine::kRSHENoError) {
+ SaveStateDescriptor desc(slot, header.description);
+
+ desc.setDeletableFlag(true);
+ desc.setWriteProtectedFlag(false);
+ desc.setThumbnail(header.thumbnail);
+
+ if (header.version > 0) {
+ int day = (header.saveDate >> 24) & 0xFF;
+ int month = (header.saveDate >> 16) & 0xFF;
+ int year = header.saveDate & 0xFFFF;
+
+ desc.setSaveDate(year, month, day);
+
+ int hour = (header.saveTime >> 16) & 0xFF;
+ int minutes = (header.saveTime >> 8) & 0xFF;
+
+ desc.setSaveTime(hour, minutes);
+
+ desc.setPlayTime(header.playTime * 1000);
+ }
+
+ return desc;
+ }
+ }
+
+ return SaveStateDescriptor();
+} // End of namespace Toltecs
+
+#if PLUGIN_ENABLED_DYNAMIC(TOLTECS)
+ REGISTER_PLUGIN_DYNAMIC(TOLTECS, PLUGIN_TYPE_ENGINE, ToltecsMetaEngine);
+#else
+ REGISTER_PLUGIN_STATIC(TOLTECS, PLUGIN_TYPE_ENGINE, ToltecsMetaEngine);
+#endif
diff --git a/engines/toltecs/menu.cpp b/engines/toltecs/menu.cpp
new file mode 100644
index 0000000000..00a0372e99
--- /dev/null
+++ b/engines/toltecs/menu.cpp
@@ -0,0 +1,613 @@
+/* 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/savefile.h"
+
+#include "toltecs/toltecs.h"
+#include "toltecs/menu.h"
+#include "toltecs/palette.h"
+#include "toltecs/render.h"
+#include "toltecs/resource.h"
+
+namespace Toltecs {
+
+MenuSystem::MenuSystem(ToltecsEngine *vm) : _vm(vm) {
+}
+
+MenuSystem::~MenuSystem() {
+}
+
+int MenuSystem::run() {
+
+ //debug("MenuSystem::run()");
+
+ _background = new Graphics::Surface();
+ _background->create(640, 400, Graphics::PixelFormat::createFormatCLUT8());
+
+ // Save original background
+ Graphics::Surface backgroundOrig;
+ backgroundOrig.create(640, 400, Graphics::PixelFormat::createFormatCLUT8());
+ memcpy(backgroundOrig.getBasePtr(0,0), _vm->_screen->_frontScreen, 640 * 400);
+
+ _currMenuID = kMenuIdNone;
+ _newMenuID = kMenuIdMain;
+ _currItemID = kItemIdNone;
+ _editingDescription = false;
+ _cfgText = true;
+ _cfgVoices = true;
+ _cfgMasterVolume = 10;
+ _cfgVoicesVolume = 10;
+ _cfgMusicVolume = 10;
+ _cfgSoundFXVolume = 10;
+ _cfgBackgroundVolume = 10;
+ _running = true;
+ _top = 30 - _vm->_guiHeight / 2;
+ _needRedraw = false;
+
+ // TODO: buildColorTransTable2
+ _vm->_palette->buildColorTransTable(0, 16, 7);
+
+ _vm->_screen->_renderQueue->clear();
+ // Draw the menu background and frame
+ _vm->_screen->blastSprite(0x140 + _vm->_cameraX, 0x175 + _vm->_cameraY, 0, 1, 0x4000);
+ shadeRect(60, 39, 520, 246, 30, 94);
+
+ memcpy(_background->pixels, _vm->_screen->_frontScreen, 640 * 400);
+
+ while (_running) {
+ update();
+ _vm->_system->updateScreen();
+ }
+
+ // Restore original background
+ memcpy(_vm->_screen->_frontScreen, backgroundOrig.getBasePtr(0,0), 640 * 400);
+ _vm->_system->copyRectToScreen((const byte *)_vm->_screen->_frontScreen, 640, 0, 0, 640, 400);
+ _vm->_system->updateScreen();
+
+ // Cleanup
+ backgroundOrig.free();
+ _background->free();
+ delete _background;
+
+ return 0;
+}
+
+void MenuSystem::update() {
+
+ if (_currMenuID != _newMenuID) {
+ _currMenuID = _newMenuID;
+ //debug("_currMenuID = %d", _currMenuID);
+ initMenu(_currMenuID);
+ }
+
+ handleEvents();
+
+ if (_needRedraw) {
+ //_vm->_system->copyRectToScreen((const byte *)_vm->_screen->_frontScreen + 39 * 640 + 60, 640, 60, 39, 520, 247);
+ _vm->_system->copyRectToScreen((const byte *)_vm->_screen->_frontScreen, 640, 0, 0, 640, 400);
+ //debug("redraw");
+ _needRedraw = false;
+ }
+
+ _vm->_system->delayMillis(5);
+
+}
+
+void MenuSystem::handleEvents() {
+
+ Common::Event event;
+ Common::EventManager *eventMan = _vm->_system->getEventManager();
+ while (eventMan->pollEvent(event)) {
+ switch (event.type) {
+ case Common::EVENT_KEYDOWN:
+ handleKeyDown(event.kbd);
+ break;
+ case Common::EVENT_QUIT:
+ _running = false;
+ break;
+ case Common::EVENT_MOUSEMOVE:
+ handleMouseMove(event.mouse.x, event.mouse.y);
+ break;
+ case Common::EVENT_LBUTTONDOWN:
+ handleMouseClick(event.mouse.x, event.mouse.y);
+ break;
+ default:
+ break;
+ }
+ }
+
+}
+
+void MenuSystem::addClickTextItem(ItemID id, int x, int y, int w, uint fontNum, const char *caption, byte defaultColor, byte activeColor) {
+ Item item;
+ item.id = id;
+ item.defaultColor = defaultColor;
+ item.activeColor = activeColor;
+ item.x = x;
+ item.y = y;
+ item.w = w;
+ item.fontNum = fontNum;
+ setItemCaption(&item, caption);
+ _items.push_back(item);
+}
+
+void MenuSystem::drawItem(ItemID itemID, bool active) {
+ Item *item = getItem(itemID);
+ if (item) {
+ byte color = active ? item->activeColor : item->defaultColor;
+ drawString(item->rect.left, item->y, 0, item->fontNum, color, item->caption.c_str());
+ }
+}
+
+void MenuSystem::handleMouseMove(int x, int y) {
+ if (!_editingDescription) {
+ ItemID newItemID = findItemAt(x, y);
+ if (_currItemID != newItemID) {
+ leaveItem(_currItemID);
+ _currItemID = newItemID;
+ enterItem(newItemID);
+ }
+ }
+}
+
+void MenuSystem::handleMouseClick(int x, int y) {
+ if (!_editingDescription) {
+ ItemID id = findItemAt(x, y);
+ clickItem(id);
+ }
+}
+
+void MenuSystem::handleKeyDown(const Common::KeyState& kbd) {
+ if (_editingDescription) {
+ if (kbd.keycode >= Common::KEYCODE_SPACE && kbd.keycode <= Common::KEYCODE_z) {
+ _editingDescriptionItem->caption += kbd.ascii;
+ restoreRect(_editingDescriptionItem->rect.left, _editingDescriptionItem->rect.top,
+ _editingDescriptionItem->rect.width() + 1, _editingDescriptionItem->rect.height() - 2);
+ setItemCaption(_editingDescriptionItem, _editingDescriptionItem->caption.c_str());
+ drawItem(_editingDescriptionID, true);
+ } else if (kbd.keycode == Common::KEYCODE_BACKSPACE) {
+ _editingDescriptionItem->caption.deleteLastChar();
+ restoreRect(_editingDescriptionItem->rect.left, _editingDescriptionItem->rect.top,
+ _editingDescriptionItem->rect.width() + 1, _editingDescriptionItem->rect.height() - 2);
+ setItemCaption(_editingDescriptionItem, _editingDescriptionItem->caption.c_str());
+ drawItem(_editingDescriptionID, true);
+ } else if (kbd.keycode == Common::KEYCODE_RETURN) {
+ SavegameItem *savegameItem = getSavegameItemByID(_editingDescriptionID);
+ _editingDescription = false;
+ _vm->requestSavegame(savegameItem->_slotNum, _editingDescriptionItem->caption);
+ _running = false;
+ } else if (kbd.keycode == Common::KEYCODE_ESCAPE) {
+ _editingDescription = false;
+ }
+ }
+}
+
+ItemID MenuSystem::findItemAt(int x, int y) {
+ for (Common::Array<Item>::iterator iter = _items.begin(); iter != _items.end(); iter++) {
+ if ((*iter).rect.contains(x, y))
+ return (*iter).id;
+ }
+ return kItemIdNone;
+}
+
+MenuSystem::Item *MenuSystem::getItem(ItemID id) {
+ for (Common::Array<Item>::iterator iter = _items.begin(); iter != _items.end(); iter++) {
+ if ((*iter).id == id)
+ return &(*iter);
+ }
+ return NULL;
+}
+
+void MenuSystem::setItemCaption(Item *item, const char *caption) {
+ Font font(_vm->_res->load(_vm->_screen->getFontResIndex(item->fontNum))->data);
+ int width = font.getTextWidth((const byte*)caption);
+ int height = font.getHeight();
+ item->rect = Common::Rect(item->x, item->y - height, item->x + width, item->y);
+ if (item->w) {
+ item->rect.translate(item->w - width / 2, 0);
+ }
+ item->caption = caption;
+}
+
+void MenuSystem::initMenu(MenuID menuID) {
+ int newSlotNum;
+
+ _items.clear();
+
+ memcpy(_vm->_screen->_frontScreen, _background->pixels, 640 * 400);
+
+ switch (menuID) {
+ case kMenuIdMain:
+ drawString(0, 74, 320, 1, 229, _vm->getSysString(kStrWhatCanIDoForYou));
+ addClickTextItem(kItemIdLoad, 0, 115, 320, 0, _vm->getSysString(kStrLoad), 229, 255);
+ addClickTextItem(kItemIdSave, 0, 135, 320, 0, _vm->getSysString(kStrSave), 229, 255);
+ addClickTextItem(kItemIdToggleText, 0, 165, 320, 0, _vm->getSysString(kStrTextOn), 229, 255);
+ addClickTextItem(kItemIdToggleVoices, 0, 185, 320, 0, _vm->getSysString(kStrVoicesOn), 229, 255);
+ addClickTextItem(kItemIdVolumesMenu, 0, 215, 320, 0, _vm->getSysString(kStrVolume), 229, 255);
+ addClickTextItem(kItemIdPlay, 0, 245, 320, 0, _vm->getSysString(kStrPlay), 229, 255);
+ addClickTextItem(kItemIdQuit, 0, 275, 320, 0, _vm->getSysString(kStrQuit), 229, 255);
+ break;
+ case kMenuIdLoad:
+ drawString(0, 74, 320, 1, 229, _vm->getSysString(kStrLoadGame));
+ addClickTextItem(kItemIdSavegameUp, 0, 155, 545, 1, "^", 255, 253);
+ addClickTextItem(kItemIdSavegameDown, 0, 195, 545, 1, "\\", 255, 253);
+ addClickTextItem(kItemIdCancel, 0, 275, 320, 0, _vm->getSysString(kStrCancel), 255, 253);
+ for (int i = 1; i <= 7; i++) {
+ Common::String saveDesc = Common::String::format("SAVEGAME %d", i);
+ addClickTextItem((ItemID)(kItemIdSavegame1 + i - 1), 0, 115 + 20 * (i - 1), 300, 0, saveDesc.c_str(), 231, 234);
+ }
+ loadSavegamesList();
+ setSavegameCaptions();
+ break;
+ case kMenuIdSave:
+ drawString(0, 74, 320, 1, 229, _vm->getSysString(kStrSaveGame));
+ addClickTextItem(kItemIdSavegameUp, 0, 155, 545, 1, "^", 255, 253);
+ addClickTextItem(kItemIdSavegameDown, 0, 195, 545, 1, "\\", 255, 253);
+ addClickTextItem(kItemIdCancel, 0, 275, 320, 0, _vm->getSysString(kStrCancel), 255, 253);
+ for (int i = 1; i <= 7; i++) {
+ Common::String saveDesc = Common::String::format("SAVEGAME %d", i);
+ addClickTextItem((ItemID)(kItemIdSavegame1 + i - 1), 0, 115 + 20 * (i - 1), 300, 0, saveDesc.c_str(), 231, 234);
+ }
+ newSlotNum = loadSavegamesList() + 1;
+ _savegames.push_back(SavegameItem(newSlotNum, Common::String::format("GAME %03d", _savegames.size() + 1)));
+ setSavegameCaptions();
+ break;
+ case kMenuIdVolumes:
+ drawString(0, 74, 320, 1, 229, _vm->getSysString(kStrAdjustVolume));
+ drawString(0, 130, 200, 0, 246, _vm->getSysString(kStrMaster));
+ drawString(0, 155, 200, 0, 244, _vm->getSysString(kStrVoices));
+ drawString(0, 180, 200, 0, 244, _vm->getSysString(kStrMusic));
+ drawString(0, 205, 200, 0, 244, _vm->getSysString(kStrSoundFx));
+ drawString(0, 230, 200, 0, 244, _vm->getSysString(kStrBackground));
+ addClickTextItem(kItemIdDone, 0, 275, 200, 0, _vm->getSysString(kStrDone), 229, 253);
+ addClickTextItem(kItemIdCancel, 0, 275, 440, 0, _vm->getSysString(kStrCancel), 229, 253);
+ addClickTextItem(kItemIdMasterDown, 0, 130 + 25 * 0, 348, 1, "[", 229, 253);
+ addClickTextItem(kItemIdVoicesDown, 0, 130 + 25 * 1, 348, 1, "[", 229, 253);
+ addClickTextItem(kItemIdMusicDown, 0, 130 + 25 * 2, 348, 1, "[", 229, 253);
+ addClickTextItem(kItemIdSoundFXDown, 0, 130 + 25 * 3, 348, 1, "[", 229, 253);
+ addClickTextItem(kItemIdBackgroundDown, 0, 130 + 25 * 4, 348, 1, "[", 229, 253);
+ addClickTextItem(kItemIdMasterUp, 0, 130 + 25 * 0, 372, 1, "]", 229, 253);
+ addClickTextItem(kItemIdVoicesUp, 0, 130 + 25 * 1, 372, 1, "]", 229, 253);
+ addClickTextItem(kItemIdMusicUp, 0, 130 + 25 * 2, 372, 1, "]", 229, 253);
+ addClickTextItem(kItemIdSoundFXUp, 0, 130 + 25 * 3, 372, 1, "]", 229, 253);
+ addClickTextItem(kItemIdBackgroundUp, 0, 130 + 25 * 4, 372, 1, "]", 229, 253);
+ drawVolumeBar(kItemIdMaster);
+ drawVolumeBar(kItemIdVoices);
+ drawVolumeBar(kItemIdMusic);
+ drawVolumeBar(kItemIdSoundFX);
+ drawVolumeBar(kItemIdBackground);
+ break;
+ default:
+ break;
+ }
+
+ for (Common::Array<Item>::iterator iter = _items.begin(); iter != _items.end(); iter++) {
+ drawItem((*iter).id, false);
+ }
+
+}
+
+void MenuSystem::enterItem(ItemID id) {
+ drawItem(id, true);
+}
+
+void MenuSystem::leaveItem(ItemID id) {
+ drawItem(id, false);
+}
+
+void MenuSystem::clickItem(ItemID id) {
+ //Item *item = getItem(id);
+ switch (id) {
+ // Main menu
+ case kItemIdSave:
+ _newMenuID = kMenuIdSave;
+ break;
+ case kItemIdLoad:
+ _newMenuID = kMenuIdLoad;
+ break;
+ case kItemIdToggleText:
+ setCfgText(!_cfgText, true);
+ if (!_cfgVoices && !_cfgText)
+ setCfgVoices(true, false);
+ break;
+ case kItemIdToggleVoices:
+ setCfgVoices(!_cfgVoices, true);
+ if (!_cfgVoices && !_cfgText)
+ setCfgText(true, false);
+ break;
+ case kItemIdVolumesMenu:
+ //debug("kItemIdVolumesMenu");
+ _newMenuID = kMenuIdVolumes;
+ break;
+ case kItemIdPlay:
+ //debug("kItemIdPlay");
+ _running = false;
+ break;
+ case kItemIdQuit:
+ _running = false;
+ _vm->quitGame();
+ break;
+ // Volumes menu
+ case kItemIdMasterUp:
+ changeVolumeBar(kItemIdMaster, +1);
+ break;
+ case kItemIdVoicesUp:
+ changeVolumeBar(kItemIdVoices, +1);
+ break;
+ case kItemIdMusicUp:
+ changeVolumeBar(kItemIdMusic, +1);
+ break;
+ case kItemIdSoundFXUp:
+ changeVolumeBar(kItemIdSoundFX, +1);
+ break;
+ case kItemIdBackgroundUp:
+ changeVolumeBar(kItemIdBackground, +1);
+ break;
+ case kItemIdMasterDown:
+ changeVolumeBar(kItemIdMaster, -1);
+ break;
+ case kItemIdVoicesDown:
+ changeVolumeBar(kItemIdVoices, -1);
+ break;
+ case kItemIdMusicDown:
+ changeVolumeBar(kItemIdMusic, -1);
+ break;
+ case kItemIdSoundFXDown:
+ changeVolumeBar(kItemIdSoundFX, -1);
+ break;
+ case kItemIdBackgroundDown:
+ changeVolumeBar(kItemIdBackground, -1);
+ break;
+ case kItemIdCancel:
+ _newMenuID = kMenuIdMain;
+ break;
+ // Save/Load menu
+ case kItemIdSavegame1:
+ case kItemIdSavegame2:
+ case kItemIdSavegame3:
+ case kItemIdSavegame4:
+ case kItemIdSavegame5:
+ case kItemIdSavegame6:
+ case kItemIdSavegame7:
+ clickSavegameItem(id);
+ break;
+ case kItemIdDone:
+ _newMenuID = kMenuIdMain;
+ break;
+ case kItemIdSavegameUp:
+ scrollSavegames(-6);
+ break;
+ case kItemIdSavegameDown:
+ scrollSavegames(+6);
+ break;
+ default:
+ break;
+ }
+}
+
+void MenuSystem::restoreRect(int x, int y, int w, int h) {
+ byte *src = (byte*)_background->getBasePtr(x, y);
+ byte *dst = _vm->_screen->_frontScreen + x + y * 640;
+ while (h--) {
+ memcpy(dst, src, w);
+ src += 640;
+ dst += 640;
+ }
+}
+
+void MenuSystem::shadeRect(int x, int y, int w, int h, byte color1, byte color2) {
+ byte *src = (byte*)_background->getBasePtr(x, y);
+ for (int xc = 0; xc < w; xc++) {
+ src[xc] = color2;
+ src[xc + h * 640] = color1;
+ }
+ src += 640;
+ w -= 1;
+ h -= 1;
+ while (h--) {
+ src[0] = color2;
+ src[w] = color1;
+ src += 640;
+ }
+}
+
+void MenuSystem::drawString(int16 x, int16 y, int w, uint fontNum, byte color, const char *text) {
+ fontNum = _vm->_screen->getFontResIndex(fontNum);
+ Font font(_vm->_res->load(fontNum)->data);
+ if (w) {
+ x = x + w - font.getTextWidth((const byte*)text) / 2;
+ }
+ _vm->_screen->drawString(x, y - font.getHeight(), color, fontNum, (const byte*)text, -1, NULL, true);
+ _needRedraw = true;
+}
+
+int MenuSystem::loadSavegamesList() {
+
+ int maxSlotNum = -1;
+
+ _savegameListTopIndex = 0;
+ _savegames.clear();
+
+ Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
+ Toltecs::ToltecsEngine::SaveHeader header;
+ Common::String pattern = _vm->getTargetName();
+ pattern += ".???";
+
+ Common::StringArray filenames;
+ filenames = saveFileMan->listSavefiles(pattern.c_str());
+ Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
+
+ for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); file++) {
+ // Obtain the last 3 digits of the filename, since they correspond to the save slot
+ int slotNum = atoi(file->c_str() + file->size() - 3);
+ if (slotNum > maxSlotNum)
+ maxSlotNum = slotNum;
+
+ if (slotNum >= 0 && slotNum <= 999) {
+ Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
+ if (in) {
+ if (Toltecs::ToltecsEngine::readSaveHeader(in, false, header) == Toltecs::ToltecsEngine::kRSHENoError) {
+ _savegames.push_back(SavegameItem(slotNum, header.description));
+ //debug("%s -> %s", file->c_str(), header.description.c_str());
+ }
+ delete in;
+ }
+ }
+ }
+
+ return maxSlotNum;
+}
+
+MenuSystem::SavegameItem *MenuSystem::getSavegameItemByID(ItemID id) {
+ if (id >= kItemIdSavegame1 && id <= kItemIdSavegame7)
+ return &_savegames[_savegameListTopIndex + id - kItemIdSavegame1];
+ else
+ return NULL;
+}
+
+void MenuSystem::setSavegameCaptions() {
+ uint index = _savegameListTopIndex;
+ for (int i = 1; i <= 7; i++)
+ setItemCaption(getItem((ItemID)(kItemIdSavegame1 + i - 1)), index < _savegames.size() ? _savegames[index++]._description.c_str() : "");
+}
+
+void MenuSystem::scrollSavegames(int delta) {
+ int newPos = CLIP<int>(_savegameListTopIndex + delta, 0, _savegames.size() - 1);
+ _savegameListTopIndex = newPos;
+ restoreRect(80, 92, 440, 140);
+ setSavegameCaptions();
+ for (int i = 1; i <= 7; i++)
+ drawItem((ItemID)(kItemIdSavegame1 + i - 1), false);
+}
+
+void MenuSystem::clickSavegameItem(ItemID id) {
+ if (_currMenuID == kMenuIdLoad) {
+ SavegameItem *savegameItem = getSavegameItemByID(id);
+ //debug("slotNum = [%d]; description = [%s]", savegameItem->_slotNum, savegameItem->_description.c_str());
+ //_vm->loadgame(savegameItem->_filename.c_str());
+ _vm->requestLoadgame(savegameItem->_slotNum);
+ _running = false;
+ } else {
+ _editingDescription = true;
+ _editingDescriptionItem = getItem(id);
+ _editingDescriptionID = id;
+ _editingDescriptionItem->activeColor = 249;
+ _editingDescriptionItem->defaultColor = 249;
+ drawItem(_editingDescriptionID, true);
+ }
+}
+
+void MenuSystem::setCfgText(bool value, bool active) {
+ if (_cfgText != value) {
+ Item *item = getItem(kItemIdToggleText);
+ _cfgText = value;
+ restoreRect(item->rect.left, item->rect.top, item->rect.width() + 1, item->rect.height() - 2);
+ setItemCaption(item, _vm->getSysString(_cfgText ? kStrTextOn : kStrTextOff));
+ drawItem(kItemIdToggleText, true);
+ }
+}
+
+void MenuSystem::setCfgVoices(bool value, bool active) {
+ if (_cfgVoices != value) {
+ Item *item = getItem(kItemIdToggleVoices);
+ _cfgVoices = value;
+ restoreRect(item->rect.left, item->rect.top, item->rect.width() + 1, item->rect.height() - 2);
+ setItemCaption(item, _vm->getSysString(_cfgVoices ? kStrVoicesOn : kStrVoicesOff));
+ drawItem(kItemIdToggleVoices, true);
+ }
+}
+
+void MenuSystem::drawVolumeBar(ItemID itemID) {
+ int w = 440, y, volume;
+ char text[21];
+
+ switch (itemID) {
+ case kItemIdMaster:
+ y = 130 + 25 * 0;
+ volume = _cfgMasterVolume;
+ break;
+ case kItemIdVoices:
+ y = 130 + 25 * 1;
+ volume = _cfgVoicesVolume;
+ break;
+ case kItemIdMusic:
+ y = 130 + 25 * 2;
+ volume = _cfgMusicVolume;
+ break;
+ case kItemIdSoundFX:
+ y = 130 + 25 * 3;
+ volume = _cfgSoundFXVolume;
+ break;
+ case kItemIdBackground:
+ y = 130 + 25 * 4;
+ volume = _cfgBackgroundVolume;
+ break;
+ default:
+ return;
+ }
+
+ Font font(_vm->_res->load(_vm->_screen->getFontResIndex(1))->data);
+ restoreRect(390, y - font.getHeight(), 100, 25);
+
+ for (int i = 0; i < volume; i++)
+ text[i] = '|';
+ text[volume] = 0;
+
+ drawString(0, y, w, 0, 246, text);
+
+}
+
+void MenuSystem::changeVolumeBar(ItemID itemID, int delta) {
+
+ int *volume, newVolume;
+
+ switch (itemID) {
+ case kItemIdMaster:
+ volume = &_cfgMasterVolume;
+ break;
+ case kItemIdVoices:
+ volume = &_cfgVoicesVolume;
+ break;
+ case kItemIdMusic:
+ volume = &_cfgMusicVolume;
+ break;
+ case kItemIdSoundFX:
+ volume = &_cfgSoundFXVolume;
+ break;
+ case kItemIdBackground:
+ volume = &_cfgBackgroundVolume;
+ break;
+ default:
+ return;
+ }
+
+ newVolume = CLIP(*volume + delta, 0, 20);
+
+ if (newVolume != *volume) {
+ *volume = newVolume;
+ drawVolumeBar(itemID);
+ }
+
+}
+
+} // End of namespace Toltecs
diff --git a/engines/toltecs/menu.h b/engines/toltecs/menu.h
new file mode 100644
index 0000000000..3e2c2da8d9
--- /dev/null
+++ b/engines/toltecs/menu.h
@@ -0,0 +1,167 @@
+/* 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 TOLTECS_MENU_H
+#define TOLTECS_MENU_H
+
+#include "common/array.h"
+#include "common/str-array.h"
+
+namespace Toltecs {
+
+enum MenuID {
+ kMenuIdNone,
+ kMenuIdMain,
+ kMenuIdSave,
+ kMenuIdLoad,
+ kMenuIdVolumes
+};
+
+enum ItemID {
+ kItemIdNone,
+ // Main menu
+ kItemIdSave,
+ kItemIdLoad,
+ kItemIdToggleText,
+ kItemIdToggleVoices,
+ kItemIdVolumesMenu,
+ kItemIdPlay,
+ kItemIdQuit,
+ // Volumes menu
+ kItemIdMasterUp,
+ kItemIdVoicesUp,
+ kItemIdMusicUp,
+ kItemIdSoundFXUp,
+ kItemIdBackgroundUp,
+ kItemIdMasterDown,
+ kItemIdVoicesDown,
+ kItemIdMusicDown,
+ kItemIdSoundFXDown,
+ kItemIdBackgroundDown,
+ kItemIdMaster,
+ kItemIdVoices,
+ kItemIdMusic,
+ kItemIdSoundFX,
+ kItemIdBackground,
+ kItemIdDone,
+ kItemIdCancel,
+ // Save/load menu
+ kItemIdSavegameUp,
+ kItemIdSavegameDown,
+ kItemIdSavegame1,
+ kItemIdSavegame2,
+ kItemIdSavegame3,
+ kItemIdSavegame4,
+ kItemIdSavegame5,
+ kItemIdSavegame6,
+ kItemIdSavegame7,
+ // TODO
+ kMenuIdDummy
+};
+
+class MenuSystem {
+
+public:
+ MenuSystem(ToltecsEngine *vm);
+ ~MenuSystem();
+
+ int run();
+ void update();
+ void handleEvents();
+
+protected:
+
+ struct Item {
+ Common::Rect rect;
+ ItemID id;
+ Common::String caption;
+ byte defaultColor, activeColor;
+ int x, y, w;
+ uint fontNum;
+ };
+
+ struct SavegameItem {
+ int _slotNum;
+ Common::String _description;
+ SavegameItem()
+ : _slotNum(-1), _description("") {}
+ SavegameItem(int slotNum, Common::String description)
+ : _slotNum(slotNum), _description(description) {}
+ };
+
+ ToltecsEngine *_vm;
+ Graphics::Surface *_background;
+
+ bool _running;
+ MenuID _currMenuID, _newMenuID;
+ ItemID _currItemID;
+ int _top;
+ int _savegameListTopIndex;
+ bool _editingDescription;
+ ItemID _editingDescriptionID;
+ Item *_editingDescriptionItem;
+ bool _needRedraw;
+
+ Common::Array<Item> _items;
+ Common::Array<SavegameItem> _savegames;
+
+ bool _cfgText, _cfgVoices;
+ int _cfgMasterVolume, _cfgVoicesVolume, _cfgMusicVolume, _cfgSoundFXVolume, _cfgBackgroundVolume;
+
+ void addClickTextItem(ItemID id, int x, int y, int w, uint fontNum, const char *caption, byte defaultColor, byte activeColor);
+
+ void drawItem(ItemID itemID, bool active);
+ void handleMouseMove(int x, int y);
+ void handleMouseClick(int x, int y);
+ void handleKeyDown(const Common::KeyState& kbd);
+
+ ItemID findItemAt(int x, int y);
+ Item *getItem(ItemID id);
+ void setItemCaption(Item *item, const char *caption);
+
+ void initMenu(MenuID menuID);
+
+ void enterItem(ItemID id);
+ void leaveItem(ItemID id);
+ void clickItem(ItemID id);
+
+ void restoreRect(int x, int y, int w, int h);
+ void shadeRect(int x, int y, int w, int h, byte color1, byte color2);
+ void drawString(int16 x, int16 y, int w, uint fontNum, byte color, const char *text);
+
+ SavegameItem *getSavegameItemByID(ItemID id);
+
+ int loadSavegamesList();
+ void setSavegameCaptions();
+ void scrollSavegames(int delta);
+ void clickSavegameItem(ItemID id);
+ void setCfgText(bool value, bool active);
+ void setCfgVoices(bool value, bool active);
+ void drawVolumeBar(ItemID itemID);
+ void changeVolumeBar(ItemID itemID, int delta);
+
+};
+
+} // End of namespace Toltecs
+
+#endif /* TOLTECS_MENU_H */
diff --git a/engines/toltecs/microtiles.cpp b/engines/toltecs/microtiles.cpp
new file mode 100644
index 0000000000..0b61ac38a5
--- /dev/null
+++ b/engines/toltecs/microtiles.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 "toltecs/microtiles.h"
+
+namespace Toltecs {
+
+MicroTileArray::MicroTileArray(int16 width, int16 height) {
+ _tilesW = (width / TileSize) + ((width % TileSize) > 0 ? 1 : 0);
+ _tilesH = (height / TileSize) + ((height % TileSize) > 0 ? 1 : 0);
+ _tiles = new BoundingBox[_tilesW * _tilesH];
+ clear();
+}
+
+MicroTileArray::~MicroTileArray() {
+ delete[] _tiles;
+}
+
+void MicroTileArray::addRect(Common::Rect r) {
+
+ int ux0, uy0, ux1, uy1;
+ int tx0, ty0, tx1, ty1;
+ int ix0, iy0, ix1, iy1;
+
+ r.clip(Common::Rect(0, 0, 639, 399));
+
+ ux0 = r.left / TileSize;
+ uy0 = r.top / TileSize;
+ ux1 = r.right / TileSize;
+ uy1 = r.bottom / TileSize;
+
+ tx0 = r.left % TileSize;
+ ty0 = r.top % TileSize;
+ tx1 = r.right % TileSize;
+ ty1 = r.bottom % TileSize;
+
+ for (int yc = uy0; yc <= uy1; yc++) {
+ for (int xc = ux0; xc <= ux1; xc++) {
+ ix0 = (xc == ux0) ? tx0 : 0;
+ ix1 = (xc == ux1) ? tx1 : TileSize - 1;
+ iy0 = (yc == uy0) ? ty0 : 0;
+ iy1 = (yc == uy1) ? ty1 : TileSize - 1;
+ updateBoundingBox(_tiles[xc + yc * _tilesW], ix0, iy0, ix1, iy1);
+ }
+ }
+
+}
+
+void MicroTileArray::clear() {
+ memset(_tiles, 0, _tilesW * _tilesH * sizeof(BoundingBox));
+}
+
+byte MicroTileArray::TileX0(const BoundingBox &boundingBox) {
+ return (boundingBox >> 24) & 0xFF;
+}
+
+byte MicroTileArray::TileY0(const BoundingBox &boundingBox) {
+ return (boundingBox >> 16) & 0xFF;
+}
+
+byte MicroTileArray::TileX1(const BoundingBox &boundingBox) {
+ return (boundingBox >> 8) & 0xFF;
+}
+
+byte MicroTileArray::TileY1(const BoundingBox &boundingBox) {
+ return boundingBox & 0xFF;
+}
+
+bool MicroTileArray::isBoundingBoxEmpty(const BoundingBox &boundingBox) {
+ return boundingBox == EmptyBoundingBox;
+}
+
+bool MicroTileArray::isBoundingBoxFull(const BoundingBox &boundingBox) {
+ return boundingBox == FullBoundingBox;
+}
+
+void MicroTileArray::setBoundingBox(BoundingBox &boundingBox, byte x0, byte y0, byte x1, byte y1) {
+ boundingBox = (x0 << 24) | (y0 << 16) | (x1 << 8) | y1;
+}
+
+void MicroTileArray::updateBoundingBox(BoundingBox &boundingBox, byte x0, byte y0, byte x1, byte y1) {
+ if (!isBoundingBoxEmpty(boundingBox)) {
+ x0 = MIN(TileX0(boundingBox), x0);
+ y0 = MIN(TileY0(boundingBox), y0);
+ x1 = MAX(TileX1(boundingBox), x1);
+ y1 = MAX(TileY1(boundingBox), y1);
+ }
+ setBoundingBox(boundingBox, x0, y0, x1, y1);
+}
+
+Common::Rect * MicroTileArray::getRectangles(int *num_rects, int min_x, int min_y, int max_x, int max_y) {
+
+ Common::Rect *rects = new Common::Rect[_tilesW * _tilesH];
+
+ int n_rects = 0;
+ int x, y;
+ int x0, y0, x1, y1;
+ int i = 0;
+
+ for (y = 0; y < _tilesH; ++y) {
+ for (x = 0; x < _tilesW; ++x) {
+
+ int start;
+ int finish = 0;
+ BoundingBox boundingBox;
+
+ boundingBox = _tiles[i];
+
+ if (isBoundingBoxEmpty(boundingBox)) {
+ ++i;
+ continue;
+ }
+
+ x0 = (x * TileSize) + TileX0(boundingBox);
+ y0 = (y * TileSize) + TileY0(boundingBox);
+ y1 = (y * TileSize) + TileY1(boundingBox);
+
+ x0 = CLIP (x0, min_x, max_x);
+ y0 = CLIP (y0, min_y, max_y);
+ y1 = CLIP (y1, min_y, max_y);
+
+ // FIXME: Why is the following code in an #if block?
+#if 1
+ start = i;
+
+ if (TileX1(boundingBox) == TileSize - 1 && x != _tilesW - 1) { // check if the tile continues
+ while (!finish) {
+ ++x;
+ ++i;
+
+ if (x == _tilesW || i >= _tilesW * _tilesH ||
+ TileY0(_tiles[i]) != TileY0(boundingBox) ||
+ TileY1(_tiles[i]) != TileY1(boundingBox) ||
+ TileX0(_tiles[i]) != 0)
+ {
+ --x;
+ --i;
+ finish = 1;
+ }
+ }
+ }
+#endif
+ x1 = (x * TileSize) + TileX1(_tiles[i]);
+
+ x1 = CLIP (x1, min_x, max_x);
+
+ // FIXME: Why is the following code in an #if block?
+
+ #if 1
+
+ rects[n_rects].left = x0;
+ rects[n_rects].top = y0;
+ rects[n_rects].right = x1 + 1;
+ rects[n_rects].bottom = y1 + 1;
+ n_rects++;
+
+ #else
+
+ // FIXME: Why is this code disabled?
+
+ if (glom [start] != -1 && /* try to glom */
+ rects [glom [start]].left == x0 &&
+ rects [glom [start]].right == x1 &&
+ rects [glom [start]].bottom == y0 - 1)
+ {
+ rects [glom [start]].bottom = y1;
+ if (y != tilesH - 1) {
+ glom [start + tilesW] = glom [start];
+ }
+ } else {
+ rects[n_rects].left = x0;
+ rects[n_rects].top = y0;
+ rects[n_rects].right = x1;
+ rects[n_rects].bottom = y1;
+ if (y != tilesH - 1) {
+ glom [start + tilesW] = n_rects;
+ }
+ n_rects ++;
+ }
+
+ #endif
+
+ ++i;
+ } // for (x = 0; x < _tilesW; ++x)
+ } // for (y = 0; y < _tilesH; ++y)
+
+ *num_rects = n_rects;
+
+ //delete glom;
+
+ return rects;
+
+}
+
+} // End of namespace Toltecs
diff --git a/engines/toltecs/microtiles.h b/engines/toltecs/microtiles.h
new file mode 100644
index 0000000000..53933621a9
--- /dev/null
+++ b/engines/toltecs/microtiles.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 TOLTECS_MICROTILES_H
+#define TOLTECS_MICROTILES_H
+
+#include "common/scummsys.h"
+#include "common/util.h"
+#include "common/rect.h"
+
+namespace Toltecs {
+
+typedef uint32 BoundingBox;
+
+const BoundingBox FullBoundingBox = 0x00001F1F;
+const BoundingBox EmptyBoundingBox = 0x00000000;
+const int TileSize = 32;
+
+class MicroTileArray {
+public:
+ MicroTileArray(int16 width, int16 height);
+ ~MicroTileArray();
+ void addRect(Common::Rect r);
+ void clear();
+ Common::Rect *getRectangles(int *num_rects, int min_x, int min_y, int max_x, int max_y);
+protected:
+ BoundingBox *_tiles;
+ int16 _tilesW, _tilesH;
+ byte TileX0(const BoundingBox &boundingBox);
+ byte TileY0(const BoundingBox &boundingBox);
+ byte TileX1(const BoundingBox &boundingBox);
+ byte TileY1(const BoundingBox &boundingBox);
+ bool isBoundingBoxEmpty(const BoundingBox &boundingBox);
+ bool isBoundingBoxFull(const BoundingBox &boundingBox);
+ void setBoundingBox(BoundingBox &boundingBox, byte x0, byte y0, byte x1, byte y1);
+ void updateBoundingBox(BoundingBox &boundingBox, byte x0, byte y0, byte x1, byte y1);
+};
+
+} // namespace Toltecs
+
+#endif // TOLTECS_MICROTILES_H
diff --git a/engines/toltecs/module.mk b/engines/toltecs/module.mk
new file mode 100644
index 0000000000..aa4a6f376b
--- /dev/null
+++ b/engines/toltecs/module.mk
@@ -0,0 +1,28 @@
+MODULE := engines/toltecs
+
+MODULE_OBJS = \
+ animation.o \
+ detection.o \
+ menu.o \
+ microtiles.o \
+ movie.o \
+ music.o \
+ palette.o \
+ toltecs.o \
+ render.o \
+ resource.o \
+ saveload.o \
+ screen.o \
+ script.o \
+ segmap.o \
+ sound.o \
+ sprite.o
+
+
+# This module can be built as a plugin
+ifeq ($(ENABLE_TOLTECS), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+
+# Include common rules
+include $(srcdir)/rules.mk
diff --git a/engines/toltecs/movie.cpp b/engines/toltecs/movie.cpp
new file mode 100644
index 0000000000..054683b63e
--- /dev/null
+++ b/engines/toltecs/movie.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.
+ *
+ *
+ */
+
+#include "audio/mixer.h"
+#include "audio/decoders/raw.h"
+
+#include "toltecs/toltecs.h"
+#include "toltecs/movie.h"
+#include "toltecs/palette.h"
+#include "toltecs/resource.h"
+#include "toltecs/screen.h"
+#include "toltecs/script.h"
+
+namespace Toltecs {
+
+enum ChunkTypes {
+ kChunkFirstImage = 0,
+ kChunkSubsequentImages = 1,
+ kChunkPalette = 2,
+ kChunkUnused = 3,
+ kChunkAudio = 4,
+ kChunkShowSubtitle = 5,
+ kChunkShakeScreen = 6,
+ kChunkSetupSubtitles = 7,
+ kChunkStopSubtitles = 8
+};
+
+MoviePlayer::MoviePlayer(ToltecsEngine *vm) : _vm(vm) {
+}
+
+MoviePlayer::~MoviePlayer() {
+}
+
+void MoviePlayer::playMovie(uint resIndex) {
+
+ const uint32 subtitleSlot = kMaxScriptSlots - 1;
+ int16 savedSceneWidth = _vm->_sceneWidth;
+ int16 savedSceneHeight = _vm->_sceneHeight;
+ int16 savedCameraHeight = _vm->_cameraHeight;
+ int16 savedCameraX = _vm->_cameraX;
+ int16 savedCameraY = _vm->_cameraY;
+ int16 savedGuiHeight = _vm->_guiHeight;
+ byte moviePalette[768];
+
+ _vm->_isSaveAllowed = false;
+
+ memset(moviePalette, 0, sizeof(moviePalette));
+
+ _vm->_screen->finishTalkTextItems();
+ _vm->_screen->clearSprites();
+
+ _vm->_arc->openResource(resIndex);
+
+ _frameCount = _vm->_arc->readUint32LE();
+ _chunkCount = _vm->_arc->readUint32LE();
+
+ // TODO: Figure out rest of the header
+ _vm->_arc->readUint32LE();
+ _vm->_arc->readUint32LE();
+ _framesPerSoundChunk = _vm->_arc->readUint32LE();
+ _vm->_arc->readUint32LE();
+
+ _vm->_sceneWidth = 640;
+ _vm->_sceneHeight = 400;
+ _vm->_cameraHeight = 400;
+ _vm->_cameraX = 0;
+ _vm->_cameraY = 0;
+ _vm->_guiHeight = 0;
+
+ _audioStream = Audio::makeQueuingAudioStream(22050, false);
+
+ _vm->_mixer->playStream(Audio::Mixer::kPlainSoundType, &_audioStreamHandle, _audioStream);
+
+ _soundChunkFramesLeft = 0;
+ _lastPrefetchOfs = 0;
+
+ fetchAudioChunks();
+
+ uint32 lastTime = _vm->_mixer->getSoundElapsedTime(_audioStreamHandle);
+
+ while (_chunkCount--) {
+
+ byte chunkType = _vm->_arc->readByte();
+ uint32 chunkSize = _vm->_arc->readUint32LE();
+ byte *chunkBuffer = NULL;
+ uint32 movieOffset;
+
+ debug(0, "chunkType = %d; chunkSize = %d", chunkType, chunkSize);
+
+ // Skip audio chunks - we've already queued them in
+ // fetchAudioChunks() above
+ if (chunkType == kChunkAudio) {
+ _vm->_arc->skip(chunkSize);
+ } else {
+ chunkBuffer = new byte[chunkSize];
+ _vm->_arc->read(chunkBuffer, chunkSize);
+ }
+
+ movieOffset = _vm->_arc->pos();
+
+ switch (chunkType) {
+ case kChunkFirstImage:
+ case kChunkSubsequentImages:
+ unpackRle(chunkBuffer, _vm->_screen->_backScreen);
+ // TODO: Rework this
+ _vm->_screen->updateShakeScreen();
+ _vm->_screen->_fullRefresh = true;
+ _vm->updateInput();
+ _vm->drawScreen();
+
+ _soundChunkFramesLeft--;
+ if (_soundChunkFramesLeft <= _framesPerSoundChunk) {
+ fetchAudioChunks();
+ }
+
+ while (_vm->_mixer->getSoundElapsedTime(_audioStreamHandle) < lastTime + 111) {
+ g_system->delayMillis(10);
+ }
+
+ lastTime = _vm->_mixer->getSoundElapsedTime(_audioStreamHandle);
+
+ break;
+ case kChunkPalette:
+ unpackPalette(chunkBuffer, moviePalette, 256, 3);
+ _vm->_palette->setFullPalette(moviePalette);
+ break;
+ case kChunkUnused:
+ error("Chunk considered to be unused has been encountered");
+ case kChunkAudio:
+ // Already processed
+ break;
+ case kChunkShowSubtitle:
+ // TODO: Check if the text is a subtitle (last character == 0xFE).
+ // If so, don't show it if text display is disabled.
+ memcpy(_vm->_script->getSlotData(subtitleSlot), chunkBuffer, chunkSize);
+ _vm->_screen->updateTalkText(subtitleSlot, 0);
+ break;
+ case kChunkShakeScreen: // start/stop shakescreen effect
+ if (chunkBuffer[0] == 0xFF)
+ _vm->_screen->stopShakeScreen();
+ else
+ _vm->_screen->startShakeScreen(chunkBuffer[0]);
+ break;
+ case kChunkSetupSubtitles: // setup subtitle parameters
+ _vm->_screen->_talkTextY = READ_LE_UINT16(chunkBuffer + 0);
+ _vm->_screen->_talkTextX = READ_LE_UINT16(chunkBuffer + 2);
+ _vm->_screen->_talkTextFontColor = ((chunkBuffer[4] << 4) & 0xF0) | ((chunkBuffer[4] >> 4) & 0x0F);
+ debug(0, "_talkTextX = %d; _talkTextY = %d; _talkTextFontColor = %d",
+ _vm->_screen->_talkTextX, _vm->_screen->_talkTextY, _vm->_screen->_talkTextFontColor);
+ break;
+ case kChunkStopSubtitles:
+ _vm->_script->getSlotData(subtitleSlot)[0] = 0xFF;
+ _vm->_screen->finishTalkTextItems();
+ break;
+ default:
+ error("MoviePlayer::playMovie(%04X) Unknown chunk type %d at %08X", resIndex, chunkType, _vm->_arc->pos() - 5 - chunkSize);
+ }
+
+ delete[] chunkBuffer;
+
+ _vm->_arc->seek(movieOffset, SEEK_SET);
+
+ if (!handleInput())
+ break;
+
+ }
+
+ _audioStream->finish();
+ _vm->_mixer->stopHandle(_audioStreamHandle);
+
+ _vm->_arc->closeResource();
+
+ debug(0, "playMovie() done");
+
+ _vm->_sceneWidth = savedSceneWidth;
+ _vm->_sceneHeight = savedSceneHeight;
+ _vm->_cameraHeight = savedCameraHeight;
+ _vm->_cameraX = savedCameraX;
+ _vm->_cameraY = savedCameraY;
+ _vm->_guiHeight = savedGuiHeight;
+
+ _vm->_isSaveAllowed = true;
+}
+
+void MoviePlayer::fetchAudioChunks() {
+
+ uint32 startOfs = _vm->_arc->pos();
+ uint32 chunkCount = _chunkCount;
+ uint prefetchChunkCount = 0;
+
+ if (_lastPrefetchOfs != 0)
+ _vm->_arc->seek(_lastPrefetchOfs, SEEK_SET);
+
+ while (chunkCount-- && prefetchChunkCount < _framesPerSoundChunk / 2) {
+ byte chunkType = _vm->_arc->readByte();
+ uint32 chunkSize = _vm->_arc->readUint32LE();
+ if (chunkType == 4) {
+ byte *chunkBuffer = (byte*)malloc(chunkSize);
+ _vm->_arc->read(chunkBuffer, chunkSize);
+ _audioStream->queueBuffer(chunkBuffer, chunkSize, DisposeAfterUse::YES, Audio::FLAG_UNSIGNED);
+ chunkBuffer = NULL;
+ prefetchChunkCount++;
+ _soundChunkFramesLeft += _framesPerSoundChunk;
+ } else {
+ _vm->_arc->seek(chunkSize, SEEK_CUR);
+ }
+ }
+
+ _lastPrefetchOfs = _vm->_arc->pos();
+
+ _vm->_arc->seek(startOfs, SEEK_SET);
+
+}
+
+void MoviePlayer::unpackPalette(byte *source, byte *dest, int elemCount, int elemSize) {
+ int ofs = 0, size = elemCount * elemSize;
+ while (ofs < size) {
+ byte len;
+ len = *source++;
+ if (len == 0) {
+ len = *source++;
+ } else {
+ byte value = *source++;
+ memset(dest, value, len);
+ }
+ ofs += len;
+ dest += len;
+ }
+}
+
+void MoviePlayer::unpackRle(byte *source, byte *dest) {
+ int size = 256000;
+ while (size > 0) {
+ byte a = *source++;
+ byte b = *source++;
+ if (a == 0) {
+ dest += b;
+ size -= b;
+ } else {
+ memset(dest, b, a);
+ dest += a;
+ size -= a;
+ }
+ }
+}
+
+bool MoviePlayer::handleInput() {
+ Common::Event event;
+ Common::EventManager *eventMan = g_system->getEventManager();
+ while (eventMan->pollEvent(event)) {
+ switch (event.type) {
+ case Common::EVENT_KEYDOWN:
+ if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
+ return false;
+ break;
+ case Common::EVENT_LBUTTONDOWN:
+ case Common::EVENT_RBUTTONDOWN:
+ return false;
+ case Common::EVENT_QUIT:
+ _vm->quitGame();
+ return false;
+ break;
+ default:
+ break;
+ }
+ }
+ return !_vm->shouldQuit();
+}
+
+} // End of namespace Toltecs
diff --git a/engines/toltecs/movie.h b/engines/toltecs/movie.h
new file mode 100644
index 0000000000..aecfac240f
--- /dev/null
+++ b/engines/toltecs/movie.h
@@ -0,0 +1,59 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ */
+
+#ifndef TOLTECS_MOVIE_H
+#define TOLTECS_MOVIE_H
+
+#include "audio/audiostream.h"
+#include "audio/mixer.h" // for Audio::SoundHandle
+
+namespace Toltecs {
+
+class MoviePlayer {
+
+public:
+ MoviePlayer(ToltecsEngine *vm);
+ ~MoviePlayer();
+
+ void playMovie(uint resIndex);
+
+protected:
+ ToltecsEngine *_vm;
+ Audio::QueuingAudioStream *_audioStream;
+ Audio::SoundHandle _audioStreamHandle;
+
+ uint32 _chunkCount, _frameCount, _lastPrefetchOfs;
+ uint32 _soundChunkFramesLeft, _framesPerSoundChunk;
+
+ void unpackPalette(byte *source, byte *dest, int elemCount, int elemSize);
+ void unpackRle(byte *source, byte *dest);
+
+ void fetchAudioChunks();
+
+ bool handleInput();
+
+};
+
+} // End of namespace Toltecs
+
+#endif /* TOLTECS_MOVIE_H */
diff --git a/engines/toltecs/music.cpp b/engines/toltecs/music.cpp
new file mode 100644
index 0000000000..c322961077
--- /dev/null
+++ b/engines/toltecs/music.cpp
@@ -0,0 +1,145 @@
+/* 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.
+ *
+ */
+
+// FIXME: This code is taken from SAGA and needs more work (e.g. setVolume).
+
+#include "toltecs/toltecs.h"
+#include "toltecs/music.h"
+#include "toltecs/resource.h"
+
+#include "audio/midiparser.h"
+#include "common/textconsole.h"
+
+namespace Toltecs {
+
+MusicPlayer::MusicPlayer(bool isGM) : _isGM(isGM), _buffer(NULL) {
+ MidiPlayer::createDriver();
+
+ int ret = _driver->open();
+ if (ret == 0) {
+ if (_nativeMT32)
+ _driver->sendMT32Reset();
+ else
+ _driver->sendGMReset();
+
+ _driver->setTimerCallback(this, &timerCallback);
+ }
+}
+
+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::playMIDI(const byte *data, uint32 size, bool loop) {
+ Common::StackLock lock(_mutex);
+
+ stopAndClear();
+
+ _buffer = new byte[size];
+ memcpy(_buffer, data, size);
+
+ MidiParser *parser;
+
+ if (!memcmp(data, "FORM", 4))
+ parser = MidiParser::createParser_XMIDI(NULL);
+ else
+ parser = MidiParser::createParser_SMF();
+
+ if (parser->loadMusic(_buffer, size)) {
+ parser->setTrack(0);
+ parser->setMidiDriver(this);
+ parser->setTimerRate(_driver->getBaseTempo());
+ parser->property(MidiParser::mpCenterPitchWheelOnUnload, 1);
+ parser->property(MidiParser::mpSendSustainOffOnNotesOff, 1);
+
+ _parser = parser;
+
+ setVolume(127);
+
+ _isLooping = loop;
+ _isPlaying = true;
+ } else {
+ delete parser;
+ }
+}
+
+void MusicPlayer::pause() {
+ setVolume(-1);
+ _isPlaying = false;
+}
+
+void MusicPlayer::resume() {
+ setVolume(127);
+ _isPlaying = true;
+}
+
+void MusicPlayer::stopAndClear() {
+ Common::StackLock lock(_mutex);
+ stop();
+
+ delete[] _buffer;
+ _buffer = NULL;
+}
+
+Music::Music(ArchiveReader *arc) : MusicPlayer(true), _arc(arc) {
+ _sequenceResIndex = -1;
+}
+
+void Music::playSequence(int16 sequenceResIndex) {
+ _sequenceResIndex = sequenceResIndex;
+
+ int32 resourceSize = _arc->getResourceSize(sequenceResIndex);
+ byte *data = new byte[resourceSize];
+ _arc->openResource(sequenceResIndex);
+ _arc->read(data, resourceSize);
+ _arc->closeResource();
+
+ if (!memcmp(data, "FORM", 4))
+ playMIDI(data, resourceSize, true); // music tracks are always looping
+ else
+ // Sanity check: this should never occur
+ error("playSequence: resource %d isn't XMIDI", sequenceResIndex);
+
+ delete[] data;
+}
+
+void Music::stopSequence() {
+ _sequenceResIndex = -1;
+ stopAndClear();
+}
+
+void Music::saveState(Common::WriteStream *out) {
+ out->writeSint16LE(_sequenceResIndex);
+}
+
+void Music::loadState(Common::ReadStream *in) {
+ _sequenceResIndex = in->readSint16LE();
+
+ if (_sequenceResIndex >= 0)
+ playSequence(_sequenceResIndex);
+}
+
+} // End of namespace Made
diff --git a/engines/m4/midi.h b/engines/toltecs/music.h
index 817150fd81..79df1ea2f5 100644
--- a/engines/m4/midi.h
+++ b/engines/toltecs/music.h
@@ -22,38 +22,52 @@
// Music class
-#ifndef M4_MIDI_H
-#define M4_MIDI_H
+#ifndef MADE_MUSIC_H
+#define MADE_MUSIC_H
#include "audio/midiplayer.h"
+#include "common/stream.h"
-namespace M4 {
+namespace Toltecs {
-class MidiPlayer : public Audio::MidiPlayer {
-public:
- MidiPlayer(MadsM4Engine *vm);
+class ArchiveReader;
- void playMusic(const char *name, int32 vol, bool loop, int32 trigger, int32 scene);
+class MusicPlayer : public Audio::MidiPlayer {
+public:
+ MusicPlayer(bool isGM = true);
- void setGM(bool isGM) { _isGM = isGM; }
+ void playMIDI(const byte *data, uint32 size, bool loop = false);
+ void pause();
+ void resume();
+ void stopAndClear();
// MidiDriver_BASE interface implementation
virtual void send(uint32 b);
protected:
- MadsM4Engine *_vm;
-
bool _isGM;
- bool _randomLoop;
+private:
+ byte *_buffer;
+};
+
+class Music : public MusicPlayer {
+public:
+
+ Music(ArchiveReader *arc);
+ ~Music() {}
+
+ void playSequence(int16 sequenceResIndex);
+ void stopSequence();
- byte *_musicData;
- uint16 *_buf;
- size_t _musicDataSize;
+ void saveState(Common::WriteStream *out);
+ void loadState(Common::ReadStream *in);
- byte *convertHMPtoSMF(byte *data, uint32 inSize, uint32 &outSize);
+private:
+ int16 _sequenceResIndex;
+ ArchiveReader *_arc;
};
-} // End of namespace M4
+} // End of namespace Toltecs
#endif
diff --git a/engines/toltecs/palette.cpp b/engines/toltecs/palette.cpp
new file mode 100644
index 0000000000..706218e0ba
--- /dev/null
+++ b/engines/toltecs/palette.cpp
@@ -0,0 +1,231 @@
+/* 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 "graphics/palette.h"
+
+#include "toltecs/toltecs.h"
+#include "toltecs/palette.h"
+#include "toltecs/resource.h"
+
+namespace Toltecs {
+
+Palette::Palette(ToltecsEngine *vm) : _vm(vm) {
+ clearFragments();
+
+ memset(_colorTransTable, 0, sizeof(_colorTransTable));
+}
+
+Palette::~Palette() {
+}
+
+void Palette::setFullPalette(byte *palette) {
+ byte colors[768];
+ for (int i = 0; i < 256; i++) {
+ colors[i * 3 + 0] = palette[i * 3 + 0] << 2;
+ colors[i * 3 + 1] = palette[i * 3 + 1] << 2;
+ colors[i * 3 + 2] = palette[i * 3 + 2] << 2;
+ }
+ _vm->_system->getPaletteManager()->setPalette((const byte *)colors, 0, 256);
+ _vm->_system->updateScreen();
+}
+
+void Palette::getFullPalette(byte *palette) {
+ byte colors[768];
+ _vm->_system->getPaletteManager()->grabPalette(colors, 0, 256);
+ for (int i = 0; i < 256; i++) {
+ palette[i * 3 + 0] = colors[i * 3 + 0] >> 2;
+ palette[i * 3 + 1] = colors[i * 3 + 1] >> 2;
+ palette[i * 3 + 2] = colors[i * 3 + 2] >> 2;
+ }
+}
+
+void Palette::setDeltaPalette(byte *palette, byte mask, int8 deltaValue, int16 count, int16 startIndex) {
+ byte colors[768];
+
+ byte *palPtr = palette + startIndex * 3;
+ int16 index = startIndex, colorCount = count;
+ byte rgb;
+
+ count++;
+
+ _vm->_system->getPaletteManager()->grabPalette(colors, 0, 256);
+
+ deltaValue *= -1;
+
+ while (count--) {
+ rgb = *palPtr++;
+ if (mask & 1) colors[index * 3 + 0] = CLIP<int>(rgb + deltaValue, 0, 63) << 2;
+ rgb = *palPtr++;
+ if (mask & 2) colors[index * 3 + 1] = CLIP<int>(rgb + deltaValue, 0, 63) << 2;
+ rgb = *palPtr++;
+ if (mask & 4) colors[index * 3 + 2] = CLIP<int>(rgb + deltaValue, 0, 63) << 2;
+ index++;
+ }
+
+ debug(0, "startIndex = %d; colorCount = %d", startIndex, colorCount);
+
+ _vm->_system->getPaletteManager()->setPalette((const byte *)colors, 0, 256);
+}
+
+void Palette::loadAddPalette(uint resIndex, byte startIndex) {
+ Resource *paletteResource = _vm->_res->load(resIndex);
+ memcpy(&_mainPalette[startIndex * 3], paletteResource->data, paletteResource->size);
+}
+
+void Palette::loadAddPaletteFrom(byte *source, byte startIndex, byte count) {
+ memcpy(&_mainPalette[startIndex * 3], source, count * 3);
+}
+
+void Palette::addFragment(uint resIndex, int16 id) {
+ debug(0, "Palette::addFragment(%d, %d)", resIndex, id);
+
+ Resource *fragmentResource = _vm->_res->load(resIndex);
+ byte count = fragmentResource->size / 3;
+
+ memcpy(&_mainPalette[_fragmentIndex * 3], fragmentResource->data, count * 3);
+
+ PaletteFragment fragment;
+ fragment.id = id;
+ fragment.index = _fragmentIndex;
+ fragment.count = count;
+ _fragments.push_back(fragment);
+
+ debug(0, "Palette::addFragment() index = %02X; count = %02X", fragment.index, fragment.count);
+
+ _fragmentIndex += count;
+}
+
+uint16 Palette::findFragment(int16 id) {
+ debug(0, "Palette::findFragment(%d)", id);
+
+ uint16 result = 0;
+ for (PaletteFragmentArray::iterator iter = _fragments.begin(); iter != _fragments.end(); iter++) {
+ PaletteFragment fragment = *iter;
+ if (fragment.id == id) {
+ result = (fragment.count << 8) | fragment.index;
+ break;
+ }
+ }
+
+ debug(0, "Palette::findFragment() result = %04X", result);
+
+ return result;
+}
+
+void Palette::clearFragments() {
+ debug(0, "Palette::clearFragments()");
+ _fragmentIndex = 128;
+ _fragments.clear();
+}
+
+void Palette::buildColorTransTable(byte limit, int8 deltaValue, byte mask) {
+ byte r = 0, g = 0, b = 0;
+
+ mask &= 7;
+
+ for (int i = 0; i < 256; i++) {
+
+ if (deltaValue < 0) {
+ // TODO (probably unused)
+ warning("Palette::buildColorTransTable(%d, %d, %02X) not yet implemented!", limit, deltaValue, mask);
+ } else {
+ r = _mainPalette[i * 3 + 0];
+ g = _mainPalette[i * 3 + 1];
+ b = _mainPalette[i * 3 + 2];
+ if (MAX(r, MAX(b, g)) >= limit) {
+ if ((mask & 1) && r >= deltaValue)
+ r -= deltaValue;
+ if ((mask & 2) && g >= deltaValue)
+ g -= deltaValue;
+ if ((mask & 4) && b >= deltaValue)
+ b -= deltaValue;
+ }
+ }
+
+ int bestIndex = 0;
+ uint16 bestMatch = 0xFFFF;
+
+ for (int j = 0; j < 256; j++) {
+ byte distance = ABS(_mainPalette[j * 3 + 0] - r) + ABS(_mainPalette[j * 3 + 1] - g) + ABS(_mainPalette[j * 3 + 2] - b);
+ byte maxColor = MAX(_mainPalette[j * 3 + 0], MAX(_mainPalette[j * 3 + 1], _mainPalette[j * 3 + 2]));
+ uint16 match = (distance << 8) | maxColor;
+ if (match < bestMatch) {
+ bestMatch = match;
+ bestIndex = j;
+ }
+ }
+
+ _colorTransTable[i] = bestIndex;
+
+ }
+}
+
+void Palette::buildColorTransTable2(byte limit, int8 deltaValue, byte mask) {
+ // TODO
+}
+
+void Palette::saveState(Common::WriteStream *out) {
+ // Save currently active palette
+ byte palette[768];
+ getFullPalette(palette);
+ out->write(palette, 768);
+
+ out->write(_mainPalette, 768);
+ out->write(_animPalette, 768);
+ out->write(_colorTransTable, 256);
+
+ uint16 fragmentCount = _fragments.size();
+ out->writeUint16LE(fragmentCount);
+ for (PaletteFragmentArray::iterator iter = _fragments.begin(); iter != _fragments.end(); iter++) {
+ PaletteFragment fragment = *iter;
+ out->writeUint16LE(fragment.id);
+ out->writeByte(fragment.index);
+ out->writeByte(fragment.count);
+ }
+ out->writeByte(_fragmentIndex);
+}
+
+void Palette::loadState(Common::ReadStream *in) {
+ // Save currently active palette
+ byte palette[768];
+ in->read(palette, 768);
+ setFullPalette(palette);
+
+ in->read(_mainPalette, 768);
+ in->read(_animPalette, 768);
+ in->read(_colorTransTable, 256);
+
+ uint16 fragmentCount = in->readUint16LE();
+ _fragments.clear();
+ for (uint16 i = 0; i < fragmentCount; i++) {
+ PaletteFragment fragment;
+ fragment.id = in->readUint16LE();
+ fragment.index = in->readByte();
+ fragment.count = in->readByte();
+ _fragments.push_back(fragment);
+ }
+ _fragmentIndex = in->readByte();
+}
+
+
+} // End of namespace Toltecs
diff --git a/engines/toltecs/palette.h b/engines/toltecs/palette.h
new file mode 100644
index 0000000000..7bcf06e027
--- /dev/null
+++ b/engines/toltecs/palette.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.
+ *
+ *
+ */
+
+#ifndef TOLTECS_PALETTE_H
+#define TOLTECS_PALETTE_H
+
+#include "common/array.h"
+#include "common/system.h"
+
+#include "toltecs/toltecs.h"
+
+namespace Toltecs {
+
+//#define ROT(index) (((index << 4) & 0xF0) | ((index >> 4) & 0x0F))
+//#define ROT(index) (index)
+
+class Palette {
+public:
+ Palette(ToltecsEngine *vm);
+ ~Palette();
+
+ void setFullPalette(byte *palette);
+ void getFullPalette(byte *palette);
+ void setDeltaPalette(byte *palette, byte mask, int8 deltaValue, int16 count, int16 startIndex);
+
+ void loadAddPalette(uint resIndex, byte startIndex);
+ void loadAddPaletteFrom(byte *source, byte startIndex, byte count);
+
+ void addFragment(uint resIndex, int16 id);
+ uint16 findFragment(int16 id);
+ void clearFragments();
+
+ void buildColorTransTable(byte limit, int8 deltaValue, byte mask);
+ void buildColorTransTable2(byte limit, int8 deltaValue, byte mask);
+ byte getColorTransPixel(byte pixel) const { return _colorTransTable[pixel]; }
+
+ byte *getMainPalette() { return _mainPalette; }
+ byte *getAnimPalette() { return _animPalette; }
+
+ void saveState(Common::WriteStream *out);
+ void loadState(Common::ReadStream *in);
+
+protected:
+
+ struct PaletteFragment {
+ int16 id;
+ byte index, count;
+ };
+
+ typedef Common::Array<PaletteFragment> PaletteFragmentArray;
+
+ ToltecsEngine *_vm;
+
+ byte _mainPalette[768];
+ byte _animPalette[768];
+ byte _colorTransTable[256];
+
+ PaletteFragmentArray _fragments;
+ byte _fragmentIndex;
+
+};
+
+} // End of namespace Toltecs
+
+#endif /* TOLTECS_PALETTE_H */
diff --git a/engines/toltecs/render.cpp b/engines/toltecs/render.cpp
new file mode 100644
index 0000000000..de5e77fb50
--- /dev/null
+++ b/engines/toltecs/render.cpp
@@ -0,0 +1,311 @@
+/* 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/system.h"
+
+#include "toltecs/toltecs.h"
+#include "toltecs/render.h"
+#include "toltecs/resource.h"
+
+namespace Toltecs {
+
+Common::Rect makeRect(int16 x, int16 y, int16 width, int16 height) {
+ Common::Rect rect;
+ rect.left = x;
+ rect.top = y;
+ rect.setWidth(width);
+ rect.setHeight(height);
+ return rect;
+}
+
+RenderQueue::RenderQueue(ToltecsEngine *vm) : _vm(vm) {
+ _currQueue = new RenderQueueArray();
+ _prevQueue = new RenderQueueArray();
+ _updateUta = new MicroTileArray(640, 400);
+}
+
+RenderQueue::~RenderQueue() {
+ delete _currQueue;
+ delete _prevQueue;
+ delete _updateUta;
+}
+
+void RenderQueue::addSprite(SpriteDrawItem &sprite) {
+
+ RenderQueueItem item;
+ item.type = kSprite;
+ item.flags = kRefresh;
+ item.rect = makeRect(sprite.x - _vm->_cameraX, sprite.y - _vm->_cameraY, sprite.width, sprite.height);
+ item.priority = sprite.priority;
+
+ item.sprite = sprite;
+ item.sprite.x -= _vm->_cameraX;
+ item.sprite.y -= _vm->_cameraY;
+
+ // Add sprite sorted by priority
+ RenderQueueArray::iterator iter = _currQueue->begin();
+ while (iter != _currQueue->end() && (*iter).priority <= item.priority) {
+ iter++;
+ }
+ _currQueue->insert(iter, item);
+
+}
+
+void RenderQueue::addText(int16 x, int16 y, byte color, uint fontResIndex, byte *text, int len) {
+
+ Font font(_vm->_res->load(fontResIndex)->data);
+
+ RenderQueueItem item;
+ item.type = kText;
+ item.flags = kRefresh;
+ item.rect = makeRect(x, y, font.getTextWidth(text), font.getHeight());
+ item.priority = 1000;
+
+ item.text.color = color;
+ item.text.fontResIndex = fontResIndex;
+ item.text.text = text;
+ item.text.len = len;
+
+ _currQueue->push_back(item);
+
+}
+
+void RenderQueue::addMask(SegmapMaskRect &mask) {
+
+ RenderQueueItem item;
+ item.type = kMask;
+ item.flags = kRefresh;
+ item.rect = makeRect(mask.x - _vm->_cameraX, mask.y - _vm->_cameraY, mask.width, mask.height);
+ item.priority = mask.priority;
+
+ item.mask = mask;
+
+ // Only add the mask if a sprite intersects its rect
+ if (rectIntersectsItem(item.rect)) {
+ RenderQueueArray::iterator iter = _currQueue->begin();
+ while (iter != _currQueue->end() && (*iter).priority <= item.priority) {
+ iter++;
+ }
+ _currQueue->insert(iter, item);
+ }
+
+}
+
+void RenderQueue::update() {
+
+ bool doFullRefresh = _vm->_screen->_fullRefresh;
+
+ _updateUta->clear();
+
+ if (!doFullRefresh) {
+
+ for (RenderQueueArray::iterator iter = _currQueue->begin(); iter != _currQueue->end(); iter++) {
+ RenderQueueItem *item = &(*iter);
+ RenderQueueItem *prevItem = findItemInQueue(_prevQueue, *item);
+ if (prevItem) {
+ if (hasItemChanged(*prevItem, *item)) {
+ item->flags = kRefresh;
+ addDirtyRect(prevItem->rect);
+ } else {
+ item->flags = kUnchanged;
+ }
+ } else {
+ item->flags = kRefresh;
+ }
+ }
+
+ for (RenderQueueArray::iterator iter = _prevQueue->begin(); iter != _prevQueue->end(); iter++) {
+ RenderQueueItem *prevItem = &(*iter);
+ RenderQueueItem *item = findItemInQueue(_currQueue, *prevItem);
+ if (!item) {
+ prevItem->flags = kRemoved;
+ addDirtyRect(prevItem->rect);
+ }
+ }
+
+ restoreDirtyBackground();
+
+ for (RenderQueueArray::iterator iter = _currQueue->begin(); iter != _currQueue->end(); iter++) {
+ RenderQueueItem *item = &(*iter);
+ if (item->flags != kUnchanged)
+ invalidateItemsByRect(item->rect, item);
+ }
+
+ } else {
+ byte *destp = _vm->_screen->_frontScreen;
+ byte *srcp = _vm->_screen->_backScreen + _vm->_cameraX + _vm->_cameraY * _vm->_sceneWidth;
+ int16 w = MIN<int16>(640, _vm->_sceneWidth);
+ int16 h = MIN<int16>(400, _vm->_cameraHeight);
+ while (h--) {
+ memcpy(destp, srcp, w);
+ destp += 640;
+ srcp += _vm->_sceneWidth;
+ }
+ _vm->_screen->_fullRefresh = false;
+ }
+
+ for (RenderQueueArray::iterator iter = _currQueue->begin(); iter != _currQueue->end(); iter++) {
+ const RenderQueueItem *item = &(*iter);
+
+ if (item->flags == kRefresh || doFullRefresh) {
+
+ switch (item->type) {
+ case kSprite:
+ _vm->_screen->drawSprite(item->sprite);
+ break;
+ case kText:
+ _vm->_screen->drawString(item->rect.left, item->rect.top, item->text.color, item->text.fontResIndex,
+ item->text.text, item->text.len, NULL, true);
+ break;
+ case kMask:
+ _vm->_screen->drawSurface(item->rect.left, item->rect.top, item->mask.surface);
+ break;
+ default:
+ break;
+ }
+
+ if (!doFullRefresh)
+ addDirtyRect(item->rect);
+
+ }
+
+ }
+
+ if (doFullRefresh) {
+ clear();
+ _vm->_system->copyRectToScreen((const byte *)_vm->_screen->_frontScreen, 640, 0, 0, 640, _vm->_cameraHeight);
+ } else {
+ updateDirtyRects();
+ }
+
+ SWAP(_currQueue, _prevQueue);
+ _currQueue->clear();
+
+}
+
+void RenderQueue::clear() {
+ _prevQueue->clear();
+ _currQueue->clear();
+}
+
+bool RenderQueue::rectIntersectsItem(const Common::Rect &rect) {
+ for (RenderQueueArray::iterator iter = _currQueue->begin(); iter != _currQueue->end(); iter++) {
+ const RenderQueueItem *item = &(*iter);
+ if (rect.intersects(item->rect))
+ return true;
+ }
+ return false;
+}
+
+RenderQueueItem *RenderQueue::findItemInQueue(RenderQueueArray *queue, const RenderQueueItem &item) {
+ /* This checks if the given item also exists in the previously drawn frame.
+ The state of the item (position, color etc) is handled elsewhere.
+ */
+ for (RenderQueueArray::iterator iter = queue->begin(); iter != queue->end(); iter++) {
+ RenderQueueItem *prevItem = &(*iter);
+ if (prevItem->type == item.type) {
+ switch (item.type) {
+ case kSprite:
+ if (prevItem->sprite.resIndex == item.sprite.resIndex &&
+ prevItem->sprite.frameNum == item.sprite.frameNum)
+ return prevItem;
+ break;
+ case kText:
+ if (prevItem->text.text == item.text.text &&
+ prevItem->text.len == item.text.len)
+ return prevItem;
+ break;
+ case kMask:
+ if (prevItem->mask.surface == item.mask.surface)
+ return prevItem;
+ break;
+ }
+ }
+ }
+ return NULL; // Not found
+}
+
+bool RenderQueue::hasItemChanged(const RenderQueueItem &item1, const RenderQueueItem &item2) {
+
+ if (item1.type != item2.type)
+ return true;
+
+ if (item1.rect.left != item2.rect.left ||
+ item1.rect.top != item2.rect.top ||
+ item1.rect.right != item2.rect.right ||
+ item1.rect.bottom != item2.rect.bottom)
+ return true;
+
+ if (item1.type == kText && item1.text.color != item2.text.color)
+ return true;
+
+ return false;
+}
+
+void RenderQueue::invalidateItemsByRect(const Common::Rect &rect, const RenderQueueItem *item) {
+ for (RenderQueueArray::iterator iter = _currQueue->begin(); iter != _currQueue->end(); iter++) {
+ RenderQueueItem *subItem = &(*iter);
+ if (item != subItem &&
+ subItem->flags == kUnchanged &&
+ rect.intersects(subItem->rect)) {
+
+ subItem->flags = kRefresh;
+ invalidateItemsByRect(subItem->rect, subItem);
+ }
+ }
+}
+
+void RenderQueue::addDirtyRect(const Common::Rect &rect) {
+ _updateUta->addRect(rect);
+}
+
+void RenderQueue::restoreDirtyBackground() {
+ int n_rects = 0;
+ Common::Rect *rects = _updateUta->getRectangles(&n_rects, 0, 0, 639, _vm->_cameraHeight - 1);
+ for (int i = 0; i < n_rects; i++) {
+ byte *destp = _vm->_screen->_frontScreen + rects[i].left + rects[i].top * 640;
+ byte *srcp = _vm->_screen->_backScreen + (_vm->_cameraX + rects[i].left) + (_vm->_cameraY + rects[i].top) * _vm->_sceneWidth;
+ int16 w = rects[i].width();
+ int16 h = rects[i].height();
+ while (h--) {
+ memcpy(destp, srcp, w);
+ destp += 640;
+ srcp += _vm->_sceneWidth;
+ }
+ invalidateItemsByRect(rects[i], NULL);
+ }
+ delete[] rects;
+}
+
+void RenderQueue::updateDirtyRects() {
+ int n_rects = 0;
+ Common::Rect *rects = _updateUta->getRectangles(&n_rects, 0, 0, 639, _vm->_cameraHeight - 1);
+ for (int i = 0; i < n_rects; i++) {
+ _vm->_system->copyRectToScreen((const byte *)_vm->_screen->_frontScreen + rects[i].left + rects[i].top * 640,
+ 640, rects[i].left, rects[i].top, rects[i].width(), rects[i].height());
+ }
+ delete[] rects;
+}
+
+
+} // End of namespace Toltecs
diff --git a/engines/toltecs/render.h b/engines/toltecs/render.h
new file mode 100644
index 0000000000..bb9ec29959
--- /dev/null
+++ b/engines/toltecs/render.h
@@ -0,0 +1,99 @@
+/* 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 TOLTECS_RENDER_H
+#define TOLTECS_RENDER_H
+
+#include "graphics/surface.h"
+
+#include "toltecs/segmap.h"
+#include "toltecs/screen.h"
+#include "toltecs/microtiles.h"
+
+namespace Toltecs {
+
+enum RenderType {
+ kSprite,
+ kText,
+ kMask
+};
+
+enum RenderFlags {
+ kNone = 1 << 0,
+ kRefresh = 1 << 1,
+ kRemoved = 1 << 2,
+ kMoved = 1 << 3,
+ kUnchanged = 1 << 4
+};
+
+struct RenderTextItem {
+ byte color;
+ uint fontResIndex;
+ byte *text;
+ int len;
+};
+
+struct RenderQueueItem {
+ RenderType type;
+ uint flags;
+ Common::Rect rect;
+ int16 priority;
+ union {
+ SpriteDrawItem sprite;
+ RenderTextItem text;
+ SegmapMaskRect mask;
+ };
+};
+
+class RenderQueue {
+public:
+ RenderQueue(ToltecsEngine *vm);
+ ~RenderQueue();
+
+ void addSprite(SpriteDrawItem &sprite);
+ void addText(int16 x, int16 y, byte color, uint fontResIndex, byte *text, int len);
+ void addMask(SegmapMaskRect &mask);
+ void update();
+ void clear();
+
+protected:
+ typedef Common::List<RenderQueueItem> RenderQueueArray;
+
+ ToltecsEngine *_vm;
+ RenderQueueArray *_currQueue, *_prevQueue;
+ MicroTileArray *_updateUta;
+
+ bool rectIntersectsItem(const Common::Rect &rect);
+ RenderQueueItem *findItemInQueue(RenderQueueArray *queue, const RenderQueueItem &item);
+ bool hasItemChanged(const RenderQueueItem &item1, const RenderQueueItem &item2);
+ void invalidateItemsByRect(const Common::Rect &rect, const RenderQueueItem *item);
+
+ void addDirtyRect(const Common::Rect &rect);
+ void restoreDirtyBackground();
+ void updateDirtyRects();
+
+};
+
+} // End of namespace Toltecs
+
+#endif /* TOLTECS_RENDER_H */
diff --git a/engines/toltecs/resource.cpp b/engines/toltecs/resource.cpp
new file mode 100644
index 0000000000..b95e0444b1
--- /dev/null
+++ b/engines/toltecs/resource.cpp
@@ -0,0 +1,128 @@
+/* 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/file.h"
+
+#include "toltecs/toltecs.h"
+#include "toltecs/resource.h"
+
+namespace Toltecs {
+
+
+/* ArchiveReader */
+
+ArchiveReader::ArchiveReader() {
+}
+
+ArchiveReader::~ArchiveReader() {
+ delete[] _offsets;
+}
+
+void ArchiveReader::openArchive(const char *filename) {
+ open(filename);
+ uint32 firstOffs = readUint32LE();
+ uint count = firstOffs / 4;
+ _offsets = new uint32[count];
+ _offsets[0] = firstOffs;
+ for (uint i = 1; i < count; i++)
+ _offsets[i] = readUint32LE();
+}
+
+uint32 ArchiveReader::openResource(uint resIndex) {
+ uint32 resourceSize = getResourceSize(resIndex);
+ seek(_offsets[resIndex]);
+ return resourceSize;
+}
+
+void ArchiveReader::closeResource() {
+}
+
+uint32 ArchiveReader::getResourceSize(uint resIndex) {
+ return _offsets[resIndex + 1] - _offsets[resIndex];
+}
+
+void ArchiveReader::dump(uint resIndex, const char *prefix) {
+ int32 resourceSize = getResourceSize(resIndex);
+ byte *data = new byte[resourceSize];
+
+ Common::String fn;
+
+ if (prefix)
+ fn = Common::String::format("%s_%04X.0", prefix, resIndex);
+ else
+ fn = Common::String::format("%04X.0", resIndex);
+
+ openResource(resIndex);
+ read(data, resourceSize);
+ closeResource();
+
+ Common::DumpFile o;
+ o.open(fn);
+ o.write(data, resourceSize);
+ o.finalize();
+ o.close();
+
+ delete[] data;
+}
+
+/* ResourceCache */
+
+ResourceCache::ResourceCache(ToltecsEngine *vm) : _vm(vm) {
+}
+
+ResourceCache::~ResourceCache() {
+ purgeCache();
+}
+
+void ResourceCache::purgeCache() {
+ for (ResourceMap::iterator iter = _cache.begin(); iter != _cache.end(); ++iter) {
+ delete[] iter->_value->data;
+ delete iter->_value;
+ iter->_value = 0;
+ }
+
+ _cache.clear();
+}
+
+Resource *ResourceCache::load(uint resIndex) {
+ ResourceMap::iterator item = _cache.find(resIndex);
+ if (item != _cache.end()) {
+ debug(1, "ResourceCache::load(%d) From cache", resIndex);
+ return (*item)._value;
+ } else {
+ debug(1, "ResourceCache::load(%d) From disk", resIndex);
+
+ Resource *resItem = new Resource();
+ resItem->size = _vm->_arc->openResource(resIndex);
+ resItem->data = new byte[resItem->size];
+ _vm->_arc->read(resItem->data, resItem->size);
+ _vm->_arc->closeResource();
+
+ _cache[resIndex] = resItem;
+
+ return resItem;
+
+ }
+}
+
+} // End of namespace Toltecs
diff --git a/engines/toltecs/resource.h b/engines/toltecs/resource.h
new file mode 100644
index 0000000000..7f4694f0f6
--- /dev/null
+++ b/engines/toltecs/resource.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.
+ *
+ *
+ */
+
+#ifndef TOLTECS_RESOURCE_H
+#define TOLTECS_RESOURCE_H
+
+#include "common/file.h"
+#include "common/hashmap.h"
+#include "common/hash-str.h"
+
+#include "engines/engine.h"
+
+namespace Toltecs {
+
+const uint kMaxCacheItems = 1024;
+const uint kMaxCacheSize = 8 * 1024 * 1024; // 8 MB
+
+
+class ArchiveReader : public Common::File {
+public:
+ ArchiveReader();
+ ~ArchiveReader();
+
+ void openArchive(const char *filename);
+
+ // Returns the size of the opened resource
+ uint32 openResource(uint resIndex);
+ // Closes the resource
+ void closeResource();
+ // Returns the size of the resource
+ uint32 getResourceSize(uint resIndex);
+
+ void dump(uint resIndex, const char *prefix = NULL);
+
+protected:
+ uint32 *_offsets;
+
+};
+
+struct Resource {
+ uint32 size;
+ byte *data;
+};
+
+class ResourceCache {
+public:
+ ResourceCache(ToltecsEngine *vm);
+ ~ResourceCache();
+
+ Resource *load(uint resIndex);
+ void purgeCache();
+
+protected:
+ typedef Common::HashMap<uint, Resource*> ResourceMap;
+
+ ToltecsEngine *_vm;
+
+ ResourceMap _cache;
+
+};
+
+
+} // End of namespace Toltecs
+
+#endif /* TOLTECS_H */
diff --git a/engines/toltecs/saveload.cpp b/engines/toltecs/saveload.cpp
new file mode 100644
index 0000000000..c24d2149b0
--- /dev/null
+++ b/engines/toltecs/saveload.cpp
@@ -0,0 +1,233 @@
+/* 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/savefile.h"
+
+#include "graphics/thumbnail.h"
+
+#include "toltecs/toltecs.h"
+#include "toltecs/animation.h"
+#include "toltecs/music.h"
+#include "toltecs/palette.h"
+#include "toltecs/script.h"
+#include "toltecs/screen.h"
+#include "toltecs/sound.h"
+
+namespace Toltecs {
+
+/* TODO:
+ - Save with F7; Load with F9
+ - Saving during an animation (AnimationPlayer) is not working correctly yet
+ - Maybe switch to SCUMM/Tinsel serialization approach?
+*/
+
+#define TOLTECS_SAVEGAME_VERSION 3
+
+ToltecsEngine::kReadSaveHeaderError ToltecsEngine::readSaveHeader(Common::SeekableReadStream *in, bool loadThumbnail, SaveHeader &header) {
+
+ header.version = in->readUint32LE();
+ if (header.version > TOLTECS_SAVEGAME_VERSION)
+ return kRSHEInvalidVersion;
+
+ byte descriptionLen = in->readByte();
+ header.description = "";
+ while (descriptionLen--)
+ header.description += (char)in->readByte();
+
+ if (loadThumbnail) {
+ header.thumbnail = Graphics::loadThumbnail(*in);
+ } else {
+ Graphics::skipThumbnail(*in);
+ }
+
+ // Not used yet, reserved for future usage
+ header.gameID = in->readByte();
+ header.flags = in->readUint32LE();
+
+ if (header.version >= 1) {
+ header.saveDate = in->readUint32LE();
+ header.saveTime = in->readUint32LE();
+ header.playTime = in->readUint32LE();
+ } else {
+ header.saveDate = 0;
+ header.saveTime = 0;
+ header.playTime = 0;
+ }
+
+ return ((in->eos() || in->err()) ? kRSHEIoError : kRSHENoError);
+}
+
+void ToltecsEngine::savegame(const char *filename, const char *description) {
+ Common::OutSaveFile *out;
+ if (!(out = g_system->getSavefileManager()->openForSaving(filename))) {
+ warning("Can't create file '%s', game not saved", filename);
+ return;
+ }
+
+ TimeDate curTime;
+ g_system->getTimeAndDate(curTime);
+
+ // Header start
+ out->writeUint32LE(TOLTECS_SAVEGAME_VERSION);
+
+ byte descriptionLen = strlen(description);
+ out->writeByte(descriptionLen);
+ out->write(description, descriptionLen);
+
+ Graphics::saveThumbnail(*out);
+
+ // Not used yet, reserved for future usage
+ out->writeByte(0);
+ out->writeUint32LE(0);
+ uint32 saveDate = ((curTime.tm_mday & 0xFF) << 24) | (((curTime.tm_mon + 1) & 0xFF) << 16) | ((curTime.tm_year + 1900) & 0xFFFF);
+ uint32 saveTime = ((curTime.tm_hour & 0xFF) << 16) | (((curTime.tm_min) & 0xFF) << 8) | ((curTime.tm_sec) & 0xFF);
+ uint32 playTime = g_engine->getTotalPlayTime() / 1000;
+ out->writeUint32LE(saveDate);
+ out->writeUint32LE(saveTime);
+ out->writeUint32LE(playTime);
+ // Header end
+
+ out->writeUint16LE(_cameraX);
+ out->writeUint16LE(_cameraY);
+ out->writeUint16LE(_cameraHeight);
+
+ out->writeUint16LE(_guiHeight);
+
+ out->writeUint16LE(_sceneWidth);
+ out->writeUint16LE(_sceneHeight);
+ out->writeUint32LE(_sceneResIndex);
+
+ out->writeUint16LE(_walkSpeedX);
+ out->writeUint16LE(_walkSpeedY);
+
+ out->writeUint32LE(_counter01);
+ out->writeUint32LE(_counter02);
+ out->writeByte(_movieSceneFlag ? 1 : 0);
+ out->writeByte(_flag01);
+
+ out->writeUint16LE(_mouseX);
+ out->writeUint16LE(_mouseY);
+ out->writeUint16LE(_mouseDisabled);
+
+ _palette->saveState(out);
+ _script->saveState(out);
+ _anim->saveState(out);
+ _screen->saveState(out);
+ _sound->saveState(out);
+ _music->saveState(out);
+
+ out->finalize();
+ delete out;
+}
+
+void ToltecsEngine::loadgame(const char *filename) {
+ Common::InSaveFile *in;
+ if (!(in = g_system->getSavefileManager()->openForLoading(filename))) {
+ warning("Can't open file '%s', game not loaded", filename);
+ return;
+ }
+
+ SaveHeader header;
+
+ kReadSaveHeaderError errorCode = readSaveHeader(in, false, header);
+
+ if (errorCode != kRSHENoError) {
+ warning("Error loading savegame '%s'", filename);
+ delete in;
+ return;
+ }
+
+ _sound->stopAll();
+ _music->stopSequence();
+ g_engine->setTotalPlayTime(header.playTime * 1000);
+
+ _cameraX = in->readUint16LE();
+ _cameraY = in->readUint16LE();
+ _cameraHeight = in->readUint16LE();
+
+ _guiHeight = in->readUint16LE();
+
+ _sceneWidth = in->readUint16LE();
+ _sceneHeight = in->readUint16LE();
+ _sceneResIndex = in->readUint32LE();
+
+ _walkSpeedX = in->readUint16LE();
+ _walkSpeedY = in->readUint16LE();
+
+ _counter01 = in->readUint32LE();
+ _counter02 = in->readUint32LE();
+ _movieSceneFlag = in->readByte() != 0;
+ _flag01 = in->readByte();
+
+ _mouseX = in->readUint16LE();
+ _mouseY = in->readUint16LE();
+ _mouseDisabled = in->readUint16LE();
+
+ _system->warpMouse(_mouseX, _mouseY);
+ _system->showMouse(_mouseDisabled == 0);
+
+ _palette->loadState(in);
+ _script->loadState(in);
+ _anim->loadState(in);
+ _screen->loadState(in);
+ if (header.version >= 2)
+ _sound->loadState(in);
+ if (header.version >= 3)
+ _music->loadState(in);
+
+ delete in;
+
+ loadScene(_sceneResIndex);
+
+ _newCameraX = _cameraX;
+ _newCameraY = _cameraY;
+}
+
+Common::Error ToltecsEngine::loadGameState(int slot) {
+ const char *fileName = getSavegameFilename(slot);
+ loadgame(fileName);
+ return Common::kNoError;
+}
+
+Common::Error ToltecsEngine::saveGameState(int slot, const Common::String &description) {
+ const char *fileName = getSavegameFilename(slot);
+ savegame(fileName, description.c_str());
+ return Common::kNoError;
+}
+
+const char *ToltecsEngine::getSavegameFilename(int num) {
+ static Common::String filename;
+ filename = getSavegameFilename(_targetName, num);
+ return filename.c_str();
+}
+
+Common::String ToltecsEngine::getSavegameFilename(const Common::String &target, int num) {
+ assert(num >= 0 && num <= 999);
+
+ char extension[5];
+ sprintf(extension, "%03d", num);
+
+ return target + "." + extension;
+}
+
+} // End of namespace Toltecs
diff --git a/engines/toltecs/screen.cpp b/engines/toltecs/screen.cpp
new file mode 100644
index 0000000000..d66ed18d8c
--- /dev/null
+++ b/engines/toltecs/screen.cpp
@@ -0,0 +1,808 @@
+/* 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 "graphics/cursorman.h"
+
+#include "toltecs/toltecs.h"
+#include "toltecs/palette.h"
+#include "toltecs/render.h"
+#include "toltecs/resource.h"
+#include "toltecs/screen.h"
+#include "toltecs/script.h"
+
+namespace Toltecs {
+
+Screen::Screen(ToltecsEngine *vm) : _vm(vm) {
+
+ _frontScreen = new byte[268800];
+ _backScreen = new byte[870400];
+
+ memset(_fontResIndexArray, 0, sizeof(_fontResIndexArray));
+ _fontColor1 = 0;
+ _fontColor2 = 0;
+
+ // Screen shaking
+ _shakeActive = false;
+ _shakeCounterInit = 0;
+ _shakeCounter = 0;
+ _shakePos = 0;
+
+ // Verb line
+ _verbLineNum = 0;
+ memset(_verbLineItems, 0, sizeof(_verbLineItems));
+ _verbLineX = 160;
+ _verbLineY = 2;
+ _verbLineWidth = 20;
+ _verbLineCount = 0;
+
+ // Talk text
+ _talkTextItemNum = 0;
+ memset(_talkTextItems, 0, sizeof(_talkTextItems));
+ _talkTextX = 0;
+ _talkTextY = 0;
+ _talkTextFontColor = 0;
+ _talkTextMaxWidth = 520;
+
+ _renderQueue = new RenderQueue(_vm);
+ _fullRefresh = false;
+ _guiRefresh = false;
+
+}
+
+Screen::~Screen() {
+
+ delete[] _frontScreen;
+ delete[] _backScreen;
+
+ delete _renderQueue;
+
+}
+
+void Screen::unpackRle(byte *source, byte *dest, uint16 width, uint16 height) {
+ int32 size = width * height;
+ while (size > 0) {
+ byte a = *source++;
+ byte b = *source++;
+ if (a == 0) {
+ dest += b;
+ size -= b;
+ } else {
+ b = ((b << 4) & 0xF0) | ((b >> 4) & 0x0F);
+ memset(dest, b, a);
+ dest += a;
+ size -= a;
+ }
+ }
+}
+
+void Screen::loadMouseCursor(uint resIndex) {
+ byte mouseCursor[16 * 16], *mouseCursorP = mouseCursor;
+ byte *cursorData = _vm->_res->load(resIndex)->data;
+ for (int i = 0; i < 32; i++) {
+ byte pixel;
+ byte mask1 = *cursorData++;
+ byte mask2 = *cursorData++;
+ for (int j = 0; j < 8; j++) {
+ pixel = 0xE5;
+ if ((mask2 & 0x80) == 0)
+ pixel = 0xE0;
+ mask2 <<= 1;
+ if ((mask1 & 0x80) == 0)
+ pixel = 0;
+ mask1 <<= 1;
+ *mouseCursorP++ = pixel;
+ }
+ }
+ // FIXME: Where's the cursor hotspot? Using 8, 8 seems good enough for now.
+ CursorMan.replaceCursor((const byte*)mouseCursor, 16, 16, 8, 8, 0);
+}
+
+void Screen::drawGuiImage(int16 x, int16 y, uint resIndex) {
+
+ byte *imageData = _vm->_res->load(resIndex)->data;
+ int16 headerSize = READ_LE_UINT16(imageData);
+ int16 width = imageData[2];
+ int16 height = imageData[3];
+ int16 workWidth = width, workHeight = height;
+ imageData += headerSize;
+
+ byte *dest = _frontScreen + x + (y + _vm->_cameraHeight) * 640;
+
+ //debug(0, "Screen::drawGuiImage() x = %d; y = %d; w = %d; h = %d; resIndex = %d", x, y, width, height, resIndex);
+
+ while (workHeight > 0) {
+ int count = 1;
+ byte pixel = *imageData++;
+ if (pixel & 0x80) {
+ pixel &= 0x7F;
+ count = *imageData++;
+ count += 2;
+ }
+ pixel = pixel + 0xE0;
+ while (count-- && workHeight > 0) {
+ *dest++ = pixel;
+ workWidth--;
+ if (workWidth == 0) {
+ workHeight--;
+ dest += 640 - width;
+ workWidth = width;
+ }
+ }
+ }
+
+ _guiRefresh = true;
+
+}
+
+void Screen::startShakeScreen(int16 shakeCounter) {
+ _shakeActive = true;
+ _shakeCounterInit = shakeCounter;
+ _shakeCounter = shakeCounter;
+ _shakePos = 0;
+}
+
+void Screen::stopShakeScreen() {
+ _shakeActive = false;
+ _vm->_system->setShakePos(0);
+}
+
+void Screen::updateShakeScreen() {
+ if (_shakeActive) {
+ _shakeCounter--;
+ if (_shakeCounter == 0) {
+ _shakeCounter = _shakeCounterInit;
+ _shakePos ^= 8;
+ _vm->_system->setShakePos(_shakePos);
+ }
+ }
+}
+
+void Screen::addStaticSprite(byte *spriteItem) {
+
+ DrawRequest drawRequest;
+ memset(&drawRequest, 0, sizeof(drawRequest));
+
+ drawRequest.y = READ_LE_UINT16(spriteItem + 0);
+ drawRequest.x = READ_LE_UINT16(spriteItem + 2);
+ int16 fragmentId = READ_LE_UINT16(spriteItem + 4);
+ drawRequest.baseColor = _vm->_palette->findFragment(fragmentId) & 0xFF;
+ drawRequest.resIndex = READ_LE_UINT16(spriteItem + 6);
+ drawRequest.flags = READ_LE_UINT16(spriteItem + 8);
+ drawRequest.scaling = 0;
+
+ debug(0, "Screen::addStaticSprite() x = %d; y = %d; baseColor = %d; resIndex = %d; flags = %04X", drawRequest.x, drawRequest.y, drawRequest.baseColor, drawRequest.resIndex, drawRequest.flags);
+
+ addDrawRequest(drawRequest);
+
+}
+
+void Screen::addAnimatedSprite(int16 x, int16 y, int16 fragmentId, byte *data, int16 *spriteArray, bool loop, int mode) {
+
+ //debug(0, "Screen::addAnimatedSprite(%d, %d, %d)", x, y, fragmentId);
+
+ DrawRequest drawRequest;
+ memset(&drawRequest, 0, sizeof(drawRequest));
+
+ drawRequest.x = x;
+ drawRequest.y = y;
+ drawRequest.baseColor = _vm->_palette->findFragment(fragmentId) & 0xFF;
+
+ if (mode == 1) {
+ drawRequest.scaling = _vm->_segmap->getScalingAtPoint(drawRequest.x, drawRequest.y);
+ } else if (mode == 2) {
+ drawRequest.scaling = 0;
+ }
+
+ int16 count = FROM_LE_16(spriteArray[0]);
+
+ //debug(0, "count = %d", count);
+
+ for (int16 index = 1; index <= count; index++) {
+
+ byte *spriteItem = data + FROM_LE_16(spriteArray[index]);
+
+ uint16 loopNum = READ_LE_UINT16(spriteItem + 0) & 0x7FFF;
+ uint16 loopCount = READ_LE_UINT16(spriteItem + 2);
+ uint16 frameNum = READ_LE_UINT16(spriteItem + 4);
+ uint16 frameCount = READ_LE_UINT16(spriteItem + 6);
+ drawRequest.resIndex = READ_LE_UINT16(spriteItem + 8);
+ drawRequest.flags = READ_LE_UINT16(spriteItem + 10 + loopNum * 2);
+
+ debug(0, "Screen::addAnimatedSprite(%d of %d) loopNum = %d; loopCount = %d; frameNum = %d; frameCount = %d; resIndex = %d; flags = %04X, mode = %d",
+ index, count, loopNum, loopCount, frameNum, frameCount, drawRequest.resIndex, drawRequest.flags, mode);
+
+ addDrawRequest(drawRequest);
+
+ frameNum++;
+ if (frameNum == frameCount) {
+ frameNum = 0;
+ loopNum++;
+ if (loopNum == loopCount) {
+ if (loop) {
+ loopNum = 0;
+ } else {
+ loopNum--;
+ }
+ }
+ } else {
+ loopNum |= 0x8000;
+ }
+
+ WRITE_LE_UINT16(spriteItem + 0, loopNum);
+ WRITE_LE_UINT16(spriteItem + 4, frameNum);
+
+ }
+
+}
+
+void Screen::clearSprites() {
+
+}
+
+void Screen::blastSprite(int16 x, int16 y, int16 fragmentId, int16 resIndex, uint16 flags) {
+
+ DrawRequest drawRequest;
+ SpriteDrawItem sprite;
+
+ drawRequest.x = x;
+ drawRequest.y = y;
+ drawRequest.baseColor = _vm->_palette->findFragment(fragmentId) & 0xFF;
+ drawRequest.resIndex = resIndex;
+ drawRequest.flags = flags;
+ drawRequest.scaling = 0;
+
+ if (createSpriteDrawItem(drawRequest, sprite)) {
+ sprite.x -= _vm->_cameraX;
+ sprite.y -= _vm->_cameraY;
+ drawSprite(sprite);
+ }
+
+}
+
+void Screen::updateVerbLine(int16 slotIndex, int16 slotOffset) {
+
+ debug(0, "Screen::updateVerbLine() _verbLineNum = %d; _verbLineX = %d; _verbLineY = %d; _verbLineWidth = %d; _verbLineCount = %d",
+ _verbLineNum, _verbLineX, _verbLineY, _verbLineWidth, _verbLineCount);
+
+ Font font(_vm->_res->load(_fontResIndexArray[0])->data);
+
+ _verbLineItems[_verbLineNum].slotIndex = slotIndex;
+ _verbLineItems[_verbLineNum].slotOffset = slotOffset;
+
+ // First clear the line
+ int16 y = _verbLineY;
+ for (int16 i = 0; i < _verbLineCount; i++) {
+ byte *dest = _frontScreen + _verbLineX - _verbLineWidth / 2 + (y - 1 + _vm->_cameraHeight) * 640;
+ for (int16 j = 0; j < 20; j++) {
+ memset(dest, 0xE0, _verbLineWidth);
+ dest += 640;
+ }
+ y += 18;
+ }
+
+ GuiTextWrapState wrapState;
+ int16 len = 0;
+ wrapState.width = 0;
+ wrapState.destString = wrapState.textBuffer;
+ wrapState.len1 = 0;
+ wrapState.len2 = 0;
+
+ y = _verbLineY;
+
+ memset(wrapState.textBuffer, 0, sizeof(wrapState.textBuffer));
+
+ for (int16 i = 0; i <= _verbLineNum; i++) {
+ wrapState.sourceString = _vm->_script->getSlotData(_verbLineItems[i].slotIndex) + _verbLineItems[i].slotOffset;
+ len = wrapGuiText(_fontResIndexArray[0], _verbLineWidth, wrapState);
+ wrapState.len1 += len;
+ }
+
+ if (_verbLineCount != 1) {
+ int16 charWidth = 0;
+ if (*wrapState.sourceString < 0xF0) {
+ while (*wrapState.sourceString > 0x20 && *wrapState.sourceString < 0xF0 && len > 0) {
+ byte ch = *wrapState.sourceString--;
+ wrapState.len1--;
+ len--;
+ charWidth = font.getCharWidth(ch) + font.getSpacing() - 1;
+ wrapState.width -= charWidth;
+ }
+ wrapState.width += charWidth;
+ wrapState.sourceString++;
+ wrapState.len1 -= len;
+ wrapState.len2 = len + 1;
+
+ drawGuiText(_verbLineX - 1 - (wrapState.width / 2), y, 0xF9, 0xFF, _fontResIndexArray[0], wrapState);
+
+ wrapState.destString = wrapState.textBuffer;
+ wrapState.width = 0;
+ len = wrapGuiText(_fontResIndexArray[0], _verbLineWidth, wrapState);
+ wrapState.len1 += len;
+
+ y += 9;
+ }
+ y += 9;
+ }
+
+ wrapState.len1 -= len;
+ wrapState.len2 = len;
+
+ drawGuiText(_verbLineX - 1 - (wrapState.width / 2), y, 0xF9, 0xFF, _fontResIndexArray[0], wrapState);
+
+ _guiRefresh = true;
+
+}
+
+void Screen::updateTalkText(int16 slotIndex, int16 slotOffset) {
+
+ int16 x, y, maxWidth, width, length;
+ byte durationModifier = 1;
+ byte *textData = _vm->_script->getSlotData(slotIndex) + slotOffset;
+
+ TalkTextItem *item = &_talkTextItems[_talkTextItemNum];
+
+ item->fontNum = 0;
+ item->color = _talkTextFontColor;
+
+ x = CLIP<int16>(_talkTextX - _vm->_cameraX, 120, _talkTextMaxWidth);
+ y = CLIP<int16>(_talkTextY - _vm->_cameraY, 4, _vm->_cameraHeight - 16);
+
+ maxWidth = 624 - ABS(x - 320) * 2;
+
+ while (1) {
+ if (*textData == 0x0A) {
+ x = CLIP<int16>(READ_LE_UINT16(&textData[3]), 120, _talkTextMaxWidth);
+ y = CLIP<int16>(READ_LE_UINT16(&textData[1]), 4, _vm->_cameraHeight - 16);
+ maxWidth = 624 - ABS(x - 320) * 2;
+ textData += 4;
+ } else if (*textData == 0x14) {
+ item->color = ((textData[1] << 4) & 0xF0) | ((textData[1] >> 4) & 0x0F);
+ textData += 2;
+ } else if (*textData == 0x19) {
+ durationModifier = textData[1];
+ textData += 2;
+ } else if (*textData < 0x0A) {
+ item->fontNum = textData[0];
+ // FIXME: Some texts request a font which isn't registered so we change it to a font that is
+ if (_fontResIndexArray[item->fontNum] == 0)
+ item->fontNum = 0;
+ textData += 1;
+ } else
+ break;
+ }
+
+ item->slotIndex = slotIndex;
+ item->slotOffset = textData - _vm->_script->getSlotData(slotIndex);
+
+ width = 0;
+ length = 0;
+
+ item->duration = 0;
+ item->lineCount = 0;
+
+ Font font(_vm->_res->load(_fontResIndexArray[item->fontNum])->data);
+ int16 wordLength, wordWidth;
+
+ while (*textData < 0xF0) {
+ if (*textData == 0x1E) {
+ textData++;
+ addTalkTextRect(font, x, y, length, width, item);
+ width = 0;
+ length = 0;
+ } else {
+ wordLength = 0;
+ wordWidth = 0;
+ while (*textData >= 0x20 && *textData < 0xF0) {
+ byte ch = *textData++;
+ wordLength++;
+ if (ch == 0x20) {
+ wordWidth += font.getWidth();
+ break;
+ } else {
+ wordWidth += font.getCharWidth(ch) + font.getSpacing() - 1;
+ }
+ }
+ if (width + wordWidth > maxWidth + font.getWidth()) {
+ addTalkTextRect(font, x, y, length, width, item);
+ width = wordWidth;
+ length = wordLength;
+ } else {
+ width += wordWidth;
+ length += wordLength;
+ }
+ }
+ }
+
+ addTalkTextRect(font, x, y, length, width, item);
+
+ if (item->lineCount > 0) {
+ int16 ysub = (font.getHeight() - 1) * item->lineCount;
+ if (item->lines[0].y - 4 < ysub)
+ ysub = item->lines[0].y - 4;
+ for (int16 l = 0; l < item->lineCount; l++)
+ item->lines[l].y -= ysub;
+ }
+
+ int16 textDurationMultiplier = item->duration + 8;
+ if (_vm->_doSpeech && *textData == 0xFE) {
+ textDurationMultiplier += 100;
+ }
+ item->duration = 4 * textDurationMultiplier * durationModifier;
+
+}
+
+void Screen::addTalkTextRect(Font &font, int16 x, int16 &y, int16 length, int16 width, TalkTextItem *item) {
+
+ if (width > 0) {
+ TextRect *textRect = &item->lines[item->lineCount];
+ width = width + 1 - font.getSpacing();
+ textRect->width = width;
+ item->duration += length;
+ textRect->length = length;
+ textRect->y = y;
+ textRect->x = CLIP<int16>(x - width / 2, 0, 640);
+ item->lineCount++;
+ }
+
+ y += font.getHeight() - 1;
+
+}
+
+void Screen::addTalkTextItemsToRenderQueue() {
+
+ for (int16 i = 0; i <= _talkTextItemNum; i++) {
+ TalkTextItem *item = &_talkTextItems[i];
+ byte *text = _vm->_script->getSlotData(item->slotIndex) + item->slotOffset;
+
+ if (item->fontNum == -1 || item->duration == 0)
+ continue;
+
+ //item->duration -= _vm->_counter01;
+ item->duration--;
+ if (item->duration < 0)
+ item->duration = 0;
+
+ for (byte j = 0; j < item->lineCount; j++) {
+ _renderQueue->addText(item->lines[j].x, item->lines[j].y, item->color, _fontResIndexArray[item->fontNum],
+ text, item->lines[j].length);
+ text += item->lines[j].length;
+ }
+
+ }
+
+}
+
+int16 Screen::getTalkTextDuration() {
+ return _talkTextItems[_talkTextItemNum].duration;
+}
+
+void Screen::finishTalkTextItems() {
+ for (int16 i = 0; i <= _talkTextItemNum; i++) {
+ _talkTextItems[i].duration = 0;
+ }
+}
+
+void Screen::keepTalkTextItemsAlive() {
+ for (int16 i = 0; i <= _talkTextItemNum; i++) {
+ TalkTextItem *item = &_talkTextItems[i];
+ if (item->fontNum == -1)
+ item->duration = 0;
+ else if (item->duration > 0)
+ item->duration = 2;
+ }
+}
+
+void Screen::registerFont(uint fontIndex, uint resIndex) {
+ _fontResIndexArray[fontIndex] = resIndex;
+}
+
+void Screen::drawGuiTextMulti(byte *textData) {
+
+ int16 x = 0, y = 0;
+
+ // Really strange stuff.
+ for (int i = 30; i >= 0; i--) {
+ if (textData[i] >= 0xF0)
+ break;
+ if (i == 0)
+ return;
+ }
+
+ GuiTextWrapState wrapState;
+ wrapState.sourceString = textData;
+
+ do {
+ if (*wrapState.sourceString == 0x0A) {
+ // Set text position
+ y = wrapState.sourceString[1];
+ x = READ_LE_UINT32(wrapState.sourceString + 2);
+ wrapState.sourceString += 4;
+ } else if (*wrapState.sourceString == 0x0B) {
+ // Inc text position
+ y += wrapState.sourceString[1];
+ x += wrapState.sourceString[2];
+ wrapState.sourceString += 3;
+ } else {
+ wrapState.destString = wrapState.textBuffer;
+ wrapState.width = 0;
+ wrapState.len1 = 0;
+ wrapState.len2 = wrapGuiText(_fontResIndexArray[1], 640, wrapState);
+ drawGuiText(x - wrapState.width / 2, y, _fontColor1, _fontColor2, _fontResIndexArray[1], wrapState);
+ }
+ } while (*wrapState.sourceString != 0xFF);
+
+ _guiRefresh = true;
+
+}
+
+int16 Screen::wrapGuiText(uint fontResIndex, int maxWidth, GuiTextWrapState &wrapState) {
+
+ Font font(_vm->_res->load(fontResIndex)->data);
+ int16 len = 0;
+
+ while (*wrapState.sourceString >= 0x20 && *wrapState.sourceString < 0xF0) {
+ byte ch = *wrapState.sourceString;
+ byte charWidth;
+ if (ch <= 0x20)
+ charWidth = font.getWidth();
+ else
+ charWidth = font.getCharWidth(ch) + font.getSpacing() - 1;
+ if (wrapState.width + charWidth >= maxWidth)
+ break;
+ len++;
+ wrapState.width += charWidth;
+ *wrapState.destString++ = *wrapState.sourceString++;
+ }
+
+ return len;
+
+}
+
+void Screen::drawGuiText(int16 x, int16 y, byte fontColor1, byte fontColor2, uint fontResIndex, GuiTextWrapState &wrapState) {
+
+ debug(0, "Screen::drawGuiText(%d, %d, %d, %d, %d) wrapState.len1 = %d; wrapState.len2 = %d", x, y, fontColor1, fontColor2, fontResIndex, wrapState.len1, wrapState.len2);
+
+ int16 ywobble = 1;
+
+ x = drawString(x + 1, y + _vm->_cameraHeight, fontColor1, fontResIndex, wrapState.textBuffer, wrapState.len1, &ywobble, false);
+ x = drawString(x, y + _vm->_cameraHeight, fontColor2, fontResIndex, wrapState.textBuffer + wrapState.len1, wrapState.len2, &ywobble, false);
+
+}
+
+int16 Screen::drawString(int16 x, int16 y, byte color, uint fontResIndex, const byte *text, int len, int16 *ywobble, bool outline) {
+
+ //debug(0, "Screen::drawString(%d, %d, %d, %d)", x, y, color, fontResIndex);
+
+ Font font(_vm->_res->load(fontResIndex)->data);
+
+ if (len == -1)
+ len = strlen((const char*)text);
+
+ int16 yadd = 0;
+ if (ywobble)
+ yadd = *ywobble;
+
+ while (len--) {
+ byte ch = *text++;
+ if (ch <= 0x20) {
+ x += font.getWidth();
+ } else {
+ drawChar(font, _frontScreen, x, y - yadd, ch, color, outline);
+ x += font.getCharWidth(ch) + font.getSpacing() - 1;
+ yadd = -yadd;
+ }
+ }
+
+ if (ywobble)
+ *ywobble = yadd;
+
+ return x;
+
+}
+
+void Screen::drawChar(const Font &font, byte *dest, int16 x, int16 y, byte ch, byte color, bool outline) {
+
+ int16 charWidth, charHeight;
+ byte *charData;
+
+ dest += x + y * 640;
+
+ charWidth = font.getCharWidth(ch);
+ //charHeight = font.getHeight() - 2;//Why was this here?!
+ charHeight = font.getHeight();
+ charData = font.getCharData(ch);
+
+ while (charHeight--) {
+ byte lineWidth = charWidth;
+ while (lineWidth > 0) {
+ byte count = charData[0] & 0x0F;
+ byte flags = charData[0] & 0xF0;
+ charData++;
+ if ((flags & 0x80) == 0) {
+ if (flags & 0x10) {
+ memset(dest, color, count);
+ } else if (outline) {
+ memset(dest, 0, count);
+ }
+ }
+ dest += count;
+ lineWidth -= count;
+ }
+ dest += 640 - charWidth;
+ }
+
+}
+
+void Screen::drawSurface(int16 x, int16 y, Graphics::Surface *surface) {
+
+ int16 skipX = 0;
+ int16 width = surface->w;
+ int16 height = surface->h;
+ byte *surfacePixels = (byte*)surface->getBasePtr(0, 0);
+ byte *frontScreen;
+
+ // Not on screen, skip
+ if (x + width < 0 || y + height < 0 || x >= 640 || y >= _vm->_cameraHeight)
+ return;
+
+ if (x < 0) {
+ skipX = -x;
+ x = 0;
+ width -= skipX;
+ }
+
+ if (y < 0) {
+ int16 skipY = -y;
+ surfacePixels += surface->w * skipY;
+ y = 0;
+ height -= skipY;
+ }
+
+ if (x + width >= 640) {
+ width -= x + width - 640;
+ }
+
+ if (y + height >= _vm->_cameraHeight) {
+ height -= y + height - _vm->_cameraHeight;
+ }
+
+ frontScreen = _vm->_screen->_frontScreen + x + (y * 640);
+
+ for (int16 h = 0; h < height; h++) {
+ surfacePixels += skipX;
+ for (int16 w = 0; w < width; w++) {
+ if (*surfacePixels != 0xFF)
+ *frontScreen = *surfacePixels;
+ frontScreen++;
+ surfacePixels++;
+ }
+ frontScreen += 640 - width;
+ surfacePixels += surface->w - width - skipX;
+ }
+
+}
+
+void Screen::saveState(Common::WriteStream *out) {
+
+ // Save verb line
+ out->writeUint16LE(_verbLineNum);
+ out->writeUint16LE(_verbLineX);
+ out->writeUint16LE(_verbLineY);
+ out->writeUint16LE(_verbLineWidth);
+ out->writeUint16LE(_verbLineCount);
+ for (int i = 0; i < 8; i++) {
+ out->writeUint16LE(_verbLineItems[i].slotIndex);
+ out->writeUint16LE(_verbLineItems[i].slotOffset);
+ }
+
+ // Save talk text items
+ out->writeUint16LE(_talkTextX);
+ out->writeUint16LE(_talkTextY);
+ out->writeUint16LE(_talkTextMaxWidth);
+ out->writeByte(_talkTextFontColor);
+ out->writeUint16LE(_talkTextItemNum);
+ for (int i = 0; i < 5; i++) {
+ out->writeUint16LE(_talkTextItems[i].duration);
+ out->writeUint16LE(_talkTextItems[i].slotIndex);
+ out->writeUint16LE(_talkTextItems[i].slotOffset);
+ out->writeUint16LE(_talkTextItems[i].fontNum);
+ out->writeByte(_talkTextItems[i].color);
+ out->writeByte(_talkTextItems[i].lineCount);
+ for (int j = 0; j < _talkTextItems[i].lineCount; j++) {
+ out->writeUint16LE(_talkTextItems[i].lines[j].x);
+ out->writeUint16LE(_talkTextItems[i].lines[j].y);
+ out->writeUint16LE(_talkTextItems[i].lines[j].width);
+ out->writeUint16LE(_talkTextItems[i].lines[j].length);
+ }
+ }
+
+ // Save GUI bitmap
+ {
+ byte *gui = _frontScreen + _vm->_cameraHeight * 640;
+ for (int i = 0; i < _vm->_guiHeight; i++) {
+ out->write(gui, 640);
+ gui += 640;
+ }
+ }
+
+ // Save fonts
+ for (int i = 0; i < 10; i++)
+ out->writeUint32LE(_fontResIndexArray[i]);
+ out->writeByte(_fontColor1);
+ out->writeByte(_fontColor2);
+
+}
+
+void Screen::loadState(Common::ReadStream *in) {
+
+ // Load verb line
+ _verbLineNum = in->readUint16LE();
+ _verbLineX = in->readUint16LE();
+ _verbLineY = in->readUint16LE();
+ _verbLineWidth = in->readUint16LE();
+ _verbLineCount = in->readUint16LE();
+ for (int i = 0; i < 8; i++) {
+ _verbLineItems[i].slotIndex = in->readUint16LE();
+ _verbLineItems[i].slotOffset = in->readUint16LE();
+ }
+
+ // Load talk text items
+ _talkTextX = in->readUint16LE();
+ _talkTextY = in->readUint16LE();
+ _talkTextMaxWidth = in->readUint16LE();
+ _talkTextFontColor = in->readByte();
+ _talkTextItemNum = in->readUint16LE();
+ for (int i = 0; i < 5; i++) {
+ _talkTextItems[i].duration = in->readUint16LE();
+ _talkTextItems[i].slotIndex = in->readUint16LE();
+ _talkTextItems[i].slotOffset = in->readUint16LE();
+ _talkTextItems[i].fontNum = in->readUint16LE();
+ _talkTextItems[i].color = in->readByte();
+ _talkTextItems[i].lineCount = in->readByte();
+ for (int j = 0; j < _talkTextItems[i].lineCount; j++) {
+ _talkTextItems[i].lines[j].x = in->readUint16LE();
+ _talkTextItems[i].lines[j].y = in->readUint16LE();
+ _talkTextItems[i].lines[j].width = in->readUint16LE();
+ _talkTextItems[i].lines[j].length = in->readUint16LE();
+ }
+ }
+
+ // Load GUI bitmap
+ {
+ byte *gui = _frontScreen + _vm->_cameraHeight * 640;
+ for (int i = 0; i < _vm->_guiHeight; i++) {
+ in->read(gui, 640);
+ gui += 640;
+ }
+ _guiRefresh = true;
+ }
+
+ // Load fonts
+ for (int i = 0; i < 10; i++)
+ _fontResIndexArray[i] = in->readUint32LE();
+ _fontColor1 = in->readByte();
+ _fontColor2 = in->readByte();
+
+}
+
+} // End of namespace Toltecs
diff --git a/engines/toltecs/screen.h b/engines/toltecs/screen.h
new file mode 100644
index 0000000000..988f59c840
--- /dev/null
+++ b/engines/toltecs/screen.h
@@ -0,0 +1,251 @@
+/* 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 TOLTECS_SCREEN_H
+#define TOLTECS_SCREEN_H
+
+#include "graphics/surface.h"
+#include "toltecs/toltecs.h"
+
+namespace Toltecs {
+
+struct DrawRequest {
+ int16 x, y;
+ int16 resIndex;
+ uint16 flags;
+ int16 baseColor;
+ int8 scaling;
+};
+
+struct SpriteDrawItem {
+ int16 x, y;
+ int16 width, height;
+ int16 origWidth, origHeight;
+ int16 resIndex, frameNum;
+ uint32 offset;
+ int16 xdelta, ydelta;
+ uint16 flags;
+ int16 skipX, yerror;
+ int16 priority;
+ int16 baseColor;
+};
+
+struct SpriteFrameEntry {
+ int16 y, x, h, w;
+ uint32 offset;
+ SpriteFrameEntry() {
+ }
+ SpriteFrameEntry(byte *data) {
+ y = READ_LE_UINT16(data + 0);
+ x = READ_LE_UINT16(data + 2);
+ h = READ_LE_UINT16(data + 4);
+ w = READ_LE_UINT16(data + 6);
+ offset = READ_LE_UINT32(data + 8);
+ }
+};
+
+class Font {
+public:
+ Font(byte *fontData) : _fontData(fontData) {
+ }
+ ~Font() {
+ }
+ int16 getSpacing() const {
+ return _fontData[1];
+ }
+ int16 getHeight() const {
+ return _fontData[2];
+ }
+ int16 getWidth() const {
+ return _fontData[3];
+ }
+ int16 getCharWidth(byte ch) const {
+ return _fontData[4 + (ch - 0x21)];
+ }
+ byte *getCharData(byte ch) const {
+ return _fontData + 0x298 + READ_LE_UINT16(&_fontData[0xE0 + (ch - 0x21) * 2]);
+ }
+ int16 getTextWidth(const byte *text) {
+ int16 width = 0;
+ while (*text && *text < 0xF0) {
+ byte ch = *text++;
+ if (ch <= 0x20) {
+ width += getWidth();
+ } else {
+ width += getCharWidth(ch) + getSpacing() - 1;
+ }
+ }
+ return width;
+ }
+
+protected:
+ byte *_fontData;
+};
+
+struct PixelPacket {
+ byte count;
+ byte pixel;
+};
+
+enum SpriteReaderStatus {
+ kSrsPixelsLeft,
+ kSrsEndOfLine,
+ kSrsEndOfSprite
+};
+
+class SpriteFilter {
+public:
+ SpriteFilter(const SpriteDrawItem &sprite) : _sprite(&sprite) {
+ }
+ virtual ~SpriteFilter() {}
+ virtual SpriteReaderStatus readPacket(PixelPacket &packet) = 0;
+protected:
+ const SpriteDrawItem *_sprite;
+};
+
+struct TextRect {
+ int16 x, y;
+ int16 width, length;
+};
+
+struct TalkTextItem {
+ int16 duration;
+ int16 slotIndex;
+ int16 slotOffset;
+ int16 fontNum;
+ byte color;
+ byte lineCount;
+ TextRect lines[15];
+};
+
+struct GuiTextWrapState {
+ int16 len1, len2;
+ byte *sourceString;
+ byte *destString;
+ int16 width;
+ byte textBuffer[100];
+};
+
+class RenderQueue;
+
+class Screen {
+public:
+ Screen(ToltecsEngine *vm);
+ ~Screen();
+
+ void unpackRle(byte *source, byte *dest, uint16 width, uint16 height);
+
+ void loadMouseCursor(uint resIndex);
+
+ void drawGuiImage(int16 x, int16 y, uint resIndex);
+
+ void startShakeScreen(int16 shakeCounter);
+ void stopShakeScreen();
+ void updateShakeScreen();
+
+ // Sprite list
+ void addStaticSprite(byte *spriteItem);
+ void addAnimatedSprite(int16 x, int16 y, int16 fragmentId, byte *data, int16 *spriteArray, bool loop, int mode);
+ void clearSprites();
+
+ // Sprite drawing
+ void drawSprite(const SpriteDrawItem &sprite);
+ void drawSpriteCore(byte *dest, SpriteFilter &reader, const SpriteDrawItem &sprite);
+ void blastSprite(int16 x, int16 y, int16 fragmentId, int16 resIndex, uint16 flags);
+
+ // Verb line
+ void updateVerbLine(int16 slotIndex, int16 slotOffset);
+
+ // Talk text
+ void updateTalkText(int16 slotIndex, int16 slotOffset);
+ void addTalkTextRect(Font &font, int16 x, int16 &y, int16 length, int16 width, TalkTextItem *item);
+ void addTalkTextItemsToRenderQueue();
+ int16 getTalkTextDuration();
+ void finishTalkTextItems();
+ void keepTalkTextItemsAlive();
+
+ // Font/text
+ void registerFont(uint fontIndex, uint resIndex);
+ void drawGuiTextMulti(byte *textData);
+ int16 wrapGuiText(uint fontResIndex, int maxWidth, GuiTextWrapState &wrapState);
+ void drawGuiText(int16 x, int16 y, byte fontColor1, byte fontColor2, uint fontResIndex, GuiTextWrapState &wrapState);
+
+ int16 drawString(int16 x, int16 y, byte color, uint fontResIndex, const byte *text, int len = -1, int16 *ywobble = NULL, bool outline = false);
+ void drawChar(const Font &font, byte *dest, int16 x, int16 y, byte ch, byte color, bool outline);
+
+ void drawSurface(int16 x, int16 y, Graphics::Surface *surface);
+
+ void saveState(Common::WriteStream *out);
+ void loadState(Common::ReadStream *in);
+
+ uint getFontResIndex(int fontNum) const { return _fontResIndexArray[fontNum]; }
+
+//protected:
+public:
+
+ struct VerbLineItem {
+ int16 slotIndex;
+ int16 slotOffset;
+ };
+
+ struct Rect {
+ int16 x, y, width, height;
+ };
+
+ ToltecsEngine *_vm;
+
+ byte *_frontScreen, *_backScreen;
+
+ uint _fontResIndexArray[10];
+ byte _fontColor1, _fontColor2;
+
+ // Screen shaking
+ bool _shakeActive;
+ int16 _shakeCounterInit, _shakeCounter;
+ int _shakePos;
+
+ // Verb line
+ int16 _verbLineNum;
+ VerbLineItem _verbLineItems[8];
+ int16 _verbLineX, _verbLineY, _verbLineWidth;
+ int16 _verbLineCount;
+
+ // Talk text
+ int16 _talkTextX, _talkTextY;
+ int16 _talkTextMaxWidth;
+ byte _talkTextFontColor;
+ int16 _talkTextItemNum;
+ TalkTextItem _talkTextItems[5];
+
+ RenderQueue *_renderQueue;
+ bool _fullRefresh;
+ bool _guiRefresh;
+
+ bool createSpriteDrawItem(const DrawRequest &drawRequest, SpriteDrawItem &sprite);
+ void addDrawRequest(const DrawRequest &drawRequest);
+
+};
+
+} // End of namespace Toltecs
+
+#endif /* TOLTECS_SCREEN_H */
diff --git a/engines/toltecs/script.cpp b/engines/toltecs/script.cpp
new file mode 100644
index 0000000000..e5fc865f5b
--- /dev/null
+++ b/engines/toltecs/script.cpp
@@ -0,0 +1,1108 @@
+/* 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.
+ *
+ *
+ */
+
+// TODO: Clean up game variable handling and move it to ToltecsEngine
+
+#include "common/error.h"
+
+#include "graphics/cursorman.h"
+
+#include "toltecs/toltecs.h"
+#include "toltecs/animation.h"
+#include "toltecs/menu.h"
+#include "toltecs/movie.h"
+#include "toltecs/music.h"
+#include "toltecs/palette.h"
+#include "toltecs/resource.h"
+#include "toltecs/script.h"
+#include "toltecs/segmap.h"
+#include "toltecs/sound.h"
+
+namespace Toltecs {
+
+ScriptInterpreter::ScriptInterpreter(ToltecsEngine *vm) : _vm(vm) {
+
+ _stack = new byte[kScriptStackSize];
+
+ memset(_slots, 0, sizeof(_slots));
+
+ _savedSp = 0;
+
+ _slots[kMaxScriptSlots - 1].size = 1024;
+ _slots[kMaxScriptSlots - 1].data = new byte[_slots[kMaxScriptSlots - 1].size];
+
+ setupScriptFunctions();
+
+}
+
+ScriptInterpreter::~ScriptInterpreter() {
+ delete[] _stack;
+ for (int i = 0; i < kMaxScriptSlots; i++)
+ delete[] _slots[i].data;
+ for (uint i = 0; i < _scriptFuncs.size(); ++i)
+ delete _scriptFuncs[i];
+}
+
+typedef Common::Functor0Mem<void, ScriptInterpreter> ScriptFunctionF;
+#define RegisterScriptFunction(x) \
+ _scriptFuncs.push_back(new ScriptFunctionF(this, &ScriptInterpreter::x)); \
+ _scriptFuncNames.push_back(#x);
+void ScriptInterpreter::setupScriptFunctions() {
+
+ // 0
+ RegisterScriptFunction(sfNop);
+ RegisterScriptFunction(sfNop);
+ RegisterScriptFunction(sfGetGameVar);
+ RegisterScriptFunction(sfSetGameVar);
+ RegisterScriptFunction(sfUpdateScreen);
+ // 5
+ RegisterScriptFunction(sfGetRandomNumber);
+ RegisterScriptFunction(sfDrawGuiTextMulti);
+ RegisterScriptFunction(sfUpdateVerbLine);
+ RegisterScriptFunction(sfSetFontColor);
+ RegisterScriptFunction(sfGetTalkTextDuration);
+ // 10
+ RegisterScriptFunction(sfTalk);
+ RegisterScriptFunction(sfFindPaletteFragment);
+ RegisterScriptFunction(sfClearPaletteFragments);
+ RegisterScriptFunction(sfAddPaletteFragment);
+ RegisterScriptFunction(sfSetDeltaAnimPalette);
+ // 15
+ RegisterScriptFunction(sfSetUnkPaletteEffect);
+ RegisterScriptFunction(sfBuildColorTransTable);
+ RegisterScriptFunction(sfSetDeltaMainPalette);
+ RegisterScriptFunction(sfLoadScript);
+ RegisterScriptFunction(sfRegisterFont);
+ // 20
+ RegisterScriptFunction(sfLoadAddPalette);
+ RegisterScriptFunction(sfLoadScene);
+ RegisterScriptFunction(sfSetGuiHeight);
+ RegisterScriptFunction(sfFindMouseInRectIndex1);
+ RegisterScriptFunction(sfFindMouseInRectIndex2);
+ // 25
+ RegisterScriptFunction(sfDrawGuiImage);
+ RegisterScriptFunction(sfAddAnimatedSpriteNoLoop);
+ RegisterScriptFunction(sfAddAnimatedSprite);
+ RegisterScriptFunction(sfAddStaticSprite);
+ RegisterScriptFunction(sfAddAnimatedSpriteScaled);
+ // 30
+ RegisterScriptFunction(sfFindPath);
+ RegisterScriptFunction(sfWalk);
+ RegisterScriptFunction(sfScrollCameraUp);
+ RegisterScriptFunction(sfScrollCameraDown);
+ RegisterScriptFunction(sfScrollCameraLeft);
+ // 35
+ RegisterScriptFunction(sfScrollCameraRight);
+ RegisterScriptFunction(sfScrollCameraUpEx);
+ RegisterScriptFunction(sfScrollCameraDownEx);
+ RegisterScriptFunction(sfScrollCameraLeftEx);
+ RegisterScriptFunction(sfScrollCameraRightEx);
+ // 40
+ RegisterScriptFunction(sfSetCamera);
+ RegisterScriptFunction(sfGetCameraChanged);
+ RegisterScriptFunction(sfGetRgbModifiertAtPoint);
+ RegisterScriptFunction(sfStartAnim);
+ RegisterScriptFunction(sfAnimNextFrame);
+ // 45
+ RegisterScriptFunction(sfNop);
+ RegisterScriptFunction(sfGetAnimFrameNumber);
+ RegisterScriptFunction(sfGetAnimStatus);
+ RegisterScriptFunction(sfStartShakeScreen);
+ RegisterScriptFunction(sfStopShakeScreen);
+ // 50
+ RegisterScriptFunction(sfStartSequence);
+ RegisterScriptFunction(sfEndSequence);
+ RegisterScriptFunction(sfSetSequenceVolume);
+ RegisterScriptFunction(sfPlayPositionalSound);
+ RegisterScriptFunction(sfPlaySound2);
+ // 55
+ RegisterScriptFunction(sfClearScreen);
+ RegisterScriptFunction(sfNop);
+ RegisterScriptFunction(sfHandleInput);
+ RegisterScriptFunction(sfRunOptionsScreen);
+ RegisterScriptFunction(sfPrecacheSprites);
+ // 60
+ RegisterScriptFunction(sfPrecacheSounds1);
+ RegisterScriptFunction(sfDeletePrecachedFiles);
+ RegisterScriptFunction(sfPrecacheSounds2);
+ RegisterScriptFunction(sfRestoreStackPtr);
+ RegisterScriptFunction(sfSaveStackPtr);
+ // 65
+ RegisterScriptFunction(sfPlayMovie);
+ RegisterScriptFunction(sfNop);
+
+}
+
+void ScriptInterpreter::loadScript(uint resIndex, uint slotIndex) {
+
+ delete[] _slots[slotIndex].data;
+
+ _slots[slotIndex].resIndex = resIndex;
+ Resource *scriptResource = _vm->_res->load(resIndex);
+ _slots[slotIndex].size = scriptResource->size;
+ _slots[slotIndex].data = new byte[_slots[slotIndex].size];
+ memcpy(_slots[slotIndex].data, scriptResource->data, _slots[slotIndex].size);
+
+}
+
+void ScriptInterpreter::setMainScript(uint slotIndex) {
+ _switchLocalDataNear = true;
+ _switchLocalDataFar = false;
+ _switchLocalDataToStack = false;
+ _cmpBitTest = false;
+ _regs.reg0 = 0;
+ _regs.reg1 = 0;
+ _regs.reg2 = 0;
+ _regs.reg3 = 0;
+ _regs.reg4 = slotIndex;
+ _regs.reg5 = 0;
+ _regs.reg6 = 0;
+ _regs.sp = 4096;
+ _regs.reg8 = 0;
+ _code = getSlotData(_regs.reg4);
+}
+
+void ScriptInterpreter::runScript() {
+ uint32 lastScreenUpdate = 0;
+
+ while (!_vm->shouldQuit()) {
+
+ if (_vm->_movieSceneFlag)
+ _vm->_mouseButton = 0;
+
+ if (_vm->_saveLoadRequested != 0) {
+ if (_vm->_saveLoadRequested == 1)
+ _vm->loadGameState(_vm->_saveLoadSlot);
+ else if (_vm->_saveLoadRequested == 2)
+ _vm->saveGameState(_vm->_saveLoadSlot, _vm->_saveLoadDescription);
+ _vm->_saveLoadRequested = 0;
+ }
+
+ if (_switchLocalDataNear) {
+ _switchLocalDataNear = false;
+ _localData = getSlotData(_regs.reg4);
+ }
+
+ if (_switchLocalDataFar) {
+ _switchLocalDataFar = false;
+ _localData = getSlotData(_regs.reg5);
+ _switchLocalDataNear = true;
+ }
+
+ if (_switchLocalDataToStack) {
+ _switchLocalDataToStack = false;
+ _localData = _stack + 2;
+ _switchLocalDataNear = true;
+ }
+
+ byte opcode = readByte();
+ execOpcode(opcode);
+
+ // Update the screen at semi-regular intervals, else the mouse
+ // cursor will be jerky.
+ uint32 now = _vm->_system->getMillis();
+ if (now < lastScreenUpdate || now - lastScreenUpdate > 10) {
+ _vm->_system->updateScreen();
+ lastScreenUpdate = _vm->_system->getMillis();
+ }
+
+ }
+
+}
+
+byte ScriptInterpreter::readByte() {
+ return *_code++;
+}
+
+int16 ScriptInterpreter::readInt16() {
+ int16 value = READ_LE_UINT16(_code);
+ _code += 2;
+ return value;
+}
+
+void ScriptInterpreter::execOpcode(byte opcode) {
+
+ int16 ofs;
+
+ debug(1, "opcode = %d", opcode);
+
+ switch (opcode) {
+ case 0:
+ {
+ // ok
+ _subCode = _code;
+ byte length = readByte();
+ debug(1, "length = %d", length);
+ uint16 index = readInt16();
+ debug(1, "callScriptFunction %d", index);
+ execScriptFunction(index);
+ _code += length - 2;
+ break;
+ }
+ case 1:
+ // ok
+ _regs.reg0 = readInt16();
+ break;
+ case 2:
+ // ok
+ _regs.reg1 = readInt16();
+ break;
+ case 3:
+ // ok
+ _regs.reg3 = readInt16();
+ break;
+ case 4:
+ // ok
+ _regs.reg5 = _regs.reg0;
+ break;
+ case 5:
+ // ok
+ _regs.reg3 = _regs.reg0;
+ break;
+ case 6:
+ // ok
+ _regs.reg1 = _regs.reg0;
+ break;
+ case 7:
+ _regs.reg1 = localRead16(_regs.reg3);
+ break;
+ case 8:
+ localWrite16(_regs.reg3, _regs.reg0);
+ break;
+ case 9:
+ localWrite16(readInt16(), _regs.reg0);
+ break;
+ case 10:
+ localWrite8(readInt16(), _regs.reg0);
+ break;
+ case 11:
+ localWrite16(readInt16(), _regs.reg5);
+ break;
+ case 12:
+ localWrite16(readInt16(), _regs.reg4);
+ break;
+ case 13:
+ localWrite16(readInt16(), _regs.reg3);
+ break;
+ case 14:
+ _regs.reg3 = localRead16(readInt16());
+ break;
+ case 15:
+ _regs.reg2 = localRead16(_regs.reg1);
+ break;
+ case 16:
+ _regs.reg2 = localRead16(_regs.reg1 + readInt16());
+ break;
+ case 17:
+ _regs.reg2 = _regs.reg0;
+ break;
+ case 18:
+ _regs.reg0 += readInt16();
+ break;
+ case 19:
+ localWrite16(_regs.reg3, localRead16(_regs.reg3) + _regs.reg0);
+ break;
+ case 20:
+ _regs.reg0 += _regs.reg2;
+ break;
+ case 21:
+ _regs.reg3 += _regs.sp;
+ break;
+ case 22:
+ _regs.reg1 += _regs.sp;
+ break;
+ case 23:
+ localWrite16(_regs.reg3, localRead16(_regs.reg3) - _regs.reg0);
+ break;
+ case 24:
+ _regs.reg0 /= readInt16();
+ break;
+ case 25:
+ localWrite16(_regs.reg3, localRead16(_regs.reg3) / _regs.reg0);
+ break;
+ case 26:
+ // NOP
+ break;
+ case 27:
+ _regs.reg0 *= readInt16();
+ break;
+ case 28:
+ localWrite16(_regs.reg3, localRead16(_regs.reg3) * _regs.reg0);
+ break;
+ case 29:
+ _regs.reg0 *= _regs.reg2;
+ break;
+ case 30:
+ localWrite16(_regs.reg3, localRead16(_regs.reg3) + 1);
+ break;
+ case 31:
+ localWrite16(_regs.reg3, localRead16(_regs.reg3) - 1);
+ break;
+ case 32:
+ _switchLocalDataFar = true;
+ break;
+ case 33:
+ _switchLocalDataToStack = true;
+ break;
+ case 34:
+ pushInt16(_regs.reg0);
+ break;
+ case 35:
+ pushInt16(_regs.reg1);
+ break;
+ case 36:
+ _regs.reg1 = popInt16();
+ break;
+ case 37:
+ _regs.reg0 = popInt16();
+ break;
+ case 38:
+ _regs.reg2 = -_regs.reg2;
+ break;
+ case 39:
+ _regs.reg8 = readInt16();
+ _cmpBitTest = false;
+ break;
+ case 40:
+ _regs.reg8 = _regs.reg0;
+ _cmpBitTest = false;
+ break;
+ case 41:
+ _regs.reg8 = readInt16();
+ _cmpBitTest = true;
+ break;
+ case 42:
+ _regs.reg8 = _regs.reg0;
+ _cmpBitTest = true;
+ break;
+ case 43:
+ _code = getSlotData(_regs.reg4) + _regs.reg0;
+ break;
+ case 44:
+ _code = getSlotData(_regs.reg5) + _regs.reg0;
+ _regs.reg4 = _regs.reg5;
+ _switchLocalDataNear = true;
+ break;
+ case 45:
+ pushInt16(_code - getSlotData(_regs.reg4));
+ pushInt16(_regs.reg4);
+ _code = getSlotData(_regs.reg4) + _regs.reg0;
+ break;
+ case 46:
+ pushInt16(_code - getSlotData(_regs.reg4));
+ pushInt16(_regs.reg4);
+ _code = getSlotData(_regs.reg5) + _regs.reg0;
+ _regs.reg4 = _regs.reg5;
+ _switchLocalDataNear = true;
+ break;
+ case 47:
+ _regs.reg4 = popInt16();
+ ofs = popInt16();
+ _code = getSlotData(_regs.reg4) + ofs;
+ _switchLocalDataNear = true;
+ break;
+ case 48:
+ _regs.reg4 = popInt16();
+ ofs = popInt16();
+ _code = getSlotData(_regs.reg4) + ofs;
+ _regs.sp += _regs.reg0;
+ _switchLocalDataNear = true;
+ break;
+ case 49:
+ ofs = readByte();
+ _code += ofs;
+ break;
+ case 50:
+ if (_cmpBitTest) {
+ _regs.reg1 &= _regs.reg8;
+ if (_regs.reg1 == 0)
+ _code += 4;
+ } else {
+ if (_regs.reg1 == _regs.reg8)
+ _code += 4;
+ }
+ _code++;
+ break;
+ case 51:
+ if (_cmpBitTest) {
+ _regs.reg1 &= _regs.reg8;
+ if (_regs.reg1 != 0)
+ _code += 4;
+ } else {
+ if (_regs.reg1 != _regs.reg8)
+ _code += 4;
+ }
+ _code++;
+ break;
+ case 52:
+ if ((uint16)_regs.reg1 >= (uint16)_regs.reg8)
+ _code += 4;
+ _code++;
+ break;
+ case 53:
+ if ((uint16)_regs.reg1 <= (uint16)_regs.reg8)
+ _code += 4;
+ _code++;
+ break;
+ case 54:
+ if ((uint16)_regs.reg1 < (uint16)_regs.reg8)
+ _code += 4;
+ _code++;
+ break;
+ case 55:
+ if ((uint16)_regs.reg1 > (uint16)_regs.reg8)
+ _code += 4;
+ _code++;
+ break;
+ default:
+ error("Invalid opcode %d", opcode);
+ }
+
+}
+
+void ScriptInterpreter::execScriptFunction(uint16 index) {
+ debug(4, "execScriptFunction(%d)", index);
+ if (index >= _scriptFuncs.size())
+ error("ScriptInterpreter::execScriptFunction() Invalid script function index %d", index);
+ debug(4, "%s", _scriptFuncNames[index]);
+ (*_scriptFuncs[index])();
+}
+
+VarType ScriptInterpreter::getGameVarType(uint variable) {
+ switch (variable) {
+ case 0: return vtByte;
+ case 1: return vtWord;
+ case 2: return vtWord;
+ case 3: return vtByte;
+ case 4: return vtWord;
+ case 5: return vtWord;
+ case 6: return vtWord;
+ case 7: return vtWord;
+ case 8: return vtWord;
+ case 9: return vtWord;
+ case 10: return vtWord;
+ case 11: return vtWord;
+ case 12: return vtByte;
+ case 13: return vtWord;
+ case 14: return vtWord;
+ case 15: return vtWord;
+ case 16: return vtWord;
+ case 17: return vtWord;
+ case 18: return vtWord;
+ case 19: return vtWord;
+ case 20: return vtWord;
+ case 21: return vtWord;
+ default:
+ error("Invalid game variable");
+ }
+}
+
+const char *getVarName(uint variable) {
+ switch (variable) {
+ case 0: return "mouseDisabled";
+ case 1: return "mouseY";
+ case 2: return "mouseX";
+ case 3: return "mouseButton";
+ case 4: return "verbLineY";
+ case 5: return "verbLineX";
+ case 6: return "verbLineWidth";
+ case 7: return "verbLineCount";
+ case 8: return "verbLineNum";
+ case 9: return "talkTextItemNum";
+ case 10: return "talkTextY";
+ case 11: return "talkTextX";
+ case 12: return "talkTextFontColor";
+ case 13: return "cameraY";
+ case 14: return "cameraX";
+ case 15: return "walkSpeedY";
+ case 16: return "walkSpeedX";
+ case 17: return "flag01";
+ case 18: return "sceneResIndex";
+ case 19: return "guiHeight";
+ case 20: return "sceneHeight";
+ case 21: return "sceneWidth";
+ }
+ return "(invalid)";
+}
+
+int16 ScriptInterpreter::getGameVar(uint variable) {
+ debug(0, "ScriptInterpreter::getGameVar(%d{%s})", variable, getVarName(variable));
+
+ switch (variable) {
+ case 0: return _vm->_mouseDisabled;
+ case 1: return _vm->_mouseY;
+ case 2: return _vm->_mouseX;
+ case 3: return _vm->_mouseButton;
+ case 4: return _vm->_screen->_verbLineY;
+ case 5: return _vm->_screen->_verbLineX;
+ case 6: return _vm->_screen->_verbLineWidth;
+ case 7: return _vm->_screen->_verbLineCount;
+ case 8: return _vm->_screen->_verbLineNum;
+ case 9: return _vm->_screen->_talkTextItemNum;
+ case 10: return _vm->_screen->_talkTextY;
+ case 11: return _vm->_screen->_talkTextX;
+ case 12: return _vm->_screen->_talkTextFontColor;
+ case 13: return _vm->_cameraY;
+ case 14: return _vm->_cameraX;
+ case 15: return _vm->_walkSpeedY;
+ case 16: return _vm->_walkSpeedX;
+ case 17: return _vm->_flag01;
+ case 18: return _vm->_sceneResIndex;
+ case 19: return _vm->_guiHeight;
+ case 20: return _vm->_sceneHeight;
+ case 21: return _vm->_sceneWidth;
+ default:
+ warning("Getting unimplemented game variable %s (%d)", getVarName(variable), variable);
+ return 0;
+ }
+}
+
+void ScriptInterpreter::setGameVar(uint variable, int16 value) {
+ debug(0, "ScriptInterpreter::setGameVar(%d{%s}, %d)", variable, getVarName(variable), value);
+
+ switch (variable) {
+ case 0:
+ _vm->_mouseDisabled = value;
+ CursorMan.showMouse(value == 0);
+ break;
+ case 3:
+ _vm->_mouseButton = value;
+ break;
+ case 4:
+ _vm->_screen->_verbLineY = value;
+ break;
+ case 5:
+ _vm->_screen->_verbLineX = value;
+ break;
+ case 6:
+ _vm->_screen->_verbLineWidth = value;
+ break;
+ case 7:
+ _vm->_screen->_verbLineCount = value;
+ break;
+ case 8:
+ _vm->_screen->_verbLineNum = value;
+ break;
+ case 9:
+ _vm->_screen->_talkTextItemNum = value;
+ break;
+ case 10:
+ _vm->_screen->_talkTextY = value;
+ break;
+ case 11:
+ _vm->_screen->_talkTextX = value;
+ break;
+ case 12:
+ _vm->_screen->_talkTextFontColor = value;
+ break;
+ case 13:
+ _vm->_cameraY = value;
+ break;
+ case 14:
+ _vm->_cameraX = value;
+ break;
+ case 15:
+ _vm->_walkSpeedY = value;
+ break;
+ case 16:
+ _vm->_walkSpeedX = value;
+ break;
+ case 17:
+ _vm->_flag01 = value != 0;
+ break;
+ case 18:
+ _vm->_sceneResIndex = value;
+ break;
+ case 19:
+ _vm->_guiHeight = value;
+ break;
+ case 20:
+ _vm->_sceneHeight = value;
+ break;
+ case 21:
+ _vm->_sceneWidth = value;
+ break;
+ case 1:
+ case 2:
+ default:
+ warning("Setting unimplemented game variable %s (%d) to %d", getVarName(variable), variable, value);
+ break;
+ }
+
+}
+
+byte ScriptInterpreter::arg8(int16 offset) {
+ return _subCode[offset];
+}
+
+int16 ScriptInterpreter::arg16(int16 offset) {
+ return READ_LE_UINT16(&_subCode[offset]);
+}
+
+void ScriptInterpreter::pushInt16(int16 value) {
+ WRITE_LE_UINT16(_stack + _regs.sp, value);
+ _regs.sp -= 2;
+}
+
+int16 ScriptInterpreter::popInt16() {
+ _regs.sp += 2;
+ return READ_LE_UINT16(_stack + _regs.sp);
+}
+
+void ScriptInterpreter::localWrite8(int16 offset, byte value) {
+ //debug(1, "localWrite8(%d, %d)", offset, value);
+ _localData[offset] = value;
+}
+
+byte ScriptInterpreter::localRead8(int16 offset) {
+ //debug(1, "localRead8(%d) -> %d", offset, _localData[offset]);
+ return _localData[offset];
+}
+
+void ScriptInterpreter::localWrite16(int16 offset, int16 value) {
+ //debug(1, "localWrite16(%d, %d)", offset, value);
+ WRITE_LE_UINT16(&_localData[offset], value);
+}
+
+int16 ScriptInterpreter::localRead16(int16 offset) {
+ //debug(1, "localRead16(%d) -> %d", offset, (int16)READ_LE_UINT16(&_localData[offset]));
+ return (int16)READ_LE_UINT16(&_localData[offset]);
+}
+
+byte *ScriptInterpreter::localPtr(int16 offset) {
+ //debug(1, "localPtr(%d)", offset);
+ return &_localData[offset];
+}
+
+void ScriptInterpreter::saveState(Common::WriteStream *out) {
+
+ // Save registers
+ out->writeUint16LE(_regs.reg0);
+ out->writeUint16LE(_regs.reg1);
+ out->writeUint16LE(_regs.reg2);
+ out->writeUint16LE(_regs.reg3);
+ out->writeUint16LE(_regs.reg4);
+ out->writeUint16LE(_regs.reg5);
+ out->writeUint16LE(_regs.reg6);
+ out->writeUint16LE(_regs.sp);
+ out->writeUint16LE(_regs.reg8);
+
+ // Save slots
+ for (int slot = 0; slot < kMaxScriptSlots; slot++) {
+ out->writeUint32LE(_slots[slot].size);
+ out->writeUint16LE(_slots[slot].resIndex);
+ if (_slots[slot].size > 0)
+ out->write(_slots[slot].data, _slots[slot].size);
+ }
+
+ // Save stack
+ out->write(_stack, kScriptStackSize);
+ out->writeUint16LE(_savedSp);
+
+ // Save IP
+ out->writeUint16LE((int16)(_code - getSlotData(_regs.reg4)));
+
+}
+
+void ScriptInterpreter::loadState(Common::ReadStream *in) {
+
+ // Load registers
+ _regs.reg0 = in->readUint16LE();
+ _regs.reg1 = in->readUint16LE();
+ _regs.reg2 = in->readUint16LE();
+ _regs.reg3 = in->readUint16LE();
+ _regs.reg4 = in->readUint16LE();
+ _regs.reg5 = in->readUint16LE();
+ _regs.reg6 = in->readUint16LE();
+ _regs.sp = in->readUint16LE();
+ _regs.reg8 = in->readUint16LE();
+
+ // Load slots
+ for (int slot = 0; slot < kMaxScriptSlots; slot++) {
+ _slots[slot].size = in->readUint32LE();
+ _slots[slot].resIndex = in->readUint16LE();
+ _slots[slot].data = NULL;
+ if (_slots[slot].size > 0) {
+ _slots[slot].data = new byte[_slots[slot].size];
+ in->read(_slots[slot].data, _slots[slot].size);
+ }
+ }
+
+ // Load stack
+ in->read(_stack, kScriptStackSize);
+ _savedSp = in->readUint16LE();
+
+ // Load IP
+ _code = getSlotData(_regs.reg4) + in->readUint16LE();
+
+}
+
+void ScriptInterpreter::sfNop() {
+ // NOP
+}
+
+void ScriptInterpreter::sfGetGameVar() {
+ int16 value = getGameVar(arg16(3));
+ localWrite16(arg16(5), value);
+}
+
+void ScriptInterpreter::sfSetGameVar() {
+ int16 varIndex = arg16(3);
+ VarType varType = getGameVarType(varIndex);
+ int16 value = 0;
+ if (varType == vtByte)
+ value = arg8(5);
+ else if (varType == vtWord)
+ value = arg16(5);
+ setGameVar(varIndex, value);
+}
+
+void ScriptInterpreter::sfUpdateScreen() {
+ _vm->updateScreen();
+}
+
+void ScriptInterpreter::sfGetRandomNumber() {
+ localWrite16(arg16(5), _vm->_rnd->getRandomNumber(arg16(3) - 1));
+}
+
+void ScriptInterpreter::sfDrawGuiTextMulti() {
+ _vm->_screen->drawGuiTextMulti((byte*)localPtr(arg16(3)));
+}
+
+void ScriptInterpreter::sfUpdateVerbLine() {
+ _vm->_screen->updateVerbLine(arg16(5), arg16(3));
+}
+
+void ScriptInterpreter::sfSetFontColor() {
+ _vm->_screen->_fontColor1 = 0;
+ _vm->_screen->_fontColor2 = arg8(3);
+}
+
+void ScriptInterpreter::sfGetTalkTextDuration() {
+ localWrite16(arg16(3), _vm->_screen->getTalkTextDuration());
+}
+
+void ScriptInterpreter::sfTalk() {
+ _vm->talk(arg16(5), arg16(3));
+}
+
+void ScriptInterpreter::sfFindPaletteFragment() {
+ localWrite16(arg16(5), _vm->_palette->findFragment(arg16(3)));
+}
+
+void ScriptInterpreter::sfClearPaletteFragments() {
+ _vm->_palette->clearFragments();
+}
+
+void ScriptInterpreter::sfAddPaletteFragment() {
+ _vm->_palette->addFragment(arg16(3), arg16(5));
+}
+
+void ScriptInterpreter::sfSetDeltaAnimPalette() {
+ _vm->_palette->setDeltaPalette(_vm->_palette->getAnimPalette(), arg8(6), (char)arg8(5), arg8(4), arg8(3));
+}
+
+void ScriptInterpreter::sfSetUnkPaletteEffect() {
+ // TODO
+ debug("ScriptInterpreter::sfSetUnkPaletteEffect");
+}
+
+void ScriptInterpreter::sfBuildColorTransTable() {
+ _vm->_palette->buildColorTransTable(arg8(4), (char)arg8(3), arg8(5));
+}
+
+void ScriptInterpreter::sfSetDeltaMainPalette() {
+ _vm->_palette->setDeltaPalette(_vm->_palette->getMainPalette(), arg8(6), (char)arg8(5), arg8(4), arg8(3));
+}
+
+void ScriptInterpreter::sfLoadScript() {
+ int16 codeOfs = _code - getSlotData(_regs.reg4);
+ loadScript(arg16(4), arg8(3));
+ _code = getSlotData(_regs.reg4) + codeOfs;
+ _switchLocalDataNear = true;
+}
+
+void ScriptInterpreter::sfRegisterFont() {
+ _vm->_screen->registerFont(arg8(3), arg16(4));
+}
+
+void ScriptInterpreter::sfLoadAddPalette() {
+ _vm->_palette->loadAddPalette(arg16(4), arg8(3));
+}
+
+void ScriptInterpreter::sfLoadScene() {
+ if (arg8(3) == 0) {
+ // FIXME: Originally, this was stopSpeech(). However, we need to stop
+ // ALL sounds here (including sound effects and background sounds)
+ // before purgeCache() is called, otherwise the sound buffers will be
+ // invalidated. This is apparent when moving from a scene that has
+ // background sounds (such as the canyon at the beginning), to another
+ // one that doesn't (such as the map), and does not stop the sounds
+ // already playing. In this case, the engine will either crash or
+ // garbage will be heard through the speakers.
+ // TODO: We should either move purgeCache() elsewhere, or monitor
+ // which resources are still used before purging the cache.
+ _vm->_sound->stopAll();
+ _vm->_res->purgeCache();
+ _vm->loadScene(arg16(4));
+ } else {
+ _vm->_screen->loadMouseCursor(arg16(4));
+ }
+}
+
+void ScriptInterpreter::sfSetGuiHeight() {
+ _vm->setGuiHeight(arg8(3));
+}
+
+void ScriptInterpreter::sfFindMouseInRectIndex1() {
+ int16 index = -1;
+ if (_vm->_mouseY < _vm->_cameraHeight) {
+ int16 slotIndex = arg16(5);
+ index = _vm->findRectAtPoint(getSlotData(slotIndex) + arg16(3),
+ _vm->_mouseX + _vm->_cameraX,
+ _vm->_mouseY + _vm->_cameraY,
+ arg16(11) + 1, arg16(7),
+ getSlotData(slotIndex) + _slots[slotIndex].size);
+ }
+ localWrite16(arg16(9), index);
+}
+
+void ScriptInterpreter::sfFindMouseInRectIndex2() {
+ int16 index = -1;
+ if (_vm->_sceneResIndex != 0) {
+ if (_vm->_mouseY < _vm->_cameraHeight) {
+ int16 slotIndex = arg16(5);
+ index = _vm->findRectAtPoint(getSlotData(slotIndex) + arg16(3),
+ _vm->_mouseX + _vm->_cameraX,
+ _vm->_mouseY + _vm->_cameraY,
+ 0, arg16(7),
+ getSlotData(slotIndex) + _slots[slotIndex].size);
+ }
+ }
+ localWrite16(arg16(9), index);
+}
+
+void ScriptInterpreter::sfDrawGuiImage() {
+ _vm->_screen->drawGuiImage(arg16(5), arg16(3), arg16(7));
+}
+
+void ScriptInterpreter::sfAddAnimatedSpriteNoLoop() {
+ _vm->_screen->addAnimatedSprite(arg16(5), arg16(3), arg16(7), (byte*)localPtr(0), (int16*)localPtr(arg16(9)), false, 2);
+}
+
+void ScriptInterpreter::sfAddAnimatedSprite() {
+ _vm->_screen->addAnimatedSprite(arg16(5), arg16(3), arg16(7), (byte*)localPtr(0), (int16*)localPtr(arg16(9)), true, 2);
+}
+
+void ScriptInterpreter::sfAddStaticSprite() {
+ _vm->_screen->addStaticSprite(_subCode + 3);
+}
+
+void ScriptInterpreter::sfAddAnimatedSpriteScaled() {
+ _vm->_screen->addAnimatedSprite(arg16(5), arg16(3), arg16(7), (byte*)localPtr(0), (int16*)localPtr(arg16(9)), true, 1);
+}
+
+void ScriptInterpreter::sfFindPath() {
+ _vm->_segmap->findPath((int16*)(getSlotData(arg16(13)) + arg16(11)), arg16(9), arg16(7), arg16(5), arg16(3));
+}
+
+void ScriptInterpreter::sfWalk() {
+ _vm->walk(getSlotData(arg16(5)) + arg16(3));
+}
+
+void ScriptInterpreter::sfScrollCameraUp() {
+ _vm->scrollCameraUp(4);
+}
+
+void ScriptInterpreter::sfScrollCameraDown() {
+ _vm->scrollCameraDown(4);
+}
+
+void ScriptInterpreter::sfScrollCameraLeft() {
+ _vm->scrollCameraLeft(4);
+}
+
+void ScriptInterpreter::sfScrollCameraRight() {
+ _vm->scrollCameraRight(4);
+}
+
+void ScriptInterpreter::sfScrollCameraUpEx() {
+ _vm->scrollCameraUp(arg16(3));
+}
+
+void ScriptInterpreter::sfScrollCameraDownEx() {
+ _vm->scrollCameraDown(arg16(3));
+}
+
+void ScriptInterpreter::sfScrollCameraLeftEx() {
+ _vm->scrollCameraLeft(arg16(3));
+}
+
+void ScriptInterpreter::sfScrollCameraRightEx() {
+ _vm->scrollCameraRight(arg16(3));
+}
+
+void ScriptInterpreter::sfSetCamera() {
+ _vm->setCamera(arg16(5), arg16(3));
+}
+
+void ScriptInterpreter::sfGetCameraChanged() {
+ localWrite16(arg16(3), _vm->getCameraChanged() ? 1 : 0);
+}
+
+void ScriptInterpreter::sfGetRgbModifiertAtPoint() {
+ byte *rgb = getSlotData(arg16(11)) + arg16(9);
+ _vm->_segmap->getRgbModifiertAtPoint(arg16(5), arg16(3), arg16(7), rgb[0], rgb[1], rgb[2]);
+}
+
+void ScriptInterpreter::sfStartAnim() {
+ _vm->_anim->start(arg16(3));
+}
+
+void ScriptInterpreter::sfAnimNextFrame() {
+ _vm->_anim->nextFrame();
+}
+
+void ScriptInterpreter::sfGetAnimFrameNumber() {
+ localWrite16(arg16(3), _vm->_anim->getFrameNumber());
+}
+
+void ScriptInterpreter::sfGetAnimStatus() {
+ int16 status = _vm->_anim->getStatus();
+ if (status == 0 || status == 1) {
+ // TODO mov screenFlag01, 0
+ }
+ localWrite16(arg16(3), status);
+}
+
+void ScriptInterpreter::sfStartShakeScreen() {
+ _vm->_screen->startShakeScreen(arg16(3));
+}
+
+void ScriptInterpreter::sfStopShakeScreen() {
+ _vm->_screen->stopShakeScreen();
+}
+
+void ScriptInterpreter::sfStartSequence() {
+ int16 sequenceResIndex = arg16(3);
+ //debug("ScriptInterpreter::sfStartSequence(%d)", sequenceResIndex);
+ if (sequenceResIndex >= 0) {
+ //_vm->_arc->dump(sequenceResIndex, "music"); // DEBUG: Dump music so we know what's in there
+
+ _vm->_music->playSequence(sequenceResIndex);
+ }
+}
+
+void ScriptInterpreter::sfEndSequence() {
+ //debug("ScriptInterpreter::sfEndSequence");
+ _vm->_music->stopSequence();
+}
+
+void ScriptInterpreter::sfSetSequenceVolume() {
+ // TODO
+ //debug("ScriptInterpreter::sfSetSequenceVolume");
+}
+
+void ScriptInterpreter::sfPlayPositionalSound() {
+ _vm->_sound->playSoundAtPos(arg16(3), arg16(9), arg16(7));
+}
+
+void ScriptInterpreter::sfPlaySound2() {
+ _vm->_sound->playSound(arg16(3), arg16(5), arg16(7));
+}
+
+void ScriptInterpreter::sfClearScreen() {
+ // TODO: Occurs on every scene change, but seems unneeded
+ //debug("ScriptInterpreter::sfClearScreen");
+}
+
+void ScriptInterpreter::sfHandleInput() {
+ int16 varOfs = arg16(3);
+ int16 keyCode = 0;
+ if (_vm->_rightButtonDown) {
+ keyCode = 1;
+ } else {
+ /* Convert keyboard scancode to IBM PC scancode
+ Only scancodes known to be used (so far) are converted
+ */
+ switch (_vm->_keyState.keycode) {
+ case Common::KEYCODE_ESCAPE:
+ keyCode = 1;
+ break;
+ case Common::KEYCODE_F10:
+ keyCode = 68;
+ break;
+ default:
+ break;
+ }
+ }
+ localWrite16(varOfs, keyCode);
+}
+
+void ScriptInterpreter::sfRunOptionsScreen() {
+ _vm->_screen->loadMouseCursor(12);
+ _vm->_palette->loadAddPalette(9, 224);
+ _vm->_palette->setDeltaPalette(_vm->_palette->getMainPalette(), 7, 0, 31, 224);
+ _vm->_screen->finishTalkTextItems();
+ _vm->_screen->clearSprites();
+ CursorMan.showMouse(true);
+ _vm->_menuSystem->run();
+ _vm->_keyState.reset();
+ _switchLocalDataNear = true;
+}
+
+/* NOTE: The opcodes sfPrecacheSprites, sfPrecacheSounds1, sfPrecacheSounds2 and
+ sfDeletePrecachedFiles were used by the original engine to handle precaching
+ of data so the game doesn't stall while playing (due to the slow speed of
+ CD-Drives back then). This is not needed in ScummVM since all supported
+ systems are fast enough to load data in-game. */
+
+void ScriptInterpreter::sfPrecacheSprites() {
+ // See note above
+}
+
+void ScriptInterpreter::sfPrecacheSounds1() {
+ // See note above
+}
+
+void ScriptInterpreter::sfDeletePrecachedFiles() {
+ // See note above
+}
+
+void ScriptInterpreter::sfPrecacheSounds2() {
+ // See note above
+}
+
+void ScriptInterpreter::sfRestoreStackPtr() {
+ _regs.sp = _savedSp;
+}
+
+void ScriptInterpreter::sfSaveStackPtr() {
+ _savedSp = _regs.sp;
+}
+
+void ScriptInterpreter::sfPlayMovie() {
+ _vm->_moviePlayer->playMovie(arg16(3));
+}
+
+} // End of namespace Toltecs
diff --git a/engines/toltecs/script.h b/engines/toltecs/script.h
new file mode 100644
index 0000000000..1a5a9c90ad
--- /dev/null
+++ b/engines/toltecs/script.h
@@ -0,0 +1,184 @@
+/* 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 TOLTECS_SCRIPT_H
+#define TOLTECS_SCRIPT_H
+
+#include "common/func.h"
+
+namespace Toltecs {
+
+const int kMaxScriptSlots = 50;
+const int kScriptStackSize = 4096 + 4;
+
+enum VarType {
+ vtByte,
+ vtWord
+};
+
+typedef Common::Functor0<void> ScriptFunction;
+
+class ScriptInterpreter {
+public:
+ ScriptInterpreter(ToltecsEngine *vm);
+ ~ScriptInterpreter();
+
+ void loadScript(uint resIndex, uint slotIndex);
+ void setMainScript(uint slotIndex);
+ void runScript();
+
+ byte *getSlotData(int slotIndex) const { return _slots[slotIndex].data; }
+
+ VarType getGameVarType(uint variable);
+ int16 getGameVar(uint variable);
+ void setGameVar(uint variable, int16 value);
+
+ void saveState(Common::WriteStream *out);
+ void loadState(Common::ReadStream *in);
+
+protected:
+
+ struct ScriptRegs {
+ int16 reg0;
+ int16 reg1;
+ int16 reg2;
+ int16 reg3;
+ int16 reg4;
+ int16 reg5;
+ int16 reg6;
+ int16 sp;
+ int16 reg8;
+ };
+
+ struct ScriptSlot {
+ byte *data;
+ int32 size;
+ uint resIndex;
+ };
+
+ ToltecsEngine *_vm;
+ Common::Array<const ScriptFunction*> _scriptFuncs;
+ Common::Array<const char *> _scriptFuncNames;
+
+ byte *_stack;
+
+ byte *_code, *_subCode;
+ byte *_localData;
+ bool _switchLocalDataNear, _switchLocalDataFar, _switchLocalDataToStack;
+ bool _cmpBitTest;
+
+ ScriptSlot _slots[kMaxScriptSlots];
+
+ ScriptRegs _regs;
+ int16 _savedSp;
+
+ byte readByte();
+ int16 readInt16();
+
+ void execOpcode(byte opcode);
+
+ void setupScriptFunctions();
+ void execScriptFunction(uint16 index);
+
+ byte arg8(int16 offset);
+ int16 arg16(int16 offset);
+
+ void pushInt16(int16 value);
+ int16 popInt16();
+
+ void localWrite8(int16 offset, byte value);
+ byte localRead8(int16 offset);
+ void localWrite16(int16 offset, int16 value);
+ int16 localRead16(int16 offset);
+ byte *localPtr(int16 offset);
+
+ void sfNop();
+ void sfGetGameVar();
+ void sfSetGameVar();
+ void sfUpdateScreen();
+ void sfGetRandomNumber();
+ void sfDrawGuiTextMulti();
+ void sfUpdateVerbLine();
+ void sfSetFontColor();
+ void sfGetTalkTextDuration();
+ void sfTalk();
+ void sfFindPaletteFragment();
+ void sfClearPaletteFragments();
+ void sfAddPaletteFragment();
+ void sfSetDeltaAnimPalette();
+ void sfSetUnkPaletteEffect();
+ void sfBuildColorTransTable();
+ void sfSetDeltaMainPalette();
+ void sfLoadScript();
+ void sfRegisterFont();
+ void sfLoadAddPalette();
+ void sfLoadScene();
+ void sfSetGuiHeight();
+ void sfFindMouseInRectIndex1();
+ void sfFindMouseInRectIndex2();
+ void sfDrawGuiImage();
+ void sfAddAnimatedSpriteNoLoop();
+ void sfAddAnimatedSprite();
+ void sfAddStaticSprite();
+ void sfAddAnimatedSpriteScaled();
+ void sfFindPath();
+ void sfWalk();
+ void sfScrollCameraUp();
+ void sfScrollCameraDown();
+ void sfScrollCameraLeft();
+ void sfScrollCameraRight();
+ void sfScrollCameraUpEx();
+ void sfScrollCameraDownEx();
+ void sfScrollCameraLeftEx();
+ void sfScrollCameraRightEx();
+ void sfSetCamera();
+ void sfGetCameraChanged();
+ void sfGetRgbModifiertAtPoint();
+ void sfStartAnim();
+ void sfAnimNextFrame();
+ void sfGetAnimFrameNumber();
+ void sfGetAnimStatus();
+ void sfStartShakeScreen();
+ void sfStopShakeScreen();
+ void sfStartSequence();
+ void sfEndSequence();
+ void sfSetSequenceVolume();
+ void sfPlayPositionalSound();
+ void sfPlaySound2();
+ void sfClearScreen();
+ void sfHandleInput();
+ void sfRunOptionsScreen();
+ void sfPrecacheSprites();
+ void sfPrecacheSounds1();
+ void sfDeletePrecachedFiles();
+ void sfPrecacheSounds2();
+ void sfRestoreStackPtr();
+ void sfSaveStackPtr();
+ void sfPlayMovie();
+
+};
+
+
+} // End of namespace Toltecs
+
+#endif /* TOLTECS_H */
diff --git a/engines/toltecs/segmap.cpp b/engines/toltecs/segmap.cpp
new file mode 100644
index 0000000000..10e5f56096
--- /dev/null
+++ b/engines/toltecs/segmap.cpp
@@ -0,0 +1,408 @@
+/* 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 "toltecs/toltecs.h"
+#include "toltecs/render.h"
+#include "toltecs/segmap.h"
+
+namespace Toltecs {
+
+SegmentMap::SegmentMap(ToltecsEngine *vm) : _vm(vm) {
+}
+
+SegmentMap::~SegmentMap() {
+ freeSegmapMaskRectSurfaces();
+}
+
+void SegmentMap::load(byte *source) {
+
+ freeSegmapMaskRectSurfaces();
+ _maskRects.clear();
+ _pathRects.clear();
+ _infoRects.clear();
+
+ // Load mask rects
+ byte *maskData = source + 2;
+ uint16 maskSize = READ_LE_UINT16(source);
+ source += 2;
+ uint16 maskRectCount = READ_LE_UINT16(source);
+ source += 2;
+ uint16 maskRectDataSize = maskRectCount * 12 + 2;
+
+ debug(0, "SegmentMap::load() maskRectCount = %d", maskRectCount);
+
+ for (uint16 i = 0; i < maskRectCount; i++) {
+ SegmapMaskRect maskRect;
+ int16 maskOffset;
+ maskRect.y = READ_LE_UINT16(source);
+ maskRect.x = READ_LE_UINT16(source + 2);
+ maskRect.height = READ_LE_UINT16(source + 4);
+ maskRect.width = READ_LE_UINT16(source + 6);
+ maskOffset = READ_LE_UINT16(source + 8);
+ maskRect.priority = READ_LE_UINT16(source + 10);
+ loadSegmapMaskRectSurface(maskData + maskOffset, maskRect);
+
+ debug(0, "SegmentMap::load() (%d, %d, %d, %d, %04X, %d)",
+ maskRect.x, maskRect.y, maskRect.width, maskRect.height, maskOffset, maskRect.priority);
+
+ source += 12;
+ _maskRects.push_back(maskRect);
+ }
+
+ source += maskSize - maskRectDataSize;
+
+ // Load path rects
+
+ source += 2; // skip rects array size
+
+ uint16 pathRectCount = READ_LE_UINT16(source);
+ source += 2;
+
+ debug(0, "SegmentMap::load() pathRectCount = %d", pathRectCount);
+
+ for (uint16 i = 0; i < pathRectCount; i++) {
+ SegmapPathRect pathRect;
+ pathRect.y1 = READ_LE_UINT16(source);
+ pathRect.x1 = READ_LE_UINT16(source + 2);
+ pathRect.y2 = pathRect.y1 + READ_LE_UINT16(source + 4);
+ pathRect.x2 = pathRect.x1 + READ_LE_UINT16(source + 6);
+
+ debug(0, "SegmentMap::load() (%d, %d, %d, %d)", pathRect.x1, pathRect.y1, pathRect.x2, pathRect.y2);
+
+ source += 8;
+ _pathRects.push_back(pathRect);
+ }
+
+ // Load info rects
+
+ source += 2; // skip rects array size
+
+ uint16 infoRectCount = READ_LE_UINT16(source);
+ source += 2;
+ debug(0, "SegmentMap::load() infoRectCount = %d", infoRectCount);
+ for (uint16 i = 0; i < infoRectCount; i++) {
+ SegmapInfoRect infoRect;
+ infoRect.y = READ_LE_UINT16(source);
+ infoRect.x = READ_LE_UINT16(source + 2);
+ infoRect.height = READ_LE_UINT16(source + 4);
+ infoRect.width = READ_LE_UINT16(source + 6);
+ infoRect.id = source[8];
+ infoRect.a = source[9];
+ infoRect.b = source[10];
+ infoRect.c = source[11];
+
+ debug(0, "SegmentMap::load() (%d, %d, %d, %d) (%d, %d, %d, %d)",
+ infoRect.x, infoRect.y, infoRect.width, infoRect.height,
+ infoRect.id, (int8)infoRect.a, (int8)infoRect.b, (int8)infoRect.c);
+
+ source += 12;
+ _infoRects.push_back(infoRect);
+ }
+
+ // TODO Other stuff
+
+
+}
+
+int16 SegmentMap::findPathRectAtPoint(int16 x, int16 y) {
+ for (int16 rectIndex = 0; rectIndex < (int16)_pathRects.size(); rectIndex++) {
+ if (y >= _pathRects[rectIndex].y1 && y <= _pathRects[rectIndex].y2 &&
+ x >= _pathRects[rectIndex].x1 && x <= _pathRects[rectIndex].x2) {
+ return rectIndex;
+ }
+ }
+ return -1;
+}
+
+void SegmentMap::adjustPathPoint(int16 &x, int16 &y) {
+
+ if (findPathRectAtPoint(x, y) != -1)
+ return;
+
+ uint32 minDistance = 0xFFFFFFFF, distance;
+ int16 adjustedX = 0, adjustedY = 0, x2, y2;
+
+ for (int16 rectIndex = 0; rectIndex < (int16)_pathRects.size(); rectIndex++) {
+
+ if (x >= _pathRects[rectIndex].x1 && x < _pathRects[rectIndex].x2) {
+ x2 = x;
+ } else if (ABS(x - _pathRects[rectIndex].x1) >= ABS(x - _pathRects[rectIndex].x2)) {
+ x2 = _pathRects[rectIndex].x2;
+ } else {
+ x2 = _pathRects[rectIndex].x1;
+ }
+
+ if (ABS(y - _pathRects[rectIndex].y1) >= ABS(y - _pathRects[rectIndex].y2)) {
+ y2 = _pathRects[rectIndex].y2;
+ } else {
+ y2 = _pathRects[rectIndex].y1;
+ }
+
+ distance = ABS(y - y2) + ABS(x - x2);
+ if (distance < minDistance) {
+ if (x >= _pathRects[rectIndex].x1 && x <= _pathRects[rectIndex].x2) {
+ adjustedX = x;
+ } else {
+ adjustedX = x2;
+ }
+ if (y >= _pathRects[rectIndex].y1 && y <= _pathRects[rectIndex].y2) {
+ adjustedY = y;
+ } else {
+ adjustedY = y2;
+ }
+ minDistance = distance;
+ }
+
+ }
+
+ x = adjustedX;
+ y = adjustedY;
+
+}
+
+int16 SegmentMap::findNextPathRect(int16 srcRectIndex, int16 destX, int16 destY) {
+
+ int16 result;
+ uint16 minDistance, distance;
+ int16 x1, y1, x2, y2;
+ int16 xmin, xmax, ymax, ymin;
+
+ result = -1;
+ minDistance = 0xFFFF;
+
+ x1 = _pathRects[srcRectIndex].x1;
+ y1 = _pathRects[srcRectIndex].y1;
+ x2 = _pathRects[srcRectIndex].x2;
+ y2 = _pathRects[srcRectIndex].y2;
+
+ for (int16 rectIndex = 0; rectIndex < (int16)_pathRects.size(); rectIndex++) {
+
+ int16 nodeX = -1, nodeY = -1;
+
+ // Check if the current rectangle is connected to the source rectangle
+ if (x1 == _pathRects[rectIndex].x2 && y1 < _pathRects[rectIndex].y2 && y2 > _pathRects[rectIndex].y1) {
+ nodeX = x1;
+ } else if (x2 == _pathRects[rectIndex].x1 && y1 < _pathRects[rectIndex].y2 && y2 > _pathRects[rectIndex].y1) {
+ nodeX = x2 - 1;
+ } else if (y1 == _pathRects[rectIndex].y2 && x1 < _pathRects[rectIndex].x2 && x2 > _pathRects[rectIndex].x1) {
+ nodeY = y1;
+ } else if (y2 == _pathRects[rectIndex].y1 && x1 < _pathRects[rectIndex].x2 && x2 > _pathRects[rectIndex].x1) {
+ nodeY = y2 - 1;
+ } else
+ continue;
+
+ if (nodeX == -1) {
+ xmin = MAX<int16>(x1, _pathRects[rectIndex].x1);
+ xmax = MIN<int16>(x2, _pathRects[rectIndex].x2) - 1;
+ if (destX > xmin && destX < xmax) {
+ nodeX = destX;
+ } else if (ABS(destX - xmin) >= ABS(destX - xmax)) {
+ nodeX = xmax - 1;
+ } else {
+ nodeX = xmin;
+ }
+ }
+
+ if (nodeY == -1) {
+ ymin = MAX<int16>(y1, _pathRects[rectIndex].y1);
+ ymax = MIN<int16>(y2, _pathRects[rectIndex].y2) - 1;
+ if (destY > ymin && destY < ymax) {
+ nodeY = destY;
+ } else if (ABS(destY - ymin) >= ABS(destY - ymax)) {
+ nodeY = ymax - 1;
+ } else {
+ nodeY = ymin;
+ }
+ }
+
+ distance = ABS(destX - nodeX) + ABS(destY - nodeY);
+
+ for (uint i = 0; i < _closedPathRectsCount; i++) {
+ if (rectIndex == _closedPathRects[i]) {
+ distance = minDistance;
+ break;
+ }
+ }
+
+ for (uint i = 0; i < _deadEndPathRectsCount; i++) {
+ if (rectIndex == _deadEndPathRects[i]) {
+ distance = minDistance;
+ break;
+ }
+ }
+
+ if (distance < minDistance) {
+ result = rectIndex;
+ minDistance = distance;
+ _pathNodes[_pathNodesCount].x = nodeX;
+ _pathNodes[_pathNodesCount].y = nodeY;
+ }
+
+ }
+
+ return result;
+}
+
+struct LineData {
+ int pitch;
+ byte *surf;
+};
+
+void plotProc(int x, int y, int color, void *data) {
+ LineData *ld = (LineData*)data;
+ ld->surf[x + y * ld->pitch] = color;
+}
+
+void SegmentMap::findPath(int16 *pointsArray, int16 destX, int16 destY, int16 sourceX, int16 sourceY) {
+
+ int16 currentRectIndex, destRectIndex;
+ int16 pointsCount;
+
+ debug(0, "SegmentMap::findPath(fromX: %d; fromY: %d; toX: %d; toY: %d)", sourceX, sourceY, destX, destY);
+
+ _deadEndPathRectsCount = 0;
+ _closedPathRectsCount = 0;
+ _pathNodesCount = 0;
+
+ pointsCount = 2;
+
+ adjustPathPoint(sourceX, sourceY);
+ currentRectIndex = findPathRectAtPoint(sourceX, sourceY);
+
+ adjustPathPoint(destX, destY);
+ destRectIndex = findPathRectAtPoint(destX, destY);
+
+ if (currentRectIndex != -1) {
+ if (destRectIndex != currentRectIndex) {
+ while (1) {
+ do {
+ _closedPathRects[_closedPathRectsCount++] = currentRectIndex;
+ currentRectIndex = findNextPathRect(currentRectIndex, destX, destY);
+ _pathNodesCount++;
+ } while (currentRectIndex != -1 && currentRectIndex != destRectIndex);
+ if (currentRectIndex != -1 && currentRectIndex == destRectIndex)
+ break;
+ _deadEndPathRects[_deadEndPathRectsCount++] = _closedPathRects[--_closedPathRectsCount];
+ _pathNodesCount -= 2;
+ currentRectIndex = _closedPathRects[--_closedPathRectsCount];
+ }
+ for (int16 i = 0; i < _pathNodesCount; i++) {
+ pointsArray[pointsCount++] = TO_LE_16(_pathNodes[i].y);
+ pointsArray[pointsCount++] = TO_LE_16(_pathNodes[i].x);
+ }
+ }
+
+ pointsArray[pointsCount++] = TO_LE_16(destY);
+ pointsArray[pointsCount++] = TO_LE_16(destX);
+
+ pointsArray[0] = 0;
+ pointsArray[1] = TO_LE_16(_pathNodesCount + 1);
+ }
+
+ debug(0, "SegmentMap::findPath() count = %d", FROM_LE_16(pointsArray[1]));
+
+#if 0 // DEBUG: Draw the path we found
+ int sx = sourceX, sy = sourceY;
+ LineData ld;
+ ld.pitch = _vm->_sceneWidth;
+ ld.surf = _vm->_screen->_backScreen;
+ for (int16 i = 0; i < FROM_LE_16(pointsArray[1]) * 2; i+=2) {
+ const int x = FROM_LE_16(pointsArray[3+i]);
+ const int y = FROM_LE_16(pointsArray[2+1]);
+ debug(0, "x = %d; y = %d", x, y);
+ Graphics::drawLine(sx, sy, x, y, 0xFF, plotProc, &ld);
+ sx = x;
+ sy = y;
+ }
+#endif
+
+}
+
+int8 SegmentMap::getScalingAtPoint(int16 x, int16 y) {
+ int8 scaling = 0;
+ for (uint i = 0; i < _infoRects.size(); i++) {
+ if (_infoRects[i].id == 0 && _infoRects[i].isPointInside(x, y)) {
+ int8 topScaling = (int8)_infoRects[i].b;
+ int8 bottomScaling = (int8)_infoRects[i].c;
+ if (y - _infoRects[i].y != 0) {
+ scaling = (ABS(y - _infoRects[i].y) * (bottomScaling - topScaling) / _infoRects[i].height) + topScaling;
+ }
+ }
+ }
+ debug(0, "SegmentMap::getScalingAtPoint(%d, %d) %d", x, y, scaling);
+ return scaling;
+}
+
+void SegmentMap::getRgbModifiertAtPoint(int16 x, int16 y, int16 id, byte &r, byte &g, byte &b) {
+ r = 0;
+ g = 0;
+ b = 0;
+ for (uint i = 0; i < _infoRects.size(); i++) {
+ if (_infoRects[i].id == id && _infoRects[i].isPointInside(x, y)) {
+ r = _infoRects[i].a;
+ g = _infoRects[i].b;
+ b = _infoRects[i].c;
+ }
+ }
+ debug(0, "SegmentMap::getRgbModifiertAtPoint() r: %d; g: %d; b: %d", r, g, b);
+}
+
+void SegmentMap::loadSegmapMaskRectSurface(byte *maskData, SegmapMaskRect &maskRect) {
+
+ maskRect.surface = new Graphics::Surface();
+ maskRect.surface->create(maskRect.width, maskRect.height, Graphics::PixelFormat::createFormatCLUT8());
+
+ byte *backScreen = _vm->_screen->_backScreen + maskRect.x + (maskRect.y * _vm->_sceneWidth);
+ byte *dest = (byte*)maskRect.surface->getBasePtr(0, 0);
+
+ for (int16 h = 0; h < maskRect.height; h++) {
+ int16 w = maskRect.width;
+ while (w > 0) {
+ byte mask = *maskData++;
+ byte count = mask & 0x7F;
+ if (mask & 0x80)
+ memcpy(dest, backScreen, count);
+ else
+ memset(dest, 0xFF, count);
+ w -= count;
+ dest += count;
+ backScreen += count;
+ }
+ backScreen += _vm->_sceneWidth - maskRect.width;
+ }
+
+}
+
+void SegmentMap::freeSegmapMaskRectSurfaces() {
+ for (uint i = 0; i < _maskRects.size(); i++) {
+ delete _maskRects[i].surface;
+ }
+}
+
+void SegmentMap::addMasksToRenderQueue() {
+ for (uint i = 0; i < _maskRects.size(); i++) {
+ _vm->_screen->_renderQueue->addMask(_maskRects[i]);
+ }
+}
+
+} // End of namespace Toltecs
diff --git a/engines/toltecs/segmap.h b/engines/toltecs/segmap.h
new file mode 100644
index 0000000000..30182a6b71
--- /dev/null
+++ b/engines/toltecs/segmap.h
@@ -0,0 +1,116 @@
+/* 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 TOLTECS_SEGMAP_H
+#define TOLTECS_SEGMAP_H
+
+#include "common/array.h"
+
+#include "toltecs/screen.h"
+
+namespace Toltecs {
+
+struct ScriptWalk {
+ int16 y, x;
+ int16 y1, x1, y2, x2;
+ int16 yerror, xerror;
+ int16 mulValue;
+ int16 scaling;
+};
+
+struct SegmapMaskRect {
+ int16 x, y;
+ int16 width, height;
+ int16 priority;
+ Graphics::Surface *surface;
+};
+
+class SegmentMap {
+public:
+ SegmentMap(ToltecsEngine *vm);
+ ~SegmentMap();
+
+ void load(byte *source);
+
+ int16 findPathRectAtPoint(int16 x, int16 y);
+ void adjustPathPoint(int16 &x, int16 &y);
+
+ void findPath(int16 *pointsArray, int16 destX, int16 destY, int16 sourceX, int16 sourceY);
+
+ int8 getScalingAtPoint(int16 x, int16 y);
+ void getRgbModifiertAtPoint(int16 x, int16 y, int16 id, byte &r, byte &g, byte &b);
+
+ void addMasksToRenderQueue();
+
+//protected:
+public: // for debugging purposes
+
+ struct SegmapPathRect {
+ int16 x1, y1, x2, y2;
+ };
+
+ struct SegmapInfoRect {
+ int16 y, x;
+ int16 height, width;
+ byte id;
+ byte a, b, c;
+ inline bool isPointInside(int16 px, int16 py) {
+ return py >= y && py <= y + height && px >= x && px <= x + width;
+ }
+ };
+
+ struct PathPoint {
+ int16 y, x;
+ };
+
+ typedef Common::Array<SegmapMaskRect> SegmapMaskRectArray;
+ typedef Common::Array<SegmapPathRect> SegmapPathRectArray;
+ typedef Common::Array<SegmapInfoRect> SegmapInfoRectArray;
+
+ ToltecsEngine *_vm;
+
+ SegmapMaskRectArray _maskRects;
+ byte *_maskRectData;
+
+ SegmapPathRectArray _pathRects;
+ SegmapInfoRectArray _infoRects;
+
+ int16 _deadEndPathRects[1000];
+ uint _deadEndPathRectsCount;
+
+ int16 _closedPathRects[1000];
+ uint _closedPathRectsCount;
+
+ PathPoint _pathNodes[1000];
+ int16 _pathNodesCount;
+
+ int16 findNextPathRect(int16 srcRectIndex, int16 destX, int16 destY);
+
+ void loadSegmapMaskRectSurface(byte *maskData, SegmapMaskRect &maskRect);
+ void freeSegmapMaskRectSurfaces();
+
+};
+
+} // End of namespace Toltecs
+
+#endif /* TOLTECS_SEGMAP_H */
diff --git a/engines/toltecs/sound.cpp b/engines/toltecs/sound.cpp
new file mode 100644
index 0000000000..c9ef00e31b
--- /dev/null
+++ b/engines/toltecs/sound.cpp
@@ -0,0 +1,224 @@
+/* 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 "audio/audiostream.h"
+#include "audio/mixer.h"
+#include "audio/decoders/raw.h"
+
+#include "toltecs/toltecs.h"
+#include "toltecs/resource.h"
+#include "toltecs/segmap.h"
+#include "toltecs/sound.h"
+
+namespace Toltecs {
+
+Sound::Sound(ToltecsEngine *vm) : _vm(vm) {
+ for (int i = 0; i < kMaxChannels; i++) {
+ channels[i].type = kChannelTypeEmpty;
+ channels[i].resIndex = -1;
+ }
+}
+
+Sound::~Sound() {
+}
+
+void Sound::playSpeech(int16 resIndex) {
+ debug(0, "playSpeech(%d)", resIndex);
+ internalPlaySound(resIndex, kChannelTypeSpeech, 50 /*TODO*/, 0);
+}
+
+void Sound::playSound(int16 resIndex, int16 type, int16 volume) {
+
+ // TODO: Use the right volumes
+
+ debug(0, "playSound(%d, %d, %d)", resIndex, type, volume);
+
+ if (volume == -1 || type == -2) {
+ if (type == kChannelTypeBackground) {
+ internalPlaySound(resIndex, type, 50 /*TODO*/, 0);
+ } else {
+ internalPlaySound(resIndex, type, 100 /*TODO*/, 0);
+ }
+ } else {
+ internalPlaySound(resIndex, type, 100 /*TODO*/, 0);
+ }
+
+}
+
+void Sound::playSoundAtPos(int16 resIndex, int16 x, int16 y) {
+
+ debug(0, "playSoundAtPos(%d, %d, %d)", resIndex, x, y);
+
+ int16 volume, panning = 0, deltaX = 0;
+ int8 scaling = _vm->_segmap->getScalingAtPoint(x, y);
+
+ if (scaling >= 0)
+ volume = 50 + ABS(scaling) / 2;
+ else
+ volume = 50 - ABS(scaling) / 2;
+
+ if (_vm->_cameraX > x)
+ deltaX = _vm->_cameraX - x;
+ else if (_vm->_cameraX + 640 < x)
+ deltaX = x - (_vm->_cameraX + 640);
+ if (deltaX > 600)
+ deltaX = 600;
+
+ volume = ((100 - deltaX / 6) * volume) / 100;
+
+ if (_vm->_cameraX + 320 != x) {
+ panning = CLIP(x - (_vm->_cameraX + 320), -381, 381) / 3;
+ }
+
+ internalPlaySound(resIndex, 1, volume, panning);
+
+}
+
+void Sound::internalPlaySound(int16 resIndex, int16 type, int16 volume, int16 panning) {
+
+ if (resIndex == -1) {
+ // Stop all sounds
+ _vm->_mixer->stopAll();
+ _vm->_screen->keepTalkTextItemsAlive();
+ for (int i = 0; i < kMaxChannels; i++) {
+ channels[i].type = kChannelTypeEmpty;
+ channels[i].resIndex = -1;
+ }
+ } else if (type == -2) {
+ // Stop sounds with specified resIndex
+ for (int i = 0; i < kMaxChannels; i++) {
+ if (channels[i].resIndex == resIndex) {
+ _vm->_mixer->stopHandle(channels[i].handle);
+ channels[i].type = kChannelTypeEmpty;
+ channels[i].resIndex = -1;
+ }
+ }
+ } else {
+
+ if (type == -3) {
+ // Stop speech and play new sound
+ stopSpeech();
+ }
+
+ // Play new sound in empty channel
+ int freeChannel = -1;
+ for (int i = 0; i < kMaxChannels; i++) {
+ if (channels[i].type == kChannelTypeEmpty || !_vm->_mixer->isSoundHandleActive(channels[i].handle)) {
+ freeChannel = i;
+ break;
+ }
+ }
+
+ // If all channels are in use no new sound will be played
+ if (freeChannel >= 0) {
+ Resource *soundResource = _vm->_res->load(resIndex);
+
+ Audio::AudioStream *stream = Audio::makeLoopingAudioStream(
+ Audio::makeRawStream(soundResource->data,
+ soundResource->size, 22050, Audio::FLAG_UNSIGNED,
+ DisposeAfterUse::NO),
+ type == kChannelTypeBackground ? 0 : 1);
+
+ channels[freeChannel].type = type;
+ channels[freeChannel].resIndex = resIndex;
+
+ Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType;
+ /*
+ switch (type) {
+ }
+ */
+
+ _vm->_mixer->playStream(soundType, &channels[freeChannel].handle,
+ stream, -1, volume, panning);
+ }
+
+ }
+
+}
+
+void Sound::updateSpeech() {
+ for (int i = 0; i < kMaxChannels; i++) {
+ if (channels[i].type == kChannelTypeSpeech && _vm->_mixer->isSoundHandleActive(channels[i].handle)) {
+ _vm->_screen->keepTalkTextItemsAlive();
+ break;
+ }
+ }
+}
+
+void Sound::stopSpeech() {
+ for (int i = 0; i < kMaxChannels; i++) {
+ if (channels[i].type == kChannelTypeSpeech) {
+ _vm->_mixer->stopHandle(channels[i].handle);
+ _vm->_screen->keepTalkTextItemsAlive();
+ channels[i].type = kChannelTypeEmpty;
+ channels[i].resIndex = -1;
+ }
+ }
+}
+
+void Sound::stopAll() {
+ for (int i = 0; i < kMaxChannels; i++) {
+ _vm->_mixer->stopHandle(channels[i].handle);
+ _vm->_screen->keepTalkTextItemsAlive();
+ channels[i].type = kChannelTypeEmpty;
+ channels[i].resIndex = -1;
+ }
+}
+
+void Sound::saveState(Common::WriteStream *out) {
+ for (int i = 0; i < kMaxChannels; i++) {
+ out->writeSint16LE(channels[i].type);
+ out->writeSint16LE(channels[i].resIndex);
+ }
+}
+
+void Sound::loadState(Common::ReadStream *in) {
+ for (int i = 0; i < kMaxChannels; i++) {
+ channels[i].type = in->readSint16LE();
+ channels[i].resIndex = in->readSint16LE();
+
+ if (channels[i].type != kChannelTypeEmpty) {
+ Resource *soundResource = _vm->_res->load(channels[i].resIndex);
+
+ Audio::AudioStream *stream = Audio::makeLoopingAudioStream(
+ Audio::makeRawStream(soundResource->data,
+ soundResource->size, 22050, Audio::FLAG_UNSIGNED,
+ DisposeAfterUse::NO),
+ channels[i].type == kChannelTypeBackground ? 0 : 1);
+
+ Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType;
+ /*
+ switch (type) {
+ }
+ */
+
+ // TODO: Volume and panning
+ int16 volume = (channels[i].type == kChannelTypeBackground) ? 50 : 100;
+
+ _vm->_mixer->playStream(soundType, &channels[i].handle,
+ stream, -1, volume, /*panning*/0);
+ }
+ }
+}
+
+} // End of namespace Toltecs
diff --git a/engines/toltecs/sound.h b/engines/toltecs/sound.h
new file mode 100644
index 0000000000..e292d22c0f
--- /dev/null
+++ b/engines/toltecs/sound.h
@@ -0,0 +1,77 @@
+/* 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 TOLTECS_SOUND_H
+#define TOLTECS_SOUND_H
+
+#include "audio/mixer.h" // for Audio::SoundHandle
+
+#include "toltecs/toltecs.h"
+
+namespace Toltecs {
+
+// 0x1219
+
+enum SoundChannelType {
+ kChannelTypeEmpty = 0,
+ kChannelTypeBackground = -1,
+ kChannelTypeSfx = -2,
+ kChannelTypeSpeech = -3
+};
+
+struct SoundChannel {
+ int16 resIndex;
+ int16 type;
+ Audio::SoundHandle handle;
+};
+
+const int kMaxChannels = 4;
+
+class Sound {
+public:
+ Sound(ToltecsEngine *vm);
+ ~Sound();
+
+ void playSpeech(int16 resIndex);
+ void playSound(int16 resIndex, int16 type, int16 volume);
+ void playSoundAtPos(int16 resIndex, int16 x, int16 y);
+ void updateSpeech();
+ void stopSpeech();
+ void stopAll();
+
+ void saveState(Common::WriteStream *out);
+ void loadState(Common::ReadStream *in);
+
+protected:
+ ToltecsEngine *_vm;
+
+ SoundChannel channels[kMaxChannels];
+
+ void internalPlaySound(int16 resIndex, int16 type, int16 volume, int16 panning);
+
+};
+
+
+} // End of namespace Toltecs
+
+#endif /* TOLTECS_SOUND_H */
diff --git a/engines/toltecs/sprite.cpp b/engines/toltecs/sprite.cpp
new file mode 100644
index 0000000000..7a02663793
--- /dev/null
+++ b/engines/toltecs/sprite.cpp
@@ -0,0 +1,509 @@
+/* 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 "toltecs/toltecs.h"
+#include "toltecs/palette.h"
+#include "toltecs/render.h"
+#include "toltecs/resource.h"
+
+namespace Toltecs {
+
+class SpriteReader : public SpriteFilter {
+public:
+ SpriteReader(byte *source, const SpriteDrawItem &sprite) : SpriteFilter(sprite), _source(source) {
+ _curWidth = _sprite->origWidth;
+ _curHeight = _sprite->origHeight;
+ }
+ SpriteReaderStatus readPacket(PixelPacket &packet) {
+ if (_sprite->flags & 0x40) {
+ // shadow sprite
+ packet.count = _source[0] & 0x7F;
+ if (_source[0] & 0x80)
+ packet.pixel = 1;
+ else
+ packet.pixel = 0;
+ _source++;
+ } else if (_sprite->flags & 0x10) {
+ // 256-color sprite
+ packet.pixel = *_source++;
+ packet.count = *_source++;
+ } else {
+ // 16-color sprite
+ packet.count = _source[0] & 0x0F;
+ packet.pixel = (_source[0] & 0xF0) >> 4;
+ _source++;
+ }
+ _curWidth -= packet.count;
+ if (_curWidth <= 0) {
+ _curHeight--;
+ if (_curHeight == 0) {
+ return kSrsEndOfSprite;
+ } else {
+ _curWidth = _sprite->origWidth;
+ return kSrsEndOfLine;
+ }
+ } else {
+ return kSrsPixelsLeft;
+ }
+ }
+ byte *getSource() {
+ return _source;
+ }
+ void setSource(byte *source) {
+ _source = source;
+ _curHeight++;
+ }
+protected:
+ byte *_source;
+ int16 _curWidth, _curHeight;
+};
+
+class SpriteFilterScaleDown : public SpriteFilter {
+public:
+ SpriteFilterScaleDown(const SpriteDrawItem &sprite, SpriteReader *reader) : SpriteFilter(sprite), _reader(reader) {
+ _height = _sprite->height;
+ _yerror = _sprite->yerror;
+ _origHeight = _sprite->origHeight;
+ _scalerStatus = 0;
+ }
+ SpriteReaderStatus readPacket(PixelPacket &packet) {
+ SpriteReaderStatus status = kSrsPixelsLeft;
+ if (_scalerStatus == 0) {
+ _xerror = _sprite->xdelta;
+ _yerror -= 100;
+ while (_yerror <= 0) {
+ do {
+ status = _reader->readPacket(packet);
+ } while (status == kSrsPixelsLeft);
+ _yerror += _sprite->ydelta - 100;
+ }
+ if (status == kSrsEndOfSprite)
+ return kSrsEndOfSprite;
+ _scalerStatus = 1;
+ }
+ if (_scalerStatus == 1) {
+ status = _reader->readPacket(packet);
+ byte updcount = packet.count;
+ while (updcount--) {
+ _xerror -= 100;
+ if (_xerror <= 0) {
+ if (packet.count > 0)
+ packet.count--;
+ _xerror += _sprite->xdelta;
+ }
+ }
+ if (status == kSrsEndOfLine) {
+ if (--_height == 0)
+ return kSrsEndOfSprite;
+ _scalerStatus = 0;
+ return kSrsEndOfLine;
+ }
+ }
+ return kSrsPixelsLeft;
+ }
+protected:
+ SpriteReader *_reader;
+ int16 _xerror, _yerror;
+ int16 _height;
+ int16 _origHeight;
+ int _scalerStatus;
+};
+
+class SpriteFilterScaleUp : public SpriteFilter {
+public:
+ SpriteFilterScaleUp(const SpriteDrawItem &sprite, SpriteReader *reader) : SpriteFilter(sprite), _reader(reader) {
+ _height = _sprite->height;
+ _yerror = _sprite->yerror;
+ _origHeight = _sprite->origHeight;
+ _scalerStatus = 0;
+ }
+ SpriteReaderStatus readPacket(PixelPacket &packet) {
+ SpriteReaderStatus status;
+ if (_scalerStatus == 0) {
+ _xerror = _sprite->xdelta;
+ _sourcep = _reader->getSource();
+ _scalerStatus = 1;
+ }
+ if (_scalerStatus == 1) {
+ status = _reader->readPacket(packet);
+ byte updcount = packet.count;
+ while (updcount--) {
+ _xerror -= 100;
+ if (_xerror <= 0) {
+ packet.count++;
+ _xerror += _sprite->xdelta;
+ }
+ }
+ if (status == kSrsEndOfLine) {
+ if (--_height == 0)
+ return kSrsEndOfSprite;
+ _yerror -= 100;
+ if (_yerror <= 0) {
+ _reader->setSource(_sourcep);
+ _yerror += _sprite->ydelta + 100;
+ }
+ _scalerStatus = 0;
+ return kSrsEndOfLine;
+ }
+ }
+ return kSrsPixelsLeft;
+ }
+protected:
+ SpriteReader *_reader;
+ byte *_sourcep;
+ int16 _xerror, _yerror;
+ int16 _height;
+ int16 _origHeight;
+ int _scalerStatus;
+};
+
+bool Screen::createSpriteDrawItem(const DrawRequest &drawRequest, SpriteDrawItem &sprite) {
+ int16 scaleValueX, scaleValueY;
+ int16 xoffs, yoffs;
+ byte *spriteData;
+ int16 frameNum;
+
+ memset(&sprite, 0, sizeof(SpriteDrawItem));
+
+ if (drawRequest.flags == 0xFFFF)
+ return false;
+
+ frameNum = drawRequest.flags & 0x0FFF;
+
+ sprite.flags = 0;
+ sprite.baseColor = drawRequest.baseColor;
+ sprite.x = drawRequest.x;
+ sprite.y = drawRequest.y;
+ sprite.priority = drawRequest.y;
+ sprite.resIndex = drawRequest.resIndex;
+ sprite.frameNum = frameNum;
+
+ spriteData = _vm->_res->load(drawRequest.resIndex)->data;
+
+ if (drawRequest.flags & 0x1000) {
+ sprite.flags |= 4;
+ }
+
+ if (drawRequest.flags & 0x2000) {
+ sprite.flags |= 0x10;
+ }
+
+ if (drawRequest.flags & 0x4000) {
+ sprite.flags |= 0x40;
+ }
+
+ // First initialize the sprite item with the values from the sprite resource
+
+ SpriteFrameEntry spriteFrameEntry(spriteData + frameNum * 12);
+
+ if (spriteFrameEntry.w == 0 || spriteFrameEntry.h == 0)
+ return false;
+
+ sprite.offset = spriteFrameEntry.offset;
+
+ sprite.width = spriteFrameEntry.w;
+ sprite.height = spriteFrameEntry.h;
+ sprite.origWidth = spriteFrameEntry.w;
+ sprite.origHeight = spriteFrameEntry.h;
+
+ if (drawRequest.flags & 0x1000) {
+ xoffs = spriteFrameEntry.w - spriteFrameEntry.x;
+ } else {
+ xoffs = spriteFrameEntry.x;
+ }
+
+ yoffs = spriteFrameEntry.y;
+
+ // If the sprite should be scaled we need to initialize some values now
+
+ if (drawRequest.scaling != 0) {
+
+ byte scaleValue = ABS(drawRequest.scaling);
+
+ scaleValueX = scaleValue * sprite.origWidth;
+ sprite.xdelta = (10000 * sprite.origWidth) / scaleValueX;
+ scaleValueX /= 100;
+
+ scaleValueY = scaleValue * sprite.origHeight;
+ sprite.ydelta = (10000 * sprite.origHeight) / scaleValueY;
+ scaleValueY /= 100;
+
+ if (drawRequest.scaling > 0) {
+ sprite.flags |= 2;
+ sprite.width = sprite.origWidth + scaleValueX;
+ sprite.height = sprite.origHeight + scaleValueY;
+ xoffs += (xoffs * scaleValue) / 100;
+ yoffs += (yoffs * scaleValue) / 100;
+ } else {
+ sprite.flags |= 1;
+ sprite.width = sprite.origWidth - scaleValueX;
+ sprite.height = sprite.origHeight - 1 - scaleValueY;
+ if (sprite.width <= 0 || sprite.height <= 0)
+ return false;
+ xoffs -= (xoffs * scaleValue) / 100;
+ yoffs -= (yoffs * scaleValue) / 100;
+ }
+
+ }
+
+ sprite.x -= xoffs;
+ sprite.y -= yoffs;
+
+ sprite.yerror = sprite.ydelta;
+
+ // Now we check if the sprite needs to be clipped
+
+ // Clip Y
+ if (sprite.y - _vm->_cameraY < 0) {
+
+ int16 clipHeight = ABS(sprite.y - _vm->_cameraY);
+ int16 skipHeight = clipHeight;
+ byte *spriteFrameData;
+
+ sprite.height -= clipHeight;
+ if (sprite.height <= 0)
+ return false;
+
+ sprite.y = _vm->_cameraY;
+
+ // If the sprite is scaled
+ if (sprite.flags & 3) {
+ int16 chopHeight = sprite.ydelta;
+ if ((sprite.flags & 2) == 0) {
+ do {
+ chopHeight -= 100;
+ if (chopHeight <= 0) {
+ skipHeight++;
+ chopHeight += sprite.ydelta;
+ } else {
+ clipHeight--;
+ }
+ } while (clipHeight > 0);
+ } else {
+ do {
+ chopHeight -= 100;
+ if (chopHeight < 0) {
+ skipHeight--;
+ chopHeight += sprite.ydelta + 100;
+ }
+ clipHeight--;
+ } while (clipHeight > 0);
+ }
+ sprite.yerror = chopHeight;
+ }
+
+ spriteFrameData = spriteData + sprite.offset;
+ // Now the sprite's offset is adjusted to point to the starting line
+ if ((sprite.flags & 0x10) == 0) {
+ while (skipHeight--) {
+ int16 lineWidth = 0;
+ while (lineWidth < sprite.origWidth) {
+ sprite.offset++;
+ lineWidth += spriteFrameData[0] & 0x0F;
+ spriteFrameData++;
+ }
+ }
+ } else {
+ while (skipHeight--) {
+ int16 lineWidth = 0;
+ while (lineWidth < sprite.origWidth) {
+ sprite.offset += 2;
+ lineWidth += spriteFrameData[1];
+ spriteFrameData += 2;
+ }
+ }
+ }
+
+ }
+
+ if (sprite.y + sprite.height - _vm->_cameraY - _vm->_cameraHeight > 0)
+ sprite.height -= sprite.y + sprite.height - _vm->_cameraY - _vm->_cameraHeight;
+ if (sprite.height <= 0)
+ return false;
+
+ sprite.skipX = 0;
+
+ if (drawRequest.flags & 0x1000) {
+ // Left border
+ if (sprite.x - _vm->_cameraX < 0) {
+ sprite.width -= ABS(sprite.x - _vm->_cameraX);
+ sprite.x = _vm->_cameraX;
+ }
+ // Right border
+ if (sprite.x + sprite.width - _vm->_cameraX - 640 > 0) {
+ sprite.flags |= 8;
+ sprite.skipX = sprite.x + sprite.width - _vm->_cameraX - 640;
+ sprite.width -= sprite.skipX;
+ }
+ } else {
+ // Left border
+ if (sprite.x - _vm->_cameraX < 0) {
+ sprite.flags |= 8;
+ sprite.skipX = ABS(sprite.x - _vm->_cameraX);
+ sprite.width -= sprite.skipX;
+ sprite.x = _vm->_cameraX;
+ }
+ // Right border
+ if (sprite.x + sprite.width - _vm->_cameraX - 640 > 0) {
+ sprite.flags |= 8;
+ sprite.width -= sprite.x + sprite.width - _vm->_cameraX - 640;
+ }
+ }
+
+ if (sprite.width <= 0)
+ return false;
+
+ return true;
+}
+
+void Screen::addDrawRequest(const DrawRequest &drawRequest) {
+ SpriteDrawItem sprite;
+ if (createSpriteDrawItem(drawRequest, sprite))
+ _renderQueue->addSprite(sprite);
+}
+
+void Screen::drawSprite(const SpriteDrawItem &sprite) {
+
+ debug(0, "Screen::drawSprite() x = %d; y = %d; flags = %04X; resIndex = %d; offset = %08X; drawX = %d; drawY = %d",
+ sprite.x, sprite.y, sprite.flags, sprite.resIndex, sprite.offset,
+ sprite.x - _vm->_cameraX, sprite.y - _vm->_cameraY);
+ debug(0, "Screen::drawSprite() width = %d; height = %d; origWidth = %d; origHeight = %d",
+ sprite.width, sprite.height, sprite.origWidth, sprite.origHeight);
+
+ byte *source = _vm->_res->load(sprite.resIndex)->data + sprite.offset;
+ byte *dest = _frontScreen + sprite.x + sprite.y * 640;
+
+ SpriteReader spriteReader(source, sprite);
+
+ if (sprite.flags & 0x40) {
+ // Shadow sprites
+ if (sprite.flags & 1) {
+ SpriteFilterScaleDown spriteScaler(sprite, &spriteReader);
+ drawSpriteCore(dest, spriteScaler, sprite);
+ } else if (sprite.flags & 2) {
+ SpriteFilterScaleUp spriteScaler(sprite, &spriteReader);
+ drawSpriteCore(dest, spriteScaler, sprite);
+ } else {
+ drawSpriteCore(dest, spriteReader, sprite);
+ }
+ } else if (sprite.flags & 0x10) {
+ // 256 color sprite
+ drawSpriteCore(dest, spriteReader, sprite);
+ } else {
+ // 16 color sprite
+ if (sprite.flags & 1) {
+ SpriteFilterScaleDown spriteScaler(sprite, &spriteReader);
+ drawSpriteCore(dest, spriteScaler, sprite);
+ } else if (sprite.flags & 2) {
+ SpriteFilterScaleUp spriteScaler(sprite, &spriteReader);
+ drawSpriteCore(dest, spriteScaler, sprite);
+ } else {
+ drawSpriteCore(dest, spriteReader, sprite);
+ }
+ }
+
+ debug(0, "Screen::drawSprite() ok");
+
+}
+
+void Screen::drawSpriteCore(byte *dest, SpriteFilter &reader, const SpriteDrawItem &sprite) {
+
+ int16 destInc;
+
+ if (sprite.flags & 4) {
+ destInc = -1;
+ dest += sprite.width;
+ } else {
+ destInc = 1;
+ }
+
+ SpriteReaderStatus status;
+ PixelPacket packet;
+
+ byte *destp = dest;
+ int16 skipX = sprite.skipX;
+
+ int16 w = sprite.width;
+ int16 h = sprite.height;
+
+ do {
+ status = reader.readPacket(packet);
+
+ if (skipX > 0) {
+ while (skipX > 0) {
+ skipX -= packet.count;
+ if (skipX < 0) {
+ packet.count = ABS(skipX);
+ break;
+ }
+ status = reader.readPacket(packet);
+ }
+ }
+
+ if (w - packet.count < 0)
+ packet.count = w;
+
+ w -= packet.count;
+
+ if (((sprite.flags & 0x40) && (packet.pixel != 0)) ||
+ ((sprite.flags & 0x10) && (packet.pixel != 0xFF)) ||
+ (!(sprite.flags & 0x10) && (packet.pixel != 0)))
+ {
+ if (sprite.flags & 0x40) {
+ while (packet.count--) {
+ *dest = _vm->_palette->getColorTransPixel(*dest);
+ dest += destInc;
+ }
+ } else {
+ if (sprite.flags & 0x10) {
+ packet.pixel = ((packet.pixel << 4) & 0xF0) | ((packet.pixel >> 4) & 0x0F);
+ } else {
+ packet.pixel += sprite.baseColor - 1;
+ }
+ while (packet.count--) {
+ *dest = packet.pixel;
+ dest += destInc;
+ }
+ }
+ } else {
+ dest += packet.count * destInc;
+ }
+
+ if (status == kSrsEndOfLine || w <= 0) {
+ if (w <= 0) {
+ while (status == kSrsPixelsLeft) {
+ status = reader.readPacket(packet);
+ }
+ }
+ dest = destp + 640;
+ destp = dest;
+ skipX = sprite.skipX;
+ w = sprite.width;
+ h--;
+ }
+
+ } while (status != kSrsEndOfSprite && h > 0);
+
+}
+
+} // End of namespace Toltecs
diff --git a/engines/toltecs/toltecs.cpp b/engines/toltecs/toltecs.cpp
new file mode 100644
index 0000000000..d403e0499b
--- /dev/null
+++ b/engines/toltecs/toltecs.cpp
@@ -0,0 +1,641 @@
+/* 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 "common/events.h"
+#include "common/random.h"
+#include "common/str.h"
+#include "common/error.h"
+#include "common/textconsole.h"
+
+#include "base/plugins.h"
+#include "base/version.h"
+
+#include "graphics/cursorman.h"
+
+#include "engines/util.h"
+
+#include "audio/mixer.h"
+
+#include "toltecs/toltecs.h"
+#include "toltecs/animation.h"
+#include "toltecs/menu.h"
+#include "toltecs/movie.h"
+#include "toltecs/music.h"
+#include "toltecs/palette.h"
+#include "toltecs/render.h"
+#include "toltecs/resource.h"
+#include "toltecs/script.h"
+#include "toltecs/screen.h"
+#include "toltecs/segmap.h"
+#include "toltecs/sound.h"
+#include "toltecs/microtiles.h"
+
+namespace Toltecs {
+
+struct GameSettings {
+ const char *gameid;
+ const char *description;
+ byte id;
+ uint32 features;
+ const char *detectname;
+};
+
+ToltecsEngine::ToltecsEngine(OSystem *syst, const ToltecsGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
+
+ // Setup mixer
+ _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
+ _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
+
+ _rnd = new Common::RandomSource("toltecs");
+}
+
+ToltecsEngine::~ToltecsEngine() {
+ delete _rnd;
+}
+
+Common::Error ToltecsEngine::run() {
+ initGraphics(640, 400, true);
+
+ _isSaveAllowed = true;
+
+ _counter01 = 0;
+ _counter02 = 0;
+ _movieSceneFlag = false;
+ _flag01 = 0;
+
+ _saveLoadRequested = 0;
+
+ _cameraX = 0;
+ _cameraY = 0;
+ _newCameraX = 0;
+ _newCameraY = 0;
+ _cameraHeight = 0;
+
+ _guiHeight = 26;
+
+ _sceneWidth = 0;
+ _sceneHeight = 0;
+
+ _doSpeech = true;
+ _doText = true;
+
+ _walkSpeedY = 5;
+ _walkSpeedX = 1;
+
+ _mouseX = 0;
+ _mouseY = 0;
+ _mouseDblClickTicks = 60;
+ _mouseWaitForRelease = false;
+ _mouseButton = 0;
+ _mouseDisabled = 0;
+ _leftButtonDown = false;
+ _rightButtonDown = false;
+
+ _arc = new ArchiveReader();
+ _arc->openArchive("WESTERN");
+
+ _res = new ResourceCache(this);
+
+ _screen = new Screen(this);
+
+ _script = new ScriptInterpreter(this);
+ _anim = new AnimationPlayer(this);
+ _palette = new Palette(this);
+ _segmap = new SegmentMap(this);
+ _moviePlayer = new MoviePlayer(this);
+ _music = new Music(_arc);
+ _menuSystem = new MenuSystem(this);
+
+ _sound = new Sound(this);
+
+ syncSoundSettings();
+
+ CursorMan.showMouse(true);
+
+ setupSysStrings();
+
+//#define TEST_MENU
+#ifdef TEST_MENU
+ _screen->registerFont(0, 0x0D);
+ _screen->registerFont(1, 0x0E);
+ _screen->loadMouseCursor(12);
+ _palette->loadAddPalette(9, 224);
+ _palette->setDeltaPalette(_palette->getMainPalette(), 7, 0, 31, 224);
+ _screen->finishTalkTextItems();
+ _screen->clearSprites();
+ _menuSystem->run();
+ /*
+ while (1) {
+ //updateInput();
+ _menuSystem->update();
+ updateScreen();
+ }
+ */
+ return Common::kNoError;
+#endif
+
+ // Start main game loop
+ setTotalPlayTime(0);
+ _script->loadScript(0, 0);
+ _script->setMainScript(0);
+ if (ConfMan.hasKey("save_slot")) {
+ int saveSlot = ConfMan.getInt("save_slot");
+ if (saveSlot >= 0 && saveSlot <= 99) {
+ _screen->loadMouseCursor(12);
+ loadGameState(saveSlot);
+ }
+ }
+ _script->runScript();
+
+ _music->stopSequence();
+ _sound->stopAll();
+
+ delete _arc;
+ delete _res;
+ delete _screen;
+ delete _script;
+ delete _anim;
+ delete _palette;
+ delete _segmap;
+ delete _music;
+ delete _moviePlayer;
+ delete _menuSystem;
+
+ delete _sound;
+
+ return Common::kNoError;
+}
+
+void ToltecsEngine::setupSysStrings() {
+ Resource *sysStringsResource = _res->load(15);
+ const char *sysStrings = (const char*)sysStringsResource->data;
+ for (int i = 0; i < kSysStrCount; i++) {
+ debug(1, "sysStrings[%d] = [%s]", i, sysStrings);
+ _sysStrings[i] = sysStrings;
+ sysStrings += strlen(sysStrings) + 1;
+ }
+ // TODO: Set yes/no chars
+}
+
+void ToltecsEngine::requestSavegame(int slotNum, Common::String &description) {
+ _saveLoadRequested = 2;
+ _saveLoadSlot = slotNum;
+ _saveLoadDescription = description;
+}
+
+void ToltecsEngine::requestLoadgame(int slotNum) {
+ _saveLoadRequested = 1;
+ _saveLoadSlot = slotNum;
+}
+
+void ToltecsEngine::loadScene(uint resIndex) {
+
+ Resource *sceneResource = _res->load(resIndex);
+ byte *scene = sceneResource->data;
+
+ uint32 imageSize = READ_LE_UINT32(scene);
+ _sceneResIndex = resIndex;
+ _sceneHeight = READ_LE_UINT16(scene + 4);
+ _sceneWidth = READ_LE_UINT16(scene + 6);
+
+ // Load scene palette
+ _palette->loadAddPaletteFrom(scene + 8, 0, 128);
+
+ // Load scene background
+ byte *source = scene + 392;
+ byte *destp = _screen->_backScreen;
+ byte *destEnd = destp + _sceneWidth * _sceneHeight;
+ while (destp < destEnd) {
+ int count = 1;
+ byte pixel = *source++;
+ if (pixel & 0x80) {
+ pixel &= 0x7F;
+ count = *source++;
+ count += 2;
+ }
+ memset(destp, pixel, count);
+ destp += count;
+ }
+
+ debug(0, "_sceneWidth = %d; _sceneHeight = %d", _sceneWidth, _sceneHeight);
+
+ // Load scene segmap
+ _segmap->load(scene + imageSize + 4);
+
+ _screen->_fullRefresh = true;
+ _screen->_renderQueue->clear();
+
+}
+
+void ToltecsEngine::updateScreen() {
+
+ _sound->updateSpeech();
+
+ _screen->updateShakeScreen();
+
+ // TODO: Set quit flag
+ if (shouldQuit())
+ return;
+
+ if (!_movieSceneFlag)
+ updateInput();
+ else
+ _mouseButton = 0;
+
+ // TODO? Check keyb
+
+ _counter01--;
+ if (_counter01 <= 0) {
+ _counter01 = MIN(_counter02, 30);
+ _counter02 = 0;
+ drawScreen();
+ _flag01 = 1;
+ _counter02 = 1;
+ } else {
+ _screen->clearSprites();
+ _flag01 = 0;
+ }
+
+ static uint32 prevUpdateTime = 0;
+ uint32 currUpdateTime;
+ do {
+ currUpdateTime = _system->getMillis();
+ _counter02 = (currUpdateTime - prevUpdateTime) / 13;
+ } while (_counter02 == 0);
+ prevUpdateTime = currUpdateTime;
+
+}
+
+void ToltecsEngine::drawScreen() {
+ // FIXME: Quick hack, sometimes cameraY was negative (the code in updateCamera was at fault)
+ if (_cameraY < 0) _cameraY = 0;
+
+ _segmap->addMasksToRenderQueue();
+ _screen->addTalkTextItemsToRenderQueue();
+
+ _screen->_renderQueue->update();
+
+ //debug("_guiHeight = %d\n", _guiHeight);
+
+ if (_screen->_guiRefresh && _guiHeight > 0 && _cameraHeight > 0) {
+ // Update the GUI when needed and it's visible
+ _system->copyRectToScreen((const byte *)_screen->_frontScreen + _cameraHeight * 640,
+ 640, 0, _cameraHeight, 640, _guiHeight);
+ _screen->_guiRefresh = false;
+ }
+
+ _system->updateScreen();
+
+ updateCamera();
+}
+
+void ToltecsEngine::updateInput() {
+
+ Common::Event event;
+ Common::EventManager *eventMan = _system->getEventManager();
+ while (eventMan->pollEvent(event)) {
+ switch (event.type) {
+ case Common::EVENT_KEYDOWN:
+ _keyState = event.kbd;
+
+ //debug("key: flags = %02X; keycode = %d", _keyState.flags, _keyState.keycode);
+
+ // FIXME: This is just for debugging
+ switch (event.kbd.keycode) {
+ case Common::KEYCODE_F7:
+ savegame("toltecs.001", "Quicksave");
+ break;
+ case Common::KEYCODE_F9:
+ loadgame("toltecs.001");
+ break;
+ case Common::KEYCODE_ESCAPE:
+ // Skip current dialog line, if a dialog is active
+ if (_screen->getTalkTextDuration() > 0) {
+ _sound->stopSpeech();
+ _screen->finishTalkTextItems();
+ _keyState.reset(); // event consumed
+ }
+ break;
+ default:
+ break;
+ }
+
+ break;
+ case Common::EVENT_KEYUP:
+ _keyState.reset();
+ break;
+ case Common::EVENT_QUIT:
+ quitGame();
+ break;
+ case Common::EVENT_MOUSEMOVE:
+ _mouseX = event.mouse.x;
+ _mouseY = event.mouse.y;
+ break;
+ case Common::EVENT_LBUTTONDOWN:
+ _mouseX = event.mouse.x;
+ _mouseY = event.mouse.y;
+ _leftButtonDown = true;
+ break;
+ case Common::EVENT_LBUTTONUP:
+ _mouseX = event.mouse.x;
+ _mouseY = event.mouse.y;
+ _leftButtonDown = false;
+ break;
+ case Common::EVENT_RBUTTONDOWN:
+ _mouseX = event.mouse.x;
+ _mouseY = event.mouse.y;
+ _rightButtonDown = true;
+ break;
+ case Common::EVENT_RBUTTONUP:
+ _mouseX = event.mouse.x;
+ _mouseY = event.mouse.y;
+ _rightButtonDown = false;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (!_mouseDisabled) {
+
+ if (_mouseDblClickTicks > 0)
+ _mouseDblClickTicks--;
+
+ byte mouseButtons = 0;
+ if (_leftButtonDown)
+ mouseButtons |= 1;
+ if (_rightButtonDown)
+ mouseButtons |= 2;
+
+ if (mouseButtons != 0) {
+ if (!_mouseWaitForRelease) {
+ _mouseButton = mouseButtons;
+ if (_mouseDblClickTicks > 0)
+ _mouseButton = 0x80;
+ //if (_mouseButton == 0x80) debug("DBL!");
+ _mouseDblClickTicks = 30; // maybe TODO
+ _mouseWaitForRelease = true;
+ } else {
+ _mouseButton = 0;
+ }
+ } else {
+ _mouseWaitForRelease = false;
+ _mouseButton = 0;
+ }
+
+ }
+
+}
+
+void ToltecsEngine::setGuiHeight(int16 guiHeight) {
+ if (guiHeight != _guiHeight) {
+ _guiHeight = guiHeight;
+ _cameraHeight = 400 - _guiHeight;
+ _screen->_guiRefresh = true;
+ debug(0, "ToltecsEngine::setGuiHeight() _guiHeight = %d; _cameraHeight = %d", _guiHeight, _cameraHeight);
+ // TODO: clearScreen();
+ }
+}
+
+void ToltecsEngine::setCamera(int16 x, int16 y) {
+ _screen->finishTalkTextItems();
+
+ _screen->clearSprites();
+
+ _cameraX = x;
+ _newCameraX = x;
+
+ _cameraY = y;
+ _newCameraY = y;
+}
+
+bool ToltecsEngine::getCameraChanged() {
+ return _cameraX != _newCameraX || _cameraY != _newCameraY;
+}
+
+void ToltecsEngine::scrollCameraUp(int16 delta) {
+ if (_newCameraY > 0) {
+ if (_newCameraY < delta)
+ _newCameraY = 0;
+ else
+ _newCameraY -= delta;
+ }
+}
+
+void ToltecsEngine::scrollCameraDown(int16 delta) {
+ debug(0, "ToltecsEngine::scrollCameraDown(%d)", delta);
+ if (_newCameraY != _sceneHeight - _cameraHeight) {
+ if (_sceneHeight - _cameraHeight < _newCameraY + delta)
+ delta += (_sceneHeight - _cameraHeight) - (delta + _newCameraY);
+ _newCameraY += delta;
+ debug(0, "ToltecsEngine::scrollCameraDown() _newCameraY = %d; delta = %d", _newCameraY, delta);
+ }
+}
+
+void ToltecsEngine::scrollCameraLeft(int16 delta) {
+ if (_newCameraX > 0) {
+ if (_newCameraX < delta)
+ _newCameraX = 0;
+ else
+ _newCameraX -= delta;
+ }
+}
+
+void ToltecsEngine::scrollCameraRight(int16 delta) {
+ debug(0, "ToltecsEngine::scrollCameraRight(%d)", delta);
+ if (_newCameraX != _sceneWidth - 640) {
+ if (_sceneWidth - 640 < delta + _newCameraX)
+ delta += (_sceneWidth - 640) - (delta + _newCameraX);
+ _newCameraX += delta;
+ debug(0, "ToltecsEngine::scrollCameraRight() _newCameraX = %d; delta = %d", _newCameraY, delta);
+ }
+}
+
+void ToltecsEngine::updateCamera() {
+
+ if (_cameraX != _newCameraX) {
+ _cameraX = _newCameraX;
+ _screen->_fullRefresh = true;
+ _screen->finishTalkTextItems();
+ }
+
+ if (_cameraY != _newCameraY) {
+ _cameraY = _newCameraY;
+ _screen->_fullRefresh = true;
+ _screen->finishTalkTextItems();
+ }
+
+ //debug(0, "ToltecsEngine::updateCamera() _cameraX = %d; _cameraY = %d", _cameraX, _cameraY);
+
+}
+
+void ToltecsEngine::talk(int16 slotIndex, int16 slotOffset) {
+
+ byte *scanData = _script->getSlotData(slotIndex) + slotOffset;
+
+ while (*scanData < 0xF0) {
+ if (*scanData == 0x19) {
+ scanData++;
+ } else if (*scanData == 0x14) {
+ scanData++;
+ } else if (*scanData == 0x0A) {
+ scanData += 4;
+ } else if (*scanData < 0x0A) {
+ scanData++;
+ }
+ scanData++;
+ }
+
+ if (*scanData == 0xFE) {
+ if (_doSpeech) {
+ int16 resIndex = READ_LE_UINT16(scanData + 1);
+ debug(0, "ToltecsEngine::talk() playSound(resIndex: %d)", resIndex);
+ _sound->playSpeech(resIndex);
+ }
+ if (_doText) {
+ _screen->updateTalkText(slotIndex, slotOffset);
+ } else {
+ _screen->keepTalkTextItemsAlive();
+ }
+ } else {
+ _screen->updateTalkText(slotIndex, slotOffset);
+ }
+
+}
+
+void ToltecsEngine::walk(byte *walkData) {
+
+ int16 xdelta, ydelta, v8, v10, v11;
+ int16 xstep, ystep;
+ ScriptWalk walkInfo;
+
+ walkInfo.y = READ_LE_UINT16(walkData + 0);
+ walkInfo.x = READ_LE_UINT16(walkData + 2);
+ walkInfo.y1 = READ_LE_UINT16(walkData + 4);
+ walkInfo.x1 = READ_LE_UINT16(walkData + 6);
+ walkInfo.y2 = READ_LE_UINT16(walkData + 8);
+ walkInfo.x2 = READ_LE_UINT16(walkData + 10);
+ walkInfo.yerror = READ_LE_UINT16(walkData + 12);
+ walkInfo.xerror = READ_LE_UINT16(walkData + 14);
+ walkInfo.mulValue = READ_LE_UINT16(walkData + 16);
+ walkInfo.scaling = READ_LE_UINT16(walkData + 18);
+
+ walkInfo.scaling = -_segmap->getScalingAtPoint(walkInfo.x, walkInfo.y);
+
+ if (walkInfo.y1 < walkInfo.y2)
+ ystep = -1;
+ else
+ ystep = 1;
+ ydelta = ABS(walkInfo.y1 - walkInfo.y2) * _walkSpeedY;
+
+ if (walkInfo.x1 < walkInfo.x2)
+ xstep = -1;
+ else
+ xstep = 1;
+ xdelta = ABS(walkInfo.x1 - walkInfo.x2) * _walkSpeedX;
+
+ debug(0, "ToltecsEngine::walk() xdelta = %d; ydelta = %d", xdelta, ydelta);
+
+ if (xdelta > ydelta)
+ SWAP(xdelta, ydelta);
+
+ v8 = 100 * xdelta;
+ if (v8 != 0) {
+ if (walkInfo.scaling > 0)
+ v8 -= v8 * ABS(walkInfo.scaling) / 100;
+ else
+ v8 += v8 * ABS(walkInfo.scaling) / 100;
+ if (ydelta != 0)
+ v8 /= ydelta;
+ }
+
+ if (ydelta > ABS(walkInfo.x1 - walkInfo.x2) * _walkSpeedX) {
+ v10 = 100 - walkInfo.scaling;
+ v11 = v8;
+ } else {
+ v10 = v8;
+ v11 = 100 - walkInfo.scaling;
+ }
+
+ walkInfo.yerror += walkInfo.mulValue * v10;
+ while (walkInfo.yerror >= 100 * _walkSpeedY) {
+ walkInfo.yerror -= 100 * _walkSpeedY;
+ if (walkInfo.y == walkInfo.y1) {
+ walkInfo.x = walkInfo.x1;
+ break;
+ }
+ walkInfo.y += ystep;
+ }
+
+ walkInfo.xerror += walkInfo.mulValue * v11;
+ while (walkInfo.xerror >= 100 * _walkSpeedX) {
+ walkInfo.xerror -= 100 * _walkSpeedX;
+ if (walkInfo.x == walkInfo.x1) {
+ walkInfo.y = walkInfo.y1;
+ break;
+ }
+ walkInfo.x += xstep;
+ }
+
+ WRITE_LE_UINT16(walkData + 0, walkInfo.y);
+ WRITE_LE_UINT16(walkData + 2, walkInfo.x);
+ WRITE_LE_UINT16(walkData + 4, walkInfo.y1);
+ WRITE_LE_UINT16(walkData + 6, walkInfo.x1);
+ WRITE_LE_UINT16(walkData + 8, walkInfo.y2);
+ WRITE_LE_UINT16(walkData + 10, walkInfo.x2);
+ WRITE_LE_UINT16(walkData + 12, walkInfo.yerror);
+ WRITE_LE_UINT16(walkData + 14, walkInfo.xerror);
+ WRITE_LE_UINT16(walkData + 16, walkInfo.mulValue);
+ WRITE_LE_UINT16(walkData + 18, walkInfo.scaling);
+
+}
+
+int16 ToltecsEngine::findRectAtPoint(byte *rectData, int16 x, int16 y, int16 index, int16 itemSize,
+ byte *rectDataEnd) {
+
+ rectData += index * itemSize;
+
+ while (rectData < rectDataEnd) {
+ int16 rectY = READ_LE_UINT16(rectData);
+ if (rectY == -10)
+ break;
+ int16 rectX = READ_LE_UINT16(rectData + 2);
+ int16 rectH = READ_LE_UINT16(rectData + 4);
+ int16 rectW = READ_LE_UINT16(rectData + 6);
+
+ debug(0, "x = %d; y = %d; x1 = %d; y2 = %d; w = %d; h = %d",
+ x, y, rectX, rectY, rectW, rectH);
+
+ if (x >= rectX && x <= rectX + rectW && y >= rectY && y <= rectY + rectH) {
+ return index;
+ }
+ index++;
+ rectData += itemSize;
+ }
+
+ return -1;
+
+}
+
+} // End of namespace Toltecs
diff --git a/engines/toltecs/toltecs.h b/engines/toltecs/toltecs.h
new file mode 100644
index 0000000000..efa1f9d13a
--- /dev/null
+++ b/engines/toltecs/toltecs.h
@@ -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.
+ *
+ *
+ */
+
+#ifndef TOLTECS_H
+#define TOLTECS_H
+
+#include "common/scummsys.h"
+#include "common/endian.h"
+#include "common/events.h"
+#include "common/file.h"
+#include "common/keyboard.h"
+#include "common/random.h"
+#include "common/textconsole.h"
+
+#include "engines/engine.h"
+
+#include "graphics/surface.h"
+
+namespace Toltecs {
+
+struct ToltecsGameDescription;
+
+class AnimationPlayer;
+class ArchiveReader;
+class Input;
+class MenuSystem;
+class MoviePlayer;
+class Music;
+class Palette;
+class ResourceCache;
+class ScriptInterpreter;
+class Screen;
+class SegmentMap;
+class Sound;
+
+enum SysString {
+ kStrLoadingPleaseWait,
+ kStrWhatCanIDoForYou,
+ kStrLoad,
+ kStrSave,
+ kStrTextOn,
+ kStrTextOff,
+ kStrVoicesOn,
+ kStrVoicesOff,
+ kStrVolume,
+ kStrPlay,
+ kStrQuit,
+ kStrLoadGame,
+ kStrSaveGame,
+ kStrAdjustVolume,
+ kStrMaster,
+ kStrVoices,
+ kStrMusic,
+ kStrSoundFx,
+ kStrBackground,
+ kStrCancel,
+ kStrDone,
+ kStrAreYouSure,
+ kStrYes,
+ kStrNo,
+ kSysStrCount
+};
+
+class ToltecsEngine : public ::Engine {
+ Common::KeyState _keyPressed;
+
+protected:
+ Common::Error run();
+// void shutdown();
+
+public:
+ ToltecsEngine(OSystem *syst, const ToltecsGameDescription *gameDesc);
+ virtual ~ToltecsEngine();
+
+ virtual bool hasFeature(EngineFeature f) const;
+
+ Common::RandomSource *_rnd;
+ const ToltecsGameDescription *_gameDescription;
+ uint32 getFeatures() const;
+ Common::Language getLanguage() const;
+ const Common::String& getTargetName() const { return _targetName; }
+
+ void setupSysStrings();
+ void requestSavegame(int slotNum, Common::String &description);
+ void requestLoadgame(int slotNum);
+
+ void loadScene(uint resIndex);
+
+ void updateScreen();
+ void drawScreen();
+ void updateInput();
+
+ void setGuiHeight(int16 guiHeight);
+
+ void setCamera(int16 x, int16 y);
+ bool getCameraChanged();
+ void scrollCameraUp(int16 delta);
+ void scrollCameraDown(int16 delta);
+ void scrollCameraLeft(int16 delta);
+ void scrollCameraRight(int16 delta);
+ void updateCamera();
+
+ void talk(int16 slotIndex, int16 slotOffset);
+
+ void walk(byte *walkData);
+
+ int16 findRectAtPoint(byte *rectData, int16 x, int16 y, int16 index, int16 itemSize,
+ byte *rectDataEnd);
+
+public:
+
+ AnimationPlayer *_anim;
+ ArchiveReader *_arc;
+ Input *_input;
+ MenuSystem *_menuSystem;
+ MoviePlayer *_moviePlayer;
+ Music *_music;
+ Palette *_palette;
+ ResourceCache *_res;
+ ScriptInterpreter *_script;
+ Screen *_screen;
+ SegmentMap *_segmap;
+ Sound *_sound;
+
+ Common::String _sysStrings[kSysStrCount];
+
+ int _saveLoadRequested;
+ int _saveLoadSlot;
+ Common::String _saveLoadDescription;
+
+ uint _sceneResIndex;
+ int16 _sceneWidth, _sceneHeight;
+
+ int _counter01, _counter02;
+ bool _movieSceneFlag;
+ byte _flag01;
+
+ int16 _cameraX, _cameraY;
+ int16 _newCameraX, _newCameraY;
+ int16 _cameraHeight;
+ int16 _guiHeight;
+
+ bool _doSpeech, _doText;
+
+ int16 _walkSpeedY, _walkSpeedX;
+
+ Common::KeyState _keyState;
+ int16 _mouseX, _mouseY;
+ int16 _mouseDblClickTicks;
+ bool _mouseWaitForRelease;
+ byte _mouseButton;
+ int16 _mouseDisabled;
+ bool _leftButtonDown, _rightButtonDown;
+
+ const char *getSysString(int index) const { return _sysStrings[index].c_str(); }
+
+ /* Save/load */
+
+ enum kReadSaveHeaderError {
+ kRSHENoError = 0,
+ kRSHEInvalidType = 1,
+ kRSHEInvalidVersion = 2,
+ kRSHEIoError = 3
+ };
+
+ struct SaveHeader {
+ Common::String description;
+ uint32 version;
+ byte gameID;
+ uint32 flags;
+ uint32 saveDate;
+ uint32 saveTime;
+ uint32 playTime;
+ Graphics::Surface *thumbnail;
+ };
+
+ bool _isSaveAllowed;
+
+ bool canLoadGameStateCurrently() { return _isSaveAllowed; }
+ bool canSaveGameStateCurrently() { return _isSaveAllowed; }
+ Common::Error loadGameState(int slot);
+ Common::Error saveGameState(int slot, const Common::String &description);
+ void savegame(const char *filename, const char *description);
+ void loadgame(const char *filename);
+
+ const char *getSavegameFilename(int num);
+ static Common::String getSavegameFilename(const Common::String &target, int num);
+
+ static kReadSaveHeaderError readSaveHeader(Common::SeekableReadStream *in, bool loadThumbnail, SaveHeader &header);
+
+};
+
+} // End of namespace Toltecs
+
+#endif /* TOLTECS_H */
diff --git a/engines/toon/anim.cpp b/engines/toon/anim.cpp
index a529001af5..98c667c303 100644
--- a/engines/toon/anim.cpp
+++ b/engines/toon/anim.cpp
@@ -29,7 +29,7 @@
namespace Toon {
-bool Animation::loadAnimation(Common::String file) {
+bool Animation::loadAnimation(const Common::String &file) {
debugC(1, kDebugAnim, "loadAnimation(%s)", file.c_str());
uint32 fileSize = 0;
diff --git a/engines/toon/anim.h b/engines/toon/anim.h
index 4b95b6cf40..eb8dcbd600 100644
--- a/engines/toon/anim.h
+++ b/engines/toon/anim.h
@@ -60,7 +60,7 @@ public:
int32 _paletteEntries;
char _name[32];
- bool loadAnimation(Common::String file);
+ bool loadAnimation(const Common::String &file);
void drawFrame(Graphics::Surface &surface, int32 frame, int32 x, int32 y);
void drawFontFrame(Graphics::Surface &surface, int32 frame, int32 x, int32 y, byte *colorMap);
void drawFrameOnPicture(int32 frame, int32 x, int32 y);
diff --git a/engines/toon/audio.cpp b/engines/toon/audio.cpp
index 5b2d06b74d..b9adfa7eeb 100644
--- a/engines/toon/audio.cpp
+++ b/engines/toon/audio.cpp
@@ -84,7 +84,7 @@ void AudioManager::removeInstance(AudioStreamInstance *inst) {
}
}
-void AudioManager::playMusic(Common::String dir, Common::String music) {
+void AudioManager::playMusic(const Common::String &dir, const Common::String &music) {
debugC(1, kDebugAudio, "playMusic(%s, %s)", dir.c_str(), music.c_str());
// two musics can be played at same time
@@ -199,7 +199,7 @@ void AudioManager::closeAudioPack(int32 id) {
_audioPacks[id] = NULL;
}
-bool AudioManager::loadAudioPack(int32 id, Common::String indexFile, Common::String packFile) {
+bool AudioManager::loadAudioPack(int32 id, const Common::String &indexFile, const Common::String &packFile) {
debugC(4, kDebugAudio, "loadAudioPack(%d, %s, %s)", id, indexFile.c_str(), packFile.c_str());
closeAudioPack(id);
@@ -481,7 +481,7 @@ AudioStreamPackage::~AudioStreamPackage() {
delete _file;
}
-bool AudioStreamPackage::loadAudioPackage(Common::String indexFile, Common::String streamFile) {
+bool AudioStreamPackage::loadAudioPackage(const Common::String &indexFile, const Common::String &streamFile) {
debugC(4, kDebugAudio, "loadAudioPackage(%s, %s)", indexFile.c_str(), streamFile.c_str());
uint32 size = 0;
diff --git a/engines/toon/audio.h b/engines/toon/audio.h
index 61a534265e..25063603eb 100644
--- a/engines/toon/audio.h
+++ b/engines/toon/audio.h
@@ -103,7 +103,7 @@ public:
AudioStreamPackage(ToonEngine *vm);
~AudioStreamPackage();
- bool loadAudioPackage(Common::String indexFile, Common::String streamFile);
+ bool loadAudioPackage(const Common::String &indexFile, const Common::String &streamFile);
void getInfo(int32 id, int32 *offset, int32 *size);
Common::SeekableReadStream *getStream(int32 id, bool ownMemory = false);
protected:
@@ -131,7 +131,7 @@ public:
bool voiceStillPlaying();
- void playMusic(Common::String dir, Common::String music);
+ void playMusic(const Common::String &dir, const Common::String &music);
void playVoice(int32 id, bool genericVoice);
int32 playSFX(int32 id, int volume, bool genericSFX);
void stopCurrentVoice();
@@ -152,7 +152,7 @@ public:
void setAmbientSFXVolume(int32 id, int volume);
void closeAudioPack(int32 id);
- bool loadAudioPack(int32 id, Common::String indexFile, Common::String packFile);
+ bool loadAudioPack(int32 id, const Common::String &indexFile, const Common::String &packFile);
AudioStreamInstance *_channels[16]; // 0-1 : music
// 2 : voice
diff --git a/engines/toon/character.cpp b/engines/toon/character.cpp
index 7d9a31c170..715bd33433 100644
--- a/engines/toon/character.cpp
+++ b/engines/toon/character.cpp
@@ -292,21 +292,21 @@ int32 Character::getFacing() {
return _facing;
}
-bool Character::loadWalkAnimation(Common::String animName) {
+bool Character::loadWalkAnimation(const Common::String &animName) {
debugC(1, kDebugCharacter, "loadWalkAnimation(%s)", animName.c_str());
delete _walkAnim;
_walkAnim = new Animation(_vm);
return _walkAnim->loadAnimation(animName);
}
-bool Character::loadIdleAnimation(Common::String animName) {
+bool Character::loadIdleAnimation(const Common::String &animName) {
debugC(1, kDebugCharacter, "loadIdleAnimation(%s)", animName.c_str());
delete _idleAnim;
_idleAnim = new Animation(_vm);
return _idleAnim->loadAnimation(animName);
}
-bool Character::loadTalkAnimation(Common::String animName) {
+bool Character::loadTalkAnimation(const Common::String &animName) {
debugC(1, kDebugCharacter, "loadTalkAnimation(%s)", animName.c_str());
delete _talkAnim;
_talkAnim = new Animation(_vm);
@@ -977,7 +977,7 @@ const SpecialCharacterAnimation *Character::getSpecialAnimation(int32 characterI
return &anims[characterAnims[characterId] + animationId];
}
-bool Character::loadShadowAnimation(Common::String animName) {
+bool Character::loadShadowAnimation(const Common::String &animName) {
debugC(1, kDebugCharacter, "loadShadowAnimation(%s)", animName.c_str());
delete _shadowAnim;
diff --git a/engines/toon/character.h b/engines/toon/character.h
index b48991732c..d06a6c060c 100644
--- a/engines/toon/character.h
+++ b/engines/toon/character.h
@@ -74,10 +74,10 @@ public:
virtual bool walkTo(int32 newPosX, int32 newPosY);
virtual bool getVisible();
virtual void setVisible(bool visible);
- virtual bool loadWalkAnimation(Common::String animName);
- virtual bool loadIdleAnimation(Common::String animName);
- virtual bool loadTalkAnimation(Common::String animName);
- virtual bool loadShadowAnimation(Common::String animName);
+ virtual bool loadWalkAnimation(const Common::String &animName);
+ virtual bool loadIdleAnimation(const Common::String &animName);
+ virtual bool loadTalkAnimation(const Common::String &animName);
+ virtual bool loadShadowAnimation(const Common::String &animName);
virtual bool setupPalette();
virtual void playStandingAnim();
virtual void playWalkAnim(int32 start, int32 end);
@@ -96,7 +96,7 @@ public:
virtual void updateTimers(int32 relativeAdd);
virtual void setTalking(bool talking) { _isTalking = talking; }
virtual bool isTalking() { return _isTalking; }
- virtual void resetScale() { };
+ virtual void resetScale() {}
virtual void plotPath(Graphics::Surface& surface);
int32 getFacingFromDirection(int32 dx, int32 dy);
diff --git a/engines/toon/detection.cpp b/engines/toon/detection.cpp
index ac4caae8b2..6a76ade90a 100644
--- a/engines/toon/detection.cpp
+++ b/engines/toon/detection.cpp
@@ -35,8 +35,6 @@ static const PlainGameDescriptor toonGames[] = {
namespace Toon {
-using Common::GUIO_NONE;
-
static const ADGameDescription gameDescriptions[] = {
{
"toon", "",
@@ -46,7 +44,7 @@ static const ADGameDescription gameDescriptions[] = {
{"study.svl", 0, "281efa3f33f6712c0f641a605f4d40fd", 2511090},
AD_LISTEND
},
- Common::EN_ANY, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO_NONE
+ Common::EN_ANY, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO0()
},
{
"toon", "",
@@ -56,7 +54,7 @@ static const ADGameDescription gameDescriptions[] = {
{"study.svl", 0, "df056b94ea83f1ed92a539cf636053ab", 2542668},
AD_LISTEND
},
- Common::FR_FRA, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO_NONE
+ Common::FR_FRA, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO0()
},
{
"toon", "",
@@ -66,7 +64,7 @@ static const ADGameDescription gameDescriptions[] = {
{"study.svl", 0, "72fe96a9e10967d3138e918295babc42", 2910283},
AD_LISTEND
},
- Common::DE_DEU, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO_NONE
+ Common::DE_DEU, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO0()
},
{
"toon", "",
@@ -76,7 +74,7 @@ static const ADGameDescription gameDescriptions[] = {
{"study.svl", 0, "b6b1ee2d9d94d53d305856039ab7bde7", 2634620},
AD_LISTEND
},
- Common::ES_ESP, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO_NONE
+ Common::ES_ESP, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO0()
},
{
"toon", "",
@@ -86,7 +84,7 @@ static const ADGameDescription gameDescriptions[] = {
{"generic.svl", 0, "5eb99850ada22f0b8cf6392262d4dd07", 9404599},
AD_LISTEND
},
- Common::DE_DEU, Common::kPlatformPC, ADGF_DEMO, GUIO_NONE
+ Common::DE_DEU, Common::kPlatformPC, ADGF_DEMO, GUIO0()
},
{
"toon", "",
@@ -95,7 +93,7 @@ static const ADGameDescription gameDescriptions[] = {
{"generic.svl", 0, "5c42724bb93b360dca7044d6b7ef26e5", 7739319},
AD_LISTEND
},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NONE
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO0()
},
AD_TABLE_END_MARKER
diff --git a/engines/toon/font.cpp b/engines/toon/font.cpp
index 63304c905f..d58663a00c 100644
--- a/engines/toon/font.cpp
+++ b/engines/toon/font.cpp
@@ -65,7 +65,7 @@ byte FontRenderer::textToFont(byte c) {
return map_textToFont[c - 0x80];
}
-void FontRenderer::renderText(int32 x, int32 y, Common::String origText, int32 mode) {
+void FontRenderer::renderText(int32 x, int32 y, const Common::String &origText, int32 mode) {
debugC(5, kDebugFont, "renderText(%d, %d, %s, %d)", x, y, origText.c_str(), mode);
int32 xx, yy;
@@ -104,7 +104,7 @@ void FontRenderer::renderText(int32 x, int32 y, Common::String origText, int32 m
}
}
-void FontRenderer::computeSize(Common::String origText, int32 *retX, int32 *retY) {
+void FontRenderer::computeSize(const Common::String &origText, int32 *retX, int32 *retY) {
debugC(4, kDebugFont, "computeSize(%s, retX, retY)", origText.c_str());
int32 lineWidth = 0;
@@ -189,7 +189,7 @@ void FontRenderer::setFontColor(int32 fontColor1, int32 fontColor2, int32 fontCo
_currentFontColor[3] = fontColor3;
}
-void FontRenderer::renderMultiLineText(int32 x, int32 y, Common::String origText, int32 mode) {
+void FontRenderer::renderMultiLineText(int32 x, int32 y, const Common::String &origText, int32 mode) {
debugC(5, kDebugFont, "renderMultiLineText(%d, %d, %s, %d)", x, y, origText.c_str(), mode);
// divide the text in several lines
diff --git a/engines/toon/font.h b/engines/toon/font.h
index 168c61f27e..349d9d1ee7 100644
--- a/engines/toon/font.h
+++ b/engines/toon/font.h
@@ -33,9 +33,9 @@ public:
~FontRenderer();
void setFont(Animation *font);
- void computeSize(Common::String origText, int32 *retX, int32 *retY);
- void renderText(int32 x, int32 y, Common::String origText, int32 mode);
- void renderMultiLineText(int32 x, int32 y, Common::String origText, int32 mode);
+ void computeSize(const Common::String &origText, int32 *retX, int32 *retY);
+ void renderText(int32 x, int32 y, const Common::String &origText, int32 mode);
+ void renderMultiLineText(int32 x, int32 y, const Common::String &origText, int32 mode);
void setFontColorByCharacter(int32 characterId);
void setFontColor(int32 fontColor1, int32 fontColor2, int32 fontColor3);
protected:
diff --git a/engines/toon/hotspot.cpp b/engines/toon/hotspot.cpp
index ee81b87417..ce2cdf1bb9 100644
--- a/engines/toon/hotspot.cpp
+++ b/engines/toon/hotspot.cpp
@@ -96,7 +96,7 @@ int32 Hotspots::Find(int32 x, int32 y) {
return foundId;
}
-bool Hotspots::LoadRif(Common::String rifName, Common::String additionalRifName) {
+bool Hotspots::LoadRif(const Common::String &rifName, const Common::String &additionalRifName) {
debugC(1, kDebugHotspot, "LoadRif(%s, %s)", rifName.c_str(), additionalRifName.c_str());
uint32 size = 0;
diff --git a/engines/toon/hotspot.h b/engines/toon/hotspot.h
index 49ac1a4af8..70e80046e1 100644
--- a/engines/toon/hotspot.h
+++ b/engines/toon/hotspot.h
@@ -50,7 +50,7 @@ public:
Hotspots(ToonEngine *vm);
~Hotspots();
- bool LoadRif(Common::String rifName, Common::String additionalRifName);
+ bool LoadRif(const Common::String &rifName, const Common::String &additionalRifName);
int32 Find(int32 x, int32 y);
int32 FindBasedOnCorner(int32 x, int32 y);
HotspotData *Get(int32 id);
diff --git a/engines/toon/movie.cpp b/engines/toon/movie.cpp
index 7637f4e62f..59ad8484d5 100644
--- a/engines/toon/movie.cpp
+++ b/engines/toon/movie.cpp
@@ -83,7 +83,7 @@ Movie::~Movie() {
void Movie::init() const {
}
-void Movie::play(Common::String video, int32 flags) {
+void Movie::play(const Common::String &video, int32 flags) {
debugC(1, kDebugMovie, "play(%s, %d)", video.c_str(), flags);
bool isFirstIntroVideo = false;
if (video == "209_1M.SMK")
diff --git a/engines/toon/movie.h b/engines/toon/movie.h
index 7e443fd8ab..2cd33302f2 100644
--- a/engines/toon/movie.h
+++ b/engines/toon/movie.h
@@ -45,7 +45,7 @@ public:
virtual ~Movie(void);
void init() const;
- void play(Common::String video, int32 flags = 0);
+ void play(const Common::String &video, int32 flags = 0);
bool isPlaying() { return _playing; }
protected:
diff --git a/engines/toon/picture.cpp b/engines/toon/picture.cpp
index 6367165d6f..ff136e5acb 100644
--- a/engines/toon/picture.cpp
+++ b/engines/toon/picture.cpp
@@ -29,7 +29,7 @@
namespace Toon {
-bool Picture::loadPicture(Common::String file) {
+bool Picture::loadPicture(const Common::String &file) {
debugC(1, kDebugPicture, "loadPicture(%s)", file.c_str());
uint32 size = 0;
diff --git a/engines/toon/picture.h b/engines/toon/picture.h
index ee0e006702..460c5b58a2 100644
--- a/engines/toon/picture.h
+++ b/engines/toon/picture.h
@@ -38,7 +38,7 @@ class Picture {
public:
Picture(ToonEngine *vm);
~Picture();
- bool loadPicture(Common::String file);
+ bool loadPicture(const Common::String &file);
void setupPalette();
void draw(Graphics::Surface &surface, int32 x, int32 y, int32 dx, int32 dy);
void drawWithRectList(Graphics::Surface& surface, int32 x, int32 y, int32 dx, int32 dy, Common::Array<Common::Rect>& rectArray);
diff --git a/engines/toon/resource.cpp b/engines/toon/resource.cpp
index 384a363d7d..2d419ec027 100644
--- a/engines/toon/resource.cpp
+++ b/engines/toon/resource.cpp
@@ -50,13 +50,13 @@ Resources::~Resources() {
purgeFileData();
}
-void Resources::removePackageFromCache(Common::String packName) {
+void Resources::removePackageFromCache(const Common::String &packName) {
// I'm not sure what's a good strategy here. It seems unnecessary to
// actually remove the cached resources, because the player may be
// wandering back and forth between rooms. So for now, do nothing.
}
-bool Resources::getFromCache(Common::String fileName, uint32 *fileSize, uint8 **fileData) {
+bool Resources::getFromCache(const Common::String &fileName, uint32 *fileSize, uint8 **fileData) {
for (Common::Array<CacheEntry *>::iterator entry = _resourceCache.begin(); entry != _resourceCache.end(); ++entry) {
if ((*entry)->_data && (*entry)->_fileName.compareToIgnoreCase(fileName) == 0) {
debugC(5, kDebugResource, "getFromCache(%s) - Got %d bytes from %s", fileName.c_str(), (*entry)->_size, (*entry)->_packName.c_str());
@@ -69,7 +69,7 @@ bool Resources::getFromCache(Common::String fileName, uint32 *fileSize, uint8 **
return false;
}
-void Resources::addToCache(Common::String packName, Common::String fileName, uint32 fileSize, uint8 *fileData) {
+void Resources::addToCache(const Common::String &packName, const Common::String &fileName, uint32 fileSize, uint8 *fileData) {
debugC(5, kDebugResource, "addToCache(%s, %s, %d) - Total Size: %d", packName.c_str(), fileName.c_str(), fileSize, _cacheSize + fileSize);
for (Common::Array<CacheEntry *>::iterator entry = _resourceCache.begin(); entry != _resourceCache.end(); ++entry) {
if ((*entry)->_data) {
@@ -115,7 +115,7 @@ void Resources::addToCache(Common::String packName, Common::String fileName, uin
_resourceCache.push_back(entry);
}
-void Resources::openPackage(Common::String fileName) {
+void Resources::openPackage(const Common::String &fileName) {
debugC(1, kDebugResource, "openPackage(%s)", fileName.c_str());
Common::File file;
@@ -132,7 +132,7 @@ void Resources::openPackage(Common::String fileName) {
_pakFiles.push_back(pakFile);
}
-void Resources::closePackage(Common::String fileName) {
+void Resources::closePackage(const Common::String &fileName) {
removePackageFromCache(fileName);
for (uint32 i = 0; i < _pakFiles.size(); i++) {
@@ -144,7 +144,7 @@ void Resources::closePackage(Common::String fileName) {
}
}
-uint8 *Resources::getFileData(Common::String fileName, uint32 *fileSize) {
+uint8 *Resources::getFileData(const Common::String &fileName, uint32 *fileSize) {
debugC(4, kDebugResource, "getFileData(%s, fileSize)", fileName.c_str());
// first try to find files outside of .pak
@@ -184,7 +184,7 @@ uint8 *Resources::getFileData(Common::String fileName, uint32 *fileSize) {
}
}
-Common::SeekableReadStream *Resources::openFile(Common::String fileName) {
+Common::SeekableReadStream *Resources::openFile(const Common::String &fileName) {
debugC(1, kDebugResource, "openFile(%s)", fileName.c_str());
// first try to find files outside of .pak
@@ -216,7 +216,7 @@ void Resources::purgeFileData() {
_allocatedFileData.clear();
}
-Common::SeekableReadStream *PakFile::createReadStream(Common::String fileName) {
+Common::SeekableReadStream *PakFile::createReadStream(const Common::String &fileName) {
debugC(1, kDebugResource, "createReadStream(%s)", fileName.c_str());
uint32 fileSize = 0;
@@ -227,7 +227,7 @@ Common::SeekableReadStream *PakFile::createReadStream(Common::String fileName) {
return 0;
}
-uint8 *PakFile::getFileData(Common::String fileName, uint32 *fileSize) {
+uint8 *PakFile::getFileData(const Common::String &fileName, uint32 *fileSize) {
debugC(4, kDebugResource, "getFileData(%s, fileSize)", fileName.c_str());
for (uint32 i = 0; i < _numFiles; i++) {
@@ -250,7 +250,7 @@ uint8 *PakFile::getFileData(Common::String fileName, uint32 *fileSize) {
return 0;
}
-void PakFile::open(Common::SeekableReadStream *rs, Common::String packName) {
+void PakFile::open(Common::SeekableReadStream *rs, const Common::String &packName) {
debugC(1, kDebugResource, "open(rs)");
char buffer[64];
diff --git a/engines/toon/resource.h b/engines/toon/resource.h
index 0cecad8187..c80ac2216e 100644
--- a/engines/toon/resource.h
+++ b/engines/toon/resource.h
@@ -37,10 +37,10 @@ public:
PakFile();
~PakFile();
- void open(Common::SeekableReadStream *rs, Common::String packName);
- uint8 *getFileData(Common::String fileName, uint32 *fileSize);
+ void open(Common::SeekableReadStream *rs, const Common::String &packName);
+ uint8 *getFileData(const Common::String &fileName, uint32 *fileSize);
Common::String getPackName() { return _packName; }
- Common::SeekableReadStream *createReadStream(Common::String fileName);
+ Common::SeekableReadStream *createReadStream(const Common::String &fileName);
void close();
protected:
@@ -76,10 +76,10 @@ class Resources {
public:
Resources(ToonEngine *vm);
~Resources();
- void openPackage(Common::String file);
- void closePackage(Common::String fileName);
- Common::SeekableReadStream *openFile(Common::String file);
- uint8 *getFileData(Common::String fileName, uint32 *fileSize); // this memory must be copied to your own structures!
+ void openPackage(const Common::String &file);
+ void closePackage(const Common::String &fileName);
+ Common::SeekableReadStream *openFile(const Common::String &file);
+ uint8 *getFileData(const Common::String &fileName, uint32 *fileSize); // this memory must be copied to your own structures!
void purgeFileData();
protected:
@@ -89,9 +89,9 @@ protected:
uint32 _cacheSize;
Common::Array<CacheEntry *> _resourceCache;
- void removePackageFromCache(Common::String packName);
- bool getFromCache(Common::String fileName, uint32 *fileSize, uint8 **fileData);
- void addToCache(Common::String packName, Common::String fileName, uint32 fileSize, uint8 *fileData);
+ void removePackageFromCache(const Common::String &packName);
+ bool getFromCache(const Common::String &fileName, uint32 *fileSize, uint8 **fileData);
+ void addToCache(const Common::String &packName, const Common::String &fileName, uint32 fileSize, uint8 *fileData);
};
} // End of namespace Toon
diff --git a/engines/toon/text.cpp b/engines/toon/text.cpp
index 0f72d58b3b..bd4583d799 100644
--- a/engines/toon/text.cpp
+++ b/engines/toon/text.cpp
@@ -35,7 +35,7 @@ TextResource::~TextResource(void) {
delete[] _textData;
}
-bool TextResource::loadTextResource(Common::String fileName) {
+bool TextResource::loadTextResource(const Common::String &fileName) {
debugC(1, kDebugText, "loadTextResource(%s)", fileName.c_str());
uint32 fileSize = 0;
diff --git a/engines/toon/text.h b/engines/toon/text.h
index b8f4a96a6a..cd575736b7 100644
--- a/engines/toon/text.h
+++ b/engines/toon/text.h
@@ -32,7 +32,7 @@ public:
TextResource(ToonEngine *vm);
~TextResource(void);
- bool loadTextResource(Common::String fileName);
+ bool loadTextResource(const Common::String &fileName);
char *getText(int32 id);
int32 getId(int32 offset);
int32 getNext(int32 offset);
diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp
index b3ab591ba7..13f702e3dd 100644
--- a/engines/toon/toon.cpp
+++ b/engines/toon/toon.cpp
@@ -192,7 +192,7 @@ void ToonEngine::parseInput() {
}
if (event.kbd.keycode == Common::KEYCODE_F5 && !hasModifier) {
if (canSaveGameStateCurrently())
- saveGame(-1, Common::String());
+ saveGame(-1, "");
}
if (event.kbd.keycode == Common::KEYCODE_F6 && !hasModifier) {
if (canLoadGameStateCurrently())
@@ -214,7 +214,7 @@ void ToonEngine::parseInput() {
if (event.kbd.flags & Common::KBD_ALT) {
int slotNum = event.kbd.ascii - '0';
if (slotNum >= 0 && slotNum <= 9 && canSaveGameStateCurrently()) {
- if (saveGame(slotNum, Common::String())) {
+ if (saveGame(slotNum, "")) {
// ok
Common::String buf = Common::String::format("Saved game in slot #%d ", slotNum);
GUI::TimedMessageDialog dialog(buf, 1000);
@@ -1084,9 +1084,6 @@ void ToonEngine::updateAnimationSceneScripts(int32 timeElapsed) {
}
void ToonEngine::loadScene(int32 SceneId, bool forGameLoad) {
- char temp[256];
- char temp2[256];
-
_firstFrame = true;
_gameState->_lastVisitedScene = _gameState->_currentScene;
@@ -1148,79 +1145,54 @@ void ToonEngine::loadScene(int32 SceneId, bool forGameLoad) {
_mouseButton = 0;
_lastMouseButton = 0x3;
+ Common::String locationName = state()->_locations[SceneId]._name;
+
// load package
- strcpy(temp, createRoomFilename(Common::String::format("%s.PAK", _gameState->_locations[_gameState->_currentScene]._name).c_str()).c_str());
- resources()->openPackage(temp);
+ resources()->openPackage(createRoomFilename(locationName + ".PAK"));
- strcpy(temp, state()->_locations[SceneId]._name);
- strcat(temp, ".NPP");
- loadAdditionalPalette(temp, 0);
+ loadAdditionalPalette(locationName + ".NPP", 0);
_additionalPalette2Present = false;
- strcpy(temp, state()->_locations[SceneId]._name);
- strcat(temp, ".NP2");
- loadAdditionalPalette(temp, 1);
+ loadAdditionalPalette(locationName + ".NP2", 1);
- strcpy(temp, state()->_locations[SceneId]._name);
- strcat(temp, ".CUP");
- loadAdditionalPalette(temp, 2);
+ loadAdditionalPalette(locationName + ".CUP", 2);
// load artwork
- strcpy(temp, state()->_locations[SceneId]._name);
- strcat(temp, ".CPS");
delete _currentPicture;
_currentPicture = new Picture(this);
- _currentPicture->loadPicture(temp);
+ _currentPicture->loadPicture(locationName + ".CPS");
_currentPicture->setupPalette();
- strcpy(temp, state()->_locations[SceneId]._name);
- strcat(temp, ".MSC");
delete _currentMask;
_currentMask = new Picture(this);
- if (_currentMask->loadPicture(temp))
+ if (_currentMask->loadPicture(locationName + ".MSC"))
_pathFinding->init(_currentMask);
- strcpy(temp, state()->_locations[SceneId]._name);
- strcat(temp, ".TRE");
delete _roomTexts;
_roomTexts = new TextResource(this);
- _roomTexts->loadTextResource(temp);
+ _roomTexts->loadTextResource(locationName + ".TRE");
- strcpy(temp, state()->_locations[SceneId]._name);
- strcat(temp, ".DAT");
uint32 fileSize;
- uint8 *sceneData = resources()->getFileData(temp, &fileSize);
+ uint8 *sceneData = resources()->getFileData(locationName + ".DAT", &fileSize);
if (sceneData) {
delete[] _roomScaleData;
_roomScaleData = new uint8[fileSize];
memcpy(_roomScaleData, sceneData, fileSize);
}
- strcpy(temp, state()->_locations[SceneId]._name);
- strcat(temp, ".SVI");
- strcpy(temp2, createRoomFilename(Common::String::format("%s.SVL", _gameState->_locations[_gameState->_currentScene]._name).c_str()).c_str());
- _audioManager->loadAudioPack(1, temp, temp2);
- strcpy(temp, state()->_locations[SceneId]._name);
- strcpy(temp2, state()->_locations[SceneId]._name);
- strcat(temp, ".SEI");
- strcat(temp2, ".SEL");
- _audioManager->loadAudioPack(3, temp, temp2);
+ _audioManager->loadAudioPack(1, locationName + ".SVI", createRoomFilename(locationName + ".SVL"));
+ _audioManager->loadAudioPack(3, locationName + ".SEI", locationName + ".SEL");
- strcpy(temp, state()->_locations[SceneId]._name);
- strcat(temp, ".RIC");
if (state()->_locations[SceneId]._flags & 0x40) {
- strcpy(temp2, state()->_locations[SceneId]._cutaway);
- strcat(temp2, ".RIC");
+ Common::String cutaway = state()->_locations[SceneId]._cutaway;
+ _hotspots->LoadRif(locationName + ".RIC", cutaway + ".RIC");
} else {
- strcpy(temp2, "");
+ _hotspots->LoadRif(locationName + ".RIC", "");
}
- _hotspots->LoadRif(temp, temp2);
restoreRifFlags(_gameState->_currentScene);
- strcpy(temp, state()->_locations[SceneId]._name);
- strcat(temp, ".CNV");
uint32 convfileSize;
- uint8 *convData = resources()->getFileData(temp, &convfileSize);
+ uint8 *convData = resources()->getFileData(locationName + ".CNV", &convfileSize);
if (convData) {
assert(convfileSize < 4096 * sizeof(int16));
memcpy(_conversationData , convData, convfileSize);
@@ -1228,8 +1200,6 @@ void ToonEngine::loadScene(int32 SceneId, bool forGameLoad) {
}
// load script
- strcpy(temp, state()->_locations[SceneId]._name);
- strcat(temp, ".EMC");
_oldTimer = _system->getMillis();
_oldTimer2 = _oldTimer;
@@ -1239,7 +1209,8 @@ void ToonEngine::loadScene(int32 SceneId, bool forGameLoad) {
_flux->update(0);
_script->unload(&_scriptData);
- _script->load(temp, &_scriptData, &_script_func->_opcodes);
+ Common::String emcfile = locationName + ".EMC";
+ _script->load(emcfile.c_str(), &_scriptData, &_script_func->_opcodes);
_script->init(&_scriptState[0], &_scriptData);
_script->init(&_scriptState[1], &_scriptData);
_script->init(&_scriptState[2], &_scriptData);
@@ -1312,7 +1283,7 @@ void ToonEngine::setupGeneralPalette() {
_drew->setupPalette();
}
-void ToonEngine::loadAdditionalPalette(Common::String fileName, int32 mode) {
+void ToonEngine::loadAdditionalPalette(const Common::String &fileName, int32 mode) {
uint32 size = 0;
uint8 *palette = resources()->getFileData(fileName, &size);
@@ -1779,9 +1750,8 @@ void ToonEngine::exitScene() {
_currentTextLineId = -1;
_currentTextLineCharacterId = 0;
- char temp[256];
- strcpy(temp, createRoomFilename(Common::String::format("%s.PAK", _gameState->_locations[_gameState->_currentScene]._name).c_str()).c_str());
- resources()->closePackage(temp);
+ Common::String locationName = _gameState->_locations[_gameState->_currentScene]._name;
+ resources()->closePackage(createRoomFilename(locationName + ".PAK"));
_drew->stopWalk();
_flux->stopWalk();
@@ -2785,13 +2755,15 @@ void ToonEngine::deleteMouseItem() {
setCursor(0);
}
-void ToonEngine::showCutaway(Common::String cutawayPicture) {
+void ToonEngine::showCutaway(const Common::String &cutawayPicture) {
_gameState->_inCutaway = true;
_currentCutaway = new Picture(this);
- if (cutawayPicture == "") {
- cutawayPicture = Common::String(_gameState->_locations[_gameState->_currentScene]._cutaway) + ".CPS";
+ if (cutawayPicture.empty()) {
+ Common::String name = _gameState->_locations[_gameState->_currentScene]._cutaway;
+ _currentCutaway->loadPicture(name + ".CPS");
+ } else {
+ _currentCutaway->loadPicture(cutawayPicture);
}
- _currentCutaway->loadPicture(cutawayPicture);
_currentCutaway->setupPalette();
_oldScrollValue = _gameState->_currentScrollValue;
_gameState->_currentScrollValue = 0;
@@ -2942,7 +2914,7 @@ void ToonEngine::drawConversationLine() {
if (_currentTextLine && _showConversationText) {
_fontRenderer->setFontColorByCharacter(_currentTextLineCharacterId);
_fontRenderer->setFont(_fontToon);
- _fontRenderer->renderMultiLineText(_currentTextLineX, _currentTextLineY, Common::String(_currentTextLine), 0);
+ _fontRenderer->renderMultiLineText(_currentTextLineX, _currentTextLineY, _currentTextLine, 0);
}
}
@@ -2988,7 +2960,7 @@ Common::String ToonEngine::getSavegameName(int nr) {
return _targetName + Common::String::format(".%03d", nr);
}
-bool ToonEngine::saveGame(int32 slot, Common::String saveGameDesc) {
+bool ToonEngine::saveGame(int32 slot, const Common::String &saveGameDesc) {
const EnginePlugin *plugin = NULL;
int16 savegameId;
Common::String savegameDescription;
@@ -3418,7 +3390,7 @@ const char *ToonEngine::getSpecialConversationMusic(int32 conversationId) {
return specialMusic[randRange(0, 1) + conversationId * 2];
}
-void ToonEngine::viewInventoryItem(Common::String str, int32 lineId, int32 itemDest) {
+void ToonEngine::viewInventoryItem(const Common::String &str, int32 lineId, int32 itemDest) {
storePalette();
fadeOut(5);
@@ -4511,7 +4483,7 @@ int32 ToonEngine::pauseSceneAnimationScript(int32 animScriptId, int32 tickToWait
return nextTicks;
}
-Common::String ToonEngine::createRoomFilename(Common::String name) {
+Common::String ToonEngine::createRoomFilename(const Common::String& name) {
Common::String file = Common::String::format("ACT%d/%s/%s", _gameState->_currentChapter, _gameState->_locations[_gameState->_currentScene]._name, name.c_str());
return file;
}
diff --git a/engines/toon/toon.h b/engines/toon/toon.h
index cad684d590..540f3e403b 100644
--- a/engines/toon/toon.h
+++ b/engines/toon/toon.h
@@ -126,7 +126,7 @@ public:
void exitScene();
void loadCursor();
void setCursor(int32 type, bool inventory = false, int32 offsetX = 0, int offsetY = 0);
- void loadAdditionalPalette(Common::String fileName, int32 mode);
+ void loadAdditionalPalette(const Common::String &fileName, int32 mode);
void setupGeneralPalette();
void render();
void update(int32 timeIncrement);
@@ -167,7 +167,7 @@ public:
void rearrangeInventory();
void createMouseItem(int32 item);
void deleteMouseItem();
- void showCutaway(Common::String cutawayPicture);
+ void showCutaway(const Common::String &cutawayPicture);
void hideCutaway();
void drawPalette();
void newGame();
@@ -181,7 +181,7 @@ public:
Character *getCharacterById(int32 charId);
Common::String getSavegameName(int nr);
bool loadGame(int32 slot);
- bool saveGame(int32 slot, Common::String saveGameDesc);
+ bool saveGame(int32 slot, const Common::String &saveGameDesc);
void fadeIn(int32 numFrames);
void fadeOut(int32 numFrames);
void initCharacter(int32 characterId, int32 animScriptId, int32 animToPlayId, int32 sceneAnimationId);
@@ -190,7 +190,7 @@ public:
int32 handleInventoryOnDrew(int32 itemId);
int32 pauseSceneAnimationScript(int32 animScriptId, int32 tickToWait);
void updateTimer(int32 timeIncrement);
- Common::String createRoomFilename(Common::String name);
+ Common::String createRoomFilename(const Common::String &name);
void createShadowLUT();
void playTalkAnimOnCharacter(int32 animID, int32 characterId, bool talker);
void updateScrolling(bool force, int32 timeIncrement);
@@ -201,7 +201,7 @@ public:
void makeLineNonWalkable(int32 x, int32 y, int32 x2, int32 y2);
void makeLineWalkable(int32 x, int32 y, int32 x2, int32 y2);
void renderInventory();
- void viewInventoryItem(Common::String str, int32 lineId, int32 itemDest);
+ void viewInventoryItem(const Common::String &str, int32 lineId, int32 itemDest);
void storePalette();
void restorePalette();
const char *getSpecialConversationMusic(int32 locationId);
diff --git a/engines/touche/detection.cpp b/engines/touche/detection.cpp
index 0684144473..35dd54776f 100644
--- a/engines/touche/detection.cpp
+++ b/engines/touche/detection.cpp
@@ -37,8 +37,6 @@ static const PlainGameDescriptor toucheGames[] = {
namespace Touche {
-using Common::GUIO_NONE;
-
static const ADGameDescription gameDescriptions[] = {
{ // retail version
"touche",
@@ -47,7 +45,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
{ // retail version - tracker item #1601818
"touche",
@@ -56,7 +54,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
{ // retail version
"touche",
@@ -65,7 +63,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
{ // retail version - tracker item #1598643
"touche",
@@ -74,7 +72,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
{ // retail version - tracker item #1681643
"touche",
@@ -83,7 +81,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
{ // fan-made translation (http://www.iagtg.net/) - tracker item #1602360
"touche",
@@ -92,7 +90,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
{ // retail version - tracker item #1800500
"touche",
@@ -101,7 +99,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::PL_POL,
Common::kPlatformPC,
ADGF_NO_FLAGS,
- GUIO_NONE
+ GUIO0()
},
{ // demo version
"touche",
@@ -110,7 +108,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- GUIO_NONE
+ GUIO0()
},
AD_TABLE_END_MARKER
};
diff --git a/engines/touche/resource.cpp b/engines/touche/resource.cpp
index 6df6fc0e5f..0790d726b7 100644
--- a/engines/touche/resource.cpp
+++ b/engines/touche/resource.cpp
@@ -590,8 +590,14 @@ void ToucheEngine::res_loadSound(int priority, int num) {
if (priority >= 0) {
uint32 size;
const uint32 offs = res_getDataOffset(kResourceTypeSound, num, &size);
- _fData.seek(offs);
- Audio::AudioStream *stream = Audio::makeVOCStream(&_fData, Audio::FLAG_UNSIGNED);
+ Common::SeekableReadStream *datastream = SearchMan.createReadStreamForMember("TOUCHE.DAT");
+ if (!datastream) {
+ warning("res_loadSound: Could not open TOUCHE.DAT");
+ return;
+ }
+
+ datastream->seek(offs);
+ Audio::AudioStream *stream = Audio::makeVOCStream(datastream, Audio::FLAG_UNSIGNED, DisposeAfterUse::YES);
if (stream) {
_mixer->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, stream);
}
diff --git a/engines/tsage/blue_force/blueforce_dialogs.cpp b/engines/tsage/blue_force/blueforce_dialogs.cpp
index 86feceb015..b9b3ad6c22 100644
--- a/engines/tsage/blue_force/blueforce_dialogs.cpp
+++ b/engines/tsage/blue_force/blueforce_dialogs.cpp
@@ -187,6 +187,7 @@ void RightClickDialog::execute() {
break;
case 4:
// Options dialog
+ BlueForce::OptionsDialog::show();
break;
}
@@ -428,6 +429,72 @@ int RadioConvDialog::show() {
return btnIndex;
}
+/*--------------------------------------------------------------------------*/
+
+void OptionsDialog::show() {
+ OptionsDialog *dlg = new OptionsDialog();
+ dlg->draw();
+
+ GfxButton *btn = dlg->execute();
+
+ if (btn == &dlg->_btnQuit) {
+ // Quit game
+ if (MessageDialog::show(QUIT_CONFIRM_MSG, CANCEL_BTN_STRING, QUIT_BTN_STRING) == 1) {
+ g_vm->quitGame();
+ }
+ } else if (btn == &dlg->_btnRestart) {
+ // Restart game
+ g_globals->_game->restartGame();
+ } else if (btn == &dlg->_btnSound) {
+ // Sound dialog
+ SoundDialog::execute();
+ } else if (btn == &dlg->_btnSave) {
+ // Save button
+ g_globals->_game->saveGame();
+ } else if (btn == &dlg->_btnRestore) {
+ // Restore button
+ g_globals->_game->restoreGame();
+ }
+
+ dlg->remove();
+ delete dlg;
+}
+
+OptionsDialog::OptionsDialog() {
+ // Set the element text
+ _gfxMessage.set(OPTIONS_MSG, 140, ALIGN_LEFT);
+ _btnRestore.setText(RESTORE_BTN_STRING);
+ _btnSave.setText(SAVE_BTN_STRING);
+ _btnRestart.setText(RESTART_BTN_STRING);
+ _btnQuit.setText(QUIT_BTN_STRING);
+ _btnSound.setText(SOUND_BTN_STRING);
+ _btnResume.setText(RESUME_BTN_STRING);
+
+ // Set position of the elements
+ _gfxMessage._bounds.moveTo(0, 1);
+ _btnRestore._bounds.moveTo(0, _gfxMessage._bounds.bottom + 1);
+ _btnSave._bounds.moveTo(0, _btnRestore._bounds.bottom + 1);
+ _btnRestart._bounds.moveTo(0, _btnSave._bounds.bottom + 1);
+ _btnQuit._bounds.moveTo(0, _btnRestart._bounds.bottom + 1);
+ _btnSound._bounds.moveTo(0, _btnQuit._bounds.bottom + 1);
+ _btnResume._bounds.moveTo(0, _btnSound._bounds.bottom + 1);
+
+ // Set all the buttons to the widest button
+ GfxButton *btnList[6] = {&_btnRestore, &_btnSave, &_btnRestart, &_btnQuit, &_btnSound, &_btnResume};
+ int16 btnWidth = 0;
+ for (int idx = 0; idx < 6; ++idx)
+ btnWidth = MAX(btnWidth, btnList[idx]->_bounds.width());
+ for (int idx = 0; idx < 6; ++idx)
+ btnList[idx]->_bounds.setWidth(btnWidth);
+
+ // Add the items to the dialog
+ addElements(&_gfxMessage, &_btnRestore, &_btnSave, &_btnRestart, &_btnQuit, &_btnSound, &_btnResume, NULL);
+
+ // Set the dialog size and position
+ frame();
+ _bounds.collapse(-6, -6);
+ setCenter(160, 90);
+}
} // End of namespace BlueForce
diff --git a/engines/tsage/blue_force/blueforce_dialogs.h b/engines/tsage/blue_force/blueforce_dialogs.h
index ca51c97aa2..76de7d19d9 100644
--- a/engines/tsage/blue_force/blueforce_dialogs.h
+++ b/engines/tsage/blue_force/blueforce_dialogs.h
@@ -85,6 +85,20 @@ public:
static int show();
};
+class OptionsDialog: public GfxDialog {
+private:
+ GfxButton _btnSave, _btnRestore, _btnRestart;
+ GfxButton _btnQuit, _btnResume;
+ GfxButton _btnSound;
+ GfxMessage _gfxMessage;
+public:
+ OptionsDialog();
+ virtual ~OptionsDialog() {}
+
+ static void show();
+};
+
+
} // End of namespace BlueForce
} // End of namespace TsAGE
diff --git a/engines/tsage/blue_force/blueforce_logic.cpp b/engines/tsage/blue_force/blueforce_logic.cpp
index 247fc4b9f2..22299c1bf1 100644
--- a/engines/tsage/blue_force/blueforce_logic.cpp
+++ b/engines/tsage/blue_force/blueforce_logic.cpp
@@ -43,9 +43,7 @@ namespace BlueForce {
void BlueForceGame::start() {
// Start the game
- g_globals->_sceneManager.changeScene(300);
-
- g_globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_sceneManager.changeScene(20);
}
Scene *BlueForceGame::createScene(int sceneNumber) {
@@ -65,17 +63,32 @@ Scene *BlueForceGame::createScene(int sceneNumber) {
// Tsnunami Title Screen #2
return new Scene100();
case 109:
- // Introduction Bar Room
+ // Introduction - Bar Room
return new Scene109();
case 110:
+ // Introduction - Outside the bar
+ return new Scene110();
case 114:
+ // Outside Tony's Bar
+ return new Scene114();
case 115:
+ // Inside Tony's Bar
+ return new Scene115();
case 125:
+ // Intro - Chase in the city
+ return new Scene125();
case 140:
+ // Intro - Burglar near the House
+ return new Scene140();
case 150:
+ // Intro - Burglar inside the house
+ return new Scene150();
case 160:
+ // Intro - Burial
+ return new Scene160();
case 180:
- error("Scene group 1 not implemented");
+ // Front of Home
+ return new Scene180();
case 190:
// Front of Police Station
return new Scene190();
@@ -92,7 +105,7 @@ Scene *BlueForceGame::createScene(int sceneNumber) {
// Credits - Gun Training
return new Scene225();
case 265:
- // Graduation Article
+ // Intro - Graduation Article
return new Scene265();
case 270:
// Living Room & Kitchen
@@ -101,7 +114,8 @@ Scene *BlueForceGame::createScene(int sceneNumber) {
// Living Room & Kitchen #2
return new Scene271();
case 280:
- error("Scene group 2 not implemented");
+ // Bedroom Flashback cut-scene
+ return new Scene280();
case 300:
// Outside Police Station
return new Scene300();
@@ -184,13 +198,17 @@ Scene *BlueForceGame::createScene(int sceneNumber) {
// Decking
return new Scene690();
case 710:
+ // Beach
return new Scene710();
case 800:
// Jamison & Ryan
return new Scene800();
case 810:
+ // Lyle's Office
+ return new Scene810();
case 820:
- error("Scene group 8 not implemented");
+ // Microfiche Reader
+ return new Scene820();
case 830:
// Outside Boat Rentals
return new Scene830();
@@ -198,17 +216,25 @@ Scene *BlueForceGame::createScene(int sceneNumber) {
// Boat Rentals
return new Scene840();
case 850:
+ // Boat Leaving/Entering Marina
+ return new Scene850();
case 860:
+ // Boat Entering Cove
+ return new Scene860();
case 870:
+ // Cove Beach
+ return new Scene870();
case 880:
- error("Scene group 8 not implemented");
+ // Beach Path
+ return new Scene880();
case 900:
- // Outside Warehouse
+ // Outside the Warehouse
return new Scene900();
case 910:
- error("Scene group 9 not implemented");
+ // Inside the Warehouse
+ return new Scene910();
case 920:
- // Inside Warehouse: Secret room
+ // Inside the Warehouse: Secret room
return new Scene920();
case 930:
// Inside the caravan
@@ -217,6 +243,7 @@ Scene *BlueForceGame::createScene(int sceneNumber) {
// Hidden in the wardrobe
return new Scene935();
case 940:
+ // Jail ending animation
return new Scene940();
default:
error("Unknown scene number - %d", sceneNumber);
@@ -224,6 +251,20 @@ Scene *BlueForceGame::createScene(int sceneNumber) {
}
}
+/**
+ * Returns true if it is currently okay to restore a game
+ */
+bool BlueForceGame::canLoadGameStateCurrently() {
+ return true;
+}
+
+/**
+ * Returns true if it is currently okay to save the game
+ */
+bool BlueForceGame::canSaveGameStateCurrently() {
+ return true;
+}
+
void BlueForceGame::rightClick() {
RightClickDialog *dlg = new RightClickDialog();
dlg->execute();
@@ -274,6 +315,24 @@ void BlueForceGame::processEvent(Event &event) {
}
}
+void BlueForceGame::restart() {
+ g_globals->_scenePalette.clearListeners();
+ g_globals->_soundHandler.stop();
+
+ // Reset the globals
+ g_globals->reset();
+
+ // Clear save/load slots
+ g_globals->_sceneHandler->_saveGameSlot = -1;
+ g_globals->_sceneHandler->_loadGameSlot = -1;
+
+ g_globals->_stripNum = 0;
+ g_globals->_events.setCursor(CURSOR_WALK);
+
+ // Change to the first game scene
+ g_globals->_sceneManager.changeScene(190);
+}
+
/*--------------------------------------------------------------------------*/
AObjectArray::AObjectArray(): EventHandler() {
@@ -563,15 +622,15 @@ void FollowerObject::dispatch() {
} else if ((_object->_visage != 308) || (_object->_strip != 1)) {
show();
setStrip(_object->_strip);
- setPosition(_object->_position, _object->_yDiff);
+ setPosition(Common::Point(_object->_position.x + 1, _object->_position.y), _yDiff);
}
}
void FollowerObject::reposition() {
assert(_object);
setStrip(_object->_strip);
- setPosition(_object->_position, _object->_yDiff);
- reposition();
+ setPosition(_object->_position, _yDiff);
+ NamedObject::reposition();
}
void FollowerObject::setup(SceneObject *object, int visage, int frameNum, int yDiff) {
@@ -665,13 +724,28 @@ void SceneExt::postInit(SceneObjectList *OwnerList) {
Scene::postInit(OwnerList);
if (BF_GLOBALS._dayNumber) {
// Blank out the bottom portion of the screen
- BF_GLOBALS._interfaceY = BF_INTERFACE_Y;
+ BF_GLOBALS._interfaceY = UI_INTERFACE_Y;
- Rect r(0, BF_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT);
+ Rect r(0, UI_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT);
BF_GLOBALS.gfxManager().getSurface().fillRect(r, 0);
}
}
+void SceneExt::remove() {
+ T2_GLOBALS._uiElements.hide();
+ T2_GLOBALS._uiElements.resetClear();
+
+ // Below code originally in Blue Force Scene::remove(). Placed here to avoid contaminating
+ // core class with Blue Force specific code
+ if (_action) {
+ if (_action->_endHandler)
+ _action->_endHandler = NULL;
+ _action->remove();
+ }
+
+ _focusObject = NULL;
+}
+
void SceneExt::process(Event &event) {
_objArray2.process(event);
if (!event.handled)
@@ -683,8 +757,8 @@ void SceneExt::dispatch() {
if (_field37A) {
if ((--_field37A == 0) && BF_GLOBALS._dayNumber) {
- if (BF_GLOBALS._uiElements._active && BF_GLOBALS._player._enabled) {
- BF_GLOBALS._uiElements.show();
+ if (T2_GLOBALS._uiElements._active && BF_GLOBALS._player._enabled) {
+ T2_GLOBALS._uiElements.show();
}
_field37A = 0;
@@ -699,6 +773,7 @@ void SceneExt::loadScene(int sceneNum) {
_v51C34.top = 0;
_v51C34.bottom = 300;
+ BF_GLOBALS._sceneHandler->_delayTicks = 1;
}
void SceneExt::checkGun() {
@@ -773,8 +848,8 @@ void SceneExt::startStrip() {
scene->_savedCanWalk = BF_GLOBALS._player._canWalk;
BF_GLOBALS._player.disableControl();
- if (!BF_GLOBALS._v50696 && BF_GLOBALS._uiElements._active)
- BF_GLOBALS._uiElements.hide();
+ if (!BF_GLOBALS._v50696 && T2_GLOBALS._uiElements._active)
+ T2_GLOBALS._uiElements.hide();
}
}
@@ -787,8 +862,8 @@ void SceneExt::endStrip() {
BF_GLOBALS._player._uiEnabled = scene->_savedUiEnabled;
BF_GLOBALS._player._canWalk = scene->_savedCanWalk;
- if (!BF_GLOBALS._v50696 && BF_GLOBALS._uiElements._active)
- BF_GLOBALS._uiElements.show();
+ if (!BF_GLOBALS._v50696 && T2_GLOBALS._uiElements._active)
+ T2_GLOBALS._uiElements.show();
}
}
@@ -841,12 +916,12 @@ void PalettedScene::add2Faders(const byte *arrBufferRGB, int step, int paletteNu
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) {
+void PalettedScene::transition(const byte *arrBufferRGB, int percent, int paletteNum, Action *action, int fromColor1, int fromColor2, int toColor1, int toColor2, bool flag) {
byte tmpPalette[768];
_palette.loadPalette(paletteNum);
_palette.loadPalette(2);
- if (!flag) {
+ 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];
@@ -861,9 +936,9 @@ void PalettedScene::sub15E4F(const byte *arrBufferRGB, int arg8, int paletteNum,
}
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;
+ tmpPalette[i * 3] = _palette._palette[i * 3] - ((_palette._palette[i * 3] - arrBufferRGB[i * 3]) * (100 - percent)) / 100;
+ tmpPalette[i * 3 + 1] = _palette._palette[i * 3 + 1] - ((_palette._palette[i * 3 + 1] - arrBufferRGB[i * 3 + 1]) * (100 - percent)) / 100;
+ tmpPalette[i * 3 + 2] = _palette._palette[i * 3 + 2] - ((_palette._palette[i * 3 + 2] - arrBufferRGB[i * 3 + 2]) * (100 - percent)) / 100;
}
BF_GLOBALS._scenePalette.addFader((const byte *)tmpPalette, 256, 100, action);
@@ -885,8 +960,8 @@ void SceneHandlerExt::process(Event &event) {
if (scene && scene->_focusObject)
scene->_focusObject->process(event);
- if (BF_GLOBALS._uiElements._active) {
- BF_GLOBALS._uiElements.process(event);
+ if (T2_GLOBALS._uiElements._active) {
+ T2_GLOBALS._uiElements.process(event);
if (event.handled)
return;
}
@@ -899,6 +974,23 @@ void SceneHandlerExt::process(Event &event) {
return;
}
+ // If the user clicks the button whilst the introduction is active, prompt for playing the game
+ if ((BF_GLOBALS._dayNumber == 0) && (event.eventType == EVENT_BUTTON_DOWN)) {
+ // Prompt user for whether to start play or watch introduction
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._events.setCursor(CURSOR_WALK);
+
+ if (MessageDialog::show2(WATCH_INTRO_MSG, START_PLAY_BTN_STRING, INTRODUCTION_BTN_STRING) == 0) {
+ // Start the game
+ BF_GLOBALS._dayNumber = 1;
+ BF_GLOBALS._sceneManager.changeScene(190);
+ } else {
+ BF_GLOBALS._player.disableControl();
+ }
+
+ event.handled = true;
+ }
+
SceneHandler::process(event);
}
@@ -1126,6 +1218,9 @@ void BlueForceInvObjectList::reset() {
setObjectScene(INV_DOG_WHISTLE, 880);
setObjectScene(INV_YELLOW_CORD, 910);
setObjectScene(INV_BLACK_CORD, 910);
+
+ // Set up the select item handler method
+ T2_GLOBALS._onSelectItem = SelectItem;
}
void BlueForceInvObjectList::setObjectScene(int objectNum, int sceneNumber) {
@@ -1140,7 +1235,7 @@ void BlueForceInvObjectList::setObjectScene(int objectNum, int sceneNumber) {
BF_GLOBALS._events.setCursor(CURSOR_USE);
// Update the user interface if necessary
- BF_GLOBALS._uiElements.updateInventory();
+ T2_GLOBALS._uiElements.updateInventory();
}
void BlueForceInvObjectList::alterInventory(int mode) {
@@ -1232,8 +1327,241 @@ void BlueForceInvObjectList::alterInventory(int mode) {
}
}
+/**
+ * When an inventory item is selected, check if it's the gun belt, since that has a specific dialog
+ */
+bool BlueForceInvObjectList::SelectItem(int objectNumber) {
+ if (objectNumber == INV_AMMO_BELT) {
+ AmmoBeltDialog *dlg = new AmmoBeltDialog();
+ dlg->execute();
+ delete dlg;
+
+ return true;
+ }
+
+ return false;
+}
+
+/*--------------------------------------------------------------------------*/
+
+NamedHotspot::NamedHotspot() : SceneHotspot() {
+ _resNum = 0;
+ _lookLineNum = _useLineNum = _talkLineNum = -1;
+}
+
+bool NamedHotspot::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_WALK:
+ // Nothing
+ return false;
+ case CURSOR_LOOK:
+ if (_lookLineNum == -1)
+ return SceneHotspot::startAction(action, event);
+
+ SceneItem::display2(_resNum, _lookLineNum);
+ return true;
+ case CURSOR_USE:
+ if (_useLineNum == -1)
+ return SceneHotspot::startAction(action, event);
+
+ SceneItem::display2(_resNum, _useLineNum);
+ return true;
+ case CURSOR_TALK:
+ if (_talkLineNum == -1)
+ return SceneHotspot::startAction(action, event);
+
+ SceneItem::display2(_resNum, _talkLineNum);
+ return true;
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+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;
+ g_globals->_sceneItems.addItems(this, NULL);
+}
+
+void NamedHotspot::setDetails(const Rect &bounds, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item) {
+ setBounds(bounds);
+ _resNum = resNum;
+ _lookLineNum = lookLineNum;
+ _talkLineNum = talkLineNum;
+ _useLineNum = useLineNum;
+
+ switch (mode) {
+ case 2:
+ g_globals->_sceneItems.push_front(this);
+ break;
+ case 4:
+ g_globals->_sceneItems.addBefore(item, this);
+ break;
+ case 5:
+ g_globals->_sceneItems.addAfter(item, this);
+ break;
+ default:
+ g_globals->_sceneItems.push_back(this);
+ break;
+ }
+}
+
+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) {
+ SceneHotspot::synchronize(s);
+ s.syncAsSint16LE(_resNum);
+ s.syncAsSint16LE(_lookLineNum);
+ s.syncAsSint16LE(_useLineNum);
+
+ if (g_vm->getGameID() == GType_BlueForce)
+ s.syncAsSint16LE(_talkLineNum);
+}
+
/*--------------------------------------------------------------------------*/
+void SceneMessage::remove() {
+ SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene;
+ if (scene->_focusObject == this)
+ scene->_focusObject = NULL;
+
+ Action::remove();
+}
+
+void SceneMessage::signal() {
+ SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ scene->_focusObject = this;
+ BF_GLOBALS._events.setCursor(CURSOR_WALK);
+ draw();
+ setDelay(180);
+ break;
+ case 1:
+ clear();
+ remove();
+ break;
+ default:
+ break;
+ }
+}
+
+void SceneMessage::process(Event &event) {
+ if ((event.eventType == EVENT_BUTTON_DOWN) ||
+ ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_RETURN))) {
+ signal();
+ }
+}
+
+
+void SceneMessage::draw() {
+ GfxSurface &surface = BF_GLOBALS._screenSurface;
+
+ // Clear the game area
+ surface.fillRect(Rect(0, 0, SCREEN_WIDTH, UI_INTERFACE_Y), 0);
+
+ // Disable scene fade in
+ BF_GLOBALS._paneRefreshFlag[0] = 0;
+
+ // Set up the font
+ GfxFont &font = BF_GLOBALS._gfxManagerInstance._font;
+ BF_GLOBALS._scenePalette.setEntry(font._colors.foreground, 255, 255, 255);
+ BF_GLOBALS._scenePalette.setPalette(font._colors.foreground, 1);
+
+ // Write out the message
+ Rect textRect(0, UI_INTERFACE_Y / 2 - (font.getHeight() / 2), SCREEN_WIDTH,
+ UI_INTERFACE_Y / 2 + (font.getHeight() / 2));
+ BF_GLOBALS._gfxManagerInstance._font.writeLines(_message.c_str(), textRect, ALIGN_CENTER);
+
+ // TODO: Ideally, saving and loading should be disabled here until the message display is complete
+}
+
+void SceneMessage::clear() {
+ // Fade out the text display
+ static const uint32 black = 0;
+ BF_GLOBALS._scenePalette.fade((const byte *)&black, false, 100);
+
+ // Refresh the background
+ BF_GLOBALS._paneRefreshFlag[0] = 0;
+
+ // Set up to fade in the game scene
+ g_globals->_sceneManager._fadeMode = FADEMODE_GRADUAL;
+ g_globals->_sceneManager._hasPalette = true;
+}
+
+IntroSceneText::IntroSceneText(): SceneText() {
+ _action = NULL;
+ _frameNumber = 0;
+ _diff = 0;
+}
+
+void IntroSceneText::setup(const Common::String &msg, Action *action) {
+ _frameNumber = BF_GLOBALS._events.getFrameNumber();
+ _diff = 180;
+ _action = action;
+ _fontNumber = 4;
+ _width = 300;
+ _textMode = ALIGN_CENTER;
+ _color1 = BF_GLOBALS._scenePalette._colors.background;
+ _color2 = _color3 = 0;
+
+ SceneText::setup(msg);
+
+ // Center the text on-screen
+ reposition();
+ _bounds.center(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2);
+
+ // Set the new position
+ _position.x = _bounds.left;
+ _position.y = _bounds.top;
+}
+
+void IntroSceneText::synchronize(Serializer &s) {
+ SceneText::synchronize(s);
+ SYNC_POINTER(_action);
+ s.syncAsUint32LE(_frameNumber);
+ s.syncAsSint16LE(_diff);
+}
+
+void IntroSceneText::dispatch() {
+ if (_diff) {
+ uint32 frameNumber = BF_GLOBALS._events.getFrameNumber();
+ if (_frameNumber < frameNumber) {
+ _diff -= frameNumber - _frameNumber;
+ _frameNumber = frameNumber;
+
+ if (_diff <= 0) {
+ // Time has expired, so remove the text and signal the designated action
+ remove();
+ if (_action)
+ _action->signal();
+ }
+ }
+ }
+}
+
} // End of namespace BlueForce
} // End of namespace TsAGE
diff --git a/engines/tsage/blue_force/blueforce_logic.h b/engines/tsage/blue_force/blueforce_logic.h
index dcaea52444..d0d0e0ee40 100644
--- a/engines/tsage/blue_force/blueforce_logic.h
+++ b/engines/tsage/blue_force/blueforce_logic.h
@@ -43,6 +43,9 @@ public:
virtual Scene *createScene(int sceneNumber);
virtual void rightClick();
virtual void processEvent(Event &event);
+ virtual bool canSaveGameStateCurrently();
+ virtual bool canLoadGameStateCurrently();
+ virtual void restart();
};
#define OBJ_ARRAY_SIZE 10
@@ -202,7 +205,7 @@ public:
bool _savedCanWalk;
int _field37A;
- FocusObject *_focusObject;
+ EventHandler *_focusObject;
Visage _cursorVisage;
Rect _v51C34;
@@ -211,13 +214,14 @@ public:
virtual Common::String getClassName() { return "SceneExt"; }
virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
virtual void process(Event &event);
virtual void dispatch();
virtual void loadScene(int sceneNum);
virtual void checkGun();
- void addTimer(Timer *timer) { _timerList.add(timer); }
- void removeTimer(Timer *timer) { _timerList.remove(timer); }
+ void addTimer(EventHandler *timer) { _timerList.add(timer); }
+ void removeTimer(EventHandler *timer) { _timerList.remove(timer); }
bool display(CursorType action);
void fadeOut();
void gunDisplay();
@@ -236,7 +240,7 @@ public:
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);
+ void transition(const byte *arrBufferRGB, int arg8, int paletteNum, Action *action, int fromColor1, int fromColor2, int toColor1, int toColor2, bool flag);
};
class SceneHandlerExt: public SceneHandler {
@@ -249,6 +253,8 @@ public:
};
class BlueForceInvObjectList : public InvObjectList {
+private:
+ static bool SelectItem(int objectNumber);
public:
InvObject _none;
InvObject _colt45;
@@ -327,6 +333,61 @@ public:
virtual Common::String getClassName() { return "BlueForceInvObjectList"; }
};
+class NamedHotspot : public SceneHotspot {
+public:
+ int _resNum, _lookLineNum, _useLineNum, _talkLineNum;
+ NamedHotspot();
+
+
+ virtual bool startAction(CursorType action, Event &event);
+ virtual Common::String getClassName() { return "NamedHotspot"; }
+ virtual void synchronize(Serializer &s);
+ 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);
+ }
+};
+
+class SceneMessage: public Action {
+private:
+ Common::String _message;
+
+ void draw();
+ void clear();
+public:
+ void setup(const Common::String &msg) { _message = msg; }
+
+ virtual Common::String getClassName() { return "SceneMessage"; }
+ virtual void remove();
+ virtual void signal();
+ virtual void process(Event &event);
+};
+
+class IntroSceneText: public SceneText {
+public:
+ Action *_action;
+ uint32 _frameNumber;
+ int _diff;
+public:
+ IntroSceneText();
+ void setup(const Common::String &msg, Action *action);
+
+ virtual Common::String getClassName() { return "BFIntroText"; }
+ virtual void synchronize(Serializer &s);
+ virtual void dispatch();
+};
+
} // End of namespace BlueForce
} // End of namespace TsAGE
diff --git a/engines/tsage/blue_force/blueforce_scenes0.cpp b/engines/tsage/blue_force/blueforce_scenes0.cpp
index 1e8c535f5f..682e273716 100644
--- a/engines/tsage/blue_force/blueforce_scenes0.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes0.cpp
@@ -48,45 +48,45 @@ void Scene20::Action1::signal() {
BF_GLOBALS._scenePalette.addRotation(64, 127, -1, 1, this);
break;
case 2:
- scene->_object1.setVisage(22);
- scene->_object1._strip = 1;
- scene->_object1._frame = 1;
- scene->_object1.changeZoom(100);
-
- scene->_object2.setVisage(22);
- scene->_object2._strip = 2;
- scene->_object2._frame = 1;
- scene->_object2.changeZoom(100);
-
- scene->_object3.setVisage(22);
- scene->_object3._strip = 3;
- scene->_object3._frame = 1;
- scene->_object3.changeZoom(100);
-
- scene->_object4.setVisage(22);
- scene->_object4._strip = 4;
- scene->_object4._frame = 1;
- scene->_object4.changeZoom(100);
-
- scene->_object5.setVisage(22);
- scene->_object5._strip = 5;
- scene->_object5._frame = 1;
- scene->_object5.changeZoom(100);
-
- scene->_object6.setVisage(22);
- scene->_object6._strip = 6;
- scene->_object6._frame = 1;
- scene->_object6.changeZoom(100);
-
- scene->_object7.setVisage(22);
- scene->_object7._strip = 7;
- scene->_object7._frame = 1;
- scene->_object7.changeZoom(100);
-
- scene->_object8.setVisage(22);
- scene->_object8._strip = 8;
- scene->_object8._frame = 1;
- scene->_object8.changeZoom(100);
+ scene->_tsunamiWave.setVisage(22);
+ scene->_tsunamiWave._strip = 1;
+ scene->_tsunamiWave._frame = 1;
+ scene->_tsunamiWave.changeZoom(100);
+
+ scene->_letterT.setVisage(22);
+ scene->_letterT._strip = 2;
+ scene->_letterT._frame = 1;
+ scene->_letterT.changeZoom(100);
+
+ scene->_letterS.setVisage(22);
+ scene->_letterS._strip = 3;
+ scene->_letterS._frame = 1;
+ scene->_letterS.changeZoom(100);
+
+ scene->_letterU.setVisage(22);
+ scene->_letterU._strip = 4;
+ scene->_letterU._frame = 1;
+ scene->_letterU.changeZoom(100);
+
+ scene->_letterN.setVisage(22);
+ scene->_letterN._strip = 5;
+ scene->_letterN._frame = 1;
+ scene->_letterN.changeZoom(100);
+
+ scene->_letterA.setVisage(22);
+ scene->_letterA._strip = 6;
+ scene->_letterA._frame = 1;
+ scene->_letterA.changeZoom(100);
+
+ scene->_letterM.setVisage(22);
+ scene->_letterM._strip = 7;
+ scene->_letterM._frame = 1;
+ scene->_letterM.changeZoom(100);
+
+ scene->_letterI.setVisage(22);
+ scene->_letterI._strip = 8;
+ scene->_letterI._frame = 1;
+ scene->_letterI.changeZoom(100);
setDelay(1);
break;
@@ -97,12 +97,12 @@ void Scene20::Action1::signal() {
setDelay(60);
break;
case 5:
- scene->_object2.animate(ANIM_MODE_5, NULL);
- scene->_object3.animate(ANIM_MODE_5, NULL);
- scene->_object4.animate(ANIM_MODE_5, NULL);
- scene->_object5.animate(ANIM_MODE_5, NULL);
- scene->_object6.animate(ANIM_MODE_5, NULL);
- scene->_object7.animate(ANIM_MODE_5, this);
+ scene->_letterT.animate(ANIM_MODE_5, NULL);
+ scene->_letterS.animate(ANIM_MODE_5, NULL);
+ scene->_letterU.animate(ANIM_MODE_5, NULL);
+ scene->_letterN.animate(ANIM_MODE_5, NULL);
+ scene->_letterA.animate(ANIM_MODE_5, NULL);
+ scene->_letterM.animate(ANIM_MODE_5, this);
break;
case 6:
setDelay(120);
@@ -121,75 +121,76 @@ void Scene20::Action1::signal() {
void Scene20::postInit(SceneObjectList *OwnerList) {
loadScene(20);
- Scene::postInit();
+ SceneExt::postInit();
setZoomPercents(60, 85, 200, 100);
+ BF_GLOBALS._interfaceY = SCREEN_HEIGHT;
_scenePalette.loadPalette(1);
_scenePalette.loadPalette(22);
- _object1.postInit();
- _object1.setVisage(21);
- _object1._strip = 1;
- _object1._frame = 1;
- _object1.animate(ANIM_MODE_NONE, NULL);
- _object1.setPosition(Common::Point(62, 85));
- _object1.changeZoom(100);
-
- _object2.postInit();
- _object2.setVisage(21);
- _object2._strip = 2;
- _object2._frame = 1;
- _object2.animate(ANIM_MODE_NONE, NULL);
- _object2.setPosition(Common::Point(27, 94));
- _object2.changeZoom(100);
-
- _object3.postInit();
- _object3.setVisage(21);
- _object3._strip = 2;
- _object3._frame = 2;
- _object3.animate(ANIM_MODE_NONE, NULL);
- _object3.setPosition(Common::Point(68, 94));
- _object3.changeZoom(100);
-
- _object4.postInit();
- _object4.setVisage(21);
- _object4._strip = 2;
- _object4._frame = 3;
- _object4.animate(ANIM_MODE_NONE, NULL);
- _object4.setPosition(Common::Point(110, 94));
- _object4.changeZoom(100);
-
- _object5.postInit();
- _object5.setVisage(21);
- _object5._strip = 2;
- _object5._frame = 4;
- _object5.animate(ANIM_MODE_NONE, NULL);
- _object5.setPosition(Common::Point(154, 94));
- _object5.changeZoom(100);
-
- _object6.postInit();
- _object6.setVisage(21);
- _object6._strip = 2;
- _object6._frame = 5;
- _object6.animate(ANIM_MODE_NONE, NULL);
- _object6.setPosition(Common::Point(199, 94));
- _object6.changeZoom(100);
-
- _object7.postInit();
- _object7.setVisage(21);
- _object7._strip = 2;
- _object7._frame = 6;
- _object7.animate(ANIM_MODE_NONE, NULL);
- _object7.setPosition(Common::Point(244, 94));
- _object7.changeZoom(100);
-
- _object8.postInit();
- _object8.setVisage(21);
- _object8._strip = 2;
- _object8._frame = 7;
- _object8.animate(ANIM_MODE_NONE, NULL);
- _object8.setPosition(Common::Point(286, 94));
- _object8.changeZoom(100);
+ _tsunamiWave.postInit();
+ _tsunamiWave.setVisage(21);
+ _tsunamiWave._strip = 1;
+ _tsunamiWave._frame = 1;
+ _tsunamiWave.animate(ANIM_MODE_NONE, NULL);
+ _tsunamiWave.setPosition(Common::Point(62, 85));
+ _tsunamiWave.changeZoom(100);
+
+ _letterT.postInit();
+ _letterT.setVisage(21);
+ _letterT._strip = 2;
+ _letterT._frame = 1;
+ _letterT.animate(ANIM_MODE_NONE, NULL);
+ _letterT.setPosition(Common::Point(27, 94));
+ _letterT.changeZoom(100);
+
+ _letterS.postInit();
+ _letterS.setVisage(21);
+ _letterS._strip = 2;
+ _letterS._frame = 2;
+ _letterS.animate(ANIM_MODE_NONE, NULL);
+ _letterS.setPosition(Common::Point(68, 94));
+ _letterS.changeZoom(100);
+
+ _letterU.postInit();
+ _letterU.setVisage(21);
+ _letterU._strip = 2;
+ _letterU._frame = 3;
+ _letterU.animate(ANIM_MODE_NONE, NULL);
+ _letterU.setPosition(Common::Point(110, 94));
+ _letterU.changeZoom(100);
+
+ _letterN.postInit();
+ _letterN.setVisage(21);
+ _letterN._strip = 2;
+ _letterN._frame = 4;
+ _letterN.animate(ANIM_MODE_NONE, NULL);
+ _letterN.setPosition(Common::Point(154, 94));
+ _letterN.changeZoom(100);
+
+ _letterA.postInit();
+ _letterA.setVisage(21);
+ _letterA._strip = 2;
+ _letterA._frame = 5;
+ _letterA.animate(ANIM_MODE_NONE, NULL);
+ _letterA.setPosition(Common::Point(199, 94));
+ _letterA.changeZoom(100);
+
+ _letterM.postInit();
+ _letterM.setVisage(21);
+ _letterM._strip = 2;
+ _letterM._frame = 6;
+ _letterM.animate(ANIM_MODE_NONE, NULL);
+ _letterM.setPosition(Common::Point(244, 94));
+ _letterM.changeZoom(100);
+
+ _letterI.postInit();
+ _letterI.setVisage(21);
+ _letterI._strip = 2;
+ _letterI._frame = 7;
+ _letterI.animate(ANIM_MODE_NONE, NULL);
+ _letterI.setPosition(Common::Point(286, 94));
+ _letterI.changeZoom(100);
setAction(&_action1);
BF_GLOBALS._dialogCenter.y = 165;
@@ -238,11 +239,11 @@ void Scene50::Tooltip2::dispatch() {
}
}
-void Scene50::Tooltip::set(const Rect &bounds, int v60, const Common::String &msg, int v62) {
+void Scene50::Tooltip::set(const Rect &bounds, int sceneNum, const Common::String &msg, int locationId) {
_bounds = bounds;
- _newSceneNumber = v60;
+ _newSceneNumber = sceneNum;
_msg = msg;
- _locationId = v62;
+ _locationId = locationId;
}
void Scene50::Tooltip::update() {
@@ -260,8 +261,8 @@ void Scene50::Tooltip::update() {
void Scene50::Tooltip::highlight(bool btnDown) {
Scene50 *scene = (Scene50 *)BF_GLOBALS._sceneManager._scene;
- scene->_field382 = _newSceneNumber;
- if ((scene->_field380 != 0) || (scene->_field380 != _newSceneNumber))
+ // In the original, a variable was used, always set to 0. The check is simplified
+ if (_newSceneNumber != 0)
update();
if (btnDown) {
@@ -322,16 +323,11 @@ void Scene50::Tooltip::highlight(bool btnDown) {
/*--------------------------------------------------------------------------*/
-Scene50::Scene50(): SceneExt() {
- _field382 = 0;
- _field380 = 0;
-}
-
void Scene50::postInit(SceneObjectList *OwnerList) {
SceneExt::postInit();
BF_GLOBALS._interfaceY = 200;
- BF_GLOBALS._uiElements._active = false;
+ T2_GLOBALS._uiElements._active = false;
BF_GLOBALS._player.postInit();
BF_GLOBALS._player.setVisage(830);
BF_GLOBALS._player.setStrip(3);
@@ -420,9 +416,10 @@ void Scene50::postInit(SceneObjectList *OwnerList) {
void Scene50::remove() {
// Blank out the screen
clearScreen();
+ BF_GLOBALS._scrollFollower = &BF_GLOBALS._player;
SceneExt::remove();
- BF_GLOBALS._uiElements._active = true;
+ T2_GLOBALS._uiElements._active = true;
}
void Scene50::signal() {
@@ -437,11 +434,11 @@ void Scene50::signal() {
}
if ((BF_GLOBALS._driveFromScene == 410) && (_sceneNumber != BF_GLOBALS._driveFromScene)) {
- BF_GLOBALS.setFlag(125);
+ BF_GLOBALS.setFlag(f1097Frankie);
}
if ((BF_GLOBALS._driveFromScene == 340) && (_sceneNumber != BF_GLOBALS._driveFromScene)) {
- BF_GLOBALS.setFlag(123);
+ BF_GLOBALS.setFlag(f1097Marina);
}
if ((BF_GLOBALS._driveFromScene == 380) && (_sceneNumber != BF_GLOBALS._driveFromScene)) {
@@ -467,7 +464,6 @@ void Scene50::signal() {
BF_GLOBALS._player.enableControl();
BF_GLOBALS._events.setCursor(CURSOR_WALK);
_sceneMode = 0;
- _field380 = 0;
}
}
@@ -475,7 +471,6 @@ void Scene50::process(Event &event) {
SceneExt::process(event);
Common::Point pt(event.mousePos.x + _sceneBounds.left, event.mousePos.y + _sceneBounds.top);
bool mouseDown = false;
- _field382 = 0;
if ((event.mousePos.x > 270 && (_sceneBounds.right < (SCREEN_WIDTH * 2))))
loadBackground(4, 0);
@@ -535,7 +530,7 @@ bool Scene60::Ignition::startAction(CursorType action, Event &event) {
bool Scene60::Ignition::check1() {
if (BF_GLOBALS._bookmark >= bStoppedFrankie) {
- BF_GLOBALS._v5098C |= 1;
+ BF_GLOBALS._subFlagBitArr1 |= 1;
return false;
} else {
if ((BF_GLOBALS._bookmark == bBookedGreen) && BF_GLOBALS.getFlag(fArrivedAtGangStop)) {
@@ -562,13 +557,13 @@ bool Scene60::Ignition::check1() {
} else if (BF_GLOBALS._bookmark < bStartOfGame) {
// Should never reach here
} else if (BF_GLOBALS._bookmark < bCalledToDomesticViolence) {
- if ((BF_GLOBALS._v5098C >> 1) & 1)
+ if ((BF_GLOBALS._subFlagBitArr1 >> 1) & 1)
BF_GLOBALS.setFlag(fLateToMarina);
else
- BF_GLOBALS._v5098C |= 2;
+ BF_GLOBALS._subFlagBitArr1 |= 2;
} else {
- int v = (((BF_GLOBALS._v5098C >> 2) & 15) + 1) & 15;
- BF_GLOBALS._v5098C = (BF_GLOBALS._v5098C & 0xC3) | (v << 2);
+ int v = (((BF_GLOBALS._subFlagBitArr1 >> 2) & 15) + 1) & 15;
+ BF_GLOBALS._subFlagBitArr1 = (BF_GLOBALS._subFlagBitArr1 & 0xC3) | (v << 2);
if ((v != 1) && (v != 2)) {
BF_GLOBALS._deathReason = 19;
@@ -578,17 +573,17 @@ bool Scene60::Ignition::check1() {
}
}
- BF_GLOBALS._v5098C |= 1;
+ BF_GLOBALS._subFlagBitArr1 |= 1;
return false;
}
bool Scene60::Ignition::check2() {
switch (BF_GLOBALS._bookmark) {
case bInspectionDone:
- if (BF_GLOBALS._v5098D & 1) {
+ if (BF_GLOBALS._subFlagBitArr2 & 1) {
BF_GLOBALS.setFlag(fLateToDrunkStop);
} else {
- BF_GLOBALS._v5098D |= 1;
+ BF_GLOBALS._subFlagBitArr2 |= 1;
}
break;
case bCalledToDrunkStop:
@@ -598,7 +593,7 @@ bool Scene60::Ignition::check2() {
break;
}
- BF_GLOBALS._v5098C |= 0x80;
+ BF_GLOBALS._subFlagBitArr1 |= 0x80;
return false;
}
@@ -681,7 +676,7 @@ bool Scene60::MirandaCard::startAction(CursorType action, Event &event) {
SceneItem::display2(60, 6);
BF_INVENTORY.setObjectScene(INV_MIRANDA_CARD, 1);
if (!BF_GLOBALS.getFlag(fGotPointsForTktBook)) {
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
BF_GLOBALS.setFlag(fGotPointsForTktBook);
}
@@ -712,7 +707,7 @@ bool Scene60::TicketBook::startAction(CursorType action, Event &event) {
SceneItem::display2(60, 3);
BF_INVENTORY.setObjectScene(INV_TICKET_BOOK, 1);
if (!BF_GLOBALS.getFlag(fShotNicoIn910)) {
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
BF_GLOBALS.setFlag(fShotNicoIn910);
}
}
@@ -777,10 +772,10 @@ void Scene60::Action1::signal() {
switch (_state) {
case 1:
if (BF_GLOBALS.removeFlag(fCan1004Marina)) {
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
_state = 606;
} else if (BF_GLOBALS.removeFlag(fCan1004Drunk)) {
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
_state = 606;
} else {
_state = 611;
@@ -791,13 +786,13 @@ void Scene60::Action1::signal() {
break;
case 3:
if (BF_GLOBALS.removeFlag(f1015Marina)) {
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
_state = 613;
} else if (BF_GLOBALS.removeFlag(f1015Frankie)) {
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
_state = 614;
} else if (BF_GLOBALS.removeFlag(f1015Drunk)) {
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
_state = 615;
} else {
_state = 616;
@@ -805,15 +800,15 @@ void Scene60::Action1::signal() {
break;
case 4:
if (BF_GLOBALS.removeFlag(f1027Marina)) {
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
_actionIndex = 5;
_state = 617;
} else if (BF_GLOBALS.removeFlag(f1027Frankie)) {
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
_actionIndex = 5;
_state = 618;
} else if (BF_GLOBALS.removeFlag(f1015Drunk)) {
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
_actionIndex = 5;
_state = 619;
} else {
@@ -823,15 +818,15 @@ void Scene60::Action1::signal() {
case 5:
if (BF_GLOBALS.removeFlag(f1035Marina)) {
BF_GLOBALS.setFlag(fCalledBackup);
- BF_GLOBALS._uiElements.addScore(50);
+ T2_GLOBALS._uiElements.addScore(50);
_state = 621;
} else if (BF_GLOBALS.removeFlag(f1035Frankie)) {
BF_GLOBALS.setFlag(fCalledBackup);
- BF_GLOBALS._uiElements.addScore(50);
+ T2_GLOBALS._uiElements.addScore(50);
_actionIndex = 5;
_state = 622;
} else if (BF_GLOBALS.removeFlag(f1035Drunk)) {
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
_state = 623;
} else {
_state = 624;
@@ -839,14 +834,14 @@ void Scene60::Action1::signal() {
break;
case 6:
if (BF_GLOBALS.removeFlag(f1097Marina)) {
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
_state = 625;
} else if (BF_GLOBALS.removeFlag(f1097Frankie)) {
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
_actionIndex = 5;
_state = 626;
} else if (BF_GLOBALS.removeFlag(f1097Drunk)) {
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
_state = 627;
} else {
_state = 628;
@@ -854,13 +849,13 @@ void Scene60::Action1::signal() {
break;
case 7:
if (BF_GLOBALS.removeFlag(f1098Marina)) {
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
_state = 629;
} else if (BF_GLOBALS.removeFlag(f1098Frankie)) {
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
_state = 630;
} else if (BF_GLOBALS.removeFlag(f1098Drunk)) {
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
_state = 631;
} else {
_state = 632;
@@ -1081,7 +1076,7 @@ void Scene60::postInit(SceneObjectList *OwnerList) {
switch (BF_GLOBALS._dayNumber) {
case 1:
- if (BF_GLOBALS.getFlag(onDuty) && (BF_GLOBALS._v5098C & 1) &&
+ if (BF_GLOBALS.getFlag(onDuty) && (BF_GLOBALS._subFlagBitArr1 & 1) &&
(BF_GLOBALS._bookmark < bStartOfGame) && (BF_GLOBALS._sceneManager._previousScene != 342)) {
setAction(&_action2);
if (BF_GLOBALS._sceneManager._previousScene == 342)
@@ -1089,7 +1084,7 @@ void Scene60::postInit(SceneObjectList *OwnerList) {
}
break;
case 2:
- if (BF_GLOBALS.getFlag(onDuty) && ((BF_GLOBALS._v5098C >> 7) & 1) &&
+ if (BF_GLOBALS.getFlag(onDuty) && ((BF_GLOBALS._subFlagBitArr1 >> 7) & 1) &&
(BF_GLOBALS._sceneManager._previousScene != 550) &&
(BF_GLOBALS._bookmark < bInspectionDone)) {
setAction(&_action3);
diff --git a/engines/tsage/blue_force/blueforce_scenes0.h b/engines/tsage/blue_force/blueforce_scenes0.h
index 103e5f0a4c..9b0bf556f4 100644
--- a/engines/tsage/blue_force/blueforce_scenes0.h
+++ b/engines/tsage/blue_force/blueforce_scenes0.h
@@ -50,8 +50,8 @@ class Scene20 : public SceneExt {
public:
Action1 _action1;
ScenePalette _scenePalette;
- SceneObject _object1, _object2, _object3, _object4;
- SceneObject _object5, _object6, _object7, _object8;
+ SceneObject _tsunamiWave, _letterT, _letterS, _letterU;
+ SceneObject _letterN, _letterA, _letterM, _letterI;
virtual void postInit(SceneObjectList *OwnerList = NULL);
};
@@ -65,7 +65,7 @@ class Scene50: public SceneExt {
int _locationId;
public:
Tooltip();
- void set(const Rect &bounds, int v60, const Common::String &msg, int v62);
+ void set(const Rect &bounds, int sceneNum, const Common::String &msg, int locationId);
void update();
void highlight(bool btnDown);
@@ -81,7 +81,6 @@ class Scene50: public SceneExt {
virtual void dispatch();
};
public:
- int _field380, _field382;
int _sceneNumber;
SceneText _text;
SceneItemType2 _item;
@@ -89,7 +88,6 @@ public:
Tooltip _location6, _location7, _location8, _location9;
Timer _timer;
public:
- Scene50();
virtual Common::String getClassName() { return "Scene50"; }
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void remove();
@@ -172,6 +170,7 @@ public:
int _sceneNumber;
int _visage;
CursorType _cursorId;
+ // TODO: Check if really useless in original
bool _field1222;
Scene60();
diff --git a/engines/tsage/blue_force/blueforce_scenes1.cpp b/engines/tsage/blue_force/blueforce_scenes1.cpp
index c953584665..f17f2d7c83 100644
--- a/engines/tsage/blue_force/blueforce_scenes1.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes1.cpp
@@ -140,6 +140,7 @@ void Scene100::Action2::signal() {
} else {
// Prompt user for whether to start play or watch introduction
g_globals->_player.enableControl();
+ g_globals->_events.setCursor(CURSOR_WALK);
if (MessageDialog::show2(WATCH_INTRO_MSG, START_PLAY_BTN_STRING, INTRODUCTION_BTN_STRING) == 0) {
// Signal to start the game
@@ -242,8 +243,8 @@ void Scene109::Action1::signal() {
scene->_drunk.show();
scene->_drunk.setAction(&scene->_action3);
scene->_object2.show();
- scene->_object9.show();
- scene->_object9.setAction(&scene->_action2);
+ scene->_beerSign.show();
+ scene->_beerSign.setAction(&scene->_action2);
BF_GLOBALS._v501FC = 170;
setDelay(60);
@@ -256,27 +257,27 @@ void Scene109::Action1::signal() {
break;
case 5:
// Open briefcase and pass over disk
- setAction(&scene->_sequenceManager6, this, 105, &scene->_object10, NULL);
+ setAction(&scene->_sequenceManager6, this, 105, &scene->_animationInset, NULL);
break;
case 6:
// Protaginist 2 walk to the bar
- scene->_object10.remove();
+ scene->_animationInset.remove();
setAction(&scene->_sequenceManager6, this, 100, &scene->_protaginist2, NULL);
break;
case 7:
// Two thugs enter and walk to table
- scene->_object7.setAction(&scene->_sequenceManager7, NULL, 103, &scene->_object7, NULL);
- scene->_object5.setAction(&scene->_sequenceManager8, this, 102, &scene->_object5, NULL);
+ scene->_cop2.setAction(&scene->_sequenceManager7, NULL, 103, &scene->_cop2, NULL);
+ scene->_cop1.setAction(&scene->_sequenceManager8, this, 102, &scene->_cop1, NULL);
scene->_protaginist2.setAction(&scene->_sequenceManager6, NULL, 104, &scene->_protaginist2, &scene->_bartender, NULL);
break;
case 8:
// Protaginist 1 leaves, protaginist 2 stands up
- setAction(&scene->_sequenceManager8, this, 101, &scene->_object5, &scene->_protaginist1, NULL);
+ setAction(&scene->_sequenceManager8, this, 101, &scene->_cop1, &scene->_protaginist1, NULL);
break;
case 9:
// Shots fired!
scene->_protaginist1.setAction(&scene->_sequenceManager5, this, 98, &scene->_protaginist1, NULL);
- scene->_object7.setAction(&scene->_sequenceManager7, NULL, 99, &scene->_object7, NULL);
+ scene->_cop2.setAction(&scene->_sequenceManager7, NULL, 99, &scene->_cop2, NULL);
break;
case 10:
// End scene
@@ -288,65 +289,12 @@ void Scene109::Action1::signal() {
void Scene109::Action2::signal() {
Scene109 *scene = (Scene109 *)BF_GLOBALS._sceneManager._scene;
- scene->setAction(&scene->_sequenceManager2, this, 3117, &scene->_object9, NULL);
+ setAction(&scene->_sequenceManager2, this, 3117, &scene->_beerSign, NULL);
}
void Scene109::Action3::signal() {
Scene109 *scene = (Scene109 *)BF_GLOBALS._sceneManager._scene;
- scene->setAction(&scene->_sequenceManager3, this, 108, &scene->_drunk, NULL);
-}
-
-/*--------------------------------------------------------------------------*/
-
-Scene109::Text::Text(): SceneText() {
- _action = NULL;
- _frameNumber = 0;
- _diff = 0;
-}
-
-void Scene109::Text::setup(const Common::String &msg, Action *action) {
- _frameNumber = BF_GLOBALS._events.getFrameNumber();
- _diff = 180;
- _action = action;
- _fontNumber = 4;
- _width = 300;
- _textMode = ALIGN_CENTER;
- _color1 = BF_GLOBALS._scenePalette._colors.background;
- _color2 = _color3 = 0;
-
- SceneText::setup(msg);
-
- // Center the text on-screen
- reposition();
- _bounds.center(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2);
-
- // Set the new position
- _position.x = _bounds.left;
- _position.y = _bounds.top;
-}
-
-void Scene109::Text::synchronize(Serializer &s) {
- SceneText::synchronize(s);
- SYNC_POINTER(_action);
- s.syncAsUint32LE(_frameNumber);
- s.syncAsSint16LE(_diff);
-}
-
-void Scene109::Text::dispatch() {
- if (_diff) {
- uint32 frameNumber = BF_GLOBALS._events.getFrameNumber();
- if (_frameNumber < frameNumber) {
- _diff -= frameNumber - _frameNumber;
- _frameNumber = frameNumber;
-
- if (_diff <= 0) {
- // Time has expired, so remove the text and signal the designated action
- remove();
- if (_action)
- _action->signal();
- }
- }
- }
+ setAction(&scene->_sequenceManager3, this, 108, &scene->_drunk, NULL);
}
/*--------------------------------------------------------------------------*/
@@ -405,21 +353,21 @@ void Scene109::postInit(SceneObjectList *OwnerList) {
_object2.setPosition(Common::Point(104, 64));
_object2.hide();
- _object9.postInit();
- _object9.setVisage(115);
- _object9.setStrip(4);
- _object9.setFrame(1);
- _object9.setPosition(Common::Point(262, 29));
- _object9.hide();
+ _beerSign.postInit();
+ _beerSign.setVisage(115);
+ _beerSign.setStrip(4);
+ _beerSign.setFrame(1);
+ _beerSign.setPosition(Common::Point(262, 29));
+ _beerSign.hide();
- _object5.postInit();
- _object5.hide();
+ _cop1.postInit();
+ _cop1.hide();
- _object7.postInit();
- _object7.hide();
+ _cop2.postInit();
+ _cop2.hide();
- _object10.postInit();
- _object10.hide();
+ _animationInset.postInit();
+ _animationInset.hide();
BF_GLOBALS._player.disableControl();
setAction(&_action1, this);
@@ -433,11 +381,2749 @@ void Scene109::signal() {
}
/*--------------------------------------------------------------------------
+ * Scene 110 - Intro - Outside the bar
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene110::Action1::signal() {
+ Scene110 *scene = (Scene110 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ setDelay(5);
+ break;
+ case 1:
+ scene->_object8.show();
+ scene->_object7.show();
+ scene->_object1.show();
+ scene->_object4.show();
+ scene->_object5.show();
+ scene->_object6.show();
+ scene->_object9.show();
+ scene->_object10.show();
+ BF_GLOBALS._v51C44 = 1;
+ scene->loadScene(110);
+ setDelay(10);
+ break;
+ case 2:
+ BF_GLOBALS._v51C44 = 1;
+ scene->_object1.animate(ANIM_MODE_5, this);
+ break;
+ case 3: {
+ Common::Point pt(123, 121);
+ NpcMover *mover = new NpcMover();
+ scene->_object4.addMover(mover, &pt, this);
+ }
+ // No break on purpose
+ case 7:
+ setDelay(30);
+ break;
+ case 4:
+ // Guy running to the moto
+ scene->_object1.animate(ANIM_MODE_6, NULL);
+ break;
+ case 5:
+ scene->_object4.setStrip(2);
+ scene->_object4.setPosition(Common::Point(117, 106));
+ scene->_object4.animate(ANIM_MODE_5, this);
+ break;
+ case 6:
+ // Play "Vroum"
+ scene->_sound.play(31);
+ // The guy starts the engine
+ scene->_object4.setStrip(3);
+ scene->_object4._frame = 1;
+ scene->_object4.animate(ANIM_MODE_5, NULL);
+ // The guy looks behind him
+ scene->_object2.setPosition(Common::Point(227, 190));
+ scene->_object2.animate(ANIM_MODE_5, this);
+ break;
+ case 8:
+ scene->_object2.animate(ANIM_MODE_6, this);
+ break;
+ case 9:
+ scene->_object2.remove();
+ scene->_object4.remove();
+ scene->_object5.setStrip(4);
+ scene->_object5.setFrame2(5);
+ scene->_object5.setPosition(Common::Point(105, 120));
+ setDelay(10);
+ scene->_object6.setPosition(Common::Point(127, 96));
+ scene->_object6.animate(ANIM_MODE_2, NULL);
+ scene->_object6.setAction(&scene->_action2);
+ scene->_sound.play(22);
+ break;
+ case 10:
+ scene->_object8.setAction(&scene->_action4);
+ scene->_object5.setFrame2(3);
+ scene->_object5.setPosition(Common::Point(87, 120));
+ setDelay(8);
+ break;
+ case 11:
+ scene->_object5.setFrame2(4);
+ scene->_object5.setPosition(Common::Point(62, 122));
+ setDelay(6);
+ break;
+ case 12:
+ scene->_object5.setFrame2(5);
+ scene->_object5.setPosition(Common::Point(35, 120));
+ scene->_object5.fixPriority(70);
+ setDelay(4);
+ break;
+ case 13:
+ scene->_object5.setFrame2(6);
+ scene->_object5.setPosition(Common::Point(22, 111));
+ setDelay(2);
+ break;
+ case 14:
+ scene->_object5.setFrame2(7);
+ scene->_object5.setPosition(Common::Point(19, 99));
+ setDelay(2);
+ break;
+ case 15:
+ scene->_object5.setFrame2(8);
+ scene->_object5.setPosition(Common::Point(54, 76));
+ setDelay(1);
+ break;
+ case 16: {
+ Common::Point pt(182, 54);
+ NpcMover *mover = new NpcMover();
+ scene->_object5.addMover(mover, &pt, this);
+ }
+ break;
+ case 17:
+ scene->_object5.remove();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene110::Action2::signal() {
+ Scene110 *scene = (Scene110 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0: {
+ Common::Point pt(152, 94);
+ NpcMover *mover = new NpcMover();
+ scene->_object6.addMover(mover, &pt, this);
+ }
+ break;
+ case 1: {
+ Common::Point pt(167, 108);
+ NpcMover *mover = new NpcMover();
+ scene->_object6.addMover(mover, &pt, this);
+ }
+ break;
+ case 2: {
+ Common::Point pt(172, 109);
+ NpcMover *mover = new NpcMover();
+ scene->_object6.addMover(mover, &pt, this);
+ }
+ break;
+ case 3: {
+ Common::Point pt(179, 117);
+ NpcMover *mover = new NpcMover();
+ scene->_object6.addMover(mover, &pt, this);
+ }
+ break;
+ case 4:
+ setDelay(30);
+ break;
+ case 5:
+ scene->_object6.animate(ANIM_MODE_NONE, NULL);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene110::Action3::signal() {
+ Scene110 *scene = (Scene110 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ setDelay(3);
+ break;
+ case 1:
+ scene->_object7.setPosition(scene->_object7._position);
+ scene->_object1.setFrame(2);
+ setDelay(1);
+ break;
+ case 2:
+ scene->_object1.setFrame(3);
+ setDelay(1);
+ break;
+ case 3:
+ scene->_object1.setFrame(4);
+ scene->_object7.animate(ANIM_MODE_5, this);
+ break;
+ case 4: {
+ scene->_object1.animate(ANIM_MODE_6, NULL);
+ scene->_object7.setPosition(Common::Point(205, 99));
+ scene->_object7.setStrip(2);
+ scene->_object7.animate(ANIM_MODE_1, NULL);
+ scene->_object7.changeZoom(90);
+ Common::Point pt(151, 88);
+ NpcMover *mover = new NpcMover();
+ scene->_object7.addMover(mover, &pt, this);
+ }
+ break;
+ case 5:
+ scene->_object7.fixPriority(76);
+ scene->_object7.setStrip(3);
+ scene->_object7.changeZoom(90);
+ scene->_object7.setFrame(1);
+ scene->_object7.animate(ANIM_MODE_5, this);
+ scene->_object10.animate(ANIM_MODE_5, NULL);
+ break;
+ case 6:
+ scene->_object7.fixPriority(73);
+ scene->_object10.animate(ANIM_MODE_6, this);
+ break;
+ case 7: {
+ scene->_object7._yDiff = 1000;
+ scene->_object10.remove();
+ scene->_object9.setFrame2(2);
+ Common::Point pt(230, 53);
+ NpcMover *mover = new NpcMover();
+ scene->_object9.addMover(mover, &pt, this);
+ scene->_sound.play(23);
+ }
+ break;
+ case 8:
+ scene->_object9.remove();
+ BF_GLOBALS._sceneManager.changeScene(125);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene110::Action3::dispatch() {
+ Scene110 *scene = (Scene110 *)BF_GLOBALS._sceneManager._scene;
+
+ Action::dispatch();
+ if ((_actionIndex == 5) && (scene->_object7._percent > 80))
+ scene->_object7.changeZoom(scene->_object7._percent - 1);
+}
+
+void Scene110::Action4::signal() {
+ Scene110 *scene = (Scene110 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ scene->_object8.setPosition(scene->_object8._position);
+ scene->_object1.setFrame(2);
+ setDelay(1);
+ break;
+ case 1:
+ scene->_object1.setFrame(3);
+ setDelay(1);
+ break;
+ case 2: {
+ scene->_object1.setFrame(4);
+ scene->_object8.fixPriority(90);
+ Common::Point pt(194, 119);
+ NpcMover *mover = new NpcMover();
+ scene->_object8.addMover(mover, &pt, this);
+ }
+ break;
+ case 3:
+ scene->_object1.animate(ANIM_MODE_6, NULL);
+ scene->_object8.setPosition(Common::Point(186, 117));
+ scene->_object8.setStrip(2);
+ scene->_object8.setFrame(1);
+ scene->_object3.setPosition(scene->_object3._position);
+ scene->_object3.setFrame(1);
+ setDelay(7);
+ break;
+ case 4:
+ scene->_object8.setFrame2(2);
+ scene->_object3.setFrame(3);
+ setDelay(7);
+ break;
+ case 5:
+ scene->_object8.setFrame2(3);
+ scene->_object3.setFrame(3);
+ setDelay(7);
+ scene->_object6.remove();
+ break;
+ case 6:
+ scene->_object8.setFrame2(4);
+ scene->_object3.setFrame(4);
+ setDelay(7);
+ break;
+ case 7:
+ scene->_object8.setFrame2(5);
+ scene->_object3.setFrame(5);
+ setDelay(7);
+ break;
+ case 8:
+ scene->_object8.setFrame2(7);
+ scene->_object3.setFrame(6);
+ setDelay(30);
+ break;
+ case 9: {
+ scene->_object3.remove();
+ scene->_object8.setFrame2(-1);
+ scene->_object8.setPosition(Common::Point(176, 105));
+ scene->_object8.animate(ANIM_MODE_1, NULL);
+ scene->_object8.setStrip(3);
+ Common::Point pt(141, 94);
+ NpcMover *mover = new NpcMover();
+ scene->_object8.addMover(mover, &pt, this);
+ scene->_object7.setAction(&scene->_action3);
+ }
+ break;
+ case 10: {
+ scene->_object8.fixPriority(77);
+ Common::Point pt(78, 76);
+ NpcMover *mover = new NpcMover();
+ scene->_object8.addMover(mover, &pt, this);
+ }
+ break;
+ case 11: {
+ scene->_object8.setPosition(Common::Point(87, 76));
+ scene->_object8.fixPriority(71);
+ scene->_object8.setStrip(6);
+ scene->_object8.changeZoom(75);
+ Common::Point pt(103, 74);
+ NpcMover *mover = new NpcMover();
+ scene->_object8.addMover(mover, &pt, this);
+ }
+ break;
+ case 12:
+ scene->_object8.setPosition(Common::Point(119, 59));
+ scene->_object8.setStrip(5);
+ scene->_object8.changeZoom(100);
+ scene->_object8.animate(ANIM_MODE_5, this);
+ break;
+ case 13:
+ scene->_object8.setPosition(Common::Point(119, 59), 300);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene110::Action4::dispatch() {
+ Scene110 *scene = (Scene110 *)BF_GLOBALS._sceneManager._scene;
+
+ Action::dispatch();
+ if ((_actionIndex > 9) && (_actionIndex < 12) && (scene->_object8._percent > 80))
+ scene->_object8.changeZoom(scene->_object8._percent - 1);
+}
+
+void Scene110::Action5::signal() {
+ Scene110 *scene = (Scene110 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ scene->_object3.setPosition(scene->_object3._position);
+ scene->_object3.animate(ANIM_MODE_5, this);
+ break;
+ case 1:
+ scene->_object3.remove();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene110::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(999);
+ _object8.postInit();
+ _object8.setVisage(112);
+ _object8.setPosition(Common::Point(239, 98), 300);
+ _object8.setFrame(1);
+ _object8.setStrip(1);
+ _object8.changeZoom(90);
+ _object8.fixPriority(90);
+ _object8.animate(ANIM_MODE_1, NULL);
+ _object8._moveDiff.x = 7;
+ _object8._moveDiff.y = 3;
+ _object8.hide();
+
+ _object3.postInit();
+ _object3.setVisage(112);
+ _object3.setPosition(Common::Point(247, 190), 300);
+ _object3.setFrame(1);
+ _object3.setStrip(4);
+ _object3.changeZoom(100);
+ _object3.fixPriority(255);
+
+ _object7.postInit();
+ _object7.setVisage(113);
+ _object7.setPosition(Common::Point(236, 86), 300);
+ _object7._frame = 1;
+ _object7.setStrip(1);
+ _object7.changeZoom(110);
+ _object7.fixPriority(89);
+ _object7._moveDiff.x = 7;
+ _object7._moveDiff.y = 3;
+ _object7.hide();
+
+ _object1.postInit();
+ _object1.setVisage(110);
+ _object1.setPosition(Common::Point(216, 88), 0);
+ _object1._frame = 1;
+ _object1.setStrip(1);
+ _object1.changeZoom(100);
+ _object1.fixPriority(83);
+ _object1.hide();
+
+ _object2.postInit();
+ _object2.setVisage(111);
+ _object2.setPosition(Common::Point(527, 190), 0);
+ _object2._frame = 1;
+ _object2.fixPriority(250);
+ _object2.setStrip(5);
+ _object2.changeZoom(100);
+
+ _object4.postInit();
+ _object4.setVisage(111);
+ _object4.setPosition(Common::Point(253, 98), 0);
+ _object4._frame = 1;
+ _object4.setStrip(1);
+ _object4.changeZoom(100);
+ _object4.fixPriority(90);
+ _object4.animate(ANIM_MODE_1, NULL);
+ _object4._moveDiff.x = 10;
+ _object4._moveDiff.y = 10;
+ _object4.hide();
+
+ _object5.postInit();
+ _object5.setVisage(111);
+ _object5.setPosition(Common::Point(114, 119), 0);
+ _object5.setFrame2(1);
+ _object5.setStrip(7);
+ _object5.fixPriority(70);
+ _object5.changeZoom(100);
+ _object5._moveDiff.x = 20;
+ _object5._moveDiff.y = 20;
+ _object5.hide();
+
+ _object6.postInit();
+ _object6.setVisage(111);
+ _object6.setPosition(Common::Point(527, 96), 0);
+ _object6._frame = 1;
+ _object6.setStrip(6);
+ _object6.changeZoom(100);
+ _object6.fixPriority(238);
+ _object6._moveDiff.x = 10;
+ _object6._moveDiff.y = 10;
+ _object6.hide();
+
+ _object9.postInit();
+ _object9.setVisage(110);
+ _object9.setPosition(Common::Point(148, 69), 0);
+ _object9._frame = 1;
+ _object9.setStrip(2);
+ _object9.changeZoom(100);
+ _object9.fixPriority(72);
+ _object9._moveDiff.x = 10;
+ _object9._moveDiff.y = 10;
+ _object9.hide();
+
+ _object10.postInit();
+ _object10.setVisage(110);
+ _object10._frame = 1;
+ _object10.setStrip(3);
+ _object10.changeZoom(100);
+ _object10.fixPriority(74);
+ _object10._moveDiff.x = 10;
+ _object10._moveDiff.y = 10;
+ _object10.setPosition(_object9._position);
+ _object10.hide();
+
+ setAction(&_action1);
+}
+/*--------------------------------------------------------------------------
+ * Scene 114 - Outside the Bar
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene114::Vechile::startAction(CursorType action, Event &event) {
+ Scene114 *scene = (Scene114 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(114, 0);
+ return true;
+ case CURSOR_USE:
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1142;
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ scene->_lyle.fixPriority(-1);
+ scene->setAction(&scene->_sequenceManager1, scene, 1142, &BF_GLOBALS._player, &scene->_lyle, NULL);
+ } else {
+ Common::Point pt(155, 111);
+ PlayerMover *mover = new PlayerMover();
+ BF_GLOBALS._player.addMover(mover, &pt, scene);
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene114::Door::startAction(CursorType action, Event &event) {
+ Scene114 *scene = (Scene114 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(114, 1);
+ return true;
+ case CURSOR_USE:
+ BF_GLOBALS._walkRegions.enableRegion(2);
+ BF_GLOBALS._player.disableControl();
+ scene->_lyle.fixPriority(-1);
+ scene->_sceneMode = 1140;
+ scene->setAction(&scene->_sequenceManager1, scene, 1140, &BF_GLOBALS._player, this, &scene->_lyle, NULL);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+void Scene114::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+
+ BF_GLOBALS._sound1.fadeSound(33);
+ loadScene(110);
+
+ setZoomPercents(85, 80, 105, 100);
+ BF_GLOBALS._walkRegions.disableRegion(9);
+ BF_GLOBALS._walkRegions.disableRegion(22);
+
+ _door.postInit();
+ _door.setVisage(110);
+ _door.setPosition(Common::Point(216, 88));
+ BF_GLOBALS._sceneItems.push_front(&_door);
+
+ 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(155, 111));
+ BF_GLOBALS._player._moveDiff.x = 3;
+ BF_GLOBALS._player._moveDiff.y = 2;
+ BF_GLOBALS._player.changeZoom(-1);
+
+ _lyle.postInit();
+ _lyle.setVisage(1359);
+ _lyle.setObjectWrapper(new SceneObjectWrapper());
+ _lyle.animate(ANIM_MODE_1, NULL);
+ _lyle.setPosition(Common::Point(-118, -146));
+ _lyle.changeZoom(-1);
+ _lyle._moveDiff.x = 2;
+ _lyle._moveDiff.y = 1;
+ _lyle.hide();
+ _lyle.setDetails(114, 2, -1, -1, 1, NULL);
+
+ _vechile.postInit();
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ _vechile.setVisage(444);
+ _vechile.setPosition(Common::Point(127, 78));
+ _vechile.fixPriority(20);
+ BF_GLOBALS._player.setPosition(Common::Point(139, 79));
+ _lyle.setPosition(Common::Point(86, 79));
+ _lyle.show();
+ } else {
+ _vechile.setVisage(380);
+ _vechile.setPosition(Common::Point(128, 125));
+ _vechile.setFrame(1);
+ if (BF_GLOBALS.getFlag(onDuty)) {
+ _vechile.setStrip(2);
+ _vechile.changeZoom(70);
+ BF_GLOBALS._player.setVisage(352);
+ } else {
+ _vechile.setStrip(1);
+ _vechile.changeZoom(77);
+ }
+ BF_GLOBALS._walkRegions.disableRegion(17);
+ }
+ BF_GLOBALS._sceneItems.push_front(&_vechile);
+ BF_GLOBALS._walkRegions.disableRegion(2);
+
+ if (BF_GLOBALS._sceneManager._previousScene == 115) {
+ BF_GLOBALS._player.setPosition(Common::Point(219, 100));
+ BF_GLOBALS._player.setStrip(6);
+ _lyle.setPosition(Common::Point(253, 110));
+ _lyle.fixPriority(108);
+ _lyle.setStrip(6);
+ BF_GLOBALS._player.enableControl();
+ } else if (BF_GLOBALS.getFlag(fWithLyle)) {
+ _sceneMode = 1141;
+ setAction(&_sequenceManager1, this, 1141, &_lyle, NULL);
+ } else {
+ BF_GLOBALS._player.enableControl();
+ }
+
+ _item1.setDetails(Rect(0, 0, 320, 200), 114, 3, -1, -1, 1, NULL);
+}
+
+void Scene114::signal() {
+ switch (_sceneMode) {
+ case 1140:
+ BF_GLOBALS._sceneManager.changeScene(115);
+ break;
+ case 1141:
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 1142:
+ BF_GLOBALS._sceneManager.changeScene(60);
+ break;
+ default:
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 115 - Inside Tony's bar
+ *
+ *--------------------------------------------------------------------------*/
+bool Scene115::Kate::startAction(CursorType action, Event &event) {
+ Scene115 *scene = (Scene115 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display(115, 8, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+ case CURSOR_TALK:
+ if (BF_INVENTORY.getObjectScene(INV_NAPKIN) == 1) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 0;
+ scene->_stripManager.start(1174, scene);
+ } else if (scene->_jukeboxPlaying == 0) {
+ if (BF_GLOBALS.getFlag(fShowedIdToKate)) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 0;
+ scene->_stripManager.start(1159, scene);
+ } else {
+ scene->_sceneMode = 1167;
+ scene->setAction(&scene->_action6);
+ }
+ } else
+ scene->setAction(&scene->_action7);
+ return true;
+ case INV_MUG_SHOT:
+ if (scene->_jukeboxPlaying == 0) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 0;
+ if (BF_GLOBALS._tonyDialogCtr == 0)
+ scene->_stripManager.start(1167, scene);
+ else if (BF_GLOBALS.getFlag(fShowedIdToKate))
+ scene->_stripManager.start(1159, scene);
+ else if (BF_GLOBALS.getFlag(fMugOnKate))
+ scene->_stripManager.start(1159, scene);
+ else {
+ scene->_sceneMode = 9999;
+ scene->setAction(&scene->_action6);
+ }
+ } else
+ SceneItem::display(115, 44, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+ case INV_ID:
+ if (scene->_jukeboxPlaying == 0) {
+ if (BF_GLOBALS._tonyDialogCtr == 0) {
+ scene->_sceneMode = 1167;
+ scene->setAction(&scene->_action6);
+ } else if (BF_GLOBALS.getFlag(fShowedIdToKate)) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 0;
+ scene->_stripManager.start(1159, scene);
+ } else {
+ BF_GLOBALS.setFlag(fShowedIdToKate);
+ scene->setAction(&scene->_action8);
+ }
+ } else
+ SceneItem::display(115, 44, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene115::Tony::startAction(CursorType action, Event &event) {
+ Scene115 *scene = (Scene115 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display(115, 7, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+ case CURSOR_TALK:
+ if (BF_GLOBALS._dayNumber == 3) {
+ if (BF_INVENTORY.getObjectScene(INV_NAPKIN) == 1)
+ scene->_sceneMode = 1173;
+ else if (BF_INVENTORY.getObjectScene(INV_COBB_RAP) == 1) {
+ if (BF_GLOBALS.getFlag(fTalkedToTony))
+ scene->_sceneMode = 1151;
+ else if (BF_GLOBALS._tonyDialogCtr == 0) {
+ scene->_sceneMode = 1150;
+ BF_GLOBALS.setFlag(fTalkedToTony);
+ } else
+ scene->_sceneMode = 1151;
+ } else if (_talkToTonyCtr2 == 0) {
+ _talkToTonyCtr2++;
+ scene->_sceneMode = 1171;
+ } else
+ scene->_sceneMode = 1172;
+ } else if (BF_GLOBALS.getFlag(onDuty)) {
+ if (scene->_talkToTonyCtr == 0) {
+ scene->_talkToTonyCtr = 1;
+ scene->_sceneMode = 1169;
+ } else
+ scene->_sceneMode = 1170;
+ } else if (scene->_talkToTonyCtr == 0) {
+ scene->_sceneMode = 1171;
+ scene->_talkToTonyCtr = 1;
+ } else
+ scene->_sceneMode = 1172;
+
+ scene->setAction(&scene->_action9);
+ return true;
+ case INV_FOREST_RAP:
+ if (BF_GLOBALS.getFlag(onDuty))
+ scene->_sceneMode = 1178;
+ else
+ scene->_sceneMode = 1180;
+ scene->setAction(&scene->_action9);
+ return true;
+ case INV_COBB_RAP:
+ if (BF_GLOBALS.getFlag(onDuty))
+ scene->_sceneMode = 1177;
+ else if (BF_GLOBALS._tonyDialogCtr == 0)
+ scene->_sceneMode = 1179;
+ else
+ scene->_sceneMode = 1154;
+
+ scene->setAction(&scene->_action9);
+ return true;
+ case INV_MUG_SHOT:
+ scene->setAction(&scene->_action2);
+ return true;
+ case INV_ID:
+ if (BF_INVENTORY.getObjectScene(INV_NAPKIN) == 1) {
+ scene->_sceneMode = 1173;
+ scene->setAction(&scene->_action9);
+ } else if (BF_INVENTORY.getObjectScene(INV_COBB_RAP) == 1) {
+ if (BF_GLOBALS.getFlag(fTalkedToTony)) {
+ scene->_sceneMode = 1151;
+ scene->setAction(&scene->_action9);
+ } else {
+ T2_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(fTalkedToTony);
+ if (BF_GLOBALS._tonyDialogCtr == 0) {
+ scene->_sceneMode = 1150;
+ scene->setAction(&scene->_action9);
+ } else {
+ BF_GLOBALS._tonyDialogCtr = 1;
+ scene->setAction(&scene->_action2);
+ }
+ }
+ } else if (_talkToTonyCtr2 == 0) {
+ _talkToTonyCtr2++;
+ if (BF_GLOBALS.getFlag(onDuty)) {
+ scene->_sceneMode = 1182;
+ scene->setAction(&scene->_action9);
+ } else {
+ scene->_sceneMode = 1171;
+ scene->setAction(&scene->_action9);
+ }
+ } else if (BF_GLOBALS.getFlag(onDuty)) {
+ scene->_sceneMode = 1183;
+ scene->setAction(&scene->_action9);
+ } else {
+ scene->_sceneMode = 1172;
+ scene->setAction(&scene->_action9);
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene115::Object3::startAction(CursorType action, Event &event) {
+ Scene115 *scene = (Scene115 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display(115, 9, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display(115, 23, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+ case CURSOR_TALK: {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1;
+ Common::Point pt(160, 110);
+ PlayerMover *mover = new PlayerMover();
+ BF_GLOBALS._player.addMover(mover, &pt, scene);
+ return true;
+ }
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene115::Object4::startAction(CursorType action, Event &event) {
+ Scene115 *scene = (Scene115 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display(115, 42, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+ case CURSOR_TALK:
+ scene->_sceneMode = 0;
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._player.updateAngle(_position);
+ scene->_stripManager.start(1184, scene);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+void Scene115::Jukebox::signal() {
+ Scene115 *scene = (Scene115 *)BF_GLOBALS._sceneManager._scene;
+
+ if (_jokeboxPlayingCtr == 2)
+ _jokeboxPlayingCtr = 0;
+ else if (_jokeboxPlayingCtr == 1) {
+ _jokeboxPlayingCtr = 2;
+ setAction(&_sequenceManager6, this, 118, &scene->_object12, &scene->_object11, NULL);
+ }
+}
+
+bool Scene115::Jukebox::startAction(CursorType action, Event &event) {
+ Scene115 *scene = (Scene115 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_USE) {
+ if (_jokeboxPlayingCtr == 0) {
+ _jokeboxPlayingCtr = 1;
+ BF_GLOBALS._player.disableControl();
+ scene->setAction(&scene->_action4);
+ } else
+ SceneItem::display(_resNum, 37, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+ } else
+ return NamedHotspot::startAction(action, event);
+}
+
+void Scene115::Jukebox::synchronize(Serializer &s) {
+ NamedHotspot::synchronize(s);
+ s.syncAsSint16LE(_jokeboxPlayingCtr);
+}
+
+Scene115::Jukebox::Jukebox() {
+ _jokeboxPlayingCtr = 0;
+}
+
+void Scene115::EventHandler1::dispatch() {
+ Scene115 *scene = (Scene115 *)BF_GLOBALS._sceneManager._scene;
+
+ if (BF_GLOBALS._player.getRegionIndex() == 27) {
+ scene->_kate.setAction(&scene->_action5);
+ scene->removeTimer(this);
+ }
+}
+
+bool Scene115::Item10::startAction(CursorType action, Event &event) {
+ Scene115 *scene = (Scene115 *)BF_GLOBALS._sceneManager._scene;
+
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ scene->_object4.setStrip2(6);
+ Common::Point pt(-20, 122);
+ NpcMover *mover = new NpcMover();
+ scene->_object4.addMover(mover, &pt, NULL);
+ }
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1150;
+ scene->setAction(&scene->_sequenceManager1, scene, 1150, &BF_GLOBALS._player, NULL);
+ return true;
+}
+
+bool Scene115::Item14::startAction(CursorType action, Event &event) {
+ Scene115 *scene = (Scene115 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display(115, 10, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+ case CURSOR_USE:
+ if (BF_GLOBALS._sceneObjects->contains(&scene->_object3))
+ SceneItem::display(115, 23, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ else
+ SceneItem::display(115, 43, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+void Scene115::Action1::signal() {
+ Scene115 *scene = (Scene115 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ setDelay(30);
+ break;
+ case 1:
+ _actionIndex = 2 + BF_GLOBALS._randomSource.getRandomNumber(1);
+ setDelay(BF_GLOBALS._randomSource.getRandomNumber(180));
+ break;
+ case 2:
+ _actionIndex = 1;
+ setAction(&scene->_sequenceManager2, this, 115, &scene->_object3, &scene->_object8, &scene->_object9, &scene->_object10, NULL);
+ break;
+ case 3:
+ _actionIndex = 1;
+ setAction(&scene->_sequenceManager2, this, 116, &scene->_object3, &scene->_object8, &scene->_object9, &scene->_object10, NULL);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene115::Action2::signal() {
+ Scene115 *scene = (Scene115 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ BF_GLOBALS._player.disableControl();
+ if (BF_GLOBALS._tonyDialogCtr < 3) {
+ if (scene->_tony._position.x > 67) {
+ scene->_tony.setAction(&scene->_sequenceManager3, NULL, 1118, &scene->_tony, NULL);
+ } else if (scene->_tony._position.x != 67) {
+ scene->_tony.setAction(&scene->_sequenceManager3, NULL, 1119, &scene->_tony, NULL);
+ }
+ }
+ BF_GLOBALS._player.setAction(&scene->_sequenceManager1, this, 1117, &BF_GLOBALS._player);
+ break;
+ case 1:
+ ++BF_GLOBALS._tonyDialogCtr;
+ if (BF_GLOBALS.getFlag(onDuty)) {
+ if (BF_GLOBALS.getFlag(fTalkedToTony)) {
+ switch (BF_GLOBALS._tonyDialogCtr) {
+ case 1:
+ T2_GLOBALS._uiElements.addScore(30);
+ scene->_stripManager.start(1181, this);
+ break;
+ case 2:
+ scene->_stripManager.start(1176, this);
+ break;
+ default:
+ scene->_stripManager.start(1155, this);
+ break;
+ }
+ } else {
+ scene->_stripManager.start(1175, this);
+ }
+ } else {
+ if (BF_GLOBALS.getFlag(fTalkedToTony)) {
+ switch (BF_GLOBALS._tonyDialogCtr) {
+ case 1:
+ T2_GLOBALS._uiElements.addScore(30);
+ scene->_stripManager.start(1153, this);
+ break;
+ case 2:
+ scene->_stripManager.start(1154, this);
+ break;
+ default:
+ scene->_stripManager.start(1155, this);
+ break;
+ }
+ } else {
+ scene->_stripManager.start(1152, this);
+ }
+ }
+ break;
+ case 2:
+ if (BF_GLOBALS._tonyDialogCtr == 3)
+ scene->_tony.setAction(&scene->_sequenceManager3, NULL, 3119, &scene->_tony, NULL);
+ BF_GLOBALS._player.enableControl();
+ remove();
+ default:
+ break;
+ }
+}
+
+void Scene115::Action3::signal() {
+ Scene115 *scene = (Scene115 *)BF_GLOBALS._sceneManager._scene;
+
+ setAction(&scene->_sequenceManager4, this, 3117, &scene->_neonSign, NULL);
+}
+
+void Scene115::Action4::signal() {
+ Scene115 *scene = (Scene115 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0: {
+ PlayerMover *mover = new PlayerMover();
+ Common::Point destPos(145, 107);
+ BF_GLOBALS._player.addMover(mover, &destPos, this);
+ break;
+ }
+ case 1:
+ BF_GLOBALS._player.setStrip(4);
+ SceneItem::display(115, 27, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_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->_object12.animate(ANIM_MODE_NONE);
+ setDelay(10);
+ break;
+ case 2:
+ setAction(&scene->_sequenceManager1, this, 117, &scene->_object12, &scene->_object11, NULL);
+ break;
+ case 3:
+ scene->_sound1.play(81, &scene->_itemJukebox, 127);
+ BF_GLOBALS._player.enableControl();
+ remove();
+ default:
+ break;
+ }
+}
+
+void Scene115::Action5::signal() {
+ Scene115 *scene = (Scene115 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ if (scene->_itemJukebox._jokeboxPlayingCtr == 0) {
+ setAction(&scene->_sequenceManager5, this, 1115, &scene->_kate, NULL);
+ scene->_jukeboxPlaying = 1;
+ } else {
+ --_actionIndex;
+ setDelay(120);
+ }
+ break;
+ case 1:
+ setAction(&scene->_sequenceManager5, this, 117, &scene->_object12, &scene->_object11, NULL);
+ break;
+ case 2:
+ scene->_sound1.play(81, &scene->_itemJukebox, 127);
+ scene->_itemJukebox._jokeboxPlayingCtr = 1;
+ setDelay(3);
+ break;
+ case 3:
+ setAction(&scene->_sequenceManager5, this, 1116, &scene->_kate, NULL);
+ break;
+ case 4:
+ scene->_jukeboxPlaying = 0;
+ remove();
+ default:
+ break;
+ }
+}
+
+void Scene115::Action6::signal() {
+ Scene115 *scene = (Scene115 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._player.setAction(&scene->_sequenceManager1, this, 2115, &scene->_kate, &BF_GLOBALS._player, NULL);
+ break;
+ case 1:
+ if (scene->_sceneMode == 9999) {
+ setAction(&scene->_sequenceManager1, this, 4115, &scene->_kate, &BF_GLOBALS._player, NULL);
+ --_actionIndex;
+ scene->_sceneMode = 1166;
+ } else {
+ scene->_stripManager.start(scene->_sceneMode, this);
+ }
+ break;
+ case 2:
+ scene->_kate.setVisage(131);
+ scene->_kate.setStrip(1);
+ scene->_kate.setFrame(1);
+ scene->_kate.setPosition(Common::Point(122, 97));
+ BF_GLOBALS._player.enableControl();
+ remove();
+ default:
+ break;
+ }
+}
+
+void Scene115::Action7::signal() {
+ Scene115 *scene = (Scene115 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0: {
+ BF_GLOBALS._player.disableControl();
+ PlayerMover *mover = new PlayerMover();
+ Common::Point destPos(142, 105);
+ BF_GLOBALS._player.addMover(mover, &destPos, this);
+ }
+ break;
+ case 1:
+ BF_GLOBALS._player.setStrip(4);
+ if (BF_GLOBALS._kateDialogCtr == 0)
+ scene->_stripManager.start(1156, this);
+ else
+ scene->_stripManager.start(1157, this);
+ ++BF_GLOBALS._kateDialogCtr;
+ break;
+ case 2:
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene115::Action8::signal() {
+ Scene115 *scene = (Scene115 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ BF_GLOBALS._player.disableControl();
+ setAction(&scene->_sequenceManager1, this, 2115, &scene->_kate, &BF_GLOBALS._player, NULL);
+ break;
+ case 1:
+ T2_GLOBALS._uiElements.addScore(30);
+ setAction(&scene->_sequenceManager1, this, 4115, &scene->_kate, &BF_GLOBALS._player, NULL);
+ break;
+ case 2:
+ scene->_stripManager.start(1160, this);
+ break;
+ case 3:
+ scene->_stripManager.start(1161, this);
+ break;
+ case 4:
+ BF_GLOBALS.setFlag(fGivenNapkin);
+ setAction(&scene->_sequenceManager1, this, 2117, &scene->_kate, &BF_GLOBALS._player, &scene->_object13, NULL);
+ break;
+ case 5:
+ BF_INVENTORY.setObjectScene(INV_NAPKIN, 1);
+ T2_GLOBALS._uiElements.addScore(10);
+ scene->_kate.setVisage(131);
+ scene->_kate.setStrip(1);
+ scene->_kate.setFrame(1);
+ scene->_kate.setPosition(Common::Point(122, 97));
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene115::Action9::signal() {
+ Scene115 *scene = (Scene115 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ BF_GLOBALS._player.disableControl();
+ if (scene->_tony._position.x > 67)
+ scene->_tony.setAction(&scene->_sequenceManager3, NULL, 1118, &scene->_tony, NULL);
+ else if (scene->_tony._position.x != 67)
+ scene->_tony.setAction(&scene->_sequenceManager3, NULL, 1119, &scene->_tony, NULL);
+ BF_GLOBALS._player.setAction(&scene->_sequenceManager1, this, 1117, &BF_GLOBALS._player, NULL);
+ break;
+ case 1:
+ scene->_stripManager.start(scene->_sceneMode, this);
+ break;
+ case 2:
+ scene->_tony.setAction(&scene->_sequenceManager3, this, 3119, &scene->_tony, NULL);
+ break;
+ case 3:
+ BF_GLOBALS._player.enableControl();
+ remove();
+ default:
+ break;
+ }
+}
+
+Scene115::Scene115() : SceneExt () {
+ _lineNumModifier = _jukeboxPlaying = _talkToTonyCtr = 0;
+}
+
+void Scene115::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+
+ BF_GLOBALS._sound1.fadeSound(15);
+ loadScene(115);
+ setZoomPercents(98, 85, 115, 100);
+ _jukeboxPlaying = 0;
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_kateSpeaker);
+ _stripManager.addSpeaker(&_tonySpeaker);
+ _stripManager.addSpeaker(&_jakeJacketSpeaker);
+ _stripManager.addSpeaker(&_jakeUniformSpeaker);
+ _stripManager.addSpeaker(&_lyleHatSpeaker);
+
+ _object6.postInit();
+ _object6.setVisage(121);
+ _object6.setPosition(Common::Point(82, 66));
+ _object6._frame = 1;
+ _object6.setStrip(5);
+ _object6.changeZoom(100);
+ _object6.fixPriority(95);
+
+ _object5.postInit();
+ _object5.setVisage(121);
+ _object5.setPosition(Common::Point(111, 64));
+ _object5._frame = 1;
+ _object5.setStrip(6);
+ _object5.changeZoom(100);
+ _object5.fixPriority(95);
+
+ // Bartender
+ _tony.postInit();
+ _tony.setVisage(132);
+ _tony.setPosition(Common::Point(74, 66));
+ _tony.setStrip(3);
+ _tony.setFrame(1);
+ _tony.fixPriority(95);
+ _tony.animate(ANIM_MODE_2, NULL);
+ _tony._numFrames = 5;
+ _tony._talkToTonyCtr2 = 0;
+ _talkToTonyCtr = 0;
+
+ //Neon sign
+ _neonSign.postInit();
+ _neonSign.setVisage(115);
+ _neonSign.setStrip(4);
+ _neonSign.setFrame(1);
+ _neonSign.setPosition(Common::Point(262, 29));
+ _neonSign.setAction(&_action3);
+
+ _object11.postInit();
+ _object11.hide();
+
+ _object12.postInit();
+ _object12.hide();
+
+ _object13.postInit();
+ _object13.hide();
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setVisage(129);
+ BF_GLOBALS._player.setStrip(3);
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.changeZoom(-1);
+
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ _object4.postInit();
+ _object4.setVisage(469);
+ _object4.animate(ANIM_MODE_1, NULL);
+ _object4.setStrip2(1);
+ _object4.setPosition(Common::Point(-20, 155));
+ Common::Point destPos(17, 118);
+ NpcMover *mover = new NpcMover();
+ _object4.addMover(mover, &destPos, NULL);
+ BF_GLOBALS._sceneItems.push_front(&_object4);
+ BF_GLOBALS._walkRegions.disableRegion(1);
+ } else if (BF_GLOBALS.getFlag(onDuty))
+ BF_GLOBALS._player.setVisage(1341);
+
+ if (BF_GLOBALS._dayNumber == 3) {
+ _object3.postInit();
+ _object3.setVisage(123);
+ _object3.setPosition(Common::Point(212, 108));
+ _object3.setAction(&_action1);
+ _lineNumModifier = 0;
+ BF_GLOBALS._sceneItems.push_front(&_object3);
+
+ _object8.postInit();
+ _object8.setVisage(115);
+ _object8.setPosition(Common::Point(330, 87));
+ _object8.setStrip(3);
+ _object8.fixPriority(112);
+
+ _object9.postInit();
+ _object9.setVisage(115);
+ _object9.setPosition(Common::Point(330, 87));
+ _object9.setStrip(3);
+ _object9.fixPriority(112);
+
+ _object10.postInit();
+ _object10.setVisage(115);
+ _object10.setPosition(Common::Point(330, 87));
+ _object10.setStrip(3);
+ _object10.fixPriority(112);
+
+ if (BF_INVENTORY.getObjectScene(INV_COBB_RAP) == 1) {
+ _kate.postInit();
+ _kate.setVisage(131);
+ _kate.setPosition(Common::Point(122, 97));
+ _kate.setStrip(1);
+ _kate.setFrame(1);
+ _kate.changeZoom(100);
+ _kate.fixPriority(95);
+ BF_GLOBALS._sceneItems.push_front(&_kate);
+ }
+ addTimer(&_eventHandler1);
+ }
+ BF_GLOBALS._sceneItems.push_front(&_tony);
+
+ _item11.setDetails(16, 115, 4, 15, 21, 1);
+ _item12.setDetails(20, 115, 5, 15, 21, 1);
+ _item13.setDetails(31, 115, 6, 16, 22, 1);
+ _item14._sceneRegionId = 13;
+ BF_GLOBALS._sceneItems.push_front(&_item14);
+ _item10.setDetails(Rect(0, 147, 30, 167), 115, -1, -1, -1, 1, NULL);
+ // SUB_177B8
+ addTimer(&_itemJukebox);
+ _itemJukebox.setDetails(Rect(147, 45, 179, 91), 115, 25, 26, 27, 1, NULL);
+ //
+ _item6.setDetails(Rect(107, 43, 122, 61), 115, 28, 29, 30, 1, NULL);
+ _item7.setDetails(Rect(180, 33, 230, 63), 115, 31, 32, 33, 1, NULL);
+ _item8.setDetails(Rect( 0, 35, 96, 66), 115, 34, 35, 36, 1, NULL);
+ _item2.setDetails(Rect( 0, 65, 135, 95), 115, 0, 12, 18, 1, NULL);
+ _item4.setDetails(Rect(104, 0, 150, 90), 115, 2, 14, 20, 1, NULL);
+ _item5.setDetails(Rect(148, 0, 320, 93), 115, 3, 14, 20, 1, NULL);
+ _item3.setDetails(Rect( 0, 95, 320, 168), 115, 1, 13, 19, 1, NULL);
+ _item9.setDetails(Rect( 0, 0, 320, 168), 115, 11, 17, 24, 1, NULL);
+
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 5115;
+ setAction(&_sequenceManager1, this, 5115, &BF_GLOBALS._player, NULL);
+}
+
+void Scene115::signal() {
+ switch (_sceneMode) {
+
+ case 1150:
+ BF_GLOBALS._sceneManager.changeScene(114);
+ break;
+ case 1:
+ BF_GLOBALS._player.updateAngle(_object3._position);
+ SceneItem::display(115, 38 + _lineNumModifier, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ ++_lineNumModifier;
+ if (_lineNumModifier >= 4)
+ _lineNumModifier = 0;
+ // No break on purpose
+ case 0:
+ // No break on purpose
+ case 5115:
+ // No break on purpose
+ default:
+ BF_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene115::process(Event &event) {
+ SceneExt::process(event);
+ if (!BF_GLOBALS._player._enabled)
+ return;
+ if (event.mousePos.y >= 167)
+ return;
+ if (_item10._bounds.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW);
+ BF_GLOBALS._events.setCursor(surface);
+ } else {
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(cursorId);
+ }
+}
+
+void Scene115::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ s.syncAsSint16LE(_lineNumModifier);
+ s.syncAsSint16LE(_jukeboxPlaying);
+ s.syncAsSint16LE(_talkToTonyCtr);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 125 - Intro - Chase in the city
+ *
+ *--------------------------------------------------------------------------*/
+void Scene125::Action1::signal() {
+ Scene125 *scene = (Scene125 *)BF_GLOBALS._sceneManager._scene;
+ SceneObject *owner = static_cast<SceneObject *>(this->_owner);
+
+ switch (_actionIndex++) {
+ case 1: {
+ Common::Point destPos(214, 105);
+ NpcMover *mover = new NpcMover();
+ owner->addMover(mover, &destPos, this);
+ break;
+ }
+ case 2:
+ owner->animate(ANIM_MODE_4, 4, 1, this);
+ break;
+ case 3:
+ owner->setFrame(5);
+ scene->_object2.show();
+ setDelay(180);
+ break;
+ case 4: {
+ Common::Point destPos(311, 85);
+ NpcMover *mover = new NpcMover();
+ owner->addMover(mover, &destPos, this);
+ break;
+ }
+ case 5:
+ owner->remove();
+ break;
+ case 0:
+ // No break on purpose
+ default:
+ break;
+ }
+}
+
+void Scene125::Action2::signal() {
+ Scene125 *scene = (Scene125 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ setDelay(30);
+ break;
+ case 1:
+ scene->_action1.signal();
+ setDelay(20);
+ break;
+ case 2: {
+ BF_GLOBALS._v501FA = 10;
+ BF_GLOBALS._v51C44 = 1;
+ Common::Point destPos(202, 94);
+ NpcMover *mover = new NpcMover();
+ BF_GLOBALS._player.addMover(mover, &destPos, this);
+ break;
+ }
+ case 3: {
+ scene->_action3.signal();
+ Common::Point destPos(280, 84);
+ NpcMover *mover = new NpcMover();
+ BF_GLOBALS._player.addMover(mover, &destPos, this);
+ break;
+ }
+ case 4:
+ BF_GLOBALS._player.animate(ANIM_MODE_5, this);
+ break;
+ case 5: {
+ Common::Point destPos(375, 111);
+ NpcMover *mover = new NpcMover();
+ BF_GLOBALS._player.addMover(mover, &destPos, this);
+ break;
+ }
+ case 6:
+ BF_GLOBALS._player.setStrip(2);
+ BF_GLOBALS._player.setFrame(1);
+ BF_GLOBALS._player.animate(ANIM_MODE_5, this);
+ break;
+ case 7: {
+ Common::Point destPos(347, 139);
+ NpcMover *mover = new NpcMover();
+ BF_GLOBALS._player.addMover(mover, &destPos, this);
+ break;
+ }
+ case 8:
+ BF_GLOBALS._player.setStrip(3);
+ BF_GLOBALS._player.setFrame(1);
+ BF_GLOBALS._player.animate(ANIM_MODE_5, this);
+ break;
+ case 9: {
+ Common::Point destPos(107, 75);
+ NpcMover *mover = new NpcMover();
+ BF_GLOBALS._player.addMover(mover, &destPos, this);
+ BF_GLOBALS._player.setPriority(80);
+ break;
+ }
+ case 10:
+ BF_GLOBALS._player.setStrip(4);
+ BF_GLOBALS._player.setFrame(1);
+ BF_GLOBALS._player.animate(ANIM_MODE_5, this);
+ break;
+ case 11: {
+ BF_GLOBALS._player.setPriority(64);
+ Common::Point destPos(229, 61);
+ NpcMover *mover = new NpcMover();
+ BF_GLOBALS._player.addMover(mover, &destPos, this);
+ break;
+ }
+ case 12:
+ scene->_action3.signal();
+ BF_GLOBALS._player.remove();
+ default:
+ break;
+ }
+}
+
+void Scene125::Action2::dispatch() {
+ Action::dispatch();
+
+ if ((_actionIndex == 10) && (BF_GLOBALS._player._percent > 80))
+ BF_GLOBALS._player.changeZoom(BF_GLOBALS._player._percent - 1);
+
+ if ((_actionIndex == 12) && (BF_GLOBALS._player._percent > 50))
+ BF_GLOBALS._player.changeZoom(BF_GLOBALS._player._percent - 1);
+}
+
+void Scene125::Action3::signal() {
+ Scene125 *scene = (Scene125 *)BF_GLOBALS._sceneManager._scene;
+ SceneObject *owner = static_cast<SceneObject *>(this->_owner);
+
+ switch (_actionIndex++) {
+ case 0:
+ break;
+ case 1: {
+ Common::Point destPos(202, 94);
+ NpcMover *mover = new NpcMover();
+ owner->addMover(mover, &destPos, this);
+ break;
+ }
+ case 2: {
+ Common::Point destPos(275, 84);
+ NpcMover *mover = new NpcMover();
+ owner->addMover(mover, &destPos, this);
+ break;
+ }
+ case 3:
+ scene->_soundExt2.fadeSound(20);
+ owner->fixPriority(70);
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 4: {
+ Common::Point destPos(375, 111);
+ NpcMover *mover = new NpcMover();
+ owner->addMover(mover, &destPos, this);
+ break;
+ }
+ case 5:
+ owner->setStrip(2);
+ owner->setFrame(1);
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 6: {
+ Common::Point destPos(347, 145);
+ NpcMover *mover = new NpcMover();
+ owner->addMover(mover, &destPos, this);
+ break;
+ }
+ case 7:
+ owner->setStrip(3);
+ owner->setFrame(1);
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 8: {
+ Common::Point destPos(96, 71);
+ NpcMover *mover = new NpcMover();
+ owner->addMover(mover, &destPos, this);
+ owner->_moveDiff.x = 6;
+ owner->_moveDiff.y = 6;
+ owner->setPriority(80);
+ break;
+ }
+ case 9:
+ owner->setPosition(Common::Point(85, 76));
+ owner->setStrip(4);
+ owner->setFrame(1);
+ owner->changeZoom(100);
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 10: {
+ scene->_action5.signal();
+ scene->_soundExt1.play(25);
+ Common::Point destPos(154, 94);
+ NpcMover *mover = new NpcMover();
+ owner->addMover(mover, &destPos, this);
+ break;
+ }
+ case 11:
+ break;
+ case 12:
+ scene->_object1.setPosition(owner->_position);
+ scene->_object1.changeZoom(2);
+ scene->_object1.show();
+ setDelay(1);
+ case 13:
+ BF_GLOBALS._sound1.play(6);
+ scene->_object1.changeZoom(4);
+ scene->_object1.setPosition(Common::Point(148, 88));
+ setDelay(1);
+ break;
+ case 14:
+ scene->_object1.changeZoom(8);
+ scene->_object1.setPosition(Common::Point(167, 97));
+ setDelay(1);
+ break;
+ case 15:
+ scene->_object1.changeZoom(16);
+ scene->_object1.setPosition(Common::Point(197, 104));
+ scene->_object4.show();
+ scene->_object3.show();
+ scene->_object4.changeZoom(16);
+ scene->_object4.setPosition(Common::Point(scene->_object1._position.x - 9, scene->_object1._position.y - 8));
+ scene->_object3.changeZoom(16);
+ scene->_object3.setPosition(Common::Point(scene->_object1._position.x + 5, scene->_object1._position.y - 8));
+ setDelay(1);
+ break;
+ case 16:
+ scene->_object1.changeZoom(32);
+ scene->_object1.setPosition(Common::Point(197, 104));
+ scene->_object4.changeZoom(32);
+ scene->_object4.setPosition(Common::Point(scene->_object1._position.x - 17, scene->_object1._position.y - 15));
+ scene->_object3.changeZoom(32);
+ scene->_object3.setPosition(Common::Point(scene->_object1._position.x + 12, scene->_object1._position.y - 15));
+ setDelay(1);
+ break;
+ case 17:
+ scene->_object1.changeZoom(64);
+ scene->_object1.setPosition(Common::Point(198, 114));
+ scene->_object4.changeZoom(64);
+ scene->_object4.setPosition(Common::Point(scene->_object1._position.x - 34, scene->_object1._position.y - 29));
+ scene->_object3.changeZoom(64);
+ scene->_object3.setPosition(Common::Point(scene->_object1._position.x + 23, scene->_object1._position.y - 29));
+ setDelay(1);
+ break;
+ case 18:
+ scene->_object1.changeZoom(100);
+ scene->_object1.setPosition(Common::Point(160, 112));
+ scene->_object4.changeZoom(100);
+ scene->_object4.setPosition(Common::Point(scene->_object1._position.x - 51, scene->_object1._position.y - 45));
+ scene->_object3.changeZoom(100);
+ scene->_object3.setPosition(Common::Point(scene->_object1._position.x + 42, scene->_object1._position.y - 45));
+ scene->_object4.animate(ANIM_MODE_5, this);
+ scene->_object3.animate(ANIM_MODE_5, this);
+ setDelay(1);
+ break;
+ case 19:
+ break;
+ case 20:
+ setDelay(30);
+ break;
+ case 21:
+ BF_GLOBALS._sceneManager.changeScene(140);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene125::Action3::dispatch() {
+ SceneObject *owner = static_cast<SceneObject *>(this->_owner);
+
+ Action::dispatch();
+
+ if ((_actionIndex == 9) && (owner->_percent > 70))
+ owner->changeZoom(owner->_percent - 1);
+}
+
+void Scene125::Action4::signal() {
+ Scene125 *scene = (Scene125 *)BF_GLOBALS._sceneManager._scene;
+ SceneObject *owner = static_cast<SceneObject *>(this->_owner);
+
+ switch (_actionIndex++) {
+ case 0:
+ setDelay(180);
+ break;
+ case 1: {
+ owner->setPriority(scene->_object2._priority - 1);
+ Common::Point destPos(66, 168);
+ NpcMover *mover = new NpcMover();
+ owner->addMover(mover, &destPos, this);
+ break;
+ }
+ case 2:
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 3: {
+ Common::Point destPos(307, 106);
+ NpcMover *mover = new NpcMover();
+ owner->addMover(mover, &destPos, this);
+ break;
+ }
+ case 4:
+ owner->remove();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene125::Action4::dispatch() {
+ SceneObject *owner = static_cast<SceneObject *>(this->_owner);
+
+ Action::dispatch();
+
+ if ((_actionIndex == 4) && (owner->_percent > 80))
+ owner->changeZoom(owner->_percent - 1);
+}
+
+void Scene125::Action5::signal() {
+ SceneObject *owner = static_cast<SceneObject *>(this->_owner);
+
+ if (_actionIndex++ == 1) {
+ Common::Point destPos(162, 103);
+ NpcMover *mover = new NpcMover();
+ owner->addMover(mover, &destPos, this);
+ }
+}
+
+void Scene125::Action6::signal() {
+ SceneObject *owner = static_cast<SceneObject *>(this->_owner);
+
+ switch (_actionIndex++) {
+ case 0:
+ setDelay(60);
+ break;
+ case 1: {
+ Common::Point destPos(410, 181);
+ NpcMover *mover = new NpcMover();
+ owner->addMover(mover, &destPos, this);
+ break;
+ }
+ case 2:
+ owner->remove();
+ default:
+ break;
+ }
+}
+
+void Scene125::Action6::dispatch() {
+ SceneObject *owner = static_cast<SceneObject *>(this->_owner);
+
+ Action::dispatch();
+
+ if ((_actionIndex == 2) && (owner->_percent < 100))
+ owner->changeZoom(owner->_percent + 1);
+}
+
+void Scene125::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(120);
+
+ _object4.postInit();
+ _object4.setVisage(124);
+ _object4.setPosition(Common::Point(0, 0));
+ _object4.setStrip(1);
+ _object4.setFrame(1);
+ _object4.fixPriority(251);
+ _object4.hide();
+
+ _object3.postInit();
+ _object3.setVisage(124);
+ _object3.setPosition(Common::Point(0, 0));
+ _object3.setStrip(2);
+ _object3.setFrame(1);
+ _object3.fixPriority(251);
+ _object3.hide();
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setVisage(127);
+ BF_GLOBALS._player.setPosition(Common::Point(160, 110));
+ BF_GLOBALS._player.setStrip(1);
+ BF_GLOBALS._player.setFrame(1);
+ BF_GLOBALS._player.changeZoom(100);
+ BF_GLOBALS._player.fixPriority(68);
+ BF_GLOBALS._player._moveDiff.x = 6;
+ BF_GLOBALS._player._moveDiff.y = 6;
+ BF_GLOBALS._player.disableControl();
+
+ _object5.postInit();
+ _object5.setVisage(128);
+ _object5.setPosition(Common::Point(150, 117));
+ _object5.fixPriority(68);
+ _object5._moveDiff.x = 6;
+ _object5._moveDiff.y = 6;
+
+ _object9.postInit();
+ _object9.setVisage(126);
+ _object9.setPosition(Common::Point(124, 106));
+ _object9.setStrip(4);
+ _object9.fixPriority(90);
+ _object9._moveDiff.x = 3;
+ _object9._moveDiff.y = 3;
+
+ _object1.postInit();
+ _object1.setVisage(130);
+ _object1.setPosition(Common::Point(139, 88));
+ _object1.setStrip(1);
+ _object1.setFrame(1);
+ _object1.changeZoom(100);
+ _object1.fixPriority(250);
+ _object1.hide();
+
+ _object8.postInit();
+ _object8.setVisage(126);
+ _object8.setPosition(Common::Point(89, 181));
+ _object8.setStrip(3);
+ _object8._moveDiff.x = 6;
+ _object8._moveDiff.y = 6;
+
+ _object6.postInit();
+ _object6.setVisage(126);
+ _object6.setPosition(Common::Point(289, 128));
+ _object6.fixPriority(69);
+ _object6._moveDiff.x = 6;
+ _object6._moveDiff.y = 6;
+ _object6.setAction(&_action1);
+
+ _object2.postInit();
+ _object2.setVisage(126);
+ _object2.setPosition(Common::Point(214, 105));
+ _object2.setStrip(2);
+ _object2.setFrame(1);
+ _object2.changeZoom(100);
+ _object2.fixPriority(63);
+ _object2.hide();
+
+ _object7.postInit();
+ _object7.setVisage(126);
+ _object7.setPosition(Common::Point(87, 76));
+ _object7.setStrip(6);
+ _object7.setFrame(6);
+ _object7.changeZoom(80);
+ _object7._moveDiff.x = 4;
+ _object7._moveDiff.y = 4;
+ _object7.setAction(&_action6);
+
+ BF_GLOBALS._sound1.play(5);
+ setAction(&_action2);
+ _object5.setAction(&_action3);
+ _object8.setAction(&_action4);
+ _object9.setAction(&_action5);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 140 - Intro - Near the house
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene140::Action1::signal() {
+ Scene140 *scene = (Scene140 *)BF_GLOBALS._sceneManager._scene;
+ SceneObject *owner = static_cast<SceneObject *>(this->_owner);
+
+ switch (_actionIndex++) {
+ case 0:
+ scene->loadScene(999);
+ setDelay(2);
+ break;
+ case 1:
+ BF_GLOBALS._scenePalette.loadPalette(2);
+ BF_GLOBALS._scenePalette.refresh();
+ scene->_text.setup(BF_19840518, this);
+ break;
+ case 2:
+ scene->_object1.show();
+ scene->loadScene(140);
+ setDelay(1);
+ break;
+ case 3: {
+ Common::Point destPos(236, 144);
+ NpcMover *mover = new NpcMover();
+ owner->addMover(mover, &destPos, this);
+ owner->_numFrames = 7;
+ break;
+ }
+ case 4:
+ owner->setStrip(3);
+ owner->setFrame(1);
+ owner->_numFrames = 5;
+ owner->setPosition(Common::Point(226, 143));
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 5:
+ owner->setStrip(4);
+ owner->setFrame(1);
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 6:
+ scene->_object1.animate(ANIM_MODE_5, this);
+ owner->setStrip(1);
+ owner->setFrame(1);
+ break;
+ case 7:
+ owner->setFrame(1);
+ owner->setPosition(Common::Point(owner->_position.x, owner->_position.y + 1));
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 8:
+ owner->animate(ANIM_MODE_6, this);
+ owner->_numFrames = 10;
+ break;
+ case 9:
+ owner->_numFrames = 5;
+ owner->setPosition(Common::Point(217, 117));
+ owner->setStrip(2);
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 10:
+ owner->setPosition(Common::Point(212, 117));
+ setDelay(10);
+ // No break on purpose
+ case 11:
+ owner->setPosition(owner->_position, 1000);
+ setDelay(60);
+ break;
+ case 12:
+ BF_GLOBALS._sound1.play(8);
+ setDelay(60);
+ // No break on purpose
+ case 13:
+ BF_GLOBALS._v51C44 = 1;
+ BF_GLOBALS._sceneManager.changeScene(150);
+ default:
+ break;
+ }
+}
+
+void Scene140::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(999);
+
+ _object2.postInit();
+ _object2.setVisage(141);
+ _object2.setPosition(Common::Point(333, 149));
+ _object2.setStrip(5);
+ _object2.animate(ANIM_MODE_1, NULL);
+ _object2._moveDiff.x = 3;
+
+ _object1.postInit();
+ _object1.setVisage(141);
+ _object1.setPosition(Common::Point(202, 115));
+ _object1.setFrame(1);
+ _object1.setStrip(6);
+ _object1.changeZoom(100);
+ _object1.hide();
+
+ BF_GLOBALS._v5020C = 0;
+ BF_GLOBALS._v501F8 = 300;
+ BF_GLOBALS._v501FC = 90;
+ BF_GLOBALS._sound1.play(7);
+
+ _object2.setAction(&_action1);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 150 - Intro - Burglar inside the house
+ *
+ *--------------------------------------------------------------------------*/
+void Scene150::Action1::signal() {
+ SceneObject *owner = static_cast<SceneObject *>(this->_owner);
+ static uint32 v50B96 = 0;
+
+ switch (_actionIndex++) {
+ case 0:
+ _actionIndex = 5;
+ _object2.postInit();
+ _object2.setVisage(150);
+ _object2.setStrip(3);
+ _object2._frame = 1;
+ _object2.setPosition(Common::Point(148, 126));
+ _object2.changeZoom(100);
+ setDelay(10);
+ break;
+ case 1:
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 2:
+ owner->_frame = 1;
+ owner->setStrip(4);
+ owner->animate(ANIM_MODE_4, 3, 1, this);
+ break;
+ case 3:
+ owner->animate(ANIM_MODE_5, this);
+ _object2.animate(ANIM_MODE_5, this);
+ break;
+ case 4:
+ _object2.remove();
+ break;
+ case 5:
+ owner->_numFrames = 8;
+ owner->_frame = 1;
+ owner->setStrip(2);
+ owner->animate(ANIM_MODE_4, 14, 1, this);
+ break;
+ case 6:
+ owner->fixPriority(119);
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 7:
+ setDelay(60);
+ break;
+ case 8:
+ BF_GLOBALS._sound1.stop();
+ // No break on purpose
+ case 9:
+ _sound1.play(8);
+ setDelay(30);
+ break;
+ case 10:
+ BF_GLOBALS._scenePalette.addFader((const byte *)&v50B96, 1, 2, this);
+ break;
+ case 11:
+ BF_GLOBALS._sound1.play(9);
+ BF_GLOBALS._sceneManager.changeScene(160);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene150::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(150);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setPosition(Common::Point(160, 100));
+ BF_GLOBALS._player._moveDiff.x = 15;
+ BF_GLOBALS._player.hide();
+
+ _object1.postInit();
+ _object1.setVisage(150);
+ _object1.setPosition(Common::Point(158, 119));
+ _object1._numFrames = 5;
+ _object1.fixPriority(121);
+ _object1.setAction(&_action1);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 160 - Intro - Burial
+ *
+ *--------------------------------------------------------------------------*/
+void Scene160::Action1::signal() {
+ Scene160 *scene = (Scene160 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ break;
+ case 1:
+ scene->_kid.animate(ANIM_MODE_5, this);
+ break;
+ case 2:
+ // No break on purpose
+ case 10:
+ scene->_grandma.animate(ANIM_MODE_5, this);
+ break;
+ case 3:
+ // No break on purpose
+ case 6:
+ scene->_kid.animate(ANIM_MODE_6, this);
+ break;
+ case 4:
+ scene->_kid.setPosition(Common::Point(scene->_kid._position.x - 2, scene->_kid._position.y + 19));
+ scene->_kid.setFrame(1);
+ scene->_kid.setStrip(2);
+ scene->_kid.animate(ANIM_MODE_5, this);
+
+ scene->_kidBody.setPosition(scene->_kid._position);
+ scene->_kidBody.setFrame(1);
+ scene->_kidBody.setStrip(3);
+ break;
+ case 5:
+ setDelay(60);
+ break;
+ case 7:
+ scene->_kidBody.remove();
+ scene->_kid.setStrip(6);
+ scene->_kid.setFrame(1);
+ scene->_kid.setPosition(Common::Point(scene->_kid._position.x - 4, scene->_kid._position.y + 19));
+ scene->_grandma.animate(ANIM_MODE_6, this);
+ scene->_grandma._numFrames = 7;
+ break;
+ case 8:
+ scene->_grandma.setStrip(2);
+ scene->_grandma.setFrame(1);
+ scene->_grandma.animate(ANIM_MODE_5, this);
+ break;
+ case 9:
+ setDelay(120);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene160::Action2::signal() {
+ Scene160 *scene = (Scene160 *)BF_GLOBALS._sceneManager._scene;
+ SceneObject *owner = static_cast<SceneObject *>(this->_owner);
+ static uint32 v50BAB = 0;
+ static uint32 v50BC3 = 0;
+
+ switch (_actionIndex++) {
+ case 0:
+ break;
+ case 1:
+ owner->animate(ANIM_MODE_5, this);
+ owner->_numFrames = 8;
+ break;
+ case 2:
+ owner->setStrip(2);
+ owner->setFrame(1);
+ owner->setPosition(Common::Point(scene->_flag._position.x + 56, scene->_flag._position.y + 2));
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 3:
+ owner->setStrip(3);
+ owner->setFrame(1);
+ owner->setPosition(Common::Point(scene->_flag._position.x + 26, scene->_flag._position.y - 8));
+ owner->animate(ANIM_MODE_4, 8, 1, this);
+ break;
+ case 4:
+ scene->_flag.remove();
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 5:
+ owner->setVisage(162);
+ owner->setStrip(1);
+ owner->setFrame(1);
+ owner->setPosition(Common::Point(owner->_position.x + 27, owner->_position.y + 11));
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 6:
+ owner->setStrip(2);
+ owner->setFrame(1);
+ owner->setPosition(Common::Point(owner->_position.x - 42, owner->_position.y + 15));
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 7:
+ owner->setStrip(3);
+ owner->setFrame(1);
+ owner->setPosition(Common::Point(owner->_position.x + 1, owner->_position.y));
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 8:
+ owner->setStrip(4);
+ owner->setFrame(1);
+ owner->setPosition(Common::Point(owner->_position.x - 3, owner->_position.y - 1));
+
+ scene->_leftOfficer.show();
+ scene->_leftOfficer.setStrip(1);
+ scene->_leftOfficer.setFrame(1);
+ scene->_leftOfficer.setPosition(Common::Point(owner->_position.x + 8, owner->_position.y - 39));
+ scene->_leftOfficer._numFrames = 5;
+ scene->_leftOfficer.animate(ANIM_MODE_5, this);
+ break;
+ case 9:
+ setDelay(30);
+ break;
+ case 10:
+ scene->_leftOfficer.hide();
+ owner->setVisage(163);
+ owner->setStrip(2);
+ owner->setFrame(1);
+ owner->setPosition(Common::Point(owner->_position.x + 39, owner->_position.y));
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 11:
+ scene->_leftOfficer.fixPriority(owner->_priority + 1);
+ setDelay(60);
+ break;
+ case 12:
+ scene->_leftOfficer.show();
+ scene->_leftOfficer.setPosition(Common::Point(owner->_position.x - 32, owner->_position.y - 38));
+ scene->_leftOfficer.setStrip(3);
+ scene->_leftOfficer.setFrame(1);
+
+ owner->setVisage(165);
+ owner->setPosition(Common::Point(owner->_position.x + 6, owner->_position.y - 3));
+ owner->setStrip(1);
+ owner->setFrame(1);
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 13: {
+ owner->setStrip(2);
+ owner->setFrame(1);
+ owner->changeZoom(110);
+ owner->animate(ANIM_MODE_1, NULL);
+ Common::Point destPos(scene->_kid._position.x - 25, scene->_kid._position.y + 15);
+ NpcMover *mover = new NpcMover();
+ owner->addMover(mover, &destPos, this);
+ break;
+ }
+ case 14:
+ owner->changeZoom(100);
+ owner->setStrip(5);
+ owner->setFrame(1);
+ scene->_kid.animate(ANIM_MODE_4, 5, 1, this);
+ break;
+ case 15:
+ owner->animate(ANIM_MODE_5, this);
+ scene->_kid.animate(ANIM_MODE_5, NULL);
+ break;
+ case 16:
+ owner->setStrip(6);
+ owner->setFrame(1);
+ owner->setPosition(Common::Point(owner->_position.x - 8, owner->_position.y + 3));
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 17:
+ setDelay(70);
+ break;
+ case 18:
+ owner->animate(ANIM_MODE_6, this);
+ break;
+ case 19:
+ setDelay(120);
+ break;
+ case 20:
+ BF_GLOBALS._sound1.changeSound(10);
+ BF_GLOBALS._scenePalette.addFader((const byte *)&v50BAB, 1, 2, this);
+ break;
+ case 21:
+ BF_GLOBALS._scenePalette.loadPalette(2);
+ scene->loadScene(999);
+ setDelay(2);
+ break;
+ case 22:
+ scene->_sceneBounds.set(0, 0, 320, 200);
+ scene->_text.setup(BF_11_YEARS, this);
+ break;
+ case 23:
+ BF_GLOBALS._scenePalette.loadPalette(2);
+ scene->loadScene(165);
+ BF_GLOBALS._scenePalette.addFader((const byte *)&v50BC3, 1, -5, this);
+ break;
+ case 24:
+ setDelay(900);
+ break;
+ case 25:
+ BF_GLOBALS._sound1.fade(0, 10, 10, true, this);
+// FIXME: Currently, fade() doesn't end properly with this song,
+// thus never returns here. This hack skips the wait and changes
+// directly to the next scene
+// Start of hack
+// break;
+// case 26:
+ setDelay(5);
+ BF_GLOBALS._sound1.stop();
+// End of hack
+
+ BF_GLOBALS._v51C44 = 1;
+ BF_GLOBALS._sceneManager.changeScene(200);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene160::Action2::process(Event &event) {
+ if ((event.handled) || (event.eventType == 5))
+ return;
+
+ if (_actionIndex == 25) {
+ event.handled = true;
+ setDelay(1);
+ }
+}
+
+void Scene160::Action3::signal() {
+ Scene160 *scene = (Scene160 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ scene->_text.setup(BF_3_DAYS, this);
+ break;
+ case 1: {
+ Common::Point destPos(720, 100);
+ NpcMover *mover = new NpcMover();
+ BF_GLOBALS._player.addMover(mover, &destPos, this);
+ break;
+ }
+ case 2:
+ scene->_action1.signal();
+ scene->_action2.signal();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene160::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(160);
+ _sceneBounds.moveTo(0, 0);
+
+ BF_GLOBALS._scenePalette.loadPalette(2);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setPosition(Common::Point(160, 100));
+ BF_GLOBALS._player._moveDiff.x = 15;
+ BF_GLOBALS._player.hide();
+
+ _grandma.postInit();
+ _grandma.setVisage(54);
+ _grandma.setPosition(Common::Point(712, 97));
+ _grandma.fixPriority(66);
+
+ _kid.postInit();
+ _kid.setPosition(Common::Point(732, 65));
+ _kid.setVisage(164);
+ _kid.setStrip(4);
+ _kid.fixPriority(68);
+
+ _kidBody.postInit();
+ _kidBody.setPosition(Common::Point(_kid._position.x, _kid._position.y));
+ _kidBody.setVisage(164);
+ _kidBody.setStrip(5);
+ _kidBody.fixPriority(68);
+
+ _flag.postInit();
+ _flag.setPosition(Common::Point(645, 116));
+ _flag.setVisage(161);
+ _flag.setStrip(4);
+ _flag.fixPriority(80);
+
+ _rightOfficer.postInit();
+ _rightOfficer.setVisage(161);
+ _rightOfficer.setPosition(Common::Point(_flag._position.x + 58, _flag._position.y + 11));
+ _rightOfficer.fixPriority(81);
+
+ _leftOfficer.postInit();
+ _leftOfficer.setVisage(163);
+ _leftOfficer.setPosition(Common::Point(620, 79));
+ _leftOfficer.setStrip(3);
+ _leftOfficer.fixPriority(81);
+ _leftOfficer.hide();
+
+ _rightOfficer.setAction(&_action2);
+ _grandma.setAction(&_action1);
+ setAction(&_action3);
+
+ _sceneBounds.center(BF_GLOBALS._player._position.x, BF_GLOBALS._player._position.y);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 180 - Front of Home
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene180::Vechile::startAction(CursorType action, Event &event) {
+ if (action == CURSOR_USE) {
+ BF_GLOBALS._sceneManager.changeScene(60);
+ return true;
+ } else {
+ return NamedObject::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene180::GarageExit::startAction(CursorType action, Event &event) {
+ Scene180 *scene = (Scene180 *)BF_GLOBALS._sceneManager._scene;
+
+ if (scene->_garageExit.contains(event.mousePos)) {
+ ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, 256, 114);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene180::Scene180(): SceneExt() {
+ _dispatchMode = 0;
+}
+
+void Scene180::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ s.syncAsSint16LE(_dispatchMode);
+}
+
+void Scene180::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+
+ if (((BF_GLOBALS._bookmark == bLyleStoppedBy) && (BF_GLOBALS._dayNumber == 1)) ||
+ ((BF_GLOBALS._bookmark == bDroppedOffLyle) && (BF_GLOBALS._dayNumber == 3)) ||
+ ((BF_GLOBALS._bookmark == bDoneAtLyles) && (BF_GLOBALS._dayNumber == 4)))
+ loadScene(999);
+ else
+ loadScene(1180);
+ _garageExit.setDetails(Rect(243, 93, 275, 122), 180, -1, -1, -1, 1, NULL);
+ _gameTextSpeaker._textPos.y = 180;
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _dispatchMode = 0;
+ setZoomPercents(121, 60, 125, 70);
+
+ if ((BF_GLOBALS._bookmark == bLyleStoppedBy) && (BF_GLOBALS._dayNumber == 1)) {
+ BF_GLOBALS._v501FC = 87;
+ BF_GLOBALS._v501FA = _sceneBounds.left + 10;
+ // CHECKME: BF_GLOBALS._v50206 = 18; ??
+ _sceneMessage.setup(THE_NEXT_DAY);
+ _sceneMode = 6;
+ setAction(&_sceneMessage, this);
+ BF_GLOBALS._driveFromScene = 4;
+ BF_GLOBALS._driveToScene = 4;
+ BF_GLOBALS._mapLocationId = 4;
+ } else if (((BF_GLOBALS._bookmark == bDroppedOffLyle) && (BF_GLOBALS._dayNumber == 3)) ||
+ ((BF_GLOBALS._bookmark == bDoneAtLyles) && (BF_GLOBALS._dayNumber == 4))) {
+ BF_GLOBALS._v501FC = 87;
+ BF_GLOBALS._v501FA = _sceneBounds.left + 10;
+ // CHECKME: BF_GLOBALS._v50206 = 18; ??
+ _sceneMessage.setup(THE_NEXT_DAY);
+ _sceneMode = 6;
+ setAction(&_sceneMessage, this);
+ } else if (BF_GLOBALS._dayNumber == 0) {
+ BF_GLOBALS._player.setPosition(Common::Point(0, 150));
+ _vechile.postInit();
+ _garageExit.postInit();
+
+ BF_GLOBALS._driveToScene = 190;
+ BF_GLOBALS._sound1.play(31);
+ BF_GLOBALS._sound1.holdAt(1);
+ _sceneMode = 1800;
+
+ setAction(&_sequenceManager, this, 1800, &_vechile, &_object1, NULL);
+ } else if (BF_GLOBALS._driveFromScene == 180) {
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setVisage(831);
+ BF_GLOBALS._player.setPosition(Common::Point(285, 125));
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player._strip = 3;
+ BF_GLOBALS._player.changeZoom(-1);
+
+ _vechile.postInit();
+ _vechile.setVisage(580);
+ _vechile.setStrip(2);
+ _vechile.setPosition(Common::Point(262, 131));
+ _vechile.setZoom(65);
+ _vechile.setDetails(180, 33, 34, 35, 1, NULL);
+
+ _object1.postInit();
+ _object1.setVisage(182);
+ _object1.setStrip(2);
+ _object1.setPosition(Common::Point(258, 122));
+ _object1.setFrame(6);
+
+ BF_GLOBALS._driveFromScene = 0;
+ BF_GLOBALS._player.enableControl();
+ } else if (BF_GLOBALS._driveToScene != 180) {
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.disableControl();
+
+ _vechile.postInit();
+ _vechile.setDetails(180, 33, 34, 35, 1, NULL);
+
+ _object1.postInit();
+
+ BF_GLOBALS._driveFromScene = 4;
+ BF_GLOBALS._driveToScene = 4;
+ BF_GLOBALS._mapLocationId = 4;
+
+ BF_GLOBALS._sound1.fadeSound(33);
+ _sceneMode = 1801;
+ setAction(&_sequenceManager, this, 1801, &BF_GLOBALS._player, &_vechile, &_object1, NULL);
+ } else {
+ BF_GLOBALS._driveFromScene = 0;
+ if (!BF_GLOBALS.getFlag(onDuty) && !BF_GLOBALS.getFlag(fWithLyle)) {
+ BF_GLOBALS._player.setPosition(Common::Point(0, 150));
+
+ _object1.postInit();
+ _object1.setVisage(182);
+ _object1.setStrip(2);
+ _object1.setPosition(Common::Point(258, 122));
+
+ _vechile.postInit();
+ _vechile.setVisage(181);
+ _vechile.setStrip(2);
+ _vechile.changeZoom(80);
+ _vechile.fixPriority(150);
+ _vechile._moveDiff = Common::Point(40, 5);
+ _vechile.setPosition(Common::Point(-25, 171));
+
+ _dispatchMode = 1;
+
+ BF_GLOBALS._sound1.play(29);
+ _sceneMode = 1;
+ ADD_MOVER(_vechile, 259, 150);
+ } else {
+ BF_GLOBALS._player.setPosition(Common::Point(0, 150));
+
+ _object1.postInit();
+ _object1.setVisage(182);
+ _object1.setStrip(2);
+ _object1.setPosition(Common::Point(258, 122));
+
+ _vechile.postInit();
+ if (BF_GLOBALS.getFlag(onDuty)) {
+ BF_GLOBALS._sound1.play(29);
+
+ _vechile.setVisage(191);
+ _vechile.setStrip(3);
+ _vechile._frame = 5;
+ _vechile.changeZoom(75);
+
+ _dispatchMode = 1;
+ _vechile._moveDiff.x = 45;
+ } else {
+ _vechile.setVisage(444);
+ _vechile.setStrip(2);
+ _vechile.changeZoom(85);
+
+ _dispatchMode = 3;
+ _vechile._moveDiff.x = 30;
+ }
+
+ _vechile.fixPriority(150);
+ _vechile._moveDiff.y = 5;
+ _vechile.setPosition(Common::Point(-25, 171));
+
+ _sceneMode = 3;
+ ADD_MOVER(_vechile, 258, 145);
+ }
+ }
+
+ if (_sceneMode != 6) {
+ _frontDoor.setDetails(Rect(183, 92, 218, 122), 180, 27, 28, 29, 1, NULL);
+ _driveway.setDetails(8, 180, 36, 37, 38, 1);
+ _street.setDetails(1, 180, 21, 22, 23, 1);
+ _lawn.setDetails(3, 180, 18, 19, 20, 1);
+ _bushes.setDetails(4, 180, 15, 16, 17, 1);
+ _palms.setDetails(6, 180, 12, 13, 14, 1);
+ _garage.setDetails(Rect(241, 85, 319, 121), 180, 30, 31, 32, 1, NULL);
+ _fence.setDetails(Rect(0, 109, 21, 125), 180, 9, 10, 11, 1, NULL);
+ _house.setDetails(5, 180, 24, 25, 26, 1);
+ _steps.setDetails(7, 180, 6, 7, 8, 1);
+ _curb.setDetails(2, 180, 3, 4, 5, 1);
+ _sky.setDetails(Rect(0, 0, 319, 190), 180, 0, 1, 2, 1, NULL);
+ }
+}
+
+void Scene180::signal() {
+ switch (_sceneMode) {
+ case 1:
+ _dispatchMode = 0;
+ switch (BF_GLOBALS._bookmark) {
+ case bFlashBackThree:
+ BF_GLOBALS._bookmark = bDroppedOffLyle;
+ _sceneMode = 7;
+ break;
+ case bDoneWithIsland:
+ BF_GLOBALS._bookmark = bDoneAtLyles;
+ _sceneMode = 8;
+ break;
+ default:
+ _sceneMode = 1802;
+ break;
+ }
+
+ setAction(&_sequenceManager, this, 1802, &_vechile, &_object1, NULL);
+ break;
+ case 2:
+ _dispatchMode = 0;
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS._sceneManager.changeScene(BF_GLOBALS._driveToScene);
+ break;
+ case 3:
+ _dispatchMode = 0;
+ BF_GLOBALS._sound1.stop();
+ _stripManager.start(1800, this);
+ _sceneMode = 4;
+ break;
+ case 4:
+ _sceneMode = 5;
+ BF_GLOBALS._sound1.fadeSound(29);
+ ADD_MOVER(_vechile, 340, 140);
+ _vechile._moveDiff.y = 1;
+ break;
+ case 5:
+ BF_GLOBALS._sceneManager.changeScene(50);
+ break;
+ case 6:
+ loadScene(1180);
+ BF_GLOBALS._sound1.fadeSound(33);
+
+ switch (BF_GLOBALS._bookmark) {
+ case bLyleStoppedBy:
+ BF_GLOBALS._dayNumber = 2;
+ BF_INVENTORY.alterInventory(2);
+ break;
+ case bDroppedOffLyle:
+ BF_GLOBALS._dayNumber = 4;
+ BF_INVENTORY.alterInventory(4);
+ break;
+ case bDoneAtLyles:
+ BF_GLOBALS._dayNumber = 5;
+ BF_INVENTORY.alterInventory(5);
+ break;
+ default:
+ break;
+ }
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.disableControl();
+
+ _vechile.postInit();
+ _vechile.setDetails(180, 33, 34, 35, 1, NULL);
+
+ _object1.postInit();
+ _sceneMode = 1801;
+ setAction(&_sequenceManager, this, 1801, &BF_GLOBALS._player, &_vechile, &_object1, NULL);
+
+ _frontDoor.setDetails(Rect(183, 92, 218, 122), 180, 27, 28, 29, 1, NULL);
+ _driveway.setDetails(8, 180, 36, 37, 38, 1);
+ _street.setDetails(1, 180, 21, 22, 23, 1);
+ _lawn.setDetails(3, 180, 18, 19, 20, 1);
+ _bushes.setDetails(4, 180, 15, 16, 17, 1);
+ _palms.setDetails(6, 180, 12, 13, 14, 1);
+ _garage.setDetails(Rect(241, 85, 319, 121), 180, 30, 31, 32, 1, NULL);
+ _fence.setDetails(Rect(0, 109, 21, 125), 180, 9, 10, 11, 1, NULL);
+ _house.setDetails(4, 180, 24, 25, 26, 1);
+ _steps.setDetails(7, 180, 6, 7, 8, 1);
+ _curb.setDetails(2, 180, 3, 4, 5, 1);
+ _sky.setDetails(Rect(0, 0, 319, 190), 180, 0, 1, 2, 1, NULL);
+ break;
+ case 7:
+ BF_INVENTORY.setObjectScene(INV_COBB_RAP, 0);
+ BF_INVENTORY.setObjectScene(INV_MUG_SHOT, 0);
+ BF_INVENTORY.setObjectScene(INV_FOREST_RAP, 0);
+ BF_INVENTORY.setObjectScene(INV_LYLE_CARD, 0);
+ BF_INVENTORY.setObjectScene(INV_NAPKIN, 0);
+ BF_INVENTORY.setObjectScene(INV_9MM_BULLETS, 0);
+ BF_INVENTORY.setObjectScene(INV_SCHEDULE, 0);
+ BF_INVENTORY.setObjectScene(INV_PRINT_OUT, 0);
+
+ BF_GLOBALS._sceneManager.changeScene(180);
+ break;
+ case 8:
+ if (BF_GLOBALS.getFlag(fLeftTraceIn900) || BF_GLOBALS.getFlag(fGotPointsForSearchingDA) ||
+ BF_GLOBALS.getFlag(fLeftTraceIn920)) {
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS._driveToScene = 0;
+ BF_GLOBALS._driveFromScene = 0;
+ BF_GLOBALS._sceneManager.changeScene(271);
+ } else {
+ BF_GLOBALS._sceneManager.changeScene(180);
+ }
+ break;
+ case 1800:
+ _dispatchMode = 2;
+ _vechile._moveDiff.x = 10;
+ _sceneMode = 2;
+ ADD_MOVER(_vechile, -25, 171);
+ break;
+ case 1801:
+ BF_GLOBALS._player._strip = 3;
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 1802:
+ BF_GLOBALS._sound1.release();
+ BF_GLOBALS._driveToScene = 0;
+ BF_GLOBALS._driveFromScene = 0;
+ BF_GLOBALS._sceneManager.changeScene(270);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene180::process(Event &event) {
+ SceneExt::process(event);
+
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (UI_INTERFACE_Y - 1))) {
+ if (_vechile.contains(event.mousePos)) {
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(cursorId);
+ } else if (_garageExit.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);
+ }
+ }
+}
+
+void Scene180::dispatch() {
+ switch (_dispatchMode) {
+ case 1:
+ if (_vechile._mover && (_vechile._percent > 50))
+ _vechile.changeZoom(_vechile._percent - 1);
+ if (_vechile._moveDiff.x > 15)
+ --_vechile._moveDiff.x;
+ break;
+ case 2:
+ if (_vechile._mover && (_vechile._percent < 100))
+ _vechile.changeZoom(_vechile._percent + 1);
+ if (_vechile._moveDiff.x < 35)
+ ++_vechile._moveDiff.x;
+ break;
+ case 3:
+ if (_vechile._mover && (_vechile._percent > 70))
+ _vechile.changeZoom(_vechile._percent - 1);
+ if (_vechile._moveDiff.x > 15)
+ --_vechile._moveDiff.x;
+ break;
+ default:
+ break;
+ }
+
+ SceneExt::dispatch();
+
+ if (!_action && (BF_GLOBALS._player._position.y < 120)) {
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS._driveToScene = 0;
+ BF_GLOBALS._driveFromScene = 0;
+
+ if (BF_GLOBALS.getFlag(fLeftTraceIn900) || BF_GLOBALS.getFlag(fGotPointsForSearchingDA) ||
+ BF_GLOBALS.getFlag(fLeftTraceIn920))
+ BF_GLOBALS._sceneManager.changeScene(271);
+ else
+ BF_GLOBALS._sceneManager.changeScene(270);
+ }
+}
+
+/*--------------------------------------------------------------------------
* Scene 190 - Front of Police Station
*
*--------------------------------------------------------------------------*/
-bool Scene190::Object4::startAction(CursorType action, Event &event) {
+bool Scene190::LyleCar::startAction(CursorType action, Event &event) {
Scene190 *scene = (Scene190 *)BF_GLOBALS._sceneManager._scene;
switch (action) {
@@ -505,14 +3191,14 @@ void Scene190::Action1::signal() {
}
case 2:
scene->_sound.play(82);
- scene->_object2.animate(ANIM_MODE_5, this);
+ scene->_door.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);
+ scene->_door.animate(ANIM_MODE_6, this);
break;
case 5:
BF_GLOBALS._sound1.fadeOut2(NULL);
@@ -534,12 +3220,17 @@ void Scene190::postInit(SceneObjectList *OwnerList) {
(BF_GLOBALS._sceneManager._previousScene == 20)) {
// clearScreen();
}
- if (BF_GLOBALS._dayNumber == 0)
+ if (BF_GLOBALS._dayNumber == 0) {
// If at start of game, change to first day
BF_GLOBALS._dayNumber = 1;
+ // To be checked: Not present in the original
+ g_globals->_sceneManager._previousScene = 100;
+ }
+ SceneExt::postInit();
// Load the scene data
loadScene(190);
+
BF_GLOBALS._scenePalette.loadPalette(2);
_stripManager.addSpeaker(&_speaker);
@@ -547,18 +3238,20 @@ void Scene190::postInit(SceneObjectList *OwnerList) {
BF_GLOBALS._player.disableControl();
// Initialise objects
- _object2.postInit();
- _object2.setVisage(190);
- _object2.setStrip(1);
- _object2.setPosition(Common::Point(179, 88));
+ _door.postInit();
+ _door.setVisage(190);
+ _door.setStrip(1);
+ _door.setPosition(Common::Point(179, 88));
+
+ _flag.postInit();
+ _flag.setVisage(190);
+ _flag.setStrip(2);
+ _flag.fixPriority(200);
+ _flag.setPosition(Common::Point(170, 31));
+ _flag.animate(ANIM_MODE_7, 0, NULL);
+ _flag.setDetails(190, 8, 26, 19, 1, NULL);
- _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);
+ _fieldB52 = true;
if (BF_GLOBALS.getFlag(fWithLyle)) {
BF_GLOBALS._player.setVisage(303);
@@ -566,11 +3259,11 @@ void Scene190::postInit(SceneObjectList *OwnerList) {
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);
+ _lyleCar.postInit();
+ _lyleCar.setVisage(444);
+ _lyleCar.setFrame(2);
+ _lyleCar.setPosition(Common::Point(54, 114));
+ _lyleCar.setDetails(190, -1, -1, -1, 1, NULL);
switch (BF_GLOBALS._sceneManager._previousScene) {
case 300: {
@@ -581,7 +3274,7 @@ void Scene190::postInit(SceneObjectList *OwnerList) {
}
case 315:
_sceneMode = 1901;
- setAction(&_sequenceManager, this, 1901, &BF_GLOBALS._player, &_object2, NULL);
+ setAction(&_sequenceManager, this, 1901, &BF_GLOBALS._player, &_door, NULL);
break;
case 50:
case 60:
@@ -615,13 +3308,15 @@ void Scene190::postInit(SceneObjectList *OwnerList) {
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);
+ setAction(&_sequenceManager, this, _sceneMode, &BF_GLOBALS._player, &_door, NULL);
break;
case 50:
case 60:
default:
BF_GLOBALS.setFlag(onBike);
BF_GLOBALS._player.disableControl();
+ // To be checked: Not present in the original
+ T2_GLOBALS._uiElements._active = true;
_sceneMode = BF_GLOBALS.getFlag(onDuty) ? 192 : 190;
setAction(&_sequenceManager, this, _sceneMode, &BF_GLOBALS._player, NULL);
break;
@@ -644,7 +3339,7 @@ void Scene190::postInit(SceneObjectList *OwnerList) {
_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);
+ _item10.setDetails(Rect(0, 0, SCREEN_WIDTH, UI_INTERFACE_Y), 190, 23, -1, -1, 1, NULL);
}
void Scene190::signal() {
@@ -680,7 +3375,7 @@ void Scene190::signal() {
void Scene190::process(Event &event) {
SceneExt::process(event);
- if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (UI_INTERFACE_Y - 1))) {
// Check if the cursor is on an exit
if (_exit.contains(event.mousePos)) {
GfxSurface surface = _cursorVisage.getFrame(3);
@@ -707,6 +3402,11 @@ void Scene190::dispatch() {
}
}
+void Scene190::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_scenes1.h b/engines/tsage/blue_force/blueforce_scenes1.h
index 3fd38e35ca..b304c2aeaa 100644
--- a/engines/tsage/blue_force/blueforce_scenes1.h
+++ b/engines/tsage/blue_force/blueforce_scenes1.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"
@@ -94,39 +95,344 @@ class Scene109: public PalettedScene {
virtual void signal();
};
- /* Texts */
- class Text: public SceneText {
+public:
+ SequenceManager _sequenceManager1, _sequenceManager2, _sequenceManager3;
+ SequenceManager _sequenceManager4, _sequenceManager5, _sequenceManager6;
+ SequenceManager _sequenceManager7, _sequenceManager8;
+ SceneObject _object1, _object2, _protaginist2, _protaginist1, _cop1;
+ SceneObject _drunk, _cop2, _bartender, _beerSign, _animationInset;
+ IntroSceneText _text;
+ Action1 _action1;
+ Action2 _action2;
+ Action3 _action3;
+public:
+ Scene109();
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+};
+
+class Scene110: 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();
+ virtual void dispatch();
+ };
+ class Action4: public Action {
+ public:
+ virtual void signal();
+ virtual void dispatch();
+ };
+ class Action5: public Action {
+ public:
+ virtual void signal();
+ };
+public:
+ NamedObject _object1, _object2, _object3, _object4, _object5, _object6, _object7, _object8, _object9, _object10;
+ ASound _sound;
+ Action1 _action1;
+ Action2 _action2;
+ Action3 _action3;
+ Action4 _action4;
+ Action5 _action5;
+public:
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+};
+
+class Scene114: public SceneExt {
+ /* Objects */
+ class Vechile: public NamedObject {
public:
- Action *_action;
- uint32 _frameNumber;
- int _diff;
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Door: public NamedObject {
public:
- Text();
- void setup(const Common::String &msg, Action *action);
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ SequenceManager _sequenceManager1;
+ Vechile _vechile;
+ Door _door;
+ NamedObject _lyle;
+ NamedHotspot _item1;
+public:
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+};
- virtual Common::String getClassName() { return "BF109Text"; }
+class Scene115: public SceneExt {
+ /* Objects */
+ class Kate: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Tony: public NamedObject {
+ public:
+ int _talkToTonyCtr2;
+ 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);
+ };
+
+ /* Custom class */
+ class EventHandler1: public EventHandler {
+ public:
+ virtual Common::String getClassName() { return "Scene115_EventHandler1"; }
+ virtual void dispatch();
+ };
+
+ /* Items */
+ class Jukebox: public NamedHotspot {
+ SequenceManager _sequenceManager6;
+ public:
+ int _jokeboxPlayingCtr;
+
+ Jukebox();
+ virtual bool startAction(CursorType action, Event &event);
+ virtual void signal();
virtual void synchronize(Serializer &s);
+ };
+ class Item10: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item14: 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();
+ };
+ 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();
+ };
+ class Action9: public Action {
+ public:
+ virtual void signal();
+ };
+
+ SequenceManager _sequenceManager1;
+ SequenceManager _sequenceManager2;
+ SequenceManager _sequenceManager3;
+ SequenceManager _sequenceManager4;
+ SequenceManager _sequenceManager5;
+ Kate _kate;
+ Tony _tony;
+ Object3 _object3;
+ Object4 _object4;
+ SceneObject _object5, _object6, _neonSign, _object8, _object9;
+ SceneObject _object10, _object11, _object12, _object13;
+ Jukebox _itemJukebox;
+ EventHandler1 _eventHandler1;
+ NamedHotspot _item2, _item3, _item4, _item5, _item6, _item7, _item8, _item9;
+ Item10 _item10;
+ NamedHotspot _item11, _item12, _item13;
+ Item14 _item14;
+ Action1 _action1;
+ Action2 _action2;
+ Action3 _action3;
+ Action4 _action4;
+ Action5 _action5;
+ Action6 _action6;
+ Action7 _action7;
+ Action8 _action8;
+ Action9 _action9;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerKate _kateSpeaker;
+ SpeakerTony _tonySpeaker;
+ SpeakerJakeJacket _jakeJacketSpeaker;
+ SpeakerJakeUniform _jakeUniformSpeaker;
+ SpeakerLyleHat _lyleHatSpeaker;
+ ASound _sound1;
+ int _lineNumModifier;
+ int _jukeboxPlaying;
+ int _talkToTonyCtr;
+public:
+ Scene115();
+ virtual void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void process(Event &event);
+};
+
+class Scene125: public SceneExt {
+ class Action1: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action2: public Action {
+ public:
+ virtual void signal();
+ virtual void dispatch();
+ };
+ class Action3: public Action {
+ public:
+ virtual void signal();
+ virtual void dispatch();
+ };
+ class Action4: public Action {
+ public:
+ virtual void signal();
+ virtual void dispatch();
+ };
+ class Action5: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action6: public Action {
+ public:
+ virtual void signal();
virtual void dispatch();
};
+
public:
- SequenceManager _sequenceManager1, _sequenceManager2, _sequenceManager3;
- SequenceManager _sequenceManager4, _sequenceManager5, _sequenceManager6;
- SequenceManager _sequenceManager7, _sequenceManager8;
- SceneObject _object1, _object2, _protaginist2, _protaginist1, _object5;
- SceneObject _drunk, _object7, _bartender, _object9, _object10;
- Text _text;
Action1 _action1;
- Action _action2, _action3;
+ Action2 _action2;
+ Action3 _action3;
+ Action4 _action4;
+ Action5 _action5;
+ Action6 _action6;
+ NamedObject _object1, _object2, _object3, _object4, _object5;
+ NamedObject _object6, _object7, _object8, _object9;
+ ASoundExt _soundExt1;
+ ASoundExt _soundExt2;
+
+ void postInit(SceneObjectList *OwnerList);
+};
+
+class Scene140: public SceneExt {
+ class Action1: public Action {
+ public:
+ virtual void signal();
+ };
public:
- Scene109();
+ Action1 _action1;
+ ASoundExt _soundExt1;
+ NamedObject _object1;
+ NamedObject _object2;
+ IntroSceneText _text;
+
+ void postInit(SceneObjectList *OwnerList);
+};
+
+class Scene150: public SceneExt {
+ class Action1: public Action {
+ NamedObject _object2;
+ ASound _sound1;
+ public:
+ virtual void signal();
+ };
+public:
+ NamedObject _object1;
+ Action1 _action1;
+ void postInit(SceneObjectList *OwnerList);
+};
+
+class Scene160: public SceneExt {
+ class Action1: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action2: public Action {
+ public:
+ virtual void signal();
+ virtual void process(Event &event);
+ };
+ class Action3: public ActionExt {
+ public:
+ virtual void signal();
+ };
+public:
+ NamedObject _flag, _kid, _kidBody, _leftOfficer, _grandma, _rightOfficer;
+ ASound _sound1;
+ Action1 _action1;
+ Action2 _action2;
+ Action3 _action3;
+ IntroSceneText _text;
+
+ void postInit(SceneObjectList *OwnerList);
+};
+
+class Scene180: public SceneExt {
+ /* Objects */
+ class Vechile: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Items */
+ class GarageExit: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ SequenceManager _sequenceManager;
+ SpeakerGameText _gameTextSpeaker;
+ NamedObject _object1;
+ Vechile _vechile;
+ NamedHotspot _driveway, _garage, _frontDoor, _house, _street;
+ NamedHotspot _lawn, _bushes, _palms, _fence, _steps;
+ NamedHotspot _curb, _sky;
+ GarageExit _garageExit;
+ ASoundExt _sound1;
+ SceneMessage _sceneMessage;
+ int _dispatchMode;
+
+ Scene180();
+ virtual void synchronize(Serializer &s);
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
};
class Scene190: public SceneExt {
/* Objects */
- class Object4: public NamedObject {
+ class LyleCar: public NamedObject {
public:
virtual bool startAction(CursorType action, Event &event);
};
@@ -153,8 +459,8 @@ class Scene190: public SceneExt {
public:
SequenceManager _sequenceManager;
FollowerObject _object1;
- NamedObject _object2, _object3;
- Object4 _object4;
+ NamedObject _door, _flag;
+ LyleCar _lyleCar;
Item1 _item1;
Item2 _item2;
NamedHotspot _item3, _item4, _item5, _item6;
@@ -170,10 +476,7 @@ public:
virtual void signal();
virtual void process(Event &event);
virtual void dispatch();
- virtual void synchronize(Serializer &s) {
- SceneExt::synchronize(s);
- s.syncAsSint16LE(_fieldB52);
- }
+ virtual void synchronize(Serializer &s);
};
} // End of namespace BlueForce
diff --git a/engines/tsage/blue_force/blueforce_scenes2.cpp b/engines/tsage/blue_force/blueforce_scenes2.cpp
index 7d66c7a52b..5a181af927 100644
--- a/engines/tsage/blue_force/blueforce_scenes2.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes2.cpp
@@ -86,12 +86,14 @@ void Scene200::Action2::signal() {
switch (_actionIndex++) {
case 1:
- owner->setPosition(owner->_position);
+ owner->setPosition(owner->_position, 0);
owner->animate(ANIM_MODE_5, this);
break;
case 2:
- owner->setPosition(owner->_position);
+ owner->setPosition(owner->_position, 1000);
owner->setFrame(1);
+ _actionIndex = 0;
+ setDelay(1);
break;
default:
break;
@@ -184,6 +186,12 @@ void Scene210::Action1::signal() {
void Scene210::postInit(SceneObjectList *OwnerList) {
SceneExt::postInit();
loadScene(210);
+
+// FIXME: This fixes an obvious glitch during scene transition.
+// Shouldn't it be included in the 2 previous functions?
+ clearScreen();
+//
+
BF_GLOBALS._scenePalette.loadPalette(235);
BF_GLOBALS._scenePalette.refresh();
@@ -349,6 +357,11 @@ void Scene220::postInit(SceneObjectList *OwnerList) {
SceneExt::postInit();
loadScene(220);
+// FIXME: This fixes an obvious glitch during scene transition.
+// Shouldn't it be included in the 2 previous functions?
+ clearScreen();
+//
+
_object2.postInit();
_object2.setVisage(220);
_object2.setPosition(Common::Point(182, 122));
@@ -708,7 +721,7 @@ void Scene225::remove() {
}
/*--------------------------------------------------------------------------
- * Scene 265 - Graduation Article
+ * Scene 265 - Intro - Graduation Article
*
*--------------------------------------------------------------------------*/
@@ -754,7 +767,7 @@ void Scene265::postInit(SceneObjectList *OwnerList) {
void Scene265::remove() {
clearScreen();
- remove();
+ SceneExt::remove();
}
/*--------------------------------------------------------------------------
@@ -857,7 +870,7 @@ bool Scene270::Item::startAction(CursorType action, Event &event) {
scene->_object2.postInit();
scene->_object2.hide();
scene->_sceneMode = 2705;
- scene->setAction(&scene->_sequenceManager1, this, 2705, &BF_GLOBALS._player, &scene->_object2, NULL);
+ scene->setAction(&scene->_sequenceManager1, scene, 2705, &BF_GLOBALS._player, &scene->_object2, NULL);
return true;
} else {
return NamedHotspot::startAction(action, event);
@@ -924,9 +937,9 @@ void Scene270::postInit(SceneObjectList *OwnerList) {
(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);
+ BF_GLOBALS._walkRegions.disableRegion(6);
+ BF_GLOBALS._walkRegions.disableRegion(14);
+ BF_GLOBALS._walkRegions.disableRegion(19);
_grandma.postInit();
_grandma.setVisage(274);
@@ -1091,7 +1104,7 @@ void Scene270::signal() {
SceneItem::display2(270, 37);
BF_GLOBALS._player.enableControl();
} else {
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
BF_GLOBALS.setFlag(shownLyleCrate1Day1);
_sceneMode = 12;
ADD_PLAYER_MOVER(192, 135);
@@ -1129,9 +1142,9 @@ void Scene270::signal() {
&_lyle, &_grandma, NULL);
break;
case 2718:
- BF_GLOBALS._walkRegions.proc1(6);
- BF_GLOBALS._walkRegions.proc1(14);
- BF_GLOBALS._walkRegions.proc1(19);
+ BF_GLOBALS._walkRegions.disableRegion(6);
+ BF_GLOBALS._walkRegions.disableRegion(14);
+ BF_GLOBALS._walkRegions.disableRegion(19);
_field219A = 1;
BF_GLOBALS._bookmark = bTalkedToGrannyAboutSkipsCard;
@@ -1139,7 +1152,7 @@ void Scene270::signal() {
_grandma.setStrip(8);
_grandma._frame = 5;
_field384 = 1;
- _field384 = 1;
+ _field386 = 1;
BF_GLOBALS._player._moveDiff.x = 8;
BF_GLOBALS._player.enableControl();
@@ -1169,7 +1182,7 @@ void Scene270::process(Event &event) {
SceneExt::process(event);
- if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1)) &&
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (UI_INTERFACE_Y - 1)) &&
!_field384 && !_field386) {
// Check if the cursor is on an exit
if (_exit.contains(event.mousePos)) {
@@ -1277,7 +1290,7 @@ void Scene270::dispatch() {
void Scene271::Action1::signal() {
Scene271 *scene = (Scene271 *)BF_GLOBALS._sceneManager._scene;
- scene->setAction(&scene->_sequenceManager2, this, 2703, &scene->_tv, NULL);
+ setAction(&scene->_sequenceManager2, this, 2703, &scene->_tv, NULL);
}
/*--------------------------------------------------------------------------*/
@@ -1419,7 +1432,7 @@ void Scene271::postInit(SceneObjectList *OwnerList) {
_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);
+ _item11.setDetails(Rect(0, 0, SCREEN_WIDTH, UI_INTERFACE_Y), 270, 0, 1, 2, 1, NULL);
BF_GLOBALS._player.postInit();
BF_GLOBALS._player._moveDiff.x = 8;
@@ -1437,11 +1450,11 @@ void Scene271::postInit(SceneObjectList *OwnerList) {
switch (BF_GLOBALS._sceneManager._previousScene) {
case 180:
- BF_GLOBALS._walkRegions.proc1(6);
- BF_GLOBALS._walkRegions.proc1(14);
- BF_GLOBALS._walkRegions.proc1(19);
+ BF_GLOBALS._walkRegions.disableRegion(6);
+ BF_GLOBALS._walkRegions.disableRegion(14);
+ BF_GLOBALS._walkRegions.disableRegion(19);
- BF_GLOBALS._player.setVisage(151);
+ BF_GLOBALS._player.setVisage(275);
BF_GLOBALS._player.setPosition(Common::Point(348, 151));
_object12.postInit();
@@ -1468,9 +1481,9 @@ void Scene271::postInit(SceneObjectList *OwnerList) {
_object6.postInit();
_object6.hide();
- BF_GLOBALS._walkRegions.proc1(6);
- BF_GLOBALS._walkRegions.proc1(14);
- BF_GLOBALS._walkRegions.proc1(19);
+ BF_GLOBALS._walkRegions.disableRegion(6);
+ BF_GLOBALS._walkRegions.disableRegion(14);
+ BF_GLOBALS._walkRegions.disableRegion(19);
_object12.postInit();
_object12.setVisage(274);
@@ -1496,9 +1509,9 @@ void Scene271::postInit(SceneObjectList *OwnerList) {
_object7.setStrip(7);
_object7.setPosition(Common::Point(48, 149));
- BF_GLOBALS._walkRegions.proc1(6);
- BF_GLOBALS._walkRegions.proc1(14);
- BF_GLOBALS._walkRegions.proc1(19);
+ BF_GLOBALS._walkRegions.disableRegion(6);
+ BF_GLOBALS._walkRegions.disableRegion(14);
+ BF_GLOBALS._walkRegions.disableRegion(19);
_object12.postInit();
_object12.setVisage(276);
@@ -1530,9 +1543,9 @@ void Scene271::postInit(SceneObjectList *OwnerList) {
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);
+ BF_GLOBALS._walkRegions.disableRegion(6);
+ BF_GLOBALS._walkRegions.disableRegion(14);
+ BF_GLOBALS._walkRegions.disableRegion(19);
_object12.postInit();
_object12.setVisage(274);
@@ -1577,7 +1590,8 @@ void Scene271::signal() {
break;
case 590:
_sceneMode = 2704;
- setAction(&_sequenceManager1, this, 2707, &BF_GLOBALS._player, &_object12, &_object7, &_object8, NULL);
+ setAction(&_sequenceManager1, this, 2704, &BF_GLOBALS._player, &_object12, &_object7, &_object8, NULL);
+ break;
default:
_object11.postInit();
_object11.setPosition(Common::Point(340, 100));
@@ -1617,7 +1631,7 @@ void Scene271::signal() {
_object1.remove();
_field796 = 0;
- ADD_PLAYER_MOVER(_tempPos.x, _tempPos.y);
+ ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, _tempPos.x, _tempPos.y);
break;
case 2707:
BF_GLOBALS._player.enableControl();
@@ -1653,6 +1667,8 @@ void Scene271::signal() {
_sceneMode = 13;
addFader((const byte *)&black, 2, this);
break;
+ default:
+ break;
}
}
@@ -1669,7 +1685,7 @@ void Scene271::process(Event &event) {
SceneExt::process(event);
- if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < BF_INTERFACE_Y)) {
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < UI_INTERFACE_Y)) {
if (_exit.contains(event.mousePos)) {
GfxSurface cursor = _cursorVisage.getFrame(EXITFRAME_E);
BF_GLOBALS._events.setCursor(cursor);
@@ -1715,6 +1731,123 @@ void Scene271::dispatch() {
SceneExt::dispatch();
}
+/*--------------------------------------------------------------------------
+ * Scene 280 - Bedroom Flashback cut-scene
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene280::Action1::signal() {
+ Scene280 *scene = (Scene280 *)BF_GLOBALS._sceneManager._scene;
+ static uint32 black = 0;
+
+ switch (_actionIndex++) {
+ case 0:
+ scene->_jake.postInit();
+ scene->_jake.setVisage(283);
+ scene->_jake.setPosition(Common::Point(331, 200));
+ scene->_jake.animate(ANIM_MODE_1, NULL);
+ scene->_jake.setStrip(1);
+ ADD_MOVER(scene->_jake, 189, 131);
+ break;
+ case 1:
+ scene->_jake.setStrip(2);
+ scene->_jake.setFrame(1);
+ scene->_jake.animate(ANIM_MODE_8, NULL);
+ scene->_jake._numFrames = 5;
+
+ scene->_stripManager.start(2800, this);
+ break;
+ case 2:
+ scene->_jake.animate(ANIM_MODE_5, NULL);
+ scene->_dad.animate(ANIM_MODE_5, this);
+ break;
+ case 3:
+ scene->_jake.setStrip(4);
+ scene->_jake.setFrame(1);
+ scene->_dad.setStrip(2);
+ scene->_jake.setFrame(1);
+ scene->_dad.animate(ANIM_MODE_5, this);
+ break;
+ case 4:
+ scene->_dad.setStrip(3);
+ scene->_dad.setFrame(1);
+ scene->_dad.animate(ANIM_MODE_5, this);
+ break;
+ case 5:
+ scene->_object4.hide();
+ scene->_dad.setVisage(282);
+ scene->_dad.setStrip(1);
+ scene->_dad.setFrame(1);
+ scene->_dad._numFrames = 5;
+ scene->_dad.animate(ANIM_MODE_5, this);
+ break;
+ case 6:
+ scene->_stripManager.start(2801, this);
+ break;
+ case 7:
+ scene->_mum.postInit();
+ scene->_mum.setVisage(282);
+ scene->_mum.setStrip(2);
+ scene->_mum.setFrame(1);
+ scene->_mum.fixPriority(1);
+ scene->_mum.setPosition(Common::Point(160, 138));
+
+ scene->_jake.setStrip(3);
+ scene->_jake.setFrame(1);
+ scene->_jake.animate(ANIM_MODE_5, this);
+
+ scene->_dad._numFrames = 10;
+ scene->_dad.setVisage(284);
+ scene->_dad.setStrip(1);
+ scene->_dad.fixPriority(-1);
+ scene->_dad.setPosition(Common::Point(174, 136));
+ scene->_dad.setFrame(1);
+ scene->_dad.animate(ANIM_MODE_1, NULL);
+ ADD_MOVER(scene->_dad, 438, 320);
+ break;
+ case 8:
+ scene->_mum.animate(ANIM_MODE_4, 5, 1, this);
+ break;
+ case 9:
+ scene->_sceneMode = 2;
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ scene->addFader((const byte *)&black, 2, scene);
+
+ scene->_jake.remove();
+ scene->_mum.animate(ANIM_MODE_5, NULL);
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene280::postInit(SceneObjectList *OwnerList) {
+ PalettedScene::postInit();
+ BF_GLOBALS._interfaceY = SCREEN_HEIGHT;
+ loadScene(280);
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+
+ _dad.postInit();
+ _dad.setVisage(281);
+ _dad.setPosition(Common::Point(160, 138));
+ _dad.fixPriority(1);
+
+ _object4.postInit();
+ _object4.setVisage(280);
+ _object4.setPosition(Common::Point(139, 141));
+
+ const uint32 black = 0;
+ add2Faders((const byte *)&black, 2, 280, this);
+ _sceneMode = 1;
+ setAction(&_action1);
+}
+
+void Scene280::signal() {
+ if (_sceneMode == 2)
+ BF_GLOBALS._sceneManager.changeScene(271);
+}
+
} // 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
index 2ec939be19..17e749d7a1 100644
--- a/engines/tsage/blue_force/blueforce_scenes2.h
+++ b/engines/tsage/blue_force/blueforce_scenes2.h
@@ -276,6 +276,20 @@ public:
virtual void dispatch();
};
+class Scene280: public PalettedScene {
+ /* Actions */
+ class Action1: public ActionExt {
+ public:
+ virtual void signal();
+ };
+public:
+ Action1 _action1;
+ SpeakerGameText _gameTextSpeaker;
+ NamedObject _jake, _dad, _mum, _object4;
+
+ void postInit(SceneObjectList *OwnerList);
+ virtual void signal();
+};
} // End of namespace BlueForce
diff --git a/engines/tsage/blue_force/blueforce_scenes3.cpp b/engines/tsage/blue_force/blueforce_scenes3.cpp
index 6edd6d1aaa..a63f45d8df 100644
--- a/engines/tsage/blue_force/blueforce_scenes3.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes3.cpp
@@ -58,7 +58,7 @@ bool Scene300::Object19::startAction(CursorType action, Event &event) {
return true;
}
-
+// entrance door
bool Scene300::Item1::startAction(CursorType action, Event &event) {
if (action == CURSOR_USE) {
Scene300 *scene = (Scene300 *)BF_GLOBALS._sceneManager._scene;
@@ -75,6 +75,8 @@ bool Scene300::Item1::startAction(CursorType action, Event &event) {
bool Scene300::Item2::startAction(CursorType action, Event &event) {
if ((action == CURSOR_LOOK) || (action == CURSOR_USE)) {
Scene300 *scene = (Scene300 *)BF_GLOBALS._sceneManager._scene;
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 0;
scene->setAction(&scene->_sequenceManager1, scene, 304, &scene->_object11, NULL);
return true;
} else {
@@ -108,7 +110,7 @@ void Scene300::Action1::signal() {
setDelay(1);
break;
case 2: {
- ADD_PLAYER_MOVER_THIS(BF_GLOBALS._player, BF_GLOBALS._player._position.x - 8,
+ ADD_MOVER(BF_GLOBALS._player, BF_GLOBALS._player._position.x - 8,
BF_GLOBALS._player._position.y);
break;
}
@@ -183,12 +185,13 @@ void Scene300::Action4::signal() {
break;
case 2:
BF_GLOBALS._sceneManager.changeScene(60);
+ setDelay(15);
break;
case 3:
setAction(&scene->_sequenceManager1, this, 319, &scene->_object19, NULL);
break;
case 4:
- BF_GLOBALS.setFlag(2);
+ BF_GLOBALS.setFlag(onBike);
BF_GLOBALS._sceneManager.changeScene(190);
break;
default:
@@ -213,6 +216,7 @@ void Scene300::Action5::signal() {
break;
case 3: {
ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, 186, 140);
+ setDelay(3);
break;
}
case 4:
@@ -302,14 +306,14 @@ void Scene300::postInit(SceneObjectList *OwnerList) {
break;
case 190:
_sceneMode = 0;
- if (!BF_GLOBALS.getFlag(2)) {
+ if (!BF_GLOBALS.getFlag(onBike)) {
_sceneMode = 7308;
BF_GLOBALS._player.setPosition(Common::Point(175, 50));
ADD_PLAYER_MOVER_THIS(BF_GLOBALS._player, 123, 71);
if ((BF_GLOBALS._dayNumber == 2) && (BF_GLOBALS._bookmark < bEndDayOne))
- setup();
- } else if (!BF_GLOBALS.getFlag(3)) {
+ setupInspection();
+ } else if (!BF_GLOBALS.getFlag(onDuty)) {
BF_GLOBALS._player.disableControl();
_sceneMode = 300;
setAction(&_sequenceManager1, this, 300, &BF_GLOBALS._player, NULL);
@@ -328,7 +332,7 @@ void Scene300::postInit(SceneObjectList *OwnerList) {
setAction(&_sequenceManager1, this, 306, &BF_GLOBALS._player, &_object8, NULL);
} else {
BF_GLOBALS._player.setVisage(1304);
- setup();
+ setupInspection();
BF_GLOBALS._player.disableControl();
_sceneMode = 0;
setAction(&_sequenceManager1, this, 306, &BF_GLOBALS._player, &_object8, NULL);
@@ -348,13 +352,13 @@ void Scene300::postInit(SceneObjectList *OwnerList) {
_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);
+ _item4.setDetails(Rect(0, 85, SCREEN_WIDTH - 1, UI_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);
+ _item9.setDetails(Rect(0, 0, SCREEN_WIDTH, UI_INTERFACE_Y), 300, 29, 30, 31, 1, NULL);
}
void Scene300::signal() {
@@ -420,7 +424,7 @@ void Scene300::signal() {
setAction(&_sequenceManager1, this, 312, &_object1, &_object16, NULL);
break;
case 317:
- BF_GLOBALS.setFlag(2);
+ BF_GLOBALS.setFlag(onBike);
BF_GLOBALS._sceneManager.changeScene(60);
break;
case 318:
@@ -474,10 +478,10 @@ void Scene300::signal() {
_object10.postInit();
_object10.hide();
- if (BF_GLOBALS.getFlag(1)) {
+ if (BF_GLOBALS.getFlag(gunClean)) {
BF_GLOBALS._player.disableControl();
_sceneMode = 4308;
- setAction(&_sequenceManager1, this, 6307, &_object2, &_object1, &_object9, &_object10, NULL);
+ setAction(&_sequenceManager1, this, 6307, &_object12, &_object1, &_object9, &_object10, NULL);
} else {
BF_GLOBALS._player.disableControl();
_sceneMode = 4308;
@@ -523,7 +527,7 @@ void Scene300::signal() {
void Scene300::process(Event &event) {
SceneExt::process(event);
- if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (UI_INTERFACE_Y - 1))) {
// Check if the cursor is on an exit
if (_item14.contains(event.mousePos)) {
GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_NE);
@@ -552,7 +556,7 @@ void Scene300::dispatch() {
if ((BF_GLOBALS._player._position.y < 59) && (BF_GLOBALS._player._position.x > 137) &&
(_sceneMode != 6308) && (_sceneMode != 7308)) {
- BF_GLOBALS._v4CEA4 = 3;
+ // The original was setting a useless global variable (removed)
_sceneMode = 6308;
BF_GLOBALS._player.disableControl();
ADD_MOVER(BF_GLOBALS._player, BF_GLOBALS._player._position.x + 20,
@@ -563,7 +567,7 @@ void Scene300::dispatch() {
setAction(&_action2);
if (BF_GLOBALS._player._position.x >= 315) {
- if (BF_GLOBALS.getFlag(onDuty) || (BF_GLOBALS._bookmark == bNone) || !BF_GLOBALS.getFlag(fWithLyle)) {
+ if (BF_GLOBALS.getFlag(onDuty) || (BF_GLOBALS._bookmark == bNone) || BF_GLOBALS.getFlag(fWithLyle)) {
setAction(&_action1);
} else {
BF_GLOBALS._player.disableControl();
@@ -574,7 +578,7 @@ void Scene300::dispatch() {
}
}
-void Scene300::setup() {
+void Scene300::setupInspection() {
_object13.postInit();
_object13.setVisage(307);
_object13.setStrip(6);
@@ -618,7 +622,7 @@ void Scene300::setup() {
_object1._moveDiff = Common::Point(3, 1);
_object1.setObjectWrapper(new SceneObjectWrapper());
_object1.animate(ANIM_MODE_1, NULL);
- _object2.setup(&_object1, 306, 4, 9);
+ _object2.setup(&_object1, 306, 4, 29);
BF_GLOBALS._sceneItems.addItems(&_object13, &_object14, &_object15, &_object16, NULL);
_timer.set(3600, this, &_action5);
@@ -638,7 +642,7 @@ bool Scene315::Barry::startAction(CursorType action, Event &event) {
switch (action) {
case CURSOR_USE:
- if (scene->_field1B60 || scene->_field1B64)
+ if (scene->_invGreenCount || scene->_invGangCount)
SceneItem::display2(320, 51);
else
NamedHotspot::startAction(action, event);
@@ -667,7 +671,7 @@ bool Scene315::Barry::startAction(CursorType action, Event &event) {
scene->_stripNumber = 3174;
scene->setAction(&scene->_action1);
} else {
- ++scene->_field1B62;
+ ++scene->_bookGreenCount;
scene->_stripNumber = (action == INV_GREENS_GUN) ? 3168 : 0;
scene->_sceneMode = 3153;
scene->setAction(&scene->_sequenceManager, scene, 3153, &BF_GLOBALS._player, NULL);
@@ -675,7 +679,7 @@ bool Scene315::Barry::startAction(CursorType action, Event &event) {
break;
case INV_FOREST_RAP:
BF_GLOBALS._player.disableControl();
- scene->_stripNumber = BF_GLOBALS.getFlag(onDuty) ? 3178 : 3173;
+ scene->_stripNumber = BF_GLOBALS.getFlag(onDuty) ? 3173 : 3178;
scene->setAction(&scene->_action1);
break;
case INV_GREEN_ID:
@@ -693,7 +697,7 @@ bool Scene315::Barry::startAction(CursorType action, Event &event) {
scene->setAction(&scene->_action1);
break;
case INV_COBB_RAP:
- if (BF_INVENTORY._mugshot._sceneNumber == 1)
+ if (BF_INVENTORY.getObjectScene(INV_MUG_SHOT) == 1)
NamedHotspot::startAction(action, event);
else {
BF_GLOBALS._player.disableControl();
@@ -717,7 +721,8 @@ bool Scene315::Barry::startAction(CursorType action, Event &event) {
scene->_stripNumber = 3174;
scene->setAction(&scene->_action1);
} else {
- if (!scene->_field1B6C & (scene->_field1B66 == 1)) {
+ ++scene->_bookGangCount;
+ if (!scene->_field1B6C && (scene->_bookGangCount == 1)) {
scene->_field1B6C = 1;
scene->_stripNumber = 3169;
} else {
@@ -737,6 +742,7 @@ bool Scene315::Barry::startAction(CursorType action, Event &event) {
bool Scene315::SutterSlot::startAction(CursorType action, Event &event) {
Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene;
+ scene->_currentCursor = action;
switch (action) {
case INV_GREENS_GUN:
@@ -757,9 +763,9 @@ bool Scene315::SutterSlot::startAction(CursorType action, Event &event) {
case INV_BOOKING_FRANKIE:
case INV_BOOKING_GANG:
if (action == INV_BOOKING_GREEN)
- ++scene->_field1B62;
+ ++scene->_bookGreenCount;
else
- ++scene->_field1B66;
+ ++scene->_bookGangCount;
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 12;
@@ -860,7 +866,7 @@ bool Scene315::BulletinMemo::startAction(CursorType action, Event &event) {
return true;
case CURSOR_USE:
if (!BF_GLOBALS.getFlag(fGotPointsForCleaningGun)) {
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
BF_GLOBALS.setFlag(fGotPointsForCleaningGun);
}
BF_GLOBALS._player.addMover(NULL);
@@ -872,6 +878,7 @@ bool Scene315::BulletinMemo::startAction(CursorType action, Event &event) {
}
}
+// Own Mail Slot
bool Scene315::Object2::startAction(CursorType action, Event &event) {
Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene;
@@ -904,7 +911,7 @@ bool Scene315::ATFMemo::startAction(CursorType action, Event &event) {
return true;
case CURSOR_USE:
if (!BF_GLOBALS.getFlag(fGotPointsForMemo)) {
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
BF_GLOBALS.setFlag(fGotPointsForMemo);
}
@@ -935,8 +942,12 @@ void Scene315::Action1::signal() {
break;
case 3:
if (scene->_sceneMode == 3169) {
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
BF_INVENTORY.setObjectScene(INV_MUG_SHOT, 1);
+ //HACK: This has to be checked wether or not it occurs in the original.
+ //When the _sceneMode is set to 3169, the value desn't change.
+ //If you show the forest rapsheet, it gives points (and again... and again...)
+ scene->_sceneMode = 3154;
}
remove();
@@ -955,9 +966,9 @@ Scene315::Scene315() {
BF_GLOBALS.clearFlag(fCanDrawGun);
_field1B68 = true;
- _field1B6A = false;
- _field1B60 = _field1B62 = 0;
- _field1B64 = _field1B66 = 0;
+ _doorOpened = false;
+ _invGreenCount = _bookGreenCount = 0;
+ _invGangCount = _bookGangCount = 0;
}
void Scene315::synchronize(Serializer &s) {
@@ -966,18 +977,19 @@ void Scene315::synchronize(Serializer &s) {
s.syncAsSint16LE(_field1390);
s.syncAsSint16LE(_stripNumber);
s.syncAsSint16LE(_field1398);
- s.syncAsSint16LE(_field1B60);
- s.syncAsSint16LE(_field1B62);
- s.syncAsSint16LE(_field1B64);
- s.syncAsSint16LE(_field1B66);
+ s.syncAsSint16LE(_invGreenCount);
+ s.syncAsSint16LE(_bookGreenCount);
+ s.syncAsSint16LE(_invGangCount);
+ s.syncAsSint16LE(_bookGangCount);
s.syncAsSint16LE(_field1B6C);
s.syncAsSint16LE(_field139C);
s.syncAsByte(_field1B68);
- s.syncAsByte(_field1B6A);
+ s.syncAsByte(_doorOpened);
s.syncAsSint16LE(_currentCursor);
}
void Scene315::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit(OwnerList);
loadScene(315);
if (BF_GLOBALS._sceneManager._previousScene != 325)
@@ -1059,34 +1071,34 @@ void Scene315::postInit(SceneObjectList *OwnerList) {
// Set up evidence objects in inventory
if (BF_INVENTORY._bookingGreen.inInventory())
- ++_field1B60;
+ ++_invGreenCount;
if (BF_INVENTORY._greensGun.inInventory())
- ++_field1B60;
+ ++_invGreenCount;
if (BF_INVENTORY._greensKnife.inInventory())
- ++_field1B60;
+ ++_invGreenCount;
if (BF_INVENTORY._bullet22.inInventory())
- ++_field1B64;
+ ++_invGangCount;
if (BF_INVENTORY._autoRifle.inInventory())
- ++_field1B64;
+ ++_invGangCount;
if (BF_INVENTORY._wig.inInventory())
- ++_field1B64;
+ ++_invGangCount;
if (BF_INVENTORY._bookingFrankie.inInventory())
- ++_field1B64;
+ ++_invGangCount;
if (BF_INVENTORY._bookingGang.inInventory())
- ++_field1B64;
+ ++_invGangCount;
if (BF_INVENTORY._snub22.inInventory())
- ++_field1B64;
+ ++_invGangCount;
switch (BF_GLOBALS._sceneManager._previousScene) {
case 190:
if (_field1398)
- _field1B6A = true;
+ _doorOpened = true;
_sceneMode = BF_GLOBALS.getFlag(onDuty) ? 3150 : 3165;
setAction(&_sequenceManager, this, _sceneMode, &BF_GLOBALS._player, NULL);
break;
case 325:
- BF_GLOBALS._uiElements._active = false;
+ T2_GLOBALS._uiElements._active = false;
_object6.postInit();
_object7.postInit();
_object8.setFrame(8);
@@ -1097,7 +1109,7 @@ void Scene315::postInit(SceneObjectList *OwnerList) {
case 300:
default:
if (_field1398)
- _field1B6A = true;
+ _doorOpened = true;
if (!BF_GLOBALS.getFlag(onDuty))
_sceneMode = 3166;
else if (!_field1398)
@@ -1109,10 +1121,10 @@ void Scene315::postInit(SceneObjectList *OwnerList) {
break;
}
- if (_field1B6A) {
+ if (_doorOpened) {
_object8.setFrame(8);
} else {
- BF_GLOBALS._walkRegions.proc1(4);
+ BF_GLOBALS._walkRegions.disableRegion(4);
}
_briefingMaterial.setDetails(24, 315, 38, 39, 40, 1);
@@ -1133,15 +1145,15 @@ void Scene315::signal() {
BF_GLOBALS._player.enableControl();
break;
case 10:
- if (_field1B62) {
- if (_field1B62 >= _field1B60)
+ if (_bookGreenCount) {
+ if (_bookGreenCount >= _invGreenCount)
BF_GLOBALS.setFlag(fLeftTraceIn910);
else
++ctr;
}
- if (_field1B66) {
- if (_field1B66 < _field1B64)
+ if (_bookGangCount) {
+ if (_bookGangCount < _invGangCount)
++ctr;
else if (BF_GLOBALS._bookmark < bBookedFrankieEvidence)
BF_GLOBALS._bookmark = bBookedFrankieEvidence;
@@ -1156,15 +1168,15 @@ void Scene315::signal() {
BF_GLOBALS._sound1.fadeOut2(NULL);
break;
case 11:
- if (_field1B62) {
- if (_field1B62 >= _field1B60)
+ if (_bookGreenCount) {
+ if (_bookGreenCount >= _invGreenCount)
BF_GLOBALS.setFlag(fLeftTraceIn910);
else
++ctr;
}
- if (_field1B66) {
- if (_field1B66 < _field1B64)
+ if (_bookGangCount) {
+ if (_bookGangCount < _invGangCount)
++ctr;
else if (BF_GLOBALS._bookmark < bBookedFrankie)
BF_GLOBALS._bookmark = bBookedFrankie;
@@ -1175,6 +1187,7 @@ void Scene315::signal() {
if (ctr == 1) {
BF_GLOBALS._deathReason = 20;
BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS._sceneManager.changeScene(666);
} else if ((BF_GLOBALS._bookmark != bBookedFrankie) || !BF_GLOBALS.getFlag(onDuty)) {
BF_GLOBALS._sound1.fadeOut2(NULL);
BF_GLOBALS._sceneManager.changeScene(190);
@@ -1189,10 +1202,10 @@ void Scene315::signal() {
}
break;
case 12:
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
BF_INVENTORY.setObjectScene((int)_currentCursor, 315);
- if (!_field1B64 || (_field1B66 != _field1B64))
+ if (!_invGangCount || (_bookGangCount != _invGangCount))
BF_GLOBALS._player.enableControl();
else {
_field139C = 1;
@@ -1211,23 +1224,24 @@ void Scene315::signal() {
BF_GLOBALS._sceneManager.changeScene(325);
break;
case 3152:
- BF_GLOBALS._walkRegions.proc1(4);
+ BF_GLOBALS._walkRegions.disableRegion(4);
_object7.remove();
_object6.remove();
-
+ // No break on purpose
+ case 3155:
BF_GLOBALS._player.enableControl();
_field1B68 = false;
- BF_GLOBALS._walkRegions.proc1(4);
- BF_GLOBALS._uiElements._active = true;
- BF_GLOBALS._uiElements.show();
+ BF_GLOBALS._walkRegions.disableRegion(4);
+ T2_GLOBALS._uiElements._active = true;
+ T2_GLOBALS._uiElements.show();
break;
case 3153:
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
BF_INVENTORY.setObjectScene((int)_currentCursor, 315);
if (_stripNumber != 0)
setAction(&_action1);
- else if (!_field1B64 || (_field1B66 != _field1B64))
+ else if (!_invGangCount || (_bookGangCount != _invGangCount))
BF_GLOBALS._player.enableControl();
else {
_stripNumber = 3171;
@@ -1235,15 +1249,8 @@ void Scene315::signal() {
_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);
+ T2_GLOBALS._uiElements.addScore(10);
BF_INVENTORY.setObjectScene(INV_DA_NOTE, 1);
_object2.remove();
BF_GLOBALS._player.enableControl();
@@ -1254,12 +1261,12 @@ void Scene315::signal() {
break;
case 3158:
BF_GLOBALS._player.enableControl();
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
BF_INVENTORY.setObjectScene(INV_FOREST_RAP, 1);
break;
case 3159:
if (!BF_GLOBALS.getFlag(fBookedGreenEvidence)) {
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
BF_GLOBALS.setFlag(fBookedGreenEvidence);
}
BF_GLOBALS.setFlag(gunClean);
@@ -1284,6 +1291,11 @@ void Scene315::signal() {
BF_GLOBALS._player.enableControl();
_object9.remove();
break;
+ case 3169:
+ T2_GLOBALS._uiElements.addScore(30);
+ BF_INVENTORY.setObjectScene(INV_MUG_SHOT, 1);
+ BF_GLOBALS._player.enableControl();
+ break;
case 3154:
default:
break;
@@ -1293,7 +1305,7 @@ void Scene315::signal() {
void Scene315::process(Event &event) {
SceneExt::process(event);
- if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (UI_INTERFACE_Y - 1))) {
// Check if the cursor is on an exit
if (_swExit.contains(event.mousePos)) {
GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW);
@@ -1315,7 +1327,7 @@ void Scene315::dispatch() {
if (_field1B68)
return;
- if (_field1B6A) {
+ if (_doorOpened) {
if (BF_GLOBALS._player._position.y < 69) {
BF_GLOBALS._player.disableControl();
_field1B68 = true;
@@ -1718,9 +1730,9 @@ void Scene340::Action1::signal() {
++BF_GLOBALS._marinaWomanCtr;
if (BF_GLOBALS.getFlag(fBackupArrived340)) {
- scene->_field2654 = 1;
+ scene->_backupPresent = 1;
scene->_harrison.setPosition(Common::Point(46, 154));
- BF_GLOBALS._walkRegions.proc1(19);
+ BF_GLOBALS._walkRegions.disableRegion(19);
} else if (BF_GLOBALS.getFlag(fCalledBackup)) {
scene->_timer1.set(40, &scene->_harrison, &scene->_action4);
}
@@ -1729,6 +1741,8 @@ void Scene340::Action1::signal() {
BF_GLOBALS._player.enableControl();
remove();
break;
+ default:
+ break;
}
}
@@ -1737,6 +1751,7 @@ void Scene340::Action2::signal() {
switch (_actionIndex++) {
case 0: {
+ BF_GLOBALS._player.disableControl();
ADD_PLAYER_MOVER(64, 155);
break;
}
@@ -1754,6 +1769,8 @@ void Scene340::Action2::signal() {
BF_GLOBALS._player.enableControl();
remove();
break;
+ default:
+ break;
}
}
@@ -1762,6 +1779,7 @@ void Scene340::Action3::signal() {
switch (_actionIndex++) {
case 0: {
+ BF_GLOBALS._player.disableControl();
ADD_PLAYER_MOVER(64, 155);
break;
}
@@ -1770,18 +1788,20 @@ void Scene340::Action3::signal() {
setDelay(3);
break;
case 2:
- scene->_stripManager.start(scene->_field2652 + 3404, this);
+ scene->_stripManager.start(scene->_womanDialogCount + 3404, this);
break;
case 3:
- if (++scene->_field2652 > 2) {
+ if (++scene->_womanDialogCount > 2) {
if (!BF_GLOBALS.getFlag(fGotAllSkip340))
BF_GLOBALS.setFlag(fGotAllSkip340);
- scene->_field2652 = 0;
+ scene->_womanDialogCount = 0;
}
BF_GLOBALS._player.enableControl();
remove();
break;
+ default:
+ break;
}
}
@@ -1800,17 +1820,19 @@ void Scene340::Action4::signal() {
break;
case 1:
BF_GLOBALS.setFlag(fBackupArrived340);
- scene->_field2654 = 1;
+ scene->_backupPresent = 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._walkRegions.disableRegion(19);
BF_GLOBALS._player.enableControl();
remove();
break;
+ default:
+ break;
}
}
@@ -1820,7 +1842,7 @@ void Scene340::Action5::signal() {
switch (_actionIndex++) {
case 0:
BF_GLOBALS._player.disableControl();
- if (scene->_field2654) {
+ if (scene->_backupPresent) {
ADD_PLAYER_MOVER(64, 155);
} else {
BF_GLOBALS._player.changeAngle(45);
@@ -1846,6 +1868,8 @@ void Scene340::Action5::signal() {
BF_GLOBALS._player.enableControl();
remove();
break;
+ default:
+ break;
}
}
@@ -1890,6 +1914,8 @@ void Scene340::Action7::signal() {
BF_GLOBALS.setFlag(fBackupIn350);
BF_GLOBALS._sceneManager.changeScene(350);
break;
+ default:
+ break;
}
}
@@ -1942,6 +1968,11 @@ void Scene340::Action8::signal() {
case 4:
remove();
break;
+ default:
+ // This is present in the original game
+ warning("Bugs");
+ remove();
+ break;
}
}
@@ -1974,15 +2005,15 @@ void Scene340::Timer2::signal() {
/*--------------------------------------------------------------------------*/
Scene340::Scene340(): PalettedScene() {
- _seqNumber1 = _field2652 = _field2654 = 0;
+ _seqNumber1 = _womanDialogCount = _backupPresent = 0;
}
void Scene340::synchronize(Serializer &s) {
PalettedScene::synchronize(s);
s.syncAsSint16LE(_seqNumber1);
- s.syncAsSint16LE(_field2652);
- s.syncAsSint16LE(_field2654);
+ s.syncAsSint16LE(_womanDialogCount);
+ s.syncAsSint16LE(_backupPresent);
}
void Scene340::postInit(SceneObjectList *OwnerList) {
@@ -1990,14 +2021,14 @@ void Scene340::postInit(SceneObjectList *OwnerList) {
loadScene(340);
setZoomPercents(126, 70, 162, 100);
- BF_GLOBALS._walkRegions.proc1(13);
- BF_GLOBALS._walkRegions.proc1(15);
+ BF_GLOBALS._walkRegions.disableRegion(13);
+ BF_GLOBALS._walkRegions.disableRegion(15);
_timer2.set(2, NULL);
_stripManager.addSpeaker(&_gameTextSpeaker);
_stripManager.addSpeaker(&_jakeUniformSpeaker);
- _field2652 = 0;
+ _womanDialogCount = 0;
BF_GLOBALS._player.postInit();
BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
@@ -2006,7 +2037,7 @@ void Scene340::postInit(SceneObjectList *OwnerList) {
_swExit.setDetails(15, 340, -1, -1, -1, 1);
_northExit.setDetails(16, 340, -1, -1, -1, 1);
- BF_GLOBALS._player._regionBitList = 0x10000;
+ BF_GLOBALS._player._regionBitList |= 0x10000;
BF_GLOBALS._player.setVisage(BF_GLOBALS.getFlag(onDuty) ? 1341 : 129);
BF_GLOBALS._player._moveDiff = Common::Point(5, 2);
@@ -2054,18 +2085,18 @@ void Scene340::postInit(SceneObjectList *OwnerList) {
_stripManager.addSpeaker(&_harrisonSpeaker);
if (BF_GLOBALS.getFlag(fBackupIn350)) {
- _field2654 = 0;
+ _backupPresent = 0;
_harrison.setVisage(1355);
_harrison.setPosition(Common::Point(289, 112));
_harrison.changeAngle(225);
_harrison.setFrame(1);
_harrison.fixPriority(75);
- BF_GLOBALS._walkRegions.proc1(23);
+ BF_GLOBALS._walkRegions.disableRegion(23);
} else if (BF_GLOBALS.getFlag(fBackupArrived340)) {
- _field2654 = 1;
+ _backupPresent = 1;
_harrison.setPosition(Common::Point(46, 154));
- BF_GLOBALS._walkRegions.proc1(19);
+ BF_GLOBALS._walkRegions.disableRegion(19);
} else if (BF_GLOBALS.getFlag(fCalledBackup) && (BF_GLOBALS._marinaWomanCtr > 0)) {
_timer1.set(900, &_harrison, &_action4);
}
@@ -2092,7 +2123,7 @@ void Scene340::postInit(SceneObjectList *OwnerList) {
_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);
+ _item1.setDetails(Rect(0, 0, SCREEN_WIDTH - 1, UI_INTERFACE_Y), 340, 1, 7, 10, 1, NULL);
BF_GLOBALS._player.disableControl();
_sceneMode = 0;
@@ -2137,7 +2168,7 @@ void Scene340::process(Event &event) {
if (!event.handled) {
SceneExt::process(event);
- if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (UI_INTERFACE_Y - 1))) {
// Check if the cursor is on an exit
if (_westExit.contains(event.mousePos)) {
GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_W);
@@ -2288,8 +2319,8 @@ void Scene342::postInit(SceneObjectList *OwnerList) {
loadScene(340);
setZoomPercents(126, 70, 162, 100);
- BF_GLOBALS._walkRegions.proc1(13);
- BF_GLOBALS._walkRegions.proc1(15);
+ BF_GLOBALS._walkRegions.disableRegion(13);
+ BF_GLOBALS._walkRegions.disableRegion(15);
_field1A1A = 0;
_timer1.set(2, NULL);
@@ -2357,7 +2388,7 @@ void Scene342::postInit(SceneObjectList *OwnerList) {
}
if (BF_GLOBALS.getFlag(fWithLyle)) {
- BF_GLOBALS._walkRegions.proc1(19);
+ BF_GLOBALS._walkRegions.disableRegion(19);
BF_GLOBALS._player.disableControl();
_sceneMode = 0;
@@ -2393,7 +2424,7 @@ void Scene342::postInit(SceneObjectList *OwnerList) {
_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);
+ _item1.setDetails(Rect(0, 0, SCREEN_WIDTH - 1, UI_INTERFACE_Y), 340, 1, 7, 10, 1, NULL);
}
void Scene342::remove() {
@@ -2434,7 +2465,7 @@ void Scene342::process(Event &event) {
if (!event.handled) {
SceneExt::process(event);
- if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (UI_INTERFACE_Y - 1))) {
// Check if the cursor is on an exit
if (_westExit.contains(event.mousePos)) {
GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_W);
@@ -2481,7 +2512,7 @@ void Scene342::dispatch() {
*
*--------------------------------------------------------------------------*/
-bool Scene350::Item5::startAction(CursorType action, Event &event) {
+bool Scene350::FireBox::startAction(CursorType action, Event &event) {
Scene350 *scene = (Scene350 *)BF_GLOBALS._sceneManager._scene;
switch (action) {
@@ -2559,7 +2590,7 @@ bool Scene350::Hook::startAction(CursorType action, Event &event) {
BF_INVENTORY.setObjectScene(INV_HOOK, 1);
if (!BF_GLOBALS.getFlag(hookPoints)) {
BF_GLOBALS.setFlag(hookPoints);
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
}
remove();
return true;
@@ -2568,7 +2599,7 @@ bool Scene350::Hook::startAction(CursorType action, Event &event) {
}
}
-bool Scene350::Object5::startAction(CursorType action, Event &event) {
+bool Scene350::FireboxInset::startAction(CursorType action, Event &event) {
Scene350 *scene = (Scene350 *)BF_GLOBALS._sceneManager._scene;
switch (action) {
@@ -2576,7 +2607,7 @@ bool Scene350::Object5::startAction(CursorType action, Event &event) {
SceneItem::display2(350, BF_INVENTORY.getObjectScene(INV_HOOK) ? 29 : 28);
return true;
case CURSOR_USE:
- scene->_object5.remove();
+ scene->_fireBoxInset.remove();
return true;
case INV_HOOK:
BF_INVENTORY.setObjectScene(INV_HOOK, 350);
@@ -2589,7 +2620,7 @@ bool Scene350::Object5::startAction(CursorType action, Event &event) {
BF_GLOBALS._sceneItems.push_front(&scene->_hook);
return true;
default:
- return NamedObject::startAction(action, event);
+ return FocusObject::startAction(action, event);
}
}
@@ -2635,7 +2666,7 @@ void Scene350::postInit(SceneObjectList *OwnerList) {
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);
+ _swExit.setDetails(Rect(0, 160, SCREEN_WIDTH, UI_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);
@@ -2669,20 +2700,20 @@ void Scene350::postInit(SceneObjectList *OwnerList) {
}
}
- _item5._sceneRegionId = 5;
- BF_GLOBALS._sceneItems.push_back(&_item5);
+ _fireBox._sceneRegionId = 5;
+ BF_GLOBALS._sceneItems.push_back(&_fireBox);
_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);
+ _item1.setDetails(Rect(0, 0, SCREEN_WIDTH - 1, UI_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();
+ T2_GLOBALS._uiElements._active = true;
+ T2_GLOBALS._uiElements.show();
// Deliberate fall-through
case 355:
if (BF_GLOBALS.getFlag(onDuty) && BF_GLOBALS.getFlag(gunDrawn))
@@ -2726,12 +2757,12 @@ void Scene350::signal() {
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);
+ _fireBoxInset.postInit();
+ _fireBoxInset.setVisage(350);
+ _fireBoxInset.setStrip(4);
+ _fireBoxInset.fixPriority(200);
+ _fireBoxInset.setPosition(Common::Point(85, 166));
+ BF_GLOBALS._sceneItems.push_front(&_fireBoxInset);
if (BF_INVENTORY.getObjectScene(INV_HOOK) == 350) {
_hook.postInit();
@@ -2748,7 +2779,7 @@ void Scene350::signal() {
default:
if (BF_GLOBALS.getFlag(fBackupIn350)) {
_harrison.updateAngle(BF_GLOBALS._player._position);
- BF_GLOBALS._walkRegions.proc1(19);
+ BF_GLOBALS._walkRegions.disableRegion(19);
}
BF_GLOBALS._player.enableControl();
@@ -2792,7 +2823,7 @@ void Scene350::process(Event &event) {
if (!event.handled) {
SceneExt::process(event);
- if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (UI_INTERFACE_Y - 1))) {
// Check if the cursor is on an exit
if (_swExit.contains(event.mousePos)) {
GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW);
@@ -2860,7 +2891,7 @@ bool Scene355::Doorway::startAction(CursorType action, Event &event) {
BF_GLOBALS.setFlag(fTookTrailerAmmo);
scene->_stripManager.start(3575, scene);
- scene->_object7._flag = 1;
+ scene->_lyle._flag = 1;
return true;
case 1:
BF_GLOBALS._player.disableControl();
@@ -2935,7 +2966,7 @@ bool Scene355::Locker::startAction(CursorType action, Event &event) {
}
}
-bool Scene355::LockerDoor::startAction(CursorType action, Event &event) {
+bool Scene355::LockerInset::startAction(CursorType action, Event &event) {
Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene;
switch (action) {
@@ -2949,8 +2980,8 @@ bool Scene355::LockerDoor::startAction(CursorType action, Event &event) {
if (_frame == 1) {
SceneItem::display2(355, 23);
return true;
- }
- return true;
+ } else
+ return NamedObject::startAction(action, event);
case INV_SCREWDRIVER:
scene->_sound2.play(104);
BF_INVENTORY.setObjectScene(INV_SCREWDRIVER, 999);
@@ -2985,7 +3016,7 @@ bool Scene355::Object5::startAction(CursorType action, Event &event) {
return true;
case CURSOR_USE:
BF_INVENTORY.setObjectScene(INV_FLARE, 1);
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
scene->_object9.remove();
remove();
@@ -2995,7 +3026,7 @@ bool Scene355::Object5::startAction(CursorType action, Event &event) {
}
}
-bool Scene355::Object6::startAction(CursorType action, Event &event) {
+bool Scene355::Green::startAction(CursorType action, Event &event) {
Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene;
switch (action) {
@@ -3013,7 +3044,7 @@ bool Scene355::Object6::startAction(CursorType action, Event &event) {
BF_GLOBALS._player._regionBitList |= 0x10;
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 9985;
- scene->setAction(&scene->_sequenceManager, scene, 3357, &BF_GLOBALS._player, this, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 3557, &BF_GLOBALS._player, this, NULL);
}
return true;
case CURSOR_TALK:
@@ -3023,14 +3054,14 @@ bool Scene355::Object6::startAction(CursorType action, Event &event) {
} else if (BF_INVENTORY.getObjectScene(INV_HANDCUFFS) != 1) {
return false;
} else {
- switch (BF_GLOBALS._v4CEC2) {
+ switch (BF_GLOBALS._greenDay5TalkCtr++) {
case 0:
scene->_stripManager.start(3565, scene);
break;
case 1:
scene->_stripManager.start(3567, scene);
break;
- case 2:
+ default:
scene->_stripManager.start(3571, scene);
break;
}
@@ -3052,25 +3083,25 @@ bool Scene355::Object6::startAction(CursorType action, Event &event) {
else if (!BF_GLOBALS.getFlag(gunDrawn))
SceneItem::display2(1, 0);
else {
- if (BF_GLOBALS._sceneObjects->contains(&scene->_object7))
- scene->_object7.setAction(NULL);
+ if (BF_GLOBALS._sceneObjects->contains(&scene->_lyle))
+ scene->_lyle.setAction(NULL);
BF_GLOBALS._player.disableControl();
- scene->_object6.setStrip(1);
- scene->_object6.setFrame(1);
+ scene->_green.setStrip(1);
+ scene->_green.setFrame(1);
scene->_sceneMode = 9981;
scene->signal();
}
return true;
case INV_HANDCUFFS:
- if (BF_GLOBALS._v4CEC2 <= 1)
+ if (BF_GLOBALS._greenDay5TalkCtr <= 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);
+ T2_GLOBALS._uiElements.addScore(50);
_flag = 1;
BF_GLOBALS._bookmark = bInvestigateBoat;
}
@@ -3083,7 +3114,7 @@ bool Scene355::Object6::startAction(CursorType action, Event &event) {
}
}
-bool Scene355::Object7::startAction(CursorType action, Event &event) {
+bool Scene355::Lyle::startAction(CursorType action, Event &event) {
Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene;
switch (action) {
@@ -3091,7 +3122,7 @@ bool Scene355::Object7::startAction(CursorType action, Event &event) {
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 0;
- if (BF_GLOBALS._sceneObjects->contains(&scene->_object6)) {
+ if (BF_GLOBALS._sceneObjects->contains(&scene->_green)) {
scene->_stripManager.start((BF_INVENTORY.getObjectScene(INV_HANDCUFFS) == 355) ? 3578 : 3577, scene);
} else {
switch (_flag) {
@@ -3137,7 +3168,7 @@ bool Scene355::Object8::startAction(CursorType action, Event &event) {
scene->_sceneMode = 9997;
scene->_stripManager.start(3561, scene);
} else {
- SceneItem::display(1, 4);
+ SceneItem::display2(1, 4);
}
return true;
default:
@@ -3258,10 +3289,16 @@ bool Scene355::Item4::startAction(CursorType action, Event &event) {
}
-bool Scene355::Item5::startAction(CursorType action, Event &event) {
+bool Scene355::Pouch::startAction(CursorType action, Event &event) {
Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene;
switch (action) {
+ case CURSOR_LOOK:
+ if (BF_INVENTORY.getObjectScene(INV_SCREWDRIVER) == 355) {
+ SceneItem::display2(355, 29);
+ return true;
+ }
+ break;
case CURSOR_USE:
if (BF_INVENTORY.getObjectScene(INV_SCREWDRIVER) == 355) {
if (scene->_modeFlag) {
@@ -3289,8 +3326,10 @@ bool Scene355::Item5::startAction(CursorType action, Event &event) {
}
return true;
default:
- return NamedHotspot::startAction(action, event);
+ break;
}
+
+ return NamedHotspot::startAction(action, event);
}
bool Scene355::Item11::startAction(CursorType action, Event &event) {
@@ -3314,7 +3353,7 @@ bool Scene355::Item11::startAction(CursorType action, Event &event) {
scene->_sceneMode = 0;
BF_GLOBALS.setFlag(fTookTrailerAmmo);
scene->_stripManager.start(3575, scene);
- scene->_object7._flag = 1;
+ scene->_lyle._flag = 1;
scene->_doorway._v2 = 1;
break;
case 1:
@@ -3349,7 +3388,7 @@ bool Scene355::Item11::startAction(CursorType action, Event &event) {
return NamedHotspot::startAction(action, event);
}
-bool Scene355::Item12::startAction(CursorType action, Event &event) {
+bool Scene355::RentalExit::startAction(CursorType action, Event &event) {
Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene;
if (!BF_GLOBALS.getFlag(gunDrawn)) {
@@ -3360,6 +3399,7 @@ bool Scene355::Item12::startAction(CursorType action, Event &event) {
else {
scene->_nextSceneMode = 0;
BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 9991;
scene->setAction(&scene->_sequenceManager, scene, 3555, &BF_GLOBALS._player, NULL);
}
}
@@ -3378,7 +3418,7 @@ void Scene355::Action1::signal() {
break;
case 1:
_actionIndex = 0;
- scene->_object7.animate(ANIM_MODE_8, 1, this);
+ scene->_lyle.animate(ANIM_MODE_8, 1, this);
break;
default:
break;
@@ -3527,7 +3567,7 @@ void Scene355::postInit(SceneObjectList *OwnerList) {
case 4:
break;
case 5:
- BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._player.enableControl();
_modeFlag = true;
BF_GLOBALS._player.setPosition(Common::Point(133, 173));
BF_GLOBALS._player.fixPriority(249);
@@ -3536,17 +3576,17 @@ void Scene355::postInit(SceneObjectList *OwnerList) {
if (BF_GLOBALS._bookmark == bDoneAtLyles)
BF_GLOBALS._bookmark = bEndDayFour;
- _item5.setDetails(Rect(22, 136, 46, 146), 355, 43, -1, -1, 1, NULL);
+ _pouch.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);
+ _lyle.postInit();
+ _lyle.setVisage(847);
+ _lyle.setPosition(Common::Point(296, 97));
+ _lyle.setStrip(1);
+ _lyle.setAction(&_action1);
+ _lyle._flag = BF_GLOBALS.getFlag(fTookTrailerAmmo) ? 1 : 0;
+ _lyle.setDetails(355, 40, 42, 41, 1, NULL);
}
if ((BF_INVENTORY.getObjectScene(INV_RAGS) == 0) && (BF_INVENTORY.getObjectScene(INV_JAR) == 0) &&
@@ -3568,39 +3608,39 @@ void Scene355::postInit(SceneObjectList *OwnerList) {
_doorway.setPosition(Common::Point(146, 107));
_doorway._v3 = 0;
_doorway._v2 = 2;
- _object7._flag = 2;
+ _lyle._flag = 2;
- _object6.postInit();
- BF_GLOBALS._sceneItems.push_back(&_object6);
+ _green.postInit();
+ BF_GLOBALS._sceneItems.push_back(&_green);
if (BF_INVENTORY.getObjectScene(INV_HANDCUFFS) == 1) {
- _object6.setVisage(376);
- _object6.setStrip(1);
- _object6.setPosition(Common::Point(193, 88));
- _object6._flag = 0;
+ _green.setVisage(376);
+ _green.setStrip(1);
+ _green.setPosition(Common::Point(193, 88));
+ _green._flag = 0;
} else {
- _object6._flag = 1;
+ _green._flag = 1;
if (BF_INVENTORY.getObjectScene(INV_GRENADES) == 1) {
- _object6.setVisage(373);
- _object6.setStrip(5);
- _object6.setPosition(Common::Point(238, 142));
+ _green.setVisage(373);
+ _green.setStrip(5);
+ _green.setPosition(Common::Point(238, 142));
} else {
- _object6.setVisage(375);
- _object6.setStrip(1);
- _object6.setFrame(_object6.getFrameCount());
- _object6.setPosition(Common::Point(193, 147));
+ _green.setVisage(375);
+ _green.setStrip(1);
+ _green.setFrame(_green.getFrameCount());
+ _green.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();
+ if ((BF_GLOBALS._bookmark == bFinishedWGreen) && BF_GLOBALS._sceneObjects->contains(&_lyle) &&
+ !BF_GLOBALS.getFlag(iWasAmbushed)) {
+ BF_GLOBALS.setFlag(iWasAmbushed);
+ BF_GLOBALS._player.disableControl();
- _sceneMode = 0;
- _stripManager.start(3582, this);
+ _sceneMode = 0;
+ _stripManager.start(3582, this);
+ }
}
break;
default:
@@ -3630,6 +3670,7 @@ void Scene355::postInit(SceneObjectList *OwnerList) {
break;
}
+ _item3._sceneRegionId = 18;
_harrison.setDetails(355, 18, 20, 19, 1, NULL);
_item6.setDetails(10, 355, 2, -1, 14, 1);
_item7.setDetails(11, 355, 3, -1, 15, 1);
@@ -3640,8 +3681,8 @@ void Scene355::postInit(SceneObjectList *OwnerList) {
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);
+ _rentalExit.setBounds(Rect(115, 101, 186, 154));
+ BF_GLOBALS._sceneItems.push_front(&_rentalExit);
} else {
_item2.setDetails(Rect(273, 53, 320, 101), 355, -1, -1, -1, 2, NULL);
}
@@ -3735,21 +3776,21 @@ void Scene355::signal() {
case 3562:
if (!BF_GLOBALS.getFlag(unlockBoat)) {
BF_GLOBALS.setFlag(unlockBoat);
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
}
- SceneItem::display(355, !_doorway._v3 ? 24 : 25);
+ SceneItem::display2(355, !_doorway._v3 ? 24 : 25);
BF_GLOBALS._player.enableControl();
break;
case 4550:
- BF_GLOBALS._uiElements.addScore(50);
+ T2_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;
+ _lyle._flag = 2;
BF_GLOBALS._player.enableControl();
break;
case 4552:
@@ -3762,10 +3803,10 @@ void Scene355::signal() {
_sceneMode = 9980;
break;
case 9992:
- _sceneMode = 0;
+ _sceneMode = 9992;
break;
default:
- _sceneMode = 9992;
+ _sceneMode = 0;
break;
}
setAction(&_sequenceManager, this, 4554, &BF_GLOBALS._player, NULL);
@@ -3785,29 +3826,29 @@ void Scene355::signal() {
break;
case 9981:
_sceneMode = 9994;
- _object6.animate(ANIM_MODE_5, NULL);
+ _green.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);
+ BF_GLOBALS._player.updateAngle(_green._position);
_stripManager.start(3581, this);
} else {
- BF_GLOBALS._player.updateAngle(_object7._position);
+ BF_GLOBALS._player.updateAngle(_lyle._position);
_stripManager.start(3570, this);
}
} else {
if (BF_GLOBALS.getFlag(fLyleOnIsland)) {
- if (BF_GLOBALS._sceneObjects->contains(&_object6)) {
+ if (BF_GLOBALS._sceneObjects->contains(&_green)) {
BF_INVENTORY.setObjectScene(INV_GRENADES, 860);
_stripManager.start(3583, this);
} else {
signal();
}
} else {
- BF_GLOBALS._player.updateAngle(_object7._position);
+ BF_GLOBALS._player.updateAngle(_lyle._position);
_stripManager.start(BF_GLOBALS.getFlag(fTookTrailerAmmo) ? 3579 : 3580, this);
}
}
@@ -3823,7 +3864,7 @@ void Scene355::signal() {
BF_GLOBALS._sound1.play(109);
BF_GLOBALS.setFlag(fTookTrailerAmmo);
_stripManager.start(3575, this);
- _object7._flag = 1;
+ _lyle._flag = 1;
++_doorway._v2;
break;
case 1:
@@ -3858,7 +3899,7 @@ void Scene355::signal() {
_sceneMode = 0;
_stripManager.start(3569, this);
BF_INVENTORY.setObjectScene(INV_GRENADES, 1);
- BF_GLOBALS._uiElements.addScore(50);
+ T2_GLOBALS._uiElements.addScore(50);
BF_GLOBALS._player._regionBitList |= 0x10;
break;
case 9986:
@@ -3885,13 +3926,13 @@ void Scene355::signal() {
}
break;
case 9988:
- BF_GLOBALS._uiElements.addScore(30);
+ T2_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;
+ _green.postInit();
+ _green.setVisage(373);
+ _green.setPosition(Common::Point(-10, -10));
+ _green._flag = 0;
_object9.postInit();
_object9.setPosition(Common::Point(-10, -10));
@@ -3900,24 +3941,24 @@ void Scene355::signal() {
_object11.postInit();
_object11.setPosition(Common::Point(-10, -10));
- BF_GLOBALS._sceneItems.push_front(&_object6);
+ BF_GLOBALS._sceneItems.push_front(&_green);
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);
+ setAction(&_sequenceManager, this, 4550, &_doorway, &_green, &_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);
+ _lockerInset.postInit();
+ _lockerInset.setVisage(2356);
+ _lockerInset.setStrip(2);
+ BF_GLOBALS._sceneItems.push_front(&_lockerInset);
if (BF_INVENTORY.getObjectScene(INV_SCREWDRIVER) == 999) {
- _lockerDoor.setFrame(2);
+ _lockerInset.setFrame(2);
if (BF_INVENTORY.getObjectScene(INV_FLARE) == 355) {
_object5.postInit();
_object5.setVisage(2356);
@@ -3927,11 +3968,11 @@ void Scene355::signal() {
BF_GLOBALS._sceneItems.push_front(&_object5);
}
} else {
- _lockerDoor.setFrame(1);
+ _lockerInset.setFrame(1);
}
- _lockerDoor.setPosition(Common::Point(82, 115));
- _lockerDoor.fixPriority(254);
+ _lockerInset.setPosition(Common::Point(82, 115));
+ _lockerInset.fixPriority(254);
BF_GLOBALS._player.enableControl();
break;
case 9990:
@@ -3949,7 +3990,7 @@ void Scene355::signal() {
case 9993:
BF_INVENTORY.setObjectScene(INV_SCREWDRIVER, 1);
SceneItem::display2(355, 29);
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
_sceneMode = 0;
signal();
break;
@@ -3987,11 +4028,11 @@ void Scene355::signal() {
}
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))) {
+ if (BF_GLOBALS._dayNumber != 5) {
+ // Handling for earlier days
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (UI_INTERFACE_Y - 1))) {
// Check if the cursor is on an exit
- if (_item12.contains(event.mousePos)) {
+ if (_rentalExit.contains(event.mousePos)) {
GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_NW);
BF_GLOBALS._events.setCursor(surface);
} else {
@@ -4001,6 +4042,39 @@ void Scene355::process(Event &event) {
}
}
+ 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;
+ }
+ } else {
+ // Day 5 handling
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (UI_INTERFACE_Y - 1))) {
+ // Check if the cursor is on the exit to the rental boat
+ if (_rentalExit.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);
+ }
+ }
+
// Special handling of actions
if (event.eventType == EVENT_BUTTON_DOWN) {
switch (BF_GLOBALS._events.getCursor()) {
@@ -4045,39 +4119,6 @@ void Scene355::process(Event &event) {
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);
@@ -4085,8 +4126,8 @@ void Scene355::process(Event &event) {
void Scene355::dispatch() {
PalettedScene::dispatch();
- if (BF_GLOBALS._sceneObjects->contains(&_object7)) {
- _object7.updateAngle(BF_GLOBALS._player._position);
+ if (BF_GLOBALS._sceneObjects->contains(&_lyle)) {
+ _lyle.updateAngle(BF_GLOBALS._player._position);
}
if (!_action && (BF_GLOBALS._player.getRegionIndex() == 20)) {
@@ -4124,7 +4165,7 @@ bool Scene360::Item1::startAction(CursorType action, Event &event) {
case CURSOR_TALK:
scene->_sceneMode = 3607;
BF_GLOBALS._player.disableControl();
- scene->_stripManager.start(3550, this);
+ scene->_stripManager.start(3550, scene);
return true;
case INV_COLT45:
SceneItem::display2(1, 4);
@@ -4233,7 +4274,7 @@ bool Scene360::Object4::startAction(CursorType action, Event &event) {
}
}
-bool Scene360::BsseballCards::startAction(CursorType action, Event &event) {
+bool Scene360::BaseballCards::startAction(CursorType action, Event &event) {
switch (action) {
case CURSOR_LOOK:
if (event.mousePos.x >= (_bounds.left + _bounds.width() / 2))
@@ -4249,7 +4290,7 @@ bool Scene360::BsseballCards::startAction(CursorType action, Event &event) {
}
}
-bool Scene360::Object6::startAction(CursorType action, Event &event) {
+bool Scene360::Harrison::startAction(CursorType action, Event &event) {
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(360, 6);
@@ -4291,7 +4332,7 @@ void Scene360::Action1::signal() {
if (BF_INVENTORY.getObjectScene(INV_WAREHOUSE_KEYS) == 360) {
SceneItem::display2(360, 20);
BF_INVENTORY.setObjectScene(INV_WAREHOUSE_KEYS, 1);
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
} else {
SceneItem::display2(360, 5);
}
@@ -4306,13 +4347,12 @@ void Scene360::Action1::signal() {
/*--------------------------------------------------------------------------*/
-Scene360::Scene360() {
- _field380 = 0;
-}
-
void Scene360::synchronize(Serializer &s) {
SceneExt::synchronize(s);
- s.syncAsSint16LE(_field380);
+ if (s.getVersion() < 9) {
+ int tmpVar = 0;
+ s.syncAsSint16LE(tmpVar);
+ }
}
void Scene360::postInit(SceneObjectList *OwnerList) {
@@ -4390,20 +4430,19 @@ void Scene360::postInit(SceneObjectList *OwnerList) {
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 {
+ if ((BF_GLOBALS._sceneManager._previousScene == 355) || (BF_GLOBALS._sceneManager._previousScene != 370)) {
+ // The original was using there a useless variable (now removed)
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);
+ _harrison.postInit();
+ _harrison.setVisage(BF_GLOBALS.getFlag(gunDrawn) ? 363 : 1363);
+ _harrison.animate(ANIM_MODE_1, NULL);
+ _harrison.setObjectWrapper(new SceneObjectWrapper());
+ _harrison.setPosition(Common::Point(235, 150));
+ _harrison.setStrip(2);
+ BF_GLOBALS._sceneItems.push_back(&_harrison);
}
_sceneMode = 3607;
@@ -4418,13 +4457,16 @@ void Scene360::postInit(SceneObjectList *OwnerList) {
_slidingDoor.setPosition(Common::Point(6, 130));
_slidingDoor.setAction(&_sequenceManager1, this, 3606, &_slidingDoor, &_object7, NULL);
}
+ } else {
+ BF_GLOBALS._player.setPosition(Common::Point(62, 122));
+ BF_GLOBALS._player.enableControl();
}
_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));
+ _item1.setBounds(Rect(0, 0, SCREEN_WIDTH, UI_INTERFACE_Y));
BF_GLOBALS._sceneItems.push_back(&_item1);
}
@@ -4438,7 +4480,7 @@ void Scene360::signal() {
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));
+ BF_GLOBALS._player._position.y + 1));
_sceneMode = 3610;
setAction(&_sequenceManager1, this, 3610, &_slidingDoor, &_object2, &BF_GLOBALS._player, NULL);
break;
@@ -4447,8 +4489,13 @@ void Scene360::signal() {
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);
+ if (BF_GLOBALS.getFlag(fBackupIn350)) {
+ _sceneMode = 3603;
+ setAction(&_sequenceManager1, this, _sceneMode, &_harrison, NULL);
+ } else {
+ _sceneMode = 3605;
+ setAction(&_sequenceManager1, this, _sceneMode, &BF_GLOBALS._player, &_slidingDoor, NULL);
+ }
break;
case 3605:
if (BF_GLOBALS.getFlag(fBackupIn350)) {
@@ -4462,11 +4509,17 @@ void Scene360::signal() {
break;
case 3607:
case 3609:
- _object6.setVisage(1363);
+ // Original game was only using at this place visage 1363.
+ // This workaround allow Harrison to keep his gun handy
+ // when entering the romm (if required)
+ if (! BF_GLOBALS.getFlag(gunDrawn))
+ _harrison.setVisage(1363);
+ else
+ _harrison.setVisage(363);
BF_GLOBALS._player.enableControl();
break;
case 3608:
- BF_GLOBALS._sceneManager.changeScene(355);
+ BF_GLOBALS._sceneManager.changeScene(355);
break;
case 3610:
BF_GLOBALS._sceneManager.changeScene(666);
@@ -4510,7 +4563,7 @@ void Scene360::process(Event &event) {
BF_GLOBALS._player.setFrame(BF_GLOBALS._player.getFrameCount());
BF_GLOBALS._player.animate(ANIM_MODE_6, this);
- _object6.setVisage(1363);
+ _harrison.setVisage(1363);
}
} else {
// Handle drawing gun
@@ -4525,7 +4578,7 @@ void Scene360::process(Event &event) {
BF_GLOBALS.setFlag(gunDrawn);
_sceneMode = 9998;
- _object6.setVisage(363);
+ _harrison.setVisage(363);
}
event.handled = true;
@@ -4574,7 +4627,7 @@ bool Scene370::GreensGun::startAction(CursorType action, Event &event) {
case CURSOR_USE:
if ((BF_INVENTORY.getObjectScene(INV_HANDCUFFS) != 1) || BF_GLOBALS.getFlag(greenTaken)) {
BF_GLOBALS._player.disableControl();
- BF_GLOBALS._walkRegions.proc2(3);
+ BF_GLOBALS._walkRegions.enableRegion(3);
scene->_sceneMode = 3711;
scene->setAction(&scene->_sequenceManager, scene, 3711, &BF_GLOBALS._player, this, NULL);
} else {
@@ -4603,7 +4656,7 @@ bool Scene370::Green::startAction(CursorType action, Event &event) {
scene->_stripManager.start(3717, scene);
} else {
BF_GLOBALS._player.disableControl();
- BF_GLOBALS._walkRegions.proc2(3);
+ BF_GLOBALS._walkRegions.enableRegion(3);
scene->_sceneMode = 3715;
scene->setAction(&scene->_sequenceManager, scene, 3715, &BF_GLOBALS._player, this, NULL);
}
@@ -4658,7 +4711,7 @@ bool Scene370::Green::startAction(CursorType action, Event &event) {
if (_v2 != 3)
SceneItem::display2(370, 2);
else {
- BF_GLOBALS._uiElements.addScore(50);
+ T2_GLOBALS._uiElements.addScore(50);
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 3704;
scene->setAction(&scene->_sequenceManager, scene, 3704, &BF_GLOBALS._player, this, &scene->_harrison, NULL);
@@ -4738,37 +4791,36 @@ bool Scene370::Laura::startAction(CursorType action, Event &event) {
bool Scene370::Item1::startAction(CursorType action, Event &event) {
Scene370 *scene = (Scene370 *)BF_GLOBALS._sceneManager._scene;
- switch (action) {
- case CURSOR_LOOK:
+ if (action == CURSOR_LOOK) {
SceneItem::display2(370, 15);
return true;
- case CURSOR_USE:
+ } else if (action == CURSOR_USE) {
SceneItem::display2(370, 16);
return true;
- case INV_COLT45:
+ } else if (action == 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 false;
+ } else if (action < CURSOR_WALK) // If any other inventory item used
+ return false;
+ else // If any other action is used
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:
+ if (action == CURSOR_LOOK) {
SceneItem::display2(370, 14);
return true;
- case CURSOR_USE:
+ } else if (action == CURSOR_USE) {
SceneItem::display2(370, 29);
return true;
- case INV_COLT45:
+ } else if (action == 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();
@@ -4777,10 +4829,11 @@ bool Scene370::Item6::startAction(CursorType action, Event &event) {
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);
- }
+ } else if (action < CURSOR_WALK) // If any other inventory item used
+ return false;
+ else // If any other action
+ return SceneHotspot::startAction(action, event);
}
@@ -4923,7 +4976,7 @@ void Scene370::signal() {
BF_GLOBALS._player.setStrip(3);
BF_GLOBALS._sceneItems.push_front(&_laura);
- BF_GLOBALS._walkRegions.proc1(3);
+ BF_GLOBALS._walkRegions.disableRegion(3);
_harrison.setAction(NULL);
BF_GLOBALS._player.enableControl();
@@ -4933,15 +4986,15 @@ void Scene370::signal() {
break;
case 3705:
_laura.remove();
- BF_GLOBALS._walkRegions.proc2(6);
- BF_GLOBALS._walkRegions.proc2(1);
+ BF_GLOBALS._walkRegions.enableRegion(6);
+ BF_GLOBALS._walkRegions.enableRegion(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);
+ T2_GLOBALS._uiElements.addScore(50);
BF_GLOBALS._sceneItems.push_front(&_greensGun);
BF_GLOBALS._player.enableControl();
@@ -4950,8 +5003,8 @@ void Scene370::signal() {
_sceneMode = 0;
_object5.remove();
_green.setAction(NULL);
- BF_GLOBALS._walkRegions.proc1(6);
- BF_GLOBALS._walkRegions.proc1(1);
+ BF_GLOBALS._walkRegions.disableRegion(6);
+ BF_GLOBALS._walkRegions.disableRegion(1);
break;
case 3709:
BF_GLOBALS._player.disableControl();
@@ -4965,15 +5018,15 @@ void Scene370::signal() {
_green.setAction(&_sequenceManager, this, 3701, NULL);
break;
case 3711:
- BF_GLOBALS._walkRegions.proc1(3);
+ BF_GLOBALS._walkRegions.disableRegion(3);
BF_INVENTORY.setObjectScene(INV_GREENS_GUN, 1);
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
_greensGun.remove();
BF_GLOBALS._player.enableControl();
break;
case 3712:
- BF_GLOBALS._uiElements._active = false;
- BF_GLOBALS._uiElements.hide();
+ T2_GLOBALS._uiElements._active = false;
+ T2_GLOBALS._uiElements.hide();
if (BF_GLOBALS._sceneObjects->contains(&_greensGun))
_greensGun.remove();
@@ -4985,10 +5038,10 @@ void Scene370::signal() {
BF_GLOBALS._player._canWalk = false;
break;
case 3715:
- BF_GLOBALS._uiElements.addScore(50);
+ T2_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._walkRegions.disableRegion(3);
BF_GLOBALS._player.enableControl();
break;
case 3716:
@@ -5009,7 +5062,7 @@ void Scene370::signal() {
void Scene370::process(Event &event) {
SceneExt::process(event);
- if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (UI_INTERFACE_Y - 1))) {
// Check if the cursor is on an exit
if (_exit.contains(event.mousePos)) {
GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_E);
@@ -5079,7 +5132,7 @@ void Scene380::postInit(SceneObjectList *OwnerList) {
setZoomPercents(68, 80, 131, 100);
BF_GLOBALS._sound1.fadeSound(33);
- BF_GLOBALS._walkRegions.proc1(9);
+ BF_GLOBALS._walkRegions.disableRegion(9);
_door.postInit();
_door.setVisage(380);
@@ -5103,13 +5156,13 @@ void Scene380::postInit(SceneObjectList *OwnerList) {
_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);
+ BF_GLOBALS._walkRegions.disableRegion(12);
+ BF_GLOBALS._walkRegions.disableRegion(18);
+ BF_GLOBALS._walkRegions.disableRegion(19);
+ BF_GLOBALS._walkRegions.disableRegion(20);
+ BF_GLOBALS._walkRegions.disableRegion(25);
+ BF_GLOBALS._walkRegions.disableRegion(26);
+ BF_GLOBALS._walkRegions.disableRegion(27);
} else if (BF_GLOBALS.getFlag(onDuty)) {
// Show on duty motorcycle
_vechile.setStrip(2);
@@ -5259,7 +5312,7 @@ bool Scene385::Door::startAction(CursorType action, Event &event) {
switch (action) {
case CURSOR_USE:
- BF_GLOBALS._walkRegions.proc2(6);
+ BF_GLOBALS._walkRegions.enableRegion(6);
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 3850;
scene->setAction(&scene->_sequenceManager, scene, 3850, &BF_GLOBALS._player, this, NULL);
@@ -5272,8 +5325,7 @@ bool Scene385::Door::startAction(CursorType action, Event &event) {
bool Scene385::Jim::startAction(CursorType action, Event &event) {
Scene385 *scene = (Scene385 *)BF_GLOBALS._sceneManager._scene;
- switch (action) {
- case CURSOR_TALK:
+ if (action == CURSOR_TALK) {
if (scene->_jimFlag) {
scene->_talkAction = 3867;
scene->setAction(&scene->_action1);
@@ -5297,24 +5349,24 @@ bool Scene385::Jim::startAction(CursorType action, Event &event) {
break;
}
- scene->_jimFlag = 1;
+ scene->_jimFlag = true;
scene->setAction(&scene->_action1);
}
return true;
- case INV_PRINT_OUT:
+ } else if (action == INV_PRINT_OUT) {
if (!BF_GLOBALS.getFlag(fGotPointsForMCard)) {
- BF_GLOBALS._uiElements.addScore(30);
- BF_GLOBALS.getFlag(fGotPointsForMCard);
+ T2_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(fGotPointsForMCard);
scene->setAction(&scene->_action2);
return true;
- }
- break;
- default:
- break;
- }
-
- return NamedObject::startAction(action, event);
+ } else
+ return false;
+ } else if (action < CURSOR_WALK)
+ // Any other inventory item
+ return false;
+ else
+ return NamedObject::startAction(action, event);
}
bool Scene385::Dezi::startAction(CursorType action, Event &event) {
@@ -5385,7 +5437,8 @@ bool Scene385::Exit::startAction(CursorType action, Event &event) {
Scene385::Scene385(): SceneExt() {
- _talkAction = _jimFlag = 0;
+ _talkAction = 0;
+ _jimFlag = false;
}
void Scene385::synchronize(Serializer &s) {
@@ -5440,7 +5493,7 @@ void Scene385::postInit(SceneObjectList *OwnerList) {
_door.setPosition(Common::Point(107, 27));
_door.setDetails(385, 0, -1, -1, 1, NULL);
- BF_GLOBALS._walkRegions.proc1(6);
+ BF_GLOBALS._walkRegions.disableRegion(6);
if (BF_GLOBALS._sceneManager._previousScene == 390) {
BF_GLOBALS._player.setPosition(Common::Point(109, 119));
@@ -5471,7 +5524,7 @@ void Scene385::signal() {
void Scene385::process(Event &event) {
SceneExt::process(event);
- if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (UI_INTERFACE_Y - 1))) {
// Check if the cursor is on an exit
if (_exit.contains(event.mousePos)) {
GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW);
@@ -5599,7 +5652,7 @@ bool Scene390::Green::startAction(CursorType action, Event &event) {
if (BF_GLOBALS.getFlag(readGreenRights)) {
SceneItem::display2(390, 15);
} else {
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
BF_GLOBALS.setFlag(readGreenRights);
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 3904;
@@ -5725,7 +5778,7 @@ bool Scene390::GangMember1::startAction(CursorType action, Event &event) {
SceneItem::display2(390, 15);
} else {
BF_GLOBALS.setFlag(readFrankRights);
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 3904;
@@ -5749,7 +5802,7 @@ bool Scene390::GangMember2::startAction(CursorType action, Event &event) {
if (BF_GLOBALS.getFlag(readFrankRights)) {
SceneItem::display2(390, 15);
} else {
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
BF_GLOBALS.setFlag(readFrankRights);
BF_GLOBALS._player.disableControl();
@@ -5900,7 +5953,7 @@ void Scene390::signal() {
BF_GLOBALS._player.enableControl();
break;
case 3905:
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
_object2.remove();
BF_INVENTORY.setObjectScene(INV_HANDCUFFS, 1);
BF_GLOBALS._player.enableControl();
diff --git a/engines/tsage/blue_force/blueforce_scenes3.h b/engines/tsage/blue_force/blueforce_scenes3.h
index 86150433fd..ea9d5f7311 100644
--- a/engines/tsage/blue_force/blueforce_scenes3.h
+++ b/engines/tsage/blue_force/blueforce_scenes3.h
@@ -94,7 +94,7 @@ class Scene300: public SceneExt {
virtual void signal();
};
private:
- void setup();
+ void setupInspection();
public:
SequenceManager _sequenceManager1, _sequenceManager2;
SequenceManager _sequenceManager3, _sequenceManager4;
@@ -213,9 +213,9 @@ public:
int _field1390;
int _stripNumber;
int _field1398;
- int _field1B60, _field1B62, _field1B64;
- int _field1B66, _field1B6C, _field139C;
- bool _field1B68, _field1B6A;
+ int _invGreenCount, _bookGreenCount, _invGangCount;
+ int _bookGangCount, _field1B6C, _field139C;
+ bool _field1B68, _doorOpened;
CursorType _currentCursor;
Scene315();
@@ -363,7 +363,7 @@ public:
ASoundExt _sound1, _sound2;
TimerExt _timer1;
Timer2 _timer2;
- int _seqNumber1, _field2652, _field2654;
+ int _seqNumber1, _womanDialogCount, _backupPresent;
Scene340();
virtual void synchronize(Serializer &s);
@@ -432,7 +432,7 @@ public:
class Scene350: public SceneExt {
/* Items */
- class Item5: public NamedHotspot {
+ class FireBox: public NamedHotspot {
public:
virtual bool startAction(CursorType action, Event &event);
};
@@ -454,7 +454,7 @@ class Scene350: public SceneExt {
public:
virtual bool startAction(CursorType action, Event &event);
};
- class Object5: public NamedObject {
+ class FireboxInset: public FocusObject {
public:
virtual bool startAction(CursorType action, Event &event);
};
@@ -470,9 +470,9 @@ public:
SceneObject _yachtDoor;
BackgroundSceneObject _yachtBody;
Hook _hook;
- Object5 _object5;
+ FireboxInset _fireBoxInset;
NamedHotspot _item1, _item2, _item3, _item4;
- Item5 _item5;
+ FireBox _fireBox;
Yacht _yacht;
SouthWestExit _swExit;
SpeakerGameText _gameTextSpeaker;
@@ -505,7 +505,7 @@ class Scene355: public PalettedScene {
public:
virtual bool startAction(CursorType action, Event &event);
};
- class LockerDoor: public NamedObject {
+ class LockerInset: public FocusObject {
public:
virtual bool startAction(CursorType action, Event &event);
};
@@ -513,11 +513,11 @@ class Scene355: public PalettedScene {
public:
virtual bool startAction(CursorType action, Event &event);
};
- class Object6: public NamedObjectExt {
+ class Green: public NamedObjectExt {
public:
virtual bool startAction(CursorType action, Event &event);
};
- class Object7: public NamedObjectExt {
+ class Lyle: public NamedObjectExt {
public:
virtual bool startAction(CursorType action, Event &event);
};
@@ -543,7 +543,7 @@ class Scene355: public PalettedScene {
public:
virtual bool startAction(CursorType action, Event &event);
};
- class Item5: public NamedHotspot {
+ class Pouch: public NamedHotspot {
public:
virtual bool startAction(CursorType action, Event &event);
};
@@ -551,7 +551,7 @@ class Scene355: public PalettedScene {
public:
virtual bool startAction(CursorType action, Event &event);
};
- class Item12: public NamedHotspot {
+ class RentalExit: public NamedHotspot {
public:
virtual bool startAction(CursorType action, Event &event);
};
@@ -576,21 +576,21 @@ public:
NamedObject _harrison;
Doorway _doorway;
Locker _locker;
- LockerDoor _lockerDoor;
+ LockerInset _lockerInset;
Object5 _object5;
- Object6 _object6;
- Object7 _object7;
+ Green _green;
+ Lyle _lyle;
Object8 _object8;
NamedObject _object9, _object10, _object11;
Item1 _item1;
Item2 _item2;
Item3 _item3;
Item4 _item4;
- Item5 _item5;
+ Pouch _pouch;
NamedHotspot _item6, _item7, _item8;
NamedHotspot _item9, _item10;
Item11 _item11;
- Item12 _item12;
+ RentalExit _rentalExit;
ASoundExt _sound1, _sound2, _sound3;
Action1 _action1;
Action2 _action2;
@@ -621,11 +621,11 @@ class Scene360: public SceneExt {
public:
virtual bool startAction(CursorType action, Event &event);
};
- class BsseballCards: public NamedObject {
+ class BaseballCards: public NamedObject {
public:
virtual bool startAction(CursorType action, Event &event);
};
- class Object6: public NamedObject {
+ class Harrison: public NamedObject {
public:
virtual bool startAction(CursorType action, Event &event);
};
@@ -667,8 +667,8 @@ public:
SceneObject _object2;
Window _window;
Object4 _object4;
- BsseballCards _baseballCards;
- Object6 _object6;
+ BaseballCards _baseballCards;
+ Harrison _harrison;
Object7 _object7;
Item1 _item1;
Item2 _item2;
@@ -676,9 +676,7 @@ public:
Barometer _barometer;
Action1 _action1;
ASound _sound1;
- int _field380;
- Scene360();
virtual void synchronize(Serializer &s);
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void signal();
@@ -815,7 +813,8 @@ public:
SpeakerJake385 _jake385Speaker;
NamedHotspot _item1, _item2, _item3, _item4, _item5;
Exit _exit;
- int _talkAction, _jimFlag;
+ int _talkAction;
+ bool _jimFlag;
Scene385();
virtual void synchronize(Serializer &s);
diff --git a/engines/tsage/blue_force/blueforce_scenes4.cpp b/engines/tsage/blue_force/blueforce_scenes4.cpp
index 07445a7e76..deff4f2518 100644
--- a/engines/tsage/blue_force/blueforce_scenes4.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes4.cpp
@@ -35,6 +35,7 @@ namespace BlueForce {
*
*--------------------------------------------------------------------------*/
+// Talk to driver with backup
void Scene410::Action1::signal() {
Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene;
@@ -62,11 +63,12 @@ void Scene410::Action1::signal() {
}
}
+// Talk to passenger with backup
void Scene410::Action2::signal() {
Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene;
BF_GLOBALS._player.disableControl();
- switch (scene->_field1FB8++) {
+ switch (scene->_talkCount++) {
case 0:
scene->_sceneMode = 4105;
scene->_stripManager.start(BF_GLOBALS.getFlag(fTalkedShooterNoBkup) ? 4123 : 4107, scene);
@@ -90,7 +92,7 @@ void Scene410::Action2::signal() {
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_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_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();
@@ -98,12 +100,13 @@ void Scene410::Action2::signal() {
}
}
+// Talk to passenger without backup
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);
+ scene->setAction(&scene->_sequenceManager1, scene, 4102, &scene->_passenger, &BF_GLOBALS._player, NULL);
} else {
BF_GLOBALS.setFlag(fTalkedShooterNoBkup);
scene->_sceneMode = 0;
@@ -111,36 +114,23 @@ void Scene410::Action3::signal() {
}
}
+// Talk to driver without backup
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;
+ if (BF_GLOBALS.getFlag(fTalkedDriverNoBkup)) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2;
+ scene->setAction(&scene->_sequenceManager1, scene, 4120, &scene->_passenger, &BF_GLOBALS._player, NULL);
+ } else {
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS.setFlag(fTalkedDriverNoBkup);
+ scene->_sceneMode = 4101;
+ scene->_stripManager.start(4103, scene);
}
}
+// Talk to passenger
void Scene410::Action5::signal() {
Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene;
@@ -153,7 +143,7 @@ void Scene410::Action5::signal() {
}
break;
case 1:
- BF_GLOBALS._player.updateAngle(scene->_object2._position);
+ BF_GLOBALS._player.updateAngle(scene->_passenger._position);
setDelay(3);
break;
case 2:
@@ -171,6 +161,7 @@ void Scene410::Action5::signal() {
}
}
+// Talk to driver
void Scene410::Action6::signal() {
Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene;
@@ -183,7 +174,7 @@ void Scene410::Action6::signal() {
}
break;
case 1:
- BF_GLOBALS._player.updateAngle(scene->_object1._position);
+ BF_GLOBALS._player.updateAngle(scene->_driver._position);
setDelay(3);
break;
case 2:
@@ -222,11 +213,11 @@ void Scene410::Action7::signal() {
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);
+ setAction(&scene->_sequenceManager1, this, 4112, &scene->_driver, &scene->_passenger,
+ &scene->_harrison, NULL);
break;
case 5:
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
setAction(&scene->_sequenceManager1, this, 4118, &BF_GLOBALS._player, NULL);
BF_GLOBALS._player.disableControl();
break;
@@ -241,7 +232,7 @@ void Scene410::Action7::signal() {
/*--------------------------------------------------------------------------*/
-bool Scene410::Item2::startAction(CursorType action, Event &event) {
+bool Scene410::Motorcycle::startAction(CursorType action, Event &event) {
Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene;
switch (action) {
@@ -249,7 +240,7 @@ bool Scene410::Item2::startAction(CursorType action, Event &event) {
if (!BF_GLOBALS.getFlag(fCalledBackup)) {
scene->_sceneMode = 4103;
scene->signal();
- } else if (BF_GLOBALS.getFlag(fSearchedTruck) && !BF_GLOBALS._sceneObjects->contains(&scene->_object3)) {
+ } else if (BF_GLOBALS.getFlag(fSearchedTruck) && !BF_GLOBALS._sceneObjects->contains(&scene->_harrison)) {
scene->_sceneMode = 4103;
scene->signal();
} else if (scene->_field1FBC != 0) {
@@ -264,7 +255,7 @@ bool Scene410::Item2::startAction(CursorType action, Event &event) {
}
}
-bool Scene410::Item4::startAction(CursorType action, Event &event) {
+bool Scene410::TruckFront::startAction(CursorType action, Event &event) {
Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene;
switch (action) {
@@ -274,7 +265,7 @@ bool Scene410::Item4::startAction(CursorType action, Event &event) {
else if (BF_GLOBALS.getFlag(fSearchedTruck))
SceneItem::display2(410, 13);
else if (BF_GLOBALS.getFlag(fGangInCar)) {
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
scene->_sceneMode = 4118;
scene->signal();
} else {
@@ -291,7 +282,7 @@ bool Scene410::Item4::startAction(CursorType action, Event &event) {
/*--------------------------------------------------------------------------*/
-bool Scene410::Object1::startAction(CursorType action, Event &event) {
+bool Scene410::Driver::startAction(CursorType action, Event &event) {
Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene;
switch (action) {
@@ -307,7 +298,7 @@ bool Scene410::Object1::startAction(CursorType action, Event &event) {
} else if (!scene->_field1FC0) {
scene->_sceneMode = 4124;
scene->_field1FC0 = 1;
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
scene->signal();
} else {
break;
@@ -318,14 +309,14 @@ bool Scene410::Object1::startAction(CursorType action, Event &event) {
return true;
case INV_HANDCUFFS:
if (BF_GLOBALS.getFlag(fCalledBackup)) {
- if ((scene->_field1FB8 < 5) || (scene->_field1FB6 < 1) || (scene->_field1FBC != 0))
+ if ((scene->_talkCount < 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);
+ T2_GLOBALS._uiElements.addScore(30);
} else {
if (BF_GLOBALS.getFlag(fTalkedDriverNoBkup)) {
scene->setAction(&scene->_action4);
@@ -340,15 +331,15 @@ bool Scene410::Object1::startAction(CursorType action, Event &event) {
} else if (!scene->_field1FC4) {
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 2;
- scene->setAction(&scene->_sequenceManager1, scene, 4120, &scene->_object2, &BF_GLOBALS._player, NULL);
+ scene->setAction(&scene->_sequenceManager1, scene, 4120, &scene->_passenger, &BF_GLOBALS._player, NULL);
} else if ((scene->_field1FBC != 0) || (scene->_field1FC2 != 0)) {
break;
} else {
scene->_field1FC2 = 1;
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 4127;
- scene->setAction(&scene->_sequenceManager1, scene, 4127, &scene->_object1, NULL);
+ scene->setAction(&scene->_sequenceManager1, scene, 4127, &BF_GLOBALS._player, &scene->_driver, NULL);
}
return true;
case INV_MIRANDA_CARD:
@@ -359,12 +350,12 @@ bool Scene410::Object1::startAction(CursorType action, Event &event) {
SceneItem::display2(390, 15);
} else {
BF_GLOBALS.setFlag(readFrankRights);
- BF_GLOBALS._uiElements.addScore(30);
+ T2_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);
+ scene->setAction(&scene->_sequenceManager1, scene, 4126, &BF_GLOBALS._player, &scene->_driver, NULL);
}
return true;
default:
@@ -374,39 +365,47 @@ bool Scene410::Object1::startAction(CursorType action, Event &event) {
return NamedObject::startAction(action, event);
}
-bool Scene410::Object2::startAction(CursorType action, Event &event) {
+bool Scene410::Passenger::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)) {
+ if (BF_GLOBALS.getFlag(fTalkedShooterNoBkup))
scene->setAction(&scene->_action3);
- } else {
- SceneItem::display2(410, 5);
- }
+ else
+ SceneItem::display(410, 5, SET_WIDTH, 300,
+ SET_X, 10 + GLOBALS._sceneManager._scene->_sceneBounds.left,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 96, SET_EXT_BGCOLOR, 99,
+ SET_EXT_FGCOLOR, 13, LIST_END);
} else if (!scene->_field1FBA) {
- SceneItem::display2(410, 5);
+ SceneItem::display(410, 5, SET_WIDTH, 300,
+ SET_X, 10 + GLOBALS._sceneManager._scene->_sceneBounds.left,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 96, SET_EXT_BGCOLOR, 99,
+ SET_EXT_FGCOLOR, 13, LIST_END);
} else if (!scene->_field1FBE) {
scene->_sceneMode = 4121;
scene->_field1FBE = 1;
- BF_GLOBALS._uiElements.addScore(50);
+ T2_GLOBALS._uiElements.addScore(50);
scene->signal();
- } else {
+ } 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))
+ if ((scene->_talkCount < 5) || (scene->_field1FBA != 0))
break;
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 9;
- ADD_PLAYER_MOVER(195, 139);
+ Common::Point destPos(195, 139);
+ PlayerMover *mover = new PlayerMover();
+ BF_GLOBALS._player.addMover(mover, &destPos, scene);
} else if (BF_GLOBALS.getFlag(fTalkedShooterNoBkup)) {
scene->setAction(&scene->_action3);
} else {
@@ -421,12 +420,12 @@ bool Scene410::Object2::startAction(CursorType action, Event &event) {
SceneItem::display2(390, 15);
} else {
BF_GLOBALS.setFlag(readFrankRights);
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 0;
scene->setAction(&scene->_sequenceManager1, scene, 4125, &BF_GLOBALS._player,
- &scene->_object2, NULL);
+ &scene->_passenger, NULL);
}
return true;
default:
@@ -436,7 +435,7 @@ bool Scene410::Object2::startAction(CursorType action, Event &event) {
return NamedObject::startAction(action, event);
}
-bool Scene410::Object3::startAction(CursorType action, Event &event) {
+bool Scene410::Harrison::startAction(CursorType action, Event &event) {
Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene;
switch (action) {
@@ -445,9 +444,16 @@ bool Scene410::Object3::startAction(CursorType action, Event &event) {
if (BF_GLOBALS.getFlag(fSearchedTruck)) {
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 8;
- ADD_PLAYER_MOVER(147, 143);
+
+ Common::Point destPos(147, 143);
+ PlayerMover *mover = new PlayerMover();
+ BF_GLOBALS._player.addMover(mover, &destPos, scene);
} else {
- SceneItem::display2(350, 13);
+ SceneItem::display(350, 13, SET_WIDTH, 300,
+ SET_X, 10 + GLOBALS._sceneManager._scene->_sceneBounds.left,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 32, SET_EXT_BGCOLOR, 49,
+ SET_EXT_FGCOLOR, 13, LIST_END);
}
} else if ((scene->_field1FBA != 0) && (scene->_field1FBC != 0)) {
BF_GLOBALS._player.disableControl();
@@ -457,16 +463,17 @@ bool Scene410::Object3::startAction(CursorType action, Event &event) {
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);
+ (!scene->_field1FBA && (scene->_talkCount < 5))) {
+ SceneItem::display(350, 13, SET_WIDTH, 300,
+ SET_X, 10 + GLOBALS._sceneManager._scene->_sceneBounds.left,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 32, SET_EXT_BGCOLOR, 49,
+ SET_EXT_FGCOLOR, 13, LIST_END);
} 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);
+ BF_GLOBALS._walkRegions.enableRegion(22);
scene->_sceneMode = 4122;
scene->_stripManager.start(4112, scene);
} else if (scene->_field1FB6 < 1) {
@@ -477,7 +484,7 @@ bool Scene410::Object3::startAction(CursorType action, Event &event) {
BF_GLOBALS._player.disableControl();
scene->_field1FBC = 1;
scene->_field1FC0 = 1;
- BF_GLOBALS._walkRegions.proc2(22);
+ BF_GLOBALS._walkRegions.enableRegion(22);
scene->_sceneMode = 4109;
scene->_stripManager.start(4112, scene);
}
@@ -493,14 +500,14 @@ bool Scene410::Object3::startAction(CursorType action, Event &event) {
/*--------------------------------------------------------------------------*/
Scene410::Scene410(): SceneExt() {
- _field1FB6 = _field1FB8 = _field1FBA = _field1FBC = 0;
+ _field1FB6 = _talkCount = _field1FBA = _field1FBC = 0;
_field1FBE = _field1FC0 = _field1FC2 = _field1FC4 = 0;
}
void Scene410::synchronize(Serializer &s) {
SceneExt::synchronize(s);
s.syncAsSint16LE(_field1FB6);
- s.syncAsSint16LE(_field1FB8);
+ s.syncAsSint16LE(_talkCount);
s.syncAsSint16LE(_field1FBA);
s.syncAsSint16LE(_field1FBC);
s.syncAsSint16LE(_field1FBE);
@@ -524,6 +531,7 @@ void Scene410::postInit(SceneObjectList *OwnerList) {
_stripManager.addSpeaker(&_jakeUniformSpeaker);
_stripManager.addSpeaker(&_harrisonSpeaker);
_stripManager.addSpeaker(&_shooterSpeaker);
+ _stripManager.addSpeaker(&_driverSpeaker);
BF_GLOBALS._player.postInit();
BF_GLOBALS._player.setVisage(1341);
@@ -533,20 +541,20 @@ void Scene410::postInit(SceneObjectList *OwnerList) {
BF_GLOBALS._player.setPosition(Common::Point(114, 133));
BF_GLOBALS._player.changeZoom(-1);
- _item2.setDetails(8, 410, 15, -1, -1, 1);
+ _motorcycle.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);
+ _passenger.postInit();
+ _passenger.setVisage(415);
+ _passenger.setStrip(1);
+ _passenger.setPosition(Common::Point(278, 92));
+ _passenger.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);
+ _driver.postInit();
+ _driver.setVisage(416);
+ _driver.setStrip(2);
+ _driver.setPosition(Common::Point(244, 85));
+ _driver.setDetails(410, 6, -1, 7, 1, NULL);
+ _driver.changeZoom(-1);
_object5.postInit();
_object5.setVisage(410);
@@ -558,32 +566,32 @@ void Scene410::postInit(SceneObjectList *OwnerList) {
_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);
+ _truckFront.setDetails(6, 410, 3, -1, -1, 1);
+ _truckBack.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));
+ _passenger.remove();
+ _driver.remove();
+ BF_GLOBALS._walkRegions.disableRegion(21);
+ BF_GLOBALS._walkRegions.disableRegion(22);
+
+ _harrison.postInit();
+ _harrison.setVisage(343);
+ _harrison.setObjectWrapper(new SceneObjectWrapper());
+ _harrison.animate(ANIM_MODE_1, NULL);
+ _harrison.setDetails(350, 12, 13, 14, 1, NULL);
+ _harrison.setPosition(Common::Point(97, 185));
+ _harrison.changeZoom(-1);
+
+ _patrolCar.postInit();
+ _patrolCar.setVisage(410);
+ _patrolCar.setDetails(410, 8, 9, 10, 1, NULL);
+ _patrolCar.fixPriority(148);
+ _patrolCar.setPosition(Common::Point(39, 168));
_field1FC4 = 1;
_sceneMode = 0;
@@ -591,62 +599,62 @@ void Scene410::postInit(SceneObjectList *OwnerList) {
break;
case 60:
if (BF_GLOBALS.getFlag(fSearchedTruck)) {
- _object2.remove();
- _object1.remove();
+ _passenger.remove();
+ _driver.remove();
_sceneMode = 0;
} else {
_field1FC4 = BF_GLOBALS._v50CC8;
_field1FBA = BF_GLOBALS._v50CC2;
- _field1FB8 = BF_GLOBALS._v50CC6;
+ _talkCount = BF_GLOBALS._v50CC6;
_field1FB6 = BF_GLOBALS._v50CC4;
- _object2.setVisage(418);
- _object2.setStrip(6);
- _object2.setPosition(Common::Point(227, 137));
+ _passenger.setVisage(418);
+ _passenger.setStrip(6);
+ _passenger.setPosition(Common::Point(227, 137));
- if (_field1FB8 > 0) {
- _object2.setVisage(415);
- _object2.setStrip(2);
- _object2.setFrame(5);
+ if (_talkCount > 0) {
+ _passenger.setVisage(415);
+ _passenger.setStrip(2);
+ _passenger.setFrame(5);
}
if (_field1FBA) {
- _object2.setVisage(415);
- _object2.setStrip(6);
- _object2.setFrame(8);
+ _passenger.setVisage(415);
+ _passenger.setStrip(6);
+ _passenger.setFrame(8);
}
- BF_GLOBALS._walkRegions.proc1(16);
+ BF_GLOBALS._walkRegions.disableRegion(16);
if (BF_GLOBALS.getFlag(fDriverOutOfTruck)) {
- _object1.setVisage(417);
- _object1.setStrip(1);
- _object1.setPosition(Common::Point(152, 97));
+ _driver.setVisage(417);
+ _driver.setStrip(1);
+ _driver.setPosition(Common::Point(152, 97));
- BF_GLOBALS._walkRegions.proc1(7);
+ BF_GLOBALS._walkRegions.disableRegion(7);
}
if (BF_GLOBALS.getFlag(fCalledBackup)) {
- BF_GLOBALS._walkRegions.proc1(21);
- BF_GLOBALS._walkRegions.proc1(22);
+ BF_GLOBALS._walkRegions.disableRegion(21);
+ BF_GLOBALS._walkRegions.disableRegion(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);
+ _harrison.postInit();
+ _harrison.setVisage(343);
+ _harrison.setObjectWrapper(new SceneObjectWrapper());
+ _harrison.animate(ANIM_MODE_1, NULL);
+ _harrison.setDetails(350, 12, 13, 14, 1, NULL);
+ BF_GLOBALS._sceneItems.addBefore(&_driver, &_harrison);
- _object3.setPosition(Common::Point(-10, 124));
- _object3.changeZoom(-1);
+ _harrison.setPosition(Common::Point(-10, 124));
+ _harrison.changeZoom(-1);
- _object4.postInit();
- _object4.setVisage(410);
- _object4.setDetails(410, 8, 9, 10, 1, NULL);
- _object4.fixPriority(148);
+ _patrolCar.postInit();
+ _patrolCar.setVisage(410);
+ _patrolCar.setDetails(410, 8, 9, 10, 1, NULL);
+ _patrolCar.fixPriority(148);
if (_field1FC4) {
- _object3.setPosition(Common::Point(108, 112));
- _object4.fixPriority(148);
- _object4.setPosition(Common::Point(39, 168));
+ _harrison.setPosition(Common::Point(108, 112));
+ _patrolCar.fixPriority(148);
+ _patrolCar.setPosition(Common::Point(39, 168));
_sceneMode = 0;
} else {
@@ -669,7 +677,7 @@ void Scene410::postInit(SceneObjectList *OwnerList) {
signal();
- _item1.setDetails(Rect(0, 0, SCREEN_WIDTH, BF_INTERFACE_Y), 410, 0, 1, 2, 1, NULL);
+ _background.setDetails(Rect(0, 0, SCREEN_WIDTH, UI_INTERFACE_Y), 410, 0, 1, 2, 1, NULL);
}
void Scene410::signal() {
@@ -680,7 +688,7 @@ void Scene410::signal() {
BF_GLOBALS._v50CC8 = _field1FC4;
BF_GLOBALS._v50CC2 = _field1FBA;
- BF_GLOBALS._v50CC6 = _field1FB8;
+ BF_GLOBALS._v50CC6 = _talkCount;
BF_GLOBALS._v50CC4 = _field1FB6;
BF_GLOBALS._sceneManager.changeScene(60);
break;
@@ -709,12 +717,13 @@ void Scene410::signal() {
break;
case 7:
BF_INVENTORY.setObjectScene(INV_TYRONE_ID, 1);
+ _sceneMode = 0;
signal();
break;
case 8:
- BF_GLOBALS._walkRegions.proc2(22);
+ BF_GLOBALS._walkRegions.enableRegion(22);
BF_GLOBALS._player.changeAngle(225);
- _object3.changeAngle(45);
+ _harrison.changeAngle(45);
_sceneMode = 4114;
_stripManager.start(4120, this);
break;
@@ -723,74 +732,82 @@ void Scene410::signal() {
_stripManager.start(4111, this);
_field1FBA = 1;
BF_GLOBALS.setFlag(fCuffedFrankie);
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
break;
case 10:
- BF_GLOBALS._player.updateAngle(_object3._position);
+ BF_GLOBALS._player.updateAngle(_harrison._position);
_sceneMode = 0;
break;
case 4100:
BF_GLOBALS._player.disableControl();
_sceneMode = 0;
- setAction(&_sequenceManager1, this, 4100, &_object2, &_object5, NULL);
- BF_GLOBALS._walkRegions.proc1(16);
+ setAction(&_sequenceManager1, this, 4100, &_passenger, &_object5, NULL);
+ BF_GLOBALS._walkRegions.disableRegion(16);
break;
case 4101:
+ // Driver gets out of the car
BF_GLOBALS._player.disableControl();
_sceneMode = 0;
- setAction(&_sequenceManager1, this, 4100, &_object1, &_object6, NULL);
+ setAction(&_sequenceManager1, this, 4101, &_driver, &_object6, NULL);
BF_GLOBALS.setFlag(fDriverOutOfTruck);
- BF_GLOBALS._walkRegions.proc1(7);
+ BF_GLOBALS._walkRegions.disableRegion(7);
break;
case 4103:
+ // Click on moto to ask for backup
BF_GLOBALS._player.disableControl();
_sceneMode = 1;
setAction(&_sequenceManager1, this, 4103, &BF_GLOBALS._player, NULL);
break;
case 4104:
+ // After call for backup, patrol car is coming
_field1FC4 = 1;
BF_GLOBALS._player.disableControl();
_sceneMode = 0;
- setAction(&_sequenceManager1, this, 4104, &_object4, &_object3, NULL);
+ setAction(&_sequenceManager1, this, 4104, &_patrolCar, &_harrison, NULL);
break;
case 4105:
+ // Second guy gets nervous
BF_GLOBALS._player.disableControl();
_sceneMode = 0;
- setAction(&_sequenceManager1, this, 4105, &_object2, NULL);
+ setAction(&_sequenceManager1, this, 4105, &_passenger, NULL);
+ break;
case 4106:
BF_GLOBALS._player.disableControl();
_sceneMode = 4119;
- setAction(&_sequenceManager1, this, 4106, &_object2, NULL);
+ setAction(&_sequenceManager1, this, 4106, &_passenger, NULL);
break;
case 4107:
BF_GLOBALS._player.disableControl();
_sceneMode = 5;
- setAction(&_sequenceManager1, this, 4107, &_object2, NULL);
+ setAction(&_sequenceManager1, this, 4107, &BF_GLOBALS._player, &_passenger, 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._walkRegions.enableRegion(22);
+ BF_GLOBALS._walkRegions.enableRegion(7);
+ BF_GLOBALS._walkRegions.enableRegion(16);
BF_GLOBALS._player.disableControl();
_sceneMode = 0;
- setAction(&_sequenceManager1, this, 4108, &_object3, NULL);
+ setAction(&_sequenceManager1, this, 4108, &_harrison, NULL);
break;
case 4109:
+ // Harrison puts handcuffs to driver
if ((BF_GLOBALS._player._position.x > 116) && (BF_GLOBALS._player._position.x != 195) &&
(BF_GLOBALS._player._position.y != 139)) {
- ADD_PLAYER_MOVER(195, 139);
+ ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, 195, 139);
}
- BF_GLOBALS._walkRegions.proc2(22);
+ BF_GLOBALS._walkRegions.enableRegion(22);
BF_GLOBALS._player.disableControl();
_sceneMode = 0;
- setAction(&_sequenceManager1, this, 4109, &_object1, &_object3, NULL);
+ setAction(&_sequenceManager1, this, 4109, &_driver, &_harrison, NULL);
break;
case 4110:
+ // Harrisson takes care of the driver
BF_GLOBALS._player.disableControl();
_sceneMode = 0;
- setAction(&_sequenceManager1, this, 4110, &_object3, &_object1, NULL);
+ setAction(&_sequenceManager1, this, 4110, &_harrison, &_driver, NULL);
break;
case 4112:
BF_GLOBALS.setFlag(fGangInCar);
@@ -798,21 +815,21 @@ void Scene410::signal() {
BF_GLOBALS._player.updateAngle(Common::Point(100, 170));
BF_GLOBALS._player.disableControl();
_sceneMode = 4108;
- setAction(&_sequenceManager1, this, 4112, &_object1, &_object2, &_object3, NULL);
+ setAction(&_sequenceManager1, this, 4112, &_driver, &_passenger, &_harrison, NULL);
break;
case 4114:
- BF_GLOBALS._walkRegions.proc2(22);
+ BF_GLOBALS._walkRegions.enableRegion(22);
BF_GLOBALS._player.disableControl();
_sceneMode = 4116;
- setAction(&_sequenceManager1, this, 4114, &_object3, &_object4, NULL);
+ setAction(&_sequenceManager1, this, 4114, &_harrison, &_patrolCar, NULL);
break;
case 4116:
- BF_GLOBALS._walkRegions.proc2(21);
- BF_GLOBALS._walkRegions.proc2(22);
- _object3.remove();
+ BF_GLOBALS._walkRegions.enableRegion(21);
+ BF_GLOBALS._walkRegions.enableRegion(22);
+ _harrison.remove();
BF_GLOBALS._player.disableControl();
_sceneMode = 0;
- setAction(&_sequenceManager1, this, 4116, &_object4, NULL);
+ setAction(&_sequenceManager1, this, 4116, &_patrolCar, NULL);
break;
case 4118:
BF_GLOBALS._player.disableControl();
@@ -822,30 +839,30 @@ void Scene410::signal() {
case 4119:
BF_GLOBALS._player.disableControl();
_sceneMode = 4107;
- setAction(&_sequenceManager1, this, 4119, &_object2, NULL);
+ setAction(&_sequenceManager1, this, 4119, &BF_GLOBALS._player, &_passenger, NULL);
break;
case 4121:
BF_GLOBALS._player.disableControl();
_sceneMode = 6;
- setAction(&_sequenceManager1, this, 4121, &BF_GLOBALS._player, &_object2, NULL);
+ setAction(&_sequenceManager1, this, 4121, &BF_GLOBALS._player, &_passenger, NULL);
break;
case 4122:
- BF_GLOBALS._walkRegions.proc2(22);
+ BF_GLOBALS._walkRegions.enableRegion(22);
BF_INVENTORY.setObjectScene(INV_22_SNUB, 0);
BF_GLOBALS._player.disableControl();
_sceneMode = 0;
- setAction(&_sequenceManager1, this, 4122, &_object2, &_object3, NULL);
+ setAction(&_sequenceManager1, this, 4122, &_passenger, &_harrison, 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);
+ setAction(&_sequenceManager1, this, 4123, &_driver, &BF_GLOBALS._player, NULL);
break;
case 4124:
BF_GLOBALS._player.disableControl();
_sceneMode = 7;
- setAction(&_sequenceManager1, this, 4124, &_object1, &BF_GLOBALS._player, NULL);
+ setAction(&_sequenceManager1, this, 4124, &_driver, &BF_GLOBALS._player, NULL);
break;
case 4127:
SceneItem::display2(410, 16);
@@ -867,14 +884,14 @@ void Scene410::process(Event &event) {
event.handled = true;
BF_GLOBALS._player.disableControl();
_sceneMode = 2;
- setAction(&_sequenceManager1, this, 4102, &_object2, &BF_GLOBALS._player, NULL);
+ setAction(&_sequenceManager1, this, 4102, &_passenger, &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);
+ setAction(&_sequenceManager1, this, 4120, &_passenger, &BF_GLOBALS._player, NULL);
}
}
}
@@ -886,7 +903,7 @@ void Scene410::process(Event &event) {
void Scene410::dispatch() {
SceneExt::dispatch();
if ((_sceneMode == 4112) || (_sceneMode == 4101)) {
- _object3.updateAngle(_object1._position);
+ _harrison.updateAngle(_driver._position);
}
}
@@ -911,6 +928,17 @@ bool Scene415::GunInset::startAction(CursorType action, Event &event) {
}
}
+void Scene415::GunInset::remove() {
+ Scene415 *scene = (Scene415 *)BF_GLOBALS._sceneManager._scene;
+
+ BF_GLOBALS._player.disableControl();
+ scene->_gunAndWig.remove();
+ FocusObject::remove();
+
+ scene->_sceneMode = 0;
+ scene->_animatedSeat.animate(ANIM_MODE_6, scene);
+}
+
bool Scene415::GunAndWig::startAction(CursorType action, Event &event) {
Scene415 *scene = (Scene415 *)BF_GLOBALS._sceneManager._scene;
@@ -920,19 +948,19 @@ bool Scene415::GunAndWig::startAction(CursorType action, Event &event) {
BF_INVENTORY.setObjectScene(INV_AUTO_RIFLE, 1);
BF_INVENTORY.setObjectScene(INV_WIG, 1);
BF_GLOBALS.setFlag(fGotAutoWeapon);
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
remove();
return true;
case INV_FOREST_RAP:
- if (scene->_fieldE14)
+ if (scene->_scoreWigRapFlag)
break;
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 0;
scene->_stripManager.start(4126, scene);
- BF_GLOBALS._uiElements.addScore(50);
- scene->_fieldE14 = true;
+ T2_GLOBALS._uiElements.addScore(50);
+ scene->_scoreWigRapFlag = true;
return true;
default:
break;
@@ -945,7 +973,7 @@ bool Scene415::BulletsInset::startAction(CursorType action, Event &event) {
Scene415 *scene = (Scene415 *)BF_GLOBALS._sceneManager._scene;
if (action == CURSOR_USE) {
- if (BF_GLOBALS.getFlag(fGotAutoWeapon)) {
+ if (BF_GLOBALS.getFlag(fGotBulletsFromDash)) {
FocusObject::startAction(action, event);
} else {
remove();
@@ -957,6 +985,13 @@ bool Scene415::BulletsInset::startAction(CursorType action, Event &event) {
}
}
+void Scene415::BulletsInset::remove() {
+ Scene415 *scene = (Scene415 *)BF_GLOBALS._sceneManager._scene;
+
+ scene->_theBullets.remove();
+ FocusObject::remove();
+}
+
bool Scene415::DashDrawer::startAction(CursorType action, Event &event) {
Scene415 *scene = (Scene415 *)BF_GLOBALS._sceneManager._scene;
@@ -976,23 +1011,22 @@ bool Scene415::TheBullets::startAction(CursorType action, Event &event) {
NamedObject::startAction(action, event);
BF_INVENTORY.setObjectScene(INV_22_BULLET, 1);
BF_GLOBALS.setFlag(fGotBulletsFromDash);
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
remove();
scene->_dashDrawer.remove();
return true;
case INV_FOREST_RAP:
- if (scene->_fieldE16) {
+ if (scene->_scoreBulletRapFlag) {
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;
+ T2_GLOBALS._uiElements.addScore(50);
+ scene->_scoreBulletRapFlag = true;
}
- break;
+ return true;
default:
break;
}
@@ -1012,7 +1046,7 @@ bool Scene415::Lever::startAction(CursorType action, Event &event) {
} else {
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 2;
- scene->setAction(&scene->_sequenceManager, scene, 4150, &scene->_object6, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 4150, &scene->_animatedSeat, NULL);
}
return true;
default:
@@ -1023,13 +1057,13 @@ bool Scene415::Lever::startAction(CursorType action, Event &event) {
/*--------------------------------------------------------------------------*/
Scene415::Scene415(): SceneExt() {
- _fieldE14 = _fieldE16 = false;
+ _scoreWigRapFlag = _scoreBulletRapFlag = false;
}
void Scene415::synchronize(Serializer &s) {
SceneExt::synchronize(s);
- s.syncAsSint16LE(_fieldE14);
- s.syncAsSint16LE(_fieldE16);
+ s.syncAsSint16LE(_scoreWigRapFlag);
+ s.syncAsSint16LE(_scoreBulletRapFlag);
}
void Scene415::postInit(SceneObjectList *OwnerList) {
@@ -1044,11 +1078,11 @@ void Scene415::postInit(SceneObjectList *OwnerList) {
_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);
+ _animatedSeat.postInit();
+ _animatedSeat.setVisage(419);
+ _animatedSeat.setStrip(1);
+ _animatedSeat.setPosition(Common::Point(306, 116));
+ _animatedSeat.fixPriority(80);
_windowLever.setDetails(16, 415, 25, -1, 26, 1);
_item7.setDetails(17, 415, 32, -1, 33, 1);
@@ -1058,7 +1092,7 @@ void Scene415::postInit(SceneObjectList *OwnerList) {
_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);
+ _item1.setDetails(Rect(0, 0, SCREEN_WIDTH, UI_INTERFACE_Y), 415, 0, 1, 2, 1, NULL);
BF_GLOBALS._player.enableControl();
BF_GLOBALS._player._canWalk = false;
@@ -1241,8 +1275,8 @@ void Scene440::postInit(SceneObjectList *OwnerList) {
_lyle.setPosition(Common::Point(135, 128));
_lyle.show();
- BF_GLOBALS._walkRegions.proc1(12);
- BF_GLOBALS._walkRegions.proc1(13);
+ BF_GLOBALS._walkRegions.disableRegion(12);
+ BF_GLOBALS._walkRegions.disableRegion(13);
} else {
_vechile.setPosition(Common::Point(169, 121));
_vechile.fixPriority(117);
@@ -1263,7 +1297,7 @@ void Scene440::postInit(SceneObjectList *OwnerList) {
}
BF_GLOBALS._sceneItems.push_back(&_vechile);
- BF_GLOBALS._walkRegions.proc1(11);
+ BF_GLOBALS._walkRegions.disableRegion(11);
_doorway.postInit();
_doorway.setVisage(440);
@@ -1287,7 +1321,7 @@ void Scene440::postInit(SceneObjectList *OwnerList) {
BF_GLOBALS._player.enableControl();
}
- _item1.setBounds(Rect(0, 0, SCREEN_WIDTH, BF_INTERFACE_Y - 1));
+ _item1.setBounds(Rect(0, 0, SCREEN_WIDTH, UI_INTERFACE_Y - 1));
BF_GLOBALS._sceneItems.push_back(&_item1);
}
@@ -1314,7 +1348,7 @@ void Scene440::signal() {
*
*--------------------------------------------------------------------------*/
-bool Scene450::Object1::startAction(CursorType action, Event &event) {
+bool Scene450::Weasel::startAction(CursorType action, Event &event) {
Scene450 *scene = (Scene450 *)BF_GLOBALS._sceneManager._scene;
switch (action) {
@@ -1338,7 +1372,7 @@ bool Scene450::Object1::startAction(CursorType action, Event &event) {
case INV_FOREST_RAP:
BF_INVENTORY.setObjectScene(INV_FOREST_RAP, 450);
BF_GLOBALS._player.disableControl();
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
scene->_sceneMode = 4505;
scene->setAction(&scene->_sequenceManager, scene, 4505, &BF_GLOBALS._player, this,
@@ -1349,7 +1383,7 @@ bool Scene450::Object1::startAction(CursorType action, Event &event) {
}
}
-bool Scene450::Object3::startAction(CursorType action, Event &event) {
+bool Scene450::PinBoy::startAction(CursorType action, Event &event) {
Scene450 *scene = (Scene450 *)BF_GLOBALS._sceneManager._scene;
switch (action) {
@@ -1378,7 +1412,7 @@ bool Scene450::Object3::startAction(CursorType action, Event &event) {
}
}
-bool Scene450::Object4::startAction(CursorType action, Event &event) {
+bool Scene450::Manager::startAction(CursorType action, Event &event) {
Scene450 *scene = (Scene450 *)BF_GLOBALS._sceneManager._scene;
switch (action) {
@@ -1438,7 +1472,7 @@ bool Scene450::Object4::startAction(CursorType action, Event &event) {
SceneItem::display2(450, 16);
BF_GLOBALS._player.enableControl();
} else {
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
scene->_sceneMode = 4510;
BF_INVENTORY.setObjectScene(INV_NAPKIN, 450);
scene->setAction(&scene->_sequenceManager, scene, 4510, &BF_GLOBALS._player, this, NULL);
@@ -1453,12 +1487,12 @@ bool Scene450::Object4::startAction(CursorType action, Event &event) {
BF_GLOBALS._player.disableControl();
if (!BF_GLOBALS.getFlag(showEugeneID))
- BF_GLOBALS._uiElements.addScore(30);
+ T2_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);
+ T2_GLOBALS._uiElements.addScore(30);
scene->_sceneMode = 4511;
scene->setAction(&scene->_sequenceManager, scene, 4511, &BF_GLOBALS._player, this, NULL);
} else {
@@ -1474,7 +1508,7 @@ bool Scene450::Object4::startAction(CursorType action, Event &event) {
/*--------------------------------------------------------------------------*/
-bool Scene450::Item1::startAction(CursorType action, Event &event) {
+bool Scene450::Exit::startAction(CursorType action, Event &event) {
Scene450 *scene = (Scene450 *)BF_GLOBALS._sceneManager._scene;
if (event.eventType == EVENT_BUTTON_DOWN) {
@@ -1534,26 +1568,27 @@ void Scene450::postInit(SceneObjectList *OwnerList) {
_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);
+ _pinBoy.postInit();
+ _pinBoy.setVisage(463);
+ _pinBoy.setPosition(Common::Point(138, 121));
+ _pinBoy.fixPriority(100);
+ _pinBoy.setFrame(_pinBoy.getFrameCount());
+ BF_GLOBALS._sceneItems.push_back(&_pinBoy);
} 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);
+ (BF_INVENTORY.getObjectScene(INV_CARAVAN_KEY) == 1)) {
+ _pinBoy.postInit();
+ _pinBoy.setVisage(463);
+ _pinBoy.setPosition(Common::Point(138, 121));
+ _pinBoy.fixPriority(100);
+ _pinBoy.setFrame(_pinBoy.getFrameCount());
+ BF_GLOBALS._sceneItems.push_back(&_pinBoy);
} else {
- _object4.postInit();
- _object4.setVisage(467);
- _object4.setPosition(Common::Point(138, 121));
- _object4.changeZoom(-1);
- BF_GLOBALS._sceneItems.push_back(&_object4);
+ _manager.postInit();
+ _manager.setVisage(467);
+ _manager.setPosition(Common::Point(138, 121));
+ _manager.changeZoom(-1);
+ _manager.fixPriority(100);
+ BF_GLOBALS._sceneItems.push_back(&_manager);
if (!BF_GLOBALS.getFlag(takenWeasel)) {
_object2.postInit();
@@ -1565,18 +1600,18 @@ void Scene450::postInit(SceneObjectList *OwnerList) {
_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);
+ BF_GLOBALS._walkRegions.disableRegion(4);
+
+ _weasel.postInit();
+ _weasel.setVisage(466);
+ _weasel.animate(ANIM_MODE_1, NULL);
+ _weasel.setObjectWrapper(new SceneObjectWrapper());
+ _weasel.setPosition(Common::Point(70, 80));
+ _weasel.setStrip(5);
+ _weasel.changeZoom(90);
+ _weasel.fixPriority(65);
+ _weasel._flag = 0;
+ BF_GLOBALS._sceneItems.push_back(&_weasel);
}
}
@@ -1597,20 +1632,22 @@ void Scene450::signal() {
break;
case 4501:
if (BF_GLOBALS._sceneObjects->contains(&_object2)) {
+ _sceneMode = 450;
ADD_MOVER(_object2, -20, 135);
} else {
+ _sceneMode = 451;
ADD_PLAYER_MOVER(0, 160);
}
break;
case 4503:
- _object1.fixPriority(100);
+ _weasel.fixPriority(100);
BF_GLOBALS._player.enableControl();
break;
case 4505:
BF_GLOBALS.setFlag(takenWeasel);
- _object1.remove();
+ _weasel.remove();
_object2.remove();
- BF_GLOBALS._walkRegions.proc2(4);
+ BF_GLOBALS._walkRegions.enableRegion(4);
BF_GLOBALS._player.enableControl();
break;
case 4507:
@@ -1619,18 +1656,18 @@ void Scene450::signal() {
BF_GLOBALS.setFlag(fMgrCallsWeasel);
_field19AC = 1;
_sceneMode = 4503;
- setAction(&_sequenceManager, this, 4503, &_object1, &_door, &_object4, NULL);
+ setAction(&_sequenceManager, this, 4503, &_weasel, &_door, &_manager, NULL);
break;
case 4508:
- _object4.remove();
+ _manager.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);
+ BF_INVENTORY.setObjectScene(INV_CARAVAN_KEY, 1);
_sceneMode = 4508;
- setAction(&_sequenceManager, this, 4508, &BF_GLOBALS._player, &_object4, &_door, NULL);
+ setAction(&_sequenceManager, this, 4508, &BF_GLOBALS._player, &_manager, &_door, NULL);
break;
default:
BF_GLOBALS._player.enableControl();
@@ -1641,7 +1678,7 @@ void Scene450::signal() {
void Scene450::process(Event &event) {
SceneExt::process(event);
- if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (UI_INTERFACE_Y - 1))) {
// Check if the cursor is on an exit
if (_exit.contains(event.mousePos)) {
GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW);
diff --git a/engines/tsage/blue_force/blueforce_scenes4.h b/engines/tsage/blue_force/blueforce_scenes4.h
index 5da61cfaa0..937c015a4c 100644
--- a/engines/tsage/blue_force/blueforce_scenes4.h
+++ b/engines/tsage/blue_force/blueforce_scenes4.h
@@ -71,38 +71,38 @@ class Scene410: public SceneExt {
};
/* Objects */
- class Object1: public NamedObject {
+ class Driver: public NamedObject {
public:
virtual bool startAction(CursorType action, Event &event);
};
- class Object2: public NamedObject {
+ class Passenger: public NamedObject {
public:
virtual bool startAction(CursorType action, Event &event);
};
- class Object3: public NamedObject {
+ class Harrison: public NamedObject {
public:
virtual bool startAction(CursorType action, Event &event);
};
/* Items */
- class Item2: public NamedHotspot {
+ class Motorcycle: public NamedHotspot {
public:
virtual bool startAction(CursorType action, Event &event);
};
- class Item4: public NamedHotspot {
+ class TruckFront: 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;
+ Driver _driver;
+ Passenger _passenger;
+ Harrison _harrison;
+ NamedObject _patrolCar, _object5, _object6;
+ NamedHotspot _background;
+ Motorcycle _motorcycle;
+ NamedHotspot _truckBack;
+ TruckFront _truckFront;
Action1 _action1;
Action2 _action2;
Action3 _action3;
@@ -116,7 +116,7 @@ public:
SpeakerDriver _driverSpeaker;
SpeakerShooter _shooterSpeaker;
ASoundExt _sound1;
- int _field1FB6, _field1FB8, _field1FBA;
+ int _field1FB6, _talkCount, _field1FBA;
int _field1FBC, _field1FBE;
int _field1FC0, _field1FC2, _field1FC4;
@@ -133,6 +133,7 @@ class Scene415: public SceneExt {
class GunInset: public FocusObject {
public:
virtual bool startAction(CursorType action, Event &event);
+ virtual void remove();
};
class GunAndWig: public NamedObject {
public:
@@ -141,6 +142,7 @@ class Scene415: public SceneExt {
class BulletsInset: public FocusObject {
public:
virtual bool startAction(CursorType action, Event &event);
+ virtual void remove();
};
class DashDrawer: public NamedObject {
public:
@@ -166,12 +168,12 @@ public:
BulletsInset _bulletsInset;
DashDrawer _dashDrawer;
TheBullets _theBullets;
- NamedObject _object6;
+ NamedObject _animatedSeat;
NamedHotspot _item1, _steeringWheel, _horn, _dashboard;
NamedHotspot _seat, _windowLever, _item7, _seatBelt;
Lever _lever;
SpeakerJakeRadio _jakeRadioSpeaker;
- bool _fieldE14, _fieldE16;
+ bool _scoreWigRapFlag, _scoreBulletRapFlag;
Scene415();
virtual void postInit(SceneObjectList *OwnerList = NULL);
@@ -214,7 +216,7 @@ public:
class Scene450: public SceneExt {
/* Objects */
- class Object1: public NamedObjectExt {
+ class Weasel: public NamedObjectExt {
public:
virtual bool startAction(CursorType action, Event &event);
};
@@ -222,17 +224,17 @@ class Scene450: public SceneExt {
public:
virtual bool startAction(CursorType action, Event &event);
};
- class Object3: public NamedObject {
+ class PinBoy: public NamedObject {
public:
virtual bool startAction(CursorType action, Event &event);
};
- class Object4: public NamedObject {
+ class Manager: public NamedObject {
public:
virtual bool startAction(CursorType action, Event &event);
};
/* Items */
- class Item1: public NamedHotspot {
+ class Exit: public NamedHotspot {
public:
virtual bool startAction(CursorType action, Event &event);
};
@@ -245,12 +247,13 @@ public:
SpeakerEugene _eugeneSpeaker;
SpeakerWeasel _weaselSpeaker;
SpeakerBilly _billySpeaker;
- Object1 _object1;
+ Weasel _weasel;
NamedObject _object2;
- Object3 _object3;
- Object4 _object4;
+ PinBoy _pinBoy;
+ Manager _manager;
NamedObject _door, _counterDoor;
- NamedHotspot _exit, _interior, _shelf, _counter;
+ Exit _exit;
+ NamedHotspot _interior, _shelf, _counter;
int _field19AC, _field19AE;
Scene450();
diff --git a/engines/tsage/blue_force/blueforce_scenes5.cpp b/engines/tsage/blue_force/blueforce_scenes5.cpp
index 9b67159f9b..7a250e2233 100644
--- a/engines/tsage/blue_force/blueforce_scenes5.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes5.cpp
@@ -55,7 +55,7 @@ void Scene550::Action1::signal() {
/*--------------------------------------------------------------------------*/
-bool Scene550::Object1::startAction(CursorType action, Event &event) {
+bool Scene550::Lyle::startAction(CursorType action, Event &event) {
Scene550 *scene = (Scene550 *)BF_GLOBALS._sceneManager._scene;
switch (action) {
@@ -76,8 +76,8 @@ bool Scene550::Object1::startAction(CursorType action, Event &event) {
scene->_sceneMode = 5512;
scene->setAction(&scene->_action1);
} else {
- scene->_sceneMode = BF_INVENTORY.getObjectScene(BF_ITEM_67) == 1 ? 5513 : 5512;
- scene->_stripManager.setAction(&scene->_action1);
+ scene->_sceneMode = BF_INVENTORY.getObjectScene(INV_CARAVAN_KEY) == 1 ? 5513 : 5512;
+ scene->setAction(&scene->_action1);
}
return true;
case INV_SCHEDULE:
@@ -101,8 +101,8 @@ bool Scene550::CaravanDoor::startAction(CursorType action, Event &event) {
case CURSOR_USE:
SceneItem::display2(550, 7);
return true;
- case BF_ITEM_67:
- if ((BF_GLOBALS._dayNumber == 3) || !BF_GLOBALS.getFlag(fWithLyle))
+ case INV_CARAVAN_KEY:
+ if ((BF_GLOBALS._dayNumber != 3) || !BF_GLOBALS.getFlag(fWithLyle))
SceneItem::display2(550, 33);
else {
BF_GLOBALS._player.disableControl();
@@ -189,8 +189,8 @@ void Scene550::postInit(SceneObjectList *OwnerList) {
_vechile.fixPriority(70);
if (BF_GLOBALS.getFlag(fWithLyle)) {
- BF_GLOBALS._walkRegions.proc1(10);
- BF_GLOBALS._walkRegions.proc1(11);
+ BF_GLOBALS._walkRegions.disableRegion(10);
+ BF_GLOBALS._walkRegions.disableRegion(11);
_vechile.setVisage(444);
_vechile.setStrip(4);
@@ -198,17 +198,17 @@ void Scene550::postInit(SceneObjectList *OwnerList) {
_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);
+ _lyle.postInit();
+ _lyle.setVisage(835);
+ _lyle.setPosition(Common::Point(139, 83));
+ _lyle.setDetails(550, 29, 30, 31, 1, NULL);
+ _lyle.setStrip(8);
BF_GLOBALS._player.setVisage(303);
BF_GLOBALS._player.setPosition(Common::Point(89, 76));
- BF_GLOBALS._player.updateAngle(_object1._position);
+ BF_GLOBALS._player.updateAngle(_lyle._position);
} else {
- BF_GLOBALS._walkRegions.proc1(12);
+ BF_GLOBALS._walkRegions.disableRegion(12);
_vechile.setPosition(Common::Point(205, 77));
_vechile.changeZoom(80);
@@ -225,28 +225,28 @@ void Scene550::postInit(SceneObjectList *OwnerList) {
BF_GLOBALS._player.setVisage(303);
}
+ }
- BF_GLOBALS._sceneItems.push_back(&_vechile);
+ BF_GLOBALS._sceneItems.push_back(&_vechile);
- if (BF_GLOBALS._sceneManager._previousScene == 930) {
- _caravanDoor.setFrame(_caravanDoor.getFrameCount());
- BF_GLOBALS._player.disableControl();
+ 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;
- }
+ _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, &_lyle, NULL);
+ } else {
+ _sceneMode = 0;
}
_item2.setDetails(Rect(0, 26, 53, 67), 550, 1, -1, 2, 1, NULL);
@@ -296,8 +296,8 @@ void Scene551::Action2::signal() {
switch (_actionIndex++) {
case 0:
- BF_GLOBALS._walkRegions.proc2(18);
- BF_GLOBALS._walkRegions.proc2(4);
+ BF_GLOBALS._walkRegions.enableRegion(18);
+ BF_GLOBALS._walkRegions.enableRegion(4);
scene->_field1CD2 = 1;
scene->_harrison.setObjectWrapper(new SceneObjectWrapper());
@@ -316,7 +316,7 @@ void Scene551::Action2::signal() {
scene->_harrison.updateAngle(BF_GLOBALS._player._position);
if (scene->_drunkStanding._flag == 1) {
- BF_GLOBALS._walkRegions.proc1(4);
+ BF_GLOBALS._walkRegions.disableRegion(4);
ADD_PLAYER_MOVER(71, 97);
} else {
ADD_PLAYER_MOVER(141, 87);
@@ -465,7 +465,7 @@ bool Scene551::Drunk::startAction(CursorType action, Event &event) {
BF_GLOBALS.set2Flags(f1098Drunk);
BF_GLOBALS.setFlag(didDrunk);
_flag = 1;
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 5506;
@@ -486,7 +486,7 @@ bool Scene551::PatrolCarTrunk::startAction(CursorType action, Event &event) {
switch (action) {
case CURSOR_USE:
if (BF_INVENTORY.getObjectScene(INV_CENTER_PUNCH) != 1) {
- BF_GLOBALS._walkRegions.proc2(18);
+ BF_GLOBALS._walkRegions.enableRegion(18);
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 2;
scene->setAction(&scene->_sequenceManager, scene, 5503, &BF_GLOBALS._player, &scene->_harrison, this, NULL);
@@ -560,7 +560,7 @@ bool Scene551::TrunkKits::startAction(CursorType action, Event &event) {
break;
case 2:
if (!BF_GLOBALS.getFlag(fShowedBluePrint)) {
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
BF_GLOBALS.setFlag(fShowedBluePrint);
}
@@ -681,7 +681,7 @@ void Scene551::postInit(SceneObjectList *OwnerList) {
_vechile2.changeZoom(80);
BF_GLOBALS._sceneItems.push_back(&_vechile2);
- BF_GLOBALS._walkRegions.proc1(14);
+ BF_GLOBALS._walkRegions.disableRegion(14);
_drunk.postInit();
_drunk.setVisage(550);
@@ -812,7 +812,7 @@ void Scene551::signal() {
BF_GLOBALS._sceneManager.changeScene(60);
break;
case 2:
- BF_GLOBALS._walkRegions.proc1(18);
+ BF_GLOBALS._walkRegions.disableRegion(18);
_trunkInset.postInit();
_trunkInset.setVisage(553);
@@ -850,8 +850,8 @@ void Scene551::signal() {
setAction(&_sequenceManager, this, 5507, &BF_GLOBALS._player, &_drunk, &_drunkStanding, NULL);
break;
case 5507:
- BF_GLOBALS._walkRegions.proc1(2);
- BF_GLOBALS._walkRegions.proc1(4);
+ BF_GLOBALS._walkRegions.disableRegion(2);
+ BF_GLOBALS._walkRegions.disableRegion(4);
_drunkStanding._flag = 1;
BF_GLOBALS._sceneItems.push_front(&_drunkStanding);
@@ -924,7 +924,7 @@ void Scene560::Action1::signal() {
scene->_deskChair.setStrip(BF_GLOBALS._player._strip);
scene->_deskChair.setPosition(BF_GLOBALS._player._position);
- scene->_field380 = 1;
+ scene->_field380 = true;
BF_GLOBALS._player.enableControl();
remove();
break;
@@ -950,7 +950,7 @@ void Scene560::Action2::signal() {
BF_GLOBALS._player.animate(ANIM_MODE_6, this);
break;
case 2:
- scene->_field380 = 0;
+ scene->_field380 = false;
scene->_deskChair.setPosition(Common::Point(81, 149));
scene->_deskChair.setVisage(561);
scene->_deskChair.setStrip(3);
@@ -1175,7 +1175,7 @@ void Scene560::SafeInset::signal() {
BF_GLOBALS._sceneObjects->draw();
if (!BF_GLOBALS.getFlag(fGotPointsForBank)) {
- BF_GLOBALS._uiElements.addScore(50);
+ T2_GLOBALS._uiElements.addScore(50);
BF_GLOBALS.setFlag(fGotPointsForBank);
}
@@ -1228,7 +1228,7 @@ void Scene560::SafeInset::process(Event &event) {
GfxSurface cursor = _cursorVisage.getFrame(7);
BF_GLOBALS._events.setCursor(cursor);
- if ((event.mousePos.y < BF_INTERFACE_Y) && (event.eventType == EVENT_BUTTON_DOWN)) {
+ if ((event.mousePos.y < UI_INTERFACE_Y) && (event.eventType == EVENT_BUTTON_DOWN)) {
// Leave the safe view
event.handled = true;
remove();
@@ -1305,7 +1305,7 @@ bool Scene560::SafeInset::Item::startAction(CursorType action, Event &event) {
bool Scene560::Nickel::startAction(CursorType action, Event &event) {
if (action == CURSOR_USE) {
BF_INVENTORY.setObjectScene(INV_NICKEL, 1);
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
remove();
return true;
} else {
@@ -1335,7 +1335,7 @@ bool Scene560::BoxInset::Item1::startAction(CursorType action, Event &event) {
if (action == CURSOR_USE) {
if (!BF_GLOBALS.getFlag(fGotPointsForBox)) {
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
BF_GLOBALS.setFlag(fGotPointsForBox);
}
@@ -1378,7 +1378,7 @@ bool Scene560::Computer::startAction(CursorType action, Event &event) {
/*--------------------------------------------------------------------------*/
Scene560::Scene560(): SceneExt() {
- _field380 = _field11EA = 0;
+ _field380 = _field11EA = false;
}
void Scene560::postInit(SceneObjectList *OwnerList) {
@@ -1433,12 +1433,12 @@ void Scene560::postInit(SceneObjectList *OwnerList) {
_deskChair.setStrip(BF_GLOBALS._player._strip);
_deskChair.setPosition(BF_GLOBALS._player._position);
- _field11EA = 0;
- _field380 = 1;
+ _field11EA = false;
+ _field380 = true;
} else {
// Entering study through doorway
- _field11EA = 0;
- _field380 = 0;
+ _field11EA = false;
+ _field380 = false;
BF_GLOBALS._player.postInit();
BF_GLOBALS._player.setVisage(563);
@@ -1513,7 +1513,7 @@ void Scene560::signal() {
}
} else if ((_sceneMode != 3) && (_sceneMode != 4)) {
if (!BF_GLOBALS.getFlag(fGotPointsForPunch)) {
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
BF_GLOBALS.setFlag(fGotPointsForPunch);
}
@@ -1529,7 +1529,7 @@ void Scene560::signal() {
}
break;
case 10:
- _field11EA = 0;
+ _field11EA = false;
BF_GLOBALS._player.enableControl();
break;
case 11:
@@ -1540,7 +1540,7 @@ void Scene560::signal() {
void Scene560::process(Event &event) {
if ((event.eventType == EVENT_BUTTON_DOWN) && (BF_GLOBALS._events.getCursor() == CURSOR_WALK) &&
- (_field380 == 1) && !_action) {
+ (_field380) && !_action) {
_destPosition = event.mousePos;
BF_GLOBALS._player.disableControl();
setAction(&_action2);
@@ -1553,7 +1553,7 @@ void Scene560::process(Event &event) {
void Scene560::dispatch() {
if (!_field11EA && (BF_GLOBALS._player._position.y < 105)) {
- _field11EA = 1;
+ _field11EA = true;
BF_GLOBALS._player.disableControl();
BF_GLOBALS._sceneManager.changeScene(270);
}
@@ -1664,12 +1664,12 @@ void Scene570::PasswordEntry::checkPassword() {
if (!_entryBuffer.compareTo("JACKIE") || !_entryBuffer.compareTo("SCUMMVM")) {
// Password was correct
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
BF_GLOBALS._player.disableControl();
scene->_sound1.play(73);
- BF_GLOBALS._uiElements.hide();
- BF_GLOBALS._uiElements._active = false;
+ T2_GLOBALS._uiElements.hide();
+ T2_GLOBALS._uiElements._active = false;
scene->_sceneMode = 5701;
scene->setAction(&scene->_sequenceManager, scene, 5701, &scene->_object3, NULL);
} else {
@@ -1846,20 +1846,20 @@ bool Scene570::Icon::startAction(CursorType action, Event &event) {
scene->_iconManager.hideList();
switch (_folderId) {
case 8:
- BF_GLOBALS._uiElements.hide();
- BF_GLOBALS._uiElements._active = false;
+ T2_GLOBALS._uiElements.hide();
+ T2_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;
+ T2_GLOBALS._uiElements.hide();
+ T2_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;
+ T2_GLOBALS._uiElements.hide();
+ T2_GLOBALS._uiElements._active = false;
scene->_sceneMode = 5707;
scene->setAction(&scene->_sequenceManager, scene, 5707, &scene->_object3, NULL);
break;
@@ -1869,8 +1869,8 @@ bool Scene570::Icon::startAction(CursorType action, Event &event) {
break;
case 7:
scene->_iconManager.hideList();
- BF_GLOBALS._uiElements.hide();
- BF_GLOBALS._uiElements._active = false;
+ T2_GLOBALS._uiElements.hide();
+ T2_GLOBALS._uiElements._active = false;
scene->_sceneMode = 5704;
scene->setAction(&scene->_sequenceManager, scene, 5704, &scene->_object3, NULL);
break;
@@ -1889,7 +1889,7 @@ bool Scene570::Icon::startAction(CursorType action, Event &event) {
scene->_sound1.play(74);
if (BF_INVENTORY.getObjectScene(INV_PRINT_OUT) == 570) {
SceneItem::display2(570, 6);
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
BF_INVENTORY.setObjectScene(INV_PRINT_OUT, 1);
} else {
SceneItem::display2(570, 7);
@@ -1938,7 +1938,7 @@ bool Scene570::PowerSwitch::startAction(CursorType action, Event &event) {
scene->_object3.remove();
} else {
if (!BF_GLOBALS.getFlag(fGotPointsForCoin)) {
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
BF_GLOBALS.setFlag(fGotPointsForCoin);
}
@@ -2106,16 +2106,16 @@ void Scene570::signal() {
_icon3.setDetails(7, 6, 0, 2, SCENE570_COBB);
_iconManager.refreshList();
- BF_GLOBALS._uiElements._active = true;
- BF_GLOBALS._uiElements.show();
+ T2_GLOBALS._uiElements._active = true;
+ T2_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();
+ T2_GLOBALS._uiElements._active = true;
+ T2_GLOBALS._uiElements.show();
_object3.setPosition(Common::Point(220, 75));
_object3.setVisage(572);
_object3.setStrip(4);
@@ -2220,14 +2220,13 @@ void Scene580::postInit(SceneObjectList *OwnerList) {
_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);
+ BF_GLOBALS._walkRegions.disableRegion(8);
+ BF_GLOBALS._walkRegions.disableRegion(9);
+ BF_GLOBALS._walkRegions.disableRegion(10);
+ BF_GLOBALS._walkRegions.disableRegion(11);
} else {
_vechile.setPosition(Common::Point(159, 72));
@@ -2333,7 +2332,7 @@ bool Scene590::Skip::startAction(CursorType action, Event &event) {
return true;
case INV_BASEBALL_CARD:
scene->_field17DE = 1;
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
BF_INVENTORY.setObjectScene(INV_BASEBALL_CARD, 2);
BF_GLOBALS._player.disableControl();
@@ -2529,7 +2528,7 @@ void Scene590::signal() {
void Scene590::process(Event &event) {
SceneExt::process(event);
- if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (UI_INTERFACE_Y - 1))) {
// Check if the cursor is on an exit
if (_exit.contains(event.mousePos)) {
GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW);
@@ -2542,6 +2541,14 @@ void Scene590::process(Event &event) {
}
}
+void Scene590::dispatch() {
+ if (!_action && (BF_GLOBALS._player._position.x < 182) && (BF_GLOBALS._player._position.y > 158)) {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 2;
+ setAction(&_sequenceManager, this, 5901, &BF_GLOBALS._player, NULL);
+ }
+}
+
} // 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
index 8ff5b40657..76bf4cdbc3 100644
--- a/engines/tsage/blue_force/blueforce_scenes5.h
+++ b/engines/tsage/blue_force/blueforce_scenes5.h
@@ -41,7 +41,7 @@ using namespace TsAGE;
class Scene550: public SceneExt {
/* Objects */
- class Object1: public NamedObject {
+ class Lyle: public NamedObject {
public:
virtual bool startAction(CursorType action, Event &event);
};
@@ -61,7 +61,7 @@ class Scene550: public SceneExt {
};
public:
SequenceManager _sequenceManager;
- Object1 _object1;
+ Lyle _lyle;
CaravanDoor _caravanDoor;
Vechile _vechile;
NamedHotspot _item1, _item2, _item3;
@@ -228,7 +228,8 @@ public:
NamedHotspot _chair, _lamp, _item4, _trophy, _watercolours, _fileCabinets;
NamedHotspot _certificate, _bookcase, _desk, _carpet, _item12, _office;
ASound _sound1;
- int _field380, _field11EA;
+ bool _field380;
+ bool _field11EA;
Common::Point _destPosition;
Scene560();
@@ -397,6 +398,7 @@ public:
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void signal();
virtual void process(Event &event);
+ virtual void dispatch();
};
} // End of namespace BlueForce
diff --git a/engines/tsage/blue_force/blueforce_scenes6.cpp b/engines/tsage/blue_force/blueforce_scenes6.cpp
index 0d6587daa9..5fb1b562e0 100644
--- a/engines/tsage/blue_force/blueforce_scenes6.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes6.cpp
@@ -37,7 +37,7 @@ namespace BlueForce {
void Scene600::Action1::signal() {
Scene600 *scene = (Scene600 *)BF_GLOBALS._sceneManager._scene;
- static const uint32 black = 0;
+ static byte red[3] = {220, 0, 0};
switch (_actionIndex++) {
case 0:
@@ -49,8 +49,8 @@ void Scene600::Action1::signal() {
break;
case 2:
scene->_sound1.play(59);
- setAction(&scene->_sequenceManager, this, 600, &scene->_object2, &scene->_object1,
- &BF_GLOBALS._player, &scene->_object3, NULL);
+ setAction(&scene->_sequenceManager, this, 600, &scene->_object2, &scene->_ryan,
+ &BF_GLOBALS._player, &scene->_skidMarks, NULL);
break;
case 3:
BF_GLOBALS._sound1.play(61);
@@ -61,13 +61,13 @@ void Scene600::Action1::signal() {
break;
case 5: {
BF_GLOBALS._player.remove();
- scene->_object1.remove();
+ scene->_ryan.remove();
scene->_object2.remove();
- scene->_object3.remove();
+ scene->_skidMarks.remove();
- for (int percent = 100; percent >= 0; percent -= 5) {
- BF_GLOBALS._scenePalette.fade((byte *)&black, false, percent);
- g_system->delayMillis(10);
+ for (int percent = 100; percent >= 0; percent -= 2) {
+ BF_GLOBALS._scenePalette.fade((const byte *)&red, false, percent);
+ g_system->delayMillis(5);
}
SynchronizedList<SceneObject *>::iterator i;
@@ -91,6 +91,8 @@ void Scene600::Action1::signal() {
BF_GLOBALS._v51C44 = 0;
remove();
break;
+ default:
+ break;
}
}
@@ -110,14 +112,14 @@ void Scene600::postInit(SceneObjectList *OwnerList) {
BF_GLOBALS._player.setPosition(Common::Point(639, 0));
BF_GLOBALS._player.disableControl();
- _object3.postInit();
- _object3.hide();
+ _skidMarks.postInit();
+ _skidMarks.hide();
_object2.postInit();
-
- _object1.postInit();
- _object1.setVisage(600);
- _object1.setStrip(7);
- _object1.setPosition(Common::Point(417, 82));
+
+ _ryan.postInit();
+ _ryan.setVisage(600);
+ _ryan.setStrip(7);
+ _ryan.setPosition(Common::Point(417, 82));
BF_GLOBALS.clearFlag(onDuty);
BF_INVENTORY.setObjectScene(INV_TICKET_BOOK, 60);
@@ -131,6 +133,14 @@ void Scene600::signal() {
BF_GLOBALS._sceneManager.changeScene(620);
}
+// WORKAROUND: Fix for original game bug where the global scrolling object follower
+// remains set to an object within the scene that is no longer active
+void Scene600::remove() {
+ BF_GLOBALS._scrollFollower = &BF_GLOBALS._player;
+
+ SceneExt::remove();
+}
+
/*--------------------------------------------------------------------------
* Scene 620 - Hospital cut-scene
*
@@ -173,7 +183,7 @@ void Scene620::signal() {
_object1.postInit();
_object1.setVisage(622);
_object1.setPosition(Common::Point(101, 41));
- addFader((const byte *)&black, 2, this);
+ add2Faders((const byte *)&black, 2, 622, this);
break;
case 5:
_object1.remove();
@@ -232,6 +242,8 @@ void Scene620::signal() {
BF_GLOBALS._dayNumber = 3;
BF_GLOBALS._sceneManager.changeScene(271);
break;
+ default:
+ break;
}
}
@@ -273,7 +285,7 @@ void Scene666::postInit(SceneObjectList *OwnerList) {
}
BF_GLOBALS._scenePalette.loadPalette(BF_GLOBALS._sceneManager._previousScene);
- BF_GLOBALS._uiElements._active = false;
+ T2_GLOBALS._uiElements._active = false;
_item1.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 666, -1, -1, -1, 1, NULL);
BF_GLOBALS._player.postInit();
@@ -342,7 +354,7 @@ void Scene666::remove() {
BF_GLOBALS._sound1.fadeOut2(NULL);
BF_GLOBALS._scrollFollower = &BF_GLOBALS._player;
SceneExt::remove();
- BF_GLOBALS._uiElements._active = true;
+ T2_GLOBALS._uiElements._active = true;
}
void Scene666::signal() {
@@ -378,8 +390,8 @@ bool Scene690::Object1::startAction(CursorType action, Event &event) {
if ((action == CURSOR_USE) && (scene->_object2._strip == 1)) {
BF_GLOBALS._player.disableControl();
- BF_GLOBALS._walkRegions.proc2(1);
- BF_GLOBALS._walkRegions.proc2(6);
+ BF_GLOBALS._walkRegions.enableRegion(1);
+ BF_GLOBALS._walkRegions.enableRegion(6);
scene->_sceneMode = 6901;
scene->setAction(&scene->_sequenceManager, scene, 6901, &BF_GLOBALS._player,
&scene->_object2, &scene->_object1, &scene->_object4, &scene->_object5, NULL);
@@ -492,8 +504,8 @@ void Scene690::signal() {
BF_GLOBALS._player.enableControl();
break;
case 6903:
- BF_GLOBALS._walkRegions.proc1(1);
- BF_GLOBALS._walkRegions.proc1(6);
+ BF_GLOBALS._walkRegions.disableRegion(1);
+ BF_GLOBALS._walkRegions.disableRegion(6);
BF_GLOBALS._player.enableControl();
break;
default:
diff --git a/engines/tsage/blue_force/blueforce_scenes6.h b/engines/tsage/blue_force/blueforce_scenes6.h
index 7c35b75053..3f9c14aa11 100644
--- a/engines/tsage/blue_force/blueforce_scenes6.h
+++ b/engines/tsage/blue_force/blueforce_scenes6.h
@@ -49,12 +49,13 @@ public:
SequenceManager _sequenceManager;
Action1 _action1;
ASoundExt _sound1;
- NamedObject _object1, _object2, _object3;
+ NamedObject _ryan, _object2, _skidMarks;
BackgroundSceneObject _object4, _object5;
BackgroundSceneObject _object6, _object7, _object8;
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void signal();
+ virtual void remove();
};
class Scene620 : public PalettedScene {
diff --git a/engines/tsage/blue_force/blueforce_scenes7.cpp b/engines/tsage/blue_force/blueforce_scenes7.cpp
index 1d94211871..7b84e3ccdd 100644
--- a/engines/tsage/blue_force/blueforce_scenes7.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes7.cpp
@@ -31,12 +31,13 @@ namespace TsAGE {
namespace BlueForce {
/*--------------------------------------------------------------------------
- * Scene 710 -
+ * Scene 710 - Beach
*
*--------------------------------------------------------------------------*/
+
void Scene710::Timer1::signal() {
PaletteRotation *rotation = BF_GLOBALS._scenePalette.addRotation(136, 138, -1);
- rotation->setDelay(25);
+ rotation->setDelay(20);
rotation = BF_GLOBALS._scenePalette.addRotation(146, 148, -1);
rotation->setDelay(30);
rotation = BF_GLOBALS._scenePalette.addRotation(187, 191, -1);
@@ -58,8 +59,7 @@ void Scene710::Action1::signal() {
setDelay(3);
break;
case 1: {
- PlayerMover *mover = new PlayerMover();
- BF_GLOBALS._player.addMover(mover, &scene->_laura._position, scene);
+ ADD_MOVER(BF_GLOBALS._player, scene->_laura._position.x + 8, scene->_laura._position.y + 8);
break;
}
case 2:
@@ -67,7 +67,7 @@ void Scene710::Action1::signal() {
scene->_stripManager.start(_state, this);
break;
case 3:
- if (_state == 7105)
+ if (_state != 7105)
BF_GLOBALS._player.enableControl();
else {
BF_GLOBALS._player.disableControl();
@@ -76,7 +76,7 @@ void Scene710::Action1::signal() {
}
if (_state < 7104) {
_state++;
- if ((_state != 7104) && (BF_INVENTORY.getObjectScene(INV_CRATE1) == 1))
+ if ((_state == 7104) && (BF_INVENTORY.getObjectScene(INV_CRATE1) == 1))
_state = 7105;
}
remove();
@@ -101,7 +101,7 @@ 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);
+ SceneItem::display2(710, 13);
return true;
} else
return NamedObject::startAction(action, event);
@@ -113,19 +113,19 @@ bool Scene710::Object5::startAction(CursorType action, Event &event) {
switch (action) {
case CURSOR_LOOK:
- if (scene->_v1D64 <= 2)
+ if (scene->_stickThrowCount <= 2)
return NamedObject::startAction(action, event);
else {
- SceneItem::display(710, 3);
- scene->_v1D66 = 1;
+ SceneItem::display2(710, 3);
+ scene->_watchCrate = true;
return true;
}
case CURSOR_USE:
- if ((scene->_kid._position.x < 0) && (scene->_v1D62 == 1)) {
- scene->_v1D64++;
- if (scene->_v1D66 == 0) {
+ if ((scene->_kid._position.x < 0) && (scene->_dogLying)) {
+ scene->_stickThrowCount++;
+ if (!scene->_watchCrate) {
BF_GLOBALS._player.disableControl();
- scene->_v1D62 = 0;
+ scene->_dogLying = false;
scene->_sceneMode = 7105;
scene->setAction(&scene->_sequenceManager1, scene, 7105, &BF_GLOBALS._player, &scene->_stick, &scene->_dog, NULL);
} else {
@@ -144,8 +144,8 @@ bool Scene710::Object5::startAction(CursorType action, Event &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);
@@ -187,7 +187,8 @@ void Scene710::postInit(SceneObjectList *OwnerList) {
_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;
+ _stickThrowCount = 0;
+ _dogLying = _watchCrate = _throwStick = false;
_action1._state = 7100;
_timer1.set(2, NULL);
_sceneMode = 7100;
@@ -195,7 +196,7 @@ void Scene710::postInit(SceneObjectList *OwnerList) {
}
void Scene710::signal() {
- switch (_sceneMode++) {
+ switch (_sceneMode) {
case 0:
BF_GLOBALS._player.enableControl();
break;
@@ -205,28 +206,29 @@ void Scene710::signal() {
setAction(&_sequenceManager1, this, 7102, &_dog, NULL);
break;
case 7101:
+ // Pick up crate part
BF_GLOBALS._player.enableControl();
- BF_INVENTORY.setObjectScene(288, 36);
+ BF_INVENTORY.setObjectScene(INV_CRATE1, 1);
_stick.remove();
- BF_GLOBALS._walkRegions.proc2(2);
+ BF_GLOBALS._walkRegions.enableRegion(2);
break;
case 7102:
_stick.setPosition(Common::Point(100, 122));
_stick.animate(ANIM_MODE_NONE, NULL);
_stick._strip = 2;
- if (_v1D64 <= 2)
+ if (_stickThrowCount <= 2)
_stick._frame = 2;
else {
- if (_v1D64 == 3) {
+ if (_stickThrowCount == 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))
+ _dogLying = true;
+ BF_GLOBALS._walkRegions.disableRegion(2);
+ if ((_throwStick) && (_sceneMode != 0))
BF_GLOBALS._player.enableControl();
break;
case 7103:
@@ -239,12 +241,12 @@ void Scene710::signal() {
}
break;
case 7105:
- _v1D68 = 1;
+ _throwStick = true;
// No break on purpose
case 7104:
_sceneMode = 7102;
setAction(&_sequenceManager1, this, 7102, &_dog, NULL);
- BF_GLOBALS._walkRegions.proc2(2);
+ BF_GLOBALS._walkRegions.enableRegion(2);
break;
case 7106:
BF_GLOBALS._sound1.fadeOut2(NULL);
@@ -256,8 +258,8 @@ void Scene710::signal() {
}
void Scene710::dispatch() {
- if ((_kid._position.x > 0) && (_v1D62 == 1) && (_sceneMode != 7106)) {
- _v1D62 = 0;
+ if ((_kid._position.x > 0) && (_dogLying) && (_sceneMode != 7106)) {
+ _dogLying = false;
_sceneMode = 7103;
setAction(&_sequenceManager1, this, 7103, &_kid, &_stick, &_dog, NULL);
}
@@ -266,10 +268,10 @@ void Scene710::dispatch() {
void Scene710::synchronize(Serializer &s) {
SceneExt::synchronize(s);
- s.syncAsSint16LE(_v1D62);
- s.syncAsSint16LE(_v1D64);
- s.syncAsSint16LE(_v1D66);
- s.syncAsSint16LE(_v1D68);
+ s.syncAsSint16LE(_dogLying);
+ s.syncAsSint16LE(_stickThrowCount);
+ s.syncAsSint16LE(_watchCrate);
+ s.syncAsSint16LE(_throwStick);
}
diff --git a/engines/tsage/blue_force/blueforce_scenes7.h b/engines/tsage/blue_force/blueforce_scenes7.h
index 9bb43453ef..161d94cc2c 100644
--- a/engines/tsage/blue_force/blueforce_scenes7.h
+++ b/engines/tsage/blue_force/blueforce_scenes7.h
@@ -89,12 +89,15 @@ public:
NamedHotspot _item7;
NamedHotspot _item8;
NamedHotspot _item9;
- int _v1D62, _v1D64, _v1D66, _v1D68;
+ int _stickThrowCount;
+ bool _dogLying;
+ bool _watchCrate;
+ bool _throwStick;
- void postInit(SceneObjectList *OwnerList = NULL);
- void signal();
- void dispatch();
- void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void dispatch();
+ virtual void synchronize(Serializer &s);
};
} // End of namespace BlueForce
diff --git a/engines/tsage/blue_force/blueforce_scenes8.cpp b/engines/tsage/blue_force/blueforce_scenes8.cpp
index 49de0be65c..32cd376891 100644
--- a/engines/tsage/blue_force/blueforce_scenes8.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes8.cpp
@@ -69,7 +69,7 @@ bool Scene800::Doorway::startAction(CursorType action, Event &event) {
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);
+ SceneItem::display2(800, 5);
else {
if (BF_GLOBALS.getFlag(fWithLyle)) {
ADD_PLAYER_MOVER_NULL(scene->_lyle, 277, 145);
@@ -103,7 +103,7 @@ bool Scene800::Car1::startAction(CursorType action, Event &event) {
else {
BF_GLOBALS.setFlag(ticketVW);
BF_GLOBALS._player.disableControl();
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
scene->_sceneMode = 8005;
scene->setAction(&scene->_action1);
}
@@ -252,12 +252,12 @@ void Scene800::postInit(SceneObjectList *OwnerList) {
_car2.fixPriority(158);
BF_GLOBALS._sceneItems.push_back(&_car2);
- BF_GLOBALS._walkRegions.proc1(8);
+ BF_GLOBALS._walkRegions.disableRegion(8);
}
if ((BF_GLOBALS._dayNumber == 4) && (BF_GLOBALS._bookmark < bEndDayThree)) {
_car2.remove();
- BF_GLOBALS._walkRegions.proc2(8);
+ BF_GLOBALS._walkRegions.enableRegion(8);
}
if (BF_GLOBALS.getFlag(fWithLyle)) {
@@ -305,7 +305,7 @@ void Scene800::postInit(SceneObjectList *OwnerList) {
_sceneMode = 8001;
setAction(&_sequenceManager, this, 8001, &BF_GLOBALS._player, &_doorway, NULL);
}
- } else if ((BF_INVENTORY.getObjectScene(INV_SCHEDULE) == 1) && (BF_GLOBALS._bookmark == bFlashBackThree)) {
+ } 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));
@@ -314,7 +314,7 @@ void Scene800::postInit(SceneObjectList *OwnerList) {
_lyle.setPosition(Common::Point(244, 162));
_lyle.setStrip(4);
_sceneMode = 8004;
- setAction(&_sequenceManager, this, 8001, &_lyle, &_doorway, NULL);
+ setAction(&_sequenceManager, this, 8004, &_lyle, &_doorway, NULL);
} else {
BF_GLOBALS._player.updateAngle(_motorcycle._position);
BF_GLOBALS._player.enableControl();
@@ -344,6 +344,8 @@ void Scene800::signal() {
case 8004:
BF_GLOBALS.clearFlag(fWithLyle);
_lyle.remove();
+ BF_GLOBALS._player.enableControl();
+ break;
}
}
@@ -357,6 +359,1142 @@ void Scene800::dispatch() {
}
/*--------------------------------------------------------------------------
+ * Scene 810 - Lyle's Office
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene810::Action1::signal() {
+ Scene810 *scene = (Scene810 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ if (scene->_lyle._position.x == 115) {
+ ADD_PLAYER_MOVER(174, 142);
+ } else if (scene->_lyle._position.x < 160) {
+ ADD_PLAYER_MOVER(scene->_lyle._position.x + 20, scene->_lyle._position.y + 15);
+ } else {
+ ADD_PLAYER_MOVER(scene->_lyle._position.x - 20, scene->_lyle._position.y + 15);
+ }
+ break;
+ case 1:
+ BF_GLOBALS._player.updateAngle(scene->_lyle._position);
+ scene->_stripManager.start(scene->_sceneMode, this);
+ break;
+ case 2:
+ if (BF_GLOBALS.getFlag(shownFax) && (BF_GLOBALS._dayNumber == 3) && !BF_GLOBALS.getFlag(fWithLyle))
+ BF_GLOBALS.setFlag(showMugAround);
+
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene810::Action2::signal() {
+ Scene810 *scene = (Scene810 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ if (!BF_GLOBALS.getFlag(shownLyleCrate1Day1))
+ T2_GLOBALS._uiElements.addScore(30);
+
+ if (scene->_lyle._position.x == 115) {
+ ADD_PLAYER_MOVER(174, 142);
+ } else {
+ ADD_PLAYER_MOVER(193, 105);
+ }
+ break;
+ case 1:
+ BF_GLOBALS._player.setStrip(8);
+ if (scene->_lyle._position.x != 115)
+ _actionIndex = 3;
+
+ if (BF_GLOBALS.getFlag(shownLyleCrate1Day1)) {
+ if (BF_GLOBALS.getFlag(onDuty)) {
+ scene->_stripManager.start(8138, this);
+ } else {
+ scene->_stripManager.start((BF_GLOBALS._dayNumber == 3) ? 8110 : 8126, this);
+ }
+ } else if (BF_GLOBALS._dayNumber >= 3) {
+ scene->_stripManager.start(8110, this);
+ } else {
+ scene->_stripManager.start(BF_GLOBALS.getFlag(onDuty) ? 8140 : 8128, this);
+ }
+ break;
+ case 2:
+ setAction(&scene->_sequenceManager1, this, 8117, &scene->_lyle, &scene->_chair, NULL);
+ break;
+ case 3:
+ BF_GLOBALS._walkRegions.enableRegion(4);
+ ADD_PLAYER_MOVER_THIS(scene->_lyle, 27, 124);
+ break;
+ case 4:
+ scene->_lyle.setVisage(813);
+ scene->_lyle.setStrip(2);
+ scene->_lyle.setFrame(1);
+
+ ADD_PLAYER_MOVER(84, 113);
+ break;
+ case 5:
+ BF_GLOBALS._player.setStrip(8);
+ scene->_lyle.animate(ANIM_MODE_4, 5, 1, this);
+ break;
+ case 6:
+ scene->_lyle.animate(ANIM_MODE_5, NULL);
+ scene->_stripManager.start(8111, this);
+ break;
+ case 7:
+ scene->_lyle.setVisage(845);
+ scene->_lyle.setStrip(1);
+ scene->_lyle.setFrame(1);
+ scene->_lyle.animate(ANIM_MODE_1, NULL);
+
+ scene->_stripManager.start(BF_GLOBALS.getFlag(onDuty) ? 8137 : 8112, this);
+ break;
+ case 8:
+ BF_GLOBALS._walkRegions.disableRegion(13);
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ default:
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene810::Lyle::startAction(CursorType action, Event &event) {
+ Scene810 *scene = (Scene810 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(810, 26);
+ return true;
+
+ case CURSOR_TALK:
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._player.updateAngle(_position);
+
+ switch (BF_GLOBALS._dayNumber) {
+ case 4:
+ scene->_sceneMode = (BF_INVENTORY.getObjectScene(INV_AUTO_RIFLE) == 810) ? 8001 : 8123;
+ break;
+ case 2:
+ if (BF_GLOBALS.getFlag(shownFax))
+ scene->_sceneMode = 8151;
+ else if (BF_GLOBALS.getFlag(onDuty)) {
+ if (BF_GLOBALS.getFlag(shownLyleCrate1)) {
+ scene->_sceneMode = BF_GLOBALS.getFlag(shownLyleCrate1Day1) ? 8145 : 8154;
+ } else if (BF_GLOBALS.getFlag(shownLyleRapsheet) || BF_GLOBALS.getFlag(shownLylePO)) {
+ scene->_sceneMode = 8145;
+ } else if (!_flag) {
+ ++_flag;
+ scene->_sceneMode = 8139;
+ } else {
+ scene->_sceneMode = 8152;
+ }
+ } else {
+ if (BF_GLOBALS.getFlag(shownLyleCrate1)) {
+ scene->_sceneMode = BF_GLOBALS.getFlag(shownLyleCrate1Day1) ? 8133 : 8153;
+ } else if (BF_GLOBALS.getFlag(shownLyleRapsheet) || BF_GLOBALS.getFlag(shownLylePO)) {
+ scene->_sceneMode = 8133;
+ } else if (!_flag) {
+ ++_flag;
+ scene->_sceneMode = 8127;
+ } else {
+ scene->_sceneMode = 8152;
+ }
+ }
+ break;
+ default:
+ if (BF_GLOBALS.getFlag(shownFax))
+ scene->_sceneMode = 8146;
+ else if (BF_GLOBALS.getFlag(shownLylePO) || BF_GLOBALS.getFlag(shownLyleRapsheet) || BF_GLOBALS.getFlag(shownLyleCrate1))
+ scene->_sceneMode = 8108;
+ else if (BF_INVENTORY.getObjectScene(INV_COBB_RAP) == 1)
+ scene->_sceneMode = 8107;
+ else
+ scene->_sceneMode = 8155;
+ break;
+ }
+
+ scene->setAction(&scene->_action1);
+ return true;
+
+ case INV_FOREST_RAP:
+ if (BF_GLOBALS.getFlag(shownLyleRapsheet))
+ scene->_sceneMode = 8148;
+ else {
+ BF_GLOBALS.setFlag(shownLyleRapsheet);
+ if (BF_GLOBALS._dayNumber != 2) {
+ scene->_sceneMode = BF_GLOBALS.getFlag(shownLylePO) ? 8122 : 8101;
+ } else if (BF_GLOBALS.getFlag(onDuty)) {
+ scene->_sceneMode = BF_GLOBALS.getFlag(shownLylePO) ? 8142 : 8143;
+ } else {
+ scene->_sceneMode = BF_GLOBALS.getFlag(shownLylePO) ? 8130 : 8131;
+ }
+ }
+ BF_GLOBALS._player.disableControl();
+ scene->setAction(&scene->_action1);
+ return true;
+
+ case INV_COBB_RAP:
+ if (BF_GLOBALS.getFlag(shownFax)) {
+ scene->_sceneMode = 8151;
+ } else {
+ BF_GLOBALS.setFlag(shownFax);
+ scene->_sceneMode = 8118;
+ }
+
+ BF_GLOBALS._player.disableControl();
+ scene->setAction(&scene->_action1);
+ return true;
+
+ case INV_AUTO_RIFLE:
+ BF_INVENTORY.setObjectScene(INV_AUTO_RIFLE, 810);
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 8116;
+ scene->setAction(&scene->_sequenceManager1, scene, 8116, &BF_GLOBALS._player, NULL);
+ return true;
+
+ case INV_PRINT_OUT:
+ if (BF_GLOBALS.getFlag(shownLylePO)) {
+ scene->_sceneMode = 8149;
+ } else {
+ BF_GLOBALS.setFlag(shownLylePO);
+ if (BF_GLOBALS._dayNumber == 3) {
+ if (BF_GLOBALS.getFlag(shownFax)) {
+ BF_GLOBALS.setFlag(shownFax);
+ scene->_sceneMode = 8125;
+ } else if (BF_GLOBALS.getFlag(shownLyleRapsheet)) {
+ scene->_sceneMode = 8104;
+ } else {
+ scene->_sceneMode = 8121;
+ }
+ } else if (BF_GLOBALS.getFlag(onDuty)) {
+ if ((BF_GLOBALS.getFlag(shownLyleRapsheet)) || (BF_GLOBALS.getFlag(shownLyleCrate1))){
+ scene->_sceneMode = 8141;
+ } else {
+ // Doublecheck on shownLyleCrate1 removed: useless
+ scene->_sceneMode = 8144;
+ }
+ } else {
+ if ((BF_GLOBALS.getFlag(shownLyleRapsheet)) || (BF_GLOBALS.getFlag(shownLyleCrate1))) {
+ scene->_sceneMode = 8129;
+ } else { // if (BF_GLOBALS.getFlag(shownLyleCrate1)) {
+ scene->_sceneMode = 8132;
+ // doublecheck Present in the original, may hide a bug in the original
+ //} else
+ // scene->_sceneMode = 8121;
+ }
+ }
+ }
+
+ BF_GLOBALS._player.disableControl();
+ scene->setAction(&scene->_action1);
+ return true;
+
+ case INV_CRATE1:
+ if (BF_GLOBALS.getFlag(shownLyleCrate1)) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 8147;
+ scene->setAction(&scene->_action1);
+ } else {
+ BF_GLOBALS.setFlag(shownLyleCrate1);
+ BF_GLOBALS._player.disableControl();
+ scene->setAction(&scene->_action2);
+ }
+ return true;
+
+ default:
+ return NamedObjectExt::startAction(action, event);
+ }
+}
+
+bool Scene810::Chair::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(810, 28);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(810, 29);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene810::Object3::startAction(CursorType action, Event &event) {
+ Scene810 *scene = (Scene810 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(810, 30);
+ return true;
+ case CURSOR_USE:
+ if (!BF_GLOBALS.getFlag(seenFolder)) {
+ BF_GLOBALS.setFlag(seenFolder);
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 8104;
+ scene->setAction(&scene->_sequenceManager1, scene, 8104, &BF_GLOBALS._player, this, NULL);
+ } else if (BF_INVENTORY.getObjectScene(INV_MICROFILM) == 810) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 8114;
+ scene->setAction(&scene->_sequenceManager1, scene, 8114, &BF_GLOBALS._player, NULL);
+ } else {
+ SceneItem::display2(810, 38);
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene810::FaxMachineInset::startAction(CursorType action, Event &event) {
+ Scene810 *scene = (Scene810 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_WALK:
+ return true;
+ case CURSOR_LOOK:
+ SceneItem::display2(810, 32);
+ return true;
+ case CURSOR_USE:
+ if (scene->_rect3.contains(event.mousePos)) {
+ if (BF_INVENTORY.getObjectScene(INV_PRINT_OUT) == 811) {
+ T2_GLOBALS._uiElements.addScore(50);
+ scene->_sound1.play(77);
+ scene->_fieldA70 = 1;
+ BF_GLOBALS._player.disableControl();
+
+ scene->_sceneMode = 8109;
+ scene->setAction(&scene->_sequenceManager1, scene, 8109, &BF_GLOBALS._player,
+ &scene->_object6, &scene->_object5, NULL);
+ scene->_fieldA74 = 1;
+ remove();
+ } else {
+ SceneItem::display2(810, 39);
+ }
+ }
+
+ if (scene->_rect1.contains(event.mousePos) || scene->_rect2.contains(event.mousePos)) {
+ if (BF_INVENTORY.getObjectScene(INV_PRINT_OUT) == 811) {
+ scene->_sound1.play(77);
+ BF_GLOBALS._player.disableControl();
+
+ scene->_sceneMode = 8109;
+ scene->setAction(&scene->_sequenceManager1, scene, 8109, &BF_GLOBALS._player,
+ &scene->_object6, &scene->_object5, NULL);
+ scene->_fieldA74 = 1;
+ remove();
+ } else {
+ SceneItem::display2(810, 39);
+ }
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene810::Object5::startAction(CursorType action, Event &event) {
+ Scene810 *scene = (Scene810 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(810, 33);
+ return true;
+ case CURSOR_USE: {
+ scene->_sceneMode = 8195;
+ BF_GLOBALS._player.disableControl();
+
+ PlayerMover *mover = new PlayerMover();
+ Common::Point destPos(67, 111);
+ BF_GLOBALS._player.addMover(mover, &destPos, scene);
+ return true;
+ }
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene810::Object7::startAction(CursorType action, Event &event) {
+ Scene810 *scene = (Scene810 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ case CURSOR_USE:
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 8113;
+ scene->setAction(&scene->_sequenceManager1, scene, 8113, &BF_GLOBALS._player, NULL);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene810::Map::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(810, 0);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(810, 1);
+ return true;
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+bool Scene810::Window::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(810, 2);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(810, 3);
+ return true;
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+bool Scene810::Bookcase::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(810, 4);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(810, 5);
+ return true;
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+bool Scene810::FaxMachine::startAction(CursorType action, Event &event) {
+ Scene810 *scene = (Scene810 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(810, 6);
+ return true;
+ case CURSOR_USE:
+ if (scene->_fieldA74 == 1) {
+ scene->_object5.startAction(action, event);
+ } else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 8105;
+
+ Common::Point destPos(67, 111);
+ PlayerMover *mover = new PlayerMover();
+ BF_GLOBALS._player.addMover(mover, &destPos, scene);
+ }
+ return true;
+ case INV_PRINT_OUT:
+ if (BF_INVENTORY.getObjectScene(INV_COBB_RAP) == 1)
+ SceneItem::display2(810, 31);
+ else {
+ BF_INVENTORY.setObjectScene(INV_PRINT_OUT, 811);
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 811;
+
+ if (BF_GLOBALS._sceneObjects->contains(&scene->_lyle)) {
+ scene->setAction(&scene->_sequenceManager1, scene, BF_GLOBALS.getFlag(onDuty) ? 8108 : 8105,
+ &BF_GLOBALS._player, &scene->_object6, NULL);
+ } else {
+ scene->setAction(&scene->_sequenceManager1, scene, 8111, &BF_GLOBALS._player,
+ &scene->_object6, NULL);
+ }
+ }
+ return true;
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+bool Scene810::GarbageCan::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(810, 8);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(810, 9);
+ return true;
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+bool Scene810::FileCabinets::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(810, 10);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(810, 11);
+ return true;
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+bool Scene810::CoffeeMaker::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(810, 12);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(810, 13);
+ return true;
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+bool Scene810::Shelves::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(810, 14);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(810, 15);
+ return true;
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+bool Scene810::MicroficheReader::startAction(CursorType action, Event &event) {
+ Scene810 *scene = (Scene810 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(810, 16);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(810, 17);
+ return true;
+ case INV_MICROFILM:
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 8106;
+ scene->setAction(&scene->_sequenceManager1, scene, 8106, &BF_GLOBALS._player, NULL);
+ return true;
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+bool Scene810::Item10::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(810, 18);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(810, 19);
+ return true;
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+bool Scene810::Pictures::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(810, 20);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(810, 21);
+ return true;
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+bool Scene810::Item12::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(810, 22);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(810, 23);
+ return true;
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+bool Scene810::Background::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(810, 24);
+ return true;
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+bool Scene810::Desk::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(810, 36);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(810, 37);
+ return true;
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+bool Scene810::Exit::startAction(CursorType action, Event &event) {
+ ADD_PLAYER_MOVER(event.mousePos.x + 30, event.mousePos.y);
+ return true;
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene810::Scene810(): SceneExt() {
+ _fieldA70 = _fieldA74 = 0;
+ _rect1 = Rect(68, 12, 120, 22);
+ _rect2 = Rect(59, 27, 117, 37);
+ _rect3 = Rect(49, 43, 112, 54);
+}
+
+void Scene810::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ s.syncAsSint16LE(_fieldA70);
+ s.syncAsSint16LE(_fieldA72);
+ s.syncAsSint16LE(_fieldA74);
+}
+
+void Scene810::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(810);
+ setZoomPercents(90, 80, 135, 100);
+ if (BF_GLOBALS._sceneManager._previousScene != 820)
+ BF_GLOBALS._sound1.fadeSound(76);
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_jakeJacketSpeaker);
+ _stripManager.addSpeaker(&_jakeUniformSpeaker);
+ _stripManager.addSpeaker(&_lyleHatSpeaker);
+
+ 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.changeZoom(-1);
+ BF_GLOBALS._player._moveDiff = Common::Point(5, 3);
+ BF_GLOBALS._player.enableControl();
+
+ if (BF_GLOBALS._dayNumber == 2)
+ BF_GLOBALS.setFlag(beenToJRDay2);
+
+ if (BF_GLOBALS._dayNumber == 3) {
+ _object3.postInit();
+ _object3.setVisage(810);
+ _object3.setStrip(3);
+ _object3.setPosition(Common::Point(154, 97));
+ _object3.fixPriority(128);
+ BF_GLOBALS._sceneItems.push_back(&_object3);
+ }
+
+ if (BF_GLOBALS._dayNumber == 4) {
+ BF_INVENTORY.setObjectScene(INV_FOREST_RAP, 0);
+ BF_INVENTORY.setObjectScene(INV_COBB_RAP, 0);
+ BF_INVENTORY.setObjectScene(INV_PRINT_OUT, 0);
+ BF_INVENTORY.setObjectScene(INV_CRATE1, 0);
+ }
+
+ _desk._sceneRegionId = 12;
+ BF_GLOBALS._sceneItems.push_back(&_desk);
+
+ _lyle.postInit();
+ _lyle.setVisage(812);
+ _lyle.setPosition(Common::Point(115, 112));
+ _lyle._moveDiff = Common::Point(4, 2);
+ _lyle.changeZoom(-1);
+ _lyle._flag = 0;
+ BF_GLOBALS._sceneItems.push_back(&_lyle);
+
+ _chair.postInit();
+ _chair.setVisage(810);
+ _chair.setStrip(2);
+ _chair.setPosition(Common::Point(113, 126));
+ _chair.hide();
+ BF_GLOBALS._sceneItems.push_back(&_chair);
+
+ _object6.postInit();
+ _object6.setVisage(810);
+ _object6.setStrip(6);
+ _object6.setPosition(Common::Point(51, 65));
+ _object6._numFrames = 3;
+ _object6.hide();
+
+ _object5.postInit();
+ _object5.setVisage(810);
+ _object5.setStrip(5);
+ _object5.setPosition(Common::Point(58, 82));
+ _object5._numFrames = 3;
+ _object5.fixPriority(108);
+ _object5.hide();
+
+ if (BF_INVENTORY.getObjectScene(INV_PRINT_OUT) == 811) {
+ _object5.show();
+ BF_GLOBALS._sceneItems.push_back(&_object5);
+ }
+
+ if ((BF_GLOBALS._dayNumber == 4) && (BF_GLOBALS._bookmark < bEndDayThree)) {
+ _lyle.remove();
+ _chair.show();
+ }
+
+ switch (BF_GLOBALS._sceneManager._previousScene) {
+ case 820:
+ BF_GLOBALS._player.setStrip(7);
+ BF_GLOBALS._player.setPosition(Common::Point(278, 116));
+
+ _lyle.setVisage(845);
+ _lyle.setPosition(Common::Point(340, 175));
+ _lyle.setObjectWrapper(new SceneObjectWrapper());
+ _lyle.animate(ANIM_MODE_1, NULL);
+
+ _chair.show();
+
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 8107;
+ setAction(&_sequenceManager1, this, 8107, &BF_GLOBALS._player, &_lyle, NULL);
+ break;
+ case 935:
+ BF_GLOBALS._v51C44 = 1;
+ BF_GLOBALS._scenePalette.loadPalette(2);
+ _lyle.remove();
+
+ BF_GLOBALS._player.setPosition(Common::Point(174, 142));
+ BF_GLOBALS._player.setStrip(8);
+ BF_GLOBALS._player.enableControl();
+
+ _chair.remove();
+ break;
+ default:
+ BF_GLOBALS._player.setPosition(Common::Point(340, 180));
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 8100;
+
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ _lyle.setVisage(845);
+ _lyle.setPosition(Common::Point(340, 175));
+ _lyle.setObjectWrapper(new SceneObjectWrapper());
+ _lyle.animate(ANIM_MODE_1, NULL);
+
+ _chair.show();
+ _sceneMode = 8196;
+ setAction(&_sequenceManager1, NULL, 8100, &BF_GLOBALS._player, NULL);
+ _lyle.setAction(&_sequenceManager2, this, 8107, &BF_GLOBALS._player, &_lyle, NULL);
+ } else {
+ setAction(&_sequenceManager1, this, 8100, &BF_GLOBALS._player, NULL);
+ }
+ break;
+ }
+
+ _exit.setDetails(Rect(315, 117, 320, 154), 810, -1, -1, -1, 1, NULL);
+ _map.setBounds(Rect(10, 10, 81, 52));
+ _window.setBounds(Rect(96, 10, 155, 49));
+ _bookcase.setBounds(Rect(5, 70, 74, 105));
+ _garbageCan.setBounds(Rect(84, 118, 101, 142));
+ _fileCabinets.setBounds(Rect(203, 41, 255, 100));
+ _coffeeMaker.setBounds(Rect(182, 54, 202, 89));
+ _shelves.setBounds(Rect(265, 10, 319, 41));
+ _microficheReader.setBounds(Rect(283, 47, 314, 73));
+
+ _faxMachine._sceneRegionId = 8;
+ BF_GLOBALS._sceneItems.push_back(&_faxMachine);
+ _item10._sceneRegionId = 9;
+ BF_GLOBALS._sceneItems.push_back(&_item10);
+ _pictures._sceneRegionId = 10;
+ BF_GLOBALS._sceneItems.push_back(&_pictures);
+ _item12._sceneRegionId = 8;
+ BF_GLOBALS._sceneItems.push_back(&_item12);
+
+ BF_GLOBALS._sceneItems.addItems(&_microficheReader, &_map, &_window, &_bookcase, &_garbageCan,
+ &_fileCabinets, &_coffeeMaker, &_shelves, &_background, NULL);
+ _background.setBounds(Rect(0, 0, SCREEN_WIDTH, UI_INTERFACE_Y));
+}
+
+void Scene810::signal() {
+ switch (_sceneMode) {
+ case 811:
+ case 8105:
+ _faxMachineInset.postInit();
+ _faxMachineInset.setVisage(810);
+ _faxMachineInset.setPosition(Common::Point(77, 94));
+ _faxMachineInset.setStrip(8);
+ _faxMachineInset.fixPriority(250);
+ BF_GLOBALS._sceneItems.push_back(&_faxMachineInset);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 8100:
+ if (BF_GLOBALS.getFlag(examinedFile810)) {
+ if ((BF_GLOBALS._dayNumber == 4) && BF_GLOBALS._sceneObjects->contains(&_lyle)) {
+ _sceneMode = 8115;
+ setAction(&_sequenceManager1, this, 8115, &BF_GLOBALS._player, NULL);
+ } else {
+ BF_GLOBALS._player.enableControl();
+ }
+ } else {
+ if ((BF_GLOBALS._dayNumber == 3) && BF_GLOBALS._sceneObjects->contains(&_lyle)) {
+ _sceneMode = 8103;
+ setAction(&_sequenceManager1, this, 8103, &BF_GLOBALS._player, &_lyle, &_chair, NULL);
+ } else if (BF_GLOBALS.getFlag(shownLyleCrate1Day1) && !BF_GLOBALS.getFlag(shownLyleCrate1)) {
+ BF_GLOBALS.setFlag(shownLyleCrate1);
+ setAction(&_action2);
+ } else {
+ BF_GLOBALS._player.enableControl();
+ }
+ }
+ break;
+ case 8101:
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS._sceneManager.changeScene(800);
+ break;
+ case 8103:
+ _lyle.remove();
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 8104:
+ BF_GLOBALS.setFlag(examinedFile810);
+ _object7.postInit();
+ _object7.setVisage(810);
+ _object7.setPosition(Common::Point(54, 101));
+ _object7.fixPriority(200);
+ BF_GLOBALS._sceneItems.push_front(&_object7);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 8106:
+ T2_GLOBALS._uiElements.addScore(30);
+ BF_INVENTORY.setObjectScene(INV_MICROFILM, 820);
+ BF_GLOBALS._sceneManager.changeScene(820);
+ break;
+ case 8107:
+ if (BF_GLOBALS.getFlag(shownFax)) {
+ BF_GLOBALS.setFlag(showMugAround);
+ } else {
+ BF_GLOBALS._walkRegions.disableRegion(4);
+ BF_GLOBALS._player.enableControl();
+ }
+ break;
+ case 8109:
+ _object6.setFrame(1);
+ BF_GLOBALS._sceneItems.push_front(&_object5);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 8110:
+ case 8115:
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 8112:
+ BF_GLOBALS.setFlag(fWithLyle);
+ BF_GLOBALS._sceneManager.changeScene(800);
+ break;
+ case 8113:
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS._sceneManager.changeScene(935);
+ break;
+ case 8114:
+ T2_GLOBALS._uiElements.addScore(10);
+ BF_INVENTORY.setObjectScene(INV_MICROFILM, 1);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 8116:
+ BF_GLOBALS._bookmark = bDoneWithIsland;
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 8195:
+ BF_GLOBALS._player.setStrip(8);
+ BF_INVENTORY.setObjectScene(INV_PRINT_OUT, 1);
+ if (_fieldA70 == 1) {
+ BF_INVENTORY.setObjectScene(INV_COBB_RAP, 1);
+ _sceneMode = 8110;
+ if (BF_GLOBALS._sceneObjects->contains(&_lyle)) {
+ _sceneMode = 8198;
+ BF_GLOBALS.setFlag(shownFax);
+ _stripManager.start(BF_GLOBALS.getFlag(onDuty) ? 8135 : 8106, this);
+ } else {
+ _stripManager.start(8117, this);
+ }
+ } else {
+ SceneItem::display2(810, 34);
+ BF_GLOBALS._player.enableControl();
+ }
+
+ _fieldA74 = 0;
+ _object5.hide();
+ _object5.setFrame(1);
+ break;
+ case 8196:
+ BF_GLOBALS._walkRegions.disableRegion(4);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 8198:
+ if (BF_GLOBALS._dayNumber == 3) {
+ BF_GLOBALS.setFlag(showMugAround);
+ } else {
+ BF_GLOBALS._player.enableControl();
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene810::process(Event &event) {
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (UI_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);
+ }
+ }
+
+ if (!event.handled)
+ SceneExt::process(event);
+}
+
+void Scene810::dispatch() {
+ SceneExt::dispatch();
+
+ if (BF_GLOBALS._sceneObjects->contains(&_lyle) && (BF_GLOBALS._player._position.x != 115) && !_lyle._mover) {
+ _lyle.updateAngle(BF_GLOBALS._player._position);
+ }
+
+ if (BF_GLOBALS._sceneObjects->contains(&_faxMachineInset) && (BF_GLOBALS._player._position.x != 67) &&
+ (BF_GLOBALS._player._position.y != 111)) {
+ _faxMachineInset.remove();
+ }
+
+ if (!_action) {
+ if (BF_GLOBALS.getFlag(showMugAround)) {
+ if (_lyle._position.y == 115) {
+ BF_GLOBALS._player.disableControl();
+
+ _sceneMode = 8110;
+ setAction(&_sequenceManager1, this, 8117, &_lyle, &_chair, NULL);
+ } else {
+ BF_GLOBALS.clearFlag(showMugAround);
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._walkRegions.enableRegion(4);
+ BF_GLOBALS._walkRegions.enableRegion(13);
+
+ _sceneMode = 8112;
+ setAction(&_sequenceManager1, this, 8112, &BF_GLOBALS._player, &_lyle, NULL);
+ }
+ }
+
+ if (BF_GLOBALS._player._position.x >= 318) {
+ BF_GLOBALS._player.disableControl();
+
+ if ((BF_GLOBALS._dayNumber == 3) && !BF_GLOBALS.getFlag(examinedFile810)) {
+ SceneItem::display2(810, 35);
+ _sceneMode = 8100;
+ setAction(&_sequenceManager1, this, 8100, &BF_GLOBALS._player, NULL);
+ } else {
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ BF_GLOBALS._walkRegions.enableRegion(4);
+ BF_GLOBALS._walkRegions.enableRegion(13);
+
+ ADD_MOVER_NULL(_lyle, 320, 155);
+ }
+
+ _sceneMode = 8101;
+ setAction(&_sequenceManager1, this, 8101, &BF_GLOBALS._player, NULL);
+ }
+ }
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 820 - Microfiche Reader
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene820::PowerButton::startAction(CursorType action, Event &event) {
+ Scene820 *scene = (Scene820 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(820, 5);
+ return true;
+ case CURSOR_USE:
+ scene->_sound1.play(69);
+ if (_flags & OBJFLAG_HIDING) {
+ scene->_pageNumber = 0;
+ show();
+ BF_GLOBALS._scenePalette.loadPalette(821);
+ BF_GLOBALS._scenePalette.refresh();
+
+ SceneItem::display(820, scene->_pageNumber, SET_WIDTH, 240, SET_X, 41, SET_Y, 0,
+ SET_FONT, 50, SET_FG_COLOR, 18, SET_EXT_BGCOLOR, 12, SET_KEEP_ONSCREEN, true, LIST_END);
+ } else {
+ BF_GLOBALS._scenePalette.loadPalette(820);
+ BF_GLOBALS._scenePalette.refresh();
+
+ scene->_object4.remove();
+ scene->_object5.remove();
+
+ SceneItem::display(0, 0);
+ hide();
+
+ BF_GLOBALS._sceneManager.changeScene(810);
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene820::BackButton::startAction(CursorType action, Event &event) {
+ Scene820 *scene = (Scene820 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(820, 7);
+ return true;
+ case CURSOR_USE:
+ // WORKAROUND: The original game had a bug where you could see the microfiche text by directly
+ // using the paging buttons, but then you had to use the power button twice to 'turn on' the
+ // reader and then off again. This check prevents the paging buttons being used until the
+ // reader is properly turned on.
+ if (scene->_powerButton._flags & OBJFLAG_HIDING)
+ return true;
+
+ scene->_sound1.play(72);
+ show();
+ scene->_sceneMode = 8200;
+ scene->setAction(&scene->_sequenceManager, scene, 8200, NULL);
+
+ if (scene->_pageNumber)
+ --scene->_pageNumber;
+ if (scene->_pageNumber == 3) {
+ scene->_object4.hide();
+ scene->_object5.hide();
+ }
+
+ SceneItem::display(820, scene->_pageNumber, SET_WIDTH, 240, SET_X, 41, SET_Y, 0,
+ SET_FONT, 50, SET_FG_COLOR, 18, SET_EXT_BGCOLOR, 12, SET_KEEP_ONSCREEN, true, LIST_END);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene820::ForwardButton::startAction(CursorType action, Event &event) {
+ Scene820 *scene = (Scene820 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(820, 6);
+ return true;
+ case CURSOR_USE:
+ // WORKAROUND: The original game had a bug where you could see the microfiche text by directly
+ // using the paging buttons, but then you had to use the power button twice to 'turn on' the
+ // reader and then off again. This check prevents the paging buttons being used until the
+ // reader is properly turned on.
+ if (scene->_powerButton._flags & OBJFLAG_HIDING)
+ return true;
+
+ scene->_sound1.play(72);
+ show();
+ scene->_sceneMode = 8200;
+ scene->setAction(&scene->_sequenceManager, scene, 8200, NULL);
+
+ if (scene->_pageNumber < 4)
+ ++scene->_pageNumber;
+
+ SceneItem::display(820, scene->_pageNumber, SET_WIDTH, 240, SET_X, 41, SET_Y, 0,
+ SET_FONT, 50, SET_FG_COLOR, 18, SET_EXT_BGCOLOR, 12, SET_KEEP_ONSCREEN, true, LIST_END);
+
+ if (scene->_pageNumber == 4) {
+ scene->_object4.show();
+ scene->_object5.show();
+ }
+
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene820::Scene820(): SceneExt() {
+ _pageNumber = 0;
+}
+
+void Scene820::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ s.syncAsSint16LE(_pageNumber);
+}
+
+void Scene820::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(820);
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+
+ _powerButton.postInit();
+ _powerButton.setVisage(820);
+ _powerButton.setPosition(Common::Point(42, 163));
+ _powerButton.hide();
+ BF_GLOBALS._sceneItems.push_back(&_powerButton);
+
+ _backButton.postInit();
+ _backButton.setVisage(820);
+ _backButton.setStrip(2);
+ _backButton.setPosition(Common::Point(278, 155));
+ _backButton.hide();
+ BF_GLOBALS._sceneItems.push_back(&_backButton);
+
+ _forwardButton.postInit();
+ _forwardButton.setVisage(820);
+ _forwardButton.setStrip(3);
+ _forwardButton.setPosition(Common::Point(278, 164));
+ _forwardButton.hide();
+ BF_GLOBALS._sceneItems.push_back(&_forwardButton);
+
+ _object4.postInit();
+ _object4.setVisage(821);
+ _object4.setPosition(Common::Point(96, 130));
+ _object4.hide();
+
+ _object5.postInit();
+ _object5.setVisage(821);
+ _object5.setStrip(2);
+ _object5.setPosition(Common::Point(223, 130));
+ _object5.hide();
+
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._player._canWalk = false;
+
+ _item1.setDetails(Rect(0, 0, SCREEN_WIDTH, UI_INTERFACE_Y), 820, -1, -1, -1, 1, NULL);
+}
+
+void Scene820::signal() {
+ if (_sceneMode == 8200) {
+ _forwardButton.hide();
+ _backButton.hide();
+ }
+}
+
+/*--------------------------------------------------------------------------
* Scene 830 - Outside Boat Rentals
*
*--------------------------------------------------------------------------*/
@@ -421,7 +1559,7 @@ bool Scene830::Door::startAction(CursorType action, Event &event) {
return NamedObject::startAction(action, event);
}
-bool Scene830::Object4::startAction(CursorType action, Event &event) {
+bool Scene830::RentalBoat::startAction(CursorType action, Event &event) {
Scene830 *scene = (Scene830 *)BF_GLOBALS._sceneManager._scene;
if (action == INV_RENTAL_KEYS) {
@@ -431,7 +1569,7 @@ bool Scene830::Object4::startAction(CursorType action, Event &event) {
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);
+ scene->setAction(&scene->_sequenceManager, scene, 834, &BF_GLOBALS._player, &scene->_rentalBoat, NULL);
}
return true;
} else {
@@ -529,12 +1667,12 @@ void Scene830::postInit(SceneObjectList *OwnerList) {
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);
+ _rentalBoat.postInit();
+ _rentalBoat.setVisage(830);
+ _rentalBoat.setStrip(1);
+ _rentalBoat.setPosition(Common::Point(271, 146));
+ _rentalBoat.fixPriority(90);
+ _rentalBoat.setDetails(830, 0, 1, 2, 1, NULL);
}
_door.postInit();
@@ -573,7 +1711,7 @@ void Scene830::postInit(SceneObjectList *OwnerList) {
_field18A4 = 0;
_lyle.postInit();
- _lyle._flags = OBJFLAG_CHECK_REGION;
+// _lyle._flags = OBJFLAG_CHECK_REGION;
_lyle.setVisage(835);
_lyle.setObjectWrapper(new SceneObjectWrapper());
_lyle.animate(ANIM_MODE_1, NULL);
@@ -727,13 +1865,13 @@ void Scene830::signal() {
BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
BF_GLOBALS._player._strip = 7;
- BF_GLOBALS._uiElements.addScore(30);
+ T2_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);
+ T2_GLOBALS._uiElements.addScore(30);
BF_INVENTORY.setObjectScene(INV_FISHING_NET, 1);
break;
case 8309:
@@ -754,7 +1892,9 @@ void Scene830::process(Event &event) {
event.handled = true;
}
- if (BF_GLOBALS._player._enabled && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ SceneExt::process(event);
+
+ if (BF_GLOBALS._player._enabled && (event.mousePos.y < (UI_INTERFACE_Y - 1))) {
// Check if the cursor is on an exit
if (_seExit.contains(event.mousePos)) {
GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SE);
@@ -800,7 +1940,7 @@ void Scene830::dispatch() {
*
*--------------------------------------------------------------------------*/
-void Scene840::Object2::postInit(SceneObjectList *OwnerList) {
+void Scene840::BoatKeysInset::postInit(SceneObjectList *OwnerList) {
FocusObject::postInit(OwnerList);
if (BF_INVENTORY.getObjectScene(INV_RENTAL_KEYS) != 1) {
@@ -826,18 +1966,19 @@ void Scene840::Object2::postInit(SceneObjectList *OwnerList) {
_v1B4 = _v1B6 = 0;
}
-void Scene840::Object2::remove() {
+void Scene840::BoatKeysInset::remove() {
Scene840 *scene = (Scene840 *)BF_GLOBALS._sceneManager._scene;
_rentalKeys.remove();
_waveKeys.remove();
+ FocusObject::remove();
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 8412;
scene->setAction(&scene->_sequenceManager1, scene, 8412, &BF_GLOBALS._player, NULL);
}
-void Scene840::Object2::process(Event &event) {
+void Scene840::BoatKeysInset::process(Event &event) {
if (BF_GLOBALS._player._enabled) {
if (_bounds.contains(event.mousePos)) {
CursorType cursorId = BF_GLOBALS._events.getCursor();
@@ -859,7 +2000,7 @@ void Scene840::Object2::process(Event &event) {
FocusObject::process(event);
}
-bool Scene840::Object2::startAction(CursorType action, Event &event) {
+bool Scene840::BoatKeysInset::startAction(CursorType action, Event &event) {
switch (action) {
case CURSOR_LOOK:
if ((event.mousePos.y > 43) && (event.mousePos.y < 92)) {
@@ -882,9 +2023,9 @@ bool Scene840::Object2::startAction(CursorType action, Event &event) {
break;
case INV_WAVE_KEYS:
if ((BF_GLOBALS._dayNumber != 4) || (BF_GLOBALS._bookmark != bEndDayThree))
- SceneItem::display(840, 47);
+ SceneItem::display2(840, 47);
else {
- BF_GLOBALS._uiElements.addScore(50);
+ T2_GLOBALS._uiElements.addScore(50);
if (BF_INVENTORY.getObjectScene(INV_RENTAL_KEYS) == 1) {
// Replace rental keys
@@ -919,7 +2060,7 @@ bool Scene840::Object2::startAction(CursorType action, Event &event) {
return FocusObject::startAction(action, event);
}
-bool Scene840::Object2::RentalKeys::startAction(CursorType action, Event &event) {
+bool Scene840::BoatKeysInset::RentalKeys::startAction(CursorType action, Event &event) {
Scene840 *scene = (Scene840 *)BF_GLOBALS._sceneManager._scene;
switch (action) {
@@ -929,9 +2070,9 @@ bool Scene840::Object2::RentalKeys::startAction(CursorType action, Event &event)
} else {
SceneItem::display2(840, 55);
BF_INVENTORY.setObjectScene(INV_RENTAL_KEYS, 1);
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
- scene->_object2._v1B4 = 1;
+ scene->_boatKeysInset._v1B4 = 1;
remove();
}
return true;
@@ -940,16 +2081,16 @@ bool Scene840::Object2::RentalKeys::startAction(CursorType action, Event &event)
}
}
-bool Scene840::Object2::WaveKeys::startAction(CursorType action, Event &event) {
+bool Scene840::BoatKeysInset::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);
+ SceneItem::display2(840, 56);
BF_INVENTORY.setObjectScene(INV_WAVE_KEYS, 1);
- BF_GLOBALS._uiElements.addScore(50);
- scene->_object2._v1B6 = 1;
+ T2_GLOBALS._uiElements.addScore(50);
+ scene->_boatKeysInset._v1B6 = 1;
remove();
} else {
SceneItem::display2(840, 9);
@@ -960,7 +2101,7 @@ bool Scene840::Object2::WaveKeys::startAction(CursorType action, Event &event) {
}
}
-bool Scene840::Object6::startAction(CursorType action, Event &event) {
+bool Scene840::BoatKeys::startAction(CursorType action, Event &event) {
Scene840 *scene = (Scene840 *)BF_GLOBALS._sceneManager._scene;
switch (action) {
@@ -1021,7 +2162,7 @@ bool Scene840::Carter::startAction(CursorType action, Event &event) {
if (BF_INVENTORY.getObjectScene(INV_WAVE_KEYS) == 1) {
if (!BF_GLOBALS.getFlag(fGotPointsForCombo)) {
- BF_GLOBALS._uiElements.addScore(50);
+ T2_GLOBALS._uiElements.addScore(50);
BF_GLOBALS.setFlag(fGotPointsForCombo);
}
}
@@ -1145,16 +2286,16 @@ void Scene840::postInit(SceneObjectList *OwnerList) {
_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);
+ _item13.setDetails(Rect(0, 0, SCREEN_WIDTH - 1, UI_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);
+ _boatKeys.postInit();
+ _boatKeys.setVisage(840);
+ _boatKeys.setStrip(4);
+ _boatKeys.setFrame(1);
+ _boatKeys.setPosition(Common::Point(250, 83));
+ _boatKeys.fixPriority(120);
+ _boatKeys.setDetails(840, -1, 8, 9, 2, NULL);
_field1AC0 = 1;
}
@@ -1245,9 +2386,9 @@ void Scene840::signal() {
break;
case 4:
_sceneMode = 8403;
- _object6.postInit();
- _object6.setDetails(840, -1, 8, 9, 2, NULL);
- setAction(&_sequenceManager1, this, 8403, &_carter, &_object6, NULL);
+ _boatKeys.postInit();
+ _boatKeys.setDetails(840, -1, 8, 9, 2, NULL);
+ setAction(&_sequenceManager1, this, 8403, &_carter, &_boatKeys, NULL);
break;
case 5:
_sceneMode = 8408;
@@ -1261,7 +2402,7 @@ void Scene840::signal() {
if ((BF_GLOBALS._dayNumber == 4) && (BF_GLOBALS._bookmark >= bEndDayThree)) {
_stripManager.start(8440, this);
_sceneMode = 3;
- } else if (BF_GLOBALS._sceneObjects->contains(&_object6)) {
+ } else if (BF_GLOBALS._sceneObjects->contains(&_boatKeys)) {
_stripManager.start(8442, this);
_sceneMode = 3;
} else if (_field1AC6) {
@@ -1280,13 +2421,13 @@ void Scene840::signal() {
break;
case 8402:
BF_GLOBALS._player.enableControl();
- BF_GLOBALS._uiElements.addScore(30);
+ T2_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);
+ T2_GLOBALS._uiElements.addScore(30);
_sceneMode = 3;
_field1AC0 = 1;
_stripManager.start(8441, this);
@@ -1323,18 +2464,18 @@ void Scene840::signal() {
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);
+ _boatKeysInset.postInit();
+ _boatKeysInset.setVisage(840);
+ _boatKeysInset.setStrip(2);
+ _boatKeysInset.setPosition(Common::Point(160, 140));
+ _boatKeysInset.fixPriority(254);
+ _boatKeysInset.setDetails(840, 50, 8, 51);
break;
case 8412:
- if (_object2._v1B6) {
+ if (_boatKeysInset._v1B6) {
_sceneMode = 8409;
setAction(&_sequenceManager1, this, 8409, &BF_GLOBALS._player, &_carter, &_doors, NULL);
- } else if (!_object2._v1B4) {
+ } else if (!_boatKeysInset._v1B4) {
BF_GLOBALS._player.enableControl();
} else {
_sceneMode = 3;
@@ -1348,13 +2489,13 @@ void Scene840::signal() {
}
break;
case 8413:
- BF_GLOBALS._uiElements.addScore(50);
+ T2_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);
+ T2_GLOBALS._uiElements.addScore(50);
BF_INVENTORY.setObjectScene(INV_WAVE_KEYS, 0);
BF_INVENTORY.setObjectScene(INV_RENTAL_KEYS, 0);
BF_GLOBALS._player.enableControl();
@@ -1365,7 +2506,7 @@ void Scene840::signal() {
void Scene840::process(Event &event) {
SceneExt::process(event);
- if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (UI_INTERFACE_Y - 1))) {
if (_exit.contains(event.mousePos)) {
GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_E);
BF_GLOBALS._events.setCursor(surface);
@@ -1392,6 +2533,1092 @@ void Scene840::dispatch() {
}
}
+/*--------------------------------------------------------------------------
+ * Scene 850 - Boat Leaving/Entering Marina
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene850::Timer1::signal() {
+ PaletteRotation *rot = BF_GLOBALS._scenePalette.addRotation(240, 254, 1);
+ rot->setDelay(25);
+
+ remove();
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene850::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(850);
+ BF_GLOBALS._sound1.fadeSound(35);
+
+ BF_GLOBALS._player.disableControl();
+ _timer.set(2, NULL);
+
+ _object1.postInit();
+ if (BF_GLOBALS._sceneManager._previousScene == 830) {
+ _sceneMode = 8500;
+ setAction(&_sequenceManager, this, 8500, &_object1, NULL);
+ } else {
+ BF_GLOBALS._sound1.changeSound(10);
+ _sceneMode = 8501;
+ setAction(&_sequenceManager, this, 8501, &_object1, NULL);
+ }
+}
+
+void Scene850::remove() {
+ BF_GLOBALS._scenePalette.clearListeners();
+ SceneExt::remove();
+}
+
+void Scene850::signal() {
+ switch (_sceneMode) {
+ case 8500:
+ BF_GLOBALS._sceneManager.changeScene(860);
+ break;
+ case 8501:
+ BF_GLOBALS._sceneManager.changeScene(830);
+ break;
+ default:
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 860 - Boat Entering Cove
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene860::Action1::signal() {
+ Scene860 *scene = (Scene860 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ scene->_sound1.play(88);
+ scene->_sound1.holdAt(1);
+
+ if (scene->_field888 == scene->_field886) {
+ ++_actionIndex;
+ signal();
+ } else {
+ BF_GLOBALS._player.addMover(NULL);
+ BF_GLOBALS._player.setStrip((scene->_field886 == 1) ? 4 : 5);
+ scene->_field888 = scene->_field886;
+
+ BF_GLOBALS._player.setFrame(1);
+ BF_GLOBALS._player._numFrames = 9;
+ BF_GLOBALS._player.animate(ANIM_MODE_5, this);
+ }
+ break;
+ case 1:
+ if (scene->_field886 == 1) {
+ BF_GLOBALS._player._position.x += 5;
+ BF_GLOBALS._player.setStrip(3);
+ } else {
+ BF_GLOBALS._player._position.x -= 5;
+ BF_GLOBALS._player.setStrip(2);
+ }
+ signal();
+ // Deliberate fall-through
+ case 2:
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ ADD_MOVER_NULL(BF_GLOBALS._player, scene->_destPos.x, scene->_destPos.y);
+ remove();
+ break;
+ default:
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene860::Scene860(): SceneExt() {
+ _field87E = _field880 = 0;
+ _destPos.x = _destPos.y = 0;
+ _field886 = _field888 = 0;
+
+ _swRect = Rect(37, 102, 175, 128);
+ _neRect = Rect(259, 50, 320, 84);
+}
+
+void Scene860::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ s.syncAsSint16LE(_field87E);
+ s.syncAsSint16LE(_field880);
+ s.syncAsSint16LE(_destPos.x);
+ s.syncAsSint16LE(_destPos.y);
+ s.syncAsSint16LE(_field886);
+ s.syncAsSint16LE(_field888);
+
+ _swRect.synchronize(s);
+ _neRect.synchronize(s);
+ _yachtRect.synchronize(s);
+}
+
+void Scene860::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(880);
+
+ BF_GLOBALS._sound1.changeSound(90);
+ if (BF_GLOBALS._dayNumber == 0) {
+ BF_GLOBALS._dayNumber = 1;
+ BF_GLOBALS.setFlag(fBlowUpGoon);
+ }
+
+ if (BF_GLOBALS.getFlag(fBlowUpGoon)) {
+ _deadBody.postInit();
+ _deadBody.setVisage(875);
+ _deadBody.setStrip(7);
+ _deadBody.setFrame2(_deadBody.getFrameCount());
+ _deadBody.fixPriority(130);
+ _deadBody.setPosition(Common::Point(255, 148));
+ }
+
+ if (BF_GLOBALS._dayNumber == 5) {
+ _object2.postInit();
+ _object2.setVisage(880);
+ _object2.setPosition(Common::Point(196, 81));
+ BF_GLOBALS._sceneItems.push_back(&_object2);
+ _object2.setDetails(860, 0, 1, -1, 1, NULL);
+ _object2.fixPriority(20);
+
+ _neRect = Rect(0, 0, 0, 0);
+ _yachtRect = Rect(180, 66, 219, 79);
+ }
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setVisage(880);
+ BF_GLOBALS._player._moveDiff = Common::Point(1, 1);
+ BF_GLOBALS._player._moveRate = 20;
+
+ BF_GLOBALS._events.setCursor(CURSOR_WALK);
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._player._canWalk = false;
+
+ switch (BF_GLOBALS._sceneManager._previousScene) {
+ case 355:
+ if (BF_INVENTORY.getObjectScene(INV_GRENADES) == 860) {
+ _sceneMode = 8610;
+ setAction(&_sequenceManager, this, 8610, &BF_GLOBALS._player, NULL);
+ } else {
+ _sceneMode = 8609;
+ setAction(&_sequenceManager, this, 8609, &BF_GLOBALS._player, NULL);
+ _field87E = 0;
+ _field880 = 1;
+ _field888 = 1;
+ }
+ break;
+ case 870:
+ _sound1.play(89);
+ _sound1.holdAt(1);
+ _sceneMode = 8608;
+ setAction(&_sequenceManager, this, 8608, &BF_GLOBALS._player, NULL);
+ _field880 = 0;
+ _field87E = 2;
+ _field888 = 1;
+ break;
+ default:
+ _sound1.play(89);
+ _sound1.holdAt(1);
+ _sceneMode = 8607;
+ setAction(&_sequenceManager, this, 8607, &BF_GLOBALS._player, NULL);
+ _field87E = 0;
+ _field880 = 2;
+ _field888 = 1;
+ break;
+ }
+}
+
+void Scene860::signal() {
+ switch (_sceneMode) {
+ case 8601:
+ case 8606:
+ BF_GLOBALS._sceneManager.changeScene(870);
+ break;
+ case 8602:
+ case 8604:
+ BF_GLOBALS._sceneManager.changeScene(355);
+ break;
+ case 8603:
+ case 8605:
+ BF_GLOBALS._sceneManager.changeScene(850);
+ break;
+ case 8607:
+ case 8608:
+ case 8609:
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._player._canWalk = false;
+ break;
+ case 8610:
+ BF_GLOBALS._deathReason = 22;
+ BF_GLOBALS._sceneManager.changeScene(866);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene860::process(Event &event) {
+ if (_swRect.contains(event.mousePos)) {
+ GfxSurface cursor = _cursorVisage.getFrame(EXITFRAME_SW);
+ BF_GLOBALS._events.setCursor(cursor);
+
+ if ((event.eventType == EVENT_BUTTON_DOWN) && !_action) {
+ event.handled = true;
+ _field886 = 2;
+ _destPos = Common::Point(119, 126);
+ _field87E = 0;
+ setAction(&_action1);
+ }
+ } else if (_neRect.contains(event.mousePos)) {
+ GfxSurface cursor = _cursorVisage.getFrame(EXITFRAME_NE);
+ BF_GLOBALS._events.setCursor(cursor);
+
+ if ((event.eventType == EVENT_BUTTON_DOWN) && !_action) {
+ event.handled = true;
+ _field886 = 1;
+ _destPos = Common::Point(266, 56);
+ _field87E = 2;
+ setAction(&_action1);
+ }
+ } else if (_yachtRect.contains(event.mousePos)) {
+ GfxSurface cursor = _cursorVisage.getFrame(EXITFRAME_NW);
+ BF_GLOBALS._events.setCursor(cursor);
+
+ if ((event.eventType == EVENT_BUTTON_DOWN) && !_action) {
+ event.handled = true;
+ _field886 = (BF_GLOBALS._player._position.y <= 78) ? 2 : 1;
+ _destPos = Common::Point(212, 78);
+ _field87E = 1;
+ setAction(&_action1);
+ }
+ } else {
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(cursorId);
+ }
+}
+
+void Scene860::dispatch() {
+ if (_action) {
+ _action->dispatch();
+ } else if (_swRect.contains(BF_GLOBALS._player._position) && (_field87E == 0)) {
+ _sound1.play(88);
+ BF_GLOBALS._sceneManager.changeScene(870);
+ } else if (_neRect.contains(BF_GLOBALS._player._position) && (_field87E == 2)) {
+ _sound1.release();
+ BF_GLOBALS._sceneManager.changeScene(850);
+ } else if (_yachtRect.contains(BF_GLOBALS._player._position) && (_field87E == 1)) {
+ _sound1.play(88);
+ BF_GLOBALS._sceneManager.changeScene(355);
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 870 - Cove Beach
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene870::Lyle::startAction(CursorType action, Event &event) {
+ Scene870 *scene = (Scene870 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_TALK) {
+ if (BF_GLOBALS.getFlag(fTookTrailerAmmo)) {
+ scene->startStrip((BF_GLOBALS._bookmark >= bFinishedWGreen) ? 8704 : 8701);
+ } else {
+ scene->startStrip(8700);
+ }
+ return true;
+ } else {
+ return NamedObjectExt::startAction(action, event);
+ }
+}
+
+bool Scene870::Green::startAction(CursorType action, Event &event) {
+ Scene870 *scene = (Scene870 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_TALK) {
+ if (!BF_GLOBALS.getFlag(fLyleOnIsland) && !scene->_field1664 && (BF_GLOBALS._bookmark == bFinishedWGreen)) {
+ scene->startStrip(8703);
+ ++scene->_field1664;
+ } else {
+ scene->startStrip(8705);
+ }
+ return true;
+ } else {
+ return NamedObjectExt::startAction(action, event);
+ }
+}
+
+void Scene870::CrateInset::postInit(SceneObjectList *OwnerList) {
+ Scene870 *scene = (Scene870 *)BF_GLOBALS._sceneManager._scene;
+
+ FocusObject::postInit();
+ setVisage(870);
+ setStrip(5);
+ setFrame(scene->_field1662);
+ setPosition(Common::Point(160, 130));
+ fixPriority(250);
+
+ if (scene->_field1662 == 3) {
+ initContents();
+ }
+}
+
+void Scene870::CrateInset::initContents() {
+ Scene870 *scene = (Scene870 *)BF_GLOBALS._sceneManager._scene;
+
+ if (BF_INVENTORY.getObjectScene(INV_JAR) == 870) {
+ // Jar still in crate, so display it
+ _jar.postInit();
+ _jar.setVisage(870);
+ _jar.setStrip(4);
+ _jar.setFrame(5);
+ _jar.setPosition(Common::Point(scene->_crateInset._position.x + 5,
+ scene->_crateInset._position.y - 26));
+ _jar.fixPriority(251);
+ _jar.setDetails(870, 39, 40, 41, 1, NULL);
+ BF_GLOBALS._sceneItems.remove(&_jar);
+ BF_GLOBALS._sceneItems.push_front(&_jar);
+ }
+
+ if (BF_INVENTORY.getObjectScene(INV_RAGS) == 870) {
+ // Rags still in crate, so display it
+ _rags.postInit();
+ _rags.setVisage(870);
+ _rags.setStrip(4);
+ _rags.setFrame(6);
+ _rags.setPosition(Common::Point(scene->_crateInset._position.x - 18,
+ scene->_crateInset._position.y - 18));
+ _rags.fixPriority(251);
+ _rags.setDetails(870, 42, 43, 44, 1, NULL);
+ BF_GLOBALS._sceneItems.remove(&_rags);
+ BF_GLOBALS._sceneItems.push_front(&_rags);
+ }
+}
+
+void Scene870::CrateInset::remove() {
+ _jar.remove();
+ _rags.remove();
+ FocusObject::remove();
+}
+
+bool Scene870::CrateInset::startAction(CursorType action, Event &event) {
+ Scene870 *scene = (Scene870 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_WALK:
+ return true;
+ case CURSOR_LOOK:
+ if (scene->_field1662 != 2)
+ break;
+
+ scene->_field1662 = 3;
+ setFrame(3);
+ initContents();
+ return true;
+ case CURSOR_USE:
+ if (scene->_field1662 == 2) {
+ setFrame(1);
+ scene->_field1662 = 1;
+ } else {
+ setFrame(2);
+ scene->_field1662 = 2;
+ _jar.remove();
+ _rags.remove();
+ }
+ return true;
+ default:
+ break;
+ }
+
+ return FocusObject::startAction(action, event);
+}
+
+bool Scene870::CrateInset::Jar::startAction(CursorType action, Event &event) {
+ if (action == CURSOR_USE) {
+ BF_INVENTORY.setObjectScene(INV_JAR, 1);
+ remove();
+ T2_GLOBALS._uiElements.addScore(30);
+ return true;
+ } else {
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene870::CrateInset::Rags::startAction(CursorType action, Event &event) {
+ if (action == CURSOR_USE) {
+ BF_INVENTORY.setObjectScene(INV_RAGS, 1);
+ remove();
+ T2_GLOBALS._uiElements.addScore(30);
+ return true;
+ } else {
+ return NamedObject::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene870::Boat::startAction(CursorType action, Event &event) {
+ if (action == INV_RENTAL_KEYS) {
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._sceneManager.changeScene(860);
+ return true;
+ } else {
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+bool Scene870::Crate::startAction(CursorType action, Event &event) {
+ Scene870 *scene = (Scene870 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_USE) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1;
+ Common::Point destPos(163, 164);
+ PlayerMover *mover = new PlayerMover();
+ BF_GLOBALS._player.addMover(mover, &destPos, scene);
+ return true;
+ } else {
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+bool Scene870::Exit::startAction(CursorType action, Event &event) {
+ ADD_PLAYER_MOVER(event.mousePos.x, event.mousePos.y);
+ return true;
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene870::Action1::signal() {
+ Scene870 *scene = (Scene870 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ setDelay(30);
+ break;
+ case 1:
+ scene->_yacht.setStrip(6);
+ scene->_yacht.setFrame(1);
+ scene->_yacht._numFrames = 6;
+ scene->_yacht.animate(ANIM_MODE_5, this);
+ break;
+ case 2:
+ BF_GLOBALS._sceneManager.changeScene(666);
+ break;
+ default:
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene870::Scene870(): SceneExt() {
+ _field1662 = 1;
+ _field1664 = 0;
+}
+
+void Scene870::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ s.syncAsSint16LE(_field1662);
+ s.syncAsSint16LE(_field1664);
+}
+
+void Scene870::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(870);
+ BF_GLOBALS._sound1.changeSound(90);
+
+ PaletteRotation *rot;
+ rot = BF_GLOBALS._scenePalette.addRotation(235, 235, 1);
+ rot->setDelay(10);
+ rot = BF_GLOBALS._scenePalette.addRotation(237, 238, 1);
+ rot->setDelay(40);
+ rot = BF_GLOBALS._scenePalette.addRotation(242, 243, 1);
+ rot->setDelay(30);
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_greenSpeaker);
+ _stripManager.addSpeaker(&_jakeJacketSpeaker);
+ _stripManager.addSpeaker(&_lyleHatSpeaker);
+
+ if (BF_GLOBALS._dayNumber == 0)
+ BF_GLOBALS._dayNumber = 5;
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setVisage(831);
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player._moveDiff = Common::Point(2, 1);
+
+ _exit.setDetails(Rect(305, 150, 320, 168), 870, -1, -1, -1, 1, NULL);
+ _lumber.setDetails(9, 870, 36, 37, 38, 1);
+ _firePit.setDetails(8, 870, 9, 10, 11, 1);
+
+ if (BF_GLOBALS._dayNumber == 5) {
+ if (!BF_GLOBALS.getFlag(fLyleOnIsland) && (BF_GLOBALS._bookmark != bFinishedWGreen) &&
+ (!BF_GLOBALS.getFlag(fTookTrailerAmmo) || (BF_GLOBALS._bookmark >= bInvestigateBoat))) {
+ _lyle.postInit();
+ _lyle.setVisage(835);
+ _lyle.setObjectWrapper(new SceneObjectWrapper());
+ _lyle.animate(ANIM_MODE_1, NULL);
+ _lyle._moveDiff = Common::Point(2, 1);
+ _lyle.setDetails(870, 27, 28, 29, 1, NULL);
+ }
+
+ _yacht.postInit();
+ _yacht.setVisage(870);
+ _yacht.setStrip(4);
+ _yacht.setFrame(4);
+ _yacht.setPosition(Common::Point(232, 19));
+ _yacht.setDetails(870, 30, 31, 32, 1, NULL);
+
+ if ((BF_INVENTORY.getObjectScene(INV_RAGS) == 0) && (BF_INVENTORY.getObjectScene(INV_FLARE) == 0) &&
+ (BF_INVENTORY.getObjectScene(INV_HANDCUFFS) == 355)) {
+ _green.postInit();
+ _green.setVisage(870);
+ _green.setStrip(7);
+ _green.setPosition(Common::Point(127, 109));
+
+ if (BF_GLOBALS._bookmark == bFinishedWGreen) {
+ _green.setDetails(870, 51, 54, 53, 1, NULL);
+ } else {
+ _green.setDetails(870, 51, 52, 53, 1, NULL);
+ }
+ }
+ }
+
+ switch (BF_GLOBALS._sceneManager._previousScene) {
+ case 355:
+ _object6.postInit();
+ _object6.setVisage(870);
+ _object6.setPosition(Common::Point(142, 154));
+ _object6.fixPriority(148);
+
+ BF_GLOBALS._player.remove();
+ _lyle.remove();
+ setAction(&_action1);
+ break;
+ case 880:
+ if (BF_GLOBALS._sceneObjects->contains(&_lyle)) {
+ _lyle.setPosition(Common::Point(330, 169));
+ ADD_PLAYER_MOVER_NULL(_lyle, 303, 169);
+ }
+
+ BF_GLOBALS._player.setPosition(Common::Point(330, 139));
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 8700;
+ setAction(&_sequenceManager, this, 8700, &BF_GLOBALS._player, NULL);
+ break;
+ default:
+ if (BF_GLOBALS._sceneObjects->contains(&_lyle)) {
+ _lyle.setPosition(Common::Point(156, 148));
+ _lyle.fixPriority(149);
+ }
+
+ if ((BF_INVENTORY.getObjectScene(INV_HANDCUFFS) != 1) &&
+ (BF_INVENTORY.getObjectScene(INV_GRENADES) == 355)) {
+ _object4.postInit();
+ _object4.hide();
+ _object5.postInit();
+ _object5.hide();
+
+ BF_GLOBALS._deathReason = 7;
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 2;
+ setAction(&_sequenceManager, this, 8703, &BF_GLOBALS._player, &_lyle, &_green,
+ &_object4, &_object5, NULL);
+ } else {
+ BF_GLOBALS._player.changeAngle(135);
+ BF_GLOBALS._player.setPosition(Common::Point(214, 139));
+ BF_GLOBALS._player.enableControl();
+ }
+ break;
+ }
+
+ _boat.setDetails(7, 870, 3, 4, 5, 1);
+ _crate.setDetails(14, 870, 12, 13, 14, 1);
+ _water.setDetails(5, 870, 24, 25, 26, 1);
+ _palmTrees.setDetails(4, 870, 45, 46, 47, 1);
+ _sand.setDetails(3, 870, 21, 22, 23, 1);
+ _boulders.setDetails(2, 870, 18, 19, 20, 1);
+ _farShore.setDetails(1, 870, 48, 49, 50, 1);
+}
+
+void Scene870::startStrip(int stripNumber) {
+ _sceneMode = 3;
+ BF_GLOBALS._player.disableControl();
+ _stripManager.start(stripNumber, this);
+}
+
+void Scene870::remove() {
+ BF_GLOBALS._scenePalette.clearListeners();
+ SceneExt::remove();
+}
+
+void Scene870::signal() {
+ switch (_sceneMode) {
+ case 0:
+ case 3:
+ case 8700:
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 1:
+ _crateInset.postInit();
+ _crateInset.setDetails(870, -1, -1, -1);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 2:
+ _yacht.setStrip(6);
+ _yacht.setFrame(1);
+ _yacht._numFrames = 6;
+ _yacht.animate(ANIM_MODE_5, this);
+ BF_GLOBALS._sceneManager.changeScene(666);
+ break;
+ case 8701:
+ BF_GLOBALS._sceneManager.changeScene(880);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene870::process(Event &event) {
+ SceneExt::process(event);
+
+ if (!event.handled && BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (UI_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 Scene870::dispatch() {
+ SceneExt::dispatch();
+
+ if (BF_GLOBALS._sceneObjects->contains(&_lyle) && _lyle.isNoMover()) {
+ _lyle.updateAngle(BF_GLOBALS._player._position);
+ }
+
+ if (!_action && (BF_GLOBALS._player._position.x > 305)) {
+ if (BF_GLOBALS._sceneObjects->contains(&_lyle)) {
+ _lyle.animate(ANIM_MODE_1, NULL);
+ ADD_PLAYER_MOVER_NULL(_lyle, BF_GLOBALS._player._position.x, BF_GLOBALS._player._position.y + 5);
+ }
+
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 8701;
+ setAction(&_sequenceManager, this, 8701, &BF_GLOBALS._player, NULL);
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 880 - Beach Path
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene880::Action1::signal() {
+ Scene880 *scene = (Scene880 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ _actionIndex = 1 + BF_GLOBALS._randomSource.getRandomNumber(1);
+ setDelay(BF_GLOBALS._randomSource.getRandomNumber(90));
+ break;
+ case 1:
+ _actionIndex = 0;
+ scene->_sequenceManager2._onCallback = SequenceManager_callbackProc;
+ setAction(&scene->_sequenceManager2, this, 8811, &scene->_object4, NULL);
+ break;
+ case 2:
+ _actionIndex = 1;
+ setAction(&scene->_sequenceManager2, this, 8814, &scene->_object4, NULL);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene880::Action1::SequenceManager_callbackProc(int v1, int v2) {
+ int idx = BF_GLOBALS._randomSource.getRandomNumber(2);
+ Scene880 *scene = (Scene880 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (idx) {
+ case 0:
+ scene->_object5.show();
+ break;
+ case 1:
+ scene->_object6.show();
+ break;
+ case 2:
+ scene->_object7.show();
+ break;
+ default:
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene880::Object4::startAction(CursorType action, Event &event) {
+ Scene880 *scene = (Scene880 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (!scene->_seqNumber)
+ break;
+
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 8815;
+ scene->setAction(&scene->_sequenceManager1, scene, scene->_seqNumber, &BF_GLOBALS._player, NULL);
+ return true;
+ case CURSOR_TALK:
+ if (scene->_sceneMode != 2)
+ break;
+
+ scene->_stripManager.start(8800, &BF_GLOBALS._stripProxy);
+ return true;
+ case INV_COLT45:
+ if (scene->_sceneMode != 2)
+ break;
+
+ scene->gunDisplay();
+ return true;
+ default:
+ break;
+ }
+
+ return NamedObject::startAction(action, event);
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene880::NorthExit::startAction(CursorType action, Event &event) {
+ ADD_PLAYER_MOVER(40, 113);
+ return true;
+}
+
+bool Scene880::SouthEastExit::startAction(CursorType action, Event &event) {
+ Scene880 *scene = (Scene880 *)BF_GLOBALS._sceneManager._scene;
+
+ if (scene->_sceneMode == 2)
+ return false;
+ else {
+ ADD_PLAYER_MOVER(300, 158);
+ return true;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene880::Scene880(): SceneExt() {
+ _seqNumber = 0;
+}
+
+void Scene880::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ s.syncAsSint16LE(_seqNumber);
+}
+
+void Scene880::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(880);
+
+ if (BF_GLOBALS._dayNumber == 0)
+ BF_GLOBALS._dayNumber = 5;
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_jakeJacketSpeaker);
+ _stripManager.addSpeaker(&_lyleHatSpeaker);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setVisage(1358);
+ BF_GLOBALS._player._moveDiff = Common::Point(3, 2);
+ BF_GLOBALS._player.disableControl();
+
+ _northExit.setDetails(Rect(25, 99, 54, 127), 880, -1, -1, -1, 1, NULL);
+ _seExit.setDetails(Rect(279, 150, 320, 167), 880, -1, -1, -1, 1, NULL);
+
+ if (BF_GLOBALS._dayNumber == 5) {
+ BF_GLOBALS._sound1.changeSound(107);
+ _object1.postInit();
+ _object1.hide();
+
+ if ((BF_GLOBALS._bookmark != bFinishedWGreen) && (BF_GLOBALS._bookmark >= bInvestigateBoat) &&
+ BF_GLOBALS.getFlag(fTookTrailerAmmo)) {
+ BF_GLOBALS.setFlag(fLyleOnIsland);
+ }
+
+ _object2.postInit();
+ _object2.setVisage(880);
+ _object2.setPosition(Common::Point(209, 76));
+ _object2.setDetails(880, 4, 5, 6, 1, NULL);
+
+ _object4.postInit();
+ _object4.setVisage(875);
+ _object4.setDetails(880, 7, -1, 9, 1, NULL);
+
+ _object5.postInit();
+ _object5.setVisage(874);
+ _object5.setStrip(2);
+ _object5.setFrame(2);
+ _object5.fixPriority(118);
+ _object5.setPosition(Common::Point(55, 117));
+ _object5.hide();
+
+ _object6.postInit();
+ _object6.setVisage(874);
+ _object6.setStrip(3);
+ _object6.setFrame(2);
+ _object6.fixPriority(118);
+ _object6.setPosition(Common::Point(60, 109));
+ _object6.hide();
+
+ _object7.postInit();
+ _object7.setVisage(874);
+ _object7.setStrip(4);
+ _object7.setFrame(2);
+ _object7.fixPriority(118);
+ _object7.setPosition(Common::Point(57, 100));
+ _object7.hide();
+
+ if (BF_GLOBALS.getFlag(fShootGoon)) {
+ _object4.setStrip(6);
+ _object4.setFrame2(_object4.getFrameCount());
+ _object4.fixPriority(160);
+ _object4.setPosition(Common::Point(255, 148));
+
+ _seqNumber = 8816;
+ } else if (BF_GLOBALS.getFlag(fBlowUpGoon)) {
+ _object4.setStrip(7);
+ _object4.setFrame2(_object4.getFrameCount());
+ _object4.fixPriority(130);
+ _object4.setPosition(Common::Point(255, 148));
+
+ _seqNumber = 8815;
+ } else {
+ _object4.setStrip(2);
+ _object4.setPosition(Common::Point(258, 147));
+
+ _object3.postInit();
+ _object3.setVisage(871);
+ _object3.setStrip(4);
+ _object3.hide();
+
+ _seqNumber = 0;
+ }
+ } else if (BF_GLOBALS._sceneManager._previousScene != 900) {
+ BF_GLOBALS._sound1.changeSound(91);
+ }
+
+ switch (BF_GLOBALS._sceneManager._previousScene) {
+ case 900:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager1, this, 8802, &BF_GLOBALS._player, NULL);
+ break;
+ default:
+ BF_GLOBALS._player.disableControl();
+
+ if (BF_GLOBALS._dayNumber != 5) {
+ _sceneMode = 0;
+ setAction(&_sequenceManager1, this, 8800, &BF_GLOBALS._player, NULL);
+ } else if ((BF_GLOBALS._bookmark > bFinishedWGreen) || (_seqNumber != 0)) {
+ _sceneMode = 0;
+ setAction(&_sequenceManager1, this, 8800, &BF_GLOBALS._player, NULL);
+ } else {
+ BF_GLOBALS._bookmark = bFinishedWGreen;
+ _sceneMode = 8805;
+ setAction(&_sequenceManager1, this, 8805, &BF_GLOBALS._player, &_object1, &_object4, NULL);
+ }
+ break;
+ }
+
+ _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 880, 0, -1, -1, 1, NULL);
+}
+
+void Scene880::signal() {
+ switch (_sceneMode) {
+ case 0:
+ case 2:
+ BF_GLOBALS._player._moveDiff = Common::Point(3, 2);
+ BF_GLOBALS._player.fixPriority(-1);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 1:
+ BF_GLOBALS._sceneManager.changeScene(666);
+ break;
+ case 3:
+ T2_GLOBALS._uiElements.addScore(50);
+ BF_GLOBALS.clearFlag(gunDrawn);
+ BF_INVENTORY.setObjectScene(INV_GRENADES, 880);
+ _sceneMode = 0;
+ signal();
+ break;
+ case 4:
+ T2_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.clearFlag(gunDrawn);
+ _sceneMode = 0;
+ signal();
+ break;
+ case 6:
+ BF_GLOBALS._deathReason = 10;
+ BF_GLOBALS.clearFlag(gunDrawn);
+
+ if (_object4._action) {
+ handleAction(_object4._action);
+ }
+
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 1;
+ setAction(&_sequenceManager1, this, 8806, &BF_GLOBALS._player, &_object4, NULL);
+ break;
+ case 7:
+ BF_GLOBALS.clearFlag(gunDrawn);
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 8801;
+ setAction(&_sequenceManager1, this, 8801, &BF_GLOBALS._player, NULL);
+ break;
+ case 8801:
+ BF_GLOBALS._sceneManager.changeScene(870);
+ break;
+ case 8803:
+ BF_GLOBALS._sceneManager.changeScene(900);
+ break;
+ case 8805:
+ _object4.setAction(&_action1);
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 2;
+ setAction(&_sequenceManager1, this, 8807, &BF_GLOBALS._player, NULL);
+ BF_GLOBALS.setFlag(gunDrawn);
+ break;
+ case 8815:
+ if (BF_INVENTORY.getObjectScene(INV_DOG_WHISTLE) == 880) {
+ BF_INVENTORY.setObjectScene(INV_DOG_WHISTLE, 1);
+ T2_GLOBALS._uiElements.addScore(30);
+
+ SceneItem::display2(880, 13);
+ } else {
+ SceneItem::display2(880, 12);
+ }
+ BF_GLOBALS._player.enableControl();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene880::process(Event &event) {
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (UI_INTERFACE_Y - 1))) {
+ // Check if the cursor is on an exit
+ if (_northExit.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_N);
+ BF_GLOBALS._events.setCursor(surface);
+ } else if (_seExit.contains(event.mousePos) && (_sceneMode != 2)) {
+ 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);
+ }
+ }
+
+ if (event.eventType == EVENT_BUTTON_DOWN) {
+ switch (BF_GLOBALS._events.getCursor()) {
+ case INV_COLT45:
+ if (_sceneMode != 2) {
+ _sceneMode = 0;
+ SceneItem::display2(880, 11);
+ signal();
+ } else if (BF_GLOBALS.getFlag(gunDrawn)) {
+ BF_GLOBALS.clearFlag(gunDrawn);
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 6;
+ setAction(&_sequenceManager1, this, 8812, &BF_GLOBALS._player, NULL);
+ } else {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 2;
+ setAction(&_sequenceManager1, this, 8807, &BF_GLOBALS._player, NULL);
+ }
+
+ event.handled = true;
+ break;
+ case INV_GRENADES:
+ if (_sceneMode == 2) {
+ if (event.mousePos.x >= 150) {
+ BF_GLOBALS.setFlag(fBlowUpGoon);
+ _seqNumber = 8815;
+ if (_object4._action)
+ handleAction(_object4._action);
+
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 3;
+ setAction(&_sequenceManager1, this, 8809, &BF_GLOBALS._player, &_object3, &_object4, NULL);
+ } else {
+ if (_object4._action)
+ handleAction(_object4._action);
+
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._deathReason = 11;
+ _sceneMode = 1;
+ setAction(&_sequenceManager1, this, 8810, &BF_GLOBALS._player, &_object3, NULL);
+ }
+ event.handled = true;
+ }
+ break;
+ case CURSOR_WALK:
+ if (_sceneMode == 2) {
+ event.handled = true;
+ BF_GLOBALS._player.disableControl();
+
+ _sceneMode = (event.mousePos.y <= BF_GLOBALS._player._position.y) ? 7 : 6;
+ setAction(&_sequenceManager1, this, 8812, &BF_GLOBALS._player, NULL);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ SceneExt::process(event);
+}
+
+void Scene880::handleAction(Action *action) {
+ if (action->_action)
+ // Work down into sub-actions
+ handleAction(action->_action);
+
+ if (action->_owner) {
+ action->_owner->_action = NULL;
+ action->_owner = NULL;
+ }
+}
+
+void Scene880::dispatch() {
+ SceneExt::dispatch();
+
+ if (!_action) {
+ if ((BF_GLOBALS._player._position.y <= 123) && (BF_GLOBALS._player._priority != 5)) {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 8801;
+ setAction(&_sequenceManager1, this, 8801, &BF_GLOBALS._player, NULL);
+ }
+
+ if ((BF_GLOBALS._player._position.x >= 275) && (BF_GLOBALS._player._position.y > 155)) {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 8803;
+ setAction(&_sequenceManager1, this, 8803, &BF_GLOBALS._player, 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
index 84a11805a2..ef5ef81563 100644
--- a/engines/tsage/blue_force/blueforce_scenes8.h
+++ b/engines/tsage/blue_force/blueforce_scenes8.h
@@ -99,6 +99,177 @@ public:
virtual void dispatch();
};
+class Scene810: public SceneExt {
+ /* Actions */
+ class Action1: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action2: public Action {
+ public:
+ virtual void signal();
+ };
+
+ /* Items */
+ class Map: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Window: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Bookcase: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class FaxMachine: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class GarbageCan: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class FileCabinets: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class CoffeeMaker: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Shelves: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class MicroficheReader: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item10: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Pictures: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item12: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Background: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Desk: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Exit: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Objects */
+ class Lyle: public NamedObjectExt {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Chair: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object3: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class FaxMachineInset: public FocusObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object5: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object7: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ Action1 _action1;
+ Action2 _action2;
+ SequenceManager _sequenceManager1, _sequenceManager2;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerJakeJacket _jakeJacketSpeaker;
+ SpeakerJakeUniform _jakeUniformSpeaker;
+ SpeakerLyleHat _lyleHatSpeaker;
+ Lyle _lyle;
+ Chair _chair;
+ Object3 _object3;
+ FaxMachineInset _faxMachineInset;
+ Object5 _object5;
+ NamedObject _object6;
+ Object7 _object7;
+ Map _map;
+ Window _window;
+ Bookcase _bookcase;
+ FaxMachine _faxMachine;
+ GarbageCan _garbageCan;
+ FileCabinets _fileCabinets;
+ CoffeeMaker _coffeeMaker;
+ Shelves _shelves;
+ MicroficheReader _microficheReader;
+ Item10 _item10;
+ Pictures _pictures;
+ Item12 _item12;
+ Background _background;
+ Desk _desk;
+ Exit _exit;
+ ASoundExt _sound1;
+ Rect _rect1, _rect2, _rect3;
+ int _fieldA70, _fieldA72, _fieldA74;
+
+ Scene810();
+ virtual void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+};
+
+class Scene820: public SceneExt {
+ /* Objects */
+ class PowerButton: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class ForwardButton: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class BackButton: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ SequenceManager _sequenceManager;
+ ASoundExt _sound1;
+ SpeakerGameText _gameTextSpeaker;
+ PowerButton _powerButton;
+ BackButton _backButton;
+ ForwardButton _forwardButton;
+ NamedObject _object4, _object5;
+ NamedHotspot _item1;
+ int _pageNumber;
+
+ Scene820();
+ virtual void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+};
+
class Scene830: public PalettedScene {
/* Items */
class SouthEastExit: public NamedHotspot {
@@ -119,7 +290,7 @@ class Scene830: public PalettedScene {
public:
virtual bool startAction(CursorType action, Event &event);
};
- class Object4: public NamedObject {
+ class RentalBoat: public NamedObject {
public:
virtual bool startAction(CursorType action, Event &event);
};
@@ -135,7 +306,7 @@ public:
SpeakerLyleHat _lyleHatSpeaker;
NamedObject _object1, _lyle, _object6;
Door _door;
- Object4 _object4;
+ RentalBoat _rentalBoat;
Object5 _object5;
SouthEastExit _seExit;
NoteBoard _noteBoard;
@@ -165,7 +336,7 @@ class Scene840: public PalettedScene {
};
/* Objects */
- class Object2: public FocusObject {
+ class BoatKeysInset: public FocusObject {
class RentalKeys: public NamedObject {
public:
virtual bool startAction(CursorType action, Event &event);
@@ -184,7 +355,7 @@ class Scene840: public PalettedScene {
virtual void process(Event &event);
virtual bool startAction(CursorType action, Event &event);
};
- class Object6: public NamedObject {
+ class BoatKeys: public NamedObject {
public:
virtual bool startAction(CursorType action, Event &event);
};
@@ -196,9 +367,9 @@ class Scene840: public PalettedScene {
public:
SequenceManager _sequenceManager1, _sequenceManager2;
NamedObject _object1;
- Object2 _object2;
+ BoatKeysInset _boatKeysInset;
NamedObject _doors;
- Object6 _object6;
+ BoatKeys _boatKeys;
Carter _carter;
NamedObject _lyle;
Coins _coins;
@@ -222,6 +393,173 @@ public:
virtual void dispatch();
};
+class Scene850: public SceneExt {
+ /* Timers */
+ class Timer1: public Timer {
+ public:
+ virtual void signal();
+ };
+public:
+ SequenceManager _sequenceManager;
+ Timer1 _timer;
+ NamedObject _object1;
+ ASoundExt _sound1;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+};
+
+class Scene860: public SceneExt {
+ /* Actions */
+ class Action1: public Action {
+ public:
+ virtual void signal();
+ };
+public:
+ SequenceManager _sequenceManager;
+ NamedObject _deadBody, _object2;
+ NamedHotspot _item1;
+ Action1 _action1;
+ Rect _swRect, _neRect, _yachtRect;
+ ASoundExt _sound1;
+ int _field87E, _field880, _field886, _field888;
+ Common::Point _destPos;
+
+ Scene860();
+ virtual void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+};
+
+class Scene870: public SceneExt {
+ /* Actions */
+ class Action1: public Action {
+ public:
+ virtual void signal();
+ };
+
+ /* Objects */
+ class Lyle: public NamedObjectExt {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Green: public NamedObjectExt {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class CrateInset: public FocusObject {
+ class Jar: public NamedObjectExt {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Rags: public NamedObjectExt {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ private:
+ void initContents();
+ public:
+ Jar _jar;
+ Rags _rags;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Items */
+ class Boat: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Crate: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Exit: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ SequenceManager _sequenceManager;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerJakeJacket _jakeJacketSpeaker;
+ SpeakerLyleHat _lyleHatSpeaker;
+ SpeakerGreen _greenSpeaker;
+ Boat _boat;
+ Crate _crate;
+ Exit _exit;
+ NamedObject _yacht;
+ Lyle _lyle;
+ Green _green;
+ NamedObject _object4, _object5, _object6;
+ CrateInset _crateInset;
+ NamedHotspot _lumber, _firePit, _water, _boulders;
+ NamedHotspot _palmTrees, _sand, _farShore, _item11;
+ Action1 _action1;
+ int _field1662, _field1664;
+
+ Scene870();
+ 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();
+
+ void startStrip(int stripNumber);
+};
+
+class Scene880: public SceneExt {
+ /* Actions */
+ class Action1: public Action {
+ private:
+ static void SequenceManager_callbackProc(int v1, int v2);
+ public:
+ virtual void signal();
+ };
+
+ /* Objects */
+ class Object4: public NamedObjectExt {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Items */
+ class NorthExit: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class SouthEastExit: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+private:
+ static void handleAction(Action *action);
+public:
+ SequenceManager _sequenceManager1, _sequenceManager2, _sequenceManager3;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerJakeJacket _jakeJacketSpeaker;
+ SpeakerLyleHat _lyleHatSpeaker;
+ Action1 _action1;
+ NamedObject _object1, _object2, _object3;
+ Object4 _object4;
+ NamedObject _object5, _object6, _object7;
+ NamedHotspot _background;
+ NorthExit _northExit;
+ SouthEastExit _seExit;
+ int _seqNumber;
+
+ Scene880();
+ 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
diff --git a/engines/tsage/blue_force/blueforce_scenes9.cpp b/engines/tsage/blue_force/blueforce_scenes9.cpp
index a449600b63..ea54bf6b1d 100644
--- a/engines/tsage/blue_force/blueforce_scenes9.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes9.cpp
@@ -57,50 +57,50 @@ bool Scene900::Item4::startAction(CursorType action, Event &event) {
}
/*--------------------------------------------------------------------------*/
-bool Scene900::Object1::startAction(CursorType action, Event &event) {
+bool Scene900::Gate::startAction(CursorType action, Event &event) {
Scene900 *scene = (Scene900 *)BF_GLOBALS._sceneManager._scene;
switch (action) {
case CURSOR_USE:
- if (BF_GLOBALS._v4CEC0 == 0) {
+ if (BF_GLOBALS._gateStatus == 0) {
return NamedObject::startAction(action, event);
} else {
BF_GLOBALS._player.disableControl();
- if (BF_GLOBALS._v4CEC0 == 2) {
+ if (BF_GLOBALS._gateStatus == 2) {
scene->_sceneMode = 9006;
- BF_GLOBALS._v4CEC0 = 1;
+ BF_GLOBALS._gateStatus = 1;
scene->setAction(&scene->_sequenceManager1, scene, 9006, &BF_GLOBALS._player, this, NULL);
} else {
- BF_GLOBALS._v4CEC0 = 2;
- if (scene->_object3._flag == false) {
+ BF_GLOBALS._gateStatus = 2;
+ if (scene->_dog._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);
+ BF_GLOBALS._walkRegions.enableRegion(24);
}
}
return true;
}
break;
case INV_WAREHOUSE_KEYS:
- if (BF_GLOBALS._v4CEC0 == 2) {
+ if (BF_GLOBALS._gateStatus == 2) {
SceneItem::display2(900, 14);
} else {
- if (BF_GLOBALS._v4CEC0 == 0) {
+ if (BF_GLOBALS._gateStatus == 0) {
if (!BF_GLOBALS.getFlag(fGotPointsForUnlockGate)) {
BF_GLOBALS.setFlag(fGotPointsForUnlockGate);
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
}
- BF_GLOBALS._v4CEC0 = 1;
+ BF_GLOBALS._gateStatus = 1;
} else {
if (!BF_GLOBALS.getFlag(fGotPointsForLockGate)) {
if (BF_GLOBALS._bookmark == bEndDayThree) {
BF_GLOBALS.setFlag(fGotPointsForLockGate);
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
}
}
- BF_GLOBALS._v4CEC0 = 0;
+ BF_GLOBALS._gateStatus = 0;
}
scene->_sceneMode = 9004;
BF_GLOBALS._player.disableControl();
@@ -112,29 +112,29 @@ bool Scene900::Object1::startAction(CursorType action, Event &event) {
}
}
-bool Scene900::Object2::startAction(CursorType action, Event &event) {
+bool Scene900::Door::startAction(CursorType action, Event &event) {
Scene900 *scene = (Scene900 *)BF_GLOBALS._sceneManager._scene;
switch (action) {
case CURSOR_USE:
- if (BF_GLOBALS._v4CEC0 == 2) {
+ if (BF_GLOBALS._gateStatus == 2) {
if (_flag) {
SceneItem::display2(900, 1);
} else {
BF_GLOBALS._player.disableControl();
- BF_GLOBALS._walkRegions.proc2(26);
+ BF_GLOBALS._walkRegions.enableRegion(26);
scene->_sceneMode = 9007;
- scene->setAction(&scene->_sequenceManager1, scene, 9007, &BF_GLOBALS._player, &scene->_object2, this, NULL);
+ scene->setAction(&scene->_sequenceManager1, scene, 9007, &BF_GLOBALS._player, &scene->_door, this, NULL);
}
return true;
} else
return NamedObject::startAction(action, event);
break;
case INV_WAREHOUSE_KEYS:
- if (BF_GLOBALS._v4CEC0 == 2) {
+ if (BF_GLOBALS._gateStatus == 2) {
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 9012;
- scene->setAction(&scene->_sequenceManager1, scene, 9012, &BF_GLOBALS._player, &scene->_object2, NULL);
+ scene->setAction(&scene->_sequenceManager1, scene, 9012, &BF_GLOBALS._player, &scene->_door, NULL);
} else
SceneItem::display2(900, 5);
return true;
@@ -143,7 +143,7 @@ bool Scene900::Object2::startAction(CursorType action, Event &event) {
}
}
-bool Scene900::Object3::startAction(CursorType action, Event &event) {
+bool Scene900::Dog::startAction(CursorType action, Event &event) {
Scene900 *scene = (Scene900 *)BF_GLOBALS._sceneManager._scene;
switch (action) {
@@ -174,31 +174,31 @@ bool Scene900::Object3::startAction(CursorType action, Event &event) {
}
}
-bool Scene900::Object6::startAction(CursorType action, Event &event) {
+bool Scene900::Lyle::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
+ if (!_action) {
+ if (scene->_dog._flag) {
+ // Dog is no longer there
+ if (BF_GLOBALS._gateStatus == 0)
+ scene->_stripManager.start(9004, &BF_GLOBALS._stripProxy);
+ else {
+ if (scene->_door._flag == 1) {
+ if (BF_GLOBALS._gateStatus == 2)
+ scene->_stripManager.start(9005, &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);
- }
+ } else
+ scene->_stripManager.start(9001, &BF_GLOBALS._stripProxy);
+ }
+ } else {
+ // Dog is there
+ if (scene->_lyleDialogCtr)
+ scene->_stripManager.start(9003, &BF_GLOBALS._stripProxy);
+ else {
+ ++scene->_lyleDialogCtr;
+ scene->_stripManager.start(9002, &BF_GLOBALS._stripProxy);
}
}
}
@@ -207,7 +207,7 @@ bool Scene900::Object6::startAction(CursorType action, Event &event) {
return NamedObject::startAction(action, event);
}
-bool Scene900::Object7::startAction(CursorType action, Event &event) {
+bool Scene900::Body::startAction(CursorType action, Event &event) {
Scene900 *scene = (Scene900 *)BF_GLOBALS._sceneManager._scene;
if (action == CURSOR_USE) {
@@ -225,25 +225,25 @@ void Scene900::Action1::signal() {
switch (_actionIndex++) {
case 0:
- if (scene->_object3._flag == 0) {
- scene->_object3.setStrip(3);
+ if (scene->_dog._flag == 0) {
+ scene->_dog.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);
+ scene->_dog.addMover(mover, &pt, this);
} else {
_actionIndex = 4;
Common::Point pt(775, 107);
NpcMover *mover = new NpcMover();
- scene->_object3.addMover(mover, &pt, this);
+ scene->_dog.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);
+ scene->_dog.setPosition(Common::Point(864, 117));
+ scene->_dog.setStrip(7);
+ scene->_dog.setFrame(1);
+ scene->_dog.animate(ANIM_MODE_5, this);
if (BF_GLOBALS._randomSource.getRandomNumber(3) == 1)
scene->_sound1.play(92);
else
@@ -252,16 +252,16 @@ void Scene900::Action1::signal() {
_actionIndex = 7;
break;
case 2:
- scene->_object3.animate(ANIM_MODE_6, this);
+ scene->_dog.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);
+ scene->_dog.setStrip(3);
+ scene->_dog.setPosition(Common::Point(864, 130));
+ scene->_dog.fixPriority(122);
+ scene->_dog.animate(ANIM_MODE_1, NULL);
Common::Point pt(775, 107);
NpcMover *mover = new NpcMover();
- scene->_object3.addMover(mover, &pt, this);
+ scene->_dog.addMover(mover, &pt, this);
break;
}
case 6:
@@ -271,10 +271,10 @@ void Scene900::Action1::signal() {
setDelay(30);
break;
case 5: {
- scene->_object3.setStrip(4);
+ scene->_dog.setStrip(4);
Common::Point pt(940, 145);
NpcMover *mover = new NpcMover();
- scene->_object3.addMover(mover, &pt, this);
+ scene->_dog.addMover(mover, &pt, this);
break;
}
case 7:
@@ -286,17 +286,17 @@ void Scene900::Action1::signal() {
_actionIndex = 8;
break;
case 8:
- scene->_object3.setStrip(1);
- scene->_object3.setFrame(7);
- scene->_object3.animate(ANIM_MODE_6, NULL);
+ scene->_dog.setStrip(1);
+ scene->_dog.setFrame(7);
+ scene->_dog.animate(ANIM_MODE_6, NULL);
break;
case 9:
scene->_field1976 = 0;
- scene->_object3._flag = 0;
+ scene->_dog._flag = 0;
_actionIndex = 7;
- scene->_object3.setStrip(1);
- scene->_object3.setFrame(1);
- scene->_object3.animate(ANIM_MODE_5, this);
+ scene->_dog.setStrip(1);
+ scene->_dog.setFrame(1);
+ scene->_dog.animate(ANIM_MODE_5, this);
break;
default:
break;
@@ -309,7 +309,7 @@ void Scene900::Action2::signal() {
switch (_actionIndex++) {
case 0:
scene->_field1976 = 1;
- if (scene->_object3._action->getActionIndex() == 8)
+ if (scene->_dog._action->getActionIndex() != 8)
_actionIndex = 0;
setDelay(5);
break;
@@ -319,18 +319,18 @@ void Scene900::Action2::signal() {
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);
+ setAction(&scene->_sequenceManager1, this, 9009, &BF_GLOBALS._player, &scene->_object5, &scene->_dog, 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);
+ T2_GLOBALS._uiElements.addScore(50);
}
SceneItem::display2(900, 10);
- scene->_object3._flag = 1;
- scene->_object3.fixPriority(130);
+ scene->_dog._flag = 1;
+ scene->_dog.fixPriority(130);
BF_GLOBALS._player.enableControl();
remove();
break;
@@ -349,44 +349,44 @@ void Scene900::Action3::signal() {
PlayerMover *mover = new PlayerMover();
BF_GLOBALS._player.addMover(mover, &pt, 0);
}
- if (scene->_object3._action->getActionIndex() != 7) {
+ if (scene->_dog._action->getActionIndex() != 7) {
_actionIndex = 0;
}
setDelay(5);
break;
case 1:
- if (scene->_object3._strip == 3) {
+ if (scene->_dog._strip == 3) {
_actionIndex = 3;
Common::Point pt(775, 107);
NpcMover *mover = new NpcMover();
- scene->_object3.addMover(mover, &pt, this);
+ scene->_dog.addMover(mover, &pt, this);
} else
- scene->_object3.animate(ANIM_MODE_6, this);
+ scene->_dog.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);
+ scene->_dog.setStrip(3);
+ scene->_dog.setPosition(Common::Point(864, 130));
+ scene->_dog.fixPriority(122);
+ scene->_dog.animate(ANIM_MODE_1, NULL);
Common::Point pt(775, 107);
NpcMover *mover = new NpcMover();
- scene->_object3.addMover(mover, &pt, this);
+ scene->_dog.addMover(mover, &pt, this);
break;
}
case 3:
- scene->_object3.remove();
- scene->_object3._flag = 1;
+ scene->_dog.remove();
+ scene->_dog._flag = 1;
SceneItem::display2(900, 24);
if (!BF_GLOBALS.getFlag(fGotPointsForLockWarehouse)) {
BF_GLOBALS.setFlag(fGotPointsForLockWarehouse);
- BF_GLOBALS._uiElements.addScore(10);
+ T2_GLOBALS._uiElements.addScore(10);
}
BF_GLOBALS._player.enableControl();
remove();
break;
default:
break;
- }
+ }
}
void Scene900::Action4::signal() {
@@ -395,15 +395,15 @@ void Scene900::Action4::signal() {
switch (_actionIndex++) {
case 0:
scene->_field1976 = 1;
- if (scene->_object3._action->getActionIndex() != 8)
+ if (scene->_dog._action->getActionIndex() != 8)
_actionIndex = 0;
setDelay(5);
break;
case 1:
- scene->setAction(&scene->_sequenceManager1, scene, 9005, &BF_GLOBALS._player, &scene->_object1, NULL);
+ scene->setAction(&scene->_sequenceManager1, this, 9005, &BF_GLOBALS._player, &scene->_gate, NULL);
break;
case 2:
- scene->setAction(&scene->_sequenceManager1, scene, 9008, &BF_GLOBALS._player, &scene->_object3, NULL);
+ scene->setAction(&scene->_sequenceManager1, this, 9008, &BF_GLOBALS._player, &scene->_dog, NULL);
break;
case 3:
BF_GLOBALS._deathReason = 5;
@@ -418,40 +418,41 @@ void Scene900::Action4::signal() {
/*--------------------------------------------------------------------------*/
Scene900::Scene900(): PalettedScene() {
- _field1974 = _field1976 = 0;
+ _lyleDialogCtr = _field1976 = 0;
}
void Scene900::postInit(SceneObjectList *OwnerList) {
- PalettedScene::postInit();
+ PalettedScene::postInit(OwnerList);
loadScene(900);
if (BF_GLOBALS._sceneManager._previousScene == 910)
BF_GLOBALS._sound1.changeSound(91);
- _field1974 = 0;
+ _lyleDialogCtr = 0;
_field1976 = 0;
- BF_GLOBALS._uiElements._active = true;
+ T2_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;
+ _dog._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);
+ _body.postInit();
+ _body.fixPriority(120);
+ _body.setVisage(901);
+ _body.setPosition(Common::Point(159,128));
+ _body.setDetails(900, 15, 16, 17, ANIM_MODE_1, NULL);
}
if (BF_GLOBALS._sceneManager._previousScene == 910) {
- _sceneBounds.moveTo(640, 0);
- BF_GLOBALS._v4CEC0 = 2;
+ _sceneBounds.moveTo(639, 0);
+
+ BF_GLOBALS._gateStatus = 2;
BF_INVENTORY.setObjectScene(INV_FISHING_NET, 900);
- _object3._flag = 1;
+ _dog._flag = 1;
}
if (BF_INVENTORY.getObjectScene(INV_FISHING_NET) == 900)
- _object3._flag = 1;
+ _dog._flag = 1;
_stripManager.addSpeaker(&_gameTextSpeaker);
_stripManager.addSpeaker(&_jakeJacketSpeaker);
@@ -460,37 +461,37 @@ void Scene900::postInit(SceneObjectList *OwnerList) {
_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);
+ _dog.postInit();
+ _dog.setVisage(902);
+ _dog.setPosition(Common::Point(845, 135));
+ _dog.fixPriority(122);
+ _dog.setDetails(900, 8, -1, 9, 1, NULL);
+
+ if (_dog._flag == 0) {
+ _dog.animate(ANIM_MODE_1, NULL);
+ _dog.setAction(&_action1);
} else {
- _object3.setAction(&_action1);
- _object3.fixPriority(130);
+ _dog.setAction(&_action1);
+ _dog.fixPriority(130);
if (BF_GLOBALS._dayNumber == 4) {
- _object3.setPosition(Common::Point(879, 120));
- _object3.setStrip(2);
+ _dog.setPosition(Common::Point(879, 120));
+ _dog.setStrip(2);
} else {
- _object3.setPosition(Common::Point(864, 117));
- _object3.setStrip(6);
- _object3.setFrame(6);
+ _dog.setPosition(Common::Point(864, 117));
+ _dog.setStrip(6);
+ _dog.setFrame(6);
}
}
- _object1.postInit();
- _object1.setVisage(900);
- _object1.setStrip(2);
+ _gate.postInit();
+ _gate.setVisage(900);
+ _gate.setStrip(2);
- if (BF_GLOBALS._v4CEC0 == 2)
- _object1.setPosition(Common::Point(758, 127));
+ if (BF_GLOBALS._gateStatus == 2)
+ _gate.setPosition(Common::Point(758, 127));
else {
- BF_GLOBALS._walkRegions.proc1(24);
- _object1.setPosition(Common::Point(804, 132));
+ BF_GLOBALS._walkRegions.disableRegion(24);
+ _gate.setPosition(Common::Point(804, 132));
}
if (BF_GLOBALS._dayNumber == 5)
@@ -504,59 +505,62 @@ void Scene900::postInit(SceneObjectList *OwnerList) {
_object4.setPosition(Common::Point(866, 117));
}
- _object2.postInit();
- _object2.setVisage(900);
+ _door.postInit();
+ _door.setVisage(900);
if (BF_GLOBALS._v4CEC8 == 0)
- _object2.setStrip(4);
+ _door.setStrip(4);
else
- _object2.setStrip(1);
+ _door.setStrip(1);
- _object2.setPosition(Common::Point(847, 45));
- _object2._flag = 1;
+ _door.setPosition(Common::Point(847, 45));
+ _door._flag = 1;
if ((BF_GLOBALS._sceneManager._previousScene == 880) || (BF_GLOBALS._sceneManager._previousScene != 910)) {
- BF_GLOBALS._walkRegions.proc1(26);
+ BF_GLOBALS._walkRegions.disableRegion(26);
BF_GLOBALS._player.disableControl();
if (BF_GLOBALS._bookmark == bFinishedWGreen) {
_sceneMode = 9013;
_lyle.postInit();
_lyle._moveDiff.y = 7;
- _lyle._flags |= 0x1000;
+ _lyle._flags |= OBJFLAG_CHECK_REGION;
_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 {
+ 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());
+ }
+
+ _sceneMode = 9000;
+ setAction(&_sequenceManager1, this, 9000, &BF_GLOBALS._player, NULL);
+ }
} else {
- _object2._flag = 0;
- _object2.setFrame(_object2.getFrameCount());
+ _door._flag = 0;
+ _door.setFrame(_door.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);
+ setAction(&_sequenceManager1, this, 9014, &BF_GLOBALS._player, &_door, &_lyle, NULL);
} else
- setAction(&_sequenceManager1, this, 9002, &BF_GLOBALS._player, &_object2, NULL);
+ setAction(&_sequenceManager1, this, 9002, &BF_GLOBALS._player, &_door, NULL);
}
- _object1.setDetails(900, 0, -1, 1, 1, 0);
- _object2.setDetails(900, 2, -1, 5, 1, 0);
+ _gate.setDetails(900, 0, -1, 1, 1, 0);
+ _door.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);
@@ -570,16 +574,16 @@ void Scene900::signal() {
BF_GLOBALS._sceneManager.changeScene(910);
break;
case 3:
- BF_GLOBALS._walkRegions.proc1(24);
+ BF_GLOBALS._walkRegions.disableRegion(24);
_sceneMode = 9004;
- setAction(&_sequenceManager1, this, 9006, &BF_GLOBALS._player, &_object1, NULL);
+ setAction(&_sequenceManager1, this, 9006, &BF_GLOBALS._player, &_gate, 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))
+ if ((BF_INVENTORY.getObjectScene(INV_FISHING_NET) == 900) || (BF_GLOBALS._gateStatus != 0) ||
+ (_door._flag == 0))
BF_GLOBALS.setFlag(fLeftTraceIn900);
else
BF_GLOBALS.clearFlag(fLeftTraceIn900);
@@ -587,24 +591,24 @@ void Scene900::signal() {
BF_GLOBALS._sceneManager.changeScene(880);
break;
case 9002:
- BF_GLOBALS._walkRegions.proc1(26);
+ BF_GLOBALS._walkRegions.disableRegion(26);
BF_GLOBALS._player.enableControl();
break;
case 9004:
- if (BF_GLOBALS._v4CEC0 == 0)
+ if (BF_GLOBALS._gateStatus == 0)
SceneItem::display2(900, 3);
else
SceneItem::display2(900, 4);
BF_GLOBALS._player.enableControl();
break;
case 9005:
- if (_object3._flag == 0)
+ if (_dog._flag == 0)
BF_GLOBALS._player.setAction(&_action4);
else
BF_GLOBALS._player.enableControl();
break;
case 9006:
- BF_GLOBALS._walkRegions.proc1(24);
+ BF_GLOBALS._walkRegions.disableRegion(24);
BF_GLOBALS._player.enableControl();
break;
case 9007:
@@ -623,16 +627,16 @@ void Scene900::signal() {
break;
case 9010:
_sound1.play(92);
- if (BF_GLOBALS._v4CEC0 == 2) {
+ if (BF_GLOBALS._gateStatus == 2) {
_sceneMode = 9008;
- setAction(&_sequenceManager1, this, 9008, &BF_GLOBALS._player, &_object3, NULL);
+ setAction(&_sequenceManager1, this, 9008, &BF_GLOBALS._player, &_dog, NULL);
} else {
BF_GLOBALS._player._strip = 7;
_action1.setActionIndex(9);
- _object3.signal();
+ _dog.signal();
if ((!BF_GLOBALS.getFlag(fGotPointsForFreeDog)) && (BF_GLOBALS._bookmark == bEndDayThree)) {
BF_GLOBALS.setFlag(fGotPointsForFreeDog);
- BF_GLOBALS._uiElements.addScore(50);
+ T2_GLOBALS._uiElements.addScore(50);
}
BF_INVENTORY.setObjectScene(INV_FISHING_NET, 1);
SceneItem::display2(900, 11);
@@ -640,19 +644,19 @@ void Scene900::signal() {
}
break;
case 9012:
- if (_object2._flag == 0) {
+ if (_door._flag == 0) {
SceneItem::display2(900, 12);
- _object2._flag = 1;
+ _door._flag = 1;
if ((!BF_GLOBALS.getFlag(fGotPointsForLockWarehouse)) && (BF_GLOBALS._bookmark == bEndDayThree)) {
BF_GLOBALS.setFlag(fGotPointsForLockWarehouse);
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
}
} else {
SceneItem::display2(900, 13);
- _object2._flag = 0;
+ _door._flag = 0;
if (!BF_GLOBALS.getFlag(fGotPointsForUnlockWarehouse)) {
BF_GLOBALS.setFlag(fGotPointsForUnlockWarehouse);
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
}
}
BF_GLOBALS._player.enableControl();
@@ -664,9 +668,9 @@ void Scene900::signal() {
BF_GLOBALS._player.enableControl();
break;
case 9016:
- if ((BF_GLOBALS._clip1Bullets == 0) && (BF_GLOBALS._clip2Bullets == 0)){
- BF_GLOBALS._clip1Bullets = 8;
+ if ((BF_GLOBALS._clip1Bullets == 0) && (BF_GLOBALS._clip2Bullets == 0)) {
BF_GLOBALS._clip1Bullets = 8;
+ BF_GLOBALS._clip2Bullets = 8;
SceneItem::display2(900, 25);
} else if (BF_GLOBALS._clip1Bullets == 0) {
BF_GLOBALS._clip1Bullets = 8;
@@ -687,9 +691,9 @@ void Scene900::signal() {
void Scene900::process(Event &event) {
SceneExt::process(event);
- if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (UI_INTERFACE_Y - 1))) {
if (_item4.contains(event.mousePos)) {
- GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_N);
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_W);
BF_GLOBALS._events.setCursor(surface);
} else {
CursorType cursorId = BF_GLOBALS._events.getCursor();
@@ -716,11 +720,2201 @@ void Scene900::dispatch() {
void Scene900::synchronize(Serializer &s) {
SceneExt::synchronize(s);
- s.syncAsSint16LE(_field1974);
+ s.syncAsSint16LE(_lyleDialogCtr);
s.syncAsSint16LE(_field1976);
}
/*--------------------------------------------------------------------------
+ * Scene 910 - Inside the warehouse
+ *
+ *--------------------------------------------------------------------------*/
+/* Actions */
+void Scene910::Action1::signal() {
+ Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex - 1) {
+ case 0:
+ scene->_vent.setStrip(1);
+ scene->_vent.animate(ANIM_MODE_5, this);
+ break;
+ case 1:
+ if (scene->_vent._strip == 2)
+ scene->_vent.setFrame(4);
+ scene->_vent.setStrip(1);
+ scene->_vent.animate(ANIM_MODE_6, NULL);
+ break;
+ case 2:
+ scene->_vent.setStrip(2);
+ scene->_vent.animate(ANIM_MODE_2, NULL);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene910::Action2::signal() {
+ Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ scene->_shadow.postInit();
+ scene->_shadow.setVisage(919);
+ scene->_shadow.setPosition(Common::Point(267, 51));
+ scene->_shadow.fixPriority(40);
+ signal();
+ break;
+ case 1:
+ scene->_shadow.hide();
+ setDelay(600);
+ break;
+ case 2:
+ scene->_shadow.setStrip(BF_GLOBALS._randomSource.getRandomNumber(2) + 2);
+ scene->_shadow.setFrame(1);
+ scene->_shadow.show();
+ setDelay(6);
+ break;
+ case 3:
+ _actionIndex = 1;
+ scene->_shadow.setStrip(BF_GLOBALS._randomSource.getRandomNumber(2) + 2);
+ scene->_shadow.animate(ANIM_MODE_5, this);
+ break;
+ default:
+ break;
+ }
+}
+
+/* Objects */
+
+void Scene910::Lyle::synchronize(Serializer &s) {
+ NamedObject::synchronize(s);
+ s.syncAsSint16LE(_field90);
+}
+
+bool Scene910::Lyle::startAction(CursorType action, Event &event) {
+ Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_USE) {
+ if (BF_GLOBALS._v4CEE2 == 0)
+ return NamedObject::startAction(action, event);
+ else
+ return false;
+ } else if (action == CURSOR_TALK) {
+ if ((BF_GLOBALS._hiddenDoorStatus != 0) || (BF_GLOBALS._v4CEE2 != 0)) {
+ scene->_stripManager.start(9100 + _field90, &BF_GLOBALS._stripProxy);
+ if (_field90 < 1)
+ _field90++;
+ return true;
+ } else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 9130;
+ if (BF_GLOBALS.getFlag(gunDrawn))
+ scene->setAction(&scene->_sequenceManager1, scene, 9138, &BF_GLOBALS._player, &scene->_lyle, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager1, scene, 9130, &BF_GLOBALS._player, &scene->_lyle, NULL);
+ return true;
+ }
+ } else {
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene910::Nico::startAction(CursorType action, Event &event) {
+ Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneSubMode = 6;
+ scene->_sceneMode = 9123;
+ if (BF_GLOBALS._player._visage == 1911)
+ scene->setAction(&scene->_sequenceManager1, scene, 9123, &BF_GLOBALS._player, NULL);
+ else
+ scene->signal();
+ return true;
+ break;
+ case CURSOR_TALK:
+ if (BF_GLOBALS._v4CEE2 >= 4)
+ return NamedObject::startAction(action, event);
+
+ if (BF_GLOBALS._v4CEE6 < 4)
+ BF_GLOBALS._v4CEE6++;
+
+ if (BF_GLOBALS._v4CEE6 == 2) {
+ scene->_sceneMode = 13;
+ scene->_stripManager.start(9105, scene);
+ } else
+ scene->_stripManager.start(9103 + BF_GLOBALS._v4CEE6, &BF_GLOBALS._stripProxy);
+ return true;
+ break;
+ case INV_COLT45:
+ if (BF_GLOBALS._v4CEE2 > 1) {
+ if (BF_GLOBALS._v4CEE2 != 4) {
+ if ((BF_GLOBALS.getFlag(gunDrawn)) && (BF_GLOBALS.getFlag(fGunLoaded)) && (BF_GLOBALS.getHasBullets())) {
+ if (scene->_field2DE0 == 0) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 9126;
+ scene->setAction(&scene->_sequenceManager1, scene, 9126, &scene->_nico, NULL);
+ return NamedObject::startAction(action, event);
+ } else {
+ scene->_stripManager.start(9117, &BF_GLOBALS._stripProxy);
+ return NamedObject::startAction(action, event);
+ }
+ } else
+ return NamedObject::startAction(action, event);
+ } else {
+ SceneItem::display(910, 90, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+ }
+ } else {
+ if ((BF_GLOBALS.getFlag(gunDrawn)) && (BF_GLOBALS.getFlag(fGunLoaded)) && (BF_GLOBALS.getHasBullets())) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 9125;
+ scene->setAction(&scene->_sequenceManager1, scene, 9125, &scene->_nico, NULL);
+ }
+ return NamedObject::startAction(action, event);
+ }
+ break;
+ case INV_BADGE:
+ case INV_ID:
+ if (BF_GLOBALS._v4CEE2 >= 4)
+ return NamedObject::startAction(action, event);
+
+ if (BF_GLOBALS._v4CEE6 < 4)
+ BF_GLOBALS._v4CEE6++;
+
+ if (BF_GLOBALS._v4CEE6 == 2) {
+ scene->_sceneMode = 13;
+ scene->_stripManager.start(9105, scene);
+ } else
+ scene->_stripManager.start(9103 + BF_GLOBALS._v4CEE6, &BF_GLOBALS._stripProxy);
+
+ return true;
+ break;
+ case INV_YELLOW_CORD:
+ if (BF_GLOBALS._v4CEE2 < 4) {
+ BF_GLOBALS._player.disableControl();
+ scene->_yellowCord.fixPriority(121);
+ scene->_sceneSubMode = 10;
+ scene->_sceneMode = 9123;
+ if (BF_GLOBALS._player._visage == 1911)
+ scene->setAction(&scene->_sequenceManager1, scene, 9123, &BF_GLOBALS._player, NULL);
+ else
+ scene->signal();
+
+ return true;
+ } else {
+ SceneItem::display(910, 95, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+
+ return true;
+ }
+ break;
+ case INV_HALF_YELLOW_CORD:
+ if (BF_GLOBALS._v4CECC == 1)
+ SceneItem::display(910, 84, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ else
+ SceneItem::display(910, 82, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+ break;
+ case INV_BLACK_CORD:
+ case INV_HALF_BLACK_CORD:
+ SceneItem::display(910, 83, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+ break;
+ default:
+ return NamedObject::startAction(action, event);
+ break;
+ }
+}
+
+bool Scene910::Stuart::startAction(CursorType action, Event &event) {
+ Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneSubMode = 7;
+ scene->_sceneMode = 9123;
+ if (BF_GLOBALS._player._visage == 1911)
+ scene->setAction(&scene->_sequenceManager1, scene, 9123, &BF_GLOBALS._player, NULL);
+ else
+ scene->signal();
+ return true;
+ break;
+ case CURSOR_TALK:
+ if (BF_GLOBALS._v4CEE8 < 3)
+ BF_GLOBALS._v4CEE8++;
+
+ scene->_stripManager.start(9107 + BF_GLOBALS._v4CEE8, &BF_GLOBALS._stripProxy);
+ return true;
+ break;
+ case INV_COLT45:
+ if ((BF_GLOBALS.getFlag(gunDrawn)) && (BF_GLOBALS.getFlag(fGunLoaded)) && (BF_GLOBALS.getHasBullets())){
+ BF_GLOBALS._player.disableControl();
+ if (BF_GLOBALS._v4CEE4 == 2) {
+ scene->_sceneMode = 9132;
+ scene->setAction(&scene->_sequenceManager1, scene, 9132, &scene->_stuart, NULL);
+ return NamedObject::startAction(action, event);
+ } else {
+ if (scene->_field2DE0 == 0) {
+ scene->_sceneMode = 9132;
+ scene->setAction(&scene->_sequenceManager1, scene, 9132, &scene->_stuart, NULL);
+ } else
+ scene->_stripManager.start(9117, &BF_GLOBALS._stripProxy);
+ return NamedObject::startAction(action, event);
+ }
+ } else
+ return NamedObject::startAction(action, event);
+ break;
+ case INV_YELLOW_CORD:
+ if (BF_GLOBALS._v4CECC == 1) {
+ SceneItem::display(910, 84, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+ } else {
+ BF_GLOBALS._player.disableControl();
+ if (BF_GLOBALS._v4CEE2 == 4) {
+ scene->_sceneSubMode = 11;
+ scene->_sceneMode = 9123;
+ if (BF_GLOBALS._player._visage == 1911)
+ scene->setAction(&scene->_sequenceManager1, scene, 9123, &BF_GLOBALS._player, NULL);
+ else
+ scene->signal();
+ return true;
+ } else {
+ scene->_sceneSubMode = 12;
+ scene->_sceneMode = 9123;
+ if (BF_GLOBALS._player._visage == 1911)
+ scene->setAction(&scene->_sequenceManager1, scene, 9123, &BF_GLOBALS._player, NULL);
+ else
+ scene->signal();
+ return true;
+ }
+ }
+ break;
+ case INV_HALF_YELLOW_CORD:
+ if (BF_GLOBALS._v4CECC == 1) {
+ SceneItem::display(910, 84, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+ } else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneSubMode = 11;
+ scene->_sceneMode = 9123;
+ if (BF_GLOBALS._player._visage == 1911)
+ scene->setAction(&scene->_sequenceManager1, scene, 9123, &BF_GLOBALS._player, NULL);
+ else
+ scene->signal();
+ return true;
+ }
+ break;
+ case INV_BLACK_CORD:
+ case INV_HALF_BLACK_CORD:
+ SceneItem::display(910, 83, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+ break;
+ default:
+ return NamedObject::startAction(action, event);
+ break;
+ }
+}
+
+bool Scene910::Forbes::startAction(CursorType action, Event &event) {
+ Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_TALK) {
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._walkRegions.enableRegion(1);
+ BF_GLOBALS._walkRegions.enableRegion(16);
+ scene->_sceneMode = 9140;
+ scene->setAction(&scene->_sequenceManager1, scene, 9140, &scene->_forbes, &BF_GLOBALS._player, &scene->_lyle, NULL);
+ return true;
+ } else
+ return NamedObject::startAction(action, event);
+}
+
+void Scene910::PowerCord::synchronize(Serializer &s) {
+ NamedObject::synchronize(s);
+ s.syncAsSint16LE(_field90);
+ s.syncAsSint16LE(_field92);
+}
+
+bool Scene910::PowerCord::startAction(CursorType action, Event &event) {
+ Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
+
+ // the last check is used in order to replace a check on CURSOR_1000, which is replaced
+ // directly by its sub-check. All items have an id inferior to 100h.
+ if ((action == CURSOR_LOOK) || (action == CURSOR_TALK) || (action < CURSOR_WALK)) {
+ if (_field90 == 1)
+ return false;
+ if ((_field92 != 1) || (BF_GLOBALS._hiddenDoorStatus == 0 ))
+ return NamedObject::startAction(action, event);
+ return false;
+ } else if (action == CURSOR_USE) {
+ if (_field90 == 0) {
+ if ((BF_GLOBALS._hiddenDoorStatus == 0) || (_field92 != 1)) {
+ BF_GLOBALS._player.disableControl();
+ if (_field92 == 1) {
+ scene->_sceneSubMode = 8;
+ scene->_sceneMode = 9123;
+ if (BF_GLOBALS._player._visage == 1911)
+ scene->setAction(&scene->_sequenceManager1, scene, 9123, &BF_GLOBALS._player, NULL);
+ else
+ scene->signal();
+ _field90 = 1;
+ return true;
+ } else {
+ scene->_destPos = Common::Point(151, 186);
+ scene->_sceneSubMode = 4;
+ scene->_sceneMode = 9123;
+ if (BF_GLOBALS._player._visage == 1911)
+ scene->setAction(&scene->_sequenceManager1, scene, 9123, &BF_GLOBALS._player, NULL);
+ else
+ scene->signal();
+ _field90 = 1;
+ return true;
+ }
+ } else
+ return false;
+ } else if (_field90 == 1)
+ return false;
+ else
+ return true;
+ } else
+ return NamedObject::startAction(action, event);
+}
+
+void Scene910::PowerCord::init(int val) {
+ NamedObject::postInit();
+
+ _field92 = val;
+ _field90 = 0;
+}
+
+bool Scene910::BreakerBox::startAction(CursorType action, Event &event) {
+ Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ if (BF_GLOBALS._v4CEC8 == 0)
+ SceneItem::display2(910, 7);
+ else
+ SceneItem::display2(910, 6);
+ return true;
+ break;
+ case CURSOR_USE:
+ if (scene->_lyle._position.x == 115) {
+ SceneItem::display2(910, 62);
+ return true;
+ } else if (scene->_sceneMode != 9120) {
+ if (BF_GLOBALS._v4CEE2 == 1) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 9118;
+ scene->setAction(&scene->_sequenceManager1, scene, 9118, &BF_GLOBALS._player, &scene->_nico, NULL);
+ return true;
+ } else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 9102;
+ if (BF_GLOBALS.getFlag(gunDrawn)) {
+ scene->_sceneSubMode = 1;
+ scene->_sceneMode = 9123;
+ scene->setAction(&scene->_sequenceManager1, scene, 9123, &BF_GLOBALS._player, NULL);
+ return true;
+ } else {
+ scene->setAction(&scene->_sequenceManager1, scene, 9102, &BF_GLOBALS._player, NULL);
+ return true;
+ }
+ }
+ } else {
+ SceneItem::display(910, 62, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+ }
+ break;
+ default:
+ return NamedObject::startAction(action, event);
+ break;
+ }
+}
+
+bool Scene910::FakeWall::startAction(CursorType action, Event &event) {
+ Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action == INV_YELLOW_CORD) {
+ BF_GLOBALS._player.disableControl();
+ scene->_destPos = Common::Point(285, 114);
+ scene->_sceneSubMode = 9;
+ scene->_sceneMode = 9123;
+ if (BF_GLOBALS._player._visage == 1911)
+ scene->setAction(&scene->_sequenceManager1, scene, 9123, &BF_GLOBALS._player, NULL);
+ else
+ scene->signal();
+ return true;
+ } else
+ return NamedObject::startAction(action, event);
+}
+
+void Scene910::BreakerBoxInset::postInit(SceneObjectList *OwnerList) {
+ Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
+
+ FocusObject::postInit();
+ _resNum = 910;
+ _lookLineNum = 7;
+ _useLineNum = 8;
+ BF_GLOBALS._sceneItems.push_back(this);
+ scene->_breakerButtonCtr = 0;
+
+ _object13.setupBreaker(115, 44, 1, BF_GLOBALS._breakerBoxStatusArr[0]);
+ _object14.setupBreaker(116, 63, 2, BF_GLOBALS._breakerBoxStatusArr[1]);
+ _object15.setupBreaker(116, 69, 2, BF_GLOBALS._breakerBoxStatusArr[2]);
+ _object16.setupBreaker(115, 76, 1, BF_GLOBALS._breakerBoxStatusArr[3]);
+ _object17.setupBreaker(115, 95, 1, BF_GLOBALS._breakerBoxStatusArr[4]);
+ _object18.setupBreaker(116, 114, 2, BF_GLOBALS._breakerBoxStatusArr[5]);
+ _object19.setupBreaker(116, 120, 2, BF_GLOBALS._breakerBoxStatusArr[6]);
+ _object20.setupBreaker(188, 45, 2, BF_GLOBALS._breakerBoxStatusArr[7]);
+ _object21.setupBreaker(188, 51, 2, BF_GLOBALS._breakerBoxStatusArr[8]);
+ _object22.setupBreaker(179, 59, 1, BF_GLOBALS._breakerBoxStatusArr[9]);
+ _object23.setupBreaker(187, 78, 2, BF_GLOBALS._breakerBoxStatusArr[10]);
+ _object24.setupBreaker(187, 84, 2, BF_GLOBALS._breakerBoxStatusArr[11]);
+
+ _object25.setupHiddenSwitch(178, 90, 1, BF_GLOBALS._breakerBoxStatusArr[12]);
+ _object26.setupHiddenSwitch(178, 108, 2, BF_GLOBALS._breakerBoxStatusArr[13]);
+}
+
+void Scene910::BreakerBoxInset::remove() {
+ Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
+
+ _object13.remove();
+ _object14.remove();
+ _object15.remove();
+ _object16.remove();
+ _object17.remove();
+ _object18.remove();
+ _object19.remove();
+ _object20.remove();
+ _object21.remove();
+ _object22.remove();
+ _object23.remove();
+ _object24.remove();
+ _object25.remove();
+ _object26.remove();
+ _object27.remove();
+ _object28.remove();
+
+ if ((BF_GLOBALS._breakerBoxStatusArr[13] < 4) && (scene->_breakerBox._frame > 1))
+ scene->_breakerBox.animate(ANIM_MODE_6, NULL);
+
+ FocusObject::remove();
+}
+
+void Scene910::Object13::synchronize(Serializer &s) {
+ NamedObject::synchronize(s);
+ s.syncAsSint16LE(_state);
+ s.syncAsSint16LE(_mode);
+}
+
+bool Scene910::Object13::startAction(CursorType action, Event &event) {
+ static uint32 black = 0;
+ Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
+
+ int8 xDiff;
+
+ if (_mode == 1)
+ xDiff = 12;
+ else
+ xDiff = 7;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display(910, 9, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+ case CURSOR_USE:
+ scene->_sound2.play(101);
+ if (event.mousePos.x <= _position.x + xDiff) {
+ if (_mode != 1) {
+ if (_frame > 6)
+ setFrame(_frame - 1);
+ } else {
+ if (_frame > 1)
+ setFrame(_frame - 1);
+ }
+ } else {
+ if (_mode == 1) {
+ if (_frame < 3)
+ setFrame(_frame + 1);
+ } else {
+ if (_frame < 8)
+ setFrame(_frame + 1);
+ }
+ }
+
+ if (_mode != 1)
+ BF_GLOBALS._breakerBoxStatusArr[_state - 1] = (_state + 251) % 256;
+ else
+ BF_GLOBALS._breakerBoxStatusArr[_state - 1] = _state;
+
+ switch (_state) {
+ case 1:
+ if (BF_GLOBALS._v4CEE2 < 1) {
+ if (_frame == 2) {
+ if (!BF_GLOBALS.getFlag(fGotPointsForClosingDoor)) {
+ T2_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(fGotPointsForClosingDoor);
+ }
+ scene->_sceneMode = 0;
+ if (BF_GLOBALS._dayNumber == 5) {
+ if (BF_GLOBALS._v4CEE2 == 0) {
+ scene->_breakerBoxInset.remove();
+ // _objectList.draw();
+ BF_GLOBALS._player.disableControl();
+ scene->_lyle.setVisage(912);
+ scene->_shadow.remove();
+ scene->_action2.remove();
+ scene->_nico.postInit();
+ scene->_sceneMode = 9129;
+ scene->setAction(&scene->_sequenceManager1, scene, 9129, &BF_GLOBALS._player, &scene->_nico, NULL);
+ } else if (BF_GLOBALS._v4CEE2 == 2) {
+ scene->_breakerBoxInset.remove();
+ // _objectList.draw();
+ BF_GLOBALS._player.disableControl();
+ scene->_lyle.setVisage(911);
+ scene->_lyle.setStrip(4);
+ scene->_nico.setVisage(923);
+ scene->_nico.setStrip(2);
+ scene->_stuart.setVisage(923);
+ scene->_stuart.setStrip(3);
+ scene->_sceneMode = 9134;
+ scene->setAction(&scene->_sequenceManager1, scene, 9134, &BF_GLOBALS._player, &scene->_nico, &scene->_lyle, NULL);
+ }
+ }
+ BF_GLOBALS._v4CEC8 = 1;
+ scene->_object5.show();
+ if (scene->_sceneMode == 0) {
+ BF_GLOBALS._player.setVisage(911);
+ scene->_lyle.setVisage(912);
+ }
+ scene->transition((const byte *)&black, 25, 910, NULL, 0, 111, 112, 255, 0);
+ BF_GLOBALS._scenePalette.signalListeners();
+ // _objectList.draw();
+ } else {
+ if (BF_GLOBALS._v4CEC8 == 1) {
+ if (!BF_GLOBALS.getFlag(fGotPointsForStartGenerator)) {
+ T2_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(fGotPointsForStartGenerator);
+ }
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._v4CEC8 = 0;
+ scene->_sceneMode = 2;
+ scene->transition((const byte *)&black, 30, 910, scene, 0, 111, 112, 255, 0);
+ }
+ }
+ } else
+ SceneItem::display(910, 97, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+ case 4:
+ if (_frame == 2) {
+ if (BF_GLOBALS._breakerBoxStatusArr[4] == 2) {
+ scene->_action1.setActionIndex(2);
+ scene->_action1.signal();
+ }
+ } else if (scene->_action1.getActionIndex() == 2) {
+ scene->_action1.setActionIndex(1);
+ scene->_action1.signal();
+ }
+ return true;
+ case 5:
+ if (_frame == 2) {
+ if (BF_GLOBALS._breakerBoxStatusArr[3] == 2) {
+ scene->_action1.setActionIndex(2);
+ scene->_action1.signal();
+ }
+ } else if (scene->_action1.getActionIndex() == 2) {
+ scene->_action1.setActionIndex(1);
+ scene->_action1.signal();
+ }
+ return true;
+ case 15:
+ if ((BF_GLOBALS._v4CECA == 2) && (BF_GLOBALS._breakerBoxStatusArr[17] == 1)) {
+ if (_frame == 7)
+ scene->closeHiddenDoor();
+ else
+ scene->openHiddenDoor();
+ }
+ return true;
+ default:
+ return true;
+ }
+ default:
+ return NamedObject::startAction(action, event);
+ break;
+ }
+}
+
+void Scene910::Object13::remove() {
+ BF_GLOBALS._sceneItems.remove(this);
+ SceneObject::remove();
+}
+
+void Scene910::Object13::setupBreaker(int x, int y, int mode, int8 frameNumber) {
+ Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
+
+ NamedObject::postInit();
+ _mode = mode;
+ scene->_breakerButtonCtr++;
+ _state = scene->_breakerButtonCtr;
+ setVisage(910);
+
+ if (mode == 1) {
+ setStrip(8);
+ setFrame(frameNumber);
+ } else if (mode == 2) {
+ setStrip(7);
+ setFrame(frameNumber + 5);
+ }
+
+ fixPriority(252);
+ setPosition(Common::Point(x, y));
+ BF_GLOBALS._sceneItems.push_front(this);
+}
+
+void Scene910::Object25::synchronize(Serializer &s) {
+ NamedObject::synchronize(s);
+ s.syncAsSint16LE(_field90);
+ s.syncAsSint16LE(_field92);
+}
+
+bool Scene910::Object25::startAction(CursorType action, Event &event) {
+ Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ if (_field92 == 1)
+ SceneItem::display2(910, 10);
+ else
+ SceneItem::display2(910, 11);
+ return true;
+ case CURSOR_USE:
+ _field92 = BF_GLOBALS._breakerBoxStatusArr[_field90 + 11];
+ switch (_field92 - 1) {
+ case 0:
+ _field92 = 2;
+ setStrip(7);
+ setFrame(1);
+ if (_field90 == 1) {
+ scene->_breakerButtonCtr = 14;
+ scene->_breakerBoxInset._object27.setupBreaker(182, 92, 2, BF_GLOBALS._breakerBoxStatusArr[14]);
+ } else {
+ scene->_breakerButtonCtr = 15;
+ scene->_breakerBoxInset._object28.init(178, 108, 0, BF_GLOBALS._breakerBoxStatusArr[15]);
+ }
+ SceneItem::display2(910, 12);
+ break;
+ case 1:
+ _field92 = 3;
+ setStrip(6);
+ setFrame(3);
+ if (_field90 == 1)
+ scene->_breakerBoxInset._object27.remove();
+ else
+ scene->_breakerBoxInset._object28.remove();
+ break;
+ case 2:
+ _field92 = 2;
+ setStrip(7);
+ setFrame(1);
+ if (_field90 == 1) {
+ scene->_breakerButtonCtr = 14;
+ scene->_breakerBoxInset._object27.setupBreaker(182, 96, 2, BF_GLOBALS._breakerBoxStatusArr[14]);
+ } else {
+ scene->_breakerButtonCtr = 15;
+ scene->_breakerBoxInset._object28.init(178, 108, 0, BF_GLOBALS._breakerBoxStatusArr[15]);
+ }
+ break;
+ case 3:
+ SceneItem::display2(910, 13);
+ break;
+ default:
+ break;
+ }
+
+ BF_GLOBALS._breakerBoxStatusArr[_field90 + 11] = _field92;
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ break;
+ }
+}
+
+void Scene910::Object25::remove() {
+ BF_GLOBALS._sceneItems.remove(this);
+ SceneObject::remove();
+}
+
+void Scene910::Object25::setupHiddenSwitch(int x, int y, int arg8, int argA) {
+ Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
+
+ NamedObject::postInit();
+ scene->_breakerButtonCtr++;
+ _field90 = arg8;
+ _field92 = argA;
+ setVisage(910);
+
+ if ((_field92 != 2) && (_field92 != 4)) {
+ setStrip(6);
+ setFrame(3);
+ } else {
+ setStrip(7);
+ setFrame(1);
+ if (_field90 == 1) {
+ scene->_breakerButtonCtr = 14;
+ scene->_breakerBoxInset._object27.setupBreaker(182, 96, 2, BF_GLOBALS._breakerBoxStatusArr[14]);
+ } else {
+ scene->_breakerButtonCtr = 15;
+ scene->_breakerBoxInset._object28.init(178, 108, 0, BF_GLOBALS._breakerBoxStatusArr[15]);
+ }
+ }
+
+ fixPriority(251);
+ setPosition(Common::Point(x, y));
+ BF_GLOBALS._sceneItems.push_front(this);
+}
+
+bool Scene910::BlackPlug::startAction(CursorType action, Event &event) {
+ Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display(910, 14, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+ case CURSOR_USE:
+ switch (_frame - _state - 2) {
+ case 0:
+ SceneItem::display(910, 15, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ break;
+ case 1:
+ if (BF_GLOBALS._v4CECA == 1) {
+ BF_GLOBALS._v4CECA = 0;
+ BF_INVENTORY.setObjectScene(INV_BLACK_CORD, 1);
+ BF_INVENTORY.setObjectScene(INV_HALF_BLACK_CORD, 910);
+ } else if (BF_GLOBALS._v4CECA == 2) {
+ BF_GLOBALS._v4CECA = 1;
+ BF_INVENTORY.setObjectScene(INV_BLACK_CORD, 3 - _state);
+ BF_INVENTORY.setObjectScene(INV_HALF_BLACK_CORD, 1);
+ scene->_blackCord.setPosition(Common::Point(540, 100));
+ }
+ setFrame(_state + 2);
+ break;
+ case 2:
+ if (BF_GLOBALS._v4CECC == 1) {
+ BF_GLOBALS._v4CECC = 0;
+ BF_INVENTORY.setObjectScene(INV_YELLOW_CORD, 1);
+ BF_INVENTORY.setObjectScene(INV_HALF_YELLOW_CORD, 910);
+ } else if (BF_GLOBALS._v4CECC == 2) {
+ BF_GLOBALS._v4CECC = 1;
+ BF_INVENTORY.setObjectScene(INV_YELLOW_CORD, 3 - _state);
+ BF_INVENTORY.setObjectScene(INV_HALF_YELLOW_CORD, 1);
+ scene->_yellowCord.setPosition(Common::Point(540, 100));
+ }
+ setFrame(_state + 2);
+ break;
+ case 3:
+ if ((_position.x - 12) - (5 * _state) < event.mousePos.x) {
+ if (BF_GLOBALS._v4CECA == 1) {
+ BF_GLOBALS._v4CECA = 0;
+ BF_INVENTORY.setObjectScene(INV_BLACK_CORD, 1);
+ BF_INVENTORY.setObjectScene(INV_HALF_BLACK_CORD, 910);
+ scene->_blackCord.setPosition(Common::Point(540, 100));
+ } else if (BF_GLOBALS._v4CECA == 2) {
+ BF_GLOBALS._v4CECA = 1;
+ BF_INVENTORY.setObjectScene(INV_BLACK_CORD, 3 - _state);
+ BF_INVENTORY.setObjectScene(INV_HALF_BLACK_CORD, 1);
+ scene->_blackCord.setPosition(Common::Point(540, 100));
+ }
+ setFrame(_state + 4);
+ } else {
+ if (BF_GLOBALS._v4CECC == 1) {
+ BF_GLOBALS._v4CECC = 0;
+ BF_INVENTORY.setObjectScene(INV_YELLOW_CORD, 1);
+ BF_INVENTORY.setObjectScene(INV_HALF_YELLOW_CORD, 910);
+ } else if (BF_GLOBALS._v4CECC == 2) {
+ BF_GLOBALS._v4CECC = 1;
+ BF_INVENTORY.setObjectScene(INV_YELLOW_CORD, 3 - _state);
+ BF_INVENTORY.setObjectScene(INV_HALF_YELLOW_CORD, 1);
+ scene->_yellowCord.setPosition(Common::Point(540, 100));
+ }
+ setFrame(_state + 3);
+ }
+ default:
+ break;
+ }
+ BF_GLOBALS._breakerBoxStatusArr[_state + 15] = _frame;
+ if (_state == 0) {
+ if (_frame == 2)
+ BF_GLOBALS._breakerBoxStatusArr[13] = 2;
+ else
+ BF_GLOBALS._breakerBoxStatusArr[13] = 4;
+ }
+ return true;
+ case INV_HALF_YELLOW_CORD:
+ if (BF_INVENTORY.getObjectScene(INV_YELLOW_CORD) == _state + 2) {
+ SceneItem::display(910, 85, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+ }
+ if (BF_GLOBALS._v4CEE2 == 3) {
+ SceneItem::display(910, 84, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+ }
+ // no break on purpose
+ case INV_YELLOW_CORD:
+ if (BF_GLOBALS._v4CECC == 0) {
+ BF_GLOBALS._v4CECC = 1;
+ BF_INVENTORY.setObjectScene(INV_YELLOW_CORD, _state + 2);
+ BF_INVENTORY.setObjectScene(INV_HALF_YELLOW_CORD, 1);
+ } else if (BF_GLOBALS._v4CECC == 1) {
+ BF_GLOBALS._v4CECC = 2;
+ BF_INVENTORY.setObjectScene(INV_HALF_YELLOW_CORD, _state + 2);
+ scene->_yellowCord.setStrip(4);
+ scene->_yellowCord.setFrame(2);
+ scene->_yellowCord.setPosition(Common::Point(135, 93));
+ scene->_yellowCord.fixPriority(50);
+ }
+ if (_frame - _state == 2)
+ setFrame(_state + 4);
+ else if (_frame - _state == 3)
+ setFrame(_state + 5);
+ BF_GLOBALS._breakerBoxStatusArr[_state + 15] = _frame;
+ if (_state == 0) {
+ if (_frame == 2)
+ BF_GLOBALS._breakerBoxStatusArr[13] = 2;
+ else
+ BF_GLOBALS._breakerBoxStatusArr[13] = 4;
+ }
+ return true;
+ case INV_HALF_BLACK_CORD:
+ if (BF_INVENTORY.getObjectScene(INV_BLACK_CORD) == _state + 2) {
+ SceneItem::display(910, 85, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+ }
+ //No break on purpose
+ case INV_BLACK_CORD:
+ if (BF_GLOBALS._v4CECA == 0) {
+ if (_state == 1) {
+ if (!BF_GLOBALS.getFlag(fGotPointsForBlackCord)) {
+ T2_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(fGotPointsForBlackCord);
+ }
+ } else {
+ if (!BF_GLOBALS.getFlag(fGotPointsForGeneratorPlug)) {
+ T2_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(fGotPointsForGeneratorPlug);
+ }
+ }
+ BF_GLOBALS._v4CECA = 1;
+ BF_INVENTORY.setObjectScene(INV_BLACK_CORD, _state + 2);
+ BF_INVENTORY.setObjectScene(INV_HALF_BLACK_CORD, 1);
+ } else if (BF_GLOBALS._v4CECA == 1) {
+ if (_state == 1) {
+ if (!BF_GLOBALS.getFlag(fGotPointsForBlackCord)) {
+ T2_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(fGotPointsForBlackCord);
+ }
+ } else {
+ if (!BF_GLOBALS.getFlag(fGotPointsForGeneratorPlug)) {
+ T2_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(fGotPointsForGeneratorPlug);
+ }
+ }
+ BF_GLOBALS._v4CECA = 2;
+ BF_INVENTORY.setObjectScene(INV_HALF_BLACK_CORD, _state + 2);
+ scene->_blackCord.setStrip(4);
+ scene->_blackCord.setFrame(1);
+ scene->_blackCord.setPosition(Common::Point(135, 93));
+ scene->_blackCord.fixPriority(50);
+ scene->_blackCord.show();
+ scene->_blackCord._field90 = 1;
+ if (BF_GLOBALS._breakerBoxStatusArr[17] == 1) {
+ if (BF_GLOBALS._breakerBoxStatusArr[14] == 2)
+ scene->closeHiddenDoor();
+ else
+ scene->openHiddenDoor();
+ }
+ }
+ if (_frame - _state == 2)
+ setFrame(_state + 3);
+ else if (_frame - _state == 4)
+ setFrame(_state + 5);
+ BF_GLOBALS._breakerBoxStatusArr[_state + 15] = _frame;
+ if (_state == 0) {
+ if (_frame == 2)
+ BF_GLOBALS._breakerBoxStatusArr[13] = 2;
+ else
+ BF_GLOBALS._breakerBoxStatusArr[13] = 4;
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+void Scene910::BlackPlug::init(int x, int y, int arg8, int8 argA) {
+ NamedObject::postInit();
+ _state = arg8;
+ _mode = argA;
+ setVisage(910);
+ if (_state == 0)
+ setStrip(7);
+ else
+ setStrip(3);
+ setFrame(argA);
+ fixPriority(251);
+ setPosition(Common::Point(x, y));
+ BF_GLOBALS._sceneItems.push_front(this);
+}
+
+void Scene910::BlackPlug::remove() {
+ BF_GLOBALS._sceneItems.remove(this);
+ SceneObject::remove();
+}
+
+void Scene910::GeneratorInset::postInit(SceneObjectList *OwnerList) {
+ Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
+
+ FocusObject::postInit();
+ _resNum = 910;
+ _lookLineNum = 99;
+ _useLineNum = 87;
+ BF_GLOBALS._sceneItems.push_front(this);
+
+ scene->_breakerButtonCtr = 16;
+ _blackPlug.init(142, 86, 1, BF_GLOBALS._breakerBoxStatusArr[16]);
+
+ scene->_breakerButtonCtr = 17;
+ _powerButton.init(BF_GLOBALS._breakerBoxStatusArr[17]);
+}
+
+void Scene910::GeneratorInset::remove() {
+ Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
+
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 12;
+ BF_GLOBALS._player.animate(ANIM_MODE_6, scene);
+ _blackPlug.remove();
+ _powerButton.remove();
+ FocusObject::remove();
+}
+
+bool Scene910::PowerButton::startAction(CursorType action, Event &event) {
+ Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_USE) {
+ if (_frame == 4) {
+ scene->_sound1.play(100);
+ scene->_sound1.holdAt(1);
+ if (!BF_GLOBALS.getFlag(fGotPointsForFuseBoxPlug)) {
+ T2_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(fGotPointsForFuseBoxPlug);
+ }
+ setFrame(5);
+ _object32.setFrame(7);
+ if (BF_GLOBALS._v4CECA == 2) {
+ if (BF_GLOBALS._breakerBoxStatusArr[14] == 2)
+ scene->closeHiddenDoor();
+ else
+ scene->openHiddenDoor();
+ }
+ } else {
+ scene->_sound1.release();
+ if (BF_GLOBALS._bookmark == bEndDayThree) {
+ if (!BF_GLOBALS.getFlag(fGotPointsForLightsOff)) {
+ T2_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(fGotPointsForLightsOff);
+ }
+ }
+ setFrame(4);
+ _object32.setFrame(6);
+ }
+ BF_GLOBALS._breakerBoxStatusArr[17] = (_frame + 252) % 256;
+ return true;
+ } else
+ return NamedObject::startAction(action, event);
+}
+
+void Scene910::PowerButton::remove() {
+ _object32.remove();
+ SceneObject::remove();
+}
+
+void Scene910::PowerButton::init(int frame) {
+ NamedObject::postInit();
+ setVisage(910);
+ setStrip(6);
+ setFrame(frame + 4);
+ setPosition(Common::Point(159, 83));
+ fixPriority(251);
+ _object32.postInit();
+ _object32.setVisage(910);
+ _object32.setStrip(6);
+ _object32.setFrame(6 + frame);
+ _object32.setPosition(Common::Point(166, 84));
+ _object32.fixPriority(251);
+ BF_GLOBALS._sceneItems.push_front(this);
+}
+
+bool Scene910::Generator::startAction(CursorType action, Event &event) {
+ Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_USE) {
+ if (scene->_lyle._position.x == 115)
+ SceneItem::display(910, 62, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ else if (BF_GLOBALS._v4CEE2 == 1) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 9118;
+ scene->setAction(&scene->_sequenceManager1, scene, 9118, &BF_GLOBALS._player, &scene->_nico, NULL);
+ } else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 9103;
+ if (BF_GLOBALS.getFlag(gunDrawn)) {
+ scene->_sceneMode = 9123;
+ scene->setAction(&scene->_sequenceManager1, scene, 9123, &BF_GLOBALS._player, NULL);
+ } else
+ scene->setAction(&scene->_sequenceManager1, scene, 9103, &BF_GLOBALS._player, NULL);
+ }
+ return true;
+ } else {
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+bool Scene910::Item2::startAction(CursorType action, Event &event) {
+ Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action == 59) {
+ BF_GLOBALS._player.disableControl();
+ scene->_destPos = Common::Point(151, 186);
+ scene->_sceneSubMode = 5;
+ scene->_sceneMode = 9123;
+ if (BF_GLOBALS._player._visage == 1911)
+ scene->setAction(&scene->_sequenceManager1, scene, 9123, &BF_GLOBALS._player, NULL);
+ else
+ scene->signal();
+ return true;
+ } else
+ return NamedHotspot::startAction(action, event);
+}
+
+bool Scene910::Item3::startAction(CursorType action, Event &event) {
+ Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
+
+ if ((action == CURSOR_TALK) && (BF_GLOBALS._v4CEE2 == 4) && (BF_GLOBALS._v4CEE4 == 0)) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 15;
+ scene->_stripManager.start(9102, scene);
+ return true;
+ } else {
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+bool Scene910::Item9::startAction(CursorType action, Event &event) {
+ if (BF_GLOBALS._hiddenDoorStatus == 0)
+ return NamedHotspot::startAction(action, event);
+ else
+ return false;
+}
+
+bool Scene910::Item15::startAction(CursorType action, Event &event) {
+ if (BF_GLOBALS._v4CEC8 == 0)
+ return false;
+
+ if ((action == CURSOR_LOOK) || (action == CURSOR_USE) || (action == CURSOR_TALK))
+ return NamedHotspot::startAction(action, event);
+
+ if (action >= CURSOR_WALK)
+ return false;
+
+ SceneItem::display(910, 2, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ return true;
+}
+
+bool Scene910::Item16::startAction(CursorType action, Event &event) {
+ Scene910 *scene = (Scene910 *)BF_GLOBALS._sceneManager._scene;
+
+ if ((BF_GLOBALS._hiddenDoorStatus == 0) || (BF_GLOBALS._v4CEE2 != 0))
+ return false;
+
+ if (BF_GLOBALS._player._visage == 1911) {
+ BF_GLOBALS._player.disableControl();
+ scene->_destPos = Common::Point(292, 100);
+ scene->_sceneSubMode = 0;
+ scene->_sceneMode = 9123;
+ scene->setAction(&scene->_sequenceManager1, scene, 9123, &BF_GLOBALS._player, NULL);
+ } else {
+ Common::Point pt(292, 100);
+ PlayerMover *mover = new PlayerMover();
+ BF_GLOBALS._player.addMover(mover, &pt, NULL);
+ }
+
+ return true;
+}
+
+bool Scene910::Item17::startAction(CursorType action, Event &event) {
+ Common::Point pt(15, 159);
+ PlayerMover *mover = new PlayerMover();
+ BF_GLOBALS._player.addMover(mover, &pt, NULL);
+
+ return true;
+}
+
+void Scene910::remove() {
+ PalettedScene::remove();
+}
+
+void Scene910::synchronize(Serializer &s) {
+ PalettedScene::synchronize(s);
+
+ s.syncAsSint16LE(_sceneSubMode);
+ s.syncAsSint16LE(_breakerButtonCtr);
+ s.syncAsSint16LE(_field2DE0);
+ s.syncAsSint16LE(_field2DE2);
+ s.syncAsSint16LE(_field2DE4);
+ s.syncAsSint16LE(_destPos.x);
+ s.syncAsSint16LE(_destPos.y);
+}
+
+void Scene910::postInit(SceneObjectList *OwnerList) {
+ uint32 unk_50E94 = 0, unk_50E90 = 0;
+ uint32 unk_50E98 = 0, unk_50E9C = 0;
+
+ PalettedScene::postInit(OwnerList);
+ loadScene(910);
+
+ BF_GLOBALS._sound1.changeSound(99);
+ BF_GLOBALS._v51C44 = 0;
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_jakeJacketSpeaker);
+ _stripManager.addSpeaker(&_lyleHatSpeaker);
+ _stripManager.addSpeaker(&_fbiSpeaker);
+ _stripManager.addSpeaker(&_nicoSpeaker);
+ _stripManager.addSpeaker(&_daSpeaker);
+ BF_GLOBALS._player.postInit();
+
+ if (BF_GLOBALS._v4CEC8 == 0)
+ BF_GLOBALS._player.setVisage(129);
+ else
+ BF_GLOBALS._player.setVisage(911);
+
+ BF_GLOBALS._player.setPosition(Common::Point(330, 190));
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.disableControl();
+
+ _vent.postInit();
+ _vent.setVisage(910);
+ if ((BF_GLOBALS._breakerBoxStatusArr[3] == 2) && (BF_GLOBALS._breakerBoxStatusArr[4] == 2)) {
+ _action1.setActionIndex(4);
+ } else {
+ _vent.animate(ANIM_MODE_2, NULL);
+ _vent.setStrip(2);
+ }
+ _vent.setPosition(Common::Point(98, 34));
+ _vent.setAction(&_action1);
+
+ _breakerBox.postInit();
+ _breakerBox.setVisage(910);
+ _breakerBox.setStrip(5);
+ _breakerBox.setFrame(1);
+ _breakerBox.setPosition(Common::Point(91, 66));
+
+ _fakeWall.postInit();
+ _fakeWall.setVisage(910);
+ _fakeWall.setStrip(8);
+ _fakeWall.setFrame(4);
+ _fakeWall.fixPriority(48);
+
+ _yellowCord.init(1);
+ _yellowCord.setVisage(910);
+ _yellowCord.setStrip(6);
+ _yellowCord.setFrame(2);
+ _yellowCord.fixPriority(50);
+
+ _blackCord.init(2);
+ _blackCord.setVisage(910);
+ _blackCord.setStrip(6);
+ _blackCord.setFrame(1);
+ _blackCord.setPosition(Common::Point(114, 149));
+ _blackCord.fixPriority(246);
+
+ if (BF_GLOBALS._dayNumber < 5)
+ _item17.setDetails(Rect(0, 149, 29, 167), 910, -1, -1, -1, 1, NULL);
+
+ if (BF_GLOBALS._v4CEE2 == 0)
+ _item16.setDetails(Rect(265, 18, 319, 102), 910, -1, -1, -1, 1, NULL);
+
+ _breakerBox.setDetails(910, 6, -1, -1, 1, NULL);
+ _item15.setDetails(Rect(0, 0, 320, 170), 910, 0, 1, 2, 1, NULL);
+ _yellowCord.setDetails(910, 52, 53, -1, 1, NULL);
+ _blackCord.setDetails(910, 54, 55, -1, 1, NULL);
+ _item2.setDetails(3, 910, 22, -1, 24, 1);
+ _item4.setDetails(1, 910, 16, 17, 18, 1);
+ _item8.setDetails(4, 910, 25, 26, 27, 1);
+ _item6.setDetails(Rect(37, 58, 42, 67), 910, 34, 35, 36, 1, NULL);
+ _item7.setDetails(Rect(114, 53, 135, 87), 910, 37, 38, 39, 1, NULL);
+ _generator.setDetails(Rect(146, 67, 184, 93), 910, 40, 41, 42, 1, NULL);
+ _item9.setDetails(Rect(266, 39, 274, 70), 910, 43, 44, 45, 1, NULL);
+ _item10.setDetails(Rect(276, 27, 288, 83), 910, 46, 47, 48, 1, NULL);
+ _item11.setDetails(Rect(295, 42, 312, 87), 910, 49, 50, 51, 1, NULL);
+ _fakeWall.setDetails(910, 28, -1, 30, 1, NULL);
+ _item3.setDetails(7, 910, 59, 60, 61, 1);
+ _item5.setDetails(2, 910, 19, 20, 21, 1);
+ _backWall.setDetails(6, 910, 28, 29, 30, 1);
+ _item13.setDetails(5, 910, 31, 32, 33, 1);
+ _item14.setDetails(Rect(0, 0, 320, 170), 910, 3, 4, 5, 1, NULL);
+ if (BF_GLOBALS._dayNumber == 0) {
+ BF_GLOBALS._dayNumber = 5;
+ BF_GLOBALS._sceneManager._previousScene = 900;
+ BF_GLOBALS.setFlag(fWithLyle);
+ }
+
+ if ( (BF_GLOBALS._sceneManager._previousScene == 910)
+ || (BF_GLOBALS._sceneManager._previousScene == 190)
+ || (BF_GLOBALS._sceneManager._previousScene == 300)) {
+ BF_GLOBALS._sceneManager._previousScene = 900;
+ BF_GLOBALS._v4CEE2 = 0;
+ BF_GLOBALS._v4CEE4 = 0;
+ }
+
+ _field2DE0 = 0;
+ _field2DE2 = 0;
+ _field2DE4 = 0;
+ BF_GLOBALS.clearFlag(fCanDrawGun);
+ _lyle._position.x = 0;
+
+ if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._sceneManager._previousScene == 900)){
+ BF_GLOBALS.setFlag(fCanDrawGun);
+ BF_GLOBALS._v4CEC8 = 0;
+ BF_GLOBALS._player.setVisage(129);
+
+ _lyle.postInit();
+ _lyle.setVisage(811);
+ _lyle.setPosition(Common::Point(-52, 217));
+ _lyle.animate(ANIM_MODE_1, NULL);
+ _lyle.setObjectWrapper(new SceneObjectWrapper());
+ _lyle._field90 = 0;
+ _lyle.setDetails(910, 69, 70, 71, 5, &_item4);
+
+ BF_GLOBALS._breakerBoxStatusArr[0] = 3;
+ BF_GLOBALS._breakerBoxStatusArr[12] = 2;
+ BF_GLOBALS._breakerBoxStatusArr[13] = 4;
+ BF_GLOBALS._breakerBoxStatusArr[14] = 3;
+ BF_GLOBALS._breakerBoxStatusArr[15] = 3;
+ BF_GLOBALS._breakerBoxStatusArr[16] = 4;
+ BF_GLOBALS._breakerBoxStatusArr[17] = 1;
+ BF_GLOBALS._v4CECA = 2;
+ BF_GLOBALS._hiddenDoorStatus = 1;
+ _yellowCord.setPosition(Common::Point(291, -30));
+ BF_GLOBALS._v4CECC = 0;
+ }
+
+ if (BF_GLOBALS._sceneManager._previousScene == 920) {
+ BF_GLOBALS.setFlag(fCanDrawGun);
+ BF_GLOBALS._player.setPosition(Common::Point(276, 119));
+ BF_GLOBALS._player.setStrip(6);
+ if (BF_GLOBALS._v4CECC == 0)
+ _yellowCord.setPosition(Common::Point(291, -30));
+
+ if (BF_GLOBALS._dayNumber == 5) {
+ _nico.postInit();
+ _nico.setVisage(914);
+ _nico.setStrip(5);
+ _nico.setFrame(8);
+ _nico.setPosition(Common::Point(263, 120));
+ _nico.setDetails(910, 63, 64, 65, 5, &_item4);
+
+ _stuart.postInit();
+ _stuart.setVisage(918);
+ _stuart.setStrip(4);
+ _stuart.setFrame(1);
+ _stuart.setPosition(Common::Point(291, 127));
+ _stuart.setDetails(910, 66, 67, 68, 5, &_nico);
+
+ _lyle.postInit();
+ _lyle.setVisage(916);
+ _lyle.setPosition(Common::Point(155, 113));
+ _lyle.setStrip(3);
+ _lyle.setFrame(3);
+ _lyle._field90 = 1;
+ _lyle.setDetails(910, 69, 70, 71, 5, &_item4);
+ }
+ BF_GLOBALS._player.enableControl();
+ } else if (BF_GLOBALS._sceneManager._previousScene == 935) {
+ BF_GLOBALS.setFlag(fCanDrawGun);
+ BF_GLOBALS._v4CEC8 = 0;
+ _lyle.postInit();
+ _lyle.setVisage(916);
+ _lyle.setPosition(Common::Point(155, 113));
+ _lyle.setStrip(3);
+ _lyle.setFrame(3);
+ _lyle._field90 = 1;
+ _lyle.setDetails(910, 69, 70 ,71 , 5, &_item4);
+
+ BF_GLOBALS._walkRegions.disableRegion(15);
+ BF_GLOBALS._walkRegions.disableRegion(16);
+ BF_GLOBALS._walkRegions.disableRegion(14);
+ BF_GLOBALS._walkRegions.disableRegion(10);
+ if (BF_GLOBALS.getFlag(gunDrawn)) {
+ BF_GLOBALS._player.setVisage(1911);
+ BF_GLOBALS._player.animate(ANIM_MODE_NONE, 0, NULL);
+ BF_GLOBALS._player.setFrame(7);
+ }
+ BF_GLOBALS._player.setPosition(Common::Point(174, 157));
+ BF_GLOBALS._player._strip = 7;
+ _nico.postInit();
+ _nico.setVisage(913);
+ _nico.setPosition(Common::Point(262, 124));
+ _nico.setStrip(6);
+ BF_GLOBALS._v4CEE6 = 0;
+ BF_GLOBALS._v4CEE2 = 1;
+ _nico.setDetails(910, 63, 64, 67, 5, &_item4);
+ BF_GLOBALS._v4CECA = 2;
+ if (BF_GLOBALS._v4CECC == 0)
+ _yellowCord.setPosition(Common::Point(291, -30));
+ _sceneMode = 11;
+ if (BF_GLOBALS._v4CEC8 == 0)
+ add2Faders((const byte *)&unk_50E94, 2, 913, this);
+ else
+ add2Faders((const byte *)&unk_50E90, 2, 911, this);
+ } else {
+ BF_GLOBALS.clearFlag(gunDrawn);
+ BF_GLOBALS._player.disableControl();
+ }
+
+ if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._v4CEE2 == 0)){
+ _shadow.postInit();
+ _shadow.setAction(&_action2);
+ }
+
+ if (BF_INVENTORY.getObjectScene(INV_YELLOW_CORD) == 1)
+ _yellowCord.setPosition(Common::Point(540, 100));
+
+ if (BF_INVENTORY.getObjectScene(INV_BLACK_CORD) == 1)
+ _blackCord.setPosition(Common::Point(540, 100));
+
+ if (BF_GLOBALS._v4CECC == 2) {
+ _yellowCord.setStrip(4);
+ _yellowCord.setFrame(2);
+ _yellowCord.setPosition(Common::Point(135, 93));
+ _yellowCord.setPriority(50);
+ _yellowCord._field90 = 1;
+
+ _breakerBox.setFrame(3);
+ }
+
+ if (BF_GLOBALS._v4CECA == 2) {
+ _blackCord.setStrip(4);
+ _blackCord.setFrame(1);
+ _blackCord.setPosition(Common::Point(135, 93));
+ _blackCord.fixPriority(50);
+ _blackCord._field90 = 1;
+
+ _breakerBox.setFrame(3);
+ }
+
+ _object5.postInit();
+ _object5.setVisage(919);
+ _object5.setStrip(5);
+ _object5.setPosition(Common::Point(286, 129));
+ _object5.fixPriority(1);
+
+ if (BF_GLOBALS._v4CEC8 == 0)
+ _object5.hide();
+
+ if (BF_GLOBALS._hiddenDoorStatus == 0) {
+ _object5.setFrame(1);
+ _fakeWall.setPosition(Common::Point(292, 107));
+ if (BF_GLOBALS._v4CECC != 2)
+ _yellowCord.setPosition(Common::Point(288, 57));
+ BF_GLOBALS._walkRegions.disableRegion(10);
+ } else {
+ _object5.setFrame(6);
+ _fakeWall.setPosition(Common::Point(295, 20));
+ _fakeWall.hide();
+ if (BF_GLOBALS._v4CECC != 2)
+ _yellowCord.setPosition(Common::Point(291, -30));
+ BF_GLOBALS._walkRegions.disableRegion(10);
+ }
+
+ if (BF_GLOBALS._breakerBoxStatusArr[17] != 0) {
+ _sound1.play(100);
+ _sound1.holdAt(1);
+ }
+
+ if (BF_GLOBALS._sceneManager._previousScene != 935) {
+ _sceneMode = 11;
+ if (BF_GLOBALS._v4CEC8 == 0)
+ add2Faders((const byte *)&unk_50E9C, 10, 910, this);
+ else
+ add2Faders((const byte *)&unk_50E98, 10, 911, this);
+ }
+}
+
+void Scene910::signal() {
+ static uint32 black = 0;
+
+ switch (_sceneMode) {
+ case 2:
+ _sceneMode = 3;
+ _timer1.set(60, this);
+ break;
+ case 3:
+ _sceneMode = 4;
+ transition((const byte *)&black, 35, 910, this, 0, 111, 112, 255, false);
+ break;
+ case 4:
+ _sceneMode = 5;
+ _timer1.set(30, this);
+ break;
+ case 5:
+ _sceneMode = 6;
+ transition((const byte *)&black, 40, 910, this, 0, 111, 112, 255, false);
+ break;
+ case 6:
+ _sceneMode = 7;
+ _timer1.set(60, this);
+ break;
+ case 7:
+ BF_GLOBALS._player.setVisage(129);
+ _lyle.setVisage(811);
+ _object5.hide();
+ _sceneMode = 8;
+ transition((const byte *)&black, 95, 910, this, 0, 111, 112, 255, false);
+ break;
+ case 8:
+ _sceneMode = 9;
+ _timer1.set(30, this);
+ break;
+ case 9:
+ _sceneMode = 0;
+ transition((const byte *)&black, 100, 910, this, 0, 111, 112, 255, false);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 10:
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._v51C44 = 0;
+ BF_GLOBALS._sceneManager.changeScene(935);
+ break;
+ case 11:
+ if (BF_GLOBALS._sceneManager._previousScene == 900) {
+ if (BF_GLOBALS._v4CEC8 != 0)
+ transition((const byte *)&black, 25, 910, NULL, 0, 111, 112, 255, false);
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ NpcMover *mover = new NpcMover();
+ Common::Point destPos(22, 157);
+ _lyle.addMover(mover, &destPos, NULL);
+ }
+
+ _sceneMode = 9100;
+ setAction(&_sequenceManager1, this, 9100, &BF_GLOBALS._player, NULL);
+ } else if (BF_GLOBALS._sceneManager._previousScene == 935) {
+ _sceneMode = 9146;
+ _stripManager.start(9103, this);
+ }
+ break;
+ case 12:
+ BF_GLOBALS._player.setVisage(129);
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.setStrip(7);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 13:
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._player.setAction(&_sequenceManager2, NULL, 9117, &_nico, NULL);
+ BF_GLOBALS._v4CEE2 = 2;
+ // No break on purpose
+ case 15:
+ _stuart.postInit();
+ _stuart.setDetails(910, 66, 67, 68, 5, &_nico);
+ BF_GLOBALS._v4CEE8 = 0;
+ _sceneMode = 9121;
+ setAction(&_sequenceManager1, this, 9121, &_stuart, NULL);
+ break;
+ case 14:
+ BF_GLOBALS._v51C44 = 1;
+ BF_GLOBALS._sceneManager.changeScene(940);
+ break;
+ case 16:
+ _lyle._field90 = 1;
+ _sceneMode = 10;
+ addFader((const byte *)&black, 2, this);
+ BF_GLOBALS._v4CEE2 = 1;
+ BF_GLOBALS._walkRegions.disableRegion(16);
+ BF_GLOBALS._walkRegions.disableRegion(14);
+ BF_GLOBALS._sceneItems.remove(&_item16);
+ break;
+ case 17:
+ BF_GLOBALS._player._strip = 7;
+ BF_GLOBALS._player._frame = 1;
+ if (_field2DE2 == 0) {
+ _field2DE2 = 1;
+ if (BF_GLOBALS._v4CEE2 == 4) {
+ _sceneMode = 9149;
+ setAction(&_sequenceManager1, this, 9149, &BF_GLOBALS._player, NULL);
+ } else {
+ _sceneMode = 9141;
+ setAction(&_sequenceManager1, this, 9141, &BF_GLOBALS._player, &_nico, NULL);
+ }
+ } else {
+ SceneItem::display(910, 91, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ BF_GLOBALS._player.enableControl();
+ }
+ break;
+ case 18:
+ BF_GLOBALS._player._strip = 7;
+ BF_GLOBALS._player._frame = 1;
+ if (BF_GLOBALS._v4CEE4 == 3) {
+ if (_field2DE4 == 0) {
+ _field2DE4 = 1;
+ _sceneMode = 9142;
+ setAction(&_sequenceManager1, this, 9142, &BF_GLOBALS._player, &_stuart, NULL);
+ } else {
+ SceneItem::display(910, 92, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ BF_GLOBALS._player.enableControl();
+ }
+ } else {
+ SceneItem::display(910, 94, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ BF_GLOBALS._player.enableControl();
+ }
+ break;
+ case 19:
+ BF_GLOBALS._deathReason = 14;
+ BF_GLOBALS._v51C44 = 1;
+ BF_GLOBALS._sceneManager.changeScene(666);
+ break;
+ case 20:
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 9100:
+ if (BF_GLOBALS._dayNumber == 5)
+ BF_GLOBALS._walkRegions.disableRegion(1);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 9101:
+ if ((BF_GLOBALS._hiddenDoorStatus == 0) && (BF_GLOBALS._v4CEC8 != 0) && (BF_GLOBALS._breakerBoxStatusArr[17] == 0) && (BF_INVENTORY.getObjectScene(INV_YELLOW_CORD) == 910) && (BF_INVENTORY.getObjectScene(INV_BLACK_CORD) == 910))
+ BF_GLOBALS.clearFlag(fGotPointsForSearchingDA);
+ else
+ BF_GLOBALS.setFlag(fGotPointsForSearchingDA);
+ BF_GLOBALS._v51C44 = 1;
+ BF_GLOBALS._sceneManager.changeScene(900);
+ break;
+ case 9102:
+ if ((BF_GLOBALS._breakerBoxStatusArr[13] < 4) && (_breakerBox._frame == 1))
+ _breakerBox.animate(ANIM_MODE_5, NULL);
+
+ BF_GLOBALS._player.enableControl();
+ _breakerBoxInset.postInit();
+ _breakerBoxInset.setVisage(910);
+ _breakerBoxInset.setStrip(3);
+ _breakerBoxInset.setFrame(1);
+ _breakerBoxInset.setPosition(Common::Point(160, 130));
+ _breakerBoxInset.fixPriority(250);
+ break;
+ case 9103:
+ BF_GLOBALS._player.enableControl();
+ _generatorInset.postInit();
+ _generatorInset.setVisage(910);
+ _generatorInset.setStrip(3);
+ _generatorInset.setFrame(2);
+ _generatorInset.setPosition(Common::Point(160, 130));
+ _generatorInset.fixPriority(250);
+ break;
+ case 9110:
+ if (!BF_GLOBALS.getFlag(fGotPointsForCrate)) {
+ T2_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(fGotPointsForCrate);
+ }
+ BF_INVENTORY.setObjectScene(INV_BLACK_CORD, 1);
+ _blackCord.setPosition(Common::Point(540, 100));
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 9111:
+ if ((BF_GLOBALS._bookmark == bEndDayThree) && (!BF_GLOBALS.getFlag(fGotPointsForGeneratorOff))) {
+ T2_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(fGotPointsForGeneratorOff);
+ }
+ BF_INVENTORY.setObjectScene(INV_BLACK_CORD, 910);
+ _blackCord.setStrip(6);
+ _blackCord.setFrame(1);
+ _blackCord.setPosition(Common::Point(114, 149));
+ _blackCord.fixPriority(249);
+ BF_GLOBALS._v4CECA = 0;
+ _blackCord._field90 = 0;
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 9112:
+ BF_GLOBALS._player._strip = 4;
+ BF_GLOBALS._player._frame = 1;
+ BF_INVENTORY.setObjectScene(INV_YELLOW_CORD, 1);
+ _yellowCord.setPosition(Common::Point(540, 100));
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 9113:
+ BF_GLOBALS._player._strip = 4;
+ BF_GLOBALS._player._frame = 1;
+ BF_INVENTORY.setObjectScene(INV_YELLOW_CORD, 910);
+ _yellowCord.setStrip(6);
+ _yellowCord.setFrame(2);
+ _yellowCord.setPosition(Common::Point(_fakeWall._position.x - 4, _fakeWall._position.y - 50));
+ _yellowCord.fixPriority(50);
+ BF_GLOBALS._v4CECC = 0;
+ _yellowCord._field90 = 0;
+ _yellowCord.show();
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 9114:
+ _fakeWall.hide();
+ if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._v4CEE2 == 0)) {
+ BF_GLOBALS._player.disableControl();
+ _nico.postInit();
+ _nico.setDetails(910, 63, 64, 65, 5, &_item4);
+ BF_GLOBALS._v4CEE6 = 0;
+ _shadow.postInit();
+ _action2.remove();
+ _sceneMode = 9116;
+ setAction(&_sequenceManager1, this, 9116, &_nico, NULL);
+ } else {
+ BF_GLOBALS._player.enableControl();
+ }
+ break;
+ case 9115:
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 9116:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 16;
+ _stripManager.start(9119, this);
+ break;
+ case 9118:
+ // No break on purpose
+ case 9137:
+ BF_GLOBALS._deathReason = 16;
+ BF_GLOBALS._v51C44 = 1;
+ BF_GLOBALS._sceneManager.changeScene(666);
+ break;
+ case 9119:
+ if (!BF_GLOBALS.getFlag(fGotPointsForCordOnForklift)) {
+ T2_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(fGotPointsForCordOnForklift);
+ }
+ BF_INVENTORY.setObjectScene(INV_YELLOW_CORD, 0);
+ BF_INVENTORY.setObjectScene(INV_HALF_YELLOW_CORD, 1);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 9120:
+ BF_GLOBALS._walkRegions.disableRegion(7);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 9121:
+ _item3.setDetails(7, 910, 96, 60, 61, 3);
+ BF_GLOBALS._v4CEE4 = 2;
+ if (BF_GLOBALS._v4CEE2 == 4) {
+ _sceneMode = 20;
+ _stripManager.start(9115, this);
+ } else {
+ BF_GLOBALS._player.enableControl();
+ }
+ break;
+ case 9123:
+ BF_GLOBALS.clearFlag(gunDrawn);
+ switch (_sceneSubMode - 1) {
+ case 0:
+ _sceneMode = 9102;
+ setAction(&_sequenceManager1, this, 9102, &BF_GLOBALS._player, NULL);
+ break;
+ case 1:
+ _sceneMode = 9103;
+ setAction(&_sequenceManager1, this, 9103, &BF_GLOBALS._player, NULL);
+ break;
+ case 2:
+ _sceneMode = 9143;
+ setAction(&_sequenceManager1, this, 9143, &BF_GLOBALS._player, NULL);
+ break;
+ case 3:
+ _sceneMode = 9110;
+ setAction(&_sequenceManager1, this, 9110, &BF_GLOBALS._player, &_blackCord, NULL);
+ break;
+ case 4:
+ _sceneMode = 9111;
+ setAction(&_sequenceManager1, this, 9111, &BF_GLOBALS._player, &_blackCord, NULL);
+ break;
+ case 5:
+ switch (BF_GLOBALS._v4CEE2 - 1) {
+ case 0:
+ _sceneMode = 9118;
+ setAction(&_sequenceManager1, this, 9118, &BF_GLOBALS._player, &_nico, NULL);
+ break;
+ case 1:
+ _sceneMode = 9148;
+ setAction(&_sequenceManager1, this, 9148, &BF_GLOBALS._player, &_nico, NULL);
+ break;
+ case 2:
+ // No break on purpose
+ case 3: {
+ _sceneMode = 17;
+ PlayerMover *mover = new PlayerMover();
+ Common::Point destPos(232, 138);
+ BF_GLOBALS._player.addMover(mover, &destPos, this);
+ }
+ default:
+ break;
+ }
+ break;
+ case 6: {
+ _sceneMode = 18;
+ PlayerMover *mover = new PlayerMover();
+ Common::Point destPos(248, 137);
+ BF_GLOBALS._player.addMover(mover, &destPos, this);
+ break;
+ }
+ case 7: {
+ _sceneMode = 9112;
+ PlayerMover *mover = new PlayerMover();
+ Common::Point destPos(285, 114);
+ BF_GLOBALS._player.addMover(mover, &destPos, this);
+ break;
+ }
+ case 8: {
+ _sceneMode = 9113;
+ PlayerMover *mover = new PlayerMover();
+ Common::Point destPos(285, 114);
+ BF_GLOBALS._player.addMover(mover, &destPos, this);
+ break;
+ }
+ case 9:
+ _sceneMode = 9119;
+ setAction(&_sequenceManager1, this, 9119, &BF_GLOBALS._player, &_nico, &_yellowCord, NULL);
+ break;
+ case 10:
+ _yellowCord.fixPriority(127);
+ if (_yellowCord._position.x != 267)
+ _yellowCord.hide();
+ _sceneMode = 9136;
+ setAction(&_sequenceManager1, this, 9136, &BF_GLOBALS._player, &_stuart, &_yellowCord, NULL);
+ BF_GLOBALS._v4CEE4 = 3;
+ break;
+ case 11:
+ _sceneMode = 9137;
+ setAction(&_sequenceManager1, this, 9137, &BF_GLOBALS._player, &_nico, NULL);
+ break;
+ default:
+ BF_GLOBALS._player.enableControl();
+ PlayerMover *mover = new PlayerMover();
+ BF_GLOBALS._player.addMover(mover, &_destPos, NULL);
+ break;
+ }
+ break;
+ case 9124:
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS.setFlag(gunDrawn);
+ break;
+ case 9125:
+ BF_GLOBALS.setFlag(fBackupAt340);
+ BF_GLOBALS._v4CEE2 = 4;
+ _stuart.postInit();
+ _nico.setDetails(910, 72, 73, 74, 3, NULL);
+ _stuart.setDetails(910, 66, 67, 68, 5, &_nico);
+ BF_GLOBALS._v4CEE8 = 0;
+ _sceneMode = 9121;
+ setAction(&_sequenceManager1, this, 9121, &_stuart, NULL);
+ break;
+ case 9126:
+ _sceneMode = 19;
+ if (BF_GLOBALS._v4CEE4 == 0)
+ signal();
+ else
+ _stripManager.start(9115, this);
+ break;
+ case 9129:
+ // No break on purpose
+ case 9134:
+ BF_GLOBALS._deathReason = 17;
+ BF_GLOBALS._v51C44 = 1;
+ BF_GLOBALS._sceneManager.changeScene(666);
+ break;
+ case 9130:
+ _lyle.setAction(&_sequenceManager2, NULL, 9133, &_lyle, NULL);
+ BF_GLOBALS._breakerBoxStatusArr[14] = 3;
+ openHiddenDoor();
+ BF_GLOBALS._walkRegions.disableRegion(15);
+ break;
+ case 9132:
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._v4CEE4 = 4;
+ BF_GLOBALS._deathReason = 13;
+ BF_GLOBALS._v51C44 = 1;
+ BF_GLOBALS._sceneManager.changeScene(666);
+ break;
+ case 9135:
+ BF_GLOBALS._deathReason = 15;
+ BF_GLOBALS._v51C44 = 1;
+ BF_GLOBALS._sceneManager.changeScene(666);
+ break;
+ case 9136:
+ if (!BF_GLOBALS.getFlag(fGotPointsForCuffingNico)) {
+ T2_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(fGotPointsForCuffingNico);
+ }
+ _lyle.setAction(&_sequenceManager2, NULL, 9131, &_lyle, NULL);
+ BF_GLOBALS._walkRegions.enableRegion(16);
+ if (BF_GLOBALS._v4CEE2 == 4)
+ BF_INVENTORY.setObjectScene(INV_YELLOW_CORD, 0);
+ else
+ BF_INVENTORY.setObjectScene(INV_HALF_YELLOW_CORD, 910);
+ _forbes.postInit();
+ _forbes.setDetails(910, 86, 87, 88, 4, &_item8);
+ _sceneMode = 9139;
+ setAction(&_sequenceManager1, this, 9139, &_forbes, &BF_GLOBALS._player, NULL);
+ break;
+ case 9139:
+ BF_GLOBALS._walkRegions.disableRegion(4);
+ _field2DE0 = 1;
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 9140:
+ _sceneMode = 14;
+ addFader((const byte *)&black, 2, this);
+ break;
+ case 9141:
+ BF_INVENTORY.setObjectScene(INV_22_SNUB, 1);
+ if (!BF_GLOBALS.getFlag(fGotPointsForCuffingDA)) {
+ T2_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(fGotPointsForCuffingDA);
+ }
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 9142:
+ BF_GLOBALS._player.enableControl();
+ if (!BF_GLOBALS.getFlag(fGotPointsForSearchingNico)) {
+ T2_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(fGotPointsForSearchingNico);
+ }
+ break;
+ case 9143:
+ if (BF_GLOBALS._v4CEE2 == 0) {
+ BF_GLOBALS._v51C44 = 1;
+ BF_GLOBALS._sceneManager.changeScene(920);
+ } else {
+ SceneItem::display(910, 89, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ _sceneMode = 9144;
+ setAction(&_sequenceManager1, this, 9144, &BF_GLOBALS._player, NULL);
+ }
+ break;
+ case 9144:
+ // No break on purpose
+ case 9146:
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 9148:
+ BF_GLOBALS._deathReason = 23;
+ BF_GLOBALS._v51C44 = 1;
+ BF_GLOBALS._sceneManager.changeScene(666);
+ break;
+ case 9149:
+ SceneItem::display(910, 74, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ BF_INVENTORY.setObjectScene(INV_22_SNUB, 1);
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._player.setVisage(129);
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player._strip = 7;
+ BF_GLOBALS._player._frame = 1;
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene910::process(Event &event) {
+ SceneExt::process(event);
+ if ((!BF_GLOBALS._player._enabled) || (event.mousePos.y >= 167))
+ return;
+
+ if (!_focusObject) {
+ if (_item17._bounds.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW);
+ BF_GLOBALS._events.setCursor(surface);
+ } else if ((BF_GLOBALS._hiddenDoorStatus == 0) || (BF_GLOBALS._v4CEE2 != 0)) {
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(cursorId);
+ } else if (!_item16._bounds.contains(event.mousePos)) {
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(cursorId);
+ } else {
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_NW);
+ BF_GLOBALS._events.setCursor(surface);
+ }
+ }
+
+ if (event.eventType != EVENT_BUTTON_DOWN)
+ return;
+
+ switch (BF_GLOBALS._events.getCursor()) {
+ case INV_COLT45:
+ if (!BF_GLOBALS._player._bounds.contains(event.mousePos))
+ break;
+ if (BF_GLOBALS.getFlag(gunDrawn)) {
+ BF_GLOBALS._player.disableControl();
+ _destPos = BF_GLOBALS._player._position;
+ _sceneMode = 9123;
+ setAction(&_sequenceManager1, this, 9123, &BF_GLOBALS._player, NULL);
+ event.handled = true;
+ } else if (BF_GLOBALS._v4CEE2 <= 1) {
+ if (BF_GLOBALS.getFlag(fCanDrawGun)) {
+ BF_GLOBALS._player.addMover(NULL);
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 9124;
+ setAction(&_sequenceManager1, this, 9124, &BF_GLOBALS._player, NULL);
+ } else
+ SceneItem::display(1, 4, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ } else
+ SceneItem::display(910, 81, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ event.handled = true;
+ break;
+ case CURSOR_WALK:
+ if (BF_GLOBALS._v4CEE2 == 1) {
+ BF_GLOBALS._player.disableControl();
+ if (BF_GLOBALS._player._visage == 1911) {
+ BF_GLOBALS._player.disableControl();
+ _destPos = event.mousePos;
+ _sceneSubMode = 0;
+ _sceneMode = 9123;
+ setAction(&_sequenceManager1, this, 9123, &BF_GLOBALS._player, NULL);
+ } else {
+ _sceneMode = 9118;
+ setAction(&_sequenceManager1, this, 9118, &BF_GLOBALS._player, &_nico, NULL);
+ event.handled = true;
+ }
+ } else if (BF_GLOBALS._player._visage == 1911) {
+ BF_GLOBALS._player.disableControl();
+ _destPos = event.mousePos;
+ _sceneSubMode = 0;
+ _sceneMode = 9123;
+ setAction(&_sequenceManager1, this, 9123, &BF_GLOBALS._player, NULL);
+ }
+ default:
+ break;
+ }
+}
+
+void Scene910::dispatch() {
+ SceneExt::dispatch();
+ if (_action)
+ return;
+
+ if ((_sceneMode != 14) && (BF_GLOBALS._player._position.x < 30) && (BF_GLOBALS._player._position.y > 148)) {
+ BF_GLOBALS._player.disableControl();
+ if (BF_GLOBALS._dayNumber != 5) {
+ _sceneMode = 9101;
+ setAction(&_sequenceManager1, this, 9101, &BF_GLOBALS._player, NULL);
+ } else {
+ _sceneMode = 9146;
+ if (BF_GLOBALS._hiddenDoorStatus == 0)
+ setAction(&_sequenceManager1, this, 9146, &BF_GLOBALS._player, NULL);
+ else
+ setAction(&_sequenceManager1, this, 9145, &BF_GLOBALS._player, NULL);
+ }
+ }
+
+ if ((BF_GLOBALS._player._position.x > 265) && (BF_GLOBALS._player._position.y < 102) && (BF_GLOBALS._hiddenDoorStatus != 0) && (_sceneMode != 9143)) {
+ BF_GLOBALS._player.disableControl();
+ if (BF_GLOBALS.getFlag(gunDrawn)) {
+ _sceneSubMode = 3;
+ _sceneMode = 9123;
+ setAction(&_sequenceManager1, this, 9123, &BF_GLOBALS._player, NULL);
+ } else if (BF_GLOBALS._v4CEE2 == 0) {
+ _sceneMode = 9143;
+ setAction(&_sequenceManager1, this, 9143, &BF_GLOBALS._player, NULL);
+ } else {
+ SceneItem::display(910, 98, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ _sceneMode = 9144;
+ setAction(&_sequenceManager1, this, 9144, &BF_GLOBALS._player, NULL);
+ }
+ }
+
+ if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._player._position.x > 250) && (_sceneMode != 9135) && (_sceneMode != 11) && (BF_GLOBALS._hiddenDoorStatus != 0) && (BF_GLOBALS._v4CEE2 == 0)) {
+ BF_GLOBALS._player.disableControl();
+ _shadow.remove();
+ _nico.remove();
+ _nico.postInit();
+ _nico.setDetails(910, 63, 64, 65, 5, &_item4);
+ _sceneMode = 9135;
+ setAction(&_sequenceManager1, this, 9135, &BF_GLOBALS._player, &_nico, NULL);
+ }
+
+}
+
+void Scene910::checkGun() {
+ if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._v4CEE2 == 0) && (BF_GLOBALS._hiddenDoorStatus != 0))
+ SceneItem::display(910, 70, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ else
+ SceneExt::checkGun();
+}
+
+void Scene910::openHiddenDoor() {
+ if (BF_GLOBALS._hiddenDoorStatus != 0)
+ return;
+
+ if (! BF_GLOBALS.getFlag(fGotPointsForLightsOn)) {
+ T2_GLOBALS._uiElements.addScore(50);
+ BF_GLOBALS.setFlag(fGotPointsForLightsOn);
+ }
+ BF_GLOBALS._hiddenDoorStatus = 1;
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._walkRegions.enableRegion(10);
+ _sceneMode = 9114;
+ _sound2.play(42);
+ if ((BF_GLOBALS._v4CECC == 0) && (BF_INVENTORY.getObjectScene(INV_YELLOW_CORD) == 910))
+ setAction(&_sequenceManager1, this, 9127, &_fakeWall, &_yellowCord, &_object5, NULL);
+ else
+ setAction(&_sequenceManager1, this, 9114, &_fakeWall, &_object5, NULL);
+}
+
+void Scene910::closeHiddenDoor() {
+ if (BF_GLOBALS._hiddenDoorStatus != 0) {
+ _fakeWall.show();
+ if ((BF_GLOBALS._bookmark == bEndDayThree) && (!BF_GLOBALS.getFlag(fGotPointsForOpeningDoor))) {
+ T2_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(fGotPointsForOpeningDoor);
+ }
+ BF_GLOBALS._hiddenDoorStatus = 0;
+ BF_GLOBALS._walkRegions.disableRegion(10);
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 9115;
+ _sound2.play(42);
+ if ((BF_GLOBALS._v4CECC == 0) && (BF_INVENTORY.getObjectScene(INV_YELLOW_CORD) == 910))
+ setAction(&_sequenceManager1, this, 9128, &_fakeWall, &_yellowCord, &_object5, NULL);
+ else
+ setAction(&_sequenceManager1, this, 9115, &_fakeWall, &_object5, NULL);
+ }
+
+ if ((BF_GLOBALS._dayNumber == 5) && (BF_GLOBALS._v4CEE2 == 0)) {
+ // _objectList.draw();
+ if (BF_GLOBALS._sceneObjects->contains(&_breakerBoxInset))
+ _breakerBoxInset.remove();
+ if (BF_GLOBALS._sceneObjects->contains(&_generatorInset))
+ _generatorInset.remove();
+
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 9120;
+ BF_GLOBALS._player.setAction(&_sequenceManager2, NULL, 9120, &BF_GLOBALS._player, &_lyle, NULL);
+ BF_GLOBALS._walkRegions.enableRegion(1);
+ }
+}
+
+/*--------------------------------------------------------------------------
* Scene 920 - Inside Warehouse: Secret Room
*
*--------------------------------------------------------------------------*/
@@ -732,13 +2926,13 @@ bool Scene920::Item1::startAction(CursorType action, Event &event) {
case CURSOR_LOOK:
if ((BF_GLOBALS.getFlag(fCrateOpen)) && (BF_GLOBALS._player._visage == 921)) {
BF_GLOBALS._player.disableControl();
- scene->_object2.postInit();
+ scene->_crateWindow.postInit();
scene->_sceneMode = 9204;
if (!BF_GLOBALS.getFlag(fGotPointsForBoots)) {
- BF_GLOBALS._uiElements.addScore(30);
+ T2_GLOBALS._uiElements.addScore(30);
BF_GLOBALS.setFlag(fGotPointsForBoots);
}
- scene->setAction(&scene->_sequenceManager1, scene, 9204, &BF_GLOBALS._player, &scene->_object2, NULL);
+ scene->setAction(&scene->_sequenceManager1, scene, 9204, &BF_GLOBALS._player, &scene->_crateWindow, NULL);
return true;
} else
return NamedHotspot::startAction(action, event);
@@ -747,12 +2941,12 @@ bool Scene920::Item1::startAction(CursorType action, Event &event) {
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))) {
+ if ((BF_INVENTORY.getObjectScene(INV_AUTO_RIFLE) != 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);
+ scene->setAction(&scene->_sequenceManager1, scene, 9203, &BF_GLOBALS._player, &scene->_crateTop, NULL);
BF_GLOBALS.clearFlag(fCrateOpen);
}
} else {
@@ -761,7 +2955,7 @@ bool Scene920::Item1::startAction(CursorType action, Event &event) {
}
} else {
scene->_sceneMode = 9202;
- scene->setAction(&scene->_sequenceManager1, scene, 9202, &BF_GLOBALS._player, &scene->_object1, NULL);
+ scene->setAction(&scene->_sequenceManager1, scene, 9202, &BF_GLOBALS._player, &scene->_crateTop, NULL);
BF_GLOBALS.setFlag(fCrateOpen);
}
return true;
@@ -803,22 +2997,23 @@ void Scene920::postInit(SceneObjectList *OwnerList) {
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));
+ _doorway.postInit();
+ _doorway.setVisage(922);
+ _doorway.setStrip(2);
+ _doorway.fixPriority(1);
+ _doorway.setPosition(Common::Point(145, 82));
}
- _object1.postInit();
- _object1.setVisage(922);
+ _crateTop.postInit();
+ _crateTop.setVisage(922);
if (BF_GLOBALS.getFlag(fCrateOpen)) {
- _object1.setStrip(3);
- _object1.setFrame(5);
+ _crateTop.setStrip(3);
+ _crateTop.setFrame(5);
}
- _object1.setPosition(Common::Point(158, 107));
- _object1.setPriority(130);
+ _crateTop.setPosition(Common::Point(158, 107));
+ _crateTop.fixPriority(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);
@@ -847,7 +3042,7 @@ void Scene920::signal() {
BF_GLOBALS._sceneManager.changeScene(910);
break;
case 9204:
- _object2.remove();
+ _crateWindow.remove();
BF_GLOBALS.setFlag(fSawGuns);
BF_GLOBALS._player.enableControl();
break;
@@ -859,8 +3054,8 @@ void Scene920::signal() {
}
case 9207:
BF_GLOBALS._player.enableControl();
- BF_GLOBALS._uiElements.addScore(30);
- BF_INVENTORY.setObjectScene(15, 1);
+ T2_GLOBALS._uiElements.addScore(30);
+ BF_INVENTORY.setObjectScene(INV_AUTO_RIFLE, 1);
BF_GLOBALS._bookmark = bEndDayThree;
break;
default:
@@ -870,7 +3065,7 @@ void Scene920::signal() {
}
void Scene920::process(Event &event) {
SceneExt::process(event);
- if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (UI_INTERFACE_Y - 1))) {
if (_exitN.contains(event.mousePos)) {
GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_N);
BF_GLOBALS._events.setCursor(surface);
@@ -912,25 +3107,26 @@ bool Scene930::Object1::startAction(CursorType action, Event &event) {
Scene930 *scene = (Scene930 *)BF_GLOBALS._sceneManager._scene;
bool result;
- if ((action == CURSOR_USE) && (!BF_GLOBALS.getFlag(93))) {
+ if ((action == CURSOR_USE) && (!BF_GLOBALS.getFlag(fGotPointsForFBI))) {
scene->setAction(&scene->_action2);
result = true;
- } else
+ } else
result = NamedObject::startAction(action, event);
return result;
}
bool Scene930::Object2::startAction(CursorType action, Event &event) {
+// Small box Inset
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);
+ T2_GLOBALS._uiElements.addScore(30);
+ BF_INVENTORY.setObjectScene(INV_9MM_BULLETS, 1);
+ BF_GLOBALS.setFlag(fGotPointsForFBI);
remove();
scene->_box.remove();
return true;
@@ -943,13 +3139,13 @@ bool Scene930::Object3::startAction(CursorType action, Event &event) {
if (action != CURSOR_USE)
return NamedObject::startAction(action, event);
- if (scene->_v141C == 0)
+ if (!scene->_bootInsetDisplayed)
scene->setAction(&scene->_action1);
return true;
}
bool Scene930::Object4::startAction(CursorType action, Event &event) {
-// Boot window
+// Boot inset
Scene930 *scene = (Scene930 *)BF_GLOBALS._sceneManager._scene;
switch (action) {
@@ -972,7 +3168,7 @@ bool Scene930::Object4::startAction(CursorType action, Event &event) {
if (BF_GLOBALS._bookmark >= bFlashBackTwo) {
_lookLineNum = 71;
NamedObject::startAction(action, event);
- scene->subF3D6F();
+ scene->ShowSoleInset();
remove();
} else
NamedObject::startAction(action, event);
@@ -983,23 +3179,35 @@ bool Scene930::Object4::startAction(CursorType action, Event &event) {
}
}
+void Scene930::Object4::remove() {
+// Boots inset
+ Scene930 *scene = (Scene930 *)BF_GLOBALS._sceneManager._scene;
+
+ if (scene->_bootInsetDisplayed && !BF_GLOBALS._sceneObjects->contains(&scene->_soleInset)) {
+ scene->_boots.setAction(&scene->_action3);
+ }
+
+ FocusObject::remove();
+}
+
bool Scene930::Object5::startAction(CursorType action, Event &event) {
+// Boots sole inset
Scene930 *scene = (Scene930 *)BF_GLOBALS._sceneManager._scene;
switch (action) {
case CURSOR_WALK:
return true;
case CURSOR_USE:
- if (BF_INVENTORY.getObjectScene(55) == 1)
+ if (BF_INVENTORY.getObjectScene(INV_SCHEDULE) == 1)
return NamedObject::startAction(action, event);
- if (scene->_v141A == 0) {
+ if (!scene->_soleOpened) {
animate(ANIM_MODE_4, getFrameCount() - 1, 1, NULL);
- scene->_v141A = 1;
+ scene->_soleOpened = 1;
_lookLineNum = 76;
_useLineNum = 78;
} else {
- BF_GLOBALS._uiElements.addScore(50);
- BF_INVENTORY.setObjectScene(55, 1);
+ T2_GLOBALS._uiElements.addScore(50);
+ BF_INVENTORY.setObjectScene(INV_SCHEDULE, 1);
setFrame2(getFrameCount());
_lookLineNum = 92;
_useLineNum = -1;
@@ -1010,6 +3218,14 @@ bool Scene930::Object5::startAction(CursorType action, Event &event) {
break;
}
}
+
+void Scene930::Object5::remove() {
+ Scene930 *scene = (Scene930 *)BF_GLOBALS._sceneManager._scene;
+ scene->_boots.setAction(&scene->_action3);
+
+ FocusObject::remove();
+}
+
/* Items */
bool Scene930::Item1::startAction(CursorType action, Event &event) {
Scene930 *scene = (Scene930 *)BF_GLOBALS._sceneManager._scene;
@@ -1031,7 +3247,7 @@ void Scene930::Action1::signal() {
case 0:
setDelay(10);
BF_GLOBALS._player.disableControl();
- scene->_v141C = 1;
+ scene->_bootInsetDisplayed = 1;
break;
case 1: {
Common::Point pt(50, 142);
@@ -1055,10 +3271,10 @@ void Scene930::Action1::signal() {
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);
+ scene->showBootInset();
+ if (!BF_GLOBALS.getFlag(fGotPointsForCPU)) {
+ T2_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(fGotPointsForCPU);
}
SceneItem::display(0, 312);
BF_GLOBALS._player.enableControl();
@@ -1088,10 +3304,10 @@ void Scene930::Action2::signal() {
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_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_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();
+ scene->ShowBoxInset();
BF_GLOBALS._player.enableControl();
remove();
break;
@@ -1117,7 +3333,7 @@ void Scene930::Action3::signal() {
BF_GLOBALS._player.setVisage(368);
BF_GLOBALS._player.setStrip(6);
BF_GLOBALS._player.setFrame(1);
- scene->_v141C = 0;
+ scene->_bootInsetDisplayed = 0;
remove();
BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
BF_GLOBALS._player.enableControl();
@@ -1135,9 +3351,9 @@ void Scene930::postInit(SceneObjectList *OwnerList) {
if (BF_GLOBALS._dayNumber == 0)
BF_GLOBALS._dayNumber = 1;
setZoomPercents(83, 75, 140, 100);
- _v141A = 0;
- _v141C = 0;
- if (BF_INVENTORY.getObjectScene(54) != 1) {
+ _soleOpened = 0;
+ _bootInsetDisplayed = 0;
+ if (BF_INVENTORY.getObjectScene(INV_9MM_BULLETS) != 1) {
_box.postInit();
_box.setVisage(930);
_box.setStrip(1);
@@ -1187,7 +3403,8 @@ void Scene930::postInit(SceneObjectList *OwnerList) {
_sceneMode = 0;
setAction(&_sequenceManager1, this, 9300, &BF_GLOBALS._player, NULL);
} else {
- _v141C = 1;
+ // After flashback
+ _bootInsetDisplayed = 1;
BF_GLOBALS._player.animate(ANIM_MODE_NONE);
BF_GLOBALS._player.setPosition(Common::Point(50, 142));
BF_GLOBALS._player.setVisage(931);
@@ -1197,7 +3414,7 @@ void Scene930::postInit(SceneObjectList *OwnerList) {
BF_GLOBALS._player.enableControl();
BF_GLOBALS._player.changeZoom(110);
_boots.setFrame(2);
- showBootWindow();
+ showBootInset();
}
}
@@ -1213,7 +3430,7 @@ void Scene930::signal() {
_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_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_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();
@@ -1235,49 +3452,49 @@ 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::showBootInset() {
+ _bootsInset.postInit();
+ _bootsInset.setVisage(930);
+ _bootsInset.setStrip(3);
+ _bootsInset.setFrame2(1);
+ _bootsInset.fixPriority(260);
+ _bootsInset.setPosition(Common::Point(147, 128));
+ _bootsInset.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::ShowBoxInset() {
+ _boxInset.postInit();
+ _boxInset.setVisage(930);
+ _boxInset.setStrip(1);
+ _boxInset.setFrame2(2);
+ _boxInset.fixPriority(260);
+ _boxInset.setPosition(Common::Point(147, 128));
+ _boxInset.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);
+void Scene930::ShowSoleInset() {
+ _soleInset.postInit();
+ _soleInset.setVisage(930);
+ _soleInset.setStrip(3);
+ if (BF_INVENTORY.getObjectScene(INV_SCHEDULE) == 1) {
+ _soleInset.setFrame(_soleInset.getFrameCount());
+ _soleInset.setDetails(930, 92, 77, -1);
+ } else if (!_soleOpened) {
+ _soleInset.setFrame(2);
+ _soleInset.setDetails(930, 93, 77, -1);
} else {
- _object5.setFrame(_object5.getFrameCount());
- _object5.setDetails(930, 76, 77, 78);
+ _soleInset.setFrame(_soleInset.getFrameCount());
+ _soleInset.setDetails(930, 76, 77, 78);
}
- _object5.fixPriority(260);
- _object5.setPosition(Common::Point(147, 128));
+ _soleInset.fixPriority(260);
+ _soleInset.setPosition(Common::Point(147, 128));
}
void Scene930::synchronize(Serializer &s) {
SceneExt::synchronize(s);
- s.syncAsSint16LE(_v141A);
- s.syncAsSint16LE(_v141C);
+ s.syncAsSint16LE(_soleOpened);
+ s.syncAsSint16LE(_bootInsetDisplayed);
}
/*--------------------------------------------------------------------------
@@ -1296,7 +3513,7 @@ void Scene935::Action1::signal() {
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);
+ scene->transition((const byte *)&v50EEA, 5 * i, 935, NULL, 0, 255, 249, 255, 1);
setDelay(3);
break;
case 2:
@@ -1313,7 +3530,7 @@ void Scene935::Action1::signal() {
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);
+ scene->transition((const byte *)&v50F26, 5 * i, 935, NULL, 0, 255, 249, 255, 1);
setDelay(3);
break;
case 5:
@@ -1330,7 +3547,7 @@ void Scene935::Action1::signal() {
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);
+ scene->transition((const byte *)&v50F62, 5 * i, 935, NULL, 0, 255, 249, 255, 1);
setDelay(3);
break;
case 8:
@@ -1424,7 +3641,7 @@ void Scene935::signal() {
_sceneMode = 3;
setAction(&_sequenceManager, this, 9353, &_object1, &_object2, NULL);
break;
- default:
+ default:
BF_GLOBALS._sceneManager.changeScene(BF_GLOBALS._sceneManager._previousScene);
break;
}
@@ -1435,7 +3652,7 @@ void Scene935::dispatch() {
}
/*--------------------------------------------------------------------------
- * Scene 940 - ?
+ * Scene 940 - Jail ending animation
*
*--------------------------------------------------------------------------*/
@@ -1453,9 +3670,11 @@ void Scene940::Action1::signal() {
break;
case 2:
_actionIndex = 941;
- if (BF_GLOBALS.getFlag(fBackupAt340))
+ if (BF_GLOBALS.getFlag(fBackupAt340)) {
+ // WORKAROUND: If the player shot Nico, the alternate text was previously going off-screen
+ scene->_gameTextSpeaker1._offsetPos.y -= 10;
scene->_stripManager.start(9408, this);
- else
+ } else
scene->_stripManager.start(9400, this);
break;
case 5:
@@ -1501,7 +3720,7 @@ void Scene940::Action1::signal() {
break;
case 946:
_actionIndex = 942;
- setAction(&scene->_sequenceManager1, this, 946, &scene->_object7, &scene->_object8, NULL);
+ setAction(&scene->_sequenceManager1, this, 946, &scene->_object7, &scene->_object8, NULL);
break;
case 947:
_actionIndex = 5;
@@ -1588,7 +3807,7 @@ void Scene940::postInit(SceneObjectList *OwnerList) {
BF_GLOBALS._sound1.play(115);
BF_GLOBALS._dayNumber = 6;
BF_GLOBALS._interfaceY = 200;
- BF_GLOBALS._uiElements._active = false;
+ T2_GLOBALS._uiElements._active = false;
_gameTextSpeaker2._speakerName = "SENTTEXT";
_gameTextSpeaker2._color1 = 104;
@@ -1670,7 +3889,7 @@ void Scene940::remove() {
// clearScren();
BF_GLOBALS._scrollFollower = &BF_GLOBALS._player;
SceneExt::remove();
- BF_GLOBALS._uiElements._active = true;
+ T2_GLOBALS._uiElements._active = true;
}
} // End of namespace BlueForce
diff --git a/engines/tsage/blue_force/blueforce_scenes9.h b/engines/tsage/blue_force/blueforce_scenes9.h
index f4f2c6e779..9ae542c21d 100644
--- a/engines/tsage/blue_force/blueforce_scenes9.h
+++ b/engines/tsage/blue_force/blueforce_scenes9.h
@@ -43,50 +43,50 @@ class Scene900: public PalettedScene {
/* Items */
class Item1: public NamedHotspot {
public:
- bool startAction(CursorType action, Event &event);
+ virtual bool startAction(CursorType action, Event &event);
};
class Item4: public NamedHotspot {
public:
- bool startAction(CursorType action, Event &event);
+ virtual bool startAction(CursorType action, Event &event);
};
/* Objects */
- class Object1: public NamedObject {
+ class Gate: public NamedObject {
public:
- bool startAction(CursorType action, Event &event);
+ virtual bool startAction(CursorType action, Event &event);
};
- class Object2: public NamedObjectExt {
+ class Door: public NamedObjectExt {
public:
- bool startAction(CursorType action, Event &event);
+ virtual bool startAction(CursorType action, Event &event);
};
- class Object3: public NamedObjectExt {
+ class Dog: public NamedObjectExt {
public:
- bool startAction(CursorType action, Event &event);
+ virtual bool startAction(CursorType action, Event &event);
};
- class Object6: public NamedObject {
+ class Lyle: public NamedObject {
public:
- bool startAction(CursorType action, Event &event);
+ virtual bool startAction(CursorType action, Event &event);
};
- class Object7: public NamedObject {
+ class Body: public NamedObject {
public:
- bool startAction(CursorType action, Event &event);
+ virtual bool startAction(CursorType action, Event &event);
};
/* Actions */
class Action1 : public Action {
public:
- void signal();
+ virtual void signal();
};
class Action2 : public Action {
public:
- void signal();
+ virtual void signal();
};
class Action3 : public Action {
public:
- void signal();
+ virtual void signal();
};
class Action4 : public Action {
public:
- void signal();
+ virtual void signal();
};
public:
@@ -95,41 +95,219 @@ public:
SpeakerJakeJacket _jakeJacketSpeaker;
SpeakerLyleHat _lyleHatSpeaker;
Item1 _item1;
- Object1 _object1;
- Object2 _object2;
- Object3 _object3;
+ Gate _gate;
+ Door _door;
+ Dog _dog;
NamedHotspot _item2;
NamedHotspot _item3;
NamedObject _object4;
NamedObject _object5;
- Object6 _lyle;
- Object7 _object7;
+ Lyle _lyle;
+ Body _body;
Item4 _item4;
ASoundExt _sound1;
Action1 _action1;
Action2 _action2;
Action3 _action3;
Action4 _action4;
- int _field1974;
+ int _lyleDialogCtr;
int _field1976;
Scene900();
- void postInit(SceneObjectList *OwnerList = NULL);
- void signal();
- void process(Event &event);
- void dispatch();
- void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+ virtual void synchronize(Serializer &s);
+};
+
+class Scene910: public PalettedScene {
+ /* Actions */
+ class Action1 : public Action {
+ public:
+ virtual void signal();
+ };
+ class Action2 : public Action {
+ public:
+ virtual void signal();
+ };
+ /* Objects */
+ class Lyle: public NamedObject {
+ public:
+ int _field90;
+ virtual void synchronize(Serializer &s);
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Nico: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Stuart: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Forbes: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class PowerCord: public NamedObject {
+ public:
+ int _field90, _field92;
+
+ virtual void synchronize(Serializer &s);
+ virtual bool startAction(CursorType action, Event &event);
+ void init(int val);
+
+ };
+ class BreakerBox: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class FakeWall: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Object13: public NamedObject {
+ protected:
+ int _state, _mode;
+ public:
+ void setupBreaker(int x, int y, int mode, int8 frameNumber);
+ virtual void synchronize(Serializer &s);
+ virtual bool startAction(CursorType action, Event &event);
+ virtual void remove();
+ };
+
+ class BlackPlug: public Object13 {
+ public:
+ void init(int x, int y, int arg8, int8 mode);
+ virtual bool startAction(CursorType action, Event &event);
+ virtual void remove();
+ };
+
+ class Object25: public NamedObject {
+ int _field90, _field92;
+ public:
+ void setupHiddenSwitch(int x, int y, int arg8, int argA);
+ virtual void synchronize(Serializer &s);
+ virtual bool startAction(CursorType action, Event &event);
+ virtual void remove();
+ };
+
+ class BreakerBoxInset: public FocusObject {
+ Object13 _object13, _object14, _object15, _object16, _object17, _object18;
+ Object13 _object19, _object20, _object21, _object22, _object23, _object24;
+ Object25 _object25, _object26;
+ public:
+ Object13 _object27;
+ BlackPlug _object28;
+ virtual Common::String getClassName() { return "Scene910_object12"; }
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ };
+
+ class PowerButton: public NamedObject {
+ public:
+ NamedObject _object32;
+ virtual void remove();
+ virtual bool startAction(CursorType action, Event &event);
+ void init(int frame);
+ };
+
+ class GeneratorInset: public FocusObject {
+ BlackPlug _blackPlug;
+ PowerButton _powerButton;
+ public:
+ virtual Common::String getClassName() { return "Scene910_object29"; }
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ };
+
+ /* Items */
+ class Generator: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item2: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item3: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item9: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item15: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item16: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item17: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ int _sceneSubMode, _breakerButtonCtr, _field2DE0, _field2DE2, _field2DE4;
+ Common::Point _destPos;
+public:
+ SequenceManager _sequenceManager1, _sequenceManager2;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerJakeJacket _jakeJacketSpeaker;
+ SpeakerLyleHat _lyleHatSpeaker;
+ SpeakerFBI _fbiSpeaker;
+ SpeakerNico _nicoSpeaker;
+ SpeakerDA _daSpeaker;
+ Action1 _action1;
+ Action2 _action2;
+ Timer _timer1;
+ Lyle _lyle;
+ Nico _nico;
+ Stuart _stuart;
+ Forbes _forbes;
+ NamedObject _object5, _vent, _shadow;
+ PowerCord _blackCord, _yellowCord;
+ BreakerBox _breakerBox;
+ FakeWall _fakeWall;
+ BreakerBoxInset _breakerBoxInset;
+ GeneratorInset _generatorInset;
+ NamedObject _object30, _object31, _object32;
+ Generator _generator;
+ Item2 _item2;
+ Item3 _item3;
+ NamedHotspot _item4, _item5, _item6, _item7, _item8;
+ Item9 _item9, _item10;
+ NamedHotspot _item11, _backWall, _item13, _item14;
+ Item15 _item15;
+ Item16 _item16;
+ Item17 _item17;
+ ASoundExt _sound1, _sound2;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void synchronize(Serializer &s);
+ virtual void remove();
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+ virtual void checkGun();
+ void openHiddenDoor();
+ void closeHiddenDoor();
};
class Scene920: public SceneExt {
/* Items */
class Item1: public NamedHotspot {
public:
- bool startAction(CursorType action, Event &event);
+ virtual bool startAction(CursorType action, Event &event);
};
class Item8: public NamedHotspot {
public:
- bool startAction(CursorType action, Event &event);
+ virtual bool startAction(CursorType action, Event &event);
};
public:
@@ -144,71 +322,73 @@ public:
NamedHotspot _item5;
NamedHotspot _item6;
NamedHotspot _item7;
- NamedObject _object1;
- NamedObject _object2;
- NamedObject _object3;
+ NamedObject _crateTop;
+ NamedObject _crateWindow;
+ NamedObject _doorway;
Item8 _exitN;
Common::Point _oldCoord;
- void postInit(SceneObjectList *OwnerList = NULL);
- void signal();
- void process(Event &event);
- void dispatch();
- void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+ virtual void synchronize(Serializer &s);
};
class Scene930: public PalettedScene {
/* Objects */
class Object1: public NamedObject {
public:
- bool startAction(CursorType action, Event &event);
+ virtual bool startAction(CursorType action, Event &event);
};
class Object2: public FocusObject {
public:
- bool startAction(CursorType action, Event &event);
+ virtual bool startAction(CursorType action, Event &event);
};
class Object3: public NamedObject {
public:
- bool startAction(CursorType action, Event &event);
+ virtual bool startAction(CursorType action, Event &event);
};
class Object4: public FocusObject {
public:
- bool startAction(CursorType action, Event &event);
+ virtual bool startAction(CursorType action, Event &event);
+ virtual void remove();
};
class Object5: public FocusObject {
public:
- bool startAction(CursorType action, Event &event);
+ virtual bool startAction(CursorType action, Event &event);
+ virtual void remove();
};
/* Items */
class Item1: public NamedHotspot {
public:
- bool startAction(CursorType action, Event &event);
+ virtual bool startAction(CursorType action, Event &event);
};
/* Actions */
class Action1 : public Action {
public:
- void signal();
+ virtual void signal();
};
class Action2 : public Action {
public:
- void signal();
+ virtual void signal();
};
class Action3 : public Action {
public:
- void signal();
+ virtual void signal();
};
- void showBootWindow();
- void subF3C07();
- void subF3D6F();
+ void showBootInset();
+ void ShowBoxInset();
+ void ShowSoleInset();
public:
SequenceManager _sequenceManager1;
Object1 _box;
- Object2 _object2;
+ Object2 _boxInset;
Object3 _boots;
- Object4 _bootsWindow;
- Object5 _object5;
-
+ Object4 _bootsInset;
+ Object5 _soleInset;
+
Item1 _item1;
NamedHotspot _item2;
NamedHotspot _item3;
@@ -237,20 +417,20 @@ public:
SpeakerGameText gameTextSpeaker;
- int _v141A;
- int _v141C;
+ bool _soleOpened;
+ int _bootInsetDisplayed;
- void postInit(SceneObjectList *OwnerList = NULL);
- void signal();
- void dispatch();
- void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void dispatch();
+ virtual void synchronize(Serializer &s);
};
class Scene935: public PalettedScene {
/* Actions */
class Action1 : public Action {
public:
- void signal();
+ virtual void signal();
};
public:
@@ -261,22 +441,22 @@ public:
Action1 _action1;
VisualSpeaker _visualSpeaker;
- void postInit(SceneObjectList *OwnerList = NULL);
- void remove();
- void signal();
- void dispatch();
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+ virtual void dispatch();
};
class Scene940: public SceneExt {
/* Items */
class Item1: public NamedHotspot {
public:
- bool startAction(CursorType action, Event &event);
+ virtual bool startAction(CursorType action, Event &event);
};
/* Actions */
class Action1 : public Action {
public:
- void signal();
+ virtual void signal();
};
public:
@@ -308,8 +488,8 @@ public:
SpeakerGameText _gameTextSpeaker1;
SpeakerGameText _gameTextSpeaker2;
- void postInit(SceneObjectList *OwnerList = NULL);
- void remove();
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
};
} // End of namespace BlueForce
diff --git a/engines/tsage/blue_force/blueforce_speakers.cpp b/engines/tsage/blue_force/blueforce_speakers.cpp
index 0f506c7122..8af18b43b8 100644
--- a/engines/tsage/blue_force/blueforce_speakers.cpp
+++ b/engines/tsage/blue_force/blueforce_speakers.cpp
@@ -965,6 +965,59 @@ SpeakerLyleText::SpeakerLyleText(): VisualSpeaker() {
_speakerName = "LYLETEXT";
}
+/*--------------------------------------------------------------------------*/
+
+SpeakerKate::SpeakerKate(): VisualSpeaker() {
+ _color1 = 108;
+
+ _speakerName = "KATE";
+}
+
+void SpeakerKate::setText(const Common::String &msg) {
+ _removeObject1 = _removeObject2 = true;
+
+ _object1.postInit();
+ _object1.setVisage(122);
+ _object1.setStrip2(8);
+ _object1.fixPriority(254);
+ _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 270,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ _object2.postInit();
+ _object2.setVisage(122);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 270,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ _object2._numFrames = 7;
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerTony::SpeakerTony(): VisualSpeaker() {
+ _color1 = 108;
+ _color2 = 8;
+
+ _speakerName = "TONY";
+}
+
+void SpeakerTony::setText(const Common::String &msg) {
+ _removeObject2 = true;
+
+ _object2.postInit();
+ _object2.setVisage(132);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 62,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
} // 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
index 932c3c311f..508279a929 100644
--- a/engines/tsage/blue_force/blueforce_speakers.h
+++ b/engines/tsage/blue_force/blueforce_speakers.h
@@ -337,6 +337,21 @@ public:
virtual Common::String getClassName() { return "SpeakerLyleText"; }
};
+class SpeakerKate: public VisualSpeaker {
+public:
+ SpeakerKate();
+
+ virtual Common::String getClassName() { return "SpeakerKate"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerTony: public VisualSpeaker {
+public:
+ SpeakerTony();
+
+ virtual Common::String getClassName() { return "SpeakerTony"; }
+ virtual void setText(const Common::String &msg);
+};
} // End of namespace BlueForce
} // End of namespace TsAGE
diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp
index d86548bd4b..b802f71ff3 100644
--- a/engines/tsage/converse.cpp
+++ b/engines/tsage/converse.cpp
@@ -32,7 +32,7 @@ namespace TsAGE {
SequenceManager::SequenceManager() : Action() {
- Common::set_to(&_objectList[0], &_objectList[6], (SceneObject *)NULL);
+ Common::fill(&_objectList[0], &_objectList[6], (SceneObject *)NULL);
_sequenceData.clear();
_fontNum = 0;
_sequenceOffset = 0;
@@ -81,7 +81,7 @@ void SequenceManager::remove() {
if (g_globals->_sceneObjects->contains(&_sceneText))
_sceneText.remove();
- Common::set_to(&_objectList[0], &_objectList[6], (SceneObject *)NULL);
+ Common::fill(&_objectList[0], &_objectList[6], (SceneObject *)NULL);
Action::remove();
}
@@ -342,7 +342,7 @@ void SequenceManager::attached(EventHandler *newOwner, EventHandler *endHandler,
DEALLOCATE(seqData);
- Common::set_to(&_objectList[0], &_objectList[6], (SceneObject *)NULL);
+ Common::fill(&_objectList[0], &_objectList[6], (SceneObject *)NULL);
for (int idx = 0; idx < 6; ++idx) {
_objectList[idx] = va_arg(va, SceneObject *);
if (!_objectList[idx])
@@ -531,26 +531,52 @@ void ConversationChoiceDialog::draw() {
/*--------------------------------------------------------------------------*/
void Obj44::load(const byte *dataP) {
- _id = READ_LE_UINT16(dataP);
+ Common::MemoryReadStream s(dataP, (g_vm->getGameID() == GType_Ringworld2) ? 126 : 68);
+
+ if (g_vm->getGameID() == GType_Ringworld2) {
+ _mode = s.readSint16LE();
+ _lookupValue = s.readSint16LE();
+ _lookupIndex = s.readSint16LE();
+ _field6 = s.readSint16LE();
+ _field8 = s.readSint16LE();
+ }
+
+ _id = s.readSint16LE();
for (int idx = 0; idx < OBJ44_LIST_SIZE; ++idx)
- _field2[idx] = READ_LE_UINT16(dataP + 2 + idx * 2);
+ _callbackId[idx] = s.readSint16LE();
+
+ if (g_vm->getGameID() == GType_Ringworld2) {
+ _field16 = s.readSint16LE();
+ s.skip(20);
+ } else {
+ s.skip(4);
+ }
- const byte *listP = dataP + 0x10;
- for (int idx = 0; idx < OBJ44_LIST_SIZE; ++idx, listP += 10) {
- _list[idx]._id = READ_LE_UINT16(listP);
- _list[idx]._scriptOffset = READ_LE_UINT16(listP + 2);
+ for (int idx = 0; idx < OBJ0A_LIST_SIZE; ++idx) {
+ _list[idx]._id = s.readSint16LE();
+ _list[idx]._scriptOffset = s.readSint16LE();
+ s.skip(6);
}
- _speakerOffset = READ_LE_UINT16(dataP + 0x42);
+ _speakerOffset = s.readSint16LE();
}
void Obj44::synchronize(Serializer &s) {
s.syncAsSint32LE(_id);
for (int idx = 0; idx < OBJ44_LIST_SIZE; ++idx)
- s.syncAsSint32LE(_field2[idx]);
- for (int idx = 0; idx < OBJ44_LIST_SIZE; ++idx)
+ s.syncAsSint32LE(_callbackId[idx]);
+ for (int idx = 0; idx < OBJ0A_LIST_SIZE; ++idx)
_list[idx].synchronize(s);
s.syncAsUint32LE(_speakerOffset);
+
+ if (g_vm->getGameID() == GType_Ringworld2) {
+ s.syncAsSint16LE(_mode);
+ s.syncAsSint16LE(_lookupValue);
+ s.syncAsSint16LE(_lookupIndex);
+ s.syncAsSint16LE(_field6);
+ s.syncAsSint16LE(_field8);
+ s.syncAsSint16LE(_field16);
+ }
}
/*--------------------------------------------------------------------------*/
@@ -581,6 +607,11 @@ void StripManager::start(int stripNum, EventHandler *owner, StripCallback *callb
owner->setAction(this, owner);
}
+void StripManager::start3(int stripNum, EventHandler *owner, byte *lookupList) {
+ _lookupList = lookupList;
+ start(stripNum, owner, NULL);
+}
+
void StripManager::reset() {
_actionIndex = 0;
_delayFrames = 0;
@@ -614,10 +645,12 @@ void StripManager::load() {
// Get the object list
byte *obj44List = g_resourceManager->getResource(RES_STRIP, _stripNum, 1);
int dataSize = g_vm->_memoryManager.getSize(obj44List);
- assert((dataSize % 0x44) == 0);
+
+ int obj44Size = (g_vm->getGameID() == GType_Ringworld2) ? 126 : 68;
+ assert((dataSize % obj44Size) == 0);
byte *dataP = obj44List;
- for (int idx = 0; idx < (dataSize / 0x44); ++idx, dataP += 0x44) {
+ for (int idx = 0; idx < (dataSize / obj44Size); ++idx, dataP += obj44Size) {
Obj44 obj;
obj.load(dataP);
_obj44List.push_back(obj);
@@ -703,7 +736,12 @@ void StripManager::signal() {
return;
} else if (_obj44Index == 10000) {
// Reached end of strip
+ EventHandler *endHandler = _endHandler;
remove();
+
+ if ((g_vm->getGameID() == GType_Ringworld2) && endHandler)
+ endHandler->signal();
+
return;
}
@@ -714,17 +752,54 @@ void StripManager::signal() {
load();
Obj44 &obj44 = _obj44List[_obj44Index];
- _field2E8 = obj44._id;
+
+ if (g_vm->getGameID() != GType_Ringworld2) {
+ _field2E8 = obj44._id;
+ } else {
+ // Return to Ringworld specific handling
+ if (obj44._field6)
+ _field2E8 = obj44._field6;
+
+ switch (obj44._mode) {
+ case 1:
+ ++_lookupList[obj44._lookupIndex - 1];
+ break;
+ case 2:
+ --_lookupList[obj44._lookupIndex - 1];
+ break;
+ case 3:
+ _lookupList[obj44._lookupIndex - 1] = obj44._lookupValue;
+ break;
+ default:
+ break;
+ }
+ }
+
Common::StringArray choiceList;
// Build up a list of script entries
int idx;
- for (idx = 0; idx < OBJ44_LIST_SIZE; ++idx) {
- if (!obj44._list[idx]._id)
- break;
- // Get the next one
- choiceList.push_back((const char *)&_script[0] + obj44._list[idx]._scriptOffset);
+ if (g_vm->getGameID() == GType_Ringworld2 && obj44._field16) {
+ // Special loading mode used in Return to Ringworld
+ for (idx = 0; idx < OBJ44_LIST_SIZE; ++idx) {
+ int objIndex = _lookupList[obj44._field16 - 1];
+
+ if (!obj44._list[objIndex]._id)
+ break;
+
+ // Get the next one
+ choiceList.push_back((const char *)&_script[0] + obj44._list[objIndex]._scriptOffset);
+ }
+ } else {
+ // Standard choices loading
+ for (idx = 0; idx < OBJ44_LIST_SIZE; ++idx) {
+ if (!obj44._list[idx]._id)
+ break;
+
+ // Get the next one
+ choiceList.push_back((const char *)&_script[0] + obj44._list[idx]._scriptOffset);
+ }
}
int strIndex = 0;
@@ -754,10 +829,10 @@ void StripManager::signal() {
if (_callbackObject) {
for (idx = 0; idx < OBJ44_LIST_SIZE; ++idx) {
- if (!obj44._field2[idx])
+ if (!obj44._callbackId[idx])
break;
- _callbackObject->stripCallback(obj44._field2[idx]);
+ _callbackObject->stripCallback(obj44._callbackId[idx]);
}
}
diff --git a/engines/tsage/converse.h b/engines/tsage/converse.h
index f82c07a7dd..0c4eb9539d 100644
--- a/engines/tsage/converse.h
+++ b/engines/tsage/converse.h
@@ -178,13 +178,19 @@ public:
};
#define OBJ44_LIST_SIZE 5
+#define OBJ0A_LIST_SIZE ((g_vm->getGameID() == GType_Ringworld2) ? 8 : 5)
class Obj44 : public Serialisable {
public:
int _id;
- int _field2[OBJ44_LIST_SIZE];
- Obj0A _list[OBJ44_LIST_SIZE];
+ int _callbackId[OBJ44_LIST_SIZE];
+ Obj0A _list[8];
uint _speakerOffset;
+
+ // Return to Ringworld specific field
+ int _mode;
+ int _lookupValue, _lookupIndex, _field6;
+ int _field8, _field16;
public:
void load(const byte *dataP);
virtual void synchronize(Serializer &s);
@@ -215,6 +221,9 @@ public:
Common::Array<byte> _script;
StripProc _onBegin;
StripProc _onEnd;
+
+ // Ringworld 2 specific fields
+ byte *_lookupList;
public:
StripManager();
virtual ~StripManager();
@@ -225,6 +234,7 @@ public:
virtual void process(Event &event);
void start(int stripNum, EventHandler *owner, StripCallback *callback = NULL);
+ void start3(int stripNum, EventHandler *owner, byte *lookupList);
void setCallback(StripCallback *callback) { _callbackObject = callback; }
void setColors(int stdColor, int highlightColor) { _choiceDialog.setColors(stdColor, highlightColor); }
void setFontNumber(int fontNum) { _choiceDialog.setFontNumber(fontNum); }
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index c237548547..9d7c8abf0a 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -66,9 +66,19 @@ InvObject::InvObject(int visage, int strip, int frame) {
_iconResNum = 10;
}
+InvObject::InvObject(int strip, int frame) {
+ assert(g_vm->getGameID() == GType_Ringworld2);
+ _strip = strip;
+ _frame = frame;
+
+ _visage = 7;
+ _sceneNumber = 0;
+ _iconResNum = 10;
+}
+
void InvObject::setCursor() {
- if (g_vm->getGameID() == GType_BlueForce) {
- // Blue Force cursor handling
+ if (g_vm->getGameID() != GType_Ringworld) {
+ // All other games
_cursorId = (CursorType)BF_GLOBALS._inventory->indexOf(this);
g_globals->_events.setCursor(_cursorId);
} else {
@@ -84,6 +94,10 @@ void InvObject::setCursor() {
}
}
+bool InvObject::inInventory() const {
+ return _sceneNumber == ((g_vm->getGameID() != GType_Ringworld2) ? 1 : g_globals->_player._characterIndex);
+}
+
/*--------------------------------------------------------------------------*/
InvObjectList::InvObjectList() {
@@ -886,24 +900,28 @@ 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 = g_globals->_walkRegions._idxList[srcWalkRegion._idxListIndex + foundIndex]) != 0) && (!foundRoute)) {
- int newDistance = calculateRestOfRoute(tempList, currDest, destRegion, foundRoute);
+ // Only check the region if it isn't in the list of explicitly disabled regions
+ if (!contains(g_globals->_walkRegions._disabledRegions, (int)currDest)) {
+ int newDistance = calculateRestOfRoute(tempList, currDest, destRegion, foundRoute);
- if ((newDistance <= bestDistance) || foundRoute) {
- // We found a shorter possible route, or one leading to the destination.
+ if ((newDistance <= bestDistance) || foundRoute) {
+ // We found a shorter possible route, or one leading to the destination.
- // Overwrite the route with this new one.
- routeList[0] = ourListSize - 1;
+ // Overwrite the route with this new one.
+ routeList[0] = ourListSize - 1;
+
+ for (int i = ourListSize; i <= tempList[0]; ++i) {
+ routeList[i] = tempList[i];
+ ++routeList[0];
+ }
- for (int i = ourListSize; i <= tempList[0]; ++i) {
- routeList[i] = tempList[i];
- ++routeList[0];
+ bestDistance = newDistance;
}
- bestDistance = newDistance;
+ // Truncate our local list to the size it was before the call.
+ tempList[0] = ourListSize;
}
- // Truncate our local list to the size it was before the call.
- tempList[0] = ourListSize;
++foundIndex;
}
@@ -1047,6 +1065,8 @@ PaletteRotation::PaletteRotation() : PaletteModifierCached() {
_percent = 0;
_delayCtr = 0;
_frameNumber = g_globals->_events.getFrameNumber();
+ _idxChange = 1;
+ _countdown = 0;
}
void PaletteRotation::synchronize(Serializer &s) {
@@ -1060,14 +1080,24 @@ void PaletteRotation::synchronize(Serializer &s) {
s.syncAsSint32LE(_rotationMode);
s.syncAsSint32LE(_duration);
s.syncBytes(&_palette[0], 256 * 3);
+
+ if (g_vm->getGameID() == GType_Ringworld2) {
+ s.syncAsSint16LE(_idxChange);
+ s.syncAsSint16LE(_countdown);
+ }
}
void PaletteRotation::signal() {
+ if (_countdown > 0) {
+ --_countdown;
+ return;
+ }
+
if (_delayCtr) {
uint32 frameNumber = g_globals->_events.getFrameNumber();
if (frameNumber >= _frameNumber) {
- _delayCtr = frameNumber - _frameNumber;
+ _delayCtr -= frameNumber - _frameNumber;
_frameNumber = frameNumber;
if (_delayCtr < 0)
@@ -1084,21 +1114,24 @@ void PaletteRotation::signal() {
bool flag = true;
switch (_rotationMode) {
case -1:
- if (--_currIndex < _start) {
+ _currIndex -= _idxChange;
+ if (_currIndex < _start) {
flag = decDuration();
if (flag)
_currIndex = _end - 1;
}
break;
case 1:
- if (++_currIndex >= _end) {
+ _currIndex += _idxChange;
+ if (_currIndex >= _end) {
flag = decDuration();
if (flag)
_currIndex = _start;
}
break;
case 2:
- if (++_currIndex >= _end) {
+ _currIndex += _idxChange;
+ if (_currIndex >= _end) {
flag = decDuration();
if (flag) {
_currIndex = _end - 2;
@@ -1107,7 +1140,8 @@ void PaletteRotation::signal() {
}
break;
case 3:
- if (--_currIndex < _start) {
+ _currIndex -= _idxChange;
+ if (_currIndex < _start) {
flag = decDuration();
if (flag) {
_currIndex = _start + 1;
@@ -1130,7 +1164,9 @@ void PaletteRotation::signal() {
void PaletteRotation::remove() {
Action *action = _action;
- g_system->getPaletteManager()->setPalette((const byte *)&_palette[_start * 3], _start, _end - _start);
+
+ if (_idxChange)
+ g_system->getPaletteManager()->setPalette((const byte *)&_palette[_start * 3], _start, _end - _start);
_scenePalette->_listeners.remove(this);
@@ -1285,6 +1321,15 @@ void ScenePalette::setPalette(int index, int count) {
}
/**
+ * Get a palette entry
+ */
+void ScenePalette::getEntry(int index, uint *r, uint *g, uint *b) {
+ *r = _palette[index * 3];
+ *g = _palette[index * 3 + 1];
+ *b = _palette[index * 3 + 2];
+}
+
+/**
* Set a palette entry
*/
void ScenePalette::setEntry(int index, uint r, uint g, uint b) {
@@ -1424,8 +1469,8 @@ void ScenePalette::changeBackground(const Rect &bounds, FadeMode fadeMode) {
}
Rect tempRect = bounds;
- if (g_vm->getGameID() == GType_BlueForce)
- tempRect.setHeight(BF_GLOBALS._interfaceY);
+ if (g_vm->getGameID() != GType_Ringworld)
+ tempRect.setHeight(T2_GLOBALS._interfaceY);
g_globals->_screenSurface.copyFrom(g_globals->_sceneManager._scene->_backSurface,
tempRect, Rect(0, 0, tempRect.width(), tempRect.height()), NULL);
@@ -1523,20 +1568,20 @@ void SceneItem::display(int resNum, int 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 ((g_vm->getGameID() != GType_Ringworld) && T2_GLOBALS._uiElements._active)
+ T2_GLOBALS._uiElements.hide();
if (g_globals->_sceneObjects->contains(&g_globals->_sceneText)) {
g_globals->_sceneText.remove();
g_globals->_sceneObjects->draw();
}
- GfxFontBackup font;
Common::Point pos(160, 100);
Rect textRect;
int maxWidth = 120;
bool keepOnscreen = false;
- bool centerText = g_vm->getGameID() == GType_Ringworld;
+ bool centerText = g_vm->getGameID() != GType_BlueForce;
+ Common::List<int> playList;
if (resNum != 0) {
va_list va;
@@ -1545,6 +1590,17 @@ void SceneItem::display(int resNum, int lineNum, ...) {
if (resNum == -1)
msg = Common::String(va_arg(va, const char *));
+ if (g_vm->getGameID() == GType_Ringworld2) {
+ // Pre-process the string for any sound information
+ while (msg.hasPrefix("!")) {
+ msg.deleteChar(0);
+ playList.push_back(atoi(msg.c_str()));
+
+ while (!msg.empty() && (*msg.c_str() >= '0' && *msg.c_str() <= '9'))
+ msg.deleteChar(0);
+ }
+ }
+
int mode;
do {
// Get next instruction
@@ -1618,10 +1674,14 @@ void SceneItem::display(int resNum, int lineNum, ...) {
if (resNum) {
// Get required bounding size
- g_globals->gfxManager().getStringBounds(msg.c_str(), textRect, maxWidth);
- textRect.center(pos.x, pos.y);
+ GfxFont font;
+ font.setFontNumber(g_globals->_sceneText._fontNumber);
+ font.getStringBounds(msg.c_str(), textRect, maxWidth);
+ // Center the text at the specified position, and then constrain it to be-
+ textRect.center(pos.x, pos.y);
textRect.contain(g_globals->gfxManager()._bounds);
+
if (centerText) {
g_globals->_sceneText._color1 = g_globals->_sceneText._color2;
g_globals->_sceneText._color2 = 0;
@@ -1652,12 +1712,18 @@ void SceneItem::display(int resNum, int lineNum, ...) {
g_system->delayMillis(10);
}
+ // For Return to Ringworld, play the voice overs in sequence
+ if ((g_vm->getGameID() == GType_Ringworld2) && !playList.empty() && !R2_GLOBALS._playStream.isPlaying()) {
+ R2_GLOBALS._playStream.play(*playList.begin(), NULL);
+ playList.pop_front();
+ }
+
g_globals->_sceneText.remove();
}
- if ((g_vm->getGameID() == GType_BlueForce) && BF_GLOBALS._uiElements._active) {
+ if ((g_vm->getGameID() != GType_Ringworld) && T2_GLOBALS._uiElements._active) {
// Show user interface
- BF_GLOBALS._uiElements.show();
+ T2_GLOBALS._uiElements.show();
// Re-show the cursor
BF_GLOBALS._events.setCursor(BF_GLOBALS._events.getCursor());
@@ -1665,14 +1731,22 @@ void SceneItem::display(int resNum, int lineNum, ...) {
}
void SceneItem::display2(int resNum, int lineNum) {
- if (g_vm->getGameID() == GType_BlueForce)
+ switch (g_vm->getGameID()) {
+ case 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_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
SET_EXT_FGCOLOR, 13, LIST_END);
- else
+ break;
+ case GType_Ringworld2:
+ display(resNum, lineNum, SET_WIDTH, 280, SET_X, 160, SET_Y, 20, SET_POS_MODE, ALIGN_CENTER,
+ SET_EXT_BGCOLOR, 60, LIST_END);
+ break;
+ default:
display(resNum, lineNum, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
+ break;
+ }
}
void SceneItem::display(const Common::String &msg) {
@@ -1681,7 +1755,7 @@ void SceneItem::display(const Common::String &msg) {
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_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + UI_INTERFACE_Y + 2,
SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
SET_EXT_FGCOLOR, 13, LIST_END);
}
@@ -1689,13 +1763,15 @@ void SceneItem::display(const Common::String &msg) {
/*--------------------------------------------------------------------------*/
bool SceneHotspot::startAction(CursorType action, Event &event) {
- if (g_vm->getGameID() != GType_BlueForce)
- return SceneItem::startAction(action, event);
- else {
+ switch (g_vm->getGameID()) {
+ case GType_BlueForce: {
BlueForce::SceneExt *scene = (BlueForce::SceneExt *)BF_GLOBALS._sceneManager._scene;
assert(scene);
return scene->display(action);
}
+ default:
+ return SceneItem::startAction(action, event);
+ }
}
void SceneHotspot::doAction(int action) {
@@ -1731,109 +1807,6 @@ void SceneHotspot::doAction(int action) {
/*--------------------------------------------------------------------------*/
-NamedHotspot::NamedHotspot() : SceneHotspot() {
- _resNum = 0;
- _lookLineNum = _useLineNum = _talkLineNum = -1;
-}
-
-bool NamedHotspot::startAction(CursorType action, Event &event) {
- switch (action) {
- case CURSOR_WALK:
- // Nothing
- 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);
- 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);
- 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);
- return true;
- default:
- return SceneHotspot::startAction(action, event);
- }
-}
-
-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;
- g_globals->_sceneItems.addItems(this, NULL);
-}
-
-void NamedHotspot::setDetails(const Rect &bounds, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item) {
- setBounds(bounds);
- _resNum = resNum;
- _lookLineNum = lookLineNum;
- _talkLineNum = talkLineNum;
- _useLineNum = useLineNum;
-
- switch (mode) {
- case 2:
- g_globals->_sceneItems.push_front(this);
- break;
- case 4:
- g_globals->_sceneItems.addBefore(item, this);
- break;
- case 5:
- g_globals->_sceneItems.addAfter(item, this);
- break;
- default:
- g_globals->_sceneItems.push_back(this);
- break;
- }
-}
-
-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) {
- SceneHotspot::synchronize(s);
- s.syncAsSint16LE(_resNum);
- s.syncAsSint16LE(_lookLineNum);
- s.syncAsSint16LE(_useLineNum);
-
- if (g_vm->getGameID() == GType_BlueForce)
- s.syncAsSint16LE(_talkLineNum);
-}
-
-/*--------------------------------------------------------------------------*/
-
void SceneObjectWrapper::setSceneObject(SceneObject *so) {
_sceneObject = so;
so->_strip = 1;
@@ -1907,7 +1880,6 @@ SceneObject::SceneObject() : SceneHotspot() {
_moveDiff.x = 5;
_moveDiff.y = 3;
_numFrames = 10;
- _numFrames = 10;
_moveRate = 10;
_regionBitList = 0;
_sceneRegionId = 0;
@@ -1919,6 +1891,8 @@ SceneObject::SceneObject() : SceneHotspot() {
_visage = 0;
_strip = 0;
_frame = 0;
+ _effect = 0;
+ _shade = 0;
}
SceneObject::SceneObject(const SceneObject &so) : SceneHotspot() {
@@ -2135,7 +2109,7 @@ int SceneObject::checkRegion(const Common::Point &pt) {
if ((objYDiff >= yPos) && (objYDiff <= newY) &&
((*i)->_xs < tempRect.right) && ((*i)->_xe > tempRect.left)) {
// Found index
- regionIndex = -1; //****DEBUG*** = *i;
+ regionIndex = (*i)->_regionIndex;
break;
}
}
@@ -2221,6 +2195,14 @@ SceneObject *SceneObject::clone() const {
return obj;
}
+void SceneObject::copy(SceneObject *src) {
+ *this = *src;
+
+ _objectWrapper = NULL;
+ _mover = NULL;
+ _endAction = NULL;
+}
+
void SceneObject::checkAngle(const SceneObject *obj) {
checkAngle(obj->_position);
}
@@ -2287,6 +2269,11 @@ void SceneObject::synchronize(Serializer &s) {
s.syncAsSint32LE(_moveRate);
SYNC_POINTER(_endAction);
s.syncAsUint32LE(_regionBitList);
+
+ if (g_vm->getGameID() == GType_Ringworld2) {
+ s.syncAsSint16LE(_effect);
+ s.syncAsSint16LE(_shade);
+ }
}
void SceneObject::postInit(SceneObjectList *OwnerList) {
@@ -2496,6 +2483,11 @@ void SceneObject::updateScreen() {
srcRect.right = ((srcRect.right + 3) / 4) * 4;
srcRect.clip(g_globals->_sceneManager._scene->_sceneBounds);
+ if (g_vm->getGameID() != GType_Ringworld) {
+ if (T2_GLOBALS._uiElements._visible)
+ srcRect.bottom = MIN<int16>(srcRect.bottom, T2_GLOBALS._interfaceY);
+ }
+
if (srcRect.isValidRect()) {
Rect destRect = srcRect;
destRect.translate(-sceneBounds.left, -sceneBounds.top);
@@ -2526,6 +2518,13 @@ void SceneObject::setup(int visage, int stripFrameNum, int frameNum, int posX, i
fixPriority(priority);
}
+void SceneObject::setup(int visage, int stripFrameNum, int frameNum) {
+ postInit();
+ setVisage(visage);
+ setStrip(stripFrameNum);
+ setFrame(frameNum);
+}
+
/*--------------------------------------------------------------------------*/
void BackgroundSceneObject::postInit(SceneObjectList *OwnerList) {
@@ -2662,43 +2661,48 @@ void SceneObjectList::draw() {
}
g_globals->_paneRegions[paneNum].setRect(0, 0, 0, 0);
-redraw:
- // Main draw loop
- for (uint objIndex = 0; objIndex < objList.size(); ++objIndex) {
- SceneObject *obj = objList[objIndex];
-
- if ((obj->_flags & flagMask) && !(obj->_flags & OBJFLAG_HIDE)) {
- obj->_paneRects[paneNum] = obj->_bounds;
- obj->draw();
+
+ // FIXME: Currently, removing objects causes screen flickers when the removed object intersects
+ // another drawn object, since the background is briefly redrawn over the object. For now, I'm
+ // using a forced jump back to redraw objects. In the long term, I should figure out how the
+ // original game does this properly
+ bool redrawFlag = true;
+ while (redrawFlag) {
+ redrawFlag = false;
+
+ // Main draw loop
+ for (uint objIndex = 0; objIndex < objList.size(); ++objIndex) {
+ SceneObject *obj = objList[objIndex];
+
+ if ((obj->_flags & flagMask) && !(obj->_flags & OBJFLAG_HIDE)) {
+ obj->_paneRects[paneNum] = obj->_bounds;
+ obj->draw();
+ }
}
- }
- // Update the palette
- 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) {
- SceneObject *obj = objList[objIndex];
-
- if (obj->_flags & OBJFLAG_HIDE)
- obj->_flags |= OBJFLAG_HIDING;
- obj->_flags &= ~flagMask;
- if (obj->_flags & OBJFLAG_REMOVE) {
- obj->_flags |= OBJFLAG_PANES;
-
- checkIntersection(objList, objIndex, CURRENT_PANENUM);
-
- obj->updateScreen();
- obj->removeObject();
-
- // FIXME: Currently, removing objects causes screen flickers when the removed object intersects
- // another drawn object, since the background is briefly redrawn over the object. For now, I'm
- // using a forced jump back to redraw objects. In the long term, I should figure out how the
- // original game does this properly
- objList.remove_at(objIndex);
- goto redraw;
+ // Update the palette
+ 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() && !redrawFlag; ++objIndex) {
+ SceneObject *obj = objList[objIndex];
+
+ if (obj->_flags & OBJFLAG_HIDE)
+ obj->_flags |= OBJFLAG_HIDING;
+ obj->_flags &= ~flagMask;
+ if (obj->_flags & OBJFLAG_REMOVE) {
+ obj->_flags |= OBJFLAG_PANES;
+
+ checkIntersection(objList, objIndex, CURRENT_PANENUM);
+
+ obj->updateScreen();
+ obj->removeObject();
+
+ objList.remove_at(objIndex);
+ redrawFlag = true;
+ }
}
}
}
@@ -2807,6 +2811,7 @@ SceneText::SceneText() : SceneObject() {
_fontNumber = 2;
_width = 160;
_textMode = ALIGN_LEFT;
+ _color1 = 0;
_color2 = 0;
_color3 = 0;
}
@@ -2867,8 +2872,8 @@ void SceneText::synchronize(Serializer &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)
+ if ((g_vm->getGameID() == GType_Ringworld) || (_bounds.top < UI_INTERFACE_Y) ||
+ !T2_GLOBALS._uiElements._visible)
SceneObject::updateScreen();
}
@@ -2909,7 +2914,7 @@ void Visage::setVisage(int resNum, int rlbNum) {
// 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
+ // Games after Ringworld have an extra indirection via the visage index file
byte *indexData = g_resourceManager->getResource(RES_VISAGE, resNum, 9999);
if (rlbNum == 9999) {
_data = indexData;
@@ -2917,6 +2922,11 @@ void Visage::setVisage(int resNum, int rlbNum) {
if (rlbNum == 0)
rlbNum = 1;
+ // Check how many slots there are
+ uint16 count = READ_LE_UINT16(indexData);
+ if (rlbNum > count)
+ rlbNum = count;
+
// Get the flags/rlbNum to use
uint32 v = READ_LE_UINT32(indexData + (rlbNum - 1) * 4 + 2);
int flags = v >> 30;
@@ -2977,6 +2987,16 @@ Player::Player(): SceneObject() {
_enabled = false;
_uiEnabled = false;
_field8C = 0;
+
+ // Return to Ringworld specific fields
+ _characterIndex = R2_NONE;
+
+ for (int i = 0; i < MAX_CHARACTERS; ++i) {
+ _characterScene[i] = 0;
+ _characterStrip[i] = 0;
+ _characterFrame[i] = 0;
+ _oldCharacterScene[i] = 0;
+ }
}
void Player::postInit(SceneObjectList *OwnerList) {
@@ -2986,8 +3006,25 @@ void Player::postInit(SceneObjectList *OwnerList) {
_uiEnabled = true;
_percent = 100;
_field8C = 10;
- _moveDiff.x = 4;
- _moveDiff.y = 2;
+
+ if (g_vm->getGameID() != GType_Ringworld2)
+ {
+ _moveDiff.x = 4;
+ _moveDiff.y = 2;
+ }
+ else
+ {
+ _moveDiff.x = 3;
+ _moveDiff.y = 2;
+ _effect = 1;
+ _shade = 0;
+
+ setObjectWrapper(new SceneObjectWrapper());
+ setPosition(_characterPos[_characterIndex]);
+ setStrip(_characterStrip[_characterIndex]);
+ setFrame(_characterFrame[_characterIndex]);
+ _characterScene[_characterIndex] = GLOBALS._sceneManager._sceneNumber;
+ }
}
void Player::disableControl() {
@@ -2996,16 +3033,29 @@ void Player::disableControl() {
g_globals->_events.setCursor(CURSOR_NONE);
_enabled = false;
- if ((g_vm->getGameID() == GType_BlueForce) && BF_GLOBALS._uiElements._active)
- BF_GLOBALS._uiElements.hide();
+ if ((g_vm->getGameID() != GType_Ringworld) && T2_GLOBALS._uiElements._active)
+ T2_GLOBALS._uiElements.hide();
}
void Player::enableControl() {
+ CursorType cursor;
+
_canWalk = true;
_uiEnabled = true;
_enabled = true;
- if (g_vm->getGameID() == GType_Ringworld) {
+ switch (g_vm->getGameID()) {
+ case GType_BlueForce:
+ case GType_Ringworld2:
+ cursor = g_globals->_events.getCursor();
+ g_globals->_events.setCursor(cursor);
+
+ if (T2_GLOBALS._uiElements._active)
+ T2_GLOBALS._uiElements.show();
+ break;
+
+ default:
+ // Ringworld
g_globals->_events.setCursor(CURSOR_WALK);
switch (g_globals->_events.getCursor()) {
@@ -3019,15 +3069,15 @@ void Player::enableControl() {
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();
+ break;
}
}
+void Player::enableControl(CursorType cursor) {
+ enableControl();
+ R2_GLOBALS._events.setCursor(cursor);
+}
+
void Player::process(Event &event) {
if ((g_vm->getGameID() != GType_Ringworld) && _action)
_action->process(event);
@@ -3036,7 +3086,7 @@ void Player::process(Event &event) {
(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)
+ if ((g_vm->getGameID() != GType_Ringworld) && !BF_GLOBALS._player._enabled)
return;
PlayerMover *newMover = new PlayerMover();
@@ -3055,8 +3105,20 @@ void Player::synchronize(Serializer &s) {
s.syncAsByte(_uiEnabled);
s.syncAsSint16LE(_field8C);
- if (g_vm->getGameID() == GType_BlueForce)
+ if (g_vm->getGameID() != GType_Ringworld)
s.syncAsByte(_enabled);
+
+ if (g_vm->getGameID() == GType_Ringworld2) {
+ s.syncAsSint16LE(_characterIndex);
+ for (int i = 0; i < MAX_CHARACTERS; ++i) {
+ s.syncAsSint16LE(_characterScene[i]);
+ s.syncAsSint16LE(_oldCharacterScene[i]);
+ s.syncAsSint16LE(_characterPos[i].x);
+ s.syncAsSint16LE(_characterPos[i].y);
+ s.syncAsSint16LE(_characterStrip[i]);
+ s.syncAsSint16LE(_characterFrame[i]);
+ }
+ }
}
/*--------------------------------------------------------------------------*/
@@ -3498,6 +3560,7 @@ void WalkRegions::clear() {
_field18.clear();
_idxList.clear();
_idxList2.clear();
+ _disabledRegions.clear();
}
void WalkRegions::load(int sceneNum) {
@@ -3670,6 +3733,39 @@ int WalkRegions::indexOf(const Common::Point &pt, const Common::List<int> *index
return -1;
}
+void WalkRegions::synchronize(Serializer &s) {
+ // Synchronise the list of disabled regions as a list of values terminated with a '-1'
+ int regionId = 0;
+ if (s.isLoading()) {
+ _disabledRegions.clear();
+
+ s.syncAsSint16LE(regionId);
+ while (regionId != -1) {
+ _disabledRegions.push_back(regionId);
+ s.syncAsSint16LE(regionId);
+ }
+ } else {
+ Common::List<int>::iterator i;
+ for (i = _disabledRegions.begin(); i != _disabledRegions.end(); ++i) {
+ regionId = *i;
+ s.syncAsSint16LE(regionId);
+ }
+
+ regionId = -1;
+ s.syncAsSint16LE(regionId);
+ }
+}
+
+void WalkRegions::disableRegion(int regionId) {
+ if (!contains(_disabledRegions, regionId))
+ _disabledRegions.push_back(regionId);
+}
+
+void WalkRegions::enableRegion(int regionId) {
+ _disabledRegions.remove(regionId);
+}
+
+
/*--------------------------------------------------------------------------*/
void ScenePriorities::load(int resNum) {
@@ -3848,8 +3944,32 @@ void SceneHandler::process(Event &event) {
g_vm->_debugger->onFrame();
}
+ if ((event.eventType == EVENT_KEYPRESS) && g_globals->_player._enabled && g_globals->_player._canWalk) {
+ // Keyboard shortcuts for different actions
+ switch (event.kbd.keycode) {
+ case Common::KEYCODE_w:
+ g_globals->_events.setCursor(CURSOR_WALK);
+ event.handled = true;
+ break;
+ case Common::KEYCODE_l:
+ g_globals->_events.setCursor(CURSOR_LOOK);
+ event.handled = true;
+ break;
+ case Common::KEYCODE_u:
+ g_globals->_events.setCursor(CURSOR_USE);
+ event.handled = true;
+ break;
+ case Common::KEYCODE_t:
+ g_globals->_events.setCursor(CURSOR_TALK);
+ event.handled = true;
+ break;
+ default:
+ break;
+ }
+ }
+
// Mouse press handling
- bool enabled = (g_vm->getGameID() == GType_BlueForce) ? g_globals->_player._enabled :
+ bool enabled = (g_vm->getGameID() != GType_Ringworld) ? 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
@@ -3881,7 +4001,7 @@ void SceneHandler::process(Event &event) {
g_globals->_events.setCursor(CURSOR_USE);
}
- if (g_vm->getGameID() == GType_BlueForce)
+ if (g_vm->getGameID() != GType_Ringworld)
event.handled = true;
} else if (g_vm->getGameID() != GType_Ringworld) {
event.handled = true;
@@ -3937,7 +4057,7 @@ void SceneHandler::dispatch() {
do {
process(event);
} while (g_globals->_events.getEvent(event));
- } else if (g_vm->getGameID() == GType_BlueForce) {
+ } else if (g_vm->getGameID() != GType_Ringworld) {
// For Blue Force, 'none' events need to be generated in the absence of any
event.eventType = EVENT_NONE;
event.mousePos = g_globals->_events._mousePos;
diff --git a/engines/tsage/core.h b/engines/tsage/core.h
index 5d26b14265..cbd3d9f77c 100644
--- a/engines/tsage/core.h
+++ b/engines/tsage/core.h
@@ -62,8 +62,9 @@ public:
public:
InvObject(int sceneNumber, int rlbNum, int cursorNum, CursorType cursorId, const Common::String description);
InvObject(int visage, int strip, int frame);
+ InvObject(int visage, int strip);
- bool inInventory() const { return _sceneNumber == 1; }
+ bool inInventory() const;
void setCursor();
virtual Common::String getClassName() { return "InvObject"; }
@@ -128,7 +129,7 @@ public:
virtual void dispatch();
virtual void setAction(Action *action) { setAction(action, NULL); }
virtual void setAction(Action *action, EventHandler *endHandler, ...);
- virtual void destroy() {};
+ virtual void destroy() {}
};
class Action : public EventHandler {
@@ -321,6 +322,8 @@ public:
int _end;
int _rotationMode;
int _duration;
+ int _idxChange;
+ int _countdown;
public:
PaletteRotation();
@@ -371,6 +374,7 @@ public:
bool loadPalette(int paletteNum);
void refresh();
void setPalette(int index, int count);
+ void getEntry(int index, uint *r, uint *g, uint *b);
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);
@@ -417,6 +421,7 @@ public:
virtual void destroy() {}
virtual bool startAction(CursorType action, Event &event);
virtual void doAction(int action);
+ virtual bool performAction(CursorType action, Event &event) { return startAction(action, event); }
bool contains(const Common::Point &pt);
void setBounds(const Rect &newBounds) { _bounds = newBounds; }
@@ -445,32 +450,6 @@ public:
virtual void doAction(int action);
};
-class NamedHotspot : public SceneHotspot {
-public:
- int _resNum, _lookLineNum, _useLineNum, _talkLineNum;
- NamedHotspot();
-
-
- virtual bool startAction(CursorType action, Event &event);
- virtual Common::String getClassName() { return "NamedHotspot"; }
- virtual void synchronize(Serializer &s);
- 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,
ANIM_MODE_4 = 4, ANIM_MODE_5 = 5, ANIM_MODE_6 = 6, ANIM_MODE_7 = 7, ANIM_MODE_8 = 8,
// Introduced in Blue Force
@@ -555,6 +534,10 @@ public:
int _moveRate;
Action *_endAction;
uint32 _regionBitList;
+
+ // Ringworld 2 specific fields
+ int _shade;
+ int _effect;
public:
SceneObject();
SceneObject(const SceneObject &so);
@@ -602,8 +585,11 @@ public:
// New methods introduced by Blue Force
virtual void updateAngle(const Common::Point &pt);
virtual void changeAngle(int angle);
+ // New methods introduced by Ringworld 2
+ virtual void copy(SceneObject *src);
void setup(int visage, int stripFrameNum, int frameNum, int posX, int posY, int priority);
+ void setup(int visage, int stripFrameNum, int frameNum);
};
class BackgroundSceneObject: public SceneObject {
@@ -634,12 +620,23 @@ public:
virtual void updateScreen();
};
+#define MAX_CHARACTERS 4
+enum R2RCharacter { R2_NONE = 0, R2_QUINN = 1, R2_SEEKER = 2, R2_MIRANDA = 3 };
+
class Player : public SceneObject {
public:
bool _canWalk;
bool _uiEnabled;
int _field8C;
bool _enabled;
+
+ // Return to Ringworld specific fields
+ R2RCharacter _characterIndex;
+ int _characterScene[MAX_CHARACTERS];
+ int _oldCharacterScene[MAX_CHARACTERS];
+ Common::Point _characterPos[MAX_CHARACTERS];
+ int _characterStrip[MAX_CHARACTERS];
+ int _characterFrame[MAX_CHARACTERS];
public:
Player();
@@ -650,6 +647,7 @@ public:
void disableControl();
void enableControl();
+ void enableControl(CursorType cursor);
};
/*--------------------------------------------------------------------------*/
@@ -825,8 +823,11 @@ public:
Common::Array<WRField18> _field18;
Common::Array<int> _idxList;
Common::Array<int> _idxList2;
+ Common::List<int> _disabledRegions;
public:
WalkRegions() { _resNum = -1; }
+ virtual ~WalkRegions() {}
+ virtual void synchronize(Serializer &s);
void clear();
void load(int sceneNum);
@@ -835,8 +836,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"); }
+ void disableRegion(int regionId);
+ void enableRegion(int regionId);
};
/*--------------------------------------------------------------------------*/
diff --git a/engines/tsage/debugger.cpp b/engines/tsage/debugger.cpp
index a0e8b9edba..f7ba5c20f2 100644
--- a/engines/tsage/debugger.cpp
+++ b/engines/tsage/debugger.cpp
@@ -24,6 +24,8 @@
#include "tsage/globals.h"
#include "tsage/graphics.h"
#include "tsage/ringworld/ringworld_logic.h"
+#include "tsage/blue_force/blueforce_logic.h"
+#include "tsage/ringworld2/ringworld2_logic.h"
namespace TsAGE {
@@ -95,6 +97,10 @@ bool Debugger::Cmd_WalkRegions(int argc, const char **argv) {
for (uint regionIndex = 0; regionIndex < g_globals->_walkRegions._regionList.size(); ++regionIndex, ++color) {
WalkRegion &wr = g_globals->_walkRegions._regionList[regionIndex];
+ // Skip the region if it's in the list of explicitly disabled regions
+ if (contains(g_globals->_walkRegions._disabledRegions, (int)regionIndex + 1))
+ continue;
+
for (int yp = wr._bounds.top; yp < wr._bounds.bottom; ++yp) {
LineSliceSet sliceSet = wr.getLineSlices(yp);
@@ -269,10 +275,88 @@ bool Debugger::Cmd_ClearFlag(int argc, const char **argv) {
return true;
}
+/**
+ * Show any active hotspot areas in the scene
+ */
+bool Debugger::Cmd_Hotspots(int argc, const char **argv) {
+ int colIndex = 16;
+ const Rect &sceneBounds = g_globals->_sceneManager._scene->_sceneBounds;
+
+ // Lock the background surface for access
+ Graphics::Surface destSurface = g_globals->_sceneManager._scene->_backSurface.lockSurface();
+
+ // Iterate through the scene items
+ SynchronizedList<SceneItem *>::iterator i;
+ 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
+ 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 = g_globals->_sceneRegions.begin();
+ while ((ri != g_globals->_sceneRegions.end()) && ((*ri)._regionId != o->_sceneRegionId))
+ ++ri;
+
+ 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);
+
+ for (uint p = 0; p < set.items.size(); ++p)
+ destSurface.hLine(set.items[p].xs - sceneBounds.left, y - sceneBounds.top,
+ set.items[p].xe - sceneBounds.left - 1, colIndex);
+ }
+ }
+ }
+ }
+
+ // Release the surface
+ g_globals->_sceneManager._scene->_backSurface.unlockSurface();
+
+ // Mark the scene as requiring a full redraw
+ g_globals->_paneRefreshFlag[0] = 2;
+
+ return false;
+}
+
+/**
+ * Play the specified sound
+ */
+bool Debugger::Cmd_Sound(int argc, const char **argv) {
+ if (argc != 2) {
+ DebugPrintf("Usage: %s <sound number>\n", argv[0]);
+ return true;
+ }
+
+ int soundNum = strToInt(argv[1]);
+ g_globals->_soundHandler.play(soundNum);
+ return false;
+}
+
+/*
+ * This command lists the objects available, and their ID
+ */
+bool DemoDebugger::Cmd_ListObjects(int argc, const char **argv) {
+ DebugPrintf("Not available in Demo\n");
+ return true;
+}
+
+bool DemoDebugger::Cmd_MoveObject(int argc, const char **argv) {
+ DebugPrintf("Not available in Demo\n");
+ return true;
+}
+
/*
* This command lists the objects available, and their ID
*/
-bool Debugger::Cmd_ListObjects(int argc, const char **argv) {
+bool RingworldDebugger::Cmd_ListObjects(int argc, const char **argv) {
if (argc != 1) {
DebugPrintf("Usage: %s\n", argv[0]);
return true;
@@ -318,7 +402,7 @@ bool Debugger::Cmd_ListObjects(int argc, const char **argv) {
/*
* This command gets an item, or move it to a room
*/
-bool Debugger::Cmd_MoveObject(int argc, const char **argv) {
+bool RingworldDebugger::Cmd_MoveObject(int argc, const char **argv) {
// Check for a flag to clear
if ((argc < 2) || (argc > 3)){
DebugPrintf("Usage: %s <object number> [<scene number>]\n", argv[0]);
@@ -439,69 +523,188 @@ bool Debugger::Cmd_MoveObject(int argc, const char **argv) {
return true;
}
-/**
- * Show any active hotspot areas in the scene
+/*
+ * This command lists the objects available, and their ID
*/
-bool Debugger::Cmd_Hotspots(int argc, const char **argv) {
- int colIndex = 16;
- const Rect &sceneBounds = g_globals->_sceneManager._scene->_sceneBounds;
-
- // Lock the background surface for access
- Graphics::Surface destSurface = g_globals->_sceneManager._scene->_backSurface.lockSurface();
-
- // Iterate through the scene items
- SynchronizedList<SceneItem *>::iterator i;
- 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
- 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 = g_globals->_sceneRegions.begin();
- while ((ri != g_globals->_sceneRegions.end()) && ((*ri)._regionId != o->_sceneRegionId))
- ++ri;
+bool BlueForceDebugger::Cmd_ListObjects(int argc, const char **argv) {
+ if (argc != 1) {
+ DebugPrintf("Usage: %s\n", argv[0]);
+ return true;
+ }
- 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);
+ DebugPrintf("Available objects for this game are:\n");
+ DebugPrintf("1 - INV_COLT45\n");
+ DebugPrintf("2 - INV_AMMO_CLIP\n");
+ DebugPrintf("3 - INV_SPARE_CLIP\n");
+ DebugPrintf("4 - INV_HANDCUFFS\n");
+ DebugPrintf("5 - INV_GREENS_GUN\n");
+ DebugPrintf("6 - INV_TICKET_BOOK\n");
+ DebugPrintf("7 - INV_MIRANDA_CARD\n");
+ DebugPrintf("8 - INV_FOREST_RAP\n");
+ DebugPrintf("9 - INV_GREEN_ID\n");
+ DebugPrintf("10 - INV_BASEBALL_CARD\n");
+ DebugPrintf("11 - INV_BOOKING_GREEN\n");
+ DebugPrintf("12 - INV_FLARE\n");
+ DebugPrintf("13 - INV_COBB_RAP\n");
+ DebugPrintf("14 - INV_22_BULLET\n");
+ DebugPrintf("15 - INV_AUTO_RIFLE\n");
+ DebugPrintf("16 - INV_WIG\n");
+ DebugPrintf("17 - INV_FRANKIE_ID\n");
+ DebugPrintf("18 - INV_TYRONE_ID\n");
+ DebugPrintf("19 - INV_22_SNUB\n");
+ DebugPrintf("20 - INV_BOOKING_FRANKIE\n");
+ DebugPrintf("21 - INV_BOOKING_GANG\n");
+ DebugPrintf("22 - INV_FBI_TELETYPE\n");
+ DebugPrintf("23 - INV_DA_NOTE\n");
+ DebugPrintf("24 - INV_PRINT_OUT\n");
+ DebugPrintf("25 - INV_WAREHOUSE_KEYS\n");
+ DebugPrintf("26 - INV_CENTER_PUNCH\n");
+ DebugPrintf("27 - INV_TRANQ_GUN\n");
+ DebugPrintf("28 - INV_HOOK\n");
+ DebugPrintf("29 - INV_RAGS\n");
+ DebugPrintf("30 - INV_JAR\n");
+ DebugPrintf("31 - INV_SCREWDRIVER\n");
+ DebugPrintf("32 - INV_D_FLOPPY\n");
+ DebugPrintf("33 - INV_BLANK_DISK\n");
+ DebugPrintf("34 - INV_STICK\n");
+ DebugPrintf("35 - INV_CRATE1\n");
+ DebugPrintf("36 - INV_CRATE2\n");
+ DebugPrintf("37 - INV_SHOEBOX\n");
+ DebugPrintf("38 - INV_BADGE\n");
+ DebugPrintf("39 - INV_RENTAL_COUPON\n");
+ DebugPrintf("40 - INV_NICKEL\n");
+ DebugPrintf("41 - INV_LYLE_CARD\n");
+ DebugPrintf("42 - INV_CARTER_NOTE\n");
+ DebugPrintf("43 - INV_MUG_SHOT\n");
+ DebugPrintf("44 - INV_CLIPPING\n");
+ DebugPrintf("45 - INV_MICROFILM \n");
+ DebugPrintf("46 - INV_WAVE_KEYS\n");
+ DebugPrintf("47 - INV_RENTAL_KEYS\n");
+ DebugPrintf("48 - INV_NAPKIN\n");
+ DebugPrintf("49 - INV_DMV_PRINTOUT\n");
+ DebugPrintf("50 - INV_FISHING_NET\n");
+ DebugPrintf("51 - INV_ID\n");
+ DebugPrintf("52 - INV_9MM_BULLETS\n");
+ DebugPrintf("53 - INV_SCHEDULE\n");
+ DebugPrintf("54 - INV_GRENADES\n");
+ DebugPrintf("55 - INV_YELLOW_CORD\n");
+ DebugPrintf("56 - INV_HALF_YELLOW_CORD\n");
+ DebugPrintf("57 - INV_BLACK_CORD\n");
+ DebugPrintf("58 - INV_HALF_BLACK_CORD\n");
+ DebugPrintf("59 - INV_WARRANT\n");
+ DebugPrintf("60 - INV_JACKET\n");
+ DebugPrintf("61 - INV_GREENS_KNIFE\n");
+ DebugPrintf("62 - INV_DOG_WHISTLE\n");
+ DebugPrintf("63 - INV_AMMO_BELT\n");
+ DebugPrintf("64 - INV_CARAVAN_KEY\n");
+ return true;
+}
- for (uint p = 0; p < set.items.size(); ++p)
- destSurface.hLine(set.items[p].xs - sceneBounds.left, y - sceneBounds.top,
- set.items[p].xe - sceneBounds.left - 1, colIndex);
- }
- }
- }
+bool BlueForceDebugger::Cmd_MoveObject(int argc, const char **argv) {
+ // Check for a flag to clear
+ if ((argc < 2) || (argc > 3)){
+ DebugPrintf("Usage: %s <object number> [<scene number>]\n", argv[0]);
+ DebugPrintf("If no scene is specified, the object will be added to inventory\n");
+ return true;
}
- // Release the surface
- g_globals->_sceneManager._scene->_backSurface.unlockSurface();
+ int objNum = strToInt(argv[1]);
+ int sceneNum = 1;
+ if (argc == 3)
+ sceneNum = strToInt(argv[2]);
- // Mark the scene as requiring a full redraw
- g_globals->_paneRefreshFlag[0] = 2;
+ if ((objNum > 0) && (objNum < 65))
+ BF_INVENTORY.setObjectScene(objNum, sceneNum);
+ else
+ DebugPrintf("Invalid object Id %s\n", argv[1]);
- return false;
+ return true;
}
-/**
- * Play the specified sound
+/*
+ * This command lists the objects available, and their ID
*/
-bool Debugger::Cmd_Sound(int argc, const char **argv) {
- if (argc != 2) {
- DebugPrintf("Usage: %s <sound number>\n", argv[0]);
+bool Ringworld2Debugger::Cmd_ListObjects(int argc, const char **argv) {
+ if (argc != 1) {
+ DebugPrintf("Usage: %s\n", argv[0]);
return true;
}
- int soundNum = strToInt(argv[1]);
- g_globals->_soundHandler.play(soundNum);
- return false;
+ DebugPrintf("Available objects for this game are:\n");
+ DebugPrintf("1 - R2_OPTO_DISK\n");
+ DebugPrintf("2 - R2_2\n");
+ DebugPrintf("3 - R2_NEGATOR_GUN\n");
+ DebugPrintf("4 - R2_STEPPING_DISKS\n");
+ DebugPrintf("5 - R2_5\n");
+ DebugPrintf("6 - R2_6\n");
+ DebugPrintf("7 - R2_7\n");
+ DebugPrintf("8 - R2_8\n");
+ DebugPrintf("9 - R2_9\n");
+ DebugPrintf("10 - R2_10\n");
+ DebugPrintf("11 - R2_11\n");
+ DebugPrintf("12 - R2_12\n");
+ DebugPrintf("13 - R2_13\n");
+ DebugPrintf("14 - R2_14\n");
+ DebugPrintf("15 - R2_15\n");
+ DebugPrintf("16 - R2_16\n");
+ DebugPrintf("17 - R2_17\n");
+ DebugPrintf("18 - R2_18\n");
+ DebugPrintf("19 - R2_19\n");
+ DebugPrintf("20 - R2_20\n");
+ DebugPrintf("21 - R2_21\n");
+ DebugPrintf("22 - R2_22\n");
+ DebugPrintf("23 - R2_23\n");
+ DebugPrintf("24 - R2_24\n");
+ DebugPrintf("25 - R2_25\n");
+ DebugPrintf("26 - R2_26\n");
+ DebugPrintf("27 - R2_27\n");
+ DebugPrintf("28 - R2_28\n");
+ DebugPrintf("29 - R2_29\n");
+ DebugPrintf("30 - R2_30\n");
+ DebugPrintf("31 - R2_31\n");
+ DebugPrintf("32 - R2_32\n");
+ DebugPrintf("33 - R2_33\n");
+ DebugPrintf("34 - R2_34\n");
+ DebugPrintf("35 - R2_35\n");
+ DebugPrintf("36 - R2_36\n");
+ DebugPrintf("37 - R2_37\n");
+ DebugPrintf("38 - R2_38\n");
+ DebugPrintf("39 - R2_39\n");
+ DebugPrintf("40 - R2_40\n");
+ DebugPrintf("41 - R2_41\n");
+ DebugPrintf("42 - R2_42\n");
+ DebugPrintf("43 - R2_43\n");
+ DebugPrintf("44 - R2_44\n");
+ DebugPrintf("45 - R2_45\n");
+ DebugPrintf("46 - R2_46\n");
+ DebugPrintf("47 - R2_47\n");
+ DebugPrintf("48 - R2_48\n");
+ DebugPrintf("49 - R2_49\n");
+ DebugPrintf("50 - R2_50\n");
+ DebugPrintf("51 - R2_51\n");
+ DebugPrintf("52 - R2_52\n");
+
+ return true;
}
+bool Ringworld2Debugger::Cmd_MoveObject(int argc, const char **argv) {
+ // Check for a flag to clear
+ if ((argc < 2) || (argc > 3)){
+ DebugPrintf("Usage: %s <object number> [<scene number>]\n", argv[0]);
+ DebugPrintf("If no scene is specified, the object will be added to inventory\n");
+ return true;
+ }
+
+ int objNum = strToInt(argv[1]);
+ int sceneNum = 1;
+ if (argc == 3)
+ sceneNum = strToInt(argv[2]);
+
+ if ((objNum > 0) && (objNum < 53))
+ R2_INVENTORY.setObjectScene(objNum, sceneNum);
+ else
+ DebugPrintf("Invalid object Id %s\n", argv[1]);
+
+ return true;
+}
} // End of namespace TsAGE
diff --git a/engines/tsage/debugger.h b/engines/tsage/debugger.h
index fcdbc2d243..bf826a3f77 100644
--- a/engines/tsage/debugger.h
+++ b/engines/tsage/debugger.h
@@ -41,10 +41,34 @@ protected:
bool Cmd_SetFlag(int argc, const char **argv);
bool Cmd_GetFlag(int argc, const char **argv);
bool Cmd_ClearFlag(int argc, const char **argv);
- bool Cmd_ListObjects(int argc, const char **argv);
- bool Cmd_MoveObject(int argc, const char **argv);
bool Cmd_Hotspots(int argc, const char **argv);
bool Cmd_Sound(int argc, const char **argv);
+ virtual bool Cmd_ListObjects(int argc, const char **argv) = 0;
+ virtual bool Cmd_MoveObject(int argc, const char **argv) = 0;
+};
+
+class DemoDebugger : public Debugger {
+protected:
+ virtual bool Cmd_ListObjects(int argc, const char **argv);
+ virtual bool Cmd_MoveObject(int argc, const char **argv);
+};
+
+class RingworldDebugger : public Debugger {
+protected:
+ virtual bool Cmd_ListObjects(int argc, const char **argv);
+ virtual bool Cmd_MoveObject(int argc, const char **argv);
+};
+
+class BlueForceDebugger : public Debugger {
+protected:
+ virtual bool Cmd_ListObjects(int argc, const char **argv);
+ virtual bool Cmd_MoveObject(int argc, const char **argv);
+};
+
+class Ringworld2Debugger : public Debugger {
+protected:
+ virtual bool Cmd_ListObjects(int argc, const char **argv);
+ virtual bool Cmd_MoveObject(int argc, const char **argv);
};
} // End of namespace TsAGE
diff --git a/engines/tsage/detection.cpp b/engines/tsage/detection.cpp
index 44a25085fa..12add10c58 100644
--- a/engines/tsage/detection.cpp
+++ b/engines/tsage/detection.cpp
@@ -61,6 +61,7 @@ static const PlainGameDescriptor tSageGameTitles[] = {
{ "tsage", "Tsunami TsAGE-based Game" },
{ "ringworld", "Ringworld: Revenge of the Patriarch" },
{ "blueforce", "Blue Force" },
+ { "ringworld2", "Return to Ringworld" },
{ 0, 0 }
};
@@ -75,7 +76,7 @@ public:
TSageMetaEngine() : AdvancedMetaEngine(TsAGE::gameDescriptions, sizeof(TsAGE::tSageGameDescription), tSageGameTitles) {
_md5Bytes = 5000;
_singleid = "tsage";
- _guioptions = Common::GUIO_NOSPEECH;
+ _guioptions = GUIO1(GUIO_NOSPEECH);
}
virtual const char *getName() const {
diff --git a/engines/tsage/detection_tables.h b/engines/tsage/detection_tables.h
index 4b69549673..d6b1760b80 100644
--- a/engines/tsage/detection_tables.h
+++ b/engines/tsage/detection_tables.h
@@ -32,8 +32,8 @@ static const tSageGameDescription gameDescriptions[] = {
AD_ENTRY1s("ring.rlb", "466f0e6492d9d0f34d35c5cd088de90f", 37847618),
Common::EN_ANY,
Common::kPlatformPC,
- ADGF_TESTING | ADGF_CD,
- Common::GUIO_NOSPEECH | Common::GUIO_NOSFX
+ ADGF_CD,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOSFX)
},
GType_Ringworld,
GF_CD | GF_ALT_REGIONS
@@ -46,8 +46,8 @@ static const tSageGameDescription gameDescriptions[] = {
AD_ENTRY1s("ring.rlb", "cb8bba91b30cd172712371d7123bd763", 7427980),
Common::ES_ESP,
Common::kPlatformPC,
- ADGF_TESTING | ADGF_CD,
- Common::GUIO_NOSPEECH | Common::GUIO_NOSFX
+ ADGF_CD,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOSFX)
},
GType_Ringworld,
GF_CD | GF_ALT_REGIONS
@@ -60,8 +60,8 @@ static const tSageGameDescription gameDescriptions[] = {
AD_ENTRY1s("ring.rlb", "7b7f0c5b37b58fa5ec06ebb2ca0d0d9d", 8438770),
Common::EN_ANY,
Common::kPlatformPC,
- ADGF_TESTING,
- Common::GUIO_NOSPEECH | Common::GUIO_NOSFX
+ ADGF_NO_FLAGS,
+ GUIO2(GUIO_NOSPEECH, GUIO_NOSFX)
},
GType_Ringworld,
GF_FLOPPY
@@ -75,7 +75,7 @@ static const tSageGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- Common::GUIO_NOSPEECH | Common::GUIO_NOSFX
+ GUIO2(GUIO_NOSPEECH, GUIO_NOSFX)
},
GType_Ringworld,
GF_FLOPPY | GF_DEMO
@@ -90,7 +90,7 @@ static const tSageGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO,
- Common::GUIO_NOSPEECH | Common::GUIO_NOSFX
+ GUIO2(GUIO_NOSPEECH, GUIO_NOSFX)
},
GType_Ringworld,
GF_FLOPPY | GF_DEMO | GF_ALT_REGIONS
@@ -106,7 +106,7 @@ static const tSageGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_UNSTABLE,
- Common::GUIO_NOSPEECH | Common::GUIO_NOSFX
+ GUIO2(GUIO_NOSPEECH, GUIO_NOSFX)
},
GType_BlueForce,
GF_FLOPPY
@@ -121,7 +121,7 @@ static const tSageGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_UNSTABLE,
- Common::GUIO_NOSPEECH | Common::GUIO_NOSFX
+ GUIO2(GUIO_NOSPEECH, GUIO_NOSFX)
},
GType_BlueForce,
GF_FLOPPY | GF_ALT_REGIONS
@@ -135,11 +135,27 @@ static const tSageGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_CD | ADGF_UNSTABLE,
- Common::GUIO_NOSPEECH | Common::GUIO_NOSFX
+ GUIO2(GUIO_NOSPEECH, GUIO_NOSFX)
},
GType_BlueForce,
GF_CD | GF_ALT_REGIONS
},
+
+ // Return to Ringworld
+ {
+ {
+ "ringworld2",
+ "CD",
+ AD_ENTRY1s("r2rw.rlb", "df6c25622387007788ca36d99362c1f0", 47586928),
+ Common::EN_ANY,
+ Common::kPlatformPC,
+ ADGF_CD | ADGF_UNSTABLE,
+ GUIO0()
+ },
+ GType_Ringworld2,
+ GF_CD | GF_ALT_REGIONS
+ },
+
{ AD_TABLE_END_MARKER, 0, 0 }
};
diff --git a/engines/tsage/dialogs.cpp b/engines/tsage/dialogs.cpp
index 002835e76b..972d591c34 100644
--- a/engines/tsage/dialogs.cpp
+++ b/engines/tsage/dialogs.cpp
@@ -181,242 +181,6 @@ void ModalDialog::drawFrame() {
/*--------------------------------------------------------------------------*/
-bool GfxInvImage::process(Event &event) {
- if (!event.handled && (event.eventType == EVENT_BUTTON_DOWN)) {
- event.handled = _bounds.contains(event.mousePos);
- return event.handled;
- }
-
- return false;
-}
-
-/*--------------------------------------------------------------------------*/
-
-void InventoryDialog::show() {
- // Determine how many items are in the player's inventory
- int itemCount = 0;
- SynchronizedList<InvObject *>::iterator i;
- for (i = RING_INVENTORY._itemList.begin(); i != RING_INVENTORY._itemList.end(); ++i) {
- if ((*i)->inInventory())
- ++itemCount;
- }
-
- if (itemCount == 0) {
- MessageDialog::show(INV_EMPTY_MSG, OK_BTN_STRING);
- return;
- }
-
- InventoryDialog *dlg = new InventoryDialog();
- dlg->draw();
- dlg->execute();
- delete dlg;
-}
-
-InventoryDialog::InventoryDialog() {
- // Determine the maximum size of the image of any item in the player's inventory
- int imgWidth = 0, imgHeight = 0;
-
- SynchronizedList<InvObject *>::iterator i;
- for (i = RING_INVENTORY._itemList.begin(); i != RING_INVENTORY._itemList.end(); ++i) {
- InvObject *invObject = *i;
- if (invObject->inInventory()) {
- // Get the image for the item
- GfxSurface itemSurface = surfaceFromRes(invObject->_displayResNum, invObject->_rlbNum, invObject->_cursorNum);
-
- // Maintain the dimensions of the largest item image
- imgWidth = MAX(imgWidth, (int)itemSurface.getBounds().width());
- imgHeight = MAX(imgHeight, (int)itemSurface.getBounds().height());
-
- // Add the item to the display list
- GfxInvImage *img = new GfxInvImage();
- _images.push_back(img);
- img->setDetails(invObject->_displayResNum, invObject->_rlbNum, invObject->_cursorNum);
- img->_invObject = invObject;
- add(img);
- }
- }
- assert(_images.size() > 0);
-
- // Figure out the number of columns/rows to show all the items
- int cellsSize = 3;
- while ((cellsSize * cellsSize) < (int)_images.size())
- ++cellsSize;
-
- // Set the position of each inventory item to be displayed
- int cellX = 0;
- Common::Point pt(0, 0);
-
- for (uint idx = 0; idx < _images.size(); ++idx) {
- if (cellX == cellsSize) {
- // Move to the start of the next line
- pt.x = 0;
- pt.y += imgHeight + 2;
- cellX = 0;
- }
-
- _images[idx]->_bounds.moveTo(pt.x, pt.y);
-
- pt.x += imgWidth + 2;
- ++cellX;
- }
-
- // Set up the buttons
- pt.y += imgHeight + 2;
- _btnOk.setText(OK_BTN_STRING);
- _btnOk._bounds.moveTo((imgWidth + 2) * cellsSize - _btnOk._bounds.width(), pt.y);
- _btnLook.setText(LOOK_BTN_STRING);
- _btnLook._bounds.moveTo(_btnOk._bounds.left - _btnLook._bounds.width() - 2, _btnOk._bounds.top);
- addElements(&_btnLook, &_btnOk, NULL);
-
- frame();
- setCenter(SCREEN_CENTER_X, SCREEN_CENTER_Y);
-}
-
-InventoryDialog::~InventoryDialog() {
- for (uint idx = 0; idx < _images.size(); ++idx)
- delete _images[idx];
-}
-
-void InventoryDialog::execute() {
- if ((RING_INVENTORY._selectedItem) && RING_INVENTORY._selectedItem->inInventory())
- RING_INVENTORY._selectedItem->setCursor();
-
- GfxElement *hiliteObj;
- bool lookFlag = false;
- _gfxManager.activate();
-
- while (!g_vm->shouldQuit()) {
- // Get events
- Event event;
- while (!g_globals->_events.getEvent(event) && !g_vm->shouldQuit()) {
- g_system->delayMillis(10);
- g_system->updateScreen();
- }
- if (g_vm->shouldQuit())
- break;
-
- hiliteObj = NULL;
- if ((event.eventType == EVENT_BUTTON_DOWN) && !_bounds.contains(event.mousePos))
- break;
-
- // Pass event to elements
- event.mousePos.x -= _gfxManager._bounds.left;
- event.mousePos.y -= _gfxManager._bounds.top;
-
- for (GfxElementList::iterator i = _elements.begin(); i != _elements.end(); ++i) {
- if ((*i)->process(event))
- hiliteObj = *i;
- }
-
- if (!event.handled && event.eventType == EVENT_KEYPRESS) {
- if ((event.kbd.keycode == Common::KEYCODE_RETURN) || (event.kbd.keycode == Common::KEYCODE_ESCAPE)) {
- // Exit the dialog
- //hiliteObj = &_btnOk;
- break;
- }
- }
-
- if (hiliteObj == &_btnOk) {
- // Ok button clicked
- if (lookFlag)
- 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;
- g_globals->_events.setCursor(CURSOR_LOOK);
- } else {
- _btnLook._message = LOOK_BTN_STRING;
- lookFlag = 0;
- g_globals->_events.setCursor(CURSOR_WALK);
- }
-
- hiliteObj->draw();
- } else if (hiliteObj) {
- // Inventory item selected
- InvObject *invObject = static_cast<GfxInvImage *>(hiliteObj)->_invObject;
- if (lookFlag) {
- g_globals->_screenSurface.displayText(invObject->_description);
- } else {
- RING_INVENTORY._selectedItem = invObject;
- invObject->setCursor();
- }
- }
- }
-
- _gfxManager.deactivate();
-}
-
-/*--------------------------------------------------------------------------*/
-
-void OptionsDialog::show() {
- OptionsDialog *dlg = new OptionsDialog();
- dlg->draw();
-
- GfxButton *btn = dlg->execute();
-
- if (btn == &dlg->_btnQuit) {
- // Quit game
- if (MessageDialog::show(QUIT_CONFIRM_MSG, CANCEL_BTN_STRING, QUIT_BTN_STRING) == 1) {
- g_vm->quitGame();
- }
- } else if (btn == &dlg->_btnRestart) {
- // Restart game
- g_globals->_game->restartGame();
- } else if (btn == &dlg->_btnSound) {
- // Sound dialog
- SoundDialog::execute();
- } else if (btn == &dlg->_btnSave) {
- // Save button
- g_globals->_game->saveGame();
- } else if (btn == &dlg->_btnRestore) {
- // Restore button
- g_globals->_game->restoreGame();
- }
-
- dlg->remove();
- delete dlg;
-}
-
-OptionsDialog::OptionsDialog() {
- // Set the element text
- _gfxMessage.set(OPTIONS_MSG, 140, ALIGN_LEFT);
- _btnRestore.setText(RESTORE_BTN_STRING);
- _btnSave.setText(SAVE_BTN_STRING);
- _btnRestart.setText(RESTART_BTN_STRING);
- _btnQuit.setText(QUIT_BTN_STRING);
- _btnSound.setText(SOUND_BTN_STRING);
- _btnResume.setText(RESUME_BTN_STRING);
-
- // Set position of the elements
- _gfxMessage._bounds.moveTo(0, 1);
- _btnRestore._bounds.moveTo(0, _gfxMessage._bounds.bottom + 1);
- _btnSave._bounds.moveTo(0, _btnRestore._bounds.bottom + 1);
- _btnRestart._bounds.moveTo(0, _btnSave._bounds.bottom + 1);
- _btnQuit._bounds.moveTo(0, _btnRestart._bounds.bottom + 1);
- _btnSound._bounds.moveTo(0, _btnQuit._bounds.bottom + 1);
- _btnResume._bounds.moveTo(0, _btnSound._bounds.bottom + 1);
-
- // Set all the buttons to the widest button
- GfxButton *btnList[6] = {&_btnRestore, &_btnSave, &_btnRestart, &_btnQuit, &_btnSound, &_btnResume};
- int16 btnWidth = 0;
- for (int idx = 0; idx < 6; ++idx)
- btnWidth = MAX(btnWidth, btnList[idx]->_bounds.width());
- for (int idx = 0; idx < 6; ++idx)
- btnList[idx]->_bounds.setWidth(btnWidth);
-
- // Add the items to the dialog
- addElements(&_gfxMessage, &_btnRestore, &_btnSave, &_btnRestart, &_btnQuit, &_btnSound, &_btnResume, NULL);
-
- // Set the dialog size and position
- frame();
- setCenter(160, 100);
-}
-
-/*--------------------------------------------------------------------------*/
-
void SoundDialog::execute() {
ConfigDialog *dlg = new ConfigDialog();
dlg->runModal();
diff --git a/engines/tsage/dialogs.h b/engines/tsage/dialogs.h
index 35ed60ba1a..33b55093d0 100644
--- a/engines/tsage/dialogs.h
+++ b/engines/tsage/dialogs.h
@@ -60,47 +60,6 @@ public:
/*--------------------------------------------------------------------------*/
-class GfxInvImage : public GfxImage {
-public:
- InvObject *_invObject;
-public:
- GfxInvImage() : GfxImage(), _invObject(NULL) {}
-
- virtual bool process(Event &event);
-};
-
-#define MAX_INVOBJECT_DISPLAY 20
-
-class InventoryDialog : public ModalDialog {
-private:
- Common::Array<GfxInvImage *> _images;
- GfxButton _btnOk, _btnLook;
-public:
- InventoryDialog();
- virtual ~InventoryDialog();
- void execute();
-
- static void show();
-};
-
-/*--------------------------------------------------------------------------*/
-
-class OptionsDialog : public ModalDialog {
-private:
- GfxButton _btnSave, _btnRestore, _btnRestart;
- GfxButton _btnQuit, _btnResume;
- GfxButton _btnSound;
- GfxMessage _gfxMessage;
-public:
- OptionsDialog();
- virtual ~OptionsDialog() {}
- GfxButton *execute() { return GfxDialog::execute(&_btnResume); }
-
- static void show();
-};
-
-/*--------------------------------------------------------------------------*/
-
class SoundDialog {
public:
static void execute();
diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp
index 940709c8c7..ac08997563 100644
--- a/engines/tsage/events.cpp
+++ b/engines/tsage/events.cpp
@@ -156,7 +156,7 @@ void EventsClass::setCursor(CursorType cursorType) {
// No cursor
g_globals->setFlag(122);
- if ((g_vm->getFeatures() & GF_DEMO) || (g_vm->getGameID() == GType_BlueForce)) {
+ if ((g_vm->getFeatures() & GF_DEMO) || (g_vm->getGameID() != GType_Ringworld)) {
CursorMan.showMouse(false);
return;
}
@@ -165,10 +165,13 @@ void EventsClass::setCursor(CursorType cursorType) {
case CURSOR_LOOK:
// Look cursor
- if (g_vm->getGameID() == GType_BlueForce)
+ if (g_vm->getGameID() == GType_BlueForce) {
cursor = g_resourceManager->getSubResource(1, 5, 3, &size);
- else
+ } else if (g_vm->getGameID() == GType_Ringworld2) {
+ cursor = g_resourceManager->getSubResource(5, 1, 5, &size);
+ } else {
cursor = g_resourceManager->getSubResource(4, 1, 5, &size);
+ }
_currentCursor = CURSOR_LOOK;
break;
@@ -176,6 +179,8 @@ void EventsClass::setCursor(CursorType cursorType) {
// Use cursor
if (g_vm->getGameID() == GType_BlueForce) {
cursor = g_resourceManager->getSubResource(1, 5, 2, &size);
+ } else if (g_vm->getGameID() == GType_Ringworld2) {
+ cursor = g_resourceManager->getSubResource(5, 1, 4, &size);
} else {
cursor = g_resourceManager->getSubResource(4, 1, 4, &size);
}
@@ -186,6 +191,8 @@ void EventsClass::setCursor(CursorType cursorType) {
// Talk cursor
if (g_vm->getGameID() == GType_BlueForce) {
cursor = g_resourceManager->getSubResource(1, 5, 4, &size);
+ } else if (g_vm->getGameID() == GType_Ringworld2) {
+ cursor = g_resourceManager->getSubResource(5, 1, 6, &size);
} else {
cursor = g_resourceManager->getSubResource(4, 1, 3, &size);
}
@@ -214,7 +221,8 @@ void EventsClass::setCursor(CursorType cursorType) {
case CURSOR_WALK:
default:
- if (g_vm->getGameID() == GType_BlueForce) {
+ switch (g_vm->getGameID()) {
+ case GType_BlueForce:
if (cursorType == CURSOR_WALK) {
cursor = g_resourceManager->getSubResource(1, 5, 1, &size);
} else {
@@ -224,13 +232,45 @@ void EventsClass::setCursor(CursorType cursorType) {
questionEnabled = true;
}
_currentCursor = cursorType;
- } else {
+ break;
+ case GType_Ringworld2:
+ if (cursorType == CURSOR_WALK) {
+ cursor = CURSOR_WALK_DATA;
+ delFlag = false;
+ } else {
+ // Inventory icon
+ InvObject *invObject = g_globals->_inventory->getItem((int)cursorType);
+ cursor = g_resourceManager->getSubResource(6, invObject->_strip, invObject->_frame, &size);
+ questionEnabled = true;
+ }
+ _currentCursor = cursorType;
+ break;
+ default:
// For Ringworld, always treat as the walk cursor
cursor = CURSOR_WALK_DATA;
_currentCursor = CURSOR_WALK;
delFlag = false;
+ break;
}
break;
+
+ // Ringworld 2 specific cursors
+ case EXITCURSOR_N:
+ case EXITCURSOR_S:
+ case EXITCURSOR_W:
+ case EXITCURSOR_E:
+ case EXITCURSOR_LEFT_HAND:
+ case CURSOR_INVALID:
+ case EXITCURSOR_NE:
+ case EXITCURSOR_SE:
+ case EXITCURSOR_SW:
+ case EXITCURSOR_NW:
+ case SHADECURSOR_UP:
+ case SHADECURSOR_DOWN:
+ case SHADECURSOR_HAND:
+ _currentCursor = cursorType;
+ cursor = g_resourceManager->getSubResource(5, 1, cursorType - R2CURSORS_START, &size);
+ break;
}
// Decode the cursor
@@ -244,9 +284,9 @@ 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);
+ // For Blue Force and Return to Ringworld, enable the question button when an inventory icon is selected
+ if (g_vm->getGameID() != GType_Ringworld)
+ T2_GLOBALS._uiElements._question.setEnabled(questionEnabled);
}
void EventsClass::pushCursor(CursorType cursorType) {
@@ -313,7 +353,6 @@ void EventsClass::setCursor(Graphics::Surface &cursor, int transColor, const Com
}
void EventsClass::setCursor(GfxSurface &cursor) {
- // TODO: Find proper parameters for this form in Blue Force
Graphics::Surface s = cursor.lockSurface();
const byte *cursorData = (const byte *)s.getBasePtr(0, 0);
diff --git a/engines/tsage/events.h b/engines/tsage/events.h
index 0195b2fc7b..1942c98901 100644
--- a/engines/tsage/events.h
+++ b/engines/tsage/events.h
@@ -80,7 +80,23 @@ enum CursorType {
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,
+ INV_CARAVAN_KEY = 67, BF_LAST_INVENT = 68,
+
+ // Ringworld 2 objects
+ R2_OPTO_DISK = 1, R2_2 = 2, R2_NEGATOR_GUN = 3, R2_STEPPING_DISKS = 4, R2_5 = 5, R2_6 = 6,
+ R2_7 = 7, R2_8 = 8, R2_9 = 9, R2_10 = 10, R2_11 = 11, R2_12 = 12, R2_13 = 13, R2_14 = 14,
+ R2_15 = 15, R2_16 = 16, R2_17 = 17, R2_18 = 18, R2_19 = 19, R2_20 = 20, R2_21 = 21,
+ R2_22 = 22, R2_23 = 23, R2_24 = 24, R2_25 = 25, R2_26 = 26, R2_27 = 27, R2_28 = 28,
+ R2_29 = 29, R2_30 = 30, R2_31 = 31, R2_32 = 32, R2_33 = 33, R2_34 = 34, R2_35 = 35,
+ R2_36 = 36, R2_37 = 37, R2_38 = 38, R2_39 = 39, R2_40 = 40, R2_41 = 41, R2_42 = 42,
+ R2_43 = 43, R2_44 = 44, R2_45 = 45, R2_46 = 46, R2_47 = 47, R2_48 = 48, R2_49 = 49,
+ R2_50 = 50, R2_51 = 51, R2_52 = 52,
+
+ // Ringworld 2 cursors
+ R2CURSORS_START = 0x8000, EXITCURSOR_N = 0x8007, EXITCURSOR_S = 0x8008, EXITCURSOR_W = 0x8009,
+ EXITCURSOR_E = 0x800A, EXITCURSOR_LEFT_HAND = 0x800B, CURSOR_INVALID = 0x800C,
+ EXITCURSOR_NE = 0x800D, EXITCURSOR_SE = 0x800E, EXITCURSOR_SW = 0x800F, EXITCURSOR_NW = 0x8010,
+ SHADECURSOR_UP = 0x8011, SHADECURSOR_DOWN = 0x8012, SHADECURSOR_HAND = 0x8013,
// Cursors
CURSOR_WALK = 0x100, CURSOR_LOOK = 0x200, CURSOR_700 = 700, CURSOR_USE = 0x400, CURSOR_TALK = 0x800,
diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp
index 788ab71b76..769ad4c054 100644
--- a/engines/tsage/globals.cpp
+++ b/engines/tsage/globals.cpp
@@ -25,6 +25,7 @@
#include "tsage/blue_force/blueforce_logic.h"
#include "tsage/ringworld/ringworld_demo.h"
#include "tsage/ringworld/ringworld_logic.h"
+#include "tsage/ringworld2/ringworld2_logic.h"
namespace TsAGE {
@@ -75,6 +76,17 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface
_fontColors.background = 88;
_fontColors.foreground = 92;
_dialogCenter.y = 140;
+ } else if (g_vm->getGameID() == GType_Ringworld2) {
+ // Return to Ringworld
+ _gfxFontNumber = 50;
+ _gfxColors.background = 0;
+ _gfxColors.foreground = 59;
+ _fontColors.background = 4;
+ _fontColors.foreground = 15;
+ _color1 = 59;
+ _color2 = 15;
+ _color3 = 4;
+ _dialogCenter.y = 100;
} else if ((g_vm->getGameID() == GType_Ringworld) && (g_vm->getFeatures() & GF_CD)) {
_gfxFontNumber = 50;
_gfxColors.background = 53;
@@ -85,6 +97,7 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface
_color2 = 18;
_color3 = 18;
} else {
+ // Ringworld
_gfxFontNumber = 50;
_gfxColors.background = 53;
_gfxColors.foreground = 18;
@@ -124,6 +137,12 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface
_inventory = new BlueForce::BlueForceInvObjectList();
_sceneHandler = new BlueForce::SceneHandlerExt();
break;
+
+ case GType_Ringworld2:
+ _inventory = new Ringworld2::Ringworld2InvObjectList();
+ _game = new Ringworld2::Ringworld2Game();
+ _sceneHandler = new Ringworld2::SceneHandlerExt();
+ break;
}
}
@@ -136,7 +155,7 @@ Globals::~Globals() {
}
void Globals::reset() {
- Common::set_to(&_flags[0], &_flags[MAX_FLAGS], false);
+ Common::fill(&_flags[0], &_flags[MAX_FLAGS], false);
g_saver->addFactory(classFactoryProc);
}
@@ -169,6 +188,9 @@ void Globals::synchronize(Serializer &s) {
s.syncAsSint16LE(_prevSceneOffset.x); s.syncAsSint16LE(_prevSceneOffset.y);
SYNC_POINTER(_scrollFollower);
s.syncAsSint32LE(_stripNum);
+
+ if (s.getVersion() >= 8)
+ _walkRegions.synchronize(s);
}
void Globals::dispatchSound(ASound *obj) {
@@ -181,38 +203,71 @@ void Globals::dispatchSounds() {
/*--------------------------------------------------------------------------*/
+void TsAGE2Globals::reset() {
+ Globals::reset();
+
+ // Reset the inventory
+ T2_GLOBALS._uiElements.updateInventory();
+ T2_GLOBALS._uiElements._scoreValue = 0;
+ T2_GLOBALS._uiElements._active = false;
+}
+
+void TsAGE2Globals::synchronize(Serializer &s) {
+ Globals::synchronize(s);
+
+ s.syncAsSint16LE(_interfaceY);
+}
+
+/*--------------------------------------------------------------------------*/
+
namespace BlueForce {
-BlueForceGlobals::BlueForceGlobals(): Globals() {
+BlueForceGlobals::BlueForceGlobals(): TsAGE2Globals() {
}
void BlueForceGlobals::synchronize(Serializer &s) {
- Globals::synchronize(s);
+ TsAGE2Globals::synchronize(s);
s.syncAsSint16LE(_dayNumber);
- s.syncAsSint16LE(_v4CEA4);
+ if (s.getVersion() < 9) {
+ int tmpVar = 0;
+ s.syncAsSint16LE(tmpVar);
+ }
+ s.syncAsSint16LE(_tonyDialogCtr);
s.syncAsSint16LE(_marinaWomanCtr);
+ s.syncAsSint16LE(_kateDialogCtr);
s.syncAsSint16LE(_v4CEB6);
s.syncAsSint16LE(_safeCombination);
- s.syncAsSint16LE(_v4CEC0);
- s.syncAsSint16LE(_v4CEC2);
+ s.syncAsSint16LE(_gateStatus);
+ s.syncAsSint16LE(_greenDay5TalkCtr);
s.syncAsSint16LE(_v4CEC4);
s.syncAsSint16LE(_v4CEC8);
+ s.syncAsSint16LE(_v4CECA);
+ s.syncAsSint16LE(_v4CECC);
+ for (int i = 0; i < 18; i++)
+ s.syncAsByte(_breakerBoxStatusArr[i]);
+ s.syncAsSint16LE(_hiddenDoorStatus);
+ s.syncAsSint16LE(_v4CEE2);
+ s.syncAsSint16LE(_v4CEE4);
+ s.syncAsSint16LE(_v4CEE6);
+ s.syncAsSint16LE(_v4CEE8);
s.syncAsSint16LE(_deziTopic);
s.syncAsSint16LE(_deathReason);
s.syncAsSint16LE(_driveFromScene);
s.syncAsSint16LE(_driveToScene);
+ s.syncAsSint16LE(_v501F8);
+ s.syncAsSint16LE(_v501FA);
s.syncAsSint16LE(_v501FC);
+ s.syncAsSint16LE(_v5020C);
s.syncAsSint16LE(_v50696);
- s.syncAsSint16LE(_v5098C);
- s.syncAsSint16LE(_v5098D);
+ s.syncAsSint16LE(_subFlagBitArr1);
+ s.syncAsSint16LE(_subFlagBitArr2);
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);
@@ -220,7 +275,7 @@ void BlueForceGlobals::synchronize(Serializer &s) {
}
void BlueForceGlobals::reset() {
- Globals::reset();
+ TsAGE2Globals::reset();
_scenePalette.clearListeners();
_scrollFollower = &_player;
@@ -228,29 +283,56 @@ void BlueForceGlobals::reset() {
// 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;
+ _interfaceY = UI_INTERFACE_Y;
_dayNumber = 0;
- _v4CEA4 = 0;
+ _tonyDialogCtr = 0;
_marinaWomanCtr = 0;
+ _kateDialogCtr = 0;
_v4CEB6 = 0;
_safeCombination = 0;
- _v4CEC0 = 0;
- _v4CEC2 = 0;
+ _gateStatus = 0;
+ _greenDay5TalkCtr = 0;
_v4CEC4 = 0;
_v4CEC8 = 1;
+ _v4CECA = 0;
+ _v4CECC = 0;
+ _breakerBoxStatusArr[0] = 2;
+ _breakerBoxStatusArr[1] = 2;
+ _breakerBoxStatusArr[2] = 2;
+ _breakerBoxStatusArr[3] = 1;
+ _breakerBoxStatusArr[4] = 2;
+ _breakerBoxStatusArr[5] = 2;
+ _breakerBoxStatusArr[6] = 2;
+ _breakerBoxStatusArr[7] = 2;
+ _breakerBoxStatusArr[8] = 2;
+ _breakerBoxStatusArr[9] = 2;
+ _breakerBoxStatusArr[10] = 2;
+ _breakerBoxStatusArr[11] = 2;
+ _breakerBoxStatusArr[12] = 1;
+ _breakerBoxStatusArr[13] = 1;
+ _breakerBoxStatusArr[14] = 2;
+ _breakerBoxStatusArr[15] = 2;
+ _breakerBoxStatusArr[16] = 3;
+ _breakerBoxStatusArr[17] = 0;
+ _hiddenDoorStatus = 0;
+ _v4CEE2 = 0;
+ _v4CEE4 = 0;
+ _v4CEE6 = 0;
+ _v4CEE8 = 0;
_deziTopic = 0;
_deathReason = 0;
+ _v501F8 = 0;
+ _v501FA = 0;
_v501FC = 0;
+ _v5020C = 0;
_v50696 = 0;
- _v5098C = 0;
- _v5098D = 0;
+ _subFlagBitArr1 = 0;
+ _subFlagBitArr2 = 0;
_v50CC2 = 0;
_v50CC4 = 0;
_v50CC6 = 0;
@@ -282,4 +364,72 @@ bool BlueForceGlobals::removeFlag(int flagNum) {
} // end of namespace BlueForce
+namespace Ringworld2 {
+
+void Ringworld2Globals::reset() {
+ Globals::reset();
+
+ // Reset the inventory
+ R2_INVENTORY.reset();
+ T2_GLOBALS._uiElements.updateInventory();
+ T2_GLOBALS._uiElements._active = false;
+
+ // Reset fields
+ _v5657C = 0;
+ _v565F5 = 0;
+ _v565AE = 0;
+ for (int i = 0; i < 14; i++)
+ _v56605[i] = 0;
+ _v57C2C = 0;
+ _v58CE2 = 0;
+ Common::fill(&_v565F1[0], &_v565F1[MAX_CHARACTERS], 0);
+ _speechSubtitles = SPEECH_VOICE | SPEECH_TEXT;
+ _insetUp = 0;
+
+ Common::fill(&_v565F1[0], &_v565F1[MAX_CHARACTERS], 0);
+ Common::fill(&_stripManager_lookupList[0], &_stripManager_lookupList[12], 0);
+ _stripManager_lookupList[0] = 1;
+ _stripManager_lookupList[1] = 1;
+ _stripManager_lookupList[2] = 1;
+ _stripManager_lookupList[3] = 1;
+ _stripManager_lookupList[4] = 1;
+ _stripManager_lookupList[5] = 1;
+ _stripManager_lookupList[8] = 1;
+ _stripManager_lookupList[9] = 1;
+ _stripManager_lookupList[10] = 1;
+ _stripManager_lookupList[11] = 1;
+
+ // Reset fields stored in the player class
+ _player._characterIndex = R2_QUINN;
+ _player._characterScene[1] = 100;
+ _player._characterScene[2] = 300;
+ _player._characterScene[3] = 300;
+}
+
+void Ringworld2Globals::synchronize(Serializer &s) {
+ TsAGE2Globals::synchronize(s);
+ int i;
+
+ s.syncAsSint16LE(_v5657C);
+ s.syncAsSint16LE(_v565F5);
+ s.syncAsSint16LE(_v57C2C);
+ s.syncAsSint16LE(_v58CE2);
+ s.syncAsSint16LE(_speechSubtitles);
+
+ for (i = 0; i < MAX_CHARACTERS; ++i)
+ s.syncAsSint16LE(_v565F1[i]);
+
+ s.syncAsByte(_v565AE);
+
+ for (i = 0; i < 14; ++i)
+ s.syncAsByte(_v56605[i]);
+
+ for (i = 0; i < 12; ++i)
+ s.syncAsByte(_stripManager_lookupList[i]);
+
+ s.syncAsSint16LE(_insetUp);
+}
+
+} // end of namespace Ringworld2
+
} // end of namespace TsAGE
diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h
index fa99e36ab9..9048899953 100644
--- a/engines/tsage/globals.h
+++ b/engines/tsage/globals.h
@@ -30,7 +30,7 @@
#include "tsage/events.h"
#include "tsage/sound.h"
#include "tsage/saveload.h"
-#include "tsage/blue_force/blueforce_ui.h"
+#include "tsage/user_interface.h"
namespace TsAGE {
@@ -77,7 +77,6 @@ public:
Globals();
~Globals();
- void reset();
void setFlag(int flagNum) {
assert((flagNum >= 0) && (flagNum < MAX_FLAGS));
_flags[flagNum] = true;
@@ -94,13 +93,34 @@ public:
GfxManager &gfxManager() { return **_gfxManagers.begin(); }
virtual Common::String getClassName() { return "Globals"; }
virtual void synchronize(Serializer &s);
+ virtual void reset();
+
void dispatchSounds();
};
+typedef bool (*SelectItemProc)(int objectNumber);
+
+/**
+ * The following class represents common globals that were introduced after the release of Ringworld.
+ */
+class TsAGE2Globals: public Globals {
+public:
+ UIElements _uiElements;
+ SelectItemProc _onSelectItem;
+ int _interfaceY;
+ ASoundExt _inventorySound;
+
+ TsAGE2Globals() { _onSelectItem = NULL; }
+ virtual void reset();
+ virtual void synchronize(Serializer &s);
+};
+
extern Globals *g_globals;
-#define GLOBALS (*g_globals)
+#define GLOBALS (*::TsAGE::g_globals)
+#define T2_GLOBALS (*((::TsAGE::TsAGE2Globals *)g_globals))
#define BF_GLOBALS (*((::TsAGE::BlueForce::BlueForceGlobals *)g_globals))
+#define R2_GLOBALS (*((::TsAGE::Ringworld2::Ringworld2Globals *)g_globals))
// 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
@@ -162,44 +182,54 @@ enum Flag {
hookPoints
};
-class BlueForceGlobals: public Globals {
+class BlueForceGlobals: public TsAGE2Globals {
public:
- ASoundExt _sound1, _sound2, _sound3;
- UIElements _uiElements;
+ ASoundExt _sound1, _sound3;
StripProxy _stripProxy;
int _dayNumber;
- int _v4CEA4;
+ int _tonyDialogCtr;
int _marinaWomanCtr;
+ int _kateDialogCtr;
int _v4CEB6;
int _safeCombination;
- int _v4CEC0;
- int _v4CEC2;
+ int _gateStatus;
+ int _greenDay5TalkCtr;
int _v4CEC4;
int _v4CEC8;
+ int _v4CECA;
+ int _v4CECC;
+ int8 _breakerBoxStatusArr[18];
+ int _hiddenDoorStatus;
+ int _v4CEE2;
+ int _v4CEE4;
+ int _v4CEE6;
+ int _v4CEE8;
int _deziTopic;
int _deathReason;
int _driveFromScene;
int _driveToScene;
+ int _v501F8;
+ int _v501FA;
int _v501FC;
+ int _v5020C;
int _v50696;
- uint8 _v5098C;
- uint8 _v5098D;
+ uint8 _subFlagBitArr1;
+ uint8 _subFlagBitArr2;
int _v50CC2;
int _v50CC4;
int _v50CC6;
int _v50CC8;
int _v51C42;
int _v51C44;
- int _interfaceY;
Bookmark _bookmark;
int _mapLocationId;
int _clip1Bullets, _clip2Bullets;
BlueForceGlobals();
- void reset();
bool getHasBullets();
virtual Common::String getClassName() { return "BFGlobals"; }
+ virtual void reset();
virtual void synchronize(Serializer &s);
void set2Flags(int flagNum);
bool removeFlag(int flagNum);
@@ -207,6 +237,33 @@ public:
} // End of namespace BlueForce
+namespace Ringworld2 {
+
+#define SPEECH_TEXT 1
+#define SPEECH_VOICE 2
+
+class Ringworld2Globals: public TsAGE2Globals {
+public:
+ ASoundExt _sound1, _sound2, _sound3, _sound4;
+ PlayStream _playStream;
+ StripProxy _stripProxy;
+ int _insetUp;
+ int _v565F5;
+ int _v5657C;
+ byte _v565AE;
+ byte _v56605[14];
+ int _v57C2C;
+ int _v58CE2;
+ int _speechSubtitles;
+ int _v565F1[4];
+ byte _stripManager_lookupList[12];
+
+ virtual void reset();
+ virtual void synchronize(Serializer &s);
+};
+
+} // End of namespace Ringworld2
+
} // End of namespace TsAGE
#endif
diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp
index 4b2da0b456..171167c2ea 100644
--- a/engines/tsage/graphics.cpp
+++ b/engines/tsage/graphics.cpp
@@ -81,7 +81,7 @@ GfxSurface surfaceFromRes(const byte *imgData) {
if (!rleEncoded) {
Common::copy(srcP, srcP + (r.width() * r.height()), destP);
} else {
- Common::set_to(destP, destP + (r.width() * r.height()), s._transColor);
+ Common::fill(destP, destP + (r.width() * r.height()), s._transColor);
for (int yp = 0; yp < r.height(); ++yp) {
int width = r.width();
@@ -105,7 +105,7 @@ GfxSurface surfaceFromRes(const byte *imgData) {
controlVal &= 0x3f;
int pixel = *srcP++;
- Common::set_to(destP, destP + controlVal, pixel);
+ Common::fill(destP, destP + controlVal, pixel);
destP += controlVal;
width -= controlVal;
}
@@ -261,7 +261,7 @@ void GfxSurface::create(int width, int height) {
}
_customSurface = new Graphics::Surface();
_customSurface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
- Common::set_to((byte *)_customSurface->pixels, (byte *)_customSurface->pixels + (width * height), 0);
+ Common::fill((byte *)_customSurface->pixels, (byte *)_customSurface->pixels + (width * height), 0);
_bounds = Rect(0, 0, width, height);
}
@@ -455,7 +455,7 @@ static int *scaleLine(int size, int srcSize) {
int scale = PRECISION_FACTOR * size / srcSize;
assert(scale >= 0);
int *v = new int[size];
- Common::set_to(v, &v[size], -1);
+ Common::fill(v, &v[size], -1);
int distCtr = PRECISION_FACTOR / 2;
int *destP = v;
@@ -493,7 +493,7 @@ static GfxSurface ResizeSurface(GfxSurface &src, int xSize, int ySize, int trans
byte *destP = (byte *)destImage.getBasePtr(0, yp);
if (vertUsage[yp] == -1) {
- Common::set_to(destP, destP + xSize, transIndex);
+ Common::fill(destP, destP + xSize, transIndex);
} else {
const byte *srcP = (const byte *)srcImage.getBasePtr(0, vertUsage[yp]);
@@ -676,7 +676,39 @@ void GfxElement::drawFrame() {
Rect tempRect = _bounds;
tempRect.collapse(g_globals->_gfxEdgeAdjust, g_globals->_gfxEdgeAdjust);
tempRect.collapse(-1, -1);
- gfxManager.fillRect(tempRect, _colors.background);
+
+ if (g_vm->getGameID() == GType_Ringworld2) {
+ // For Return to Ringworld, use palette shading
+
+ // Get the current palette and determining a shading translation list
+ ScenePalette tempPalette;
+ tempPalette.getPalette(0, 256);
+ int transList[256];
+
+ for (int i = 0; i < 256; ++i) {
+ uint r, g, b, v;
+ tempPalette.getEntry(i, &r, &g, &b);
+ v = ((r >> 1) + (g >> 1) + (b >> 1)) / 4;
+
+ transList[i] = tempPalette.indexOf(v, v, v);
+ }
+
+ // Loop through the surface area to replace each pixel
+ // with its proper shaded replacement
+ Graphics::Surface surface = gfxManager.lockSurface();
+ for (int y = tempRect.top; y < tempRect.bottom; ++y) {
+ byte *lineP = (byte *)surface.getBasePtr(tempRect.left, y);
+ for (int x = 0; x < tempRect.width(); ++x) {
+ *lineP = transList[*lineP];
+ lineP++;
+ }
+ }
+ gfxManager.unlockSurface();
+
+ } else {
+ // Fill dialog content with specified background colour
+ gfxManager.fillRect(tempRect, _colors.background);
+ }
--tempRect.bottom; --tempRect.right;
gfxManager.fillArea(tempRect.left, tempRect.top, bgColor);
@@ -1222,7 +1254,11 @@ void GfxFont::setFontNumber(uint32 fontNumber) {
if (!_fontData)
_fontData = g_resourceManager->getResource(RES_FONT, _fontNumber, 0);
- _numChars = READ_LE_UINT16(_fontData + 4);
+ // Since some TsAGE game versions don't have a valid character count at offset 4, use the offset of the
+ // first charactre data to calculate the number of characters in the offset table preceeding it
+ _numChars = (READ_LE_UINT32(_fontData + 12) - 12) / 4;
+ assert(_numChars <= 256);
+
_fontSize.y = READ_LE_UINT16(_fontData + 6);
_fontSize.x = READ_LE_UINT16(_fontData + 8);
_bpp = READ_LE_UINT16(_fontData + 10);
diff --git a/engines/tsage/graphics.h b/engines/tsage/graphics.h
index 06b482d7b5..dba3401700 100644
--- a/engines/tsage/graphics.h
+++ b/engines/tsage/graphics.h
@@ -292,7 +292,7 @@ public:
Common::copy(src, src + size, dest);
}
virtual void set(byte *dest, int size, byte val) {
- Common::set_to(dest, dest + size, val);
+ Common::fill(dest, dest + size, val);
}
void copyFrom(GfxSurface &src, Rect destBounds, Region *priorityRegion = NULL) {
_surface.setBounds(_bounds);
diff --git a/engines/tsage/module.mk b/engines/tsage/module.mk
index 50b269941e..44f808ba8e 100644
--- a/engines/tsage/module.mk
+++ b/engines/tsage/module.mk
@@ -14,7 +14,6 @@ MODULE_OBJS := \
blue_force/blueforce_scenes8.o \
blue_force/blueforce_scenes9.o \
blue_force/blueforce_speakers.o \
- blue_force/blueforce_ui.o \
converse.o \
core.o \
debugger.o \
@@ -36,11 +35,17 @@ MODULE_OBJS := \
ringworld/ringworld_scenes8.o \
ringworld/ringworld_scenes10.o \
ringworld/ringworld_speakers.o \
+ ringworld2/ringworld2_dialogs.o \
+ ringworld2/ringworld2_logic.o \
+ ringworld2/ringworld2_scenes0.o \
+ ringworld2/ringworld2_scenes2.o \
+ ringworld2/ringworld2_speakers.o \
saveload.o \
scenes.o \
sound.o \
staticres.o \
- tsage.o
+ tsage.o \
+ user_interface.o
# This module can be built as a plugin
ifeq ($(ENABLE_TSAGE), DYNAMIC_PLUGIN)
diff --git a/engines/tsage/resources.cpp b/engines/tsage/resources.cpp
index e83801d748..824f20e9b2 100644
--- a/engines/tsage/resources.cpp
+++ b/engines/tsage/resources.cpp
@@ -33,7 +33,7 @@ namespace TsAGE {
MemoryManager::MemoryManager() {
_memoryPool = new MemoryHeader*[MEMORY_POOL_SIZE];
- Common::set_to(&_memoryPool[0], &_memoryPool[MEMORY_POOL_SIZE], (MemoryHeader *)NULL);
+ Common::fill(&_memoryPool[0], &_memoryPool[MEMORY_POOL_SIZE], (MemoryHeader *)NULL);
}
MemoryManager::~MemoryManager() {
@@ -67,7 +67,7 @@ uint16 MemoryManager::allocate(uint32 size) {
byte *MemoryManager::allocate2(uint32 size) {
uint32 idx = allocate(size);
byte *result = lock(idx);
- Common::set_to(result, result + size, 0);
+ Common::fill(result, result + size, 0);
return result;
}
@@ -354,6 +354,8 @@ void TLib::loadIndex() {
se.resNum = resNum;
se.resType = (ResourceType)(configId & 0x1f);
se.fileOffset = (((configId >> 5) & 0x7ff) << 16) | fileOffset;
+ if (g_vm->getGameID() == GType_Ringworld2)
+ se.fileOffset <<= 4;
_sections.push_back(se);
}
@@ -412,16 +414,27 @@ byte *TLib::getSubResource(int resNum, int rlbNum, int index, uint *size, bool s
*/
bool TLib::getMessage(int resNum, int lineNum, Common::String &result, bool suppressErrors) {
byte *msgData = getResource(RES_MESSAGE, resNum, 0, true);
- if (!msgData) {
+ if (!msgData || (lineNum < 0)) {
if (suppressErrors)
return false;
error("Unknown message %d line %d", resNum, lineNum);
}
+ int msgSize = _memoryManager.getSize(msgData);
const char *srcP = (const char *)msgData;
- while (lineNum-- > 0)
+ const char *endP = srcP + msgSize;
+
+ while (lineNum-- > 0) {
srcP += strlen(srcP) + 1;
+
+ if (srcP >= endP) {
+ if (suppressErrors)
+ return false;
+
+ error("Unknown message %d line %d", resNum, lineNum);
+ }
+ }
result = Common::String(srcP);
_memoryManager.deallocate(msgData);
@@ -501,7 +514,7 @@ Common::String ResourceManager::getMessage(int resNum, int lineNum, bool suppres
if (!suppressErrors)
error("Unknown message %d line %d", resNum, lineNum);
- return result;
+ return Common::String();
}
} // end of namespace TsAGE
diff --git a/engines/tsage/resources.h b/engines/tsage/resources.h
index 176d60fcc4..0410fa3f42 100644
--- a/engines/tsage/resources.h
+++ b/engines/tsage/resources.h
@@ -29,7 +29,6 @@
#include "common/list.h"
#include "common/str.h"
#include "common/str-array.h"
-#include "common/textconsole.h"
#include "common/util.h"
#include "graphics/surface.h"
@@ -42,7 +41,10 @@ const int MEMORY_POOL_SIZE = 1000;
enum ResourceType { RES_LIBRARY, RES_STRIP, RES_IMAGE, RES_PALETTE, RES_VISAGE, RES_SOUND, RES_MESSAGE,
RES_FONT, RES_POINTER, RES_BANK, RES_SND_DRIVER, RES_PRIORITY, RES_CONTROL, RES_WALKRGNS,
- RES_BITMAP, RES_SAVE, RES_SEQUENCE };
+ RES_BITMAP, RES_SAVE, RES_SEQUENCE,
+ // Return to Ringworld specific resource types
+ RT17, RT18, RT19, RT20, RT21, RT22, RT23, RT24, RT25, RT26, RT27, RT28, RT29, RT30, RT31
+};
class MemoryHeader {
public:
diff --git a/engines/tsage/ringworld/ringworld_demo.cpp b/engines/tsage/ringworld/ringworld_demo.cpp
index adf4aae9dd..fedb19c804 100644
--- a/engines/tsage/ringworld/ringworld_demo.cpp
+++ b/engines/tsage/ringworld/ringworld_demo.cpp
@@ -41,6 +41,14 @@ Scene *RingworldDemoGame::createScene(int sceneNumber) {
return new RingworldDemoScene();
}
+bool RingworldDemoGame::canLoadGameStateCurrently() {
+ return false;
+}
+
+bool RingworldDemoGame::canSaveGameStateCurrently() {
+ return false;
+}
+
void RingworldDemoGame::quitGame() {
if (MessageDialog::show(DEMO_EXIT_MSG, EXIT_BTN_STRING, DEMO_BTN_STRING) == 0)
g_vm->quitGame();
diff --git a/engines/tsage/ringworld/ringworld_demo.h b/engines/tsage/ringworld/ringworld_demo.h
index 30527b0aea..7c0ac39285 100644
--- a/engines/tsage/ringworld/ringworld_demo.h
+++ b/engines/tsage/ringworld/ringworld_demo.h
@@ -44,6 +44,8 @@ public:
virtual Scene *createScene(int sceneNumber);
virtual void quitGame();
virtual void processEvent(Event &event);
+ virtual bool canSaveGameStateCurrently();
+ virtual bool canLoadGameStateCurrently();
};
class RingworldDemoScene: public Scene {
diff --git a/engines/tsage/ringworld/ringworld_dialogs.cpp b/engines/tsage/ringworld/ringworld_dialogs.cpp
index 9d1a7effc2..37101c9c58 100644
--- a/engines/tsage/ringworld/ringworld_dialogs.cpp
+++ b/engines/tsage/ringworld/ringworld_dialogs.cpp
@@ -210,13 +210,249 @@ void RightClickDialog::execute() {
break;
case 6:
// Dialog options
- OptionsDialog::show();
+ Ringworld::OptionsDialog::show();
break;
}
_gfxManager.deactivate();
}
+/*--------------------------------------------------------------------------*/
+
+void OptionsDialog::show() {
+ OptionsDialog *dlg = new OptionsDialog();
+ dlg->draw();
+
+ GfxButton *btn = dlg->execute();
+
+ if (btn == &dlg->_btnQuit) {
+ // Quit game
+ if (MessageDialog::show(QUIT_CONFIRM_MSG, CANCEL_BTN_STRING, QUIT_BTN_STRING) == 1) {
+ g_vm->quitGame();
+ }
+ } else if (btn == &dlg->_btnRestart) {
+ // Restart game
+ g_globals->_game->restartGame();
+ } else if (btn == &dlg->_btnSound) {
+ // Sound dialog
+ SoundDialog::execute();
+ } else if (btn == &dlg->_btnSave) {
+ // Save button
+ g_globals->_game->saveGame();
+ } else if (btn == &dlg->_btnRestore) {
+ // Restore button
+ g_globals->_game->restoreGame();
+ }
+
+ dlg->remove();
+ delete dlg;
+}
+
+OptionsDialog::OptionsDialog() {
+ // Set the element text
+ _gfxMessage.set(OPTIONS_MSG, 140, ALIGN_LEFT);
+ _btnRestore.setText(RESTORE_BTN_STRING);
+ _btnSave.setText(SAVE_BTN_STRING);
+ _btnRestart.setText(RESTART_BTN_STRING);
+ _btnQuit.setText(QUIT_BTN_STRING);
+ _btnSound.setText(SOUND_BTN_STRING);
+ _btnResume.setText(RESUME_BTN_STRING);
+
+ // Set position of the elements
+ _gfxMessage._bounds.moveTo(0, 1);
+ _btnRestore._bounds.moveTo(0, _gfxMessage._bounds.bottom + 1);
+ _btnSave._bounds.moveTo(0, _btnRestore._bounds.bottom + 1);
+ _btnRestart._bounds.moveTo(0, _btnSave._bounds.bottom + 1);
+ _btnQuit._bounds.moveTo(0, _btnRestart._bounds.bottom + 1);
+ _btnSound._bounds.moveTo(0, _btnQuit._bounds.bottom + 1);
+ _btnResume._bounds.moveTo(0, _btnSound._bounds.bottom + 1);
+
+ // Set all the buttons to the widest button
+ GfxButton *btnList[6] = {&_btnRestore, &_btnSave, &_btnRestart, &_btnQuit, &_btnSound, &_btnResume};
+ int16 btnWidth = 0;
+ for (int idx = 0; idx < 6; ++idx)
+ btnWidth = MAX(btnWidth, btnList[idx]->_bounds.width());
+ for (int idx = 0; idx < 6; ++idx)
+ btnList[idx]->_bounds.setWidth(btnWidth);
+
+ // Add the items to the dialog
+ addElements(&_gfxMessage, &_btnRestore, &_btnSave, &_btnRestart, &_btnQuit, &_btnSound, &_btnResume, NULL);
+
+ // Set the dialog size and position
+ frame();
+ setCenter(160, 100);
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool GfxInvImage::process(Event &event) {
+ if (!event.handled && (event.eventType == EVENT_BUTTON_DOWN)) {
+ event.handled = _bounds.contains(event.mousePos);
+ return event.handled;
+ }
+
+ return false;
+}
+
+/*--------------------------------------------------------------------------*/
+
+void InventoryDialog::show() {
+ // Determine how many items are in the player's inventory
+ int itemCount = 0;
+ SynchronizedList<InvObject *>::iterator i;
+ for (i = RING_INVENTORY._itemList.begin(); i != RING_INVENTORY._itemList.end(); ++i) {
+ if ((*i)->inInventory())
+ ++itemCount;
+ }
+
+ if (itemCount == 0) {
+ MessageDialog::show(INV_EMPTY_MSG, OK_BTN_STRING);
+ return;
+ }
+
+ InventoryDialog *dlg = new InventoryDialog();
+ dlg->draw();
+ dlg->execute();
+ delete dlg;
+}
+
+InventoryDialog::InventoryDialog() {
+ // Determine the maximum size of the image of any item in the player's inventory
+ int imgWidth = 0, imgHeight = 0;
+
+ SynchronizedList<InvObject *>::iterator i;
+ for (i = RING_INVENTORY._itemList.begin(); i != RING_INVENTORY._itemList.end(); ++i) {
+ InvObject *invObject = *i;
+ if (invObject->inInventory()) {
+ // Get the image for the item
+ GfxSurface itemSurface = surfaceFromRes(invObject->_displayResNum, invObject->_rlbNum, invObject->_cursorNum);
+
+ // Maintain the dimensions of the largest item image
+ imgWidth = MAX(imgWidth, (int)itemSurface.getBounds().width());
+ imgHeight = MAX(imgHeight, (int)itemSurface.getBounds().height());
+
+ // Add the item to the display list
+ GfxInvImage *img = new GfxInvImage();
+ _images.push_back(img);
+ img->setDetails(invObject->_displayResNum, invObject->_rlbNum, invObject->_cursorNum);
+ img->_invObject = invObject;
+ add(img);
+ }
+ }
+ assert(_images.size() > 0);
+
+ // Figure out the number of columns/rows to show all the items
+ int cellsSize = 3;
+ while ((cellsSize * cellsSize) < (int)_images.size())
+ ++cellsSize;
+
+ // Set the position of each inventory item to be displayed
+ int cellX = 0;
+ Common::Point pt(0, 0);
+
+ for (uint idx = 0; idx < _images.size(); ++idx) {
+ if (cellX == cellsSize) {
+ // Move to the start of the next line
+ pt.x = 0;
+ pt.y += imgHeight + 2;
+ cellX = 0;
+ }
+
+ _images[idx]->_bounds.moveTo(pt.x, pt.y);
+
+ pt.x += imgWidth + 2;
+ ++cellX;
+ }
+
+ // Set up the buttons
+ pt.y += imgHeight + 2;
+ _btnOk.setText(OK_BTN_STRING);
+ _btnOk._bounds.moveTo((imgWidth + 2) * cellsSize - _btnOk._bounds.width(), pt.y);
+ _btnLook.setText(LOOK_BTN_STRING);
+ _btnLook._bounds.moveTo(_btnOk._bounds.left - _btnLook._bounds.width() - 2, _btnOk._bounds.top);
+ addElements(&_btnLook, &_btnOk, NULL);
+
+ frame();
+ setCenter(SCREEN_CENTER_X, SCREEN_CENTER_Y);
+}
+
+InventoryDialog::~InventoryDialog() {
+ for (uint idx = 0; idx < _images.size(); ++idx)
+ delete _images[idx];
+}
+
+void InventoryDialog::execute() {
+ if ((RING_INVENTORY._selectedItem) && RING_INVENTORY._selectedItem->inInventory())
+ RING_INVENTORY._selectedItem->setCursor();
+
+ GfxElement *hiliteObj;
+ bool lookFlag = false;
+ _gfxManager.activate();
+
+ while (!g_vm->shouldQuit()) {
+ // Get events
+ Event event;
+ while (!g_globals->_events.getEvent(event) && !g_vm->shouldQuit()) {
+ g_system->delayMillis(10);
+ g_system->updateScreen();
+ }
+ if (g_vm->shouldQuit())
+ break;
+
+ hiliteObj = NULL;
+ if ((event.eventType == EVENT_BUTTON_DOWN) && !_bounds.contains(event.mousePos))
+ break;
+
+ // Pass event to elements
+ event.mousePos.x -= _gfxManager._bounds.left;
+ event.mousePos.y -= _gfxManager._bounds.top;
+
+ for (GfxElementList::iterator i = _elements.begin(); i != _elements.end(); ++i) {
+ if ((*i)->process(event))
+ hiliteObj = *i;
+ }
+
+ if (!event.handled && event.eventType == EVENT_KEYPRESS) {
+ if ((event.kbd.keycode == Common::KEYCODE_RETURN) || (event.kbd.keycode == Common::KEYCODE_ESCAPE)) {
+ // Exit the dialog
+ //hiliteObj = &_btnOk;
+ break;
+ }
+ }
+
+ if (hiliteObj == &_btnOk) {
+ // Ok button clicked
+ if (lookFlag)
+ 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;
+ g_globals->_events.setCursor(CURSOR_LOOK);
+ } else {
+ _btnLook._message = LOOK_BTN_STRING;
+ lookFlag = 0;
+ g_globals->_events.setCursor(CURSOR_WALK);
+ }
+
+ hiliteObj->draw();
+ } else if (hiliteObj) {
+ // Inventory item selected
+ InvObject *invObject = static_cast<GfxInvImage *>(hiliteObj)->_invObject;
+ if (lookFlag) {
+ g_globals->_screenSurface.displayText(invObject->_description);
+ } else {
+ RING_INVENTORY._selectedItem = invObject;
+ invObject->setCursor();
+ }
+ }
+ }
+
+ _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
index 11a8f10e70..b14b3f6d78 100644
--- a/engines/tsage/ringworld/ringworld_dialogs.h
+++ b/engines/tsage/ringworld/ringworld_dialogs.h
@@ -63,6 +63,45 @@ public:
void execute();
};
+class OptionsDialog : public ModalDialog {
+private:
+ GfxButton _btnSave, _btnRestore, _btnRestart;
+ GfxButton _btnQuit, _btnResume;
+ GfxButton _btnSound;
+ GfxMessage _gfxMessage;
+public:
+ OptionsDialog();
+ virtual ~OptionsDialog() {}
+ GfxButton *execute() { return GfxDialog::execute(&_btnResume); }
+
+ static void show();
+};
+
+/*--------------------------------------------------------------------------*/
+
+class GfxInvImage : public GfxImage {
+public:
+ InvObject *_invObject;
+public:
+ GfxInvImage() : GfxImage(), _invObject(NULL) {}
+
+ virtual bool process(Event &event);
+};
+
+#define MAX_INVOBJECT_DISPLAY 20
+
+class InventoryDialog : public ModalDialog {
+private:
+ Common::Array<GfxInvImage *> _images;
+ GfxButton _btnOk, _btnLook;
+public:
+ InventoryDialog();
+ virtual ~InventoryDialog();
+ void execute();
+
+ static void show();
+};
+
} // End of namespace Ringworld
} // End of namespace TsAGE
diff --git a/engines/tsage/ringworld/ringworld_logic.cpp b/engines/tsage/ringworld/ringworld_logic.cpp
index 3fb284f5da..ad67b66f69 100644
--- a/engines/tsage/ringworld/ringworld_logic.cpp
+++ b/engines/tsage/ringworld/ringworld_logic.cpp
@@ -192,6 +192,20 @@ Scene *RingworldGame::createScene(int sceneNumber) {
}
}
+/**
+ * Returns true if it is currently okay to restore a game
+ */
+bool RingworldGame::canLoadGameStateCurrently() {
+ return !g_globals->getFlag(50);
+}
+
+/**
+ * Returns true if it is currently okay to save the game
+ */
+bool RingworldGame::canSaveGameStateCurrently() {
+ return !g_globals->getFlag(50);
+}
+
/*--------------------------------------------------------------------------*/
DisplayHotspot::DisplayHotspot(int regionId, ...) {
@@ -572,6 +586,106 @@ void RingworldGame::rightClick() {
delete dlg;
}
+/*--------------------------------------------------------------------------*/
+
+NamedHotspot::NamedHotspot() : SceneHotspot() {
+ _resNum = 0;
+ _lookLineNum = _useLineNum = _talkLineNum = -1;
+}
+
+void NamedHotspot::doAction(int action) {
+ switch (action) {
+ case CURSOR_WALK:
+ // Nothing
+ return;
+ case CURSOR_LOOK:
+ if (_lookLineNum == -1)
+ break;
+
+ SceneItem::display(_resNum, _lookLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
+ return;
+ case CURSOR_USE:
+ if (_useLineNum == -1)
+ break;
+
+ SceneItem::display(_resNum, _useLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
+ return;
+ case CURSOR_TALK:
+ if (_talkLineNum == -1)
+ break;
+
+ SceneItem::display(_resNum, _lookLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
+ return;
+ default:
+ break;
+ }
+
+ SceneHotspot::doAction(action);
+}
+
+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;
+ g_globals->_sceneItems.addItems(this, NULL);
+}
+
+void NamedHotspot::setDetails(const Rect &bounds, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item) {
+ setBounds(bounds);
+ _resNum = resNum;
+ _lookLineNum = lookLineNum;
+ _talkLineNum = talkLineNum;
+ _useLineNum = useLineNum;
+
+ switch (mode) {
+ case 2:
+ g_globals->_sceneItems.push_front(this);
+ break;
+ case 4:
+ g_globals->_sceneItems.addBefore(item, this);
+ break;
+ case 5:
+ g_globals->_sceneItems.addAfter(item, this);
+ break;
+ default:
+ g_globals->_sceneItems.push_back(this);
+ break;
+ }
+}
+
+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) {
+ SceneHotspot::synchronize(s);
+ s.syncAsSint16LE(_resNum);
+ s.syncAsSint16LE(_lookLineNum);
+ s.syncAsSint16LE(_useLineNum);
+
+ if (g_vm->getGameID() == GType_BlueForce)
+ s.syncAsSint16LE(_talkLineNum);
+}
+
+
} // 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 84816347af..6f6a66cc26 100644
--- a/engines/tsage/ringworld/ringworld_logic.h
+++ b/engines/tsage/ringworld/ringworld_logic.h
@@ -155,6 +155,33 @@ public:
virtual Scene *createScene(int sceneNumber);
virtual void processEvent(Event &event);
virtual void rightClick();
+ virtual bool canSaveGameStateCurrently();
+ virtual bool canLoadGameStateCurrently();
+};
+
+class NamedHotspot : public SceneHotspot {
+public:
+ int _resNum, _lookLineNum, _useLineNum, _talkLineNum;
+ NamedHotspot();
+
+ virtual void doAction(int action);
+ virtual Common::String getClassName() { return "NamedHotspot"; }
+ virtual void synchronize(Serializer &s);
+ 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);
+ }
};
} // End of namespace Ringworld
diff --git a/engines/tsage/ringworld/ringworld_scenes1.cpp b/engines/tsage/ringworld/ringworld_scenes1.cpp
index 8227e2a884..4d9d565705 100644
--- a/engines/tsage/ringworld/ringworld_scenes1.cpp
+++ b/engines/tsage/ringworld/ringworld_scenes1.cpp
@@ -2607,7 +2607,7 @@ void Scene90::stripCallback(int v) {
Scene90 *scene = (Scene90 *)g_globals->_sceneManager._scene;
if (v == 1)
- scene->_object2.animate(ANIM_MODE_7, NULL);
+ scene->_object2.animate(ANIM_MODE_7, 0, NULL);
else if (v == 2)
scene->_object2.animate(ANIM_MODE_NONE);
}
diff --git a/engines/tsage/ringworld/ringworld_scenes10.cpp b/engines/tsage/ringworld/ringworld_scenes10.cpp
index 9a9f63705b..f9a8e7996a 100644
--- a/engines/tsage/ringworld/ringworld_scenes10.cpp
+++ b/engines/tsage/ringworld/ringworld_scenes10.cpp
@@ -20,7 +20,6 @@
*
*/
-#include "graphics/cursorman.h"
#include "tsage/ringworld/ringworld_scenes10.h"
#include "tsage/scenes.h"
#include "tsage/tsage.h"
@@ -54,6 +53,7 @@ void Object9350::draw() {
* Scene 9100 - Near beach: Slave washing clothes
*
*--------------------------------------------------------------------------*/
+// Slave hotspot
void Scene9100::SceneHotspot1::doAction(int action) {
Scene9100 *scene = (Scene9100 *)g_globals->_sceneManager._scene;
@@ -102,7 +102,7 @@ void Scene9100::signal() {
g_globals->_sceneManager.changeScene(9150);
break;
case 9105:
- _sceneHotspot3.remove();
+ _hotspotCleanedClothes.remove();
// No break on purpose
case 9103:
case 9104:
@@ -145,13 +145,13 @@ void Scene9100::postInit(SceneObjectList *OwnerList) {
_object6.setStrip(6);
_object6.setFrame(1);
_object6.setPosition(Common::Point(138, 166));
- _sceneHotspot3.setDetails(145, 125, 166, 156, 9100, 40, 43);
+ _hotspotCleanedClothes.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);
+ _hotspotSlave.setDetails(140, 176, 185, 215, 9100, 36, 37);
+ _hotspotSoiledClothes.setDetails(161, 138, 182, 175, 9100, 38, 39);
+ _hotspotIsland.setDetails(37, 196, 47, 320, 9100, 44, -1);
+ _hotspotBoulders.setDetails(69, 36, 121, 272, 9100, 45, 46);
+ _hotspotTrees.setDetails(127, 0, 200, 52, 9100, 47, 48);
g_globals->_soundHandler.play(251);
if (g_globals->_sceneManager._previousScene == 9150) {
@@ -708,7 +708,7 @@ void Scene9360::postInit(SceneObjectList *OwnerList) {
*
*--------------------------------------------------------------------------*/
Scene9400::Scene9400() {
- _field1032 = 0;
+ _hittingAnvil = false;
}
void Scene9400::SceneHotspot7::doAction(int action) {
@@ -766,12 +766,12 @@ void Scene9400::signal() {
void Scene9400::dispatch() {
if ((_object1._animateMode == 2) && (_object1._strip == 1) && (_object1._frame == 4)){
- if (_field1032 == 0) {
+ if (_hittingAnvil == false) {
_soundHandler.play(296);
- _field1032 = 1;
+ _hittingAnvil = true;
}
} else {
- _field1032 = 0;
+ _hittingAnvil = false;
}
if (_action == 0) {
if (g_globals->_player._position.y < 120) {
@@ -825,7 +825,7 @@ void Scene9400::postInit(SceneObjectList *OwnerList) {
void Scene9400::synchronize(Serializer &s) {
Scene::synchronize(s);
if (s.getVersion() >= 3)
- s.syncAsSint16LE(_field1032);
+ s.syncAsSint16LE(_hittingAnvil);
}
/*--------------------------------------------------------------------------
@@ -1181,7 +1181,7 @@ void Scene9500::postInit(SceneObjectList *OwnerList) {
_object2.setFrame(_object2.getFrameCount());
_object2.setPosition(Common::Point(303, 130));
_object2.fixPriority(132);
- if (RING_INVENTORY._helmet._sceneNumber == 1) {
+ if (RING_INVENTORY._helmet._sceneNumber != 1) {
_hotspot2.setDetails(87, 294, 104, 314, 9400, 17, -1);
} else {
_object2.setStrip(2);
diff --git a/engines/tsage/ringworld/ringworld_scenes10.h b/engines/tsage/ringworld/ringworld_scenes10.h
index 6bca48776b..48859ab454 100644
--- a/engines/tsage/ringworld/ringworld_scenes10.h
+++ b/engines/tsage/ringworld/ringworld_scenes10.h
@@ -80,12 +80,12 @@ public:
SceneObject _object4;
SceneObject _object5;
SceneObject _object6;
- SceneHotspot1 _sceneHotspot1;
- NamedHotspot _sceneHotspot2;
- NamedHotspot _sceneHotspot3;
- NamedHotspot _sceneHotspot4;
- NamedHotspot _sceneHotspot5;
- NamedHotspot _sceneHotspot6;
+ SceneHotspot1 _hotspotSlave;
+ NamedHotspot _hotspotSoiledClothes;
+ NamedHotspot _hotspotCleanedClothes;
+ NamedHotspot _hotspotIsland;
+ NamedHotspot _hotspotBoulders;
+ NamedHotspot _hotspotTrees;
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void signal();
@@ -236,7 +236,7 @@ public:
NamedHotspot _hotspot5;
NamedHotspot _hotspot6;
ASound _soundHandler;
- int _field1032;
+ bool _hittingAnvil;
SceneHotspot7 _hotspot7;
SceneHotspot8 _hotspot8;
diff --git a/engines/tsage/ringworld/ringworld_scenes3.cpp b/engines/tsage/ringworld/ringworld_scenes3.cpp
index 7103a48ed9..81190aea7b 100644
--- a/engines/tsage/ringworld/ringworld_scenes3.cpp
+++ b/engines/tsage/ringworld/ringworld_scenes3.cpp
@@ -453,14 +453,14 @@ void Scene2000::stripCallback(int v) {
switch (v) {
case 0:
_object9.setStrip(3);
- _object9.animate(ANIM_MODE_7, NULL);
+ _object9.animate(ANIM_MODE_7, 0, NULL);
_object10.setStrip(6);
_object10.setFrame(1);
_object10.animate(ANIM_MODE_5, NULL);
break;
case 1:
_object10.setStrip(5);
- _object10.animate(ANIM_MODE_7, NULL);
+ _object10.animate(ANIM_MODE_7, 0, NULL);
_object9.setStrip(4);
_object9.setFrame(1);
_object9.animate(ANIM_MODE_5, NULL);
@@ -1921,7 +1921,7 @@ void Scene2100::stripCallback(int v) {
switch (v) {
case 1:
_object4._numFrames = 4;
- _object4.animate(ANIM_MODE_7, NULL);
+ _object4.animate(ANIM_MODE_7, 0, NULL);
break;
case 2:
_object4.animate(ANIM_MODE_NONE, NULL);
diff --git a/engines/tsage/ringworld/ringworld_scenes5.cpp b/engines/tsage/ringworld/ringworld_scenes5.cpp
index 3cf1207e9e..49726eba2e 100644
--- a/engines/tsage/ringworld/ringworld_scenes5.cpp
+++ b/engines/tsage/ringworld/ringworld_scenes5.cpp
@@ -1478,7 +1478,7 @@ void Scene4025::Hole::doAction(int action) {
void Scene4025::Peg::synchronize(Serializer &s) {
SceneObject::synchronize(s);
- s.syncAsSint16LE(_field88);
+ s.syncAsSint16LE(_pegId);
s.syncAsSint16LE(_armStrip);
}
@@ -1513,35 +1513,35 @@ void Scene4025::postInit(SceneObjectList *OwnerList) {
_pegPtr = _pegPtr2 = NULL;
_peg1.postInit();
- _peg1._field88 = 1;
+ _peg1._pegId = 1;
_peg1.setVisage(4025);
_peg1.setStrip(2);
_peg1.setFrame(1);
_peg1.setPosition(Common::Point(203, 61));
_peg2.postInit();
- _peg2._field88 = 4;
+ _peg2._pegId = 4;
_peg2.setVisage(4025);
_peg2.setStrip(2);
_peg2.setFrame(2);
_peg2.setPosition(Common::Point(195, 57));
_peg3.postInit();
- _peg3._field88 = 0;
+ _peg3._pegId = 0;
_peg3.setVisage(4025);
_peg3.setStrip(2);
_peg3.setFrame(3);
_peg3.setPosition(Common::Point(202, 66));
_peg4.postInit();
- _peg4._field88 = 3;
+ _peg4._pegId = 3;
_peg4.setVisage(4025);
_peg4.setStrip(2);
_peg4.setFrame(4);
_peg4.setPosition(Common::Point(194, 68));
_peg5.postInit();
- _peg5._field88 = 2;
+ _peg5._pegId = 2;
_peg5.setVisage(4025);
_peg5.setStrip(1);
_peg5.setFrame(5);
@@ -2173,7 +2173,7 @@ void Scene4050::Action4::signal() {
case 5:
scene->_hotspot16.setStrip2(4);
scene->_hotspot16.setFrame(1);
- scene->_hotspot16.animate(ANIM_MODE_4, 4, 1, this);;
+ scene->_hotspot16.animate(ANIM_MODE_4, 4, 1, this);
break;
case 6:
scene->_hotspot16.animate(ANIM_MODE_5, NULL);
@@ -4311,7 +4311,7 @@ void Scene4301::Action1::signal() {
setDelay(20);
break;
case 21:
- scene->_field68E = true;
+ scene->_puzzleDone = true;
remove();
break;
}
@@ -4412,7 +4412,7 @@ void Scene4301::postInit(SceneObjectList *OwnerList) {
Scene::postInit();
setZoomPercents(0, 100, 200, 100);
- _field68E = false;
+ _puzzleDone = false;
RING_INVENTORY._stasisBox2._sceneNumber = 1;
_hotspot4.setDetails(97, 76, 127, 102, 4300, 5, 6);
@@ -4432,8 +4432,8 @@ void Scene4301::postInit(SceneObjectList *OwnerList) {
void Scene4301::dispatch() {
if (_action) {
_action->dispatch();
- } else if (_field68E) {
- _field68E = 0;
+ } else if (_puzzleDone) {
+ _puzzleDone = false;
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 80e67755bd..c93df2a1d8 100644
--- a/engines/tsage/ringworld/ringworld_scenes5.h
+++ b/engines/tsage/ringworld/ringworld_scenes5.h
@@ -215,10 +215,10 @@ class Scene4025 : public Scene {
};
class Peg : public SceneObject {
public:
- int _field88;
+ int _pegId;
int _armStrip;
- Peg() : SceneObject() { _field88 = 0; _armStrip = 3; }
+ Peg() : SceneObject() { _pegId = 0; _armStrip = 3; }
virtual void synchronize(Serializer &s);
virtual void doAction(int action);
};
@@ -682,13 +682,13 @@ public:
SceneObject _hotspot1, _hotspot2, _hotspot3;
Hotspot4 _hotspot4;
Hotspot5 _hotspot5;
- bool _field68E;
+ bool _puzzleDone;
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void dispatch();
virtual void synchronize(Serializer &s) {
Scene::synchronize(s);
- s.syncAsSint16LE(_field68E);
+ s.syncAsSint16LE(_puzzleDone);
}
};
diff --git a/engines/tsage/ringworld/ringworld_scenes6.cpp b/engines/tsage/ringworld/ringworld_scenes6.cpp
index cd3415f511..30a91b57aa 100644
--- a/engines/tsage/ringworld/ringworld_scenes6.cpp
+++ b/engines/tsage/ringworld/ringworld_scenes6.cpp
@@ -1124,7 +1124,7 @@ void Scene5100::postInit(SceneObjectList *OwnerList) {
_hotspot4.setVisage(5363);
_hotspot4.setPosition(Common::Point(1025, 65));
_hotspot4.setStrip(4);
- _hotspot4.animate(ANIM_MODE_7, 0, NULL);;
+ _hotspot4.animate(ANIM_MODE_7, 0, NULL);
g_globals->_sceneItems.push_back(&_hotspot4);
_hotspot9.postInit();
@@ -1562,7 +1562,7 @@ void Scene5200::Hotspot9::doAction(int action) {
SceneItem::display2(5200, 14);
break;
default:
- SceneItem::doAction(action);
+ SceneHotspot::doAction(action);
break;
}
}
diff --git a/engines/tsage/ringworld/ringworld_scenes8.cpp b/engines/tsage/ringworld/ringworld_scenes8.cpp
index f8fb8b01e7..9cb85a6930 100644
--- a/engines/tsage/ringworld/ringworld_scenes8.cpp
+++ b/engines/tsage/ringworld/ringworld_scenes8.cpp
@@ -1879,12 +1879,12 @@ void Scene7700::SceneHotspot8::doAction(int action) {
scene->_soundHandler.play(259);
scene->_object15.setFrame(scene->_object15.getFrameCount());
scene->_object15.animate(ANIM_MODE_6, scene);
- if ((scene->_field977 == 2) && (scene->_field97B == 0)) {
- scene->_field979++;
+ if ((scene->_seatCountLeft1 == 2) && (scene->_seatCountLeft2 == 0)) {
+ scene->_seatCountRight++;
} else {
- scene->_field97B = 0;
- scene->_field979 = 0;
- scene->_field977 = 0;
+ scene->_seatCountLeft2 = 0;
+ scene->_seatCountRight = 0;
+ scene->_seatCountLeft1 = 0;
}
break;
default:
@@ -1905,26 +1905,26 @@ void Scene7700::SceneHotspot9::doAction(int action) {
scene->_soundHandler.play(259);
scene->_object15.setFrame(1);
scene->_object15.animate(ANIM_MODE_5, scene);
- if (scene->_field977 > 2) {
- scene->_field97B = 0;
- scene->_field979 = 0;
- scene->_field977 = 0;
+ if (scene->_seatCountLeft1 > 2) {
+ scene->_seatCountLeft2 = 0;
+ scene->_seatCountRight = 0;
+ scene->_seatCountLeft1 = 0;
}
- if (scene->_field979 != 0) {
- if (scene->_field979 != 4) {
- scene->_field97B = 0;
- scene->_field979 = 0;
- scene->_field977 = 0;
+ if (scene->_seatCountRight != 0) {
+ if (scene->_seatCountRight != 4) {
+ scene->_seatCountLeft2 = 0;
+ scene->_seatCountRight = 0;
+ scene->_seatCountLeft1 = 0;
} else {
- scene->_field97B++;
- if (scene->_field97B == 3) {
+ scene->_seatCountLeft2++;
+ if (scene->_seatCountLeft2 == 3) {
g_globals->_player.disableControl();
scene->setAction(&scene->_action3);
}
}
} else {
- scene->_field977++;
+ scene->_seatCountLeft1++;
}
break;
default:
@@ -2315,9 +2315,9 @@ void Scene7700::postInit(SceneObjectList *OwnerList) {
Scene::postInit();
setZoomPercents(100, 80, 200, 100);
g_globals->setFlag(53);
- _field97B = 0;
- _field979 = 0;
- _field977 = 0;
+ _seatCountLeft2 = 0;
+ _seatCountRight = 0;
+ _seatCountLeft1 = 0;
_stripManager.addSpeaker(&_speakerEText);
_stripManager.addSpeaker(&_speakerQText);
@@ -2538,9 +2538,9 @@ Scene7700::Scene7700() {
void Scene7700::synchronize(Serializer &s) {
Scene::synchronize(s);
if (s.getVersion() >= 3) {
- s.syncAsSint16LE(_field977);
- s.syncAsSint16LE(_field979);
- s.syncAsSint16LE(_field97B);
+ s.syncAsSint16LE(_seatCountLeft1);
+ s.syncAsSint16LE(_seatCountRight);
+ s.syncAsSint16LE(_seatCountLeft2);
}
}
diff --git a/engines/tsage/ringworld/ringworld_scenes8.h b/engines/tsage/ringworld/ringworld_scenes8.h
index 84178c36f9..b24f220f8c 100644
--- a/engines/tsage/ringworld/ringworld_scenes8.h
+++ b/engines/tsage/ringworld/ringworld_scenes8.h
@@ -480,7 +480,7 @@ public:
SceneHotspot11 _sceneHotspot34;
SceneHotspot11 _sceneHotspot35;
SceneHotspot11 _sceneHotspot36;
- int _field977, _field979, _field97B;
+ int _seatCountLeft1, _seatCountRight, _seatCountLeft2;
Scene7700();
virtual void postInit(SceneObjectList *OwnerList = NULL);
diff --git a/engines/tsage/ringworld2/ringworld2_dialogs.cpp b/engines/tsage/ringworld2/ringworld2_dialogs.cpp
new file mode 100644
index 0000000000..ddb4eae9c4
--- /dev/null
+++ b/engines/tsage/ringworld2/ringworld2_dialogs.cpp
@@ -0,0 +1,447 @@
+/* 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/ringworld2/ringworld2_dialogs.h"
+#include "tsage/ringworld2/ringworld2_logic.h"
+
+namespace TsAGE {
+
+namespace Ringworld2 {
+
+/**
+ * This dialog implements the right-click dialog
+ */
+RightClickDialog::RightClickDialog() : GfxDialog() {
+ // Setup button positions
+ _btnList[0] = Common::Point(48, 12);
+ _btnList[1] = Common::Point(31, 29);
+ _btnList[2] = Common::Point(65, 29);
+ _btnList[3] = Common::Point(14, 47);
+ _btnList[4] = Common::Point(48, 47);
+ _btnList[5] = Common::Point(83, 47);
+
+ // Set the palette and change the cursor
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+
+ setPalette();
+
+ // Get the dialog image and selected button images
+ if (R2_GLOBALS._sceneManager._sceneNumber == 2900) {
+ _surface = surfaceFromRes(2902, 1, 1);
+ _btnImages.setVisage(2902, 2);
+ } else {
+ _surface = surfaceFromRes(1, 1, 1);
+ _btnImages.setVisage(1, 2);
+ }
+
+ // 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);
+
+ _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);
+}
+
+bool RightClickDialog::process(Event &event) {
+ switch (event.eventType) {
+ case EVENT_MOUSE_MOVE: {
+ // Check whether a button is highlighted
+ int buttonIndex;
+ for (buttonIndex = 5; buttonIndex >= 0; --buttonIndex) {
+ Rect tempRect(0, 0, 28, 29);
+ tempRect.moveTo(_btnList[buttonIndex].x, _btnList[buttonIndex].y);
+
+ if (tempRect.contains(event.mousePos))
+ break;
+ }
+ // 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, _btnList[buttonIndex].x, _btnList[buttonIndex].y);
+ }
+
+ _highlightedAction = buttonIndex;
+ }
+
+ event.handled = true;
+ return true;
+ }
+
+ case EVENT_BUTTON_DOWN:
+ // Specify the selected action
+ _selectedAction = (_highlightedAction == -1) ? 999 : _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:
+ // Look action
+ cursorNum = CURSOR_LOOK;
+ break;
+ case 1:
+ // Walk action
+ cursorNum = CURSOR_WALK;
+ break;
+ case 2:
+ // Use action
+ cursorNum = CURSOR_USE;
+ break;
+ case 3:
+ // Talk action
+ cursorNum = CURSOR_TALK;
+ break;
+ case 4:
+ // Change player
+ CharacterDialog::show();
+ break;
+ case 5:
+ // Options dialog
+ break;
+ }
+
+ if (cursorNum != CURSOR_NONE)
+ R2_GLOBALS._events.setCursor(cursorNum);
+
+ _gfxManager.deactivate();
+}
+
+/*--------------------------------------------------------------------------*/
+
+void CharacterDialog::show() {
+ CharacterDialog *dlg = new CharacterDialog();
+ dlg->draw();
+
+ // Make the default button the currently active character
+ GfxButton *btn = NULL;
+ int oldCharacter = R2_GLOBALS._player._characterIndex;
+ switch (oldCharacter) {
+ case 1:
+ btn = &dlg->_btnQuinn;
+ break;
+ case 2:
+ btn = &dlg->_btnSeeker;
+ break;
+ case 3:
+ btn = &dlg->_btnMiranda;
+ break;
+ default:
+ break;
+ }
+
+ // Show the character selection dialog
+ btn = dlg->execute(btn);
+
+ // Figure out the new selected character
+ if (btn == &dlg->_btnQuinn)
+ R2_GLOBALS._player._characterIndex = R2_QUINN;
+ else if (btn == &dlg->_btnSeeker)
+ R2_GLOBALS._player._characterIndex = R2_SEEKER;
+ else if (btn == &dlg->_btnMiranda)
+ R2_GLOBALS._player._characterIndex = R2_MIRANDA;
+
+ // Remove the dialog
+ dlg->remove();
+ delete dlg;
+
+ // Only do transfer if a different character was selected
+ if (R2_GLOBALS._player._characterIndex != oldCharacter) {
+ // Save the details of the previously active character
+ SceneExt *scene = (SceneExt *)R2_GLOBALS._sceneManager._scene;
+ scene->saveCharacter(oldCharacter);
+
+ // Play a transition sound as the character is changed
+ if (R2_GLOBALS._player._characterScene[0] != 300) {
+ switch (R2_GLOBALS._v565F1[R2_GLOBALS._player._characterIndex]) {
+ case 0:
+ R2_GLOBALS._sound4.stop();
+ break;
+ case 1:
+ R2_GLOBALS._sound4.play(45);
+ break;
+ case 2:
+ R2_GLOBALS._sound4.play(4);
+ break;
+ case 3:
+ R2_GLOBALS._sound4.play(5);
+ break;
+ case 4:
+ R2_GLOBALS._sound4.play(6);
+ break;
+ default:
+ break;
+ }
+ } else if (R2_GLOBALS._v565F1[R2_GLOBALS._player._characterIndex] > 1) {
+ switch (R2_GLOBALS._v565F1[R2_GLOBALS._player._characterIndex]) {
+ case 2:
+ R2_GLOBALS._sound4.play(45);
+ break;
+ case 3:
+ R2_GLOBALS._sound4.play(4);
+ break;
+ case 4:
+ R2_GLOBALS._sound4.play(5);
+ break;
+ case 5:
+ R2_GLOBALS._sound4.play(6);
+ break;
+ default:
+ break;
+ }
+ } else if ((R2_GLOBALS._player._characterScene[1] == 300) && (R2_GLOBALS._v565F1[1] != 1)) {
+ switch (R2_GLOBALS._v565F1[1]) {
+ case 2:
+ R2_GLOBALS._sound4.play(45);
+ break;
+ case 3:
+ R2_GLOBALS._sound4.play(4);
+ break;
+ case 4:
+ R2_GLOBALS._sound4.play(5);
+ break;
+ case 5:
+ R2_GLOBALS._sound4.play(6);
+ break;
+ default:
+ break;
+ }
+ } else if (R2_GLOBALS._player._characterScene[2] != 300) {
+ R2_GLOBALS._sound4.stop();
+ } else if (R2_GLOBALS._v565F1[2] == 1) {
+ R2_GLOBALS._sound4.stop();
+ } else {
+ switch (R2_GLOBALS._v565F1[1]) {
+ case 2:
+ R2_GLOBALS._sound4.play(45);
+ break;
+ case 3:
+ R2_GLOBALS._sound4.play(4);
+ break;
+ case 4:
+ R2_GLOBALS._sound4.play(5);
+ break;
+ case 5:
+ R2_GLOBALS._sound4.play(6);
+ break;
+ default:
+ break;
+ }
+ }
+
+ // Change to whichever scene the newly selected character is in
+ R2_GLOBALS._sceneManager.changeScene(R2_GLOBALS._player._characterScene[R2_GLOBALS._player._characterIndex]);
+ }
+}
+
+CharacterDialog::CharacterDialog() {
+ // Set the element text
+ _msgTitle.set(CHAR_TITLE, 140, ALIGN_LEFT);
+ _btnQuinn.setText(CHAR_QUINN_MSG);
+ _btnSeeker.setText(CHAR_SEEKER_MSG);
+ _btnMiranda.setText(CHAR_MIRANDA_MSG);
+ _btnCancel.setText(CHAR_CANCEL_MSG);
+
+ // Set position of the elements
+ _msgTitle._bounds.moveTo(5, 5);
+ _btnQuinn._bounds.moveTo(25, _msgTitle._bounds.bottom + 1);
+ _btnSeeker._bounds.moveTo(25, _btnQuinn._bounds.bottom + 1);
+ _btnMiranda._bounds.moveTo(25, _btnSeeker._bounds.bottom + 1);
+ _btnCancel._bounds.moveTo(25, _btnMiranda._bounds.bottom + 1);
+
+ // Add the items to the dialog
+ addElements(&_msgTitle, &_btnQuinn, &_btnSeeker, &_btnMiranda, &_btnCancel, NULL);
+
+ // Set the dialog size and position
+ frame();
+ _bounds.collapse(-6, -6);
+ setCenter(160, 100);
+}
+
+/*--------------------------------------------------------------------------*/
+
+void HelpDialog::show() {
+ // Set the palette and change the cursor
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+
+ // Create the dialog and draw it
+ HelpDialog *dlg = new HelpDialog();
+ dlg->draw();
+
+ // Show the character selection dialog
+ GfxButton *btn = dlg->execute(&dlg->_btnResume);
+
+ // If a function button was selected, take care of it
+ Event evt;
+ evt.eventType = EVENT_KEYPRESS;
+ evt.kbd.keycode = Common::KEYCODE_INVALID;
+ if (btn == &dlg->_btnList[0]) {
+ evt.kbd.keycode = Common::KEYCODE_F2;
+ } else if (btn == &dlg->_btnList[1]) {
+ evt.kbd.keycode = Common::KEYCODE_F3;
+ } else if (btn == &dlg->_btnList[2]) {
+ evt.kbd.keycode = Common::KEYCODE_F4;
+ } else if (btn == &dlg->_btnList[3]) {
+ evt.kbd.keycode = Common::KEYCODE_F5;
+ } else if (btn == &dlg->_btnList[4]) {
+ evt.kbd.keycode = Common::KEYCODE_F7;
+ } else if (btn == &dlg->_btnList[5]) {
+ evt.kbd.keycode = Common::KEYCODE_F8;
+ } else if (btn == &dlg->_btnList[6]) {
+ evt.kbd.keycode = Common::KEYCODE_F10;
+ }
+
+ // Remove the dialog
+ dlg->remove();
+ delete dlg;
+
+ // If a action button was selected, dispatch to handle it
+ if (evt.kbd.keycode != Common::KEYCODE_INVALID)
+ R2_GLOBALS._game->processEvent(evt);
+}
+
+HelpDialog::HelpDialog() {
+ // Set the title and game version
+ _msgTitle.set(HELP_MSG, 172, ALIGN_CENTER);
+ _msgTitle._bounds.moveTo(5, 0);
+ _msgVersion.set(GAME_VERSION, 172, ALIGN_CENTER);
+ _msgVersion._bounds.moveTo(5, _msgTitle._bounds.bottom + 3);
+ addElements(&_msgTitle, &_msgVersion, NULL);
+
+ // Set buttons
+ _btnList[0].setText(F2);
+ _btnList[0]._bounds.moveTo(5, _msgVersion._bounds.bottom + 2);
+ _btnDescription[0].set(SOUND_OPTIONS, 140, ALIGN_LEFT);
+ _btnDescription[0]._bounds.moveTo(_btnList[0]._bounds.right + 2, _btnList[0]._bounds.top + 4);
+
+ _btnList[1].setText(F3);
+ _btnList[1]._bounds.moveTo(5, _btnList[0]._bounds.bottom);
+ _btnDescription[1].set(QUIT_GAME, 140, ALIGN_LEFT);
+ _btnDescription[1]._bounds.moveTo(_btnList[1]._bounds.right + 2, _btnList[1]._bounds.top + 4);
+
+ _btnList[2].setText(F4);
+ _btnList[2]._bounds.moveTo(5, _btnList[1]._bounds.bottom);
+ _btnDescription[2].set(RESTART_GAME, 140, ALIGN_LEFT);
+ _btnDescription[2]._bounds.moveTo(_btnList[2]._bounds.right + 2, _btnList[2]._bounds.top + 4);
+
+ _btnList[3].setText(F5);
+ _btnList[3]._bounds.moveTo(5, _btnList[2]._bounds.bottom);
+ _btnDescription[3].set(SAVE_GAME, 140, ALIGN_LEFT);
+ _btnDescription[3]._bounds.moveTo(_btnList[3]._bounds.right + 2, _btnList[3]._bounds.top + 4);
+
+ _btnList[4].setText(F7);
+ _btnList[4]._bounds.moveTo(5, _btnList[3]._bounds.bottom);
+ _btnDescription[4].set(RESTORE_GAME, 140, ALIGN_LEFT);
+ _btnDescription[4]._bounds.moveTo(_btnList[4]._bounds.right + 2, _btnList[4]._bounds.top + 4);
+
+ _btnList[5].setText(F8);
+ _btnList[5]._bounds.moveTo(5, _btnList[4]._bounds.bottom);
+ _btnDescription[5].set(SHOW_CREDITS, 140, ALIGN_LEFT);
+ _btnDescription[5]._bounds.moveTo(_btnList[5]._bounds.right + 2, _btnList[5]._bounds.top + 4);
+
+ _btnList[6].setText(F10);
+ _btnList[6]._bounds.moveTo(5, _btnList[5]._bounds.bottom);
+ _btnDescription[6].set(PAUSE_GAME, 140, ALIGN_LEFT);
+ _btnDescription[6]._bounds.moveTo(_btnList[6]._bounds.right + 2, _btnList[6]._bounds.top + 4);
+
+ for (int i = 0; i < 7; ++i) {
+ addElements(&_btnList[i], &_btnDescription[i], NULL);
+ }
+
+ // Add 'Resume' button
+ _btnResume.setText(RESUME_PLAY);
+ _btnResume._bounds.moveTo(5, _btnList[6]._bounds.bottom + 2);
+ addElements(&_btnResume, NULL);
+
+ // Set the dialog size and position
+ frame();
+ _bounds.collapse(-6, -6);
+ setCenter(160, 100);
+}
+
+} // End of namespace Ringworld2
+
+} // End of namespace TsAGE
diff --git a/engines/tsage/ringworld2/ringworld2_dialogs.h b/engines/tsage/ringworld2/ringworld2_dialogs.h
new file mode 100644
index 0000000000..02a1aed81c
--- /dev/null
+++ b/engines/tsage/ringworld2/ringworld2_dialogs.h
@@ -0,0 +1,91 @@
+/* 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_RINGWORLD2_DIALOGS_H
+#define TSAGE_RINGWORLD2_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 Ringworld2 {
+
+using namespace TsAGE;
+
+class RightClickDialog : public GfxDialog {
+private:
+ GfxSurface _surface;
+ Visage _btnImages;
+ Common::Point _btnList[6];
+
+ 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 CharacterDialog: public GfxDialog {
+private:
+ GfxMessage _msgTitle;
+ GfxButton _btnQuinn, _btnMiranda, _btnSeeker;
+ GfxButton _btnCancel;
+public:
+ CharacterDialog();
+ virtual ~CharacterDialog() {}
+
+ static void show();
+};
+
+class HelpDialog: public GfxDialog {
+private:
+ GfxMessage _msgTitle, _msgVersion;
+ GfxButton _btnList[7];
+ GfxMessage _btnDescription[7];
+ GfxButton _btnResume;
+public:
+ HelpDialog();
+ virtual ~HelpDialog() {}
+
+ static void show();
+};
+
+} // End of namespace Ringworld2
+
+} // End of namespace TsAGE
+
+#endif
diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp
new file mode 100644
index 0000000000..dca3dcead5
--- /dev/null
+++ b/engines/tsage/ringworld2/ringworld2_logic.cpp
@@ -0,0 +1,1037 @@
+/* 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 "tsage/scenes.h"
+#include "tsage/tsage.h"
+#include "tsage/staticres.h"
+#include "tsage/ringworld2/ringworld2_logic.h"
+#include "tsage/ringworld2/ringworld2_dialogs.h"
+#include "tsage/ringworld2/ringworld2_scenes0.h"
+#include "tsage/ringworld2/ringworld2_scenes2.h"
+
+namespace TsAGE {
+
+namespace Ringworld2 {
+
+Scene *Ringworld2Game::createScene(int sceneNumber) {
+ switch (sceneNumber) {
+ /* Scene group #0 */
+ //
+ case 50: return new Scene50();
+ // Quinn's room
+ case 100: return new Scene100();
+ // Computer console
+ case 125: return new Scene125();
+ //
+ case 150:
+ case 160:
+ case 175:
+ case 180:
+ error("Missing scene %d from group 0", sceneNumber);
+ case 200:
+ // Ship Corridor
+ return new Scene200();
+ case 205:
+ case 250:
+ error("Missing scene %d from group 0", sceneNumber);
+ case 300:
+ return new Scene300();
+ case 325:
+ case 400:
+ case 500:
+ case 525:
+ case 600:
+ case 700:
+ case 800:
+ case 825:
+ case 850:
+ case 900:
+ error("Missing scene %d from group 0", sceneNumber);
+ /* Scene group #1 */
+ //
+ case 1000:
+ case 1010:
+ case 1020:
+ case 1100:
+ case 1200:
+ case 1330:
+ case 1500:
+ case 1525:
+ case 1530:
+ case 1550:
+ case 1575:
+ case 1580:
+ case 1625:
+ case 1700:
+ case 1750:
+ case 1800:
+ case 1850:
+ case 1875:
+ case 1900:
+ case 1925:
+ case 1945:
+ case 1950:
+ error("Missing scene %d from group 1", sceneNumber);
+ /* Scene group #2 */
+ //
+ case 2000:
+ // Maze
+ return new Scene2000();
+ case 2350:
+ // Maze: Balloon Launch Platform
+ return new Scene2350();
+ case 2400:
+ // Maze: Large empty room
+ return new Scene2400();
+ case 2425:
+ // Maze:
+ return new Scene2425();
+ case 2430:
+ // Maze: Bedroom
+ return new Scene2430();
+ case 2435:
+ // Maze: Throne room
+ return new Scene2435();
+ case 2440:
+ // Maze: Another bedroom
+ return new Scene2440();
+ case 2445:
+ // Maze:
+ return new Scene2445();
+ case 2450:
+ // Maze: Another bedroom
+ return new Scene2450();
+ case 2455:
+ // Maze: Inside crevasse
+ return new Scene2455();
+ case 2500:
+ // Maze: Large Cave
+ return new Scene2500();
+ case 2525:
+ case 2530:
+ case 2535:
+ case 2600:
+ case 2700:
+ case 2750:
+ case 2800:
+ case 2900:
+ error("Missing scene %d from group 2", sceneNumber);
+ /* Scene group #3 */
+ //
+ case 3100:
+ case 3125:
+ case 3150:
+ case 3175:
+ case 3200:
+ case 3210:
+ case 3220:
+ case 3230:
+ case 3240:
+ case 3245:
+ case 3250:
+ case 3255:
+ case 3260:
+ case 3275:
+ case 3350:
+ case 3375:
+ case 3385:
+ case 3395:
+ case 3400:
+ case 3500:
+ case 3600:
+ case 3700:
+ case 3800:
+ case 3900:
+ error("Missing scene %d from group 3", sceneNumber);
+ default:
+ error("Unknown scene number - %d", sceneNumber);
+ break;
+ }
+}
+
+/**
+ * Returns true if it is currently okay to restore a game
+ */
+bool Ringworld2Game::canLoadGameStateCurrently() {
+ return true;
+}
+
+/**
+ * Returns true if it is currently okay to save the game
+ */
+bool Ringworld2Game::canSaveGameStateCurrently() {
+ return true;
+}
+
+/*--------------------------------------------------------------------------*/
+
+SceneExt::SceneExt(): Scene() {
+ _stripManager._onBegin = SceneExt::startStrip;
+ _stripManager._onEnd = SceneExt::endStrip;
+
+ _field372 = _field37A = 0;
+ _savedPlayerEnabled = false;
+ _savedUiEnabled = false;
+ _savedCanWalk = false;
+ _focusObject = NULL;
+}
+
+void SceneExt::postInit(SceneObjectList *OwnerList) {
+ Scene::postInit(OwnerList);
+
+ // Exclude the bottom area of the screen to allow room for the UI
+ T2_GLOBALS._interfaceY = UI_INTERFACE_Y;
+
+ // Initialise fields
+ _action = NULL;
+ _field12 = 0;
+ _sceneMode = 0;
+}
+
+void SceneExt::remove() {
+ _sceneAreas.clear();
+ Scene::remove();
+}
+
+void SceneExt::process(Event &event) {
+ if (!event.handled)
+ Scene::process(event);
+}
+
+void SceneExt::dispatch() {
+/*
+ _timerList.dispatch();
+
+ if (_field37A) {
+ if ((--_field37A == 0) && R2_GLOBALS._dayNumber) {
+ if (R2_GLOBALS._uiElements._active && R2_GLOBALS._player._enabled) {
+ R2_GLOBALS._uiElements.show();
+ }
+
+ _field37A = 0;
+ }
+ }
+*/
+ Scene::dispatch();
+}
+
+void SceneExt::loadScene(int sceneNum) {
+ Scene::loadScene(sceneNum);
+
+ _v51C34.top = 0;
+ _v51C34.bottom = 300;
+
+ int prevScene = R2_GLOBALS._sceneManager._previousScene;
+ int sceneNumber = R2_GLOBALS._sceneManager._sceneNumber;
+
+ if (((prevScene == -1) && (sceneNumber != 180) && (sceneNumber != 205) && (sceneNumber != 50)) ||
+ (sceneNumber == 50) || ((prevScene == 205) && (sceneNumber == 100)) ||
+ ((prevScene == 180) && (sceneNumber == 100))) {
+ // TODO: sub_17875
+ R2_GLOBALS._v58CE2 = 1;
+ R2_GLOBALS._uiElements.show();
+ } else {
+ // Update the user interface
+ R2_GLOBALS._uiElements.updateInventory();
+ }
+}
+
+bool SceneExt::display(CursorType action) {
+ switch (action) {
+ case CURSOR_CROSSHAIRS:
+ return false;
+ case CURSOR_LOOK:
+ SceneItem::display2(1, R2_GLOBALS._randomSource.getRandomNumber(4));
+ break;
+ case CURSOR_USE:
+ SceneItem::display2(1, R2_GLOBALS._randomSource.getRandomNumber(4) + 5);
+ break;
+ case CURSOR_TALK:
+ SceneItem::display2(1, R2_GLOBALS._randomSource.getRandomNumber(4) + 10);
+ break;
+ default:
+ return false;
+ }
+
+ return true;
+}
+
+void SceneExt::fadeOut() {
+ uint32 black = 0;
+ R2_GLOBALS._scenePalette.fade((const byte *)&black, false, 100);
+}
+
+void SceneExt::startStrip() {
+ SceneExt *scene = (SceneExt *)R2_GLOBALS._sceneManager._scene;
+ scene->_field372 = 1;
+ scene->_savedPlayerEnabled = R2_GLOBALS._player._enabled;
+
+ if (scene->_savedPlayerEnabled) {
+ scene->_savedUiEnabled = R2_GLOBALS._player._uiEnabled;
+ scene->_savedCanWalk = R2_GLOBALS._player._canWalk;
+ R2_GLOBALS._player.disableControl();
+/*
+ if (!R2_GLOBALS._v50696 && R2_GLOBALS._uiElements._active)
+ R2_GLOBALS._uiElements.hide();
+*/
+ }
+}
+
+void SceneExt::endStrip() {
+ SceneExt *scene = (SceneExt *)R2_GLOBALS._sceneManager._scene;
+ scene->_field372 = 0;
+
+ if (scene->_savedPlayerEnabled) {
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._uiEnabled = scene->_savedUiEnabled;
+ R2_GLOBALS._player._canWalk = scene->_savedCanWalk;
+/*
+ if (!R2_GLOBALS._v50696 && R2_GLOBALS._uiElements._active)
+ R2_GLOBALS._uiElements.show();
+*/
+ }
+}
+
+void SceneExt::clearScreen() {
+ R2_GLOBALS._screenSurface.fillRect(R2_GLOBALS._screenSurface.getBounds(), 0);
+}
+
+void SceneExt::refreshBackground(int xAmount, int yAmount) {
+ switch (_activeScreenNumber) {
+ case 700:
+ case 1020:
+ case 1100:
+ case 1700:
+ case 2600:
+ case 2950:
+ case 3100:
+ case 3101:
+ case 3275:
+ case 3600:
+ // Use traditional style sectioned screen loading
+ Scene::refreshBackground(xAmount, yAmount);
+ return;
+ default:
+ // Break out to new style screen loading
+ break;
+ }
+
+ /* New style background loading */
+
+ // Get the screen data
+ byte *dataP = g_resourceManager->getResource(RT18, _activeScreenNumber, 0);
+ int screenSize = g_vm->_memoryManager.getSize(dataP);
+
+ // Lock the background for update
+ Graphics::Surface s = _backSurface.lockSurface();
+ assert(screenSize == (s.w * s.h));
+
+ // Copy the data
+ byte *destP = (byte *)s.getBasePtr(0, 0);
+ Common::copy(dataP, dataP + (s.w * s.h), destP);
+ _backSurface.unlockSurface();
+
+ // Free the resource data
+ DEALLOCATE(dataP);
+}
+
+/**
+ * Saves the current player position and view in the details for the specified character index
+ */
+void SceneExt::saveCharacter(int characterIndex) {
+ R2_GLOBALS._player._characterPos[characterIndex] = R2_GLOBALS._player._position;
+ R2_GLOBALS._player._characterStrip[characterIndex] = R2_GLOBALS._player._strip;
+ R2_GLOBALS._player._characterFrame[characterIndex] = R2_GLOBALS._player._frame;
+}
+
+/*--------------------------------------------------------------------------*/
+
+void SceneHandlerExt::postInit(SceneObjectList *OwnerList) {
+ SceneHandler::postInit(OwnerList);
+}
+
+void SceneHandlerExt::process(Event &event) {
+ if (T2_GLOBALS._uiElements._active) {
+ T2_GLOBALS._uiElements.process(event);
+ if (event.handled)
+ return;
+ }
+
+ SceneExt *scene = static_cast<SceneExt *>(R2_GLOBALS._sceneManager._scene);
+ if (scene && R2_GLOBALS._player._uiEnabled) {
+ // Handle any scene areas that have been registered
+ SynchronizedList<SceneArea *>::iterator saIter;
+ for (saIter = scene->_sceneAreas.begin(); saIter != scene->_sceneAreas.end() && !event.handled; ++saIter) {
+ (*saIter)->process(event);
+ }
+ }
+
+ if (!event.handled)
+ SceneHandler::process(event);
+}
+
+/*--------------------------------------------------------------------------*/
+
+DisplayHotspot::DisplayHotspot(int regionId, ...) {
+ _sceneRegionId = regionId;
+
+ // Load up the actions
+ va_list va;
+ va_start(va, regionId);
+
+ int param = va_arg(va, int);
+ while (param != LIST_END) {
+ _actions.push_back(param);
+ param = va_arg(va, int);
+ }
+
+ va_end(va);
+}
+
+bool DisplayHotspot::performAction(int action) {
+ for (uint i = 0; i < _actions.size(); i += 3) {
+ if (_actions[i] == action) {
+ display(_actions[i + 1], _actions[i + 2], SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/*--------------------------------------------------------------------------*/
+
+DisplayObject::DisplayObject(int firstAction, ...) {
+ // Load up the actions
+ va_list va;
+ va_start(va, firstAction);
+
+ int param = firstAction;
+ while (param != LIST_END) {
+ _actions.push_back(param);
+ param = va_arg(va, int);
+ }
+
+ va_end(va);
+}
+
+bool DisplayObject::performAction(int action) {
+ for (uint i = 0; i < _actions.size(); i += 3) {
+ if (_actions[i] == action) {
+ display(_actions[i + 1], _actions[i + 2], SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/*--------------------------------------------------------------------------*/
+
+Ringworld2InvObjectList::Ringworld2InvObjectList():
+ _none(1, 1),
+ _inv1(1, 2),
+ _inv2(1, 3),
+ _negatorGun(1, 4),
+ _steppingDisks(1, 5),
+ _inv5(1, 6),
+ _inv6(1, 7),
+ _inv7(1, 8),
+ _inv8(1, 9),
+ _inv9(1, 10),
+ _inv10(1, 11),
+ _inv11(1, 12),
+ _inv12(1, 13),
+ _inv13(1, 14),
+ _inv14(1, 15),
+ _inv15(1, 16),
+ _inv16(1, 17),
+ _inv17(2, 2),
+ _inv18(2, 3),
+ _inv19(2, 4),
+ _inv20(2, 5),
+ _inv21(2, 5),
+ _inv22(2, 6),
+ _inv23(2, 7),
+ _inv24(2, 8),
+ _inv25(2, 9),
+ _inv26(2, 10),
+ _inv27(2, 11),
+ _inv28(2, 12),
+ _inv29(2, 13),
+ _inv30(2, 14),
+ _inv31(2, 15),
+ _inv32(2, 16),
+ _inv33(3, 2),
+ _inv34(3, 3),
+ _inv35(3, 4),
+ _inv36(3, 5),
+ _inv37(3, 6),
+ _inv38(3, 7),
+ _inv39(1, 10),
+ _inv40(3, 8),
+ _inv41(3, 9),
+ _inv42(3, 10),
+ _inv43(3, 11),
+ _inv44(3, 12),
+ _inv45(3, 13),
+ _inv46(3, 17),
+ _inv47(3, 14),
+ _inv48(3, 14),
+ _inv49(3, 15),
+ _inv50(3, 15),
+ _inv51(3, 17),
+ _inv52(4, 2) {
+
+ // Add the items to the list
+ _itemList.push_back(&_none);
+ _itemList.push_back(&_inv1);
+ _itemList.push_back(&_inv2);
+ _itemList.push_back(&_negatorGun);
+ _itemList.push_back(&_steppingDisks);
+ _itemList.push_back(&_inv5);
+ _itemList.push_back(&_inv6);
+ _itemList.push_back(&_inv7);
+ _itemList.push_back(&_inv8);
+ _itemList.push_back(&_inv9);
+ _itemList.push_back(&_inv10);
+ _itemList.push_back(&_inv11);
+ _itemList.push_back(&_inv12);
+ _itemList.push_back(&_inv13);
+ _itemList.push_back(&_inv14);
+ _itemList.push_back(&_inv15);
+ _itemList.push_back(&_inv16);
+ _itemList.push_back(&_inv17);
+ _itemList.push_back(&_inv18);
+ _itemList.push_back(&_inv19);
+ _itemList.push_back(&_inv20);
+ _itemList.push_back(&_inv21);
+ _itemList.push_back(&_inv22);
+ _itemList.push_back(&_inv23);
+ _itemList.push_back(&_inv24);
+ _itemList.push_back(&_inv25);
+ _itemList.push_back(&_inv26);
+ _itemList.push_back(&_inv27);
+ _itemList.push_back(&_inv28);
+ _itemList.push_back(&_inv29);
+ _itemList.push_back(&_inv30);
+ _itemList.push_back(&_inv31);
+ _itemList.push_back(&_inv32);
+ _itemList.push_back(&_inv33);
+ _itemList.push_back(&_inv34);
+ _itemList.push_back(&_inv35);
+ _itemList.push_back(&_inv36);
+ _itemList.push_back(&_inv37);
+ _itemList.push_back(&_inv38);
+ _itemList.push_back(&_inv39);
+ _itemList.push_back(&_inv40);
+ _itemList.push_back(&_inv41);
+ _itemList.push_back(&_inv42);
+ _itemList.push_back(&_inv43);
+ _itemList.push_back(&_inv44);
+ _itemList.push_back(&_inv45);
+ _itemList.push_back(&_inv46);
+ _itemList.push_back(&_inv47);
+ _itemList.push_back(&_inv48);
+ _itemList.push_back(&_inv49);
+ _itemList.push_back(&_inv50);
+ _itemList.push_back(&_inv51);
+ _itemList.push_back(&_inv52);
+
+ _selectedItem = NULL;
+}
+
+void Ringworld2InvObjectList::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(R2_OPTO_DISK, 800);
+ setObjectScene(R2_2, 400);
+ setObjectScene(R2_NEGATOR_GUN, 100);
+ setObjectScene(R2_STEPPING_DISKS, 100);
+ setObjectScene(R2_5, 400);
+ setObjectScene(R2_6, 400);
+ setObjectScene(R2_7, 500);
+ setObjectScene(R2_8, 700);
+ setObjectScene(R2_9, 800);
+ setObjectScene(R2_10, 100);
+ setObjectScene(R2_11, 400);
+ setObjectScene(R2_12, 500);
+ setObjectScene(R2_13, 1550);
+ setObjectScene(R2_14, 850);
+ setObjectScene(R2_15, 850);
+ setObjectScene(R2_16, 0);
+ setObjectScene(R2_17, 1550);
+ setObjectScene(R2_18, 1550);
+ setObjectScene(R2_19, 1550);
+ setObjectScene(R2_20, 500);
+ setObjectScene(R2_21, 500);
+ setObjectScene(R2_22, 1550);
+ setObjectScene(R2_23, 1580);
+ setObjectScene(R2_24, 9999);
+ setObjectScene(R2_25, 1550);
+ setObjectScene(R2_26, 1550);
+ setObjectScene(R2_27, 1580);
+ setObjectScene(R2_28, 1550);
+ setObjectScene(R2_29, 2525);
+ setObjectScene(R2_30, 2440);
+ setObjectScene(R2_31, 2455);
+ setObjectScene(R2_32, 2535);
+ setObjectScene(R2_33, 2530);
+ setObjectScene(R2_34, 1950);
+ setObjectScene(R2_35, 1950);
+ setObjectScene(R2_36, 9999);
+ setObjectScene(R2_37, 2430);
+ setObjectScene(R2_38, 9999);
+ setObjectScene(R2_39, 2);
+ setObjectScene(R2_40, 9999);
+ setObjectScene(R2_41, 3150);
+ setObjectScene(R2_42, 0);
+ setObjectScene(R2_43, 3260);
+ setObjectScene(R2_44, 2);
+ setObjectScene(R2_45, 1550);
+ setObjectScene(R2_46, 0);
+ setObjectScene(R2_47, 3150);
+ setObjectScene(R2_48, 2435);
+ setObjectScene(R2_49, 2440);
+ setObjectScene(R2_50, 2435);
+ setObjectScene(R2_51, 1580);
+ setObjectScene(R2_52, 3260);
+}
+
+void Ringworld2InvObjectList::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 (R2_GLOBALS._events.getCursor() == objectNum)
+ R2_GLOBALS._events.setCursor(CURSOR_USE);
+
+ // Update the user interface if necessary
+ T2_GLOBALS._uiElements.updateInventory();
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Ringworld2Game::start() {
+ int slot = -1;
+
+ if (ConfMan.hasKey("save_slot")) {
+ slot = ConfMan.getInt("save_slot");
+ Common::String file = g_vm->generateSaveName(slot);
+ Common::InSaveFile *in = g_vm->_system->getSavefileManager()->openForLoading(file);
+ if (in)
+ delete in;
+ else
+ slot = -1;
+ }
+
+ if (slot >= 0)
+ R2_GLOBALS._sceneHandler->_loadGameSlot = slot;
+ else {
+ // Switch to the first game scene
+ R2_GLOBALS._events.setCursor(CURSOR_WALK);
+ R2_GLOBALS._uiElements._active = true;
+ R2_GLOBALS._sceneManager.setNewScene(100);
+ }
+
+ g_globals->_events.showCursor();
+}
+
+void Ringworld2Game::restart() {
+ g_globals->_scenePalette.clearListeners();
+ g_globals->_soundHandler.stop();
+
+ // Change to the first game scene
+ g_globals->_sceneManager.changeScene(100);
+}
+
+void Ringworld2Game::endGame(int resNum, int lineNum) {
+ 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)
+ g_vm->quitGame();
+ else
+ restart();
+ } else {
+ // Savegames exist, so prompt for Restore/Restart
+ bool breakFlag;
+ do {
+ if (g_vm->shouldQuit()) {
+ breakFlag = true;
+ } else if (MessageDialog::show(msg, RESTART_BTN_STRING, RESTORE_BTN_STRING) == 0) {
+ restart();
+ breakFlag = true;
+ } else {
+ handleSaveLoad(false, g_globals->_sceneHandler->_loadGameSlot, g_globals->_sceneHandler->_saveName);
+ breakFlag = g_globals->_sceneHandler->_loadGameSlot >= 0;
+ }
+ } while (!breakFlag);
+ }
+
+ g_globals->_events.setCursorFromFlag();
+}
+
+void Ringworld2Game::processEvent(Event &event) {
+ if (event.eventType == EVENT_KEYPRESS) {
+ switch (event.kbd.keycode) {
+ case Common::KEYCODE_F1:
+ // F1 - Help
+ HelpDialog::show();
+ 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_F8:
+ // F8 - Credits
+ warning("TODO: Show Credits");
+ break;
+
+ case Common::KEYCODE_F10:
+ // F10 - Pause
+ GfxDialog::setPalette();
+ MessageDialog::show(GAME_PAUSED_MSG, OK_BTN_STRING);
+ g_globals->_events.setCursorFromFlag();
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+void Ringworld2Game::rightClick() {
+ RightClickDialog *dlg = new RightClickDialog();
+ dlg->execute();
+ delete dlg;
+}
+
+/*--------------------------------------------------------------------------*/
+
+NamedHotspot::NamedHotspot() : SceneHotspot() {
+ _resNum = 0;
+ _lookLineNum = _useLineNum = _talkLineNum = -1;
+}
+
+bool NamedHotspot::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_WALK:
+ // Nothing
+ return false;
+ case CURSOR_LOOK:
+ if (_lookLineNum == -1)
+ return SceneHotspot::startAction(action, event);
+
+ SceneItem::display2(_resNum, _lookLineNum);
+ return true;
+ case CURSOR_USE:
+ if (_useLineNum == -1)
+ return SceneHotspot::startAction(action, event);
+
+ SceneItem::display2(_resNum, _useLineNum);
+ return true;
+ case CURSOR_TALK:
+ if (_talkLineNum == -1)
+ return SceneHotspot::startAction(action, event);
+
+ SceneItem::display2(_resNum, _talkLineNum);
+ return true;
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+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;
+ g_globals->_sceneItems.addItems(this, NULL);
+}
+
+void NamedHotspot::setDetails(const Rect &bounds, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item) {
+ setBounds(bounds);
+ _resNum = resNum;
+ _lookLineNum = lookLineNum;
+ _talkLineNum = talkLineNum;
+ _useLineNum = useLineNum;
+
+ switch (mode) {
+ case 2:
+ g_globals->_sceneItems.push_front(this);
+ break;
+ case 4:
+ g_globals->_sceneItems.addBefore(item, this);
+ break;
+ case 5:
+ g_globals->_sceneItems.addAfter(item, this);
+ break;
+ default:
+ g_globals->_sceneItems.push_back(this);
+ break;
+ }
+}
+
+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) {
+ SceneHotspot::synchronize(s);
+ s.syncAsSint16LE(_resNum);
+ s.syncAsSint16LE(_lookLineNum);
+ s.syncAsSint16LE(_useLineNum);
+
+ if (g_vm->getGameID() == GType_BlueForce)
+ s.syncAsSint16LE(_talkLineNum);
+}
+
+void SceneActor::postInit(SceneObjectList *OwnerList) {
+ _lookLineNum = _talkLineNum = _useLineNum = -1;
+ SceneObject::postInit();
+}
+
+void SceneActor::synchronize(Serializer &s) {
+ SceneObject::synchronize(s);
+ s.syncAsSint16LE(_resNum);
+ s.syncAsSint16LE(_lookLineNum);
+ s.syncAsSint16LE(_talkLineNum);
+ s.syncAsSint16LE(_useLineNum);
+}
+
+bool SceneActor::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 *)R2_GLOBALS._sceneManager._scene)->display(action);
+ return handled;
+}
+
+void SceneActor::setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item) {
+ _resNum = resNum;
+ _lookLineNum = lookLineNum;
+ _talkLineNum = talkLineNum;
+ _useLineNum = useLineNum;
+
+ switch (mode) {
+ case 2:
+ g_globals->_sceneItems.push_front(this);
+ break;
+ case 4:
+ g_globals->_sceneItems.addBefore(item, this);
+ break;
+ case 5:
+ g_globals->_sceneItems.addAfter(item, this);
+ break;
+ default:
+ g_globals->_sceneItems.push_back(this);
+ break;
+ }
+}
+
+void SceneActor::setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum) {
+ _resNum = resNum;
+ _lookLineNum = lookLineNum;
+ _talkLineNum = talkLineNum;
+ _useLineNum = useLineNum;
+}
+
+/*--------------------------------------------------------------------------*/
+
+SceneArea::SceneArea(): EventHandler() {
+ _enabled = true;
+ _insideArea = false;
+ _savedCursorNum = CURSOR_NONE;
+ _cursorState = 0;
+}
+
+void SceneArea::synchronize(Serializer &s) {
+ EventHandler::synchronize(s);
+
+ _bounds.synchronize(s);
+ s.syncAsSint16LE(_enabled);
+ s.syncAsSint16LE(_insideArea);
+ s.syncAsSint16LE(_cursorNum);
+ s.syncAsSint16LE(_savedCursorNum);
+ s.syncAsSint16LE(_cursorState);
+}
+
+void SceneArea::remove() {
+ static_cast<SceneExt *>(R2_GLOBALS._sceneManager._scene)->_sceneAreas.remove(this);
+}
+
+void SceneArea::process(Event &event) {
+ if (!R2_GLOBALS._insetUp && _enabled && R2_GLOBALS._events.isCursorVisible()) {
+ CursorType cursor = R2_GLOBALS._events.getCursor();
+
+ if (_bounds.contains(event.mousePos)) {
+ // Cursor moving in bounded area
+ if (cursor != _cursorNum) {
+ _savedCursorNum = cursor;
+ _cursorState = 0;
+ R2_GLOBALS._events.setCursor(_cursorNum);
+ }
+ _insideArea = true;
+ } else if ((event.mousePos.y < 171) && _insideArea && (_cursorNum == cursor) &&
+ (_savedCursorNum != CURSOR_NONE)) {
+ // Cursor moved outside bounded area
+ R2_GLOBALS._events.setCursor(_savedCursorNum);
+ }
+ }
+}
+
+void SceneArea::setDetails(const Rect &bounds, CursorType cursor) {
+ _bounds = bounds;
+ _cursorNum = cursor;
+
+ static_cast<SceneExt *>(R2_GLOBALS._sceneManager._scene)->_sceneAreas.push_front(this);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SceneExit::SceneExit(): SceneArea() {
+ _moving = false;
+ _destPos = Common::Point(-1, -1);
+}
+
+void SceneExit::synchronize(Serializer &s) {
+ SceneArea::synchronize(s);
+
+ s.syncAsSint16LE(_moving);
+ s.syncAsSint16LE(_destPos.x);
+ s.syncAsSint16LE(_destPos.y);
+}
+
+void SceneExit::setDetails(const Rect &bounds, CursorType cursor, int sceneNumber) {
+ _sceneNumber = sceneNumber;
+ SceneArea::setDetails(bounds, cursor);
+}
+
+void SceneExit::changeScene() {
+ R2_GLOBALS._sceneManager.setNewScene(_sceneNumber);
+}
+
+void SceneExit::process(Event &event) {
+ if (!R2_GLOBALS._insetUp) {
+ SceneArea::process(event);
+
+ if (_enabled) {
+ if (event.eventType == EVENT_BUTTON_DOWN) {
+ if (!_bounds.contains(event.mousePos))
+ _moving = false;
+ else if (!R2_GLOBALS._player._canWalk) {
+ _moving = false;
+ changeScene();
+ event.handled = true;
+ } else {
+ Common::Point dest((_destPos.x == -1) ? event.mousePos.x : _destPos.x,
+ (_destPos.y == -1) ? event.mousePos.y : _destPos.y);
+ ADD_PLAYER_MOVER(dest.x, dest.y);
+
+ _moving = true;
+ event.handled = true;
+ }
+ }
+
+ if (_moving && (_bounds.contains(R2_GLOBALS._player._position) || (R2_GLOBALS._player._position == _destPos)))
+ changeScene();
+ }
+ }
+}
+
+} // End of namespace Ringworld2
+
+} // End of namespace TsAGE
diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h
new file mode 100644
index 0000000000..9eaa1b0cd1
--- /dev/null
+++ b/engines/tsage/ringworld2/ringworld2_logic.h
@@ -0,0 +1,289 @@
+/* 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_RINGWORLD2_LOGIC_H
+#define TSAGE_RINGWORLD2_LOGIC_H
+
+#include "common/scummsys.h"
+#include "tsage/events.h"
+#include "tsage/core.h"
+#include "tsage/scenes.h"
+#include "tsage/globals.h"
+
+namespace TsAGE {
+
+namespace Ringworld2 {
+
+using namespace TsAGE;
+
+#define R2_INVENTORY (*((::TsAGE::Ringworld2::Ringworld2InvObjectList *)g_globals->_inventory))
+
+class SceneFactory {
+public:
+ static Scene *createScene(int sceneNumber);
+};
+
+class SceneArea: public EventHandler {
+public:
+ Rect _bounds;
+ bool _enabled;
+ bool _insideArea;
+ CursorType _cursorNum;
+ CursorType _savedCursorNum;
+ int _cursorState;
+public:
+ SceneArea();
+ void setDetails(const Rect &bounds, CursorType cursor);
+
+ virtual void synchronize(Serializer &s);
+ virtual void remove();
+ virtual void process(Event &event);
+};
+
+class SceneExit: public SceneArea {
+public:
+ bool _moving;
+ int _sceneNumber;
+ Common::Point _destPos;
+public:
+ SceneExit();
+ virtual void setDetails(const Rect &bounds, CursorType cursor, int sceneNumber);
+ virtual void setDest(const Common::Point &p) { _destPos = p; }
+ virtual void changeScene();
+
+ virtual void synchronize(Serializer &s);
+ virtual void process(Event &event);
+};
+
+class SceneExt: public Scene {
+private:
+ static void startStrip();
+ static void endStrip();
+public:
+ int _field372;
+ bool _savedPlayerEnabled;
+ bool _savedUiEnabled;
+ bool _savedCanWalk;
+ int _field37A;
+
+ SceneObject *_focusObject;
+ Visage _cursorVisage;
+ SynchronizedList<SceneArea *> _sceneAreas;
+
+ Rect _v51C34;
+public:
+ SceneExt();
+
+ virtual Common::String getClassName() { return "SceneExt"; }
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void process(Event &event);
+ virtual void dispatch();
+ virtual void loadScene(int sceneNum);
+ virtual void refreshBackground(int xAmount, int yAmount);
+ virtual void saveCharacter(int characterIndex);
+
+ bool display(CursorType action);
+ void fadeOut();
+ void clearScreen();
+};
+
+class SceneHandlerExt: public SceneHandler {
+public:
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void process(Event &event);
+};
+
+
+class DisplayHotspot : public SceneObject {
+private:
+ Common::Array<int> _actions;
+ bool performAction(int action);
+public:
+ DisplayHotspot(int regionId, ...);
+
+ virtual void doAction(int action) {
+ if (!performAction(action))
+ SceneHotspot::doAction(action);
+ }
+};
+
+class DisplayObject : public SceneObject {
+private:
+ Common::Array<int> _actions;
+ bool performAction(int action);
+public:
+ DisplayObject(int firstAction, ...);
+
+ virtual void doAction(int action) {
+ if (!performAction(action))
+ SceneHotspot::doAction(action);
+ }
+};
+
+class SceneObjectExt : public SceneObject {
+public:
+ int _state;
+
+ virtual void synchronize(Serializer &s) {
+ SceneObject::synchronize(s);
+ s.syncAsSint16LE(_state);
+ }
+ virtual Common::String getClassName() { return "SceneObjectExt"; }
+};
+
+/*--------------------------------------------------------------------------*/
+
+class Ringworld2InvObjectList : public InvObjectList {
+public:
+ InvObject _none;
+ InvObject _inv1;
+ InvObject _inv2;
+ InvObject _negatorGun;
+ InvObject _steppingDisks;
+ InvObject _inv5;
+ InvObject _inv6;
+ InvObject _inv7;
+ InvObject _inv8;
+ InvObject _inv9;
+ InvObject _inv10;
+ InvObject _inv11;
+ InvObject _inv12;
+ InvObject _inv13;
+ InvObject _inv14;
+ InvObject _inv15;
+ InvObject _inv16;
+ InvObject _inv17;
+ InvObject _inv18;
+ InvObject _inv19;
+ InvObject _inv20;
+ InvObject _inv21;
+ InvObject _inv22;
+ InvObject _inv23;
+ InvObject _inv24;
+ InvObject _inv25;
+ InvObject _inv26;
+ InvObject _inv27;
+ InvObject _inv28;
+ InvObject _inv29;
+ InvObject _inv30;
+ InvObject _inv31;
+ InvObject _inv32;
+ InvObject _inv33;
+ InvObject _inv34;
+ InvObject _inv35;
+ InvObject _inv36;
+ InvObject _inv37;
+ InvObject _inv38;
+ InvObject _inv39;
+ InvObject _inv40;
+ InvObject _inv41;
+ InvObject _inv42;
+ InvObject _inv43;
+ InvObject _inv44;
+ InvObject _inv45;
+ InvObject _inv46;
+ InvObject _inv47;
+ InvObject _inv48;
+ InvObject _inv49;
+ InvObject _inv50;
+ InvObject _inv51;
+ InvObject _inv52;
+
+ Ringworld2InvObjectList();
+ void reset();
+ void setObjectScene(int objectNum, int sceneNumber);
+
+ virtual Common::String getClassName() { return "Ringworld2InvObjectList"; }
+};
+
+#define RING2_INVENTORY (*((::TsAGE::Ringworld2::Ringworld2InvObjectList *)g_globals->_inventory))
+
+class Ringworld2Game: public Game {
+public:
+ virtual void start();
+ virtual void restart();
+ virtual void endGame(int resNum, int lineNum);
+
+ virtual Scene *createScene(int sceneNumber);
+ virtual void processEvent(Event &event);
+ virtual void rightClick();
+ virtual bool canSaveGameStateCurrently();
+ virtual bool canLoadGameStateCurrently();
+};
+
+class NamedHotspot : public SceneHotspot {
+public:
+ int _resNum, _lookLineNum, _useLineNum, _talkLineNum;
+ NamedHotspot();
+
+ virtual bool startAction(CursorType action, Event &event);
+ virtual Common::String getClassName() { return "NamedHotspot"; }
+ virtual void synchronize(Serializer &s);
+ 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 = 0);
+};
+
+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);
+ }
+};
+
+class SceneActor: public SceneObject {
+public:
+ int _resNum;
+ int _lookLineNum, _talkLineNum, _useLineNum;
+
+ virtual Common::String getClassName() { return "SceneActor"; }
+ virtual void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual bool startAction(CursorType action, Event &event);
+
+ 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 SceneActorExt: public SceneActor {
+public:
+ int _state;
+
+ SceneActorExt() { _state = 0; }
+ virtual Common::String getClassName() { return "SceneActorExt"; }
+ virtual void synchronize(Serializer &s) {
+ SceneActor::synchronize(s);
+ s.syncAsSint16LE(_state);
+ }
+};
+
+} // End of namespace Ringworld2
+
+} // End of namespace TsAGE
+
+#endif
diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp
new file mode 100644
index 0000000000..214853ce86
--- /dev/null
+++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp
@@ -0,0 +1,2256 @@
+/* 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/scenes.h"
+#include "tsage/tsage.h"
+#include "tsage/staticres.h"
+#include "tsage/ringworld2/ringworld2_scenes0.h"
+#include "tsage/ringworld2/ringworld2_speakers.h"
+
+namespace TsAGE {
+
+namespace Ringworld2 {
+
+void Scene50::Action1::signal() {
+ switch (_actionIndex++) {
+ case 0:
+ setDelay(2);
+ break;
+ case 1:
+ setDelay(180);
+ break;
+ case 2:
+ R2_GLOBALS._sceneManager.changeScene(100);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene50::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit(OwnerList);
+ loadScene(110);
+
+ R2_GLOBALS._v58CE2 = 0;
+ R2_GLOBALS._scenePalette.loadPalette(0);
+
+ R2_GLOBALS._sound2.play(10);
+ R2_GLOBALS._player.disableControl();
+
+ setAction(&_action1);
+}
+
+void Scene50::process(Event &event) {
+ if ((event.eventType != EVENT_BUTTON_DOWN) && (event.eventType != EVENT_KEYPRESS) && (event.eventType == 27)) {
+ event.handled = true;
+ warning("TODO: incomplete Scene50::process()");
+ // CursorType _oldCursorId = _cursorId;
+ g_globals->_events.setCursor(R2_2);
+ // _cursorManager.sub_1D474(2, 0);
+ // sub_5566A(1);
+ // _cursorManager._fieldE = _oldCursorId;
+ R2_GLOBALS._sceneManager.changeScene(100);
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 100 - Quinn's Room
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene100::Door::startAction(CursorType action, Event &event) {
+ Scene100 *scene = (Scene100 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (_state) {
+ SceneItem::display2(100, 6);
+ } else {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 101;
+ scene->setAction(&scene->_sequenceManager1, scene, 101, &R2_GLOBALS._player, this, NULL);
+ }
+ return true;
+ case CURSOR_TALK:
+ if (_state) {
+ SceneItem::display2(100, 26);
+ _state = 0;
+ scene->_object10.setFrame(1);
+ } else {
+ SceneItem::display2(100, 27);
+ _state = 1;
+ scene->_object10.setFrame(2);
+ }
+ return true;
+ default:
+ return SceneActor::startAction(action, event);
+ }
+}
+
+bool Scene100::Table::startAction(CursorType action, Event &event) {
+ Scene100 *scene = (Scene100 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ R2_GLOBALS._player.disableControl();
+ if (_strip == 2) {
+ scene->_sceneMode = 108;
+ scene->_object3.postInit();
+ scene->_stasisNegator.postInit();
+
+ if (R2_INVENTORY.getObjectScene(R2_NEGATOR_GUN) == 1) {
+ scene->_stasisNegator.setup(100, 7, 2);
+ } else {
+ scene->_stasisNegator.setup(100, 7, 1);
+ scene->_stasisNegator.setDetails(100, 21, 22, 23, 2, NULL);
+ }
+
+ scene->setAction(&scene->_sequenceManager2, scene, 108, this, &scene->_object3,
+ &scene->_stasisNegator, &R2_GLOBALS._player, NULL);
+ } else {
+ scene->_sceneMode = 109;
+ scene->setAction(&scene->_sequenceManager2, scene, 109, this, &scene->_object3,
+ &scene->_stasisNegator, &R2_GLOBALS._player, NULL);
+ }
+ return true;
+ case CURSOR_TALK:
+ R2_GLOBALS._player.disableControl();
+
+ if (_strip == 2) {
+ SceneItem::display2(100, 18);
+ scene->_sceneMode = 102;
+ scene->_object3.postInit();
+ scene->_stasisNegator.postInit();
+
+ if (R2_INVENTORY.getObjectScene(R2_NEGATOR_GUN) == 1) {
+ scene->_stasisNegator.setup(100, 7, 2);
+ } else {
+ scene->_stasisNegator.setup(100, 7, 1);
+ scene->_stasisNegator.setDetails(100, 21, 22, 23, 2, NULL);
+ }
+
+ scene->setAction(&scene->_sequenceManager2, scene, 102, this, &scene->_object3,
+ &scene->_stasisNegator, NULL);
+ } else {
+ SceneItem::display2(100, 19);
+ scene->_sceneMode = 103;
+ scene->setAction(&scene->_sequenceManager2, scene, 103, this, &scene->_object3,
+ &scene->_stasisNegator, NULL);
+ }
+ return true;
+ default:
+ return SceneActor::startAction(action, event);
+ }
+}
+
+bool Scene100::StasisNegator::startAction(CursorType action, Event &event) {
+ Scene100 *scene = (Scene100 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 107;
+ scene->setAction(&scene->_sequenceManager1, scene, 107, &R2_GLOBALS._player, &scene->_stasisNegator, NULL);
+ return true;
+ default:
+ return SceneActor::startAction(action, event);
+ }
+}
+
+bool Scene100::Object10::startAction(CursorType action, Event &event) {
+ Scene100 *scene = (Scene100 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(100, _state ? 24 : 25);
+ return true;
+ case CURSOR_TALK:
+ SceneItem::display2(100, _state ? 26 : 27);
+ return true;
+ case CURSOR_USE:
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 110;
+ scene->setAction(&scene->_sequenceManager1, scene, 110, &R2_GLOBALS._player, NULL);
+ return true;
+ default:
+ return SceneActor::startAction(action, event);
+ }
+}
+
+bool Scene100::SteppingDisks::startAction(CursorType action, Event &event) {
+ Scene100 *scene = (Scene100 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 111;
+ scene->setAction(&scene->_sequenceManager1, scene, 111, &R2_GLOBALS._player, this, NULL);
+ return true;
+ default:
+ return SceneActor::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene100::Terminal::startAction(CursorType action, Event &event) {
+ Scene100 *scene = (Scene100 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 105;
+ scene->setAction(&scene->_sequenceManager1, scene, 105, &R2_GLOBALS._player, this, NULL);
+ return true;
+ default:
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene100::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(100);
+ R2_GLOBALS._scenePalette.loadPalette(0);
+
+ if (R2_GLOBALS._sceneManager._previousScene != 125)
+ R2_GLOBALS._sound1.play(10);
+
+ _door.postInit();
+ _door._state = 0;
+ _door.setVisage(100);
+ _door.setPosition(Common::Point(160, 84));
+ _door.setDetails(100, 3, 4, 5, 1, NULL);
+
+ _object10.postInit();
+ _object10.setup(100, 2, 1);
+ _object10.setDetails(100, -1, -1, -1, 1, NULL);
+
+ _table.postInit();
+ _table.setup(100, 2, 3);
+ _table.setPosition(Common::Point(175, 157));
+ _table.setDetails(100, 17, 18, 20, 1, NULL);
+
+ _object1.postInit();
+ _object1.setup(100, 3, 1);
+ _object1.setPosition(Common::Point(89, 79));
+ _object1.fixPriority(250);
+ _object1.animate(ANIM_MODE_2, NULL);
+ _object1._numFrames = 3;
+
+ _object2.postInit();
+ _object2.setup(100, 3, 1);
+ _object2.setPosition(Common::Point(89, 147));
+ _object2.fixPriority(250);
+ _object2.animate(ANIM_MODE_7, 0, NULL);
+ _object2._numFrames = 3;
+
+ _object6.postInit();
+ _object6.setVisage(101);
+ _object6.setPosition(Common::Point(231, 126));
+ _object6.fixPriority(10);
+ _object6.setDetails(100, 37, -1, 39, 1, NULL);
+
+ if (R2_INVENTORY.getObjectScene(R2_STEPPING_DISKS) == 100) {
+ _steppingDisks.postInit();
+ _steppingDisks.setup(100, 8, 1);
+ _steppingDisks.setPosition(Common::Point(274, 130));
+ _steppingDisks.setDetails(100, 40, -1, 42, 1, NULL);
+ }
+
+ _terminal.setDetails(11, 100, 14, 15, 16);
+ _desk.setDetails(12, 100, 11, -1, 13);
+ _bed.setDetails(13, 100, 8, 9, 10);
+ _duct.setDetails(14, 100, 34, -1, 36);
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.setVisage(10);
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ R2_GLOBALS._player.disableControl();
+
+ _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 100, 0, 1, -1, 1, NULL);
+
+ switch (R2_GLOBALS._sceneManager._previousScene) {
+ case 50:
+ case 180:
+ _object5.postInit();
+ _object4.postInit();
+ _sceneMode = 104;
+ setAction(&_sequenceManager1, this, 104, &R2_GLOBALS._player, &_object6, &_object4, &_object5, NULL);
+ break;
+ case 125:
+ _sceneMode = 100;
+ setAction(&_sequenceManager1, this, 106, &R2_GLOBALS._player, NULL);
+ break;
+ case 200:
+ _sceneMode = 100;
+ setAction(&_sequenceManager1, this, 100, &R2_GLOBALS._player, &_door, NULL);
+ break;
+ default:
+ R2_GLOBALS._player.setStrip(3);
+ R2_GLOBALS._player.setPosition(Common::Point(180, 100));
+ R2_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene100::remove() {
+ R2_GLOBALS._sound1.play(10);
+ SceneExt::remove();
+}
+
+void Scene100::signal() {
+ switch (_sceneMode) {
+ case 101:
+ R2_GLOBALS._sceneManager.changeScene(200);
+ break;
+ case 103:
+ case 109:
+ _table.setStrip(2);
+ _table.setFrame(3);
+
+ _object3.remove();
+ _stasisNegator.remove();
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 104:
+ _sceneMode = 0;
+ _object5.remove();
+ _object4.remove();
+
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ R2_GLOBALS._player._numFrames = 10;
+ R2_GLOBALS._player.fixPriority(-1);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 105:
+ R2_GLOBALS._sceneManager.changeScene(125);
+ break;
+ case 107:
+ R2_GLOBALS._sceneItems.remove(&_stasisNegator);
+
+ _stasisNegator.setFrame(2);
+ R2_INVENTORY.setObjectScene(R2_NEGATOR_GUN, 1);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 110:
+ if (_door._state) {
+ _door._state = 0;
+ _object10.setFrame(1);
+ } else {
+ _door._state = 1;
+ _object10.setFrame(2);
+ }
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 111:
+ R2_INVENTORY.setObjectScene(R2_STEPPING_DISKS, 1);
+ _steppingDisks.remove();
+ R2_GLOBALS._player.enableControl();
+ break;
+ default:
+ R2_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene100::dispatch() {
+ int regionIndex = R2_GLOBALS._player.getRegionIndex();
+ if (regionIndex == 13)
+ R2_GLOBALS._player._shade = 4;
+
+ if ((R2_GLOBALS._player._visage == 13) || (R2_GLOBALS._player._visage == 101))
+ R2_GLOBALS._player._shade = 0;
+
+ SceneExt::dispatch();
+
+ if ((_sceneMode == 101) && (_door._frame == 2) && (_table._strip == 5)) {
+ _table.setAction(&_sequenceManager2, NULL, 103, &_table, &_object3, &_stasisNegator, NULL);
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 125 - Computer Terminal
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene125::Object5::startAction(CursorType action, Event &event) {
+ if (action == CURSOR_USE)
+ return true;
+ else
+ return SceneActor::startAction(action, event);
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene125::Icon::Icon(): SceneActor() {
+ _lookLineNum = 0;
+ _field98 = 0;
+ _pressed = false;
+}
+
+void Scene125::Icon::postInit(SceneObjectList *OwnerList) {
+ SceneObject::postInit();
+
+ _object1.postInit();
+ _object1.fixPriority(255);
+ _object1.hide();
+
+ _sceneText1._color1 = 92;
+ _sceneText1._color2 = 0;
+ _sceneText1._width = 200;
+ _sceneText2._color1 = 0;
+ _sceneText2._color2 = 0;
+ _sceneText2._width = 200;
+ setDetails(125, -1, -1, -1, 2, NULL);
+}
+
+void Scene125::Icon::synchronize(Serializer &s) {
+ SceneActor::synchronize(s);
+ s.syncAsSint16LE(_lookLineNum);
+ s.syncAsSint16LE(_field98);
+ s.syncAsSint16LE(_pressed);
+}
+
+void Scene125::Icon::process(Event &event) {
+ Scene125 *scene = (Scene125 *)R2_GLOBALS._sceneManager._scene;
+
+ if (!event.handled && !(_flags & OBJFLAG_HIDING) && R2_GLOBALS._player._uiEnabled) {
+
+ if (event.eventType == EVENT_BUTTON_DOWN) {
+ int regionIndex = R2_GLOBALS._sceneRegions.indexOf(event.mousePos);
+
+ switch (R2_GLOBALS._events.getCursor()) {
+ case CURSOR_LOOK:
+ if (regionIndex == _sceneRegionId) {
+ event.handled = true;
+ if (_lookLineNum == 26) {
+ SceneItem::display2(130, 7);
+ } else {
+ SceneItem::display2(130, _lookLineNum);
+ }
+ }
+ break;
+
+ case CURSOR_USE:
+ if ((regionIndex == _sceneRegionId) && !_pressed) {
+ scene->_sound1.play(14);
+ setFrame(2);
+
+ switch (_object1._strip) {
+ case 1:
+ _object1.setStrip(2);
+ break;
+ case 3:
+ _object1.setStrip(4);
+ break;
+ case 5:
+ _object1.setStrip(6);
+ break;
+ default:
+ break;
+ }
+
+ _pressed = true;
+ event.handled = true;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if ((event.eventType == EVENT_BUTTON_UP) && _pressed) {
+ setFrame(1);
+
+ switch (_object1._strip) {
+ case 2:
+ _object1.setStrip(1);
+ break;
+ case 4:
+ _object1.setStrip(3);
+ break;
+ case 6:
+ _object1.setStrip(5);
+ break;
+ default:
+ break;
+ }
+
+ _pressed = false;
+ event.handled = true;
+ scene->consoleAction(_lookLineNum);
+ }
+ }
+}
+
+void Scene125::Icon::setIcon(int id) {
+ Scene125 *scene = (Scene125 *)R2_GLOBALS._sceneManager._scene;
+
+ _lookLineNum = _field98 = id;
+ SceneActor::_lookLineNum = id;
+
+ _sceneText1.remove();
+ _sceneText2.remove();
+
+ if (_lookLineNum) {
+ showIcon();
+ _object1.setup(161, ((id - 1) / 10) * 2 + 1, ((id - 1) % 10) + 1);
+ _object1.setPosition(_position);
+
+ _sceneText1._fontNumber = scene->_iconFontNumber;
+ _sceneText1.setup(CONSOLE_MESSAGES[id]);
+ _sceneText1.fixPriority(20);
+
+ _sceneText2._fontNumber = scene->_iconFontNumber;
+ _sceneText2.setup(CONSOLE_MESSAGES[id]);
+ _sceneText2.fixPriority(20);
+
+ _sceneText2._fontNumber = scene->_iconFontNumber;
+ _sceneText2.setup(CONSOLE_MESSAGES[id]);
+ _sceneText2.fixPriority(10);
+
+ switch (_lookLineNum) {
+ case 5:
+ _sceneText1.setPosition(Common::Point(62, _position.y + 8));
+ _sceneText2.setPosition(Common::Point(64, _position.y + 10));
+ break;
+ case 6:
+ case 7:
+ case 24:
+ case 25:
+ _sceneText1.setPosition(Common::Point(65, _position.y + 8));
+ _sceneText2.setPosition(Common::Point(67, _position.y + 10));
+ break;
+ case 26:
+ _sceneText1.setPosition(Common::Point(83, _position.y + 8));
+ _sceneText2.setPosition(Common::Point(85, _position.y + 10));
+ break;
+ default:
+ _sceneText1.setPosition(Common::Point(121, _position.y + 8));
+ _sceneText2.setPosition(Common::Point(123, _position.y + 10));
+ break;
+ }
+ } else {
+ hideIcon();
+ }
+}
+
+void Scene125::Icon::showIcon() {
+ _sceneText1.show();
+ _sceneText2.show();
+ _object1.show();
+ _object2.show();
+ show();
+}
+
+void Scene125::Icon::hideIcon() {
+ _sceneText1.hide();
+ _sceneText2.hide();
+ _object1.hide();
+ _object2.hide();
+ hide();
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene125::Item4::startAction(CursorType action, Event &event) {
+ Scene125 *scene = (Scene125 *)R2_GLOBALS._sceneManager._scene;
+ switch (action) {
+ case CURSOR_USE:
+ if (R2_INVENTORY.getObjectScene(R2_OPTO_DISK) == R2_GLOBALS._player._oldCharacterScene[1]) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 126;
+ scene->setAction(&scene->_sequenceManager, scene, 126, &scene->_object7, NULL);
+ return true;
+ }
+ break;
+ case R2_OPTO_DISK:
+ if (R2_INVENTORY.getObjectScene(R2_OPTO_DISK) == 1) {
+ R2_GLOBALS._player.disableControl();
+ scene->_object7.postInit();
+ scene->_sceneMode = 125;
+ scene->setAction(&scene->_sequenceManager, scene, 125, &scene->_object7, NULL);
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+
+ return SceneHotspot::startAction(action, event);
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene125::Scene125(): SceneExt() {
+ _iconFontNumber = 50;
+ _consoleMode = 5;
+ _logIndex = _databaseIndex = _infodiskIndex = 0;
+
+ _soundCount = _soundIndex = 0;
+ for (int i = 0; i < 10; ++i)
+ _soundIndexes[i] = 0;
+}
+
+void Scene125::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(160);
+ _palette.loadPalette(0);
+
+ if (R2_GLOBALS._sceneManager._previousScene != 125)
+ // Save the prior scene to return to when the console is turned off
+ R2_GLOBALS._player._oldCharacterScene[1] = R2_GLOBALS._sceneManager._previousScene;
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.hide();
+ R2_GLOBALS._player.disableControl();
+
+ if (R2_INVENTORY.getObjectScene(R2_OPTO_DISK) == R2_GLOBALS._player._oldCharacterScene[1]) {
+ _object7.postInit();
+ _object7.setup(160, 3, 5);
+ _object7.setPosition(Common::Point(47, 167));
+ }
+
+ _object6.postInit();
+ _object6.setup(162, 1, 1);
+ _object6.setPosition(Common::Point(214, 168));
+
+ _item4.setDetails(Rect(27, 145, 81, 159), 126, 9, -1, -1, 1, NULL);
+ _item3.setDetails(Rect(144, 119, 286, 167), 126, 6, 7, 8, 1, NULL);
+ _item2.setDetails(1, 126, 3, 4, 5);
+ _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 126, 0, 1, -1, 1, NULL);
+
+ _sceneMode = 1;
+ signal();
+}
+
+void Scene125::signal() {
+ switch (_sceneMode) {
+ case 1:
+ _icon1.postInit();
+ _icon1._sceneRegionId = 2;
+ _icon2.postInit();
+ _icon2._sceneRegionId = 3;
+ _icon3.postInit();
+ _icon3._sceneRegionId = 4;
+ _icon4.postInit();
+ _icon4._sceneRegionId = 5;
+
+ _sceneMode = 2;
+ setAction(&_sequenceManager, this, 127, &_icon1, &_icon2, &_icon3, &_icon4, &R2_GLOBALS._player, NULL);
+ break;
+ case 2:
+ _icon1.setup(160, 1, 1);
+ _icon1.setPosition(Common::Point(65, 17));
+ _icon1._object2.postInit();
+ _icon1._object2.setup(160, 7, 1);
+ _icon1._object2.setPosition(Common::Point(106, 41));
+
+ _icon2.setup(160, 1, 1);
+ _icon2.setPosition(Common::Point(80, 32));
+ _icon2._object2.postInit();
+ _icon2._object2.setup(160, 7, 2);
+ _icon2._object2.setPosition(Common::Point(106, 56));
+
+ _icon3.setup(160, 1, 1);
+ _icon3.setPosition(Common::Point(65, 47));
+ _icon3._object2.postInit();
+ _icon3._object2.setup(160, 7, 1);
+ _icon3._object2.setPosition(Common::Point(106, 71));
+
+ _icon4.setup(160, 1, 1);
+ _icon4.setPosition(Common::Point(80, 62));
+ _icon4._sceneRegionId = 5;
+ _icon4._object2.postInit();
+ _icon4._object2.setup(160, 7, 2);
+ _icon4._object2.setPosition(Common::Point(106, 86));
+
+ _icon5.postInit();
+ _icon5.setup(160, 1, 1);
+ _icon5.setPosition(Common::Point(37, 92));
+ _icon5.setIcon(6);
+ _icon5._sceneRegionId = 7;
+
+ _icon6.postInit();
+ _icon6.setup(160, 1, 1);
+ _icon6.setPosition(Common::Point(106, 110));
+ _icon6.setIcon(5);
+ _icon6._sceneRegionId = 8;
+
+ consoleAction(5);
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ break;
+ case 10:
+ switch (_consoleMode) {
+ case 12:
+ _sceneMode = 129;
+
+ _object1.postInit();
+ _object2.postInit();
+ _object3.postInit();
+
+ if (R2_GLOBALS.getFlag(13)) {
+ _object4.postInit();
+ setAction(&_sequenceManager, this, 130, &R2_GLOBALS._player, &_object1, &_object2,
+ &_object3, &_object4, NULL);
+ } else {
+ setAction(&_sequenceManager, this, 129, &R2_GLOBALS._player, &_object1, &_object2, &_object3, NULL);
+ }
+ break;
+ case 13:
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ _infodiskIndex = 0;
+ setDetails(129, 0);
+ break;
+ case 23:
+ R2_GLOBALS._sceneManager.changeScene(1330);
+ break;
+ case 27:
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ _databaseIndex = 0;
+ setDetails(128, 0);
+ break;
+ case 28:
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ _databaseIndex = 37;
+ setDetails(128, 37);
+ break;
+ case 29:
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ _databaseIndex = 68;
+ setDetails(128, 68);
+ break;
+ case 30:
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ _databaseIndex = 105;
+ setDetails(128, 105);
+ break;
+ default:
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ _logIndex = 0;
+ setDetails(127, 0);
+ break;
+ }
+ break;
+ case 11:
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+
+ if ((_consoleMode >= 27) && (_consoleMode <= 30)) {
+ consoleAction(11);
+ }
+ consoleAction(2);
+ _icon6.setIcon(5);
+ break;
+ case 12:
+ if (_soundCount > 0)
+ --_soundCount;
+ if (!_soundCount || (R2_GLOBALS._speechSubtitles & SPEECH_VOICE)) {
+ _soundIndex = 0;
+ R2_GLOBALS._playStream.stop();
+ } else {
+ _sceneMode = 12;
+ R2_GLOBALS._playStream.play(_soundIndexes[_soundIndex++], this);
+ }
+ break;
+ case 125:
+ R2_INVENTORY.setObjectScene(R2_OPTO_DISK, R2_GLOBALS._player._oldCharacterScene[1]);
+ break;
+ case 126:
+ R2_INVENTORY.setObjectScene(R2_OPTO_DISK, 1);
+ _object7.remove();
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ break;
+ case 128:
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ SceneItem::display2(126, 12);
+ break;
+ default:
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ break;
+ }
+}
+
+void Scene125::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+
+ s.syncAsSint16LE(_consoleMode);
+ s.syncAsSint16LE(_iconFontNumber);
+ s.syncAsSint16LE(_logIndex);
+ s.syncAsSint16LE(_databaseIndex);
+ s.syncAsSint16LE(_infodiskIndex);
+ s.syncAsSint16LE(_soundCount);
+ s.syncAsSint16LE(_soundIndex);
+
+ for (int i = 0; i < 10; ++i)
+ s.syncAsSint16LE(_soundIndexes[i]);
+}
+
+void Scene125::process(Event &event) {
+ SceneExt::process(event);
+
+ if (R2_GLOBALS._player._uiEnabled) {
+ _icon1.process(event);
+ _icon2.process(event);
+ _icon3.process(event);
+ _icon4.process(event);
+ _icon5.process(event);
+ _icon6.process(event);
+ }
+}
+
+void Scene125::dispatch() {
+ if (_soundCount)
+ R2_GLOBALS._playStream.proc1();
+
+ Scene::dispatch();
+}
+
+/**
+ * Handles actions on the console screen.
+ */
+void Scene125::consoleAction(int id) {
+ _icon3.setIcon(0);
+ _icon4.setIcon(0);
+
+ if (id == 5)
+ _icon5.setIcon(6);
+ else {
+ switch (_consoleMode) {
+ case 10:
+ case 12:
+ case 13:
+ case 27:
+ case 28:
+ case 29:
+ case 30:
+ break;
+ default:
+ _icon5.setIcon(7);
+ break;
+ }
+ }
+
+ switch (id) {
+ case 1:
+ _icon1.setIcon(8);
+ _icon2.setIcon(9);
+ break;
+ case 2:
+ _icon1.setIcon(10);
+ _icon2.setIcon(11);
+ _icon3.setIcon(12);
+ _icon4.setIcon(13);
+ break;
+ case 3:
+ _icon1.setIcon(15);
+ _icon2.setIcon(16);
+ _icon3.setIcon(17);
+ break;
+ case 4:
+ _icon1.setIcon(22);
+ _icon2.setIcon(23);
+ break;
+ case 6:
+ R2_GLOBALS._sceneManager.changeScene(R2_GLOBALS._player._oldCharacterScene[1]);
+ break;
+ case 7:
+ if (_consoleMode == 11)
+ consoleAction(2);
+ else if (_consoleMode == 22)
+ consoleAction(4);
+ else
+ consoleAction(5);
+ break;
+ case 8:
+ _iconFontNumber = 50;
+ stop();
+ _icon6.setIcon(5);
+ consoleAction(1);
+ break;
+ case 9:
+ _iconFontNumber = 52;
+ stop();
+ _icon6.setIcon(5);
+ consoleAction(1);
+ break;
+ case 10:
+ R2_GLOBALS._player.disableControl();
+ consoleAction(2);
+ _icon1.hideIcon();
+ _icon2.hideIcon();
+ _icon3.hideIcon();
+ _icon5.setIcon(24);
+
+ _icon4.setPosition(Common::Point(52, 107));
+ _icon4._sceneRegionId = 9;
+ _icon4.setIcon(25);
+ _icon4._object2.hide();
+
+ _icon6.setIcon(26);
+ _sceneMode = 10;
+
+ _palette.loadPalette(161);
+ R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 5, this);
+ break;
+ case 11:
+ _icon1.setIcon(27);
+ _icon2.setIcon(28);
+ _icon3.setIcon(29);
+ _icon4.setIcon(30);
+ break;
+ case 12:
+ R2_GLOBALS._player.disableControl();
+ consoleAction(2);
+ _icon1.hideIcon();
+ _icon2.hideIcon();
+ _icon3.hideIcon();
+ _icon4.hideIcon();
+ _icon5.hideIcon();
+
+ _icon6.setIcon(26);
+ _sceneMode = 10;
+ _palette.loadPalette(161);
+ R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 5, this);
+ break;
+ case 13:
+ consoleAction(2);
+ if (R2_INVENTORY.getObjectScene(R2_OPTO_DISK) != R2_GLOBALS._player._oldCharacterScene[1]) {
+ SceneItem::display2(126, 17);
+ } else {
+ R2_GLOBALS._player.disableControl();
+
+ _icon1.hideIcon();
+ _icon2.hideIcon();
+ _icon3.hideIcon();
+ _icon5.setIcon(24);
+
+ _icon4.setPosition(Common::Point(52, 107));
+ _icon4._sceneRegionId = 9;
+ _icon4.setIcon(25);
+ _icon4._object2.hide();
+
+ _icon6.setIcon(26);
+ _sceneMode = 10;
+
+ _palette.loadPalette(161);
+ R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 5, this);
+ }
+ break;
+ case 15:
+ consoleAction(3);
+
+ if (R2_GLOBALS._v565F5 < 3) {
+ R2_GLOBALS._player.disableControl();
+ _object5.postInit();
+ _object5.setup(162, 2, 2);
+ _object5.setPosition(Common::Point(216, UI_INTERFACE_Y));
+
+ R2_GLOBALS._v565F5 += 2;
+ } else if (R2_GLOBALS._v565F5 == 3) {
+ SceneItem::display2(126, 13);
+ } else {
+ SceneItem::display2(126, 14);
+ }
+ break;
+ case 16:
+ consoleAction(3);
+
+ if (R2_GLOBALS._v565F5 < 4) {
+ R2_GLOBALS._player.disableControl();
+ _object5.postInit();
+ _object5.setup(162, 2, 3);
+ _object5.setPosition(Common::Point(218, UI_INTERFACE_Y));
+
+ ++R2_GLOBALS._v565F5;
+ } else {
+ SceneItem::display2(126, 15);
+ }
+ break;
+ case 17:
+ consoleAction(3);
+
+ if (R2_GLOBALS._v565F5 < 4) {
+ R2_GLOBALS._player.disableControl();
+ _object5.postInit();
+ _object5.setup(162, 2, 1);
+ _object5.setPosition(Common::Point(215, UI_INTERFACE_Y));
+
+ ++R2_GLOBALS._v565F5;
+ } else {
+ SceneItem::display2(126, 16);
+ }
+ break;
+ case 22:
+ _icon1.setIcon(31);
+ _icon2.setIcon(32);
+ _icon3.setIcon(33);
+ _icon4.setIcon(34);
+ break;
+ case 23:
+ R2_GLOBALS._player.disableControl();
+ consoleAction(4);
+ _icon1.hideIcon();
+ _icon2.hideIcon();
+ _icon3.hideIcon();
+ _icon4.hideIcon();
+ _icon5.hideIcon();
+ _icon6.hideIcon();
+
+ _sceneMode = 10;
+ _palette.loadPalette(161);
+ break;
+ case 24:
+ _icon4.setIcon(25);
+ _icon4._object2.hide();
+
+ if (_consoleMode == 10) {
+ setDetails(127, --_logIndex);
+ } else if (_consoleMode == 13) {
+ setDetails(129, --_infodiskIndex);
+ } else {
+ setDetails(128, --_databaseIndex);
+ }
+ break;
+ case 25:
+ _icon4.setIcon(25);
+ _icon4._object2.hide();
+
+ if (_consoleMode == 10) {
+ setDetails(127, ++_logIndex);
+ } else if (_consoleMode == 13) {
+ setDetails(129, ++_infodiskIndex);
+ } else {
+ setDetails(128, ++_databaseIndex);
+ }
+ break;
+ case 26:
+ R2_GLOBALS._player.disableControl();
+ stop();
+ _icon4.setPosition(Common::Point(80, 62));
+ _icon4._sceneRegionId = 5;
+ _icon4.hideIcon();
+
+ R2_GLOBALS._player.hide();
+ _object1.hide();
+ _object2.hide();
+ _object3.hide();
+ _object4.hide();
+
+ _sceneMode = 11;
+ _palette.loadPalette(160);
+ R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 5, this);
+ break;
+ case 27:
+ case 28:
+ case 29:
+ case 30:
+ R2_GLOBALS._player.disableControl();
+ consoleAction(11);
+ _consoleMode = id;
+
+ _icon1.hideIcon();
+ _icon2.hideIcon();
+ _icon3.hideIcon();
+ _icon4.hideIcon();
+ _icon5.setIcon(24);
+
+ _icon4.setPosition(Common::Point(52, 107));
+ _icon4._sceneRegionId = 9;
+ _icon4.setIcon(25);
+ _icon4._object2.hide();
+
+ _icon6.setIcon(26);
+ _sceneMode = 10;
+
+ _palette.loadPalette(161);
+ R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 5, this);
+ break;
+ case 31:
+ consoleAction(22);
+ R2_GLOBALS._sound1.play((R2_GLOBALS._sound1.getSoundNum() == 10) ? 63 : 10);
+ break;
+ case 32:
+ consoleAction(22);
+ R2_GLOBALS._sound1.play((R2_GLOBALS._sound1.getSoundNum() == 10) ? 64 : 10);
+ break;
+ case 33:
+ consoleAction(22);
+ R2_GLOBALS._sound1.play((R2_GLOBALS._sound1.getSoundNum() == 10) ? 65 : 10);
+ break;
+ case 34:
+ consoleAction(22);
+ R2_GLOBALS._sound1.play((R2_GLOBALS._sound1.getSoundNum() == 10) ? 66 : 10);
+ break;
+ default:
+ _icon1.setIcon(1);
+ _icon2.setIcon(2);
+ _icon3.setIcon(3);
+ _icon4.setIcon(4);
+ break;
+ }
+
+ if ((id != 6) && (id != 7) && (id != 24) && (id != 25))
+ _consoleMode = id;
+}
+
+/**
+ * Sets the message to be displayed on the console screen.
+ */
+void Scene125::setDetails(int resNum, int lineNum) {
+ stop();
+
+ Common::String msg = g_resourceManager->getMessage(resNum, lineNum, true);
+
+ if (!msg.empty()) {
+ // Check for any specified sound numbers embedded in the message
+ msg = parseMessage(msg);
+
+ _sceneText._fontNumber = _iconFontNumber;
+ _sceneText._color1 = 92;
+ _sceneText._color2 = 0;
+ _sceneText._width = 221;
+ _sceneText.fixPriority(20);
+ _sceneText.setup(msg);
+ _sceneText.setPosition(Common::Point(49, 19));
+
+ R2_GLOBALS._sceneObjects->draw();
+
+ if ((_soundCount > 0) && (R2_GLOBALS._speechSubtitles & SPEECH_VOICE)) {
+ _sceneMode = 12;
+ R2_GLOBALS._playStream.play(_soundIndexes[_soundIndex], this);
+ }
+ } else {
+ // Passed the start or end of the message set, so return to the menu
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._player.hide();
+
+ _icon4.setPosition(Common::Point(80, 62));
+ _icon4._sceneRegionId = 5;
+ _icon4.hideIcon();
+
+ _consoleMode = 0;
+ _palette.loadPalette(160);
+ _sceneMode = 11;
+ R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 5, this);
+ }
+}
+
+/**
+ * Stops any playing console sounds and hides any current console message.
+ */
+void Scene125::stop() {
+ _sceneText.remove();
+ _soundIndex = 0;
+ _soundCount = 0;
+
+ R2_GLOBALS._playStream.stop();
+}
+
+/**
+ * Parses a message to be displayed on the console to see whether there are any sounds to be played.
+ */
+Common::String Scene125::parseMessage(const Common::String &msg) {
+ _soundIndex = 0;
+ _soundCount = 0;
+
+ const char *msgP = msg.c_str();
+ while (*msgP == '!') {
+ // Get the sound number
+ _soundIndexes[_soundCount++] = atoi(++msgP);
+
+ while (!((*msgP == '\0') || (*msgP < '0') || (*msgP > '9')))
+ ++msgP;
+ }
+
+ return Common::String(msgP);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 200 - Ship Corridor
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene200::NorthDoor::startAction(CursorType action, Event &event) {
+ Scene200 *scene = (Scene200 *)R2_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_USE) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 202;
+ scene->setAction(&scene->_sequenceManager, scene, 202, &R2_GLOBALS._player, this, NULL);
+ return true;
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+}
+
+bool Scene200::EastDoor::startAction(CursorType action, Event &event) {
+ Scene200 *scene = (Scene200 *)R2_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_USE) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 200;
+ scene->setAction(&scene->_sequenceManager, scene, 200, &R2_GLOBALS._player, this, NULL);
+ return true;
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+}
+
+bool Scene200::WestDoor::startAction(CursorType action, Event &event) {
+ Scene200 *scene = (Scene200 *)R2_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_USE) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 204;
+ scene->setAction(&scene->_sequenceManager, scene, 204, &R2_GLOBALS._player, this, NULL);
+ return true;
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene200::EastExit::changeScene() {
+ Scene200 *scene = (Scene200 *)R2_GLOBALS._sceneManager._scene;
+
+ _enabled = false;
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 206;
+ scene->setAction(&scene->_sequenceManager, scene, 206, &R2_GLOBALS._player, NULL);
+}
+
+void Scene200::WestExit::changeScene() {
+ Scene200 *scene = (Scene200 *)R2_GLOBALS._sceneManager._scene;
+
+ _enabled = false;
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 208;
+ scene->setAction(&scene->_sequenceManager, scene, 208, &R2_GLOBALS._player, NULL);
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene200::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(200);
+
+ _westExit.setDetails(Rect(94, 0, 123, 58), EXITCURSOR_W, 175);
+ _westExit.setDest(Common::Point(125, 52));
+ _eastExit.setDetails(Rect(133, 0, 167, 58), EXITCURSOR_E, 150);
+ _eastExit.setDest(Common::Point(135, 52));
+
+ _northDoor.postInit();
+ _northDoor.setVisage(200);
+ _northDoor.setPosition(Common::Point(188, 79));
+ _northDoor.setDetails(200, 3, -1, -1, 1, NULL);
+
+ _eastDoor.postInit();
+ _eastDoor.setVisage(200);
+ _eastDoor.setStrip(2);
+ _eastDoor.setPosition(Common::Point(305, 124));
+ _eastDoor.setDetails(200, 6, -1, -1, 1, NULL);
+
+ _westDoor.postInit();
+ _westDoor.setVisage(200);
+ _westDoor.setStrip(3);
+ _westDoor.setPosition(Common::Point(62, 84));
+ _westDoor.setDetails(200, 9, -1, -1, 1, NULL);
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.setVisage(10);
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ R2_GLOBALS._player.disableControl();
+
+ _compartment.setDetails(Rect(4, 88, 153, 167), 200, 12, -1, -1, 1, NULL);
+ _westDoorDisplay.setDetails(Rect(41, 51, 48, 61), 200, 15, -1, -1, 1, NULL);
+ _eastDoorDisplay.setDetails(Rect(279, 67, 286, 78), 200, 18, -1, -1, 1, NULL);
+ _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 200, 0, -1, -1, 1, NULL);
+
+ switch (R2_GLOBALS._sceneManager._previousScene) {
+ case 100:
+ _sceneMode = 201;
+ setAction(&_sequenceManager, this, 201, &R2_GLOBALS._player, &_eastDoor, NULL);
+ break;
+ case 150:
+ _sceneMode = 207;
+ setAction(&_sequenceManager, this, 207, &R2_GLOBALS._player, NULL);
+ break;
+ case 175:
+ _sceneMode = 209;
+ setAction(&_sequenceManager, this, 209, &R2_GLOBALS._player, NULL);
+ break;
+ case 250:
+ _sceneMode = 203;
+ setAction(&_sequenceManager, this, 203, &R2_GLOBALS._player, &_northDoor, NULL);
+ break;
+ case 400:
+ _sceneMode = 205;
+ setAction(&_sequenceManager, this, 205, &R2_GLOBALS._player, &_westDoor, NULL);
+ break;
+ default:
+ R2_GLOBALS._player.setStrip(3);
+ R2_GLOBALS._player.setPosition(Common::Point(215, 115));
+ R2_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene200::signal() {
+ switch (_sceneMode) {
+ case 200:
+ R2_GLOBALS._sceneManager.changeScene(100);
+ break;
+ case 202:
+ R2_GLOBALS._sceneManager.changeScene(250);
+ break;
+ case 204:
+ R2_GLOBALS._sceneManager.changeScene(400);
+ break;
+ case 206:
+ R2_GLOBALS._sceneManager.changeScene(150);
+ break;
+ case 208:
+ R2_GLOBALS._sceneManager.changeScene(175);
+ break;
+ default:
+ R2_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 300 - Bridge
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene300::Action1::signal() {
+ Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex) {
+ case 0:
+ setAction(&scene->_sequenceManager2, this, 311, (R2_GLOBALS._player._characterIndex == 1) ?
+ (SceneObject *)&R2_GLOBALS._player : (SceneObject *)&scene->_quinn);
+ _actionIndex = 2;
+ break;
+ case 1:
+ setAction(&scene->_sequenceManager2, this, 312, (R2_GLOBALS._player._characterIndex == 1) ?
+ (SceneObject *)&R2_GLOBALS._player : (SceneObject *)&scene->_quinn);
+ _actionIndex = 0;
+ break;
+ case 2:
+ if (!R2_GLOBALS._playStream.isPlaying())
+ _actionIndex = R2_GLOBALS._randomSource.getRandomNumber(1);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene300::Action2::signal() {
+ Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex) {
+ case 0:
+ setAction(&scene->_sequenceManager3, this, 302, &scene->_seeker, NULL);
+ _actionIndex = 2;
+ break;
+ case 1:
+ setAction(&scene->_sequenceManager3, this, 303, &scene->_seeker, NULL);
+ _actionIndex = 2;
+ break;
+ case 2:
+ if (!R2_GLOBALS._playStream.isPlaying())
+ _actionIndex = R2_GLOBALS._randomSource.getRandomNumber(1);
+
+ setDelay(60 + R2_GLOBALS._randomSource.getRandomNumber(119));
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene300::Action3::signal() {
+ Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex) {
+ case 0:
+ setAction(&scene->_sequenceManager3, this, 304, &scene->_miranda, NULL);
+ _actionIndex = 2;
+ break;
+ case 1:
+ setAction(&scene->_sequenceManager3, this, 305, &scene->_miranda, NULL);
+ _actionIndex = 2;
+ break;
+ case 2:
+ if (!R2_GLOBALS._playStream.isPlaying())
+ _actionIndex = R2_GLOBALS._randomSource.getRandomNumber(1);
+
+ setDelay(60 + R2_GLOBALS._randomSource.getRandomNumber(119));
+ break;
+ default:
+ break;
+ }
+}
+
+
+void Scene300::Action4::signal() {
+ Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene;
+
+ if (!R2_GLOBALS._playStream.isPlaying()) {
+ scene->_object7.setStrip2(R2_GLOBALS._randomSource.getRandomNumber(2));
+ scene->_object7.setFrame(1);
+
+ scene->_object9.setStrip2(3);
+ scene->_object9.setFrame(1);
+ }
+
+ setDelay(60 + R2_GLOBALS._randomSource.getRandomNumber(479));
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene300::QuinnWorkstation::startAction(CursorType action, Event &event) {
+ Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (R2_GLOBALS._player._characterIndex != 1)
+ SceneItem::display2(300, 46);
+ else if (R2_GLOBALS.getFlag(44)) {
+ R2_GLOBALS._player.setAction(NULL);
+ R2_GLOBALS._sceneManager.changeScene(325);
+ } else {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 306;
+ scene->setAction(&scene->_sequenceManager1, scene, 306, &R2_GLOBALS._player, NULL);
+ }
+ return true;
+
+ case CURSOR_LOOK:
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ SceneItem::display2(300, 47);
+ return true;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return NamedHotspot::startAction(action, event);
+}
+
+bool Scene300::MirandaWorkstation::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_USE:
+ if (R2_GLOBALS._player._characterIndex != 3)
+ SceneItem::display2(300, 49);
+ else
+ R2_GLOBALS._sceneManager.changeScene(325);
+ return true;
+
+ case CURSOR_LOOK:
+ if (R2_GLOBALS._player._characterIndex == 3) {
+ SceneItem::display2(300, 47);
+ return true;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return NamedHotspot::startAction(action, event);
+}
+
+bool Scene300::SeekerWorkstation::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ if (R2_GLOBALS._player._characterIndex == 2) {
+ SceneItem::display2(300, 47);
+ return true;
+ }
+ break;
+
+ case CURSOR_USE:
+ if (R2_GLOBALS._player._characterIndex != 2)
+ SceneItem::display2(300, 48);
+ else
+ R2_GLOBALS._sceneManager.changeScene(325);
+ return true;
+
+ default:
+ break;
+ }
+
+ return NamedHotspot::startAction(action, event);
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene300::Miranda::startAction(CursorType action, Event &event) {
+ Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_TALK:
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ // Quinn talking to Miranda
+ R2_GLOBALS._player.disableControl();
+
+ if (!R2_GLOBALS.getFlag(44)) {
+ if (R2_GLOBALS.getFlag(40))
+ scene->_stripId = 119;
+ else if (R2_GLOBALS.getFlag(38))
+ scene->_stripId = 101;
+ else {
+ R2_GLOBALS._sound1.play(69);
+ scene->_stripId = 100;
+ }
+
+ scene->_sceneMode = 309;
+ scene->setAction(&scene->_sequenceManager1, scene, 309, &R2_GLOBALS._player, NULL);
+ } else if (!R2_GLOBALS.getFlag(55)) {
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+ scene->_sceneMode = 10;
+ scene->_stripManager.start3(scene->_stripId, scene, R2_GLOBALS._stripManager_lookupList);
+ } else {
+ scene->_sceneMode = 16;
+
+ if (!R2_GLOBALS.getFlag(57)) {
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+ scene->_stripManager.start3(434, scene, R2_GLOBALS._stripManager_lookupList);
+ } else if (R2_GLOBALS._player._characterScene[R2_MIRANDA] != 500) {
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+ scene->_stripManager.start3(407, scene, R2_GLOBALS._stripManager_lookupList);
+ } else {
+ scene->_stripId = 433;
+ scene->_sceneMode = 309;
+ scene->setAction(&scene->_sequenceManager1, scene, 309, &R2_GLOBALS._player, NULL);
+ }
+ }
+ } else {
+ // Seeker talking to Miranda
+ scene->_sceneMode = 10;
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+
+ if (!R2_GLOBALS.getFlag(44))
+ scene->_stripId = 174 + R2_GLOBALS._randomSource.getRandomNumber(2);
+ else if (!R2_GLOBALS.getFlag(55))
+ scene->_stripId = 211;
+ else
+ scene->_stripId = 438;
+
+ scene->_stripManager.start3(scene->_stripId, scene, R2_GLOBALS._stripManager_lookupList);
+ }
+ return true;
+
+ case R2_OPTO_DISK:
+ SceneItem::display2(300, 54);
+ return true;
+
+ case R2_2:
+ if (!R2_GLOBALS.getFlag(2) || !R2_GLOBALS.getFlag(3) || (R2_INVENTORY.getObjectScene(R2_OPTO_DISK) == 1))
+ SceneItem::display2(300, 55);
+ else {
+ R2_GLOBALS._player.disableControl();
+ scene->_stripId = R2_GLOBALS.getFlag(4) ? 121 : 120;
+ scene->_sceneMode = 309;
+ scene->setAction(&scene->_sequenceManager1, scene, 309, &R2_GLOBALS._player, NULL);
+ }
+ return true;
+
+ default:
+ break;
+ }
+
+ return SceneActor::startAction(action, event);
+}
+
+bool Scene300::Seeker::startAction(CursorType action, Event &event) {
+ Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_TALK:
+ R2_GLOBALS._player.disableControl();
+
+ if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
+ if (R2_GLOBALS.getFlag(44)) {
+ if (!R2_GLOBALS.getFlag(38)) {
+ R2_GLOBALS._sound1.play(69);
+ scene->_stripId = 181;
+ scene->_sceneMode = 310;
+ scene->setAction(&scene->_sequenceManager1, scene, 309, &R2_GLOBALS._player, NULL);
+ } else {
+ scene->_stripId = R2_GLOBALS.getFlag(40) ? 170 : 150;
+ scene->_sceneMode = 310;
+ scene->setAction(&scene->_sequenceManager1, scene, 309, &R2_GLOBALS._player, NULL);
+ }
+ } else {
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+ if (!R2_GLOBALS.getFlag(55)) {
+ scene->_sceneMode = 10;
+ scene->_stripManager.start3(205, scene, R2_GLOBALS._stripManager_lookupList);
+ } else {
+ scene->_sceneMode = 16;
+ scene->_stripManager.start3(R2_GLOBALS.getFlag(57) ? 407 : 401, scene, R2_GLOBALS._stripManager_lookupList);
+ }
+ }
+ } else {
+ scene->_sceneMode = 10;
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+
+ if (!R2_GLOBALS.getFlag(44))
+ scene->_stripId = 122 + R2_GLOBALS._randomSource.getRandomNumber(2);
+ else if (!R2_GLOBALS.getFlag(55))
+ scene->_stripId = 209;
+ else
+ scene->_stripId = 440;
+
+ scene->_stripManager.start3(scene->_stripId, scene, R2_GLOBALS._stripManager_lookupList);
+ }
+ return true;
+
+ case R2_OPTO_DISK:
+ if (R2_GLOBALS.getFlag(13)) {
+ SceneItem::display2(300, 53);
+ } else {
+ R2_GLOBALS._player.disableControl();
+ scene->_stripId = 171;
+ }
+
+ scene->_sceneMode = 310;
+ scene->setAction(&scene->_sequenceManager1, scene, 310, &R2_GLOBALS._player, NULL);
+ return true;
+
+ case R2_2:
+ if (!R2_GLOBALS.getFlag(2) || !R2_GLOBALS.getFlag(3) || (R2_INVENTORY.getObjectScene(R2_OPTO_DISK) == 1))
+ break;
+
+ R2_GLOBALS._player.disableControl();
+ scene->_stripId = R2_GLOBALS.getFlag(4) ? 173 : 172;
+ scene->_sceneMode = 310;
+ scene->setAction(&scene->_sequenceManager1, scene, 310, &R2_GLOBALS._player, NULL);
+ return true;
+
+ default:
+ break;
+ }
+
+ return SceneActor::startAction(action, event);
+}
+
+bool Scene300::Quinn::startAction(CursorType action, Event &event) {
+ Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_TALK:
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+ scene->_sceneMode = 10;
+
+ if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) {
+ if (R2_GLOBALS._player._characterScene[R2_MIRANDA] == 500)
+ scene->_stripId = 442;
+ else if (!R2_GLOBALS.getFlag(44))
+ scene->_stripId = 177 + R2_GLOBALS._randomSource.getRandomNumber(2);
+ else if (!R2_GLOBALS.getFlag(55))
+ scene->_stripId = 208;
+ else
+ scene->_stripId = 441;
+ } else if (R2_GLOBALS._player._characterScene[R2_MIRANDA] == 500) {
+ scene->_stripId = 442;
+ } else if (R2_GLOBALS.getFlag(44)) {
+ scene->_stripId = R2_GLOBALS.getFlag(55) ? 441 : 208;
+ } else {
+ scene->_stripId = 125 + R2_GLOBALS._randomSource.getRandomNumber(2);
+ }
+
+ scene->_stripManager.start3(scene->_stripId, scene, R2_GLOBALS._stripManager_lookupList);
+ return true;
+
+ default:
+ return SceneActor::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene300::Scene300(): SceneExt() {
+ _stripId = 0;
+ _rotation = NULL;
+}
+
+void Scene300::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+
+ s.syncAsSint16LE(_stripId);
+ SYNC_POINTER(_rotation);
+}
+
+void Scene300::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(300);
+ _sound1.play(23);
+ setZoomPercents(75, 93, 120, 100);
+
+ if (R2_GLOBALS._sceneManager._previousScene == -1) {
+ R2_GLOBALS._sceneManager._previousScene = 1000;
+ R2_GLOBALS._player._characterIndex = R2_QUINN;
+ }
+
+ _stripManager.setColors(60, 255);
+ _stripManager.setFontNumber(3);
+ _stripManager.addSpeaker(&_mirandaSpeaker);
+ _stripManager.addSpeaker(&_seekerSpeaker);
+ _stripManager.addSpeaker(&_quinnSpeaker);
+ _stripManager.addSpeaker(&_quinnLSpeaker);
+ _stripManager.addSpeaker(&_seekerLSpeaker);
+ _stripManager.addSpeaker(&_tealSpeaker);
+ _stripManager.addSpeaker(&_soldierSpeaker);
+
+ _rotation = R2_GLOBALS._scenePalette.addRotation(237, 254, -1);
+ _rotation->setDelay(3);
+ _rotation->_countdown = 1;
+
+ if (R2_GLOBALS.getFlag(51) && !R2_GLOBALS.getFlag(25)) {
+ _object1.postInit();
+ _object1.setup(301, 7, 2);
+ _object1.setPosition(Common::Point(65, 24));
+
+ _object2.postInit();
+ _object2.setup(301, 8, 2);
+ _object2.setPosition(Common::Point(254, 24));
+ }
+
+ _doorway.postInit();
+ _doorway.setVisage(300);
+ _doorway.setPosition(Common::Point(159, 79));
+
+ _object3.postInit();
+ _object3.setup(300, 4, 1);
+ _object3.setPosition(Common::Point(84, 48));
+ _object3.animate(ANIM_MODE_2, NULL);
+ _object3._numFrames = 5;
+
+ _object4.postInit();
+ _object4.setup(300, 5, 1);
+ _object4.setPosition(Common::Point(236, 48));
+
+ _object4.animate(ANIM_MODE_2, NULL);
+
+ _protocolDisplay.postInit();
+ _protocolDisplay.setup(300, 6, 1);
+ _protocolDisplay.setPosition(Common::Point(287, 71));
+ _protocolDisplay.animate(ANIM_MODE_7, NULL);
+ _protocolDisplay._numFrames = 5;
+
+ _object6.postInit();
+ _object6.setup(300, 7, 1);
+ _object6.setPosition(Common::Point(214, 37));
+ _object6.animate(ANIM_MODE_2, NULL);
+ _object6._numFrames = 3;
+
+ _object7.postInit();
+ _object7.setup(301, 1, 1);
+ _object7.setPosition(Common::Point(39, 97));
+ _object7.fixPriority(124);
+ _object7.animate(ANIM_MODE_2, NULL);
+ _object7._numFrames = 5;
+ _object7.setAction(&_action4);
+
+ _object8.postInit();
+ _object8.setup(300, 8, 1);
+ _object8.setPosition(Common::Point(105, 37));
+ _object8.animate(ANIM_MODE_2, NULL);
+ _object8._numFrames = 5;
+
+ _object9.postInit();
+ _object9.setup(301, 6, 1);
+ _object9.setPosition(Common::Point(274, 116));
+ _object9.fixPriority(143);
+ _object9.animate(ANIM_MODE_2, NULL);
+ _object9._numFrames = 5;
+
+ _quinnWorkstation1.setDetails(Rect(243, 148, 315, 167), 300, 30, 31, 32, 1, NULL);
+ _mirandaWorkstation1.setDetails(Rect(4, 128, 69, 167), 300, 33, 31, 35, 1, NULL);
+
+ switch (R2_GLOBALS._player._characterIndex) {
+ case 1:
+ _miranda.postInit();
+ _miranda.setup(302, 2, 1);
+ _miranda.setPosition(Common::Point(47, 128));
+ _miranda.setAction(&_action3);
+ _miranda.setDetails(300, 39, 40, 41, 1, NULL);
+
+ if ((R2_GLOBALS._player._characterScene[2] == 300) || (R2_GLOBALS._player._characterScene[2] == 325)) {
+ _seeker.postInit();
+ _seeker.setVisage(302);
+ _seeker.setPosition(Common::Point(158, 108));
+ _seeker.fixPriority(130);
+ _seeker.setAction(&_action2);
+ _seeker.setDetails(300, 42, 43, 44, 1, NULL);
+ }
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.setVisage(10);
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ R2_GLOBALS._player.disableControl();
+ break;
+
+ case 2:
+ _miranda.postInit();
+ _miranda.setup(302, 2, 1);
+ _miranda.setPosition(Common::Point(47, 128));
+ _miranda.setAction(&_action3);
+ _miranda.setDetails(300, 39, 40, 41, 1, NULL);
+
+ if ((R2_GLOBALS._player._characterScene[1] == 300) || (R2_GLOBALS._player._characterScene[1] == 325)) {
+ _quinn.postInit();
+ _quinn.setup(302, 3, 1);
+ _quinn.setPosition(Common::Point(271, 150));
+ _quinn.setAction(&_action1);
+ _quinn.setDetails(300, 50, 51, 52, 1, NULL);
+ }
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.setup(302, 1, 3);
+ R2_GLOBALS._player.setPosition(Common::Point(158, 108));
+ R2_GLOBALS._player.fixPriority(130);
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ break;
+
+ case 3:
+ if ((R2_GLOBALS._player._characterScene[2] == 300) || (R2_GLOBALS._player._characterScene[2] == 325)) {
+ _seeker.postInit();
+ _seeker.setVisage(302);
+ _seeker.setPosition(Common::Point(158, 108));
+ _seeker.fixPriority(130);
+ _seeker.setAction(&_action2);
+ _seeker.setDetails(300, 42, 43, 44, 1, NULL);
+ }
+
+ if ((R2_GLOBALS._player._characterScene[1] == 300) || (R2_GLOBALS._player._characterScene[1] == 325)) {
+ _quinn.postInit();
+ _quinn.setup(302, 3, 1);
+ _quinn.setPosition(Common::Point(271, 150));
+ _quinn.setAction(&_action1);
+ _quinn.setDetails(300, 50, 51, 52, 1, NULL);
+ }
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.setup(302, 2, 1);
+ R2_GLOBALS._player.setPosition(Common::Point(47, 128));
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ break;
+
+ default:
+ break;
+ }
+
+ _seekerWorkstation.setDetails(Rect(101, 95, 217, 143), 300, 36, 31, 35, 1, NULL);
+ _quinnWorkstation2.setDetails(Rect(224, 102, 315, 143), 300, 30, 31, 32, 1, NULL);
+ _mirandaWorkstation2.setDetails(Rect(4, 83, 84, 124), 300, 33, 31, 35, 1, NULL);
+ _hull.setDetails(11, 300, 6, -1, -1);
+ _statusDisplays.setDetails(12, 300, 9, 10, -1);
+ _damageControl.setDetails(13, 300, 12, -1, -1);
+ _manualOverrides.setDetails(14, 300, 15, -1, 17);
+ _scanners1.setDetails(Rect(126, 15, 183, 25), 300, 18, -1, 20, 1, NULL);
+ _scanners2.setDetails(Rect(126, 80, 183, 90), 300, 18, -1, 20, 1, NULL);
+ _protocolDisplay.setDetails(300, 27, -1, 29, 1, NULL);
+ _indirectLighting1.setDetails(Rect(74, 71, 122, 89), 300, 21, -1, -1, 1, NULL);
+ _indirectLighting2.setDetails(Rect(197, 71, 245, 89), 300, 21, -1, -1, 1, NULL);
+ _lighting.setDetails(Rect(129, 3, 190, 14), 300, 24, -1, -1, 1, NULL);
+ _doorway.setDetails(300, 3, -1, 5, 1, NULL);
+ _background.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 300, 0, -1, -1, 1, NULL);
+
+ switch (R2_GLOBALS._player._characterIndex) {
+ case 1:
+ _sceneMode = 300;
+
+ switch (R2_GLOBALS._sceneManager._previousScene) {
+ case 250:
+ setAction(&_sequenceManager1, this, 300, &R2_GLOBALS._player, &_doorway, NULL);
+ break;
+ case 325:
+ if (!R2_GLOBALS.getFlag(44) || R2_GLOBALS.getFlag(25))
+ setAction(&_sequenceManager1, this, 309, &R2_GLOBALS._player, NULL);
+ else {
+ R2_GLOBALS.setFlag(60);
+ R2_GLOBALS._player.setup(302, 3, 1);
+ R2_GLOBALS._player.setPosition(Common::Point(271, 150));
+ R2_GLOBALS._player.setAction(&_action1);
+
+ if (R2_GLOBALS.getFlag(55)) {
+ if (R2_GLOBALS.getFlag(57)) {
+ R2_GLOBALS.clearFlag(60);
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+ _sceneMode = 16;
+ _stripManager.start(404, this);
+ } else {
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ }
+ } else {
+ if (R2_GLOBALS.getFlag(45)) {
+ R2_GLOBALS.clearFlag(60);
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+ _sceneMode = 12;
+ _stripManager.start3(204, this, R2_GLOBALS._stripManager_lookupList);
+ } else {
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player._canWalk = false;
+ }
+ }
+ }
+ break;
+ case 1000:
+ R2_GLOBALS.setFlag(60);
+ R2_GLOBALS._player.setup(302, 3, 1);
+ R2_GLOBALS._player.setPosition(Common::Point(271, 150));
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+
+ if (R2_GLOBALS.getFlag(51)) {
+ _sceneMode = 13;
+ _stripManager.start3(300, this, R2_GLOBALS._stripManager_lookupList);
+ } else {
+ _sceneMode = 11;
+ _stripManager.start3(200, this, R2_GLOBALS._stripManager_lookupList);
+ }
+ break;
+
+ case 1100:
+ R2_GLOBALS._player.setVisage(10);
+ R2_GLOBALS._player.setPosition(Common::Point(160, 95));
+ _stripId = 400;
+ _sceneMode = 309;
+ setAction(&_sequenceManager1, this, 309, &R2_GLOBALS._player, NULL);
+ break;
+
+ case 1500:
+ R2_GLOBALS.clearFlag(60);
+ R2_GLOBALS._player.setup(302, 3, 1);
+ R2_GLOBALS._player.setPosition(Common::Point(271, 150));
+ _sceneMode = 17;
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+ _stripManager.start(413, this);
+ break;
+
+ default:
+ if (R2_GLOBALS.getFlag(60)) {
+ R2_GLOBALS._player.setup(302, 3, 1);
+ R2_GLOBALS._player.setPosition(Common::Point(271, 150));
+ R2_GLOBALS._player.setAction(&_action1);
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+ } else {
+ R2_GLOBALS._player.setStrip(3);
+ R2_GLOBALS._player.setPosition(Common::Point(200, 150));
+ R2_GLOBALS._player.enableControl();
+ }
+ break;
+ }
+ break;
+
+ case 3:
+ if (R2_GLOBALS._sceneManager._previousScene == 1500) {
+ R2_GLOBALS._player._oldCharacterScene[3] = 3150;
+ R2_GLOBALS._player._characterScene[3] = 3150;
+ R2_GLOBALS._player._effect = 0;
+ R2_GLOBALS._player.setAction(NULL);
+ R2_GLOBALS._player.disableControl();
+
+ _quinn.postInit();
+ _quinn.setVisage(10);
+ _quinn.setPosition(Common::Point(10, 10));
+ _quinn.hide();
+
+ _seeker.postInit();
+ _seeker.setVisage(20);
+ _seeker.setPosition(Common::Point(20, 20));
+ _seeker.hide();
+
+ _teal.postInit();
+ _soldier.postInit();
+ _object12.postInit();
+
+ R2_GLOBALS._sound1.play(107);
+ _sceneMode = 308;
+
+ setAction(&_sequenceManager1, this, 308, &R2_GLOBALS._player, &_teal, &_soldier, &_object12, &_doorway, NULL);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene300::remove() {
+ R2_GLOBALS._player.setAction(NULL);
+ SceneExt::remove();
+}
+
+void Scene300::signal() {
+ switch (_sceneMode) {
+ case 10:
+ switch (_stripManager._field2E8) {
+ case 0:
+ R2_GLOBALS._sound1.changeSound(10);
+ R2_GLOBALS.setFlag(38);
+ break;
+ case 1:
+ R2_GLOBALS.setFlag(3);
+ break;
+ case 2:
+ R2_GLOBALS.setFlag(4);
+ break;
+ case 3:
+ R2_GLOBALS.setFlag(13);
+ if (R2_GLOBALS._stripManager_lookupList[1] == 6)
+ R2_GLOBALS.setFlag(40);
+ break;
+ case 4:
+ if (R2_GLOBALS._stripManager_lookupList[1] == 6)
+ R2_GLOBALS.setFlag(40);
+ break;
+ case 5:
+ R2_GLOBALS._sceneManager.changeScene(1000);
+ break;
+ default:
+ break;
+ }
+
+ _stripManager._field2E8 = 0;
+ switch (_stripId) {
+ case 400:
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 15;
+ setAction(&_sequenceManager1, this, 306, &R2_GLOBALS._player, NULL);
+ break;
+ case 181:
+ R2_GLOBALS._player.setStrip(6);
+ // Deliberate fall-through
+ default:
+ R2_GLOBALS._player.enableControl(CURSOR_TALK);
+
+ if ((R2_GLOBALS._player._characterIndex != 1) || R2_GLOBALS.getFlag(44))
+ R2_GLOBALS._player._canWalk = false;
+ break;
+ }
+ break;
+
+ case 11:
+ R2_GLOBALS.setFlag(44);
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ break;
+
+ case 12:
+ R2_GLOBALS._player.setAction(NULL);
+ R2_GLOBALS._sceneManager.changeScene(1010);
+ break;
+
+ case 13:
+ R2_GLOBALS._player.disableControl();
+ _seeker.changeZoom(-1);
+ _sceneMode = 313;
+ _seeker.setAction(NULL);
+ setAction(&_sequenceManager1, this, 313, &R2_GLOBALS._player, &_seeker, NULL);
+ break;
+
+ case 14:
+ if (_seeker._action)
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 314;
+ break;
+
+ case 15:
+ R2_GLOBALS.setFlag(55);
+ R2_GLOBALS.setFlag(38);
+ R2_GLOBALS.setFlag(44);
+ R2_GLOBALS.setFlag(51);
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+ _sceneMode = 16;
+ _stripManager.start3(401, this, R2_GLOBALS._stripManager_lookupList);
+ break;
+
+ case 16:
+ if (_stripManager._field2E8 == 1) {
+ R2_GLOBALS._player.setAction(NULL);
+ R2_GLOBALS._sceneManager.changeScene(1000);
+ } else {
+ R2_GLOBALS._player.setAction(&_action1);
+ R2_GLOBALS._player.enableControl(CURSOR_TALK);
+ }
+ break;
+
+ case 17:
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 316;
+ _seeker.changeZoom(-1);
+ _seeker.setAction(&_sequenceManager3, this, 316, &_seeker, &_doorway, NULL);
+ R2_GLOBALS._player.setAction(&_sequenceManager1, NULL, 307, &R2_GLOBALS._player, NULL);
+ break;
+
+ case 18:
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 317;
+ setAction(&_sequenceManager1, this, 317, &_teal, &_doorway, NULL);
+ break;
+
+ case 19:
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 318;
+ setAction(&_sequenceManager1, this, 318, &R2_GLOBALS._player, &_teal, &_soldier, &_object12, NULL);
+ break;
+
+ case 20:
+ R2_GLOBALS._player._characterIndex = R2_QUINN;
+ R2_GLOBALS._sceneManager.changeScene(1500);
+ break;
+
+ case 300:
+ case 307:
+ R2_GLOBALS._player.enableControl();
+ break;
+
+ case 301:
+ R2_GLOBALS._sceneManager.changeScene(250);
+ break;
+
+ case 306:
+ R2_GLOBALS._sceneManager.changeScene(325);
+ break;
+
+ case 308:
+ _sceneMode = 18;
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+ _stripManager.start(418, this);
+ break;
+
+ case 310:
+ R2_GLOBALS._player.setStrip(5);
+ // Deliberate fall-through
+ case 309:
+ signal309();
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+ _sceneMode = 10;
+ _stripManager.start3(_stripId, this, R2_GLOBALS._stripManager_lookupList);
+ break;
+
+ case 313:
+ _sceneMode = 14;
+ R2_GLOBALS._player._effect = 0;
+ _seeker.setAction(&_sequenceManager3, this, 314, &_seeker, &_doorway, NULL);
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+ _stripManager.start(301, this);
+ break;
+
+ case 314:
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 315;
+ R2_GLOBALS._player._effect = 1;
+ setAction(&_sequenceManager1, this, 315, &R2_GLOBALS._player, &_doorway, NULL);
+ break;
+
+ case 315:
+ R2_GLOBALS._sceneManager.changeScene(1100);
+ break;
+
+ case 316:
+ R2_GLOBALS._player._characterScene[2] = 500;
+ _seeker.remove();
+ R2_GLOBALS._player.enableControl(CURSOR_CROSSHAIRS);
+ break;
+
+ case 317:
+ _sceneMode = 19;
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+ _stripManager.start(419, this);
+ break;
+
+ case 318:
+ _sceneMode = 20;
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+ _stripManager.start(420, this);
+ break;
+
+ default:
+ break;
+ }
+}
+
+void Scene300::signal309() {
+ if (R2_GLOBALS.getFlag(2))
+ R2_GLOBALS._stripManager_lookupList[0] = (R2_INVENTORY.getObjectScene(R2_2) == 1) ? 3 : 2;
+
+ if (R2_GLOBALS.getFlag(4))
+ R2_GLOBALS._stripManager_lookupList[0] = 4;
+
+ if (R2_INVENTORY.getObjectScene(R2_OPTO_DISK) == 1)
+ R2_GLOBALS._stripManager_lookupList[0] = 5;
+
+ if (R2_GLOBALS.getFlag(13)) {
+ R2_GLOBALS._stripManager_lookupList[0] = 6;
+ R2_GLOBALS._stripManager_lookupList[2] = 2;
+ }
+
+ if (R2_GLOBALS.getFlag(39))
+ R2_GLOBALS._stripManager_lookupList[1] = 2;
+
+ if (R2_GLOBALS.getFlag(5))
+ R2_GLOBALS._stripManager_lookupList[1] = 3;
+
+ if (R2_GLOBALS.getFlag(6))
+ R2_GLOBALS._stripManager_lookupList[1] = 4;
+
+ if (R2_GLOBALS.getFlag(8))
+ R2_GLOBALS._stripManager_lookupList[1] = 5;
+
+ if (R2_GLOBALS.getFlag(9)) {
+ R2_GLOBALS._stripManager_lookupList[1] = 6;
+ R2_GLOBALS._stripManager_lookupList[3] = 2;
+ }
+
+ if (R2_GLOBALS.getFlag(48))
+ R2_GLOBALS._stripManager_lookupList[4] = 2;
+
+ if (R2_GLOBALS.getFlag(49))
+ R2_GLOBALS._stripManager_lookupList[4] = 3;
+}
+
+} // End of namespace Ringworld2
+
+} // End of namespace TsAGE
diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h
new file mode 100644
index 0000000000..834b91c01c
--- /dev/null
+++ b/engines/tsage/ringworld2/ringworld2_scenes0.h
@@ -0,0 +1,285 @@
+/* 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_RINGWORLD2_SCENES0_H
+#define TSAGE_RINGWORLD2_SCENES0_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/sound.h"
+#include "tsage/ringworld2/ringworld2_logic.h"
+#include "tsage/ringworld2/ringworld2_speakers.h"
+
+namespace TsAGE {
+
+namespace Ringworld2 {
+
+using namespace TsAGE;
+
+class Scene50: public SceneExt {
+
+ class Action1: public Action {
+ public:
+ void signal();
+ };
+
+public:
+ Action1 _action1;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void process(Event &event);
+};
+
+class Scene100: public SceneExt {
+ /* Objects */
+ class Door: public SceneActorExt {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class Table: public SceneActor {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class StasisNegator: public SceneActor {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class Object10: public SceneActorExt {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class SteppingDisks: public SceneActor {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+
+ /* Items */
+ class Terminal: public NamedHotspot{
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+
+public:
+ NamedHotspot _background, _duct, _bed, _desk;
+ Terminal _terminal;
+ SceneActor _object1, _object2, _object3, _object4, _object5;
+ SceneActor _object6;
+ Door _door;
+ Table _table;
+ StasisNegator _stasisNegator;
+ Object10 _object10;
+ SteppingDisks _steppingDisks;
+ SequenceManager _sequenceManager1, _sequenceManager2;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+ virtual void dispatch();
+};
+
+class Scene125: public SceneExt {
+ /* Objects */
+ class Object5: public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Icon: public SceneActor {
+ public:
+ int _lookLineNum, _field98;
+ bool _pressed;
+ SceneObject _object1, _object2;
+ SceneText _sceneText1, _sceneText2;
+
+ Icon();
+ virtual Common::String getClassName() { return "Scene125_Icon"; }
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void synchronize(Serializer &s);
+ virtual void process(Event &event);
+
+ void setIcon(int id);
+ void showIcon();
+ void hideIcon();
+ };
+
+ /* Items */
+ class Item4: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+public:
+ ScenePalette _palette;
+ ASoundExt _sound1;
+ NamedHotspot _background, _item2, _item3;
+ Item4 _item4;
+ SceneActor _object1, _object2, _object3, _object4, _object5, _object6, _object7;
+ Icon _icon1, _icon2, _icon3, _icon4, _icon5, _icon6;
+ SequenceManager _sequenceManager;
+ SceneText _sceneText;
+ int _consoleMode, _iconFontNumber, _logIndex, _databaseIndex, _infodiskIndex;
+ int _soundCount, _soundIndex;
+ int _soundIndexes[10];
+
+ Scene125();
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void synchronize(Serializer &s);
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+
+ void consoleAction(int id);
+ void setDetails(int resNum, int lineNum);
+ void stop();
+ Common::String parseMessage(const Common::String &msg);
+};
+
+class Scene200: public SceneExt {
+ /* Objects */
+ class NorthDoor: public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class EastDoor: public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class WestDoor: public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Scene Exits */
+ class EastExit: public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+ class WestExit: public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+public:
+ NamedHotspot _background, _compartment, _westDoorDisplay, _eastDoorDisplay;
+ NorthDoor _northDoor;
+ EastDoor _eastDoor;
+ WestDoor _westDoor;
+ EastExit _eastExit;
+ WestExit _westExit;
+ SequenceManager _sequenceManager;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+};
+
+class Scene300: 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();
+ };
+
+ /* Items */
+ class QuinnWorkstation: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class MirandaWorkstation: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class SeekerWorkstation: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Objects */
+ class Miranda: public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Seeker: public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Quinn: public SceneActor {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ SequenceManager _sequenceManager1, _sequenceManager2, _sequenceManager3, _sequenceManager4;
+ ASoundExt _sound1;
+ SpeakerMiranda300 _mirandaSpeaker;
+ SpeakerSeeker300 _seekerSpeaker;
+ SpeakerSeekerL _seekerLSpeaker;
+ SpeakerQuinn300 _quinnSpeaker;
+ SpeakerQuinnL _quinnLSpeaker;
+ SpeakerTeal300 _tealSpeaker;
+ SpeakerSoldier300 _soldierSpeaker;
+
+ NamedHotspot _background, _hull, _statusDisplays, _damageControl, _manualOverrides;
+ NamedHotspot _scanners1, _scanners2, _indirectLighting1, _indirectLighting2, _lighting;
+ QuinnWorkstation _quinnWorkstation1, _quinnWorkstation2;
+ SeekerWorkstation _seekerWorkstation;
+ MirandaWorkstation _mirandaWorkstation1, _mirandaWorkstation2;
+ SceneActor _object1, _object2, _object3, _object4, _protocolDisplay;
+ SceneActor _object6, _object7, _object8, _object9;
+ SceneActor _teal, _soldier, _object12, _doorway;
+ Miranda _miranda;
+ Seeker _seeker;
+ Quinn _quinn;
+ Action1 _action1;
+ Action2 _action2;
+ Action3 _action3;
+ Action4 _action4;
+ PaletteRotation *_rotation;
+ int _stripId;
+
+ Scene300();
+ void signal309();
+
+ virtual void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+};
+
+} // End of namespace Ringworld2
+
+} // End of namespace TsAGE
+
+#endif
diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp
new file mode 100644
index 0000000000..18fd6e6bde
--- /dev/null
+++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp
@@ -0,0 +1,2507 @@
+/* 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/scenes.h"
+#include "tsage/tsage.h"
+#include "tsage/staticres.h"
+#include "tsage/ringworld2/ringworld2_scenes2.h"
+
+namespace TsAGE {
+
+namespace Ringworld2 {
+
+/*--------------------------------------------------------------------------
+ * Scene 2000 - Maze
+ *
+ *--------------------------------------------------------------------------*/
+void Scene2000::initPlayer() {
+ R2_GLOBALS._player.disableControl();
+ warning("DisableControl, with arguments?");
+
+ warning("initPlayer: %d", _mazePlayerMode);
+ switch (_mazePlayerMode) {
+ case 0:
+ R2_GLOBALS._player.setStrip(5);
+ if (_exit1._enabled) {
+ if (_exit2._enabled)
+ R2_GLOBALS._player.setPosition(Common::Point(140, 129));
+ else
+ R2_GLOBALS._player.setPosition(Common::Point(20, 129));
+ } else
+ R2_GLOBALS._player.setPosition(Common::Point(245, 129));
+ R2_GLOBALS._player.enableControl();
+ warning("EnableControl, with 2 arguments?");
+ break;
+ case 1:
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _sceneMode = 2001;
+ else
+ _sceneMode = 2021;
+ setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL);
+ break;
+ case 2:
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _sceneMode = 2002;
+ else
+ _sceneMode = 2022;
+ setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL);
+ break;
+ case 3:
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _sceneMode = 2000;
+ else
+ _sceneMode = 2020;
+ setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL);
+ break;
+ case 4:
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _sceneMode = 2005;
+ else
+ _sceneMode = 2025;
+ setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL);
+ break;
+ case 5:
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _sceneMode = 2004;
+ else
+ _sceneMode = 2024;
+ setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL);
+ break;
+ case 6:
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _sceneMode = 2009;
+ else
+ _sceneMode = 2029;
+ setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL);
+ break;
+ case 7:
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _sceneMode = 2008;
+ else
+ _sceneMode = 2028;
+ setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL);
+ break;
+ case 8:
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _sceneMode = 2013;
+ else
+ _sceneMode = 2033;
+ setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL);
+ break;
+ case 9:
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _sceneMode = 2012;
+ else
+ _sceneMode = 2032;
+ setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL);
+ break;
+ case 10:
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _sceneMode = 2016;
+ else
+ _sceneMode = 2036;
+ setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL);
+ break;
+ case 11:
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _sceneMode = 2038;
+ else
+ _sceneMode = 2040;
+ setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL);
+ break;
+ default:
+ break;
+ }
+ for (int i = 0; i < 11; i++) {
+ if (R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex] == R2_GLOBALS._v56605[3 + i])
+ _objList1[i].show();
+ }
+
+ if ((R2_GLOBALS._player._characterScene[1] == R2_GLOBALS._player._characterScene[2]) && (R2_GLOBALS._v56605[1] == R2_GLOBALS._v56605[2])) {
+ _object1.postInit();
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ _object1.setup(20, 5, 1);
+ _object1.setDetails(9002, 0, 4, 3, 1, NULL);
+ } else {
+ _object1.setup(2008, 5, 1);
+ _object1.setDetails(9001, 0, 5, 3, 1, NULL);
+ }
+ if (_exit1._enabled) {
+ if (_exit2._enabled)
+ _object1.setPosition(Common::Point(180, 128));
+ else
+ _object1.setPosition(Common::Point(75, 128));
+ } else
+ _object1.setPosition(Common::Point(300, 128));
+ }
+}
+
+void Scene2000::initExits() {
+ _exit1._enabled = true;
+ _exit2._enabled = true;
+ _exit3._enabled = false;
+ _exit4._enabled = false;
+ _exit5._enabled = false;
+
+ _exit1._insideArea = false;
+ _exit2._insideArea = false;
+ _exit3._insideArea = false;
+ _exit4._insideArea = false;
+ _exit5._insideArea = false;
+
+ _exit1._moving = false;
+ _exit2._moving = false;
+ _exit3._moving = false;
+ _exit4._moving = false;
+ _exit5._moving = false;
+
+ for (int i = 0; i < 11; i++)
+ _objList1[i].hide();
+
+ _object1.remove();
+
+ warning("initExits: %d", R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex]);
+
+ switch (R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex]) {
+ case 3:
+ case 10:
+ case 16:
+ case 21:
+ _exit5._enabled = true;
+ _exit5._bounds.set(61, 68, 90, 125);
+ _exit5.setDest(Common::Point(92, 129));
+ _exit5._cursorNum = EXITCURSOR_W;
+ break;
+ case 4:
+ case 12:
+ case 25:
+ case 34:
+ _exit5._enabled = true;
+ _exit5._bounds.set(230, 68, 259, 125);
+ _exit5.setDest(Common::Point(244, 129));
+ _exit5._cursorNum = EXITCURSOR_E;
+ break;
+ default:
+ break;
+ }
+
+ switch (R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex] - 1) {
+ case 0:
+ case 6:
+ case 13:
+ case 18:
+ case 22:
+ case 27:
+ case 30:
+ _exit1._enabled = false;
+ loadScene(2225);
+ R2_GLOBALS._walkRegions.load(2225);
+ if (!_exitingFlag)
+ _mazePlayerMode = 0;
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2000;
+ break;
+ case 1:
+ case 19:
+ _exit3._enabled = true;
+ _exit3._bounds.set(71, 130, 154, 168);
+ _exit3.setDest(Common::Point(94, 129));
+ _exit3._cursorNum = EXITCURSOR_SE;
+ loadScene(2300);
+ if (!_exitingFlag)
+ _mazePlayerMode = 0;
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2000;
+ R2_GLOBALS._walkRegions.load(2000);
+ break;
+ case 2:
+ case 9:
+ case 15:
+ case 20:
+ loadScene(2150);
+ R2_GLOBALS._walkRegions.load(2000);
+ switch(R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex]) {
+ case 2400:
+ _mazePlayerMode = 1;
+ break;
+ case 2425:
+ case 2430:
+ case 2435:
+ case 2450:
+ _mazePlayerMode = 3;
+ break;
+ default:
+ if (!_exitingFlag)
+ _mazePlayerMode = 0;
+ break;
+ }
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2000;
+ R2_GLOBALS._sceneManager._previousScene = 2000;
+ break;
+ case 3:
+ case 11:
+ case 24:
+ case 33:
+ loadScene(2175);
+ R2_GLOBALS._walkRegions.load(2000);
+ if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2000) {
+ if (!_exitingFlag)
+ _mazePlayerMode = 0;
+ } else if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2350)
+ _mazePlayerMode = 1;
+ else
+ _mazePlayerMode = 10;
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2000;
+ R2_GLOBALS._sceneManager._previousScene = 2000;
+ break;
+ case 4:
+ case 8:
+ loadScene(2000);
+ R2_GLOBALS._walkRegions.load(2000);
+ if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 1900)
+ _mazePlayerMode = 1;
+ else if (!_exitingFlag)
+ _mazePlayerMode = 0;
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2000;
+ R2_GLOBALS._sceneManager._previousScene = 2000;
+ break;
+ case 5:
+ case 12:
+ case 17:
+ case 21:
+ case 26:
+ loadScene(2200);
+ R2_GLOBALS._walkRegions.load(2000);
+ _exit2._enabled = false;
+ if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 1900)
+ _mazePlayerMode = 2;
+ else if (!_exitingFlag)
+ _mazePlayerMode = 0;
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2000;
+ R2_GLOBALS._sceneManager._previousScene = 2000;
+ break;
+ case 7:
+ case 29:
+ _exit4._enabled = true;
+ _exit4._bounds.set(138, 83, 211, 125);
+ _exit4.setDest(Common::Point(129, 188));
+ _exit4._cursorNum = EXITCURSOR_NW;
+ loadScene(2250);
+ R2_GLOBALS._walkRegions.load(2000);
+ if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2500)
+ _mazePlayerMode = 1;
+ else if (!_exitingFlag)
+ _mazePlayerMode = 0;
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2000;
+ R2_GLOBALS._sceneManager._previousScene = 2000;
+ break;
+ case 10:
+ case 25:
+ _exit3._enabled = true;
+ _exit3._bounds.set(78, 130, 148, 168);
+ _exit3.setDest(Common::Point(100, 129));
+ _exit3._cursorNum = EXITCURSOR_SE;
+ loadScene(2075);
+ R2_GLOBALS._walkRegions.load(2000);
+ if (!_exitingFlag)
+ _mazePlayerMode = 0;
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2000;
+ break;
+ case 14:
+ _exit3._enabled = true;
+ _exit3._bounds.set(160, 130, 248, 168);
+ _exit3.setDest(Common::Point(225, 129));
+ _exit3._cursorNum = EXITCURSOR_SW;
+ loadScene(2325);
+ R2_GLOBALS._walkRegions.load(2000);
+ if (!_exitingFlag)
+ _mazePlayerMode = 0;
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2000;
+ break;
+ case 16:
+ case 31:
+ _exit4._enabled = true;
+ _exit4._bounds.set(122, 83, 207, 125);
+ _exit4.setDest(Common::Point(210, 129));
+ _exit4._cursorNum = EXITCURSOR_NW;
+ loadScene(2125);
+ R2_GLOBALS._walkRegions.load(2000);
+ if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2400)
+ _mazePlayerMode = 2;
+ else if (!_exitingFlag)
+ _mazePlayerMode = 0;
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2000;
+ R2_GLOBALS._sceneManager._previousScene = 2000;
+ break;
+ case 23:
+ _exit4._enabled = true;
+ _exit4._bounds.set(108, 83, 128, 184);
+ _exit4.setDest(Common::Point(135, 129));
+ _exit4._cursorNum = CURSOR_INVALID;
+ loadScene(2275);
+ R2_GLOBALS._walkRegions.load(2000);
+ if (!_exitingFlag)
+ _mazePlayerMode = 0;
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2000;
+ break;
+ case 28:
+ _exit3._enabled = true;
+ _exit3._bounds.set(171, 130, 241, 168);
+ _exit3.setDest(Common::Point(218, 129));
+ _exit3._cursorNum = EXITCURSOR_SW;
+ loadScene(2050);
+ R2_GLOBALS._walkRegions.load(2000);
+ if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2350)
+ _mazePlayerMode = 11;
+ else if (!_exitingFlag)
+ _mazePlayerMode = 0;
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2000;
+ break;
+ case 32:
+ loadScene(2025);
+ R2_GLOBALS._walkRegions.load(2000);
+ if (!_exitingFlag)
+ _mazePlayerMode = 0;
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2000;
+ break;
+ default:
+ break;
+ }
+ _exitingFlag = false;
+ R2_GLOBALS._uiElements.show();
+}
+
+void Scene2000::Action1::signal() {
+ Scene2000 *scene = (Scene2000 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex) {
+ case 0: {
+ _actionIndex = 1;
+ Common::Point pt(-20, 127);
+ warning("TODO: Check sub_22D26");
+ NpcMover *mover = new NpcMover();
+ scene->_objList1[_state].addMover(mover, &pt, scene);
+ break;
+ }
+ case 1:
+ scene->_objList1[_state].setPosition(Common::Point(340, 127));
+ --R2_GLOBALS._v56605[4 + _state];
+ _actionIndex = 0;
+ switch (_state - 1) {
+ case 0:
+ if (R2_GLOBALS._v56605[4] == 1)
+ _actionIndex = 10;
+ break;
+ case 2:
+ if (R2_GLOBALS._v56605[6] == 7)
+ _actionIndex = 10;
+ break;
+ case 4:
+ if (R2_GLOBALS._v56605[8] == 14)
+ _actionIndex = 10;
+ break;
+ case 6:
+ if (R2_GLOBALS._v56605[10] == 19)
+ _actionIndex = 10;
+ break;
+ case 7:
+ if (R2_GLOBALS._v56605[11] == 23)
+ _actionIndex = 10;
+ break;
+ default:
+ break;
+ }
+
+ if (R2_GLOBALS._v56605[3 + _state] == R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex])
+ scene->_objList1[_state].show();
+ else
+ scene->_objList1[_state].hide();
+
+ signal();
+ break;
+ case 5: {
+ _actionIndex = 6;
+ Common::Point pt(340, 127);
+ warning("TODO: Check sub_22D26");
+ NpcMover *mover = new NpcMover();
+ scene->_objList1[_state].addMover(mover, &pt, this);
+ break;
+ }
+ case 6:
+ scene->_objList1[_state].setPosition(Common::Point(-20, 127));
+ ++R2_GLOBALS._v56605[3 + _state];
+ _actionIndex = 5;
+ switch (_state - 1) {
+ case 0:
+ if (R2_GLOBALS._v56605[4] == 5)
+ _actionIndex = 15;
+ break;
+ case 2:
+ if (R2_GLOBALS._v56605[6] == 13)
+ _actionIndex = 15;
+ break;
+ case 4:
+ if (R2_GLOBALS._v56605[8] == 16)
+ _actionIndex = 15;
+ break;
+ case 6:
+ if (R2_GLOBALS._v56605[10] == 22)
+ _actionIndex = 15;
+ break;
+ case 7:
+ if (R2_GLOBALS._v56605[11] == 27)
+ _actionIndex = 15;
+ break;
+ default:
+ break;
+ }
+
+ if (R2_GLOBALS._v56605[3 + _state] == R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex])
+ scene->_objList1[_state].show();
+ else
+ scene->_objList1[_state].hide();
+
+ signal();
+ break;
+ case 10: {
+ Common::Point pt(290, 127);
+ warning("TODO: Check sub_22D26");
+ NpcMover *mover = new NpcMover();
+ scene->_objList1[_state].addMover(mover, &pt, this);
+ _actionIndex = 11;
+ break;
+ }
+ case 11:
+ if (_state == 1)
+ scene->_objList1[0].setStrip(1);
+ else if (_state == 5)
+ scene->_objList1[4].setStrip(1);
+ setDelay(600);
+ _actionIndex = 12;
+ break;
+ case 12:
+ if (_state == 1)
+ scene->_objList1[0].setStrip(2);
+ else if (_state == 5)
+ scene->_objList1[4].setStrip(2);
+ scene->_objList1[_state].setStrip(1);
+ _actionIndex = 5;
+ signal();
+ break;
+ case 15:
+ if ((R2_GLOBALS._v56605[3 + _state] == 13) || (R2_GLOBALS._v56605[3 + _state] == 22) || (R2_GLOBALS._v56605[3 + _state] == 27)) {
+ Common::Point pt(30, 127);
+ warning("TODO: Check sub_22D26");
+ NpcMover *mover = new NpcMover();
+ scene->_objList1[_state].addMover(mover, &pt, this);
+ _actionIndex = 16;
+ } else {
+ Common::Point pt(120, 127);
+ warning("TODO: Check sub_22D26");
+ NpcMover *mover = new NpcMover();
+ scene->_objList1[_state].addMover(mover, &pt, this);
+ _actionIndex = 16;
+ }
+ break;
+ case 16:
+ if (_state == 1)
+ scene->_objList1[2].setStrip(2);
+ else if (_state == 8)
+ scene->_objList1[9].setStrip(2);
+ setDelay(600);
+ _actionIndex = 17;
+ break;
+ case 17:
+ if (_state == 1)
+ scene->_objList1[2].setStrip(1);
+ else if (_state == 8)
+ scene->_objList1[9].setStrip(1);
+ scene->_objList1[_state].setStrip(2);
+ _actionIndex = 0;
+ break;
+ case 99:
+ error("99");
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene2000::Exit1::changeScene() {
+ Scene2000 *scene = (Scene2000 *)R2_GLOBALS._sceneManager._scene;
+ warning("exit1");
+
+ scene->_exitingFlag = true;
+ scene->_sceneMode = 0;
+ R2_GLOBALS._player.disableControl();
+ warning("DisableControl, with arguments?");
+ scene->_sceneMode = 10;
+
+ warning("TODO: Check sub_22D26");
+ Common::Point pt(-10, 129);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+
+ scene->setAction(&scene->_sequenceManager, scene, 206, &R2_GLOBALS._player, NULL);
+}
+
+void Scene2000::Exit2::changeScene() {
+ Scene2000 *scene = (Scene2000 *)R2_GLOBALS._sceneManager._scene;
+ warning("exit2");
+
+ scene->_exitingFlag = true;
+ scene->_sceneMode = 0;
+ R2_GLOBALS._player.disableControl();
+ warning("DisableControl, with arguments?");
+ scene->_sceneMode = 11;
+
+ warning("TODO: Check sub_22D26");
+ Common::Point pt(330, 129);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+}
+
+void Scene2000::Exit3::changeScene() {
+ Scene2000 *scene = (Scene2000 *)R2_GLOBALS._sceneManager._scene;
+ warning("exit13");
+
+ scene->_exitingFlag = true;
+ scene->_sceneMode = 0;
+ R2_GLOBALS._player.disableControl();
+ warning("DisableControl, with arguments?");
+ scene->_sceneMode = 12;
+
+ switch (R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex]) {
+ case 2:
+ scene->_mazePlayerMode = 4;
+ R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex] = 8;
+ break;
+ case 11:
+ scene->_mazePlayerMode = 6;
+ R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex] = 17;
+ break;
+ case 15:
+ scene->_mazePlayerMode = 8;
+ R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex] = 24;
+ break;
+ case 20:
+ scene->_mazePlayerMode = 4;
+ R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex] = 30;
+ break;
+ case 26:
+ scene->_mazePlayerMode = 6;
+ R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex] = 32;
+ break;
+ case 29:
+ scene->_mazePlayerMode = 11;
+ R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex] = 29;
+ break;
+ default:
+ break;
+ }
+
+ switch (scene->_mazePlayerMode) {
+ case 4:
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->setAction(&scene->_sequenceManager, scene, 2003, &R2_GLOBALS._player, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager, scene, 2023, &R2_GLOBALS._player, NULL);
+ break;
+ case 6:
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->setAction(&scene->_sequenceManager, scene, 2007, &R2_GLOBALS._player, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager, scene, 2027, &R2_GLOBALS._player, NULL);
+ break;
+ case 8:
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->setAction(&scene->_sequenceManager, scene, 2011, &R2_GLOBALS._player, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager, scene, 2031, &R2_GLOBALS._player, NULL);
+ break;
+ case 11:
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->_sceneMode = 2039;
+ else
+ scene->_sceneMode = 2041;
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL);
+ break;
+
+ default:
+ break;
+ }
+}
+void Scene2000::Exit4::changeScene() {
+ Scene2000 *scene = (Scene2000 *)R2_GLOBALS._sceneManager._scene;
+ warning("exit4");
+
+ scene->_exitingFlag = true;
+ scene->_sceneMode = 0;
+ R2_GLOBALS._player.disableControl();
+ warning("DisableControl, with arguments?");
+ scene->_sceneMode = 13;
+
+ switch (R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex]) {
+ case 8:
+ scene->_mazePlayerMode = 5;
+ R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex] = 2;
+ break;
+ case 17:
+ scene->_mazePlayerMode = 7;
+ R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex] = 11;
+ break;
+ case 24:
+ scene->_mazePlayerMode = 9;
+ R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex] = 15;
+ break;
+ case 30:
+ scene->_mazePlayerMode = 5;
+ R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex] = 20;
+ break;
+ case 32:
+ scene->_mazePlayerMode = 7;
+ R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex] = 26;
+ break;
+ default:
+ break;
+ }
+
+ switch (scene->_mazePlayerMode) {
+ case 5:
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->setAction(&scene->_sequenceManager, scene, 2006, &R2_GLOBALS._player, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager, scene, 2026, &R2_GLOBALS._player, NULL);
+ break;
+ case 7:
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->setAction(&scene->_sequenceManager, scene, 2010, &R2_GLOBALS._player, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager, scene, 2030, &R2_GLOBALS._player, NULL);
+ break;
+ case 9:
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->setAction(&scene->_sequenceManager, scene, 2014, &R2_GLOBALS._player, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager, scene, 2034, &R2_GLOBALS._player, NULL);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene2000::Exit5::changeScene() {
+ Scene2000 *scene = (Scene2000 *)R2_GLOBALS._sceneManager._scene;
+ warning("exit5");
+
+ scene->_sceneMode = 0;
+ R2_GLOBALS._player.disableControl();
+ warning("DisableControl, with arguments?");
+ scene->_sceneMode = 14;
+
+ switch (R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex]) {
+ case 3:
+ scene->_mazePlayerMode = 1;
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->setAction(&scene->_sequenceManager, scene, 2015, &R2_GLOBALS._player, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager, scene, 2035, &R2_GLOBALS._player, NULL);
+ break;
+ case 4:
+ scene->_mazePlayerMode = 7;
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->setAction(&scene->_sequenceManager, scene, 2017, &R2_GLOBALS._player, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager, scene, 2037, &R2_GLOBALS._player, NULL);
+ break;
+ case 10:
+ scene->_mazePlayerMode = 8;
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->setAction(&scene->_sequenceManager, scene, 2015, &R2_GLOBALS._player, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager, scene, 2035, &R2_GLOBALS._player, NULL);
+ break;
+ case 12:
+ scene->_mazePlayerMode = 3;
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->setAction(&scene->_sequenceManager, scene, 2017, &R2_GLOBALS._player, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager, scene, 2037, &R2_GLOBALS._player, NULL);
+ break;
+ case 16:
+ scene->_mazePlayerMode = 4;
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->setAction(&scene->_sequenceManager, scene, 2015, &R2_GLOBALS._player, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager, scene, 2035, &R2_GLOBALS._player, NULL);
+ break;
+ case 21:
+ scene->_mazePlayerMode = 5;
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->setAction(&scene->_sequenceManager, scene, 2015, &R2_GLOBALS._player, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager, scene, 2035, &R2_GLOBALS._player, NULL);
+ break;
+ case 25:
+ scene->_mazePlayerMode = 2;
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->setAction(&scene->_sequenceManager, scene, 2017, &R2_GLOBALS._player, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager, scene, 2037, &R2_GLOBALS._player, NULL);
+ break;
+ case 34:
+ scene->_mazePlayerMode = 6;
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->setAction(&scene->_sequenceManager, scene, 2017, &R2_GLOBALS._player, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager, scene, 2037, &R2_GLOBALS._player, NULL);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene2000::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(2000);
+
+ if (R2_GLOBALS._sceneManager._previousScene != -1) {
+ R2_GLOBALS._v56605[1] = 21;
+ R2_GLOBALS._v56605[2] = 21;
+ }
+ if ((R2_GLOBALS._player._characterScene[R2_GLOBALS._player._characterIndex] != R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex]) && (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] != 2350)) {
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 0;
+ }
+ _exitingFlag = false;
+
+ _exit1.setDetails(Rect(0, 100, 14, 140), EXITCURSOR_W, 2000);
+ _exit1.setDest(Common::Point(14, 129));
+ _exit2.setDetails(Rect(305, 100, 320, 140), EXITCURSOR_E, 2000);
+ _exit2.setDest(Common::Point(315, 129));
+ _exit3.setDetails(Rect(71, 130, 154, 168), EXITCURSOR_S, 2000);
+ _exit3.setDest(Common::Point(94, 129));
+ _exit4.setDetails(Rect(138, 83, 211, 125), EXITCURSOR_N, 2000);
+ _exit4.setDest(Common::Point(188, 128));
+ _exit5.setDetails(Rect(61, 68, 90, 125), EXITCURSOR_W, 2000);
+ _exit5.setDest(Common::Point(92, 129));
+
+ R2_GLOBALS._sound1.play(200);
+ initExits();
+ g_globals->_sceneManager._fadeMode = FADEMODE_IMMEDIATE;
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ R2_GLOBALS._player.setup(2008, 3, 1);
+ R2_GLOBALS._player._moveDiff = Common::Point(3, 2);
+ } else {
+ R2_GLOBALS._player.setup(20, 3, 1);
+ R2_GLOBALS._player._moveDiff = Common::Point(5, 3);
+ }
+
+ _action1._state = 8;
+ _action2._state = 1;
+ _action3._state = 5;
+ _action4._state = 7;
+ _action5._state = 3;
+
+ for (int i = 0; i < 11; i++)
+ _objList1[i].postInit();
+
+ _objList1[0].setVisage(2000);
+ _objList1[0].setStrip(2);
+ _objList1[0].setDetails(2001, 0, -1, -1, 1, NULL);
+
+ _objList1[1].setVisage(2001);
+ _objList1[1].setStrip(2);
+ _objList1[1].setDetails(2001, 0, -1, -1, 1, NULL);
+
+ _objList1[2].setVisage(2003);
+ _objList1[2].setStrip(1);
+ _objList1[2].setDetails(2001, 0, -1, -1, 1, NULL);
+
+ _objList1[3].setVisage(2007);
+ _objList1[3].setStrip(2);
+ _objList1[3].setDetails(2001, 12, -1, -1, 1, NULL);
+
+ _objList1[4].setVisage(2004);
+ _objList1[4].setStrip(2);
+ _objList1[4].setDetails(2001, 19, -1, -1, 1, NULL);
+
+ _objList1[5].setVisage(2003);
+ _objList1[5].setStrip(2);
+ _objList1[5].setDetails(2001, 0, -1, -1, 1, NULL);
+
+ _objList1[6].setVisage(2000);
+ _objList1[6].setStrip(1);
+ _objList1[6].setDetails(2001, 0, -1, -1, 1, NULL);
+
+ _objList1[7].setVisage(2000);
+ _objList1[7].setStrip(2);
+ _objList1[7].setDetails(2001, 0, -1, -1, 1, NULL);
+
+ _objList1[8].setVisage(2000);
+ _objList1[8].setStrip(2);
+ _objList1[8].setDetails(2001, 0, -1, -1, 1, NULL);
+
+ _objList1[9].setVisage(2006);
+ _objList1[9].setStrip(1);
+ _objList1[9].setDetails(2001, 6, -1, -1, 1, NULL);
+
+ _objList1[10].setVisage(2007);
+ _objList1[10].setStrip(1);
+ _objList1[10].setDetails(2001, 12, -1, -1, 1, NULL);
+
+ for (int i = 0; i < 11; i++) {
+ _objList1[i].animate(ANIM_MODE_1, NULL);
+ _objList1[i]._moveDiff.x = 3;
+ _objList1[i]._moveRate = 8;
+ _objList1[i].hide();
+ switch (i - 1) {
+ case 0:
+ if (R2_GLOBALS._v56605[3 + i] == 1)
+ ++R2_GLOBALS._v56605[3 + i];
+ else if (R2_GLOBALS._v56605[3 + i] == 5)
+ --R2_GLOBALS._v56605[3 + i];
+ break;
+ case 2:
+ if (R2_GLOBALS._v56605[3 + i] == 7)
+ ++R2_GLOBALS._v56605[3 + i];
+ else if (R2_GLOBALS._v56605[3 + i] == 13)
+ --R2_GLOBALS._v56605[3 + i];
+ break;
+ case 4:
+ if (R2_GLOBALS._v56605[3 + i] == 14)
+ ++R2_GLOBALS._v56605[3 + i];
+ else if (R2_GLOBALS._v56605[3 + i] == 16)
+ --R2_GLOBALS._v56605[3 + i];
+ break;
+ case 6:
+ if (R2_GLOBALS._v56605[3 + i] == 19)
+ ++R2_GLOBALS._v56605[3 + i];
+ else if (R2_GLOBALS._v56605[3 + i] == 22)
+ --R2_GLOBALS._v56605[3 + i];
+ break;
+ case 8:
+ if (R2_GLOBALS._v56605[3 + i] == 23)
+ ++R2_GLOBALS._v56605[3 + i];
+ else if (R2_GLOBALS._v56605[3 + i] == 27)
+ --R2_GLOBALS._v56605[3 + i];
+ break;
+ default:
+ break;
+ }
+ switch (R2_GLOBALS._v56605[3 + i] - 1) {
+ case 0:
+ case 6:
+ case 13:
+ case 18:
+ case 22:
+ case 27:
+ case 30:
+ _objList1[i].setPosition(Common::Point(265, 127));
+ break;
+ case 5:
+ case 12:
+ case 17:
+ case 21:
+ case 26:
+ _objList1[i].setPosition(Common::Point(55, 127));
+ break;
+ default:
+ _objList1[i].setPosition(Common::Point(160, 127));
+ break;
+ }
+ }
+ _objList1[1].setAction(&_action2);
+ _objList1[3].setAction(&_action5);
+ _objList1[5].setAction(&_action4);
+ _objList1[8].setAction(&_action1);
+
+ initPlayer();
+
+ _item1.setDetails(Rect(0, 0, 320, 200), 2000, 0, -1, 23, 1, NULL);
+}
+
+void Scene2000::remove() {
+ R2_GLOBALS._sound1.fadeOut(NULL);
+ SceneExt::remove();
+}
+
+void Scene2000::signal() {
+ switch (_sceneMode) {
+ case 10:
+ if (R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex] == 6)
+ g_globals->_sceneManager.changeScene(1900);
+ else {
+ _mazePlayerMode = 1;
+ --R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex];
+ initExits();
+ initPlayer();
+ }
+ break;
+ case 11:
+ switch (R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex]) {
+ case 5:
+ g_globals->_sceneManager.changeScene(1900);
+ break;
+ case 30:
+ g_globals->_sceneManager.changeScene(2500);
+ break;
+ case 34:
+ g_globals->_sceneManager.changeScene(2350);
+ break;
+ default:
+ _mazePlayerMode = 2;
+ ++R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex];
+ initExits();
+ initPlayer();
+ break;
+ }
+ break;
+ case 12:
+ case 13:
+ initExits();
+ initPlayer();
+ break;
+ case 14:
+ switch (_mazePlayerMode - 1) {
+ case 0:
+ g_globals->_sceneManager.changeScene(2450);
+ break;
+ case 1:
+ g_globals->_sceneManager.changeScene(2440);
+ break;
+ case 2:
+ g_globals->_sceneManager.changeScene(2435);
+ break;
+ case 3:
+ g_globals->_sceneManager.changeScene(2430);
+ break;
+ case 4:
+ g_globals->_sceneManager.changeScene(2425);
+ break;
+ case 5:
+ g_globals->_sceneManager.changeScene(2525);
+ break;
+ case 6:
+ g_globals->_sceneManager.changeScene(2530);
+ break;
+ case 7:
+ g_globals->_sceneManager.changeScene(2535);
+ break;
+ default:
+ break;
+ }
+ break;
+ case 2039:
+ case 2041:
+ g_globals->_sceneManager.changeScene(2350);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene2000::process(Event &event) {
+ if ((R2_GLOBALS._player._canWalk) && (event.eventType == EVENT_BUTTON_DOWN) &&
+ (R2_GLOBALS._events.getCursor() == CURSOR_CROSSHAIRS)) {
+ warning("TODO: Check sub_22D26");
+
+ Common::Point pt(event.mousePos.x, 129);
+ PlayerMover *mover = new PlayerMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+
+ event.handled = true;
+ }
+ Scene::process(event);
+}
+
+void Scene2000::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+
+ s.syncAsByte(_exitingFlag);
+ s.syncAsSint16LE(_mazePlayerMode);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 2350 - Balloon Launch Platform
+ *
+ *--------------------------------------------------------------------------*/
+bool Scene2350::Actor2::startAction(CursorType action, Event &event) {
+ if (action != R2_6)
+ return(SceneActor::startAction(action, event));
+ return true;
+}
+
+bool Scene2350::Actor3::startAction(CursorType action, Event &event) {
+ Scene2350 *scene = (Scene2350 *)R2_GLOBALS._sceneManager._scene;
+
+ if ((action == R2_20) && (R2_GLOBALS.getFlag(74))) {
+ R2_GLOBALS._player.disableControl();
+ scene->_actor1.postInit();
+ scene->_sceneMode = 2355;
+ scene->setAction(&scene->_sequenceManager, scene, 2355, &R2_GLOBALS._player, &scene->_actor1, NULL);
+ return true;
+ }
+
+ return(SceneActor::startAction(action, event));
+}
+
+void Scene2350::ExitUp::changeScene() {
+ Scene2350 *scene = (Scene2350 *)R2_GLOBALS._sceneManager._scene;
+
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 12;
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->setAction(&scene->_sequenceManager, scene, 2350, &R2_GLOBALS._player, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager, scene, 2352, &R2_GLOBALS._player, NULL);
+}
+
+void Scene2350::ExitWest::changeScene() {
+ Scene2350 *scene = (Scene2350 *)R2_GLOBALS._sceneManager._scene;
+
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 11;
+
+ Common::Point pt(-10, 129);
+ warning("TODO: Check sub_22D26");
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+
+}
+
+void Scene2350::postInit(SceneObjectList *OwnerList) {
+ loadScene(2350);
+ SceneExt::postInit();
+ R2_GLOBALS._sound1.play(200);
+ _stripManager.addSpeaker(&_pharishaSpeaker);
+ _stripManager.addSpeaker(&_quinnSpeaker);
+
+ if (R2_GLOBALS._sceneManager._previousScene == -1)
+ R2_GLOBALS._player._characterScene[2] = 2350;
+
+ _exitUp.setDetails(Rect(25, 83, 93, 125), EXITCURSOR_NW, 2350);
+ _exitUp.setDest(Common::Point(80, 129));
+ _exitWest.setDetails(Rect(0, 100, 14, 140), EXITCURSOR_W, 2350);
+ _exitWest.setDest(Common::Point(14, 129));
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ R2_GLOBALS._player.setup(2008, 3, 1);
+ R2_GLOBALS._player._moveDiff = Common::Point(3, 2);
+ } else {
+ R2_GLOBALS._player.setup(20, 3, 1);
+ R2_GLOBALS._player._moveDiff = Common::Point(5, 3);
+ }
+
+ if (R2_GLOBALS._player._characterScene[1] == R2_GLOBALS._player._characterScene[2]) {
+ _actor2.postInit();
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ _actor2.setup(20, 5, 1);
+ _actor2.setDetails(9002, 0, 4, 3, 1, NULL);
+ } else {
+ _actor2.setup(2008, 5, 1);
+ _actor2.setDetails(9001, 0, 5, 3, 1, NULL);
+ }
+ _actor2.setPosition(Common::Point(135, 128));
+ }
+ _actor3.postInit();
+ _actor4.postInit();
+
+ if (R2_INVENTORY.getObjectScene(20) == 2350) {
+ _actor3.hide();
+ _actor4.hide();
+ } else {
+ _actor3.setup(2350, 0, 1);
+ _actor3.setPosition(Common::Point(197, 101));
+ _actor3.setDetails(2000, 12, -1, -1, 1, NULL);
+ _actor3.fixPriority(10);
+ _actor4.setup(2350, 1, 2);
+ _actor4.setPosition(Common::Point(199, 129));
+ _actor4.setDetails(2000, 12, -1, -1, 1, NULL);
+ _actor4.fixPriority(10);
+ }
+ _item1.setDetails(Rect(0, 0, 320, 200), 2000, 9, -1, -1, 1, NULL);
+ R2_GLOBALS._player.disableControl();
+
+ if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2000) {
+ if (R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex] == 34) {
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _sceneMode = 2351;
+ else
+ _sceneMode = 2353;
+ setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL);
+ } else {
+ _sceneMode = 10;
+ R2_GLOBALS._player.setPosition(Common::Point(-20, 129));
+ Common::Point pt(20, 129);
+ warning("TODO: Check sub_22D26");
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+
+ }
+ } else {
+ R2_GLOBALS._player.setPosition(Common::Point(100, 129));
+ R2_GLOBALS._player.setStrip(3);
+ R2_GLOBALS._player.enableControl();
+ }
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2350;
+}
+
+void Scene2350::remove() {
+ R2_GLOBALS._sound1.fadeOut(NULL);
+ SceneExt::remove();
+}
+
+void Scene2350::signal() {
+ switch (_sceneMode) {
+ case 11:
+ R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex] = 34;
+ g_globals->_sceneManager.changeScene(2000);
+ break;
+ case 12:
+ R2_GLOBALS._v56605[R2_GLOBALS._player._characterIndex] = 29;
+ g_globals->_sceneManager.changeScene(2000);
+ break;
+ case 20:
+ _sceneMode = 21;
+ _stripManager.start(712, this);
+ break;
+ case 21:
+ R2_GLOBALS._player.disableControl();
+ R2_INVENTORY.setObjectScene(36, 1);
+ _sceneMode = 2354;
+ setAction(&_sequenceManager, this, 2354, &R2_GLOBALS._player, NULL);
+ break;
+ case 2354:
+ R2_INVENTORY.setObjectScene(20, 2350);
+ g_globals->_sceneManager.changeScene(2900);
+ break;
+ case 2355:
+ _sceneMode = 20;
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+ _stripManager.start(711, this);
+ break;
+ default:
+ R2_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene2350::process(Event &event) {
+ if ((R2_GLOBALS._player._canWalk) && (event.eventType != EVENT_BUTTON_DOWN) &&
+ (R2_GLOBALS._events.getCursor() == CURSOR_CROSSHAIRS)){
+ Common::Point pt(event.mousePos.x, 129);
+ PlayerMover *mover = new PlayerMover();
+ R2_GLOBALS._player.addMover(mover, &pt);
+ event.handled = true;
+ }
+ Scene::process(event);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 2400 - Maze: Large empty room
+ *
+ *--------------------------------------------------------------------------*/
+void Scene2400::Exit1::changeScene() {
+ Scene2400 *scene = (Scene2400 *)R2_GLOBALS._sceneManager._scene;
+
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 10;
+
+ Common::Point pt(-10, 150);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+
+}
+
+void Scene2400::Exit2::changeScene() {
+ Scene2400 *scene = (Scene2400 *)R2_GLOBALS._sceneManager._scene;
+
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 11;
+
+ Common::Point pt(330, 150);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+}
+
+void Scene2400::postInit(SceneObjectList *OwnerList) {
+ loadScene(2400);
+ SceneExt::postInit();
+ _exit1.setDetails(Rect(0, 125, 14, 165), EXITCURSOR_W, 2000);
+ _exit1.setDest(Common::Point(14, 150));
+ _exit2.setDetails(Rect(305, 125, 320, 165), EXITCURSOR_E, 2000);
+ _exit2.setDest(Common::Point(315, 150));
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.disableControl();
+
+ if (R2_GLOBALS._v56605[1] == 16) {
+ _sceneMode = 2400;
+ setAction(&_sequenceManager, this, 2400, &R2_GLOBALS._player, NULL);
+ } else {
+ _sceneMode = 2401;
+ setAction(&_sequenceManager, this, 2401, &R2_GLOBALS._player, NULL);
+ }
+}
+
+void Scene2400::signal() {
+ switch (_sceneMode) {
+ case 10:
+ R2_GLOBALS._v56605[1] = 16;
+ g_globals->_sceneManager.changeScene(2000);
+ break;
+ case 11:
+ R2_GLOBALS._v56605[1] = 17;
+ g_globals->_sceneManager.changeScene(2000);
+ break;
+ default:
+ R2_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 2425 - Maze:
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene2425::Item1::startAction(CursorType action, Event &event) {
+ Scene2425 *scene = (Scene2425 *)R2_GLOBALS._sceneManager._scene;
+
+ if ((action == R2_37) && (!R2_GLOBALS.getFlag(84))) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2426;
+ scene->setAction(&scene->_sequenceManager, scene, 2426, &R2_GLOBALS._player, &scene->_actor1, NULL);
+ R2_GLOBALS.setFlag(84);
+ return true;
+ } else if (action == R2_37) {
+ R2_GLOBALS._events.setCursor(R2_STEPPING_DISKS);
+ R2_GLOBALS._player.enableControl(R2_STEPPING_DISKS);
+ return NamedHotspot::startAction(R2_STEPPING_DISKS, event);
+ } else
+ return NamedHotspot::startAction(action, event);
+}
+
+bool Scene2425::Item2::startAction(CursorType action, Event &event) {
+ Scene2425 *scene = (Scene2425 *)R2_GLOBALS._sceneManager._scene;
+
+ if ((action == R2_37) && (R2_GLOBALS.getFlag(84))) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2427;
+ scene->setAction(&scene->_sequenceManager, scene, 2427, &R2_GLOBALS._player, &scene->_actor1, NULL);
+ R2_GLOBALS.clearFlag(84);
+ return true;
+ } else if (action == R2_37) {
+ R2_GLOBALS._events.setCursor(R2_STEPPING_DISKS);
+ R2_GLOBALS._player.enableControl(R2_STEPPING_DISKS);
+ return NamedHotspot::startAction(R2_STEPPING_DISKS, event);
+ } else
+ return NamedHotspot::startAction(action, event);
+}
+
+bool Scene2425::Item3::startAction(CursorType action, Event &event) {
+ Scene2425 *scene = (Scene2425 *)R2_GLOBALS._sceneManager._scene;
+
+ if (action != R2_37)
+ return NamedHotspot::startAction(action, event);
+ else {
+ R2_GLOBALS._player.disableControl();
+ if (R2_GLOBALS.getFlag(84)) {
+ scene->_sceneMode = 20;
+ scene->setAction(&scene->_sequenceManager, scene, 2427, &R2_GLOBALS._player, &scene->_actor1, NULL);
+ R2_GLOBALS.clearFlag(84);
+ } else {
+ scene->_sceneMode = 2425;
+ scene->setAction(&scene->_sequenceManager, scene, 2425, &R2_GLOBALS._player, &scene->_actor1, NULL);
+ }
+ return true;
+ }
+}
+
+bool Scene2425::Item4::startAction(CursorType action, Event &event) {
+ if (action != R2_37)
+ return NamedHotspot::startAction(action, event);
+ else {
+ R2_GLOBALS._events.setCursor(R2_STEPPING_DISKS);
+ R2_GLOBALS._player.enableControl(R2_STEPPING_DISKS);
+ return NamedHotspot::startAction(R2_STEPPING_DISKS, event);
+ }
+}
+
+bool Scene2425::Actor1::startAction(CursorType action, Event &event) {
+ if (action == R2_STEPPING_DISKS) {
+ if (R2_GLOBALS._player._characterIndex == 2) {
+ R2_GLOBALS._events.setCursor(R2_37);
+ return true;
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+ } else if (R2_GLOBALS._events.getCursor() == R2_37)
+ return false;
+ else
+ return SceneActor::startAction(action, event);
+}
+
+bool Scene2425::Actor2::startAction(CursorType action, Event &event) {
+ if (action != R2_37)
+ return SceneActor::startAction(action, event);
+ else {
+ R2_GLOBALS._events.setCursor(R2_STEPPING_DISKS);
+ R2_GLOBALS._player.enableControl(R2_STEPPING_DISKS);
+ return SceneActor::startAction(R2_STEPPING_DISKS, event);
+ }
+}
+
+void Scene2425::Exit1::changeScene() {
+ Scene2425 *scene = (Scene2425 *)R2_GLOBALS._sceneManager._scene;
+
+ _enabled = false;
+ R2_GLOBALS._events.setCursor(R2_NEGATOR_GUN);
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 11;
+
+ Common::Point pt(340, 200);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+}
+
+
+void Scene2425::postInit(SceneObjectList *OwnerList) {
+ loadScene(2425);
+ SceneExt::postInit();
+ if (R2_GLOBALS._sceneManager._previousScene == -1) {
+ R2_GLOBALS._player._characterIndex = R2_SEEKER;
+ R2_GLOBALS._sceneManager._previousScene = 2000;
+ }
+
+ R2_GLOBALS._sound1.play(200);
+ _exit1.setDetails(Rect(270, 136, 319, 168), EXITCURSOR_SE, 2000);
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ R2_GLOBALS._player.setVisage(2008);
+ R2_GLOBALS._player._moveDiff = Common::Point(3, 2);
+ } else {
+ R2_GLOBALS._player.setVisage(20);
+ R2_GLOBALS._player._moveDiff = Common::Point(5, 3);
+ }
+
+ if (R2_GLOBALS._player._characterScene[1] == R2_GLOBALS._player._characterScene[2]) {
+ _actor2.postInit();
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ _actor2.setup(20, 5, 1);
+ _actor2.setDetails(9002, 0, 4, 3, 1, NULL);
+ } else {
+ _actor2.setup(2008, 5, 1);
+ _actor2.setDetails(9001, 0, 5, 3, 1, NULL);
+ }
+ _actor2.setPosition(Common::Point(250, 185));
+ }
+
+ _actor1.postInit();
+ if (R2_GLOBALS._sceneManager._previousScene == 2455)
+ _actor1.setup(2426, 1, 1);
+ else
+ _actor1.setup(2426, 1, 2);
+
+ _actor1.setPosition(Common::Point(290, 9));
+ _actor1.fixPriority(20);
+ _actor1.setDetails(2455, 12, -1, -1, 1, NULL);
+ _item1.setDetails(Rect(225, 52, 248, 65), 2425, -1, -1, -1, 1, NULL);
+ _item2.setDetails(Rect(292, 81, 316, 94), 2425, -1, -1, -1, 1, NULL);
+
+// CHECKME: SceneActor using a SceneItem function??
+// _actor3.setDetails(11, 2425, 3, -1, 6);
+ _actor3._sceneRegionId = 11;
+ _actor3._resNum = 2425;
+ _actor3._lookLineNum = 3;
+ _actor3._talkLineNum = -1;
+ _actor3._useLineNum = 6;
+ g_globals->_sceneItems.push_back(&_actor3);
+
+ _item3.setDetails(12, 2425, 7, -1, 9);
+ _item4.setDetails(Rect(0, 0, 320, 200), 2425, 0, -1, -1, 1, NULL);
+
+ R2_GLOBALS._player.disableControl();
+ switch (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex]) {
+ case 2000: {
+ _sceneMode = 10;
+ R2_GLOBALS._player.setPosition(Common::Point(340, 200));
+
+ Common::Point pt(280, 150);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ break;
+ }
+ case 2425:
+ _sceneMode = 10;
+ R2_GLOBALS._player.setPosition(Common::Point(280, 150));
+ _action->signal();
+ break;
+ case 2455:
+ _sceneMode = 2428;
+ setAction(&_sequenceManager, this, 2428, &R2_GLOBALS._player, &_actor1, NULL);
+ break;
+ default:
+ R2_GLOBALS._player.setPosition(Common::Point(280, 150));
+ R2_GLOBALS._player.setStrip(8);
+ R2_GLOBALS._player.enableControl();
+ break;
+ }
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2425;
+}
+
+void Scene2425::remove() {
+ R2_GLOBALS._sound1.fadeOut(NULL);
+ SceneExt::remove();
+}
+
+void Scene2425::signal() {
+ switch (_sceneMode) {
+ case 11:
+ g_globals->_sceneManager.changeScene(2000);
+ break;
+ case 20:
+ _sceneMode = 2425;
+ setAction(&_sequenceManager, this, 2425, &R2_GLOBALS._player, &_actor1, NULL);
+ break;
+ case 2425:
+ g_globals->_sceneManager.changeScene(2455);
+ break;
+ default:
+ R2_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 2430 - Maze: Bedroom
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene2430::Actor1::startAction(CursorType action, Event &event) {
+ return SceneActor::startAction(action, event);
+}
+
+bool Scene2430::Actor2::startAction(CursorType action, Event &event) {
+ Scene2430 *scene = (Scene2430 *)R2_GLOBALS._sceneManager._scene;
+
+ if ((action != R2_STEPPING_DISKS) || (R2_GLOBALS._player._characterIndex != 2))
+ return SceneActor::startAction(action, event);
+
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2430;
+ scene->setAction(&scene->_sequenceManager, scene, 2430, &R2_GLOBALS._player, &scene->_actor2, NULL);
+ return true;
+}
+
+bool Scene2430::Actor3::startAction(CursorType action, Event &event) {
+ Scene2430 *scene = (Scene2430 *)R2_GLOBALS._sceneManager._scene;
+
+ if ((action != R2_STEPPING_DISKS) || (R2_GLOBALS._player._characterIndex != 2))
+ return SceneActor::startAction(action, event);
+
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2435;
+ scene->setAction(&scene->_sequenceManager, scene, 2435, &R2_GLOBALS._player, &scene->_actor3, NULL);
+ return true;
+}
+
+void Scene2430::Exit1::changeScene() {
+ Scene2430 *scene = (Scene2430 *)R2_GLOBALS._sceneManager._scene;
+
+ scene->_sceneMode = 0;
+ R2_GLOBALS._events.setCursor(R2_NEGATOR_GUN);
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 11;
+ Common::Point pt(108, 200);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+}
+
+void Scene2430::postInit(SceneObjectList *OwnerList) {
+ loadScene(2430);
+ SceneExt::postInit();
+ _exit1.setDetails(Rect(68, 155, 147, 168), EXITCURSOR_S, 2000);
+ _exit1.setDest(Common::Point(108, 160));
+
+ if (R2_INVENTORY.getObjectScene(37) == 2430) {
+ _actor2.postInit();
+ _actor2.setup(2435, 1, 5);
+ _actor2.setPosition(Common::Point(205, 119));
+ _actor2.fixPriority(152);
+ _actor2.setDetails(2430, 51, -1, 53, 1, NULL);
+ }
+
+ if (R2_INVENTORY.getObjectScene(50) == 2435) {
+ _actor3.postInit();
+ _actor3.setup(2435, 1, 1);
+ _actor3.setPosition(Common::Point(31, 65));
+ _actor3.setDetails(2430, 48, -1, -1, 1, NULL);
+ }
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ R2_GLOBALS._player.setVisage(2008);
+ R2_GLOBALS._player._moveDiff = Common::Point(3, 2);
+ } else {
+ R2_GLOBALS._player.setVisage(20);
+ R2_GLOBALS._player._moveDiff = Common::Point(5, 3);
+ }
+ R2_GLOBALS._player.setPosition(Common::Point(100, 200));
+
+ if (R2_GLOBALS._player._characterScene[1] == R2_GLOBALS._player._characterScene[2]) {
+ _actor1.postInit();
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ _actor1.setup(20, 5, 1);
+ _actor1.setDetails(9002, 0, 4, 3, 1, NULL);
+ } else {
+ _actor1.setup(2008, 5, 1);
+ _actor1.setDetails(9001, 0, 5, 3, 1, NULL);
+ }
+ _actor1.setPosition(Common::Point(189, 137));
+ R2_GLOBALS._walkRegions.enableRegion(4);
+ }
+
+ _item2.setDetails(Rect(11, 30, 37, 45), 2430, 3, -1, 5, 1, NULL);
+ _item3.setDetails(Rect(9, 58, 63, 92), 2430, 6, -1, -1, 1, NULL);
+ _item4.setDetails(Rect(20, 89, 127, 107), 2430, 9, -1, 11, 1, NULL);
+ _item5.setDetails(Rect(49, 7, 60, 27), 2430, 12, 13, 14, 1, NULL);
+ _item6.setDetails(Rect(69, 10, 95, 72), 2430, 15, -1, 14, 1, NULL);
+ _item10.setDetails(Rect(198, 4, 222, 146), 2430, 30, 31, 32, 1, NULL);
+ _item7.setDetails(Rect(155, 40, 304, 120), 2430, 21, -1, 23, 1, NULL);
+ _item8.setDetails(Rect(249, 3, 261, 39), 2430, 24, 25, -1, 1, NULL);
+ _item9.setDetails(Rect(279, 13, 305, 34), 2430, 33, -1, 18, 1, NULL);
+ // CHECKME: initialized for the 2nd time??
+ _item2.setDetails(Rect(11, 30, 37, 45), 2430, 33, -1, 18, 1, NULL);
+ _item11.setDetails(Rect(116, 104, 148, 111), 2430, 39, -1, -1, 1, NULL);
+ _item12.setDetails(Rect(66, 77, 84, 83), 2430, 39, -1, -1, 1, NULL);
+ _item13.setDetails(Rect(117, 118, 201, 141), 2430, 9, -1, 11, 1, NULL);
+ _item1.setDetails(Rect(0, 0, 320, 200), 2430, 0, -1, -1, 1, NULL);
+
+ if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2000) {
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2430;
+ Common::Point pt(108, 150);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ } else {
+ R2_GLOBALS._player.setPosition(Common::Point(105, 145));
+ R2_GLOBALS._player.setStrip(3);
+ R2_GLOBALS._player.enableControl();
+ }
+}
+
+void Scene2430::signal() {
+ switch (_sceneMode) {
+ case 11:
+ g_globals->_sceneManager.changeScene(2000);
+ break;
+ case 2430:
+ _actor2.remove();
+ R2_INVENTORY.setObjectScene(R2_37, 2);
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 2435:
+ _actor3.remove();
+ R2_INVENTORY.setObjectScene(R2_50, 2);
+ R2_GLOBALS._player.enableControl();
+ break;
+ default:
+ R2_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 2435 - Maze: Throne room
+ *
+ *--------------------------------------------------------------------------*/
+bool Scene2435::Actor1::startAction(CursorType action, Event &event) {
+ return SceneActor::startAction(action, event);
+}
+
+bool Scene2435::Actor2::startAction(CursorType action, Event &event) {
+ Scene2435 *scene = (Scene2435 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case R2_34:
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._events.setCursor(R2_2);
+ R2_GLOBALS.setFlag(82);
+ scene->_stripManager.start(603, scene);
+ return true;
+ case R2_35:
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._events.setCursor(R2_2);
+ R2_GLOBALS.setFlag(82);
+ scene->_stripManager.start(602, scene);
+ R2_INVENTORY.setObjectScene(R2_35, 2000);
+ return true;
+ case CURSOR_TALK:
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 20;
+ R2_GLOBALS._events.setCursor(R2_2);
+ if ((R2_GLOBALS._player._characterIndex == 1) || (R2_GLOBALS.getFlag(82))) {
+ scene->_stripManager.start(605, scene);
+ return true;
+ } else if (R2_INVENTORY.getObjectScene(R2_35) == 2) {
+ scene->_stripManager.start(601, scene);
+ return true;
+ } else {
+ R2_GLOBALS.setFlag(82);
+ scene->_stripManager.start(600, scene);
+ return true;
+ }
+ default:
+ return SceneActor::startAction(action, event);
+ }
+}
+
+void Scene2435::Exit1::changeScene() {
+ Scene2435 *scene = (Scene2435 *)R2_GLOBALS._sceneManager._scene;
+
+ _enabled = false;
+ R2_GLOBALS._events.setCursor(R2_NEGATOR_GUN);
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 11;
+ Common::Point pt(175, 200);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+
+}
+
+void Scene2435::postInit(SceneObjectList *OwnerList) {
+ loadScene(2435);
+ SceneExt::postInit();
+ R2_GLOBALS._sound1.play(201);
+ _stripManager.addSpeaker(&_quinnSpeaker);
+ _stripManager.addSpeaker(&_seekerSpeaker);
+ _stripManager.addSpeaker(&_pharishaSpeaker);
+ _exit1.setDetails(Rect(142, 155, 207, 167), EXITCURSOR_S, 2000);
+ _exit1.setDest(Common::Point(175, 160));
+ _actor2.postInit();
+ _actor2.setup(2005, 3, 1);
+ _actor2.setPosition(Common::Point(219, 106));
+ _actor2.setDetails(2001, 25, 26, -1, 1, NULL);
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ R2_GLOBALS._player.setVisage(2008);
+ R2_GLOBALS._player._moveDiff = Common::Point(3, 2);
+ } else {
+ R2_GLOBALS._player.setVisage(20);
+ R2_GLOBALS._player._moveDiff = Common::Point(5, 3);
+ }
+ R2_GLOBALS._player.setPosition(Common::Point(715, 200));
+ if (R2_GLOBALS._player._characterScene[1] == R2_GLOBALS._player._characterScene[2]) {
+ _actor1.postInit();
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ _actor1.setup(20, 5, 1);
+ _actor1.setDetails(9002, 0, 4, 3, 1, NULL);
+ } else {
+ _actor1.setup(2008, 5, 1);
+ _actor1.setDetails(9001, 0, 5, 3, 1, NULL);
+ }
+ _actor1.setPosition(Common::Point(107, 145));
+ R2_GLOBALS._walkRegions.enableRegion(2);
+ }
+
+ _item2.setDetails(Rect(52, 44, 96, 82), 2430, 3, -1, 5, 1, NULL);
+ _item3.setDetails(Rect(117, 36, 161, 74), 2430, 3, -1, 5, 1, NULL);
+ _item1.setDetails(Rect(0, 0, 320, 200), 2430, 0, -1, -1, 1, NULL);
+ R2_GLOBALS._player.disableControl();
+ if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2000) {
+ _sceneMode = 10;
+ Common::Point pt(175, 150);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ } else if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2450) {
+ _sceneMode = 30;
+ Common::Point pt(175, 150);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ } else {
+ R2_GLOBALS._player.setPosition(Common::Point(210, 150));
+ R2_GLOBALS._player.setStrip(3);
+ R2_GLOBALS._player.enableControl();
+ }
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2435;
+ R2_GLOBALS._v56605[1 + R2_GLOBALS._player._characterIndex] = 12;
+}
+
+void Scene2435::remove() {
+ R2_GLOBALS._sound1.fadeOut2(NULL);
+ SceneExt::remove();
+}
+
+void Scene2435::signal() {
+ switch (_sceneMode) {
+ case 11:
+ g_globals->_sceneManager.changeScene(2000);
+ break;
+ case 20:
+ R2_GLOBALS._player.enableControl(R2_6);
+ break;
+ case 30:
+ R2_GLOBALS._player._characterScene[1] = 2435;
+ R2_GLOBALS._player._characterScene[2] = 2435;
+ R2_GLOBALS._player._oldCharacterScene[1] = 2435;
+ R2_GLOBALS._player._oldCharacterScene[2] = 2435;
+ R2_GLOBALS._v56605[1] = 12;
+ R2_GLOBALS._v56605[2] = 12;
+ R2_GLOBALS.setFlag(81);
+ _sceneMode = 2436;
+ R2_GLOBALS._player.setStrip(7);
+ _actor1.postInit();
+ if (R2_GLOBALS._player._characterIndex == 1)
+ _actor1.setVisage(20);
+ else
+ _actor1.setVisage(2008);
+ setAction(&_sequenceManager, this, 2436, &_actor1, NULL);
+ break;
+ case 2436:
+ R2_GLOBALS._walkRegions.enableRegion(2);
+ _sceneMode = 20;
+ R2_GLOBALS._events.setCursor(R2_2);
+ _stripManager.start(709, this);
+ default:
+ R2_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 2440 - Maze: Another bedroom
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene2440::Actor1::startAction(CursorType action, Event &event) {
+ return SceneActor::startAction(action, event);
+}
+
+bool Scene2440::Actor2::startAction(CursorType action, Event &event) {
+ Scene2440 *scene = (Scene2440 *)R2_GLOBALS._sceneManager._scene;
+
+ if ((action == CURSOR_USE) && (R2_GLOBALS._player._characterIndex == 2)){
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2440;
+ scene->setAction(&scene->_sequenceManager, scene, 2440, &R2_GLOBALS._player, &scene->_actor2, NULL);
+ return true;
+ }
+
+ return SceneActor::startAction(action, event);
+}
+
+void Scene2440::Exit1::changeScene() {
+ Scene2440 *scene = (Scene2440 *)R2_GLOBALS._sceneManager._scene;
+
+ _enabled = false;
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 11;
+ Common::Point pt(210, 200);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+}
+
+void Scene2440::postInit(SceneObjectList *OwnerList) {
+ loadScene(2440);
+ SceneExt::postInit();
+ R2_GLOBALS._sound1.play(200);
+ // Fix exit cursor, the original was using NW
+ _exit1.setDetails(Rect(172, 155, 250, 167), EXITCURSOR_SE, 2000);
+ _exit1.setDest(Common::Point(210, 160));
+ if (R2_INVENTORY.getObjectScene(49) == 2440) {
+ _actor2.postInit();
+ _actor2.setup(2435, 1, 1);
+ _actor2.setPosition(Common::Point(94, 80));
+ _actor2.fixPriority(106);
+ _actor2.setDetails(2430, 48, -1, -1, 1, NULL);
+ }
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.enableControl();
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ R2_GLOBALS._player.setVisage(2008);
+ R2_GLOBALS._player._moveDiff = Common::Point(3, 2);
+ } else {
+ R2_GLOBALS._player.setVisage(20);
+ R2_GLOBALS._player._moveDiff = Common::Point(5, 3);
+ }
+ R2_GLOBALS._player.setPosition(Common::Point(210, 200));
+ if (R2_GLOBALS._player._characterScene[1] == R2_GLOBALS._player._characterScene[2]) {
+ _actor1.postInit();
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ _actor1.setup(20, 5, 1);
+ _actor1.setDetails(9002, 0, 4, 3, 1, NULL);
+ } else {
+ _actor1.setup(2008, 5, 1);
+ _actor1.setDetails(9002, 0, 5, 3, 1, NULL);
+ }
+ _actor1.setPosition(Common::Point(38, 119));
+ }
+
+ _item2.setDetails(Rect(125, 25, 142, 73), 2430, 15, -1, 14, 1, NULL);
+ _item3.setDetails(Rect(124, 78, 237, 120), 2430, 36, -1, 38, 1, NULL);
+ _item4.setDetails(Rect(250, 3, 265, 133), 2430, 30, 31, 32, 1, NULL);
+ _item5.setDetails(Rect(91, 117, 203, 140), 2430, 9, -1, 11, 1, NULL);
+ _item6.setDetails(Rect(48, 78, 103, 112), 2430, 6, -1, -1, 1, NULL);
+ _item7.setDetails(Rect(48, 31, 73, 52), 2430, 33, -1, 18, 1, NULL);
+ _item1.setDetails(Rect(0, 0, 320, 200), 2430, 0, -1, -1, 1, NULL);
+
+ R2_GLOBALS._player.disableControl();
+
+ if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2000) {
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2440;
+ Common::Point pt(210, 150);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ } else {
+ R2_GLOBALS._player.setPosition(Common::Point(210, 150));
+ R2_GLOBALS._player.setStrip(3);
+ R2_GLOBALS._player.enableControl();
+ }
+}
+
+void Scene2440::remove() {
+ R2_GLOBALS._sound1.fadeOut2(NULL);
+ SceneExt::remove();
+}
+
+void Scene2440::signal() {
+ switch (_sceneMode) {
+ case 11:
+ g_globals->_sceneManager.changeScene(2000);
+ break;
+ case 2440:
+ _actor2.remove();
+ R2_INVENTORY.setObjectScene(49, 2);
+ // No break on purpose
+ default:
+ R2_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 2445 - Maze:
+ *
+ *--------------------------------------------------------------------------*/
+void Scene2445::postInit(SceneObjectList *OwnerList) {
+ loadScene(2445);
+ SceneExt::postInit();
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ R2_GLOBALS._player.setVisage(10);
+ R2_GLOBALS._player.setPosition(Common::Point(160, 140));
+ R2_GLOBALS._player.disableControl();
+}
+
+void Scene2445::signal() {
+ R2_GLOBALS._player.enableControl();
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 2450 - Maze: Another bedroom
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene2450::Actor2::startAction(CursorType action, Event &event) {
+ Scene2450 *scene = (Scene2450 *)R2_GLOBALS._sceneManager._scene;
+
+ if ((action == CURSOR_USE) && (R2_GLOBALS._player._characterIndex == 1)) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2452;
+ scene->setAction(&scene->_sequenceManager, scene, 2452, &R2_GLOBALS._player, &scene->_actor2, NULL);
+ return true;
+ }
+ return SceneActor::startAction(action, event);
+}
+
+bool Scene2450::Actor3::startAction(CursorType action, Event &event) {
+ Scene2450 *scene = (Scene2450 *)R2_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_TALK) {
+ R2_GLOBALS._player.disableControl();
+ if (R2_GLOBALS._v565AE < 3) {
+ ++R2_GLOBALS._v565AE;
+ scene->_sceneMode = 20;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ if (R2_GLOBALS._player._characterIndex == 1)
+ scene->_stripManager.start(699 + (R2_GLOBALS._v565AE * 2), scene);
+ else
+ scene->_stripManager.start(700 + (R2_GLOBALS._v565AE * 2), scene);
+ }
+ return true;} else {
+ return SceneActor::startAction(action, event);
+ }
+}
+
+void Scene2450::Exit1::changeScene() {
+ Scene2450 *scene = (Scene2450 *)R2_GLOBALS._sceneManager._scene;
+
+ if ((R2_GLOBALS._player._characterIndex == 2) || (R2_GLOBALS.getFlag(61))) {
+ _enabled = false;
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 10;
+ Common::Point pt(-10, 180);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+ } else {
+ _moving = false;
+ SceneItem::display(2450, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ Common::Point pt(60, 140);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, NULL);
+ }
+}
+
+void Scene2450::postInit(SceneObjectList *OwnerList) {
+ loadScene(2450);
+ SceneExt::postInit();
+ R2_GLOBALS._sound1.play(200);
+ if (R2_GLOBALS._sceneManager._previousScene == -1) {
+ R2_GLOBALS._sceneManager._previousScene = 1900;
+ R2_GLOBALS._player._oldCharacterScene[1] = 1900;
+ R2_GLOBALS._player._oldCharacterScene[2] = 1900;
+ }
+ _stripManager.addSpeaker(&_quinnSpeaker);
+ _stripManager.addSpeaker(&_seekerSpeaker);
+ _stripManager.addSpeaker(&_caretakerSpeaker);
+
+ if (R2_GLOBALS.getFlag(72)) {
+ _exit1.setDetails(Rect(0, 143, 47, 168), EXITCURSOR_SW, 2000);
+ _exit1.setDest(Common::Point(10, 160));
+ }
+
+ if (!R2_GLOBALS.getFlag(61)) {
+ _actor2.postInit();
+ _actor2.setVisage(2009);
+ _actor2.setPosition(Common::Point(190, 119));
+ _actor2.fixPriority(50);
+ _actor2.setDetails(2450, 0, -1, -1, 1, NULL);
+ }
+
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.disableControl();
+ switch (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex]) {
+ case 1900:
+ R2_GLOBALS._v565AE = 0;
+ R2_GLOBALS._player._characterScene[1] = 2450;
+ R2_GLOBALS._player._characterScene[2] = 2450;
+ R2_GLOBALS._player._oldCharacterScene[1] = 2450;
+ R2_GLOBALS._player._oldCharacterScene[2] = 2450;
+ R2_GLOBALS._player.setup(2450, 1, 1);
+ R2_GLOBALS._player.setPosition(Common::Point(126, 101));
+ setAction(&_sequenceManager, this, 2450, &R2_GLOBALS._player, NULL);
+ break;
+ case 2000:
+ _sceneMode = 2451;
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ if (R2_GLOBALS._player._characterScene[2] == 2450) {
+ _actor1.postInit();
+ _actor1.setup(20, 6, 1);
+ _actor1.setPosition(Common::Point(240, 120));
+ _actor1.setDetails(9002, 0, 4, 3, 1, NULL);
+ }
+ setAction(&_sequenceManager, this, 2451, &R2_GLOBALS._player, NULL);
+ } else {
+ R2_GLOBALS._player._oldCharacterScene[2] = 2450;
+ R2_GLOBALS._player._characterScene[2] = 2450;
+ if (R2_GLOBALS._player._characterScene[1] == 2450) {
+ _actor1.postInit();
+ if (R2_GLOBALS.getFlag(61))
+ _actor1.setup(2008, 6, 1);
+ else
+ _actor1.setup(10, 6, 1);
+ _actor1.setDetails(9001, 0, 5, 3, 1, NULL);
+ _actor1.setPosition(Common::Point(106, 111));
+ }
+ setAction(&_sequenceManager, this, 2456, &R2_GLOBALS._player, NULL);
+ }
+ break;
+ case 2450:
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ R2_GLOBALS._player.postInit();
+ if (R2_GLOBALS.getFlag(61)) {
+ R2_GLOBALS._player.setup(2008, 6, 1);
+ } else {
+ R2_GLOBALS._player.setup(10, 6, 1);
+ }
+ R2_GLOBALS._player.setPosition(Common::Point(106, 111));
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ if (R2_GLOBALS.getFlag(72)) {
+ if (R2_GLOBALS._player._characterScene[2] == 2450) {
+ _actor1.postInit();
+ _actor1.setup(20, 6, 1);
+ _actor1.setPosition(Common::Point(240, 120));
+ _actor1.setDetails(9002, 0, 4, 3, 1, NULL);
+ }
+ } else {
+ _actor1.postInit();
+ _actor1.setup(20, 8, 1);
+ _actor1.setPosition(Common::Point(93, 158));
+ _actor1.setDetails(9002, 0, 4, 3, 1, NULL);
+
+ _actor3.postInit();
+ _actor3.setup(2001, 7, 1);
+ _actor3.setPosition(Common::Point(34, 153));
+ _actor3.setDetails(2001, 40, -1, -1, 1, NULL);
+
+ _exit1._enabled = false;
+ }
+ } else {
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.setup(20, 8, 1);
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ R2_GLOBALS._player.setPosition(Common::Point(93, 158));
+ if (R2_GLOBALS.getFlag(72)) {
+ if (R2_GLOBALS._player._characterScene[1] == 2450) {
+ _actor1.postInit();
+ if (R2_GLOBALS.getFlag(61)) {
+ _actor1.setup(2008, 6, 1);
+ } else {
+ _actor1.setup(10, 6, 1);
+ }
+ _actor1.setPosition(Common::Point(106, 111));
+ _actor1.setDetails(9001, 0, 5, 3, 1, NULL);
+ }
+ } else {
+ _actor1.postInit();
+ if (R2_GLOBALS.getFlag(61)) {
+ _actor1.setup(2008, 6, 1);
+ } else {
+ _actor1.setup(10, 6, 1);
+ }
+ _actor1.setPosition(Common::Point(106, 111));
+ _actor1.setDetails(9001, 0, 5, 3, 1, NULL);
+
+ _actor3.postInit();
+ _actor3.setup(2001, 7, 1);
+ _actor3.setPosition(Common::Point(34, 153));
+ _actor3.setDetails(2001, 40, -1, -1, 1, NULL);
+
+ _exit1._enabled = false;
+ }
+ }
+ R2_GLOBALS._player.enableControl();
+ if (!R2_GLOBALS.getFlag(72)) {
+ R2_GLOBALS._player._canWalk = false;
+ }
+ break;
+ default:
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ if (R2_GLOBALS.getFlag(61)) {
+ R2_GLOBALS._player.setup(2008, 3, 1);
+ } else {
+ R2_GLOBALS._player.setup(10, 3, 1);
+ }
+ R2_GLOBALS._player._moveDiff = Common::Point(3, 2);
+ } else {
+ R2_GLOBALS._player.setVisage(20);
+ R2_GLOBALS._player._moveDiff = Common::Point(5, 3);
+ }
+ R2_GLOBALS._player.setPosition(Common::Point(100, 130));
+ R2_GLOBALS._player.enableControl();
+ break;
+ }
+ _item2.setDetails(Rect(174, 4, 199, 123), 2430, 30, 31, 32, 1, NULL);
+ _item3.setDetails(Rect(67, 73, 207, 121), 2430, 36, -1, 38, 1, NULL);
+ _item1.setDetails(Rect(0, 0, 320, 200), 2430, 0, -1, -1, 1, NULL);
+}
+
+void Scene2450::remove() {
+ R2_GLOBALS._sound1.fadeOut2(NULL);
+ SceneExt::remove();
+}
+
+void Scene2450::signal() {
+ switch (_sceneMode) {
+ case 10:
+ g_globals->_sceneManager.changeScene(2000);
+ break;
+ case 20:
+ if (R2_GLOBALS._v565AE == 3) {
+ R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._v565AE = 4;
+ _sceneMode = 2454;
+ setAction(&_sequenceManager, this, 2454, &_actor3, NULL);
+ } else {
+ R2_GLOBALS._player.enableControl(CURSOR_TALK);
+ if (R2_GLOBALS._v565AE < 4)
+ R2_GLOBALS._player._canWalk = false;
+ }
+ break;
+ case 30:
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 2455;
+ setAction(&_sequenceManager, this, 2455, &_actor1, NULL);
+ break;
+ case 31:
+ R2_GLOBALS.setFlag(61);
+ g_globals->_sceneManager.changeScene(2435);
+ break;
+ case 2451:
+ R2_GLOBALS._player.enableControl();
+ break;
+ case 2452:
+ R2_GLOBALS.setFlag(61);
+ _actor2.remove();
+ R2_GLOBALS._player.enableControl();
+ if (!R2_GLOBALS.getFlag(72)) {
+ R2_GLOBALS._player.setStrip(6);
+ R2_GLOBALS._player._canWalk = false;
+ }
+ break;
+ case 2453:
+ _sceneMode = 20;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(700, this);
+ break;
+ case 2454:
+ _exit1._enabled = true;
+ R2_GLOBALS.setFlag(72);
+ _actor3.remove();
+ if (R2_GLOBALS.getFlag(61)) {
+ g_globals->_sceneManager.changeScene(2435);
+ } else {
+ _sceneMode = 31;
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ setAction(&_sequenceManager, this, 2452, &R2_GLOBALS._player, NULL);
+ } else {
+ setAction(&_sequenceManager, this, 2452, &_actor1, &_actor2, NULL);
+ }
+ }
+ break;
+ case 2455:
+ R2_GLOBALS._player._oldCharacterScene[2] = 2450;
+ R2_GLOBALS._player._characterScene[2] = 2000;
+ R2_GLOBALS._v56605[2] = 3;
+ _actor1.remove();
+ R2_GLOBALS._player.enableControl(CURSOR_ARROW);
+ break;
+ default:
+ _actor1.postInit();
+ _actor1.setDetails(9002, 0, 4, 3, 2, NULL);
+ _actor3.postInit();
+ _actor3.setDetails(2001, 40, -1, -1, 2, NULL);
+ _sceneMode = 2453;
+ setAction(&_sequenceManager, this, 2453, &_actor3, &_actor1, NULL);
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 2455 - Maze: Inside crevasse
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene2455::Actor1::startAction(CursorType action, Event &event) {
+ Scene2455 *scene = (Scene2455 *)R2_GLOBALS._sceneManager._scene;
+
+ if (action == R2_29) {
+ if ((R2_INVENTORY.getObjectScene(49) == 2455) || (R2_INVENTORY.getObjectScene(50) == 2455)) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2458;
+ scene->_actor2._lookLineNum = 9;
+ scene->_actor1.remove();
+ scene->_actor3.postInit();
+ scene->_actor3.setDetails(2455, 16, 1, -1, 2, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 2458, &R2_GLOBALS._player, &scene->_actor2, &scene->_actor3, NULL);
+ return true;
+ }
+ }
+
+ return SceneActor::startAction(action, event);
+}
+
+bool Scene2455::Actor2::startAction(CursorType action, Event &event) {
+ Scene2455 *scene = (Scene2455 *)R2_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case R2_49:
+ if (R2_INVENTORY.getObjectScene(50) != 2455) {
+ R2_GLOBALS._player.disableControl();
+ scene->_actor1.postInit();
+ scene->_actor1.setup(2456, 3, 3);
+ scene->_actor1.setPosition(Common::Point(162, 165));
+ scene->_actor1.setDetails(2455, 15, 1, -1, 2, NULL);
+ scene->_sceneMode = 11;
+ scene->setAction(&scene->_sequenceManager, scene, 2457, &R2_GLOBALS._player, &scene->_actor2, NULL);
+ return true;
+ }
+ break;
+ case R2_50:
+ if (R2_INVENTORY.getObjectScene(49) != 2455) {
+ R2_GLOBALS._player.disableControl();
+ scene->_actor1.postInit();
+ scene->_actor1.setup(2456, 3, 3);
+ scene->_actor1.setPosition(Common::Point(162, 165));
+ scene->_actor1.setDetails(2455, 15, 1, -1, 2, NULL);
+ scene->_sceneMode = 12;
+ scene->setAction(&scene->_sequenceManager, scene, 2457, &R2_GLOBALS._player, &scene->_actor2, NULL);
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+
+ return SceneActor::startAction(action, event);
+}
+
+bool Scene2455::Actor3::startAction(CursorType action, Event &event) {
+ Scene2455 *scene = (Scene2455 *)R2_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_USE) {
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2459;
+ scene->setAction(&scene->_sequenceManager, scene, 2459, &R2_GLOBALS._player, &scene->_actor3, NULL);
+ return true;
+ }
+
+ return SceneActor::startAction(action, event);
+}
+
+void Scene2455::Exit1::changeScene() {
+ Scene2455 *scene = (Scene2455 *)R2_GLOBALS._sceneManager._scene;
+
+ _enabled = false;
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2461;
+ scene->setAction(&scene->_sequenceManager, scene, 2461, &R2_GLOBALS._player, NULL);
+}
+
+void Scene2455::postInit(SceneObjectList *OwnerList) {
+ loadScene(2455);
+ SceneExt::postInit();
+
+ if (R2_GLOBALS._sceneManager._previousScene == -1) {
+ R2_INVENTORY.setObjectScene(29, 2);
+ R2_INVENTORY.setObjectScene(50, 2);
+ }
+
+ R2_GLOBALS._sound1.play(200);
+ _exit1.setDetails(Rect(0, 0, 320, 15), EXITCURSOR_N, 2425);
+
+ if (R2_INVENTORY.getObjectScene(29) == 2455) {
+ if ((R2_INVENTORY.getObjectScene(50) == 2455) || (R2_INVENTORY.getObjectScene(49) == 2455)) {
+ _actor1.postInit();
+ _actor1.setup(2456, 3, 3);
+ _actor1.setPosition(Common::Point(162, 165));
+ _actor1.setDetails(2455, 15, 1, -1, 1, NULL);
+ }
+ } else {
+ _actor3.postInit();
+ _actor3.setup(2456, 3, 1);
+ _actor3.setPosition(Common::Point(176, 165));
+ _actor3.setDetails(2455, 16, 1, -1, 1, NULL);
+ }
+
+ _actor2.postInit();
+ if (R2_INVENTORY.getObjectScene(29) == 2455) {
+ _actor2.setup(2456, 3, 2);
+ _actor2.setDetails(2455, 9, 1, -1, 1, NULL);
+ } else {
+ if ((R2_INVENTORY.getObjectScene(50) != 2455) && (R2_INVENTORY.getObjectScene(49) != 2455))
+ _actor2.setup(2455, 1, 1);
+ else
+ _actor2.setup(2456, 1, 1);
+ _actor2.setDetails(2455, 3, 1, -1, 1, NULL);
+ }
+ _actor2.setPosition(Common::Point(162, 165));
+ _actor2.fixPriority(20);
+ if (R2_INVENTORY.getObjectScene(29) != 2455)
+ _actor2.animate(ANIM_MODE_2, NULL);
+
+ R2_GLOBALS._player.postInit();
+ _item1.setDetails(Rect(0, 0, 320, 200), 2455, 0, 1, -1, 1, NULL);
+ R2_GLOBALS._player.disableControl();
+
+ if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2425) {
+ _sceneMode = 2460;
+ setAction(&_sequenceManager, this, 2460, &R2_GLOBALS._player, NULL);
+ } else {
+ R2_GLOBALS._player.setup(2455, 2, 9);
+ R2_GLOBALS._player.setPosition(Common::Point(118, 165));
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+ }
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2455;
+}
+
+void Scene2455::remove() {
+ R2_GLOBALS._sound1.fadeOut2(NULL);
+ SceneExt::remove();
+}
+
+void Scene2455::signal() {
+ switch (_sceneMode) {
+ case 10:
+ // No break on purpose
+ case 2461:
+ g_globals->_sceneManager.changeScene(2425);
+ break;
+ case 11:
+ R2_INVENTORY.setObjectScene(49, 2455);
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+ break;
+ case 12:
+ R2_INVENTORY.setObjectScene(50, 2455);
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+ break;
+ case 2458:
+ R2_INVENTORY.setObjectScene(29, 2455);
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+ break;
+ case 2459:
+ _actor3.remove();
+ R2_INVENTORY.setObjectScene(31, 2);
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+ break;
+ default:
+ R2_GLOBALS._player.enableControl(CURSOR_USE);
+ R2_GLOBALS._player._canWalk = false;
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 2500 - Maze: Large Cave
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene2500::Exit1::changeScene() {
+ Scene2500 *scene = (Scene2500 *)R2_GLOBALS._sceneManager._scene;
+
+ _enabled = false;
+ R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+ R2_GLOBALS._player.disableControl();
+ scene->_sceneMode = 11;
+
+ Common::Point pt(20, 105);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, scene);
+}
+
+void Scene2500::postInit(SceneObjectList *OwnerList) {
+ loadScene(2500);
+ SceneExt::postInit();
+
+ if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 3100)
+ R2_GLOBALS._v58CE2 = 0;
+
+ _stripManager.addSpeaker(&_quinnSpeaker);
+ _stripManager.addSpeaker(&_seekerSpeaker);
+ _stripManager.addSpeaker(&_mirandaSpeaker);
+ _stripManager.addSpeaker(&_webbsterSpeaker);
+
+ if (R2_GLOBALS._sceneManager._previousScene == -1)
+ R2_GLOBALS._sceneManager._previousScene = 2000;
+
+ _exit1.setDetails(Rect(30, 50, 85, 105), EXITCURSOR_W, 2000);
+ _exit1.setDest(Common::Point(84, 104));
+ R2_GLOBALS._player.postInit();
+ R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ R2_GLOBALS._player.setVisage(11);
+ R2_GLOBALS._player._moveDiff = Common::Point(2, 1);
+ } else {
+ R2_GLOBALS._player.setVisage(21);
+ R2_GLOBALS._player._moveDiff = Common::Point(3, 2);
+ }
+
+ if (R2_GLOBALS._player._characterScene[1] == R2_GLOBALS._player._characterScene[2]) {
+ _actor1.postInit();
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ _actor1.setup(21, 3, 1);
+ _actor1.setDetails(9002, 1, -1, -1, 1, NULL);
+ } else {
+ _actor1.setup(2008, 3, 1);
+ _actor1.changeZoom(50);
+ _actor1.setDetails(9001, 0, -1, -1, 1, NULL);
+ }
+ _actor1.setPosition(Common::Point(141, 94));
+ }
+
+ _item1.setDetails(Rect(0, 0, 320, 200), 2430, 0, -1, -1, 1, NULL);
+ R2_GLOBALS._player.disableControl();
+
+ if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2000) {
+ _sceneMode = 10;
+ R2_GLOBALS._player.setPosition(Common::Point(20, 105));
+ Common::Point pt(95, 105);
+ NpcMover *mover = new NpcMover();
+ R2_GLOBALS._player.addMover(mover, &pt, this);
+ } else if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 3100) {
+ _sceneMode = 2500;
+ _actor2.postInit();
+ _actor3.postInit();
+ setAction(&_sequenceManager, this, 2500, &R2_GLOBALS._player, &_actor2, &_actor3, NULL);
+ } else {
+ R2_GLOBALS._player.setPosition(Common::Point(160, 150));
+ R2_GLOBALS._player.setStrip(3);
+ R2_GLOBALS._player.enableControl();
+ }
+ R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2500;
+}
+
+void Scene2500::signal() {
+ switch (_sceneMode) {
+ case 11:
+ g_globals->_sceneManager.changeScene(2000);
+ break;
+ case 20:
+ R2_GLOBALS._player.disableControl();
+ _sceneMode = 2501;
+ setAction(&_sequenceManager, this, 2501, &R2_GLOBALS._player, &_actor2, &_actor3, NULL);
+ break;
+ case 2500:
+ _sceneMode = 20;
+ R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
+ _stripManager.start(900, this);
+ break;
+ case 2501:
+ g_globals->_sceneManager.changeScene(1000);
+ break;
+ default:
+ R2_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+} // End of namespace Ringworld2
+} // End of namespace TsAGE
diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.h b/engines/tsage/ringworld2/ringworld2_scenes2.h
new file mode 100644
index 0000000000..82898a45dd
--- /dev/null
+++ b/engines/tsage/ringworld2/ringworld2_scenes2.h
@@ -0,0 +1,389 @@
+/* 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_RINGWORLD2_SCENES2_H
+#define TSAGE_RINGWORLD2_SCENES2_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/sound.h"
+#include "tsage/ringworld2/ringworld2_logic.h"
+#include "tsage/ringworld2/ringworld2_speakers.h"
+
+namespace TsAGE {
+
+namespace Ringworld2 {
+
+using namespace TsAGE;
+
+class Scene2000 : public SceneExt {
+ class Action1 : public ActionExt {
+ public:
+ virtual void signal();
+ };
+
+ class Exit1 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+ class Exit2 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+ class Exit3 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+ class Exit4 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+ class Exit5 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+public:
+ bool _exitingFlag;
+ int _mazePlayerMode;
+
+ NamedHotspot _item1;
+ SceneActor _object1;
+ SceneActor _objList1[11];
+ Exit1 _exit1;
+ Exit2 _exit2;
+ Exit3 _exit3;
+ Exit4 _exit4;
+ Exit5 _exit5;
+ Action1 _action1, _action2, _action3, _action4, _action5;
+ SequenceManager _sequenceManager;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void synchronize(Serializer &s);
+
+ void initExits();
+ void initPlayer();
+};
+
+class Scene2350 : public SceneExt {
+ class Actor2 : public SceneActor {
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Actor3 : public SceneActor {
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class ExitUp : public SceneExit {
+ virtual void changeScene();
+ };
+ class ExitWest : public SceneExit {
+ virtual void changeScene();
+ };
+public:
+
+ SpeakerQuinn2350 _quinnSpeaker;
+ SpeakerPharisha2350 _pharishaSpeaker;
+ NamedHotspot _item1;
+ SceneActor _actor1;
+ Actor2 _actor2;
+ Actor3 _actor3;
+ Actor3 _actor4;
+ ExitUp _exitUp;
+ ExitWest _exitWest;
+ SequenceManager _sequenceManager;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+ virtual void process(Event &event);
+};
+
+class Scene2400 : public SceneExt {
+ class Exit1 : public SceneExit {
+ virtual void changeScene();
+ };
+ class Exit2 : public SceneExit {
+ virtual void changeScene();
+ };
+public:
+ Exit1 _exit1;
+ Exit2 _exit2;
+ SequenceManager _sequenceManager;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+};
+
+class Scene2425 : public SceneExt {
+ 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 Item3 : public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item4 : public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ class Actor1 : public SceneActor {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class Actor2 : public SceneActor {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+
+ class Exit1 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+public:
+ Item1 _item1;
+ Item2 _item2;
+ Item3 _item3;
+ Item4 _item4;
+ Actor1 _actor1;
+ Actor2 _actor2;
+ Actor2 _actor3;
+ Exit1 _exit1;
+ SequenceManager _sequenceManager;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+};
+
+class Scene2430 : public SceneExt {
+ class Actor1 : public SceneActor {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class Actor2 : public SceneActor {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class Actor3 : public SceneActor {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+
+ class Exit1 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+public:
+ NamedHotspot _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;
+ Actor1 _actor1;
+ Actor2 _actor2;
+ Actor3 _actor3;
+ Exit1 _exit1;
+ SequenceManager _sequenceManager;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+};
+
+class Scene2435 : public SceneExt {
+ class Actor1 : public SceneActor {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class Actor2 : public SceneActor {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+
+ class Exit1 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+public:
+ SpeakerQuinn2435 _quinnSpeaker;
+ SpeakerSeeker2435 _seekerSpeaker;
+ SpeakerPharisha2435 _pharishaSpeaker;
+ NamedHotspot _item1;
+ NamedHotspot _item2;
+ NamedHotspot _item3;
+ Actor1 _actor1;
+ Actor2 _actor2;
+ Exit1 _exit1;
+ SequenceManager _sequenceManager;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+};
+
+class Scene2440 : public SceneExt {
+ class Actor1 : public SceneActor {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class Actor2 : public SceneActor {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+
+ class Exit1 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+public:
+ NamedHotspot _item1;
+ NamedHotspot _item2;
+ NamedHotspot _item3;
+ NamedHotspot _item4;
+ NamedHotspot _item5;
+ NamedHotspot _item6;
+ NamedHotspot _item7;
+ Actor1 _actor1;
+ Actor2 _actor2;
+ Exit1 _exit1;
+ SequenceManager _sequenceManager;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+};
+
+class Scene2445 : public SceneExt {
+public:
+ SequenceManager _sequenceManager;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+};
+
+class Scene2450 : public SceneExt {
+ class Actor2 : public SceneActor {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class Actor3 : public SceneActor {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+
+ class Exit1 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+public:
+ SpeakerQuinn2450 _quinnSpeaker;
+ SpeakerSeeker2450 _seekerSpeaker;
+ SpeakerCaretaker2450 _caretakerSpeaker;
+ NamedHotspot _item1;
+ NamedHotspot _item2;
+ NamedHotspot _item3;
+ SceneActor _actor1;
+ Actor2 _actor2;
+ Actor3 _actor3;
+ Exit1 _exit1;
+ SequenceManager _sequenceManager;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+};
+
+class Scene2455 : public SceneExt {
+ class Actor1 : public SceneActor {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class Actor2 : public SceneActor {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class Actor3 : public SceneActor {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+
+ class Exit1 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+public:
+ NamedHotspot _item1;
+ Actor1 _actor1;
+ Actor2 _actor2;
+ Actor3 _actor3;
+ Exit1 _exit1;
+ SequenceManager _sequenceManager;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+};
+
+class Scene2500 : public SceneExt {
+ class Exit1 : public SceneExit {
+ public:
+ virtual void changeScene();
+ };
+public:
+ SpeakerQuinn2500 _quinnSpeaker;
+ SpeakerSeeker2500 _seekerSpeaker;
+ SpeakerMiranda2500 _mirandaSpeaker;
+ SpeakerWebbster2500 _webbsterSpeaker;
+ NamedHotspot _item1;
+ SceneActor _actor1;
+ SceneActor _actor2;
+ SceneActor _actor3;
+ Exit1 _exit1;
+ SequenceManager _sequenceManager;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+};
+
+} // End of namespace Ringworld2
+} // End of namespace TsAGE
+
+#endif
diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp
new file mode 100644
index 0000000000..8c8bd7171a
--- /dev/null
+++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp
@@ -0,0 +1,738 @@
+/* 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/ringworld2/ringworld2_speakers.h"
+#include "tsage/scenes.h"
+#include "tsage/tsage.h"
+#include "tsage/graphics.h"
+#include "tsage/staticres.h"
+#include "tsage/ringworld2/ringworld2_scenes0.h"
+#include "tsage/ringworld2/ringworld2_scenes2.h"
+
+namespace TsAGE {
+
+namespace Ringworld2 {
+
+VisualSpeaker::VisualSpeaker(): Speaker() {
+ _delayAmount = 0;
+ _frameNumber = R2_GLOBALS._events.getFrameNumber();
+ _color1 = 8;
+ _color2 = 0;
+ _displayMode = 0;
+ _fieldF6 = 0;
+}
+
+void VisualSpeaker::remove() {
+ if (_object2) {
+ if (_fieldF8) {
+ _fieldF8 = 0;
+ _object1.setStrip(_object1._strip - 1);
+ _object1.setFrame(_object1.getFrameCount());
+ _object1.animate(ANIM_MODE_6, (_fieldF6 == 0xff) ? this : NULL);
+ } else {
+ _object1.animate(ANIM_MODE_6, (_fieldF6 == 0xff) ? this : NULL);
+ }
+ }
+
+ Speaker::remove();
+}
+
+void VisualSpeaker::synchronize(Serializer &s) {
+ Speaker::synchronize(s);
+
+ SYNC_POINTER(_object2);
+ s.syncAsSint16LE(_fieldF6);
+ s.syncAsSint16LE(_fieldF8);
+ s.syncAsSint16LE(_displayMode);
+ s.syncAsSint16LE(_soundId);
+ s.syncAsSint16LE(_delayAmount);
+ s.syncAsByte(_removeObject);
+ s.syncAsSint32LE(_frameNumber);
+ s.syncAsSint16LE(_numFrames);
+}
+
+void VisualSpeaker::setText(const Common::String &msg) {
+ _sceneText.remove();
+
+ // Position the text depending on the specified display mode
+ switch (_displayMode) {
+ case 2:
+ _textPos = Common::Point(60, 20);
+ break;
+ case 3:
+ _textPos = Common::Point(110, 20);
+ break;
+ case 4:
+ _textPos = Common::Point(10, 100);
+ break;
+ case 5:
+ _textPos = Common::Point(60, 100);
+ break;
+ case 6:
+ _textPos = Common::Point(110, 100);
+ break;
+ case 7:
+ _textPos = Common::Point(170, 20);
+ break;
+ case 8:
+ _textPos = Common::Point(170, 100);
+ break;
+ case 9:
+ _textPos = Common::Point(330, 20);
+ break;
+ default:
+ _textPos = Common::Point(10, 20);
+ break;
+ }
+
+ // Check if the message starts with a '!'. If so, it indicates a speech resource Id to be played,
+ // in which case extract the resource number from the message.
+ _soundId = 0;
+ Common::String s = msg;
+ if (s.hasPrefix("!")) {
+ s.deleteChar(0);
+ _soundId = atoi(s.c_str());
+
+ while (!s.empty() && (*s.c_str() >= '0' && *s.c_str() <= '9'))
+ s.deleteChar(0);
+ }
+
+ // Set up the text details
+ _sceneText._color1 = _color1;
+ _sceneText._color2 = _color2;
+ _sceneText._color3 = _color3;
+ _sceneText._width = _textWidth;
+ _sceneText._fontNumber = _fontNumber;
+ _sceneText._textMode = _textMode;
+ _sceneText.setup(s);
+
+ //_sceneText.clone();
+
+ _sceneText.setPosition(_textPos);
+ _sceneText.setPriority(0x100);
+
+ // If subtitles are turned off, don't show the text
+ if (!(R2_GLOBALS._speechSubtitles & SPEECH_TEXT)) {
+ _sceneText.hide();
+ }
+
+ // Figure out the text delay if subtitles are turned on, or there's no speech resource specified
+ if ((R2_GLOBALS._speechSubtitles & SPEECH_TEXT) || !_soundId) {
+ const char *msgP = s.c_str();
+ int numWords = 0;
+ while (*msgP != '\0') {
+ if (*msgP++ == ' ')
+ ++numWords;
+ }
+
+ if (!numWords && !s.empty())
+ ++numWords;
+
+ _numFrames = numWords * 30 + 120;
+ setFrame(_numFrames);
+ } else {
+ _numFrames = 1;
+ }
+
+ // If the text is empty, no delay is needed
+ if (s.empty())
+ _numFrames = 0;
+
+
+ if (_fieldF6) {
+ if ((R2_GLOBALS._speechSubtitles & SPEECH_TEXT) || !_soundId)
+ _sceneText.hide();
+ } else {
+ if ((R2_GLOBALS._speechSubtitles & SPEECH_VOICE) && _soundId) {
+ if (!R2_GLOBALS._playStream.play(_soundId, NULL))
+ _sceneText.show();
+ }
+ }
+}
+
+void VisualSpeaker::proc16() {
+ R2_GLOBALS._playStream.stop();
+ _fieldF6 = 0;
+ _object1.remove();
+
+ assert(_object2);
+ _object2->show();
+ _object2 = NULL;
+ _fieldF8 = 0;
+}
+
+void VisualSpeaker::setFrame(int numFrames) {
+ _delayAmount = numFrames;
+ _frameNumber = R2_GLOBALS._events.getFrameNumber();
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerMiranda300::SpeakerMiranda300(): VisualSpeaker() {
+ _speakerName = "MIRANDA";
+ _color1 = 154;
+ _color2 = 0;
+ _fieldF6 = 0;
+ _textWidth = 300;
+ _hideObjects = false;
+ _object2 = NULL;
+ _displayMode = 1;
+ _numFrames = 0;
+}
+
+void SpeakerMiranda300::proc15() {
+ int v = _fieldF6;
+
+ if (!_object2) {
+ if (R2_GLOBALS._player._characterIndex == 3) {
+ _object2 = &R2_GLOBALS._player;
+ } else {
+ Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene;
+ _object2 = &scene->_miranda;
+ }
+
+ _object2->hide();
+ _object1.postInit();
+ _object1.setPosition(_object2->_position);
+
+ if (_object2->_mover)
+ _object2->addMover(NULL);
+ }
+
+ if (v == 0) {
+ _object1.animate(ANIM_MODE_2, NULL);
+ } else if (v == 100) {
+ _numFrames = 0;
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+
+ _object1.setStrip(_object1._strip - 1);
+ _object1.setFrame(_object1.getFrameCount());
+ _object1.animate(ANIM_MODE_6, this);
+ } else {
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+
+ if (v == 4) {
+ _object1.setup(304, 5, 1);
+ } else {
+ _object1.setup(305, v * 2 - 1, 1);
+ }
+ _object1.animate(ANIM_MODE_5, this);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerSeeker300::SpeakerSeeker300(): VisualSpeaker() {
+ _speakerName = "SEEKER";
+ _color1 = 35;
+ _color2 = 0;
+ _fieldF6 = 0;
+ _textWidth = 300;
+ _hideObjects = false;
+ _object2 = NULL;
+ _displayMode = 1;
+ _numFrames = 0;
+}
+
+void SpeakerSeeker300::proc15() {
+ int v = _fieldF6;
+
+ if (!_object2) {
+ if (R2_GLOBALS._player._characterIndex == 3) {
+ _object2 = &R2_GLOBALS._player;
+ } else {
+ Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene;
+ _object2 = &scene->_seeker;
+ }
+
+ _object2->hide();
+ _object1.postInit();
+ _object1.fixPriority(140);
+ _object1.setPosition(_object2->_position);
+
+ if (_object2->_mover)
+ _object2->addMover(NULL);
+ }
+
+ if (v == 0) {
+ _object1.animate(ANIM_MODE_2, NULL);
+ } else if (v == 100) {
+ _numFrames = 0;
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+
+ _object1.setStrip(_object1._strip - 1);
+ _object1.setFrame(_object1.getFrameCount());
+ _object1.animate(ANIM_MODE_6, this);
+ } else {
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+ _object1.setup(306, v * 2 - 1, 1);
+ _object1.animate(ANIM_MODE_5, this);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerSeekerL::SpeakerSeekerL(): VisualSpeaker() {
+ _speakerName = "SEEKERL";
+ _color1 = 35;
+ _color2 = 0;
+ _fieldF6 = 0;
+ _textWidth = 300;
+ _hideObjects = false;
+ _object2 = NULL;
+ _displayMode = 1;
+ _numFrames = 0;
+ _fontNumber = 10;
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerQuinnL::SpeakerQuinnL(): VisualSpeaker() {
+ _speakerName = "QUINNL";
+ _color1 = 35;
+ _color2 = 0;
+ _fieldF6 = 0;
+ _textWidth = 300;
+ _hideObjects = false;
+ _object2 = NULL;
+ _displayMode = 1;
+ _numFrames = 0;
+ _fontNumber = 10;
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerQuinn300::SpeakerQuinn300(): VisualSpeaker() {
+ _speakerName = "QUINN";
+ _color1 = 60;
+ _color2 = 0;
+ _fieldF6 = 0;
+ _textWidth = 300;
+ _hideObjects = false;
+ _object2 = NULL;
+ _displayMode = 1;
+ _numFrames = 0;
+}
+
+void SpeakerQuinn300::proc15() {
+ int v = _fieldF6;
+
+ if (!_object2) {
+ if (R2_GLOBALS._player._characterIndex == 3) {
+ _object2 = &R2_GLOBALS._player;
+ } else {
+ Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene;
+ _object2 = &scene->_quinn;
+ }
+
+ _object2->hide();
+ _object1.postInit();
+ _object1.setPosition(_object2->_position);
+
+ if (_object2->_mover)
+ _object2->addMover(NULL);
+ }
+
+ if (v == 0) {
+ _object1.animate(ANIM_MODE_2, NULL);
+ } else if (v == 100) {
+ _numFrames = 0;
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+
+ _object1.setStrip(_object1._strip - 1);
+ _object1.setFrame(_object1.getFrameCount());
+ _object1.animate(ANIM_MODE_6, this);
+ } else {
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+
+ switch (_object2->_visage) {
+ case 10:
+ _object1.setup((v - 1) / 4 + 4010, ((v - ((v - 1) / 4 * 4) - 1) % 8) * 2 + 1, 1);
+ break;
+ case 302:
+ _object1.setup(308, (v - 1) % 8 + 1, 1);
+ break;
+ case 308:
+ _object1.setup(308, 5, 1);
+ break;
+ }
+
+ _object1.animate(ANIM_MODE_5, this);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerTeal300::SpeakerTeal300(): VisualSpeaker() {
+ _speakerName = "TEAL";
+ _color1 = 22;
+ _color2 = 0;
+ _fieldF6 = 0;
+ _textWidth = 300;
+ _hideObjects = false;
+ _object2 = NULL;
+ _displayMode = 1;
+ _numFrames = 0;
+}
+
+void SpeakerTeal300::proc15() {
+ int v = _fieldF6;
+
+ if (!_object2) {
+ Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene;
+ _object2 = &scene->_teal;
+ _object2->hide();
+
+ _object1.postInit();
+ _object1.setPosition(_object2->_position);
+
+ if (_object2->_mover)
+ _object2->addMover(NULL);
+ }
+
+ if (v == 0) {
+ _object1.animate(ANIM_MODE_2, NULL);
+ } else {
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+ _object1.setup(303, 1, 1);
+ _object1.animate(ANIM_MODE_5, this);
+ }
+}
+
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerSoldier300::SpeakerSoldier300(): VisualSpeaker() {
+ _speakerName = "SOLDIER";
+ _color1 = 60;
+ _color2 = 0;
+ _fieldF6 = 0;
+ _textWidth = 300;
+ _hideObjects = false;
+ _object2 = NULL;
+ _displayMode = 1;
+ _numFrames = 0;
+}
+
+void SpeakerSoldier300::proc15() {
+ int v = _fieldF6;
+
+ if (!_object2) {
+ Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene;
+ _object2 = &scene->_teal;
+ _object2->hide();
+
+ _object1.postInit();
+ _object1.setPosition(_object2->_position);
+
+ if (_object2->_mover)
+ _object2->addMover(NULL);
+ }
+
+ if (v == 0) {
+ _object1.animate(ANIM_MODE_2, NULL);
+ } else {
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+ _object1.setup(303, 3, 1);
+ _object1.animate(ANIM_MODE_5, this);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerQuinn2350::SpeakerQuinn2350(): VisualSpeaker() {
+ _speakerName = "QUINN";
+ _color1 = 60;
+ _color2 = 0;
+ _fieldF6 = 0;
+ _textWidth = 300;
+ _hideObjects = false;
+ _object2 = NULL;
+ _displayMode = 1;
+ _numFrames = 0;
+}
+
+SpeakerPharisha2350::SpeakerPharisha2350(): VisualSpeaker() {
+ _speakerName = "PHARISHA";
+ _color1 = 151;
+ _color2 = 0;
+ _fieldF6 = 0;
+ _textWidth = 300;
+ _hideObjects = false;
+ _object2 = NULL;
+ _displayMode = 1;
+ _numFrames = 0;
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerQuinn2435::SpeakerQuinn2435() {
+ _speakerName = "QUINN";
+ _color1 = 60;
+ _color2 = 0;
+ _fieldF6 = 0;
+ _textWidth = 300;
+ _hideObjects = false;
+ _object2 = NULL;
+ _displayMode = 1;
+ _numFrames = 0;
+}
+void SpeakerQuinn2435::proc15() {
+ int v = _fieldF6;
+
+ if (!_object2) {
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ _object2 = &R2_GLOBALS._player;
+ } else {
+ Scene2435 *scene = (Scene2435 *)R2_GLOBALS._sceneManager._scene;
+ _object2 = &scene->_actor1;
+ }
+
+ _object2->hide();
+ _object1.postInit();
+ _object1.setPosition(_object2->_position);
+ }
+
+ if (v == 0) {
+ _object1.animate(ANIM_MODE_2, NULL);
+ } else {
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+ _object2->setStrip(7);
+ _object1.setup(2020, 5, 1);
+ _object1.animate(ANIM_MODE_5, this);
+ }
+}
+
+SpeakerSeeker2435::SpeakerSeeker2435() {
+ _speakerName = "SEEKER";
+ _color1 = 35;
+ _color2 = 0;
+ _fieldF6 = 0;
+ _textWidth = 300;
+ _hideObjects = false;
+ _object2 = NULL;
+ _displayMode = 1;
+ _numFrames = 0;
+}
+
+void SpeakerSeeker2435::proc15() {
+ int v = _fieldF6;
+
+ if (!_object2) {
+ if (R2_GLOBALS._player._characterIndex == 2) {
+ _object2 = &R2_GLOBALS._player;
+ } else {
+ Scene2435 *scene = (Scene2435 *)R2_GLOBALS._sceneManager._scene;
+ _object2 = &scene->_actor1;
+ }
+
+ _object2->hide();
+ _object1.postInit();
+ _object1.setPosition(_object2->_position);
+ }
+
+ if (v == 0) {
+ _object1.animate(ANIM_MODE_2, NULL);
+ } else {
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+ _object2->setStrip(7);
+ _object1.setup(4099, 1, 1);
+ _object1.animate(ANIM_MODE_5, this);
+ }
+}
+
+SpeakerPharisha2435::SpeakerPharisha2435() {
+ _speakerName = "PHARISHA";
+ _color1 = 151;
+ _color2 = 0;
+ _fieldF6 = 0;
+ _textWidth = 300;
+ _hideObjects = false;
+ _object2 = NULL;
+ _displayMode = 1;
+ _numFrames = 0;
+}
+
+void SpeakerPharisha2435::proc15() {
+ int v = _fieldF6;
+ Scene2435 *scene = (Scene2435 *)R2_GLOBALS._sceneManager._scene;
+
+ if (!_object2) {
+ _object2 = &scene->_actor2;
+ _object2->hide();
+ _object1.postInit();
+ _object1.setPosition(_object2->_position);
+ }
+
+ if (v == 0) {
+ _object1.animate(ANIM_MODE_2, NULL);
+ } else {
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+ _object1.setup(4098, 5, 1);
+ _object1.animate(ANIM_MODE_5, this);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerQuinn2450::SpeakerQuinn2450() {
+ _speakerName = "QUINN";
+ _color1 = 60;
+ _color2 = 0;
+ _fieldF6 = 0;
+ _textWidth = 300;
+ _hideObjects = false;
+ _object2 = NULL;
+ _displayMode = 1;
+ _numFrames = 0;
+}
+void SpeakerQuinn2450::proc15() {
+ int v = _fieldF6;
+
+ if (!_object2) {
+ if (R2_GLOBALS._player._characterIndex == 1) {
+ _object2 = &R2_GLOBALS._player;
+ } else {
+ Scene2435 *scene = (Scene2435 *)R2_GLOBALS._sceneManager._scene;
+ _object2 = &scene->_actor1;
+ }
+
+ _object2->hide();
+ _object1.postInit();
+ _object1.setPosition(_object2->_position);
+ }
+
+ if (v == 0) {
+ _object1.animate(ANIM_MODE_2, NULL);
+ } else {
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+ if (R2_GLOBALS.getFlag(61))
+ _object1.setup(2020, 3, 1);
+ else
+ _object1.setup(2020, 1, 1);
+ _object1.animate(ANIM_MODE_5, this);
+ }
+}
+
+SpeakerSeeker2450::SpeakerSeeker2450() {
+ _speakerName = "SEEKER";
+ _color1 = 35;
+ _color2 = 0;
+ _fieldF6 = 0;
+ _textWidth = 300;
+ _hideObjects = false;
+ _object2 = NULL;
+ _displayMode = 1;
+ _numFrames = 0;
+}
+
+void SpeakerSeeker2450::proc15() {
+ int v = _fieldF6;
+
+ if (!_object2) {
+ if (R2_GLOBALS._player._characterIndex == 2) {
+ _object2 = &R2_GLOBALS._player;
+ } else {
+ Scene2450 *scene = (Scene2450 *)R2_GLOBALS._sceneManager._scene;
+ _object2 = &scene->_actor1;
+ }
+
+ _object2->hide();
+ _object1.postInit();
+ _object1.setPosition(_object2->_position);
+ }
+
+ if (v == 0) {
+ _object1.animate(ANIM_MODE_2, NULL);
+ } else {
+ ((SceneItem *)_action)->_sceneRegionId = 0;
+ _object1.setup(4099, 3, 1);
+ _object1.animate(ANIM_MODE_5, this);
+ }
+}
+
+SpeakerCaretaker2450::SpeakerCaretaker2450() {
+ _speakerName = "CARETAKER";
+ _color1 = 43;
+ _color2 = 0;
+ _fieldF6 = 0;
+ _textWidth = 300;
+ _hideObjects = false;
+ _object2 = NULL;
+ _displayMode = 1;
+ _numFrames = 0;
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerQuinn2500::SpeakerQuinn2500() {
+ _speakerName = "QUINN";
+ _color1 = 60;
+ _color2 = 0;
+ _fieldF6 = 0;
+ _textWidth = 300;
+ _hideObjects = false;
+ _object2 = NULL;
+ _displayMode = 1;
+ _numFrames = 0;
+}
+
+SpeakerSeeker2500::SpeakerSeeker2500() {
+ _speakerName = "SEEKER";
+ _color1 = 35;
+ _color2 = 0;
+ _fieldF6 = 0;
+ _textWidth = 300;
+ _hideObjects = false;
+ _object2 = NULL;
+ _displayMode = 1;
+ _numFrames = 0;
+}
+
+SpeakerMiranda2500::SpeakerMiranda2500() {
+ // Not in uppercase in the original
+ _speakerName = "Miranda";
+ _color1 = 154;
+ _color2 = 0;
+ _fieldF6 = 0;
+ _textWidth = 300;
+ _hideObjects = false;
+ _object2 = NULL;
+ _displayMode = 1;
+ _numFrames = 0;
+}
+
+SpeakerWebbster2500::SpeakerWebbster2500() {
+ // Not in uppercase in the original
+ _speakerName = "Webbster";
+ _color1 = 27;
+ _color2 = 0;
+ _fieldF6 = 0;
+ _textWidth = 300;
+ _hideObjects = false;
+ _object2 = NULL;
+ _displayMode = 1;
+ _numFrames = 0;
+}
+
+} // End of namespace Ringworld2
+} // End of namespace TsAGE
diff --git a/engines/tsage/ringworld2/ringworld2_speakers.h b/engines/tsage/ringworld2/ringworld2_speakers.h
new file mode 100644
index 0000000000..e6a805f31b
--- /dev/null
+++ b/engines/tsage/ringworld2/ringworld2_speakers.h
@@ -0,0 +1,209 @@
+/* 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_RINGWORLD2_SPEAKERS_H
+#define TSAGE_RINGWORLD2_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/ringworld2/ringworld2_logic.h"
+
+namespace TsAGE {
+
+namespace Ringworld2 {
+
+using namespace TsAGE;
+
+class VisualSpeaker : public Speaker {
+public:
+ SceneActor _object1;
+ SceneObject *_object2;
+ int _fieldF6, _fieldF8;
+ int _displayMode;
+ int _soundId;
+ int _delayAmount;
+ bool _removeObject;
+ int _frameNumber;
+ int _numFrames;
+private:
+ void setFrame(int numFrames);
+public:
+ VisualSpeaker();
+
+ virtual Common::String getClassName() { return "VisualSpeaker"; }
+ virtual void synchronize(Serializer &s);
+ virtual void remove();
+ virtual void setText(const Common::String &msg);
+ virtual void proc15() {}
+ virtual void proc16();
+};
+
+class SpeakerMiranda300 : public VisualSpeaker {
+public:
+ SpeakerMiranda300();
+
+ virtual Common::String getClassName() { return "SpeakerMiranda300"; }
+ virtual void proc15();
+};
+
+class SpeakerSeeker300 : public VisualSpeaker {
+public:
+ SpeakerSeeker300();
+
+ virtual Common::String getClassName() { return "SpeakerSeeker300"; }
+ virtual void proc15();
+};
+
+class SpeakerSeekerL : public VisualSpeaker {
+public:
+ SpeakerSeekerL();
+
+ virtual Common::String getClassName() { return "SpeakerSeekerL"; }
+};
+
+class SpeakerQuinnL : public VisualSpeaker {
+public:
+ SpeakerQuinnL();
+
+ virtual Common::String getClassName() { return "SpeakerQuinnL"; }
+};
+
+class SpeakerQuinn300 : public VisualSpeaker {
+public:
+ SpeakerQuinn300();
+
+ virtual Common::String getClassName() { return "SpeakerQuinn300"; }
+ virtual void proc15();
+};
+
+class SpeakerTeal300 : public VisualSpeaker {
+public:
+ SpeakerTeal300();
+
+ virtual Common::String getClassName() { return "SpeakerTeal300"; }
+ virtual void proc15();
+};
+
+class SpeakerSoldier300 : public VisualSpeaker {
+public:
+ SpeakerSoldier300();
+
+ virtual Common::String getClassName() { return "SpeakerSoldier300"; }
+ virtual void proc15();
+};
+
+class SpeakerQuinn2350 : public VisualSpeaker {
+public:
+ SpeakerQuinn2350();
+
+ virtual Common::String getClassName() { return "SpeakerQuinn2350"; }
+};
+
+class SpeakerPharisha2350 : public VisualSpeaker {
+public:
+ SpeakerPharisha2350();
+
+ virtual Common::String getClassName() { return "SpeakerPharisha2350"; }
+};
+
+class SpeakerQuinn2435 : public VisualSpeaker {
+public:
+ SpeakerQuinn2435();
+
+ virtual Common::String getClassName() { return "SpeakerQuinn2435"; }
+ virtual void proc15();
+};
+
+class SpeakerSeeker2435 : public VisualSpeaker {
+public:
+ SpeakerSeeker2435();
+
+ virtual Common::String getClassName() { return "SpeakerSeeker2435"; }
+ virtual void proc15();
+};
+
+class SpeakerPharisha2435 : public VisualSpeaker {
+public:
+ SpeakerPharisha2435();
+
+ virtual Common::String getClassName() { return "SpeakerPharisha2435"; }
+ virtual void proc15();
+};
+
+class SpeakerQuinn2450 : public VisualSpeaker {
+public:
+ SpeakerQuinn2450();
+
+ virtual Common::String getClassName() { return "SpeakerQuinn2450"; }
+ virtual void proc15();
+};
+
+class SpeakerSeeker2450 : public VisualSpeaker {
+public:
+ SpeakerSeeker2450();
+
+ virtual Common::String getClassName() { return "SpeakerSeeker2450"; }
+ virtual void proc15();
+};
+
+class SpeakerCaretaker2450 : public VisualSpeaker {
+public:
+ SpeakerCaretaker2450();
+
+ virtual Common::String getClassName() { return "SpeakerCaretaker2450"; }
+};
+
+class SpeakerQuinn2500 : public VisualSpeaker {
+public:
+ SpeakerQuinn2500();
+
+ virtual Common::String getClassName() { return "SpeakerQuinn2500"; }
+};
+
+class SpeakerSeeker2500 : public VisualSpeaker {
+public:
+ SpeakerSeeker2500();
+
+ virtual Common::String getClassName() { return "SpeakerSeeker2500"; }
+};
+
+class SpeakerMiranda2500 : public VisualSpeaker {
+public:
+ SpeakerMiranda2500();
+
+ virtual Common::String getClassName() { return "SpeakerMiranda2500"; }
+};
+
+class SpeakerWebbster2500 : public VisualSpeaker {
+public:
+ SpeakerWebbster2500();
+
+ virtual Common::String getClassName() { return "SpeakerWebbster2500"; }
+};
+} // End of namespace Ringworld2
+} // End of namespace TsAGE
+
+#endif
diff --git a/engines/tsage/saveload.cpp b/engines/tsage/saveload.cpp
index c261d091dd..e56968acdf 100644
--- a/engines/tsage/saveload.cpp
+++ b/engines/tsage/saveload.cpp
@@ -129,8 +129,12 @@ Common::Error Saver::save(int slot, const Common::String &saveName) {
_macroSaveFlag = true;
_saveSlot = slot;
- // Set up the serializer
+ // Try and create the save file
Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(g_vm->generateSaveName(slot));
+ if (!saveFile)
+ return Common::kCreatingFileFailed;
+
+ // Set up the serializer
Serializer serializer(NULL, saveFile);
serializer.setSaveVersion(TSAGE_SAVEGAME_VERSION);
@@ -177,6 +181,9 @@ Common::Error Saver::restore(int slot) {
// Set up the serializer
Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(g_vm->generateSaveName(slot));
+ if (!saveFile)
+ return Common::kReadingFailed;
+
Serializer serializer(saveFile, NULL);
// Read in the savegame header
@@ -283,6 +290,7 @@ void Saver::writeSavegameHeader(Common::OutSaveFile *out, tSageSavegameHeader &h
::createThumbnail(thumb, (const byte *)s.pixels, SCREEN_WIDTH, SCREEN_HEIGHT, thumbPalette);
Graphics::saveThumbnail(*out, *thumb);
g_globals->_screenSurface.unlockSurface();
+ thumb->free();
delete thumb;
// Write out the save date/time
diff --git a/engines/tsage/saveload.h b/engines/tsage/saveload.h
index 52b23413d4..ff78abf52d 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 7
+#define TSAGE_SAVEGAME_VERSION 9
class SavedObject;
diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp
index baa114218e..6362c63bc3 100644
--- a/engines/tsage/scenes.cpp
+++ b/engines/tsage/scenes.cpp
@@ -259,7 +259,7 @@ Scene::Scene() : _sceneBounds(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT),
_sceneMode = 0;
_activeScreenNumber = 0;
_oldSceneBounds = Rect(4000, 4000, 4100, 4100);
- Common::set_to(&_zoomPercents[0], &_zoomPercents[256], 0);
+ Common::fill(&_zoomPercents[0], &_zoomPercents[256], 0);
}
Scene::~Scene() {
@@ -316,11 +316,39 @@ void Scene::loadScene(int sceneNum) {
void Scene::loadSceneData(int sceneNum) {
_activeScreenNumber = sceneNum;
- // Get the basic scene size
- byte *data = g_resourceManager->getResource(RES_BITMAP, sceneNum, 9999);
- _backgroundBounds = Rect(0, 0, READ_LE_UINT16(data), READ_LE_UINT16(data + 2));
+ if (g_vm->getGameID() == GType_Ringworld2) {
+ // Most scenes in Ringworld 2 don't have a scene size resource, but rather just have
+ // a standard 320x200 size. Only read the scene size data for the specific few scenes
+ switch (sceneNum) {
+ case 700:
+ case 1020:
+ case 1100:
+ case 1700:
+ case 2600:
+ case 2950:
+ case 3100:
+ case 3101:
+ case 3275:
+ case 3600: {
+ // Get the basic scene size from the resource
+ byte *data = g_resourceManager->getResource(RES_BITMAP, sceneNum, 9999);
+ _backgroundBounds = Rect(0, 0, READ_LE_UINT16(data), READ_LE_UINT16(data + 2));
+ DEALLOCATE(data);
+ break;
+ }
+ default:
+ // For all other scenes, use a standard screen size
+ _backgroundBounds = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ break;
+ }
+ } else {
+ // Get the basic scene size
+ byte *data = g_resourceManager->getResource(RES_BITMAP, sceneNum, 9999);
+ _backgroundBounds = Rect(0, 0, READ_LE_UINT16(data), READ_LE_UINT16(data + 2));
+ DEALLOCATE(data);
+ }
+
g_globals->_sceneManager._scene->_sceneBounds.contain(_backgroundBounds);
- DEALLOCATE(data);
// Set up a surface for storing the scene background
SceneManager::setBackSurface();
@@ -335,7 +363,7 @@ void Scene::loadSceneData(int sceneNum) {
_priorities.load(sceneNum);
// Initialize the section enabled list
- Common::set_to(&_enabledSections[0], &_enabledSections[16 * 16], 0xffff);
+ Common::fill(&_enabledSections[0], &_enabledSections[16 * 16], 0xffff);
g_globals->_sceneOffset.x = (_sceneBounds.left / 160) * 160;
g_globals->_sceneOffset.y = (_sceneBounds.top / 100) * 100;
@@ -428,8 +456,9 @@ 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 (g_vm->getGameID() == GType_BlueForce) {
- // For Blue Force, if the scene has an interface area, exclude it from the copy
+ if (g_vm->getGameID() != GType_Ringworld) {
+ // For Blue Force and Return to Ringworld, 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);
}
diff --git a/engines/tsage/scenes.h b/engines/tsage/scenes.h
index da813f019a..2daa71ba98 100644
--- a/engines/tsage/scenes.h
+++ b/engines/tsage/scenes.h
@@ -63,10 +63,11 @@ public:
virtual void process(Event &event);
virtual void dispatch();
virtual void loadScene(int sceneNum);
+ virtual void refreshBackground(int xAmount, int yAmount);
void setZoomPercents(int yStart, int minPercent, int yEnd, int maxPercent);
void loadBackground(int xAmount, int yAmount);
- void refreshBackground(int xAmount, int yAmount);
+
void loadSceneData(int sceneNum);
};
@@ -133,6 +134,8 @@ public:
virtual Scene *createScene(int sceneNumber) = 0;
virtual void processEvent(Event &event) {}
virtual void rightClick() {}
+ virtual bool canSaveGameStateCurrently() = 0;
+ virtual bool canLoadGameStateCurrently() = 0;
};
} // End of namespace TsAGE
diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp
index 71e69283e7..9df5a6666b 100644
--- a/engines/tsage/sound.cpp
+++ b/engines/tsage/sound.cpp
@@ -36,7 +36,7 @@ static SoundManager *_soundManager = NULL;
SoundManager::SoundManager() {
_soundManager = this;
- __sndmgrReady = false;
+ _sndmgrReady = false;
_ourSndResVersion = 0x102;
_ourDrvResVersion = 0x10A;
@@ -52,7 +52,7 @@ SoundManager::SoundManager() {
}
SoundManager::~SoundManager() {
- if (__sndmgrReady) {
+ if (_sndmgrReady) {
Common::StackLock slock(_serverDisabledMutex);
g_vm->_mixer->stopAll();
@@ -83,7 +83,7 @@ SoundManager::~SoundManager() {
}
void SoundManager::postInit() {
- if (!__sndmgrReady) {
+ if (!_sndmgrReady) {
g_saver->addSaveNotifier(&SoundManager::saveNotifier);
g_saver->addLoadNotifier(&SoundManager::loadNotifier);
g_saver->addListener(this);
@@ -94,7 +94,7 @@ void SoundManager::postInit() {
// 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;
+ _sndmgrReady = true;
}
}
@@ -136,7 +136,7 @@ void SoundManager::update() {
}
Common::List<SoundDriverEntry> &SoundManager::buildDriverList(bool detectFlag) {
- assert(__sndmgrReady);
+ assert(_sndmgrReady);
_availableDrivers.clear();
// Build up a list of available drivers. Currently we only implement an Adlib music
@@ -549,7 +549,7 @@ void SoundManager::loadNotifier(bool postFlag) {
void SoundManager::loadNotifierProc(bool postFlag) {
if (!postFlag) {
// Stop any currently playing sounds
- if (__sndmgrReady) {
+ if (_sndmgrReady) {
Common::StackLock slock(_serverDisabledMutex);
for (Common::List<Sound *>::iterator i = _soundList.begin(); i != _soundList.end(); ) {
@@ -569,7 +569,7 @@ void SoundManager::loadNotifierProc(bool postFlag) {
void SoundManager::listenerSynchronize(Serializer &s) {
s.validate("SoundManager");
- assert(__sndmgrReady && _driversDetected);
+ assert(_sndmgrReady && _driversDetected);
if (s.getVersion() < 6)
return;
@@ -798,7 +798,7 @@ void SoundManager::_sfRethinkVoiceTypes() {
continue;
_sfUpdateVoiceStructs();
- Common::set_to(sound->_chWork, sound->_chWork + SOUND_ARR_SIZE, false);
+ Common::fill(sound->_chWork, sound->_chWork + SOUND_ARR_SIZE, false);
for (;;) {
// Scan for sub priority
@@ -1485,7 +1485,7 @@ Sound::Sound() {
memset(_chNumVoices, 0, SOUND_ARR_SIZE * sizeof(int));
memset(_chSubPriority, 0, SOUND_ARR_SIZE * sizeof(int));
memset(_chFlags, 0, SOUND_ARR_SIZE * sizeof(int));
- Common::set_to(_chWork, _chWork + SOUND_ARR_SIZE, false);
+ Common::fill(_chWork, _chWork + SOUND_ARR_SIZE, false);
memset(_channelData, 0, SOUND_ARR_SIZE * sizeof(byte *));
memset(_trkChannel, 0, SOUND_ARR_SIZE * sizeof(int));
memset(_trkState, 0, SOUND_ARR_SIZE * sizeof(int));
@@ -2432,7 +2432,7 @@ void ASound::dispatch() {
}
}
-void ASound::play(int soundNum, Action *action, int volume) {
+void ASound::play(int soundNum, EventHandler *action, int volume) {
_action = action;
_cueValue = 0;
@@ -2557,7 +2557,7 @@ AdlibSoundDriver::AdlibSoundDriver(): SoundDriver() {
_mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
- Common::set_to(_channelVoiced, _channelVoiced + ADLIB_CHANNEL_COUNT, false);
+ Common::fill(_channelVoiced, _channelVoiced + ADLIB_CHANNEL_COUNT, false);
memset(_channelVolume, 0, ADLIB_CHANNEL_COUNT * sizeof(int));
memset(_v4405E, 0, ADLIB_CHANNEL_COUNT * sizeof(int));
memset(_v44067, 0, ADLIB_CHANNEL_COUNT * sizeof(int));
@@ -2565,7 +2565,7 @@ AdlibSoundDriver::AdlibSoundDriver(): SoundDriver() {
memset(_v44079, 0, ADLIB_CHANNEL_COUNT * sizeof(int));
memset(_v44082, 0, ADLIB_CHANNEL_COUNT * sizeof(int));
_v44082[ADLIB_CHANNEL_COUNT] = 0x90;
- Common::set_to(_pitchBlend, _pitchBlend + ADLIB_CHANNEL_COUNT, 0x2000);
+ Common::fill(_pitchBlend, _pitchBlend + ADLIB_CHANNEL_COUNT, 0x2000);
memset(_v4409E, 0, ADLIB_CHANNEL_COUNT * sizeof(int));
_patchData = NULL;
}
diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h
index 010394a42e..77d1f3d3ac 100644
--- a/engines/tsage/sound.h
+++ b/engines/tsage/sound.h
@@ -87,7 +87,7 @@ public:
int _driverResID;
public:
SoundDriver();
- virtual ~SoundDriver() {};
+ virtual ~SoundDriver() {}
const Common::String &getShortDriverDescription() { return _shortDescription; }
const Common::String &getLongDriverDescription() { return _longDescription; }
@@ -169,7 +169,7 @@ class SoundManager : public SaveListener {
private:
SoundDriver *instantiateDriver(int driverNum);
public:
- bool __sndmgrReady;
+ bool _sndmgrReady;
int _ourSndResVersion, _ourDrvResVersion;
SynchronizedList<Sound *> _playList;
Common::List<SoundDriver *> _installedDrivers;
@@ -373,7 +373,7 @@ public:
virtual void synchronize(Serializer &s);
virtual void dispatch();
- void play(int soundNum, Action *action = NULL, int volume = 127);
+ void play(int soundNum, EventHandler *action = NULL, int volume = 127);
void stop();
void prime(int soundNum, Action *action = NULL);
void unPrime();
@@ -414,6 +414,16 @@ public:
virtual void signal();
};
+class PlayStream {
+public:
+ Sound _sound;
+
+ void setFile(const Common::String &filename) {}
+ bool play(int soundNum, EventHandler *endAction) { return false; }
+ void stop() {}
+ void proc1() {}
+ bool isPlaying() const { return false; }
+};
#define ADLIB_CHANNEL_COUNT 9
diff --git a/engines/tsage/staticres.cpp b/engines/tsage/staticres.cpp
index 626e2a7cd1..238e7b3049 100644
--- a/engines/tsage/staticres.cpp
+++ b/engines/tsage/staticres.cpp
@@ -77,7 +77,6 @@ const char *INV_EMPTY_MSG = "You have nothing in your possesion.";
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.";
-const char *OPTIONS_MSG = "\x01Options...";
const char *OK_BTN_STRING = " Ok ";
const char *CANCEL_BTN_STRING = "Cancel";
const char *QUIT_BTN_STRING = " Quit ";
@@ -99,6 +98,7 @@ 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";
+const char *OPTIONS_MSG = "\x01Options...";
// Scene specific resources
const char *EXIT_MSG = " EXIT ";
@@ -134,6 +134,7 @@ 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 ";
+const char *OPTIONS_MSG = "Options...";
// Blue Force general messages
const char *BF_NAME = "Blue Force";
@@ -175,6 +176,46 @@ const char *SCENE570_PROTODATA = "PROTODATA";
const char *SCENE570_WACKYEXE = "WACKYEXE";
const char *SCENE570_WACKYDATA = "WACKYDATA";
+// Scene 180 messages
+const char *THE_NEXT_DAY = "The Next Day";
+
} // End of namespace BlueForce
+namespace Ringworld2 {
+
+const char *CONSOLE_MESSAGES[] = {
+ NULL, "Select Language", "Computer Services", "Food Services", "Entertainment Services",
+ "Main Menu", "Exit Menu", "Previous Menu", "Interworld", "Hero's Tongue", "Personal Log",
+ "Database", "Starchart", "Iso-Opto Disk Reader", "Eject Disk", "Meals", "Snacks",
+ "Beverages", "Human Basic Snacks", "Kzin Basic Snacks", "Hot Beverages", "Cold Beverages",
+ "Music", "Outpost Alpha", " ", " ", "Done", "A-G", "H-O", "P-S", "T-Z", "Tchaikovsky",
+ "Mozart", "Bach", "Rossini"
+};
+
+const char *HELP_MSG = "\x1\rRETURN TO\r RINGWORLD\x14";
+const char *CHAR_TITLE = "\x01Select Character:";
+const char *CHAR_QUINN_MSG = " Quinn ";
+const char *CHAR_SEEKER_MSG = " Seeker ";
+const char *CHAR_MIRANDA_MSG = "Miranda";
+const char *CHAR_CANCEL_MSG = " Cancel ";
+
+const char *GAME_VERSION = "ScummVM Version";
+const char *SOUND_OPTIONS = "Sound options";
+const char *QUIT_GAME = "Quit";
+const char *RESTART_GAME = "Restart";
+const char *SAVE_GAME = "Save game";
+const char *RESTORE_GAME = "Restore game";
+const char *SHOW_CREDITS = "Show credits";
+const char *PAUSE_GAME = "Pause game";
+const char *RESUME_PLAY = " Resume play ";
+const char *F2 = "F2";
+const char *F3 = "F3";
+const char *F4 = "F4";
+const char *F5 = "F5";
+const char *F7 = "F7";
+const char *F8 = "F8";
+const char *F10 = "F10";
+
+} // End of namespace Ringworld2
+
} // End of namespace TsAGE
diff --git a/engines/tsage/staticres.h b/engines/tsage/staticres.h
index 6829ff2568..faff3f4103 100644
--- a/engines/tsage/staticres.h
+++ b/engines/tsage/staticres.h
@@ -44,7 +44,6 @@ extern const char *RESTORING_NOT_ALLOWED_MSG;
extern const char *QUIT_CONFIRM_MSG;
extern const char *RESTART_MSG;
extern const char *GAME_PAUSED_MSG;
-extern const char *OPTIONS_MSG;
extern const char *OK_BTN_STRING;
extern const char *CANCEL_BTN_STRING;
extern const char *QUIT_BTN_STRING;
@@ -64,6 +63,7 @@ extern const char *HELP_MSG;
extern const char *WATCH_INTRO_MSG;
extern const char *START_PLAY_BTN_STRING;
extern const char *INTRODUCTION_BTN_STRING;
+extern const char *OPTIONS_MSG;
// Scene specific resources
extern const char *EXIT_MSG;
@@ -98,6 +98,7 @@ extern const char *HELP_MSG;
extern const char *WATCH_INTRO_MSG;
extern const char *START_PLAY_BTN_STRING;
extern const char *INTRODUCTION_BTN_STRING;
+extern const char *OPTIONS_MSG;
// Blue Force messages
extern const char *BF_NAME;
@@ -138,8 +139,43 @@ extern const char *SCENE570_WACKYDATA;
// Scene 60 radio dispatch buttons
extern const char *RADIO_BTN_LIST[8];
+// Scene 180 message
+extern const char *THE_NEXT_DAY;
+
} // End of namespace BlueForce
+namespace Ringworld2 {
+
+// Scene 125 - Console messages
+extern const char *CONSOLE_MESSAGES[];
+
+// Dialog messages
+extern const char *HELP_MSG;
+extern const char *CHAR_TITLE;
+extern const char *CHAR_QUINN_MSG;
+extern const char *CHAR_SEEKER_MSG;
+extern const char *CHAR_MIRANDA_MSG;
+extern const char *CHAR_CANCEL_MSG;
+
+extern const char *GAME_VERSION;
+extern const char *SOUND_OPTIONS;
+extern const char *QUIT_GAME;
+extern const char *RESTART_GAME;
+extern const char *SAVE_GAME;
+extern const char *RESTORE_GAME;
+extern const char *SHOW_CREDITS;
+extern const char *PAUSE_GAME;
+extern const char *RESUME_PLAY;
+extern const char *F2;
+extern const char *F3;
+extern const char *F4;
+extern const char *F5;
+extern const char *F7;
+extern const char *F8;
+extern const char *F10;
+
+} // End of namespace Ringworld2
+
} // End of namespace TsAGE
#endif
diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp
index 90fdecc90b..40f4dfcfd2 100644
--- a/engines/tsage/tsage.cpp
+++ b/engines/tsage/tsage.cpp
@@ -38,7 +38,14 @@ TSageEngine::TSageEngine(OSystem *system, const tSageGameDescription *gameDesc)
_gameDescription(gameDesc) {
g_vm = this;
DebugMan.addDebugChannel(kRingDebugScripts, "scripts", "Scripts debugging");
- _debugger = new Debugger();
+ if (g_vm->getFeatures() & GF_DEMO)
+ _debugger = new DemoDebugger();
+ else if (g_vm->getGameID() == GType_Ringworld)
+ _debugger = new RingworldDebugger();
+ else if (g_vm->getGameID() == GType_BlueForce)
+ _debugger = new BlueForceDebugger();
+ else if (g_vm->getGameID() == GType_Ringworld2)
+ _debugger = new Ringworld2Debugger();
}
Common::Error TSageEngine::init() {
@@ -61,6 +68,9 @@ bool TSageEngine::hasFeature(EngineFeature f) const {
}
void TSageEngine::initialize() {
+ // Set up the correct graphics mode
+ init();
+
g_saver = new Saver();
// Set up the resource manager
@@ -84,11 +94,20 @@ void TSageEngine::initialize() {
g_globals = new BlueForce::BlueForceGlobals();
// Setup the user interface
- BF_GLOBALS._uiElements.setup(Common::Point(0, BF_INTERFACE_Y - 2));
+ T2_GLOBALS._uiElements.setup(Common::Point(0, UI_INTERFACE_Y - 2));
// Reset all global variables
BF_GLOBALS.reset();
- }
+ } else if (g_vm->getGameID() == GType_Ringworld2) {
+ g_resourceManager->addLib("R2RW.RLB");
+ g_globals = new Ringworld2::Ringworld2Globals();
+
+ // Setup the user interface
+ T2_GLOBALS._uiElements.setup(Common::Point(0, UI_INTERFACE_Y - 2));
+
+ // Reset all global variables
+ R2_GLOBALS.reset();
+ }
g_globals->gfxManager().setDefaults();
@@ -119,14 +138,14 @@ Common::Error TSageEngine::run() {
* Returns true if it is currently okay to restore a game
*/
bool TSageEngine::canLoadGameStateCurrently() {
- return (g_globals->getFlag(50) == 0);
+ return (g_globals != NULL) && (g_globals->_game != NULL) && g_globals->_game->canLoadGameStateCurrently();
}
/**
* Returns true if it is currently okay to save the game
*/
bool TSageEngine::canSaveGameStateCurrently() {
- return (g_globals->getFlag(50) == 0);
+ return (g_globals != NULL) && (g_globals->_game != NULL) && g_globals->_game->canSaveGameStateCurrently();
}
/**
diff --git a/engines/tsage/tsage.h b/engines/tsage/tsage.h
index a4e9240aee..eb36cf0790 100644
--- a/engines/tsage/tsage.h
+++ b/engines/tsage/tsage.h
@@ -40,7 +40,8 @@ namespace TsAGE {
enum {
GType_Ringworld = 0,
- GType_BlueForce = 1
+ GType_BlueForce = 1,
+ GType_Ringworld2 = 2
};
enum {
@@ -62,7 +63,7 @@ struct tSageGameDescription;
#define SCREEN_HEIGHT 200
#define SCREEN_CENTER_X 160
#define SCREEN_CENTER_Y 100
-#define BF_INTERFACE_Y 168
+#define UI_INTERFACE_Y 168
class TSageEngine : public Engine {
private:
diff --git a/engines/tsage/blue_force/blueforce_ui.cpp b/engines/tsage/user_interface.cpp
index fb4008d2c1..2d06e268e4 100644
--- a/engines/tsage/blue_force/blueforce_ui.cpp
+++ b/engines/tsage/user_interface.cpp
@@ -20,16 +20,15 @@
*
*/
-#include "tsage/blue_force/blueforce_ui.h"
+#include "tsage/user_interface.h"
+#include "tsage/core.h"
+#include "tsage/tsage.h"
#include "tsage/blue_force/blueforce_dialogs.h"
#include "tsage/blue_force/blueforce_logic.h"
-#include "tsage/tsage.h"
-#include "tsage/core.h"
+#include "tsage/ringworld2/ringworld2_logic.h"
namespace TsAGE {
-namespace BlueForce {
-
void StripProxy::process(Event &event) {
if (_action)
_action->process(event);
@@ -72,19 +71,34 @@ void UIQuestion::process(Event &event) {
}
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, (int)cursor);
+ switch (g_vm->getGameID()) {
+ case GType_BlueForce:
+ if (cursor == INV_FOREST_RAP) {
+ // Forest rap item has a graphical display
+ showItem(5, 1, 1);
+ } else {
+ // Display object description
+ SceneItem::display2(9001, (int)cursor);
+ }
+ break;
+ case GType_Ringworld2:
+ if ((cursor == R2_9) || (cursor == R2_39)) {
+ // Show communicator
+ warning("TODO: Communicator");
+ } else {
+ // Show object description
+ SceneItem::display2(3, (int)cursor);
+ }
+ break;
+ default:
+ break;
}
}
void UIQuestion::setEnabled(bool flag) {
if (_enabled != flag) {
UIElement::setEnabled(flag);
- BF_GLOBALS._uiElements.draw();
+ T2_GLOBALS._uiElements.draw();
}
}
@@ -98,16 +112,16 @@ void UIQuestion::showItem(int resNum, int rlbNum, int frameNum) {
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);
+ GfxSurface *savedArea = Surface_getArea(GLOBALS.gfxManager().getSurface(), imgRect);
// Draw the image
- BF_GLOBALS.gfxManager().copyFrom(objImage, imgRect);
+ GLOBALS.gfxManager().copyFrom(objImage, imgRect);
// Wait for a press
- BF_GLOBALS._events.waitForPress();
+ GLOBALS._events.waitForPress();
// Restore the old area
- BF_GLOBALS.gfxManager().copyFrom(*savedArea, imgRect);
+ GLOBALS.gfxManager().copyFrom(*savedArea, imgRect);
delete savedArea;
}
@@ -136,7 +150,7 @@ void UIScore::draw() {
}
void UIScore::updateScore() {
- int score = BF_GLOBALS._uiElements._scoreValue;
+ int score = T2_GLOBALS._uiElements._scoreValue;
_digit3.setFrame(score / 1000 + 1); score %= 1000;
_digit2.setFrame(score / 100 + 1); score %= 100;
@@ -161,22 +175,13 @@ void UIInventorySlot::process(Event &event) {
if (event.eventType == EVENT_BUTTON_DOWN) {
event.handled = true;
- if (_objIndex == INV_AMMO_BELT) {
- // Handle showing ammo belt
- showAmmoBelt();
-
- } else if (_objIndex != INV_NONE) {
+ // Check if game has a select item handler, and if so, give it a chance to check
+ // whether something special happens when the item is selected
+ if (!T2_GLOBALS._onSelectItem || !T2_GLOBALS._onSelectItem((CursorType)_objIndex))
_object->setCursor();
- }
}
}
-void UIInventorySlot::showAmmoBelt() {
- AmmoBeltDialog *dlg = new AmmoBeltDialog();
- dlg->execute();
- delete dlg;
-}
-
/*--------------------------------------------------------------------------*/
UIInventoryScroll::UIInventoryScroll() {
@@ -201,7 +206,7 @@ void UIInventoryScroll::process(Event &event) {
toggle(false);
// Scroll the inventory as necessary
- BF_GLOBALS._uiElements.scrollInventory(_isLeft);
+ T2_GLOBALS._uiElements.scrollInventory(_isLeft);
event.handled = true;
break;
default:
@@ -212,7 +217,7 @@ void UIInventoryScroll::process(Event &event) {
void UIInventoryScroll::toggle(bool pressed) {
if (_enabled) {
setFrame(pressed ? (_frameNum + 1) : _frameNum);
- BF_GLOBALS._uiElements.draw();
+ T2_GLOBALS._uiElements.draw();
}
}
@@ -242,9 +247,9 @@ void UICollection::show() {
void UICollection::erase() {
if (_clearScreen) {
- Rect tempRect(0, BF_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT);
- BF_GLOBALS._screenSurface.fillRect(tempRect, 0);
- BF_GLOBALS._sceneManager._scene->_backSurface.fillRect(tempRect, 0);
+ Rect tempRect(0, UI_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT);
+ GLOBALS._screenSurface.fillRect(tempRect, 0);
+ GLOBALS._sceneManager._scene->_backSurface.fillRect(tempRect, 0);
_clearScreen = false;
}
}
@@ -255,23 +260,31 @@ void UICollection::resetClear() {
void UICollection::draw() {
if (_visible) {
+ // Temporarily reset the sceneBounds when drawing UI elements to force them on-screen
+ Rect savedBounds = g_globals->_sceneManager._scene->_sceneBounds;
+ g_globals->_sceneManager._scene->_sceneBounds = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+
// Draw the elements onto the background
for (uint idx = 0; idx < _objList.size(); ++idx)
_objList[idx]->draw();
// 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));
+ GLOBALS._screenSurface.copyFrom(GLOBALS._sceneManager._scene->_backSurface,
+ Rect(0, UI_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT),
+ Rect(0, UI_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT));
_clearScreen = 1;
+ g_globals->_sceneManager._scene->_sceneBounds = savedBounds;
}
}
/*--------------------------------------------------------------------------*/
UIElements::UIElements(): UICollection() {
- _cursorVisage.setVisage(1, 5);
+ if (g_vm->getGameID() == GType_Ringworld2)
+ _cursorVisage.setVisage(5, 1);
+ else
+ _cursorVisage.setVisage(1, 5);
g_saver->addLoadNotifier(&UIElements::loadNotifierProc);
}
@@ -303,16 +316,18 @@ void UIElements::synchronize(Serializer &s) {
}
void UIElements::process(Event &event) {
- if (_clearScreen && BF_GLOBALS._player._enabled && (BF_GLOBALS._sceneManager._sceneNumber != 50)) {
+ if (_clearScreen && GLOBALS._player._enabled &&
+ ((g_vm->getGameID() != GType_BlueForce) || (GLOBALS._sceneManager._sceneNumber != 50))) {
if (_bounds.contains(event.mousePos)) {
// Cursor inside UI area
if (!_cursorChanged) {
- if (BF_GLOBALS._events.isInventoryIcon()) {
+ if (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);
+ int cursorId = (g_vm->getGameID() == GType_Ringworld2) ? 11 : 6;
+ GfxSurface surface = _cursorVisage.getFrame(cursorId);
+ GLOBALS._events.setCursor(surface);
}
_cursorChanged = true;
}
@@ -331,14 +346,15 @@ void UIElements::process(Event &event) {
} else if (_cursorChanged) {
// Cursor outside UI area, so reset as necessary
- BF_GLOBALS._events.setCursor(BF_GLOBALS._events.getCursor());
+ GLOBALS._events.setCursor(GLOBALS._events.getCursor());
_cursorChanged = false;
-
- SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene;
+/*
+ SceneExt *scene = (SceneExt *)GLOBALS._sceneManager._scene;
if (scene->_focusObject) {
GfxSurface surface = _cursorVisage.getFrame(7);
- BF_GLOBALS._events.setCursor(surface);
+ GLOBALS._events.setCursor(surface);
}
+*/
}
}
}
@@ -351,8 +367,8 @@ void UIElements::setup(const Common::Point &pt) {
UICollection::setup(pt);
hide();
- _object1.setup(1, 3, 1, 0, 0, 255);
- add(&_object1);
+ _background.setup(1, 3, 1, 0, 0, 255);
+ add(&_background);
// Set up the inventory slots
int xp = 0;
@@ -374,32 +390,48 @@ void UIElements::setup(const Common::Point &pt) {
}
xp = idx * 63 + 2;
- item->setup(9, 1, idx, xp, 4, 255);
+ if (g_vm->getGameID() == GType_BlueForce) {
+ item->setup(9, 1, idx, xp, 4, 255);
+ } else {
+ item->setup(7, 1, idx, xp, 4, 255);
+ }
add(item);
}
// Setup bottom-right hand buttons
xp += 62;
- _question.setup(1, 4, 7, xp, 16, 255);
+ int yp = (g_vm->getGameID() == GType_BlueForce) ? 16 : 17;
+ _question.setup(1, 4, 7, xp, yp, 255);
_question.setEnabled(false);
add(&_question);
xp += 21;
- _scrollLeft.setup(1, 4, 1, xp, 16, 255);
+ _scrollLeft.setup(1, 4, 1, xp, yp, 255);
add(&_scrollLeft);
_scrollLeft._isLeft = true;
xp += 22;
- _scrollRight.setup(1, 4, 4, xp, 16, 255);
+ _scrollRight.setup(1, 4, 4, xp, yp, 255);
add(&_scrollRight);
_scrollRight._isLeft = false;
- // Set up the score
- _score.postInit();
- add(&_score);
+ switch (g_vm->getGameID()) {
+ case GType_BlueForce:
+ // Set up the score
+ _score.postInit();
+ add(&_score);
+ break;
+ case GType_Ringworld2:
+ // Set up the character display
+ _character.setup(1, 5, R2_GLOBALS._player._characterIndex, 285, 11, 255);
+ add(&_character);
+ break;
+ default:
+ break;
+ }
// Set interface area
- _bounds = Rect(0, BF_INTERFACE_Y - 1, SCREEN_WIDTH, SCREEN_HEIGHT);
+ _bounds = Rect(0, UI_INTERFACE_Y - 1, SCREEN_WIDTH, SCREEN_HEIGHT);
updateInventory();
}
@@ -420,7 +452,16 @@ void UIElements::add(UIElement *obj) {
* Handles updating the visual inventory in the user interface
*/
void UIElements::updateInventory() {
- _score.updateScore();
+ switch (g_vm->getGameID()) {
+ case GType_BlueForce:
+ // Update the score
+ _score.updateScore();
+ break;
+ case GType_Ringworld2:
+ _character.setFrame(R2_GLOBALS._player._characterIndex);
+ break;
+ }
+
updateInvList();
// Enable scroll buttons if the player has more than four items
@@ -445,7 +486,7 @@ void UIElements::updateInventory() {
// Loop through the inventory objects
SynchronizedList<InvObject *>::iterator i;
int objIndex = 0;
- for (i = BF_INVENTORY._itemList.begin(); i != BF_INVENTORY._itemList.end(); ++i, ++objIndex) {
+ for (i = GLOBALS._inventory->_itemList.begin(); i != GLOBALS._inventory->_itemList.end(); ++i, ++objIndex) {
InvObject *obj = *i;
// Check whether the object is in any of the four inventory slots
@@ -461,6 +502,8 @@ void UIElements::updateInventory() {
slot->setVisage(obj->_visage);
slot->setStrip(obj->_strip);
slot->setFrame(obj->_frame);
+
+ slot->reposition();
}
}
}
@@ -479,7 +522,7 @@ void UIElements::updateInvList() {
SynchronizedList<InvObject *>::iterator i;
int itemIndex = 0;
- for (i = BF_GLOBALS._inventory->_itemList.begin(); i != BF_GLOBALS._inventory->_itemList.end(); ++i, ++itemIndex) {
+ for (i = GLOBALS._inventory->_itemList.begin(); i != GLOBALS._inventory->_itemList.end(); ++i, ++itemIndex) {
InvObject *invObject = *i;
if (invObject->inInventory())
_itemList.push_back(itemIndex);
@@ -491,7 +534,7 @@ void UIElements::updateInvList() {
*/
void UIElements::addScore(int amount) {
_scoreValue += amount;
- BF_GLOBALS._sound2.play(0);
+ T2_GLOBALS._inventorySound.play(0);
updateInventory();
}
@@ -508,10 +551,8 @@ void UIElements::scrollInventory(bool isLeft) {
}
void UIElements::loadNotifierProc(bool postFlag) {
- if (postFlag && BF_GLOBALS._uiElements._active)
- BF_GLOBALS._uiElements.show();
+ if (postFlag && T2_GLOBALS._uiElements._active)
+ T2_GLOBALS._uiElements.show();
}
-} // End of namespace BlueForce
-
} // End of namespace TsAGE
diff --git a/engines/tsage/blue_force/blueforce_ui.h b/engines/tsage/user_interface.h
index 601b97a9fe..0fbfc5a00f 100644
--- a/engines/tsage/blue_force/blueforce_ui.h
+++ b/engines/tsage/user_interface.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef TSAGE_BLUEFORCE_UI_H
-#define TSAGE_BLUEFORCE_UI_H
+#ifndef TSAGE_USER_INTERFACE_H
+#define TSAGE_USER_INTERFACE_H
#include "common/scummsys.h"
#include "tsage/core.h"
@@ -30,10 +30,6 @@
namespace TsAGE {
-namespace BlueForce {
-
-using namespace TsAGE;
-
class StripProxy: public EventHandler {
public:
virtual void process(Event &event);
@@ -76,8 +72,6 @@ public:
};
class UIInventorySlot: public UIElement {
-private:
- void showAmmoBelt();
public:
int _objIndex;
InvObject *_object;
@@ -124,7 +118,7 @@ private:
void add(UIElement *obj);
void updateInvList();
public:
- UIElement _object1;
+ UIElement _background;
UIQuestion _question;
UIScore _score;
UIInventorySlot _slot1, _slot2, _slot3, _slot4;
@@ -134,6 +128,7 @@ public:
bool _active;
Common::Array<int> _itemList;
Visage _cursorVisage;
+ UIElement _character;
UIElements();
virtual Common::String getClassName() { return "UIElements"; }
@@ -149,8 +144,6 @@ public:
static void loadNotifierProc(bool postFlag);
};
-} // End of namespace BlueForce
-
} // End of namespace TsAGE
#endif
diff --git a/engines/tucker/detection.cpp b/engines/tucker/detection.cpp
index 4a3313e3f7..aeeebe6877 100644
--- a/engines/tucker/detection.cpp
+++ b/engines/tucker/detection.cpp
@@ -43,7 +43,7 @@ static const ADGameDescription tuckerGameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformPC,
Tucker::kGameFlagNoSubtitles,
- Common::GUIO_NONE
+ GUIO0()
},
{
"tucker",
@@ -52,7 +52,7 @@ static const ADGameDescription tuckerGameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
Tucker::kGameFlagEncodedData,
- Common::GUIO_NONE
+ GUIO0()
},
{
"tucker",
@@ -61,7 +61,7 @@ static const ADGameDescription tuckerGameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformPC,
Tucker::kGameFlagEncodedData,
- Common::GUIO_NONE
+ GUIO0()
},
{
"tucker",
@@ -70,7 +70,7 @@ static const ADGameDescription tuckerGameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformPC,
Tucker::kGameFlagEncodedData,
- Common::GUIO_NONE
+ GUIO0()
},
{
"tucker",
@@ -79,7 +79,7 @@ static const ADGameDescription tuckerGameDescriptions[] = {
Common::PL_POL,
Common::kPlatformPC,
0,
- Common::GUIO_NONE
+ GUIO0()
},
{
"tucker",
@@ -88,7 +88,7 @@ static const ADGameDescription tuckerGameDescriptions[] = {
Common::CZ_CZE,
Common::kPlatformPC,
Tucker::kGameFlagEncodedData,
- Common::GUIO_NONE
+ GUIO0()
},
{
"tucker",
@@ -97,7 +97,7 @@ static const ADGameDescription tuckerGameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO | Tucker::kGameFlagDemo,
- Common::GUIO_NONE
+ GUIO0()
},
AD_TABLE_END_MARKER
};
@@ -109,7 +109,7 @@ static const ADGameDescription tuckerDemoGameDescription = {
Common::EN_ANY,
Common::kPlatformPC,
ADGF_DEMO | Tucker::kGameFlagDemo | Tucker::kGameFlagIntroOnly,
- Common::GUIO_NONE
+ GUIO0()
};
class TuckerMetaEngine : public AdvancedMetaEngine {
diff --git a/engines/tucker/locations.cpp b/engines/tucker/locations.cpp
index 70b17e4191..f6d34c295b 100644
--- a/engines/tucker/locations.cpp
+++ b/engines/tucker/locations.cpp
@@ -2184,10 +2184,6 @@ void TuckerEngine::updateSprite_locationNum48(int i) {
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
_spritesTable[i].needUpdate = 1;
state = 2;
- } else if (getRandomNumber() < 30000) {
- _spritesTable[i].needUpdate = 0;
- state = 2;
- _spritesTable[i].updateDelay = 5;
} else {
_spritesTable[i].needUpdate = 0;
state = 2;
@@ -2857,9 +2853,6 @@ void TuckerEngine::updateSprite_locationNum66_1(int i) {
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
_spritesTable[i].needUpdate = 1;
state = 8;
- } else if (getRandomNumber() > 30000) {
- state = 10;
- _spritesTable[i].needUpdate = 0;
} else {
state = 10;
_spritesTable[i].needUpdate = 0;
@@ -2917,13 +2910,13 @@ void TuckerEngine::execData3PostUpdate_locationNum66() {
if (_spritesTable[2].flipX == 1) {
--_updateLocationXPosTable2[0];
if (_updateLocationXPosTable2[0] < -50) {
- _updateLocationXPosTable2[0] = 0;
+ _spritesTable[2].flipX = 0;
_updateLocationXPosTable2[0] = -50;
}
} else {
++_updateLocationXPosTable2[0];
if (_updateLocationXPosTable2[0] > 500) {
- _updateLocationXPosTable2[0] = 1;
+ _spritesTable[2].flipX = 1;
_updateLocationXPosTable2[0] = 500;
}
}