aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMatthew Hoops2011-05-11 00:30:02 -0400
committerMatthew Hoops2011-05-11 00:30:28 -0400
commita1d41da096c0bcf502a85919cb1cb1ee471719c5 (patch)
tree8c51419daa486f1d4833757db4715dadab6c3497 /engines
parentaccb0c2a5d0c9e7b353cda4b74f511a498ed8073 (diff)
parent33c3e19cea2a08fbf26ecbe940763e8ee1c37d28 (diff)
downloadscummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.tar.gz
scummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.tar.bz2
scummvm-rg350-a1d41da096c0bcf502a85919cb1cb1ee471719c5.zip
Merge remote branch 'upstream/master' into t7g-ios
Conflicts: audio/decoders/qdm2.h common/util.cpp engines/groovie/music.cpp engines/groovie/resource.h video/qt_decoder.cpp video/qt_decoder.h
Diffstat (limited to 'engines')
-rw-r--r--engines/advancedDetector.cpp4
-rw-r--r--engines/advancedDetector.h12
-rw-r--r--engines/agi/agi.cpp1
-rw-r--r--engines/agi/agi.h14
-rw-r--r--engines/agi/detection.cpp4
-rw-r--r--engines/agi/graphics.cpp11
-rw-r--r--engines/agi/inv.cpp2
-rw-r--r--engines/agi/keyboard.cpp4
-rw-r--r--engines/agi/loader_v2.cpp2
-rw-r--r--engines/agi/loader_v3.cpp1
-rw-r--r--engines/agi/lzw.cpp2
-rw-r--r--engines/agi/menu.cpp2
-rw-r--r--engines/agi/objects.cpp2
-rw-r--r--engines/agi/op_cmd.cpp1
-rw-r--r--engines/agi/op_test.cpp6
-rw-r--r--engines/agi/picture.cpp8
-rw-r--r--engines/agi/preagi.cpp1
-rw-r--r--engines/agi/preagi_mickey.cpp1
-rw-r--r--engines/agi/preagi_troll.cpp1
-rw-r--r--engines/agi/preagi_winnie.cpp52
-rw-r--r--engines/agi/preagi_winnie.h2
-rw-r--r--engines/agi/predictive.cpp1
-rw-r--r--engines/agi/saveload.cpp25
-rw-r--r--engines/agi/sound.cpp2
-rw-r--r--engines/agi/sound_2gs.cpp1
-rw-r--r--engines/agi/sound_midi.cpp1
-rw-r--r--engines/agi/sound_sarien.cpp4
-rw-r--r--engines/agi/text.cpp4
-rw-r--r--engines/agi/wagparser.cpp1
-rw-r--r--engines/agi/words.cpp2
-rw-r--r--engines/agos/agos.cpp22
-rw-r--r--engines/agos/agos.h7
-rw-r--r--engines/agos/animation.cpp2
-rw-r--r--engines/agos/charset-fontdata.cpp1
-rw-r--r--engines/agos/debug.cpp1
-rw-r--r--engines/agos/debug.h2
-rw-r--r--engines/agos/detection.cpp1
-rw-r--r--engines/agos/draw.cpp1
-rw-r--r--engines/agos/event.cpp1
-rw-r--r--engines/agos/gfx.cpp1
-rw-r--r--engines/agos/icons.cpp4
-rw-r--r--engines/agos/items.cpp1
-rw-r--r--engines/agos/menus.cpp1
-rw-r--r--engines/agos/midi.cpp1
-rw-r--r--engines/agos/midi.h2
-rw-r--r--engines/agos/midiparser_s1d.cpp1
-rw-r--r--engines/agos/res.cpp1
-rw-r--r--engines/agos/res_snd.cpp1
-rw-r--r--engines/agos/rooms.cpp1
-rw-r--r--engines/agos/saveload.cpp1
-rw-r--r--engines/agos/script.cpp1
-rw-r--r--engines/agos/script_dp.cpp2
-rw-r--r--engines/agos/script_ff.cpp6
-rw-r--r--engines/agos/script_pn.cpp2
-rw-r--r--engines/agos/script_s1.cpp2
-rw-r--r--engines/agos/script_s2.cpp2
-rw-r--r--engines/agos/sound.cpp1
-rw-r--r--engines/agos/string.cpp1
-rw-r--r--engines/agos/string_pn.cpp2
-rw-r--r--engines/agos/subroutine.cpp1
-rw-r--r--engines/agos/vga.cpp1
-rw-r--r--engines/agos/vga_e2.cpp1
-rw-r--r--engines/agos/vga_ff.cpp4
-rw-r--r--engines/agos/vga_ww.cpp1
-rw-r--r--engines/agos/window.cpp1
-rw-r--r--engines/cine/anim.cpp1
-rw-r--r--engines/cine/bg.cpp1
-rw-r--r--engines/cine/cine.cpp4
-rw-r--r--engines/cine/detection.cpp1
-rw-r--r--engines/cine/gfx.cpp3
-rw-r--r--engines/cine/msg.cpp1
-rw-r--r--engines/cine/pal.cpp3
-rw-r--r--engines/cine/part.cpp1
-rw-r--r--engines/cine/saveload.cpp1
-rw-r--r--engines/cine/script_fw.cpp1
-rw-r--r--engines/cine/script_os.cpp1
-rw-r--r--engines/cine/sound.cpp2
-rw-r--r--engines/cine/sound.h2
-rw-r--r--engines/cine/texte.cpp4
-rw-r--r--engines/cine/various.cpp1
-rw-r--r--engines/cruise/actor.cpp2
-rw-r--r--engines/cruise/background.cpp2
-rw-r--r--engines/cruise/cruise.cpp5
-rw-r--r--engines/cruise/cruise.h1
-rw-r--r--engines/cruise/cruise_main.cpp1
-rw-r--r--engines/cruise/ctp.cpp2
-rw-r--r--engines/cruise/ctp.h2
-rw-r--r--engines/cruise/dataLoader.cpp1
-rw-r--r--engines/cruise/detection.cpp3
-rw-r--r--engines/cruise/font.cpp4
-rw-r--r--engines/cruise/font.h2
-rw-r--r--engines/cruise/function.cpp2
-rw-r--r--engines/cruise/gfxModule.cpp10
-rw-r--r--engines/cruise/gfxModule.h4
-rw-r--r--engines/cruise/menu.cpp1
-rw-r--r--engines/cruise/object.cpp2
-rw-r--r--engines/cruise/overlay.cpp1
-rw-r--r--engines/cruise/saveload.cpp1
-rw-r--r--engines/cruise/script.cpp1
-rw-r--r--engines/cruise/sound.cpp2
-rw-r--r--engines/dialogs.cpp12
-rw-r--r--engines/dialogs.h8
-rw-r--r--engines/draci/animation.cpp7
-rw-r--r--engines/draci/font.cpp30
-rw-r--r--engines/draci/font.h26
-rw-r--r--engines/draci/game.cpp36
-rw-r--r--engines/draci/game.h6
-rw-r--r--engines/draci/mouse.cpp6
-rw-r--r--engines/draci/music.cpp1
-rw-r--r--engines/draci/screen.cpp20
-rw-r--r--engines/draci/screen.h2
-rw-r--r--engines/draci/script.cpp8
-rw-r--r--engines/draci/script.h2
-rw-r--r--engines/draci/sound.cpp10
-rw-r--r--engines/draci/sprite.cpp10
-rw-r--r--engines/draci/sprite.h6
-rw-r--r--engines/draci/surface.cpp10
-rw-r--r--engines/draci/surface.h13
-rw-r--r--engines/draci/walking.cpp14
-rw-r--r--engines/draci/walking.h6
-rw-r--r--engines/drascula/converse.cpp2
-rw-r--r--engines/drascula/drascula.cpp1
-rw-r--r--engines/drascula/drascula.h4
-rw-r--r--engines/drascula/graphics.cpp64
-rw-r--r--engines/drascula/objects.cpp2
-rw-r--r--engines/drascula/palette.cpp2
-rw-r--r--engines/drascula/rooms.cpp4
-rw-r--r--engines/drascula/saveload.cpp2
-rw-r--r--engines/drascula/sound.cpp1
-rw-r--r--engines/engine.cpp27
-rw-r--r--engines/engine.h14
-rw-r--r--engines/game.cpp1
-rw-r--r--engines/game.h2
-rw-r--r--engines/gob/databases.cpp1
-rw-r--r--engines/gob/dataio.cpp6
-rw-r--r--engines/gob/dataio.h2
-rw-r--r--engines/gob/detection_tables.h28
-rw-r--r--engines/gob/draw_v2.cpp9
-rw-r--r--engines/gob/gob.cpp3
-rw-r--r--engines/gob/gob.h4
-rw-r--r--engines/gob/inter_v1.cpp2
-rw-r--r--engines/gob/inter_v4.cpp2
-rw-r--r--engines/gob/inter_v5.cpp3
-rw-r--r--engines/gob/inter_v6.cpp2
-rw-r--r--engines/gob/resources.h2
-rw-r--r--engines/gob/save/savefile.cpp2
-rw-r--r--engines/gob/save/savehandler.cpp4
-rw-r--r--engines/gob/save/saveload.cpp3
-rw-r--r--engines/gob/save/saveload_v6.cpp3
-rw-r--r--engines/gob/sound/adlib.cpp2
-rw-r--r--engines/gob/sound/bgatmosphere.cpp2
-rw-r--r--engines/gob/sound/cdrom.cpp1
-rw-r--r--engines/gob/sound/infogrames.cpp2
-rw-r--r--engines/gob/sound/sounddesc.cpp2
-rw-r--r--engines/gob/sound/soundmixer.cpp2
-rw-r--r--engines/gob/surface.cpp2
-rw-r--r--engines/gob/surface.h2
-rw-r--r--engines/gob/totfile.h2
-rw-r--r--engines/gob/util.cpp2
-rw-r--r--engines/gob/video.cpp1
-rw-r--r--engines/gob/videoplayer.cpp2
-rw-r--r--engines/groovie/cursor.cpp3
-rw-r--r--engines/groovie/cursor.h2
-rw-r--r--engines/groovie/debug.cpp2
-rw-r--r--engines/groovie/font.cpp4
-rw-r--r--engines/groovie/graphics.cpp8
-rw-r--r--engines/groovie/groovie.cpp2
-rw-r--r--engines/groovie/groovie.h2
-rw-r--r--engines/groovie/music.cpp3
-rw-r--r--engines/groovie/player.cpp2
-rw-r--r--engines/groovie/resource.cpp47
-rw-r--r--engines/groovie/resource.h9
-rw-r--r--engines/groovie/roq.cpp17
-rw-r--r--engines/groovie/script.cpp22
-rw-r--r--engines/groovie/script.h4
-rw-r--r--engines/groovie/vdx.cpp91
-rw-r--r--engines/groovie/vdx.h8
-rw-r--r--engines/hugo/detection.cpp1
-rw-r--r--engines/hugo/dialogs.cpp68
-rw-r--r--engines/hugo/dialogs.h6
-rw-r--r--engines/hugo/display.cpp6
-rw-r--r--engines/hugo/file.cpp12
-rw-r--r--engines/hugo/file_v1d.cpp2
-rw-r--r--engines/hugo/file_v1w.cpp2
-rw-r--r--engines/hugo/file_v2d.cpp10
-rw-r--r--engines/hugo/file_v3d.cpp2
-rw-r--r--engines/hugo/hugo.cpp16
-rw-r--r--engines/hugo/hugo.h4
-rw-r--r--engines/hugo/intro.cpp7
-rw-r--r--engines/hugo/inventory.cpp1
-rw-r--r--engines/hugo/mouse.cpp2
-rw-r--r--engines/hugo/object.cpp3
-rw-r--r--engines/hugo/object_v1d.cpp1
-rw-r--r--engines/hugo/object_v1w.cpp1
-rw-r--r--engines/hugo/object_v2d.cpp1
-rw-r--r--engines/hugo/object_v3d.cpp1
-rw-r--r--engines/hugo/parser.cpp11
-rw-r--r--engines/hugo/parser.h5
-rw-r--r--engines/hugo/parser_v1d.cpp1
-rw-r--r--engines/hugo/parser_v1w.cpp3
-rw-r--r--engines/hugo/parser_v2d.cpp3
-rw-r--r--engines/hugo/parser_v3d.cpp3
-rw-r--r--engines/hugo/route.cpp1
-rw-r--r--engines/hugo/schedule.cpp59
-rw-r--r--engines/hugo/sound.cpp2
-rw-r--r--engines/hugo/util.cpp3
-rw-r--r--engines/kyra/animator_hof.cpp2
-rw-r--r--engines/kyra/animator_lok.cpp5
-rw-r--r--engines/kyra/animator_mr.cpp2
-rw-r--r--engines/kyra/animator_tim.cpp5
-rw-r--r--engines/kyra/animator_v2.cpp3
-rw-r--r--engines/kyra/debugger.cpp7
-rw-r--r--engines/kyra/detection.cpp6
-rw-r--r--engines/kyra/gui.cpp2
-rw-r--r--engines/kyra/gui_hof.cpp8
-rw-r--r--engines/kyra/gui_lok.cpp9
-rw-r--r--engines/kyra/gui_lok.h1
-rw-r--r--engines/kyra/gui_lol.cpp4
-rw-r--r--engines/kyra/gui_mr.cpp5
-rw-r--r--engines/kyra/gui_v2.cpp2
-rw-r--r--engines/kyra/items_hof.cpp2
-rw-r--r--engines/kyra/items_lok.cpp8
-rw-r--r--engines/kyra/items_mr.cpp2
-rw-r--r--engines/kyra/kyra_hof.cpp7
-rw-r--r--engines/kyra/kyra_lok.cpp21
-rw-r--r--engines/kyra/kyra_lok.h4
-rw-r--r--engines/kyra/kyra_mr.cpp5
-rw-r--r--engines/kyra/kyra_v1.cpp15
-rw-r--r--engines/kyra/kyra_v1.h9
-rw-r--r--engines/kyra/kyra_v2.cpp7
-rw-r--r--engines/kyra/lol.cpp14
-rw-r--r--engines/kyra/lol.h5
-rw-r--r--engines/kyra/resource.cpp4
-rw-r--r--engines/kyra/saveload.cpp12
-rw-r--r--engines/kyra/saveload_hof.cpp12
-rw-r--r--engines/kyra/saveload_lok.cpp7
-rw-r--r--engines/kyra/saveload_lol.cpp3
-rw-r--r--engines/kyra/scene_hof.cpp4
-rw-r--r--engines/kyra/scene_lok.cpp6
-rw-r--r--engines/kyra/scene_lol.cpp2
-rw-r--r--engines/kyra/scene_mr.cpp3
-rw-r--r--engines/kyra/scene_v1.cpp1
-rw-r--r--engines/kyra/scene_v2.cpp3
-rw-r--r--engines/kyra/screen.cpp8
-rw-r--r--engines/kyra/screen_hof.cpp4
-rw-r--r--engines/kyra/screen_lok.cpp6
-rw-r--r--engines/kyra/screen_lol.cpp5
-rw-r--r--engines/kyra/screen_mr.cpp1
-rw-r--r--engines/kyra/script.cpp10
-rw-r--r--engines/kyra/script_hof.cpp7
-rw-r--r--engines/kyra/script_lok.cpp7
-rw-r--r--engines/kyra/script_lol.cpp3
-rw-r--r--engines/kyra/script_mr.cpp6
-rw-r--r--engines/kyra/script_tim.cpp4
-rw-r--r--engines/kyra/script_tim.h1
-rw-r--r--engines/kyra/script_v1.cpp2
-rw-r--r--engines/kyra/script_v2.cpp2
-rw-r--r--engines/kyra/seqplayer.cpp11
-rw-r--r--engines/kyra/sequences_hof.cpp6
-rw-r--r--engines/kyra/sequences_lok.cpp4
-rw-r--r--engines/kyra/sequences_lol.cpp3
-rw-r--r--engines/kyra/sequences_v2.cpp2
-rw-r--r--engines/kyra/sound.cpp7
-rw-r--r--engines/kyra/sound_adlib.cpp25
-rw-r--r--engines/kyra/sound_amiga.cpp5
-rw-r--r--engines/kyra/sound_lok.cpp4
-rw-r--r--engines/kyra/sound_lol.cpp4
-rw-r--r--engines/kyra/sound_towns.cpp9
-rw-r--r--engines/kyra/sprites.cpp12
-rw-r--r--engines/kyra/staticres.cpp9
-rw-r--r--engines/kyra/text.cpp6
-rw-r--r--engines/kyra/text_hof.cpp4
-rw-r--r--engines/kyra/text_lok.cpp5
-rw-r--r--engines/kyra/text_lol.cpp5
-rw-r--r--engines/kyra/text_lol.h4
-rw-r--r--engines/kyra/text_mr.cpp3
-rw-r--r--engines/kyra/timer.cpp4
-rw-r--r--engines/kyra/timer_lok.cpp4
-rw-r--r--engines/kyra/timer_lol.cpp3
-rw-r--r--engines/kyra/timer_mr.cpp2
-rw-r--r--engines/kyra/vqa.cpp6
-rw-r--r--engines/kyra/wsamovie.cpp11
-rw-r--r--engines/kyra/wsamovie.h4
-rw-r--r--engines/lastexpress/data/animation.cpp5
-rw-r--r--engines/lastexpress/data/archive.h3
-rw-r--r--engines/lastexpress/data/background.cpp1
-rw-r--r--engines/lastexpress/data/font.cpp2
-rw-r--r--engines/lastexpress/data/font.h2
-rw-r--r--engines/lastexpress/data/scene.cpp1
-rw-r--r--engines/lastexpress/data/scene.h6
-rw-r--r--engines/lastexpress/data/sequence.cpp3
-rw-r--r--engines/lastexpress/data/sequence.h2
-rw-r--r--engines/lastexpress/data/snd.cpp40
-rw-r--r--engines/lastexpress/data/snd.h4
-rw-r--r--engines/lastexpress/data/subtitle.cpp2
-rw-r--r--engines/lastexpress/entities/entity.h1
-rw-r--r--engines/lastexpress/game/inventory.cpp193
-rw-r--r--engines/lastexpress/game/inventory.h18
-rw-r--r--engines/lastexpress/game/logic.cpp28
-rw-r--r--engines/lastexpress/game/state.h8
-rw-r--r--engines/lastexpress/graphics.cpp13
-rw-r--r--engines/lastexpress/lastexpress.cpp3
-rw-r--r--engines/lastexpress/resource.cpp1
-rw-r--r--engines/lure/debugger.cpp4
-rw-r--r--engines/lure/decode.cpp6
-rw-r--r--engines/lure/disk.h2
-rw-r--r--engines/lure/fights.cpp6
-rw-r--r--engines/lure/hotspots.cpp28
-rw-r--r--engines/lure/hotspots.h6
-rw-r--r--engines/lure/lure.h2
-rw-r--r--engines/lure/luredefs.h14
-rw-r--r--engines/lure/memory.cpp1
-rw-r--r--engines/lure/menu.cpp36
-rw-r--r--engines/lure/palette.cpp4
-rw-r--r--engines/lure/res.cpp2
-rw-r--r--engines/lure/res_struct.cpp2
-rw-r--r--engines/lure/res_struct.h6
-rw-r--r--engines/lure/room.cpp6
-rw-r--r--engines/lure/screen.cpp8
-rw-r--r--engines/lure/sound.h1
-rw-r--r--engines/lure/surface.cpp88
-rw-r--r--engines/lure/surface.h16
-rw-r--r--engines/m4/actor.cpp3
-rw-r--r--engines/m4/animation.cpp4
-rw-r--r--engines/m4/compression.cpp1
-rw-r--r--engines/m4/console.cpp2
-rw-r--r--engines/m4/converse.cpp5
-rw-r--r--engines/m4/detection.cpp15
-rw-r--r--engines/m4/dialogs.cpp9
-rw-r--r--engines/m4/events.cpp2
-rw-r--r--engines/m4/font.cpp8
-rw-r--r--engines/m4/font.h4
-rw-r--r--engines/m4/globals.cpp2
-rw-r--r--engines/m4/graphics.cpp31
-rw-r--r--engines/m4/graphics.h33
-rw-r--r--engines/m4/gui.cpp13
-rw-r--r--engines/m4/m4.cpp12
-rw-r--r--engines/m4/m4_menus.cpp1
-rw-r--r--engines/m4/m4_scene.cpp15
-rw-r--r--engines/m4/m4_scene.h6
-rw-r--r--engines/m4/m4_views.cpp2
-rw-r--r--engines/m4/mads_anim.cpp4
-rw-r--r--engines/m4/mads_logic.cpp2
-rw-r--r--engines/m4/mads_menus.cpp22
-rw-r--r--engines/m4/mads_scene.cpp11
-rw-r--r--engines/m4/mads_views.cpp21
-rw-r--r--engines/m4/mads_views.h12
-rw-r--r--engines/m4/midi.cpp1
-rw-r--r--engines/m4/resource.cpp1
-rw-r--r--engines/m4/scene.cpp2
-rw-r--r--engines/m4/script.cpp1
-rw-r--r--engines/m4/sound.cpp1
-rw-r--r--engines/m4/sprite.cpp11
-rw-r--r--engines/m4/woodscript.cpp1
-rw-r--r--engines/m4/woodscript.h6
-rw-r--r--engines/m4/ws_sequence.cpp2
-rw-r--r--engines/made/database.cpp1
-rw-r--r--engines/made/graphics.cpp2
-rw-r--r--engines/made/made.cpp2
-rw-r--r--engines/made/music.cpp2
-rw-r--r--engines/made/pmvplayer.cpp2
-rw-r--r--engines/made/redreader.cpp1
-rw-r--r--engines/made/resource.cpp7
-rw-r--r--engines/made/resource.h1
-rw-r--r--engines/made/screen.cpp8
-rw-r--r--engines/made/script.h1
-rw-r--r--engines/made/scriptfuncs.cpp2
-rw-r--r--engines/made/scriptfuncs.h2
-rw-r--r--engines/metaengine.h4
-rw-r--r--engines/mohawk/bitmap.cpp22
-rw-r--r--engines/mohawk/console.cpp3
-rw-r--r--engines/mohawk/cstime.cpp5
-rw-r--r--engines/mohawk/cstime_cases.cpp2
-rw-r--r--engines/mohawk/cstime_game.cpp2
-rw-r--r--engines/mohawk/cstime_ui.cpp2
-rw-r--r--engines/mohawk/cstime_view.cpp2
-rw-r--r--engines/mohawk/cursors.cpp71
-rw-r--r--engines/mohawk/cursors.h14
-rw-r--r--engines/mohawk/detection.cpp5
-rw-r--r--engines/mohawk/detection_tables.h97
-rw-r--r--engines/mohawk/dialogs.cpp4
-rw-r--r--engines/mohawk/graphics.cpp17
-rw-r--r--engines/mohawk/graphics.h2
-rw-r--r--engines/mohawk/installer_archive.cpp2
-rw-r--r--engines/mohawk/installer_archive.h2
-rw-r--r--engines/mohawk/livingbooks.cpp8
-rw-r--r--engines/mohawk/livingbooks_code.cpp3
-rw-r--r--engines/mohawk/mohawk.cpp10
-rw-r--r--engines/mohawk/mohawk.h2
-rw-r--r--engines/mohawk/myst.cpp2
-rw-r--r--engines/mohawk/myst_areas.cpp4
-rw-r--r--engines/mohawk/myst_scripts.cpp2
-rw-r--r--engines/mohawk/myst_stacks/channelwood.cpp4
-rw-r--r--engines/mohawk/myst_stacks/credits.cpp1
-rw-r--r--engines/mohawk/myst_stacks/dni.cpp2
-rw-r--r--engines/mohawk/myst_stacks/mechanical.cpp3
-rw-r--r--engines/mohawk/myst_stacks/myst.cpp2
-rw-r--r--engines/mohawk/myst_stacks/preview.cpp1
-rw-r--r--engines/mohawk/myst_stacks/selenitic.cpp7
-rw-r--r--engines/mohawk/myst_stacks/slides.cpp1
-rw-r--r--engines/mohawk/myst_stacks/stoneship.cpp4
-rw-r--r--engines/mohawk/myst_state.cpp2
-rw-r--r--engines/mohawk/myst_state.h2
-rw-r--r--engines/mohawk/resource.cpp1
-rw-r--r--engines/mohawk/riven.h1
-rw-r--r--engines/mohawk/riven_external.cpp1
-rw-r--r--engines/mohawk/riven_scripts.cpp1
-rw-r--r--engines/mohawk/riven_scripts.h1
-rw-r--r--engines/mohawk/sound.cpp3
-rw-r--r--engines/mohawk/video.cpp11
-rw-r--r--engines/mohawk/view.cpp2
-rw-r--r--engines/parallaction/balloons.cpp6
-rw-r--r--engines/parallaction/callables_br.cpp2
-rw-r--r--engines/parallaction/detection.cpp1
-rw-r--r--engines/parallaction/dialogue.cpp1
-rw-r--r--engines/parallaction/disk.cpp5
-rw-r--r--engines/parallaction/disk.h10
-rw-r--r--engines/parallaction/disk_br.cpp3
-rw-r--r--engines/parallaction/disk_ns.cpp3
-rw-r--r--engines/parallaction/exec_br.cpp2
-rw-r--r--engines/parallaction/exec_ns.cpp1
-rw-r--r--engines/parallaction/font.cpp1
-rw-r--r--engines/parallaction/gfxbase.cpp1
-rw-r--r--engines/parallaction/graphics.cpp6
-rw-r--r--engines/parallaction/gui.cpp2
-rw-r--r--engines/parallaction/gui_br.cpp3
-rw-r--r--engines/parallaction/gui_ns.cpp5
-rw-r--r--engines/parallaction/input.cpp7
-rw-r--r--engines/parallaction/inventory.cpp4
-rw-r--r--engines/parallaction/objects.cpp2
-rw-r--r--engines/parallaction/parallaction.cpp5
-rw-r--r--engines/parallaction/parallaction.h3
-rw-r--r--engines/parallaction/parallaction_br.cpp1
-rw-r--r--engines/parallaction/parallaction_ns.cpp1
-rw-r--r--engines/parallaction/parser.cpp2
-rw-r--r--engines/parallaction/parser_br.cpp1
-rw-r--r--engines/parallaction/parser_ns.cpp2
-rw-r--r--engines/parallaction/saveload.cpp3
-rw-r--r--engines/parallaction/sound_br.cpp1
-rw-r--r--engines/parallaction/sound_ns.cpp2
-rw-r--r--engines/queen/command.cpp2
-rw-r--r--engines/queen/cutaway.cpp1
-rw-r--r--engines/queen/display.cpp1
-rw-r--r--engines/queen/display.h3
-rw-r--r--engines/queen/graphics.cpp3
-rw-r--r--engines/queen/input.cpp1
-rw-r--r--engines/queen/journal.cpp1
-rw-r--r--engines/queen/logic.cpp3
-rw-r--r--engines/queen/midiadlib.cpp1
-rw-r--r--engines/queen/music.cpp2
-rw-r--r--engines/queen/queen.cpp1
-rw-r--r--engines/queen/queen.h2
-rw-r--r--engines/queen/resource.cpp1
-rw-r--r--engines/queen/sound.cpp1
-rw-r--r--engines/queen/sound.h2
-rw-r--r--engines/queen/talk.cpp3
-rw-r--r--engines/queen/walk.cpp1
-rw-r--r--engines/saga/gfx.cpp3
-rw-r--r--engines/saga/gfx.h1
-rw-r--r--engines/saga/interface.cpp14
-rw-r--r--engines/saga/interface.h2
-rw-r--r--engines/saga/introproc_saga2.cpp5
-rw-r--r--engines/saga/render.cpp2
-rw-r--r--engines/saga/saga.h1
-rw-r--r--engines/saga/saveload.cpp4
-rw-r--r--engines/saga/shorten.cpp3
-rw-r--r--engines/savestate.cpp1
-rw-r--r--engines/savestate.h2
-rw-r--r--engines/sci/console.cpp4
-rw-r--r--engines/sci/decompressor.cpp3
-rw-r--r--engines/sci/decompressor.h4
-rw-r--r--engines/sci/engine/kfile.cpp1
-rw-r--r--engines/sci/engine/kmisc.cpp3
-rw-r--r--engines/sci/engine/kmovement.cpp2
-rw-r--r--engines/sci/engine/ksound.cpp1
-rw-r--r--engines/sci/engine/kstring.cpp10
-rw-r--r--engines/sci/engine/kvideo.cpp9
-rw-r--r--engines/sci/engine/object.h1
-rw-r--r--engines/sci/engine/script.cpp2
-rw-r--r--engines/sci/engine/script_patches.cpp41
-rw-r--r--engines/sci/engine/state.h4
-rw-r--r--engines/sci/engine/vm.cpp2
-rw-r--r--engines/sci/engine/workarounds.cpp6
-rw-r--r--engines/sci/graphics/cursor.cpp52
-rw-r--r--engines/sci/graphics/fontsjis.h2
-rw-r--r--engines/sci/graphics/frameout.cpp12
-rw-r--r--engines/sci/graphics/maciconbar.h2
-rw-r--r--engines/sci/graphics/paint.cpp2
-rw-r--r--engines/sci/graphics/paint16.cpp14
-rw-r--r--engines/sci/graphics/paint32.cpp5
-rw-r--r--engines/sci/graphics/palette.cpp2
-rw-r--r--engines/sci/graphics/picture.cpp26
-rw-r--r--engines/sci/graphics/portrait.cpp4
-rw-r--r--engines/sci/graphics/screen.cpp12
-rw-r--r--engines/sci/graphics/screen.h39
-rw-r--r--engines/sci/graphics/transitions.cpp3
-rw-r--r--engines/sci/parser/grammar.cpp1
-rw-r--r--engines/sci/resource.cpp5
-rw-r--r--engines/sci/resource_audio.cpp1
-rw-r--r--engines/sci/resource_intern.h2
-rw-r--r--engines/sci/sci.cpp2
-rw-r--r--engines/sci/sound/drivers/adlib.cpp2
-rw-r--r--engines/sci/sound/drivers/amigamac.cpp25
-rw-r--r--engines/sci/sound/drivers/cms.cpp2
-rw-r--r--engines/sci/sound/drivers/fb01.cpp1
-rw-r--r--engines/sci/sound/drivers/midi.cpp4
-rw-r--r--engines/sci/sound/drivers/pcjr.cpp3
-rw-r--r--engines/sci/sound/soundcmd.cpp28
-rw-r--r--engines/sci/video/robot_decoder.cpp5
-rw-r--r--engines/sci/video/robot_decoder.h1
-rw-r--r--engines/sci/video/seq_decoder.cpp6
-rw-r--r--engines/sci/video/seq_decoder.h10
-rw-r--r--engines/scumm/charset.cpp47
-rw-r--r--engines/scumm/costume.cpp5
-rw-r--r--engines/scumm/cursor.cpp2
-rw-r--r--engines/scumm/debugger.cpp1
-rw-r--r--engines/scumm/detection.cpp6
-rw-r--r--engines/scumm/detection_tables.h5
-rw-r--r--engines/scumm/dialogs.h4
-rw-r--r--engines/scumm/file_nes.cpp1
-rw-r--r--engines/scumm/gfx.cpp97
-rw-r--r--engines/scumm/gfx.h4
-rw-r--r--engines/scumm/gfxARM.s8
-rw-r--r--engines/scumm/gfx_towns.cpp2
-rw-r--r--engines/scumm/he/cup_player_he.cpp1
-rw-r--r--engines/scumm/he/logic_he.cpp416
-rw-r--r--engines/scumm/he/logic_he.h42
-rw-r--r--engines/scumm/he/palette_he.cpp1
-rw-r--r--engines/scumm/he/resource_he.cpp47
-rw-r--r--engines/scumm/imuse/imuse_part.cpp2
-rw-r--r--engines/scumm/imuse/sysex_scumm.cpp1
-rw-r--r--engines/scumm/imuse_digi/dimuse.h2
-rw-r--r--engines/scumm/imuse_digi/dimuse_codecs.cpp2
-rw-r--r--engines/scumm/midiparser_ro.cpp1
-rw-r--r--engines/scumm/palette.cpp3
-rw-r--r--engines/scumm/player_mod.h2
-rw-r--r--engines/scumm/player_nes.h2
-rw-r--r--engines/scumm/player_pce.h1
-rw-r--r--engines/scumm/player_sid.cpp2
-rw-r--r--engines/scumm/player_v4a.h1
-rw-r--r--engines/scumm/proc3ARM.s64
-rw-r--r--engines/scumm/saveload.h4
-rw-r--r--engines/scumm/scumm-md5.h3
-rw-r--r--engines/scumm/scumm.cpp8
-rw-r--r--engines/scumm/scumm.h11
-rw-r--r--engines/scumm/smush/channel.cpp2
-rw-r--r--engines/scumm/smush/channel.h2
-rw-r--r--engines/scumm/smush/codec37.cpp1
-rw-r--r--engines/scumm/smush/codec47.cpp3
-rw-r--r--engines/scumm/smush/saud_channel.cpp1
-rw-r--r--engines/scumm/smush/smush_mixer.h2
-rw-r--r--engines/scumm/smush/smush_player.cpp1
-rw-r--r--engines/scumm/sound.cpp4
-rw-r--r--engines/scumm/util.cpp1
-rw-r--r--engines/sky/autoroute.cpp1
-rw-r--r--engines/sky/compact.cpp5
-rw-r--r--engines/sky/compact.h2
-rw-r--r--engines/sky/control.cpp5
-rw-r--r--engines/sky/control.h2
-rw-r--r--engines/sky/debug.cpp2
-rw-r--r--engines/sky/detection.cpp1
-rw-r--r--engines/sky/disk.cpp4
-rw-r--r--engines/sky/disk.h3
-rw-r--r--engines/sky/intro.cpp1
-rw-r--r--engines/sky/logic.cpp7
-rw-r--r--engines/sky/mouse.cpp1
-rw-r--r--engines/sky/music/adlibchannel.cpp1
-rw-r--r--engines/sky/music/gmchannel.cpp1
-rw-r--r--engines/sky/music/gmmusic.cpp1
-rw-r--r--engines/sky/music/mt32music.cpp1
-rw-r--r--engines/sky/music/musicbase.cpp1
-rw-r--r--engines/sky/screen.cpp49
-rw-r--r--engines/sky/screen.h11
-rw-r--r--engines/sky/sky.cpp1
-rw-r--r--engines/sky/sky.h6
-rw-r--r--engines/sky/skydefs.h4
-rw-r--r--engines/sky/sound.cpp2
-rw-r--r--engines/sky/struc.h6
-rw-r--r--engines/sky/text.cpp16
-rw-r--r--engines/sky/text.h8
-rw-r--r--engines/sword1/animation.cpp7
-rw-r--r--engines/sword1/control.cpp2
-rw-r--r--engines/sword1/control.h2
-rw-r--r--engines/sword1/detection.cpp2
-rw-r--r--engines/sword1/eventman.cpp1
-rw-r--r--engines/sword1/logic.cpp3
-rw-r--r--engines/sword1/memman.cpp1
-rw-r--r--engines/sword1/menu.cpp2
-rw-r--r--engines/sword1/mouse.h1
-rw-r--r--engines/sword1/music.cpp3
-rw-r--r--engines/sword1/objectman.cpp1
-rw-r--r--engines/sword1/resman.cpp9
-rw-r--r--engines/sword1/router.cpp1
-rw-r--r--engines/sword1/screen.cpp3
-rw-r--r--engines/sword1/sound.cpp3
-rw-r--r--engines/sword1/sound.h2
-rw-r--r--engines/sword1/sword1.cpp1
-rw-r--r--engines/sword1/sword1.h6
-rw-r--r--engines/sword1/text.cpp3
-rw-r--r--engines/sword2/animation.cpp2
-rw-r--r--engines/sword2/controls.cpp4
-rw-r--r--engines/sword2/events.cpp1
-rw-r--r--engines/sword2/function.cpp17
-rw-r--r--engines/sword2/header.h10
-rw-r--r--engines/sword2/icons.cpp20
-rw-r--r--engines/sword2/interpreter.cpp3
-rw-r--r--engines/sword2/layers.cpp3
-rw-r--r--engines/sword2/logic.cpp1
-rw-r--r--engines/sword2/logic.h2
-rw-r--r--engines/sword2/maketext.cpp39
-rw-r--r--engines/sword2/maketext.h12
-rw-r--r--engines/sword2/memory.cpp1
-rw-r--r--engines/sword2/mouse.cpp23
-rw-r--r--engines/sword2/music.cpp41
-rw-r--r--engines/sword2/object.h2
-rw-r--r--engines/sword2/palette.cpp27
-rw-r--r--engines/sword2/protocol.cpp4
-rw-r--r--engines/sword2/render.cpp16
-rw-r--r--engines/sword2/resman.cpp1
-rw-r--r--engines/sword2/resman.h2
-rw-r--r--engines/sword2/router.cpp7
-rw-r--r--engines/sword2/router.h2
-rw-r--r--engines/sword2/saveload.cpp1
-rw-r--r--engines/sword2/screen.cpp17
-rw-r--r--engines/sword2/screen.h6
-rw-r--r--engines/sword2/scroll.cpp2
-rw-r--r--engines/sword2/sound.cpp1
-rw-r--r--engines/sword2/sound.h1
-rw-r--r--engines/sword2/speech.cpp9
-rw-r--r--engines/sword2/sprite.cpp32
-rw-r--r--engines/sword2/startup.cpp1
-rw-r--r--engines/sword2/sword2.cpp1
-rw-r--r--engines/sword2/sync.cpp1
-rw-r--r--engines/sword25/detection.cpp2
-rw-r--r--engines/sword25/fmv/movieplayer.cpp8
-rw-r--r--engines/sword25/fmv/theora_decoder.cpp3
-rw-r--r--engines/sword25/fmv/theora_decoder.h3
-rw-r--r--engines/sword25/gfx/graphicengine.cpp45
-rw-r--r--engines/sword25/gfx/graphicengine.h14
-rw-r--r--engines/sword25/gfx/image/pngloader.cpp13
-rw-r--r--engines/sword25/gfx/image/pngloader.h9
-rw-r--r--engines/sword25/gfx/image/renderedimage.cpp85
-rw-r--r--engines/sword25/gfx/image/swimage.cpp4
-rw-r--r--engines/sword25/gfx/image/vectorimagerenderer.cpp11
-rw-r--r--engines/sword25/gfx/screenshot.cpp5
-rw-r--r--engines/sword25/gfx/text.cpp4
-rw-r--r--engines/sword25/kernel/filesystemutil.cpp3
-rw-r--r--engines/sword25/kernel/inputpersistenceblock.cpp2
-rw-r--r--engines/sword25/kernel/kernel.cpp4
-rw-r--r--engines/sword25/kernel/kernel.h1
-rw-r--r--engines/sword25/kernel/kernel_script.cpp117
-rw-r--r--engines/sword25/kernel/objectregistry.h1
-rw-r--r--engines/sword25/kernel/persistenceservice.cpp44
-rw-r--r--engines/sword25/kernel/resmanager.cpp15
-rw-r--r--engines/sword25/kernel/resmanager.h5
-rw-r--r--engines/sword25/script/luacallback.cpp2
-rw-r--r--engines/sword25/sfx/soundengine.cpp2
-rw-r--r--engines/sword25/sword25.cpp16
-rw-r--r--engines/sword25/sword25.h10
-rw-r--r--engines/sword25/util/pluto/Makefile29
-rw-r--r--engines/sword25/util/pluto/pdep/lauxlib.h174
-rw-r--r--engines/sword25/util/pluto/pdep/ldo.h57
-rw-r--r--engines/sword25/util/pluto/pdep/lfunc.h34
-rw-r--r--engines/sword25/util/pluto/pdep/lgc.h110
-rw-r--r--engines/sword25/util/pluto/pdep/llimits.h128
-rw-r--r--engines/sword25/util/pluto/pdep/lobject.h381
-rw-r--r--engines/sword25/util/pluto/pdep/lopcodes.h268
-rw-r--r--engines/sword25/util/pluto/pdep/lstate.h169
-rw-r--r--engines/sword25/util/pluto/pdep/lstring.h31
-rw-r--r--engines/sword25/util/pluto/pdep/ltm.h54
-rw-r--r--engines/sword25/util/pluto/pdep/lua.h388
-rw-r--r--engines/sword25/util/pluto/pdep/lzio.h2
-rw-r--r--engines/sword25/util/pluto/pdep/pdep.h21
-rw-r--r--engines/sword25/util/pluto/pptest.cpp95
-rw-r--r--engines/sword25/util/pluto/pptest.lua168
-rw-r--r--engines/sword25/util/pluto/puptest.cpp81
-rw-r--r--engines/sword25/util/pluto/puptest.lua93
-rw-r--r--engines/teenagent/actor.cpp1
-rw-r--r--engines/teenagent/animation.cpp1
-rw-r--r--engines/teenagent/callbacks.cpp2
-rw-r--r--engines/teenagent/console.h4
-rw-r--r--engines/teenagent/font.cpp4
-rw-r--r--engines/teenagent/font.h1
-rw-r--r--engines/teenagent/inventory.cpp1
-rw-r--r--engines/teenagent/music.cpp2
-rw-r--r--engines/teenagent/resources.cpp1
-rw-r--r--engines/teenagent/scene.cpp5
-rw-r--r--engines/teenagent/scene.h4
-rw-r--r--engines/teenagent/segment.cpp1
-rw-r--r--engines/teenagent/surface.cpp2
-rw-r--r--engines/teenagent/surface.h6
-rw-r--r--engines/teenagent/teenagent.cpp2
-rw-r--r--engines/testbed/detection.cpp2
-rw-r--r--engines/testbed/events.cpp7
-rw-r--r--engines/testbed/graphics.cpp9
-rw-r--r--engines/testbed/savegame.cpp6
-rw-r--r--engines/testbed/sound.cpp2
-rw-r--r--engines/testbed/testbed.cpp7
-rw-r--r--engines/testbed/testbed.h4
-rw-r--r--engines/testbed/testsuite.h5
-rw-r--r--engines/tinsel/actors.cpp35
-rw-r--r--engines/tinsel/actors.h2
-rw-r--r--engines/tinsel/adpcm.cpp7
-rw-r--r--engines/tinsel/anim.cpp1
-rw-r--r--engines/tinsel/background.cpp16
-rw-r--r--engines/tinsel/background.h4
-rw-r--r--engines/tinsel/bg.cpp3
-rw-r--r--engines/tinsel/bmv.cpp24
-rw-r--r--engines/tinsel/bmv.h4
-rw-r--r--engines/tinsel/dialogs.cpp46
-rw-r--r--engines/tinsel/dialogs.h2
-rw-r--r--engines/tinsel/drives.cpp4
-rw-r--r--engines/tinsel/faders.cpp68
-rw-r--r--engines/tinsel/faders.h2
-rw-r--r--engines/tinsel/font.cpp4
-rw-r--r--engines/tinsel/graphics.cpp50
-rw-r--r--engines/tinsel/graphics.h2
-rw-r--r--engines/tinsel/handle.cpp1
-rw-r--r--engines/tinsel/mareels.cpp1
-rw-r--r--engines/tinsel/move.cpp28
-rw-r--r--engines/tinsel/object.cpp10
-rw-r--r--engines/tinsel/object.h4
-rw-r--r--engines/tinsel/palette.cpp182
-rw-r--r--engines/tinsel/palette.h42
-rw-r--r--engines/tinsel/pcode.cpp1
-rw-r--r--engines/tinsel/pcode.h2
-rw-r--r--engines/tinsel/pdisplay.cpp24
-rw-r--r--engines/tinsel/pid.h6
-rw-r--r--engines/tinsel/polygons.cpp39
-rw-r--r--engines/tinsel/polygons.h4
-rw-r--r--engines/tinsel/rince.cpp11
-rw-r--r--engines/tinsel/rince.h8
-rw-r--r--engines/tinsel/saveload.cpp26
-rw-r--r--engines/tinsel/savescn.cpp4
-rw-r--r--engines/tinsel/scene.cpp3
-rw-r--r--engines/tinsel/sched.cpp1
-rw-r--r--engines/tinsel/scn.cpp3
-rw-r--r--engines/tinsel/sound.cpp24
-rw-r--r--engines/tinsel/strres.cpp1
-rw-r--r--engines/tinsel/sysvar.cpp6
-rw-r--r--engines/tinsel/sysvar.h4
-rw-r--r--engines/tinsel/text.cpp12
-rw-r--r--engines/tinsel/text.h8
-rw-r--r--engines/tinsel/timers.cpp2
-rw-r--r--engines/tinsel/timers.h2
-rw-r--r--engines/tinsel/tinlib.cpp43
-rw-r--r--engines/tinsel/tinlib.h2
-rw-r--r--engines/tinsel/tinsel.cpp14
-rw-r--r--engines/tinsel/tinsel.h4
-rw-r--r--engines/toon/anim.cpp3
-rw-r--r--engines/toon/audio.cpp2
-rw-r--r--engines/toon/character.cpp8
-rw-r--r--engines/toon/drew.cpp2
-rw-r--r--engines/toon/flux.cpp2
-rw-r--r--engines/toon/font.cpp10
-rw-r--r--engines/toon/hotspot.cpp2
-rw-r--r--engines/toon/movie.cpp11
-rw-r--r--engines/toon/path.cpp8
-rw-r--r--engines/toon/picture.cpp3
-rw-r--r--engines/toon/resource.cpp1
-rw-r--r--engines/toon/script.cpp3
-rw-r--r--engines/toon/script_func.cpp3
-rw-r--r--engines/toon/state.cpp2
-rw-r--r--engines/toon/text.cpp2
-rw-r--r--engines/toon/tools.cpp2
-rw-r--r--engines/toon/toon.cpp14
-rw-r--r--engines/toon/toon.h1
-rw-r--r--engines/touche/menu.cpp4
-rw-r--r--engines/touche/midi.h2
-rw-r--r--engines/touche/resource.cpp1
-rw-r--r--engines/touche/saveload.cpp1
-rw-r--r--engines/touche/touche.cpp9
-rw-r--r--engines/tsage/converse.cpp148
-rw-r--r--engines/tsage/converse.h30
-rw-r--r--engines/tsage/core.cpp857
-rw-r--r--engines/tsage/core.h223
-rw-r--r--engines/tsage/debugger.cpp302
-rw-r--r--engines/tsage/debugger.h8
-rw-r--r--engines/tsage/detection.cpp12
-rw-r--r--engines/tsage/detection_tables.h32
-rw-r--r--engines/tsage/dialogs.cpp98
-rw-r--r--engines/tsage/dialogs.h8
-rw-r--r--engines/tsage/events.cpp82
-rw-r--r--engines/tsage/events.h9
-rw-r--r--engines/tsage/globals.cpp60
-rw-r--r--engines/tsage/globals.h20
-rw-r--r--engines/tsage/graphics.cpp196
-rw-r--r--engines/tsage/graphics.h44
-rw-r--r--engines/tsage/module.mk1
-rw-r--r--engines/tsage/resources.cpp135
-rw-r--r--engines/tsage/resources.h41
-rw-r--r--engines/tsage/ringworld_demo.cpp58
-rw-r--r--engines/tsage/ringworld_demo.h52
-rw-r--r--engines/tsage/ringworld_logic.cpp527
-rw-r--r--engines/tsage/ringworld_logic.h74
-rw-r--r--engines/tsage/ringworld_scenes1.cpp523
-rw-r--r--engines/tsage/ringworld_scenes1.h59
-rw-r--r--engines/tsage/ringworld_scenes10.cpp589
-rw-r--r--engines/tsage/ringworld_scenes10.h21
-rw-r--r--engines/tsage/ringworld_scenes2.cpp58
-rw-r--r--engines/tsage/ringworld_scenes3.cpp412
-rw-r--r--engines/tsage/ringworld_scenes3.h33
-rw-r--r--engines/tsage/ringworld_scenes4.cpp4
-rw-r--r--engines/tsage/ringworld_scenes4.h2
-rw-r--r--engines/tsage/ringworld_scenes5.cpp972
-rw-r--r--engines/tsage/ringworld_scenes5.h69
-rw-r--r--engines/tsage/ringworld_scenes6.cpp173
-rw-r--r--engines/tsage/ringworld_scenes6.h8
-rw-r--r--engines/tsage/ringworld_scenes8.cpp744
-rw-r--r--engines/tsage/ringworld_scenes8.h11
-rw-r--r--engines/tsage/saveload.cpp87
-rw-r--r--engines/tsage/saveload.h36
-rw-r--r--engines/tsage/scenes.cpp61
-rw-r--r--engines/tsage/scenes.h7
-rw-r--r--engines/tsage/sound.cpp6
-rw-r--r--engines/tsage/sound.h2
-rw-r--r--engines/tsage/staticres.cpp3
-rw-r--r--engines/tsage/staticres.h4
-rw-r--r--engines/tsage/tsage.cpp30
-rw-r--r--engines/tsage/tsage.h10
-rw-r--r--engines/tucker/locations.cpp1
-rw-r--r--engines/tucker/resource.cpp1
-rw-r--r--engines/tucker/saveload.cpp1
-rw-r--r--engines/tucker/sequences.cpp3
-rw-r--r--engines/tucker/tucker.cpp7
825 files changed, 7841 insertions, 7540 deletions
diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
index bf152ce90a..8170452102 100644
--- a/engines/advancedDetector.cpp
+++ b/engines/advancedDetector.cpp
@@ -23,7 +23,8 @@
*
*/
-#include "base/plugins.h"
+// FIXME: Avoid using printf
+#define FORBIDDEN_SYMBOL_EXCEPTION_printf
#include "common/debug.h"
#include "common/util.h"
@@ -32,6 +33,7 @@
#include "common/macresman.h"
#include "common/md5.h"
#include "common/config-manager.h"
+#include "common/textconsole.h"
#include "engines/advancedDetector.h"
diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h
index 515127b23d..757fb12f33 100644
--- a/engines/advancedDetector.h
+++ b/engines/advancedDetector.h
@@ -25,11 +25,13 @@
#ifndef ENGINES_ADVANCED_DETECTOR_H
#define ENGINES_ADVANCED_DETECTOR_H
-#include "common/fs.h"
-#include "common/error.h"
-
#include "engines/metaengine.h"
+namespace Common {
+class Error;
+class FSList;
+}
+
struct ADGameFileDescription {
const char *fileName;
@@ -62,8 +64,8 @@ struct ADGameDescription {
Common::Platform platform;
/**
- * A bitmask of extra flags. The top 8 bits are reserved for generic flags
- * defined in the ADGameFlags. This leaves 24 flags to be used by client
+ * A bitmask of extra flags. The top 16 bits are reserved for generic flags
+ * defined in the ADGameFlags. This leaves 16 bits to be used by client
* code.
*/
uint32 flags;
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index 632587f7f7..a69d19f06c 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -32,6 +32,7 @@
#include "common/config-manager.h"
#include "common/debug-channels.h"
#include "common/random.h"
+#include "common/textconsole.h"
#include "engines/util.h"
diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index df19f55b52..c71a0ebf64 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -27,9 +27,10 @@
#define AGI_H
#include "common/scummsys.h"
-#include "common/endian.h"
+#include "common/error.h"
#include "common/util.h"
#include "common/file.h"
+#include "common/rect.h"
#include "common/stack.h"
#include "common/system.h"
@@ -45,7 +46,9 @@
#include "agi/sound.h"
-namespace Common { class RandomSource; }
+namespace Common {
+class RandomSource;
+}
/**
* This is the namespace of the AGI engine.
@@ -92,7 +95,7 @@ typedef signed int Err;
#define CRYPT_KEY_SIERRA "Avis Durgan"
#define CRYPT_KEY_AGDS "Alex Simkin"
-#define MSG_BOX_COLOUR 0x0f // White
+#define MSG_BOX_COLOR 0x0f // White
#define MSG_BOX_TEXT 0x00 // Black
#define MSG_BOX_LINE 0x04 // Red
#define BUTTON_BORDER 0x00 // Black
@@ -693,7 +696,6 @@ public:
class GfxMgr;
class SpritesMgr;
class Menu;
-class SearchTree;
// Image stack support
struct ImageStackElement {
@@ -727,7 +729,7 @@ protected:
virtual Common::Error run() {
Common::Error err;
err = init();
- if (err != Common::kNoError)
+ if (err.getCode() != Common::kNoError)
return err;
return go();
}
@@ -935,7 +937,7 @@ public:
private:
// Some submethods of testIfCode
uint8 testObjRight(uint8, uint8, uint8, uint8, uint8);
- uint8 testObjCentre(uint8, uint8, uint8, uint8, uint8);
+ uint8 testObjCenter(uint8, uint8, uint8, uint8, uint8);
uint8 testObjInBox(uint8, uint8, uint8, uint8, uint8);
uint8 testPosn(uint8, uint8, uint8, uint8, uint8);
uint8 testSaid(uint8, uint8 *);
diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp
index 0a53f0c4f4..fb92344de2 100644
--- a/engines/agi/detection.cpp
+++ b/engines/agi/detection.cpp
@@ -23,12 +23,16 @@
*
*/
+// FIXME: Avoid using printf
+#define FORBIDDEN_SYMBOL_EXCEPTION_printf
+
#include "base/plugins.h"
#include "engines/advancedDetector.h"
#include "common/config-manager.h"
#include "common/file.h"
#include "common/savefile.h"
+#include "common/textconsole.h"
#include "graphics/thumbnail.h"
#include "graphics/surface.h"
diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp
index 58982a2931..f0d38761d0 100644
--- a/engines/agi/graphics.cpp
+++ b/engines/agi/graphics.cpp
@@ -24,9 +24,10 @@
*/
#include "common/file.h"
-
+#include "common/textconsole.h"
#include "graphics/cursorman.h"
+#include "graphics/palette.h"
#include "agi/agi.h"
#include "agi/graphics.h"
@@ -685,14 +686,14 @@ void GfxMgr::drawFrame(int x1, int y1, int x2, int y2, int c1, int c2) {
}
}
-void GfxMgr::drawBox(int x1, int y1, int x2, int y2, int colour1, int colour2, int m) {
+void GfxMgr::drawBox(int x1, int y1, int x2, int y2, int color1, int color2, int m) {
x1 += m;
y1 += m;
x2 -= m;
y2 -= m;
- drawRectangle(x1, y1, x2, y2, colour1);
- drawFrame(x1 + 2, y1 + 2, x2 - 2, y2 - 2, colour2, colour2);
+ drawRectangle(x1, y1, x2, y2, color1);
+ drawFrame(x1 + 2, y1 + 2, x2 - 2, y2 - 2, color2, color2);
flushBlock(x1, y1, x2, y2);
}
@@ -752,7 +753,7 @@ void GfxMgr::rawDrawButton(int x, int y, const char *s, int fgcolor, int bgcolor
// Draw a filled rectangle that's larger than the button. Used for drawing
// a border around the button as the button itself is drawn after this.
- drawRectangle(x1, y1, x2, y2, border ? BUTTON_BORDER : MSG_BOX_COLOUR);
+ drawRectangle(x1, y1, x2, y2, border ? BUTTON_BORDER : MSG_BOX_COLOR);
while (*s) {
putTextCharacter(0, x + textOffset, y + textOffset, *s++, fgcolor, bgcolor);
diff --git a/engines/agi/inv.cpp b/engines/agi/inv.cpp
index 46dfcb2b43..f1d9523887 100644
--- a/engines/agi/inv.cpp
+++ b/engines/agi/inv.cpp
@@ -66,7 +66,7 @@ namespace Agi {
#define SELECT_MSG_RU "ENTER - \xa2\xeb\xa1\xe0\xa0\xe2\xec, ESC - \xae\xe2\xac\xa5\xad\xa8\xe2\xec."
void AgiEngine::printItem(int n, int fg, int bg) {
- printText(objectName(_intobj[n]), 0, n % 2 ? 39 - strlen(objectName(_intobj[n])) : 1,
+ printText(objectName(_intobj[n]), 0, ((n % 2) ? 39 - strlen(objectName(_intobj[n])) : 1),
(n / 2) + 2, 40, fg, bg);
}
diff --git a/engines/agi/keyboard.cpp b/engines/agi/keyboard.cpp
index 344654128d..95211f8e3c 100644
--- a/engines/agi/keyboard.cpp
+++ b/engines/agi/keyboard.cpp
@@ -279,7 +279,7 @@ void AgiEngine::handleGetstring(int key) {
void AgiEngine::handleKeys(int key) {
uint8 *p = NULL;
int c = 0;
- static uint8 formattedEntry[256];
+ static uint8 formattedEntry[40];
int l = _game.lineUserInput;
int fg = _game.colorFg, bg = _game.colorBg;
int promptLength = strlen(agiSprintf(_game.strings[0]));
@@ -298,7 +298,7 @@ void AgiEngine::handleKeys(int key) {
;
// Copy to internal buffer
- for (; *p; p++) {
+ for (; *p && c < 40-1; p++) {
// Squash spaces
if (*p == 0x20 && *(p + 1) == 0x20) {
p++;
diff --git a/engines/agi/loader_v2.cpp b/engines/agi/loader_v2.cpp
index 8780e1dab8..0141a61065 100644
--- a/engines/agi/loader_v2.cpp
+++ b/engines/agi/loader_v2.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/textconsole.h"
+
#include "agi/agi.h"
namespace Agi {
diff --git a/engines/agi/loader_v3.cpp b/engines/agi/loader_v3.cpp
index 18ea4cae7d..025e755c8b 100644
--- a/engines/agi/loader_v3.cpp
+++ b/engines/agi/loader_v3.cpp
@@ -28,6 +28,7 @@
#include "common/config-manager.h"
#include "common/fs.h"
+#include "common/textconsole.h"
namespace Agi {
diff --git a/engines/agi/lzw.cpp b/engines/agi/lzw.cpp
index f645cb16d3..495d6458da 100644
--- a/engines/agi/lzw.cpp
+++ b/engines/agi/lzw.cpp
@@ -36,6 +36,8 @@
#include "agi/agi.h"
#include "agi/lzw.h"
+#include "common/textconsole.h"
+
namespace Agi {
diff --git a/engines/agi/menu.cpp b/engines/agi/menu.cpp
index 5ec4908e4a..b62bcd9ad8 100644
--- a/engines/agi/menu.cpp
+++ b/engines/agi/menu.cpp
@@ -117,7 +117,7 @@ void Menu::drawMenuOptionHilite(int hMenu, int vMenu) {
AgiMenuOption *d = getMenuOption(hMenu, vMenu);
// Disabled menu items are "greyed out" with a checkerboard effect,
- // rather than having a different colour. -- dsymonds
+ // rather than having a different color. -- dsymonds
_vm->printText(d->text, 0, m->wincol + 1, vMenu + 2, m->width + 2,
MENU_BG, MENU_FG, !d->enabled);
}
diff --git a/engines/agi/objects.cpp b/engines/agi/objects.cpp
index d942a2b538..bea53d7fa4 100644
--- a/engines/agi/objects.cpp
+++ b/engines/agi/objects.cpp
@@ -25,6 +25,8 @@
#include "agi/agi.h"
+#include "common/textconsole.h"
+
namespace Agi {
int AgiEngine::allocObjects(int n) {
diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index 2ea53e57ad..e1f99456e8 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -32,6 +32,7 @@
#include "agi/menu.h"
#include "common/random.h"
+#include "common/textconsole.h"
namespace Agi {
diff --git a/engines/agi/op_test.cpp b/engines/agi/op_test.cpp
index ab4f6cadc5..f5234d4e6c 100644
--- a/engines/agi/op_test.cpp
+++ b/engines/agi/op_test.cpp
@@ -132,8 +132,8 @@ uint8 AgiEngine::testObjInBox(uint8 n, uint8 x1, uint8 y1, uint8 x2, uint8 y2) {
v->yPos >= y1 && v->xPos + v->xSize - 1 <= x2 && v->yPos <= y2;
}
-// if n is in centre of box
-uint8 AgiEngine::testObjCentre(uint8 n, uint8 x1, uint8 y1, uint8 x2, uint8 y2) {
+// if n is in center of box
+uint8 AgiEngine::testObjCenter(uint8 n, uint8 x1, uint8 y1, uint8 x2, uint8 y2) {
VtEntry *v = &_game.viewTable[n];
return v->xPos + v->xSize / 2 >= x1 &&
@@ -311,7 +311,7 @@ int AgiEngine::testIfCode(int lognum) {
ec = testObjInBox(p[0], p[1], p[2], p[3], p[4]);
break;
case 0x11:
- ec = testObjCentre(p[0], p[1], p[2], p[3], p[4]);
+ ec = testObjCenter(p[0], p[1], p[2], p[3], p[4]);
break;
case 0x12:
ec = testObjRight(p[0], p[1], p[2], p[3], p[4]);
diff --git a/engines/agi/picture.cpp b/engines/agi/picture.cpp
index 47b72cc8c6..8951fc81df 100644
--- a/engines/agi/picture.cpp
+++ b/engines/agi/picture.cpp
@@ -26,6 +26,8 @@
#include "agi/agi.h"
#include "agi/graphics.h"
+#include "common/textconsole.h"
+
namespace Agi {
PictureMgr::PictureMgr(AgiBase *agi, GfxMgr *gfx) {
@@ -601,7 +603,7 @@ void PictureMgr::drawPicture() {
_patCode = nextByte();
plotBrush();
break;
- case 0xf0: // set colour on screen (AGI pic v2)
+ case 0xf0: // set color on screen (AGI pic v2)
if (_pictureVersion == AGIPIC_V15)
break;
@@ -615,7 +617,7 @@ void PictureMgr::drawPicture() {
_scrColor &= 0xF; // for v3 drawing diff
_scrOn = true;
_priOn = false;
- } else if (_pictureVersion == AGIPIC_V15) { // set colour on screen
+ } else if (_pictureVersion == AGIPIC_V15) { // set color on screen
_scrColor = nextByte();
_scrColor &= 0xF;
_scrOn = true;
@@ -623,7 +625,7 @@ void PictureMgr::drawPicture() {
_scrOn = false;
}
break;
- case 0xf2: // set colour on priority (AGI pic v2)
+ case 0xf2: // set color on priority (AGI pic v2)
if (_pictureVersion == AGIPIC_V15)
break;
diff --git a/engines/agi/preagi.cpp b/engines/agi/preagi.cpp
index 7457a317c2..c51c53e76e 100644
--- a/engines/agi/preagi.cpp
+++ b/engines/agi/preagi.cpp
@@ -26,6 +26,7 @@
#include "common/config-manager.h"
#include "common/debug-channels.h"
#include "common/random.h"
+#include "common/textconsole.h"
#include "audio/mididrv.h"
diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp
index 10ca797587..64fc4e9ae5 100644
--- a/engines/agi/preagi_mickey.cpp
+++ b/engines/agi/preagi_mickey.cpp
@@ -25,6 +25,7 @@
#include "common/events.h"
#include "common/savefile.h"
+#include "common/textconsole.h"
#include "graphics/cursorman.h"
diff --git a/engines/agi/preagi_troll.cpp b/engines/agi/preagi_troll.cpp
index 4e87c8063c..76849949c7 100644
--- a/engines/agi/preagi_troll.cpp
+++ b/engines/agi/preagi_troll.cpp
@@ -28,6 +28,7 @@
#include "agi/graphics.h"
#include "common/events.h"
+#include "common/textconsole.h"
#include "graphics/cursorman.h"
diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp
index e97c144872..ef35a0b4e0 100644
--- a/engines/agi/preagi_winnie.cpp
+++ b/engines/agi/preagi_winnie.cpp
@@ -32,6 +32,7 @@
#include "common/events.h"
#include "common/memstream.h"
#include "common/savefile.h"
+#include "common/textconsole.h"
namespace Agi {
@@ -216,15 +217,9 @@ int Winnie::getObjInRoom(int iRoom) {
return 0;
}
-#define setTakeDrop() {\
- if (getObjInRoom(_room))\
- fCanSel[IDI_WTP_SEL_TAKE] = true;\
- else\
- fCanSel[IDI_WTP_SEL_TAKE] = false;\
- if (_game.iObjHave)\
- fCanSel[IDI_WTP_SEL_DROP] = true;\
- else\
- fCanSel[IDI_WTP_SEL_DROP] = false;\
+void Winnie::setTakeDrop(int fCanSel[]) {
+ fCanSel[IDI_WTP_SEL_TAKE] = getObjInRoom(_room);
+ fCanSel[IDI_WTP_SEL_DROP] = _game.iObjHave;
}
void Winnie::setFlag(int iFlag) {
@@ -280,7 +275,7 @@ int Winnie::parser(int pc, int index, uint8 *buffer) {
fCanSel[IDI_WTP_SEL_EAST] = fCanSel[IDI_WTP_SEL_WEST] = true;
// check if object in room or player carrying one
- setTakeDrop();
+ setTakeDrop(fCanSel);
// check which rows have a menu option
for (iSel = 0; iSel < IDI_WTP_MAX_OPTION; iSel++) {
@@ -366,11 +361,11 @@ int Winnie::parser(int pc, int index, uint8 *buffer) {
break;
case IDI_WTP_SEL_TAKE:
takeObj(_room);
- setTakeDrop();
+ setTakeDrop(fCanSel);
break;
case IDI_WTP_SEL_DROP:
dropObj(_room);
- setTakeDrop();
+ setTakeDrop(fCanSel);
break;
}
}
@@ -795,13 +790,12 @@ void Winnie::getMenuMouseSel(int *iSel, int fCanSel[], int x, int y) {
}
}
-#define makeSel() {\
- if (fCanSel[*iSel]) {\
- return;\
- } else {\
- keyHelp();\
- clrMenuSel(iSel, fCanSel);\
- }\
+void Winnie::makeSel(int *iSel, int fCanSel[]) {
+ if (fCanSel[*iSel])
+ return;
+
+ keyHelp();
+ clrMenuSel(iSel, fCanSel);
}
void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) {
@@ -843,22 +837,22 @@ void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) {
// Click to move
if (fCanSel[IDI_WTP_SEL_NORTH] && hotspotNorth.contains(event.mouse.x, event.mouse.y)) {
*iSel = IDI_WTP_SEL_NORTH;
- makeSel();
+ makeSel(iSel, fCanSel);
_vm->_gfx->setCursorPalette(false);
return;
} else if (fCanSel[IDI_WTP_SEL_SOUTH] && hotspotSouth.contains(event.mouse.x, event.mouse.y)) {
*iSel = IDI_WTP_SEL_SOUTH;
- makeSel();
+ makeSel(iSel, fCanSel);
_vm->_gfx->setCursorPalette(false);
return;
} else if (fCanSel[IDI_WTP_SEL_WEST] && hotspotWest.contains(event.mouse.x, event.mouse.y)) {
*iSel = IDI_WTP_SEL_WEST;
- makeSel();
+ makeSel(iSel, fCanSel);
_vm->_gfx->setCursorPalette(false);
return;
} else if (fCanSel[IDI_WTP_SEL_EAST] && hotspotEast.contains(event.mouse.x, event.mouse.y)) {
*iSel = IDI_WTP_SEL_EAST;
- makeSel();
+ makeSel(iSel, fCanSel);
_vm->_gfx->setCursorPalette(false);
return;
} else {
@@ -943,31 +937,31 @@ void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) {
break;
case Common::KEYCODE_n:
*iSel = IDI_WTP_SEL_NORTH;
- makeSel();
+ makeSel(iSel, fCanSel);
break;
case Common::KEYCODE_s:
if (event.kbd.flags & Common::KBD_CTRL) {
_vm->flipflag(fSoundOn);
} else {
*iSel = IDI_WTP_SEL_SOUTH;
- makeSel();
+ makeSel(iSel, fCanSel);
}
break;
case Common::KEYCODE_e:
*iSel = IDI_WTP_SEL_EAST;
- makeSel();
+ makeSel(iSel, fCanSel);
break;
case Common::KEYCODE_w:
*iSel = IDI_WTP_SEL_WEST;
- makeSel();
+ makeSel(iSel, fCanSel);
break;
case Common::KEYCODE_t:
*iSel = IDI_WTP_SEL_TAKE;
- makeSel();
+ makeSel(iSel, fCanSel);
break;
case Common::KEYCODE_d:
*iSel = IDI_WTP_SEL_DROP;
- makeSel();
+ makeSel(iSel, fCanSel);
break;
case Common::KEYCODE_RETURN:
switch (*iSel) {
diff --git a/engines/agi/preagi_winnie.h b/engines/agi/preagi_winnie.h
index 5a5472feb0..0187d80326 100644
--- a/engines/agi/preagi_winnie.h
+++ b/engines/agi/preagi_winnie.h
@@ -342,6 +342,8 @@ private:
void saveGame();
void loadGame();
void dropObjRnd();
+ void setTakeDrop(int[]);
+ void makeSel(int*, int[]);
void wind();
void mist();
diff --git a/engines/agi/predictive.cpp b/engines/agi/predictive.cpp
index 0230b9bd74..96ad78ace5 100644
--- a/engines/agi/predictive.cpp
+++ b/engines/agi/predictive.cpp
@@ -28,6 +28,7 @@
#include "agi/keyboard.h"
#include "common/config-manager.h"
+#include "common/textconsole.h"
#ifdef __DS__
#include "wordcompletion.h"
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp
index 9194cc642c..c8df726fc7 100644
--- a/engines/agi/saveload.cpp
+++ b/engines/agi/saveload.cpp
@@ -31,6 +31,7 @@
#include "common/file.h"
#include "common/config-manager.h"
#include "common/savefile.h"
+#include "common/textconsole.h"
#include "graphics/thumbnail.h"
#include "graphics/surface.h"
@@ -597,7 +598,7 @@ int AgiEngine::selectSlot() {
int hm = 1, vm = 3; // box margins
int xmin, xmax, slotClicked;
char desc[NUM_VISIBLE_SLOTS][40];
- int textCentre, buttonLength, buttonX[2], buttonY;
+ int textCenter, buttonLength, buttonX[2], buttonY;
const char *buttonText[] = { " OK ", "Cancel", NULL };
_noSaveLoadAllowed = true;
@@ -606,10 +607,10 @@ int AgiEngine::selectSlot() {
getSavegameDescription(_firstSlot + i, desc[i]);
}
- textCentre = GFX_WIDTH / CHAR_LINES / 2;
+ textCenter = GFX_WIDTH / CHAR_LINES / 2;
buttonLength = 6;
- buttonX[0] = (textCentre - 3 * buttonLength / 2) * CHAR_COLS;
- buttonX[1] = (textCentre + buttonLength / 2) * CHAR_COLS;
+ buttonX[0] = (textCenter - 3 * buttonLength / 2) * CHAR_COLS;
+ buttonX[1] = (textCenter + buttonLength / 2) * CHAR_COLS;
buttonY = (vm + 17) * CHAR_LINES;
for (i = 0; i < 2; i++)
@@ -642,8 +643,8 @@ int AgiEngine::selectSlot() {
for (i = 0; i < NUM_VISIBLE_SLOTS; i++) {
sprintf(dstr, "[%2d. %-28.28s]", i + _firstSlot, desc[i]);
printText(dstr, 0, hm + 1, vm + 4 + i,
- (40 - 2 * hm) - 1, i == active ? MSG_BOX_COLOUR : MSG_BOX_TEXT,
- i == active ? MSG_BOX_TEXT : MSG_BOX_COLOUR);
+ (40 - 2 * hm) - 1, i == active ? MSG_BOX_COLOR : MSG_BOX_TEXT,
+ i == active ? MSG_BOX_TEXT : MSG_BOX_COLOR);
}
char upArrow[] = "^";
@@ -651,11 +652,11 @@ int AgiEngine::selectSlot() {
char scrollBar[] = " ";
for (i = 1; i < NUM_VISIBLE_SLOTS - 1; i++)
- printText(scrollBar, 35, hm + 1, vm + 4 + i, 1, MSG_BOX_COLOUR, 7, true);
+ printText(scrollBar, 35, hm + 1, vm + 4 + i, 1, MSG_BOX_COLOR, 7, true);
printText(upArrow, 35, hm + 1, vm + 4, 1, 8, 7);
printText(downArrow, 35, hm + 1, vm + 4 + NUM_VISIBLE_SLOTS - 1, 1, 8, 7);
- printText(scrollBar, 35, hm + 1, vm + 4 + sbPos, 1, MSG_BOX_COLOUR, MSG_BOX_TEXT);
+ printText(scrollBar, 35, hm + 1, vm + 4 + sbPos, 1, MSG_BOX_COLOR, MSG_BOX_TEXT);
oldActive = active;
oldFirstSlot = _firstSlot;
@@ -808,7 +809,7 @@ int AgiEngine::saveGameDialog() {
do {
drawWindow(hp, vp, GFX_WIDTH - hp, GFX_HEIGHT - vp);
printText("Select a slot in which you wish to\nsave the game:",
- 0, hm + 1, vm + 1, w, MSG_BOX_TEXT, MSG_BOX_COLOUR);
+ 0, hm + 1, vm + 1, w, MSG_BOX_TEXT, MSG_BOX_COLOR);
slot = selectSlot();
if (slot + _firstSlot == 0)
messageBox("That slot is for Autosave only.");
@@ -819,7 +820,7 @@ int AgiEngine::saveGameDialog() {
drawWindow(hp, vp + 5 * CHAR_LINES, GFX_WIDTH - hp,
GFX_HEIGHT - vp - 9 * CHAR_LINES);
printText("Enter a description for this game:",
- 0, hm + 1, vm + 6, w, MSG_BOX_TEXT, MSG_BOX_COLOUR);
+ 0, hm + 1, vm + 6, w, MSG_BOX_TEXT, MSG_BOX_COLOR);
_gfx->drawRectangle(3 * CHAR_COLS, 11 * CHAR_LINES - 1,
37 * CHAR_COLS, 12 * CHAR_LINES, MSG_BOX_TEXT);
_gfx->flushBlock(3 * CHAR_COLS, 11 * CHAR_LINES - 1,
@@ -844,7 +845,7 @@ int AgiEngine::saveGameDialog() {
for (numChars = 0; numChars < 28 && name[numChars]; numChars++)
handleGetstring(name[numChars]);
- _gfx->printCharacter(numChars + 3, 11, _game.cursorChar, MSG_BOX_COLOUR, MSG_BOX_TEXT);
+ _gfx->printCharacter(numChars + 3, 11, _game.cursorChar, MSG_BOX_COLOR, MSG_BOX_TEXT);
do {
mainCycle();
} while (_game.inputMode == INPUT_GETSTRING);
@@ -902,7 +903,7 @@ int AgiEngine::loadGameDialog() {
drawWindow(hp, vp, GFX_WIDTH - hp, GFX_HEIGHT - vp);
printText("Select a game which you wish to\nrestore:",
- 0, hm + 1, vm + 1, w, MSG_BOX_TEXT, MSG_BOX_COLOUR);
+ 0, hm + 1, vm + 1, w, MSG_BOX_TEXT, MSG_BOX_COLOR);
slot = selectSlot();
diff --git a/engines/agi/sound.cpp b/engines/agi/sound.cpp
index b215822917..b40cef67ef 100644
--- a/engines/agi/sound.cpp
+++ b/engines/agi/sound.cpp
@@ -31,6 +31,8 @@
#include "agi/sound_sarien.h"
#include "agi/sound_pcjr.h"
+#include "common/textconsole.h"
+
namespace Agi {
//
diff --git a/engines/agi/sound_2gs.cpp b/engines/agi/sound_2gs.cpp
index 11bf5a9034..f5758ed140 100644
--- a/engines/agi/sound_2gs.cpp
+++ b/engines/agi/sound_2gs.cpp
@@ -28,6 +28,7 @@
#include "common/md5.h"
#include "common/memstream.h"
#include "common/str-array.h"
+#include "common/textconsole.h"
#include "agi/agi.h"
#include "agi/sound_2gs.h"
diff --git a/engines/agi/sound_midi.cpp b/engines/agi/sound_midi.cpp
index 986715721f..997c1edd6b 100644
--- a/engines/agi/sound_midi.cpp
+++ b/engines/agi/sound_midi.cpp
@@ -49,6 +49,7 @@
#include "common/file.h"
#include "common/memstream.h"
#include "common/stream.h"
+#include "common/textconsole.h"
#include "agi/agi.h"
diff --git a/engines/agi/sound_sarien.cpp b/engines/agi/sound_sarien.cpp
index 4ed7f8d029..6f2f3c5ad3 100644
--- a/engines/agi/sound_sarien.cpp
+++ b/engines/agi/sound_sarien.cpp
@@ -23,11 +23,7 @@
*
*/
-#include "common/md5.h"
-#include "common/config-manager.h"
-#include "common/fs.h"
#include "common/random.h"
-#include "common/str-array.h"
#include "audio/mididrv.h"
diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp
index af3881170a..f85c4c1cdd 100644
--- a/engines/agi/text.cpp
+++ b/engines/agi/text.cpp
@@ -166,7 +166,7 @@ void AgiEngine::blitTextbox(const char *p, int y, int x, int len) {
drawWindow(xoff, yoff, xoff + w - 1, yoff + h - 1);
printText2(2, msg, 0, CHAR_COLS + xoff, CHAR_LINES + yoff,
- len + 1, MSG_BOX_TEXT, MSG_BOX_COLOUR);
+ len + 1, MSG_BOX_TEXT, MSG_BOX_COLOR);
free(msg);
@@ -730,7 +730,7 @@ void AgiEngine::drawWindow(int x1, int y1, int x2, int y2) {
debugC(4, kDebugLevelText, "x1=%d, y1=%d, x2=%d, y2=%d", x1, y1, x2, y2);
_gfx->saveBlock(x1, y1, x2, y2, _game.window.buffer);
- _gfx->drawBox(x1, y1, x2, y2, MSG_BOX_COLOUR, MSG_BOX_LINE, 2);
+ _gfx->drawBox(x1, y1, x2, y2, MSG_BOX_COLOR, MSG_BOX_LINE, 2);
}
} // End of namespace Agi
diff --git a/engines/agi/wagparser.cpp b/engines/agi/wagparser.cpp
index 22de66712d..fab3b5cf50 100644
--- a/engines/agi/wagparser.cpp
+++ b/engines/agi/wagparser.cpp
@@ -27,6 +27,7 @@
#include "common/util.h"
#include "common/fs.h"
#include "common/debug.h"
+#include "common/textconsole.h"
#include "agi/wagparser.h"
diff --git a/engines/agi/words.cpp b/engines/agi/words.cpp
index c48ed90ad8..d8596dec97 100644
--- a/engines/agi/words.cpp
+++ b/engines/agi/words.cpp
@@ -29,6 +29,8 @@
#include "agi/agi.h"
+#include "common/textconsole.h"
+
namespace Agi {
static uint8 *words; // words in the game
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index 498c7e4961..56501b5294 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.cpp
@@ -25,9 +25,9 @@
#include "common/config-manager.h"
#include "common/EventRecorder.h"
-#include "common/events.h"
#include "common/file.h"
#include "common/fs.h"
+#include "common/textconsole.h"
#include "common/system.h"
#include "engines/util.h"
@@ -35,14 +35,12 @@
#include "agos/debugger.h"
#include "agos/intern.h"
#include "agos/agos.h"
-#include "agos/vga.h"
#include "backends/audiocd/audiocd.h"
#include "graphics/surface.h"
#include "audio/mididrv.h"
-#include "audio/mods/protracker.h"
namespace AGOS {
@@ -568,33 +566,33 @@ Common::Error AGOSEngine::init() {
// allocate buffers
_backGroundBuf = new Graphics::Surface();
- _backGroundBuf->create(_screenWidth, _screenHeight, 1);
+ _backGroundBuf->create(_screenWidth, _screenHeight, Graphics::PixelFormat::createFormatCLUT8());
if (getGameType() == GType_FF || getGameType() == GType_PP) {
_backBuf = new Graphics::Surface();
- _backBuf->create(_screenWidth, _screenHeight, 1);
+ _backBuf->create(_screenWidth, _screenHeight, Graphics::PixelFormat::createFormatCLUT8());
_scaleBuf = new Graphics::Surface();
- _scaleBuf->create(_screenWidth, _screenHeight, 1);
+ _scaleBuf->create(_screenWidth, _screenHeight, Graphics::PixelFormat::createFormatCLUT8());
}
if (getGameType() == GType_SIMON2) {
_window4BackScn = new Graphics::Surface();
- _window4BackScn->create(_screenWidth, _screenHeight, 1);
+ _window4BackScn->create(_screenWidth, _screenHeight, Graphics::PixelFormat::createFormatCLUT8());
} else if (getGameType() == GType_SIMON1) {
_window4BackScn = new Graphics::Surface();
- _window4BackScn->create(_screenWidth, 134, 1);
+ _window4BackScn->create(_screenWidth, 134, Graphics::PixelFormat::createFormatCLUT8());
} else if (getGameType() == GType_WW || getGameType() == GType_ELVIRA2) {
_window4BackScn = new Graphics::Surface();
- _window4BackScn->create(224, 127, 1);
+ _window4BackScn->create(224, 127, Graphics::PixelFormat::createFormatCLUT8());
} else if (getGameType() == GType_ELVIRA1) {
_window4BackScn = new Graphics::Surface();
if (getPlatform() == Common::kPlatformAmiga && (getFeatures() & GF_DEMO)) {
- _window4BackScn->create(224, 196, 1);
+ _window4BackScn->create(224, 196, Graphics::PixelFormat::createFormatCLUT8());
} else {
- _window4BackScn->create(224, 144, 1);
+ _window4BackScn->create(224, 144, Graphics::PixelFormat::createFormatCLUT8());
}
_window6BackScn = new Graphics::Surface();
- _window6BackScn->create(48, 80, 1);
+ _window6BackScn->create(48, 80, Graphics::PixelFormat::createFormatCLUT8());
}
setupGame();
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index bf51b31c43..aecf2437a7 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -29,6 +29,7 @@
#include "engines/engine.h"
#include "common/array.h"
+#include "common/error.h"
#include "common/keyboard.h"
#include "common/random.h"
#include "common/rect.h"
@@ -186,7 +187,7 @@ class AGOSEngine : public Engine {
virtual Common::Error run() {
Common::Error err;
err = init();
- if (err != Common::kNoError)
+ if (err.getCode() != Common::kNoError)
return err;
return go();
}
@@ -1140,7 +1141,7 @@ protected:
int getScale(int16 y, int16 x);
void checkScrollX(int16 x, int16 xpos);
void checkScrollY(int16 y, int16 ypos);
- void centreScroll();
+ void centerScroll();
virtual void clearVideoWindow(uint16 windowNum, uint16 color);
void clearVideoBackGround(uint16 windowNum, uint16 color);
@@ -1921,7 +1922,7 @@ public:
void off_mouseOff();
void off_loadVideo();
void off_playVideo();
- void off_centreScroll();
+ void off_centerScroll();
void off_resetPVCount();
void off_setPathValues();
void off_stopClock();
diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp
index acdc0084c4..ee47f62a58 100644
--- a/engines/agos/animation.cpp
+++ b/engines/agos/animation.cpp
@@ -31,8 +31,10 @@
#include "common/events.h"
#include "common/file.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "graphics/cursorman.h"
+#include "graphics/palette.h"
#include "graphics/surface.h"
#include "agos/animation.h"
diff --git a/engines/agos/charset-fontdata.cpp b/engines/agos/charset-fontdata.cpp
index a477b3dedc..a131bb841b 100644
--- a/engines/agos/charset-fontdata.cpp
+++ b/engines/agos/charset-fontdata.cpp
@@ -26,6 +26,7 @@
#include "common/system.h"
+#include "common/textconsole.h"
#include "agos/agos.h"
#include "agos/intern.h"
diff --git a/engines/agos/debug.cpp b/engines/agos/debug.cpp
index d0dc8cc42e..bb27557a6b 100644
--- a/engines/agos/debug.cpp
+++ b/engines/agos/debug.cpp
@@ -27,6 +27,7 @@
#include "common/file.h"
+#include "common/textconsole.h"
#include "agos/debug.h"
#include "agos/agos.h"
diff --git a/engines/agos/debug.h b/engines/agos/debug.h
index 38674de765..5865065ac3 100644
--- a/engines/agos/debug.h
+++ b/engines/agos/debug.h
@@ -2058,7 +2058,7 @@ static const char *const feeblefiles_opcodeNameTable[256] = {
"W|UNLOAD_ZONE",
NULL,
"|UNFREEZE_ZONES",
- "|CENTRE_SCROLL",
+ "|CENTER_SCROLL",
/* 188 */
"BSJ|STRING2_IS",
"|CLEAR_MARKS",
diff --git a/engines/agos/detection.cpp b/engines/agos/detection.cpp
index 646e63dacf..c8c70c0ecc 100644
--- a/engines/agos/detection.cpp
+++ b/engines/agos/detection.cpp
@@ -29,6 +29,7 @@
#include "common/config-manager.h"
#include "common/savefile.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "agos/intern.h"
#include "agos/agos.h"
diff --git a/engines/agos/draw.cpp b/engines/agos/draw.cpp
index 317c68d31a..6b9f65ee2b 100644
--- a/engines/agos/draw.cpp
+++ b/engines/agos/draw.cpp
@@ -28,6 +28,7 @@
#include "common/system.h"
#include "graphics/surface.h"
+#include "graphics/palette.h"
#include "agos/agos.h"
#include "agos/intern.h"
diff --git a/engines/agos/event.cpp b/engines/agos/event.cpp
index fc0b4f96cd..8799dbaa28 100644
--- a/engines/agos/event.cpp
+++ b/engines/agos/event.cpp
@@ -32,6 +32,7 @@
#include "common/events.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "backends/audiocd/audiocd.h"
diff --git a/engines/agos/gfx.cpp b/engines/agos/gfx.cpp
index 710c9ddd7e..4c998dfa5f 100644
--- a/engines/agos/gfx.cpp
+++ b/engines/agos/gfx.cpp
@@ -26,6 +26,7 @@
#include "common/system.h"
+#include "common/textconsole.h"
#include "graphics/surface.h"
diff --git a/engines/agos/icons.cpp b/engines/agos/icons.cpp
index ca603db1fa..39a7705c54 100644
--- a/engines/agos/icons.cpp
+++ b/engines/agos/icons.cpp
@@ -25,9 +25,9 @@
-#include "common/system.h"
-
#include "common/file.h"
+#include "common/system.h"
+#include "common/textconsole.h"
#include "graphics/surface.h"
diff --git a/engines/agos/items.cpp b/engines/agos/items.cpp
index 81da5264ba..5d1523bbd5 100644
--- a/engines/agos/items.cpp
+++ b/engines/agos/items.cpp
@@ -26,6 +26,7 @@
#include "common/file.h"
+#include "common/textconsole.h"
#include "agos/intern.h"
#include "agos/agos.h"
diff --git a/engines/agos/menus.cpp b/engines/agos/menus.cpp
index 5629a1dca6..2b103a75cb 100644
--- a/engines/agos/menus.cpp
+++ b/engines/agos/menus.cpp
@@ -27,6 +27,7 @@
#include "common/file.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "graphics/surface.h"
diff --git a/engines/agos/midi.cpp b/engines/agos/midi.cpp
index a37c96a787..26e2f2c736 100644
--- a/engines/agos/midi.cpp
+++ b/engines/agos/midi.cpp
@@ -28,6 +28,7 @@
#include "common/config-manager.h"
#include "common/file.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "agos/agos.h"
diff --git a/engines/agos/midi.h b/engines/agos/midi.h
index ad69a3ddde..40f54dbaf0 100644
--- a/engines/agos/midi.h
+++ b/engines/agos/midi.h
@@ -31,7 +31,7 @@
#include "common/mutex.h"
namespace Common {
- class File;
+class File;
}
namespace AGOS {
diff --git a/engines/agos/midiparser_s1d.cpp b/engines/agos/midiparser_s1d.cpp
index 156dc6ecaa..f96518b5e9 100644
--- a/engines/agos/midiparser_s1d.cpp
+++ b/engines/agos/midiparser_s1d.cpp
@@ -25,6 +25,7 @@
#include "common/debug.h"
#include "common/util.h"
+#include "common/textconsole.h"
#include "audio/mididrv.h"
#include "audio/midiparser.h"
diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp
index b8409669ee..0e818963e2 100644
--- a/engines/agos/res.cpp
+++ b/engines/agos/res.cpp
@@ -28,6 +28,7 @@
#include "common/file.h"
#include "common/memstream.h"
+#include "common/textconsole.h"
#include "common/util.h"
#include "agos/agos.h"
diff --git a/engines/agos/res_snd.cpp b/engines/agos/res_snd.cpp
index fe09e746ff..34deff37ab 100644
--- a/engines/agos/res_snd.cpp
+++ b/engines/agos/res_snd.cpp
@@ -26,6 +26,7 @@
#include "common/config-manager.h"
#include "common/file.h"
#include "common/memstream.h"
+#include "common/textconsole.h"
#include "agos/intern.h"
#include "agos/agos.h"
diff --git a/engines/agos/rooms.cpp b/engines/agos/rooms.cpp
index a2eff06fcc..0993197594 100644
--- a/engines/agos/rooms.cpp
+++ b/engines/agos/rooms.cpp
@@ -26,6 +26,7 @@
#include "common/file.h"
+#include "common/textconsole.h"
#include "agos/agos.h"
#include "agos/intern.h"
diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp
index eefa2460ec..d6f25814bb 100644
--- a/engines/agos/saveload.cpp
+++ b/engines/agos/saveload.cpp
@@ -26,6 +26,7 @@
#include "common/file.h"
#include "common/savefile.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "common/translation.h"
#include "gui/about.h"
diff --git a/engines/agos/script.cpp b/engines/agos/script.cpp
index 90992b52fe..94a3f371cc 100644
--- a/engines/agos/script.cpp
+++ b/engines/agos/script.cpp
@@ -28,6 +28,7 @@
#include "common/system.h"
+#include "common/textconsole.h"
#include "agos/animation.h"
#include "agos/agos.h"
diff --git a/engines/agos/script_dp.cpp b/engines/agos/script_dp.cpp
index 57610017a1..6eb3ca4779 100644
--- a/engines/agos/script_dp.cpp
+++ b/engines/agos/script_dp.cpp
@@ -271,7 +271,7 @@ void AGOSEngine_DIMP::setupOpcodes() {
OPCODE(os1_unloadZone),
OPCODE(o_invalid),
OPCODE(os1_unfreezeZones),
- OPCODE(off_centreScroll),
+ OPCODE(off_centerScroll),
/* 188 */
OPCODE(os2_isShortText),
OPCODE(os2_clearMarks),
diff --git a/engines/agos/script_ff.cpp b/engines/agos/script_ff.cpp
index dbd89cebf5..8dfee7f7c7 100644
--- a/engines/agos/script_ff.cpp
+++ b/engines/agos/script_ff.cpp
@@ -272,7 +272,7 @@ void AGOSEngine_Feeble::setupOpcodes() {
OPCODE(os1_unloadZone),
OPCODE(o_invalid),
OPCODE(os1_unfreezeZones),
- OPCODE(off_centreScroll),
+ OPCODE(off_centerScroll),
/* 188 */
OPCODE(os2_isShortText),
OPCODE(os2_clearMarks),
@@ -590,9 +590,9 @@ void AGOSEngine_Feeble::off_playVideo() {
}
}
-void AGOSEngine_Feeble::off_centreScroll() {
+void AGOSEngine_Feeble::off_centerScroll() {
// 187
- centreScroll();
+ centerScroll();
}
void AGOSEngine_Feeble::off_resetPVCount() {
diff --git a/engines/agos/script_pn.cpp b/engines/agos/script_pn.cpp
index 909c051362..b8ba7fb015 100644
--- a/engines/agos/script_pn.cpp
+++ b/engines/agos/script_pn.cpp
@@ -26,6 +26,8 @@
#include "agos/agos.h"
#include "agos/vga.h"
+#include "common/textconsole.h"
+
namespace AGOS {
enum {
diff --git a/engines/agos/script_s1.cpp b/engines/agos/script_s1.cpp
index 05a725cb50..dab0302631 100644
--- a/engines/agos/script_s1.cpp
+++ b/engines/agos/script_s1.cpp
@@ -26,6 +26,8 @@
#include "common/system.h"
+#include "graphics/palette.h"
+
#include "agos/agos.h"
#ifdef _WIN32_WCE
diff --git a/engines/agos/script_s2.cpp b/engines/agos/script_s2.cpp
index dd525163c7..a0b14525f2 100644
--- a/engines/agos/script_s2.cpp
+++ b/engines/agos/script_s2.cpp
@@ -27,6 +27,8 @@
#include "agos/agos.h"
+#include "common/textconsole.h"
+
namespace AGOS {
#define OPCODE(x) _OPCODE(AGOSEngine_Simon2, x)
diff --git a/engines/agos/sound.cpp b/engines/agos/sound.cpp
index 35301793bf..25d861acb5 100644
--- a/engines/agos/sound.cpp
+++ b/engines/agos/sound.cpp
@@ -25,6 +25,7 @@
#include "common/file.h"
#include "common/memstream.h"
+#include "common/textconsole.h"
#include "common/util.h"
#include "agos/agos.h"
diff --git a/engines/agos/string.cpp b/engines/agos/string.cpp
index bda605a84a..1152d6ed04 100644
--- a/engines/agos/string.cpp
+++ b/engines/agos/string.cpp
@@ -26,6 +26,7 @@
#include "common/file.h"
+#include "common/textconsole.h"
#include "gui/about.h"
#include "gui/message.h"
diff --git a/engines/agos/string_pn.cpp b/engines/agos/string_pn.cpp
index a4e40d8306..92d85ab96c 100644
--- a/engines/agos/string_pn.cpp
+++ b/engines/agos/string_pn.cpp
@@ -26,6 +26,8 @@
#include "agos/agos.h"
#include "agos/intern.h"
+#include "common/textconsole.h"
+
namespace AGOS {
uint32 AGOSEngine_PN::ftext(uint32 base, int n) {
diff --git a/engines/agos/subroutine.cpp b/engines/agos/subroutine.cpp
index 733d40e52d..bd07596a46 100644
--- a/engines/agos/subroutine.cpp
+++ b/engines/agos/subroutine.cpp
@@ -26,6 +26,7 @@
#include "common/file.h"
+#include "common/textconsole.h"
#include "agos/agos.h"
#include "agos/intern.h"
diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp
index 83ee05036c..6c07db13c1 100644
--- a/engines/agos/vga.cpp
+++ b/engines/agos/vga.cpp
@@ -31,6 +31,7 @@
#include "agos/vga.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "graphics/surface.h"
diff --git a/engines/agos/vga_e2.cpp b/engines/agos/vga_e2.cpp
index b0431db801..9e163ba91f 100644
--- a/engines/agos/vga_e2.cpp
+++ b/engines/agos/vga_e2.cpp
@@ -32,6 +32,7 @@
#include "common/system.h"
#include "graphics/surface.h"
+#include "graphics/palette.h"
namespace AGOS {
diff --git a/engines/agos/vga_ff.cpp b/engines/agos/vga_ff.cpp
index 38a3479292..14a1c60ae5 100644
--- a/engines/agos/vga_ff.cpp
+++ b/engines/agos/vga_ff.cpp
@@ -201,7 +201,7 @@ void AGOSEngine::vc78_computeXY() {
if (getGameType() == GType_FF) {
setBitFlag(85, false);
if (getBitFlag(74)) {
- centreScroll();
+ centerScroll();
}
}
}
@@ -348,7 +348,7 @@ void AGOSEngine::checkScrollY(int16 y, int16 ypos) {
}
}
-void AGOSEngine::centreScroll() {
+void AGOSEngine::centerScroll() {
int16 x, y, tmp;
if (_scrollXMax != 0) {
diff --git a/engines/agos/vga_ww.cpp b/engines/agos/vga_ww.cpp
index 8aecd3448a..08b2cee303 100644
--- a/engines/agos/vga_ww.cpp
+++ b/engines/agos/vga_ww.cpp
@@ -32,6 +32,7 @@
#include "common/system.h"
#include "graphics/surface.h"
+#include "graphics/palette.h"
namespace AGOS {
diff --git a/engines/agos/window.cpp b/engines/agos/window.cpp
index a03c7e178a..08680c9e45 100644
--- a/engines/agos/window.cpp
+++ b/engines/agos/window.cpp
@@ -26,6 +26,7 @@
#include "common/system.h"
+#include "common/textconsole.h"
#include "graphics/surface.h"
diff --git a/engines/cine/anim.cpp b/engines/cine/anim.cpp
index 14b8de9e39..6b4b29dcfe 100644
--- a/engines/cine/anim.cpp
+++ b/engines/cine/anim.cpp
@@ -29,6 +29,7 @@
#include "common/endian.h"
#include "common/memstream.h"
+#include "common/textconsole.h"
#include "cine/cine.h"
#include "cine/anim.h"
diff --git a/engines/cine/bg.cpp b/engines/cine/bg.cpp
index b3171de918..22fd28a99c 100644
--- a/engines/cine/bg.cpp
+++ b/engines/cine/bg.cpp
@@ -26,6 +26,7 @@
#include "common/endian.h"
#include "common/memstream.h"
+#include "common/textconsole.h"
#include "cine/cine.h"
#include "cine/various.h"
diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp
index 54d113d69c..8104ad38cd 100644
--- a/engines/cine/cine.cpp
+++ b/engines/cine/cine.cpp
@@ -23,13 +23,9 @@
*
*/
-#include "common/events.h"
#include "common/EventRecorder.h"
-#include "common/file.h"
-#include "common/savefile.h"
#include "common/config-manager.h"
#include "common/debug-channels.h"
-#include "common/system.h"
#include "engines/util.h"
diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp
index 9dfa2f71ea..058c1a1140 100644
--- a/engines/cine/detection.cpp
+++ b/engines/cine/detection.cpp
@@ -27,6 +27,7 @@
#include "engines/advancedDetector.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "cine/cine.h"
#include "cine/various.h"
diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp
index 3970d88117..18feacd08b 100644
--- a/engines/cine/gfx.cpp
+++ b/engines/cine/gfx.cpp
@@ -30,8 +30,9 @@
#include "cine/pal.h"
#include "common/endian.h"
-#include "common/system.h"
#include "common/events.h"
+#include "common/system.h"
+#include "common/textconsole.h"
#include "graphics/cursorman.h"
diff --git a/engines/cine/msg.cpp b/engines/cine/msg.cpp
index a01afd147b..3d58d6ddcd 100644
--- a/engines/cine/msg.cpp
+++ b/engines/cine/msg.cpp
@@ -25,6 +25,7 @@
#include "common/debug.h"
#include "common/endian.h"
+#include "common/textconsole.h"
#include "cine/msg.h"
#include "cine/various.h"
diff --git a/engines/cine/pal.cpp b/engines/cine/pal.cpp
index 3c8ffc295b..0f52600db5 100644
--- a/engines/cine/pal.cpp
+++ b/engines/cine/pal.cpp
@@ -27,6 +27,9 @@
#include "cine/various.h"
#include "cine/pal.h"
#include "common/system.h" // For g_system->getPaletteManager()->setPalette
+#include "common/textconsole.h"
+
+#include "graphics/palette.h"
namespace Cine {
diff --git a/engines/cine/part.cpp b/engines/cine/part.cpp
index f5c9402388..17ef01948c 100644
--- a/engines/cine/part.cpp
+++ b/engines/cine/part.cpp
@@ -25,6 +25,7 @@
#include "common/debug.h"
#include "common/endian.h"
+#include "common/textconsole.h"
#include "cine/cine.h"
#include "cine/unpack.h"
diff --git a/engines/cine/saveload.cpp b/engines/cine/saveload.cpp
index 4911f78da9..1fc2a8b2fd 100644
--- a/engines/cine/saveload.cpp
+++ b/engines/cine/saveload.cpp
@@ -25,6 +25,7 @@
#include "common/debug.h"
#include "common/savefile.h"
+#include "common/textconsole.h"
#include "cine/cine.h"
#include "cine/bg_list.h"
diff --git a/engines/cine/script_fw.cpp b/engines/cine/script_fw.cpp
index ffbee3d389..674bf4dd86 100644
--- a/engines/cine/script_fw.cpp
+++ b/engines/cine/script_fw.cpp
@@ -28,6 +28,7 @@
*/
#include "common/endian.h"
+#include "common/textconsole.h"
#include "cine/cine.h"
#include "cine/bg_list.h"
diff --git a/engines/cine/script_os.cpp b/engines/cine/script_os.cpp
index 9ee3a892a9..aa2c8c33ac 100644
--- a/engines/cine/script_os.cpp
+++ b/engines/cine/script_os.cpp
@@ -28,6 +28,7 @@
*/
#include "common/endian.h"
+#include "common/textconsole.h"
#include "cine/cine.h"
#include "cine/bg_list.h"
diff --git a/engines/cine/sound.cpp b/engines/cine/sound.cpp
index f0c0668e33..414761159b 100644
--- a/engines/cine/sound.cpp
+++ b/engines/cine/sound.cpp
@@ -26,6 +26,8 @@
#include "common/endian.h"
#include "common/file.h"
#include "common/memstream.h"
+#include "common/system.h"
+#include "common/textconsole.h"
#include "cine/cine.h"
#include "cine/sound.h"
diff --git a/engines/cine/sound.h b/engines/cine/sound.h
index e9a797989e..7b506ab5f3 100644
--- a/engines/cine/sound.h
+++ b/engines/cine/sound.h
@@ -30,7 +30,7 @@
#include "audio/mixer.h"
namespace Audio {
- class AudioStream;
+class AudioStream;
}
namespace Cine {
diff --git a/engines/cine/texte.cpp b/engines/cine/texte.cpp
index 9dbfa315d9..fb6818d690 100644
--- a/engines/cine/texte.cpp
+++ b/engines/cine/texte.cpp
@@ -23,8 +23,10 @@
*
*/
-#include "cine/cine.h"
#include "common/file.h"
+#include "common/textconsole.h"
+
+#include "cine/cine.h"
#include "cine/various.h"
namespace Cine {
diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp
index 5b8663606e..fdc7a28867 100644
--- a/engines/cine/various.cpp
+++ b/engines/cine/various.cpp
@@ -26,6 +26,7 @@
#include "common/endian.h"
#include "common/events.h"
+#include "common/textconsole.h"
#include "graphics/cursorman.h"
diff --git a/engines/cruise/actor.cpp b/engines/cruise/actor.cpp
index 9cbc3dd9ae..2c83aff743 100644
--- a/engines/cruise/actor.cpp
+++ b/engines/cruise/actor.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/textconsole.h"
+
#include "cruise/cruise.h"
#include "cruise/staticres.h"
diff --git a/engines/cruise/background.cpp b/engines/cruise/background.cpp
index edd52d3b4a..7c63c155d3 100644
--- a/engines/cruise/background.cpp
+++ b/engines/cruise/background.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/textconsole.h"
+
#include "cruise/cruise_main.h"
namespace Cruise {
diff --git a/engines/cruise/cruise.cpp b/engines/cruise/cruise.cpp
index 2c5659c4d9..9712bd9439 100644
--- a/engines/cruise/cruise.cpp
+++ b/engines/cruise/cruise.cpp
@@ -23,13 +23,10 @@
*
*/
-#include "common/events.h"
#include "common/EventRecorder.h"
#include "common/file.h"
-#include "common/savefile.h"
-#include "common/config-manager.h"
#include "common/debug-channels.h"
-#include "common/system.h"
+#include "common/textconsole.h"
#include "engines/util.h"
diff --git a/engines/cruise/cruise.h b/engines/cruise/cruise.h
index ad3bb20ca1..8d03d47327 100644
--- a/engines/cruise/cruise.h
+++ b/engines/cruise/cruise.h
@@ -31,7 +31,6 @@
#include "common/random.h"
#include "engines/engine.h"
-#include "engines/game.h"
#include "cruise/cruise_main.h"
#include "cruise/debugger.h"
diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp
index b1d7a594fe..e2f2d7468e 100644
--- a/engines/cruise/cruise_main.cpp
+++ b/engines/cruise/cruise_main.cpp
@@ -27,6 +27,7 @@
#include "common/endian.h"
#include "common/events.h"
#include "common/system.h" // for g_system->getEventManager()
+#include "common/textconsole.h"
#include "cruise/cruise.h"
#include "cruise/cruise_main.h"
diff --git a/engines/cruise/ctp.cpp b/engines/cruise/ctp.cpp
index 4f6c21e0e4..f1223c12e6 100644
--- a/engines/cruise/ctp.cpp
+++ b/engines/cruise/ctp.cpp
@@ -167,7 +167,7 @@ void makeCtStruct(Common::Array<CtStruct> &lst, int16 table[][40], int num, int
}
ct.num = num;
- ct.colour = walkboxColor[num];
+ ct.color = walkboxColor[num];
ct.bounds.left = minX;
ct.bounds.right = maxX;
ct.bounds.top = minY;
diff --git a/engines/cruise/ctp.h b/engines/cruise/ctp.h
index 3c6c9582cc..0aec9c52d8 100644
--- a/engines/cruise/ctp.h
+++ b/engines/cruise/ctp.h
@@ -57,7 +57,7 @@ class CtStruct {
public:
CtStruct *next;
int16 num;
- int16 colour;
+ int16 color;
Common::Rect bounds;
Common::Array<CtEntry> slices;
};
diff --git a/engines/cruise/dataLoader.cpp b/engines/cruise/dataLoader.cpp
index b9e4ca8bc9..3ccd1689b8 100644
--- a/engines/cruise/dataLoader.cpp
+++ b/engines/cruise/dataLoader.cpp
@@ -26,6 +26,7 @@
#include "cruise/cruise_main.h"
#include "common/endian.h"
#include "common/memstream.h"
+#include "common/textconsole.h"
namespace Cruise {
diff --git a/engines/cruise/detection.cpp b/engines/cruise/detection.cpp
index e43fadf598..63d7328e78 100644
--- a/engines/cruise/detection.cpp
+++ b/engines/cruise/detection.cpp
@@ -27,6 +27,7 @@
#include "base/plugins.h"
#include "common/savefile.h"
+#include "common/system.h"
#include "engines/advancedDetector.h"
#include "cruise/cruise.h"
@@ -74,7 +75,7 @@ static const CRUISEGameDescription gameDescriptions[] = {
{
{
"cruise",
- "16 colours",
+ "16 colors",
AD_ENTRY1("D1", "cd29a4cd9162076e9a18495fe56a48f3"),
Common::EN_GRB,
Common::kPlatformPC,
diff --git a/engines/cruise/font.cpp b/engines/cruise/font.cpp
index 3a609cb8d4..2bf36bbdbd 100644
--- a/engines/cruise/font.cpp
+++ b/engines/cruise/font.cpp
@@ -266,13 +266,13 @@ int32 prepareWordRender(int32 inRightBorder_X, int16 wordSpacingWidth,
return counter;
}
-void drawString(int32 x, int32 y, const char *string, uint8 *buffer, uint8 fontColour, int32 rightBorder_X) {
+void drawString(int32 x, int32 y, const char *string, uint8 *buffer, uint8 fontColor, int32 rightBorder_X) {
// Get the rendered text to display
gfxEntryStruct *s = renderText(rightBorder_X, string);
// Draw the message
- drawMessage(s, x, y, rightBorder_X - x, fontColour, buffer);
+ drawMessage(s, x, y, rightBorder_X - x, fontColor, buffer);
// Free the data
delete s->imagePtr;
diff --git a/engines/cruise/font.h b/engines/cruise/font.h
index 849c074ac5..17bb4372cf 100644
--- a/engines/cruise/font.h
+++ b/engines/cruise/font.h
@@ -66,7 +66,7 @@ void renderWord(uint8 *fontPtr_Data, uint8 *outBufferPtr,
int32 drawPosPixel_X, int32 heightOff, int32 height, int32 param4,
int32 stringRenderBufferSize, int32 width, int32 charWidth);
gfxEntryStruct *renderText(int inRightBorder_X, const char *string);
-void drawString(int32 x, int32 y, const char *string, uint8 * buffer, uint8 fontColour,
+void drawString(int32 x, int32 y, const char *string, uint8 * buffer, uint8 fontColor,
int32 inRightBorder_X);
void freeGfx(gfxEntryStruct *pGfx);
diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp
index 0b25ee59c1..75b90f7ec8 100644
--- a/engines/cruise/function.cpp
+++ b/engines/cruise/function.cpp
@@ -28,6 +28,8 @@
#include "cruise/cell.h"
#include "cruise/sound.h"
#include "cruise/staticres.h"
+
+#include "common/textconsole.h"
#include "common/util.h"
namespace Cruise {
diff --git a/engines/cruise/gfxModule.cpp b/engines/cruise/gfxModule.cpp
index f9ab193399..4d48c2c466 100644
--- a/engines/cruise/gfxModule.cpp
+++ b/engines/cruise/gfxModule.cpp
@@ -29,6 +29,8 @@
#include "common/list.h"
#include "common/rect.h"
+#include "graphics/palette.h"
+
#include "cruise/cruise.h"
#include "cruise/cruise_main.h"
@@ -203,7 +205,7 @@ void gfxModuleData_gfxWaitVSync() {
void gfxModuleData_flip() {
}
-void gfxCopyRect(const uint8 *sourceBuffer, int width, int height, byte *dest, int x, int y, int colour) {
+void gfxCopyRect(const uint8 *sourceBuffer, int width, int height, byte *dest, int x, int y, int color) {
int xp, yp;
for (yp = 0; yp < height; ++yp) {
@@ -216,7 +218,7 @@ void gfxCopyRect(const uint8 *sourceBuffer, int width, int height, byte *dest, i
int yDest = y + yp;
if ((v != 0) && (xDest >= 0) && (yDest >= 0) && (xDest < 320) && (yDest < 200))
- *destP = (v == 1) ? 0 : colour;
+ *destP = (v == 1) ? 0 : color;
}
}
}
@@ -324,10 +326,10 @@ void flip() {
g_system->updateScreen();
}
-void drawSolidBox(int32 x1, int32 y1, int32 x2, int32 y2, uint8 colour) {
+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), colour);
+ Common::set_to(p, p + (x2 - x1), color);
}
}
diff --git a/engines/cruise/gfxModule.h b/engines/cruise/gfxModule.h
index 1dbc5afc9b..1ca2581af5 100644
--- a/engines/cruise/gfxModule.h
+++ b/engines/cruise/gfxModule.h
@@ -55,7 +55,7 @@ void gfxModuleData_flip();
void gfxModuleData_updatePalette();
void gfxModuleData_updateScreen();
-void gfxCopyRect(const uint8 *sourceBuffer, int width, int height, byte *dest, int x, int y, int colour);
+void gfxCopyRect(const uint8 *sourceBuffer, int width, int height, byte *dest, int x, int y, int color);
void gfxModuleData_gfxCopyScreen(const uint8 *sourcePtr, uint8 *destPtr);
void convertGfxFromMode4(const uint8 *sourcePtr, int width, int height, uint8 *destPtr);
void convertGfxFromMode5(const uint8 *sourcePtr, int width, int height, uint8 *destPtr);
@@ -67,7 +67,7 @@ void gfxModuleData_setPalEntries(const byte *ptr, int start, int num);
void gfxModuleData_setPal256(const byte *ptr);
void gfxModuleData_addDirtyRect(const Common::Rect &r);
void flip();
-void drawSolidBox(int32 x1, int32 y1, int32 x2, int32 y2, uint8 colour);
+void drawSolidBox(int32 x1, int32 y1, int32 x2, int32 y2, uint8 color);
void resetBitmap(uint8 *dataPtr, int32 dataSize);
void switchBackground(const byte *newBg);
diff --git a/engines/cruise/menu.cpp b/engines/cruise/menu.cpp
index a722b947ff..36689ca0e3 100644
--- a/engines/cruise/menu.cpp
+++ b/engines/cruise/menu.cpp
@@ -29,6 +29,7 @@
#include "engines/metaengine.h"
#include "gui/saveload.h"
+#include "common/system.h"
#include "common/translation.h"
namespace Cruise {
diff --git a/engines/cruise/object.cpp b/engines/cruise/object.cpp
index 864491605f..8e2be0cf13 100644
--- a/engines/cruise/object.cpp
+++ b/engines/cruise/object.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/textconsole.h"
+
#include "cruise/cruise_main.h"
namespace Cruise {
diff --git a/engines/cruise/overlay.cpp b/engines/cruise/overlay.cpp
index 9a77891deb..b7a0293f33 100644
--- a/engines/cruise/overlay.cpp
+++ b/engines/cruise/overlay.cpp
@@ -24,6 +24,7 @@
*/
#include "common/memstream.h"
+#include "common/textconsole.h"
#include "cruise/cruise.h"
#include "cruise/cruise_main.h"
diff --git a/engines/cruise/saveload.cpp b/engines/cruise/saveload.cpp
index a1a306705e..6e75088d45 100644
--- a/engines/cruise/saveload.cpp
+++ b/engines/cruise/saveload.cpp
@@ -30,6 +30,7 @@
#include "common/serializer.h"
#include "common/savefile.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "graphics/scaler.h"
#include "graphics/thumbnail.h"
diff --git a/engines/cruise/script.cpp b/engines/cruise/script.cpp
index aae4dba475..d6ff784644 100644
--- a/engines/cruise/script.cpp
+++ b/engines/cruise/script.cpp
@@ -26,6 +26,7 @@
#include "cruise/cruise.h"
#include "cruise/cruise_main.h"
#include "common/endian.h"
+#include "common/textconsole.h"
namespace Cruise {
diff --git a/engines/cruise/sound.cpp b/engines/cruise/sound.cpp
index 2826a34351..322f808439 100644
--- a/engines/cruise/sound.cpp
+++ b/engines/cruise/sound.cpp
@@ -24,6 +24,8 @@
*/
#include "common/endian.h"
+#include "common/system.h"
+#include "common/textconsole.h"
#include "cruise/cruise.h"
#include "cruise/cruise_main.h"
diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp
index 18c184e568..7e1f29271e 100644
--- a/engines/dialogs.cpp
+++ b/engines/dialogs.cpp
@@ -25,21 +25,21 @@
#include "base/version.h"
#include "common/config-manager.h"
-#include "common/savefile.h"
-#include "common/system.h"
#include "common/events.h"
+#include "common/str.h"
+#include "common/system.h"
#include "common/translation.h"
-#include "graphics/scaler.h"
-
#include "gui/about.h"
#include "gui/gui-manager.h"
-#include "gui/launcher.h"
-#include "gui/widgets/list.h"
#include "gui/message.h"
#include "gui/options.h"
#include "gui/saveload.h"
+#include "gui/ThemeEngine.h"
#include "gui/ThemeEval.h"
+#include "gui/widget.h"
+
+#include "graphics/font.h"
#include "engines/dialogs.h"
#include "engines/engine.h"
diff --git a/engines/dialogs.h b/engines/dialogs.h
index 6e5338b317..587e91a2bb 100644
--- a/engines/dialogs.h
+++ b/engines/dialogs.h
@@ -25,15 +25,15 @@
#ifndef GLOBAL_DIALOGS_H
#define GLOBAL_DIALOGS_H
-#include "common/str.h"
#include "gui/dialog.h"
class Engine;
namespace GUI {
- class ButtonWidget;
- class GraphicsWidget;
- class SaveLoadChooser;
+class ButtonWidget;
+class CommandSender;
+class GraphicsWidget;
+class SaveLoadChooser;
}
class MainMenuDialog : public GUI::Dialog {
diff --git a/engines/draci/animation.cpp b/engines/draci/animation.cpp
index d7582ec31d..f2f1727fdd 100644
--- a/engines/draci/animation.cpp
+++ b/engines/draci/animation.cpp
@@ -32,6 +32,7 @@
#include "draci/surface.h"
#include "common/memstream.h"
+#include "common/system.h"
namespace Draci {
@@ -359,7 +360,7 @@ void AnimationManager::insert(Animation *anim, bool allocateIndex) {
}
void AnimationManager::drawScene(Surface *surf) {
- // Fill the screen with colour zero since some rooms may rely on the screen being black
+ // Fill the screen with color zero since some rooms may rely on the screen being black
_vm->_screen->getSurface()->fill(0);
sortAnimations();
@@ -498,8 +499,8 @@ const Animation *AnimationManager::getTopAnimation(int x, int y) const {
Animation *retval = NULL;
- // Get transparent colour for the current screen
- const int transparent = _vm->_screen->getSurface()->getTransparentColour();
+ // Get transparent color for the current screen
+ const int transparent = _vm->_screen->getSurface()->getTransparentColor();
for (it = _animations.reverse_begin(); it != _animations.end(); --it) {
diff --git a/engines/draci/font.cpp b/engines/draci/font.cpp
index 688458f3d4..d869d046f3 100644
--- a/engines/draci/font.cpp
+++ b/engines/draci/font.cpp
@@ -125,7 +125,7 @@ uint8 Font::getCharWidth(uint8 chr) const {
* @param ty Vertical offset on the surface
*/
-void Font::drawChar(Surface *dst, uint8 chr, int tx, int ty, int with_colour) const {
+void Font::drawChar(Surface *dst, uint8 chr, int tx, int ty, int with_color) const {
assert(dst != NULL);
assert(tx >= 0);
assert(ty >= 0);
@@ -147,39 +147,39 @@ void Font::drawChar(Surface *dst, uint8 chr, int tx, int ty, int with_colour) co
int ySpaceLeft = dst->h - ty - 1;
int yPixelsToDraw = (_fontHeight < ySpaceLeft) ? _fontHeight : ySpaceLeft;
- int _transparent = dst->getTransparentColour();
+ int _transparent = dst->getTransparentColor();
for (int y = 0; y < yPixelsToDraw; ++y) {
for (int x = 0; x <= xPixelsToDraw; ++x) {
int curr = y * _maxCharWidth + x;
- int colour = _charData[charOffset + curr];
+ int color = _charData[charOffset + curr];
// If pixel is transparent, skip it
- if (colour == _transparent)
+ if (color == _transparent)
continue;
- // Replace colour with font colours
- switch (colour) {
+ // Replace color with font colors
+ switch (color) {
case 254:
- colour = with_colour;
+ color = with_color;
break;
case 253:
- colour = kFontColour2;
+ color = kFontColor2;
break;
case 252:
- colour = kFontColour3;
+ color = kFontColor3;
break;
case 251:
- colour = kFontColour4;
+ color = kFontColor4;
break;
}
// Paint the pixel
- ptr[x] = colour;
+ ptr[x] = color;
}
// Advance to next row
@@ -198,8 +198,8 @@ void Font::drawChar(Surface *dst, uint8 chr, int tx, int ty, int with_colour) co
* @param spacing Space to leave between individual characters. Defaults to 0.
*/
void Font::drawString(Surface *dst, const byte *str, uint len,
- int x, int y, int with_colour, int spacing, bool markDirty) const {
- drawString(dst, Common::String((const char *)str, len), x, y, with_colour, spacing, markDirty);
+ int x, int y, int with_color, int spacing, bool markDirty) const {
+ drawString(dst, Common::String((const char *)str, len), x, y, with_color, spacing, markDirty);
}
/**
@@ -213,7 +213,7 @@ void Font::drawString(Surface *dst, const byte *str, uint len,
*/
void Font::drawString(Surface *dst, const Common::String &str,
- int x, int y, int with_colour, int spacing, bool markDirty) const {
+ int x, int y, int with_color, int spacing, bool markDirty) const {
assert(dst != NULL);
assert(x >= 0);
assert(y >= 0);
@@ -238,7 +238,7 @@ void Font::drawString(Surface *dst, const Common::String &str,
break;
}
- drawChar(dst, str[i], curx, cury, with_colour);
+ drawChar(dst, str[i], curx, cury, with_color);
curx += getCharWidth(str[i]) + spacing;
}
diff --git a/engines/draci/font.h b/engines/draci/font.h
index 010de66e2c..0ccc900465 100644
--- a/engines/draci/font.h
+++ b/engines/draci/font.h
@@ -36,19 +36,19 @@ extern const char * const kFontBig;
class Surface;
/**
- * Default font colours. They all seem to remain constant except for the
+ * Default font colors. They all seem to remain constant except for the
* first one which varies depending on the character speaking.
- * kOverFontColour is set to transparent.
+ * kOverFontColor is set to transparent.
*/
enum {
- kFontColour1 = 2,
- kFontColour2 = 0,
- kFontColour3 = 3,
- kFontColour4 = 4,
- kOverFontColour = 255,
- kTitleColour = 255,
- kLineActiveColour = 254,
- kLineInactiveColour = 255
+ kFontColor1 = 2,
+ kFontColor2 = 0,
+ kFontColor3 = 3,
+ kFontColor4 = 4,
+ kOverFontColor = 255,
+ kTitleColor = 255,
+ kLineActiveColor = 254,
+ kLineInactiveColor = 255
};
/**
@@ -64,12 +64,12 @@ public:
uint8 getFontHeight() const { return _fontHeight; }
uint8 getMaxCharWidth() const { return _maxCharWidth; }
uint8 getCharWidth(byte chr) const;
- void drawChar(Surface *dst, uint8 chr, int tx, int ty, int with_colour) const;
+ void drawChar(Surface *dst, uint8 chr, int tx, int ty, int with_color) const;
- void drawString(Surface *dst, const byte *str, uint len, int x, int y, int with_colour,
+ void drawString(Surface *dst, const byte *str, uint len, int x, int y, int with_color,
int spacing, bool markDirty) const;
void drawString(Surface *dst, const Common::String &str,
- int x, int y, int with_colour, int spacing, bool markDirty) const;
+ int x, int y, int with_color, int spacing, bool markDirty) const;
uint getStringWidth(const Common::String &str, int spacing) const;
uint getStringHeight(const Common::String &str) const;
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp
index 060ee41077..e19ec67810 100644
--- a/engines/draci/game.cpp
+++ b/engines/draci/game.cpp
@@ -47,9 +47,9 @@ static const char *dialoguePath = "ROZH";
static double real_to_double(byte real[6]);
enum {
- kWalkingMapOverlayColour = 2,
- kWalkingShortestPathOverlayColour = 120,
- kWalkingObliquePathOverlayColour = 73
+ kWalkingMapOverlayColor = 2,
+ kWalkingShortestPathOverlayColor = 120,
+ kWalkingObliquePathOverlayColor = 73
};
Game::Game(DraciEngine *vm) : _vm(vm), _walkingState(vm) {
@@ -69,7 +69,7 @@ Game::Game(DraciEngine *vm) : _vm(vm), _walkingState(vm) {
for (i = 0; i < numPersons; ++i) {
_persons[i]._x = personData.readUint16LE();
_persons[i]._y = personData.readUint16LE();
- _persons[i]._fontColour = personData.readByte();
+ _persons[i]._fontColor = personData.readByte();
}
// Read in dialogue offsets
@@ -217,12 +217,12 @@ void Game::init() {
// Initialize animation for object / room titles
_titleAnim = new Animation(_vm, kTitleText, 257, true);
- _titleAnim->addFrame(new Text("", _vm->_smallFont, kTitleColour, 0, 0, 0), NULL);
+ _titleAnim->addFrame(new Text("", _vm->_smallFont, kTitleColor, 0, 0, 0), NULL);
_vm->_anims->insert(_titleAnim, false);
// Initialize animation for speech text
Animation *speechAnim = new Animation(_vm, kSpeechText, 257, true);
- speechAnim->addFrame(new Text("", _vm->_bigFont, kFontColour1, 0, 0, 0), NULL);
+ speechAnim->addFrame(new Text("", _vm->_bigFont, kFontColor1, 0, 0, 0), NULL);
_vm->_anims->insert(speechAnim, false);
// Initialize inventory animation. _iconsArchive is never flushed.
@@ -236,7 +236,7 @@ void Game::init() {
for (uint i = 0; i < kDialogueLines; ++i) {
_dialogueAnims[i] = new Animation(_vm, kDialogueLinesID - i, 254, true);
- _dialogueAnims[i]->addFrame(new Text("", _vm->_smallFont, kLineInactiveColour, 0, 0, 0), NULL);
+ _dialogueAnims[i]->addFrame(new Text("", _vm->_smallFont, kLineInactiveColor, 0, 0, 0), NULL);
_dialogueAnims[i]->setRelative(1,
kScreenHeight - (i + 1) * _vm->_smallFont->getFontHeight());
@@ -418,9 +418,9 @@ void Game::handleDialogueLoop() {
text = reinterpret_cast<Text *>(_dialogueAnims[i]->getCurrentFrame());
if (_animUnderCursor == _dialogueAnims[i]) {
- text->setColour(kLineActiveColour);
+ text->setColor(kLineActiveColor);
} else {
- text->setColour(kLineInactiveColour);
+ text->setColor(kLineInactiveColor);
}
}
@@ -442,7 +442,7 @@ void Game::fadePalette(bool fading_out) {
}
for (int i = 1; i <= kBlackFadingIterations; ++i) {
_vm->_system->delayMillis(kBlackFadingTimeUnit);
- _vm->_screen->interpolatePalettes(startPal, endPal, 0, kNumColours, i, kBlackFadingIterations);
+ _vm->_screen->interpolatePalettes(startPal, endPal, 0, kNumColors, i, kBlackFadingIterations);
_vm->_screen->copyToScreen();
}
}
@@ -454,7 +454,7 @@ void Game::advanceAnimationsAndTestLoopExit() {
--_fadePhase;
const byte *startPal = _currentRoom._palette >= 0 ? _vm->_paletteArchive->getFile(_currentRoom._palette)->_data : NULL;
const byte *endPal = getScheduledPalette() >= 0 ? _vm->_paletteArchive->getFile(getScheduledPalette())->_data : NULL;
- _vm->_screen->interpolatePalettes(startPal, endPal, 0, kNumColours, _fadePhases - _fadePhase, _fadePhases);
+ _vm->_screen->interpolatePalettes(startPal, endPal, 0, kNumColors, _fadePhases - _fadePhase, _fadePhases);
if (_fadePhase == 0) {
if (_loopSubstatus == kInnerWhileFade) {
setExitLoop(true);
@@ -997,7 +997,7 @@ int Game::dialogueDraw() {
dialogueLine = reinterpret_cast<Text *>(anim->getCurrentFrame());
dialogueLine->setText(_dialogueBlocks[i]._title);
- dialogueLine->setColour(kLineInactiveColour);
+ dialogueLine->setColor(kLineInactiveColor);
_lines[_dialogueLinesNum] = i;
_dialogueLinesNum++;
}
@@ -1114,8 +1114,8 @@ int Game::playHeroAnimation(int anim_index) {
return anim->currentFrameNum();
}
-void Game::redrawWalkingPath(Animation *anim, byte colour, const WalkingPath &path) {
- Sprite *ov = _walkingMap.newOverlayFromPath(path, colour);
+void Game::redrawWalkingPath(Animation *anim, byte color, const WalkingPath &path) {
+ Sprite *ov = _walkingMap.newOverlayFromPath(path, color);
delete anim->getFrame(0);
anim->replaceFrame(0, ov, NULL);
anim->markDirtyRect(_vm->_screen->getSurface());
@@ -1148,8 +1148,8 @@ void Game::walkHero(int x, int y, SightDirection dir) {
_walkingMap.obliquePath(shortestPath, &obliquePath);
debugC(2, kDraciWalkingDebugLevel, "Walking path lengths: shortest=%d oblique=%d", shortestPath.size(), obliquePath.size());
if (_vm->_showWalkingMap) {
- redrawWalkingPath(_walkingShortestPathOverlay, kWalkingShortestPathOverlayColour, shortestPath);
- redrawWalkingPath(_walkingObliquePathOverlay, kWalkingObliquePathOverlayColour, obliquePath);
+ redrawWalkingPath(_walkingShortestPathOverlay, kWalkingShortestPathOverlayColor, shortestPath);
+ redrawWalkingPath(_walkingObliquePathOverlay, kWalkingObliquePathOverlayColor, obliquePath);
}
// Start walking. Walking will be gradually advanced by
@@ -1211,7 +1211,7 @@ void Game::loadWalkingMap(int mapID) {
f = _vm->_walkingMapsArchive->getFile(mapID);
_walkingMap.load(f->_data, f->_length);
- Sprite *ov = _walkingMap.newOverlayFromMap(kWalkingMapOverlayColour);
+ Sprite *ov = _walkingMap.newOverlayFromMap(kWalkingMapOverlayColor);
delete _walkingMapOverlay->getFrame(0);
_walkingMapOverlay->replaceFrame(0, ov, NULL);
_walkingMapOverlay->markDirtyRect(_vm->_screen->getSurface());
@@ -1385,7 +1385,7 @@ void Game::enterNewRoom() {
loadOverlays();
// Draw the scene with the black palette and slowly fade into the right palette.
- _vm->_screen->setPalette(NULL, 0, kNumColours);
+ _vm->_screen->setPalette(NULL, 0, kNumColors);
_vm->_anims->drawScene(_vm->_screen->getSurface());
_vm->_screen->copyToScreen();
fadePalette(false);
diff --git a/engines/draci/game.h b/engines/draci/game.h
index 21baaed5cc..0b5b3a03cc 100644
--- a/engines/draci/game.h
+++ b/engines/draci/game.h
@@ -31,7 +31,7 @@
#include "draci/walking.h"
namespace Common {
- class Serializer;
+class Serializer;
}
namespace Draci {
@@ -145,7 +145,7 @@ public:
struct Person {
uint _x, _y;
- byte _fontColour;
+ byte _fontColor;
};
struct Dialogue {
@@ -348,7 +348,7 @@ private:
void enterNewRoom();
void initWalkingOverlays();
void loadRoomObjects();
- void redrawWalkingPath(Animation *anim, byte colour, const WalkingPath &path);
+ void redrawWalkingPath(Animation *anim, byte color, const WalkingPath &path);
DraciEngine *_vm;
diff --git a/engines/draci/mouse.cpp b/engines/draci/mouse.cpp
index 14d1162fed..5853d15d21 100644
--- a/engines/draci/mouse.cpp
+++ b/engines/draci/mouse.cpp
@@ -106,14 +106,14 @@ void Mouse::setCursorType(CursorType cur) {
f = _vm->_iconsArchive->getFile(cur);
Sprite sp(f->_data, f->_length, 0, 0, true);
- CursorMan.replaceCursorPalette(_vm->_screen->getPalette(), 0, kNumColours);
+ CursorMan.replaceCursorPalette(_vm->_screen->getPalette(), 0, kNumColors);
CursorMan.replaceCursor(sp.getBuffer(), sp.getWidth(), sp.getHeight(),
sp.getWidth() / 2, sp.getHeight() / 2, 255);
}
void Mouse::loadItemCursor(const GameItem *item, bool highlighted) {
const int itemID = item->_absNum;
- const int archiveIndex = 2 * itemID + highlighted;
+ const int archiveIndex = 2 * itemID + (highlighted ? 1 : 0);
CursorType newCursor = static_cast<CursorType> (kItemCursor + archiveIndex);
if (newCursor == getCursorType()) {
return;
@@ -124,7 +124,7 @@ void Mouse::loadItemCursor(const GameItem *item, bool highlighted) {
f = _vm->_itemImagesArchive->getFile(archiveIndex);
Sprite sp(f->_data, f->_length, 0, 0, true);
- CursorMan.replaceCursorPalette(_vm->_screen->getPalette(), 0, kNumColours);
+ CursorMan.replaceCursorPalette(_vm->_screen->getPalette(), 0, kNumColors);
CursorMan.replaceCursor(sp.getBuffer(), sp.getWidth(), sp.getHeight(),
sp.getWidth() / 2, sp.getHeight() / 2, 255);
}
diff --git a/engines/draci/music.cpp b/engines/draci/music.cpp
index 750410b329..1d725ebb15 100644
--- a/engines/draci/music.cpp
+++ b/engines/draci/music.cpp
@@ -29,6 +29,7 @@
#include "audio/mididrv.h"
#include "audio/midiparser.h"
#include "common/config-manager.h"
+#include "common/debug.h"
#include "common/file.h"
#include "draci/draci.h"
diff --git a/engines/draci/screen.cpp b/engines/draci/screen.cpp
index dbe3fd98b8..ab9c49c63a 100644
--- a/engines/draci/screen.cpp
+++ b/engines/draci/screen.cpp
@@ -26,6 +26,8 @@
#include "common/memstream.h"
#include "common/system.h"
+#include "graphics/palette.h"
+
#include "draci/draci.h"
#include "draci/screen.h"
#include "draci/surface.h"
@@ -36,12 +38,12 @@ namespace Draci {
Screen::Screen(DraciEngine *vm) : _vm(vm) {
_surface = new Surface(kScreenWidth, kScreenHeight);
- _palette = new byte[3 * kNumColours];
- _blackPalette = new byte[3 * kNumColours];
- for (int i = 0; i < 3 * kNumColours; ++i) {
+ _palette = new byte[3 * kNumColors];
+ _blackPalette = new byte[3 * kNumColors];
+ for (int i = 0; i < 3 * kNumColors; ++i) {
_blackPalette[i] = 0;
}
- setPalette(NULL, 0, kNumColours);
+ setPalette(NULL, 0, kNumColors);
this->clearScreen();
}
@@ -54,11 +56,11 @@ Screen::~Screen() {
/**
* @brief Sets a part of the palette
* @param data Pointer to a buffer containing new palette data
- * start Index of the colour where replacement should start
- * num Number of colours to replace
+ * start Index of the color where replacement should start
+ * num Number of colors to replace
*/
void Screen::setPalette(const byte *data, uint16 start, uint16 num) {
- Common::MemoryReadStream pal(data ? data : _blackPalette, 3 * kNumColours);
+ Common::MemoryReadStream pal(data ? data : _blackPalette, 3 * kNumColors);
pal.seek(start * 3);
// Copy the palette
@@ -78,8 +80,8 @@ void Screen::setPalette(const byte *data, uint16 start, uint16 num) {
}
void Screen::interpolatePalettes(const byte *first, const byte *second, uint16 start, uint16 num, int index, int number) {
- Common::MemoryReadStream firstPal(first ? first : _blackPalette, 3 * kNumColours);
- Common::MemoryReadStream secondPal(second ? second : _blackPalette, 3 * kNumColours);
+ Common::MemoryReadStream firstPal(first ? first : _blackPalette, 3 * kNumColors);
+ Common::MemoryReadStream secondPal(second ? second : _blackPalette, 3 * kNumColors);
firstPal.seek(start * 3);
secondPal.seek(start * 3);
diff --git a/engines/draci/screen.h b/engines/draci/screen.h
index dc1aca092d..e4e910475a 100644
--- a/engines/draci/screen.h
+++ b/engines/draci/screen.h
@@ -33,7 +33,7 @@ namespace Draci {
enum ScreenParameters {
kScreenWidth = 320,
kScreenHeight = 200,
- kNumColours = 256,
+ kNumColors = 256,
kDefaultTransparent = 255
};
diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp
index 2a27541ad9..a7ce8b27d9 100644
--- a/engines/draci/script.cpp
+++ b/engines/draci/script.cpp
@@ -716,14 +716,14 @@ void Script::talk(const Common::Array<int> &params) {
SoundSample *sample = _vm->_sound->isMutedVoice()
? NULL : _vm->_dubbingArchive->getSample(sentenceID, 0);
- // Set the string and text colour
+ // Set the string and text color
surface->markDirtyRect(speechFrame->getRect(kNoDisplacement));
if (_vm->_sound->showSubtitles() || !sample) {
speechFrame->setText(Common::String((const char *)f->_data+1, f->_length-1));
} else {
speechFrame->setText("");
}
- speechFrame->setColour(person->_fontColour);
+ speechFrame->setColor(person->_fontColor);
speechFrame->repeatedlySplitLongLines(kScreenWidth);
// Speak the dubbing if possible
@@ -873,11 +873,11 @@ void Script::fadePalettePlay(const Common::Array<int> &params) {
void Script::setPalette(const Common::Array<int> &params) {
if (_vm->_game->getScheduledPalette() == -1) {
- _vm->_screen->setPalette(NULL, 0, kNumColours);
+ _vm->_screen->setPalette(NULL, 0, kNumColors);
} else {
const BAFile *f;
f = _vm->_paletteArchive->getFile(_vm->_game->getScheduledPalette());
- _vm->_screen->setPalette(f->_data, 0, kNumColours);
+ _vm->_screen->setPalette(f->_data, 0, kNumColors);
}
// Immediately update the palette
_vm->_screen->copyToScreen();
diff --git a/engines/draci/script.h b/engines/draci/script.h
index e81691204e..a75f6bcbc3 100644
--- a/engines/draci/script.h
+++ b/engines/draci/script.h
@@ -30,7 +30,7 @@
#include "common/stream.h"
namespace Common {
- class ReadStream;
+class ReadStream;
}
namespace Draci {
diff --git a/engines/draci/sound.cpp b/engines/draci/sound.cpp
index c8646fff67..ab2479f811 100644
--- a/engines/draci/sound.cpp
+++ b/engines/draci/sound.cpp
@@ -29,6 +29,7 @@
#include "common/file.h"
#include "common/str.h"
#include "common/substream.h"
+#include "common/textconsole.h"
#include "common/memstream.h"
#include "common/unzip.h"
@@ -417,15 +418,16 @@ void Sound::setVolume() {
} else {
_muteSound = _muteVoice = true;
}
+
if (ConfMan.getBool("mute")) {
_muteSound = _muteVoice = true;
}
- const int soundVolume = _muteSound ? 0: ConfMan.getInt("sfx_volume");
- const int speechVolume = _muteVoice ? 0 : ConfMan.getInt("speech_volume");
+ _mixer->muteSoundType(Audio::Mixer::kSFXSoundType, _muteSound);
+ _mixer->muteSoundType(Audio::Mixer::kSpeechSoundType, _muteVoice);
- _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, soundVolume);
- _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, speechVolume);
+ _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
+ _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume"));
}
} // End of namespace Draci
diff --git a/engines/draci/sprite.cpp b/engines/draci/sprite.cpp
index 65c6e21ee4..b4296375f2 100644
--- a/engines/draci/sprite.cpp
+++ b/engines/draci/sprite.cpp
@@ -144,7 +144,7 @@ void Sprite::drawReScaled(Surface *surface, bool markDirty, const Displacement &
// Get pointers to source and destination buffers
byte *dst = (byte *)surface->getBasePtr(clippedDestRect.left, clippedDestRect.top);
- const int transparent = surface->getTransparentColour();
+ const int transparent = surface->getTransparentColor();
// Calculate how many rows and columns we need to draw
const int rows = clippedDestRect.height();
@@ -212,7 +212,7 @@ void Sprite::draw(Surface *surface, bool markDirty, int relX, int relY) const {
const byte *src = _data + croppedBy.y * _width +
(!_mirror ? croppedBy.x : _width - 1 - croppedBy.x);
- const int transparent = surface->getTransparentColour();
+ const int transparent = surface->getTransparentColor();
// Calculate how many rows and columns we need to draw
const int rows = clippedDestRect.height();
@@ -252,7 +252,7 @@ Common::Rect Sprite::getRect(const Displacement &displacement) const {
_y + displacement.relY + scummvm_lround(_scaledHeight * displacement.extraScaleY));
}
-Text::Text(const Common::String &str, const Font *font, byte fontColour,
+Text::Text(const Common::String &str, const Font *font, byte fontColor,
int x, int y, uint spacing) {
_x = x;
_y = y;
@@ -268,7 +268,7 @@ Text::Text(const Common::String &str, const Font *font, byte fontColour,
}
_spacing = spacing;
- _colour = fontColour;
+ _color = fontColor;
_font = font;
@@ -294,7 +294,7 @@ void Text::setText(const Common::String &str) {
}
void Text::draw(Surface *surface, bool markDirty, int relX, int relY) const {
- _font->drawString(surface, _text, _x + relX, _y + relY, _colour, _spacing, true);
+ _font->drawString(surface, _text, _x + relX, _y + relY, _color, _spacing, true);
}
Common::Rect Text::getRect(const Displacement &displacement) const {
diff --git a/engines/draci/sprite.h b/engines/draci/sprite.h
index ddc56ecd80..15e1cf80ca 100644
--- a/engines/draci/sprite.h
+++ b/engines/draci/sprite.h
@@ -139,12 +139,12 @@ private:
class Text : public Drawable {
public:
- Text(const Common::String &str, const Font *font, byte fontColour,
+ Text(const Common::String &str, const Font *font, byte fontColor,
int x, int y, uint spacing);
~Text() {}
void setText(const Common::String &str);
- void setColour(byte fontColour) { _colour = fontColour; }
+ void setColor(byte fontColor) { _color = fontColor; }
void setSpacing(uint spacing) { _spacing = spacing; }
void setFont(const Font *font);
@@ -165,7 +165,7 @@ private:
Common::String _text;
uint _length;
- uint8 _colour;
+ uint8 _color;
uint _spacing;
const Font *_font;
};
diff --git a/engines/draci/surface.cpp b/engines/draci/surface.cpp
index 1c7ecfb23b..37a76dbe0e 100644
--- a/engines/draci/surface.cpp
+++ b/engines/draci/surface.cpp
@@ -29,9 +29,9 @@
namespace Draci {
Surface::Surface(int width, int height) {
- this->create(width, height, 1);
+ this->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
this->markClean();
- _transparentColour = kDefaultTransparent;
+ _transparentColor = kDefaultTransparent;
}
Surface::~Surface() {
@@ -80,12 +80,12 @@ void Surface::markClean() {
}
/**
- * @brief Fills the surface with the specified colour
+ * @brief Fills the surface with the specified color
*/
-void Surface::fill(uint colour) {
+void Surface::fill(uint color) {
byte *ptr = (byte *)getBasePtr(0, 0);
- memset(ptr, colour, w * h);
+ memset(ptr, color, w * h);
}
/**
diff --git a/engines/draci/surface.h b/engines/draci/surface.h
index a5c9ddb597..cb15ecebe4 100644
--- a/engines/draci/surface.h
+++ b/engines/draci/surface.h
@@ -27,6 +27,7 @@
#define DRACI_SURFACE_H
#include "common/list.h"
+#include "common/rect.h"
#include "graphics/surface.h"
namespace Draci {
@@ -43,18 +44,18 @@ public:
void markDirty();
void markClean();
bool needsFullUpdate() const { return _fullUpdate; }
- uint getTransparentColour() const { return _transparentColour; }
- void setTransparentColour(uint colour) { _transparentColour = colour; }
- void fill(uint colour);
+ uint getTransparentColor() const { return _transparentColor; }
+ void setTransparentColor(uint color) { _transparentColor = color; }
+ void fill(uint color);
uint putAboveY(int y, int height) const;
uint centerOnX(int x, int width) const;
Common::Rect getDimensions() const { return Common::Rect(w, h); }
private:
- /** The current transparent colour of the surface. See getTransparentColour() and
- * setTransparentColour().
+ /** The current transparent color of the surface. See getTransparentColor() and
+ * setTransparentColor().
*/
- uint _transparentColour;
+ uint _transparentColor;
/** Set when the surface is scheduled for a full update.
* See markDirty(), markClean(). Accessed via needsFullUpdate().
diff --git a/engines/draci/walking.cpp b/engines/draci/walking.cpp
index c6f9a58a85..d72e50be07 100644
--- a/engines/draci/walking.cpp
+++ b/engines/draci/walking.cpp
@@ -58,7 +58,7 @@ bool WalkingMap::isWalkable(const Common::Point &p) const {
return getPixel(p.x / _deltaX, p.y / _deltaY);
}
-Sprite *WalkingMap::newOverlayFromMap(byte colour) const {
+Sprite *WalkingMap::newOverlayFromMap(byte color) const {
// HACK: Create a visible overlay from the walking map so we can test it
byte *wlk = new byte[_realWidth * _realHeight];
memset(wlk, 255, _realWidth * _realHeight);
@@ -66,7 +66,7 @@ Sprite *WalkingMap::newOverlayFromMap(byte colour) const {
for (int i = 0; i < _mapWidth; ++i) {
for (int j = 0; j < _mapHeight; ++j) {
if (getPixel(i, j)) {
- drawOverlayRectangle(Common::Point(i, j), colour, wlk);
+ drawOverlayRectangle(Common::Point(i, j), color, wlk);
}
}
}
@@ -285,7 +285,7 @@ void WalkingMap::obliquePath(const WalkingPath& path, WalkingPath *obliquedPath)
while (managedToOblique(obliquedPath)) {}
}
-Sprite *WalkingMap::newOverlayFromPath(const WalkingPath &path, byte colour) const {
+Sprite *WalkingMap::newOverlayFromPath(const WalkingPath &path, byte color) const {
// HACK: Create a visible overlay from the walking map so we can test it
byte *wlk = new byte[_realWidth * _realHeight];
memset(wlk, 255, _realWidth * _realHeight);
@@ -297,14 +297,14 @@ Sprite *WalkingMap::newOverlayFromPath(const WalkingPath &path, byte colour) con
// Draw only points in the interval [v1, v2). These half-open
// half-closed intervals connect all the way to the last point.
for (int step = 0; step < steps; ++step) {
- drawOverlayRectangle(interpolate(v1, v2, step, steps), colour, wlk);
+ drawOverlayRectangle(interpolate(v1, v2, step, steps), color, wlk);
}
}
// Draw the last point. This works also when the path has no segment,
// but just one point.
if (path.size() > 0) {
const Common::Point &vLast = path[path.size()-1];
- drawOverlayRectangle(vLast, colour, wlk);
+ drawOverlayRectangle(vLast, color, wlk);
}
Sprite *ov = new Sprite(_realWidth, _realHeight, wlk, 0, 0, false);
@@ -313,10 +313,10 @@ Sprite *WalkingMap::newOverlayFromPath(const WalkingPath &path, byte colour) con
return ov;
}
-void WalkingMap::drawOverlayRectangle(const Common::Point &p, byte colour, byte *buf) const {
+void WalkingMap::drawOverlayRectangle(const Common::Point &p, byte color, byte *buf) const {
for (int i = 0; i < _deltaX; ++i) {
for (int j = 0; j < _deltaY; ++j) {
- buf[(p.y * _deltaY + j) * _realWidth + (p.x * _deltaX + i)] = colour;
+ buf[(p.y * _deltaY + j) * _realWidth + (p.x * _deltaX + i)] = color;
}
}
}
diff --git a/engines/draci/walking.h b/engines/draci/walking.h
index 55b39792f1..d6c7f0691d 100644
--- a/engines/draci/walking.h
+++ b/engines/draci/walking.h
@@ -45,12 +45,12 @@ public:
bool getPixel(int x, int y) const;
bool isWalkable(const Common::Point &p) const;
- Sprite *newOverlayFromMap(byte colour) const;
+ Sprite *newOverlayFromMap(byte color) const;
Common::Point findNearestWalkable(int x, int y) const;
bool findShortestPath(Common::Point p1, Common::Point p2, WalkingPath *path) const;
void obliquePath(const WalkingPath& path, WalkingPath *obliquedPath);
- Sprite *newOverlayFromPath(const WalkingPath &path, byte colour) const;
+ Sprite *newOverlayFromPath(const WalkingPath &path, byte color) const;
Common::Point getDelta() const { return Common::Point(_deltaX, _deltaY); }
static int pointsBetween(const Common::Point &p1, const Common::Point &p2);
@@ -68,7 +68,7 @@ private:
// 4 possible directions to walk from a pixel.
static const int kDirections[][2];
- void drawOverlayRectangle(const Common::Point &p, byte colour, byte *buf) const;
+ void drawOverlayRectangle(const Common::Point &p, byte color, byte *buf) const;
bool lineIsCovered(const Common::Point &p1, const Common::Point &p2) const;
// Returns true if the number of vertices on the path was decreased.
diff --git a/engines/drascula/converse.cpp b/engines/drascula/converse.cpp
index d0906fdf55..dcd93d84d7 100644
--- a/engines/drascula/converse.cpp
+++ b/engines/drascula/converse.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/textconsole.h"
+
#include "drascula/drascula.h"
namespace Drascula {
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp
index 19395dcd3f..470f28ccff 100644
--- a/engines/drascula/drascula.cpp
+++ b/engines/drascula/drascula.cpp
@@ -29,6 +29,7 @@
#include "common/file.h"
#include "common/savefile.h"
#include "common/config-manager.h"
+#include "common/textconsole.h"
#include "backends/audiocd/audiocd.h"
diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h
index ac3f86b9ba..b70384614f 100644
--- a/engines/drascula/drascula.h
+++ b/engines/drascula/drascula.h
@@ -573,8 +573,8 @@ public:
void enterName();
bool soundIsActive();
void waitFrameSSN();
- void mixVideo(byte *OldScreen, byte *NewScreen);
- void decodeRLE(byte *BufferRLE, byte *MiVideoRLE);
+ void mixVideo(byte *OldScreen, byte *NewScreen, uint16 oldPitch);
+ void decodeRLE(byte *BufferRLE, byte *MiVideoRLE, uint16 pitch = 320);
void decodeOffset(byte *BufferOFF, byte *MiVideoOFF, int length);
int playFrameSSN(Common::SeekableReadStream *stream);
diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp
index 9c5f3dc12a..0811fbede1 100644
--- a/engines/drascula/graphics.cpp
+++ b/engines/drascula/graphics.cpp
@@ -25,8 +25,9 @@
#include "drascula/drascula.h"
#include "graphics/surface.h"
-#include "common/stream.h"
+#include "common/stream.h"
+#include "common/textconsole.h"
namespace Drascula {
@@ -133,14 +134,18 @@ void DrasculaEngine::showFrame(Common::SeekableReadStream *stream, bool firstFra
}
byte *prevFrame = (byte *)malloc(64000);
- byte *screenBuffer = (byte *)_system->lockScreen()->pixels;
- memcpy(prevFrame, screenBuffer, 64000);
+ Graphics::Surface *screenSurf = _system->lockScreen();
+ byte *screenBuffer = (byte *)screenSurf->pixels;
+ uint16 screenPitch = screenSurf->pitch;
+ for (int y = 0; y < 200; y++) {
+ memcpy(prevFrame+y*320, screenBuffer+y*screenPitch, 320);
+ }
- decodeRLE(pcxData, screenBuffer);
+ decodeRLE(pcxData, screenBuffer, screenPitch);
free(pcxData);
if (!firstFrame)
- mixVideo(screenBuffer, prevFrame);
+ mixVideo(screenBuffer, prevFrame, screenPitch);
_system->unlockScreen();
_system->updateScreen();
@@ -445,7 +450,9 @@ void DrasculaEngine::screenSaver() {
int x1_, y1_, off1, off2;
- byte *screenBuffer = (byte *)_system->lockScreen()->pixels;
+ Graphics::Surface *screenSurf = _system->lockScreen();
+ byte *screenBuffer = (byte *)screenSurf->pixels;
+ uint16 screenPitch = screenSurf->pitch;
for (int i = 0; i < 200; i++) {
for (int j = 0; j < 320; j++) {
x1_ = j + tempRow[i];
@@ -463,7 +470,7 @@ void DrasculaEngine::screenSaver() {
y1_ = checkWrapY(y1_);
off2 = 320 * y1_ + x1_;
- screenBuffer[320 * i + j] = ghost[bgSurface[off2] + (copia[off1] << 8)];
+ screenBuffer[screenPitch * i + j] = ghost[bgSurface[off2] + (copia[off1] << 8)];
}
}
@@ -532,11 +539,14 @@ int DrasculaEngine::playFrameSSN(Common::SeekableReadStream *stream) {
free(BufferSSN);
waitFrameSSN();
- byte *screenBuffer = (byte *)_system->lockScreen()->pixels;
+ Graphics::Surface *screenSurf = _system->lockScreen();
+ byte *screenBuffer = (byte *)screenSurf->pixels;
+ uint16 screenPitch = screenSurf->pitch;
if (FrameSSN)
- mixVideo(screenBuffer, screenSurface);
+ mixVideo(screenBuffer, screenSurface, screenPitch);
else
- memcpy(screenBuffer, screenSurface, 64000);
+ for (int y = 0; y < 200; y++)
+ memcpy(screenBuffer+y*screenPitch, screenSurface+y*320, 320);
_system->unlockScreen();
_system->updateScreen();
@@ -548,11 +558,14 @@ int DrasculaEngine::playFrameSSN(Common::SeekableReadStream *stream) {
decodeOffset(BufferSSN, screenSurface, length);
free(BufferSSN);
waitFrameSSN();
- byte *screenBuffer = (byte *)_system->lockScreen()->pixels;
+ Graphics::Surface *screenSurf = _system->lockScreen();
+ byte *screenBuffer = (byte *)screenSurf->pixels;
+ uint16 screenPitch = screenSurf->pitch;
if (FrameSSN)
- mixVideo(screenBuffer, screenSurface);
+ mixVideo(screenBuffer, screenSurface, screenPitch);
else
- memcpy(screenBuffer, screenSurface, 64000);
+ for (int y = 0; y < 200; y++)
+ memcpy(screenBuffer+y*screenPitch, screenSurface+y*320, 320);
_system->unlockScreen();
_system->updateScreen();
@@ -588,11 +601,12 @@ void DrasculaEngine::decodeOffset(byte *BufferOFF, byte *MiVideoOFF, int length)
}
}
-void DrasculaEngine::decodeRLE(byte* srcPtr, byte* dstPtr) {
+ void DrasculaEngine::decodeRLE(byte* srcPtr, byte* dstPtr, uint16 pitch) {
bool stopProcessing = false;
byte pixel;
uint repeat;
- int curByte = 0;
+ int curByte = 0, curLine = 0;
+ pitch -= 320;
while (!stopProcessing) {
pixel = *srcPtr++;
@@ -603,17 +617,25 @@ void DrasculaEngine::decodeRLE(byte* srcPtr, byte* dstPtr) {
}
for (uint j = 0; j < repeat; j++) {
*dstPtr++ = pixel;
- if (++curByte >= 64000) {
- stopProcessing = true;
- break;
+ if (++curByte >= 320) {
+ curByte = 0;
+ dstPtr += pitch;
+ if (++curLine >= 200) {
+ stopProcessing = true;
+ break;
+ }
}
}
}
}
-void DrasculaEngine::mixVideo(byte *OldScreen, byte *NewScreen) {
- for (int x = 0; x < 64000; x++)
- OldScreen[x] ^= NewScreen[x];
+void DrasculaEngine::mixVideo(byte *OldScreen, byte *NewScreen, uint16 oldPitch) {
+ for (int y = 0; y < 200; y++) {
+ for (int x = 0; x < 320; x++)
+ OldScreen[x] ^= NewScreen[x];
+ OldScreen += oldPitch;
+ NewScreen += 320;
+ }
}
void DrasculaEngine::waitFrameSSN() {
diff --git a/engines/drascula/objects.cpp b/engines/drascula/objects.cpp
index 6b507abc65..630eb08d3c 100644
--- a/engines/drascula/objects.cpp
+++ b/engines/drascula/objects.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/textconsole.h"
+
#include "drascula/drascula.h"
namespace Drascula {
diff --git a/engines/drascula/palette.cpp b/engines/drascula/palette.cpp
index b521c0313b..a75e72e249 100644
--- a/engines/drascula/palette.cpp
+++ b/engines/drascula/palette.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "graphics/palette.h"
+
#include "drascula/drascula.h"
namespace Drascula {
diff --git a/engines/drascula/rooms.cpp b/engines/drascula/rooms.cpp
index 7744374518..35d4eedb5d 100644
--- a/engines/drascula/rooms.cpp
+++ b/engines/drascula/rooms.cpp
@@ -24,6 +24,7 @@
*/
#include "common/array.h"
+#include "common/textconsole.h"
#include "drascula/drascula.h"
@@ -140,6 +141,9 @@ void DrasculaEngine::setupRoomsTable() {
}
void DrasculaEngine::freeRoomsTable() {
+ if (_roomHandlers == 0)
+ return;
+
for (uint32 i = 0; i < _roomHandlers->roomParsers.size(); i++)
delete _roomHandlers->roomParsers[i];
_roomHandlers->roomParsers.clear();
diff --git a/engines/drascula/saveload.cpp b/engines/drascula/saveload.cpp
index db67409890..eacbe6756d 100644
--- a/engines/drascula/saveload.cpp
+++ b/engines/drascula/saveload.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/textconsole.h"
+
#include "drascula/drascula.h"
namespace Drascula {
diff --git a/engines/drascula/sound.cpp b/engines/drascula/sound.cpp
index 48e7492b11..5cb1c4486a 100644
--- a/engines/drascula/sound.cpp
+++ b/engines/drascula/sound.cpp
@@ -29,6 +29,7 @@
#include "audio/decoders/voc.h"
#include "common/config-manager.h"
+#include "common/textconsole.h"
#include "backends/audiocd/audiocd.h"
diff --git a/engines/engine.cpp b/engines/engine.cpp
index 0e5e58bc72..2c1d3a732c 100644
--- a/engines/engine.cpp
+++ b/engines/engine.cpp
@@ -22,6 +22,8 @@
* $Id$
*/
+#define FORBIDDEN_SYMBOL_EXCEPTION_getcwd
+
#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -32,25 +34,26 @@
#include "engines/engine.h"
#include "engines/dialogs.h"
-#include "engines/metaengine.h"
-#include "engines/util.h"
#include "common/config-manager.h"
-#include "common/debug.h"
#include "common/events.h"
#include "common/file.h"
-#include "common/timer.h"
-#include "common/savefile.h"
#include "common/system.h"
#include "common/str.h"
+#include "common/error.h"
+#include "common/list.h"
+#include "common/list_intern.h"
+#include "common/scummsys.h"
+#include "common/textconsole.h"
#include "gui/debugger.h"
+#include "gui/dialog.h"
#include "gui/message.h"
-#include "gui/gui-manager.h"
#include "audio/mixer.h"
#include "graphics/cursorman.h"
+#include "graphics/pixelformat.h"
#ifdef _WIN32_WCE
extern bool isSmartphone();
@@ -439,10 +442,14 @@ void Engine::syncSoundSettings() {
if (ConfMan.hasKey("mute"))
mute = ConfMan.getBool("mute");
- _mixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, (mute ? 0 : Audio::Mixer::kMaxMixerVolume));
- _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, (mute ? 0 : soundVolumeMusic));
- _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, (mute ? 0 : soundVolumeSFX));
- _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, (mute ? 0 : soundVolumeSpeech));
+ _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->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, Audio::Mixer::kMaxMixerVolume);
+ _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, soundVolumeMusic);
+ _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, soundVolumeSFX);
+ _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, soundVolumeSpeech);
}
void Engine::flipMute() {
diff --git a/engines/engine.h b/engines/engine.h
index 168a1dc2a0..b7afc0f09d 100644
--- a/engines/engine.h
+++ b/engines/engine.h
@@ -26,22 +26,22 @@
#define ENGINES_ENGINE_H
#include "common/scummsys.h"
-#include "common/error.h"
#include "common/str.h"
class OSystem;
namespace Audio {
- class Mixer;
+class Mixer;
}
namespace Common {
- class EventManager;
- class SaveFileManager;
- class TimerManager;
+class Error;
+class EventManager;
+class SaveFileManager;
+class TimerManager;
}
namespace GUI {
- class Debugger;
- class Dialog;
+class Debugger;
+class Dialog;
}
/**
diff --git a/engines/game.cpp b/engines/game.cpp
index dea6d37485..a27080cbf8 100644
--- a/engines/game.cpp
+++ b/engines/game.cpp
@@ -24,7 +24,6 @@
*/
#include "engines/game.h"
-#include "base/plugins.h"
const PlainGameDescriptor *findPlainGameDescriptor(const char *gameid, const PlainGameDescriptor *list) {
diff --git a/engines/game.h b/engines/game.h
index 3e5d7f262c..c9a3b25853 100644
--- a/engines/game.h
+++ b/engines/game.h
@@ -28,6 +28,8 @@
#include "common/array.h"
#include "common/hash-str.h"
+#include "common/str.h"
+#include "common/util.h"
/**
* A simple structure used to map gameids (like "monkey", "sword1", ...) to
diff --git a/engines/gob/databases.cpp b/engines/gob/databases.cpp
index 66a711e46e..94f641db4e 100644
--- a/engines/gob/databases.cpp
+++ b/engines/gob/databases.cpp
@@ -24,6 +24,7 @@
*/
#include "common/file.h"
+#include "common/textconsole.h"
#include "gob/databases.h"
diff --git a/engines/gob/dataio.cpp b/engines/gob/dataio.cpp
index 78fc0ab3c1..aa2743b5ed 100644
--- a/engines/gob/dataio.cpp
+++ b/engines/gob/dataio.cpp
@@ -26,6 +26,7 @@
#include "common/endian.h"
#include "common/types.h"
#include "common/memstream.h"
+#include "common/substream.h"
#include "gob/gob.h"
#include "gob/dataio.h"
@@ -345,9 +346,8 @@ Common::SeekableReadStream *DataIO::getFile(File &file) {
if (!file.archive->file.seek(file.offset))
return 0;
- Common::SeekableReadStream *rawData = file.archive->file.readStream(file.size);
- if (!rawData)
- return 0;
+ Common::SeekableReadStream *rawData =
+ new Common::SafeSubReadStream(&file.archive->file, file.offset, file.offset + file.size);
if (!file.packed)
return rawData;
diff --git a/engines/gob/dataio.h b/engines/gob/dataio.h
index 6e12d15af8..f2b39aed09 100644
--- a/engines/gob/dataio.h
+++ b/engines/gob/dataio.h
@@ -33,7 +33,7 @@
#include "common/file.h"
namespace Common {
- class SeekableReadStream;
+class SeekableReadStream;
}
namespace Gob {
diff --git a/engines/gob/detection_tables.h b/engines/gob/detection_tables.h
index b12fb81be1..832300f785 100644
--- a/engines/gob/detection_tables.h
+++ b/engines/gob/detection_tables.h
@@ -2278,6 +2278,20 @@ static const GOBGameDescription gameDescriptions[] = {
kFeaturesAdLib,
"disk0.stk", 0, 0
},
+ { // Supplied by alex86r in bug report #3297633
+ {
+ "fascination",
+ "VGA 3 disks edition",
+ AD_ENTRY1s("disk0.stk", "ab3dfdce43917bc806812959d692fc8f", 1061929),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ },
+ kGameTypeFascination,
+ kFeaturesAdLib,
+ "disk0.stk", 0, 0
+ },
{
{
"fascination",
@@ -3779,6 +3793,20 @@ static const GOBGameDescription gameDescriptions[] = {
kFeatures640x480 | kFeaturesTrueColor,
0, 0, 0
},
+ { // Supplied by alex86r in bug report #3297602
+ {
+ "urban",
+ "",
+ AD_ENTRY1s("intro.stk", "4e4a3c017fe5475353bf94c455fe3efd", 1253448),
+ IT_ITA,
+ kPlatformPC,
+ ADGF_NO_FLAGS,
+ GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ },
+ kGameTypeUrban,
+ kFeatures640x480 | kFeaturesTrueColor,
+ 0, 0, 0
+ },
{ // Supplied by goodoldgeorg in bug report #2770340
{
"urban",
diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp
index 15a8f7ff8e..c07f8de69d 100644
--- a/engines/gob/draw_v2.cpp
+++ b/engines/gob/draw_v2.cpp
@@ -899,17 +899,12 @@ void Draw_v2::spriteOperation(int16 operation) {
_spriteTop = spriteTop;
_spriteRight = spriteRight;
_spriteBottom = spriteBottom;
- _destSpriteX = destSpriteX;
+ if (operation != DRAW_PRINTTEXT)
+ _destSpriteX = destSpriteX;
_destSpriteY = destSpriteY;
_destSurface = destSurface;
_sourceSurface = sourceSurface;
- if (operation == DRAW_PRINTTEXT) {
- len = _fonts[_fontIndex]->getCharWidth();
- adjustCoords(1, &len, 0);
- _destSpriteX += len * strlen(_textToPrint);
- }
-
if ((_renderFlags & RENDERFLAG_USEDELTAS) && !deltaVeto) {
if (_sourceSurface == kBackSurface) {
_spriteLeft -= _backDeltaX;
diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp
index 12914163c2..3d697d3693 100644
--- a/engines/gob/gob.cpp
+++ b/engines/gob/gob.cpp
@@ -24,14 +24,11 @@
*/
#include "common/debug-channels.h"
-#include "common/endian.h"
-#include "common/events.h"
#include "common/EventRecorder.h"
#include "backends/audiocd/audiocd.h"
#include "base/plugins.h"
#include "common/config-manager.h"
-#include "common/md5.h"
#include "audio/mididrv.h"
#include "gui/gui-manager.h"
diff --git a/engines/gob/gob.h b/engines/gob/gob.h
index 9bdbed45cf..4a928747b0 100644
--- a/engines/gob/gob.h
+++ b/engines/gob/gob.h
@@ -30,12 +30,14 @@
#include "common/system.h"
#include "common/savefile.h"
+#include "graphics/pixelformat.h"
+
#include "engines/engine.h"
#include "gob/console.h"
namespace GUI {
- class StaticTextWidget;
+class StaticTextWidget;
}
/**
diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp
index 262fdc8045..8f1ff4c73f 100644
--- a/engines/gob/inter_v1.cpp
+++ b/engines/gob/inter_v1.cpp
@@ -23,9 +23,7 @@
*
*/
-#include "common/endian.h"
#include "common/str.h"
-#include "common/file.h"
#include "gob/gob.h"
#include "gob/inter.h"
diff --git a/engines/gob/inter_v4.cpp b/engines/gob/inter_v4.cpp
index 778387e52d..1da92b3766 100644
--- a/engines/gob/inter_v4.cpp
+++ b/engines/gob/inter_v4.cpp
@@ -23,9 +23,7 @@
*
*/
-#include "common/endian.h"
#include "common/str.h"
-#include "common/file.h"
#include "gob/gob.h"
#include "gob/inter.h"
diff --git a/engines/gob/inter_v5.cpp b/engines/gob/inter_v5.cpp
index 85b213ae66..f5e87bb936 100644
--- a/engines/gob/inter_v5.cpp
+++ b/engines/gob/inter_v5.cpp
@@ -23,9 +23,6 @@
*
*/
-#include "common/endian.h"
-#include "common/file.h"
-
#include "gui/message.h"
#include "gob/gob.h"
diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp
index 06a06f4fb6..53ebfe7513 100644
--- a/engines/gob/inter_v6.cpp
+++ b/engines/gob/inter_v6.cpp
@@ -23,9 +23,7 @@
*
*/
-#include "common/endian.h"
#include "common/str.h"
-#include "common/file.h"
#include "graphics/dither.h"
#include "gob/gob.h"
diff --git a/engines/gob/resources.h b/engines/gob/resources.h
index 9921dc6e76..dec64f6b7c 100644
--- a/engines/gob/resources.h
+++ b/engines/gob/resources.h
@@ -29,7 +29,7 @@
#include "common/str.h"
namespace Common {
- class SeekableReadStream;
+class SeekableReadStream;
}
namespace Gob {
diff --git a/engines/gob/save/savefile.cpp b/engines/gob/save/savefile.cpp
index d472ef600b..45cd2a2b7d 100644
--- a/engines/gob/save/savefile.cpp
+++ b/engines/gob/save/savefile.cpp
@@ -336,7 +336,7 @@ bool SavePartSprite::read(Common::ReadStream &stream) {
// If it's in the current format, the true color flag has to be the same too
if (!_oldFormat)
- if (stream.readByte() != _trueColor)
+ if ((stream.readByte() != 0) != _trueColor)
return false;
// Sprite data
diff --git a/engines/gob/save/savehandler.cpp b/engines/gob/save/savehandler.cpp
index 8cb8274402..21102ae786 100644
--- a/engines/gob/save/savehandler.cpp
+++ b/engines/gob/save/savehandler.cpp
@@ -113,8 +113,8 @@ void SlotFileIndexed::buildIndex(byte *buffer, SavePartInfo &info,
if (setLongest) {
uint32 slot0Len;
for (slot0Len = strlen((const char *) bufferStart); slot0Len < longest; slot0Len++)
- buffer[slot0Len] = ' ';
- buffer[slot0Len] = '\0';
+ bufferStart[slot0Len] = ' ';
+ bufferStart[slot0Len] = '\0';
}
}
diff --git a/engines/gob/save/saveload.cpp b/engines/gob/save/saveload.cpp
index 3508e58f16..e490509914 100644
--- a/engines/gob/save/saveload.cpp
+++ b/engines/gob/save/saveload.cpp
@@ -23,9 +23,6 @@
*
*/
-#include "common/endian.h"
-#include "common/savefile.h"
-
#include "gob/gob.h"
#include "gob/save/saveload.h"
#include "gob/global.h"
diff --git a/engines/gob/save/saveload_v6.cpp b/engines/gob/save/saveload_v6.cpp
index 37ac08ebea..248fe0a93f 100644
--- a/engines/gob/save/saveload_v6.cpp
+++ b/engines/gob/save/saveload_v6.cpp
@@ -284,6 +284,9 @@ SaveLoad_v6::GameHandler::GameHandler(GobEngine *vm, const char *target,
SaveLoad_v6::GameHandler::~GameHandler() {
delete _slotFile;
+
+ delete _reader;
+ delete _writer;
}
int32 SaveLoad_v6::GameHandler::getSize() {
diff --git a/engines/gob/sound/adlib.cpp b/engines/gob/sound/adlib.cpp
index f070bf14fa..4244df68e5 100644
--- a/engines/gob/sound/adlib.cpp
+++ b/engines/gob/sound/adlib.cpp
@@ -23,8 +23,10 @@
*
*/
+#include "common/debug.h"
#include "common/file.h"
#include "common/endian.h"
+#include "common/textconsole.h"
#include "gob/gob.h"
#include "gob/sound/adlib.h"
diff --git a/engines/gob/sound/bgatmosphere.cpp b/engines/gob/sound/bgatmosphere.cpp
index 8850a727d3..b351d92275 100644
--- a/engines/gob/sound/bgatmosphere.cpp
+++ b/engines/gob/sound/bgatmosphere.cpp
@@ -23,8 +23,6 @@
*
*/
-#include "common/system.h"
-#include "common/events.h"
#include "common/EventRecorder.h"
#include "gob/sound/bgatmosphere.h"
diff --git a/engines/gob/sound/cdrom.cpp b/engines/gob/sound/cdrom.cpp
index 4f3d783046..217aa9c18e 100644
--- a/engines/gob/sound/cdrom.cpp
+++ b/engines/gob/sound/cdrom.cpp
@@ -25,6 +25,7 @@
#include "common/endian.h"
#include "common/str.h"
+#include "common/textconsole.h"
#include "common/util.h"
#include "backends/audiocd/audiocd.h"
diff --git a/engines/gob/sound/infogrames.cpp b/engines/gob/sound/infogrames.cpp
index 6377b4e798..9fb7410740 100644
--- a/engines/gob/sound/infogrames.cpp
+++ b/engines/gob/sound/infogrames.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/textconsole.h"
+
#include "gob/sound/infogrames.h"
namespace Gob {
diff --git a/engines/gob/sound/sounddesc.cpp b/engines/gob/sound/sounddesc.cpp
index d33ea89147..cc1c6b1f6b 100644
--- a/engines/gob/sound/sounddesc.cpp
+++ b/engines/gob/sound/sounddesc.cpp
@@ -25,6 +25,8 @@
#include "common/util.h"
#include "common/memstream.h"
+#include "common/textconsole.h"
+
#include "audio/mixer.h"
#include "audio/decoders/raw.h"
#include "audio/decoders/wave.h"
diff --git a/engines/gob/sound/soundmixer.cpp b/engines/gob/sound/soundmixer.cpp
index b6082c577c..3b6b2e5d52 100644
--- a/engines/gob/sound/soundmixer.cpp
+++ b/engines/gob/sound/soundmixer.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/util.h"
+
#include "gob/sound/soundmixer.h"
#include "gob/sound/sounddesc.h"
diff --git a/engines/gob/surface.cpp b/engines/gob/surface.cpp
index c3e8cd9ff5..7bd8aae597 100644
--- a/engines/gob/surface.cpp
+++ b/engines/gob/surface.cpp
@@ -31,6 +31,8 @@
#include "common/frac.h"
#include "graphics/primitives.h"
+#include "graphics/pixelformat.h"
+#include "graphics/surface.h"
namespace Gob {
diff --git a/engines/gob/surface.h b/engines/gob/surface.h
index 3dea18e36e..b84927af70 100644
--- a/engines/gob/surface.h
+++ b/engines/gob/surface.h
@@ -34,7 +34,7 @@
#include "graphics/iff.h"
namespace Common {
- class SeekableReadStream;
+class SeekableReadStream;
}
namespace Gob {
diff --git a/engines/gob/totfile.h b/engines/gob/totfile.h
index 211232f870..ce467425e2 100644
--- a/engines/gob/totfile.h
+++ b/engines/gob/totfile.h
@@ -29,7 +29,7 @@
#include "common/str.h"
namespace Common {
- class SeekableReadStream;
+class SeekableReadStream;
}
namespace Gob {
diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp
index 4d51b3d61f..787f85175a 100644
--- a/engines/gob/util.cpp
+++ b/engines/gob/util.cpp
@@ -36,6 +36,8 @@
#include "common/events.h"
+#include "graphics/palette.h"
+
namespace Gob {
Util::Util(GobEngine *vm) : _vm(vm) {
diff --git a/engines/gob/video.cpp b/engines/gob/video.cpp
index 444ff8ed9e..1d74a07bfc 100644
--- a/engines/gob/video.cpp
+++ b/engines/gob/video.cpp
@@ -29,6 +29,7 @@
#include "graphics/cursorman.h"
#include "graphics/fontman.h"
+#include "graphics/palette.h"
#include "graphics/surface.h"
#include "gob/gob.h"
diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp
index 8222c99ef3..de149c9787 100644
--- a/engines/gob/videoplayer.cpp
+++ b/engines/gob/videoplayer.cpp
@@ -720,7 +720,7 @@ bool VideoPlayer::copyFrame(int slot, Surface &dest,
if (!surface)
return false;
- Surface src(surface->w, surface->h, surface->bytesPerPixel, (byte *)surface->pixels);
+ Surface src(surface->w, surface->h, surface->format.bytesPerPixel, (byte *)surface->pixels);
dest.blit(src, left, top, left + width - 1, top + height - 1, x, y, transp);
return true;
diff --git a/engines/groovie/cursor.cpp b/engines/groovie/cursor.cpp
index db4134ccb0..8b62b829e1 100644
--- a/engines/groovie/cursor.cpp
+++ b/engines/groovie/cursor.cpp
@@ -26,8 +26,11 @@
#include "groovie/cursor.h"
#include "groovie/groovie.h"
+#include "common/debug.h"
#include "common/archive.h"
+#include "common/file.h"
#include "common/macresman.h"
+#include "common/textconsole.h"
#include "graphics/cursorman.h"
namespace Groovie {
diff --git a/engines/groovie/cursor.h b/engines/groovie/cursor.h
index 7a1f3ccc0e..e40dc0c486 100644
--- a/engines/groovie/cursor.h
+++ b/engines/groovie/cursor.h
@@ -30,7 +30,7 @@
#include "common/system.h"
namespace Common {
- class MacResManager;
+class MacResManager;
}
namespace Groovie {
diff --git a/engines/groovie/debug.cpp b/engines/groovie/debug.cpp
index bd4b671e11..0b70e4f83a 100644
--- a/engines/groovie/debug.cpp
+++ b/engines/groovie/debug.cpp
@@ -31,6 +31,8 @@
#include "common/debug-channels.h"
#include "common/system.h"
+#include "graphics/palette.h"
+
namespace Groovie {
Debugger::Debugger(GroovieEngine *vm) :
diff --git a/engines/groovie/font.cpp b/engines/groovie/font.cpp
index 92ebcce298..13d0df0005 100644
--- a/engines/groovie/font.cpp
+++ b/engines/groovie/font.cpp
@@ -23,6 +23,10 @@
*
*/
+#include "common/array.h"
+#include "common/textconsole.h"
+#include "graphics/surface.h"
+
#include "groovie/font.h"
namespace Groovie {
diff --git a/engines/groovie/graphics.cpp b/engines/groovie/graphics.cpp
index 3ceeeb6018..71ee231b80 100644
--- a/engines/groovie/graphics.cpp
+++ b/engines/groovie/graphics.cpp
@@ -25,15 +25,19 @@
#include "groovie/graphics.h"
#include "groovie/groovie.h"
+
+#include "common/rect.h"
#include "common/system.h"
+#include "graphics/palette.h"
+
namespace Groovie {
GraphicsMan::GraphicsMan(GroovieEngine *vm) :
_vm(vm), _changed(false), _fading(0) {
// Create the game surfaces
- _foreground.create(640, 320, _vm->_pixelFormat.bytesPerPixel);
- _background.create(640, 320, _vm->_pixelFormat.bytesPerPixel);
+ _foreground.create(640, 320, _vm->_pixelFormat);
+ _background.create(640, 320, _vm->_pixelFormat);
}
GraphicsMan::~GraphicsMan() {
diff --git a/engines/groovie/groovie.cpp b/engines/groovie/groovie.cpp
index 552aec6128..71b83b9baa 100644
--- a/engines/groovie/groovie.cpp
+++ b/engines/groovie/groovie.cpp
@@ -35,7 +35,9 @@
#include "common/config-manager.h"
#include "common/debug-channels.h"
#include "common/events.h"
+#include "common/file.h"
#include "common/macresman.h"
+#include "common/textconsole.h"
#include "backends/audiocd/audiocd.h"
#include "engines/util.h"
diff --git a/engines/groovie/groovie.h b/engines/groovie/groovie.h
index bd376db0d2..6f1e5bb52e 100644
--- a/engines/groovie/groovie.h
+++ b/engines/groovie/groovie.h
@@ -33,7 +33,7 @@
#include "graphics/pixelformat.h"
namespace Common {
- class MacResManager;
+class MacResManager;
}
/**
diff --git a/engines/groovie/music.cpp b/engines/groovie/music.cpp
index b6ef5d277c..20353f4276 100644
--- a/engines/groovie/music.cpp
+++ b/engines/groovie/music.cpp
@@ -29,8 +29,11 @@
#include "backends/audiocd/audiocd.h"
#include "common/config-manager.h"
+#include "common/debug.h"
+#include "common/file.h"
#include "common/macresman.h"
#include "common/memstream.h"
+#include "common/textconsole.h"
#include "audio/audiostream.h"
#include "audio/midiparser.h"
#include "audio/decoders/mp3.h"
diff --git a/engines/groovie/player.cpp b/engines/groovie/player.cpp
index 92590d420c..090d99e768 100644
--- a/engines/groovie/player.cpp
+++ b/engines/groovie/player.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/debug.h"
+
#include "groovie/player.h"
#include "groovie/groovie.h"
diff --git a/engines/groovie/resource.cpp b/engines/groovie/resource.cpp
index 2cb571b4cc..5701f3a73d 100644
--- a/engines/groovie/resource.cpp
+++ b/engines/groovie/resource.cpp
@@ -24,8 +24,11 @@
*/
#include "common/archive.h"
+#include "common/debug.h"
+#include "common/file.h"
#include "common/macresman.h"
#include "common/substream.h"
+#include "common/textconsole.h"
#include "groovie/resource.h"
#include "groovie/groovie.h"
@@ -92,7 +95,7 @@ ResMan_t7g::ResMan_t7g(Common::MacResManager *macResFork) : _macResFork(macResFo
}
}
-uint16 ResMan_t7g::getRef(Common::String name, Common::String scriptname) {
+uint32 ResMan_t7g::getRef(Common::String name, Common::String scriptname) {
// Get the name of the RL file
Common::String rlFileName(t7g_gjds[_lastGjd]);
rlFileName += ".rl";
@@ -110,7 +113,7 @@ uint16 ResMan_t7g::getRef(Common::String name, Common::String scriptname) {
if (!rlFile)
error("Groovie::Resource: Couldn't open %s", rlFileName.c_str());
- uint16 resNum;
+ uint32 resNum;
bool found = false;
for (resNum = 0; !found && !rlFile->err() && !rlFile->eos(); resNum++) {
// Read the resource name
@@ -134,7 +137,7 @@ uint16 ResMan_t7g::getRef(Common::String name, Common::String scriptname) {
// Verify we really found the resource
if (!found) {
error("Groovie::Resource: Couldn't find resource %s in %s", name.c_str(), rlFileName.c_str());
- return (uint16)-1;
+ return (uint32)-1;
}
return (_lastGjd << 10) | (resNum - 1);
@@ -218,8 +221,42 @@ ResMan_v2::ResMan_v2() {
indexfile.close();
}
-uint16 ResMan_v2::getRef(Common::String name, Common::String scriptname) {
- return 0;
+uint32 ResMan_v2::getRef(Common::String name, Common::String scriptname) {
+ // Open the RL file
+ Common::File rlFile;
+ if (!rlFile.open("dir.rl")) {
+ error("Groovie::Resource: Couldn't open dir.rl");
+ return false;
+ }
+
+ uint32 resNum;
+ bool found = false;
+ for (resNum = 0; !found && !rlFile.err() && !rlFile.eos(); resNum++) {
+ // Seek past metadata
+ rlFile.seek(14, SEEK_CUR);
+
+ // Read the resource name
+ char readname[18];
+ rlFile.read(readname, 18);
+
+ // Test whether it's the resource we're searching
+ Common::String resname(readname, 18);
+ if (resname.hasPrefix(name.c_str())) {
+ debugC(2, kGroovieDebugResource | kGroovieDebugAll, "Groovie::Resource: Resource %12s matches %s", readname, name.c_str());
+ found = true;
+ }
+ }
+
+ // Close the RL file
+ rlFile.close();
+
+ // Verify we really found the resource
+ if (!found) {
+ error("Groovie::Resource: Couldn't find resource %s", name.c_str());
+ return (uint32)-1;
+ }
+
+ return resNum;
}
bool ResMan_v2::getResInfo(uint32 fileRef, ResInfo &resInfo) {
diff --git a/engines/groovie/resource.h b/engines/groovie/resource.h
index c87658999a..0a9a03b42c 100644
--- a/engines/groovie/resource.h
+++ b/engines/groovie/resource.h
@@ -27,7 +27,7 @@
#define GROOVIE_RESOURCE_H
namespace Common {
- class MacResManager;
+class MacResManager;
}
namespace Groovie {
@@ -44,7 +44,8 @@ public:
virtual ~ResMan() {}
Common::SeekableReadStream *open(uint32 fileRef);
- virtual uint16 getRef(Common::String name, Common::String scriptname = "") = 0;
+
+ virtual uint32 getRef(Common::String name, Common::String scriptname = "") = 0;
virtual bool getResInfo(uint32 fileRef, ResInfo &resInfo) = 0;
protected:
@@ -58,7 +59,7 @@ public:
ResMan_t7g(Common::MacResManager *macResFork = 0);
~ResMan_t7g() {}
- uint16 getRef(Common::String name, Common::String scriptname);
+ uint32 getRef(Common::String name, Common::String scriptname);
bool getResInfo(uint32 fileRef, ResInfo &resInfo);
private:
@@ -70,7 +71,7 @@ public:
ResMan_v2();
~ResMan_v2() {}
- uint16 getRef(Common::String name, Common::String scriptname);
+ uint32 getRef(Common::String name, Common::String scriptname);
bool getResInfo(uint32 fileRef, ResInfo &resInfo);
};
diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp
index 4d7157c797..be9c4f6921 100644
--- a/engines/groovie/roq.cpp
+++ b/engines/groovie/roq.cpp
@@ -30,7 +30,11 @@
#include "groovie/graphics.h"
#include "groovie/groovie.h"
+#include "common/debug.h"
+#include "common/textconsole.h"
+
#include "graphics/jpeg.h"
+#include "graphics/palette.h"
#ifdef USE_RGB_COLOR
// Required for the YUV to RGB conversion
@@ -175,7 +179,7 @@ void ROQPlayer::buildShowBuf() {
// Skip to the next pixel
out += _vm->_pixelFormat.bytesPerPixel;
if (!(x % _scaleX))
- in += _currBuf->bytesPerPixel;
+ in += _currBuf->format.bytesPerPixel;
}
#ifdef DITHER
_dither->nextLine();
@@ -328,8 +332,13 @@ bool ROQPlayer::processBlockInfo(ROQBlockHeader &blockHeader) {
_prevBuf->free();
// Allocate new buffers
- _currBuf->create(width, height, 3);
- _prevBuf->create(width, height, 3);
+ // These buffers use YUV data, since we can not describe it with a
+ // PixelFormat struct we just add some dummy PixelFormat with the
+ // correct bytes per pixel value. Since the surfaces are only used
+ // internally and no code assuming RGB data is present is used on
+ // them it should be just fine.
+ _currBuf->create(width, height, Graphics::PixelFormat(3, 0, 0, 0, 0, 0, 0, 0, 0));
+ _prevBuf->create(width, height, Graphics::PixelFormat(3, 0, 0, 0, 0, 0, 0, 0, 0));
// Clear the buffers with black YUV values
byte *ptr1 = (byte *)_currBuf->getBasePtr(0, 0);
@@ -697,7 +706,7 @@ void ROQPlayer::copy(byte size, int destx, int desty, int offx, int offy) {
for (int i = 0; i < size; i++) {
// Copy the current line
- memcpy(dst, src, size * _currBuf->bytesPerPixel);
+ memcpy(dst, src, size * _currBuf->format.bytesPerPixel);
// Move to the beginning of the next line
dst += _currBuf->pitch;
diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index e68003f72e..5c9f119d81 100644
--- a/engines/groovie/script.cpp
+++ b/engines/groovie/script.cpp
@@ -37,8 +37,11 @@
#include "common/config-manager.h"
#include "common/debug-channels.h"
#include "common/EventRecorder.h"
+#include "common/file.h"
#include "common/macresman.h"
+#include "gui/message.h"
+
#define NUM_OPCODES 90
namespace Groovie {
@@ -65,7 +68,9 @@ static void debugScript(int level, bool nl, const char *s, ...) {
Script::Script(GroovieEngine *vm, EngineVersion version) :
_code(NULL), _savedCode(NULL), _stacktop(0), _debugger(NULL), _vm(vm),
- _videoFile(NULL), _videoRef(0), _staufsMove(NULL), _lastCursor(0xff) {
+ _videoFile(NULL), _videoRef(0), _staufsMove(NULL), _lastCursor(0xff),
+ _version(version) {
+
// Initialize the opcode set depending on the engine version
switch (version) {
case kGroovieT7G:
@@ -320,7 +325,7 @@ uint8 Script::readScriptChar(bool allow7C, bool limitVal, bool limitVar) {
return result;
}
-uint16 Script::getVideoRefString() {
+uint32 Script::getVideoRefString() {
Common::String str;
byte c;
@@ -412,6 +417,13 @@ void Script::savegame(uint slot) {
char newchar;
Common::OutSaveFile *file = SaveLoad::openForSaving(ConfMan.getActiveDomainName(), slot);
+ if (!file) {
+ debugC(9, kGroovieDebugScript, "Save file pointer is null");
+ GUI::MessageDialog dialog("Failed to save game", "OK");
+ dialog.runModal();
+ return;
+ }
+
// Saving the variables. It is endian safe because they're byte variables
file->write(_variables, 0x400);
delete file;
@@ -722,7 +734,7 @@ void Script::o_hotspot_center() {
debugScript(5, true, "HOTSPOT-CENTER @0x%04X", address);
- // Mark the centremost 240 pixels of the game area
+ // Mark the centermost 240 pixels of the game area
Common::Rect rect(200, 80, 440, 400);
hotspot(rect, address, 0);
}
@@ -1020,7 +1032,7 @@ void Script::o_add() {
void Script::o_videofromstring1() {
uint16 instStart = _currentInstruction;
- uint16 fileref = getVideoRefString();
+ uint32 fileref = getVideoRefString();
// Show the debug information just when starting the playback
if (fileref != _videoRef) {
@@ -1036,7 +1048,7 @@ void Script::o_videofromstring1() {
void Script::o_videofromstring2() {
uint16 instStart = _currentInstruction;
- uint16 fileref = getVideoRefString();
+ uint32 fileref = getVideoRefString();
// Show the debug information just when starting the playback
if (fileref != _videoRef) {
diff --git a/engines/groovie/script.h b/engines/groovie/script.h
index 2360d45744..c5ad6da78b 100644
--- a/engines/groovie/script.h
+++ b/engines/groovie/script.h
@@ -77,6 +77,8 @@ private:
bool _firstbit;
uint8 _lastCursor;
+ EngineVersion _version;
+
// Script filename (for debugging purposes)
Common::String _scriptFile;
Common::String _savedScriptFile;
@@ -138,7 +140,7 @@ private:
uint16 readScript8or16bits();
uint8 readScriptChar(bool allow7C, bool limitVal, bool limitVar);
uint8 readScriptVar();
- uint16 getVideoRefString();
+ uint32 getVideoRefString();
bool hotspot(Common::Rect rect, uint16 addr, uint8 cursor);
diff --git a/engines/groovie/vdx.cpp b/engines/groovie/vdx.cpp
index 61e5e3f6d7..b6f06d7011 100644
--- a/engines/groovie/vdx.cpp
+++ b/engines/groovie/vdx.cpp
@@ -28,9 +28,12 @@
#include "groovie/groovie.h"
#include "groovie/lzss.h"
+#include "common/debug.h"
#include "common/debug-channels.h"
+#include "common/textconsole.h"
#include "audio/mixer.h"
#include "audio/decoders/raw.h"
+#include "graphics/palette.h"
#define TILE_SIZE 4 // Size of each tile on the image: only ever seen 4 so far
#define VDX_IDENT 0x9267 // 37479
@@ -70,7 +73,7 @@ uint16 VDXPlayer::loadInternal() {
}
// Flags:
// - 1 Puzzle piece? Skip palette, don't redraw full screen, draw still to b/ack buffer
- // - 2 Transparent colour is 0xFF
+ // - 2 Transparent color is 0xFF
// - 5 Skip still chunks
// - 7
// - 8 Just show the first frame
@@ -256,26 +259,26 @@ void VDXPlayer::getDelta(Common::ReadStream *in) {
uint16 currentLine = 0;
uint32 offset = 0;
while (!in->eos()) {
- byte colours[16];
+ byte colors[16];
if (currOpCode < 0x60) {
param1 = in->readByte();
param2 = in->readByte();
- expandColourMap(colours, vdxBlockMapLookup[currOpCode], param1, param2);
- decodeBlockDelta(offset, colours, 640);
+ expandColorMap(colors, vdxBlockMapLookup[currOpCode], param1, param2);
+ decodeBlockDelta(offset, colors, 640);
offset += TILE_SIZE;
} else if (currOpCode > 0x7f) {
param1 = in->readByte();
param2 = in->readByte();
param3 = in->readByte();
- expandColourMap(colours, (param1 << 8) + currOpCode, param2, param3);
- decodeBlockDelta(offset, colours, 640);
+ expandColorMap(colors, (param1 << 8) + currOpCode, param2, param3);
+ decodeBlockDelta(offset, colors, 640);
offset += TILE_SIZE;
} else switch (currOpCode) {
- case 0x60: /* Fill tile with the 16 colours given as parameters */
+ case 0x60: /* Fill tile with the 16 colors given as parameters */
for (l = 0; l < 16; l++) {
- colours[l] = in->readByte();
+ colors[l] = in->readByte();
}
- decodeBlockDelta(offset, colours, 640);
+ decodeBlockDelta(offset, colors, 640);
offset += TILE_SIZE;
break;
case 0x61: /* Skip to the end of this line, next block is start of next */
@@ -304,14 +307,14 @@ void VDXPlayer::getDelta(Common::ReadStream *in) {
case 0x72:
case 0x73:
case 0x74:
- case 0x75: /* Next param1 blocks are filled with colour param2 */
+ case 0x75: /* Next param1 blocks are filled with color param2 */
param1 = currOpCode - 0x6b;
param2 = in->readByte();
for (l = 0; l < 16; l++) {
- colours[l] = param2;
+ colors[l] = param2;
}
for (k = 0; k < param1; k++) {
- decodeBlockDelta(offset, colours, 640);
+ decodeBlockDelta(offset, colors, 640);
offset += TILE_SIZE;
}
break;
@@ -324,14 +327,14 @@ void VDXPlayer::getDelta(Common::ReadStream *in) {
case 0x7c:
case 0x7d:
case 0x7e:
- case 0x7f: /* Next bytes contain colours to fill the next param1 blocks in the current line*/
+ case 0x7f: /* Next bytes contain colors to fill the next param1 blocks in the current line*/
param1 = currOpCode - 0x75;
for (k = 0; k < param1; k++) {
param2 = in->readByte();
for (l = 0; l < 16; l++) {
- colours[l] = param2;
+ colors[l] = param2;
}
- decodeBlockDelta(offset, colours, 640);
+ decodeBlockDelta(offset, colors, 640);
offset += TILE_SIZE;
}
break;
@@ -349,8 +352,8 @@ void VDXPlayer::getStill(Common::ReadStream *in) {
debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::VDX: numYTiles=%d", numYTiles);
// It's skipped in the original:
- uint16 colourDepth = in->readUint16LE();
- debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::VDX: colourDepth=%d", colourDepth);
+ uint16 colorDepth = in->readUint16LE();
+ debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::VDX: colorDepth=%d", colorDepth);
uint16 imageWidth = TILE_SIZE * numXTiles;
@@ -383,15 +386,15 @@ void VDXPlayer::getStill(Common::ReadStream *in) {
// Skip the frame when flag 5 is set, unless flag 1 is set
if (!_flagFive || _flagOne) {
- byte colours[16];
+ byte colors[16];
for (uint16 j = 0; j < numYTiles; j++) {
byte *currentTile = buf + j * TILE_SIZE * imageWidth;
for (uint16 i = numXTiles; i; i--) {
- uint8 colour1 = in->readByte();
- uint8 colour0 = in->readByte();
- uint16 colourMap = in->readUint16LE();
- expandColourMap(colours, colourMap, colour1, colour0);
- decodeBlockStill(currentTile, colours, 640, mask);
+ uint8 color1 = in->readByte();
+ uint8 color0 = in->readByte();
+ uint16 colorMap = in->readUint16LE();
+ expandColorMap(colors, colorMap, color1, color0);
+ decodeBlockStill(currentTile, colors, 640, mask);
currentTile += TILE_SIZE;
}
@@ -430,22 +433,22 @@ void VDXPlayer::getStill(Common::ReadStream *in) {
}
}
-void VDXPlayer::expandColourMap(byte *out, uint16 colourMap, uint8 colour1, uint8 colour0) {
+void VDXPlayer::expandColorMap(byte *out, uint16 colorMap, uint8 color1, uint8 color0) {
// It's a bit faster to start from the end
out += 16;
for (int i = 16; i; i--) {
- // Set the corresponding colour
+ // Set the corresponding color
// The following is an optimized version of:
- // *--out = (colourMap & 1) ? colour1 : colour0;
- uint8 selector = -(colourMap & 1);
- *--out = (selector & colour1) | (~selector & colour0);
+ // *--out = (colorMap & 1) ? color1 : color0;
+ uint8 selector = -(colorMap & 1);
+ *--out = (selector & color1) | (~selector & color0);
- // Update the flag map to test the next colour
- colourMap >>= 1;
+ // Update the flag map to test the next color
+ colorMap >>= 1;
}
}
-void VDXPlayer::decodeBlockStill(byte *buf, byte *colours, uint16 imageWidth, uint8 mask) {
+void VDXPlayer::decodeBlockStill(byte *buf, byte *colors, uint16 imageWidth, uint8 mask) {
assert(TILE_SIZE == 4);
for (int y = TILE_SIZE; y; y--) {
@@ -453,15 +456,15 @@ void VDXPlayer::decodeBlockStill(byte *buf, byte *colours, uint16 imageWidth, ui
// TODO: optimize with bit logic?
for (int x = 0; x < TILE_SIZE; x++) {
// 0xff pixels don't modify the buffer
- if (*colours != 0xff) {
- // Write the colour
- *buf = *colours | mask;
+ if (*colors != 0xff) {
+ // Write the color
+ *buf = *colors | mask;
// Note: if the mask is 0, it paints the image
// else, it paints the image's mask using 0xff
}
- // Point to the next colour
- colours++;
+ // Point to the next color
+ colors++;
// Point to the next pixel
buf++;
@@ -470,8 +473,8 @@ void VDXPlayer::decodeBlockStill(byte *buf, byte *colours, uint16 imageWidth, ui
// Point to the start of the next line
buf += imageWidth - TILE_SIZE;
} else {
- *((uint32 *)buf) = *((uint32 *)colours);
- colours += 4;
+ *((uint32 *)buf) = *((uint32 *)colors);
+ colors += 4;
// Point to the start of the next line
buf += imageWidth;
@@ -479,7 +482,7 @@ void VDXPlayer::decodeBlockStill(byte *buf, byte *colours, uint16 imageWidth, ui
}
}
-void VDXPlayer::decodeBlockDelta(uint32 offset, byte *colours, uint16 imageWidth) {
+void VDXPlayer::decodeBlockDelta(uint32 offset, byte *colors, uint16 imageWidth) {
assert(TILE_SIZE == 4);
byte *dest;
@@ -506,19 +509,19 @@ void VDXPlayer::decodeBlockDelta(uint32 offset, byte *colours, uint16 imageWidth
for (int x = 0; x < TILE_SIZE; x++) {
// TODO: this can probably be optimized with bit logic
if (fgBuf[x] != 0xff) {
- if (*colours == 0xff) {
+ if (*colors == 0xff) {
dest[x] = fgBuf[x];
} else {
- dest[x] = *colours;
+ dest[x] = *colors;
}
}
- colours++;
+ colors++;
}
fgBuf += imageWidth;
} else {
// Paint directly
- *((uint32 *)dest) = *((uint32 *)colours);
- colours += 4;
+ *((uint32 *)dest) = *((uint32 *)colors);
+ colors += 4;
}
// Move to the next line
diff --git a/engines/groovie/vdx.h b/engines/groovie/vdx.h
index 0b29493108..31c7606cb7 100644
--- a/engines/groovie/vdx.h
+++ b/engines/groovie/vdx.h
@@ -29,7 +29,7 @@
#include "groovie/player.h"
namespace Common {
- class ReadStream;
+class ReadStream;
}
namespace Groovie {
@@ -73,9 +73,9 @@ private:
void getStill(Common::ReadStream *in);
void getDelta(Common::ReadStream *in);
- void expandColourMap(byte *out, uint16 colourMap, uint8 colour1, uint8 colour0);
- void decodeBlockStill(byte *buf, byte *colours, uint16 imageWidth, uint8 mask);
- void decodeBlockDelta(uint32 offset, byte *colours, uint16 imageWidth);
+ void expandColorMap(byte *out, uint16 colorMap, uint8 color1, uint8 color0);
+ void decodeBlockStill(byte *buf, byte *colors, uint16 imageWidth, uint8 mask);
+ void decodeBlockDelta(uint32 offset, byte *colors, uint16 imageWidth);
void chunkSound(Common::ReadStream *in);
void setPalette(uint8 *palette);
void fadeIn(uint8 *palette);
diff --git a/engines/hugo/detection.cpp b/engines/hugo/detection.cpp
index e862e339ce..95302c9235 100644
--- a/engines/hugo/detection.cpp
+++ b/engines/hugo/detection.cpp
@@ -26,6 +26,7 @@
#include "engines/advancedDetector.h"
#include "common/system.h"
#include "common/savefile.h"
+#include "common/textconsole.h"
#include "graphics/thumbnail.h"
#include "graphics/surface.h"
diff --git a/engines/hugo/dialogs.cpp b/engines/hugo/dialogs.cpp
index ead432c5df..f0dc84eae8 100644
--- a/engines/hugo/dialogs.cpp
+++ b/engines/hugo/dialogs.cpp
@@ -26,6 +26,7 @@
#include "common/substream.h"
#include "graphics/imagedec.h"
#include "gui/gui-manager.h"
+#include "gui/ThemeEval.h"
#include "hugo/hugo.h"
#include "hugo/display.h"
@@ -132,7 +133,7 @@ void TopMenu::loadBmpArr(Common::SeekableReadStream &in) {
Common::SeekableSubReadStream stream(&in, filPos, filPos + bmpSize);
arrayBmp[i * 2] = Graphics::ImageDecoder::loadFile(stream, g_system->getOverlayFormat());
arrayBmp[i * 2 + 1] = new Graphics::Surface();
- arrayBmp[i * 2 + 1]->create(arrayBmp[i * 2]->w * 2, arrayBmp[i * 2]->h * 2, arrayBmp[i * 2]->bytesPerPixel);
+ arrayBmp[i * 2 + 1]->create(arrayBmp[i * 2]->w * 2, arrayBmp[i * 2]->h * 2, g_system->getOverlayFormat());
byte *src = (byte *)arrayBmp[i * 2]->pixels;
byte *dst = (byte *)arrayBmp[i * 2 + 1]->pixels;
@@ -140,12 +141,12 @@ void TopMenu::loadBmpArr(Common::SeekableReadStream &in) {
src = (byte *)arrayBmp[i * 2]->getBasePtr(0, j);
dst = (byte *)arrayBmp[i * 2 + 1]->getBasePtr(0, j * 2);
for (int k = arrayBmp[i * 2]->w; k > 0; k--) {
- for (int m = arrayBmp[i * 2]->bytesPerPixel; m > 0; m--) {
+ for (int m = arrayBmp[i * 2]->format.bytesPerPixel; m > 0; m--) {
*dst++ = *src++;
}
- src -= arrayBmp[i * 2]->bytesPerPixel;
+ src -= arrayBmp[i * 2]->format.bytesPerPixel;
- for (int m = arrayBmp[i * 2]->bytesPerPixel; m > 0; m--) {
+ for (int m = arrayBmp[i * 2]->format.bytesPerPixel; m > 0; m--) {
*dst++ = *src++;
}
}
@@ -164,7 +165,8 @@ void TopMenu::handleCommand(GUI::CommandSender *sender, uint32 command, uint32 d
switch (command) {
case kCmdWhat:
close();
- _vm->_file->instructions();
+ _vm->getGameStatus().helpFl = true;
+
break;
case kCmdMusic:
_vm->_sound->toggleMusic();
@@ -231,12 +233,52 @@ void TopMenu::handleMouseUp(int x, int y, int button, int clickCount) {
}
EntryDialog::EntryDialog(const Common::String &title, const Common::String &buttonLabel, const Common::String &defaultValue) : GUI::Dialog(20, 20, 100, 50) {
- new GUI::StaticTextWidget(this, 0, 0, 10, 10, title, Graphics::kTextAlignCenter);
-
- _text = new GUI::EditTextWidget(this, 0, 0, 50, 10, "");
+ const int screenW = g_system->getOverlayWidth();
+ const int screenH = g_system->getOverlayHeight();
+
+ int buttonWidth = g_gui.xmlEval()->getVar("Globals.Button.Width", 0);
+ int buttonHeight = g_gui.xmlEval()->getVar("Globals.Button.Height", 0);
+
+ // First, determine the size the dialog needs. For this we have to break
+ // down the string into lines, and taking the maximum of their widths.
+ // Using this, and accounting for the space the button(s) need, we can set
+ // the real size of the dialog
+ Common::Array<Common::String> lines;
+ int lineCount, buttonPos;
+ int maxlineWidth = g_gui.getFont().wordWrapText(title, screenW - 2 * 30, lines);
+
+ // Calculate the desired dialog size (maxing out at 300*180 for now)
+ _w = MAX(maxlineWidth, buttonWidth) + 20;
+
+ lineCount = lines.size();
+
+ _h = 16 + buttonHeight + 8;
+
+ // Limit the number of lines so that the dialog still fits on the screen.
+ if (lineCount > (screenH - 20 - _h) / kLineHeight) {
+ lineCount = (screenH - 20 - _h) / kLineHeight;
+ }
+ _h += lineCount * kLineHeight;
+
+ // Center the dialog
+ _x = (screenW - _w) / 2;
+ _y = (screenH - _h) / 2;
+
+ // Each line is represented by one static text item.
+ for (int i = 0; i < lineCount; i++) {
+ new GUI::StaticTextWidget(this, 10, 10 + i * kLineHeight, maxlineWidth, kLineHeight,
+ lines[i], Graphics::kTextAlignCenter);
+ }
+
+ _text = new GUI::EditTextWidget(this, 10, 10 + lineCount * (kLineHeight + 1), _w - 20, kLineHeight, "", "", 0, kCmdFinishEdit);
_text->setEditString(defaultValue);
- new GUI::ButtonWidget(this, 20, 20, 30, 10, buttonLabel, 0, kCmdButton);
+ _h += kLineHeight + 5;
+
+ buttonPos = (_w - buttonWidth) / 2;
+
+ new GUI::ButtonWidget(this, buttonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, buttonLabel, 0, kCmdButton, Common::ASCII_RETURN); // Confirm dialog
+
}
EntryDialog::~EntryDialog() {
@@ -245,6 +287,7 @@ EntryDialog::~EntryDialog() {
void EntryDialog::handleCommand(GUI::CommandSender *sender, uint32 command, uint32 data) {
switch (command) {
case kCmdButton:
+ case kCmdFinishEdit:
close();
break;
default:
@@ -252,11 +295,4 @@ void EntryDialog::handleCommand(GUI::CommandSender *sender, uint32 command, uint
}
}
-void EntryDialog::reflowLayout() {
-}
-
-void EntryDialog::init() {
-}
-
-
} // End of namespace Hugo
diff --git a/engines/hugo/dialogs.h b/engines/hugo/dialogs.h
index f870414a93..56dbd41f81 100644
--- a/engines/hugo/dialogs.h
+++ b/engines/hugo/dialogs.h
@@ -67,7 +67,8 @@ enum {
kCmdInvent = 'INVT',
// EntryDialog commands
- kCmdButton = 'BTNP'
+ kCmdButton = 'BTNP',
+ kCmdFinishEdit = 'FNSH'
};
class TopMenu : public GUI::Dialog {
@@ -105,14 +106,11 @@ public:
EntryDialog(const Common::String &title, const Common::String &buttonLabel, const Common::String &defaultValue);
virtual ~EntryDialog();
- void reflowLayout();
void handleCommand(GUI::CommandSender *sender, uint32 command, uint32 data);
const Common::String &getEditString() const { return _text->getEditString(); }
protected:
- void init();
-
GUI::EditTextWidget *_text;
};
diff --git a/engines/hugo/display.cpp b/engines/hugo/display.cpp
index 333eb59707..af4d094ceb 100644
--- a/engines/hugo/display.cpp
+++ b/engines/hugo/display.cpp
@@ -32,8 +32,11 @@
// Display.c - DIB related code for HUGOWIN
+#include "common/debug.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "graphics/cursorman.h"
+#include "graphics/palette.h"
#include "hugo/hugo.h"
#include "hugo/display.h"
@@ -507,6 +510,9 @@ void Screen::drawStatusText() {
sdx = stringLength(_vm->_scoreLine);
posY = 0;
+
+ //Display a black behind the score line
+ _vm->_screen->drawRectangle(true, 0, 0, kXPix, 8, _TBLACK);
writeStr(posX, posY, _vm->_scoreLine, _TCYAN);
displayList(kDisplayAdd, posX, posY, sdx, sdy);
}
diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp
index a0e3ff05ce..ba4e420111 100644
--- a/engines/hugo/file.cpp
+++ b/engines/hugo/file.cpp
@@ -30,8 +30,10 @@
*
*/
+#include "common/debug.h"
#include "common/system.h"
#include "common/savefile.h"
+#include "common/textconsole.h"
#include "common/config-manager.h"
#include "graphics/thumbnail.h"
#include "gui/saveload.h"
@@ -298,7 +300,11 @@ sound_pt FileManager::getSound(const int16 sound, uint16 *size) {
}
if (!has_read_header) {
- if (fp.read(s_hdr, sizeof(s_hdr)) != sizeof(s_hdr))
+ for (int i = 0; i < kMaxSounds; i++) {
+ s_hdr[i].size = fp.readUint16LE();
+ s_hdr[i].offset = fp.readUint32LE();
+ }
+ if (fp.err())
error("Wrong sound file format");
has_read_header = true;
}
@@ -400,7 +406,7 @@ bool FileManager::saveGame(const int16 slot, const Common::String &descrip) {
out->writeByte((gameStatus.gameOverFl) ? 1 : 0);
// Save screen states
- for (int i = 0; i < _vm->_numScreens; i++)
+ for (int i = 0; i < _vm->_numStates; i++)
out->writeByte(_vm->_screenStates[i]);
_vm->_scheduler->saveSchedulerData(out);
@@ -497,7 +503,7 @@ bool FileManager::restoreGame(const int16 slot) {
gameStatus.storyModeFl = (in->readByte() == 1);
_vm->_mouse->setJumpExitFl(in->readByte() == 1);
gameStatus.gameOverFl = (in->readByte() == 1);
- for (int i = 0; i < _vm->_numScreens; i++)
+ for (int i = 0; i < _vm->_numStates; i++)
_vm->_screenStates[i] = in->readByte();
_vm->_scheduler->restoreSchedulerData(in);
diff --git a/engines/hugo/file_v1d.cpp b/engines/hugo/file_v1d.cpp
index 48f274e88a..021969f306 100644
--- a/engines/hugo/file_v1d.cpp
+++ b/engines/hugo/file_v1d.cpp
@@ -30,7 +30,9 @@
*
*/
+#include "common/debug.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "hugo/hugo.h"
#include "hugo/file.h"
diff --git a/engines/hugo/file_v1w.cpp b/engines/hugo/file_v1w.cpp
index dbb093752a..4f327b3095 100644
--- a/engines/hugo/file_v1w.cpp
+++ b/engines/hugo/file_v1w.cpp
@@ -30,7 +30,9 @@
*
*/
+#include "common/debug.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "hugo/hugo.h"
#include "hugo/file.h"
diff --git a/engines/hugo/file_v2d.cpp b/engines/hugo/file_v2d.cpp
index ffadd17481..0ad89e987e 100644
--- a/engines/hugo/file_v2d.cpp
+++ b/engines/hugo/file_v2d.cpp
@@ -30,7 +30,9 @@
*
*/
+#include "common/debug.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "hugo/hugo.h"
#include "hugo/file.h"
@@ -167,10 +169,10 @@ const char *FileManager_v2d::fetchString(const int index) {
// Get offset to string[index] (and next for length calculation)
_stringArchive.seek((uint32)index * sizeof(uint32), SEEK_SET);
- uint32 off1, off2;
- if (_stringArchive.read((char *)&off1, sizeof(uint32)) == 0)
- error("An error has occurred: bad String offset");
- if (_stringArchive.read((char *)&off2, sizeof(uint32)) == 0)
+
+ uint32 off1 = _stringArchive.readUint32LE();
+ uint32 off2 = _stringArchive.readUint32LE();
+ if (!off1 || !off2)
error("An error has occurred: bad String offset");
// Check size of string
diff --git a/engines/hugo/file_v3d.cpp b/engines/hugo/file_v3d.cpp
index 2f3e5af3f0..6370fffa4d 100644
--- a/engines/hugo/file_v3d.cpp
+++ b/engines/hugo/file_v3d.cpp
@@ -30,7 +30,9 @@
*
*/
+#include "common/debug.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "hugo/hugo.h"
#include "hugo/file.h"
diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp
index ba87f58150..a872a97bae 100644
--- a/engines/hugo/hugo.cpp
+++ b/engines/hugo/hugo.cpp
@@ -25,13 +25,14 @@
#include "common/system.h"
#include "common/random.h"
+#include "common/error.h"
#include "common/events.h"
#include "common/EventRecorder.h"
#include "common/debug-channels.h"
#include "common/config-manager.h"
+#include "common/textconsole.h"
#include "hugo/hugo.h"
-#include "hugo/game.h"
#include "hugo/file.h"
#include "hugo/schedule.h"
#include "hugo/display.h"
@@ -53,7 +54,7 @@ HugoEngine *HugoEngine::s_Engine = 0;
HugoEngine::HugoEngine(OSystem *syst, const HugoGameDescription *gd) : Engine(syst), _gameDescription(gd),
_hero(0), _heroImage(0), _defltTunes(0), _numScreens(0), _tunesNbr(0), _soundSilence(0), _soundTest(0),
- _screenStates(0), _score(0), _maxscore(0), _lastTime(0), _curTime(0), _episode(0)
+ _screenStates(0), _numStates(0), _score(0), _maxscore(0), _lastTime(0), _curTime(0), _episode(0)
{
_system = syst;
DebugMan.addDebugChannel(kDebugSchedule, "Schedule", "Script Schedule debug level");
@@ -298,6 +299,10 @@ Common::Error HugoEngine::run() {
break;
}
}
+ if (_status.helpFl) {
+ _status.helpFl = false;
+ _file->instructions();
+ }
_mouse->mouseHandler(); // Mouse activity - adds to display list
_screen->displayList(kDisplayDisplay); // Blit the display list to screen
@@ -323,9 +328,6 @@ void HugoEngine::initMachine() {
*/
void HugoEngine::runMachine() {
status_t &gameStatus = getGameStatus();
- // Don't process if we're in a textbox
- if (gameStatus.textBoxFl)
- return;
// Don't process if gameover
if (gameStatus.gameOverFl)
@@ -463,6 +465,7 @@ bool HugoEngine::loadHugoDat() {
for (int varnt = 0; varnt < _numVariant; varnt++) {
numElem = in.readUint16BE();
if (varnt == _gameVariant) {
+ _numStates = numElem;
_screenStates = (byte *)malloc(sizeof(byte) * numElem);
memset(_screenStates, 0, sizeof(_screenStates));
}
@@ -530,13 +533,13 @@ void HugoEngine::initStatus() {
debugC(1, kDebugEngine, "initStatus");
_status.storyModeFl = false; // Not in story mode
_status.gameOverFl = false; // Hero not knobbled yet
- _status.textBoxFl = false; // Not processing a text box
_status.lookFl = false; // Toolbar "look" button
_status.recallFl = false; // Toolbar "recall" button
_status.newScreenFl = false; // Screen not just loaded
_status.godModeFl = false; // No special cheats allowed
_status.doQuitFl = false;
_status.skipIntroFl = false;
+ _status.helpFl = false;
// Initialize every start of new game
_status.tick = 0; // Tick count
@@ -553,6 +556,7 @@ void HugoEngine::initStatus() {
// _status.screenWidth = 0; // Desktop screen width
// _status.saveTick = 0; // Time of last save
// _status.saveSlot = 0; // Slot to save/restore game
+// _status.textBoxFl = false; // Not processing a text box
}
/**
diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h
index ed021f5cd6..b2d241f241 100644
--- a/engines/hugo/hugo.h
+++ b/engines/hugo/hugo.h
@@ -176,13 +176,13 @@ struct HugoGameDescription;
struct status_t { // Game status (not saved)
bool storyModeFl; // Game is telling story - no commands
bool gameOverFl; // Game is over - hero knobbled
- bool textBoxFl; // Game is (halted) in text box
bool lookFl; // Toolbar "look" button pressed
bool recallFl; // Toolbar "recall" button pressed
bool newScreenFl; // New screen just loaded in dib_a
bool godModeFl; // Allow DEBUG features in live version
bool doQuitFl;
bool skipIntroFl;
+ bool helpFl;
uint32 tick; // Current time in ticks
vstate_t viewState; // View state machine
int16 song; // Current song
@@ -194,6 +194,7 @@ struct status_t { // Game status (not saved)
// bool helpFl; // Calling WinHelp (don't disable music)
// bool mmtimeFl; // Multimedia timer supported
// bool demoFl; // Game is in demo mode
+// bool textBoxFl; // Game is (halted) in text box
// int16 screenWidth; // Desktop screen width
// int16 saveSlot; // Current slot to save/restore game
// int16 cx, cy; // Cursor position (dib coords)
@@ -238,6 +239,7 @@ public:
int8 _soundTest;
int8 _tunesNbr;
uint16 _numScreens;
+ uint16 _numStates;
int8 _normalTPS; // Number of ticks (frames) per second.
// 8 for Win versions, 9 for DOS versions
object_t *_hero;
diff --git a/engines/hugo/intro.cpp b/engines/hugo/intro.cpp
index 63e81924c4..c31d76abd0 100644
--- a/engines/hugo/intro.cpp
+++ b/engines/hugo/intro.cpp
@@ -31,6 +31,7 @@
*/
#include "common/system.h"
+#include "common/textconsole.h"
#include "hugo/hugo.h"
#include "hugo/intro.h"
@@ -93,7 +94,7 @@ void intro_v1d::introInit() {
surf.h = 200;
surf.pixels = _vm->_screen->getFrontBuffer();
surf.pitch = 320;
- surf.bytesPerPixel = 1;
+ surf.format = Graphics::PixelFormat::createFormatCLUT8();
_vm->_screen->displayList(kDisplayInit);
}
@@ -247,7 +248,7 @@ void intro_v2d::introInit() {
surf.h = 200;
surf.pixels = _vm->_screen->getFrontBuffer();
surf.pitch = 320;
- surf.bytesPerPixel = 1;
+ surf.format = Graphics::PixelFormat::createFormatCLUT8();
char buffer[128];
@@ -293,7 +294,7 @@ void intro_v3d::introInit() {
surf.h = 200;
surf.pixels = _vm->_screen->getFrontBuffer();
surf.pitch = 320;
- surf.bytesPerPixel = 1;
+ surf.format = Graphics::PixelFormat::createFormatCLUT8();
char buffer[128];
if (_vm->_boot.registered)
diff --git a/engines/hugo/inventory.cpp b/engines/hugo/inventory.cpp
index ab58e386ba..45893f6965 100644
--- a/engines/hugo/inventory.cpp
+++ b/engines/hugo/inventory.cpp
@@ -30,6 +30,7 @@
*
*/
+#include "common/debug.h"
#include "common/system.h"
#include "hugo/hugo.h"
diff --git a/engines/hugo/mouse.cpp b/engines/hugo/mouse.cpp
index 1b2dd588b8..c02908e579 100644
--- a/engines/hugo/mouse.cpp
+++ b/engines/hugo/mouse.cpp
@@ -32,6 +32,7 @@
// mouse.cpp : Handle all mouse activity
+#include "common/debug.h"
#include "common/system.h"
#include "hugo/hugo.h"
@@ -363,6 +364,7 @@ void MouseHandler::readHotspot(Common::ReadStream &in, hotspot_t &hotspot) {
void MouseHandler::loadHotspots(Common::ReadStream &in) {
hotspot_t *wrkHotspots = 0;
hotspot_t tmp;
+ memset(&tmp, 0, sizeof(tmp));
for (int varnt = 0; varnt < _vm->_numVariant; varnt++) {
int numRows = in.readUint16BE();
if (varnt == _vm->_gameVariant)
diff --git a/engines/hugo/object.cpp b/engines/hugo/object.cpp
index 0a52a0f62d..acf9f6e50c 100644
--- a/engines/hugo/object.cpp
+++ b/engines/hugo/object.cpp
@@ -30,8 +30,7 @@
*
*/
-#include "common/system.h"
-#include "common/random.h"
+#include "common/debug.h"
#include "hugo/hugo.h"
#include "hugo/game.h"
diff --git a/engines/hugo/object_v1d.cpp b/engines/hugo/object_v1d.cpp
index a8edb45746..95bedf4fa2 100644
--- a/engines/hugo/object_v1d.cpp
+++ b/engines/hugo/object_v1d.cpp
@@ -30,6 +30,7 @@
*
*/
+#include "common/debug.h"
#include "common/system.h"
#include "common/random.h"
diff --git a/engines/hugo/object_v1w.cpp b/engines/hugo/object_v1w.cpp
index f3ba793a3b..54becd8234 100644
--- a/engines/hugo/object_v1w.cpp
+++ b/engines/hugo/object_v1w.cpp
@@ -30,6 +30,7 @@
*
*/
+#include "common/debug.h"
#include "common/system.h"
#include "common/random.h"
diff --git a/engines/hugo/object_v2d.cpp b/engines/hugo/object_v2d.cpp
index b3c49262ad..7c47bf4f92 100644
--- a/engines/hugo/object_v2d.cpp
+++ b/engines/hugo/object_v2d.cpp
@@ -30,6 +30,7 @@
*
*/
+#include "common/debug.h"
#include "common/system.h"
#include "common/random.h"
diff --git a/engines/hugo/object_v3d.cpp b/engines/hugo/object_v3d.cpp
index 2c6fc5d99d..3ff6c56ad3 100644
--- a/engines/hugo/object_v3d.cpp
+++ b/engines/hugo/object_v3d.cpp
@@ -30,6 +30,7 @@
*
*/
+#include "common/debug.h"
#include "common/system.h"
#include "common/random.h"
diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp
index feee4cbadd..29a1d5efa3 100644
--- a/engines/hugo/parser.cpp
+++ b/engines/hugo/parser.cpp
@@ -30,12 +30,8 @@
*
*/
-#include "common/system.h"
#include "common/events.h"
-
-#include "common/random.h"
-#include "common/EventRecorder.h"
-#include "common/debug-channels.h"
+#include "common/textconsole.h"
#include "hugo/hugo.h"
#include "hugo/display.h"
@@ -87,6 +83,7 @@ void Parser::readCmd(Common::ReadStream &in, cmd &curCmd) {
*/
void Parser::loadCmdList(Common::ReadStream &in) {
cmd tmpCmd;
+ memset(&tmpCmd, 0, sizeof(tmpCmd));
for (int varnt = 0; varnt < _vm->_numVariant; varnt++) {
uint16 numElem = in.readUint16BE();
if (varnt == _vm->_gameVariant) {
@@ -119,6 +116,7 @@ void Parser::readBG(Common::ReadStream &in, background_t &curBG) {
*/
void Parser::loadBackgroundObjects(Common::ReadStream &in) {
background_t tmpBG;
+ memset(&tmpBG, 0, sizeof(tmpBG));
for (int varnt = 0; varnt < _vm->_numVariant; varnt++) {
uint16 numElem = in.readUint16BE();
@@ -145,6 +143,7 @@ void Parser::loadBackgroundObjects(Common::ReadStream &in) {
void Parser::loadCatchallList(Common::ReadStream &in) {
background_t *wrkCatchallList = 0;
background_t tmpBG;
+ memset(&tmpBG, 0, sizeof(tmpBG));
for (int varnt = 0; varnt < _vm->_numVariant; varnt++) {
uint16 numElem = in.readUint16BE();
@@ -337,7 +336,7 @@ void Parser::keyHandler(Common::Event event) {
break;
case Common::KEYCODE_F1: // User Help (DOS)
if (_checkDoubleF1Fl)
- _vm->_file->instructions();
+ gameStatus.helpFl = true;
else
_vm->_screen->userHelp();
_checkDoubleF1Fl = !_checkDoubleF1Fl;
diff --git a/engines/hugo/parser.h b/engines/hugo/parser.h
index dd9244ba93..b00b8d5c43 100644
--- a/engines/hugo/parser.h
+++ b/engines/hugo/parser.h
@@ -32,6 +32,11 @@
#ifndef HUGO_PARSER_H
#define HUGO_PARSER_H
+
+namespace Common {
+struct Event;
+}
+
namespace Hugo {
enum seqTextParser {
diff --git a/engines/hugo/parser_v1d.cpp b/engines/hugo/parser_v1d.cpp
index de18427d93..b2e515fd42 100644
--- a/engines/hugo/parser_v1d.cpp
+++ b/engines/hugo/parser_v1d.cpp
@@ -32,6 +32,7 @@
// parser.c - handles all keyboard/command input
+#include "common/debug.h"
#include "common/system.h"
#include "hugo/hugo.h"
diff --git a/engines/hugo/parser_v1w.cpp b/engines/hugo/parser_v1w.cpp
index 305fb995e1..a39063357b 100644
--- a/engines/hugo/parser_v1w.cpp
+++ b/engines/hugo/parser_v1w.cpp
@@ -32,8 +32,7 @@
// parser.c - handles all keyboard/command input
-#include "common/system.h"
-#include "common/events.h"
+#include "common/debug.h"
#include "hugo/hugo.h"
#include "hugo/parser.h"
diff --git a/engines/hugo/parser_v2d.cpp b/engines/hugo/parser_v2d.cpp
index d6f2adfedc..6233f11c29 100644
--- a/engines/hugo/parser_v2d.cpp
+++ b/engines/hugo/parser_v2d.cpp
@@ -32,6 +32,7 @@
// parser.c - handles all keyboard/command input
+#include "common/debug.h"
#include "common/system.h"
#include "hugo/hugo.h"
@@ -121,7 +122,6 @@ void Parser_v2d::lineHandler() {
// SAVE/RESTORE
if (!strcmp("save", _vm->_line)) {
- _vm->_config.soundFl = false;
if (gameStatus.gameOverFl)
_vm->gameOverMsg();
else
@@ -130,7 +130,6 @@ void Parser_v2d::lineHandler() {
}
if (!strcmp("restore", _vm->_line)) {
- _vm->_config.soundFl = false;
_vm->_file->restoreGame(-1);
return;
}
diff --git a/engines/hugo/parser_v3d.cpp b/engines/hugo/parser_v3d.cpp
index f08d472240..8c4946c534 100644
--- a/engines/hugo/parser_v3d.cpp
+++ b/engines/hugo/parser_v3d.cpp
@@ -32,6 +32,7 @@
// parser.c - handles all keyboard/command input
+#include "common/debug.h"
#include "common/system.h"
#include "hugo/hugo.h"
@@ -123,7 +124,6 @@ void Parser_v3d::lineHandler() {
// SAVE/RESTORE
if (!strcmp("save", _vm->_line)) {
- _vm->_config.soundFl = false;
if (gameStatus.gameOverFl)
_vm->gameOverMsg();
else
@@ -132,7 +132,6 @@ void Parser_v3d::lineHandler() {
}
if (!strcmp("restore", _vm->_line)) {
- _vm->_config.soundFl = false;
_vm->_file->restoreGame(-1);
return;
}
diff --git a/engines/hugo/route.cpp b/engines/hugo/route.cpp
index 76ec583857..68b659cd3f 100644
--- a/engines/hugo/route.cpp
+++ b/engines/hugo/route.cpp
@@ -32,6 +32,7 @@
// Find shortest route from hero to destination
+#include "common/debug.h"
#include "common/system.h"
#include "hugo/hugo.h"
diff --git a/engines/hugo/schedule.cpp b/engines/hugo/schedule.cpp
index 45a2b77826..0e91124a7e 100644
--- a/engines/hugo/schedule.cpp
+++ b/engines/hugo/schedule.cpp
@@ -32,7 +32,9 @@
// This module contains all the scheduling and timing stuff
+#include "common/debug.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "hugo/hugo.h"
#include "hugo/schedule.h"
@@ -1143,6 +1145,10 @@ void Scheduler::insertAction(act *action) {
case AGSCHEDULE:
curEvent->localActionFl = false; // Lasts over a new screen
break;
+ // Workaround: When dying, switch to storyMode in order to block the keyboard.
+ case GAMEOVER:
+ _vm->getGameStatus().storyModeFl = true;
+ // No break on purpose
default:
curEvent->localActionFl = true; // Rest are for current screen only
break;
@@ -1529,28 +1535,22 @@ void Scheduler_v1d::runScheduler() {
}
void Scheduler_v1d::promptAction(act *action) {
- Utils::promptBox(_vm->_file->fetchString(action->a3.promptIndex));
-
- warning("STUB: doAction(act3)");
- // TODO: The answer of the player is not handled currently! Once it'll be read in the messageBox, uncomment this block
-#if 0
- char response[256];
- // TODO: Put user input in response
-
- Utils::strlwr(response);
- if (action->a3.encodedFl) {
- warning("Encrypted flag set");
- decodeString(response);
- }
+ Common::String response;
+
+ response = Utils::promptBox(_vm->_file->fetchString(action->a3.promptIndex));
+
+ response.toLowercase();
+
+ char resp[256];
+ strncpy(resp, response.c_str(), 256);
+
+ if (action->a3.encodedFl)
+ decodeString(resp);
- if (strstr(response, _vm->_file->fetchString(action->a3.responsePtr[0]))
+ if (strstr(resp, _vm->_file->fetchString(action->a3.responsePtr[0])))
insertActionList(action->a3.actPassIndex);
else
insertActionList(action->a3.actFailIndex);
-#endif
-
- // HACK: As the answer is not read, currently it's always considered correct
- insertActionList(action->a3.actPassIndex);
}
/**
@@ -1578,19 +1578,22 @@ const char *Scheduler_v2d::getCypher() const {
}
void Scheduler_v2d::promptAction(act *action) {
- Utils::promptBox(_vm->_file->fetchString(action->a3.promptIndex));
- warning("STUB: doAction(act3), expecting answer %s", _vm->_file->fetchString(action->a3.responsePtr[0]));
+ Common::String response;
+
+ response = Utils::promptBox(_vm->_file->fetchString(action->a3.promptIndex));
+ response.toLowercase();
- // TODO: The answer of the player is not handled currently! Once it'll be read in the messageBox, uncomment this block
-#if 0
- char *response = Utils::Box(BOX_PROMPT, "%s", _vm->_file->fetchString(action->a3.promptIndex));
+ debug(1, "doAction(act3), expecting answer %s", _vm->_file->fetchString(action->a3.responsePtr[0]));
bool found = false;
- char *tmpStr; // General purpose string ptr
+ const char *tmpStr; // General purpose string ptr
- for (dx = 0; !found && (action->a3.responsePtr[dx] != -1); dx++) {
+ 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(response) , tmpStr))
+ if (strstr(Utils::strlwr(resp), tmpStr))
found = true;
}
@@ -1598,10 +1601,6 @@ void Scheduler_v2d::promptAction(act *action) {
insertActionList(action->a3.actPassIndex);
else
insertActionList(action->a3.actFailIndex);
-#endif
-
- // HACK: As the answer is not read, currently it's always considered correct
- insertActionList(action->a3.actPassIndex);
}
/**
diff --git a/engines/hugo/sound.cpp b/engines/hugo/sound.cpp
index 24359a2c54..d657eb96a6 100644
--- a/engines/hugo/sound.cpp
+++ b/engines/hugo/sound.cpp
@@ -32,7 +32,9 @@
// sound.c - sound effects and music support
+#include "common/debug.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "common/config-manager.h"
#include "audio/decoders/raw.h"
diff --git a/engines/hugo/util.cpp b/engines/hugo/util.cpp
index 044b58e986..6846bc98af 100644
--- a/engines/hugo/util.cpp
+++ b/engines/hugo/util.cpp
@@ -104,6 +104,9 @@ Common::String promptBox(const Common::String &msg) {
return Common::String();
EntryDialog dialog(msg, "OK", "");
+
+ dialog.runModal();
+
return dialog.getEditString();
}
diff --git a/engines/kyra/animator_hof.cpp b/engines/kyra/animator_hof.cpp
index e1471239da..a563bc2b4f 100644
--- a/engines/kyra/animator_hof.cpp
+++ b/engines/kyra/animator_hof.cpp
@@ -26,7 +26,7 @@
#include "kyra/kyra_hof.h"
#include "kyra/wsamovie.h"
-#include "common/endian.h"
+#include "common/system.h"
namespace Kyra {
diff --git a/engines/kyra/animator_lok.cpp b/engines/kyra/animator_lok.cpp
index b906d3a724..452d5e8062 100644
--- a/engines/kyra/animator_lok.cpp
+++ b/engines/kyra/animator_lok.cpp
@@ -23,16 +23,13 @@
*
*/
-#include "common/endian.h"
-
#include "kyra/kyra_lok.h"
#include "kyra/screen.h"
#include "kyra/animator_lok.h"
#include "kyra/sprites.h"
-#include "common/system.h"
-
namespace Kyra {
+
Animator_LoK::Animator_LoK(KyraEngine_LoK *vm, OSystem *system) {
_vm = vm;
_screen = vm->screen();
diff --git a/engines/kyra/animator_mr.cpp b/engines/kyra/animator_mr.cpp
index e6daba7aeb..47c0e3b03a 100644
--- a/engines/kyra/animator_mr.cpp
+++ b/engines/kyra/animator_mr.cpp
@@ -27,6 +27,8 @@
#include "kyra/resource.h"
#include "kyra/wsamovie.h"
+#include "common/system.h"
+
namespace Kyra {
void KyraEngine_MR::restorePage3() {
diff --git a/engines/kyra/animator_tim.cpp b/engines/kyra/animator_tim.cpp
index 0290b2aa7f..fa42042bef 100644
--- a/engines/kyra/animator_tim.cpp
+++ b/engines/kyra/animator_tim.cpp
@@ -23,9 +23,6 @@
*
*/
-#include "common/endian.h"
-#include "common/system.h"
-
#include "kyra/script_tim.h"
#include "kyra/wsamovie.h"
#include "kyra/screen_lol.h"
@@ -36,6 +33,8 @@
#include "kyra/screen_v2.h"
#endif
+#include "common/system.h"
+
namespace Kyra {
#ifdef ENABLE_LOL
diff --git a/engines/kyra/animator_v2.cpp b/engines/kyra/animator_v2.cpp
index b06dffd36f..07ff4456e5 100644
--- a/engines/kyra/animator_v2.cpp
+++ b/engines/kyra/animator_v2.cpp
@@ -25,9 +25,6 @@
#include "kyra/kyra_v2.h"
#include "kyra/screen_v2.h"
-#include "kyra/wsamovie.h"
-
-#include "common/endian.h"
namespace Kyra {
diff --git a/engines/kyra/debugger.cpp b/engines/kyra/debugger.cpp
index 301271ad3c..066648b96f 100644
--- a/engines/kyra/debugger.cpp
+++ b/engines/kyra/debugger.cpp
@@ -23,18 +23,15 @@
*
*/
-
-#include "common/config-manager.h"
-#include "common/system.h"
#include "kyra/debugger.h"
#include "kyra/kyra_lok.h"
-#include "kyra/kyra_v2.h"
#include "kyra/kyra_hof.h"
-#include "kyra/screen.h"
#include "kyra/timer.h"
#include "kyra/resource.h"
#include "kyra/lol.h"
+#include "common/system.h"
+
namespace Kyra {
Debugger::Debugger(KyraEngine_v1 *vm)
diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp
index 6c111a6601..87cda9f3b6 100644
--- a/engines/kyra/detection.cpp
+++ b/engines/kyra/detection.cpp
@@ -22,17 +22,17 @@
* $Id$
*/
-#include "kyra/kyra_v1.h"
#include "kyra/kyra_lok.h"
#include "kyra/lol.h"
#include "kyra/kyra_hof.h"
#include "kyra/kyra_mr.h"
-
#include "common/config-manager.h"
-#include "engines/advancedDetector.h"
+#include "common/system.h"
#include "common/savefile.h"
+#include "engines/advancedDetector.h"
+
#include "base/plugins.h"
struct KYRAGameDescription {
diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp
index ff7bf233d2..849b65a24b 100644
--- a/engines/kyra/gui.cpp
+++ b/engines/kyra/gui.cpp
@@ -25,11 +25,11 @@
#include "kyra/gui.h"
-#include "kyra/screen.h"
#include "kyra/text.h"
#include "kyra/wsamovie.h"
#include "common/savefile.h"
+#include "common/system.h"
namespace Kyra {
diff --git a/engines/kyra/gui_hof.cpp b/engines/kyra/gui_hof.cpp
index 56971e563c..26e0d8f18a 100644
--- a/engines/kyra/gui_hof.cpp
+++ b/engines/kyra/gui_hof.cpp
@@ -23,15 +23,13 @@
*
*/
-#include "kyra/kyra_v1.h"
+#include "kyra/gui_hof.h"
#include "kyra/kyra_hof.h"
-#include "kyra/screen.h"
-#include "kyra/wsamovie.h"
#include "kyra/timer.h"
-#include "kyra/sound.h"
#include "kyra/resource.h"
+#include "kyra/sound.h"
-#include "common/savefile.h"
+#include "common/system.h"
#include "graphics/scaler.h"
diff --git a/engines/kyra/gui_lok.cpp b/engines/kyra/gui_lok.cpp
index 3560478a1b..c31cbe3db2 100644
--- a/engines/kyra/gui_lok.cpp
+++ b/engines/kyra/gui_lok.cpp
@@ -23,18 +23,13 @@
*
*/
+#include "kyra/gui_lok.h"
#include "kyra/kyra_lok.h"
-#include "kyra/screen.h"
-#include "kyra/script.h"
-#include "kyra/text.h"
#include "kyra/animator_lok.h"
-#include "kyra/sound.h"
-#include "kyra/gui_lok.h"
+#include "kyra/text.h"
#include "kyra/timer.h"
#include "kyra/util.h"
-#include "kyra/item.h"
-#include "common/config-manager.h"
#include "common/savefile.h"
#include "common/system.h"
diff --git a/engines/kyra/gui_lok.h b/engines/kyra/gui_lok.h
index e846933741..084a798de4 100644
--- a/engines/kyra/gui_lok.h
+++ b/engines/kyra/gui_lok.h
@@ -27,6 +27,7 @@
#define KYRA_GUI_LOK_H
#include "kyra/gui.h"
+#include "kyra/screen_lok.h"
namespace Kyra {
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp
index 07fbf1664d..2625347d50 100644
--- a/engines/kyra/gui_lol.cpp
+++ b/engines/kyra/gui_lol.cpp
@@ -25,13 +25,15 @@
#ifdef ENABLE_LOL
+#include "kyra/gui_lol.h"
#include "kyra/lol.h"
#include "kyra/screen_lol.h"
-#include "kyra/gui_lol.h"
#include "kyra/resource.h"
#include "kyra/util.h"
+#include "kyra/sound.h"
#include "common/savefile.h"
+#include "common/system.h"
#include "common/config-manager.h"
#include "graphics/scaler.h"
diff --git a/engines/kyra/gui_mr.cpp b/engines/kyra/gui_mr.cpp
index 6bdecfc3b8..6eca24fd46 100644
--- a/engines/kyra/gui_mr.cpp
+++ b/engines/kyra/gui_mr.cpp
@@ -26,12 +26,11 @@
#include "kyra/gui_mr.h"
#include "kyra/kyra_mr.h"
#include "kyra/text_mr.h"
-#include "kyra/wsamovie.h"
#include "kyra/resource.h"
-#include "kyra/sound.h"
#include "kyra/timer.h"
+#include "kyra/sound.h"
-#include "common/savefile.h"
+#include "common/system.h"
#include "graphics/scaler.h"
diff --git a/engines/kyra/gui_v2.cpp b/engines/kyra/gui_v2.cpp
index 2247a0ca2e..01922de7cf 100644
--- a/engines/kyra/gui_v2.cpp
+++ b/engines/kyra/gui_v2.cpp
@@ -24,12 +24,12 @@
*/
#include "kyra/gui_v2.h"
-#include "kyra/kyra_v2.h"
#include "kyra/screen_v2.h"
#include "kyra/text.h"
#include "kyra/util.h"
#include "common/savefile.h"
+#include "common/system.h"
namespace Kyra {
diff --git a/engines/kyra/items_hof.cpp b/engines/kyra/items_hof.cpp
index 6a78a77c23..d460698272 100644
--- a/engines/kyra/items_hof.cpp
+++ b/engines/kyra/items_hof.cpp
@@ -25,6 +25,8 @@
#include "kyra/kyra_hof.h"
+#include "common/system.h"
+
namespace Kyra {
int KyraEngine_HoF::checkItemCollision(int x, int y) {
diff --git a/engines/kyra/items_lok.cpp b/engines/kyra/items_lok.cpp
index 322314e3ad..ed1299d239 100644
--- a/engines/kyra/items_lok.cpp
+++ b/engines/kyra/items_lok.cpp
@@ -24,17 +24,9 @@
*/
#include "kyra/kyra_lok.h"
-#include "kyra/seqplayer.h"
-#include "kyra/screen.h"
-#include "kyra/resource.h"
-#include "kyra/sound.h"
-#include "kyra/sprites.h"
-#include "kyra/wsamovie.h"
#include "kyra/animator_lok.h"
-#include "kyra/text.h"
#include "common/system.h"
-#include "common/savefile.h"
namespace Kyra {
diff --git a/engines/kyra/items_mr.cpp b/engines/kyra/items_mr.cpp
index 2bc268ace3..5659876307 100644
--- a/engines/kyra/items_mr.cpp
+++ b/engines/kyra/items_mr.cpp
@@ -26,6 +26,8 @@
#include "kyra/kyra_mr.h"
#include "kyra/timer.h"
+#include "common/system.h"
+
namespace Kyra {
void KyraEngine_MR::removeTrashItems() {
diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp
index c73792ef8e..de6aa55b08 100644
--- a/engines/kyra/kyra_hof.cpp
+++ b/engines/kyra/kyra_hof.cpp
@@ -23,18 +23,13 @@
*
*/
-#include "kyra/kyra_v1.h"
#include "kyra/kyra_hof.h"
-#include "kyra/screen.h"
#include "kyra/resource.h"
-#include "kyra/wsamovie.h"
-#include "kyra/sound.h"
-#include "kyra/script.h"
-#include "kyra/script_tim.h"
#include "kyra/text_hof.h"
#include "kyra/timer.h"
#include "kyra/debugger.h"
#include "kyra/util.h"
+#include "kyra/sound.h"
#include "common/system.h"
#include "common/config-manager.h"
diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp
index d7ec6ada71..a04c28cad8 100644
--- a/engines/kyra/kyra_lok.cpp
+++ b/engines/kyra/kyra_lok.cpp
@@ -24,26 +24,19 @@
*/
#include "kyra/kyra_lok.h"
-
-#include "common/file.h"
-#include "common/system.h"
-#include "common/savefile.h"
-#include "common/config-manager.h"
-#include "common/debug-channels.h"
-
-#include "gui/message.h"
-
#include "kyra/resource.h"
-#include "kyra/screen.h"
-#include "kyra/script.h"
#include "kyra/seqplayer.h"
-#include "kyra/sound.h"
#include "kyra/sprites.h"
-#include "kyra/wsamovie.h"
#include "kyra/animator_lok.h"
-#include "kyra/text.h"
#include "kyra/debugger.h"
#include "kyra/timer.h"
+#include "kyra/sound.h"
+
+#include "common/system.h"
+#include "common/config-manager.h"
+#include "common/debug-channels.h"
+
+#include "gui/message.h"
namespace Kyra {
diff --git a/engines/kyra/kyra_lok.h b/engines/kyra/kyra_lok.h
index d1ff24ad85..cfa231e2d0 100644
--- a/engines/kyra/kyra_lok.h
+++ b/engines/kyra/kyra_lok.h
@@ -32,6 +32,10 @@
#include "kyra/gui_lok.h"
#include "kyra/item.h"
+namespace Graphics {
+struct Surface;
+}
+
namespace Kyra {
class Movie;
diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp
index 65e78448a5..570ebe0bab 100644
--- a/engines/kyra/kyra_mr.cpp
+++ b/engines/kyra/kyra_mr.cpp
@@ -23,18 +23,15 @@
*
*/
-#include "kyra/kyra_v1.h"
#include "kyra/kyra_mr.h"
-#include "kyra/screen_mr.h"
#include "kyra/wsamovie.h"
-#include "kyra/sound.h"
#include "kyra/text_mr.h"
#include "kyra/vqa.h"
-#include "kyra/gui.h"
#include "kyra/timer.h"
#include "kyra/debugger.h"
#include "kyra/gui_mr.h"
#include "kyra/resource.h"
+#include "kyra/sound.h"
#include "common/system.h"
#include "common/config-manager.h"
diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp
index 3a5d21196b..fb56e4a62a 100644
--- a/engines/kyra/kyra_v1.cpp
+++ b/engines/kyra/kyra_v1.cpp
@@ -23,22 +23,17 @@
*
*/
-#include "common/config-manager.h"
-#include "common/debug-channels.h"
-#include "common/EventRecorder.h"
-
-#include "audio/mididrv.h"
-#include "audio/mixer.h"
-
#include "kyra/kyra_v1.h"
#include "kyra/sound_intern.h"
#include "kyra/resource.h"
-#include "kyra/screen.h"
-#include "kyra/text.h"
#include "kyra/timer.h"
-#include "kyra/script.h"
#include "kyra/debugger.h"
+#include "common/error.h"
+#include "common/config-manager.h"
+#include "common/debug-channels.h"
+#include "common/EventRecorder.h"
+
namespace Kyra {
KyraEngine_v1::KyraEngine_v1(OSystem *system, const GameFlags &flags)
diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h
index cf51774b0f..08dc831dd9 100644
--- a/engines/kyra/kyra_v1.h
+++ b/engines/kyra/kyra_v1.h
@@ -29,10 +29,10 @@
#include "engines/engine.h"
#include "common/array.h"
+#include "common/error.h"
#include "common/events.h"
#include "common/random.h"
#include "common/hashmap.h"
-#include "common/system.h"
#include "audio/mixer.h"
@@ -44,6 +44,10 @@ class SeekableReadStream;
class WriteStream;
} // End of namespace Common
+namespace Graphics {
+struct Surface;
+}
+
class KyraMetaEngine;
/**
@@ -166,7 +170,6 @@ enum MusicDataID {
class Screen;
class Resource;
class Sound;
-class Movie;
class TextDisplayer;
class StaticResource;
class TimerManager;
@@ -247,7 +250,7 @@ protected:
Common::Error err;
registerDefaultSettings();
err = init();
- if (err != Common::kNoError)
+ if (err.getCode() != Common::kNoError)
return err;
return go();
}
diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp
index 804097c81d..16b5ffa4e8 100644
--- a/engines/kyra/kyra_v2.cpp
+++ b/engines/kyra/kyra_v2.cpp
@@ -23,11 +23,12 @@
*
*/
-#include "common/config-manager.h"
-
#include "kyra/kyra_v2.h"
#include "kyra/screen_v2.h"
-#include "kyra/debugger.h"
+
+#include "common/config-manager.h"
+#include "common/error.h"
+#include "common/system.h"
namespace Kyra {
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index 5928c40f92..ce73bffc89 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -28,17 +28,15 @@
#include "kyra/lol.h"
#include "kyra/screen_lol.h"
#include "kyra/resource.h"
-
-#include "kyra/sound.h"
#include "kyra/timer.h"
#include "kyra/util.h"
#include "kyra/debugger.h"
+#include "kyra/sound.h"
-#include "audio/decoders/voc.h"
#include "audio/audiostream.h"
#include "common/config-manager.h"
-#include "common/endian.h"
+#include "common/system.h"
namespace Kyra {
@@ -591,7 +589,9 @@ Common::Error LoLEngine::go() {
if (action == 0) {
startupNew();
} else if (_gameToLoad != -1) {
- if (loadGameState(_gameToLoad) != Common::kNoError)
+ // FIXME: Instead of throwing away the error returned by
+ // loadGameState, we should use it / augment it.
+ if (loadGameState(_gameToLoad).getCode() != Common::kNoError)
error("Couldn't load game slot %d on startup", _gameToLoad);
_gameToLoad = -1;
}
@@ -918,7 +918,9 @@ void LoLEngine::runLoop() {
while (!shouldQuit() && _runFlag) {
if (_gameToLoad != -1) {
- if (loadGameState(_gameToLoad) != Common::kNoError)
+ // FIXME: Instead of throwing away the error returned by
+ // loadGameState, we should use it / augment it.
+ if (loadGameState(_gameToLoad).getCode() != Common::kNoError)
error("Couldn't load game slot %d", _gameToLoad);
_gameToLoad = -1;
}
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h
index d24f3b427f..a3170c2193 100644
--- a/engines/kyra/lol.h
+++ b/engines/kyra/lol.h
@@ -31,12 +31,15 @@
#include "kyra/kyra_v1.h"
#include "kyra/script_tim.h"
#include "kyra/script.h"
-#include "kyra/sound.h"
#include "kyra/gui_lol.h"
#include "kyra/text_lol.h"
#include "common/list.h"
+namespace Audio {
+class SeekableAudioStream;
+} // End of namespace Audio
+
namespace Kyra {
class Screen_LoL;
diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp
index 63b8072654..22786c1c7e 100644
--- a/engines/kyra/resource.cpp
+++ b/engines/kyra/resource.cpp
@@ -27,11 +27,7 @@
#include "kyra/resource_intern.h"
#include "common/config-manager.h"
-#include "common/endian.h"
-#include "common/file.h"
#include "common/fs.h"
-#include "common/func.h"
-#include "common/system.h"
namespace Kyra {
diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp
index 44579c3377..81b3ec15ae 100644
--- a/engines/kyra/saveload.cpp
+++ b/engines/kyra/saveload.cpp
@@ -23,15 +23,15 @@
*
*/
-#include "common/endian.h"
+#include "kyra/kyra_v1.h"
+#include "kyra/util.h"
+
#include "common/savefile.h"
#include "common/system.h"
+
#include "graphics/thumbnail.h"
#include "graphics/surface.h"
-#include "kyra/kyra_v1.h"
-#include "kyra/util.h"
-
#define CURRENT_SAVE_VERSION 16
#define GF_FLOPPY (1 << 0)
@@ -257,7 +257,9 @@ void KyraEngine_v1::checkAutosave() {
}
void KyraEngine_v1::loadGameStateCheck(int slot) {
- if (loadGameState(slot) != Common::kNoError) {
+ // FIXME: Instead of throwing away the error returned by
+ // loadGameState, we should use it / augment it.
+ if (loadGameState(slot).getCode() != Common::kNoError) {
const char *filename = getSavegameFilename(slot);
Common::String errorMessage = "Could not load savegame: '";
errorMessage += filename;
diff --git a/engines/kyra/saveload_hof.cpp b/engines/kyra/saveload_hof.cpp
index 7a487dcf7b..1fd6c0f3c8 100644
--- a/engines/kyra/saveload_hof.cpp
+++ b/engines/kyra/saveload_hof.cpp
@@ -23,17 +23,15 @@
*
*/
-#include "common/endian.h"
-#include "common/savefile.h"
-#include "common/substream.h"
-#include "common/system.h"
-
-#include "kyra/kyra_v2.h"
+#include "kyra/kyra_hof.h"
#include "kyra/screen_v2.h"
-#include "kyra/resource.h"
#include "kyra/sound.h"
#include "kyra/timer.h"
+#include "common/savefile.h"
+#include "common/substream.h"
+#include "common/system.h"
+
namespace Kyra {
Common::Error KyraEngine_HoF::saveGameStateIntern(int slot, const char *saveName, const Graphics::Surface *thumb) {
diff --git a/engines/kyra/saveload_lok.cpp b/engines/kyra/saveload_lok.cpp
index 012ff138b5..5af4f1d8ca 100644
--- a/engines/kyra/saveload_lok.cpp
+++ b/engines/kyra/saveload_lok.cpp
@@ -23,17 +23,14 @@
*
*/
-#include "common/endian.h"
-#include "common/savefile.h"
-#include "common/system.h"
-
#include "kyra/kyra_lok.h"
#include "kyra/animator_lok.h"
-#include "kyra/screen.h"
#include "kyra/resource.h"
#include "kyra/sound.h"
#include "kyra/timer.h"
+#include "common/savefile.h"
+
namespace Kyra {
Common::Error KyraEngine_LoK::loadGameState(int slot) {
diff --git a/engines/kyra/saveload_lol.cpp b/engines/kyra/saveload_lol.cpp
index b6c0693a16..c5240e2624 100644
--- a/engines/kyra/saveload_lol.cpp
+++ b/engines/kyra/saveload_lol.cpp
@@ -27,12 +27,9 @@
#include "kyra/lol.h"
#include "kyra/screen_lol.h"
-#include "kyra/resource.h"
-#include "common/endian.h"
#include "common/savefile.h"
#include "common/substream.h"
-#include "common/system.h"
#include "graphics/scaler.h"
diff --git a/engines/kyra/scene_hof.cpp b/engines/kyra/scene_hof.cpp
index 79827361a3..b44c88a0b4 100644
--- a/engines/kyra/scene_hof.cpp
+++ b/engines/kyra/scene_hof.cpp
@@ -24,12 +24,10 @@
*/
#include "kyra/kyra_hof.h"
-#include "kyra/screen_v2.h"
#include "kyra/sound.h"
-#include "kyra/wsamovie.h"
#include "kyra/resource.h"
-#include "common/func.h"
+#include "common/system.h"
namespace Kyra {
diff --git a/engines/kyra/scene_lok.cpp b/engines/kyra/scene_lok.cpp
index 3abfe03fff..6200e2ab1e 100644
--- a/engines/kyra/scene_lok.cpp
+++ b/engines/kyra/scene_lok.cpp
@@ -24,19 +24,13 @@
*/
#include "kyra/kyra_lok.h"
-#include "kyra/seqplayer.h"
-#include "kyra/screen.h"
#include "kyra/resource.h"
#include "kyra/sound.h"
#include "kyra/sprites.h"
-#include "kyra/wsamovie.h"
#include "kyra/animator_lok.h"
-#include "kyra/text.h"
-#include "kyra/script.h"
#include "kyra/timer.h"
#include "common/system.h"
-#include "common/savefile.h"
namespace Kyra {
diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp
index e070b91a44..ab9f89456b 100644
--- a/engines/kyra/scene_lol.cpp
+++ b/engines/kyra/scene_lol.cpp
@@ -29,9 +29,9 @@
#include "kyra/screen_lol.h"
#include "kyra/resource.h"
#include "kyra/timer.h"
-#include "kyra/sound.h"
#include "common/endian.h"
+#include "common/system.h"
namespace Kyra {
diff --git a/engines/kyra/scene_mr.cpp b/engines/kyra/scene_mr.cpp
index acb0710616..4eac4889b6 100644
--- a/engines/kyra/scene_mr.cpp
+++ b/engines/kyra/scene_mr.cpp
@@ -25,10 +25,11 @@
#include "kyra/kyra_mr.h"
#include "kyra/screen_mr.h"
-#include "kyra/wsamovie.h"
#include "kyra/sound.h"
#include "kyra/resource.h"
+#include "common/system.h"
+
namespace Kyra {
void KyraEngine_MR::enterNewScene(uint16 sceneId, int facing, int unk1, int unk2, int unk3) {
diff --git a/engines/kyra/scene_v1.cpp b/engines/kyra/scene_v1.cpp
index 848735b4a5..bc88377892 100644
--- a/engines/kyra/scene_v1.cpp
+++ b/engines/kyra/scene_v1.cpp
@@ -24,7 +24,6 @@
*/
#include "kyra/kyra_v1.h"
-#include "kyra/screen.h"
namespace Kyra {
diff --git a/engines/kyra/scene_v2.cpp b/engines/kyra/scene_v2.cpp
index fdfbceb521..897f2e937f 100644
--- a/engines/kyra/scene_v2.cpp
+++ b/engines/kyra/scene_v2.cpp
@@ -24,7 +24,8 @@
*/
#include "kyra/kyra_v2.h"
-#include "kyra/screen.h"
+
+#include "common/system.h"
namespace Kyra {
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index 58d8e7f3d4..20a1022b26 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -23,6 +23,9 @@
*
*/
+#include "kyra/screen.h"
+#include "kyra/kyra_v1.h"
+#include "kyra/resource.h"
#include "common/endian.h"
#include "common/memstream.h"
@@ -31,12 +34,9 @@
#include "engines/util.h"
#include "graphics/cursorman.h"
+#include "graphics/palette.h"
#include "graphics/sjis.h"
-#include "kyra/screen.h"
-#include "kyra/kyra_v1.h"
-#include "kyra/resource.h"
-
namespace Kyra {
Screen::Screen(KyraEngine_v1 *vm, OSystem *system)
diff --git a/engines/kyra/screen_hof.cpp b/engines/kyra/screen_hof.cpp
index a180c28442..f0af53f024 100644
--- a/engines/kyra/screen_hof.cpp
+++ b/engines/kyra/screen_hof.cpp
@@ -23,10 +23,8 @@
*
*/
-#include "common/endian.h"
-
-#include "kyra/kyra_hof.h"
#include "kyra/screen_hof.h"
+#include "kyra/kyra_hof.h"
namespace Kyra {
diff --git a/engines/kyra/screen_lok.cpp b/engines/kyra/screen_lok.cpp
index 227349754f..2431cde20b 100644
--- a/engines/kyra/screen_lok.cpp
+++ b/engines/kyra/screen_lok.cpp
@@ -23,10 +23,12 @@
*
*/
-#include "kyra/kyra_lok.h"
#include "kyra/screen_lok.h"
+#include "kyra/kyra_lok.h"
+
+#include "common/system.h"
-#include "graphics/cursorman.h"
+#include "graphics/palette.h"
namespace Kyra {
diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp
index ff35facbb5..20756e1fae 100644
--- a/engines/kyra/screen_lol.cpp
+++ b/engines/kyra/screen_lol.cpp
@@ -27,7 +27,10 @@
#include "kyra/screen_lol.h"
#include "kyra/lol.h"
-#include "kyra/resource.h"
+
+#include "common/system.h"
+
+#include "graphics/palette.h"
namespace Kyra {
diff --git a/engines/kyra/screen_mr.cpp b/engines/kyra/screen_mr.cpp
index 33bfc517f7..4ae52b924d 100644
--- a/engines/kyra/screen_mr.cpp
+++ b/engines/kyra/screen_mr.cpp
@@ -24,7 +24,6 @@
*/
#include "kyra/screen_mr.h"
-
#include "kyra/kyra_mr.h"
namespace Kyra {
diff --git a/engines/kyra/script.cpp b/engines/kyra/script.cpp
index 956bf39b5a..21dfe0bd31 100644
--- a/engines/kyra/script.cpp
+++ b/engines/kyra/script.cpp
@@ -23,15 +23,11 @@
*
*/
-
-#include "common/endian.h"
-#include "common/stream.h"
-#include "common/util.h"
-#include "common/system.h"
-
+#include "kyra/script.h"
#include "kyra/kyra_v1.h"
#include "kyra/resource.h"
-#include "kyra/script.h"
+
+#include "common/endian.h"
namespace Kyra {
EMCInterpreter::EMCInterpreter(KyraEngine_v1 *vm) : _vm(vm), _scriptData(0), _filename(0) {
diff --git a/engines/kyra/script_hof.cpp b/engines/kyra/script_hof.cpp
index d57bb7efc5..056319e6d4 100644
--- a/engines/kyra/script_hof.cpp
+++ b/engines/kyra/script_hof.cpp
@@ -24,14 +24,11 @@
*/
#include "kyra/kyra_hof.h"
-#include "kyra/text_hof.h"
-#include "kyra/wsamovie.h"
-#include "kyra/sound.h"
#include "kyra/timer.h"
-#include "kyra/script_tim.h"
#include "kyra/resource.h"
+#include "kyra/sound.h"
-#include "common/endian.h"
+#include "common/system.h"
namespace Kyra {
diff --git a/engines/kyra/script_lok.cpp b/engines/kyra/script_lok.cpp
index a2bad8035e..30f1138360 100644
--- a/engines/kyra/script_lok.cpp
+++ b/engines/kyra/script_lok.cpp
@@ -23,12 +23,7 @@
*
*/
-#include "common/endian.h"
-#include "common/system.h"
-
#include "kyra/kyra_lok.h"
-#include "kyra/script.h"
-#include "kyra/screen.h"
#include "kyra/sprites.h"
#include "kyra/wsamovie.h"
#include "kyra/animator_lok.h"
@@ -36,6 +31,8 @@
#include "kyra/timer.h"
#include "kyra/sound.h"
+#include "common/system.h"
+
namespace Kyra {
int KyraEngine_LoK::o1_magicInMouseItem(EMCState *script) {
diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp
index c9fb8df1fb..3185032218 100644
--- a/engines/kyra/script_lol.cpp
+++ b/engines/kyra/script_lol.cpp
@@ -29,8 +29,9 @@
#include "kyra/screen_lol.h"
#include "kyra/timer.h"
#include "kyra/resource.h"
+#include "kyra/sound.h"
-#include "common/endian.h"
+#include "common/system.h"
namespace Kyra {
diff --git a/engines/kyra/script_mr.cpp b/engines/kyra/script_mr.cpp
index 18878b6543..b3943e1aef 100644
--- a/engines/kyra/script_mr.cpp
+++ b/engines/kyra/script_mr.cpp
@@ -24,14 +24,10 @@
*/
#include "kyra/kyra_mr.h"
-#include "kyra/script.h"
-#include "kyra/screen_mr.h"
#include "kyra/text_mr.h"
-#include "kyra/wsamovie.h"
-#include "kyra/timer.h"
#include "kyra/resource.h"
-#include "common/endian.h"
+#include "common/system.h"
namespace Kyra {
diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp
index 1e978caf15..004ceb97bb 100644
--- a/engines/kyra/script_tim.cpp
+++ b/engines/kyra/script_tim.cpp
@@ -24,10 +24,8 @@
*/
#include "kyra/script_tim.h"
-#include "kyra/script.h"
#include "kyra/resource.h"
#include "kyra/sound.h"
-#include "kyra/wsamovie.h"
#ifdef ENABLE_LOL
#include "kyra/lol.h"
@@ -35,7 +33,7 @@
#endif // ENABLE_LOL
#include "common/iff_container.h"
-#include "common/endian.h"
+#include "common/system.h"
namespace Kyra {
diff --git a/engines/kyra/script_tim.h b/engines/kyra/script_tim.h
index 91f2e8589e..7cf7d0a7dd 100644
--- a/engines/kyra/script_tim.h
+++ b/engines/kyra/script_tim.h
@@ -36,6 +36,7 @@ namespace Kyra {
class WSAMovie_v2;
class Screen_v2;
+class Movie;
class LoLEngine;
class TimAnimator {
diff --git a/engines/kyra/script_v1.cpp b/engines/kyra/script_v1.cpp
index 12f26ec5f6..13fdcb7d97 100644
--- a/engines/kyra/script_v1.cpp
+++ b/engines/kyra/script_v1.cpp
@@ -26,6 +26,8 @@
#include "kyra/kyra_v1.h"
#include "kyra/screen.h"
+#include "common/system.h"
+
namespace Kyra {
int KyraEngine_v1::o1_queryGameFlag(EMCState *script) {
diff --git a/engines/kyra/script_v2.cpp b/engines/kyra/script_v2.cpp
index 17e882398e..081f9dd517 100644
--- a/engines/kyra/script_v2.cpp
+++ b/engines/kyra/script_v2.cpp
@@ -27,7 +27,7 @@
#include "kyra/screen_v2.h"
#include "kyra/timer.h"
-#include "common/endian.h"
+#include "common/system.h"
namespace Kyra {
diff --git a/engines/kyra/seqplayer.cpp b/engines/kyra/seqplayer.cpp
index 5160224591..16e89de146 100644
--- a/engines/kyra/seqplayer.cpp
+++ b/engines/kyra/seqplayer.cpp
@@ -23,18 +23,11 @@
*
*/
-
-#include "common/system.h"
-
-#include "engines/engine.h"
-
+#include "kyra/seqplayer.h"
#include "kyra/resource.h"
-#include "kyra/screen.h"
#include "kyra/sound.h"
-#include "kyra/wsamovie.h"
-#include "kyra/text.h"
-#include "kyra/seqplayer.h"
+#include "common/system.h"
#define SEQOP(n, x) { n, &SeqPlayer::x, #x }
diff --git a/engines/kyra/sequences_hof.cpp b/engines/kyra/sequences_hof.cpp
index c55153b802..b268f13fc1 100644
--- a/engines/kyra/sequences_hof.cpp
+++ b/engines/kyra/sequences_hof.cpp
@@ -23,14 +23,10 @@
*
*/
-#include "kyra/kyra_v1.h"
#include "kyra/kyra_hof.h"
-#include "kyra/screen.h"
-#include "kyra/wsamovie.h"
-#include "kyra/sound.h"
-#include "kyra/text_hof.h"
#include "kyra/timer.h"
#include "kyra/resource.h"
+#include "kyra/sound.h"
#include "common/system.h"
diff --git a/engines/kyra/sequences_lok.cpp b/engines/kyra/sequences_lok.cpp
index 23af24064d..0b39201f85 100644
--- a/engines/kyra/sequences_lok.cpp
+++ b/engines/kyra/sequences_lok.cpp
@@ -25,14 +25,12 @@
#include "kyra/kyra_lok.h"
#include "kyra/seqplayer.h"
-#include "kyra/screen_lok.h"
#include "kyra/resource.h"
-#include "kyra/sound.h"
#include "kyra/sprites.h"
#include "kyra/wsamovie.h"
#include "kyra/animator_lok.h"
-#include "kyra/text.h"
#include "kyra/timer.h"
+#include "kyra/sound.h"
#include "common/system.h"
#include "common/savefile.h"
diff --git a/engines/kyra/sequences_lol.cpp b/engines/kyra/sequences_lol.cpp
index e8ea7a9dcb..da1245d7e6 100644
--- a/engines/kyra/sequences_lol.cpp
+++ b/engines/kyra/sequences_lol.cpp
@@ -28,9 +28,12 @@
#include "kyra/lol.h"
#include "kyra/screen_lol.h"
#include "kyra/resource.h"
+#include "kyra/sound.h"
#include "base/version.h"
+#include "common/system.h"
+
namespace Kyra {
#pragma mark - Intro
diff --git a/engines/kyra/sequences_v2.cpp b/engines/kyra/sequences_v2.cpp
index 3824676213..4d9cdf0d5d 100644
--- a/engines/kyra/sequences_v2.cpp
+++ b/engines/kyra/sequences_v2.cpp
@@ -26,6 +26,8 @@
#include "kyra/kyra_v2.h"
#include "kyra/resource.h"
+#include "common/system.h"
+
namespace Kyra {
void KyraEngine_v2::runAnimationScript(const char *filename, int allowSkip, int resetChar, int newShapes, int shapeUnload) {
diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp
index 9dd046e50b..1392824235 100644
--- a/engines/kyra/sound.cpp
+++ b/engines/kyra/sound.cpp
@@ -24,19 +24,16 @@
*/
-#include "common/system.h"
-#include "common/config-manager.h"
-
-#include "kyra/resource.h"
#include "kyra/sound.h"
+#include "kyra/resource.h"
#include "audio/mixer.h"
-#include "audio/decoders/voc.h"
#include "audio/audiostream.h"
#include "audio/decoders/flac.h"
#include "audio/decoders/mp3.h"
#include "audio/decoders/raw.h"
+#include "audio/decoders/voc.h"
#include "audio/decoders/vorbis.h"
namespace Kyra {
diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp
index 758d66192d..16f6ca3eaa 100644
--- a/engines/kyra/sound_adlib.cpp
+++ b/engines/kyra/sound_adlib.cpp
@@ -40,10 +40,11 @@
*/
+#include "kyra/sound_intern.h"
+#include "kyra/resource.h"
+
#include "common/system.h"
#include "common/mutex.h"
-#include "kyra/resource.h"
-#include "kyra/sound_intern.h"
#include "audio/mixer.h"
#include "audio/fmopl.h"
@@ -909,7 +910,7 @@ void AdLibDriver::unkOutput2(uint8 chan) {
// including the two most significant frequency bit, and the octave -
// set to zero.
//
- // This is very strange behaviour, and causes problems with the ancient
+ // This is very strange behavior, and causes problems with the ancient
// FMOPL code we borrowed from AdPlug. I've added a workaround. See
// fmopl.cpp for more details.
//
@@ -984,7 +985,7 @@ void AdLibDriver::setupNote(uint8 rawNote, Channel &channel, bool flag) {
uint16 freq = _unkTable[note] + channel.baseFreq;
- // When called from callback 41, the behaviour is slightly different:
+ // When called from callback 41, the behavior is slightly different:
// We adjust the frequency, even when channel.unk16 is 0.
if (channel.unk16 || flag) {
@@ -1093,12 +1094,12 @@ void AdLibDriver::adjustVolume(Channel &channel) {
// tree) and turning Kallak to stone. Related functions and variables:
//
// update_setupPrimaryEffect1()
-// - Initialises unk29, unk30 and unk31
+// - Initializes unk29, unk30 and unk31
// - unk29 is not further modified
// - unk30 is not further modified, except by update_removePrimaryEffect1()
//
// update_removePrimaryEffect1()
-// - Deinitialises unk30
+// - Deinitializes unk30
//
// unk29 - determines how often the notes are played
// unk30 - modifies the frequency
@@ -1115,7 +1116,7 @@ void AdLibDriver::primaryEffect1(Channel &channel) {
if (channel.unk31 >= temp)
return;
- // Initialise unk1 to the current frequency
+ // Initialize unk1 to the current frequency
uint16 unk1 = ((channel.regBx & 3) << 8) | channel.regAx;
// This is presumably to shift the "note on" bit so far to the left
@@ -1167,10 +1168,10 @@ void AdLibDriver::primaryEffect1(Channel &channel) {
// and leaving Kallak's hut. Related functions and variables:
//
// update_setupPrimaryEffect2()
-// - Initialises unk32, unk33, unk34, unk35 and unk36
+// - Initializes unk32, unk33, unk34, unk35 and unk36
// - unk32 is not further modified
// - unk33 is not further modified
-// - unk34 is a countdown that gets reinitialised to unk35 on zero
+// - unk34 is a countdown that gets reinitialized to unk35 on zero
// - unk35 is based on unk34 and not further modified
// - unk36 is not further modified
//
@@ -1182,13 +1183,13 @@ void AdLibDriver::primaryEffect1(Channel &channel) {
// unk32 - determines how often the notes are played
// unk33 - modifies the frequency
// unk34 - countdown, updates frequency on zero
-// unk35 - initialiser for unk34 countdown
-// unk36 - initialiser for unk38 countdown
+// unk35 - initializer for unk34 countdown
+// unk36 - initializer for unk38 countdown
// unk37 - frequency
// unk38 - countdown, begins playing on zero
// unk41 - determines how often the notes are played
//
-// Note that unk41 is never initialised. Not that it should matter much, but it
+// Note that unk41 is never initialized. Not that it should matter much, but it
// is a bit sloppy.
void AdLibDriver::primaryEffect2(Channel &channel) {
diff --git a/engines/kyra/sound_amiga.cpp b/engines/kyra/sound_amiga.cpp
index c5e9f6171d..fed21eba84 100644
--- a/engines/kyra/sound_amiga.cpp
+++ b/engines/kyra/sound_amiga.cpp
@@ -23,14 +23,11 @@
*
*/
-#include "common/system.h"
-#include "common/mutex.h"
-#include "kyra/resource.h"
#include "kyra/sound_intern.h"
+#include "kyra/resource.h"
#include "audio/mixer.h"
#include "audio/mods/maxtrax.h"
-#include "audio/audiostream.h"
namespace Kyra {
diff --git a/engines/kyra/sound_lok.cpp b/engines/kyra/sound_lok.cpp
index 40daa0b5bd..83566372bf 100644
--- a/engines/kyra/sound_lok.cpp
+++ b/engines/kyra/sound_lok.cpp
@@ -23,8 +23,10 @@
*
*/
-#include "kyra/sound.h"
#include "kyra/kyra_lok.h"
+#include "kyra/sound.h"
+
+#include "common/system.h"
namespace Kyra {
diff --git a/engines/kyra/sound_lol.cpp b/engines/kyra/sound_lol.cpp
index 87679f5bfb..10d35e03d5 100644
--- a/engines/kyra/sound_lol.cpp
+++ b/engines/kyra/sound_lol.cpp
@@ -25,10 +25,12 @@
#ifdef ENABLE_LOL
-#include "kyra/sound.h"
#include "kyra/lol.h"
+#include "kyra/sound.h"
#include "kyra/resource.h"
+#include "common/system.h"
+
#include "audio/audiostream.h"
namespace Kyra {
diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp
index 084bae5aab..6b30824a2f 100644
--- a/engines/kyra/sound_towns.cpp
+++ b/engines/kyra/sound_towns.cpp
@@ -23,20 +23,17 @@
*
*/
+#include "kyra/sound_intern.h"
+#include "kyra/resource.h"
+
#include "common/config-manager.h"
#include "common/system.h"
-#include "kyra/resource.h"
-#include "kyra/sound_intern.h"
-#include "kyra/screen.h"
-
#include "backends/audiocd/audiocd.h"
#include "audio/audiostream.h"
#include "audio/decoders/raw.h"
-#include "common/util.h"
-
namespace Kyra {
SoundTowns::SoundTowns(KyraEngine_v1 *vm, Audio::Mixer *mixer)
diff --git a/engines/kyra/sprites.cpp b/engines/kyra/sprites.cpp
index 52689869c6..23775d2946 100644
--- a/engines/kyra/sprites.cpp
+++ b/engines/kyra/sprites.cpp
@@ -23,19 +23,13 @@
*
*/
-
-#include "common/endian.h"
-#include "common/stream.h"
-#include "common/util.h"
-#include "common/system.h"
-#include "common/EventRecorder.h"
-
-#include "kyra/screen.h"
-#include "kyra/kyra_lok.h"
#include "kyra/sprites.h"
#include "kyra/resource.h"
#include "kyra/animator_lok.h"
+#include "common/system.h"
+#include "common/EventRecorder.h"
+
namespace Kyra {
Sprites::Sprites(KyraEngine_LoK *vm, OSystem *system) {
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index fe4bd2ad71..f83546e0dd 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -23,23 +23,22 @@
*
*/
-#include "common/endian.h"
-#include "common/md5.h"
-#include "kyra/kyra_v1.h"
+#include "kyra/resource.h"
#include "kyra/kyra_lok.h"
-#include "kyra/kyra_v2.h"
#include "kyra/kyra_hof.h"
#include "kyra/kyra_mr.h"
#include "kyra/screen.h"
#include "kyra/screen_lok.h"
#include "kyra/screen_hof.h"
#include "kyra/screen_mr.h"
-#include "kyra/resource.h"
#include "kyra/gui_lok.h"
#include "kyra/gui_hof.h"
#include "kyra/gui_mr.h"
#include "kyra/sound_intern.h"
+#include "common/endian.h"
+#include "common/md5.h"
+
namespace Kyra {
#define RESFILE_VERSION 73
diff --git a/engines/kyra/text.cpp b/engines/kyra/text.cpp
index 09f952f67e..e0114cda29 100644
--- a/engines/kyra/text.cpp
+++ b/engines/kyra/text.cpp
@@ -23,12 +23,8 @@
*
*/
-#include "kyra/kyra_v1.h"
-#include "kyra/screen.h"
#include "kyra/text.h"
-
-#include "common/system.h"
-#include "common/endian.h"
+#include "kyra/kyra_v1.h"
namespace Kyra {
diff --git a/engines/kyra/text_hof.cpp b/engines/kyra/text_hof.cpp
index 4c292b70db..c961d2bf49 100644
--- a/engines/kyra/text_hof.cpp
+++ b/engines/kyra/text_hof.cpp
@@ -24,11 +24,9 @@
*/
#include "kyra/text_hof.h"
-#include "kyra/kyra_hof.h"
-#include "kyra/script_tim.h"
#include "kyra/resource.h"
-#include "common/endian.h"
+#include "common/system.h"
namespace Kyra {
diff --git a/engines/kyra/text_lok.cpp b/engines/kyra/text_lok.cpp
index 40f2217a2b..cca8e5aaf5 100644
--- a/engines/kyra/text_lok.cpp
+++ b/engines/kyra/text_lok.cpp
@@ -23,13 +23,14 @@
*
*/
-#include "kyra/kyra_lok.h"
-#include "kyra/screen_lok.h"
#include "kyra/text.h"
+#include "kyra/kyra_lok.h"
#include "kyra/animator_lok.h"
#include "kyra/sprites.h"
#include "kyra/timer.h"
+#include "common/system.h"
+
namespace Kyra {
void KyraEngine_LoK::waitForChatToFinish(int vocFile, int16 chatDuration, const char *chatStr, uint8 charNum, const bool printText) {
diff --git a/engines/kyra/text_lol.cpp b/engines/kyra/text_lol.cpp
index 9f98586303..c9a77be1b2 100644
--- a/engines/kyra/text_lol.cpp
+++ b/engines/kyra/text_lol.cpp
@@ -25,10 +25,13 @@
#ifdef ENABLE_LOL
+#include "kyra/text_lol.h"
#include "kyra/lol.h"
#include "kyra/screen_lol.h"
#include "kyra/timer.h"
-#include "kyra/util.h"
+#include "kyra/sound.h"
+
+#include "common/system.h"
namespace Kyra {
diff --git a/engines/kyra/text_lol.h b/engines/kyra/text_lol.h
index 1e5bc8884e..edac131106 100644
--- a/engines/kyra/text_lol.h
+++ b/engines/kyra/text_lol.h
@@ -28,9 +28,11 @@
#ifndef KYRA_TEXT_LOL_H
#define KYRA_TEXT_LOL_H
+#include "common/scummsys.h"
+
namespace Kyra {
-class Screen_v2;
+class Screen_LoL;
class LoLEngine;
struct EMCState;
diff --git a/engines/kyra/text_mr.cpp b/engines/kyra/text_mr.cpp
index 001faab016..5679dc1ee6 100644
--- a/engines/kyra/text_mr.cpp
+++ b/engines/kyra/text_mr.cpp
@@ -24,9 +24,10 @@
*/
#include "kyra/text_mr.h"
-#include "kyra/screen_mr.h"
#include "kyra/resource.h"
+#include "common/system.h"
+
namespace Kyra {
TextDisplayer_MR::TextDisplayer_MR(KyraEngine_MR *vm, Screen_MR *screen)
diff --git a/engines/kyra/timer.cpp b/engines/kyra/timer.cpp
index 66b78d3c03..475f17cadc 100644
--- a/engines/kyra/timer.cpp
+++ b/engines/kyra/timer.cpp
@@ -23,11 +23,9 @@
*
*/
-#include "kyra/kyra_v1.h"
#include "kyra/timer.h"
-#include "common/func.h"
-#include "common/stream.h"
+#include "common/system.h"
namespace Kyra {
diff --git a/engines/kyra/timer_lok.cpp b/engines/kyra/timer_lok.cpp
index 85b98be724..3a312c22c6 100644
--- a/engines/kyra/timer_lok.cpp
+++ b/engines/kyra/timer_lok.cpp
@@ -23,14 +23,10 @@
*
*/
-#include "kyra/kyra_v1.h"
#include "kyra/kyra_lok.h"
-#include "kyra/screen.h"
#include "kyra/animator_lok.h"
#include "kyra/timer.h"
-#include "common/system.h"
-
namespace Kyra {
#define TimerV1(x) new Common::Functor1Mem<int, void, KyraEngine_LoK>(this, &KyraEngine_LoK::x)
diff --git a/engines/kyra/timer_lol.cpp b/engines/kyra/timer_lol.cpp
index 90cfc1af78..a3dab365c7 100644
--- a/engines/kyra/timer_lol.cpp
+++ b/engines/kyra/timer_lol.cpp
@@ -26,9 +26,10 @@
#ifdef ENABLE_LOL
#include "kyra/lol.h"
-#include "kyra/screen_lol.h"
#include "kyra/timer.h"
+#include "common/system.h"
+
namespace Kyra {
#define TimerV2(x) new Common::Functor1Mem<int, void, LoLEngine>(this, &LoLEngine::x)
diff --git a/engines/kyra/timer_mr.cpp b/engines/kyra/timer_mr.cpp
index 0d89decf5a..97ce7c166d 100644
--- a/engines/kyra/timer_mr.cpp
+++ b/engines/kyra/timer_mr.cpp
@@ -26,6 +26,8 @@
#include "kyra/kyra_mr.h"
#include "kyra/timer.h"
+#include "common/system.h"
+
namespace Kyra {
#define TimerV3(x) new Common::Functor1Mem<int, void, KyraEngine_MR>(this, &KyraEngine_MR::x)
diff --git a/engines/kyra/vqa.cpp b/engines/kyra/vqa.cpp
index b3371793de..28071bc171 100644
--- a/engines/kyra/vqa.cpp
+++ b/engines/kyra/vqa.cpp
@@ -33,16 +33,14 @@
#include "kyra/vqa.h"
+#include "kyra/resource.h"
#include "common/system.h"
+
#include "audio/audiostream.h"
#include "audio/mixer.h"
#include "audio/decoders/raw.h"
-#include "kyra/sound.h"
-#include "kyra/screen.h"
-#include "kyra/resource.h"
-
namespace Kyra {
VQAMovie::VQAMovie(KyraEngine_v1 *vm, OSystem *system) {
diff --git a/engines/kyra/wsamovie.cpp b/engines/kyra/wsamovie.cpp
index c9536484a3..db324d48d4 100644
--- a/engines/kyra/wsamovie.cpp
+++ b/engines/kyra/wsamovie.cpp
@@ -23,18 +23,13 @@
*
*/
-
-#include "common/endian.h"
-#include "common/system.h"
-
-#include "kyra/kyra_v1.h"
-#include "kyra/kyra_v2.h"
-#include "kyra/screen.h"
-#include "kyra/screen_v2.h"
#include "kyra/wsamovie.h"
#include "kyra/resource.h"
+#include "common/endian.h"
+
namespace Kyra {
+
WSAMovie_v1::WSAMovie_v1(KyraEngine_v1 *vm)
: Movie(vm), _frameData(0), _frameOffsTable(0), _offscreenBuffer(0), _deltaBuffer(0) {
}
diff --git a/engines/kyra/wsamovie.h b/engines/kyra/wsamovie.h
index d2c041742a..f755cdd557 100644
--- a/engines/kyra/wsamovie.h
+++ b/engines/kyra/wsamovie.h
@@ -26,10 +26,10 @@
#ifndef KYRA_WSAMOVIE_H
#define KYRA_WSAMOVIE_H
+#include "kyra/kyra_v1.h"
+
namespace Kyra {
-class KyraEngine_v1;
-class Screen_v2;
class Palette;
class Movie {
diff --git a/engines/lastexpress/data/animation.cpp b/engines/lastexpress/data/animation.cpp
index 7288889f09..2bf9bd4999 100644
--- a/engines/lastexpress/data/animation.cpp
+++ b/engines/lastexpress/data/animation.cpp
@@ -35,7 +35,10 @@
#include "common/events.h"
#include "common/rational.h"
+#include "common/rect.h"
#include "common/stream.h"
+#include "common/system.h"
+#include "common/textconsole.h"
#include "engines/engine.h"
@@ -266,7 +269,7 @@ void Animation::play() {
if (_changed) {
// Create a temporary surface to merge the overlay with the background
Graphics::Surface *s = new Graphics::Surface;
- s->create(640, 480, 2);
+ s->create(640, 480, Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0));
draw(s);
diff --git a/engines/lastexpress/data/archive.h b/engines/lastexpress/data/archive.h
index 3860245bc5..17b1d661fa 100644
--- a/engines/lastexpress/data/archive.h
+++ b/engines/lastexpress/data/archive.h
@@ -39,6 +39,9 @@
*/
#include "common/archive.h"
+#include "common/hash-str.h"
+#include "common/hashmap.h"
+#include "common/str.h"
namespace LastExpress {
diff --git a/engines/lastexpress/data/background.cpp b/engines/lastexpress/data/background.cpp
index 8b0d338f64..e8236bca86 100644
--- a/engines/lastexpress/data/background.cpp
+++ b/engines/lastexpress/data/background.cpp
@@ -31,6 +31,7 @@
#include "lastexpress/debug.h"
+#include "common/rect.h"
#include "common/stream.h"
namespace LastExpress {
diff --git a/engines/lastexpress/data/font.cpp b/engines/lastexpress/data/font.cpp
index 99239606ab..d9acbb8382 100644
--- a/engines/lastexpress/data/font.cpp
+++ b/engines/lastexpress/data/font.cpp
@@ -25,8 +25,10 @@
#include "lastexpress/data/font.h"
+#include "common/rect.h"
#include "common/stream.h"
#include "common/system.h"
+#include "common/textconsole.h"
namespace LastExpress {
diff --git a/engines/lastexpress/data/font.h b/engines/lastexpress/data/font.h
index d49db35ba5..7bcf03ed7d 100644
--- a/engines/lastexpress/data/font.h
+++ b/engines/lastexpress/data/font.h
@@ -39,10 +39,12 @@
byte {x} - Unknown data (probably just garbage)
*/
+#include "common/str.h"
#include "graphics/surface.h"
namespace Common {
class SeekableReadStream;
+struct Rect;
}
namespace LastExpress {
diff --git a/engines/lastexpress/data/scene.cpp b/engines/lastexpress/data/scene.cpp
index 5a943982c4..e893d641a5 100644
--- a/engines/lastexpress/data/scene.cpp
+++ b/engines/lastexpress/data/scene.cpp
@@ -31,6 +31,7 @@
#include "lastexpress/lastexpress.h"
#include "lastexpress/resource.h"
+#include "common/textconsole.h"
#include "common/stream.h"
namespace LastExpress {
diff --git a/engines/lastexpress/data/scene.h b/engines/lastexpress/data/scene.h
index 7fc9425f28..9ec1899402 100644
--- a/engines/lastexpress/data/scene.h
+++ b/engines/lastexpress/data/scene.h
@@ -72,9 +72,15 @@
#include "lastexpress/shared.h"
#include "common/array.h"
+#include "common/rect.h"
namespace Common {
class SeekableReadStream;
+class String;
+}
+
+namespace Graphics {
+struct Surface;
}
namespace LastExpress {
diff --git a/engines/lastexpress/data/sequence.cpp b/engines/lastexpress/data/sequence.cpp
index 2308d70a2b..b986a33d5c 100644
--- a/engines/lastexpress/data/sequence.cpp
+++ b/engines/lastexpress/data/sequence.cpp
@@ -30,6 +30,7 @@
#include "lastexpress/debug.h"
#include "common/stream.h"
+#include "common/textconsole.h"
namespace LastExpress {
@@ -82,7 +83,7 @@ void FrameInfo::read(Common::SeekableReadStream *in, bool isSequence) {
AnimFrame::AnimFrame(Common::SeekableReadStream *in, const FrameInfo &f) : _palette(NULL) {
_palSize = 1;
// TODO: use just the needed rectangle
- _image.create(640, 480, 1);
+ _image.create(640, 480, Graphics::PixelFormat::createFormatCLUT8());
//debugC(6, kLastExpressDebugGraphics, " Offsets: data=%d, unknown=%d, palette=%d", f.dataOffset, f.unknown, f.paletteOffset);
//debugC(6, kLastExpressDebugGraphics, " Position: (%d, %d) - (%d, %d)", f.xPos1, f.yPos1, f.xPos2, f.yPos2);
diff --git a/engines/lastexpress/data/sequence.h b/engines/lastexpress/data/sequence.h
index 7ad0a57254..cd16f26ab2 100644
--- a/engines/lastexpress/data/sequence.h
+++ b/engines/lastexpress/data/sequence.h
@@ -77,6 +77,8 @@
#include "lastexpress/shared.h"
#include "common/array.h"
+#include "common/rect.h"
+#include "common/str.h"
namespace Common {
class SeekableReadStream;
diff --git a/engines/lastexpress/data/snd.cpp b/engines/lastexpress/data/snd.cpp
index bd2320726a..a50fa7be08 100644
--- a/engines/lastexpress/data/snd.cpp
+++ b/engines/lastexpress/data/snd.cpp
@@ -30,12 +30,48 @@
#include "lastexpress/debug.h"
-#include "audio/decoders/adpcm.h"
+#include "audio/decoders/adpcm_intern.h"
#include "audio/audiostream.h"
+#include "common/debug.h"
#include "common/memstream.h"
+#include "common/system.h"
+#include "common/textconsole.h"
namespace LastExpress {
+// Last Express ADPCM is similar to MS IMA mono, but inverts its nibbles
+// and does not have the 4 byte per channel requirement
+
+class LastExpress_ADPCMStream : public Audio::Ima_ADPCMStream {
+public:
+ LastExpress_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, uint32 blockSize) :
+ Audio::Ima_ADPCMStream(stream, disposeAfterUse, size, 44100, 1, blockSize) {}
+
+ int readBuffer(int16 *buffer, const int numSamples) {
+ int samples = 0;
+
+ assert(numSamples % 2 == 0);
+
+ while (samples < numSamples && !_stream->eos() && _stream->pos() < _endpos) {
+ if (_blockPos[0] == _blockAlign) {
+ // read block header
+ _status.ima_ch[0].last = _stream->readSint16LE();
+ _status.ima_ch[0].stepIndex = _stream->readSint16LE();
+ _blockPos[0] = 4;
+ }
+
+ for (; samples < numSamples && _blockPos[0] < _blockAlign && !_stream->eos() && _stream->pos() < _endpos; samples += 2) {
+ byte data = _stream->readByte();
+ _blockPos[0]++;
+ buffer[samples] = decodeIMA((data >> 4) & 0x0f);
+ buffer[samples + 1] = decodeIMA(data & 0x0f);
+ }
+ }
+
+ return samples;
+ }
+};
+
//////////////////////////////////////////////////////////////////////////
// Sound
//////////////////////////////////////////////////////////////////////////
@@ -60,7 +96,7 @@ void SimpleSound::loadHeader(Common::SeekableReadStream *in) {
}
Audio::AudioStream *SimpleSound::makeDecoder(Common::SeekableReadStream *in, uint32 size) const {
- return Audio::makeADPCMStream(in, DisposeAfterUse::YES, size, Audio::kADPCMMSImaLastExpress, 44100, 1, _blockSize);
+ return new LastExpress_ADPCMStream(in, DisposeAfterUse::YES, size, _blockSize);
}
void SimpleSound::play(Audio::AudioStream *as) {
diff --git a/engines/lastexpress/data/snd.h b/engines/lastexpress/data/snd.h
index 2d28404f42..61d1c0951a 100644
--- a/engines/lastexpress/data/snd.h
+++ b/engines/lastexpress/data/snd.h
@@ -42,8 +42,8 @@
#include "audio/mixer.h"
namespace Audio {
- class AudioStream;
- class QueuingAudioStream;
+class AudioStream;
+class QueuingAudioStream;
}
namespace Common {
diff --git a/engines/lastexpress/data/subtitle.cpp b/engines/lastexpress/data/subtitle.cpp
index 953edd1d1a..2bc5d3c5ad 100644
--- a/engines/lastexpress/data/subtitle.cpp
+++ b/engines/lastexpress/data/subtitle.cpp
@@ -33,7 +33,9 @@
#include "lastexpress/debug.h"
#include "common/debug.h"
+#include "common/rect.h"
#include "common/stream.h"
+#include "common/textconsole.h"
namespace LastExpress {
diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h
index ccef312cd6..8c6cc2bafc 100644
--- a/engines/lastexpress/entities/entity.h
+++ b/engines/lastexpress/entities/entity.h
@@ -35,6 +35,7 @@
#include "common/array.h"
#include "common/func.h"
#include "common/serializer.h"
+#include "common/textconsole.h"
namespace LastExpress {
diff --git a/engines/lastexpress/game/inventory.cpp b/engines/lastexpress/game/inventory.cpp
index 81189ae633..c4d43d53d7 100644
--- a/engines/lastexpress/game/inventory.cpp
+++ b/engines/lastexpress/game/inventory.cpp
@@ -43,13 +43,13 @@
namespace LastExpress {
-Inventory::Inventory(LastExpressEngine *engine) : _engine(engine), _selectedItem(kItemNone), _highlightedItem(kItemNone), _itemsShown(0),
+Inventory::Inventory(LastExpressEngine *engine) : _engine(engine), _selectedItem(kItemNone), _highlightedItemIndex(0), _itemsShown(0),
_showingHourGlass(false), _blinkingEgg(false), _blinkingTime(0), _blinkingInterval(_defaultBlinkingInterval), _blinkingBrightness(1),
- _useMagnifier(false), _flag1(false), _isOpened(false), _eggHightlighted(false), _itemScene(NULL) {
+ _useMagnifier(false), _portraitHighlighted(false), _isOpened(false), _eggHightlighted(false), _itemScene(NULL) {
- _inventoryRect = Common::Rect(0, 0, 32, 32);
- _menuRect = Common::Rect(608, 448, 640, 480);
- _selectedRect = Common::Rect(44, 0, 76, 32);
+ //_inventoryRect = Common::Rect(0, 0, 32, 32);
+ _menuEggRect = Common::Rect(608, 448, 640, 480);
+ _selectedItemRect = Common::Rect(44, 0, 76, 32);
init();
}
@@ -136,13 +136,14 @@ void Inventory::handleMouseEvent(const Common::Event &ev) {
_useMagnifier = false;
// Egg (menu)
- if (!_menuRect.contains(ev.mouse)) {
+ if (!_menuEggRect.contains(ev.mouse)) {
// Remove highlight if needed
if (_eggHightlighted) {
if (!getGlobalTimer()) {
drawItem((CursorStyle)(getMenu()->getGameId() + 39), 608, 448, 1);
askForRedraw();
}
+
_eggHightlighted = false;
}
} else {
@@ -159,7 +160,7 @@ void Inventory::handleMouseEvent(const Common::Event &ev) {
// If clicked, show the menu
if (ev.type == Common::EVENT_LBUTTONDOWN) {
_eggHightlighted = false;
- _flag1 = false;
+ _portraitHighlighted = false;
_isOpened = false;
getSound()->playSoundWithSubtitles("LIB039.SND", SoundManager::kFlagMenuClock, kEntityPlayer);
@@ -178,14 +179,125 @@ void Inventory::handleMouseEvent(const Common::Event &ev) {
// Selected item
if (ev.mouse.x >= 32) {
- // TODO
+ if (_isOpened) {
+ // If clicked
+ if (ev.type == Common::EVENT_LBUTTONDOWN) {
+ if (_highlightedItemIndex != 0) {
+ error("[Inventory::handleMouseEvent] Click on highlighted item not implemented");
+ }
+ } else {
+ warning("[Inventory::handleMouseEvent] Default handling of open menu not implemented");
+ }
+ } else {
+ if (_portraitHighlighted) {
+ drawItem((CursorStyle)getProgress().portrait, 0, 0, 1);
+ askForRedraw();
+ _portraitHighlighted = false;
+ }
+
+ if (_selectedItem != kItemNone
+ && get(_selectedItem)->scene != kSceneNone
+ && _selectedItemRect.contains(ev.mouse)) {
+ error("[Inventory::handleMouseEvent] Default handling of selected item not implemented");
+ }
+ }
return;
}
// Opened inventory
if (ev.mouse.y >= 32) {
- // TODO
+ // Draw portrait (darkened) if the inventory is closed (and we are not on top of it)
+ if (!_isOpened) {
+ if (_portraitHighlighted) {
+ drawItem((CursorStyle)getProgress().portrait, 0, 0, 1);
+ askForRedraw();
+ _portraitHighlighted = false;
+ }
+
+ return;
+ }
+
+ // Change item highlight on list
+ if (getFlags()->mouseLeftPressed) {
+ uint32 index = ev.mouse.y / 40;
+
+ if (_highlightedItemIndex && _highlightedItemIndex != index)
+ drawHighlight(_highlightedItemIndex, true);
+
+ if (index && index <= _itemsShown && index != _highlightedItemIndex)
+ drawHighlight(index, false);
+
+ return;
+ }
+
+ // User released the mouse button, check if we were on a valid item
+ uint32 index = _highlightedItemIndex ? getItemIndex(_highlightedItemIndex) : 0;
+
+ // Reset items and portrait
+ drawItem((CursorStyle)getProgress().portrait, 0, 0, 1);
+ _engine->getGraphicsManager()->clear(GraphicsManager::kBackgroundInventory, Common::Rect(0, 44, 32, (int16)(40 * _itemsShown + 40)));
+ _highlightedItemIndex = 0;
+ _itemsShown = 0;
+
+ // Load the scene if an item has been selected
+ if (index) {
+ InventoryEntry entry = _entries[index];
+
+ // If a scene is affected to the item
+ if (entry.scene) {
+ if (getState()->sceneUseBackup) {
+ if (getFirstExaminableItem() && !getState()->sceneBackup2)
+ getState()->sceneBackup2 = getState()->scene;
+ } else {
+ getState()->sceneUseBackup = true;
+ getState()->sceneBackup = getState()->scene;
+ }
+
+ getScenes()->loadScene(entry.scene);
+ }
+
+ if (entry.field_2) {
+ selectItem((InventoryItem)index);
+ } else {
+ drawSelectedItem();
+ }
+
+ // Set inventory as closed (will cause a cleanup on next call)
+ _isOpened = false;
+
+ return;
+ }
+
+ // Draw the currently selected item
+ drawSelectedItem();
+
+ // Stop processing if we are not looking at an item already
+ if (!getState()->sceneUseBackup) {
+ _isOpened = false;
+ return;
+ }
+
+ SceneIndex scene = kSceneNone;
+ if (getState()->sceneBackup2) {
+ scene = getState()->sceneBackup2;
+ getState()->sceneBackup2 = kSceneNone;
+ } else {
+ if (getEvent(kEventKronosBringFirebird) || getProgress().isEggOpen) {
+ _isOpened = false;
+ return;
+ }
+
+ getState()->sceneUseBackup = false;
+ scene = getState()->sceneBackup;
+
+ if (getEntities()->getPosition(getScenes()->get(scene)->car, getScenes()->get(scene)->position))
+ scene = getScenes()->processIndex(getState()->sceneBackup);
+ }
+
+ getScenes()->loadScene(scene);
+
+ _isOpened = false;
return;
}
@@ -202,10 +314,10 @@ void Inventory::handleMouseEvent(const Common::Event &ev) {
return;
}
- if (!_flag1 && !_isOpened) {
+ if (!_portraitHighlighted && !_isOpened) {
drawItem((CursorStyle)getProgress().portrait, 0, 0);
- _flag1 = true;
- } else if (!_isOpened || (ev.type == Common::EVENT_LBUTTONDOWN || ev.type == Common::EVENT_LBUTTONUP)) {
+ _portraitHighlighted = true;
+ } else if (!_isOpened || getFlags()->mouseLeftPressed) {
// Do nothing
} else if (_isOpened) {
close();
@@ -239,12 +351,12 @@ void Inventory::handleMouseEvent(const Common::Event &ev) {
}
}
- _flag1 = true;
+ _portraitHighlighted = true;
}
// Draw highlighted item
- if (_highlightedItem)
- drawHighlight();
+ if (_highlightedItemIndex)
+ drawHighlight(_highlightedItemIndex, true);
}
}
@@ -256,7 +368,7 @@ void Inventory::show() {
askForRedraw();
// Show portrait (first draw, cannot be highlighted)
- drawItem((CursorStyle)getProgress().portrait, 0, 0);
+ drawItem((CursorStyle)getProgress().portrait, 0, 0, 1);
// Show selected item
if (_selectedItem != kItemNone)
@@ -511,9 +623,27 @@ void Inventory::drawItem(CursorStyle id, uint16 x, uint16 y, int16 brightnessInd
_engine->getGraphicsManager()->draw(&icon, GraphicsManager::kBackgroundInventory);
}
-// Close inventory: clear items and reset icon
+void Inventory::drawSelectedItem() {
+ // Draw the selected item if any
+ if (!_selectedItem || get(_selectedItem)->manualSelect) {
+ _selectedItem = getFirstExaminableItem();
+
+ if (_selectedItem) {
+ drawItem(get(_selectedItem)->cursor, 44, 0);
+ } else {
+ clearSelectedItem();
+ }
+ askForRedraw();
+ }
+}
+
+void Inventory::clearSelectedItem() {
+ _engine->getGraphicsManager()->clear(GraphicsManager::kBackgroundInventory, Common::Rect(44, 0, 44 + 32, 32));
+}
+
+// Open inventory: show portrait selected and draw contents
void Inventory::open() {
- _flag1 = false;
+ _portraitHighlighted = false;
_isOpened = true;
// Draw highlighted portrait
@@ -552,9 +682,18 @@ void Inventory::close() {
askForRedraw();
}
-void Inventory::drawHighlight() {
- int32 count = 0;
- uint32 index = 0;
+void Inventory::drawHighlight(uint32 currentIndex, bool reset) {
+ uint32 index = getItemIndex(currentIndex);
+
+ if (index) {
+ drawItem(_entries[index].cursor, 0, 40 * currentIndex + 4, reset ? 1 : -1);
+ _highlightedItemIndex = reset ? 0 : currentIndex;
+ askForRedraw();
+ }
+}
+
+uint32 Inventory::getItemIndex(uint32 currentIndex) {
+ uint32 count = 0;
for (uint32 i = 1; i < ARRAYSIZE(_entries); i++) {
if (!_entries[i].isPresent)
@@ -565,17 +704,13 @@ void Inventory::drawHighlight() {
if (count < 11) {
++count;
- if (count == _highlightedItem) {
- index = i;
- break;
- }
+
+ if (count == currentIndex)
+ return i;
}
}
- if (index) {
- drawItem(_entries[index].cursor, 0, 40 * _highlightedItem + 4, 1);
- _highlightedItem = kItemNone;
- }
+ return 0;
}
} // End of namespace LastExpress
diff --git a/engines/lastexpress/game/inventory.h b/engines/lastexpress/game/inventory.h
index 860f8257fe..9a885438eb 100644
--- a/engines/lastexpress/game/inventory.h
+++ b/engines/lastexpress/game/inventory.h
@@ -120,7 +120,7 @@ public:
// State
bool isMagnifierInUse() { return _useMagnifier; }
- bool isFlag1() { return _flag1; }
+ bool isPortraitHighlighted() { return _portraitHighlighted; }
bool isOpened() { return _isOpened; }
bool isEggHighlighted() { return _eggHightlighted; }
@@ -142,7 +142,7 @@ private:
InventoryEntry _entries[32];
InventoryItem _selectedItem;
- InventoryItem _highlightedItem;
+ uint32 _highlightedItemIndex;
uint32 _itemsShown;
@@ -154,27 +154,31 @@ private:
// Flags
bool _useMagnifier;
- bool _flag1;
+ bool _portraitHighlighted;
bool _isOpened;
bool _eggHightlighted;
Scene *_itemScene;
// Important rects
- Common::Rect _inventoryRect;
- Common::Rect _menuRect;
- Common::Rect _selectedRect;
+ //Common::Rect _inventoryRect;
+ Common::Rect _menuEggRect;
+ Common::Rect _selectedItemRect;
void init();
void open();
void close();
void examine(InventoryItem item);
- void drawHighlight();
+ void drawHighlight(uint32 currentIndex, bool reset);
+ uint32 getItemIndex(uint32 currentIndex);
bool isItemSceneParameter(InventoryItem item) const;
void drawItem(CursorStyle id, uint16 x, uint16 y, int16 brighnessIndex = -1);
+
+ void drawSelectedItem();
+ void clearSelectedItem();
};
} // End of namespace LastExpress
diff --git a/engines/lastexpress/game/logic.cpp b/engines/lastexpress/game/logic.cpp
index bfed65eb4a..83e067f67c 100644
--- a/engines/lastexpress/game/logic.cpp
+++ b/engines/lastexpress/game/logic.cpp
@@ -89,7 +89,7 @@ Logic::~Logic() {
#define REDRAW_CURSOR() { \
if (getInventory()->isMagnifierInUse()) \
_engine->getCursor()->setStyle(kCursorMagnifier); \
- if (getInventory()->isFlag1() \
+ if (getInventory()->isPortraitHighlighted() \
|| getInventory()->isOpened() \
|| getInventory()->isEggHighlighted()) \
_engine->getCursor()->setStyle(kCursorNormal); \
@@ -104,7 +104,7 @@ void Logic::eventMouse(const Common::Event &ev) {
getFlags()->mouseRightClick = false;
// Process event flags
- if (ev.type == Common::EVENT_LBUTTONUP) {
+ if (ev.type == Common::EVENT_LBUTTONDOWN) {
if (getFlags()->frameInterval)
_ignoreFrameInterval = false;
@@ -113,7 +113,7 @@ void Logic::eventMouse(const Common::Event &ev) {
}
if (getFlags()->flag_0) {
- if (ev.type == Common::EVENT_LBUTTONUP || ev.type == Common::EVENT_RBUTTONUP) {
+ if (ev.type == Common::EVENT_LBUTTONDOWN || ev.type == Common::EVENT_RBUTTONDOWN) {
getFlags()->flag_0 = false;
getFlags()->shouldRedraw = true;
updateCursor(true);
@@ -143,7 +143,7 @@ void Logic::eventMouse(const Common::Event &ev) {
&& !getProgress().isEggOpen
&& !getEntities()->isPlayerPosition(kCarGreenSleeping, 59)
&& !getEntities()->isPlayerPosition(kCarGreenSleeping, 76)
- && !getInventory()->isFlag1()
+ && !getInventory()->isPortraitHighlighted()
&& !getInventory()->isOpened()
&& !getInventory()->isEggHighlighted()
&& !getInventory()->isMagnifierInUse()) {
@@ -173,7 +173,7 @@ void Logic::eventMouse(const Common::Event &ev) {
if (getInventory()->getSelectedItem() == kItemMatch
&& (getEntities()->isPlayerInCar(kCarGreenSleeping) || getEntities()->isPlayerInCar(kCarRedSleeping))
&& getProgress().jacket == kJacketGreen
- && !getInventory()->isFlag1()
+ && !getInventory()->isPortraitHighlighted()
&& !getInventory()->isOpened()
&& !getInventory()->isEggHighlighted()
&& !getInventory()->isMagnifierInUse()
@@ -198,7 +198,7 @@ void Logic::eventMouse(const Common::Event &ev) {
// Handle entity item case
EntityIndex entityIndex = getEntities()->canInteractWith(ev.mouse);
if (entityIndex
- && !getInventory()->isFlag1()
+ && !getInventory()->isPortraitHighlighted()
&& !getInventory()->isOpened()
&& !getInventory()->isEggHighlighted()
&& !getInventory()->isMagnifierInUse()) {
@@ -223,17 +223,17 @@ void Logic::eventMouse(const Common::Event &ev) {
//////////////////////////////////////////////////////////////////////////
// Handle standard actions
- if (getInventory()->isFlag1() || getInventory()->isOpened() || getInventory()->isEggHighlighted())
+ if (getInventory()->isPortraitHighlighted() || getInventory()->isOpened() || getInventory()->isEggHighlighted())
_engine->getCursor()->setStyle(kCursorNormal);
- if (hotspotHandled || getInventory()->isFlag1() || getInventory()->isOpened() || getInventory()->isEggHighlighted())
+ if (hotspotHandled || getInventory()->isPortraitHighlighted() || getInventory()->isOpened() || getInventory()->isEggHighlighted())
return;
// Magnifier in use
if (getInventory()->isMagnifierInUse()) {
_engine->getCursor()->setStyle(kCursorMagnifier);
- if (getInventory()->isFlag1()
+ if (getInventory()->isPortraitHighlighted()
|| getInventory()->isOpened()
|| getInventory()->isEggHighlighted())
_engine->getCursor()->setStyle(kCursorNormal);
@@ -518,7 +518,7 @@ void Logic::updateCursor(bool) const { /* the cursor is always updated, even whe
|| getProgress().isEggOpen
|| getEntities()->isPlayerPosition(kCarGreenSleeping, 59)
|| getEntities()->isPlayerPosition(kCarGreenSleeping, 76)
- || getInventory()->isFlag1()
+ || getInventory()->isPortraitHighlighted()
|| getInventory()->isOpened()
|| getInventory()->isEggHighlighted()
|| getInventory()->isMagnifierInUse()) {
@@ -526,7 +526,7 @@ void Logic::updateCursor(bool) const { /* the cursor is always updated, even whe
if (getInventory()->getSelectedItem() != kItemMatch
|| (!getEntities()->isPlayerInCar(kCarGreenSleeping) && !getEntities()->isPlayerInCar(kCarRedSleeping))
|| getProgress().jacket != kJacketGreen
- || getInventory()->isFlag1()
+ || getInventory()->isPortraitHighlighted()
|| getInventory()->isOpened()
|| getInventory()->isEggHighlighted()
|| getInventory()->isMagnifierInUse()
@@ -536,7 +536,7 @@ void Logic::updateCursor(bool) const { /* the cursor is always updated, even whe
EntityIndex entity = getEntities()->canInteractWith(getCoords());
if (entity
- && !getInventory()->isFlag1()
+ && !getInventory()->isPortraitHighlighted()
&& !getInventory()->isOpened()
&& !getInventory()->isEggHighlighted()
&& !getInventory()->isMagnifierInUse()) {
@@ -550,7 +550,7 @@ void Logic::updateCursor(bool) const { /* the cursor is always updated, even whe
}
if (!interact
- && !getInventory()->isFlag1()
+ && !getInventory()->isPortraitHighlighted()
&& !getInventory()->isOpened()
&& !getInventory()->isEggHighlighted()
&& !getInventory()->isMagnifierInUse()) {
@@ -587,7 +587,7 @@ void Logic::updateCursor(bool) const { /* the cursor is always updated, even whe
if (getInventory()->isMagnifierInUse())
style = kCursorMagnifier;
- if (getInventory()->isFlag1() || getInventory()->isOpened() || getInventory()->isEggHighlighted())
+ if (getInventory()->isPortraitHighlighted() || getInventory()->isOpened() || getInventory()->isEggHighlighted())
style = kCursorNormal;
_engine->getCursor()->setStyle(style);
diff --git a/engines/lastexpress/game/state.h b/engines/lastexpress/game/state.h
index d97ebc1b55..663550acc2 100644
--- a/engines/lastexpress/game/state.h
+++ b/engines/lastexpress/game/state.h
@@ -28,8 +28,10 @@
#include "lastexpress/shared.h"
+#include "common/rect.h"
#include "common/serializer.h"
#include "common/system.h"
+#include "common/textconsole.h"
namespace LastExpress {
@@ -564,6 +566,9 @@ public:
bool mouseLeftClick;
bool mouseRightClick;
+ bool mouseLeftPressed;
+ bool mouseRightPressed;
+
bool flag_entities_0;
bool flag_entities_1;
@@ -585,6 +590,9 @@ public:
mouseRightClick = false;
mouseLeftClick = false;
+ mouseLeftPressed = false;
+ mouseRightPressed = false;
+
flag_entities_0 = false;
flag_entities_1 = false;
diff --git a/engines/lastexpress/graphics.cpp b/engines/lastexpress/graphics.cpp
index e5a69d16ea..c45baba808 100644
--- a/engines/lastexpress/graphics.cpp
+++ b/engines/lastexpress/graphics.cpp
@@ -25,20 +25,23 @@
#include "lastexpress/graphics.h"
+#include "common/rect.h"
#include "common/system.h"
+#include "common/textconsole.h"
namespace LastExpress {
#define COLOR_KEY 0xFFFF
GraphicsManager::GraphicsManager() : _changed(false) {
- _screen.create(640, 480, 2);
+ const Graphics::PixelFormat format(2, 5, 5, 5, 0, 10, 5, 0, 0);
+ _screen.create(640, 480, format);
// Create the game surfaces
- _backgroundA.create(640, 480, 2);
- _backgroundC.create(640, 480, 2);
- _overlay.create(640, 480, 2);
- _inventory.create(640, 480, 2);
+ _backgroundA.create(640, 480, format);
+ _backgroundC.create(640, 480, format);
+ _overlay.create(640, 480, format);
+ _inventory.create(640, 480, format);
clear(kBackgroundAll);
}
diff --git a/engines/lastexpress/lastexpress.cpp b/engines/lastexpress/lastexpress.cpp
index 7c08fef627..535f5e86b7 100644
--- a/engines/lastexpress/lastexpress.cpp
+++ b/engines/lastexpress/lastexpress.cpp
@@ -215,6 +215,7 @@ bool LastExpressEngine::handleEvents() {
case Common::EVENT_LBUTTONUP:
case Common::EVENT_LBUTTONDOWN:
getGameLogic()->getGameState()->getGameFlags()->mouseLeftClick = true;
+ getGameLogic()->getGameState()->getGameFlags()->mouseLeftPressed = (ev.type == Common::EVENT_LBUTTONDOWN) ? true : false;
// Adjust frameInterval flag
if (_frameCounter < _lastFrameCount + 30)
@@ -228,6 +229,8 @@ bool LastExpressEngine::handleEvents() {
case Common::EVENT_RBUTTONUP:
case Common::EVENT_RBUTTONDOWN:
getGameLogic()->getGameState()->getGameFlags()->mouseRightClick = true;
+ getGameLogic()->getGameState()->getGameFlags()->mouseRightPressed = (ev.type == Common::EVENT_RBUTTONDOWN) ? true : false;
+
if (_eventMouse && _eventMouse->isValid())
(*_eventMouse)(ev);
break;
diff --git a/engines/lastexpress/resource.cpp b/engines/lastexpress/resource.cpp
index 5a77b23602..dff686a503 100644
--- a/engines/lastexpress/resource.cpp
+++ b/engines/lastexpress/resource.cpp
@@ -34,6 +34,7 @@
#include "common/debug.h"
#include "common/file.h"
+#include "common/textconsole.h"
namespace LastExpress {
diff --git a/engines/lure/debugger.cpp b/engines/lure/debugger.cpp
index 9b1bb743e4..fc2029c6c4 100644
--- a/engines/lure/debugger.cpp
+++ b/engines/lure/debugger.cpp
@@ -312,7 +312,7 @@ bool Debugger::cmd_hotspot(int argc, const char **argv) {
hs->width, hs->height, hs->widthCopy, hs->heightCopy, hs->yCorrection);
DebugPrintf("Talk bubble offset = %d,%d\n", hs->talkX, hs->talkY);
DebugPrintf("load offset = %xh, script load = %d\n", hs->loadOffset, hs->scriptLoadFlag);
- DebugPrintf("Animation Id = %xh, Colour offset = %d\n", hs->animRecordId, hs->colourOffset);
+ DebugPrintf("Animation Id = %xh, Color offset = %d\n", hs->animRecordId, hs->colorOffset);
DebugPrintf("Talk Script offset = %xh, Tick Script offset = %xh\n",
hs->talkScriptOffset, hs->tickScriptOffset);
DebugPrintf("Tick Proc offset = %xh\n", hs->tickProcId);
@@ -543,7 +543,7 @@ bool Debugger::cmd_showAnim(int argc, const char **argv) {
hotspot->setSize(width, height);
Hotspot *player = res.activateHotspot(PLAYER_ID);
- hotspot->setColourOffset(player->resource()->colourOffset);
+ hotspot->setColorOffset(player->resource()->colorOffset);
hotspot->setAnimation(animId);
diff --git a/engines/lure/decode.cpp b/engines/lure/decode.cpp
index ae91cc1c52..5ffdcf1884 100644
--- a/engines/lure/decode.cpp
+++ b/engines/lure/decode.cpp
@@ -111,7 +111,7 @@ MemoryBlock *PictureDecoder::egaDecode(MemoryBlock *src, uint32 maxOutputSize) {
dataPos += sizeof(uint16);
int bitCtr = 8;
- // Decode the colour popularity table
+ // Decode the color popularity table
for (int nibbleCtr = 0; nibbleCtr < 32; ++nibbleCtr) {
for (int byteCtr = 0; byteCtr < 128; byteCtr += 32) {
@@ -134,7 +134,7 @@ MemoryBlock *PictureDecoder::egaDecode(MemoryBlock *src, uint32 maxOutputSize) {
READ_BIT_DX
if (!bitFlag) {
- // Get the favourite colour
+ // Get the favourite color
v = popTable[tableOffset];
} else {
@@ -182,7 +182,7 @@ MemoryBlock *PictureDecoder::egaDecode(MemoryBlock *src, uint32 maxOutputSize) {
continue;
} else {
- // It's a new colour
+ // It's a new color
v = al;
}
diff --git a/engines/lure/disk.h b/engines/lure/disk.h
index d2848cc587..79aaf80bbc 100644
--- a/engines/lure/disk.h
+++ b/engines/lure/disk.h
@@ -33,7 +33,7 @@
#include "lure/res_struct.h"
namespace Common {
- class File;
+class File;
}
namespace Lure {
diff --git a/engines/lure/fights.cpp b/engines/lure/fights.cpp
index 789c9d924e..983033281a 100644
--- a/engines/lure/fights.cpp
+++ b/engines/lure/fights.cpp
@@ -74,7 +74,7 @@ void FightsManager::setupPigFight() {
Resources &res = Resources::getReference();
Hotspot *player = res.getActiveHotspot(PLAYER_ID);
player->setSkipFlag(false);
- player->resource()->colourOffset = 16;
+ player->resource()->colorOffset = 16;
player->setTickProc(PLAYER_FIGHT_TICK_PROC_ID);
player->setSize(48, 53);
player->setAnimationIndex(PLAYER_FIGHT_ANIM_INDEX);
@@ -103,7 +103,7 @@ void FightsManager::setupSkorlFight() {
rec.fwtrue_x = 282;
rec.fwtrue_y = 136;
player->setPosition(282, 136);
- player->resource()->colourOffset = 96;
+ player->resource()->colorOffset = 96;
}
bool FightsManager::isFighting() {
@@ -598,7 +598,7 @@ void FightsManager::enemyKilled() {
playerHotspot->setTickProc(PLAYER_TICK_PROC_ID);
playerRec.fwhits = GENERAL_MAGIC_ID;
- playerHotspot->resource()->colourOffset = 128;
+ playerHotspot->resource()->colorOffset = 128;
playerHotspot->setSize(32, 48);
playerHotspot->resource()->width = 32;
playerHotspot->resource()->height = 48;
diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp
index bce98b28fd..5644ef798c 100644
--- a/engines/lure/hotspots.cpp
+++ b/engines/lure/hotspots.cpp
@@ -73,7 +73,7 @@ Hotspot::Hotspot(HotspotData *res): _pathFinder(this) {
_hotspotScriptOffset = res->hotspotScriptOffset;
_frameCtr = res->tickTimeout;
_tempDest.counter = 0;
- _colourOffset = isEGA ? 0 : res->colourOffset;
+ _colorOffset = isEGA ? 0 : res->colorOffset;
_override = resources.getHotspotOverride(res->hotspotId);
setAnimation(_data->animRecordId);
@@ -103,7 +103,7 @@ Hotspot::Hotspot(Hotspot *character, uint16 objType): _pathFinder(this) {
_persistant = false;
_hotspotId = 0xffff;
_override = NULL;
- _colourOffset = 0;
+ _colorOffset = 0;
_destHotspotId = character->hotspotId();
_blockedOffset = 0;
_exitCtr = 0;
@@ -174,7 +174,7 @@ Hotspot::Hotspot(): _pathFinder(NULL) {
_persistant = false;
_hotspotId = 0xffff;
_override = NULL;
- _colourOffset = 0;
+ _colorOffset = 0;
_destHotspotId = 0;
_blockedOffset = 0;
_exitCtr = 0;
@@ -303,7 +303,7 @@ void Hotspot::setAnimation(HotspotAnimData *newRecord) {
_frames = new Surface(_width * _numFrames, _height);
_frameStartsUsed = false;
}
- _frames->data().setBytes(_colourOffset, 0, _frames->data().size());
+ _frames->data().setBytes(_colorOffset, 0, _frames->data().size());
byte *pSrc = dest->data() + 0x40;
byte *pDest;
@@ -353,13 +353,13 @@ void Hotspot::setAnimation(HotspotAnimData *newRecord) {
xStart = frameNumCtr * _width;
}
- // Copy over the frame, applying the colour offset to each nibble
+ // Copy over the frame, applying the color offset to each nibble
for (uint16 yPos = 0; yPos < tempHeight; ++yPos) {
pDest = mDest.data() + yPos * _frames->width() + xStart;
for (uint16 xPos = 0; xPos < tempWidth / 2; ++xPos) {
- *pDest++ = _colourOffset + (*pSrc >> 4);
- *pDest++ = _colourOffset + (*pSrc & 0xf);
+ *pDest++ = _colorOffset + (*pSrc >> 4);
+ *pDest++ = _colorOffset + (*pSrc & 0xf);
++pSrc;
}
}
@@ -421,7 +421,7 @@ void Hotspot::copyTo(Surface *dest) {
if ((r.top >= r.bottom) || (r.left >= r.right))
return;
- _frames->copyTo(dest, r, (uint16) xPos, (uint16) yPos, _colourOffset);
+ _frames->copyTo(dest, r, (uint16) xPos, (uint16) yPos, _colorOffset);
}
void Hotspot::incFrameNumber() {
@@ -2313,7 +2313,7 @@ void Hotspot::saveToStream(Common::WriteStream *stream) {
stream->writeUint16LE(_talkY);
stream->writeByte(_layer);
stream->writeUint16LE(_hotspotScriptOffset);
- stream->writeByte(_colourOffset);
+ stream->writeByte(_colorOffset);
stream->writeByte((byte)_direction);
stream->writeUint16LE(_animId);
stream->writeUint16LE(_frameNumber);
@@ -2358,7 +2358,7 @@ void Hotspot::loadFromStream(Common::ReadStream *stream) {
_talkY = stream->readUint16LE();
_layer = stream->readByte();
_hotspotScriptOffset = stream->readUint16LE();
- _colourOffset = stream->readByte();
+ _colorOffset = stream->readByte();
_direction = (Direction)stream->readByte();
setAnimation(stream->readUint16LE());
setFrameNumber(stream->readUint16LE());
@@ -3505,10 +3505,10 @@ void HotspotTickHandlers::talkAnimHandler(Hotspot &h) {
screen.screen().fillRect(r, 0);
// Display line
- byte colour = LureEngine::getReference().isEGA() ?
- ((lineNum + 1 == selectedLine) ? EGA_DIALOG_WHITE_COLOUR : EGA_DIALOG_TEXT_COLOUR) :
- ((lineNum + 1 == selectedLine) ? VGA_DIALOG_WHITE_COLOUR : VGA_DIALOG_TEXT_COLOUR);
- screen.screen().writeString(r.left, r.top, buffer, false, colour);
+ byte color = LureEngine::getReference().isEGA() ?
+ ((lineNum + 1 == selectedLine) ? EGA_DIALOG_WHITE_COLOR : EGA_DIALOG_TEXT_COLOR) :
+ ((lineNum + 1 == selectedLine) ? VGA_DIALOG_WHITE_COLOR : VGA_DIALOG_TEXT_COLOR);
+ screen.screen().writeString(r.left, r.top, buffer, false, color);
}
if (mouse.mButton() || mouse.rButton()) {
diff --git a/engines/lure/hotspots.h b/engines/lure/hotspots.h
index 2ae2e91ecf..e9f5d56edd 100644
--- a/engines/lure/hotspots.h
+++ b/engines/lure/hotspots.h
@@ -203,7 +203,7 @@ private:
Direction _direction;
uint8 _layer;
uint16 _hotspotScriptOffset;
- uint8 _colourOffset;
+ uint8 _colorOffset;
bool _persistant;
HotspotOverrideData *_override;
bool _skipFlag;
@@ -324,8 +324,8 @@ public:
void setTickProc(uint16 newVal);
bool persistant() { return _persistant; }
void setPersistant(bool value) { _persistant = value; }
- uint8 colourOffset() { return _colourOffset; }
- void setColourOffset(uint8 value) { _colourOffset = value; }
+ uint8 colorOffset() { return _colorOffset; }
+ void setColorOffset(uint8 value) { _colorOffset = value; }
void setRoomNumber(uint16 roomNum) {
_roomNumber = roomNum;
if (_data) _data->roomNumber = roomNum;
diff --git a/engines/lure/lure.h b/engines/lure/lure.h
index 99e9e3d93e..52b785a09a 100644
--- a/engines/lure/lure.h
+++ b/engines/lure/lure.h
@@ -98,7 +98,7 @@ public:
virtual Common::Error run() {
Common::Error err;
err = init();
- if (err != Common::kNoError)
+ if (err.getCode() != Common::kNoError)
return err;
return go();
}
diff --git a/engines/lure/luredefs.h b/engines/lure/luredefs.h
index b13c4a0724..0ef7a73b7e 100644
--- a/engines/lure/luredefs.h
+++ b/engines/lure/luredefs.h
@@ -111,7 +111,7 @@ enum Action {
// Basic game dimensions
#define FULL_SCREEN_WIDTH 320
#define FULL_SCREEN_HEIGHT 200
-#define GAME_COLOURS 256
+#define GAME_COLORS 256
#define SCREEN_SIZE (FULL_SCREEN_HEIGHT * FULL_SCREEN_WIDTH)
// Some resources include multiple packed palettes of 64 entries each
@@ -120,7 +120,7 @@ enum Action {
#define RES_PALETTE_ENTRIES 220
// Main working palette size
#define MAIN_PALETTE_SIZE 228
-// Palette colour increment amouns for palette fade in/outs
+// Palette color increment amouns for palette fade in/outs
#define PALETTE_FADE_INC_SIZE 4
// EGA constants
@@ -189,11 +189,11 @@ enum CursorType {CURSOR_ARROW = 0, CURSOR_DISK = 1, CURSOR_TIME_START = 2,
#define POPMENU_CHANGE_SENSITIVITY 5
// Dialog related defines
-#define EGA_DIALOG_TEXT_COLOUR 6
-#define EGA_DIALOG_WHITE_COLOUR 2
-#define VGA_DIALOG_TEXT_COLOUR 0xe2
-#define VGA_DIALOG_WHITE_COLOUR 0xe3
-#define EGA_DIALOG_BG_COLOUR 13
+#define EGA_DIALOG_TEXT_COLOR 6
+#define EGA_DIALOG_WHITE_COLOR 2
+#define VGA_DIALOG_TEXT_COLOR 0xe2
+#define VGA_DIALOG_WHITE_COLOR 0xe3
+#define EGA_DIALOG_BG_COLOR 13
#define INFO_DIALOG_X 69
#define INFO_DIALOG_Y 61
#define INFO_DIALOG_WIDTH 191
diff --git a/engines/lure/memory.cpp b/engines/lure/memory.cpp
index f96b5015bc..d3d5067cce 100644
--- a/engines/lure/memory.cpp
+++ b/engines/lure/memory.cpp
@@ -25,6 +25,7 @@
#include "lure/memory.h"
#include "common/file.h"
+#include "common/textconsole.h"
namespace Lure {
diff --git a/engines/lure/menu.cpp b/engines/lure/menu.cpp
index 7d0816ee79..f9a78d8fc8 100644
--- a/engines/lure/menu.cpp
+++ b/engines/lure/menu.cpp
@@ -34,7 +34,7 @@
#include "lure/events.h"
#include "lure/lure.h"
-#if defined(_WIN32_WCE) || defined(__SYMBIAN32__)
+#if defined(_WIN32_WCE) || defined(__SYMBIAN32__) || defined(WEBOS)
#define LURE_CLICKABLE_MENUS
#endif
@@ -153,7 +153,7 @@ uint8 Menu::execute() {
toggleHighlight(_selectedMenu);
_surfaceMenu = Surface::newDialog(
_selectedMenu->width(), _selectedMenu->numEntries(),
- _selectedMenu->entries(), false, DEFAULT_TEXT_COLOUR, false);
+ _selectedMenu->entries(), false, DEFAULT_TEXT_COLOR, false);
_surfaceMenu->copyToScreen(_selectedMenu->xstart(), MENUBAR_Y_SIZE);
}
@@ -230,26 +230,26 @@ uint8 Menu::getIndexAt(uint16 x, uint16 y) {
return index;
}
-#define MENUBAR_SELECTED_COLOUR 0xf7
+#define MENUBAR_SELECTED_COLOR 0xf7
void Menu::toggleHighlight(MenuRecord *menuRec) {
- const byte colourList[4] = {4, 2, 0, 0xf7};
- const byte *colours = LureEngine::getReference().isEGA() ? &colourList[0] : &colourList[2];
+ const byte colorList[4] = {4, 2, 0, 0xf7};
+ const byte *colors = LureEngine::getReference().isEGA() ? &colorList[0] : &colorList[2];
byte *addr = _menu->data();
for (uint16 y=0; y<MENUBAR_Y_SIZE; ++y) {
for (uint16 x=menuRec->hsxstart(); x<=menuRec->hsxend(); ++x) {
- if (addr[x] == colours[0]) addr[x] = colours[1];
- else if (addr[x] == colours[1]) addr[x] = colours[0];
+ if (addr[x] == colors[0]) addr[x] = colors[1];
+ else if (addr[x] == colors[1]) addr[x] = colors[0];
}
addr += FULL_SCREEN_WIDTH;
}
}
void Menu::toggleHighlightItem(uint8 index) {
- const byte colourList[4] = {EGA_DIALOG_TEXT_COLOUR, EGA_DIALOG_WHITE_COLOUR,
- VGA_DIALOG_TEXT_COLOUR, VGA_DIALOG_WHITE_COLOUR};
- const byte *colours = LureEngine::getReference().isEGA() ? &colourList[0] : &colourList[2];
+ const byte colorList[4] = {EGA_DIALOG_TEXT_COLOR, EGA_DIALOG_WHITE_COLOR,
+ VGA_DIALOG_TEXT_COLOR, VGA_DIALOG_WHITE_COLOR};
+ const byte *colors = LureEngine::getReference().isEGA() ? &colorList[0] : &colorList[2];
byte *p = _surfaceMenu->data().data() + (Surface::textY() +
((index - 1) * FONT_HEIGHT)) * _surfaceMenu->width() + Surface::textX();
int numBytes =_surfaceMenu->width() - Surface::textX() * 2;
@@ -258,8 +258,8 @@ void Menu::toggleHighlightItem(uint8 index) {
byte *pTemp = p;
for (int x = 0; x < numBytes; ++x, ++pTemp) {
- if (*pTemp == colours[0]) *pTemp = colours[1];
- else if (*pTemp == colours[1]) *pTemp = colours[0];
+ if (*pTemp == colors[0]) *pTemp = colors[1];
+ else if (*pTemp == colors[1]) *pTemp = colors[0];
}
}
@@ -475,9 +475,9 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) {
Screen &screen = Screen::getReference();
Common::Rect r;
bool isEGA = LureEngine::getReference().isEGA();
- byte bgColour = isEGA ? EGA_DIALOG_BG_COLOUR : 0;
- byte textColour = isEGA ? EGA_DIALOG_TEXT_COLOUR : VGA_DIALOG_TEXT_COLOUR;
- byte whiteColour = isEGA ? EGA_DIALOG_WHITE_COLOUR : VGA_DIALOG_WHITE_COLOUR;
+ byte bgColor = isEGA ? EGA_DIALOG_BG_COLOR : 0;
+ byte textColor = isEGA ? EGA_DIALOG_TEXT_COLOR : VGA_DIALOG_TEXT_COLOR;
+ byte whiteColor = isEGA ? EGA_DIALOG_WHITE_COLOR : VGA_DIALOG_WHITE_COLOR;
const uint16 yMiddle = FULL_SCREEN_HEIGHT / 2;
@@ -521,7 +521,7 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) {
for (;;) {
if (refreshFlag) {
// Set up the contents of the menu
- s->fillRect(r, bgColour);
+ s->fillRect(r, bgColor);
for (int index = 0; index < numLines; ++index) {
#ifndef LURE_CLICKABLE_MENUS
@@ -533,9 +533,9 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) {
s->writeString(Surface::textX(), Surface::textY() + index * FONT_HEIGHT,
actions[actionIndex], true,
#ifndef LURE_CLICKABLE_MENUS
- (index == (numLines / 2)) ? whiteColour : textColour,
+ (index == (numLines / 2)) ? whiteColor : textColor,
#else
- (index == selectedIndex) ? whiteColour : textColour,
+ (index == selectedIndex) ? whiteColor : textColor,
#endif
false);
}
diff --git a/engines/lure/palette.cpp b/engines/lure/palette.cpp
index d77f64f00a..b08ca64dfb 100644
--- a/engines/lure/palette.cpp
+++ b/engines/lure/palette.cpp
@@ -33,7 +33,7 @@ namespace Lure {
// Defaults the palette to a full 256 entry palette
Palette::Palette() {
- _numEntries = GAME_COLOURS;
+ _numEntries = GAME_COLORS;
_palette = Memory::allocate(_numEntries * 4);
_palette->empty();
}
@@ -91,7 +91,7 @@ Palette::Palette(uint16 resourceId, PaletteSource paletteSource) {
break;
case RGB64:
- if (((srcData->size() % 3) != 0) || ((srcData->size() / 3) > GAME_COLOURS))
+ if (((srcData->size() % 3) != 0) || ((srcData->size() / 3) > GAME_COLORS))
error("Specified resource %d is not a palette", resourceId);
_numEntries = srcData->size() / 3;
diff --git a/engines/lure/res.cpp b/engines/lure/res.cpp
index 90c2b67b85..01b0bd0d4a 100644
--- a/engines/lure/res.cpp
+++ b/engines/lure/res.cpp
@@ -432,7 +432,7 @@ byte *Resources::getCursor(uint8 cursorNum) {
}
}
- // Post-process the cells to adjust the colour
+ // Post-process the cells to adjust the color
for (int index = 0; index < CURSOR_SIZE; ++index) {
if (_cursor[index] == 3) _cursor[index] = 15;
}
diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp
index f6a2092ddc..39beb2729e 100644
--- a/engines/lure/res_struct.cpp
+++ b/engines/lure/res_struct.cpp
@@ -406,7 +406,7 @@ HotspotData::HotspotData(HotspotResource *rec) {
walkY = READ_LE_UINT16(&rec->walkY);
talkX = rec->talkX;
talkY = rec->talkY;
- colourOffset = READ_LE_UINT16(&rec->colourOffset);
+ colorOffset = READ_LE_UINT16(&rec->colorOffset);
animRecordId = READ_LE_UINT16(&rec->animRecordId);
hotspotScriptOffset = READ_LE_UINT16(&rec->hotspotScriptOffset);
talkScriptOffset = READ_LE_UINT16(&rec->talkScriptOffset);
diff --git a/engines/lure/res_struct.h b/engines/lure/res_struct.h
index e4b8c02f6a..58ee3f4c02 100644
--- a/engines/lure/res_struct.h
+++ b/engines/lure/res_struct.h
@@ -27,9 +27,11 @@
#define LURE_RESSTRUCT_H
#include "lure/luredefs.h"
+#include "common/rect.h"
#include "common/list.h"
#include "common/file.h"
#include "common/ptr.h"
+#include "common/textconsole.h"
namespace Lure {
@@ -88,7 +90,7 @@ struct HotspotResource {
uint16 walkY;
int8 talkX;
int8 talkY;
- uint16 colourOffset;
+ uint16 colorOffset;
uint16 animRecordId;
uint16 hotspotScriptOffset;
uint16 talkScriptOffset;
@@ -538,7 +540,7 @@ public:
uint16 walkY;
int8 talkX;
int8 talkY;
- uint16 colourOffset;
+ uint16 colorOffset;
uint16 animRecordId;
uint16 hotspotScriptOffset;
uint16 talkScriptOffset;
diff --git a/engines/lure/room.cpp b/engines/lure/room.cpp
index 746d6ef094..4cefe1fabb 100644
--- a/engines/lure/room.cpp
+++ b/engines/lure/room.cpp
@@ -432,7 +432,7 @@ void Room::update() {
Surface &s = _screen.screen();
Resources &res = Resources::getReference();
HotspotList &hotspots = res.activeHotspots();
- byte white = LureEngine::getReference().isEGA() ? EGA_DIALOG_WHITE_COLOUR : VGA_DIALOG_WHITE_COLOUR;
+ byte white = LureEngine::getReference().isEGA() ? EGA_DIALOG_WHITE_COLOR : VGA_DIALOG_WHITE_COLOR;
HotspotList::iterator i;
// Copy the background to the temporary screen surface
@@ -564,9 +564,9 @@ void Room::setRoomNumber(uint16 newRoomNumber, bool showOverlay) {
if (isEGA)
_screen.setPaletteEmpty();
else
- // Fade out all the colours except the high index 0FFh, which is used to show the
+ // Fade out all the colors except the high index 0FFh, which is used to show the
// disk cursor as a room changes
- _screen.paletteFadeOut(GAME_COLOURS - 1);
+ _screen.paletteFadeOut(GAME_COLORS - 1);
// Deallocate graphical layers from the room
for (int layerNum = 0; layerNum < _numLayers; ++layerNum) {
diff --git a/engines/lure/screen.cpp b/engines/lure/screen.cpp
index 282e382bba..e02f492ef2 100644
--- a/engines/lure/screen.cpp
+++ b/engines/lure/screen.cpp
@@ -30,6 +30,8 @@
#include "lure/decode.h"
#include "lure/events.h"
+#include "graphics/palette.h"
+
namespace Lure {
static Screen *int_disk = NULL;
@@ -44,7 +46,7 @@ Screen::Screen(OSystem &system): _system(system),
_palette(new Palette(GAME_PALETTE_RESOURCE_ID, RGB64)) {
int_disk = this;
_screen->empty();
- _system.getPaletteManager()->setPalette(_palette->data(), 0, GAME_COLOURS);
+ _system.getPaletteManager()->setPalette(_palette->data(), 0, GAME_COLORS);
}
Screen::~Screen() {
@@ -87,7 +89,7 @@ void Screen::setPaletteEmpty(int numEntries) {
void Screen::setPalette(Palette *p) {
_palette->copyFrom(p);
- setSystemPalette(_palette, 0, GAME_COLOURS);
+ setSystemPalette(_palette, 0, GAME_COLORS);
_system.updateScreen();
}
@@ -138,7 +140,7 @@ void Screen::paletteFadeIn(Palette *p) {
}
// paletteFadeOut
-// Fades the screen to black by gradually decreasing the palette colours
+// Fades the screen to black by gradually decreasing the palette colors
void Screen::paletteFadeOut(int numEntries) {
assert((uint32)numEntries <= _palette->palette()->size());
diff --git a/engines/lure/sound.h b/engines/lure/sound.h
index dd5538085c..7a894d814d 100644
--- a/engines/lure/sound.h
+++ b/engines/lure/sound.h
@@ -30,6 +30,7 @@
#include "lure/disk.h"
#include "lure/memory.h"
+#include "common/mutex.h"
#include "common/singleton.h"
#include "common/ptr.h"
#include "audio/mididrv.h"
diff --git a/engines/lure/surface.cpp b/engines/lure/surface.cpp
index c4ee0f7dad..783401fde2 100644
--- a/engines/lure/surface.cpp
+++ b/engines/lure/surface.cpp
@@ -123,21 +123,21 @@ void Surface::getDialogBounds(Common::Point &size, int charWidth, int numLines,
// Forms a dialog encompassing the entire surface
void Surface::egaCreateDialog(bool blackFlag) {
- byte lineColours1[3] = {6, 0, 9};
- byte lineColours2[3] = {7, 0, 12};
+ byte lineColors1[3] = {6, 0, 9};
+ byte lineColors2[3] = {7, 0, 12};
// Surface contents
- data().setBytes(blackFlag ? 0 : EGA_DIALOG_BG_COLOUR, 0, data().size());
+ data().setBytes(blackFlag ? 0 : EGA_DIALOG_BG_COLOR, 0, data().size());
// Top/bottom lines
for (int y = 2; y >= 0; --y) {
- data().setBytes(lineColours1[y], y * width(), width());
- data().setBytes(lineColours2[y], (height() - y - 1) * width(), width());
+ data().setBytes(lineColors1[y], y * width(), width());
+ data().setBytes(lineColors2[y], (height() - y - 1) * width(), width());
for (int p = y + 1; p < height() - y; ++p) {
byte *line = data().data() + p * width();
- *(line + y) = lineColours2[y];
- *(line + width() - y - 1) = lineColours1[y];
+ *(line + y) = lineColors2[y];
+ *(line + width() - y - 1) = lineColors1[y];
}
}
}
@@ -220,10 +220,10 @@ void Surface::loadScreen(MemoryBlock *rawData) {
delete tmpScreen;
}
-int Surface::writeChar(uint16 x, uint16 y, uint8 ascii, bool transparent, int colour) {
+int Surface::writeChar(uint16 x, uint16 y, uint8 ascii, bool transparent, int color) {
byte *const addr = _data->data() + (y * _width) + x;
- if (colour == DEFAULT_TEXT_COLOUR)
- colour = LureEngine::getReference().isEGA() ? EGA_DIALOG_TEXT_COLOUR : VGA_DIALOG_TEXT_COLOUR;
+ if (color == DEFAULT_TEXT_COLOR)
+ color = LureEngine::getReference().isEGA() ? EGA_DIALOG_TEXT_COLOR : VGA_DIALOG_TEXT_COLOR;
if ((ascii < 32) || (ascii >= 32 + numFontChars))
error("Invalid ascii character passed for display '%d'", ascii);
@@ -239,7 +239,7 @@ int Surface::writeChar(uint16 x, uint16 y, uint8 ascii, bool transparent, int co
for (int x1 = 0; x1 < 8; ++x1, ++pDest) {
if (v & 0x80) {
- *pDest = colour;
+ *pDest = color;
if (x1+1 > charWidth) charWidth = x1 + 1;
}
else if (!transparent) *pDest = 0;
@@ -251,16 +251,16 @@ int Surface::writeChar(uint16 x, uint16 y, uint8 ascii, bool transparent, int co
}
void Surface::writeString(uint16 x, uint16 y, Common::String line, bool transparent,
- int colour, bool varLength) {
- writeSubstring(x, y, line, line.size(), transparent, colour, varLength);
+ int color, bool varLength) {
+ writeSubstring(x, y, line, line.size(), transparent, color, varLength);
}
void Surface::writeSubstring(uint16 x, uint16 y, Common::String line, int len,
- bool transparent, int colour, bool varLength) {
+ bool transparent, int color, bool varLength) {
const char *sPtr = line.c_str();
- if (colour == DEFAULT_TEXT_COLOUR)
- colour = LureEngine::getReference().isEGA() ? EGA_DIALOG_TEXT_COLOUR : VGA_DIALOG_TEXT_COLOUR;
+ if (color == DEFAULT_TEXT_COLOR)
+ color = LureEngine::getReference().isEGA() ? EGA_DIALOG_TEXT_COLOR : VGA_DIALOG_TEXT_COLOR;
for (int index = 0; (index < len) && (*sPtr != '\0'); ++index, ++sPtr) {
int charSize = varLength ? fontSize[(uint8)*sPtr - 32] + 2 : FONT_WIDTH;
@@ -269,7 +269,7 @@ void Surface::writeSubstring(uint16 x, uint16 y, Common::String line, int len,
break;
// Write next character
- writeChar(x, y, (uint8) *sPtr, transparent, colour);
+ writeChar(x, y, (uint8) *sPtr, transparent, color);
// Move to after the character in preparation for the next character
x += charSize;
@@ -312,7 +312,7 @@ void Surface::copyTo(Surface *dest, uint16 x, uint16 y) {
}
void Surface::copyTo(Surface *dest, const Common::Rect &srcBounds,
- uint16 destX, uint16 destY, int transparentColour) {
+ uint16 destX, uint16 destY, int transparentColor) {
int numBytes = srcBounds.right - srcBounds.left + 1;
if (destX + numBytes > dest->width())
numBytes = dest->width() - destX;
@@ -322,8 +322,8 @@ void Surface::copyTo(Surface *dest, const Common::Rect &srcBounds,
const uint32 srcPos = (srcBounds.top + y) * _width + srcBounds.left;
const uint32 destPos = (destY+y) * dest->width() + destX;
- if (transparentColour == -1) {
- // No trnnsparent colour, so copy all the bytes of the line
+ if (transparentColor == -1) {
+ // No trnnsparent color, so copy all the bytes of the line
dest->data().copyFrom(_data, srcPos, destPos, numBytes);
} else {
byte *pSrc = _data->data() + srcPos;
@@ -331,7 +331,7 @@ void Surface::copyTo(Surface *dest, const Common::Rect &srcBounds,
int bytesCtr = numBytes;
while (bytesCtr-- > 0) {
- if (*pSrc != (uint8) transparentColour)
+ if (*pSrc != (uint8) transparentColor)
*pDest = *pSrc;
++pSrc;
++pDest;
@@ -347,12 +347,12 @@ void Surface::copyFrom(MemoryBlock *src, uint32 destOffset) {
}
// fillRect
-// Fills a rectangular area with a colour
+// Fills a rectangular area with a color
-void Surface::fillRect(const Common::Rect &r, uint8 colour) {
+void Surface::fillRect(const Common::Rect &r, uint8 color) {
for (int yp = r.top; yp <= r.bottom; ++yp) {
byte *const addr = _data->data() + (yp * _width) + r.left;
- memset(addr, colour, r.width());
+ memset(addr, color, r.width());
}
}
@@ -464,7 +464,7 @@ void Surface::wordWrap(char *text, uint16 width, char **&lines, uint8 &numLines)
}
Surface *Surface::newDialog(uint16 width, uint8 numLines, const char **lines, bool varLength,
- int colour, bool squashedLines) {
+ int color, bool squashedLines) {
Common::Point size;
Surface::getDialogBounds(size, 0, numLines, squashedLines);
@@ -473,21 +473,21 @@ Surface *Surface::newDialog(uint16 width, uint8 numLines, const char **lines, bo
uint16 yP = Surface::textY();
for (uint8 ctr = 0; ctr < numLines; ++ctr) {
- s->writeString(Surface::textX(), yP, lines[ctr], true, colour, varLength);
+ s->writeString(Surface::textX(), yP, lines[ctr], true, color, varLength);
yP += squashedLines ? FONT_HEIGHT - 1 : FONT_HEIGHT;
}
return s;
}
-Surface *Surface::newDialog(uint16 width, const char *line, int colour) {
+Surface *Surface::newDialog(uint16 width, const char *line, int color) {
char **lines;
char *lineCopy = strdup(line);
uint8 numLines;
wordWrap(lineCopy, width - (Surface::textX() * 2), lines, numLines);
// Create the dialog
- Surface *result = newDialog(width, numLines, const_cast<const char **>(lines), true, colour);
+ Surface *result = newDialog(width, numLines, const_cast<const char **>(lines), true, color);
// Deallocate used resources
free(lines);
@@ -510,7 +510,7 @@ bool Surface::getString(Common::String &line, int maxSize, bool isNumeric, bool
Mouse &mouse = Mouse::getReference();
Events &events = Events::getReference();
Screen &screen = Screen::getReference();
- uint8 bgColour = *(screen.screen().data().data() + (y * FULL_SCREEN_WIDTH) + x);
+ uint8 bgColor = *(screen.screen().data().data() + (y * FULL_SCREEN_WIDTH) + x);
Common::String newLine(line);
bool abortFlag = false;
bool refreshFlag = false;
@@ -527,7 +527,7 @@ bool Surface::getString(Common::String &line, int maxSize, bool isNumeric, bool
while (!abortFlag) {
// Display the string
- screen.screen().writeString(x, y, newLine, true, DEFAULT_TEXT_COLOUR, varLength);
+ screen.screen().writeString(x, y, newLine, true, DEFAULT_TEXT_COLOR, varLength);
screen.update();
int stringSize = textWidth(newLine.c_str());
@@ -545,7 +545,7 @@ bool Surface::getString(Common::String &line, int maxSize, bool isNumeric, bool
if ((keycode == Common::KEYCODE_RETURN) || (keycode == Common::KEYCODE_KP_ENTER)) {
// Return character
screen.screen().fillRect(
- Common::Rect(x, y, x + maxSize - 1, y + FONT_HEIGHT), bgColour);
+ Common::Rect(x, y, x + maxSize - 1, y + FONT_HEIGHT), bgColor);
screen.update();
newLine.deleteLastChar();
line = newLine;
@@ -556,7 +556,7 @@ bool Surface::getString(Common::String &line, int maxSize, bool isNumeric, bool
else if (keycode == Common::KEYCODE_ESCAPE) {
// Escape character
screen.screen().fillRect(
- Common::Rect(x, y, x + maxSize - 1, y + FONT_HEIGHT), bgColour);
+ Common::Rect(x, y, x + maxSize - 1, y + FONT_HEIGHT), bgColor);
screen.update();
abortFlag = true;
} else if (keycode == Common::KEYCODE_BACKSPACE) {
@@ -564,14 +564,14 @@ bool Surface::getString(Common::String &line, int maxSize, bool isNumeric, bool
if (newLine.size() == 1) continue;
screen.screen().fillRect(
- Common::Rect(x, y, x + maxSize - 1, y + FONT_HEIGHT), bgColour);
+ Common::Rect(x, y, x + maxSize - 1, y + FONT_HEIGHT), bgColor);
newLine.deleteChar(newLine.size() - 2);
refreshFlag = true;
} else if ((ch >= ' ') && (stringSize + 8 < maxSize)) {
if (((ch >= '0') && (ch <= '9')) || !isNumeric) {
screen.screen().fillRect(
- Common::Rect(x, y, x + maxSize - 1, y + FONT_HEIGHT), bgColour);
+ Common::Rect(x, y, x + maxSize - 1, y + FONT_HEIGHT), bgColor);
newLine.insertChar(ch, newLine.size() - 1);
refreshFlag = true;
}
@@ -818,7 +818,7 @@ TalkDialog::TalkDialog(uint16 characterId, uint16 destCharacterId, uint16 active
// Write out the character name
uint16 charWidth = Surface::textWidth(srcCharName);
- byte white = LureEngine::getReference().isEGA() ? EGA_DIALOG_WHITE_COLOUR : VGA_DIALOG_WHITE_COLOUR;
+ byte white = LureEngine::getReference().isEGA() ? EGA_DIALOG_WHITE_COLOR : VGA_DIALOG_WHITE_COLOR;
_surface->writeString((TALK_DIALOG_WIDTH - charWidth) / 2, TALK_DIALOG_EDGE_SIZE + 2,
srcCharName, true, white);
debugC(ERROR_DETAILED, kLureDebugAnimations, "TalkDialog end");
@@ -903,14 +903,14 @@ TalkDialog *TalkDialog::loadFromStream(Common::ReadStream *stream) {
void SaveRestoreDialog::toggleHightlight(int xs, int xe, int ys, int ye) {
Screen &screen = Screen::getReference();
byte *addr = screen.screen().data().data() + FULL_SCREEN_WIDTH * ys + xs;
- const byte colourList[4] = {EGA_DIALOG_TEXT_COLOUR, EGA_DIALOG_WHITE_COLOUR,
- VGA_DIALOG_TEXT_COLOUR, VGA_DIALOG_WHITE_COLOUR};
- const byte *colours = LureEngine::getReference().isEGA() ? &colourList[0] : &colourList[2];
+ const byte colorList[4] = {EGA_DIALOG_TEXT_COLOR, EGA_DIALOG_WHITE_COLOR,
+ VGA_DIALOG_TEXT_COLOR, VGA_DIALOG_WHITE_COLOR};
+ const byte *colors = LureEngine::getReference().isEGA() ? &colorList[0] : &colorList[2];
for (int y = 0; y < ye - ys + 1; ++y, addr += FULL_SCREEN_WIDTH) {
for (int x = 0; x < xe - xs + 1; ++x) {
- if (addr[x] == colours[0]) addr[x] = colours[1];
- else if (addr[x] == colours[1]) addr[x] = colours[0];
+ if (addr[x] == colors[0]) addr[x] = colors[1];
+ else if (addr[x] == colors[1]) addr[x] = colors[0];
}
}
@@ -951,9 +951,9 @@ bool SaveRestoreDialog::show(bool saveDialog) {
// Create the outer dialog and dividing line
s->createDialog();
byte *pDest = s->data().data() + (s->width() * SR_SEPARATOR_Y) + SR_SEPARATOR_X;
- uint8 rowColours[5] = {*(pDest-2), *(pDest-1), *(pDest-1), *(pDest-2), *(pDest+1)};
+ uint8 rowColors[5] = {*(pDest-2), *(pDest-1), *(pDest-1), *(pDest-2), *(pDest+1)};
for (int y = 0; y < SR_SEPARATOR_HEIGHT; ++y, pDest += s->width())
- memset(pDest, rowColours[y], s->width() - 12);
+ memset(pDest, rowColors[y], s->width() - 12);
// Create title line
Common::String title(res.stringList().getString(
@@ -1248,7 +1248,7 @@ struct ItemDesc {
int16 x, y;
uint16 width, height;
uint16 animId;
- uint8 startColour;
+ uint8 startColor;
};
#define PROT_SPR_HEADER 0x1830
@@ -1286,7 +1286,7 @@ CopyProtectionDialog::CopyProtectionDialog() {
Hotspot *h = new Hotspot();
h->setPosition(ptr->x, ptr->y);
h->setSize(ptr->width, ptr->height);
- h->setColourOffset(ptr->startColour);
+ h->setColorOffset(ptr->startColor);
h->setAnimation(ptr->animId);
_hotspots.push_back(HotspotsList::value_type(h));
diff --git a/engines/lure/surface.h b/engines/lure/surface.h
index 8fd8ae49a6..9a677cf749 100644
--- a/engines/lure/surface.h
+++ b/engines/lure/surface.h
@@ -34,7 +34,7 @@
namespace Lure {
-#define DEFAULT_TEXT_COLOUR -1
+#define DEFAULT_TEXT_COLOR -1
class Surface {
private:
@@ -61,20 +61,20 @@ public:
void loadScreen(uint16 resourceId);
void loadScreen(MemoryBlock *data);
- int writeChar(uint16 x, uint16 y, uint8 ascii, bool transparent, int colour);
+ int writeChar(uint16 x, uint16 y, uint8 ascii, bool transparent, int color);
void writeString(uint16 x, uint16 y, Common::String line, bool transparent,
- int colour = DEFAULT_TEXT_COLOUR, bool varLength = true);
+ int color = DEFAULT_TEXT_COLOR, bool varLength = true);
void writeSubstring(uint16 x, uint16 y, Common::String line, int len,
- bool transparent, int colour = DEFAULT_TEXT_COLOUR, bool varLength = true);
+ bool transparent, int color = DEFAULT_TEXT_COLOR, bool varLength = true);
void transparentCopyTo(Surface *dest);
void copyTo(Surface *dest);
void copyTo(Surface *dest, uint16 x, uint16 y);
void copyTo(Surface *dest, const Common::Rect &srcBounds, uint16 destX, uint16 destY,
- int transparentColour = -1);
+ int transparentColor = -1);
void copyFrom(MemoryBlock *src) { _data->copyFrom(src); }
void copyFrom(MemoryBlock *src, uint32 destOffset);
void empty() { _data->empty(); }
- void fillRect(const Common::Rect &r, uint8 colour);
+ void fillRect(const Common::Rect &r, uint8 color);
void createDialog(bool blackFlag = false);
void copyToScreen(uint16 x, uint16 y);
void centerOnScreen();
@@ -82,8 +82,8 @@ public:
static uint16 textWidth(const char *s, int numChars = 0);
static void wordWrap(char *text, uint16 width, char **&lines, uint8 &numLines);
static Surface *newDialog(uint16 width, uint8 numLines, const char **lines, bool varLength = true,
- int colour = DEFAULT_TEXT_COLOUR, bool squashedLines = true);
- static Surface *newDialog(uint16 width, const char *lines, int colour = DEFAULT_TEXT_COLOUR);
+ int color = DEFAULT_TEXT_COLOR, bool squashedLines = true);
+ static Surface *newDialog(uint16 width, const char *lines, int color = DEFAULT_TEXT_COLOR);
static Surface *getScreen(uint16 resourceId);
bool getString(Common::String &line, int maxSize, bool isNumeric, bool varLength, int16 x, int16 y);
};
diff --git a/engines/m4/actor.cpp b/engines/m4/actor.cpp
index f342ca6b46..c61c6fe7d8 100644
--- a/engines/m4/actor.cpp
+++ b/engines/m4/actor.cpp
@@ -25,6 +25,7 @@
#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"
@@ -59,7 +60,7 @@ void Actor::placeWalkerSpriteAt(int spriteNum, int x, int y) {
info.height = info.sprite->height();
info.scaleX = info.scaleY = _scaling;
info.palette = _walkerSprites[_direction]->getPalette();
- info.inverseColourTable = _m4Vm->scene()->getInverseColourTable();
+ info.inverseColorTable = _m4Vm->scene()->getInverseColorTable();
_vm->_scene->drawSprite(x, y, info, Common::Rect(640, 400));
}
diff --git a/engines/m4/animation.cpp b/engines/m4/animation.cpp
index 37314eff44..3fe050e604 100644
--- a/engines/m4/animation.cpp
+++ b/engines/m4/animation.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/textconsole.h"
+
#include "m4/assets.h"
#include "m4/animation.h"
#include "m4/compression.h"
@@ -426,7 +428,7 @@ void MadsAnimation::update() {
// Start displaying the message
AnimMessage &me = _messages[idx];
- // The colour index to use is dependant on how many messages are currently on-screen
+ // The color index to use is dependant on how many messages are currently on-screen
uint8 colIndex;
switch (_messageCtr) {
case 1:
diff --git a/engines/m4/compression.cpp b/engines/m4/compression.cpp
index 9b1416945c..8fe4fbf1eb 100644
--- a/engines/m4/compression.cpp
+++ b/engines/m4/compression.cpp
@@ -27,6 +27,7 @@
#include "m4/m4.h"
#include "common/memstream.h"
+#include "common/textconsole.h"
namespace M4 {
diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp
index 88b4240901..cbcaa04669 100644
--- a/engines/m4/console.cpp
+++ b/engines/m4/console.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/textconsole.h"
+
#include "m4/m4.h"
#include "m4/console.h"
#include "m4/dialogs.h"
diff --git a/engines/m4/converse.cpp b/engines/m4/converse.cpp
index 2d1b8e7e4f..46c4b35b79 100644
--- a/engines/m4/converse.cpp
+++ b/engines/m4/converse.cpp
@@ -26,6 +26,7 @@
#include "common/array.h"
#include "common/hashmap.h"
#include "common/substream.h"
+#include "common/textconsole.h"
#include "m4/converse.h"
#include "m4/resource.h"
@@ -97,7 +98,7 @@ void ConversationView::setNode(int32 nodeIndex) {
_vm->_font->setFont(FONT_CONVERSATION);
// TODO: Conversation styles and colors
- _vm->_font->current()->setColours(2, 1, 3);
+ _vm->_font->current()->setColors(2, 1, 3);
_currentNodeIndex = nodeIndex;
@@ -164,7 +165,7 @@ void ConversationView::onRefresh(RectList *rects, M4Surface *destSurface) {
if (i > CONV_MAX_SHOWN_ENTRIES - 1)
break;
- _vm->_font->current()->setColour((_highlightedIndex == i) ? CONVERSATION_ENTRY_HIGHLIGHTED :
+ _vm->_font->current()->setColor((_highlightedIndex == i) ? CONVERSATION_ENTRY_HIGHLIGHTED :
CONVERSATION_ENTRY_NORMAL);
_vm->_font->current()->writeString(this, _activeItems[i]->text, CONV_ENTRIES_X_OFFSET,
diff --git a/engines/m4/detection.cpp b/engines/m4/detection.cpp
index 4b204996f3..e0983e3327 100644
--- a/engines/m4/detection.cpp
+++ b/engines/m4/detection.cpp
@@ -44,11 +44,11 @@ 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", "Riddle of Master Lu: Believe it or Not!"},
+ {"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"},
@@ -380,7 +380,12 @@ static const M4GameDescription gameDescriptions[] = {
{ AD_TABLE_END_MARKER, 0, 0 }
};
-}
+} // End of namespace M4
+
+static const char *directoryGlobs[] = {
+ "option1",
+ 0
+};
static const ADParams detectionParams = {
// Pointer to ADGameDescription or its superset structure
@@ -402,9 +407,9 @@ static const ADParams detectionParams = {
// Additional GUI options (for every game}
Common::GUIO_NOMIDI,
// Maximum directory depth
- 1,
+ 2,
// List of directory globs
- 0
+ directoryGlobs
};
class M4MetaEngine : public AdvancedMetaEngine {
diff --git a/engines/m4/dialogs.cpp b/engines/m4/dialogs.cpp
index da828ccf5b..bc6228658d 100644
--- a/engines/m4/dialogs.cpp
+++ b/engines/m4/dialogs.cpp
@@ -25,6 +25,7 @@
#include "m4/dialogs.h"
#include "common/file.h"
+#include "common/textconsole.h"
namespace M4 {
@@ -444,7 +445,7 @@ void Dialog::draw() {
int dialogY = (_vm->_screen->height() - dlgHeight) / 2;
// Create the surface for the dialog
- create(dlgWidth, dlgHeight, 1);
+ create(dlgWidth, dlgHeight, Graphics::PixelFormat::createFormatCLUT8());
_coords.left = dialogX;
_coords.top = dialogY;
_coords.right = dialogX + dlgWidth + 1;
@@ -452,7 +453,7 @@ void Dialog::draw() {
// Set up the dialog
fillRect(Common::Rect(0, 0, width(), height()), 3);
- setColour(2);
+ setColor(2);
hLine(1, width() - 1, height() - 2); // Bottom edge
hLine(0, width(), height() - 1);
vLine(width() - 2, 2, height()); // Right edge
@@ -480,8 +481,8 @@ void Dialog::draw() {
}
// Handle drawing the text contents
- _vm->_font->current()->setColours(7, 7, 7);
- setColour(7);
+ _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) {
diff --git a/engines/m4/events.cpp b/engines/m4/events.cpp
index 29b243aceb..a9641eb542 100644
--- a/engines/m4/events.cpp
+++ b/engines/m4/events.cpp
@@ -257,7 +257,7 @@ bool Mouse::setCursorNum(int cursorIndex) {
// Set the cursor to the sprite
CursorMan.replaceCursor((const byte *)_cursor->getBasePtr(), _cursor->width(), _cursor->height(),
- _cursor->xOffset, _cursor->yOffset, TRANSPARENT_COLOUR_INDEX);
+ _cursor->xOffset, _cursor->yOffset, TRANSPARENT_COLOR_INDEX);
return true;
}
diff --git a/engines/m4/font.cpp b/engines/m4/font.cpp
index 3ed419675d..582fbaebc7 100644
--- a/engines/m4/font.cpp
+++ b/engines/m4/font.cpp
@@ -159,14 +159,14 @@ Font::~Font() {
}
}
-void Font::setColour(uint8 colour) {
+void Font::setColor(uint8 color) {
if (_sysFont)
- _fontColors[1] = colour;
+ _fontColors[1] = color;
else
- _fontColors[3] = colour;
+ _fontColors[3] = color;
}
-void Font::setColours(uint8 col1, uint8 col2, uint8 col3) {
+void Font::setColors(uint8 col1, uint8 col2, uint8 col3) {
if (_sysFont)
_fontColors[1] = col3;
else {
diff --git a/engines/m4/font.h b/engines/m4/font.h
index 19d15faa1e..64e54f35b5 100644
--- a/engines/m4/font.h
+++ b/engines/m4/font.h
@@ -62,8 +62,8 @@ public:
Font(MadsM4Engine *vm, const char *filename);
~Font();
- void setColour(uint8 colour);
- void setColours(uint8 col1, uint8 col2, uint8 col3);
+ 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; }
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index d982ecad0e..3db9934cec 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/textconsole.h"
+
#include "m4/m4.h"
#include "m4/globals.h"
#include "m4/graphics.h"
diff --git a/engines/m4/graphics.cpp b/engines/m4/graphics.cpp
index 5fc46d3881..689a6ab8b4 100644
--- a/engines/m4/graphics.cpp
+++ b/engines/m4/graphics.cpp
@@ -23,11 +23,12 @@
*
*/
-#include "common/file.h"
-#include "common/endian.h"
#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"
@@ -96,7 +97,7 @@ void M4Surface::loadCodesM4(Common::SeekableReadStream *source) {
uint16 widthVal = source->readUint16LE();
uint16 heightVal = source->readUint16LE();
- create(widthVal, heightVal, 1);
+ create(widthVal, heightVal, Graphics::PixelFormat::createFormatCLUT8());
source->read(pixels, widthVal * heightVal);
}
@@ -110,7 +111,7 @@ void M4Surface::loadCodesMads(Common::SeekableReadStream *source) {
uint16 heightVal = 156;
byte *walkMap = new byte[source->size()];
- create(widthVal, heightVal, 1);
+ create(widthVal, heightVal, Graphics::PixelFormat::createFormatCLUT8());
source->read(walkMap, source->size());
byte *ptr = (byte *)getBasePtr(0, 0);
@@ -300,7 +301,7 @@ void M4Surface::drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &c
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.inverseColourTable[(b << 10) | (g << 5) | r];
+ pixel = info.inverseColorTable[(b << 10) | (g << 5) | r];
}
}
@@ -361,7 +362,7 @@ void M4Surface::fillRect(const Common::Rect &r, uint8 color) {
}
void M4Surface::copyFrom(M4Surface *src, const Common::Rect &srcBounds, int destX, int destY,
- int transparentColour) {
+ int transparentColor) {
// Validation of the rectangle and position
if ((destX >= w) || (destY >= h))
return;
@@ -390,13 +391,13 @@ void M4Surface::copyFrom(M4Surface *src, const Common::Rect &srcBounds, int dest
byte *destPtr = (byte *)pixels + (destY * width()) + destX;
for (int rowCtr = 0; rowCtr < copyRect.height(); ++rowCtr) {
- if (transparentColour == -1)
+ 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] != transparentColour) destPtr[xCtr] = srcPtr[xCtr];
+ if (srcPtr[xCtr] != transparentColor) destPtr[xCtr] = srcPtr[xCtr];
}
srcPtr += src->width();
@@ -411,7 +412,7 @@ void M4Surface::copyFrom(M4Surface *src, const Common::Rect &srcBounds, int dest
* 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 transparentColour) {
+ M4Surface *depthsSurface, int scale, int transparentColor) {
if (scale == 100) {
// Copy the specified area
@@ -443,7 +444,7 @@ void M4Surface::copyFrom(M4Surface *src, int destX, int destY, int depth,
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] != transparentColour))
+ if ((depth <= (depthsPtr[xCtr] & 0x7f)) && (srcPtr[xCtr] != transparentColor))
destPtr[xCtr] = srcPtr[xCtr];
}
@@ -557,7 +558,7 @@ void M4Surface::copyFrom(M4Surface *src, int destX, int destY, int depth,
// Not a display pixel
continue;
- if ((*srcP != transparentColour) && (depth <= (*depthP & 0x7f)))
+ if ((*srcP != transparentColor) && (depth <= (*depthP & 0x7f)))
*destP = *srcP;
++destP;
@@ -760,7 +761,7 @@ void M4Surface::rexLoadBackground(Common::SeekableReadStream *source, RGBList **
sourceUnc = packData.getItemStream(1);
assert((int)sourceUnc->size() >= sceneSize);
- create(sceneWidth, sceneHeight, 1);
+ create(sceneWidth, sceneHeight, Graphics::PixelFormat::createFormatCLUT8());
byte *pData = (byte *)pixels;
sourceUnc->read(pData, sceneSize);
@@ -813,7 +814,7 @@ void M4Surface::m4LoadBackground(Common::SeekableReadStream *source) {
assert(width() == (int)widthVal);
//debugCN(kDebugGraphics, "width(): %d, widthVal: %d, height(): %d, heightVal: %d\n", width(), widthVal, height(), heightVal);
- tileBuffer->create(tileWidth, tileHeight, 1);
+ tileBuffer->create(tileWidth, tileHeight, Graphics::PixelFormat::createFormatCLUT8());
for (curTileY = 0; curTileY < tilesY; curTileY++) {
clipY = MIN(heightVal, (1 + curTileY) * tileHeight) - (curTileY * tileHeight);
@@ -854,7 +855,7 @@ void M4Surface::madsLoadInterface(const Common::String &filename) {
// Chunk 1, data
intStream = intFile.getItemStream(1);
- create(320, 44, 1);
+ create(320, 44, Graphics::PixelFormat::createFormatCLUT8());
intStream->read(pixels, 320 * 44);
delete intStream;
@@ -933,7 +934,7 @@ void M4Surface::translate(RGBList *list, bool isTransparent) {
byte *palIndexes = list->palIndexes();
for (int i = 0; i < width() * height(); ++i, ++p) {
- if (!isTransparent || (*p != TRANSPARENT_COLOUR_INDEX)) {
+ if (!isTransparent || (*p != TRANSPARENT_COLOR_INDEX)) {
if (*p < list->size())
*p = palIndexes[*p];
else
diff --git a/engines/m4/graphics.h b/engines/m4/graphics.h
index d58ed69403..96e81f746e 100644
--- a/engines/m4/graphics.h
+++ b/engines/m4/graphics.h
@@ -40,7 +40,7 @@ namespace M4 {
#define MADS_SCREEN_HEIGHT 200
#define MADS_Y_OFFSET ((MADS_SCREEN_HEIGHT - MADS_SURFACE_HEIGHT) / 2)
-#define TRANSPARENT_COLOUR_INDEX 0xFF
+#define TRANSPARENT_COLOR_INDEX 0xFF
struct BGR8 {
uint8 b, g, r;
@@ -89,7 +89,7 @@ struct SpriteInfo {
int width, height;
int scaleX, scaleY;
uint8 encoding;
- byte *inverseColourTable;
+ byte *inverseColorTable;
RGB8 *palette;
};
@@ -105,19 +105,19 @@ private:
void m4LoadBackground(Common::SeekableReadStream *source);
public:
M4Surface(bool isScreen = false) {
- create(g_system->getWidth(), isScreen ? g_system->getHeight() : MADS_SURFACE_HEIGHT, 1);
+ 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_, 1);
+ create(width_, height_, Graphics::PixelFormat::createFormatCLUT8());
_isScreen = false;
_rgbList = NULL;
_ownsData = true;
}
M4Surface(int width_, int height_, byte *srcPixels, int pitch_) {
- bytesPerPixel = 1;
+ format = Graphics::PixelFormat::createFormatCLUT8();
w = width_;
h = height_;
pitch = pitch_;
@@ -141,7 +141,6 @@ public:
void madsLoadInterface(const Common::String &filename);
void setColor(byte value) { _color = value; }
- void setColour(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);
@@ -158,7 +157,7 @@ public:
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, 1); }
+ void setSize(int sizeX, int sizeY) { create(sizeX, sizeY, Graphics::PixelFormat::createFormatCLUT8()); }
inline byte *getBasePtr() {
return (byte *)pixels;
}
@@ -173,9 +172,9 @@ public:
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 transparentColour = -1);
+ 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 transparentColour = -1);
+ int scale, int transparentColor = -1);
void update() {
if (_isScreen) {
@@ -185,19 +184,19 @@ public:
}
// copyTo methods
- inline void copyTo(M4Surface *dest, int transparentColour = -1) {
- dest->copyFrom(this, Common::Rect(width(), height()), 0, 0, transparentColour);
+ 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 transparentColour = -1) {
- dest->copyFrom(this, Common::Rect(width(), height()), x, y, transparentColour);
+ 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 transparentColour = -1) {
- dest->copyFrom(this, srcBounds, destX, destY, transparentColour);
+ 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 transparentColour = -1) {
- dest->copyFrom(this, destX, destY, depth, depthsSurface, scale, transparentColour);
+ int transparentColor = -1) {
+ dest->copyFrom(this, destX, destY, depth, depthsSurface, scale, transparentColor);
}
void scrollX(int xAmount);
diff --git a/engines/m4/gui.cpp b/engines/m4/gui.cpp
index 8665b4e767..56cf96b589 100644
--- a/engines/m4/gui.cpp
+++ b/engines/m4/gui.cpp
@@ -25,6 +25,7 @@
#include "common/events.h"
#include "common/keyboard.h"
+#include "common/textconsole.h"
#include "m4/globals.h"
#include "m4/events.h"
@@ -290,26 +291,26 @@ void MenuButton::onRefresh() {
case OBJTYPE_SL_TEXT:
switch (_objectState) {
case OS_MOUSEOVER:
- _vm->_font->current()->setColours(TEXT_COLOR_MOUSEOVER_SHADOW, TEXT_COLOR_MOUSEOVER_FOREGROUND,
+ _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()->setColours(TEXT_COLOR_PRESSED_SHADOW, TEXT_COLOR_PRESSED_FOREGROUND,
+ _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()->setColours(TEXT_COLOR_GREYED_SHADOW, TEXT_COLOR_GREYED_FOREGROUND,
+ _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()->setColours(TEXT_COLOR_NORMAL_SHADOW, TEXT_COLOR_NORMAL_FOREGROUND,
+ _vm->_font->current()->setColors(TEXT_COLOR_NORMAL_SHADOW, TEXT_COLOR_NORMAL_FOREGROUND,
TEXT_COLOR_NORMAL_HILIGHT);
sprite = sprites[SL_LINE_NORMAL];
break;
@@ -955,7 +956,7 @@ void MenuTextField::onRefresh() {
// Draw the text
_vm->_font->setFont(FONT_MENU);
- _vm->_font->current()->setColours(TEXT_COLOR_NORMAL_SHADOW, TEXT_COLOR_NORMAL_FOREGROUND,
+ _vm->_font->current()->setColors(TEXT_COLOR_NORMAL_SHADOW, TEXT_COLOR_NORMAL_FOREGROUND,
TEXT_COLOR_NORMAL_HILIGHT);
int xp = _bounds.left + 4;
@@ -1140,7 +1141,7 @@ GUITextField::GUITextField(View *owner, const Common::Rect &bounds): GUIRect(own
void GUITextField::onRefresh() {
_parent->fillRect(_bounds, _vm->_palette->BLACK);
- _vm->_font->current()->setColours(3, 3, 3);
+ _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);
}
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 4cc2bf8783..e88140cd26 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -30,7 +30,6 @@
#include "m4/burger_data.h"
#include "m4/m4.h"
#include "m4/resource.h"
-#include "m4/sprite.h"
#include "m4/hotspot.h"
#include "m4/font.h"
#include "m4/rails.h"
@@ -50,17 +49,15 @@
#include "m4/mads_anim.h"
#include "m4/mads_menus.h"
+#include "common/error.h"
#include "common/file.h"
#include "common/fs.h"
-#include "common/events.h"
#include "common/EventRecorder.h"
-#include "common/endian.h"
#include "common/system.h"
#include "common/config-manager.h"
#include "common/debug-channels.h"
+#include "common/textconsole.h"
#include "engines/util.h"
-#include "graphics/surface.h"
-#include "audio/mididrv.h"
namespace M4 {
@@ -118,6 +115,7 @@ MadsM4Engine::MadsM4Engine(OSystem *syst, const M4GameDescription *gameDesc) :
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");
@@ -416,7 +414,7 @@ Common::Error M4Engine::run() {
_scene->loadScene(_kernel->currentRoom);
_ws->setBackgroundSurface(_scene->getBackgroundSurface());
- _ws->setInverseColourTable(scene()->getInverseColourTable());
+ _ws->setInverseColorTable(scene()->getInverseColorTable());
_kernel->loadSectionScriptFunctions();
_kernel->loadRoomScriptFunctions();
@@ -554,7 +552,7 @@ Common::Error MadsEngine::run() {
_scene->show();
_font->setFont(FONT_MAIN_MADS);
- _font->current()->setColours(2, 1, 3);
+ _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);
diff --git a/engines/m4/m4_menus.cpp b/engines/m4/m4_menus.cpp
index 118b09f50b..a20bb2660b 100644
--- a/engines/m4/m4_menus.cpp
+++ b/engines/m4/m4_menus.cpp
@@ -24,6 +24,7 @@
*/
#include "common/algorithm.h" // for find()
+#include "common/textconsole.h"
#include "gui/dialog.h"
#include "gui/message.h"
diff --git a/engines/m4/m4_scene.cpp b/engines/m4/m4_scene.cpp
index 738f414add..a0d8a503ab 100644
--- a/engines/m4/m4_scene.cpp
+++ b/engines/m4/m4_scene.cpp
@@ -24,6 +24,7 @@
*/
#include "common/system.h"
+#include "common/textconsole.h"
#include "m4/m4_scene.h"
#include "m4/dialogs.h"
@@ -41,7 +42,7 @@ namespace M4 {
M4Scene::M4Scene(M4Engine *vm): _sceneResources(), Scene(vm, &_sceneResources) {
_vm = vm;
_sceneSprites = NULL;
- _inverseColourTable = NULL;
+ _inverseColorTable = NULL;
_sceneResources.hotspots = new HotSpotList();
_sceneResources.parallax = new HotSpotList();
@@ -110,15 +111,15 @@ void M4Scene::loadSceneResources(int sceneNumber) {
}
}
-void M4Scene::loadSceneInverseColourTable(int sceneNumber) {
+void M4Scene::loadSceneInverseColorTable(int sceneNumber) {
char filename[kM4MaxFilenameSize];
Common::SeekableReadStream *iplS;
sprintf(filename, "%i.ipl", sceneNumber);
iplS = _vm->res()->openFile(filename);
- delete[] _inverseColourTable;
- _inverseColourTable = new byte[iplS->size()];
- iplS->read(_inverseColourTable, iplS->size());
+ delete[] _inverseColorTable;
+ _inverseColorTable = new byte[iplS->size()];
+ iplS->read(_inverseColorTable, iplS->size());
_vm->res()->toss(filename);
}
@@ -163,7 +164,7 @@ void M4Scene::loadScene(int sceneNumber) {
loadSceneCodes(sceneNumber);
// Load inverse color table file (*.IPL)
- loadSceneInverseColourTable(sceneNumber);
+ loadSceneInverseColorTable(sceneNumber);
if (_vm->getGameType() != GType_Burger) {
// Load scene sprites file (*.SSB)
@@ -202,7 +203,7 @@ void M4Scene::leaveScene() {
_sceneResources.parallax->clear();
delete _sceneResources.parallax;
- delete[] _inverseColourTable;
+ delete[] _inverseColorTable;
Scene::leaveScene();
}
diff --git a/engines/m4/m4_scene.h b/engines/m4/m4_scene.h
index 2216779a3e..9c2edbc06c 100644
--- a/engines/m4/m4_scene.h
+++ b/engines/m4/m4_scene.h
@@ -53,11 +53,11 @@ private:
M4SceneResources _sceneResources;
SpriteAsset *_sceneSprites;
SpriteAsset *_walkerSprite;
- byte *_inverseColourTable;
+ byte *_inverseColorTable;
void loadSceneSprites(int sceneNumber);
void loadSceneResources(int sceneNumber);
- void loadSceneInverseColourTable(int sceneNumber);
+ void loadSceneInverseColorTable(int sceneNumber);
void loadSceneSpriteCodes(int sceneNumber);
void nextCommonCursor();
public:
@@ -75,7 +75,7 @@ public:
virtual void update();
virtual void showHotSpots();
- byte *getInverseColourTable() const { return _inverseColourTable; }
+ byte *getInverseColorTable() const { return _inverseColorTable; }
M4InterfaceView *getInterface() { return (M4InterfaceView *)_interfaceSurface; }
M4SceneResources &getSceneResources() { return _sceneResources; }
void setStatusText(const char *text);
diff --git a/engines/m4/m4_views.cpp b/engines/m4/m4_views.cpp
index f4345787df..83f23edd3d 100644
--- a/engines/m4/m4_views.cpp
+++ b/engines/m4/m4_views.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/textconsole.h"
+
#include "m4/m4_views.h"
#include "m4/events.h"
#include "m4/font.h"
diff --git a/engines/m4/mads_anim.cpp b/engines/m4/mads_anim.cpp
index 1d15cbbaf7..e7ca9cb14d 100644
--- a/engines/m4/mads_anim.cpp
+++ b/engines/m4/mads_anim.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/textconsole.h"
+
#include "m4/mads_anim.h"
#include "m4/m4.h"
#include "m4/compression.h"
@@ -60,7 +62,7 @@ TextviewView::TextviewView(MadsM4Engine *vm):
_vm->_palette->setPalette(&palData[0], 4, 3);
_vm->_palette->blockRange(4, 3);
- _vm->_font->current()->setColours(5, 6, 4);
+ _vm->_font->current()->setColors(5, 6, 4);
clear();
_bgSurface.clear();
diff --git a/engines/m4/mads_logic.cpp b/engines/m4/mads_logic.cpp
index 878e86c573..98a0d06412 100644
--- a/engines/m4/mads_logic.cpp
+++ b/engines/m4/mads_logic.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/textconsole.h"
+
#include "m4/m4.h"
#include "m4/dialogs.h"
#include "m4/mads_logic.h"
diff --git a/engines/m4/mads_menus.cpp b/engines/m4/mads_menus.cpp
index 91db7d343a..437e9d2a6b 100644
--- a/engines/m4/mads_menus.cpp
+++ b/engines/m4/mads_menus.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/textconsole.h"
+
#include "m4/mads_menus.h"
#include "m4/m4.h"
@@ -695,11 +697,11 @@ void RexDialogView::updateState() {
void RexDialogView::onRefresh(RectList *rects, M4Surface *destSurface) {
// Draw the framed base area
fillRect(this->bounds(), _madsVm->_palette->BLACK);
- setColour(2);
+ 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 centred
+ // 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
@@ -943,20 +945,20 @@ void RexDialogView::refreshText() {
if (!_dialogText[i].in_use)
continue;
- // Get the item's colours
- uint colour;
+ // Get the item's colors
+ uint color;
if (_dialogText[i].state == STATE_DESELECTED)
- colour = 0xB0A;
+ color = 0xB0A;
else if (_dialogText[i].state == STATE_SELECTED)
- colour = 0xD0C;
+ color = 0xD0C;
else
- colour = 0xF0E;
+ color = 0xF0E;
- // If there's an associated text display entry, check to see if it's colour needs to change
+ // 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.colour1 == (colour & 0xff)) && (tdEntry.colour2 == (colour >> 8)))
+ if ((tdEntry.color1 == (color & 0xff)) && (tdEntry.color2 == (color >> 8)))
// It's still the same, so no further action needed
continue;
@@ -967,7 +969,7 @@ void RexDialogView::refreshText() {
// 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,
- colour, _dialogText[i].widthAdjust, _dialogText[i].text, _dialogText[i].font);
+ color, _dialogText[i].widthAdjust, _dialogText[i].text, _dialogText[i].font);
}
}
diff --git a/engines/m4/mads_scene.cpp b/engines/m4/mads_scene.cpp
index fd8a609b53..7b82480ee2 100644
--- a/engines/m4/mads_scene.cpp
+++ b/engines/m4/mads_scene.cpp
@@ -24,6 +24,7 @@
*/
#include "common/system.h"
+#include "common/textconsole.h"
#include "m4/mads_scene.h"
#include "m4/dialogs.h"
@@ -855,13 +856,13 @@ MadsInterfaceView::~MadsInterfaceView() {
void MadsInterfaceView::setFontMode(InterfaceFontMode newMode) {
switch (newMode) {
case ITEM_NORMAL:
- _vm->_font->current()->setColours(4, 4, 0xff);
+ _vm->_font->current()->setColors(4, 4, 0xff);
break;
case ITEM_HIGHLIGHTED:
- _vm->_font->current()->setColours(5, 5, 0xff);
+ _vm->_font->current()->setColors(5, 5, 0xff);
break;
case ITEM_SELECTED:
- _vm->_font->current()->setColours(6, 6, 0xff);
+ _vm->_font->current()->setColors(6, 6, 0xff);
break;
}
}
@@ -939,7 +940,7 @@ void MadsInterfaceView::onRefresh(RectList *rects, M4Surface *destSurface) {
int actionIndex = 0;
for (int x = 0; x < 2; ++x) {
for (int y = 0; y < 5; ++y, ++actionIndex) {
- // Determine the font colour depending on whether an item is selected. Note that the first action,
+ // 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));
@@ -994,7 +995,7 @@ void MadsInterfaceView::onRefresh(RectList *rects, M4Surface *destSurface) {
// 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_COLOUR_INDEX);
+ 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
diff --git a/engines/m4/mads_views.cpp b/engines/m4/mads_views.cpp
index cc127032eb..33c679c9bd 100644
--- a/engines/m4/mads_views.cpp
+++ b/engines/m4/mads_views.cpp
@@ -34,6 +34,7 @@
#include "m4/staticres.h"
#include "common/algorithm.h"
+#include "common/textconsole.h"
namespace M4 {
@@ -244,10 +245,10 @@ void MadsAction::refresh() {
}
// Add a new text display entry to display the status text at the bottom of the screen area
- uint colours = (_vm->getGameType() == GType_DragonSphere) ? 0x0300 : 0x0003;
+ uint colors = (_vm->getGameType() == GType_DragonSphere) ? 0x0300 : 0x0003;
_statusTextIndex = _owner._textDisplay.add(160 - (strWidth / 2),
- MADS_SURFACE_HEIGHT + _owner._posAdjust.y - 13, colours, textSpacing, _statusText, font);
+ MADS_SURFACE_HEIGHT + _owner._posAdjust.y - 13, colors, textSpacing, _statusText, font);
}
}
@@ -616,7 +617,7 @@ void MadsTextDisplay::clear() {
_entries[i].active = false;
}
-int MadsTextDisplay::add(int xp, int yp, uint fontColour, int charSpacing, const char *msg, Font *font) {
+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) {
@@ -629,8 +630,8 @@ int MadsTextDisplay::add(int xp, int yp, uint fontColour, int charSpacing, const
_entries[idx].msg = msg;
_entries[idx].bounds.setWidth(font->getWidth(msg, charSpacing));
_entries[idx].bounds.setHeight(font->getHeight());
- _entries[idx].colour1 = fontColour & 0xff;
- _entries[idx].colour2 = fontColour >> 8;
+ _entries[idx].color1 = fontColor & 0xff;
+ _entries[idx].color2 = fontColor >> 8;
_entries[idx].spacing = charSpacing;
_entries[idx].expire = 1;
_entries[idx].active = true;
@@ -666,7 +667,7 @@ void MadsTextDisplay::setDirtyAreas2() {
void MadsTextDisplay::draw(M4Surface *view) {
for (uint idx = 0; idx < _entries.size(); ++idx) {
if (_entries[idx].active && (_entries[idx].expire >= 0)) {
- _entries[idx].font->setColours(_entries[idx].colour1, _entries[idx].colour2, 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);
@@ -707,7 +708,7 @@ void MadsKernelMessageList::clear() {
_talkFont = _vm->_font->getFont(FONT_CONVERSATION_MADS);
}
-int MadsKernelMessageList::add(const Common::Point &pt, uint fontColour, uint8 flags, uint8 abortTimers, uint32 timeout, const char *msg) {
+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))
@@ -722,8 +723,8 @@ int MadsKernelMessageList::add(const Common::Point &pt, uint fontColour, uint8 f
MadsKernelMessageEntry &rec = _entries[idx];
strcpy(rec.msg, msg);
rec.flags = flags | KMSG_ACTIVE;
- rec.colour1 = fontColour & 0xff;
- rec.colour2 = fontColour >> 8;
+ rec.color1 = fontColor & 0xff;
+ rec.color2 = fontColor >> 8;
rec.position = pt;
rec.textDisplayIndex = -1;
rec.timeout = timeout;
@@ -918,7 +919,7 @@ void MadsKernelMessageList::processText(int msgIndex) {
if (msg.textDisplayIndex < 0) {
// Need to create a new text display entry for this message
- int idx = _owner._textDisplay.add(x1, y1, msg.colour1 | (msg.colour2 << 8), _owner._textSpacing, msg.msg, _talkFont);
+ int idx = _owner._textDisplay.add(x1, y1, msg.color1 | (msg.color2 << 8), _owner._textSpacing, msg.msg, _talkFont);
if (idx >= 0)
msg.textDisplayIndex = idx;
}
diff --git a/engines/m4/mads_views.h b/engines/m4/mads_views.h
index c93d0beda3..ce5ba9c4e5 100644
--- a/engines/m4/mads_views.h
+++ b/engines/m4/mads_views.h
@@ -174,8 +174,8 @@ public:
int expire;
int spacing;
Common::Rect bounds;
- uint8 colour1;
- uint8 colour2;
+ uint8 color1;
+ uint8 color2;
Font *font;
const char *msg;
@@ -201,7 +201,7 @@ public:
_entries[idx].expire = -1;
}
- int add(int xp, int yp, uint fontColour, int charSpacing, const char *msg, Font *font);
+ int add(int xp, int yp, uint fontColor, int charSpacing, const char *msg, Font *font);
void clear();
void draw(M4Surface *view);
void setDirtyAreas();
@@ -221,8 +221,8 @@ public:
int sequenceIndex;
char asciiChar;
char asciiChar2;
- int colour1;
- int colour2;
+ int color1;
+ int color2;
Common::Point position;
int textDisplayIndex;
int msgOffset;
@@ -251,7 +251,7 @@ public:
MadsKernelMessageList(MadsView &owner);
void clear();
- int add(const Common::Point &pt, uint fontColour, uint8 flags, uint8 abortTimers, uint32 timeout, const char *msg);
+ 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);
diff --git a/engines/m4/midi.cpp b/engines/m4/midi.cpp
index e49dbfa2e7..24ac60c22e 100644
--- a/engines/m4/midi.cpp
+++ b/engines/m4/midi.cpp
@@ -31,6 +31,7 @@
#include "audio/midiparser.h"
#include "common/config-manager.h"
#include "common/memstream.h"
+#include "common/textconsole.h"
namespace M4 {
diff --git a/engines/m4/resource.cpp b/engines/m4/resource.cpp
index 192cab0c83..1946797f75 100644
--- a/engines/m4/resource.cpp
+++ b/engines/m4/resource.cpp
@@ -28,6 +28,7 @@
#include "m4/events.h"
#include "common/substream.h"
+#include "common/textconsole.h"
namespace M4 {
diff --git a/engines/m4/scene.cpp b/engines/m4/scene.cpp
index 0f684ebced..c0cbd879b2 100644
--- a/engines/m4/scene.cpp
+++ b/engines/m4/scene.cpp
@@ -163,7 +163,7 @@ void Scene::showCodes() {
// Show all the scene's walk nodes
SceneNodeList &nodeList = _madsVm->scene()->getSceneResources()._nodes;
- _backgroundSurface->setColour(_madsVm->_palette->WHITE);
+ _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);
diff --git a/engines/m4/script.cpp b/engines/m4/script.cpp
index 42d55c6dc7..cc60ec310d 100644
--- a/engines/m4/script.cpp
+++ b/engines/m4/script.cpp
@@ -24,6 +24,7 @@
*/
#include "common/system.h"
+#include "common/textconsole.h"
#include "m4/m4.h"
#include "m4/script.h"
diff --git a/engines/m4/sound.cpp b/engines/m4/sound.cpp
index 14c60c1c58..fb90cea5cc 100644
--- a/engines/m4/sound.cpp
+++ b/engines/m4/sound.cpp
@@ -28,6 +28,7 @@
#include "m4/compression.h"
#include "common/stream.h"
+#include "common/textconsole.h"
#include "audio/audiostream.h"
#include "audio/mixer.h"
diff --git a/engines/m4/sprite.cpp b/engines/m4/sprite.cpp
index 641b93baea..cef9917381 100644
--- a/engines/m4/sprite.cpp
+++ b/engines/m4/sprite.cpp
@@ -24,6 +24,7 @@
*/
#include "common/rect.h"
+#include "common/textconsole.h"
#include "m4/globals.h"
#include "m4/graphics.h"
@@ -124,7 +125,7 @@ void M4Sprite::loadMadsSprite(Common::SeekableReadStream* source) {
bool spriteEnd = false;
// Set entire sprite contents to transparent pixels
- fillRect(bounds(), TRANSPARENT_COLOUR_INDEX);
+ fillRect(bounds(), TRANSPARENT_COLOR_INDEX);
// Major line loop
for (int yp = 0; yp < h; ++yp) {
@@ -153,7 +154,7 @@ void M4Sprite::loadMadsSprite(Common::SeekableReadStream* source) {
byte v = source->readByte();
while (cmd-- > 0) {
if (x2 < w)
- *destP++ = (v == 0xFD) ? TRANSPARENT_COLOUR_INDEX : v;
+ *destP++ = (v == 0xFD) ? TRANSPARENT_COLOR_INDEX : v;
++x2;
}
}
@@ -173,13 +174,13 @@ void M4Sprite::loadMadsSprite(Common::SeekableReadStream* source) {
byte v = source->readByte();
while (cmd-- > 0) {
if (x2 < w) {
- *destP++ = (v == 0xFD) ? TRANSPARENT_COLOUR_INDEX : v;
+ *destP++ = (v == 0xFD) ? TRANSPARENT_COLOR_INDEX : v;
}
++x2;
}
} else {
// Handle writing out single pixel
- *destP++ = (cmd == 0xFD) ? TRANSPARENT_COLOUR_INDEX : cmd;
+ *destP++ = (cmd == 0xFD) ? TRANSPARENT_COLOR_INDEX : cmd;
++x2;
}
}
@@ -203,7 +204,7 @@ void M4Sprite::loadMadsSprite(Common::SeekableReadStream* source) {
}
byte M4Sprite::getTransparencyIndex() const {
- return TRANSPARENT_COLOUR_INDEX;
+ return TRANSPARENT_COLOR_INDEX;
}
} // End of namespace M4
diff --git a/engines/m4/woodscript.cpp b/engines/m4/woodscript.cpp
index 1b9d9859ef..dc24548f84 100644
--- a/engines/m4/woodscript.cpp
+++ b/engines/m4/woodscript.cpp
@@ -26,6 +26,7 @@
#include "m4/woodscript.h"
#include "common/memstream.h"
+#include "graphics/palette.h"
namespace M4 {
diff --git a/engines/m4/woodscript.h b/engines/m4/woodscript.h
index 4b0f457193..a9a884a4b0 100644
--- a/engines/m4/woodscript.h
+++ b/engines/m4/woodscript.h
@@ -319,8 +319,8 @@ public:
RGB8 *getMainPalette() const;
- void setInverseColourTable(byte *inverseColourTable) { _inverseColourTable = inverseColourTable; }
- byte *getInverseColourTable() const { return _inverseColourTable; }
+ void setInverseColorTable(byte *inverseColorTable) { _inverseColorTable = inverseColorTable; }
+ byte *getInverseColorTable() const { return _inverseColorTable; }
protected:
MadsM4Engine *_vm;
@@ -338,7 +338,7 @@ protected:
/* Misc */
int16 *_depthTable;
- byte *_inverseColourTable;
+ byte *_inverseColorTable;
M4Surface *_backgroundSurface;
View *_surfaceView;
diff --git a/engines/m4/ws_sequence.cpp b/engines/m4/ws_sequence.cpp
index bb6230d041..3ee496da0d 100644
--- a/engines/m4/ws_sequence.cpp
+++ b/engines/m4/ws_sequence.cpp
@@ -291,7 +291,7 @@ void Sequence::draw(M4Surface *surface, const Common::Rect &clipRect, Common::Re
info.hotX = _curFrame->xOffset;
info.hotY = _curFrame->yOffset;
info.encoding = _curFrame->encoding;
- info.inverseColourTable = _m4Vm->scene()->getInverseColourTable();
+ info.inverseColorTable = _m4Vm->scene()->getInverseColorTable();
info.palette = _ws->getMainPalette();
info.width = _curFrame->width();
info.height = _curFrame->height();
diff --git a/engines/made/database.cpp b/engines/made/database.cpp
index 8d06aa0085..4e7a0467b1 100644
--- a/engines/made/database.cpp
+++ b/engines/made/database.cpp
@@ -27,6 +27,7 @@
#include "common/endian.h"
#include "common/util.h"
#include "common/savefile.h"
+#include "common/textconsole.h"
#include "made/database.h"
diff --git a/engines/made/graphics.cpp b/engines/made/graphics.cpp
index 7e8330d3f4..388ff60aa8 100644
--- a/engines/made/graphics.cpp
+++ b/engines/made/graphics.cpp
@@ -23,7 +23,9 @@
*
*/
+#include "common/debug.h"
#include "common/endian.h"
+#include "common/textconsole.h"
#include "made/graphics.h"
diff --git a/engines/made/made.cpp b/engines/made/made.cpp
index c81fa3db25..c791b657e7 100644
--- a/engines/made/made.cpp
+++ b/engines/made/made.cpp
@@ -26,8 +26,6 @@
#include "common/events.h"
#include "common/EventRecorder.h"
#include "common/keyboard.h"
-#include "common/file.h"
-#include "common/savefile.h"
#include "common/config-manager.h"
#include "common/stream.h"
diff --git a/engines/made/music.cpp b/engines/made/music.cpp
index 2e06871e13..e5bbbc3b42 100644
--- a/engines/made/music.cpp
+++ b/engines/made/music.cpp
@@ -30,8 +30,6 @@
#include "audio/audiostream.h"
#include "audio/mididrv.h"
#include "audio/midiparser.h"
-#include "common/config-manager.h"
-#include "common/file.h"
#include "made/music.h"
diff --git a/engines/made/pmvplayer.cpp b/engines/made/pmvplayer.cpp
index e37bd87a7e..5ab24c1984 100644
--- a/engines/made/pmvplayer.cpp
+++ b/engines/made/pmvplayer.cpp
@@ -169,7 +169,7 @@ bool PmvPlayer::play(const char *filename) {
if (!_surface) {
_surface = new Graphics::Surface();
- _surface->create(width, height, 1);
+ _surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
}
decompressMovieImage(imageData, *_surface, cmdOffs, pixelOffs, maskOffs, lineSize);
diff --git a/engines/made/redreader.cpp b/engines/made/redreader.cpp
index 3d36b69a28..2fcd7f43da 100644
--- a/engines/made/redreader.cpp
+++ b/engines/made/redreader.cpp
@@ -25,6 +25,7 @@
#include "made/redreader.h"
#include "common/memstream.h"
+#include "common/textconsole.h"
namespace Made {
diff --git a/engines/made/resource.cpp b/engines/made/resource.cpp
index e556e4ab38..403520bec3 100644
--- a/engines/made/resource.cpp
+++ b/engines/made/resource.cpp
@@ -23,6 +23,7 @@
*
*/
+#include "common/debug.h"
#include "common/endian.h"
#include "common/memstream.h"
#include "audio/mixer.h"
@@ -95,7 +96,7 @@ void PictureResource::loadRaw(byte *source, int size) {
}
_picture = new Graphics::Surface();
- _picture->create(width, height, 1);
+ _picture->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
decompressImage(source, *_picture, cmdOffs, pixelOffs, maskOffs, lineSize, cmdFlags, pixelFlags, maskFlags);
@@ -171,7 +172,7 @@ void PictureResource::loadChunked(byte *source, int size) {
}
_picture = new Graphics::Surface();
- _picture->create(width, height, 1);
+ _picture->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
decompressImage(source, *_picture, cmdOffs, pixelOffs, maskOffs, lineSize, cmdFlags, pixelFlags, maskFlags);
@@ -227,7 +228,7 @@ void AnimationResource::load(byte *source, int size) {
uint16 lineSize = sourceS->readUint16LE();
Graphics::Surface *frame = new Graphics::Surface();
- frame->create(frameWidth, frameHeight, 1);
+ frame->create(frameWidth, frameHeight, Graphics::PixelFormat::createFormatCLUT8());
decompressImage(source + frameOffs, *frame, cmdOffs, pixelOffs, maskOffs, lineSize, 0, 0, 0, _flags & 1);
diff --git a/engines/made/resource.h b/engines/made/resource.h
index ade6a23029..f1aeb7a87c 100644
--- a/engines/made/resource.h
+++ b/engines/made/resource.h
@@ -30,6 +30,7 @@
#include "common/file.h"
#include "common/stream.h"
#include "common/hashmap.h"
+#include "common/textconsole.h"
#include "graphics/surface.h"
#include "audio/audiostream.h"
diff --git a/engines/made/screen.cpp b/engines/made/screen.cpp
index 2649e2bd37..4a73ba8e38 100644
--- a/engines/made/screen.cpp
+++ b/engines/made/screen.cpp
@@ -28,6 +28,8 @@
#include "made/resource.h"
#include "made/database.h"
+#include "graphics/palette.h"
+
namespace Made {
Screen::Screen(MadeEngine *vm) : _vm(vm) {
@@ -36,10 +38,10 @@ Screen::Screen(MadeEngine *vm) : _vm(vm) {
_newPalette = new byte[768];
_backgroundScreen = new Graphics::Surface();
- _backgroundScreen->create(320, 200, 1);
+ _backgroundScreen->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
_workScreen = new Graphics::Surface();
- _workScreen->create(320, 200, 1);
+ _workScreen->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
_backgroundScreenDrawCtx.clipRect = Common::Rect(320, 200);
_workScreenDrawCtx.clipRect = Common::Rect(320, 200);
@@ -51,7 +53,7 @@ Screen::Screen(MadeEngine *vm) : _vm(vm) {
// Screen mask is only needed in v2 games
if (_vm->getGameID() != GID_RTZ) {
_screenMask = new Graphics::Surface();
- _screenMask->create(320, 200, 1);
+ _screenMask->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
_maskDrawCtx.clipRect = Common::Rect(320, 200);
_maskDrawCtx.destSurface = _screenMask;
}
diff --git a/engines/made/script.h b/engines/made/script.h
index 16c5ad604f..be719eba5f 100644
--- a/engines/made/script.h
+++ b/engines/made/script.h
@@ -29,6 +29,7 @@
#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 4f1937c057..c0a723438e 100644
--- a/engines/made/scriptfuncs.cpp
+++ b/engines/made/scriptfuncs.cpp
@@ -23,9 +23,7 @@
*
*/
-#include "common/endian.h"
#include "common/util.h"
-#include "common/events.h"
#include "backends/audiocd/audiocd.h"
#include "graphics/cursorman.h"
diff --git a/engines/made/scriptfuncs.h b/engines/made/scriptfuncs.h
index 3bed27c5c8..b8b2a87d19 100644
--- a/engines/made/scriptfuncs.h
+++ b/engines/made/scriptfuncs.h
@@ -34,7 +34,7 @@
#include "made/resource.h"
namespace Audio {
- class PCSpeaker;
+class PCSpeaker;
}
namespace Made {
diff --git a/engines/metaengine.h b/engines/metaengine.h
index 2afed0703b..ef34506991 100644
--- a/engines/metaengine.h
+++ b/engines/metaengine.h
@@ -37,8 +37,8 @@ class Engine;
class OSystem;
namespace Common {
- class FSList;
- class String;
+class FSList;
+class String;
}
/**
diff --git a/engines/mohawk/bitmap.cpp b/engines/mohawk/bitmap.cpp
index c8111fa91b..02548d58fc 100644
--- a/engines/mohawk/bitmap.cpp
+++ b/engines/mohawk/bitmap.cpp
@@ -31,6 +31,7 @@
#include "common/memstream.h"
#include "common/substream.h"
#include "common/system.h"
+#include "common/textconsole.h"
namespace Mohawk {
@@ -135,8 +136,12 @@ Common::Array<MohawkSurface *> MohawkBitmap::decodeImages(Common::SeekableReadSt
Graphics::Surface *MohawkBitmap::createSurface(uint16 width, uint16 height) {
Graphics::Surface *surface = new Graphics::Surface();
- byte bytesPerPixel = (getBitsPerPixel() <= 8) ? 1 : g_system->getScreenFormat().bytesPerPixel;
- surface->create(width, height, bytesPerPixel);
+ Graphics::PixelFormat format;
+ if (getBitsPerPixel() <= 8)
+ format = Graphics::PixelFormat::createFormatCLUT8();
+ else
+ format = g_system->getScreenFormat();
+ surface->create(width, height, format);
return surface;
}
@@ -569,7 +574,7 @@ void MohawkBitmap::drawRaw(Graphics::Surface *surface) {
byte b = _data->readByte();
byte g = _data->readByte();
byte r = _data->readByte();
- if (surface->bytesPerPixel == 2)
+ if (surface->format.bytesPerPixel == 2)
*((uint16 *)surface->getBasePtr(x, y)) = pixelFormat.RGBToColor(r, g, b);
else
*((uint32 *)surface->getBasePtr(x, y)) = pixelFormat.RGBToColor(r, g, b);
@@ -608,13 +613,12 @@ void MohawkBitmap::drawRLE8(Graphics::Surface *surface, bool isLE) {
if (code & 0x80) {
byte val = _data->readByte();
- for (uint16 j = 0; j < runLen; j++)
- *dst++ = val;
+ memset(dst, val, runLen);
} else {
- for (uint16 j = 0; j < runLen; j++)
- *dst++ = _data->readByte();
+ _data->read(dst, runLen);
}
+ dst += runLen;
remaining -= runLen;
}
@@ -857,7 +861,7 @@ MohawkSurface *DOSBitmap::decodeImage(Common::SeekableReadStream *stream) {
}
void DOSBitmap::expandMonochromePlane(Graphics::Surface *surface, Common::SeekableReadStream *rawStream) {
- assert(surface->bytesPerPixel == 1);
+ assert(surface->format.bytesPerPixel == 1);
byte *dst = (byte *)surface->pixels;
@@ -883,7 +887,7 @@ void DOSBitmap::expandMonochromePlane(Graphics::Surface *surface, Common::Seekab
*(dst + j * 4 + dstPixel) = (*(dst + j * 4 + dstPixel) >> 1) | (((temp >> srcBit) & 1) << 3)
void DOSBitmap::expandEGAPlanes(Graphics::Surface *surface, Common::SeekableReadStream *rawStream) {
- assert(surface->bytesPerPixel == 1);
+ 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
diff --git a/engines/mohawk/console.cpp b/engines/mohawk/console.cpp
index ee67c9f23c..93cbe87e55 100644
--- a/engines/mohawk/console.cpp
+++ b/engines/mohawk/console.cpp
@@ -29,6 +29,9 @@
#include "mohawk/sound.h"
#include "mohawk/video.h"
+#include "common/system.h"
+#include "common/textconsole.h"
+
#ifdef ENABLE_CSTIME
#include "mohawk/cstime.h"
#endif
diff --git a/engines/mohawk/cstime.cpp b/engines/mohawk/cstime.cpp
index 955e0e5af6..46faae08f5 100644
--- a/engines/mohawk/cstime.cpp
+++ b/engines/mohawk/cstime.cpp
@@ -30,15 +30,14 @@
#include "mohawk/cstime_view.h"
#include "mohawk/resource.h"
#include "mohawk/cursors.h"
-#include "mohawk/sound.h"
#include "mohawk/video.h"
#include "common/config-manager.h"
+#include "common/error.h"
#include "common/events.h"
#include "common/EventRecorder.h"
#include "common/fs.h"
-
-#include "engines/util.h"
+#include "common/textconsole.h"
namespace Mohawk {
diff --git a/engines/mohawk/cstime_cases.cpp b/engines/mohawk/cstime_cases.cpp
index 408f1c9d9a..c4801f822c 100644
--- a/engines/mohawk/cstime_cases.cpp
+++ b/engines/mohawk/cstime_cases.cpp
@@ -26,6 +26,8 @@
#include "mohawk/cstime_cases.h"
#include "mohawk/cstime_ui.h"
+#include "common/textconsole.h"
+
namespace Mohawk {
CSTimeCase1::CSTimeCase1(MohawkEngine_CSTime *vm) : CSTimeCase(vm, 1) {
diff --git a/engines/mohawk/cstime_game.cpp b/engines/mohawk/cstime_game.cpp
index 14e5d99e51..66dce1da92 100644
--- a/engines/mohawk/cstime_game.cpp
+++ b/engines/mohawk/cstime_game.cpp
@@ -29,6 +29,8 @@
#include "mohawk/resource.h"
#include "mohawk/sound.h"
#include "common/events.h"
+#include "common/system.h"
+#include "common/textconsole.h"
namespace Mohawk {
diff --git a/engines/mohawk/cstime_ui.cpp b/engines/mohawk/cstime_ui.cpp
index 935b0321da..106f7ea319 100644
--- a/engines/mohawk/cstime_ui.cpp
+++ b/engines/mohawk/cstime_ui.cpp
@@ -29,6 +29,8 @@
#include "mohawk/resource.h"
#include "common/algorithm.h" // find
#include "common/events.h"
+#include "common/system.h"
+#include "common/textconsole.h"
#include "graphics/fontman.h"
namespace Mohawk {
diff --git a/engines/mohawk/cstime_view.cpp b/engines/mohawk/cstime_view.cpp
index 115b363b6e..12d641a9ff 100644
--- a/engines/mohawk/cstime_view.cpp
+++ b/engines/mohawk/cstime_view.cpp
@@ -30,6 +30,8 @@
#include "mohawk/cursors.h"
#include "common/events.h"
+#include "common/system.h"
+#include "common/textconsole.h"
namespace Mohawk {
diff --git a/engines/mohawk/cursors.cpp b/engines/mohawk/cursors.cpp
index b4969f990a..3327860913 100644
--- a/engines/mohawk/cursors.cpp
+++ b/engines/mohawk/cursors.cpp
@@ -29,9 +29,11 @@
#include "common/macresman.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "common/winexe_ne.h"
#include "common/winexe_pe.h"
#include "graphics/cursorman.h"
+#include "graphics/maccursor.h"
#include "graphics/wincursor.h"
#ifdef ENABLE_MYST
@@ -41,11 +43,6 @@
namespace Mohawk {
-static const byte s_bwPalette[] = {
- 0x00, 0x00, 0x00, // Black
- 0xFF, 0xFF, 0xFF // White
-};
-
void CursorManager::showCursor() {
CursorMan.showMouse(true);
}
@@ -78,8 +75,13 @@ void CursorManager::setDefaultCursor() {
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0
};
+ static const byte bwPalette[] = {
+ 0x00, 0x00, 0x00, // Black
+ 0xFF, 0xFF, 0xFF // White
+ };
+
CursorMan.replaceCursor(defaultCursor, 12, 20, 0, 0, 0);
- CursorMan.replaceCursorPalette(s_bwPalette, 1, 2);
+ CursorMan.replaceCursorPalette(bwPalette, 1, 2);
}
void CursorManager::setCursor(uint16 id) {
@@ -87,35 +89,24 @@ void CursorManager::setCursor(uint16 id) {
setDefaultCursor();
}
-void CursorManager::setMacXorCursor(Common::SeekableReadStream *stream) {
+void CursorManager::setMacCursor(Common::SeekableReadStream *stream) {
assert(stream);
- byte cursorBitmap[16 * 16];
+ Graphics::MacCursor *macCursor = new Graphics::MacCursor();
- // Get black and white data
- for (int i = 0; i < 32; i++) {
- byte imageByte = stream->readByte();
- for (int b = 0; b < 8; b++)
- cursorBitmap[i * 8 + b] = (imageByte & (0x80 >> b)) ? 1 : 2;
- }
+ if (!macCursor->readFromStream(*stream))
+ error("Could not parse Mac cursor");
- // Apply mask data
- for (int i = 0; i < 32; i++) {
- byte imageByte = stream->readByte();
- for (int b = 0; b < 8; b++)
- if ((imageByte & (0x80 >> b)) == 0)
- cursorBitmap[i * 8 + b] = 0;
- }
-
- uint16 hotspotY = stream->readUint16BE();
- uint16 hotspotX = stream->readUint16BE();
+ CursorMan.replaceCursor(macCursor->getSurface(), macCursor->getWidth(), macCursor->getHeight(),
+ macCursor->getHotspotX(), macCursor->getHotspotY(), macCursor->getKeyColor());
+ CursorMan.replaceCursorPalette(macCursor->getPalette(), 0, 256);
- CursorMan.replaceCursor(cursorBitmap, 16, 16, hotspotX, hotspotY, 0);
- CursorMan.replaceCursorPalette(s_bwPalette, 1, 2);
+ delete macCursor;
+ delete stream;
}
void DefaultCursorManager::setCursor(uint16 id) {
- setMacXorCursor(_vm->getResource(_tag, id));
+ setMacCursor(_vm->getResource(_tag, id));
}
#ifdef ENABLE_MYST
@@ -148,7 +139,7 @@ void MystCursorManager::setCursor(uint16 id) {
delete clrcStream;
// Myst ME stores some cursors as 24bpp images instead of 8bpp
- if (surface->bytesPerPixel == 1) {
+ if (surface->format.bytesPerPixel == 1) {
CursorMan.replaceCursor((byte *)surface->pixels, surface->w, surface->h, hotspotX, hotspotY, 0);
CursorMan.replaceCursorPalette(mhkSurface->getPalette(), 0, 256);
} else {
@@ -223,26 +214,12 @@ void MacCursorManager::setCursor(uint16 id) {
// Try a color cursor first
Common::SeekableReadStream *stream = _resFork->getResource(MKTAG('c','r','s','r'), id);
- if (stream) {
- byte *cursor, *palette;
- int width, height, hotspotX, hotspotY, keyColor, palSize;
-
- _resFork->convertCrsrCursor(stream, &cursor, width, height, hotspotX, hotspotY, keyColor, true, &palette, palSize);
-
- CursorMan.replaceCursor(cursor, width, height, hotspotX, hotspotY, keyColor);
- CursorMan.replaceCursorPalette(palette, 0, palSize);
-
- delete[] cursor;
- delete[] palette;
- delete stream;
- return;
- }
-
- // Fall back to b&w cursors
- stream = _resFork->getResource(MKTAG('C','U','R','S'), id);
+ // Fall back to monochrome cursors
+ if (!stream)
+ stream = _resFork->getResource(MKTAG('C','U','R','S'), id);
if (stream) {
- setMacXorCursor(stream);
+ setMacCursor(stream);
delete stream;
} else {
setDefaultCursor();
@@ -265,7 +242,7 @@ LivingBooksCursorManager_v2::~LivingBooksCursorManager_v2() {
void LivingBooksCursorManager_v2::setCursor(uint16 id) {
if (_sysArchive && _sysArchive->hasResource(ID_TCUR, id)) {
- setMacXorCursor(_sysArchive->getResource(ID_TCUR, id));
+ setMacCursor(_sysArchive->getResource(ID_TCUR, id));
} else {
// TODO: Handle generated cursors
}
diff --git a/engines/mohawk/cursors.h b/engines/mohawk/cursors.h
index f8a9429689..ba9700c9f9 100644
--- a/engines/mohawk/cursors.h
+++ b/engines/mohawk/cursors.h
@@ -29,11 +29,11 @@
#include "common/scummsys.h"
namespace Common {
- class MacResManager;
- class NEResources;
- class PEResources;
- class SeekableReadStream;
- class String;
+class MacResManager;
+class NEResources;
+class PEResources;
+class SeekableReadStream;
+class String;
}
#include "mohawk/resource.h"
@@ -63,8 +63,8 @@ public:
virtual bool hasSource() const { return false; }
protected:
- // Set a Mac XOR/AND map cursor to the screen
- void setMacXorCursor(Common::SeekableReadStream *stream);
+ // Set a Mac CURS/crsr cursor to the screen
+ void setMacCursor(Common::SeekableReadStream *stream);
};
// The default Mohawk cursor manager
diff --git a/engines/mohawk/detection.cpp b/engines/mohawk/detection.cpp
index cad24b55f1..c14d3327d0 100644
--- a/engines/mohawk/detection.cpp
+++ b/engines/mohawk/detection.cpp
@@ -26,9 +26,9 @@
#include "base/plugins.h"
#include "engines/advancedDetector.h"
-#include "common/config-manager.h"
-#include "common/file.h"
#include "common/savefile.h"
+#include "common/system.h"
+#include "common/textconsole.h"
#include "mohawk/livingbooks.h"
@@ -141,6 +141,7 @@ static const PlainGameDescriptor mohawkGames[] = {
{"rugrats", "Rugrats Adventure Game"},
{"lbsampler", "Living Books Sampler"},
{"bearfight", "The Berenstain Bears Get in a Fight"},
+ {"beardark", "The Berenstain Bears In The Dark"},
{"arthurcomp", "Arthur's Computer Adventure"},
{"harryhh","Harry and the Haunted House"},
{"stellaluna", "Stellaluna"},
diff --git a/engines/mohawk/detection_tables.h b/engines/mohawk/detection_tables.h
index a8f9ee557b..36dbcbde7b 100644
--- a/engines/mohawk/detection_tables.h
+++ b/engines/mohawk/detection_tables.h
@@ -793,6 +793,21 @@ static const MohawkGameDescription gameDescriptions[] = {
{
{
+ "seussabc",
+ "Demo",
+ AD_ENTRY1("BookOutline", "17d72660680ae32cd7c560d0cf04d2ef"),
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_DEMO,
+ Common::GUIO_NONE
+ },
+ GType_LIVINGBOOKSV2,
+ GF_DEMO,
+ 0
+ },
+
+ {
+ {
"1stdegree",
"",
AD_ENTRY1("AL236_1.MHK", "3ba145492a7b8b4dee0ef4222c5639c3"),
@@ -1023,6 +1038,23 @@ static const MohawkGameDescription gameDescriptions[] = {
0
},
+ // Just Grandma and Me 1.0
+ // From scoriae
+ {
+ {
+ "grandma",
+ "v1.0",
+ AD_ENTRY1("PAGES.512", "e694ac10f957dd2e20611350bf968da3"),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ Common::GUIO_NONE
+ },
+ GType_LIVINGBOOKSV1,
+ GF_LB_10,
+ "GRANDMA.EXE"
+ },
+
{
{
"grandma",
@@ -1254,6 +1286,22 @@ static const MohawkGameDescription gameDescriptions[] = {
0
},
+ // From zerep in bug #3287894
+ {
+ {
+ "arthurbday",
+ "",
+ AD_ENTRY1("BIRTHDAY.512", "874f80ff363214d63593864e58c4a130"),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ Common::GUIO_NONE
+ },
+ GType_LIVINGBOOKSV1,
+ 0,
+ "BIRTHDAY.EXE"
+ },
+
{
{
"arthurbday",
@@ -1545,6 +1593,55 @@ static const MohawkGameDescription gameDescriptions[] = {
"Bears Get in a Fight"
},
+ // From bkennimer in bug #3284930
+ {
+ {
+ "beardark",
+ "",
+ AD_ENTRY1("DARK.LB", "81d1e6eaf88d54bd29836a133935c0d4"),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ Common::GUIO_NONE
+ },
+ GType_LIVINGBOOKSV3,
+ 0,
+ 0
+ },
+
+ // From bkennimer in bug #3284930
+ // 32-bit version of the previous entry
+ {
+ {
+ "beardark",
+ "",
+ AD_ENTRY1("DARK32.LB", "28abbf5498aeb29e78e5e0dec969ebe2"),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ Common::GUIO_NONE
+ },
+ GType_LIVINGBOOKSV3,
+ 0,
+ 0
+ },
+
+ // From bkennimer in bug #3284930
+ {
+ {
+ "beardark",
+ "",
+ AD_ENTRY1("BookOutline", "95b2e43778ca9cfaee37bdde843e7681"),
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_NO_FLAGS,
+ Common::GUIO_NONE
+ },
+ GType_LIVINGBOOKSV3,
+ 0,
+ 0
+ },
+
{
{
"arthurcomp",
diff --git a/engines/mohawk/dialogs.cpp b/engines/mohawk/dialogs.cpp
index c5a0c7e86d..4c7e52f02f 100644
--- a/engines/mohawk/dialogs.cpp
+++ b/engines/mohawk/dialogs.cpp
@@ -27,7 +27,9 @@
#include "mohawk/dialogs.h"
#include "gui/gui-manager.h"
-#include "common/savefile.h"
+#include "gui/ThemeEngine.h"
+#include "gui/widget.h"
+#include "common/system.h"
#include "common/translation.h"
#ifdef ENABLE_MYST
diff --git a/engines/mohawk/graphics.cpp b/engines/mohawk/graphics.cpp
index 81d2b6f019..a1bcb55f7b 100644
--- a/engines/mohawk/graphics.cpp
+++ b/engines/mohawk/graphics.cpp
@@ -28,7 +28,10 @@
#include "mohawk/livingbooks.h"
#include "common/substream.h"
+#include "common/system.h"
+#include "common/textconsole.h"
#include "engines/util.h"
+#include "graphics/palette.h"
#include "graphics/primitives.h"
#include "gui/message.h"
@@ -70,14 +73,14 @@ MohawkSurface::~MohawkSurface() {
void MohawkSurface::convertToTrueColor() {
assert(_surface);
- if (_surface->bytesPerPixel > 1)
+ if (_surface->format.bytesPerPixel > 1)
return;
assert(_palette);
Graphics::PixelFormat pixelFormat = g_system->getScreenFormat();
Graphics::Surface *surface = new Graphics::Surface();
- surface->create(_surface->w, _surface->h, pixelFormat.bytesPerPixel);
+ surface->create(_surface->w, _surface->h, pixelFormat);
for (uint16 i = 0; i < _surface->h; i++) {
for (uint16 j = 0; j < _surface->w; j++) {
@@ -292,7 +295,7 @@ MystGraphics::MystGraphics(MohawkEngine_Myst* vm) : GraphicsManager(), _vm(vm) {
// Initialize our buffer
_backBuffer = new Graphics::Surface();
- _backBuffer->create(_vm->_system->getWidth(), _vm->_system->getHeight(), _pixelFormat.bytesPerPixel);
+ _backBuffer->create(_vm->_system->getWidth(), _vm->_system->getHeight(), _pixelFormat);
}
MystGraphics::~MystGraphics() {
@@ -486,7 +489,7 @@ void MystGraphics::copyImageSectionToBackBuffer(uint16 image, Common::Rect src,
debug(3, "\theight: %d", height);
for (uint16 i = 0; i < height; i++)
- memcpy(_backBuffer->getBasePtr(dest.left, i + dest.top), surface->getBasePtr(src.left, top + i), width * surface->bytesPerPixel);
+ memcpy(_backBuffer->getBasePtr(dest.left, i + dest.top), surface->getBasePtr(src.left, top + i), width * surface->format.bytesPerPixel);
}
void MystGraphics::copyImageToScreen(uint16 image, Common::Rect dest) {
@@ -646,7 +649,7 @@ RivenGraphics::RivenGraphics(MohawkEngine_Riven* vm) : GraphicsManager(), _vm(vm
// The actual game graphics only take up the first 392 rows. The inventory
// occupies the rest of the screen and we don't use the buffer to hold that.
_mainScreen = new Graphics::Surface();
- _mainScreen->create(608, 392, _pixelFormat.bytesPerPixel);
+ _mainScreen->create(608, 392, _pixelFormat);
_updatesEnabled = true;
_scheduledTransition = -1; // no transition
@@ -677,7 +680,7 @@ void RivenGraphics::copyImageToScreen(uint16 image, uint32 left, uint32 top, uin
surface->w = 608 - left;
for (uint16 i = 0; i < surface->h; i++)
- memcpy(_mainScreen->getBasePtr(left, i + top), surface->getBasePtr(0, i), surface->w * surface->bytesPerPixel);
+ memcpy(_mainScreen->getBasePtr(left, i + top), surface->getBasePtr(0, i), surface->w * surface->format.bytesPerPixel);
_dirtyScreen = true;
}
@@ -972,7 +975,7 @@ void RivenGraphics::drawImageRect(uint16 id, Common::Rect srcRect, Common::Rect
assert(srcRect.width() == dstRect.width() && srcRect.height() == dstRect.height());
for (uint16 i = 0; i < srcRect.height(); i++)
- memcpy(_mainScreen->getBasePtr(dstRect.left, i + dstRect.top), surface->getBasePtr(srcRect.left, i + srcRect.top), srcRect.width() * surface->bytesPerPixel);
+ memcpy(_mainScreen->getBasePtr(dstRect.left, i + dstRect.top), surface->getBasePtr(srcRect.left, i + srcRect.top), srcRect.width() * surface->format.bytesPerPixel);
_dirtyScreen = true;
}
diff --git a/engines/mohawk/graphics.h b/engines/mohawk/graphics.h
index 5cac68c510..c7e9b98d49 100644
--- a/engines/mohawk/graphics.h
+++ b/engines/mohawk/graphics.h
@@ -33,7 +33,7 @@
#include "graphics/pict.h"
namespace Graphics {
- class JPEG;
+class JPEG;
}
namespace Mohawk {
diff --git a/engines/mohawk/installer_archive.cpp b/engines/mohawk/installer_archive.cpp
index 4ea742dff6..5079375896 100644
--- a/engines/mohawk/installer_archive.cpp
+++ b/engines/mohawk/installer_archive.cpp
@@ -27,8 +27,6 @@
#include "common/dcl.h"
#include "common/debug.h"
-#include "common/substream.h"
-#include "common/util.h"
namespace Mohawk {
diff --git a/engines/mohawk/installer_archive.h b/engines/mohawk/installer_archive.h
index 565b363be3..d33fbe5bcd 100644
--- a/engines/mohawk/installer_archive.h
+++ b/engines/mohawk/installer_archive.h
@@ -27,6 +27,8 @@
#include "common/scummsys.h"
#include "common/endian.h"
#include "common/file.h"
+#include "common/hash-str.h"
+#include "common/hashmap.h"
#include "common/str.h"
#ifndef MOHAWK_INSTALLER_ARCHIVE_H
diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp
index 7f6c3cc43a..2475965812 100644
--- a/engines/mohawk/livingbooks.cpp
+++ b/engines/mohawk/livingbooks.cpp
@@ -26,13 +26,17 @@
#include "mohawk/livingbooks.h"
#include "mohawk/resource.h"
#include "mohawk/cursors.h"
-#include "mohawk/sound.h"
#include "mohawk/video.h"
+#include "common/config-manager.h"
+#include "common/error.h"
#include "common/events.h"
#include "common/EventRecorder.h"
#include "common/fs.h"
#include "common/archive.h"
+#include "common/textconsole.h"
+
+#include "graphics/palette.h"
#include "engines/util.h"
@@ -2004,7 +2008,7 @@ LBScriptEntry *LBItem::parseScriptEntry(uint16 type, uint16 &size, Common::Seeka
size -= target.size() + 1;
}
- if (size % 2 != oldAlign) {
+ if ((uint)(size % 2) != oldAlign) {
stream->skip(1);
size--;
}
diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp
index 84f69af2ac..4237c712d9 100644
--- a/engines/mohawk/livingbooks_code.cpp
+++ b/engines/mohawk/livingbooks_code.cpp
@@ -26,6 +26,9 @@
#include "mohawk/livingbooks.h"
#include "mohawk/resource.h"
+#include "common/system.h"
+#include "common/textconsole.h"
+
namespace Mohawk {
bool LBValue::operator==(const LBValue &x) const {
diff --git a/engines/mohawk/mohawk.cpp b/engines/mohawk/mohawk.cpp
index 015cbffb26..f63645f1ac 100644
--- a/engines/mohawk/mohawk.cpp
+++ b/engines/mohawk/mohawk.cpp
@@ -24,13 +24,9 @@
*/
#include "common/scummsys.h"
-#include "common/config-manager.h"
-#include "common/file.h"
-#include "common/events.h"
-#include "common/keyboard.h"
-
-#include "base/plugins.h"
-#include "base/version.h"
+#include "common/error.h"
+#include "common/system.h"
+#include "common/textconsole.h"
#include "mohawk/mohawk.h"
#include "mohawk/cursors.h"
diff --git a/engines/mohawk/mohawk.h b/engines/mohawk/mohawk.h
index 1bad8a08ce..8a853d151e 100644
--- a/engines/mohawk/mohawk.h
+++ b/engines/mohawk/mohawk.h
@@ -34,7 +34,7 @@
class OSystem;
namespace Common {
- class SeekableReadStream;
+class SeekableReadStream;
}
/**
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index 1aba820fed..655a38b578 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -25,7 +25,9 @@
#include "common/config-manager.h"
#include "common/debug-channels.h"
+#include "common/system.h"
#include "common/translation.h"
+#include "common/textconsole.h"
#include "mohawk/cursors.h"
#include "mohawk/graphics.h"
diff --git a/engines/mohawk/myst_areas.cpp b/engines/mohawk/myst_areas.cpp
index 21f6627f60..dc00bff923 100644
--- a/engines/mohawk/myst_areas.cpp
+++ b/engines/mohawk/myst_areas.cpp
@@ -29,6 +29,10 @@
#include "mohawk/sound.h"
#include "mohawk/video.h"
+#include "common/events.h"
+#include "common/system.h"
+#include "common/textconsole.h"
+
namespace Mohawk {
MystResource::MystResource(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystResource *parent) {
diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp
index 17a2c66091..71c408ed37 100644
--- a/engines/mohawk/myst_scripts.cpp
+++ b/engines/mohawk/myst_scripts.cpp
@@ -31,6 +31,8 @@
#include "mohawk/sound.h"
#include "mohawk/video.h"
+#include "common/system.h"
+#include "common/textconsole.h"
#include "gui/message.h"
namespace Mohawk {
diff --git a/engines/mohawk/myst_stacks/channelwood.cpp b/engines/mohawk/myst_stacks/channelwood.cpp
index 26267cfbda..cba2583a50 100644
--- a/engines/mohawk/myst_stacks/channelwood.cpp
+++ b/engines/mohawk/myst_stacks/channelwood.cpp
@@ -32,7 +32,9 @@
#include "mohawk/video.h"
#include "mohawk/myst_stacks/channelwood.h"
-#include "gui/message.h"
+#include "common/events.h"
+#include "common/system.h"
+#include "common/textconsole.h"
namespace Mohawk {
namespace MystStacks {
diff --git a/engines/mohawk/myst_stacks/credits.cpp b/engines/mohawk/myst_stacks/credits.cpp
index 61772eda4d..bb8397fd09 100644
--- a/engines/mohawk/myst_stacks/credits.cpp
+++ b/engines/mohawk/myst_stacks/credits.cpp
@@ -30,6 +30,7 @@
#include "mohawk/video.h"
#include "mohawk/myst_stacks/credits.h"
+#include "common/system.h"
#include "gui/message.h"
namespace Mohawk {
diff --git a/engines/mohawk/myst_stacks/dni.cpp b/engines/mohawk/myst_stacks/dni.cpp
index ffbf9c991f..e2a11eb94f 100644
--- a/engines/mohawk/myst_stacks/dni.cpp
+++ b/engines/mohawk/myst_stacks/dni.cpp
@@ -31,6 +31,8 @@
#include "mohawk/video.h"
#include "mohawk/myst_stacks/dni.h"
+#include "common/system.h"
+
namespace Mohawk {
namespace MystStacks {
diff --git a/engines/mohawk/myst_stacks/mechanical.cpp b/engines/mohawk/myst_stacks/mechanical.cpp
index 3dab2f7939..c5c11026f5 100644
--- a/engines/mohawk/myst_stacks/mechanical.cpp
+++ b/engines/mohawk/myst_stacks/mechanical.cpp
@@ -32,7 +32,8 @@
#include "mohawk/video.h"
#include "mohawk/myst_stacks/mechanical.h"
-#include "gui/message.h"
+#include "common/events.h"
+#include "common/system.h"
namespace Mohawk {
namespace MystStacks {
diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp
index 5d070322ca..2b8ef94442 100644
--- a/engines/mohawk/myst_stacks/myst.cpp
+++ b/engines/mohawk/myst_stacks/myst.cpp
@@ -33,6 +33,8 @@
#include "mohawk/myst_stacks/myst.h"
#include "common/events.h"
+#include "common/system.h"
+#include "common/textconsole.h"
#include "gui/message.h"
diff --git a/engines/mohawk/myst_stacks/preview.cpp b/engines/mohawk/myst_stacks/preview.cpp
index dc491c7573..fddf6290fb 100644
--- a/engines/mohawk/myst_stacks/preview.cpp
+++ b/engines/mohawk/myst_stacks/preview.cpp
@@ -30,6 +30,7 @@
#include "mohawk/video.h"
#include "mohawk/myst_stacks/preview.h"
+#include "common/system.h"
#include "gui/message.h"
namespace Mohawk {
diff --git a/engines/mohawk/myst_stacks/selenitic.cpp b/engines/mohawk/myst_stacks/selenitic.cpp
index f485bab2f9..c670cb6a48 100644
--- a/engines/mohawk/myst_stacks/selenitic.cpp
+++ b/engines/mohawk/myst_stacks/selenitic.cpp
@@ -32,6 +32,8 @@
#include "mohawk/video.h"
#include "mohawk/myst_stacks/selenitic.h"
+#include "common/system.h"
+#include "common/textconsole.h"
#include "gui/message.h"
namespace Mohawk {
@@ -816,7 +818,7 @@ void Selenitic::o_soundLockEndMove(uint16 op, uint16 var, uint16 argc, uint16 *a
debugC(kDebugScript, "Opcode %d: Sound lock end move", op);
MystResourceType10 *slider = soundLockSliderFromVar(var);
- uint16 *value = 0;
+ uint16 *value = &_state.soundLockSliderPositions[0];
switch (var) {
case 20: // Sound lock sliders
@@ -834,6 +836,9 @@ void Selenitic::o_soundLockEndMove(uint16 op, uint16 var, uint16 argc, uint16 *a
case 24:
value = &_state.soundLockSliderPositions[4];
break;
+ default:
+ error("Incorrect var value for Selenitic opcode 114");
+ break;
}
uint16 stepped = 12 * (*value / 12) + 6;
diff --git a/engines/mohawk/myst_stacks/slides.cpp b/engines/mohawk/myst_stacks/slides.cpp
index e664081c96..4057edd9c9 100644
--- a/engines/mohawk/myst_stacks/slides.cpp
+++ b/engines/mohawk/myst_stacks/slides.cpp
@@ -30,6 +30,7 @@
#include "mohawk/video.h"
#include "mohawk/myst_stacks/slides.h"
+#include "common/system.h"
#include "gui/message.h"
namespace Mohawk {
diff --git a/engines/mohawk/myst_stacks/stoneship.cpp b/engines/mohawk/myst_stacks/stoneship.cpp
index b5b403dad8..07701c273e 100644
--- a/engines/mohawk/myst_stacks/stoneship.cpp
+++ b/engines/mohawk/myst_stacks/stoneship.cpp
@@ -32,7 +32,9 @@
#include "mohawk/video.h"
#include "mohawk/myst_stacks/stoneship.h"
-#include "gui/message.h"
+#include "common/events.h"
+#include "common/system.h"
+#include "common/textconsole.h"
namespace Mohawk {
namespace MystStacks {
diff --git a/engines/mohawk/myst_state.cpp b/engines/mohawk/myst_state.cpp
index 968bb422be..de71dcf382 100644
--- a/engines/mohawk/myst_state.cpp
+++ b/engines/mohawk/myst_state.cpp
@@ -27,7 +27,9 @@
#include "mohawk/myst.h"
#include "mohawk/myst_state.h"
+#include "common/debug.h"
#include "common/serializer.h"
+#include "common/textconsole.h"
#include "common/util.h"
namespace Mohawk {
diff --git a/engines/mohawk/myst_state.h b/engines/mohawk/myst_state.h
index a543cb1c4f..074c3e5f10 100644
--- a/engines/mohawk/myst_state.h
+++ b/engines/mohawk/myst_state.h
@@ -31,7 +31,7 @@
#include "common/str.h"
namespace Common {
- class Serializer;
+class Serializer;
}
namespace Mohawk {
diff --git a/engines/mohawk/resource.cpp b/engines/mohawk/resource.cpp
index de1513b237..62250b75f2 100644
--- a/engines/mohawk/resource.cpp
+++ b/engines/mohawk/resource.cpp
@@ -28,6 +28,7 @@
#include "common/debug.h"
#include "common/substream.h"
#include "common/util.h"
+#include "common/textconsole.h"
namespace Mohawk {
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index 88927884a2..3aba5643db 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -35,6 +35,7 @@
#include "common/hashmap.h"
#include "common/hash-str.h"
#include "common/random.h"
+#include "common/rect.h"
namespace Mohawk {
diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp
index 7c453dec48..dc0d66f19b 100644
--- a/engines/mohawk/riven_external.cpp
+++ b/engines/mohawk/riven_external.cpp
@@ -32,6 +32,7 @@
#include "gui/message.h"
#include "common/events.h"
+#include "common/system.h"
namespace Mohawk {
diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp
index 35f38c4069..b8f86f993a 100644
--- a/engines/mohawk/riven_scripts.cpp
+++ b/engines/mohawk/riven_scripts.cpp
@@ -33,6 +33,7 @@
#include "common/memstream.h"
#include "common/stream.h"
+#include "common/system.h"
namespace Mohawk {
diff --git a/engines/mohawk/riven_scripts.h b/engines/mohawk/riven_scripts.h
index 46cd965f40..2ac805c366 100644
--- a/engines/mohawk/riven_scripts.h
+++ b/engines/mohawk/riven_scripts.h
@@ -28,6 +28,7 @@
#include "common/str-array.h"
#include "common/ptr.h"
+#include "common/textconsole.h"
class MohawkEngine_Riven;
diff --git a/engines/mohawk/sound.cpp b/engines/mohawk/sound.cpp
index 9759f14699..fba87808d2 100644
--- a/engines/mohawk/sound.cpp
+++ b/engines/mohawk/sound.cpp
@@ -25,7 +25,10 @@
#include "mohawk/sound.h"
+#include "common/debug.h"
+#include "common/system.h"
#include "common/util.h"
+#include "common/textconsole.h"
#include "audio/musicplugin.h"
#include "audio/audiostream.h"
diff --git a/engines/mohawk/video.cpp b/engines/mohawk/video.cpp
index f481b5ceb2..8f57d61cc4 100644
--- a/engines/mohawk/video.cpp
+++ b/engines/mohawk/video.cpp
@@ -27,9 +27,16 @@
#include "mohawk/resource.h"
#include "mohawk/video.h"
+#include "common/debug.h"
#include "common/events.h"
+#include "common/textconsole.h"
+#include "common/system.h"
+
+#include "graphics/surface.h"
+
#include "video/qt_decoder.h"
+
namespace Mohawk {
void VideoEntry::clear() {
@@ -219,7 +226,7 @@ bool VideoManager::updateMovies() {
// Convert from 8bpp to the current screen format if necessary
Graphics::PixelFormat pixelFormat = _vm->_system->getScreenFormat();
- if (frame->bytesPerPixel == 1) {
+ if (frame->format.bytesPerPixel == 1) {
if (pixelFormat.bytesPerPixel == 1) {
if (_videoStreams[i]->hasDirtyPalette())
_videoStreams[i]->setSystemPalette();
@@ -228,7 +235,7 @@ bool VideoManager::updateMovies() {
const byte *palette = _videoStreams[i]->getPalette();
assert(palette);
- convertedFrame->create(frame->w, frame->h, pixelFormat.bytesPerPixel);
+ convertedFrame->create(frame->w, frame->h, pixelFormat);
for (uint16 j = 0; j < frame->h; j++) {
for (uint16 k = 0; k < frame->w; k++) {
diff --git a/engines/mohawk/view.cpp b/engines/mohawk/view.cpp
index 837d386b58..e5a44122ea 100644
--- a/engines/mohawk/view.cpp
+++ b/engines/mohawk/view.cpp
@@ -28,6 +28,8 @@
#include "mohawk/graphics.h"
#include "common/stream.h"
#include "common/system.h"
+#include "common/textconsole.h"
+#include "graphics/palette.h"
namespace Mohawk {
diff --git a/engines/parallaction/balloons.cpp b/engines/parallaction/balloons.cpp
index 527f2d2812..2cf6eebf2a 100644
--- a/engines/parallaction/balloons.cpp
+++ b/engines/parallaction/balloons.cpp
@@ -304,7 +304,7 @@ int BalloonManager_ns::createBalloon(int16 w, int16 h, int16 winding, uint16 bor
int16 real_h = (winding == -1) ? h : h + 9;
balloon->surface = new Graphics::Surface;
- balloon->surface->create(w, real_h, 1);
+ balloon->surface->create(w, real_h, Graphics::PixelFormat::createFormatCLUT8());
balloon->surface->fillRect(Common::Rect(w, real_h), BALLOON_TRANSPARENT_COLOR_NS);
Common::Rect r(w, h);
@@ -578,7 +578,7 @@ Graphics::Surface *BalloonManager_br::expandBalloon(Frames *data, int frameNum)
rect.translate(-rect.left, -rect.top);
Graphics::Surface *surf = new Graphics::Surface;
- surf->create(rect.width(), rect.height(), 1);
+ surf->create(rect.width(), rect.height(), Graphics::PixelFormat::createFormatCLUT8());
_vm->_gfx->unpackBlt(rect, data->getData(frameNum), data->getRawSize(frameNum), surf, LAYER_FOREGROUND, 100, BALLOON_TRANSPARENT_COLOR_BR);
@@ -670,7 +670,7 @@ int BalloonManager_br::createBalloon(int16 w, int16 h, uint16 borderThickness) {
Balloon *balloon = &_intBalloons[id];
balloon->surface = new Graphics::Surface;
- balloon->surface->create(w, h, 1);
+ balloon->surface->create(w, h, Graphics::PixelFormat::createFormatCLUT8());
Common::Rect rect(w, h);
balloon->surface->fillRect(rect, 1);
diff --git a/engines/parallaction/callables_br.cpp b/engines/parallaction/callables_br.cpp
index 21703dc1dd..0bc6f6762c 100644
--- a/engines/parallaction/callables_br.cpp
+++ b/engines/parallaction/callables_br.cpp
@@ -25,6 +25,8 @@
#include "parallaction/parallaction.h"
+#include "common/textconsole.h"
+
namespace Parallaction {
void Parallaction_br::_c_null(void*) {
diff --git a/engines/parallaction/detection.cpp b/engines/parallaction/detection.cpp
index f67a77aa21..8e3c2cbeb8 100644
--- a/engines/parallaction/detection.cpp
+++ b/engines/parallaction/detection.cpp
@@ -28,6 +28,7 @@
#include "common/config-manager.h"
#include "engines/advancedDetector.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "parallaction/parallaction.h"
diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp
index e3d02bac62..944d9f4b55 100644
--- a/engines/parallaction/dialogue.cpp
+++ b/engines/parallaction/dialogue.cpp
@@ -25,6 +25,7 @@
#include "common/events.h"
#include "common/debug-channels.h"
+#include "common/textconsole.h"
#include "parallaction/exec.h"
#include "parallaction/input.h"
#include "parallaction/parallaction.h"
diff --git a/engines/parallaction/disk.cpp b/engines/parallaction/disk.cpp
index 6928c1eefc..d996b72e90 100644
--- a/engines/parallaction/disk.cpp
+++ b/engines/parallaction/disk.cpp
@@ -23,6 +23,9 @@
*
*/
+#include "common/iff_container.h"
+#include "common/textconsole.h"
+
#include "parallaction/disk.h"
#include "parallaction/graphics.h"
@@ -36,7 +39,7 @@ void ILBMLoader::setupBuffer(uint32 w, uint32 h) {
_surf = new Graphics::Surface;
assert(_surf);
}
- _surf->create(w, h, 1);
+ _surf->create(w, h, Graphics::PixelFormat::createFormatCLUT8());
_mode = Graphics::ILBMDecoder::ILBM_UNPACK_PLANES;
_intBuffer = (byte*)_surf->pixels;
break;
diff --git a/engines/parallaction/disk.h b/engines/parallaction/disk.h
index 8ff0efd3c6..9af189af68 100644
--- a/engines/parallaction/disk.h
+++ b/engines/parallaction/disk.h
@@ -29,14 +29,20 @@
#define PATH_LEN 200
#include "common/archive.h"
+#include "common/str.h"
-#include "graphics/surface.h"
#include "graphics/iff.h"
namespace Common {
- class FSDirectory;
+class FSDirectory;
+class ReadStream;
+class SeekableReadStream;
+struct IFFChunk;
}
+namespace Graphics {
+struct Surface;
+}
namespace Parallaction {
diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp
index 34b04cd00f..cea4091ee9 100644
--- a/engines/parallaction/disk_br.cpp
+++ b/engines/parallaction/disk_br.cpp
@@ -27,6 +27,7 @@
#include "common/config-manager.h"
#include "common/fs.h"
+#include "common/textconsole.h"
#include "parallaction/parallaction.h"
#include "parallaction/parser.h"
@@ -227,7 +228,7 @@ void DosDisk_br::loadBitmap(Common::SeekableReadStream &stream, Graphics::Surfac
stream.skip(768);
}
- surf.create(width, height, 1);
+ surf.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
stream.read(surf.pixels, width * height);
}
diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp
index 133b7bef6c..e695fa8798 100644
--- a/engines/parallaction/disk_ns.cpp
+++ b/engines/parallaction/disk_ns.cpp
@@ -27,6 +27,7 @@
#include "common/fs.h"
#include "common/memstream.h"
#include "common/substream.h"
+#include "common/textconsole.h"
#include "parallaction/parser.h"
#include "parallaction/parallaction.h"
@@ -473,7 +474,7 @@ void DosDisk_ns::loadBackground(BackgroundInfo& info, const char *filename) {
}
// read bitmap, mask and path data and extract them into the 3 buffers
- info.bg.create(info.width, info.height, 1);
+ info.bg.create(info.width, info.height, Graphics::PixelFormat::createFormatCLUT8());
createMaskAndPathBuffers(info);
unpackBackground(stream, (byte*)info.bg.pixels, info._mask->data, info._path->data);
diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp
index 99aa27b30f..c879745f65 100644
--- a/engines/parallaction/exec_br.cpp
+++ b/engines/parallaction/exec_br.cpp
@@ -27,6 +27,8 @@
#include "parallaction/input.h"
#include "parallaction/parallaction.h"
+#include "common/textconsole.h"
+
namespace Parallaction {
#define INST_ON 1
diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp
index c8a5ee1548..ee357576d2 100644
--- a/engines/parallaction/exec_ns.cpp
+++ b/engines/parallaction/exec_ns.cpp
@@ -28,6 +28,7 @@
#include "parallaction/parallaction.h"
#include "parallaction/sound.h"
+#include "common/textconsole.h"
namespace Parallaction {
diff --git a/engines/parallaction/font.cpp b/engines/parallaction/font.cpp
index 18f469f0a2..a459e6a600 100644
--- a/engines/parallaction/font.cpp
+++ b/engines/parallaction/font.cpp
@@ -25,6 +25,7 @@
#include "common/endian.h"
#include "common/memstream.h"
+#include "common/textconsole.h"
#include "parallaction/parallaction.h"
diff --git a/engines/parallaction/gfxbase.cpp b/engines/parallaction/gfxbase.cpp
index 6c39b2e696..ca99624ecd 100644
--- a/engines/parallaction/gfxbase.cpp
+++ b/engines/parallaction/gfxbase.cpp
@@ -28,6 +28,7 @@
#include "disk.h"
#include "common/algorithm.h"
+#include "common/textconsole.h"
#include "parallaction/parallaction.h"
namespace Parallaction {
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index 35441d7e3e..d33e733677 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -26,6 +26,8 @@
#include "common/system.h"
#include "common/file.h"
+#include "common/textconsole.h"
+#include "graphics/palette.h"
#include "graphics/primitives.h"
#include "engines/util.h"
@@ -521,7 +523,7 @@ void Gfx::invertBackground(const Common::Rect& r) {
void setupLabelSurface(Graphics::Surface &surf, uint w, uint h) {
- surf.create(w, h, 1);
+ surf.create(w, h, Graphics::PixelFormat::createFormatCLUT8());
surf.fillRect(Common::Rect(w,h), LABEL_TRANSPARENT_COLOR);
}
@@ -857,7 +859,7 @@ void Gfx::setBackground(uint type, BackgroundInfo *info) {
int height = CLIP(info->height, (int)_vm->_screenHeight, info->height);
if (width != _backBuffer.w || height != _backBuffer.h) {
- _backBuffer.create(width, height, 1);
+ _backBuffer.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
}
}
diff --git a/engines/parallaction/gui.cpp b/engines/parallaction/gui.cpp
index c4a36e5362..db70ebb432 100644
--- a/engines/parallaction/gui.cpp
+++ b/engines/parallaction/gui.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/textconsole.h"
+
#include "parallaction/gui.h"
namespace Parallaction {
diff --git a/engines/parallaction/gui_br.cpp b/engines/parallaction/gui_br.cpp
index c80a9940a2..41e3082464 100644
--- a/engines/parallaction/gui_br.cpp
+++ b/engines/parallaction/gui_br.cpp
@@ -24,6 +24,7 @@
*/
#include "common/system.h"
+#include "common/textconsole.h"
#include "parallaction/gui.h"
#include "parallaction/input.h"
@@ -483,7 +484,7 @@ public:
_y = 90;
Graphics::Surface *surf = new Graphics::Surface;
- surf->create(w, 110, 1);
+ surf->create(w, 110, Graphics::PixelFormat::createFormatCLUT8());
surf->fillRect(Common::Rect(0, 0, w, 110), 12);
surf->fillRect(Common::Rect(10, 10, w-10, 100), 15);
diff --git a/engines/parallaction/gui_ns.cpp b/engines/parallaction/gui_ns.cpp
index 51d3ba5799..6b863cc808 100644
--- a/engines/parallaction/gui_ns.cpp
+++ b/engines/parallaction/gui_ns.cpp
@@ -25,6 +25,7 @@
#include "common/system.h"
#include "common/hashmap.h"
+#include "common/textconsole.h"
#include "parallaction/gui.h"
#include "parallaction/input.h"
@@ -474,7 +475,7 @@ class SelectCharacterInputState_NS : public MenuInputState {
public:
SelectCharacterInputState_NS(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("selectcharacter", helper), _vm(vm) {
_keys = (_vm->getPlatform() == Common::kPlatformAmiga && (_vm->getFeatures() & GF_LANG_MULT)) ? _amigaKeys : _pcKeys;
- _block.create(BLOCK_WIDTH, BLOCK_HEIGHT, 1);
+ _block.create(BLOCK_WIDTH, BLOCK_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
_labels[0] = 0;
_labels[1] = 0;
@@ -625,7 +626,7 @@ public:
_vm->_soundManI->stopMusic();
_vm->showSlide("password");
- _emptySlots.create(BLOCK_WIDTH * 8, BLOCK_HEIGHT, 1);
+ _emptySlots.create(BLOCK_WIDTH * 8, BLOCK_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
Common::Rect rect(SLOT_X, SLOT_Y, SLOT_X + BLOCK_WIDTH * 8, SLOT_Y + BLOCK_HEIGHT);
_vm->_gfx->grabBackground(rect, _emptySlots);
diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp
index e508668d80..3a47b14deb 100644
--- a/engines/parallaction/input.cpp
+++ b/engines/parallaction/input.cpp
@@ -25,6 +25,7 @@
#include "common/events.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "graphics/cursorman.h"
#include "parallaction/exec.h"
@@ -486,7 +487,7 @@ void Input::initCursors() {
_donnaCursor = _vm->_disk->loadPointer("pointer3");
Graphics::Surface *surf = new Graphics::Surface;
- surf->create(_mouseComboProps_BR._width, _mouseComboProps_BR._height, 1);
+ surf->create(_mouseComboProps_BR._width, _mouseComboProps_BR._height, Graphics::PixelFormat::createFormatCLUT8());
_comboArrow = new SurfaceToFrames(surf);
// TODO: choose the pointer depending on the active character
@@ -495,12 +496,12 @@ void Input::initCursors() {
} else {
// TODO: Where are the Amiga cursors?
Graphics::Surface *surf1 = new Graphics::Surface;
- surf1->create(_mouseComboProps_BR._width, _mouseComboProps_BR._height, 1);
+ surf1->create(_mouseComboProps_BR._width, _mouseComboProps_BR._height, Graphics::PixelFormat::createFormatCLUT8());
_comboArrow = new SurfaceToFrames(surf1);
// TODO: scale mouse cursor (see staticres.cpp)
Graphics::Surface *surf2 = new Graphics::Surface;
- surf2->create(32, 16, 1);
+ surf2->create(32, 16, Graphics::PixelFormat::createFormatCLUT8());
memcpy(surf2->pixels, _resMouseArrow_BR_Amiga, 32*16);
_mouseArrow = new SurfaceToFrames(surf2);
}
diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp
index 5ead55bbef..2412cc6445 100644
--- a/engines/parallaction/inventory.cpp
+++ b/engines/parallaction/inventory.cpp
@@ -26,7 +26,7 @@
#include "parallaction/input.h"
#include "parallaction/parallaction.h"
-
+#include "common/textconsole.h"
namespace Parallaction {
@@ -141,7 +141,7 @@ void Parallaction::closeInventory() {
InventoryRenderer::InventoryRenderer(Parallaction *vm, InventoryProperties *props, Inventory *inv) : _vm(vm), _props(props), _inv(inv) {
- _surf.create(_props->_width, _props->_height, 1);
+ _surf.create(_props->_width, _props->_height, Graphics::PixelFormat::createFormatCLUT8());
}
InventoryRenderer::~InventoryRenderer() {
diff --git a/engines/parallaction/objects.cpp b/engines/parallaction/objects.cpp
index c345b92ffb..e1306dc956 100644
--- a/engines/parallaction/objects.cpp
+++ b/engines/parallaction/objects.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/textconsole.h"
+
#include "parallaction/parallaction.h"
#include "parallaction/objects.h"
#include "parallaction/parser.h"
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index 3055439e47..516d465671 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -23,13 +23,10 @@
*
*/
-#include "common/config-manager.h"
#include "common/debug-channels.h"
-#include "common/events.h"
#include "common/EventRecorder.h"
-#include "common/file.h"
-#include "common/util.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "parallaction/exec.h"
#include "parallaction/input.h"
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index a8a57ed2d8..b0b1145d2e 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -32,6 +32,7 @@
#include "common/func.h"
#include "common/random.h"
#include "common/savefile.h"
+#include "common/textconsole.h"
#include "engines/engine.h"
@@ -268,7 +269,7 @@ public:
virtual Common::Error run() {
Common::Error err;
err = init();
- if (err != Common::kNoError)
+ if (err.getCode() != Common::kNoError)
return err;
return go();
}
diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp
index 619a4f7559..ca344792cf 100644
--- a/engines/parallaction/parallaction_br.cpp
+++ b/engines/parallaction/parallaction_br.cpp
@@ -25,6 +25,7 @@
#include "common/system.h"
#include "common/util.h"
+#include "common/textconsole.h"
#include "parallaction/parallaction.h"
#include "parallaction/exec.h"
diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp
index ffac22e118..ffc0412b1d 100644
--- a/engines/parallaction/parallaction_ns.cpp
+++ b/engines/parallaction/parallaction_ns.cpp
@@ -25,6 +25,7 @@
#include "common/system.h"
#include "common/config-manager.h"
+#include "common/textconsole.h"
#include "parallaction/parallaction.h"
#include "parallaction/exec.h"
diff --git a/engines/parallaction/parser.cpp b/engines/parallaction/parser.cpp
index c964b74512..a7b926e485 100644
--- a/engines/parallaction/parser.cpp
+++ b/engines/parallaction/parser.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/textconsole.h"
+
#include "parallaction/parallaction.h"
#include "parallaction/parser.h"
diff --git a/engines/parallaction/parser_br.cpp b/engines/parallaction/parser_br.cpp
index 9748be0526..f8818def9a 100644
--- a/engines/parallaction/parser_br.cpp
+++ b/engines/parallaction/parser_br.cpp
@@ -23,6 +23,7 @@
*
*/
+#include "common/textconsole.h"
#include "parallaction/parallaction.h"
#include "parallaction/parser.h"
diff --git a/engines/parallaction/parser_ns.cpp b/engines/parallaction/parser_ns.cpp
index 5053a3d7a5..6c9afe3d85 100644
--- a/engines/parallaction/parser_ns.cpp
+++ b/engines/parallaction/parser_ns.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/textconsole.h"
+
#include "parallaction/parallaction.h"
#include "parallaction/parser.h"
#include "parallaction/sound.h"
diff --git a/engines/parallaction/saveload.cpp b/engines/parallaction/saveload.cpp
index b8116d6bc7..4c77aa3e02 100644
--- a/engines/parallaction/saveload.cpp
+++ b/engines/parallaction/saveload.cpp
@@ -25,6 +25,7 @@
#include "common/savefile.h"
#include "common/config-manager.h"
+#include "common/textconsole.h"
#include "gui/dialog.h"
#include "gui/saveload.h"
@@ -313,7 +314,7 @@ void SaveLoad_ns::renameOldSavefiles() {
if (_saveFileMan->renameSavefile(oldName, newName)) {
success++;
} else {
- warning("Error %i (%s) occurred while renaming %s to %s", _saveFileMan->getError(),
+ warning("Error %i (%s) occurred while renaming %s to %s", _saveFileMan->getError().getCode(),
_saveFileMan->getErrorDesc().c_str(), oldName.c_str(), newName.c_str());
}
}
diff --git a/engines/parallaction/sound_br.cpp b/engines/parallaction/sound_br.cpp
index ee53f9641e..abfaa4bf5d 100644
--- a/engines/parallaction/sound_br.cpp
+++ b/engines/parallaction/sound_br.cpp
@@ -24,6 +24,7 @@
*/
#include "common/stream.h"
+#include "common/textconsole.h"
#include "common/util.h"
#include "audio/mixer.h"
diff --git a/engines/parallaction/sound_ns.cpp b/engines/parallaction/sound_ns.cpp
index ba81314da6..5123695ebc 100644
--- a/engines/parallaction/sound_ns.cpp
+++ b/engines/parallaction/sound_ns.cpp
@@ -24,8 +24,8 @@
*/
#include "common/file.h"
-
#include "common/stream.h"
+#include "common/textconsole.h"
#include "audio/mixer.h"
#include "audio/midiparser.h"
diff --git a/engines/queen/command.cpp b/engines/queen/command.cpp
index 356856e940..87b24735a8 100644
--- a/engines/queen/command.cpp
+++ b/engines/queen/command.cpp
@@ -24,8 +24,6 @@
*/
-#include "common/events.h"
-#include "common/system.h"
#include "queen/command.h"
#include "queen/display.h"
diff --git a/engines/queen/cutaway.cpp b/engines/queen/cutaway.cpp
index 11a8704d60..6fb48c7fb0 100644
--- a/engines/queen/cutaway.cpp
+++ b/engines/queen/cutaway.cpp
@@ -23,6 +23,7 @@
*
*/
+#include "common/textconsole.h"
#include "queen/cutaway.h"
diff --git a/engines/queen/display.cpp b/engines/queen/display.cpp
index b130b27a89..c78fd8ebcc 100644
--- a/engines/queen/display.cpp
+++ b/engines/queen/display.cpp
@@ -29,6 +29,7 @@
#include "common/events.h"
#include "graphics/cursorman.h"
+#include "graphics/palette.h"
#include "queen/display.h"
#include "queen/input.h"
diff --git a/engines/queen/display.h b/engines/queen/display.h
index d3391fc4d3..e7a2ecd4a1 100644
--- a/engines/queen/display.h
+++ b/engines/queen/display.h
@@ -32,8 +32,9 @@
#include "queen/defs.h"
class OSystem;
+
namespace Common {
- struct Rect;
+struct Rect;
}
namespace Queen {
diff --git a/engines/queen/graphics.cpp b/engines/queen/graphics.cpp
index 17e36b1d90..c86f679765 100644
--- a/engines/queen/graphics.cpp
+++ b/engines/queen/graphics.cpp
@@ -34,6 +34,9 @@
#include "queen/resource.h"
#include "queen/sound.h"
+#include "common/debug.h"
+#include "common/textconsole.h"
+
namespace Queen {
void BobSlot::curPos(int16 xx, int16 yy) {
diff --git a/engines/queen/input.cpp b/engines/queen/input.cpp
index 9518388b26..eac855a0cd 100644
--- a/engines/queen/input.cpp
+++ b/engines/queen/input.cpp
@@ -26,6 +26,7 @@
#include "common/events.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "queen/queen.h"
#include "queen/input.h"
diff --git a/engines/queen/journal.cpp b/engines/queen/journal.cpp
index aff24be22e..4200168f07 100644
--- a/engines/queen/journal.cpp
+++ b/engines/queen/journal.cpp
@@ -24,6 +24,7 @@
*/
+#include "common/error.h"
#include "common/events.h"
#include "common/system.h"
#include "queen/journal.h"
diff --git a/engines/queen/logic.cpp b/engines/queen/logic.cpp
index de254300b6..e99a739726 100644
--- a/engines/queen/logic.cpp
+++ b/engines/queen/logic.cpp
@@ -25,8 +25,7 @@
#include "common/config-manager.h"
-#include "common/events.h"
-#include "common/system.h"
+#include "common/textconsole.h"
#include "queen/logic.h"
diff --git a/engines/queen/midiadlib.cpp b/engines/queen/midiadlib.cpp
index b03c90f653..af52f7ed2b 100644
--- a/engines/queen/midiadlib.cpp
+++ b/engines/queen/midiadlib.cpp
@@ -24,6 +24,7 @@
*/
#include "common/endian.h"
+#include "common/textconsole.h"
#include "audio/fmopl.h"
#include "audio/softsynth/emumidi.h"
diff --git a/engines/queen/music.cpp b/engines/queen/music.cpp
index 58ecfa6d16..5d1a06ccb2 100644
--- a/engines/queen/music.cpp
+++ b/engines/queen/music.cpp
@@ -99,8 +99,8 @@ MidiMusic::MidiMusic(QueenEngine *vm)
MidiMusic::~MidiMusic() {
_driver->setTimerCallback(0, 0);
_parser->unloadMusic();
- _driver->close();
delete _parser;
+ _driver->close();
delete _driver;
delete[] _buf;
delete[] _musicData;
diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp
index 519f028cda..0dde5c7b42 100644
--- a/engines/queen/queen.cpp
+++ b/engines/queen/queen.cpp
@@ -32,6 +32,7 @@
#include "common/system.h"
#include "common/events.h"
#include "common/EventRecorder.h"
+#include "common/textconsole.h"
#include "engines/util.h"
diff --git a/engines/queen/queen.h b/engines/queen/queen.h
index 93d705b182..6098a9f5c2 100644
--- a/engines/queen/queen.h
+++ b/engines/queen/queen.h
@@ -30,7 +30,7 @@
#include "common/random.h"
namespace Common {
- class SeekableReadStream;
+class SeekableReadStream;
}
#if defined(_WIN32_WCE) && (_WIN32_WCE <= 300)
diff --git a/engines/queen/resource.cpp b/engines/queen/resource.cpp
index e8519ee68b..62b13e290c 100644
--- a/engines/queen/resource.cpp
+++ b/engines/queen/resource.cpp
@@ -27,6 +27,7 @@
#include "common/endian.h"
#include "common/config-manager.h"
#include "common/substream.h"
+#include "common/textconsole.h"
#include "queen/resource.h"
namespace Queen {
diff --git a/engines/queen/sound.cpp b/engines/queen/sound.cpp
index a34af99ec3..afb77f3969 100644
--- a/engines/queen/sound.cpp
+++ b/engines/queen/sound.cpp
@@ -27,6 +27,7 @@
#include "common/config-manager.h"
#include "common/endian.h"
#include "common/memstream.h"
+#include "common/textconsole.h"
#include "queen/sound.h"
#include "queen/input.h"
diff --git a/engines/queen/sound.h b/engines/queen/sound.h
index cee0463ed1..a89e345791 100644
--- a/engines/queen/sound.h
+++ b/engines/queen/sound.h
@@ -32,7 +32,7 @@
#include "queen/defs.h"
namespace Common {
- class File;
+class File;
}
namespace Queen {
diff --git a/engines/queen/talk.cpp b/engines/queen/talk.cpp
index 106b0d6123..18c712b799 100644
--- a/engines/queen/talk.cpp
+++ b/engines/queen/talk.cpp
@@ -24,9 +24,8 @@
*/
-#include "common/events.h"
-#include "common/system.h"
#include "common/rect.h"
+#include "common/textconsole.h"
#include "queen/talk.h"
diff --git a/engines/queen/walk.cpp b/engines/queen/walk.cpp
index 7765828bd7..a778ea5b05 100644
--- a/engines/queen/walk.cpp
+++ b/engines/queen/walk.cpp
@@ -23,6 +23,7 @@
*
*/
+#include "common/textconsole.h"
#include "queen/walk.h"
diff --git a/engines/saga/gfx.cpp b/engines/saga/gfx.cpp
index 5fc2082178..4930718b67 100644
--- a/engines/saga/gfx.cpp
+++ b/engines/saga/gfx.cpp
@@ -34,6 +34,7 @@
#include "common/system.h"
#include "graphics/cursorman.h"
+#include "graphics/palette.h"
#include "engines/util.h"
namespace Saga {
@@ -46,7 +47,7 @@ Gfx::Gfx(SagaEngine *vm, OSystem *system, int width, int height) : _vm(vm), _sys
debug(5, "Init screen %dx%d", width, height);
// Convert surface data to R surface data
- _backBuffer.create(width, height, 1);
+ _backBuffer.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
// Start with the cursor shown. It will be hidden before the intro, if
// there is an intro. (With boot params, there may not be.)
diff --git a/engines/saga/gfx.h b/engines/saga/gfx.h
index 33fac10c63..56d9104371 100644
--- a/engines/saga/gfx.h
+++ b/engines/saga/gfx.h
@@ -28,6 +28,7 @@
#ifndef SAGA_GFX_H
#define SAGA_GFX_H
+#include "common/rect.h"
#include "graphics/surface.h"
namespace Saga {
diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp
index 5a3b229c9d..c3773b2cb2 100644
--- a/engines/saga/interface.cpp
+++ b/engines/saga/interface.cpp
@@ -1379,9 +1379,7 @@ void Interface::setSave(PanelButton *panelButton) {
fileName = _vm->calcSaveFileName(_vm->getSaveFile(_optionSaveFileTitleNumber)->slotNumber);
_vm->save(fileName, _textInputString);
}
- _vm->getTimerManager()->removeTimerProc(&saveReminderCallback);
- _vm->getTimerManager()->installTimerProc(&saveReminderCallback, TIMETOSAVE, this);
- setSaveReminderState(1);
+ resetSaveReminder();
_textInput = false;
setMode(kPanelOption);
@@ -1393,6 +1391,12 @@ void Interface::setSave(PanelButton *panelButton) {
}
}
+void Interface::resetSaveReminder() {
+ _vm->getTimerManager()->removeTimerProc(&saveReminderCallback);
+ _vm->getTimerManager()->installTimerProc(&saveReminderCallback, TIMETOSAVE, this);
+ setSaveReminderState(1);
+}
+
void Interface::handleOptionUpdate(const Point& mousePoint) {
int16 mouseY;
Rect rect;
@@ -2794,7 +2798,7 @@ void Interface::keyBoss() {
Rect rect;
ByteArray image;
int imageWidth, imageHeight;
- const byte *pal;
+ //const byte *pal;
PalEntry cPal[PAL_ENTRIES];
_vm->_gfx->showCursor(false);
@@ -2814,7 +2818,7 @@ void Interface::keyBoss() {
rect.setHeight(imageHeight);
_vm->_gfx->getCurrentPal(_mapSavedPal);
- pal = _vm->getImagePal(resourceData);
+ //pal = _vm->getImagePal(resourceData);
cPal[0].red = 0;
cPal[0].green = 0;
diff --git a/engines/saga/interface.h b/engines/saga/interface.h
index b9a96653a7..09631bf0e8 100644
--- a/engines/saga/interface.h
+++ b/engines/saga/interface.h
@@ -288,6 +288,8 @@ public:
int32 getProtectHash() { return _protectHash; }
+ void resetSaveReminder();
+
private:
void handleMainUpdate(const Point& mousePoint); // main panel update
void handleMainClick(const Point& mousePoint); // main panel click
diff --git a/engines/saga/introproc_saga2.cpp b/engines/saga/introproc_saga2.cpp
index 5ae80b14c9..7f04474c61 100644
--- a/engines/saga/introproc_saga2.cpp
+++ b/engines/saga/introproc_saga2.cpp
@@ -31,7 +31,10 @@
#include "saga/scene.h"
#include "saga/gfx.h"
-#include "audio/mixer.h"
+#include "common/events.h"
+#include "common/keyboard.h"
+#include "common/system.h"
+#include "common/textconsole.h"
#include "graphics/surface.h"
#include "video/smk_decoder.h"
diff --git a/engines/saga/render.cpp b/engines/saga/render.cpp
index dc9334b037..837a9e5879 100644
--- a/engines/saga/render.cpp
+++ b/engines/saga/render.cpp
@@ -56,7 +56,7 @@ Render::Render(SagaEngine *vm, OSystem *system) {
_vm->getTimerManager()->installTimerProc(&fpsTimerCallback, 1000000, this);
#endif
- _backGroundSurface.create(_vm->getDisplayInfo().width, _vm->getDisplayInfo().height, 1);
+ _backGroundSurface.create(_vm->getDisplayInfo().width, _vm->getDisplayInfo().height, Graphics::PixelFormat::createFormatCLUT8());
_flags = 0;
diff --git a/engines/saga/saga.h b/engines/saga/saga.h
index 52c4b824e7..4df44a2e18 100644
--- a/engines/saga/saga.h
+++ b/engines/saga/saga.h
@@ -31,6 +31,7 @@
#include "common/array.h"
#include "common/random.h"
#include "common/memstream.h"
+#include "common/textconsole.h"
#include "audio/mididrv.h"
#include "saga/gfx.h"
diff --git a/engines/saga/saveload.cpp b/engines/saga/saveload.cpp
index 9edb79fa7c..27300377e9 100644
--- a/engines/saga/saveload.cpp
+++ b/engines/saga/saveload.cpp
@@ -23,10 +23,8 @@
*
*/
-#include "common/config-manager.h"
#include "common/savefile.h"
#include "common/system.h"
-#include "common/file.h"
#include "graphics/thumbnail.h"
#include "saga/saga.h"
@@ -256,6 +254,8 @@ void SagaEngine::save(const char *fileName, const char *saveName) {
warning("Can't write file '%s'. (Disk full?)", fileName);
delete out;
+
+ _interface->resetSaveReminder();
}
void SagaEngine::load(const char *fileName) {
diff --git a/engines/saga/shorten.cpp b/engines/saga/shorten.cpp
index 685cb26aa7..8f0baa9d53 100644
--- a/engines/saga/shorten.cpp
+++ b/engines/saga/shorten.cpp
@@ -24,6 +24,7 @@
*/
#include "common/scummsys.h"
+#include "common/textconsole.h"
#include "saga/shorten.h"
@@ -34,10 +35,8 @@
// FIXME: This doesn't work yet correctly
-#include "common/endian.h"
#include "common/util.h"
-#include "audio/mixer.h"
#include "audio/decoders/raw.h"
namespace Saga {
diff --git a/engines/savestate.cpp b/engines/savestate.cpp
index 368f59ef51..bed19ba3e5 100644
--- a/engines/savestate.cpp
+++ b/engines/savestate.cpp
@@ -25,6 +25,7 @@
#include "engines/savestate.h"
#include "graphics/surface.h"
+#include "common/textconsole.h"
void SaveStateDescriptor::setThumbnail(Graphics::Surface *t) {
if (_thumbnail.get() == t)
diff --git a/engines/savestate.h b/engines/savestate.h
index 37f2b9bdd4..9b64a96aee 100644
--- a/engines/savestate.h
+++ b/engines/savestate.h
@@ -32,7 +32,7 @@
namespace Graphics {
- struct Surface;
+struct Surface;
}
/**
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 7c351c6220..419f5e1415 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -442,7 +442,7 @@ ResourceType parseResourceType(const char *resid) {
}
bool Console::cmdGetVersion(int argc, const char **argv) {
- const char *viewTypeDesc[] = { "Unknown", "EGA", "VGA", "VGA SCI1.1", "Amiga" };
+ const char *viewTypeDesc[] = { "Unknown", "EGA", "Amiga ECS 32 colors", "Amiga AGA 64 colors", "VGA", "VGA SCI1.1" };
bool hasVocab997 = g_sci->getResMan()->testResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SELECTORS)) ? true : false;
Common::String gameVersion = "N/A";
@@ -1532,7 +1532,7 @@ bool Console::cmdUndither(int argc, const char **argv) {
}
bool flag = atoi(argv[1]) ? true : false;
- _engine->_gfxScreen->debugUnditherSetState(flag);
+ _engine->_gfxScreen->enableUndithering(flag);
if (flag)
DebugPrintf("undithering ENABLED\n");
else
diff --git a/engines/sci/decompressor.cpp b/engines/sci/decompressor.cpp
index 73d4ed4198..c122fceeb0 100644
--- a/engines/sci/decompressor.cpp
+++ b/engines/sci/decompressor.cpp
@@ -28,9 +28,8 @@
#include "common/dcl.h"
#include "common/util.h"
#include "common/endian.h"
-#include "common/debug.h"
-#include "common/debug-channels.h"
#include "common/stream.h"
+#include "common/textconsole.h"
#include "sci/decompressor.h"
#include "sci/sci.h"
diff --git a/engines/sci/decompressor.h b/engines/sci/decompressor.h
index 88e24fcc47..8b6f955ddb 100644
--- a/engines/sci/decompressor.h
+++ b/engines/sci/decompressor.h
@@ -28,7 +28,9 @@
#include "common/scummsys.h"
-namespace Common { class ReadStream; }
+namespace Common {
+class ReadStream;
+}
namespace Sci {
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 82522a6e77..0e2f64257a 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -28,6 +28,7 @@
#include "common/file.h"
#include "common/str.h"
#include "common/savefile.h"
+#include "common/system.h"
#include "common/translation.h"
#include "gui/saveload.h"
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index 907e0ba2e4..80425224bf 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -411,7 +411,8 @@ reg_t kMacPlatform(EngineState *s, int argc, reg_t *argv) {
return kIconBar(s, argc - 1, argv + 1);
case 7: // Unknown, but always return -1
return SIGNAL_REG;
- case 1: // Unknown, calls QuickDraw region functions (KQ5, QFG1VGA)
+ case 1: // Unknown, calls QuickDraw region functions (KQ5, QFG1VGA, Dr. Brain 1)
+ break; // removed warning, as it produces a lot of spam in the console
case 2: // Unknown, "UseNextWaitEvent" (Various)
case 3: // Unknown, "ProcessOpenDocuments" (Various)
case 5: // Unknown, plays a sound (KQ7)
diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp
index f93a6716b9..f4392df8f2 100644
--- a/engines/sci/engine/kmovement.cpp
+++ b/engines/sci/engine/kmovement.cpp
@@ -128,7 +128,7 @@ reg_t kSetJump(EngineState *s, int argc, reg_t *argv) {
debugC(kDebugLevelBresen, "c: %d, tmp: %d", c, tmp);
// Compute x step
- if (tmp != 0)
+ if (tmp != 0 && dx != 0)
vx = (int16)((float)(dx * sqrt(gy / (2.0 * tmp))));
else
vx = 0;
diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp
index 911713d0bd..7fb6ac296e 100644
--- a/engines/sci/engine/ksound.cpp
+++ b/engines/sci/engine/ksound.cpp
@@ -32,6 +32,7 @@
#include "sci/sound/soundcmd.h"
#include "audio/mixer.h"
+#include "common/system.h"
namespace Sci {
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index d9bb1c3531..e79af70158 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -175,7 +175,7 @@ reg_t kReadNumber(EngineState *s, int argc, reg_t *argv) {
#define ALIGN_NONE 0
#define ALIGN_RIGHT 1
#define ALIGN_LEFT -1
-#define ALIGN_CENTRE 2
+#define ALIGN_CENTER 2
/* Format(targ_address, textresnr, index_inside_res, ...)
** or
@@ -246,7 +246,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
if (xfer == '0')
fillchar = '0';
else if (xfer == '=')
- align = ALIGN_CENTRE;
+ align = ALIGN_CENTER;
else if (isdigit(xfer) || (xfer == '-'))
source--; // Go to start of length argument
@@ -258,7 +258,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
if (str_leng < 0) {
align = ALIGN_LEFT;
str_leng = -str_leng;
- } else if (align != ALIGN_CENTRE)
+ } else if (align != ALIGN_CENTER)
align = ALIGN_RIGHT;
xfer = *source++;
@@ -298,7 +298,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
*target++ = ' '; /* Format into the text */
break;
- case ALIGN_CENTRE: {
+ case ALIGN_CENTER: {
int half_extralen = extralen >> 1;
while (half_extralen-- > 0)
*target++ = ' '; /* Format into the text */
@@ -315,7 +315,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
switch (align) {
- case ALIGN_CENTRE: {
+ case ALIGN_CENTER: {
int half_extralen;
align = 0;
half_extralen = extralen - (extralen >> 1);
diff --git a/engines/sci/engine/kvideo.cpp b/engines/sci/engine/kvideo.cpp
index 6a411d8e23..a8d4437148 100644
--- a/engines/sci/engine/kvideo.cpp
+++ b/engines/sci/engine/kvideo.cpp
@@ -29,7 +29,14 @@
#include "sci/graphics/cursor.h"
#include "sci/graphics/palette.h"
#include "sci/graphics/screen.h"
-#include "graphics/cursorman.h"
+#include "common/events.h"
+#include "common/keyboard.h"
+#include "common/str.h"
+#include "common/system.h"
+#include "common/textconsole.h"
+#include "graphics/pixelformat.h"
+#include "graphics/surface.h"
+#include "video/video_decoder.h"
#include "video/avi_decoder.h"
#include "video/qt_decoder.h"
#include "sci/video/seq_decoder.h"
diff --git a/engines/sci/engine/object.h b/engines/sci/engine/object.h
index 81d5b2c983..8ae06f2707 100644
--- a/engines/sci/engine/object.h
+++ b/engines/sci/engine/object.h
@@ -28,6 +28,7 @@
#include "common/array.h"
#include "common/serializer.h"
+#include "common/textconsole.h"
#include "sci/sci.h" // for the SCI versions
#include "sci/engine/vm_types.h" // for reg_t
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp
index fb96518f19..25bf91c3ad 100644
--- a/engines/sci/engine/script.cpp
+++ b/engines/sci/engine/script.cpp
@@ -611,7 +611,7 @@ void Script::initialiseObjectsSci0(SegManager *segMan, SegmentId segmentId) {
// #3150767.
// Same happens with script 764, it seems to
// contain junk towards its end.
- _objects.erase(addr.toUint16() + (getSciVersion() < SCI_VERSION_1_1) ? 8 : 0);
+ _objects.erase(addr.toUint16() - SCRIPT_OBJECT_MAGIC_OFFSET);
} else {
error("Failed to locate base object for object at %04X:%04X", PRINT_REG(addr));
}
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 54ae88a17e..06540e6f43 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -874,9 +874,50 @@ const uint16 qfg3PatchDialogCrash[] = {
PATCH_END
};
+// Part of script 47 that handles the barter icon checks for the wrong local.
+// The local is supposed to contain the value returned by a previous kDisplay
+// call, but since the wrong one is checked, it contains junk instead. We
+// remove that check here (this doesn't affect the game at all). This occurs
+// when attempting to purchase something from a vendor and the barter button is
+// available (e.g. when buying the robe or meat from the associated vendors).
+// Fixes bug #3292251.
+const byte qfg3BarterCrash[] = {
+ 22,
+ 0x83, 0x10, // lal 10 ---> BUG! Wrong local
+ 0x30, 0x11, 0x00, // bnt 0011 ---> the accumulator will now contain garbage, so this check fails
+ 0x35, 0x00, // ldi 00
+ 0xa5, 0x00, // sat 00
+ 0x39, 0x03, // pushi 03
+ 0x5b, 0x04, 0x00, // lea 04 00
+ 0x36, // push
+ 0x39, 0x6c, // pushi 6c
+ 0x8b, 0x10, // lsl 10 ---> local 10 contains garbage, so the call below will fail
+ 0x43, 0x1b, 0x06 // callk Display[1b] 06
+};
+
+// Same as above, but for local 0x11
+const byte qfg3BarterCrash2[] = {
+ 18,
+ 0x83, 0x11, // lal 11 ---> BUG! Wrong local
+ 0x30, 0x0d, 0x00, // bnt 000d ---> the accumulator will now contain garbage, so this check fails
+ 0x39, 0x03, // pushi 03
+ 0x5b, 0x04, 0x00, // lea 04 00
+ 0x36, // push
+ 0x39, 0x6c, // pushi 6c
+ 0x8b, 0x11, // lsl 11 ---> local 11 contains garbage, so the call below will fail
+ 0x43, 0x1b, 0x06 // callk Display[1b] 06
+};
+
+const uint16 qfg3PatchBarterCrash[] = {
+ 0x35, 0x00, // ldi 00 ---> the accumulator will always be zero, so the problematic code won't run
+ PATCH_END
+};
+
// script, description, magic DWORD, adjust
const SciScriptSignature qfg3Signatures[] = {
{ 23, "dialog crash", 1, PATCH_MAGICDWORD(0xe7, 0x03, 0x22, 0x33), -1, qfg3DialogCrash, qfg3PatchDialogCrash },
+ { 47, "barter crash", 1, PATCH_MAGICDWORD(0x83, 0x10, 0x30, 0x11), 0, qfg3BarterCrash, qfg3PatchBarterCrash },
+ { 47, "barter crash 2", 1, PATCH_MAGICDWORD(0x83, 0x11, 0x30, 0x0d), 0, qfg3BarterCrash2, qfg3PatchBarterCrash },
{ 944, "import dialog continuous calls", 1, PATCH_MAGICDWORD(0x2a, 0x31, 0x0b, 0x7a), -1, qfg3SignatureImportDialog, qfg3PatchImportDialog },
SCI_SIGNATUREENTRY_TERMINATOR
};
diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h
index d91118ec1e..cd6d56500a 100644
--- a/engines/sci/engine/state.h
+++ b/engines/sci/engine/state.h
@@ -32,8 +32,8 @@
#include "common/str-array.h"
namespace Common {
- class SeekableReadStream;
- class WriteStream;
+class SeekableReadStream;
+class WriteStream;
}
#include "sci/sci.h"
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index d209a0ca5b..b441815014 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -25,8 +25,6 @@
#include "common/debug.h"
#include "common/debug-channels.h"
-#include "common/stack.h"
-#include "common/config-manager.h"
#include "sci/sci.h"
#include "sci/console.h"
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 0fba7a59e3..20d6cd0dd0 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -74,6 +74,11 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
{ GID_HOYLE4, -1, 0, 0, NULL, "open", -1, -1, { WORKAROUND_FAKE, 0 } }, // when selecting "Control" from the menu (temp vars 0-3) - bug #3039294
{ GID_HOYLE4, 910, 18, 0, NULL, "init", -1, 0, { WORKAROUND_FAKE, 0 } }, // during tutorial - bug #3042756
{ GID_HOYLE4, 910, 910, 0, NULL, "setup", -1, 3, { WORKAROUND_FAKE, 0 } }, // when selecting "Tutorial" from the main menu - bug #3039294
+ { GID_HOYLE4, 700, 718, 0, "compete_tree", "doit", -1, 75, { WORKAROUND_FAKE, 0 } }, // when placing a bid in bridge - bug #3292332
+ { GID_HOYLE4, 700, 716, 0, "other1_tree", "doit", -1, 46, { WORKAROUND_FAKE, 0 } }, // sometimes when placing a bid in bridge
+ { GID_HOYLE4, 700, 700, 1, "BridgeHand", "calcQTS", -1, 3, { WORKAROUND_FAKE, 0 } }, // sometimes when placing a bid in bridge
+ { GID_HOYLE4, 300, 300, 0, "", "export 2", 0x1d4d, 0, { WORKAROUND_FAKE, 0 } }, // after passing around cards in hearts
+ { GID_HOYLE4, 400, 400, 1, "GinHand", "calcRuns", -1, 4, { WORKAROUND_FAKE, 0 } }, // sometimes while playing Gin Rummy (e.g. when knocking and placing a card) - bug #3292334
{ GID_ISLANDBRAIN, 100, 937, 0, "IconBar", "dispatchEvent", -1, 58, { WORKAROUND_FAKE, 0 } }, // when using ENTER at the startup menu - bug #3045225
{ GID_ISLANDBRAIN, 140, 140, 0, "piece", "init", -1, 3, { WORKAROUND_FAKE, 1 } }, // first puzzle right at the start, some initialization variable. bnt is done on it, and it should be non-0
{ GID_ISLANDBRAIN, 200, 268, 0, "anElement", "select", -1, 0, { WORKAROUND_FAKE, 0 } }, // elements puzzle, gets used before super TextIcon
@@ -251,6 +256,7 @@ const SciWorkaroundEntry kGetAngle_workarounds[] = {
// gameID, room,script,lvl, object-name, method-name, call,index, workaround
const SciWorkaroundEntry kFindKey_workarounds[] = {
{ GID_ECOQUEST2, 100, 999, 0, "myList", "contains", -1, 0, { WORKAROUND_FAKE, 0 } }, // When Noah Greene gives Adam the Ecorder, and just before the game gives a demonstration, a null reference to a list is passed - bug #3035186
+ { GID_HOYLE4, 300, 999, 0, "Piles", "contains", -1, 0, { WORKAROUND_FAKE, 0 } }, // When passing the three cards in Hearts, a null reference to a list is passed - bug #3292333
SCI_WORKAROUNDENTRY_TERMINATOR
};
diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp
index 3b95a5c955..d4d7dcfd4f 100644
--- a/engines/sci/graphics/cursor.cpp
+++ b/engines/sci/graphics/cursor.cpp
@@ -25,11 +25,11 @@
#include "common/config-manager.h"
#include "common/events.h"
-#include "common/macresman.h"
#include "common/memstream.h"
#include "common/system.h"
#include "common/util.h"
#include "graphics/cursorman.h"
+#include "graphics/maccursor.h"
#include "sci/sci.h"
#include "sci/event.h"
@@ -473,49 +473,19 @@ void GfxCursor::kernelSetMacCursor(GuiResourceId viewNum, int loopNum, int celNu
assert(resource);
- if (resource->size == 32 * 2 + 4) {
- // Mac CURS cursor
- // See http://developer.apple.com/legacy/mac/library/documentation/mac/QuickDraw/QuickDraw-402.html
- // for more information.
- byte *cursorBitmap = new byte[16 * 16];
- byte *data = resource->data;
-
- // Get B&W data
- for (byte i = 0; i < 32; i++) {
- byte imageByte = *data++;
- for (byte b = 0; b < 8; b++)
- cursorBitmap[i * 8 + b] = (byte)((imageByte & (0x80 >> b)) > 0 ? 1 : 2);
- }
-
- // Apply mask data
- for (byte i = 0; i < 32; i++) {
- byte imageByte = *data++;
- for (byte b = 0; b < 8; b++)
- if ((imageByte & (0x80 >> b)) == 0)
- cursorBitmap[i * 8 + b] = 0; // Doesn't matter, just is transparent
- }
-
- uint16 hotspotY = READ_BE_UINT16(data);
- uint16 hotspotX = READ_BE_UINT16(data + 2);
-
- static const byte cursorPalette[] = { 0x00, 0x00, 0x00, 0xff, 0xff, 0xff };
-
- CursorMan.replaceCursor(cursorBitmap, 16, 16, hotspotX, hotspotY, 0);
- CursorMan.replaceCursorPalette(cursorPalette, 1, 2);
+ Common::MemoryReadStream resStream(resource->data, resource->size);
+ Graphics::MacCursor *macCursor = new Graphics::MacCursor();
- delete[] cursorBitmap;
- } else {
- // Mac crsr cursor
- byte *cursorBitmap, *palette;
- int width, height, hotspotX, hotspotY, palSize, keycolor;
- Common::MemoryReadStream resStream(resource->data, resource->size);
- Common::MacResManager::convertCrsrCursor(&resStream, &cursorBitmap, width, height, hotspotX, hotspotY, keycolor, true, &palette, palSize);
- CursorMan.replaceCursor(cursorBitmap, width, height, hotspotX, hotspotY, keycolor);
- CursorMan.replaceCursorPalette(palette, 0, palSize);
- delete[] cursorBitmap;
- delete[] palette;
+ if (!macCursor->readFromStream(resStream)) {
+ warning("Failed to load Mac cursor %d", viewNum);
+ return;
}
+ CursorMan.replaceCursor(macCursor->getSurface(), macCursor->getWidth(), macCursor->getHeight(),
+ macCursor->getHotspotX(), macCursor->getHotspotY(), macCursor->getKeyColor());
+ CursorMan.replaceCursorPalette(macCursor->getPalette(), 0, 256);
+
+ delete macCursor;
kernelShow();
}
diff --git a/engines/sci/graphics/fontsjis.h b/engines/sci/graphics/fontsjis.h
index 684e6cac5e..5538b5c2c5 100644
--- a/engines/sci/graphics/fontsjis.h
+++ b/engines/sci/graphics/fontsjis.h
@@ -29,7 +29,7 @@
#include "sci/graphics/helpers.h"
namespace Graphics {
- class FontSJIS;
+class FontSJIS;
}
namespace Sci {
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index dd55b3b060..7fafe843fd 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -23,9 +23,15 @@
*
*/
-#include "common/util.h"
-#include "common/stack.h"
-#include "graphics/primitives.h"
+#include "common/algorithm.h"
+#include "common/events.h"
+#include "common/keyboard.h"
+#include "common/list_intern.h"
+#include "common/str.h"
+#include "common/system.h"
+#include "common/textconsole.h"
+#include "engines/engine.h"
+#include "graphics/surface.h"
#include "sci/sci.h"
#include "sci/engine/kernel.h"
diff --git a/engines/sci/graphics/maciconbar.h b/engines/sci/graphics/maciconbar.h
index 3ac5475147..72609d19ab 100644
--- a/engines/sci/graphics/maciconbar.h
+++ b/engines/sci/graphics/maciconbar.h
@@ -31,7 +31,7 @@
#include "sci/engine/vm.h"
namespace Graphics {
- struct Surface;
+struct Surface;
}
namespace Sci {
diff --git a/engines/sci/graphics/paint.cpp b/engines/sci/graphics/paint.cpp
index c347da3c0f..27a0bdfc44 100644
--- a/engines/sci/graphics/paint.cpp
+++ b/engines/sci/graphics/paint.cpp
@@ -23,8 +23,6 @@
*
*/
-#include "common/util.h"
-#include "common/stack.h"
#include "graphics/primitives.h"
#include "sci/sci.h"
diff --git a/engines/sci/graphics/paint16.cpp b/engines/sci/graphics/paint16.cpp
index ff738fc3b9..5172f7cdc0 100644
--- a/engines/sci/graphics/paint16.cpp
+++ b/engines/sci/graphics/paint16.cpp
@@ -23,11 +23,6 @@
*
*/
-#include "common/util.h"
-#include "common/stack.h"
-#include "common/system.h"
-#include "graphics/primitives.h"
-
#include "sci/sci.h"
#include "sci/engine/features.h"
#include "sci/engine/state.h"
@@ -302,6 +297,11 @@ void GfxPaint16::bitsShow(const Common::Rect &rect) {
return;
_ports->offsetRect(workerRect);
+
+ // We adjust the left/right coordinates to even coordinates
+ workerRect.left &= 0xFFFE; // round down
+ workerRect.right = (workerRect.right + 1) & 0xFFFE; // round up
+
_screen->copyRectToScreen(workerRect);
}
@@ -472,6 +472,7 @@ void GfxPaint16::kernelGraphRedrawBox(Common::Rect rect) {
#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_DONTSHOWBITS 121
reg_t GfxPaint16::kernelDisplay(const char *text, int argc, reg_t *argv) {
@@ -542,9 +543,10 @@ reg_t GfxPaint16::kernelDisplay(const char *text, int argc, reg_t *argv) {
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)
+ // 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))
error("Unknown kDisplay argument %d", displayArg.offset);
if (displayArg.offset == SCI_DISPLAY_DUMMY2) {
diff --git a/engines/sci/graphics/paint32.cpp b/engines/sci/graphics/paint32.cpp
index 69a278eb8b..f277436631 100644
--- a/engines/sci/graphics/paint32.cpp
+++ b/engines/sci/graphics/paint32.cpp
@@ -23,11 +23,6 @@
*
*/
-#include "common/util.h"
-#include "common/stack.h"
-
-#include "graphics/primitives.h"
-
#include "sci/sci.h"
#include "sci/engine/state.h"
#include "sci/engine/selector.h"
diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp
index 0433479a09..42551e9369 100644
--- a/engines/sci/graphics/palette.cpp
+++ b/engines/sci/graphics/palette.cpp
@@ -28,6 +28,8 @@
#include "common/util.h"
#include "common/system.h"
+#include "graphics/palette.h"
+
#include "sci/sci.h"
#include "sci/engine/state.h"
#include "sci/graphics/cache.h"
diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp
index 82aae5399f..8cdd46268a 100644
--- a/engines/sci/graphics/picture.cpp
+++ b/engines/sci/graphics/picture.cpp
@@ -509,10 +509,12 @@ void GfxPicture::drawVectorData(byte *data, int dataSize) {
memcpy(&EGApriority, &vector_defaultEGApriority, sizeof(vector_defaultEGApriority));
if (g_sci->getGameId() == GID_ICEMAN) {
- // WORKAROUND: we remove certain visual&priority lines in underwater rooms of iceman, when not dithering the
- // picture. Normally those lines aren't shown, because they share the same color as the dithered
- // fill color combination. When not dithering, those lines would appear and get distracting.
- if ((_screen->getUnditherState()) && ((_resourceId >= 53 && _resourceId <= 58) || (_resourceId == 61)))
+ // WORKAROUND: we remove certain visual&priority lines in underwater
+ // rooms of iceman, when not dithering the picture. Normally those
+ // lines aren't shown, because they share the same color as the
+ // dithered fill color combination. When not dithering, those lines
+ // would appear and get distracting.
+ if ((_screen->isUnditheringEnabled()) && ((_resourceId >= 53 && _resourceId <= 58) || (_resourceId == 61)))
icemanDrawFix = true;
}
if (g_sci->getGameId() == GID_KQ5) {
@@ -618,14 +620,17 @@ void GfxPicture::drawVectorData(byte *data, int dataSize) {
}
break;
- // Pattern opcodes are handled in sierra sci1.1+ as actual NOPs and normally they definitely should not occur
- // inside picture data for such games
+ // Pattern opcodes are handled in sierra sci1.1+ as actual NOPs and
+ // normally they definitely should not occur inside picture data for
+ // such games.
case PIC_OP_SET_PATTERN:
if (_resourceType >= SCI_PICTURE_TYPE_SCI11) {
if (g_sci->getGameId() == GID_SQ4) {
- // WORKAROUND: For SQ4 / for some pictures handle this like a terminator
- // This picture includes garbage data, first a set pattern w/o parameter and then short pattern
- // I guess that garbage is a left over from the sq4-floppy (sci1) to sq4-cd (sci1.1) conversion
+ // WORKAROUND: For SQ4 / for some pictures handle this like
+ // a terminator. This picture includes garbage data, first a
+ // set pattern w/o parameter and then short pattern. I guess
+ // that garbage is a left over from the sq4-floppy (sci1) to
+ // sq4-cd (sci1.1) conversion.
switch (_resourceId) {
case 35:
case 381:
@@ -857,7 +862,8 @@ void GfxPicture::vectorGetPatternTexture(byte *data, int &curPos, int16 pattern_
}
}
-// Do not replace w/ some generic code. This algo really needs to behave exactly as the one from sierra
+// WARNING: Do not replace the following code with something else, like generic
+// code. This algo really needs to behave exactly as the one from sierra.
void GfxPicture::vectorFloodFill(int16 x, int16 y, byte color, byte priority, byte control) {
Port *curPort = _ports->getPort();
Common::Stack<Common::Point> stack;
diff --git a/engines/sci/graphics/portrait.cpp b/engines/sci/graphics/portrait.cpp
index 6e9df2f019..3f9ebaa07a 100644
--- a/engines/sci/graphics/portrait.cpp
+++ b/engines/sci/graphics/portrait.cpp
@@ -24,9 +24,7 @@
*/
#include "common/archive.h"
-#include "common/util.h"
-#include "common/stack.h"
-#include "graphics/primitives.h"
+#include "common/system.h"
#include "sci/sci.h"
#include "sci/event.h"
diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp
index f619780c7c..56e6759fac 100644
--- a/engines/sci/graphics/screen.cpp
+++ b/engines/sci/graphics/screen.cpp
@@ -111,7 +111,7 @@ GfxScreen::GfxScreen(ResourceManager *resMan) : _resMan(resMan) {
_picNotValid = 0;
_picNotValidSci11 = 0;
- _unditherState = true;
+ _unditheringEnabled = true;
_fontIsUpscaled = false;
if (_resMan->getViewType() != kViewEga) {
@@ -560,7 +560,7 @@ void GfxScreen::dither(bool addToFlag) {
byte *visualPtr = _visualScreen;
byte *displayPtr = _displayScreen;
- if (!_unditherState) {
+ if (!_unditheringEnabled) {
// Do dithering on visual and display-screen
for (y = 0; y < _height; y++) {
for (x = 0; x < _width; x++) {
@@ -624,13 +624,13 @@ void GfxScreen::ditherForceDitheredColor(byte color) {
_ditheredPicColors[color] = 256;
}
-void GfxScreen::debugUnditherSetState(bool flag) {
- _unditherState = flag;
+void GfxScreen::enableUndithering(bool flag) {
+ _unditheringEnabled = flag;
}
int16 *GfxScreen::unditherGetDitheredBgColors() {
- if (_unditherState)
- return (int16 *)&_ditheredPicColors;
+ if (_unditheringEnabled)
+ return _ditheredPicColors;
else
return NULL;
}
diff --git a/engines/sci/graphics/screen.h b/engines/sci/graphics/screen.h
index 89ad52e0ac..bfe0a50b81 100644
--- a/engines/sci/graphics/screen.h
+++ b/engines/sci/graphics/screen.h
@@ -95,9 +95,10 @@ public:
return _upscaledHires;
}
- bool getUnditherState() const {
- return _unditherState;
+ bool isUnditheringEnabled() const {
+ return _unditheringEnabled;
}
+ void enableUndithering(bool flag);
void putKanjiChar(Graphics::FontSJIS *commonFont, int16 x, int16 y, uint16 chr, byte color);
byte getVisual(int x, int y);
@@ -119,7 +120,6 @@ public:
// Force a color combination as a dithered color
void ditherForceDitheredColor(byte color);
- void debugUnditherSetState(bool flag);
int16 *unditherGetDitheredBgColors();
void debugShowMap(int mapNo);
@@ -151,7 +151,10 @@ private:
void setVerticalShakePos(uint16 shakePos);
- bool _unditherState;
+ /**
+ * If this flag is true, undithering is enabled, otherwise disabled.
+ */
+ bool _unditheringEnabled;
int16 _ditheredPicColors[DITHERED_BG_COLORS_SIZE];
// These screens have the real resolution of the game engine (320x200 for
@@ -161,13 +164,13 @@ private:
byte *_priorityScreen;
byte *_controlScreen;
- // This screen is the one that is actually displayed to the user. It may be
- // 640x400 for japanese SCI1 games. SCI0 games may be undithered in here.
- // Only read from this buffer for Save/ShowBits usage.
+ /**
+ * This screen is the one that is actually displayed to the user. It may be
+ * 640x400 for japanese SCI1 games. SCI0 games may be undithered in here.
+ * Only read from this buffer for Save/ShowBits usage.
+ */
byte *_displayScreen;
- Common::Rect getScaledRect(Common::Rect rect);
-
ResourceManager *_resMan;
/**
@@ -176,16 +179,22 @@ private:
*/
byte *_activeScreen;
- // This variable defines, if upscaled hires is active and what upscaled mode
- // is used.
+ /**
+ * This variable defines, if upscaled hires is active and what upscaled mode
+ * is used.
+ */
GfxScreenUpscaledMode _upscaledHires;
- // This here holds a translation for vertical coordinates between native
- // (visual) and actual (display) screen.
+ /**
+ * This here holds a translation for vertical coordinates between native
+ * (visual) and actual (display) screen.
+ */
int _upscaledMapping[SCI_SCREEN_UPSCALEDMAXHEIGHT + 1];
- // This defines whether or not the font we're drawing is already scaled
- // to the screen size (and we therefore should not upscale it ourselves).
+ /**
+ * This defines whether or not the font we're drawing is already scaled
+ * to the screen size (and we therefore should not upscale it ourselves).
+ */
bool _fontIsUpscaled;
uint16 getLowResScreenHeight();
diff --git a/engines/sci/graphics/transitions.cpp b/engines/sci/graphics/transitions.cpp
index fb124055d6..dde1be13ab 100644
--- a/engines/sci/graphics/transitions.cpp
+++ b/engines/sci/graphics/transitions.cpp
@@ -24,9 +24,8 @@
*/
#include "common/events.h"
-#include "common/util.h"
-#include "common/stack.h"
#include "common/system.h"
+#include "graphics/palette.h"
#include "graphics/surface.h"
#include "sci/sci.h"
diff --git a/engines/sci/parser/grammar.cpp b/engines/sci/parser/grammar.cpp
index 77db56adba..b330a432e3 100644
--- a/engines/sci/parser/grammar.cpp
+++ b/engines/sci/parser/grammar.cpp
@@ -31,6 +31,7 @@
#include "sci/parser/vocabulary.h"
#include "sci/console.h"
#include "common/array.h"
+#include "common/textconsole.h"
namespace Sci {
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 4caa77b0ae..a48ae0fad7 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -28,6 +28,7 @@
#include "common/file.h"
#include "common/fs.h"
#include "common/macresman.h"
+#include "common/textconsole.h"
#include "sci/resource.h"
#include "sci/resource_intern.h"
@@ -1275,7 +1276,7 @@ ResVersion ResourceManager::detectVolVersion() {
// SCI32 volume format: {bResType wResNumber dwPacked dwUnpacked wCompression} = 13 bytes
// Try to parse volume with SCI0 scheme to see if it make sense
// Checking 1MB of data should be enough to determine the version
- uint16 resId, wCompression;
+ uint16 wCompression;
uint32 dwPacked, dwUnpacked;
ResVersion curVersion = kResVersionSci0Sci1Early;
bool failed = false;
@@ -1285,7 +1286,7 @@ ResVersion ResourceManager::detectVolVersion() {
while (!fileStream->eos() && fileStream->pos() < 0x100000) {
if (curVersion > kResVersionSci0Sci1Early)
fileStream->readByte();
- resId = fileStream->readUint16LE();
+ fileStream->skip(2); // resId
dwPacked = (curVersion < kResVersionSci2) ? fileStream->readUint16LE() : fileStream->readUint32LE();
dwUnpacked = (curVersion < kResVersionSci2) ? fileStream->readUint16LE() : fileStream->readUint32LE();
diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp
index 6e74553f56..1e0b9c0ddf 100644
--- a/engines/sci/resource_audio.cpp
+++ b/engines/sci/resource_audio.cpp
@@ -27,6 +27,7 @@
#include "common/archive.h"
#include "common/file.h"
+#include "common/textconsole.h"
#include "sci/resource.h"
#include "sci/resource_intern.h"
diff --git a/engines/sci/resource_intern.h b/engines/sci/resource_intern.h
index 98cca6283c..969e250e62 100644
--- a/engines/sci/resource_intern.h
+++ b/engines/sci/resource_intern.h
@@ -29,7 +29,7 @@
#include "sci/resource.h"
namespace Common {
- class MacResManager;
+class MacResManager;
}
namespace Sci {
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 85c2eced19..8a81ea7240 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -218,7 +218,7 @@ Common::Error SciEngine::run() {
// Initialize the game screen
_gfxScreen = new GfxScreen(_resMan);
- _gfxScreen->debugUnditherSetState(ConfMan.getBool("disable_dithering"));
+ _gfxScreen->enableUndithering(ConfMan.getBool("disable_dithering"));
// Create debugger console. It requires GFX to be initialized
_console = new Console(this);
diff --git a/engines/sci/sound/drivers/adlib.cpp b/engines/sci/sound/drivers/adlib.cpp
index 65a8e2e3da..f00c99d5b5 100644
--- a/engines/sci/sound/drivers/adlib.cpp
+++ b/engines/sci/sound/drivers/adlib.cpp
@@ -26,6 +26,8 @@
#include "sci/sci.h"
#include "common/file.h"
+#include "common/system.h"
+#include "common/textconsole.h"
#include "audio/fmopl.h"
#include "audio/softsynth/emumidi.h"
diff --git a/engines/sci/sound/drivers/amigamac.cpp b/engines/sci/sound/drivers/amigamac.cpp
index d64dfac23c..7ee8d21f86 100644
--- a/engines/sci/sound/drivers/amigamac.cpp
+++ b/engines/sci/sound/drivers/amigamac.cpp
@@ -30,6 +30,8 @@
#include "common/file.h"
#include "common/frac.h"
#include "common/memstream.h"
+#include "common/system.h"
+#include "common/textconsole.h"
#include "common/util.h"
namespace Sci {
@@ -132,6 +134,7 @@ private:
};
bool _isSci1;
+ bool _isSci1Early; // KQ1 Amiga, patch 5
bool _playSwitch;
int _masterVolume;
int _frequency;
@@ -557,6 +560,7 @@ uint32 MidiDriver_AmigaMac::property(int prop, uint32 param) {
int MidiDriver_AmigaMac::open() {
_isSci1 = false;
+ _isSci1Early = false;
for (int i = 0; i < 48; i++)
_freqTable[i] = pow(2, i / (double)48);
@@ -589,9 +593,15 @@ int MidiDriver_AmigaMac::open() {
} else {
ResourceManager *resMan = g_sci->getResMan();
- Resource *resource = resMan->findResource(ResourceId(kResourceTypePatch, 7), false);
+ Resource *resource = resMan->findResource(ResourceId(kResourceTypePatch, 7), false); // Mac
if (!resource)
- resource = resMan->findResource(ResourceId(kResourceTypePatch, 9), false);
+ resource = resMan->findResource(ResourceId(kResourceTypePatch, 9), false); // Amiga
+
+ if (!resource) {
+ resource = resMan->findResource(ResourceId(kResourceTypePatch, 5), false); // KQ1 Amiga
+ if (resource)
+ _isSci1Early = true;
+ }
// If we have a patch by this point, it's SCI1
if (resource)
@@ -896,6 +906,9 @@ bool MidiDriver_AmigaMac::loadInstrumentsSCI0Mac(Common::SeekableReadStream &fil
bool MidiDriver_AmigaMac::loadInstrumentsSCI1(Common::SeekableReadStream &file) {
_bank.size = 128;
+ if (_isSci1Early)
+ file.skip(4); // TODO: What is this offset for?
+
Common::Array<uint32> instrumentOffsets;
instrumentOffsets.resize(_bank.size);
_bank.instruments.resize(_bank.size);
@@ -908,11 +921,17 @@ bool MidiDriver_AmigaMac::loadInstrumentsSCI1(Common::SeekableReadStream &file)
if (instrumentOffsets[i] == 0)
continue;
- file.seek(instrumentOffsets[i]);
+ file.seek(instrumentOffsets[i] + (_isSci1Early ? 4 : 0));
// 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));
diff --git a/engines/sci/sound/drivers/cms.cpp b/engines/sci/sound/drivers/cms.cpp
index 051fa7f1fd..47c59a1e3d 100644
--- a/engines/sci/sound/drivers/cms.cpp
+++ b/engines/sci/sound/drivers/cms.cpp
@@ -29,6 +29,8 @@
#include "audio/softsynth/cms.h"
#include "audio/mixer.h"
+#include "common/system.h"
+
#include "sci/resource.h"
namespace Sci {
diff --git a/engines/sci/sound/drivers/fb01.cpp b/engines/sci/sound/drivers/fb01.cpp
index 971c2ff92d..f217738bb2 100644
--- a/engines/sci/sound/drivers/fb01.cpp
+++ b/engines/sci/sound/drivers/fb01.cpp
@@ -30,6 +30,7 @@
#include "common/file.h"
#include "common/system.h"
+#include "common/textconsole.h"
namespace Sci {
diff --git a/engines/sci/sound/drivers/midi.cpp b/engines/sci/sound/drivers/midi.cpp
index 9eef867aeb..f36aac3a2a 100644
--- a/engines/sci/sound/drivers/midi.cpp
+++ b/engines/sci/sound/drivers/midi.cpp
@@ -745,7 +745,7 @@ uint8 MidiPlayer_Midi::getGmInstrument(const Mt32ToGmMap &Mt32Ins) {
void MidiPlayer_Midi::mapMt32ToGm(byte *data, size_t size) {
// FIXME: Clean this up
int memtimbres, patches;
- uint8 group, number, keyshift, finetune, bender_range;
+ uint8 group, number, keyshift, /*finetune,*/ bender_range;
uint8 *patchpointer;
uint32 pos;
int i;
@@ -784,7 +784,7 @@ void MidiPlayer_Midi::mapMt32ToGm(byte *data, size_t size) {
group = *patchpointer;
number = *(patchpointer + 1);
keyshift = *(patchpointer + 2);
- finetune = *(patchpointer + 3);
+ //finetune = *(patchpointer + 3);
bender_range = *(patchpointer + 4);
debugCN(kDebugLevelSound, " [%03d] ", i);
diff --git a/engines/sci/sound/drivers/pcjr.cpp b/engines/sci/sound/drivers/pcjr.cpp
index 063332577e..4b1efb3c87 100644
--- a/engines/sci/sound/drivers/pcjr.cpp
+++ b/engines/sci/sound/drivers/pcjr.cpp
@@ -27,6 +27,9 @@
#include "audio/softsynth/emumidi.h"
+#include "common/debug.h"
+#include "common/system.h"
+
namespace Sci {
#define VOLUME_SHIFT 3
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index 9ad964b67e..a2b09eab4c 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -325,14 +325,6 @@ reg_t SoundCommandParser::kDoSoundFade(int argc, reg_t *argv, reg_t acc) {
return acc;
}
- // If the current volume of the slot is the same as the target volume,
- // return without performing any fading. This fixes the music in room
- // 406 in KQ6 (bug #3267956), where the game scripts ask for the background
- // music to be played, and then faded to volume 127 (but the music is
- // already at volume 127) and subsequently stopped.
- if (argc >= 4 && musicSlot->volume == CLIP<uint16>(argv[1].toUint16(), 0, MUSIC_VOLUME_MAX))
- return acc;
-
switch (argc) {
case 1: // SCI0
// SCI0 fades out all the time and when fadeout is done it will also
@@ -353,7 +345,25 @@ reg_t SoundCommandParser::kDoSoundFade(int argc, reg_t *argv, reg_t acc) {
musicSlot->fadeStep = volume > musicSlot->fadeTo ? -5 : 5;
musicSlot->fadeTickerStep = argv[2].toUint16() * 16667 / _music->soundGetTempo();
musicSlot->fadeTicker = 0;
- musicSlot->stopAfterFading = (argc == 5) ? (argv[4].toUint16() != 0) : false;
+
+ if (argc == 5) {
+ // TODO: We currently treat this argument as a boolean, but may
+ // have to handle different non-zero values differently. (e.g.,
+ // some KQ6 scripts pass 3 here)
+ musicSlot->stopAfterFading = (argv[4].toUint16() != 0);
+ } else {
+ musicSlot->stopAfterFading = false;
+ }
+
+ // WORKAROUND/HACK: In the labyrinth in KQ6, when falling in the pit and
+ // lighting the lantern, the game scripts perform a fade in of the game
+ // music, but set it to stop after fading. Remove that flag here. This is
+ // marked as both a workaround and a hack because this issue could be a
+ // problem with our fading code and an incorrect handling of that
+ // parameter, or a script bug in that scene. Fixes bug #3267956.
+ if (g_sci->getGameId() == GID_KQ6 && g_sci->getEngineState()->currentRoomNumber() == 406 &&
+ musicSlot->resourceId == 400)
+ musicSlot->stopAfterFading = false;
break;
default:
diff --git a/engines/sci/video/robot_decoder.cpp b/engines/sci/video/robot_decoder.cpp
index ecdce3bd6b..debc75dffd 100644
--- a/engines/sci/video/robot_decoder.cpp
+++ b/engines/sci/video/robot_decoder.cpp
@@ -23,11 +23,10 @@
*
*/
-#include "common/debug.h"
-#include "common/endian.h"
#include "common/archive.h"
#include "common/stream.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "common/util.h"
#include "graphics/surface.h"
@@ -126,7 +125,7 @@ bool RobotDecoder::loadStream(Common::SeekableReadStream *stream) {
readPaletteChunk(_header.paletteDataSize);
readFrameSizesChunk();
calculateVideoDimensions();
- _surface->create(_width, _height, 1);
+ _surface->create(_width, _height, Graphics::PixelFormat::createFormatCLUT8());
return true;
}
diff --git a/engines/sci/video/robot_decoder.h b/engines/sci/video/robot_decoder.h
index 52bf0bad07..aeb638e019 100644
--- a/engines/sci/video/robot_decoder.h
+++ b/engines/sci/video/robot_decoder.h
@@ -32,6 +32,7 @@
#include "common/substream.h"
#include "audio/audiostream.h"
#include "audio/mixer.h"
+#include "graphics/pixelformat.h"
#include "video/video_decoder.h"
namespace Sci {
diff --git a/engines/sci/video/seq_decoder.cpp b/engines/sci/video/seq_decoder.cpp
index 0e69a9a352..7168496893 100644
--- a/engines/sci/video/seq_decoder.cpp
+++ b/engines/sci/video/seq_decoder.cpp
@@ -23,12 +23,10 @@
*
*/
-#include "common/debug.h"
#include "common/endian.h"
-#include "common/archive.h"
#include "common/stream.h"
#include "common/system.h"
-#include "common/util.h"
+#include "common/textconsole.h"
#include "graphics/surface.h"
@@ -61,7 +59,7 @@ bool SeqDecoder::loadStream(Common::SeekableReadStream *stream) {
_fileStream = stream;
_surface = new Graphics::Surface();
- _surface->create(SEQ_SCREEN_WIDTH, SEQ_SCREEN_HEIGHT, 1);
+ _surface->create(SEQ_SCREEN_WIDTH, SEQ_SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
_frameCount = _fileStream->readUint16LE();
diff --git a/engines/sci/video/seq_decoder.h b/engines/sci/video/seq_decoder.h
index 70aaa661ae..70d3985ec5 100644
--- a/engines/sci/video/seq_decoder.h
+++ b/engines/sci/video/seq_decoder.h
@@ -26,8 +26,18 @@
#ifndef SCI_VIDEO_SEQ_DECODER_H
#define SCI_VIDEO_SEQ_DECODER_H
+#include "common/rational.h"
+#include "graphics/pixelformat.h"
#include "video/video_decoder.h"
+namespace Common {
+class SeekableReadStream;
+}
+
+namespace Graphics {
+struct Surface;
+}
+
namespace Sci {
/**
diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp
index 861e448221..9fb76d9d63 100644
--- a/engines/scumm/charset.cpp
+++ b/engines/scumm/charset.cpp
@@ -401,7 +401,7 @@ int CharsetRendererClassic::getCharWidth(uint16 chr) {
spacing++;
}
}
-
+
} else if (chr >= 0x80) {
return _vm->_2byteWidth / 2;
}
@@ -618,11 +618,12 @@ int CharsetRendererV3::getCharWidth(uint16 chr) {
spacing = 4;
} else if (chr & 0x80) {
spacing = _vm->_2byteWidth / 2;
- }
+ }
}
- if (!spacing)
+ if (!spacing) {
spacing = *(_widthTable + chr);
+ }
return spacing;
}
@@ -777,7 +778,7 @@ void CharsetRendererV3::printChar(int chr, bool ignoreCharsetMask) {
(ignoreCharsetMask || !vs->hasTwoBuffers)) {
dst = vs->getPixels(_left, drawTop);
if (charPtr)
- drawBits1(*vs, dst, charPtr, drawTop, origWidth, origHeight, vs->bytesPerPixel);
+ drawBits1(*vs, dst, charPtr, drawTop, origWidth, origHeight, vs->format.bytesPerPixel);
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
else if (_vm->_cjkFont)
_vm->_cjkFont->drawChar(vs, chr, _left, drawTop, _color, _shadowColor);
@@ -785,7 +786,7 @@ void CharsetRendererV3::printChar(int chr, bool ignoreCharsetMask) {
} else {
dst = (byte *)_vm->_textSurface.getBasePtr(_left * _vm->_textSurfaceMultiplier, _top * _vm->_textSurfaceMultiplier);
if (charPtr)
- drawBits1(_vm->_textSurface, dst, charPtr, drawTop, origWidth, origHeight, _vm->_textSurface.bytesPerPixel, (_vm->_textSurfaceMultiplier == 2 && !is2byte));
+ drawBits1(_vm->_textSurface, dst, charPtr, drawTop, origWidth, origHeight, _vm->_textSurface.format.bytesPerPixel, (_vm->_textSurfaceMultiplier == 2 && !is2byte));
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
else if (_vm->_cjkFont)
_vm->_cjkFont->drawChar(_vm->_textSurface, chr, _left * _vm->_textSurfaceMultiplier, _top * _vm->_textSurfaceMultiplier, _color, _shadowColor);
@@ -834,7 +835,7 @@ void CharsetRendererV3::drawChar(int chr, Graphics::Surface &s, int x, int y) {
height = 8;
}
dst = (byte *)s.pixels + y * s.pitch + x;
- drawBits1(s, dst, charPtr, y, width, height, s.bytesPerPixel);
+ drawBits1(s, dst, charPtr, y, width, height, s.format.bytesPerPixel);
}
void CharsetRenderer::translateColor() {
@@ -857,17 +858,17 @@ void CharsetRenderer::processTownsCharsetColors(uint8 bytesPerPixel) {
if (_vm->_game.platform == Common::kPlatformFMTowns) {
for (int i = 0; i < (1 << bytesPerPixel); i++) {
uint8 c = _vm->_charsetColorMap[i];
-
+
if (c > 16) {
uint8 t = (_vm->_currentPalette[c * 3] < 32) ? 4 : 12;
t |= ((_vm->_currentPalette[c * 3 + 1] < 32) ? 2 : 10);
t |= ((_vm->_currentPalette[c * 3 + 1] < 32) ? 1 : 9);
c = t;
}
-
+
if (c == 0)
c = _vm->_townsOverrideShadowColor;
-
+
c = ((c & 0x0f) << 4) | (c & 0x0f);
_vm->_townsCharsetColorMap[i] = c;
}
@@ -920,12 +921,12 @@ void CharsetRendererClassic::printChar(int chr, bool ignoreCharsetMask) {
noSjis = true;
}
}
-
+
if (useTownsFontRomCharacter(chr) && !noSjis) {
charPtr = 0;
_vm->_cjkChar = chr;
enableShadow(true);
-
+
width = getCharWidth(chr);
// For whatever reason MI1 uses a different font width
// for alignment calculation and for drawing when
@@ -947,7 +948,7 @@ void CharsetRendererClassic::printChar(int chr, bool ignoreCharsetMask) {
height++;
}
} else
-#endif
+#endif
{
uint32 charOffs = READ_LE_UINT32(_fontPtr + chr * 4 + 4);
assert(charOffs < 0x14000);
@@ -1096,7 +1097,7 @@ void CharsetRendererClassic::printCharIntern(bool is2byte, const byte *charPtr,
} else
#endif
if (is2byte) {
- drawBits1(dstSurface, dstPtr, charPtr, drawTop, origWidth, origHeight, dstSurface.bytesPerPixel);
+ drawBits1(dstSurface, dstPtr, charPtr, drawTop, origWidth, origHeight, dstSurface.format.bytesPerPixel);
} else {
drawBitsN(dstSurface, dstPtr, charPtr, *_fontPtr, drawTop, origWidth, origHeight, _vm->_textSurfaceMultiplier == 2);
}
@@ -1173,7 +1174,7 @@ void CharsetRendererClassic::drawChar(int chr, Graphics::Surface &s, int x, int
dst = (byte *)s.pixels + y * s.pitch + x;
if (is2byte) {
- drawBits1(s, dst, charPtr, y, width, height, s.bytesPerPixel);
+ drawBits1(s, dst, charPtr, y, width, height, s.format.bytesPerPixel);
} else {
drawBitsN(s, dst, charPtr, *_fontPtr, y, width, height);
}
@@ -1259,14 +1260,14 @@ void CharsetRendererCommon::drawBits1(const Graphics::Surface &s, byte *dst, con
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
byte *dst3 = dst2;
byte *dst4 = dst2;
- if (scale2x) {
+ if (scale2x) {
dst3 = dst2 + s.pitch;
dst4 = dst3 + s.pitch;
pitch <<= 1;
}
if (_vm->_game.platform == Common::kPlatformFMTowns && _vm->_game.version == 5)
col = _vm->_townsCharsetColorMap[1];
-#endif
+#endif
for (y = 0; y < height && y + drawTop < s.h; y++) {
for (x = 0; x < width; x++) {
@@ -1287,19 +1288,19 @@ void CharsetRendererCommon::drawBits1(const Graphics::Surface &s, byte *dst, con
if (scale2x) {
dst[2] = dst[3] = dst2[2] = dst2[3] = _shadowColor;
dst3[0] = dst4[0] = dst3[1] = dst4[1] = _shadowColor;
- } else
+ } else
#endif
{
dst[1] = dst2[0] = _shadowColor;
if (_shadowMode != kFMTOWNSShadowMode)
dst2[1] = _shadowColor;
- }
+ }
}
dst[0] = col;
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
if (scale2x)
- dst[1] = dst2[0] = dst2[1] = col;
+ dst[1] = dst2[0] = dst2[1] = col;
#endif
}
}
@@ -1317,7 +1318,7 @@ void CharsetRendererCommon::drawBits1(const Graphics::Surface &s, byte *dst, con
dst += pitch;
dst2 += pitch;
-#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
+#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
dst3 += pitch;
dst4 += pitch;
#endif
@@ -1519,10 +1520,10 @@ void CharsetRendererNES::printChar(int chr, bool ignoreCharsetMask) {
if (ignoreCharsetMask || !vs->hasTwoBuffers) {
dst = vs->getPixels(_left, drawTop);
- drawBits1(*vs, dst, charPtr, drawTop, origWidth, origHeight, vs->bytesPerPixel);
+ drawBits1(*vs, dst, charPtr, drawTop, origWidth, origHeight, vs->format.bytesPerPixel);
} else {
dst = (byte *)_vm->_textSurface.pixels + _top * _vm->_textSurface.pitch + _left;
- drawBits1(_vm->_textSurface, dst, charPtr, drawTop, origWidth, origHeight, _vm->_textSurface.bytesPerPixel);
+ drawBits1(_vm->_textSurface, dst, charPtr, drawTop, origWidth, origHeight, _vm->_textSurface.format.bytesPerPixel);
}
if (_str.left > _left)
@@ -1552,7 +1553,7 @@ void CharsetRendererNES::drawChar(int chr, Graphics::Surface &s, int x, int y) {
height = 8;
dst = (byte *)s.pixels + y * s.pitch + x;
- drawBits1(s, dst, charPtr, y, width, height, s.bytesPerPixel);
+ drawBits1(s, dst, charPtr, y, width, height, s.format.bytesPerPixel);
}
void CharsetRendererNES::drawBits1(const Graphics::Surface &s, byte *dst, const byte *src, int drawTop, int width, int height, uint8 bitDepth, bool scalex) {
diff --git a/engines/scumm/costume.cpp b/engines/scumm/costume.cpp
index cd366fcfd4..d0a3ec6e11 100644
--- a/engines/scumm/costume.cpp
+++ b/engines/scumm/costume.cpp
@@ -419,6 +419,11 @@ void ClassicCostumeRenderer::procC64(Codec1 &v1, int actor) {
#undef MASK_AT
#ifdef USE_ARM_COSTUME_ASM
+
+#ifndef IPHONE
+#define ClassicProc3RendererShadowARM _ClassicProc3RendererShadowARM
+#endif
+
extern "C" int ClassicProc3RendererShadowARM(int _scaleY,
ClassicCostumeRenderer::Codec1 *v1,
Graphics::Surface *_out,
diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp
index bb3c4bcc02..820605924c 100644
--- a/engines/scumm/cursor.cpp
+++ b/engines/scumm/cursor.cpp
@@ -385,7 +385,7 @@ void ScummEngine_v5::redefineBuiltinCursorFromChar(int index, int chr) {
s.pitch = s.w;
// s.h = 17 for FM-TOWNS Loom Japanese. Fixes bug #1166917
assert(s.w <= 16 && s.h <= 17);
- s.bytesPerPixel = 1;
+ s.format = Graphics::PixelFormat::createFormatCLUT8();
_charset->drawChar(chr, s, 0, 0);
diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp
index 63188c1d7a..4c1942b865 100644
--- a/engines/scumm/debugger.cpp
+++ b/engines/scumm/debugger.cpp
@@ -23,7 +23,6 @@
*
*/
-#include "common/config-manager.h"
#include "common/debug-channels.h"
#include "common/file.h"
#include "common/str.h"
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index 87ec7b85a4..51b46b033c 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -23,6 +23,9 @@
*
*/
+// FIXME: Avoid using printf
+#define FORBIDDEN_SYMBOL_EXCEPTION_printf
+
#include "base/plugins.h"
#include "common/archive.h"
@@ -994,7 +997,7 @@ Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) co
Common::FSList fslist;
Common::FSNode dir(ConfMan.get("path"));
if (!dir.isDirectory())
- return Common::kInvalidPathError;
+ return Common::kPathNotDirectory;
if (!dir.getChildren(fslist, Common::FSNode::kListFilesOnly))
return Common::kNoGameDataFoundError;
@@ -1131,6 +1134,7 @@ Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) co
break;
case 62:
case 61:
+ case 60:
*engine = new ScummEngine_v60he(syst, res);
break;
default:
diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h
index a5542ca868..952abdb39a 100644
--- a/engines/scumm/detection_tables.h
+++ b/engines/scumm/detection_tables.h
@@ -372,7 +372,7 @@ static const GameSettings gameVariantsTable[] = {
{"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_SOCCER, 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},
{"freddicove", "", 0, GID_HEGAME, 6, 99, MDT_NONE, GF_USE_KEY | GF_HE_LOCALIZED | GF_16BIT_COLOR, UNK, GUIO_NOLAUNCHLOAD | GUIO_NOMIDI},
@@ -386,7 +386,7 @@ static const GameSettings gameVariantsTable[] = {
{"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_SOCCER, 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},
// 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},
@@ -483,6 +483,7 @@ static const GameFilenamePattern gameFilenamesTable[] = {
#ifdef ENABLE_SCUMM_7_8
{ "dig", "dig.la%d", kGenDiskNum, UNK_LANG, UNK, 0 },
+ { "dig", "thedig.la%d", kGenDiskNum, UNK_LANG, UNK, "Demo" }, // Used by an alternate version of the demo
{ "dig", "The Dig Data", kGenUnchanged, UNK_LANG, Common::kPlatformMacintosh, 0 },
{ "dig", "The Dig Demo Data", kGenUnchanged, UNK_LANG, Common::kPlatformMacintosh, "Demo" },
diff --git a/engines/scumm/dialogs.h b/engines/scumm/dialogs.h
index 0e6e18905f..40e549471b 100644
--- a/engines/scumm/dialogs.h
+++ b/engines/scumm/dialogs.h
@@ -33,8 +33,8 @@
#include "scumm/detection.h"
namespace GUI {
- class ListWidget;
- class CommandSender;
+class ListWidget;
+class CommandSender;
}
diff --git a/engines/scumm/file_nes.cpp b/engines/scumm/file_nes.cpp
index d9d84f04ff..47704d6eaf 100644
--- a/engines/scumm/file_nes.cpp
+++ b/engines/scumm/file_nes.cpp
@@ -28,6 +28,7 @@
#include "common/endian.h"
#include "common/md5.h"
#include "common/memstream.h"
+#include "common/textconsole.h"
namespace Scumm {
diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index a6a97ec426..e7abd5610e 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -36,6 +36,12 @@
#include "scumm/util.h"
#ifdef USE_ARM_GFX_ASM
+
+#ifndef IPHONE
+#define asmDrawStripToScreen _asmDrawStripToScreen
+#define asmCopy8Col _asmCopy8Col
+#endif
+
extern "C" void asmDrawStripToScreen(int height, int width, void const* text, void const* src, byte* dst,
int vsPitch, int vmScreenWidth, int textSurfacePitch);
extern "C" void asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height, uint8 bitDepth);
@@ -385,8 +391,11 @@ void ScummEngine::initVirtScreen(VirtScreenNumber slot, int top, int width, int
vs->hasTwoBuffers = twobufs;
vs->xstart = 0;
vs->backBuf = NULL;
- vs->bytesPerPixel = (_game.features & GF_16BIT_COLOR) ? 2 : 1;
- vs->pitch = width * vs->bytesPerPixel;
+ if (_game.features & GF_16BIT_COLOR)
+ vs->format = Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0);
+ else
+ vs->format = Graphics::PixelFormat::createFormatCLUT8();
+ vs->pitch = width * vs->format.bytesPerPixel;
if (_game.version >= 7) {
// Increase the pitch by one; needed to accomodate the extra screen
@@ -622,7 +631,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i
int m = _textSurfaceMultiplier;
int vsPitch;
int pitch = vs->pitch;
- vsPitch = vs->pitch - width * vs->bytesPerPixel;
+ vsPitch = vs->pitch - width * vs->format.bytesPerPixel;
if (_game.version < 7) {
@@ -667,7 +676,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i
} else {
WRITE_UINT16(dstPtr, _16BitPalette[tmp]); dstPtr += 2;
}
- srcPtr += vs->bytesPerPixel;
+ srcPtr += vs->format.bytesPerPixel;
}
srcPtr += vsPitch;
textPtr += _textSurface.pitch - width * m;
@@ -706,7 +715,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i
}
#endif
src = _compositeBuf;
- pitch = width * vs->bytesPerPixel;
+ pitch = width * vs->format.bytesPerPixel;
if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) {
ditherHerc(_compositeBuf, _herculesBuf, width, &x, &y, &width, &height);
@@ -1036,17 +1045,17 @@ void ScummEngine::restoreBackground(Common::Rect rect, byte backColor) {
return;
if (vs->hasTwoBuffers && _currentRoom != 0 && isLightOn()) {
- blit(screenBuf, vs->pitch, vs->getBackPixels(rect.left, rect.top), vs->pitch, width, height, vs->bytesPerPixel);
+ blit(screenBuf, vs->pitch, vs->getBackPixels(rect.left, rect.top), vs->pitch, width, height, vs->format.bytesPerPixel);
if (vs->number == kMainVirtScreen && _charset->_hasMask) {
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
if (_game.platform == Common::kPlatformFMTowns) {
byte *mask = (byte *)_textSurface.getBasePtr(rect.left * _textSurfaceMultiplier, (rect.top + vs->topline) * _textSurfaceMultiplier);
- fill(mask, _textSurface.pitch, 0, width * _textSurfaceMultiplier, height * _textSurfaceMultiplier, _textSurface.bytesPerPixel);
+ fill(mask, _textSurface.pitch, 0, width * _textSurfaceMultiplier, height * _textSurfaceMultiplier, _textSurface.format.bytesPerPixel);
} else
#endif
{
byte *mask = (byte *)_textSurface.getBasePtr(rect.left, rect.top - _screenTop);
- fill(mask, _textSurface.pitch, CHARSET_MASK_TRANSPARENCY, width * _textSurfaceMultiplier, height * _textSurfaceMultiplier, _textSurface.bytesPerPixel);
+ fill(mask, _textSurface.pitch, CHARSET_MASK_TRANSPARENCY, width * _textSurfaceMultiplier, height * _textSurfaceMultiplier, _textSurface.format.bytesPerPixel);
}
}
} else {
@@ -1054,14 +1063,14 @@ void ScummEngine::restoreBackground(Common::Rect rect, byte backColor) {
if (_game.platform == Common::kPlatformFMTowns) {
backColor |= (backColor << 4);
byte *mask = (byte *)_textSurface.getBasePtr(rect.left * _textSurfaceMultiplier, (rect.top + vs->topline) * _textSurfaceMultiplier);
- fill(mask, _textSurface.pitch, backColor, width * _textSurfaceMultiplier, height * _textSurfaceMultiplier, _textSurface.bytesPerPixel);
+ fill(mask, _textSurface.pitch, backColor, width * _textSurfaceMultiplier, height * _textSurfaceMultiplier, _textSurface.format.bytesPerPixel);
}
#endif
if (_game.features & GF_16BIT_COLOR)
- fill(screenBuf, vs->pitch, _16BitPalette[backColor], width, height, vs->bytesPerPixel);
+ fill(screenBuf, vs->pitch, _16BitPalette[backColor], width, height, vs->format.bytesPerPixel);
else
- fill(screenBuf, vs->pitch, backColor, width, height, vs->bytesPerPixel);
+ fill(screenBuf, vs->pitch, backColor, width, height, vs->format.bytesPerPixel);
}
}
@@ -1090,7 +1099,7 @@ void ScummEngine::restoreCharsetBg() {
if (vs->number != kMainVirtScreen) {
// Restore from back buffer
const byte *backBuf = vs->getBackPixels(0, 0);
- blit(screenBuf, vs->pitch, backBuf, vs->pitch, vs->w, vs->h, vs->bytesPerPixel);
+ blit(screenBuf, vs->pitch, backBuf, vs->pitch, vs->w, vs->h, vs->format.bytesPerPixel);
}
} else {
// Clear area
@@ -1118,7 +1127,7 @@ void ScummEngine::clearTextSurface() {
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
_game.platform == Common::kPlatformFMTowns ? 0 :
#endif
- CHARSET_MASK_TRANSPARENCY, _textSurface.w, _textSurface.h, _textSurface.bytesPerPixel);
+ CHARSET_MASK_TRANSPARENCY, _textSurface.w, _textSurface.h, _textSurface.format.bytesPerPixel);
}
byte *ScummEngine::getMaskBuffer(int x, int y, int z) {
@@ -1291,56 +1300,56 @@ void ScummEngine::drawBox(int x, int y, int x2, int y2, int color) {
if (vs->number != kMainVirtScreen)
error("can only copy bg to main window");
- blit(backbuff, vs->pitch, bgbuff, vs->pitch, width, height, vs->bytesPerPixel);
+ blit(backbuff, vs->pitch, bgbuff, vs->pitch, width, height, vs->format.bytesPerPixel);
if (_charset->_hasMask) {
byte *mask = (byte *)_textSurface.getBasePtr(x * _textSurfaceMultiplier, (y - _screenTop) * _textSurfaceMultiplier);
- fill(mask, _textSurface.pitch, CHARSET_MASK_TRANSPARENCY, width * _textSurfaceMultiplier, height * _textSurfaceMultiplier, _textSurface.bytesPerPixel);
+ fill(mask, _textSurface.pitch, CHARSET_MASK_TRANSPARENCY, width * _textSurfaceMultiplier, height * _textSurfaceMultiplier, _textSurface.format.bytesPerPixel);
}
}
} else if (_game.heversion >= 72) {
// Flags are used for different methods in HE games
uint32 flags = color;
if ((flags & 0x2000) || (flags & 0x4000000)) {
- blit(backbuff, vs->pitch, bgbuff, vs->pitch, width, height, vs->bytesPerPixel);
+ blit(backbuff, vs->pitch, bgbuff, vs->pitch, width, height, vs->format.bytesPerPixel);
} else if ((flags & 0x4000) || (flags & 0x2000000)) {
- blit(bgbuff, vs->pitch, backbuff, vs->pitch, width, height, vs->bytesPerPixel);
+ blit(bgbuff, vs->pitch, backbuff, vs->pitch, width, height, vs->format.bytesPerPixel);
} else if ((flags & 0x8000) || (flags & 0x1000000)) {
flags &= (flags & 0x1000000) ? 0xFFFFFF : 0x7FFF;
- fill(backbuff, vs->pitch, flags, width, height, vs->bytesPerPixel);
- fill(bgbuff, vs->pitch, flags, width, height, vs->bytesPerPixel);
+ fill(backbuff, vs->pitch, flags, width, height, vs->format.bytesPerPixel);
+ fill(bgbuff, vs->pitch, flags, width, height, vs->format.bytesPerPixel);
} else {
- fill(backbuff, vs->pitch, flags, width, height, vs->bytesPerPixel);
+ fill(backbuff, vs->pitch, flags, width, height, vs->format.bytesPerPixel);
}
} else if (_game.heversion >= 60) {
// Flags are used for different methods in HE games
uint16 flags = color;
if (flags & 0x2000) {
- blit(backbuff, vs->pitch, bgbuff, vs->pitch, width, height, vs->bytesPerPixel);
+ blit(backbuff, vs->pitch, bgbuff, vs->pitch, width, height, vs->format.bytesPerPixel);
} else if (flags & 0x4000) {
- blit(bgbuff, vs->pitch, backbuff, vs->pitch, width, height, vs->bytesPerPixel);
+ blit(bgbuff, vs->pitch, backbuff, vs->pitch, width, height, vs->format.bytesPerPixel);
} else if (flags & 0x8000) {
flags &= 0x7FFF;
- fill(backbuff, vs->pitch, flags, width, height, vs->bytesPerPixel);
- fill(bgbuff, vs->pitch, flags, width, height, vs->bytesPerPixel);
+ fill(backbuff, vs->pitch, flags, width, height, vs->format.bytesPerPixel);
+ fill(bgbuff, vs->pitch, flags, width, height, vs->format.bytesPerPixel);
} else {
- fill(backbuff, vs->pitch, flags, width, height, vs->bytesPerPixel);
+ fill(backbuff, vs->pitch, flags, width, height, vs->format.bytesPerPixel);
}
} else {
if (_game.features & GF_16BIT_COLOR) {
- fill(backbuff, vs->pitch, _16BitPalette[color], width, height, vs->bytesPerPixel);
+ fill(backbuff, vs->pitch, _16BitPalette[color], width, height, vs->format.bytesPerPixel);
} else {
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
if (_game.platform == Common::kPlatformFMTowns) {
color = ((color & 0x0f) << 4) | (color & 0x0f);
byte *mask = (byte *)_textSurface.getBasePtr(x * _textSurfaceMultiplier, (y - _screenTop + vs->topline) * _textSurfaceMultiplier);
- fill(mask, _textSurface.pitch, color, width * _textSurfaceMultiplier, height * _textSurfaceMultiplier, _textSurface.bytesPerPixel);
+ fill(mask, _textSurface.pitch, color, width * _textSurfaceMultiplier, height * _textSurfaceMultiplier, _textSurface.format.bytesPerPixel);
if (_game.id == GID_MONKEY2 || _game.id == GID_INDY4 || ((_game.id == GID_INDY3 || _game.id == GID_ZAK) && vs->number != kTextVirtScreen) || (_game.id == GID_LOOM && vs->number == kMainVirtScreen))
return;
}
#endif
- fill(backbuff, vs->pitch, color, width, height, vs->bytesPerPixel);
+ fill(backbuff, vs->pitch, color, width, height, vs->format.bytesPerPixel);
}
}
}
@@ -1379,7 +1388,7 @@ void ScummEngine_v5::drawFlashlight() {
_flashlight.y, _flashlight.y + _flashlight.h, USAGE_BIT_DIRTY);
if (_flashlight.buffer) {
- fill(_flashlight.buffer, vs->pitch, 0, _flashlight.w, _flashlight.h, vs->bytesPerPixel);
+ fill(_flashlight.buffer, vs->pitch, 0, _flashlight.w, _flashlight.h, vs->format.bytesPerPixel);
}
_flashlight.isDrawn = false;
}
@@ -1426,20 +1435,20 @@ void ScummEngine_v5::drawFlashlight() {
_flashlight.buffer = vs->getPixels(_flashlight.x, _flashlight.y);
bgbak = vs->getBackPixels(_flashlight.x, _flashlight.y);
- blit(_flashlight.buffer, vs->pitch, bgbak, vs->pitch, _flashlight.w, _flashlight.h, vs->bytesPerPixel);
+ blit(_flashlight.buffer, vs->pitch, bgbak, vs->pitch, _flashlight.w, _flashlight.h, vs->format.bytesPerPixel);
// Round the corners. To do so, we simply hard-code a set of nicely
// rounded corners.
static const int corner_data[] = { 8, 6, 4, 3, 2, 2, 1, 1 };
int minrow = 0;
- int maxcol = (_flashlight.w - 1) * vs->bytesPerPixel;
+ int maxcol = (_flashlight.w - 1) * vs->format.bytesPerPixel;
int maxrow = (_flashlight.h - 1) * vs->pitch;
for (i = 0; i < 8; i++, minrow += vs->pitch, maxrow -= vs->pitch) {
int d = corner_data[i];
for (j = 0; j < d; j++) {
- if (vs->bytesPerPixel == 2) {
+ if (vs->format.bytesPerPixel == 2) {
WRITE_UINT16(&_flashlight.buffer[minrow + 2 * j], 0);
WRITE_UINT16(&_flashlight.buffer[minrow + maxcol - 2 * j], 0);
WRITE_UINT16(&_flashlight.buffer[maxrow + 2 * j], 0);
@@ -1755,7 +1764,7 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const
}
#endif
- _vertStripNextInc = height * vs->pitch - 1 * vs->bytesPerPixel;
+ _vertStripNextInc = height * vs->pitch - 1 * vs->format.bytesPerPixel;
_objectMode = (flag & dbObjectMode) == dbObjectMode;
prepareDrawBitmap(ptr, vs, x, y, width, height, stripnr, numstrip);
@@ -1788,9 +1797,9 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const
// In the case of a double buffered virtual screen, we draw to
// the backbuffer, otherwise to the primary surface memory.
if (vs->hasTwoBuffers)
- dstPtr = vs->backBuf + y * vs->pitch + (x * 8 * vs->bytesPerPixel);
+ dstPtr = vs->backBuf + y * vs->pitch + (x * 8 * vs->format.bytesPerPixel);
else
- dstPtr = (byte *)vs->pixels + y * vs->pitch + (x * 8 * vs->bytesPerPixel);
+ dstPtr = (byte *)vs->pixels + y * vs->pitch + (x * 8 * vs->format.bytesPerPixel);
transpStrip = drawStrip(dstPtr, vs, x, y, width, height, stripnr, smap_ptr);
@@ -1799,11 +1808,11 @@ void Gdi::drawBitmap(const byte *ptr, VirtScreen *vs, int x, const int y, const
transpStrip = true;
if (vs->hasTwoBuffers) {
- byte *frontBuf = (byte *)vs->pixels + y * vs->pitch + (x * 8 * vs->bytesPerPixel);
+ byte *frontBuf = (byte *)vs->pixels + y * vs->pitch + (x * 8 * vs->format.bytesPerPixel);
if (lightsOn)
- copy8Col(frontBuf, vs->pitch, dstPtr, height, vs->bytesPerPixel);
+ copy8Col(frontBuf, vs->pitch, dstPtr, height, vs->format.bytesPerPixel);
else
- clear8Col(frontBuf, vs->pitch, height, vs->bytesPerPixel);
+ clear8Col(frontBuf, vs->pitch, height, vs->format.bytesPerPixel);
}
decodeMask(x, y, width, height, stripnr, numzbuf, zplane_list, transpStrip, flag, tmsk_ptr);
@@ -2039,7 +2048,7 @@ void Gdi::drawBMAPBg(const byte *ptr, VirtScreen *vs) {
drawStripHE(dst, vs->pitch, bmap_ptr, vs->w, vs->h, true);
break;
case 150:
- fill(dst, vs->pitch, *bmap_ptr, vs->w, vs->h, vs->bytesPerPixel);
+ fill(dst, vs->pitch, *bmap_ptr, vs->w, vs->h, vs->format.bytesPerPixel);
break;
default:
// Alternative russian freddi3 uses badly formatted bitmaps
@@ -2150,7 +2159,7 @@ void ScummEngine_v70he::restoreBackgroundHE(Common::Rect rect, int dirtybit) {
assert(rw <= _screenWidth && rw > 0);
assert(rh <= _screenHeight && rh > 0);
- blit(dst, _virtscr[kMainVirtScreen].pitch, src, _virtscr[kMainVirtScreen].pitch, rw, rh, vs->bytesPerPixel);
+ blit(dst, _virtscr[kMainVirtScreen].pitch, src, _virtscr[kMainVirtScreen].pitch, rw, rh, vs->format.bytesPerPixel);
markRectAsDirty(kMainVirtScreen, rect, dirtybit);
}
#endif
@@ -2180,15 +2189,15 @@ void Gdi::resetBackground(int top, int bottom, int strip) {
if (bottom > vs->bdirty[strip])
vs->bdirty[strip] = bottom;
- bgbak_ptr = (byte *)vs->backBuf + top * vs->pitch + (strip + vs->xstart/8) * 8 * vs->bytesPerPixel;
- backbuff_ptr = (byte *)vs->pixels + top * vs->pitch + (strip + vs->xstart/8) * 8 * vs->bytesPerPixel;
+ bgbak_ptr = (byte *)vs->backBuf + top * vs->pitch + (strip + vs->xstart/8) * 8 * vs->format.bytesPerPixel;
+ backbuff_ptr = (byte *)vs->pixels + top * vs->pitch + (strip + vs->xstart/8) * 8 * vs->format.bytesPerPixel;
numLinesToProcess = bottom - top;
if (numLinesToProcess) {
if (_vm->isLightOn()) {
- copy8Col(backbuff_ptr, vs->pitch, bgbak_ptr, numLinesToProcess, vs->bytesPerPixel);
+ copy8Col(backbuff_ptr, vs->pitch, bgbak_ptr, numLinesToProcess, vs->format.bytesPerPixel);
} else {
- clear8Col(backbuff_ptr, vs->pitch, numLinesToProcess, vs->bytesPerPixel);
+ clear8Col(backbuff_ptr, vs->pitch, numLinesToProcess, vs->format.bytesPerPixel);
}
}
}
diff --git a/engines/scumm/gfx.h b/engines/scumm/gfx.h
index c6062ef9be..3f69d75efd 100644
--- a/engines/scumm/gfx.h
+++ b/engines/scumm/gfx.h
@@ -158,11 +158,11 @@ struct VirtScreen : Graphics::Surface {
}
byte *getPixels(int x, int y) const {
- return (byte *)pixels + y * pitch + (xstart + x) * bytesPerPixel;
+ return (byte *)pixels + y * pitch + (xstart + x) * format.bytesPerPixel;
}
byte *getBackPixels(int x, int y) const {
- return (byte *)backBuf + y * pitch + (xstart + x) * bytesPerPixel;
+ return (byte *)backBuf + y * pitch + (xstart + x) * format.bytesPerPixel;
}
};
diff --git a/engines/scumm/gfxARM.s b/engines/scumm/gfxARM.s
index 34de954a17..9f7c2949b3 100644
--- a/engines/scumm/gfxARM.s
+++ b/engines/scumm/gfxARM.s
@@ -25,8 +25,8 @@
.text
- .global asmDrawStripToScreen
- .global asmCopy8Col
+ .global _asmDrawStripToScreen
+ .global _asmCopy8Col
@ ARM implementation of asmDrawStripToScreen.
@
@@ -44,7 +44,7 @@
@ In addition, we assume that text, src and dst are all word (4 byte)
@ aligned. This is the same assumption that the old 'inline' version
@ made.
-asmDrawStripToScreen:
+_asmDrawStripToScreen:
@ r0 = height
@ r1 = width
@ r2 = text
@@ -125,7 +125,7 @@ end:
@ In addition, we assume that src and dst are both word (4 byte)
@ aligned. This is the same assumption that the old 'inline' version
@ made.
-asmCopy8Col:
+_asmCopy8Col:
@ r0 = dst
@ r1 = dstPitch
@ r2 = src
diff --git a/engines/scumm/gfx_towns.cpp b/engines/scumm/gfx_towns.cpp
index abf2da63a6..78c7ef23f1 100644
--- a/engines/scumm/gfx_towns.cpp
+++ b/engines/scumm/gfx_towns.cpp
@@ -48,7 +48,7 @@ void ScummEngine::towns_drawStripToScreen(VirtScreen *vs, int dstX, int dstY, in
int dp1 = _townsScreen->getLayerPitch(0) - width * _townsScreen->getLayerBpp(0);
int dp2 = _townsScreen->getLayerPitch(1) - width * m * _townsScreen->getLayerBpp(1);
- int sp1 = vs->pitch - (width * vs->bytesPerPixel);
+ int sp1 = vs->pitch - (width * vs->format.bytesPerPixel);
int sp2 = _textSurface.pitch - width * m;
if (vs->number == kMainVirtScreen || _game.id == GID_INDY3 || _game.id == GID_ZAK) {
diff --git a/engines/scumm/he/cup_player_he.cpp b/engines/scumm/he/cup_player_he.cpp
index a16af73135..5cd75a5c62 100644
--- a/engines/scumm/he/cup_player_he.cpp
+++ b/engines/scumm/he/cup_player_he.cpp
@@ -30,6 +30,7 @@
#include "audio/audiostream.h"
#include "audio/mixer.h"
#include "audio/decoders/raw.h"
+#include "graphics/palette.h"
#include "scumm/scumm.h"
#include "scumm/util.h"
#include "scumm/he/intern_he.h"
diff --git a/engines/scumm/he/logic_he.cpp b/engines/scumm/he/logic_he.cpp
index c088fd6e22..297c2992db 100644
--- a/engines/scumm/he/logic_he.cpp
+++ b/engines/scumm/he/logic_he.cpp
@@ -823,8 +823,18 @@ int LogicHEsoccer::versionID() {
}
LogicHEsoccer::LogicHEsoccer(ScummEngine_v90he *vm) : LogicHE(vm) {
- // Originally it used 0x1b0d bytes
_userDataD = (double *)calloc(1732, sizeof(double));
+ _intArray1 = 0;
+ _intArray2 = 0;
+ _intArraysAllocated = false;
+ _array1013 = 0;
+ _array1013Allocated = false;
+}
+
+LogicHEsoccer::~LogicHEsoccer() {
+ free(_userDataD);
+ op_1020(); // clear int arrays
+ delete[] _array1013;
}
int32 LogicHEsoccer::dispatch(int op, int numArgs, int32 *args) {
@@ -843,6 +853,37 @@ int32 LogicHEsoccer::dispatch(int op, int numArgs, int32 *args) {
res = op_1004(args);
break;
+ case 1006:
+ res = op_1006(args[0], args[1], args[2], args[3]);
+ break;
+
+ case 1011:
+ // args[4] is ignored!
+ // soccer passes the argument, but then ends up not using it
+ // Makes sense that they removed it for soccermls
+ res = op_1011(args[0], args[1], args[2], args[3], args[5]);
+ break;
+
+ case 1012:
+ res = op_1012(args);
+ break;
+
+ case 1013:
+ res = op_1013(args[0], args[1], args[2]);
+ break;
+
+ case 1019:
+ res = op_1019(args);
+ break;
+
+ case 1020:
+ res = op_1020();
+ break;
+
+ case 1021:
+ res = op_1021(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
+ break;
+
case 8221968:
// Someone had a fun and used his birthday as opcode number
res = getFromArray(args[0], args[1], args[2]);
@@ -856,6 +897,32 @@ int32 LogicHEsoccer::dispatch(int op, int numArgs, int32 *args) {
return res;
}
+void LogicHEsoccer::beforeBootScript() {
+ if (_intArraysAllocated)
+ op_1020();
+
+ _userDataD[530] = 0;
+}
+
+void LogicHEsoccer::initOnce() {
+ // The original sets some paths here that we don't need to worry about
+ _array1013Allocated = false;
+ _userDataD[530] = 0;
+}
+
+int LogicHEsoccer::startOfFrame() {
+ // This variable is some sort of flag that activates this mode
+ int res = (int)_userDataD[530];
+
+ // _userDataD[535] is not used!
+ // soccer passes the argument, but then ends up not using it
+ // Makes sense that they removed it for soccermls
+ if (res)
+ res = op_1011((int)_userDataD[531], (int)_userDataD[532], (int)_userDataD[533], (int)_userDataD[534], (int)_userDataD[536]);
+
+ return res;
+}
+
int LogicHEsoccer::op_1001(int32 *args) {
return (int)(args[0] * sin((float)args[1]));
}
@@ -901,16 +968,16 @@ int LogicHEsoccer::op_1004(int32 *args) {
return 1;
}
-int LogicHEsoccer::op_1006(int32 *args) {
- double a1 = args[1] * 0.01;
- double a2 = args[2] * 0.01;
- double a3 = args[3] * 0.01;
+int LogicHEsoccer::op_1006(int32 a1, int32 a2, int32 a3, int32 a4) {
+ double v1 = a1 * 0.01;
+ double v2 = a2 * 0.01;
+ double v3 = a3 * 0.01;
double var108, var109;
- _userDataD[529] = args[4];
+ _userDataD[529] = a4;
- var108 = atan2(a1, a3) * _userDataD[523] - args[4];
- var109 = _userDataD[526] - _userDataD[528] + (_userDataD[521] - atan2(_userDataD[524] - a2, a3)) * _userDataD[522];
+ var108 = atan2(v1, v3) * _userDataD[523] - a4;
+ var109 = _userDataD[526] - _userDataD[528] + (_userDataD[521] - atan2(_userDataD[524] - v2, v3)) * _userDataD[522];
writeScummVar(108, (int32)var108);
writeScummVar(109, (int32)var109);
@@ -919,37 +986,358 @@ int LogicHEsoccer::op_1006(int32 *args) {
}
int LogicHEsoccer::op_1007(int32 *args) {
- // TODO: Used when the HE logo is shown
+ // Used when the HE logo is shown
+ // This initializes the _userDataD fields that are used in op_1006/op_1011
+
+ _intArraysAllocated = false;
+ double v14 = (double)args[0] * 0.01;
+ double v13 = (double)args[2] * 0.01;
+ _userDataD[524] = v14;
+ double v12 = atan2(v13, v14);
+ _userDataD[520] = v12;
+ double v15 = atan2(v13 - (double)args[4] * 0.01, (double)args[3] * 0.01);
+ double v19 = v15 * 2.0;
+ double v17 = atan2(v13 - (double)args[4] * 0.01, v14);
+ _userDataD[519] = v19;
+ _userDataD[521] = v17;
+ _userDataD[525] = (v17 - v12) * 2.0;
+ _userDataD[527] = (double)args[5];
+ _userDataD[526] = (double)args[6];
+ _userDataD[528] = (double)args[7];
+ _userDataD[522] = _userDataD[526] / _userDataD[525];
+ _userDataD[523] = _userDataD[527] / _userDataD[519];
+ _userDataD[518] = v13;
+
+ // Clear both byte arrays
+ memset(_byteArray1, 0, 4096);
+ memset(_byteArray2, 0, 585);
+
+ if (_array1013Allocated == 0 )
+ op_1013(4, args[8], args[9]);
return 1;
}
+// Returns the square root of the sum of the squares of the arguments
+static inline double sqrtSquare(double a1, double a2, double a3) {
+ return sqrt(a1 * a1 + a2 * a2 + a3 * a3);
+}
+
int LogicHEsoccer::op_1008(int32 *args) {
// TODO: Used during a match (kicking?)
return 1;
}
+int LogicHEsoccer::op_1011(int32 a1, int32 a2, int32 a3, int32 a4, int32 a5) {
+ // This is called on each frame by startOfFrame() if activated by op_1012.
+ // This seems to do player placement!
+
+ float v28 = 0.0;
+
+ for (int i = 0; i < 18; i++) {
+ // These seem to be some sort of percent? of angles?
+ int v32 = getFromArray(a1, i, 0);
+ int v6 = getFromArray(a1, i, 1);
+ int v30 = getFromArray(a1, i, 2);
+
+ float v29 = (double)v32 / 100.0;
+ v28 = (double)v6 / 100.0;
+ float v31 = (double)v30 / 100.0;
+
+ if (i < 13) {
+ int v25 = ((v32 + 2760) / 500 >= 0) ? ((v32 + 2750) / 500) : 0;
+ int v24 = 10;
+
+ if (v25 <= 10) {
+ int v23 = 0;
+ if ((v32 + 2750) / 500 >= 0)
+ v23 = (v32 + 2750) / 500;
+
+ v24 = v23;
+ }
+
+ int v22 = 0;
+ if ((9219 - v30) / 500 >= 0)
+ v22 = (9219 - v30) / 500;
+
+ int v21 = 6;
+ if (v22 <= 6) {
+ int v20 = 0;
+ if ((9219 - v30) / 500 >= 0)
+ v20 = (9219 - v30) / 500;
+ v21 = v20;
+ }
+
+ if (a5)
+ putInArray(a5, 0, i, v24 + 11 * v21);
+ }
+
+ float v7 = atan2(_userDataD[524] - v28, (double)v31);
+ int v8 = (int)(_userDataD[526] - (_userDataD[521] - v7) * _userDataD[522] + 300.0);
+
+ double v9 = atan2(_userDataD[523], (double)v31);
+ // x/y position?
+ putInArray(a2, i, 0, (int32)(v29 * v9 + 640.0));
+ putInArray(a2, i, 1, v8);
+
+ double v10 = atan2(_userDataD[524], (double)v31);
+ int v12 = (int)(_userDataD[526] - (_userDataD[521] - (float)v10) * _userDataD[522] + 300.0);
+ double v13 = _userDataD[523];
+
+ v29 = atan2(v29, v31);
+ // x/y position?
+ putInArray(a2, i + 22, 0, (int32)(v29 * v13 + 640.0));
+ putInArray(a2, i + 22, 1, v12);
+ }
+
+ // soccer only uses one array here
+ // soccermls/soccer2004 use four
+ int start = (_vm->_game.id == GID_SOCCER) ? 19 : 18;
+ int end = (_vm->_game.id == GID_SOCCER) ? 19 : 21;
+
+ for (int i = start; i <= end; i++) {
+ int v14 = getFromArray(a2, i, 0);
+ int v15 = getFromArray(a2, i, 1);
+
+ // This retains v28 from (i == 17)?
+ float v16 = _userDataD[524] - v28;
+ float v17 = v16 / tan((_userDataD[528] + v15 - _userDataD[526]) / (_userDataD[522] + _userDataD[521]));
+ double v18 = tan((double)(v14 - 640) / _userDataD[523]) * v17;
+ putInArray(a1, i, 0, (int)(v18 * 100.0));
+ putInArray(a1, i, 2, (int)(v17 * 100.0));
+ }
+
+ op_1011_sub(a1, a3, a4, a4);
+
+ return 1;
+}
+
+static inline int distance(int a1, int a2, int a3, int a4) {
+ return (int)sqrt((double)((a4 - a3) * (a4 - a3) + (a2 - a1) * (a2 - a1)));
+}
+
+void LogicHEsoccer::op_1011_sub(int32 a1, int32 a2, int32 a3, int32 a4) {
+ // As you can guess, this is called from op_1011
+ // This seems to be checking distances between the players and the ball
+ // and which distance is the shortest.
+
+ int v6[13];
+ int v7[13];
+ int v8[13];
+ int v18[195];
+
+ for (int i = 0; i < 13; i++) {
+ v6[i] = 0;
+ v7[i] = getFromArray(a1, i, 0);
+ v8[i] = getFromArray(a1, i, 2);
+ }
+
+ // 12 here, 13 up there
+ // Probably 12 for players, 13 for players+ball
+ for (int i = 0; i < 12; i++) {
+ int v22 = a4;
+ for (int j = i + 1; j < 13; j++) {
+ v18[i * 15 + j] = distance(v7[i], v7[j], v8[i], v8[j]);
+ putInArray(a2, i, j, v18[i * 15 + j]);
+ putInArray(a2, j, i, v18[i * 15 + j]);
+ if (v18[i * 15 + j] < v22) {
+ v22 = v18[i * 15 + j];
+ v6[i] = j + 1;
+ v6[j] = i + 1;
+ }
+ }
+ }
+
+ int v13 = getFromArray(a1, 18, 0);
+ int v14 = getFromArray(a1, 18, 2);
+ int v15 = getFromArray(a1, 19, 0);
+ int v16 = getFromArray(a1, 19, 2);
+ int v19[15];
+ int v20[15];
+
+ if (_vm->_game.id == GID_SOCCER) {
+ // soccer gets to be different
+ for (int i = 0; i < 13; i++)
+ v20[i] = distance(v13, v7[i], v14, v8[i]);
+
+ for (int i = 0; i < 13; i++)
+ v19[i] = distance(v15, v7[i], v16, v8[i]);
+ } else {
+ // soccermls and soccer2004 use two other arrays here
+ int v9 = getFromArray(a1, 20, 0);
+ int v10 = getFromArray(a1, 20, 2);
+ int v11 = getFromArray(a1, 21, 0);
+ int v12 = getFromArray(a1, 21, 2);
+
+ for (int i = 0; i < 6; i++) {
+ v20[i] = distance(v9, v7[i], v10, v8[i]);
+ v19[i] = distance(v13, v7[i], v14, v8[i]);
+ }
+
+ for (int i = 6; i < 13; i++) {
+ v20[i] = distance(v11, v7[i], v12, v8[i]);
+ v19[i] = distance(v15, v7[i], v16, v8[i]);
+ }
+ }
+
+ for (int i = 0; i < 13; i++) {
+ putInArray(a2, 14, i, v20[i]);
+ putInArray(a2, i, 14, v20[i]);
+ putInArray(a2, 13, i, v19[i]);
+ putInArray(a2, i, 13, v19[i]);
+ putInArray(a3, 0, i, v6[i]);
+ }
+}
+
int LogicHEsoccer::op_1012(int32 *args) {
- // TODO: Used after op_1019
+ // Used after op_1019
+ // This function activates startOfFrame() to call op_1011
+ // (Possibly field parameters?)
+
+ _userDataD[530] = (args[0] != 0) ? 1 : 0;
+ _userDataD[531] = args[1];
+ _userDataD[532] = args[2];
+ _userDataD[533] = args[3];
+ _userDataD[534] = args[4];
+ _userDataD[535] = args[5]; // unused!!!
+ _userDataD[536] = args[6];
+
+ return 1;
+}
+
+// Some strange power operation, ignores negative exponents
+static inline double u32Pow(float a1, int a2) {
+ if (a2 < 0)
+ return 0.0;
+
+ float v4 = 1.0;
+
+ for (int i = 1; i <= a2; i++)
+ v4 *= a1;
+
+ return v4;
+}
+
+int LogicHEsoccer::op_sub5(int a1, int a2, int a3) {
+ byte *v9 = _array1013 + 44 * a2;
+
+ *((uint32 *)v9 + 4) = a3;
+ *((uint32 *)v9) = a2;
+
+ if (a1 > 2) {
+ // Casual observation: 585 is also the size of _byteArray2
+ *((uint32 *)v9 + 40) = 8 * a2 - 585;
+ for (int i = 0; i < 8; i++)
+ *((uint32 *)v9 + 4 * i + 8) = 0xffffffff;
+ } else {
+ for (int i = 0; i < 8; i++)
+ *((uint32 *)v9 + 4 * i + 8) = op_sub5(a1 + 1, i + 8 * a2 + 1, a2);
+ }
+
+ return a2;
+}
+
+int LogicHEsoccer::op_1013(int32 a1, int32 a2, int32 a3) {
+ // Creates _array1013 for *some* purpose
+ // _array1013Temp is used again op_1014 for some reason...
+ // Seems to be used in op_1015
+
+ int v4 = (int)((1.0 - u32Pow(8.0, 4)) / -7.0);
+
+ _array1013 = new byte[v4 * 44];
+ memset(_array1013, 0, v4 * 44);
+ _array1013Allocated = true;
+ memset(_array1013Temp, 0, 44);
+
+ for (int i = 0; i < 8; i++)
+ _array1013Temp[i + 2] = op_sub5(1, i + 1, 0);
+
+ // Yes, this is not endian-safe, but should not matter since we're
+ // not saving/loading the data anywhere
+ memcpy(_array1013, _array1013Temp, 44);
return 1;
}
-int LogicHEsoccer::op_1014(int32 *args) {
+int LogicHEsoccer::op_1014(int32 a1, int32 a2, int32 a3, int32 a4, int32 a5, int32 a6, int32 a7, int32 a8, int32 a9, int32 a10, int32 a11, int32 a12, int32 a13, int32 a14) {
// TODO: Used many times during a match
+ // And called from op_1008!
return 1;
}
int LogicHEsoccer::op_1019(int32 *args) {
- // TODO: Used at the beginning of a match
+ // Used at the beginning of a match
+ // Initializes some arrays. Player positions?
+
+ // These two arrays are used in op_1014 and op_1015
+ for (int i = 0; i < 4096; i++)
+ _byteArray1[i] = getFromArray(args[1], 0, i);
+
+ for (int i = 0; i < 585; i++)
+ _byteArray2[i] = getFromArray(args[0], 0, i);
+
+ // Deallocate the two integer arrays
+ if (_intArraysAllocated)
+ op_1020();
+
+ // Reallocate them
+ _intArray1 = new uint32[1008];
+ _intArray2 = new uint32[168];
+ _intArraysAllocated = true;
+
+ memset(_intArray1, 0, 4 * 4);
+ memset(_intArray2, 0, 24 * 4);
+
+ // These two arrays are used in op_1015
+ for (int i = 0; i < 42; i++) {
+ for (int j = 0; j < 24; j++)
+ _intArray1[j + 24 * i] = getFromArray(args[3], 0, j + 24 * i);
+
+ for (int j = 0; j < 4; j++)
+ _intArray2[j + 4 * i] = getFromArray(args[2], 0, j + 4 * i);
+ }
+
+ return 1;
+}
+
+int LogicHEsoccer::op_1020() {
+ // Deallocate integer arrays
+ // The arrays can be allocated in op_1015 or op_1019
+
+ delete[] _intArray1; _intArray1 = 0;
+ delete[] _intArray2; _intArray2 = 0;
+ _intArraysAllocated = false;
return 1;
}
-int LogicHEsoccer::op_1021(int32 *args) {
- // TODO: Used during a match (ball movement?)
+int LogicHEsoccer::op_1021(int32 a1, int32 a2, int32 a3, int32 a4, int32 a5, int32 a6, int32 a7) {
+ // Used during a match (ball movement?)
+ // Also called from op_1008
+
+ int v10;
+ if (a4 && a5)
+ v10 = (int)(((double)a2 - (double)a5 * (double)a1 / (double)a4) * -1.0 * (double)a4 / (double)a5);
+ else
+ v10 = a1;
+
+ int v9;
+ if (a6 && a5)
+ v9 = (int)(((double)a2 - (double)a5 * (double)a3 / (double)a6) * -1.0 * (double)a6 / (double)a5);
+ else
+ v9 = a3;
+
+ // The final argument chooses whether to store the results for op_1008 or
+ // store them in SCUMM variables.
+ if (a7) {
+ _var1021[0] = v10;
+ _var1021[1] = v9;
+ } else {
+ writeScummVar(108, v10);
+ writeScummVar(109, v9);
+ }
return 1;
}
diff --git a/engines/scumm/he/logic_he.h b/engines/scumm/he/logic_he.h
index ab952abd5e..d097d37e75 100644
--- a/engines/scumm/he/logic_he.h
+++ b/engines/scumm/he/logic_he.h
@@ -41,9 +41,9 @@ public:
int getFromArray(int arg0, int idx2, int idx1);
void putInArray(int arg0, int idx2, int idx1, int val);
- void beforeBootScript() {}
- void initOnce() {}
- void startOfFrame() {}
+ virtual void beforeBootScript() {}
+ virtual void initOnce() {}
+ virtual int startOfFrame() { return 1; }
void endOfFrame() {}
void processKeyStroke(int keyPressed) {}
@@ -115,22 +115,52 @@ private:
public:
LogicHEsoccer(ScummEngine_v90he *vm);
+ ~LogicHEsoccer();
int versionID();
int32 dispatch(int op, int numArgs, int32 *args);
+ void beforeBootScript();
+ void initOnce();
+ int startOfFrame();
+
private:
int op_1001(int32 *args);
int op_1002(int32 *args);
int op_1003(int32 *args);
int op_1004(int32 *args);
- int op_1006(int32 *args);
+ int op_1006(int32 a1, int32 a2, int32 a3, int32 a4);
int op_1007(int32 *args);
int op_1008(int32 *args);
+ int op_1011(int32 a1, int32 a2, int32 a3, int32 a4, int32 a5);
int op_1012(int32 *args);
- int op_1014(int32 *args);
+ int op_1013(int32 a1, int32 a2, int32 a3);
+ int op_1014(int32 a1, int32 a2, int32 a3, int32 a4, int32 a5, int32 a6, int32 a7, int32 a8, int32 a9, int32 a10, int32 a11, int32 a12, int32 a13, int32 a14);
int op_1019(int32 *args);
- int op_1021(int32 *args);
+ int op_1020();
+ int op_1021(int32 a1, int32 a2, int32 a3, int32 a4, int32 a5, int32 a6, int32 a7);
+
+ // Two integer arrays are used between some functions
+ // Originally, these pointers were in _userData, but we keep them separate
+ // Also, doing it that would break things on non 32-bit systems...
+ bool _intArraysAllocated;
+ uint32 *_intArray1, *_intArray2;
+
+ // op_1007 allocates some arrays
+ // they're then filled by op_1019
+ byte _byteArray1[4096], _byteArray2[585];
+
+ // op_1011 has a subfunction
+ void op_1011_sub(int32 a1, int32 a2, int32 a3, int32 a4);
+
+ // op_1013 creates some array, purpose unknown
+ bool _array1013Allocated;
+ byte *_array1013;
+ uint32 _array1013Temp[11];
+ int op_sub5(int a1, int a2, int a3);
+
+ // op_1021 can (optionally) set two variables for use in op_1008
+ uint32 _var1021[2];
};
class LogicHEbaseball2001 : public LogicHE {
diff --git a/engines/scumm/he/palette_he.cpp b/engines/scumm/he/palette_he.cpp
index 7f517c56ed..49e43a040b 100644
--- a/engines/scumm/he/palette_he.cpp
+++ b/engines/scumm/he/palette_he.cpp
@@ -26,6 +26,7 @@
#ifdef ENABLE_HE
#include "common/system.h"
+#include "graphics/palette.h"
#include "scumm/scumm.h"
#include "scumm/he/intern_he.h"
#include "scumm/resource.h"
diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp
index ecb094f29b..552c420755 100644
--- a/engines/scumm/he/resource_he.cpp
+++ b/engines/scumm/he/resource_he.cpp
@@ -32,6 +32,7 @@
#include "audio/decoders/wave.h"
#include "graphics/cursorman.h"
+#include "graphics/maccursor.h"
#include "graphics/wincursor.h"
#include "common/archive.h"
@@ -172,11 +173,49 @@ bool MacResExtractor::extractResource(int id, CachedCursor *cc) {
if (!dataStream)
return false;
- int keyColor; // HACK: key color is ignored
- _resMgr->convertCrsrCursor(dataStream, &cc->bitmap, cc->width, cc->height, cc->hotspotX, cc->hotspotY,
- keyColor, _vm->_system->hasFeature(OSystem::kFeatureCursorHasPalette),
- &cc->palette, cc->palSize);
+ // If we don't have a cursor palette, force monochrome cursors
+ bool forceMonochrome = !_vm->_system->hasFeature(OSystem::kFeatureCursorHasPalette);
+ Graphics::MacCursor *macCursor = new Graphics::MacCursor();
+
+ if (!macCursor->readFromStream(*dataStream, forceMonochrome)) {
+ delete dataStream;
+ delete macCursor;
+ return false;
+ }
+
+ cc->bitmap = new byte[macCursor->getWidth() * macCursor->getHeight()];
+ cc->width = macCursor->getWidth();
+ cc->height = macCursor->getHeight();
+ cc->hotspotX = macCursor->getHotspotX();
+ cc->hotspotY = macCursor->getHotspotY();
+
+ if (forceMonochrome) {
+ // Convert to the SCUMM palette
+ const byte *srcBitmap = macCursor->getSurface();
+
+ for (int i = 0; i < macCursor->getWidth() * macCursor->getHeight(); i++) {
+ if (srcBitmap[i] == macCursor->getKeyColor()) // Transparent
+ cc->bitmap[i] = 255;
+ else if (srcBitmap[i] == 0) // Black
+ cc->bitmap[i] = 253;
+ else // White
+ cc->bitmap[i] = 254;
+ }
+ } else {
+ // Copy data and palette
+
+ // Sanity check. This code assumes that the key color is the same
+ assert(macCursor->getKeyColor() == 255);
+
+ memcpy(cc->bitmap, macCursor->getSurface(), macCursor->getWidth() * macCursor->getHeight());
+
+ cc->palette = new byte[256 * 3];
+ cc->palSize = 256;
+ memcpy(cc->palette, macCursor->getPalette(), 256 * 3);
+ }
+
+ delete macCursor;
delete dataStream;
return true;
}
diff --git a/engines/scumm/imuse/imuse_part.cpp b/engines/scumm/imuse/imuse_part.cpp
index 40889ec24f..487429c294 100644
--- a/engines/scumm/imuse/imuse_part.cpp
+++ b/engines/scumm/imuse/imuse_part.cpp
@@ -25,6 +25,8 @@
+#include "common/debug.h"
+#include "common/textconsole.h"
#include "common/util.h"
#include "scumm/imuse/imuse_internal.h"
#include "scumm/saveload.h"
diff --git a/engines/scumm/imuse/sysex_scumm.cpp b/engines/scumm/imuse/sysex_scumm.cpp
index c96b2f757b..78028c6056 100644
--- a/engines/scumm/imuse/sysex_scumm.cpp
+++ b/engines/scumm/imuse/sysex_scumm.cpp
@@ -24,6 +24,7 @@
#include "common/endian.h"
+#include "common/textconsole.h"
#include "common/util.h"
/*
diff --git a/engines/scumm/imuse_digi/dimuse.h b/engines/scumm/imuse_digi/dimuse.h
index 236edb5a89..1e96aa8827 100644
--- a/engines/scumm/imuse_digi/dimuse.h
+++ b/engines/scumm/imuse_digi/dimuse.h
@@ -26,6 +26,8 @@
#define SCUMM_IMUSE_DIGI_H
#include "common/scummsys.h"
+#include "common/mutex.h"
+#include "common/textconsole.h"
#include "common/util.h"
#include "scumm/imuse_digi/dimuse.h"
diff --git a/engines/scumm/imuse_digi/dimuse_codecs.cpp b/engines/scumm/imuse_digi/dimuse_codecs.cpp
index fd9deb7b44..c78e313fc2 100644
--- a/engines/scumm/imuse_digi/dimuse_codecs.cpp
+++ b/engines/scumm/imuse_digi/dimuse_codecs.cpp
@@ -229,7 +229,7 @@ int32 decompressADPCM(byte *compInput, byte *compOutput, int channels) {
// Every block starts with a 2 byte word. If that word is
// non-zero, it indicates the size of a block of raw audio
// data (not encoded) following it. That data we simply copy
- // to the output buffer and the proceed by decoding the
+ // to the output buffer and then proceed by decoding the
// remaining data.
//
// If on the other hand the word is zero, then what follows
diff --git a/engines/scumm/midiparser_ro.cpp b/engines/scumm/midiparser_ro.cpp
index e737d747ac..be77e4fd66 100644
--- a/engines/scumm/midiparser_ro.cpp
+++ b/engines/scumm/midiparser_ro.cpp
@@ -26,6 +26,7 @@
#include "audio/midiparser.h"
#include "audio/mididrv.h"
+#include "common/textconsole.h"
#include "common/util.h"
namespace Scumm {
diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp
index e81212fec8..b0786c924d 100644
--- a/engines/scumm/palette.cpp
+++ b/engines/scumm/palette.cpp
@@ -23,8 +23,11 @@
*/
#include "common/system.h"
+#include "common/textconsole.h"
#include "common/util.h"
+#include "graphics/palette.h"
+
#include "scumm/resource.h"
#include "scumm/scumm.h"
#include "scumm/scumm_v6.h"
diff --git a/engines/scumm/player_mod.h b/engines/scumm/player_mod.h
index 67d1bb4cbf..3f97c4cab9 100644
--- a/engines/scumm/player_mod.h
+++ b/engines/scumm/player_mod.h
@@ -31,7 +31,7 @@
#include "audio/mixer.h"
namespace Audio {
- class RateConverter;
+class RateConverter;
}
namespace Scumm {
diff --git a/engines/scumm/player_nes.h b/engines/scumm/player_nes.h
index 5f6e8f2d8d..402eea7bf8 100644
--- a/engines/scumm/player_nes.h
+++ b/engines/scumm/player_nes.h
@@ -35,7 +35,7 @@ namespace Scumm {
class ScummEngine;
namespace APUe {
- class APU;
+class APU;
}
static const int MAXVOLUME = 0x7F;
diff --git a/engines/scumm/player_pce.h b/engines/scumm/player_pce.h
index 3f5033f724..42153e8abc 100644
--- a/engines/scumm/player_pce.h
+++ b/engines/scumm/player_pce.h
@@ -27,6 +27,7 @@
#define SCUMM_PLAYER_PCE_H
#include "common/scummsys.h"
+#include "common/mutex.h"
#include "scumm/music.h"
#include "audio/audiostream.h"
#include "audio/mixer.h"
diff --git a/engines/scumm/player_sid.cpp b/engines/scumm/player_sid.cpp
index 0d5832a5fb..11468f3097 100644
--- a/engines/scumm/player_sid.cpp
+++ b/engines/scumm/player_sid.cpp
@@ -1296,7 +1296,7 @@ int Player_SID::readBuffer(int16 *buffer, const int numSamples) {
_cpuCyclesLeft = timingProps[_videoSystem].cyclesPerFrame;
}
// fetch samples
- int sampleCount = _sid->clock(_cpuCyclesLeft, (short*)buffer, samplesLeft);
+ int sampleCount = _sid->updateClock(_cpuCyclesLeft, (short*)buffer, samplesLeft);
samplesLeft -= sampleCount;
buffer += sampleCount;
}
diff --git a/engines/scumm/player_v4a.h b/engines/scumm/player_v4a.h
index 108dbcf317..458a39b5fe 100644
--- a/engines/scumm/player_v4a.h
+++ b/engines/scumm/player_v4a.h
@@ -27,6 +27,7 @@
#define SCUMM_PLAYER_V4A_H
#include "common/scummsys.h"
+#include "common/util.h"
#include "scumm/music.h"
#include "audio/mixer.h"
#include "audio/mods/tfmx.h"
diff --git a/engines/scumm/proc3ARM.s b/engines/scumm/proc3ARM.s
index 8b3e31f5f8..5acfa86c29 100644
--- a/engines/scumm/proc3ARM.s
+++ b/engines/scumm/proc3ARM.s
@@ -25,40 +25,40 @@
.text
- .global ClassicProc3RendererShadowARM
+ .global _ClassicProc3RendererShadowARM
-.equ _scaleIndexY , 112
-.equ _numStrips , 108
-.equ _palette , 104
-.equ _shadow_table , 100
-.equ _scaleIndexX , 96
-.equ _scaleX , 92
-.equ _height , 88
-.equ store_r14 , 84
-.equ store_r11 , 80
-.equ store_r10 , 76
-.equ store_r9 , 72
-.equ store_r8 , 68
-.equ store_r7 , 64
-.equ store_r6 , 60
-.equ store_r5 , 56
-.equ store_r4 , 52
-.equ src , 48
-.equ height , 44
-.equ len , 40
-.equ v1_shr , 36
-.equ v1_skip_width , 32
-.equ v1_destptr , 28
-.equ v1_scaleXstep , 24
-.equ v1_mask_ptr , 20
-.equ v1_y , 16
-.equ v1_scaletable , 12
-.equ pitch , 8
-.equ scaleIdxXPtr , 4
-.equ scaleIdxYPtr , 0
+.set _scaleIndexY , 112
+.set _numStrips , 108
+.set _palette , 104
+.set _shadow_table , 100
+.set _scaleIndexX , 96
+.set _scaleX , 92
+.set _height , 88
+.set store_r14 , 84
+.set store_r11 , 80
+.set store_r10 , 76
+.set store_r9 , 72
+.set store_r8 , 68
+.set store_r7 , 64
+.set store_r6 , 60
+.set store_r5 , 56
+.set store_r4 , 52
+.set src , 48
+.set height , 44
+.set len , 40
+.set v1_shr , 36
+.set v1_skip_width , 32
+.set v1_destptr , 28
+.set v1_scaleXstep , 24
+.set v1_mask_ptr , 20
+.set v1_y , 16
+.set v1_scaletable , 12
+.set pitch , 8
+.set scaleIdxXPtr , 4
+.set scaleIdxYPtr , 0
-.equ space , 48
+.set space , 48
@ r0 = _scaleY
@ r1 = v1
@@ -71,7 +71,7 @@
@ <> = _palette
@ <> = _numstrips
@ <> = _scaleIndexY
-ClassicProc3RendererShadowARM:
+_ClassicProc3RendererShadowARM:
@ shadow20 = false
@ shadowed = true
@ unscaled = false
diff --git a/engines/scumm/saveload.h b/engines/scumm/saveload.h
index 91e780bcd1..eead241b90 100644
--- a/engines/scumm/saveload.h
+++ b/engines/scumm/saveload.h
@@ -30,8 +30,8 @@
#include <stddef.h> // for ptrdiff_t
namespace Common {
- class SeekableReadStream;
- class WriteStream;
+class SeekableReadStream;
+class WriteStream;
}
namespace Scumm {
diff --git a/engines/scumm/scumm-md5.h b/engines/scumm/scumm-md5.h
index 40eeba3663..8f555818f4 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 Mon Oct 18 00:42:16 2010
+ This file was generated by the md5table tool on Sun Apr 17 10:46:26 2011
DO NOT EDIT MANUALLY!
*/
@@ -206,6 +206,7 @@ static const MD5Table md5table[] = {
{ "4c4820518e16e1a0e3616a3b021a04f3", "catalog", "HE CUP", "Preview", 10927456, Common::DE_DEU, Common::kPlatformUnknown },
{ "4cb9c3618f71668f8e4346c8f323fa82", "monkey2", "", "", 10700, Common::EN_ANY, Common::kPlatformMacintosh },
{ "4ce2d5b355964bbcb5e5ce73236ef868", "freddicove", "HE 100", "", -1, Common::RU_RUS, Common::kPlatformWindows },
+ { "4cfd3fda4a4e6e64a1fc488eba973b7a", "fbpack", "", "", -1, Common::EN_ANY, Common::kPlatformPC },
{ "4d34042713958b971cb139fba4658586", "atlantis", "FM-TOWNS", "", -1, Common::JA_JPN, Common::kPlatformFMTowns },
{ "4dbff3787aedcd96b0b325f2d92d7ad9", "maze", "HE 100", "Updated", -1, Common::EN_USA, Common::kPlatformUnknown },
{ "4dc780f1bc587a193ce8a97652791438", "loom", "EGA", "EGA", -1, Common::EN_ANY, Common::kPlatformAmiga },
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 5aea36ef66..f43aed53f7 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -1162,7 +1162,7 @@ Common::Error ScummEngine::init() {
warning("Starting game without the required 16bit color support.\nYou may experience color glitches");
initGraphics(screenWidth, screenHeight, (screenWidth > 320));
} else {
- error("16bit color support is required for this game");
+ return Common::Error(Common::kUnsupportedColorMode, "16bit color support is required for this game");
}
#endif
} else {
@@ -1222,7 +1222,7 @@ void ScummEngine::setupScumm() {
setupCharsetRenderer();
// Create and clear the text surface
- _textSurface.create(_screenWidth * _textSurfaceMultiplier, _screenHeight * _textSurfaceMultiplier, 1);
+ _textSurface.create(_screenWidth * _textSurfaceMultiplier, _screenHeight * _textSurfaceMultiplier, Graphics::PixelFormat::createFormatCLUT8());
clearTextSurface();
// Create the costume renderer
@@ -1648,6 +1648,8 @@ void ScummEngine_v90he::resetScumm() {
break;
case GID_SOCCER:
+ case GID_SOCCERMLS:
+ case GID_SOCCER2004:
_logicHE = new LogicHEsoccer(this);
break;
@@ -2494,7 +2496,7 @@ void ScummEngine_v90he::runBootscript() {
void ScummEngine::startManiac() {
debug(0, "stub startManiac()");
- displayMessage(0, "Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' directory inside the Tentacle game directory.");
+ displayMessage(0, "%s", _("Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' directory inside the Tentacle game directory."));
}
#pragma mark -
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index f3af84bb04..62c6c70e5a 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -35,6 +35,7 @@
#include "common/random.h"
#include "common/rect.h"
#include "common/str.h"
+#include "common/textconsole.h"
#include "graphics/surface.h"
#include "graphics/sjis.h"
@@ -56,12 +57,12 @@
#endif
namespace GUI {
- class Dialog;
+class Dialog;
}
using GUI::Dialog;
namespace Common {
- class SeekableReadStream;
- class WriteStream;
+class SeekableReadStream;
+class WriteStream;
}
/**
@@ -253,6 +254,8 @@ enum ScummGameId {
GID_FUNSHOP, // Used for all three funshops
GID_FOOTBALL,
GID_SOCCER,
+ GID_SOCCERMLS,
+ GID_SOCCER2004,
GID_BASEBALL2001,
GID_BASKETBALL,
GID_MOONBASE,
@@ -463,7 +466,7 @@ public:
virtual Common::Error run() {
Common::Error err;
err = init();
- if (err != Common::kNoError)
+ if (err.getCode() != Common::kNoError)
return err;
return go();
}
diff --git a/engines/scumm/smush/channel.cpp b/engines/scumm/smush/channel.cpp
index 4389890994..95b7653262 100644
--- a/engines/scumm/smush/channel.cpp
+++ b/engines/scumm/smush/channel.cpp
@@ -24,6 +24,8 @@
*/
+#include "common/textconsole.h"
+
#include "scumm/smush/channel.h"
namespace Scumm {
diff --git a/engines/scumm/smush/channel.h b/engines/scumm/smush/channel.h
index c35ac0ac00..717a294d96 100644
--- a/engines/scumm/smush/channel.h
+++ b/engines/scumm/smush/channel.h
@@ -29,7 +29,7 @@
#include "common/util.h"
namespace Common {
- class SeekableReadStream;
+class SeekableReadStream;
}
namespace Scumm {
diff --git a/engines/scumm/smush/codec37.cpp b/engines/scumm/smush/codec37.cpp
index 658d67c1b4..9dbbc6816f 100644
--- a/engines/scumm/smush/codec37.cpp
+++ b/engines/scumm/smush/codec37.cpp
@@ -25,6 +25,7 @@
#include "common/endian.h"
+#include "common/textconsole.h"
#include "common/util.h"
#include "scumm/bomp.h"
#include "scumm/smush/codec37.h"
diff --git a/engines/scumm/smush/codec47.cpp b/engines/scumm/smush/codec47.cpp
index 333fdabccf..47286ba4fc 100644
--- a/engines/scumm/smush/codec47.cpp
+++ b/engines/scumm/smush/codec47.cpp
@@ -25,6 +25,7 @@
#include "common/endian.h"
+#include "common/textconsole.h"
#include "common/util.h"
#include "scumm/bomp.h"
#include "scumm/smush/codec47.h"
@@ -342,11 +343,9 @@ void Codec47Decoder::makeTables47(int width) {
#ifdef USE_ARM_SMUSH_ASM
-extern "C" {
#ifndef IPHONE
#define ARM_Smush_decode2 _ARM_Smush_decode2
#endif
-}
extern "C" void ARM_Smush_decode2( byte *dst,
const byte *src,
diff --git a/engines/scumm/smush/saud_channel.cpp b/engines/scumm/smush/saud_channel.cpp
index 04ed955224..f730acf804 100644
--- a/engines/scumm/smush/saud_channel.cpp
+++ b/engines/scumm/smush/saud_channel.cpp
@@ -26,6 +26,7 @@
#include "common/endian.h"
#include "common/stream.h"
+#include "common/textconsole.h"
#include "scumm/util.h"
#include "scumm/smush/channel.h"
diff --git a/engines/scumm/smush/smush_mixer.h b/engines/scumm/smush/smush_mixer.h
index c7a7354511..3d62fdc722 100644
--- a/engines/scumm/smush/smush_mixer.h
+++ b/engines/scumm/smush/smush_mixer.h
@@ -27,6 +27,8 @@
#define SCUMM_SMUSH_MIXER_H
+#include "audio/mixer.h"
+#include "common/mutex.h"
#include "scumm/sound.h"
namespace Scumm {
diff --git a/engines/scumm/smush/smush_player.cpp b/engines/scumm/smush/smush_player.cpp
index 0e4f588593..2e39558372 100644
--- a/engines/scumm/smush/smush_player.cpp
+++ b/engines/scumm/smush/smush_player.cpp
@@ -31,6 +31,7 @@
#include "common/util.h"
#include "graphics/cursorman.h"
+#include "graphics/palette.h"
#include "scumm/bomp.h"
#include "scumm/file.h"
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index 54f35c1969..a38119584f 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -527,6 +527,10 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle
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);
+ }
+ if (!_sfxFile->isOpen()) {
sprintf(filename, "%d.%d.voc", offset, b);
_vm->openFile(*_sfxFile, filename);
}
diff --git a/engines/scumm/util.cpp b/engines/scumm/util.cpp
index ccd0230efa..5c3e4c9d0c 100644
--- a/engines/scumm/util.cpp
+++ b/engines/scumm/util.cpp
@@ -25,6 +25,7 @@
#include "scumm/util.h"
#include "common/util.h"
+#include "common/textconsole.h"
namespace Scumm {
diff --git a/engines/sky/autoroute.cpp b/engines/sky/autoroute.cpp
index dae4b94291..d6974837c6 100644
--- a/engines/sky/autoroute.cpp
+++ b/engines/sky/autoroute.cpp
@@ -25,6 +25,7 @@
#include "common/endian.h"
+#include "common/textconsole.h"
#include "common/util.h"
#include "sky/autoroute.h"
diff --git a/engines/sky/compact.cpp b/engines/sky/compact.cpp
index 78884e96dc..672fb38ca9 100644
--- a/engines/sky/compact.cpp
+++ b/engines/sky/compact.cpp
@@ -24,9 +24,10 @@
*/
+#include "common/debug.h"
#include "common/endian.h"
-#include "common/util.h"
#include "common/file.h"
+#include "common/textconsole.h"
#include "sky/compact.h"
#include "gui/message.h"
#include <stddef.h> // for ptrdiff_t
@@ -85,7 +86,7 @@ static const uint32 compactOffsets[] = {
MK16(Compact, alt),
MK16(Compact, request),
MK16(Compact, spWidth_xx),
- MK16(Compact, spColour),
+ MK16(Compact, spColor),
MK16(Compact, spTextId),
MK16(Compact, spTime),
MK16(Compact, arAnimIndex),
diff --git a/engines/sky/compact.h b/engines/sky/compact.h
index cd80d5cfbe..4861273146 100644
--- a/engines/sky/compact.h
+++ b/engines/sky/compact.h
@@ -31,7 +31,7 @@
#include "sky/skydefs.h"
namespace Common {
- class File;
+class File;
}
enum CptIds {
diff --git a/engines/sky/control.cpp b/engines/sky/control.cpp
index 55ba6039c3..f31f0f6ba9 100644
--- a/engines/sky/control.cpp
+++ b/engines/sky/control.cpp
@@ -26,11 +26,10 @@
#include "common/endian.h"
#include "common/config-manager.h"
-#include "common/file.h"
#include "common/events.h"
#include "common/system.h"
#include "common/savefile.h"
-#include "common/util.h"
+#include "common/textconsole.h"
#include "gui/message.h"
#include "sky/compact.h"
@@ -1275,7 +1274,7 @@ void Control::importOldCompact(Compact* destCpt, uint8 **srcPos, uint16 numElems
LODSW(*srcPos, destCpt->alt);
LODSW(*srcPos, destCpt->request);
LODSW(*srcPos, destCpt->spWidth_xx);
- LODSW(*srcPos, destCpt->spColour);
+ LODSW(*srcPos, destCpt->spColor);
LODSW(*srcPos, destCpt->spTextId);
LODSW(*srcPos, destCpt->spTime);
LODSW(*srcPos, destCpt->arAnimIndex);
diff --git a/engines/sky/control.h b/engines/sky/control.h
index a0024ce73b..e4428c1876 100644
--- a/engines/sky/control.h
+++ b/engines/sky/control.h
@@ -33,7 +33,7 @@
class OSystem;
namespace Common {
- class SaveFileManager;
+class SaveFileManager;
}
namespace Sky {
diff --git a/engines/sky/debug.cpp b/engines/sky/debug.cpp
index 2839665ff8..df55966a9a 100644
--- a/engines/sky/debug.cpp
+++ b/engines/sky/debug.cpp
@@ -24,7 +24,7 @@
*/
-#include "common/endian.h"
+#include "common/debug.h"
#include "common/util.h"
#include "sky/debug.h"
diff --git a/engines/sky/detection.cpp b/engines/sky/detection.cpp
index e72875fa4e..6871fc9604 100644
--- a/engines/sky/detection.cpp
+++ b/engines/sky/detection.cpp
@@ -34,6 +34,7 @@
#include "common/file.h"
#include "common/fs.h"
#include "common/savefile.h"
+#include "common/textconsole.h"
#include "engines/metaengine.h"
diff --git a/engines/sky/disk.cpp b/engines/sky/disk.cpp
index 5ad0c3eb19..3795c4166d 100644
--- a/engines/sky/disk.cpp
+++ b/engines/sky/disk.cpp
@@ -24,12 +24,12 @@
*/
+#include "common/debug.h"
+#include "common/textconsole.h"
#include "common/endian.h"
#include "common/file.h"
-#include "common/util.h"
#include "sky/disk.h"
-#include "sky/rnc_deco.h"
#include "sky/sky.h"
#include "sky/struc.h"
diff --git a/engines/sky/disk.h b/engines/sky/disk.h
index 3338cce385..0cdcbb4d0f 100644
--- a/engines/sky/disk.h
+++ b/engines/sky/disk.h
@@ -28,13 +28,12 @@
#include "common/scummsys.h"
-#include "common/str.h"
#include "sky/rnc_deco.h"
#define MAX_FILES_IN_LIST 60
namespace Common {
- class File;
+class File;
}
namespace Sky {
diff --git a/engines/sky/intro.cpp b/engines/sky/intro.cpp
index cf1910c5b1..506a6699c1 100644
--- a/engines/sky/intro.cpp
+++ b/engines/sky/intro.cpp
@@ -28,6 +28,7 @@
#include "common/util.h"
#include "common/events.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "sky/disk.h"
#include "sky/intro.h"
diff --git a/engines/sky/logic.cpp b/engines/sky/logic.cpp
index 1c1e2c9682..f9ebd0fb64 100644
--- a/engines/sky/logic.cpp
+++ b/engines/sky/logic.cpp
@@ -25,9 +25,8 @@
#include "common/endian.h"
#include "common/rect.h"
-#include "common/events.h"
#include "common/EventRecorder.h"
-#include "common/system.h"
+#include "common/textconsole.h"
#include "sky/autoroute.h"
#include "sky/compact.h"
@@ -1823,7 +1822,7 @@ bool Logic::fnHighlight(uint32 itemNo, uint32 pen, uint32 c) {
pen += 241;
Compact *textCompact = _skyCompact->fetchCpt(itemNo);
uint8 *sprData = (uint8 *)SkyEngine::fetchItem(textCompact->flag);
- _skyText->changeTextSpriteColour(sprData, (uint8)pen);
+ _skyText->changeTextSpriteColor(sprData, (uint8)pen);
return true;
}
@@ -2547,7 +2546,7 @@ void Logic::stdSpeak(Compact *target, uint32 textNum, uint32 animNum, uint32 bas
// form the text sprite, if player wants subtitles or
// if we couldn't find the speech file
DisplayedText textInfo;
- textInfo = _skyText->lowTextManager(textNum, FIXED_TEXT_WIDTH, 0, (uint8)target->spColour, true);
+ textInfo = _skyText->lowTextManager(textNum, FIXED_TEXT_WIDTH, 0, (uint8)target->spColor, true);
Compact *textCompact = _skyCompact->fetchCpt(textInfo.compactNum);
target->spTextId = textInfo.compactNum; //So we know what text to kill
byte *textGfx = textInfo.textData;
diff --git a/engines/sky/mouse.cpp b/engines/sky/mouse.cpp
index ca0ebcc19c..611010fa46 100644
--- a/engines/sky/mouse.cpp
+++ b/engines/sky/mouse.cpp
@@ -26,6 +26,7 @@
#include "common/events.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "graphics/cursorman.h"
#include "sky/disk.h"
#include "sky/logic.h"
diff --git a/engines/sky/music/adlibchannel.cpp b/engines/sky/music/adlibchannel.cpp
index e9c20de8c7..9b3c4338ab 100644
--- a/engines/sky/music/adlibchannel.cpp
+++ b/engines/sky/music/adlibchannel.cpp
@@ -25,6 +25,7 @@
#include "common/endian.h"
+#include "common/textconsole.h"
#include "common/util.h"
#include "sky/music/adlibchannel.h"
#include "sky/sky.h"
diff --git a/engines/sky/music/gmchannel.cpp b/engines/sky/music/gmchannel.cpp
index 3852a69068..be0afa8894 100644
--- a/engines/sky/music/gmchannel.cpp
+++ b/engines/sky/music/gmchannel.cpp
@@ -25,6 +25,7 @@
#include "gmchannel.h"
#include "common/util.h"
+#include "common/textconsole.h"
#include "audio/mididrv.h"
namespace Sky {
diff --git a/engines/sky/music/gmmusic.cpp b/engines/sky/music/gmmusic.cpp
index 8818c5b711..6a8529f287 100644
--- a/engines/sky/music/gmmusic.cpp
+++ b/engines/sky/music/gmmusic.cpp
@@ -28,6 +28,7 @@
#include "sky/sky.h"
#include "common/util.h"
#include "common/endian.h"
+#include "common/textconsole.h"
#include "audio/mididrv.h"
namespace Sky {
diff --git a/engines/sky/music/mt32music.cpp b/engines/sky/music/mt32music.cpp
index 51df95e451..4f47e511c7 100644
--- a/engines/sky/music/mt32music.cpp
+++ b/engines/sky/music/mt32music.cpp
@@ -28,6 +28,7 @@
#include "common/util.h"
#include "common/system.h"
#include "common/endian.h"
+#include "common/textconsole.h"
#include "audio/mididrv.h"
namespace Sky {
diff --git a/engines/sky/music/musicbase.cpp b/engines/sky/music/musicbase.cpp
index e1044a9505..748637f9d0 100644
--- a/engines/sky/music/musicbase.cpp
+++ b/engines/sky/music/musicbase.cpp
@@ -27,6 +27,7 @@
#include "sky/disk.h"
#include "common/util.h"
#include "common/endian.h"
+#include "common/textconsole.h"
namespace Sky {
diff --git a/engines/sky/screen.cpp b/engines/sky/screen.cpp
index a77017de38..a209571b37 100644
--- a/engines/sky/screen.cpp
+++ b/engines/sky/screen.cpp
@@ -27,6 +27,9 @@
#include "common/endian.h"
#include "common/events.h"
#include "common/system.h"
+#include "common/textconsole.h"
+
+#include "graphics/palette.h"
#include "sky/disk.h"
#include "sky/logic.h"
@@ -38,7 +41,7 @@
namespace Sky {
-uint8 Screen::_top16Colours[16*3] = {
+uint8 Screen::_top16Colors[16*3] = {
0, 0, 0,
38, 38, 38,
63, 63, 63,
@@ -63,7 +66,7 @@ Screen::Screen(OSystem *pSystem, Disk *pDisk, SkyCompact *skyCompact) {
_skyCompact = skyCompact;
int i;
- uint8 tmpPal[VGA_COLOURS * 3];
+ uint8 tmpPal[VGA_COLORS * 3];
_gameGrid = (uint8 *)malloc(GRID_X * GRID_Y * 2);
forceRefresh();
@@ -72,17 +75,17 @@ Screen::Screen(OSystem *pSystem, Disk *pDisk, SkyCompact *skyCompact) {
_scrollScreen = NULL;
//blank the first 240 colors of the palette
- memset(tmpPal, 0, GAME_COLOURS * 3);
+ memset(tmpPal, 0, GAME_COLORS * 3);
//set the remaining colors
- for (i = 0; i < (VGA_COLOURS-GAME_COLOURS); i++) {
- tmpPal[3 * GAME_COLOURS + i * 3 + 0] = (_top16Colours[i * 3 + 0] << 2) + (_top16Colours[i * 3 + 0] >> 4);
- tmpPal[3 * GAME_COLOURS + i * 3 + 1] = (_top16Colours[i * 3 + 1] << 2) + (_top16Colours[i * 3 + 1] >> 4);
- tmpPal[3 * GAME_COLOURS + i * 3 + 2] = (_top16Colours[i * 3 + 2] << 2) + (_top16Colours[i * 3 + 2] >> 4);
+ for (i = 0; i < (VGA_COLORS-GAME_COLORS); i++) {
+ tmpPal[3 * GAME_COLORS + i * 3 + 0] = (_top16Colors[i * 3 + 0] << 2) + (_top16Colors[i * 3 + 0] >> 4);
+ tmpPal[3 * GAME_COLORS + i * 3 + 1] = (_top16Colors[i * 3 + 1] << 2) + (_top16Colors[i * 3 + 1] >> 4);
+ tmpPal[3 * GAME_COLORS + i * 3 + 2] = (_top16Colors[i * 3 + 2] << 2) + (_top16Colors[i * 3 + 2] >> 4);
}
//set the palette
- _system->getPaletteManager()->setPalette(tmpPal, 0, VGA_COLOURS);
+ _system->getPaletteManager()->setPalette(tmpPal, 0, VGA_COLORS);
_currentPalette = 0;
_seqInfo.nextFrame = _seqInfo.framesLeft = 0;
@@ -109,32 +112,32 @@ void Screen::setFocusRectangle(const Common::Rect& rect) {
//set a new palette, pal is a pointer to dos vga rgb components 0..63
void Screen::setPalette(uint8 *pal) {
convertPalette(pal, _palette);
- _system->getPaletteManager()->setPalette(_palette, 0, GAME_COLOURS);
+ _system->getPaletteManager()->setPalette(_palette, 0, GAME_COLORS);
_system->updateScreen();
}
void Screen::setPaletteEndian(uint8 *pal) {
#ifdef SCUMM_BIG_ENDIAN
- uint8 endPalette[VGA_COLOURS * 3];
- for (uint16 cnt = 0; cnt < VGA_COLOURS * 3; cnt++)
+ uint8 endPalette[VGA_COLORS * 3];
+ for (uint16 cnt = 0; cnt < VGA_COLORS * 3; cnt++)
endPalette[cnt] = pal[cnt ^ 1];
convertPalette(endPalette, _palette);
#else
convertPalette(pal, _palette);
#endif
- _system->getPaletteManager()->setPalette(_palette, 0, GAME_COLOURS);
+ _system->getPaletteManager()->setPalette(_palette, 0, GAME_COLORS);
_system->updateScreen();
}
void Screen::halvePalette() {
- uint8 halfPalette[VGA_COLOURS * 3];
+ uint8 halfPalette[VGA_COLORS * 3];
- for (uint8 cnt = 0; cnt < GAME_COLOURS; cnt++) {
+ for (uint8 cnt = 0; cnt < GAME_COLORS; cnt++) {
halfPalette[cnt * 3 + 0] = _palette[cnt * 3 + 0] >> 1;
halfPalette[cnt * 3 + 1] = _palette[cnt * 3 + 1] >> 1;
halfPalette[cnt * 3 + 2] = _palette[cnt * 3 + 2] >> 1;
}
- _system->getPaletteManager()->setPalette(halfPalette, 0, GAME_COLOURS);
+ _system->getPaletteManager()->setPalette(halfPalette, 0, GAME_COLORS);
}
void Screen::setPalette(uint16 fileNum) {
@@ -168,7 +171,7 @@ void Screen::showScreen(uint8 *pScreen) {
void Screen::convertPalette(uint8 *inPal, uint8* outPal) {
int i;
- for (i = 0; i < VGA_COLOURS; i++) {
+ for (i = 0; i < VGA_COLORS; i++) {
outPal[3 * i + 0] = (inPal[3 * i + 0] << 2) + (inPal[3 * i + 0] >> 4);
outPal[3 * i + 1] = (inPal[3 * i + 1] << 2) + (inPal[3 * i + 1] >> 4);
outPal[3 * i + 2] = (inPal[3 * i + 2] << 2) + (inPal[3 * i + 2] >> 4);
@@ -247,8 +250,8 @@ void Screen::fnFadeDown(uint32 scroll) {
uint32 delayTime = _system->getMillis();
for (uint8 cnt = 0; cnt < 32; cnt++) {
delayTime += 20;
- palette_fadedown_helper(_palette, GAME_COLOURS);
- _system->getPaletteManager()->setPalette(_palette, 0, GAME_COLOURS);
+ palette_fadedown_helper(_palette, GAME_COLORS);
+ _system->getPaletteManager()->setPalette(_palette, 0, GAME_COLORS);
_system->updateScreen();
int32 waitTime = (int32)delayTime - _system->getMillis();
if (waitTime < 0)
@@ -296,7 +299,7 @@ void Screen::paletteFadeUp(uint16 fileNr) {
}
void Screen::paletteFadeUp(uint8 *pal) {
- byte tmpPal[VGA_COLOURS * 3];
+ byte tmpPal[VGA_COLORS * 3];
convertPalette(pal, tmpPal);
@@ -304,13 +307,13 @@ void Screen::paletteFadeUp(uint8 *pal) {
for (uint8 cnt = 1; cnt <= 32; cnt++) {
delayTime += 20;
- for (uint8 colCnt = 0; colCnt < GAME_COLOURS; colCnt++) {
+ for (uint8 colCnt = 0; colCnt < GAME_COLORS; colCnt++) {
_palette[colCnt * 3 + 0] = (tmpPal[colCnt * 3 + 0] * cnt) >> 5;
_palette[colCnt * 3 + 1] = (tmpPal[colCnt * 3 + 1] * cnt) >> 5;
_palette[colCnt * 3 + 2] = (tmpPal[colCnt * 3 + 2] * cnt) >> 5;
}
- _system->getPaletteManager()->setPalette(_palette, 0, GAME_COLOURS);
+ _system->getPaletteManager()->setPalette(_palette, 0, GAME_COLORS);
_system->updateScreen();
int32 waitTime = (int32)delayTime - _system->getMillis();
@@ -331,8 +334,8 @@ void Screen::fnFadeUp(uint32 palNum, uint32 scroll) {
if (palette == NULL)
error("Screen::fnFadeUp: can't fetch compact %X", palNum);
#ifdef SCUMM_BIG_ENDIAN
- byte tmpPal[VGA_COLOURS * 3];
- for (uint16 cnt = 0; cnt < VGA_COLOURS * 3; cnt++)
+ byte tmpPal[VGA_COLORS * 3];
+ for (uint16 cnt = 0; cnt < VGA_COLORS * 3; cnt++)
tmpPal[cnt] = palette[cnt ^ 1];
paletteFadeUp(tmpPal);
#else
diff --git a/engines/sky/screen.h b/engines/sky/screen.h
index 69a9a2fc8f..5e226c49ed 100644
--- a/engines/sky/screen.h
+++ b/engines/sky/screen.h
@@ -31,8 +31,9 @@
#include "sky/skydefs.h"
class OSystem;
+
namespace Common {
- struct Rect;
+struct Rect;
}
namespace Sky {
@@ -44,8 +45,8 @@ struct Compact;
struct DataFileHeader;
#define SCROLL_JUMP 16
-#define VGA_COLOURS 256
-#define GAME_COLOURS 240
+#define VGA_COLORS 256
+#define GAME_COLORS 240
#define FORE 1
#define BACK 0
@@ -100,8 +101,8 @@ private:
OSystem *_system;
Disk *_skyDisk;
SkyCompact *_skyCompact;
- static uint8 _top16Colours[16 * 3];
- uint8 _palette[VGA_COLOURS * 3];
+ static uint8 _top16Colors[16 * 3];
+ uint8 _palette[VGA_COLORS * 3];
uint32 _currentPalette;
uint8 _seqGrid[20 * 12];
diff --git a/engines/sky/sky.cpp b/engines/sky/sky.cpp
index f3556c84b3..f10ec1083a 100644
--- a/engines/sky/sky.cpp
+++ b/engines/sky/sky.cpp
@@ -25,6 +25,7 @@
#include "common/config-manager.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "sky/control.h"
#include "sky/debug.h"
diff --git a/engines/sky/sky.h b/engines/sky/sky.h
index d8ced1e569..58ac3ed26e 100644
--- a/engines/sky/sky.h
+++ b/engines/sky/sky.h
@@ -27,7 +27,8 @@
#define SKY_H
-#include "common/events.h"
+#include "common/error.h"
+#include "common/keyboard.h"
#include "engines/engine.h"
/**
@@ -52,7 +53,6 @@ struct SystemVars {
bool paused;
};
-struct Compact;
class Sound;
class Disk;
class Text;
@@ -106,7 +106,7 @@ protected:
virtual Common::Error run() {
Common::Error err;
err = init();
- if (err != Common::kNoError)
+ if (err.getCode() != Common::kNoError)
return err;
return go();
}
diff --git a/engines/sky/skydefs.h b/engines/sky/skydefs.h
index f68c0f826b..e3f3f3101f 100644
--- a/engines/sky/skydefs.h
+++ b/engines/sky/skydefs.h
@@ -92,7 +92,7 @@ namespace Sky {
#define C_BASE_MODE 0
#define C_BASE_MODE56 56
#define C_ACTION_MODE 4
-#define C_SP_COLOUR 90
+#define C_SP_COLOR 90
#define C_MEGA_SET 112
#define C_GRID_WIDTH 114
#define C_ANIM_UP 122
@@ -141,7 +141,7 @@ namespace Sky {
#define L_WAIT_SYNC 15
#define L_SIMPLE_MOD 16
-// characters with own colour set
+// characters with own color set
#define SP_COL_FOSTER 194
#define SP_COL_JOEY 216
#define SP_COL_JOBS 209
diff --git a/engines/sky/sound.cpp b/engines/sky/sound.cpp
index 3d247ed334..7191f6cd00 100644
--- a/engines/sky/sound.cpp
+++ b/engines/sky/sound.cpp
@@ -24,7 +24,9 @@
*/
+#include "common/debug.h"
#include "common/endian.h"
+#include "common/textconsole.h"
#include "sky/disk.h"
#include "sky/logic.h"
diff --git a/engines/sky/struc.h b/engines/sky/struc.h
index 295e31d9b0..987f074ed1 100644
--- a/engines/sky/struc.h
+++ b/engines/sky/struc.h
@@ -37,9 +37,9 @@ struct DisplayedText {
#include "common/pack-start.h" // START STRUCT PACKING
struct DataFileHeader {
- uint16 flag; // bit 0: set for colour data, clear for not
+ uint16 flag; // bit 0: set for color data, clear for not
// bit 1: set for compressed, clear for uncompressed
- // bit 2: set for 32 colours, clear for 16 colours
+ // bit 2: set for 32 colors, clear for 16 colors
uint16 s_x;
uint16 s_y;
uint16 s_width;
@@ -139,7 +139,7 @@ struct Compact {
uint16 request; // 42
uint16 spWidth_xx; // 43
- uint16 spColour; // 44
+ uint16 spColor; // 44
uint16 spTextId; // 45
uint16 spTime; // 46
diff --git a/engines/sky/text.cpp b/engines/sky/text.cpp
index 73c376dbbe..2464d93581 100644
--- a/engines/sky/text.cpp
+++ b/engines/sky/text.cpp
@@ -24,7 +24,9 @@
*/
+#include "common/debug.h"
#include "common/endian.h"
+#include "common/textconsole.h"
#include "sky/disk.h"
#include "sky/logic.h"
@@ -231,13 +233,13 @@ char Text::getTextChar(uint8 **data, uint32 *bitPos) {
}
}
-DisplayedText Text::displayText(uint32 textNum, uint8 *dest, bool centre, uint16 pixelWidth, uint8 color) {
+DisplayedText Text::displayText(uint32 textNum, uint8 *dest, bool center, uint16 pixelWidth, uint8 color) {
//Render text into buffer *dest
getText(textNum);
- return displayText(_textBuffer, dest, centre, pixelWidth, color);
+ return displayText(_textBuffer, dest, center, pixelWidth, color);
}
-DisplayedText Text::displayText(char *textPtr, uint8 *dest, bool centre, uint16 pixelWidth, uint8 color) {
+DisplayedText Text::displayText(char *textPtr, uint8 *dest, bool center, uint16 pixelWidth, uint8 color) {
//Render text pointed to by *textPtr in buffer *dest
uint32 centerTable[10];
uint16 lineWidth = 0;
@@ -319,7 +321,7 @@ DisplayedText Text::displayText(char *textPtr, uint8 *dest, bool centre, uint16
uint32 *centerTblPtr = centerTable;
do {
- if (centre) {
+ if (center) {
uint32 width = (pixelWidth - *centerTblPtr) >> 1;
centerTblPtr++;
curDest += width;
@@ -379,9 +381,9 @@ void Text::makeGameCharacter(uint8 textChar, uint8 *charSetPtr, uint8 *&dest, ui
dest = startPos + charWidth + _dtCharSpacing * 2 - 1;
}
-DisplayedText Text::lowTextManager(uint32 textNum, uint16 width, uint16 logicNum, uint8 color, bool centre) {
+DisplayedText Text::lowTextManager(uint32 textNum, uint16 width, uint16 logicNum, uint8 color, bool center) {
getText(textNum);
- DisplayedText textInfo = displayText(_textBuffer, NULL, centre, width, color);
+ DisplayedText textInfo = displayText(_textBuffer, NULL, center, width, color);
uint32 compactNum = FIRST_TEXT_COMPACT;
Compact *cpt = _skyCompact->fetchCpt(compactNum);
@@ -405,7 +407,7 @@ DisplayedText Text::lowTextManager(uint32 textNum, uint16 width, uint16 logicNum
return textInfo;
}
-void Text::changeTextSpriteColour(uint8 *sprData, uint8 newCol) {
+void Text::changeTextSpriteColor(uint8 *sprData, uint8 newCol) {
DataFileHeader *header = (DataFileHeader *)sprData;
sprData += sizeof(DataFileHeader);
for (uint16 cnt = 0; cnt < header->s_sp_size; cnt++)
diff --git a/engines/sky/text.h b/engines/sky/text.h
index 890cfb2e47..06aabf5094 100644
--- a/engines/sky/text.h
+++ b/engines/sky/text.h
@@ -52,14 +52,14 @@ class Text {
public:
Text(Disk *skyDisk, SkyCompact *skyCompact);
~Text();
- struct DisplayedText displayText(uint32 textNum, uint8 *dest, bool centre, uint16 pixelWidth, uint8 color);
- struct DisplayedText displayText(char *textPtr, uint8 *dest, bool centre, uint16 pixelWidth, uint8 color);
- struct DisplayedText lowTextManager(uint32 textNum, uint16 width, uint16 logicNum, uint8 color, bool centre);
+ struct DisplayedText displayText(uint32 textNum, uint8 *dest, bool center, uint16 pixelWidth, uint8 color);
+ struct DisplayedText displayText(char *textPtr, uint8 *dest, bool center, uint16 pixelWidth, uint8 color);
+ struct DisplayedText lowTextManager(uint32 textNum, uint16 width, uint16 logicNum, uint8 color, bool center);
void fnSetFont(uint32 fontNr);
void fnTextModule(uint32 textInfoId, uint32 textNo);
void fnPointerText(uint32 pointedId, uint16 mouseX, uint16 mouseY);
void logicCursor(Compact *textCompact, uint16 mouseX, uint16 mouseY);
- void changeTextSpriteColour(uint8 *sprData, uint8 newCol);
+ void changeTextSpriteColor(uint8 *sprData, uint8 newCol);
uint32 giveCurrentCharSet();
uint32 _numLetters; //no of chars in message
diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp
index 60176be1a9..7c17befcff 100644
--- a/engines/sword1/animation.cpp
+++ b/engines/sword1/animation.cpp
@@ -24,15 +24,16 @@
*/
#include "common/file.h"
+#include "common/events.h"
+#include "common/keyboard.h"
+#include "common/textconsole.h"
#include "sword1/sword1.h"
#include "sword1/animation.h"
#include "sword1/text.h"
-#include "audio/decoders/vorbis.h"
-#include "common/config-manager.h"
-#include "common/endian.h"
#include "common/str.h"
#include "common/system.h"
+#include "graphics/palette.h"
#include "graphics/surface.h"
#include "gui/message.h"
diff --git a/engines/sword1/control.cpp b/engines/sword1/control.cpp
index d4f6bfd1fe..d8ddd53e2e 100644
--- a/engines/sword1/control.cpp
+++ b/engines/sword1/control.cpp
@@ -29,7 +29,9 @@
#include "common/events.h"
#include "common/system.h"
#include "common/config-manager.h"
+#include "common/textconsole.h"
+#include "graphics/palette.h"
#include "graphics/thumbnail.h"
#include "gui/message.h"
diff --git a/engines/sword1/control.h b/engines/sword1/control.h
index 2e5bfc7197..db910f521f 100644
--- a/engines/sword1/control.h
+++ b/engines/sword1/control.h
@@ -33,7 +33,7 @@
class OSystem;
namespace Common {
- class SaveFileManager;
+class SaveFileManager;
}
namespace Sword1 {
diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp
index 855c7d1f83..fa8277033c 100644
--- a/engines/sword1/detection.cpp
+++ b/engines/sword1/detection.cpp
@@ -27,8 +27,6 @@
#include "sword1/control.h"
#include "base/plugins.h"
-#include "common/config-manager.h"
-#include "common/file.h"
#include "common/fs.h"
#include "common/savefile.h"
#include "common/system.h"
diff --git a/engines/sword1/eventman.cpp b/engines/sword1/eventman.cpp
index 55a438f506..9200e6a229 100644
--- a/engines/sword1/eventman.cpp
+++ b/engines/sword1/eventman.cpp
@@ -26,6 +26,7 @@
#include "sword1/eventman.h"
#include "sword1/sworddefs.h"
+#include "common/textconsole.h"
#include "common/util.h"
namespace Sword1 {
diff --git a/engines/sword1/logic.cpp b/engines/sword1/logic.cpp
index ef54167d41..3da3c457d0 100644
--- a/engines/sword1/logic.cpp
+++ b/engines/sword1/logic.cpp
@@ -25,9 +25,8 @@
#include "common/endian.h"
#include "common/util.h"
-#include "common/system.h"
-#include "common/events.h"
#include "common/EventRecorder.h"
+#include "common/textconsole.h"
#include "sword1/logic.h"
#include "sword1/text.h"
diff --git a/engines/sword1/memman.cpp b/engines/sword1/memman.cpp
index b08631dfc8..f315895eb0 100644
--- a/engines/sword1/memman.cpp
+++ b/engines/sword1/memman.cpp
@@ -25,6 +25,7 @@
#include "sword1/memman.h"
+#include "common/textconsole.h"
#include "common/util.h"
namespace Sword1 {
diff --git a/engines/sword1/menu.cpp b/engines/sword1/menu.cpp
index 34f6daf276..582bea82f8 100644
--- a/engines/sword1/menu.cpp
+++ b/engines/sword1/menu.cpp
@@ -309,7 +309,7 @@ void Menu::buildMenu() {
if (Logic::_scriptVars[MENU_LOOKING] || _subjectBarStatus == MENU_OPEN) { // either we're in the chooser or we're doing a 'LOOK AT'
if ((!objHeld) || (objHeld == _menuList[menuSlot]))
_objects[menuSlot]->setSelect(true);
- } else if (Logic::_scriptVars[SECOND_ITEM]) { // clicked luggage onto 2nd icon - we need to colour-highlight the 2 relevant icons & grey out the rest
+ } else if (Logic::_scriptVars[SECOND_ITEM]) { // clicked luggage onto 2nd icon - we need to color-highlight the 2 relevant icons & grey out the rest
if ((_menuList[menuSlot] == objHeld) || (_menuList[menuSlot] == Logic::_scriptVars[SECOND_ITEM]))
_objects[menuSlot]->setSelect(true);
} else { // this object is selected - ie. GREYED OUT
diff --git a/engines/sword1/mouse.h b/engines/sword1/mouse.h
index 1b4ca12183..3a7ea747fb 100644
--- a/engines/sword1/mouse.h
+++ b/engines/sword1/mouse.h
@@ -27,6 +27,7 @@
#define SWORD1_MOUSE_H
#include "common/scummsys.h"
+#include "common/rect.h"
#include "sword1/sworddefs.h"
#include "sword1/object.h"
diff --git a/engines/sword1/music.cpp b/engines/sword1/music.cpp
index 2b81ae1eb4..49f9f7271b 100644
--- a/engines/sword1/music.cpp
+++ b/engines/sword1/music.cpp
@@ -24,10 +24,9 @@
*/
-#include "common/endian.h"
#include "common/file.h"
#include "common/util.h"
-#include "common/system.h"
+#include "common/textconsole.h"
#include "sword1/sword1.h"
#include "sword1/music.h"
diff --git a/engines/sword1/objectman.cpp b/engines/sword1/objectman.cpp
index 9ac2c7a255..dde1498591 100644
--- a/engines/sword1/objectman.cpp
+++ b/engines/sword1/objectman.cpp
@@ -24,6 +24,7 @@
*/
+#include "common/textconsole.h"
#include "common/util.h"
#include "sword1/objectman.h"
diff --git a/engines/sword1/resman.cpp b/engines/sword1/resman.cpp
index 2bad8a79a7..f7b9eb8908 100644
--- a/engines/sword1/resman.cpp
+++ b/engines/sword1/resman.cpp
@@ -24,19 +24,14 @@
*/
-#include "common/config-manager.h"
-#include "common/util.h"
-#include "common/str.h"
-
-#include "engines/engine.h"
+#include "common/debug.h"
+#include "common/textconsole.h"
#include "sword1/memman.h"
#include "sword1/resman.h"
-#include "sword1/sworddefs.h"
#include "sword1/swordres.h"
#include "gui/message.h"
-#include "gui/gui-manager.h"
namespace Sword1 {
void guiFatalError(char *msg) {
diff --git a/engines/sword1/router.cpp b/engines/sword1/router.cpp
index 9ff5ae0c8e..3694ed2459 100644
--- a/engines/sword1/router.cpp
+++ b/engines/sword1/router.cpp
@@ -24,6 +24,7 @@
*/
#include "common/debug.h"
+#include "common/textconsole.h"
#include "common/util.h"
#include "sword1/router.h"
diff --git a/engines/sword1/screen.cpp b/engines/sword1/screen.cpp
index 1906fcb7fd..de96f6e7b4 100644
--- a/engines/sword1/screen.cpp
+++ b/engines/sword1/screen.cpp
@@ -25,8 +25,11 @@
#include "common/system.h"
+#include "common/textconsole.h"
#include "common/util.h"
+#include "graphics/palette.h"
+
#include "sword1/screen.h"
#include "sword1/logic.h"
#include "sword1/sworddefs.h"
diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp
index f8219eb21a..c970e72748 100644
--- a/engines/sword1/sound.cpp
+++ b/engines/sword1/sound.cpp
@@ -27,10 +27,9 @@
#include "common/endian.h"
#include "common/util.h"
-#include "common/events.h"
#include "common/EventRecorder.h"
#include "common/memstream.h"
-#include "common/system.h"
+#include "common/textconsole.h"
#include "sword1/sound.h"
#include "sword1/resman.h"
diff --git a/engines/sword1/sound.h b/engines/sword1/sound.h
index ae96132241..b6fcd6706f 100644
--- a/engines/sword1/sound.h
+++ b/engines/sword1/sound.h
@@ -34,7 +34,7 @@
#include "audio/mixer.h"
namespace Audio {
- class Mixer;
+class Mixer;
}
namespace Sword1 {
diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp
index 8768e62457..3b3eaaf8b9 100644
--- a/engines/sword1/sword1.cpp
+++ b/engines/sword1/sword1.cpp
@@ -37,6 +37,7 @@
#include "sword1/control.h"
#include "common/config-manager.h"
+#include "common/textconsole.h"
#include "engines/util.h"
diff --git a/engines/sword1/sword1.h b/engines/sword1/sword1.h
index 592d2da6f4..dbb683cd74 100644
--- a/engines/sword1/sword1.h
+++ b/engines/sword1/sword1.h
@@ -27,7 +27,9 @@
#define SWORD1_H
#include "engines/engine.h"
-#include "common/events.h"
+#include "common/error.h"
+#include "common/keyboard.h"
+#include "common/rect.h"
#include "common/util.h"
#include "sword1/sworddefs.h"
#include "sword1/console.h"
@@ -100,7 +102,7 @@ protected:
virtual Common::Error run() {
Common::Error err;
err = init();
- if (err != Common::kNoError)
+ if (err.getCode() != Common::kNoError)
return err;
return go();
}
diff --git a/engines/sword1/text.cpp b/engines/sword1/text.cpp
index ef3e07fe74..7c65533067 100644
--- a/engines/sword1/text.cpp
+++ b/engines/sword1/text.cpp
@@ -24,8 +24,7 @@
*/
-#include "common/endian.h"
-#include "common/util.h"
+#include "common/textconsole.h"
#include "sword1/text.h"
#include "sword1/resman.h"
diff --git a/engines/sword2/animation.cpp b/engines/sword2/animation.cpp
index 8d1a9836f4..a5a2499b01 100644
--- a/engines/sword2/animation.cpp
+++ b/engines/sword2/animation.cpp
@@ -26,7 +26,9 @@
*/
#include "common/file.h"
+#include "common/mutex.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "sword2/sword2.h"
#include "sword2/defs.h"
diff --git a/engines/sword2/controls.cpp b/engines/sword2/controls.cpp
index c55cc72493..4332f2811c 100644
--- a/engines/sword2/controls.cpp
+++ b/engines/sword2/controls.cpp
@@ -26,9 +26,7 @@
*/
-#include "common/events.h"
#include "common/rect.h"
-#include "common/config-manager.h"
#include "common/system.h"
#include "sword2/sword2.h"
@@ -465,7 +463,7 @@ void Widget::createSurfaceImage(int state, uint32 res, int x, int y, uint32 pc)
break;
case RLE16:
spriteType |= RDSPR_RLE256;
- // Points to just after last cdt_entry, i.e. start of colour
+ // Points to just after last cdt_entry, i.e. start of color
// table
colTablePtr = _vm->fetchAnimHeader(file) + AnimHeader::size()
+ anim_head.noAnimFrames * CdtEntry::size();
diff --git a/engines/sword2/events.cpp b/engines/sword2/events.cpp
index f0e0e567a4..24101e271c 100644
--- a/engines/sword2/events.cpp
+++ b/engines/sword2/events.cpp
@@ -26,6 +26,7 @@
*/
+#include "common/textconsole.h"
#include "sword2/sword2.h"
#include "sword2/defs.h"
diff --git a/engines/sword2/function.cpp b/engines/sword2/function.cpp
index 5e570fbaad..e0990ea120 100644
--- a/engines/sword2/function.cpp
+++ b/engines/sword2/function.cpp
@@ -28,6 +28,7 @@
#include "common/system.h"
#include "common/file.h"
+#include "common/textconsole.h"
#include "sword2/sword2.h"
#include "sword2/defs.h"
@@ -1859,15 +1860,15 @@ int32 Logic::fnSetScrollRightMouse(int32 *params) {
return IR_CONT;
}
-int32 Logic::fnColour(int32 *params) {
- // set border colour - useful during script development
- // eg. set to colour during a timer situation, then black when timed
+int32 Logic::fnColor(int32 *params) {
+ // set border color - useful during script development
+ // eg. set to color during a timer situation, then black when timed
// out
- // params 0: colour (see defines above)
+ // params 0: color (see defines above)
#ifdef SWORD2_DEBUG
- // what colour?
+ // what color?
switch (params[0]) {
case BLACK:
_vm->_screen->setPalette(0, 1, black, RDPAL_INSTANT);
@@ -1905,14 +1906,14 @@ static const uint8 blue[3] = { 0, 0, 255 };
#endif
int32 Logic::fnFlash(int32 *params) {
- // flash colour 0 (ie. border) - useful during script development
+ // flash color 0 (ie. border) - useful during script development
// eg. fnFlash(BLUE) where a text line is missed; RED when some code
// missing, etc
- // params: 0 colour to flash
+ // params: 0 color to flash
#ifdef SWORD2_DEBUG
- // what colour?
+ // what color?
switch (params[0]) {
case WHITE:
_vm->_screen->setPalette(0, 1, white, RDPAL_INSTANT);
diff --git a/engines/sword2/header.h b/engines/sword2/header.h
index 3f64152bb9..ed63c806bc 100644
--- a/engines/sword2/header.h
+++ b/engines/sword2/header.h
@@ -114,7 +114,7 @@ enum {
// standard file header
// animation header
// a string of CDT entries (one per frame of the anim)
-// a 16-byte colour table ONLY if (runTimeComp==RLE16)
+// a 16-byte color table ONLY if (runTimeComp==RLE16)
// a string of groups of (frame header + frame data)
// Animation Header
@@ -147,11 +147,11 @@ struct AnimHeader {
enum {
NONE = 0, // No frame compression
- RLE256 = 1, // James's RLE for 256-colour sprites
- RLE16 = 2 // James's RLE for 16- or 17-colour sprites
- // (raw blocks have max 16 colours for 2 pixels
+ RLE256 = 1, // James's RLE for 256-color sprites
+ RLE16 = 2 // James's RLE for 16- or 17-color sprites
+ // (raw blocks have max 16 colors for 2 pixels
// per byte, so '0's are encoded only as FLAT
- // for 17-colour sprites eg. George's mega-set)
+ // for 17-color sprites eg. George's mega-set)
};
// CDT Entry
diff --git a/engines/sword2/icons.cpp b/engines/sword2/icons.cpp
index b115eb373b..8336178ae5 100644
--- a/engines/sword2/icons.cpp
+++ b/engines/sword2/icons.cpp
@@ -157,33 +157,33 @@ void Mouse::buildMenu() {
byte *icon = NULL;
if (res) {
- bool icon_coloured;
+ bool icon_colored;
uint32 object_held = _vm->_logic->readVar(OBJECT_HELD);
uint32 combine_base = _vm->_logic->readVar(COMBINE_BASE);
if (_examiningMenuIcon) {
// When examining an object, that object is
- // coloured. The rest are greyed out.
- icon_coloured = (res == object_held);
+ // colored. The rest are greyed out.
+ icon_colored = (res == object_held);
} else if (combine_base) {
// When combining two menu object (i.e. using
- // one on another), both are coloured. The rest
+ // one on another), both are colored. The rest
// are greyed out.
- icon_coloured = (res == object_held || combine_base);
+ icon_colored = (res == object_held || combine_base);
} else {
// If an object is selected but we are not yet
// doing anything with it, the selected object
- // is greyed out. The rest are coloured.
- icon_coloured = (res != object_held);
+ // is greyed out. The rest are colored.
+ icon_colored = (res != object_held);
}
icon = _vm->_resman->openResource(res) + ResHeader::size();
- // The coloured icon is stored directly after the
+ // The colored icon is stored directly after the
// greyed out one.
- if (icon_coloured)
+ if (icon_colored)
icon += (menuIconWidth * RDMENU_ICONDEEP);
}
@@ -216,7 +216,7 @@ void Mouse::buildSystemMenu() {
else
menuIconWidth = RDMENU_ICONWIDE;
- // Build them all high in full colour - when one is clicked on all the
+ // Build them all high in full color - when one is clicked on all the
// rest will grey out.
for (int i = 0; i < ARRAYSIZE(icon_list); i++) {
diff --git a/engines/sword2/interpreter.cpp b/engines/sword2/interpreter.cpp
index a51ce5702c..a3804366d4 100644
--- a/engines/sword2/interpreter.cpp
+++ b/engines/sword2/interpreter.cpp
@@ -28,6 +28,7 @@
#include "common/util.h"
#include "common/stack.h"
+#include "common/textconsole.h"
#include "sword2/sword2.h"
#include "sword2/header.h"
@@ -147,7 +148,7 @@ void Logic::setupOpcodes() {
OPCODE(fnSetScrollLeftMouse),
OPCODE(fnSetScrollRightMouse),
/* 4C */
- OPCODE(fnColour),
+ OPCODE(fnColor),
OPCODE(fnFlash),
OPCODE(fnPreFetch),
OPCODE(fnGetPlayerSaveData),
diff --git a/engines/sword2/layers.cpp b/engines/sword2/layers.cpp
index d97b1395d5..47cc3ec232 100644
--- a/engines/sword2/layers.cpp
+++ b/engines/sword2/layers.cpp
@@ -35,6 +35,7 @@
#include "common/rect.h"
+#include "common/textconsole.h"
#include "sword2/sword2.h"
#include "sword2/defs.h"
@@ -166,7 +167,7 @@ void Screen::initBackground(int32 res, int32 new_palette) {
spriteInfo.type = 0;
spriteInfo.blend = 0;
spriteInfo.data = _vm->fetchShadingMask(file);
- spriteInfo.colourTable = 0;
+ spriteInfo.colorTable = 0;
if (openLightMask(&spriteInfo) != RD_OK)
error("Could not open light mask");
diff --git a/engines/sword2/logic.cpp b/engines/sword2/logic.cpp
index 511561c55a..c27bd76ff4 100644
--- a/engines/sword2/logic.cpp
+++ b/engines/sword2/logic.cpp
@@ -26,6 +26,7 @@
*/
+#include "common/textconsole.h"
#include "sword2/sword2.h"
#include "sword2/defs.h"
diff --git a/engines/sword2/logic.h b/engines/sword2/logic.h
index 793f87d037..e40a12bba3 100644
--- a/engines/sword2/logic.h
+++ b/engines/sword2/logic.h
@@ -260,7 +260,7 @@ public:
int32 fnStandAtAnim(int32 *params);
int32 fnSetScrollLeftMouse(int32 *params);
int32 fnSetScrollRightMouse(int32 *params);
- int32 fnColour(int32 *params);
+ int32 fnColor(int32 *params);
int32 fnFlash(int32 *params);
int32 fnPreFetch(int32 *params);
int32 fnGetPlayerSaveData(int32 *params);
diff --git a/engines/sword2/maketext.cpp b/engines/sword2/maketext.cpp
index 84a2fccedd..fda30981c8 100644
--- a/engines/sword2/maketext.cpp
+++ b/engines/sword2/maketext.cpp
@@ -27,17 +27,17 @@
// MAKETEXT - Constructs a single-frame text sprite: returns a handle to a
// FLOATING memory block containing the sprite, given a
-// null-terminated string, max width allowed, pen colour and
+// null-terminated string, max width allowed, pen color and
// pointer to required character set.
//
// NB 1) The routine does not create a standard file header or
// an anim header for the text sprite - the data simply begins
// with the frame header.
//
-// NB 2) If pen colour is zero, it copies the characters into
-// the sprite without remapping the colours.
-// ie. It can handle both the standard 2-colour font for speech
-// and any multicoloured fonts for control panels, etc.
+// NB 2) If pen color is zero, it copies the characters into
+// the sprite without remapping the colors.
+// ie. It can handle both the standard 2-color font for speech
+// and any multicolored fonts for control panels, etc.
//
// Based on textsprt.c as used for Broken Sword 1, but updated
// for new system by JEL on 9oct96 and updated again (for font
@@ -45,6 +45,7 @@
#include "common/system.h"
+#include "common/textconsole.h"
#include "sword2/sword2.h"
#include "sword2/defs.h"
@@ -58,10 +59,10 @@ namespace Sword2 {
#define MAX_LINES 30 // max character lines in output sprite
-#define BORDER_COL 200 // source colour for character border (only
- // needed for remapping colours)
+#define BORDER_COL 200 // source color for character border (only
+ // needed for remapping colors)
-#define LETTER_COL 193 // source colour for bulk of character ( " )
+#define LETTER_COL 193 // source color for bulk of character ( " )
#define LETTER_COL_PSX1 33
#define LETTER_COL_PSX2 34
#define SPACE ' '
@@ -76,9 +77,9 @@ namespace Sword2 {
*
* @param sentence pointer to a null-terminated string
* @param maxWidth the maximum allowed text sprite width in pixels
- * @param pen the text colour, or zero to use the source colours
+ * @param pen the text color, or zero to use the source colors
* @param fontRes the font resource id
- * @param border the border colour; black by default
+ * @param border the border color; black by default
* @return a handle to a floating memory block containing the text sprite
* @note The sentence must contain no leading, trailing or extra spaces.
* Out-of-range characters in the string are replaced by a special
@@ -200,7 +201,7 @@ uint16 FontRenderer::analyseSentence(byte *sentence, uint16 maxWidth, uint32 fon
*
* @param sentence pointer to a null-terminated string
* @param fontRes the font resource id
- * @param pen the text colour, or zero to use the source colours
+ * @param pen the text color, or zero to use the source colors
* @param line array of LineInfo structures, created by analyseSentence()
* @param noOfLines the number of lines, i.e. the number of elements in 'line'
* @return a handle to a floating memory block containing the text sprite
@@ -448,7 +449,7 @@ byte *FontRenderer::findChar(byte ch, byte *charSet) {
* @param spritePtr pointer to the sprite buffer
* @param spriteWidth the width of the character
* @param pen If zero, copy the data directly. Otherwise remap the
- * sprite's colours from BORDER_COL to _borderPen and from
+ * sprite's colors from BORDER_COL to _borderPen and from
* LETTER_COL to pen.
*/
@@ -464,7 +465,7 @@ void FontRenderer::copyChar(byte *charPtr, byte *spritePtr, uint16 spriteWidth,
byte *dest = rowPtr;
if (pen) {
- // Use the specified colours
+ // Use the specified colors
for (uint j = 0; j < frame.width; j++) {
switch (*source++) {
case 0:
@@ -489,7 +490,7 @@ void FontRenderer::copyChar(byte *charPtr, byte *spritePtr, uint16 spriteWidth,
}
} else {
// Pen is zero, so just copy character sprites
- // directly into text sprite without remapping colours.
+ // directly into text sprite without remapping colors.
// Apparently overlapping is never considered here?
memcpy(dest, source, frame.width);
source += frame.width;
@@ -528,13 +529,13 @@ uint32 FontRenderer::buildNewBloc(byte *ascii, int16 x, int16 y, uint16 width, u
frame_head.read(_blocList[i].text_mem);
switch (justification) {
- case POSITION_AT_CENTRE_OF_BASE:
+ case POSITION_AT_CENTER_OF_BASE:
// This one is always used for SPEECH TEXT; possibly
// also for pointer text
x -= (frame_head.width / 2);
y -= frame_head.height;
break;
- case POSITION_AT_CENTRE_OF_TOP:
+ case POSITION_AT_CENTER_OF_TOP:
x -= (frame_head.width / 2);
break;
case POSITION_AT_LEFT_OF_TOP:
@@ -550,10 +551,10 @@ uint32 FontRenderer::buildNewBloc(byte *ascii, int16 x, int16 y, uint16 width, u
x -= frame_head.width;
y -= frame_head.height;
break;
- case POSITION_AT_LEFT_OF_CENTRE:
+ case POSITION_AT_LEFT_OF_CENTER:
y -= (frame_head.height / 2);
break;
- case POSITION_AT_RIGHT_OF_CENTRE:
+ case POSITION_AT_RIGHT_OF_CENTER:
x -= frame_head.width;
y -= (frame_head.height) / 2;
break;
@@ -613,7 +614,7 @@ void FontRenderer::printTextBlocs() {
spriteInfo.type = _blocList[i].type;
spriteInfo.blend = 0;
spriteInfo.data = _blocList[i].text_mem + FrameHeader::size();
- spriteInfo.colourTable = 0;
+ spriteInfo.colorTable = 0;
spriteInfo.isText = true;
uint32 rv = _vm->_screen->drawSprite(&spriteInfo);
diff --git a/engines/sword2/maketext.h b/engines/sword2/maketext.h
index 63b65a32b1..52740d9de9 100644
--- a/engines/sword2/maketext.h
+++ b/engines/sword2/maketext.h
@@ -32,7 +32,7 @@
namespace Sword2 {
-// Output colour for character border - should be be black but note that we
+// Output color for character border - should be be black but note that we
// have to use a different pen number during sequences
#define BORDER_PEN 194
@@ -47,14 +47,14 @@ enum {
NO_JUSTIFICATION = 0,
// These all force text inside the screen edge margin when necessary
- POSITION_AT_CENTRE_OF_BASE = 1,
- POSITION_AT_CENTRE_OF_TOP = 2,
+ POSITION_AT_CENTER_OF_BASE = 1,
+ POSITION_AT_CENTER_OF_TOP = 2,
POSITION_AT_LEFT_OF_TOP = 3,
POSITION_AT_RIGHT_OF_TOP = 4,
POSITION_AT_LEFT_OF_BASE = 5,
POSITION_AT_RIGHT_OF_BASE = 6,
- POSITION_AT_LEFT_OF_CENTRE = 7,
- POSITION_AT_RIGHT_OF_CENTRE = 8
+ POSITION_AT_LEFT_OF_CENTER = 7,
+ POSITION_AT_RIGHT_OF_CENTER = 8
};
enum {
@@ -92,7 +92,7 @@ private:
// for overlap
int8 _charSpacing; // no. of pixels to separate characters along
// each line - negative for overlap
- uint8 _borderPen; // output pen colour of character borders
+ uint8 _borderPen; // output pen color of character borders
uint16 analyseSentence(byte *sentence, uint16 maxWidth, uint32 fontRes, LineInfo *line);
byte *buildTextSprite(byte *sentence, uint32 fontRes, uint8 pen, LineInfo *line, uint16 noOfLines);
diff --git a/engines/sword2/memory.cpp b/engines/sword2/memory.cpp
index cd36f9a19b..2b3784164e 100644
--- a/engines/sword2/memory.cpp
+++ b/engines/sword2/memory.cpp
@@ -48,6 +48,7 @@
//
// The number zero is used to represent the NULL pointer.
+#include "common/textconsole.h"
#include "sword2/sword2.h"
#include "sword2/memory.h"
diff --git a/engines/sword2/mouse.cpp b/engines/sword2/mouse.cpp
index c8e9387cb7..3a26ab17b7 100644
--- a/engines/sword2/mouse.cpp
+++ b/engines/sword2/mouse.cpp
@@ -29,6 +29,7 @@
#include "common/system.h"
#include "common/events.h"
#include "common/memstream.h"
+#include "common/textconsole.h"
#include "graphics/cursorman.h"
@@ -1270,8 +1271,8 @@ void Mouse::createPointerText(uint32 text_id, uint32 pointer_res) {
// Above right
justification = POSITION_AT_LEFT_OF_BASE;
} else {
- // Above centre
- justification = POSITION_AT_CENTRE_OF_BASE;
+ // Above center
+ justification = POSITION_AT_CENTER_OF_BASE;
}
} else if (yOffset > 0) {
// Below pointer
@@ -1282,20 +1283,20 @@ void Mouse::createPointerText(uint32 text_id, uint32 pointer_res) {
// Below right
justification = POSITION_AT_LEFT_OF_TOP;
} else {
- // Below centre
- justification = POSITION_AT_CENTRE_OF_TOP;
+ // Below center
+ justification = POSITION_AT_CENTER_OF_TOP;
}
} else {
// Same y-coord as pointer
if (xOffset < 0) {
- // Centre left
- justification = POSITION_AT_RIGHT_OF_CENTRE;
+ // Center left
+ justification = POSITION_AT_RIGHT_OF_CENTER;
} else if (xOffset > 0) {
- // Centre right
- justification = POSITION_AT_LEFT_OF_CENTRE;
+ // Center right
+ justification = POSITION_AT_LEFT_OF_CENTER;
} else {
- // Centre centre - shouldn't happen anyway!
- justification = POSITION_AT_LEFT_OF_CENTRE;
+ // Center center - shouldn't happen anyway!
+ justification = POSITION_AT_LEFT_OF_CENTER;
}
}
@@ -1433,7 +1434,7 @@ void Mouse::refreshInventory() {
// Can reset this now
_vm->_logic->writeVar(COMBINE_BASE, 0);
- // Cause 'object_held' icon to be greyed. The rest are coloured.
+ // Cause 'object_held' icon to be greyed. The rest are colored.
_examiningMenuIcon = true;
buildMenu();
_examiningMenuIcon = false;
diff --git a/engines/sword2/music.cpp b/engines/sword2/music.cpp
index aa91843432..ae6e2f1268 100644
--- a/engines/sword2/music.cpp
+++ b/engines/sword2/music.cpp
@@ -36,6 +36,7 @@
#include "common/memstream.h"
#include "common/substream.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "audio/decoders/mp3.h"
#include "audio/decoders/vorbis.h"
@@ -52,40 +53,6 @@
namespace Sword2 {
-/**
- * This class behaves like SeekableSubReadStream, except it remembers where the
- * previous read() or seek() took it, so that it can continue from that point
- * the next time. This is because we're frequently streaming two pieces of
- * music from the same file.
- */
-class SafeSubReadStream : public Common::SeekableSubReadStream {
-protected:
- uint32 _previousPos;
-public:
- SafeSubReadStream(SeekableReadStream *parentStream, uint32 begin, uint32 end);
- virtual uint32 read(void *dataPtr, uint32 dataSize);
- virtual bool seek(int32 offset, int whence = SEEK_SET);
-};
-
-SafeSubReadStream::SafeSubReadStream(SeekableReadStream *parentStream, uint32 begin, uint32 end)
- : SeekableSubReadStream(parentStream, begin, end, DisposeAfterUse::NO) {
- _previousPos = 0;
-}
-
-uint32 SafeSubReadStream::read(void *dataPtr, uint32 dataSize) {
- uint32 result;
- SeekableSubReadStream::seek(_previousPos);
- result = SeekableSubReadStream::read(dataPtr, dataSize);
- _previousPos = pos();
- return result;
-}
-
-bool SafeSubReadStream::seek(int32 offset, int whence) {
- bool result = SeekableSubReadStream::seek(offset, whence);
- _previousPos = pos();
- return result;
-}
-
static Audio::AudioStream *makeCLUStream(Common::File *fp, int size);
static Audio::AudioStream *makePSXCLUStream(Common::File *fp, int size);
@@ -196,19 +163,19 @@ static Audio::AudioStream *getAudioStream(SoundFileHandle *fh, const char *base,
return makeCLUStream(&fh->file, enc_len);
#ifdef USE_MAD
case kMP3Mode: {
- SafeSubReadStream *tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len);
+ Common::SafeSubReadStream *tmp = new Common::SafeSubReadStream(&fh->file, pos, pos + enc_len);
return Audio::makeMP3Stream(tmp, DisposeAfterUse::YES);
}
#endif
#ifdef USE_VORBIS
case kVorbisMode: {
- SafeSubReadStream *tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len);
+ Common::SafeSubReadStream *tmp = new Common::SafeSubReadStream(&fh->file, pos, pos + enc_len);
return Audio::makeVorbisStream(tmp, DisposeAfterUse::YES);
}
#endif
#ifdef USE_FLAC
case kFLACMode: {
- SafeSubReadStream *tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len);
+ Common::SafeSubReadStream *tmp = new Common::SafeSubReadStream(&fh->file, pos, pos + enc_len);
return Audio::makeFLACStream(tmp, DisposeAfterUse::YES);
}
#endif
diff --git a/engines/sword2/object.h b/engines/sword2/object.h
index 53819c08cc..94a968e58d 100644
--- a/engines/sword2/object.h
+++ b/engines/sword2/object.h
@@ -139,7 +139,7 @@ public:
// speech structure - contains fields used by speech scripts & text output
class ObjectSpeech {
- // int32 pen; // colour to use for body of characters
+ // int32 pen; // color to use for body of characters
// int32 width; // max width of text sprite
// int32 command; // speech script command id
// int32 ins1; // speech script instruction parameters
diff --git a/engines/sword2/palette.cpp b/engines/sword2/palette.cpp
index b348fd6bb5..a52160db25 100644
--- a/engines/sword2/palette.cpp
+++ b/engines/sword2/palette.cpp
@@ -27,6 +27,9 @@
#include "common/system.h"
+#include "common/textconsole.h"
+
+#include "graphics/palette.h"
#include "sword2/sword2.h"
#include "sword2/defs.h"
@@ -107,8 +110,8 @@ void Screen::setFullPalette(int32 palRes) {
pal += ResHeader::size();
- // always set colour 0 to black because most background screen
- // palettes have a bright colour 0 although it should come out
+ // always set color 0 to black because most background screen
+ // palettes have a bright color 0 although it should come out
// as black in the game!
_palette[0] = 0;
@@ -144,11 +147,11 @@ void Screen::setFullPalette(int32 palRes) {
}
/**
- * Matches a colour triplet to a palette index.
- * @param r red colour component
- * @param g green colour component
- * @param b blue colour component
- * @return the palette index of the closest matching colour in the palette
+ * Matches a color triplet to a palette index.
+ * @param r red color component
+ * @param g green color component
+ * @param b blue color component
+ * @return the palette index of the closest matching color in the palette
*/
// FIXME: This used to be inlined - probably a good idea - but the
@@ -160,16 +163,16 @@ uint8 Screen::quickMatch(uint8 r, uint8 g, uint8 b) {
/**
* Sets the palette.
- * @param startEntry the first colour entry to set
- * @param noEntries the number of colour entries to set
- * @param colourTable the new colour entries
+ * @param startEntry the first color entry to set
+ * @param noEntries the number of color entries to set
+ * @param colorTable the new color entries
* @param fadeNow whether to perform the change immediately or delayed
*/
-void Screen::setPalette(int16 startEntry, int16 noEntries, byte *colourTable, uint8 fadeNow) {
+void Screen::setPalette(int16 startEntry, int16 noEntries, byte *colorTable, uint8 fadeNow) {
assert(noEntries > 0);
- memmove(&_palette[3 * startEntry], colourTable, noEntries * 3);
+ memmove(&_palette[3 * startEntry], colorTable, noEntries * 3);
if (fadeNow == RDPAL_INSTANT) {
setSystemPalette(_palette, startEntry, noEntries);
diff --git a/engines/sword2/protocol.cpp b/engines/sword2/protocol.cpp
index ef2c622287..3d16e4ea4c 100644
--- a/engines/sword2/protocol.cpp
+++ b/engines/sword2/protocol.cpp
@@ -52,8 +52,8 @@ void Sword2Engine::fetchPalette(byte *screenFile, byte *palBuffer) {
palette = screenFile + ResHeader::size() + mscreenHeader.palette;
}
- // Always set colour 0 to black, because while most background screen
- // palettes have a bright colour 0 it should come out as black in the
+ // Always set color 0 to black, because while most background screen
+ // palettes have a bright color 0 it should come out as black in the
// game.
palBuffer[0] = 0;
diff --git a/engines/sword2/render.cpp b/engines/sword2/render.cpp
index a71d503d95..a47f8abe0d 100644
--- a/engines/sword2/render.cpp
+++ b/engines/sword2/render.cpp
@@ -234,24 +234,24 @@ void Screen::scaleImageGood(byte *dst, uint16 dstPitch, uint16 dstWidth, uint16
* used for debugging.
* @param x x-coordinate of the point
* @param y y-coordinate of the point
- * @param colour colour of the point
+ * @param color color of the point
*/
-void Screen::plotPoint(int x, int y, uint8 colour) {
+void Screen::plotPoint(int x, int y, uint8 color) {
byte *buf = _buffer + MENUDEEP * RENDERWIDE;
x -= _scrollX;
y -= _scrollY;
if (x >= 0 && x < RENDERWIDE && y >= 0 && y < RENDERDEEP) {
- buf[y * RENDERWIDE + x] = colour;
+ buf[y * RENDERWIDE + x] = color;
markAsDirty(x, y + MENUDEEP, x, y + MENUDEEP);
}
}
-static void plot(int x, int y, int colour, void *data) {
+static void plot(int x, int y, int color, void *data) {
Screen *screen = (Screen *)data;
- screen->plotPoint(x, y, (uint8) colour);
+ screen->plotPoint(x, y, (uint8) color);
}
/**
@@ -260,11 +260,11 @@ static void plot(int x, int y, int colour, void *data) {
* @param y0 y-coordinate of the start point
* @param x1 x-coordinate of the end point
* @param y1 y-coordinate of the end point
- * @param colour colour of the line
+ * @param color color of the line
*/
-void Screen::drawLine(int x0, int y0, int x1, int y1, uint8 colour) {
- Graphics::drawLine(x0, y0, x1, y1, colour, &plot, this);
+void Screen::drawLine(int x0, int y0, int x1, int y1, uint8 color) {
+ Graphics::drawLine(x0, y0, x1, y1, color, &plot, this);
}
/**
diff --git a/engines/sword2/resman.cpp b/engines/sword2/resman.cpp
index fa9c396ef3..36280cfda2 100644
--- a/engines/sword2/resman.cpp
+++ b/engines/sword2/resman.cpp
@@ -28,6 +28,7 @@
#include "common/file.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "sword2/sword2.h"
#include "sword2/defs.h"
diff --git a/engines/sword2/resman.h b/engines/sword2/resman.h
index dcc79927ea..75748e1568 100644
--- a/engines/sword2/resman.h
+++ b/engines/sword2/resman.h
@@ -29,7 +29,7 @@
#define SWORD2_RESMAN_H
namespace Common {
- class File;
+class File;
}
#define MAX_MEM_CACHE (8 * 1024 * 1024) // we keep up to 8 megs of resource data files in memory
diff --git a/engines/sword2/router.cpp b/engines/sword2/router.cpp
index 1548536ccb..c2b4d2e67f 100644
--- a/engines/sword2/router.cpp
+++ b/engines/sword2/router.cpp
@@ -27,6 +27,7 @@
#include "common/memstream.h"
+#include "common/textconsole.h"
#include "sword2/sword2.h"
#include "sword2/defs.h"
@@ -2344,9 +2345,9 @@ void Router::plotWalkGrid() {
plotCross(_node[i].x, _node[i].y, 184);
}
-void Router::plotCross(int16 x, int16 y, uint8 colour) {
- _vm->_screen->drawLine(x - 1, y - 1, x + 1, y + 1, colour);
- _vm->_screen->drawLine(x + 1, y - 1, x - 1, y + 1, colour);
+void Router::plotCross(int16 x, int16 y, uint8 color) {
+ _vm->_screen->drawLine(x - 1, y - 1, x + 1, y + 1, color);
+ _vm->_screen->drawLine(x + 1, y - 1, x - 1, y + 1, color);
}
void Router::loadWalkGrid() {
diff --git a/engines/sword2/router.h b/engines/sword2/router.h
index f556850797..1ad3dd74c4 100644
--- a/engines/sword2/router.h
+++ b/engines/sword2/router.h
@@ -193,7 +193,7 @@ private:
int32 solidWalkAnimator(WalkData *walkAnim);
#endif
- void plotCross(int16 x, int16 y, uint8 colour);
+ void plotCross(int16 x, int16 y, uint8 color);
public:
Router(Sword2Engine *vm) : _vm(vm), _diagonalx(0), _diagonaly(0) {
diff --git a/engines/sword2/saveload.cpp b/engines/sword2/saveload.cpp
index fab360a8ac..94ef8975b4 100644
--- a/engines/sword2/saveload.cpp
+++ b/engines/sword2/saveload.cpp
@@ -37,6 +37,7 @@
#include "common/memstream.h"
#include "common/savefile.h"
+#include "common/textconsole.h"
#include "sword2/sword2.h"
#include "sword2/defs.h"
diff --git a/engines/sword2/screen.cpp b/engines/sword2/screen.cpp
index 8c2db79297..a83e581fd4 100644
--- a/engines/sword2/screen.cpp
+++ b/engines/sword2/screen.cpp
@@ -32,6 +32,7 @@
#include "common/system.h"
#include "common/events.h"
+#include "common/textconsole.h"
#include "sword2/sword2.h"
#include "sword2/defs.h"
@@ -253,7 +254,7 @@ void Screen::updateDisplay(bool redrawScene) {
}
/**
- * Fill the screen buffer with palette colour zero. Note that it does not
+ * Fill the screen buffer with palette color zero. Note that it does not
* touch the menu areas of the screen.
*/
@@ -392,7 +393,7 @@ void Screen::displayMsg(byte *text, int time) {
spriteInfo.type = RDSPR_DISPLAYALIGN | RDSPR_NOCOMPRESSION | RDSPR_TRANS;
spriteInfo.blend = 0;
spriteInfo.data = text_spr + FrameHeader::size();
- spriteInfo.colourTable = 0;
+ spriteInfo.colorTable = 0;
spriteInfo.isText = true;
uint32 rv = drawSprite(&spriteInfo);
@@ -530,7 +531,7 @@ void Screen::processLayer(byte *file, uint32 layer_number) {
}
spriteInfo.blend = 0;
- spriteInfo.colourTable = 0;
+ spriteInfo.colorTable = 0;
// check for largest layer for debug info
@@ -572,7 +573,7 @@ void Screen::processImage(BuildUnit *build_unit) {
cdt_entry.read(_vm->fetchCdtEntry(file, build_unit->anim_pc));
frame_head.read(frame);
- // so that 0-colour is transparent
+ // so that 0-color is transparent
uint32 spriteType = RDSPR_TRANS;
if (anim_head.blend)
@@ -606,7 +607,7 @@ void Screen::processImage(BuildUnit *build_unit) {
case RLE16:
spriteType |= RDSPR_RLE16;
// points to just after last cdt_entry, ie.
- // start of colour table
+ // start of color table
colTablePtr = _vm->fetchAnimHeader(file) + AnimHeader::size() + anim_head.noAnimFrames * CdtEntry::size();
if (Sword2Engine::isPsx())
colTablePtr++; // There is one additional byte to skip before the table in psx version
@@ -632,7 +633,7 @@ void Screen::processImage(BuildUnit *build_unit) {
spriteInfo.blend = anim_head.blend;
// points to just after frame header, ie. start of sprite data
spriteInfo.data = frame + FrameHeader::size();
- spriteInfo.colourTable = colTablePtr;
+ spriteInfo.colorTable = colTablePtr;
spriteInfo.isText = false;
// check for largest layer for debug info
@@ -895,7 +896,7 @@ void Screen::rollCredits() {
// palette 3 * 256 bytes
// data width * height bytes
//
- // Note that the maximum colour component in the palette is 0x3F.
+ // Note that the maximum color component in the palette is 0x3F.
// This is the same resolution as the _paletteMatch table. I doubt
// that this is a coincidence, but let's use the image palette
// directly anyway, just to be safe.
@@ -1261,7 +1262,7 @@ void Screen::splashScreen() {
barSprite.scaledHeight = 0;
barSprite.type = RDSPR_RLE256FAST | RDSPR_TRANS;
barSprite.blend = 0;
- barSprite.colourTable = 0;
+ barSprite.colorTable = 0;
barSprite.data = frame + FrameHeader::size();
barSprite.isText = false;
diff --git a/engines/sword2/screen.h b/engines/sword2/screen.h
index 46eb53d0db..9ef4f28049 100644
--- a/engines/sword2/screen.h
+++ b/engines/sword2/screen.h
@@ -172,7 +172,7 @@ struct SpriteInfo {
uint16 type; // mask containing 'RDSPR_' bits specifying compression type, flip, transparency, etc
uint16 blend; // holds the blending values.
byte *data; // pointer to the sprite data
- byte *colourTable; // pointer to 16-byte colour table, only applicable to 16-col compression type
+ byte *colorTable; // pointer to 16-byte color table, only applicable to 16-col compression type
bool isText; // It is a engine-generated sprite containing text
};
@@ -442,8 +442,8 @@ public:
void buildDisplay();
- void plotPoint(int x, int y, uint8 colour);
- void drawLine(int x0, int y0, int x1, int y1, uint8 colour);
+ void plotPoint(int x, int y, uint8 color);
+ void drawLine(int x0, int y0, int x1, int y1, uint8 color);
void rollCredits();
void splashScreen();
diff --git a/engines/sword2/scroll.cpp b/engines/sword2/scroll.cpp
index eb080eb4b3..11ba546cf3 100644
--- a/engines/sword2/scroll.cpp
+++ b/engines/sword2/scroll.cpp
@@ -73,7 +73,7 @@ void Screen::setScrolling() {
return;
}
- // George's offset from the centre - the desired position for him
+ // George's offset from the center - the desired position for him
int16 offset_x = _thisScreen.player_feet_x - _thisScreen.feet_x;
int16 offset_y = _thisScreen.player_feet_y - _thisScreen.feet_y;
diff --git a/engines/sword2/sound.cpp b/engines/sword2/sound.cpp
index 261c8293bd..3cf8523113 100644
--- a/engines/sword2/sound.cpp
+++ b/engines/sword2/sound.cpp
@@ -39,6 +39,7 @@
#include "common/file.h"
#include "common/memstream.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "sword2/sword2.h"
#include "sword2/defs.h"
diff --git a/engines/sword2/sound.h b/engines/sword2/sound.h
index 2c4c8364c7..c37e006b76 100644
--- a/engines/sword2/sound.h
+++ b/engines/sword2/sound.h
@@ -39,6 +39,7 @@
#define SWORD2_SOUND_H
#include "common/file.h"
+#include "common/mutex.h"
#include "audio/audiostream.h"
#include "audio/mixer.h"
diff --git a/engines/sword2/speech.cpp b/engines/sword2/speech.cpp
index a0ddc333c2..ec8e198377 100644
--- a/engines/sword2/speech.cpp
+++ b/engines/sword2/speech.cpp
@@ -27,6 +27,7 @@
#include "common/file.h"
+#include "common/textconsole.h"
#include "sword2/sword2.h"
#include "sword2/defs.h"
@@ -104,16 +105,16 @@ void Logic::locateTalker(int32 *params) {
uint16 scale = obMega.calcScale();
- // Calc suitable centre point above the head, based on scaled
+ // Calc suitable center point above the head, based on scaled
// height
- // just use 'feet_x' as centre
+ // just use 'feet_x' as center
_textX = obMega.getFeetX();
// Add scaled y-offset to feet_y coord to get top of sprite
_textY = obMega.getFeetY() + (cdt_entry.y * scale) / 256;
} else {
- // It's a non-scaling anim - calc suitable centre point above
+ // It's a non-scaling anim - calc suitable center point above
// the head, based on scaled width
// x-coord + half of width
@@ -185,7 +186,7 @@ void Logic::formText(int32 *params) {
text + 2, _textX, _textY,
textWidth, obSpeech.getPen(),
RDSPR_TRANS | RDSPR_DISPLAYALIGN,
- _vm->_speechFontId, POSITION_AT_CENTRE_OF_BASE);
+ _vm->_speechFontId, POSITION_AT_CENTER_OF_BASE);
_vm->_resman->closeResource(text_res);
diff --git a/engines/sword2/sprite.cpp b/engines/sword2/sprite.cpp
index 255176292a..9a25812178 100644
--- a/engines/sword2/sprite.cpp
+++ b/engines/sword2/sprite.cpp
@@ -51,7 +51,7 @@ void Screen::mirrorSprite(byte *dst, byte *src, int16 w, int16 h) {
}
/**
- * This function takes a compressed frame of a sprite with up to 256 colours
+ * This function takes a compressed frame of a sprite with up to 256 colors
* and decompresses it.
* @param dst destination buffer
* @param src source buffer
@@ -82,7 +82,7 @@ int32 Screen::decompressRLE256(byte *dst, byte *src, int32 decompSize) {
break;
}
- // set the next 'headerByte' pixels to the next colour
+ // set the next 'headerByte' pixels to the next color
// at 'source'
memset(dst, *src, headerByte);
@@ -90,7 +90,7 @@ int32 Screen::decompressRLE256(byte *dst, byte *src, int32 decompSize) {
// block
dst += headerByte;
- // increment source pointer to just after this colour
+ // increment source pointer to just after this color
src++;
// if we've decompressed all of the data
@@ -135,7 +135,7 @@ int32 Screen::decompressRLE256(byte *dst, byte *src, int32 decompSize) {
}
/**
- * Unwinds a run of 16-colour data into 256-colour palette data.
+ * Unwinds a run of 16-color data into 256-color palette data.
*/
void Screen::unwindRaw16(byte *dst, byte *src, uint16 blockSize, byte *colTable) {
@@ -143,11 +143,11 @@ void Screen::unwindRaw16(byte *dst, byte *src, uint16 blockSize, byte *colTable)
while (blockSize > 1) {
if (Sword2Engine::isPsx()) {
- // 1st colour = number in table at position given by upper
+ // 1st color = number in table at position given by upper
// nibble of source byte
*dst++ = colTable[(*src) & 0x0f];
- // 2nd colour = number in table at position given by lower
+ // 2nd color = number in table at position given by lower
// nibble of source byte
*dst++ = colTable[(*src) >> 4];
} else {
@@ -165,19 +165,19 @@ void Screen::unwindRaw16(byte *dst, byte *src, uint16 blockSize, byte *colTable)
// if there's a final odd pixel
if (blockSize) {
- // colour = number in table at position given by upper nibble
+ // color = number in table at position given by upper nibble
// of source byte
*dst++ = colTable[(*src) >> 4];
}
}
/**
- * This function takes a compressed frame of a sprite (with up to 16 colours)
+ * This function takes a compressed frame of a sprite (with up to 16 colors)
* and decompresses it.
* @param dst destination buffer
* @param src source buffer
* @param decompSize the expected size of the uncompressed sprite
- * @param colTable mapping from the 16 encoded colours to the current palette
+ * @param colTable mapping from the 16 encoded colors to the current palette
*/
int32 Screen::decompressRLE16(byte *dst, byte *src, int32 decompSize, byte *colTable) {
@@ -199,14 +199,14 @@ int32 Screen::decompressRLE16(byte *dst, byte *src, int32 decompSize, byte *colT
}
// set the next 'headerByte' pixels to the next
- // colour at 'source'
+ // color at 'source'
memset(dst, *src, headerByte);
// increment destination pointer to just after this
// block
dst += headerByte;
- // increment source pointer to just after this colour
+ // increment source pointer to just after this color
src++;
// if we've decompressed all of the data
@@ -470,13 +470,13 @@ void Screen::deleteSurface(byte *surface) {
* RDSPR_DISPLAYALIGN The sprite is drawn relative to the top left corner
* of the screen
* RDSPR_FLIP The sprite is mirrored
- * RDSPR_TRANS The sprite has a transparent colour zero
+ * RDSPR_TRANS The sprite has a transparent color zero
* RDSPR_BLEND The sprite is translucent
* RDSPR_SHADOW The sprite is affected by the light mask. (Scaled
* sprites always are.)
* RDSPR_NOCOMPRESSION The sprite data is not compressed
- * RDSPR_RLE16 The sprite data is a 16-colour compressed sprite
- * RDSPR_RLE256 The sprite data is a 256-colour compressed sprite
+ * RDSPR_RLE16 The sprite data is a 16-color compressed sprite
+ * RDSPR_RLE256 The sprite data is a 256-color compressed sprite
* @param s all the information needed to draw the sprite
* @warning Sprites will only be drawn onto the background, not over menubar
* areas.
@@ -538,7 +538,7 @@ int32 Screen::drawSprite(SpriteInfo *s) {
byte *tempBuf2 = (byte *)malloc(s->w * s->h * 10);
memset(tempBuf2, 0, s->w * s->h * 2);
- unwindRaw16(tempBuf2, tempBuf, (s->w * (s->h / 2)), s->colourTable);
+ unwindRaw16(tempBuf2, tempBuf, (s->w * (s->h / 2)), s->colorTable);
sprite = (byte *)malloc(s->w * s->h);
if (!sprite) {
@@ -557,7 +557,7 @@ int32 Screen::drawSprite(SpriteInfo *s) {
if (!sprite)
return RDERR_OUTOFMEMORY;
- if (decompressRLE16(sprite, s->data, s->w * s->h, s->colourTable)) {
+ if (decompressRLE16(sprite, s->data, s->w * s->h, s->colorTable)) {
free(sprite);
return RDERR_DECOMPRESSION;
}
diff --git a/engines/sword2/startup.cpp b/engines/sword2/startup.cpp
index e4572d3c1a..ea1751eb5f 100644
--- a/engines/sword2/startup.cpp
+++ b/engines/sword2/startup.cpp
@@ -27,6 +27,7 @@
#include "common/file.h"
+#include "common/textconsole.h"
#include "sword2/sword2.h"
#include "sword2/defs.h"
diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp
index 7ad021b3a5..58f3547ff7 100644
--- a/engines/sword2/sword2.cpp
+++ b/engines/sword2/sword2.cpp
@@ -34,6 +34,7 @@
#include "common/EventRecorder.h"
#include "common/savefile.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "engines/metaengine.h"
#include "engines/util.h"
diff --git a/engines/sword2/sync.cpp b/engines/sword2/sync.cpp
index 1adc652b75..ee4c6b2238 100644
--- a/engines/sword2/sync.cpp
+++ b/engines/sword2/sync.cpp
@@ -26,6 +26,7 @@
*/
+#include "common/textconsole.h"
#include "sword2/sword2.h"
#include "sword2/defs.h"
diff --git a/engines/sword25/detection.cpp b/engines/sword25/detection.cpp
index 3900df2fcf..fe24675f8a 100644
--- a/engines/sword25/detection.cpp
+++ b/engines/sword25/detection.cpp
@@ -24,8 +24,6 @@
*/
#include "base/plugins.h"
-#include "common/savefile.h"
-#include "common/system.h"
#include "engines/advancedDetector.h"
#include "sword25/sword25.h"
diff --git a/engines/sword25/fmv/movieplayer.cpp b/engines/sword25/fmv/movieplayer.cpp
index 177bd38303..975f08be22 100644
--- a/engines/sword25/fmv/movieplayer.cpp
+++ b/engines/sword25/fmv/movieplayer.cpp
@@ -32,13 +32,17 @@
*
*/
+#include "common/debug.h"
+#include "common/system.h"
+#include "common/textconsole.h"
+#include "common/util.h"
+
#include "sword25/sword25.h" // for kDebugScript
#include "sword25/fmv/movieplayer.h"
#include "sword25/gfx/graphicengine.h"
#include "sword25/gfx/panel.h"
#include "sword25/kernel/kernel.h"
#include "sword25/package/packagemanager.h"
-#include "sword25/sfx/soundengine.h"
namespace Sword25 {
@@ -121,7 +125,7 @@ void MoviePlayer::update() {
const Graphics::Surface *s = _decoder.decodeNextFrame();
if (s) {
// Transfer the next frame
- assert(s->bytesPerPixel == 4);
+ assert(s->format.bytesPerPixel == 4);
#ifdef THEORA_INDIRECT_RENDERING
byte *frameData = (byte *)s->getBasePtr(0, 0);
diff --git a/engines/sword25/fmv/theora_decoder.cpp b/engines/sword25/fmv/theora_decoder.cpp
index e9901c04b0..86236fbd21 100644
--- a/engines/sword25/fmv/theora_decoder.cpp
+++ b/engines/sword25/fmv/theora_decoder.cpp
@@ -41,6 +41,7 @@
#ifdef USE_THEORADEC
#include "common/system.h"
+#include "common/textconsole.h"
#include "graphics/conversion.h"
#include "audio/decoders/raw.h"
#include "sword25/kernel/common.h"
@@ -289,7 +290,7 @@ bool TheoraDecoder::loadStream(Common::SeekableReadStream *stream) {
_surface = new Graphics::Surface();
- _surface->create(_theoraInfo.frame_width, _theoraInfo.frame_height, 4);
+ _surface->create(_theoraInfo.frame_width, _theoraInfo.frame_height, g_system->getScreenFormat());
return true;
}
diff --git a/engines/sword25/fmv/theora_decoder.h b/engines/sword25/fmv/theora_decoder.h
index a753bc58ac..4ed2af5f98 100644
--- a/engines/sword25/fmv/theora_decoder.h
+++ b/engines/sword25/fmv/theora_decoder.h
@@ -30,9 +30,12 @@
#ifdef USE_THEORADEC
+#include "common/rational.h"
#include "video/video_decoder.h"
#include "audio/audiostream.h"
#include "audio/mixer.h"
+#include "graphics/pixelformat.h"
+#include "graphics/surface.h"
#include <theora/theoradec.h>
#include <vorbis/codec.h>
diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp
index 5fefcec420..fbaa69d09c 100644
--- a/engines/sword25/gfx/graphicengine.cpp
+++ b/engines/sword25/gfx/graphicengine.cpp
@@ -86,7 +86,6 @@ GraphicEngine::GraphicEngine(Kernel *pKernel) :
GraphicEngine::~GraphicEngine() {
unregisterScriptBindings();
_backSurface.free();
- _frameBuffer.free();
delete _thumbnail;
}
@@ -112,8 +111,9 @@ bool GraphicEngine::init(int width, int height, int bitDepth, int backbufferCoun
_screenRect.right = _width;
_screenRect.bottom = _height;
- _backSurface.create(width, height, 4);
- _frameBuffer.create(width, height, 4);
+ const Graphics::PixelFormat format = g_system->getScreenFormat();
+
+ _backSurface.create(width, height, format);
// Standardmäßig ist Vsync an.
setVsync(true);
@@ -149,18 +149,6 @@ bool GraphicEngine::endFrame() {
_renderObjectManagerPtr->render();
- // FIXME: The following hack doesn't really work (all the thumbnails are empty)
-#if 0
- // HACK: The frame buffer surface is only used as the base for creating thumbnails when saving the
- // game, since the _backSurface is blanked. Currently I'm doing a slightly hacky check and only
- // copying the back surface if line 50 (the first line after the interface area) is non-blank
- if (READ_LE_UINT32((byte *)_backSurface.pixels + (_backSurface.pitch * 50)) & 0xffffff) {
- // Make a copy of the current frame into the frame buffer
- Common::copy((byte *)_backSurface.pixels, (byte *)_backSurface.pixels +
- (_backSurface.pitch * _backSurface.h), (byte *)_frameBuffer.pixels);
- }
-#endif
-
g_system->updateScreen();
return true;
@@ -206,6 +194,7 @@ bool GraphicEngine::fill(const Common::Rect *fillRectPtr, uint color) {
for (int i = rect.top; i < rect.bottom; i++) {
out = outo;
for (int j = rect.left; j < rect.right; j++) {
+#if defined(SCUMM_LITTLE_ENDIAN)
*out += (byte)(((cb - *out) * ca) >> 8);
out++;
*out += (byte)(((cg - *out) * ca) >> 8);
@@ -214,6 +203,16 @@ bool GraphicEngine::fill(const Common::Rect *fillRectPtr, uint color) {
out++;
*out = 255;
out++;
+#else
+ *out = 255;
+ out++;
+ *out += (byte)(((cr - *out) * ca) >> 8);
+ out++;
+ *out += (byte)(((cg - *out) * ca) >> 8);
+ out++;
+ *out += (byte)(((cb - *out) * ca) >> 8);
+ out++;
+#endif
}
outo += _backSurface.pitch;
@@ -226,10 +225,6 @@ bool GraphicEngine::fill(const Common::Rect *fillRectPtr, uint color) {
return true;
}
-Graphics::Surface *GraphicEngine::getScreenshot() {
- return &_frameBuffer;
-}
-
// -----------------------------------------------------------------------------
// RESOURCE MANAGING
// -----------------------------------------------------------------------------
@@ -257,8 +252,9 @@ Resource *GraphicEngine::loadResource(const Common::String &filename) {
return pResource;
}
- // Load sprite image
- if (filename.hasSuffix(".png") || filename.hasSuffix(".b25s")) {
+ // Load sprite image. Savegame thumbnails are also loaded here.
+ if (filename.hasSuffix(".png") || filename.hasSuffix(".b25s") ||
+ filename.hasPrefix("/saves")) {
bool result = false;
RenderedImage *pImage = new RenderedImage(filename, result);
if (!result) {
@@ -345,7 +341,8 @@ bool GraphicEngine::canLoadResource(const Common::String &filename) {
filename.hasSuffix("_ani.xml") ||
filename.hasSuffix("_fnt.xml") ||
filename.hasSuffix(".swf") ||
- filename.hasSuffix(".b25s");
+ filename.hasSuffix(".b25s") ||
+ filename.hasPrefix("/saves");
}
void GraphicEngine::updateLastFrameDuration() {
@@ -374,7 +371,9 @@ bool GraphicEngine::saveThumbnailScreenshot(const Common::String &filename) {
// Note: In ScumMVM, rather than saivng the thumbnail to a file, we store it in memory
// until needed when creating savegame files
delete _thumbnail;
- _thumbnail = Screenshot::createThumbnail(&_frameBuffer);
+
+ _thumbnail = Screenshot::createThumbnail(&_backSurface);
+
return true;
}
diff --git a/engines/sword25/gfx/graphicengine.h b/engines/sword25/gfx/graphicengine.h
index 38eecaa60f..8d12168b62 100644
--- a/engines/sword25/gfx/graphicengine.h
+++ b/engines/sword25/gfx/graphicengine.h
@@ -146,17 +146,6 @@ public:
*/
bool saveThumbnailScreenshot(const Common::String &filename);
- /**
- * Reads the current contents of the frame buffer
- * Notes: This method is for creating screenshots. It is not very optimised. It should only be called
- * after a call to EndFrame(), and before the next call to StartFrame().
- * @param Width Returns the width of the frame buffer
- * @param Height Returns the height of the frame buffer
- * @param Data Returns the raw data of the frame buffer as an array of 32-bit color values.
- */
- Graphics::Surface *getScreenshot();
-
-
RenderObjectPtr<Panel> getMainPanel();
/**
@@ -246,9 +235,6 @@ public:
Graphics::Surface _backSurface;
Graphics::Surface *getSurface() { return &_backSurface; }
- Graphics::Surface _frameBuffer;
- Graphics::Surface *getFrameBuffer() { return &_frameBuffer; }
-
Common::SeekableReadStream *_thumbnail;
Common::SeekableReadStream *getThumbnail() { return _thumbnail; }
diff --git a/engines/sword25/gfx/image/pngloader.cpp b/engines/sword25/gfx/image/pngloader.cpp
index f6c00b6968..d3c119b1a0 100644
--- a/engines/sword25/gfx/image/pngloader.cpp
+++ b/engines/sword25/gfx/image/pngloader.cpp
@@ -32,9 +32,6 @@
*
*/
-// Define to use ScummVM's PNG decoder, instead of libpng
-#define USE_INTERNAL_PNG_DECODER
-
#ifndef USE_INTERNAL_PNG_DECODER
// Disable symbol overrides so that we can use png.h
#define FORBIDDEN_SYMBOL_ALLOW_ALL
@@ -242,8 +239,8 @@ bool PNGLoader::decodeImage(const byte *fileDataPtr, uint fileSize, byte *&uncom
return doDecodeImage(fileDataPtr + pngOffset, fileSize - pngOffset, uncompressedDataPtr, width, height, pitch);
}
-bool PNGLoader::doImageProperties(const byte *fileDataPtr, uint fileSize, int &width, int &height) {
#ifndef USE_INTERNAL_PNG_DECODER
+bool PNGLoader::doImageProperties(const byte *fileDataPtr, uint fileSize, int &width, int &height) {
// Check for valid PNG signature
if (!doIsCorrectImageFormat(fileDataPtr, fileSize))
return false;
@@ -280,9 +277,7 @@ bool PNGLoader::doImageProperties(const byte *fileDataPtr, uint fileSize, int &w
// Destroy libpng structures
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
-#else
- // We don't need to read the image properties here...
-#endif
+
return true;
}
@@ -292,5 +287,9 @@ bool PNGLoader::imageProperties(const byte *fileDataPtr, uint fileSize, int &wid
return doImageProperties(fileDataPtr + pngOffset, fileSize - pngOffset, width, height);
}
+#else
+ // We don't need to read the image properties here...
+#endif
+
} // End of namespace Sword25
diff --git a/engines/sword25/gfx/image/pngloader.h b/engines/sword25/gfx/image/pngloader.h
index e0d68ff8b9..fea6ece0e9 100644
--- a/engines/sword25/gfx/image/pngloader.h
+++ b/engines/sword25/gfx/image/pngloader.h
@@ -40,6 +40,9 @@
namespace Sword25 {
+// Define to use ScummVM's PNG decoder, instead of libpng
+#define USE_INTERNAL_PNG_DECODER
+
/**
* Class for loading PNG files, and PNG data embedded into savegames.
*
@@ -50,7 +53,9 @@ protected:
PNGLoader() {} // Protected constructor to prevent instances
static bool doDecodeImage(const byte *fileDataPtr, uint fileSize, byte *&uncompressedDataPtr, int &width, int &height, int &pitch);
+#ifndef USE_INTERNAL_PNG_DECODER
static bool doImageProperties(const byte *fileDataPtr, uint fileSize, int &width, int &height);
+#endif
public:
@@ -72,6 +77,8 @@ public:
byte *&pUncompressedData,
int &width, int &height,
int &pitch);
+
+#ifndef USE_INTERNAL_PNG_DECODER
/**
* Extract the properties of an image.
* @param[in] fileDatePtr pointer to the image data
@@ -86,6 +93,8 @@ public:
static bool imageProperties(const byte *fileDatePtr, uint fileSize,
int &width,
int &height);
+#endif
+
};
} // End of namespace Sword25
diff --git a/engines/sword25/gfx/image/renderedimage.cpp b/engines/sword25/gfx/image/renderedimage.cpp
index ced3296e57..132c516c12 100644
--- a/engines/sword25/gfx/image/renderedimage.cpp
+++ b/engines/sword25/gfx/image/renderedimage.cpp
@@ -36,6 +36,7 @@
// INCLUDES
// -----------------------------------------------------------------------------
+#include "common/savefile.h"
#include "sword25/package/packagemanager.h"
#include "sword25/gfx/image/pngloader.h"
#include "sword25/gfx/image/renderedimage.h"
@@ -44,6 +45,14 @@
namespace Sword25 {
+// Duplicated from kernel/persistenceservice.cpp
+static Common::String generateSavegameFilename(uint slotID) {
+ char buffer[100];
+ // NOTE: This is hardcoded to sword25
+ snprintf(buffer, 100, "%s.%.3d", "sword25", slotID);
+ return Common::String(buffer);
+}
+
// -----------------------------------------------------------------------------
// CONSTRUCTION / DESTRUCTION
// -----------------------------------------------------------------------------
@@ -62,21 +71,36 @@ RenderedImage::RenderedImage(const Common::String &filename, bool &result) :
// Load file
byte *pFileData;
uint fileSize;
- pFileData = pPackage->getFile(filename, &fileSize);
+
+ if (filename.hasPrefix("/saves")) {
+ // A savegame thumbnail
+ Common::SaveFileManager *sfm = g_system->getSavefileManager();
+ int slotNum = atoi(filename.c_str() + filename.size() - 3);
+ Common::InSaveFile *file = sfm->openForLoading(generateSavegameFilename(slotNum));
+ fileSize = file->size();
+ pFileData = new byte[fileSize];
+ file->read(pFileData, fileSize);
+ delete file;
+ } else {
+ pFileData = pPackage->getFile(filename, &fileSize);
+ }
+
if (!pFileData) {
error("File \"%s\" could not be loaded.", filename.c_str());
return;
}
+#ifndef USE_INTERNAL_PNG_DECODER
// Determine image properties
- int pitch;
if (!PNGLoader::imageProperties(pFileData, fileSize, _width, _height)) {
error("Could not read image properties.");
delete[] pFileData;
return;
}
+#endif
// Uncompress the image
+ int pitch;
if (!PNGLoader::decodeImage(pFileData, fileSize, _data, _width, _height, pitch)) {
error("Could not decode image.");
delete[] pFileData;
@@ -187,7 +211,8 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe
// Create an encapsulating surface for the data
Graphics::Surface srcImage;
- srcImage.bytesPerPixel = 4;
+ // TODO: Is the data really in the screen format?
+ srcImage.format = g_system->getScreenFormat();
srcImage.pitch = _width * 4;
srcImage.w = _width;
srcImage.h = _height;
@@ -267,10 +292,11 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe
out = outo;
in = ino;
for (int j = 0; j < img->w; j++) {
- int b = in[0];
- int g = in[1];
- int r = in[2];
- int a = in[3];
+ uint32 pix = *(uint32 *)in;
+ int b = (pix >> 0) & 0xff;
+ int g = (pix >> 8) & 0xff;
+ int r = (pix >> 16) & 0xff;
+ int a = (pix >> 24) & 0xff;
in += inStep;
if (ca != 255) {
@@ -282,6 +308,7 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe
out += 4;
break;
case 255: // Full opacity
+#if defined(SCUMM_LITTLE_ENDIAN)
if (cb != 255)
*out++ = (b * cb) >> 8;
else
@@ -298,9 +325,28 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe
*out++ = r;
*out++ = a;
+#else
+ *out++ = a;
+
+ if (cr != 255)
+ *out++ = (r * cr) >> 8;
+ else
+ *out++ = r;
+
+ if (cg != 255)
+ *out++ = (g * cg) >> 8;
+ else
+ *out++ = g;
+
+ if (cb != 255)
+ *out++ = (b * cb) >> 8;
+ else
+ *out++ = b;
+#endif
break;
default: // alpha blending
+#if defined(SCUMM_LITTLE_ENDIAN)
if (cb != 255)
*out += ((b - *out) * a * cb) >> 16;
else
@@ -318,6 +364,25 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe
out++;
*out = 255;
out++;
+#else
+ *out = 255;
+ out++;
+ if (cr != 255)
+ *out += ((r - *out) * a * cr) >> 16;
+ else
+ *out += ((r - *out) * a) >> 8;
+ out++;
+ if (cg != 255)
+ *out += ((g - *out) * a * cg) >> 16;
+ else
+ *out += ((g - *out) * a) >> 8;
+ out++;
+ if (cb != 255)
+ *out += ((b - *out) * a * cb) >> 16;
+ else
+ *out += ((b - *out) * a) >> 8;
+ out++;
+#endif
}
}
outo += _backSurface->pitch;
@@ -369,7 +434,7 @@ void RenderedImage::copyDirectly(int posX, int posY) {
*/
Graphics::Surface *RenderedImage::scale(const Graphics::Surface &srcImage, int xSize, int ySize) {
Graphics::Surface *s = new Graphics::Surface();
- s->create(xSize, ySize, srcImage.bytesPerPixel);
+ s->create(xSize, ySize, srcImage.format);
int *horizUsage = scaleLine(xSize, srcImage.w);
int *vertUsage = scaleLine(ySize, srcImage.h);
@@ -380,8 +445,8 @@ Graphics::Surface *RenderedImage::scale(const Graphics::Surface &srcImage, int x
byte *destP = (byte *)s->getBasePtr(0, yp);
for (int xp = 0; xp < xSize; ++xp) {
- const byte *tempSrcP = srcP + (horizUsage[xp] * srcImage.bytesPerPixel);
- for (int byteCtr = 0; byteCtr < srcImage.bytesPerPixel; ++byteCtr) {
+ const byte *tempSrcP = srcP + (horizUsage[xp] * srcImage.format.bytesPerPixel);
+ for (int byteCtr = 0; byteCtr < srcImage.format.bytesPerPixel; ++byteCtr) {
*destP++ = *tempSrcP++;
}
}
diff --git a/engines/sword25/gfx/image/swimage.cpp b/engines/sword25/gfx/image/swimage.cpp
index 3b9b939eb3..0f3814eb54 100644
--- a/engines/sword25/gfx/image/swimage.cpp
+++ b/engines/sword25/gfx/image/swimage.cpp
@@ -56,14 +56,16 @@ SWImage::SWImage(const Common::String &filename, bool &result) :
return;
}
+#ifndef USE_INTERNAL_PNG_DECODER
// Determine image properties
- int pitch;
if (!PNGLoader::imageProperties(pFileData, fileSize, _width, _height)) {
error("Could not read image properties.");
return;
}
+#endif
// Uncompress the image
+ int pitch;
byte *pUncompressedData;
if (!PNGLoader::decodeImage(pFileData, fileSize, pUncompressedData, _width, _height, pitch)) {
error("Could not decode image.");
diff --git a/engines/sword25/gfx/image/vectorimagerenderer.cpp b/engines/sword25/gfx/image/vectorimagerenderer.cpp
index e8acd08909..99a47015fb 100644
--- a/engines/sword25/gfx/image/vectorimagerenderer.cpp
+++ b/engines/sword25/gfx/image/vectorimagerenderer.cpp
@@ -67,6 +67,7 @@ void art_rgb_run_alpha1(byte *buf, byte r, byte g, byte b, int alpha, int n) {
int v;
for (i = 0; i < n; i++) {
+#if defined(SCUMM_LITTLE_ENDIAN)
v = *buf;
*buf++ = v + (((b - v) * alpha + 0x80) >> 8);
v = *buf;
@@ -75,6 +76,16 @@ void art_rgb_run_alpha1(byte *buf, byte r, byte g, byte b, int alpha, int n) {
*buf++ = v + (((r - v) * alpha + 0x80) >> 8);
v = *buf;
*buf++ = MIN(v + alpha, 0xff);
+#else
+ v = *buf;
+ *buf++ = MIN(v + alpha, 0xff);
+ v = *buf;
+ *buf++ = v + (((r - v) * alpha + 0x80) >> 8);
+ v = *buf;
+ *buf++ = v + (((g - v) * alpha + 0x80) >> 8);
+ v = *buf;
+ *buf++ = v + (((b - v) * alpha + 0x80) >> 8);
+#endif
}
}
diff --git a/engines/sword25/gfx/screenshot.cpp b/engines/sword25/gfx/screenshot.cpp
index 35e94976eb..6ea2b574d6 100644
--- a/engines/sword25/gfx/screenshot.cpp
+++ b/engines/sword25/gfx/screenshot.cpp
@@ -36,6 +36,7 @@
#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "common/memstream.h"
+#include "common/textconsole.h"
#include "sword25/gfx/screenshot.h"
#include "sword25/kernel/filesystemutil.h"
#include <png.h>
@@ -127,14 +128,14 @@ Common::SeekableReadStream *Screenshot::createThumbnail(Graphics::Surface *data)
// generates a pixel of the target image. Finally, the result as a PNG file is stored as a file.
// The source image must be 800x600.
- if (data->w != 800 || data->h != 600 || data->bytesPerPixel != 4) {
+ if (data->w != 800 || data->h != 600 || data->format.bytesPerPixel != 4) {
error("The sreenshot dimensions have to be 800x600 in order to be saved as a thumbnail.");
return false;
}
// Buffer for the output thumbnail
Graphics::Surface thumbnail;
- thumbnail.create(200, 125, 4);
+ thumbnail.create(200, 125, g_system->getScreenFormat());
// Über das Zielbild iterieren und einen Pixel zur Zeit berechnen.
uint x, y;
diff --git a/engines/sword25/gfx/text.cpp b/engines/sword25/gfx/text.cpp
index bbfc3804a3..b1c1708565 100644
--- a/engines/sword25/gfx/text.cpp
+++ b/engines/sword25/gfx/text.cpp
@@ -173,10 +173,8 @@ bool Text::doRender() {
Common::Rect curRect = fontPtr->getCharacterRect((byte)(*iter).text[i]);
Common::Rect renderRect(curX, curY, curX + curRect.width(), curY + curRect.height());
- int renderX = curX + (renderRect.left - renderRect.left);
- int renderY = curY + (renderRect.top - renderRect.top);
renderRect.translate(curRect.left - curX, curRect.top - curY);
- result = charMapPtr->blit(renderX, renderY, Image::FLIP_NONE, &renderRect, _modulationColor);
+ result = charMapPtr->blit(curX, curY, Image::FLIP_NONE, &renderRect, _modulationColor);
if (!result)
break;
diff --git a/engines/sword25/kernel/filesystemutil.cpp b/engines/sword25/kernel/filesystemutil.cpp
index b4d4b25f8d..e5ec6c15db 100644
--- a/engines/sword25/kernel/filesystemutil.cpp
+++ b/engines/sword25/kernel/filesystemutil.cpp
@@ -34,8 +34,7 @@
#include "common/config-manager.h"
#include "common/fs.h"
-#include "common/savefile.h"
-#include "common/system.h"
+#include "common/textconsole.h"
#include "sword25/kernel/filesystemutil.h"
#include "sword25/kernel/persistenceservice.h"
diff --git a/engines/sword25/kernel/inputpersistenceblock.cpp b/engines/sword25/kernel/inputpersistenceblock.cpp
index f3aebef203..26c924dc82 100644
--- a/engines/sword25/kernel/inputpersistenceblock.cpp
+++ b/engines/sword25/kernel/inputpersistenceblock.cpp
@@ -32,6 +32,8 @@
*
*/
+#include "common/textconsole.h"
+
#include "sword25/kernel/inputpersistenceblock.h"
namespace Sword25 {
diff --git a/engines/sword25/kernel/kernel.cpp b/engines/sword25/kernel/kernel.cpp
index 6b99b0a115..99fec52040 100644
--- a/engines/sword25/kernel/kernel.cpp
+++ b/engines/sword25/kernel/kernel.cpp
@@ -95,10 +95,8 @@ Kernel::Kernel() :
_geometry = new Geometry(this);
assert(_geometry);
-#ifdef USE_THEORADEC
_fmv = new MoviePlayer(this);
assert(_fmv);
-#endif
_initSuccess = true;
}
@@ -121,10 +119,8 @@ Kernel::~Kernel() {
delete _geometry;
_geometry = 0;
-#ifdef USE_THEORADEC
delete _fmv;
_fmv = 0;
-#endif
delete _script;
_script = 0;
diff --git a/engines/sword25/kernel/kernel.h b/engines/sword25/kernel/kernel.h
index 9e7ee0fdd9..3abf43d239 100644
--- a/engines/sword25/kernel/kernel.h
+++ b/engines/sword25/kernel/kernel.h
@@ -48,6 +48,7 @@
#include "common/scummsys.h"
#include "common/random.h"
#include "common/stack.h"
+#include "common/textconsole.h"
#include "common/util.h"
#include "engines/engine.h"
diff --git a/engines/sword25/kernel/kernel_script.cpp b/engines/sword25/kernel/kernel_script.cpp
index 458f6b2deb..43a144b2c6 100644
--- a/engines/sword25/kernel/kernel_script.cpp
+++ b/engines/sword25/kernel/kernel_script.cpp
@@ -42,45 +42,9 @@
namespace Sword25 {
-static int disconnectService(lua_State *L) {
- // This function apparently is not used by the game scripts
- lua_pushboolean(L, true);
-
- return 1;
-}
-
-static int getActiveServiceIdentifier(lua_State *L) {
- // This function apparently is not used by the game scripts
- lua_pushstring(L, "QUUX");
-
- return 1;
-}
-
-static int getSuperclassCount(lua_State *L) {
- // This function is only used by a single function in system/kernel.lua which is never called.
- lua_pushnumber(L, 0);
-
- return 1;
-}
-
-static int getSuperclassIdentifier(lua_State *L) {
- // This function is only used by a single function in system/kernel.lua which is never called.
- lua_pushstring(L, "FOO");
-
- return 1;
-}
-
-static int getServiceCount(lua_State *L) {
- // This function is only used by a single function in system/kernel.lua which is never called.
- lua_pushnumber(L, 0);
-
- return 1;
-}
-
-static int getServiceIdentifier(lua_State *L) {
- // This function is only used by a single function in system/kernel.lua which is never called.
- lua_pushstring(L, "BAR");
-
+// Marks a function that should never be used
+static int dummyFuncError(lua_State *L) {
+ error("Dummy function invoked by LUA");
return 1;
}
@@ -177,12 +141,12 @@ static int getUsedMemory(lua_State *L) {
static const char *KERNEL_LIBRARY_NAME = "Kernel";
static const luaL_reg KERNEL_FUNCTIONS[] = {
- {"DisconnectService", disconnectService},
- {"GetActiveServiceIdentifier", getActiveServiceIdentifier},
- {"GetSuperclassCount", getSuperclassCount},
- {"GetSuperclassIdentifier", getSuperclassIdentifier},
- {"GetServiceCount", getServiceCount},
- {"GetServiceIdentifier", getServiceIdentifier},
+ {"DisconnectService", dummyFuncError},
+ {"GetActiveServiceIdentifier", dummyFuncError},
+ {"GetSuperclassCount", dummyFuncError},
+ {"GetSuperclassIdentifier", dummyFuncError},
+ {"GetServiceCount", dummyFuncError},
+ {"GetServiceIdentifier", dummyFuncError},
{"GetMilliTicks", getMilliTicks},
{"GetTimer", getTimer},
{"StartService", startService},
@@ -241,20 +205,6 @@ static int setY(lua_State *L) {
return 0;
}
-static int getClientX(lua_State *L) {
- // This function apparently is not used by the game scripts
- lua_pushnumber(L, 0);
-
- return 1;
-}
-
-static int getClientY(lua_State *L) {
- // This function apparently is not used by the game scripts
- lua_pushnumber(L, 0);
-
- return 1;
-}
-
static int getWidth(lua_State *L) {
// This function apparently is not used by the game scripts
lua_pushnumber(L, 800);
@@ -332,20 +282,6 @@ static int closeWanted(lua_State *L) {
return 1;
}
-static int waitForFocus(lua_State *L) {
- // This function apparently is not used by the game scripts
- lua_pushbooleancpp(L, true);
-
- return 1;
-}
-
-static int hasFocus(lua_State *L) {
- // This function apparently is not used by the game scripts
- lua_pushbooleancpp(L, true);
-
- return 1;
-}
-
static const char *WINDOW_LIBRARY_NAME = "Window";
static const luaL_reg WINDOW_FUNCTIONS[] = {
@@ -355,8 +291,8 @@ static const luaL_reg WINDOW_FUNCTIONS[] = {
{"SetX", setX},
{"GetY", getY},
{"SetY", setY},
- {"GetClientX", getClientX},
- {"GetClientY", getClientY},
+ {"GetClientX", dummyFuncError},
+ {"GetClientY", dummyFuncError},
{"GetWidth", getWidth},
{"GetHeight", getHeight},
{"SetWidth", setWidth},
@@ -365,8 +301,8 @@ static const luaL_reg WINDOW_FUNCTIONS[] = {
{"SetTitle", setTitle},
{"ProcessMessages", processMessages},
{"CloseWanted", closeWanted},
- {"WaitForFocus", waitForFocus},
- {"HasFocus", hasFocus},
+ {"WaitForFocus", dummyFuncError},
+ {"HasFocus", dummyFuncError},
{0, 0}
};
@@ -436,29 +372,6 @@ static int emptyCache(lua_State *L) {
return 0;
}
-static int isLogCacheMiss(lua_State *L) {
- Kernel *pKernel = Kernel::getInstance();
- assert(pKernel);
- ResourceManager *pResource = pKernel->getResourceManager();
- assert(pResource);
-
- // This isn't used in any script
- lua_pushbooleancpp(L, false);
-
- return 1;
-}
-
-static int setLogCacheMiss(lua_State *L) {
- Kernel *pKernel = Kernel::getInstance();
- assert(pKernel);
- ResourceManager *pResource = pKernel->getResourceManager();
- assert(pResource);
-
- // This isn't used in any script
-
- return 0;
-}
-
static int dumpLockedResources(lua_State *L) {
Kernel *pKernel = Kernel::getInstance();
assert(pKernel);
@@ -478,8 +391,8 @@ static const luaL_reg RESOURCE_FUNCTIONS[] = {
{"GetMaxMemoryUsage", getMaxMemoryUsage},
{"SetMaxMemoryUsage", setMaxMemoryUsage},
{"EmptyCache", emptyCache},
- {"IsLogCacheMiss", isLogCacheMiss},
- {"SetLogCacheMiss", setLogCacheMiss},
+ {"IsLogCacheMiss", dummyFuncError},
+ {"SetLogCacheMiss", dummyFuncError},
{"DumpLockedResources", dumpLockedResources},
{0, 0}
};
diff --git a/engines/sword25/kernel/objectregistry.h b/engines/sword25/kernel/objectregistry.h
index 8d0f4a314b..69d961ae91 100644
--- a/engines/sword25/kernel/objectregistry.h
+++ b/engines/sword25/kernel/objectregistry.h
@@ -37,6 +37,7 @@
#include "common/func.h"
#include "common/hashmap.h"
+#include "common/textconsole.h"
#include "sword25/kernel/common.h"
namespace Sword25 {
diff --git a/engines/sword25/kernel/persistenceservice.cpp b/engines/sword25/kernel/persistenceservice.cpp
index be66b6abf0..6bb2b1b102 100644
--- a/engines/sword25/kernel/persistenceservice.cpp
+++ b/engines/sword25/kernel/persistenceservice.cpp
@@ -32,6 +32,9 @@
*
*/
+// Disable symbol overrides so that we can use zlib.h
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
#include "common/fs.h"
#include "common/savefile.h"
#include "sword25/kernel/kernel.h"
@@ -102,7 +105,6 @@ struct SavegameInformation {
bool isOccupied;
bool isCompatible;
Common::String description;
- Common::String filename;
uint gamedataLength;
uint gamedataOffset;
uint gamedataUncompressedLength;
@@ -115,7 +117,6 @@ struct SavegameInformation {
isOccupied = false;
isCompatible = false;
description = "";
- filename = "";
gamedataLength = 0;
gamedataOffset = 0;
gamedataUncompressedLength = 0;
@@ -130,18 +131,18 @@ struct PersistenceService::Impl {
}
void reloadSlots() {
- // Über alle Spielstanddateien iterieren und deren Infos einlesen.
+ // Iterate through all the saved games, and read their thumbnails.
for (uint i = 0; i < SLOT_COUNT; ++i) {
readSlotSavegameInformation(i);
}
}
void readSlotSavegameInformation(uint slotID) {
- // Aktuelle Slotinformationen in den Ausgangszustand versetzen, er wird im Folgenden neu gefüllt.
+ // Get the information corresponding to the requested save slot.
SavegameInformation &curSavegameInfo = _savegameInformations[slotID];
curSavegameInfo.clear();
- // Den Dateinamen für den Spielstand des Slots generieren.
+ // Generate the save slot file name.
Common::String filename = generateSavegameFilename(slotID);
// Try to open the savegame for loading
@@ -160,16 +161,15 @@ struct PersistenceService::Impl {
// If the header can be read in and is detected to be valid, we will have a valid file
if (storedMarker == FILE_MARKER) {
- // Der Slot wird als belegt markiert.
+ // The slot is marked as occupied.
curSavegameInfo.isOccupied = true;
- // Speichern, ob der Spielstand kompatibel mit der aktuellen Engine-Version ist.
+ // Check if the saved game is compatible with the current engine version.
curSavegameInfo.isCompatible = (storedVersionID == Common::String(VERSIONID));
- // Dateinamen des Spielstandes speichern.
- curSavegameInfo.filename = generateSavegameFilename(slotID);
- // Die Beschreibung des Spielstandes besteht aus einer textuellen Darstellung des Änderungsdatums der Spielstanddatei.
+ // Load the save game description.
curSavegameInfo.description = gameDescription;
- // Den Offset zu den gespeicherten Spieldaten innerhalb der Datei speichern.
- // Dieses entspricht der aktuellen Position, da nach der letzten Headerinformation noch ein Leerzeichen als trenner folgt.
+ // The offset to the stored save game data within the file.
+ // This reflects the current position, as the header information
+ // is still followed by a space as separator.
curSavegameInfo.gamedataOffset = static_cast<uint>(file->pos());
}
@@ -241,10 +241,11 @@ Common::String &PersistenceService::getSavegameDescription(uint slotID) {
}
Common::String &PersistenceService::getSavegameFilename(uint slotID) {
- static Common::String emptyString;
+ static Common::String result;
if (!checkslotID(slotID))
- return emptyString;
- return _impl->_savegameInformations[slotID].filename;
+ return result;
+ result = generateSavegameFilename(slotID);
+ return result;
}
bool PersistenceService::saveGame(uint slotID, const Common::String &screenshotFilename) {
@@ -335,6 +336,9 @@ bool PersistenceService::saveGame(uint slotID, const Common::String &screenshotF
// Savegameinformationen für diesen Slot aktualisieren.
_impl->readSlotSavegameInformation(slotID);
+ // Empty the cache, to remove old thumbnails
+ Kernel::getInstance()->getResourceManager()->emptyThumbnailCache();
+
// Erfolg signalisieren.
return true;
}
@@ -369,13 +373,13 @@ bool PersistenceService::loadGame(uint slotID) {
byte *compressedDataBuffer = new byte[curSavegameInfo.gamedataLength];
byte *uncompressedDataBuffer = new Bytef[curSavegameInfo.gamedataUncompressedLength];
-
- file = sfm->openForLoading(generateSavegameFilename(slotID));
+ Common::String filename = generateSavegameFilename(slotID);
+ file = sfm->openForLoading(filename);
file->seek(curSavegameInfo.gamedataOffset);
file->read(reinterpret_cast<char *>(&compressedDataBuffer[0]), curSavegameInfo.gamedataLength);
if (file->err()) {
- error("Unable to load the gamedata from the savegame file \"%s\".", curSavegameInfo.filename.c_str());
+ error("Unable to load the gamedata from the savegame file \"%s\".", filename.c_str());
delete[] compressedDataBuffer;
delete[] uncompressedDataBuffer;
return false;
@@ -385,7 +389,7 @@ bool PersistenceService::loadGame(uint slotID) {
uLongf uncompressedBufferSize = curSavegameInfo.gamedataUncompressedLength;
if (uncompress(reinterpret_cast<Bytef *>(&uncompressedDataBuffer[0]), &uncompressedBufferSize,
reinterpret_cast<Bytef *>(&compressedDataBuffer[0]), curSavegameInfo.gamedataLength) != Z_OK) {
- error("Unable to decompress the gamedata from savegame file \"%s\".", curSavegameInfo.filename.c_str());
+ error("Unable to decompress the gamedata from savegame file \"%s\".", filename.c_str());
delete[] uncompressedDataBuffer;
delete[] compressedDataBuffer;
delete file;
@@ -408,7 +412,7 @@ bool PersistenceService::loadGame(uint slotID) {
delete file;
if (!success) {
- error("Unable to unpersist the gamedata from savegame file \"%s\".", curSavegameInfo.filename.c_str());
+ error("Unable to unpersist the gamedata from savegame file \"%s\".", filename.c_str());
return false;
}
diff --git a/engines/sword25/kernel/resmanager.cpp b/engines/sword25/kernel/resmanager.cpp
index 8b446e69d1..b77d79e8ea 100644
--- a/engines/sword25/kernel/resmanager.cpp
+++ b/engines/sword25/kernel/resmanager.cpp
@@ -147,6 +147,21 @@ void ResourceManager::emptyCache() {
}
}
+void ResourceManager::emptyThumbnailCache() {
+ // Scan through the resource list
+ Common::List<Resource *>::iterator iter = _resources.begin();
+ while (iter != _resources.end()) {
+ if ((*iter)->getFileName().hasPrefix("/saves")) {
+ // Unlock the thumbnail
+ while ((*iter)->getLockCount() > 0)
+ (*iter)->release();
+ // Delete the thumbnail
+ iter = deleteResource(*iter);
+ } else
+ ++iter;
+ }
+}
+
/**
* Returns a requested resource. If any error occurs, returns NULL
* @param FileName Filename of resource
diff --git a/engines/sword25/kernel/resmanager.h b/engines/sword25/kernel/resmanager.h
index 5b2bfd395f..f8006bd62d 100644
--- a/engines/sword25/kernel/resmanager.h
+++ b/engines/sword25/kernel/resmanager.h
@@ -82,6 +82,11 @@ public:
void emptyCache();
/**
+ * Removes all the savegame thumbnails from the cache
+ **/
+ void emptyThumbnailCache();
+
+ /**
* Writes the names of all currently locked resources to the log file
*/
void dumpLockedResources();
diff --git a/engines/sword25/script/luacallback.cpp b/engines/sword25/script/luacallback.cpp
index 137e37bf8d..809676796e 100644
--- a/engines/sword25/script/luacallback.cpp
+++ b/engines/sword25/script/luacallback.cpp
@@ -32,6 +32,8 @@
*
*/
+#include "common/textconsole.h"
+
#include "sword25/script/luacallback.h"
#include "sword25/script/luabindhelper.h"
diff --git a/engines/sword25/sfx/soundengine.cpp b/engines/sword25/sfx/soundengine.cpp
index 03cdaf82b7..08f0f5b4ae 100644
--- a/engines/sword25/sfx/soundengine.cpp
+++ b/engines/sword25/sfx/soundengine.cpp
@@ -39,6 +39,8 @@
#include "audio/decoders/vorbis.h"
+#include "common/system.h"
+
namespace Sword25 {
class SoundResource : public Resource {
diff --git a/engines/sword25/sword25.cpp b/engines/sword25/sword25.cpp
index aac21f4b55..38c1c89109 100644
--- a/engines/sword25/sword25.cpp
+++ b/engines/sword25/sword25.cpp
@@ -34,10 +34,18 @@
#include "common/config-manager.h"
#include "common/debug-channels.h"
+#include "common/algorithm.h"
+#include "common/array.h"
+#include "common/error.h"
+#include "common/fs.h"
+#include "common/singleton.h"
+#include "common/str-array.h"
+#include "common/str.h"
+#include "common/system.h"
+#include "common/textconsole.h"
#include "engines/util.h"
#include "sword25/sword25.h"
-#include "sword25/kernel/filesystemutil.h"
#include "sword25/kernel/kernel.h"
#include "sword25/kernel/persistenceservice.h"
#include "sword25/package/packagemanager.h"
@@ -73,10 +81,10 @@ Sword25Engine::~Sword25Engine() {
Common::Error Sword25Engine::run() {
// Engine initialisation
- Common::Error errorCode = appStart();
- if (errorCode != Common::kNoError) {
+ Common::Error error = appStart();
+ if (error.getCode() != Common::kNoError) {
appEnd();
- return errorCode;
+ return error;
}
// Run the game
diff --git a/engines/sword25/sword25.h b/engines/sword25/sword25.h
index 9e9679526b..5bd27b311f 100644
--- a/engines/sword25/sword25.h
+++ b/engines/sword25/sword25.h
@@ -27,12 +27,18 @@
#define SWORD25_H
#include "common/scummsys.h"
-#include "common/str-array.h"
-#include "common/util.h"
#include "engines/engine.h"
#include "sword25/console.h"
+namespace Common {
+class Error;
+}
+
+namespace GUI {
+class Debugger;
+}
+
struct ADGameDescription;
/**
diff --git a/engines/sword25/util/pluto/Makefile b/engines/sword25/util/pluto/Makefile
deleted file mode 100644
index 611ecc83d2..0000000000
--- a/engines/sword25/util/pluto/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-LDLIBS= -lm -ldl -llua
-LDFLAGS = -rdynamic # -L../lua-5.1.3/src
-# CFLAGS= -g3 -Wall -fprofile-arcs -ftest-coverage
-CFLAGS= -g3 -Wall -ansi -pedantic
-
-LIBTOOL=libtool --tag=CC
-
-default: pluto.so pptest puptest
-
-%.lo: %.c
- $(LIBTOOL) --mode=compile cc $(CFLAGS) -c $<
-
-pluto.so: pluto.lo pdep.lo lzio.lo
- $(LIBTOOL) --mode=link cc -rpath /usr/local/lib/lua/5.1 -o libpluto.la $^
- mv .libs/libpluto.so.0.0.0 $@
-
-test: pptest puptest pptest.lua puptest.lua pluto.so
- ./pptest
- ./puptest
-
-pptest: pptest.o
- $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
-
-puptest: puptest.o
- $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
-
-clean:
- -rm -r *.so *.la *.lo .libs *.a *.o *.bb *.bbg *.da *.gcov pptest puptest test.plh
-
diff --git a/engines/sword25/util/pluto/pdep/lauxlib.h b/engines/sword25/util/pluto/pdep/lauxlib.h
deleted file mode 100644
index d58f290527..0000000000
--- a/engines/sword25/util/pluto/pdep/lauxlib.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
-** $Id$
-** Auxiliary functions for building Lua libraries
-** See Copyright Notice in lua.h
-*/
-
-
-#ifndef lauxlib_h
-#define lauxlib_h
-
-
-#include <stddef.h>
-#include <stdio.h>
-
-#include "lua.h"
-
-
-#if defined(LUA_COMPAT_GETN)
-LUALIB_API int (luaL_getn) (lua_State *L, int t);
-LUALIB_API void (luaL_setn) (lua_State *L, int t, int n);
-#else
-#define luaL_getn(L,i) ((int)lua_objlen(L, i))
-#define luaL_setn(L,i,j) ((void)0) /* no op! */
-#endif
-
-#if defined(LUA_COMPAT_OPENLIB)
-#define luaI_openlib luaL_openlib
-#endif
-
-
-/* extra error code for `luaL_load' */
-#define LUA_ERRFILE (LUA_ERRERR+1)
-
-
-typedef struct luaL_Reg {
- const char *name;
- lua_CFunction func;
-} luaL_Reg;
-
-
-
-LUALIB_API void (luaI_openlib) (lua_State *L, const char *libname,
- const luaL_Reg *l, int nup);
-LUALIB_API void (luaL_register) (lua_State *L, const char *libname,
- const luaL_Reg *l);
-LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e);
-LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e);
-LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname);
-LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg);
-LUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg,
- size_t *l);
-LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg,
- const char *def, size_t *l);
-LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg);
-LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def);
-
-LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg);
-LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg,
- lua_Integer def);
-
-LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);
-LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t);
-LUALIB_API void (luaL_checkany) (lua_State *L, int narg);
-
-LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname);
-LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname);
-
-LUALIB_API void (luaL_where) (lua_State *L, int lvl);
-LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);
-
-LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,
- const char *const lst[]);
-
-LUALIB_API int (luaL_ref) (lua_State *L, int t);
-LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);
-
-LUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename);
-LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz,
- const char *name);
-LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s);
-
-LUALIB_API lua_State *(luaL_newstate) (void);
-
-
-LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p,
- const char *r);
-
-LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx,
- const char *fname, int szhint);
-
-
-
-
-/*
-** ===============================================================
-** some useful macros
-** ===============================================================
-*/
-
-#define luaL_argcheck(L, cond,numarg,extramsg) \
- ((void)((cond) || luaL_argerror(L, (numarg), (extramsg))))
-#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL))
-#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL))
-#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n)))
-#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d)))
-#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n)))
-#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d)))
-
-#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i)))
-
-#define luaL_dofile(L, fn) \
- (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))
-
-#define luaL_dostring(L, s) \
- (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
-
-#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n)))
-
-#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
-
-/*
-** {======================================================
-** Generic Buffer manipulation
-** =======================================================
-*/
-
-
-
-typedef struct luaL_Buffer {
- char *p; /* current position in buffer */
- int lvl; /* number of strings in the stack (level) */
- lua_State *L;
- char buffer[LUAL_BUFFERSIZE];
-} luaL_Buffer;
-
-#define luaL_addchar(B,c) \
- ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \
- (*(B)->p++ = (char)(c)))
-
-/* compatibility only */
-#define luaL_putchar(B,c) luaL_addchar(B,c)
-
-#define luaL_addsize(B,n) ((B)->p += (n))
-
-LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B);
-LUALIB_API char *(luaL_prepbuffer) (luaL_Buffer *B);
-LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);
-LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s);
-LUALIB_API void (luaL_addvalue) (luaL_Buffer *B);
-LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);
-
-
-/* }====================================================== */
-
-
-/* compatibility with ref system */
-
-/* pre-defined references */
-#define LUA_NOREF (-2)
-#define LUA_REFNIL (-1)
-
-#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \
- (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0))
-
-#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref))
-
-#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref))
-
-
-#define luaL_reg luaL_Reg
-
-#endif
-
-
diff --git a/engines/sword25/util/pluto/pdep/ldo.h b/engines/sword25/util/pluto/pdep/ldo.h
deleted file mode 100644
index 4c97134805..0000000000
--- a/engines/sword25/util/pluto/pdep/ldo.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-** $Id$
-** Stack and Call structure of Lua
-** See Copyright Notice in lua.h
-*/
-
-#ifndef ldo_h
-#define ldo_h
-
-
-#include "lobject.h"
-#include "lstate.h"
-#include "lzio.h"
-
-
-#define luaD_checkstack(L,n) \
- if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \
- luaD_growstack(L, n); \
- else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1));
-
-
-#define incr_top(L) {luaD_checkstack(L,1); L->top++;}
-
-#define savestack(L,p) ((char *)(p) - (char *)L->stack)
-#define restorestack(L,n) ((TValue *)((char *)L->stack + (n)))
-
-#define saveci(L,p) ((char *)(p) - (char *)L->base_ci)
-#define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n)))
-
-
-/* results from luaD_precall */
-#define PCRLUA 0 /* initiated a call to a Lua function */
-#define PCRC 1 /* did a call to a C function */
-#define PCRYIELD 2 /* C funtion yielded */
-
-
-/* type of protected functions, to be ran by `runprotected' */
-typedef void (*Pfunc) (lua_State *L, void *ud);
-
-LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name);
-LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line);
-LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults);
-LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults);
-LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u,
- ptrdiff_t oldtop, ptrdiff_t ef);
-LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult);
-LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize);
-LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
-LUAI_FUNC void luaD_growstack (lua_State *L, int n);
-
-LUAI_FUNC void luaD_throw (lua_State *L, int errcode);
-LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
-
-LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop);
-
-#endif
-
diff --git a/engines/sword25/util/pluto/pdep/lfunc.h b/engines/sword25/util/pluto/pdep/lfunc.h
deleted file mode 100644
index 4c2b7fd138..0000000000
--- a/engines/sword25/util/pluto/pdep/lfunc.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-** $Id$
-** Auxiliary functions to manipulate prototypes and closures
-** See Copyright Notice in lua.h
-*/
-
-#ifndef lfunc_h
-#define lfunc_h
-
-
-#include "lobject.h"
-
-
-#define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \
- cast(int, sizeof(TValue)*((n)-1)))
-
-#define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \
- cast(int, sizeof(TValue *)*((n)-1)))
-
-
-LUAI_FUNC Proto *luaF_newproto (lua_State *L);
-LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e);
-LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e);
-LUAI_FUNC UpVal *luaF_newupval (lua_State *L);
-LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level);
-LUAI_FUNC void luaF_close (lua_State *L, StkId level);
-LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f);
-LUAI_FUNC void luaF_freeclosure (lua_State *L, Closure *c);
-LUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv);
-LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number,
- int pc);
-
-
-#endif
diff --git a/engines/sword25/util/pluto/pdep/lgc.h b/engines/sword25/util/pluto/pdep/lgc.h
deleted file mode 100644
index 5123ccb479..0000000000
--- a/engines/sword25/util/pluto/pdep/lgc.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
-** $Id$
-** Garbage Collector
-** See Copyright Notice in lua.h
-*/
-
-#ifndef lgc_h
-#define lgc_h
-
-
-#include "lobject.h"
-
-
-/*
-** Possible states of the Garbage Collector
-*/
-#define GCSpause 0
-#define GCSpropagate 1
-#define GCSsweepstring 2
-#define GCSsweep 3
-#define GCSfinalize 4
-
-
-/*
-** some userful bit tricks
-*/
-#define resetbits(x,m) ((x) &= cast(lu_byte, ~(m)))
-#define setbits(x,m) ((x) |= (m))
-#define testbits(x,m) ((x) & (m))
-#define bitmask(b) (1<<(b))
-#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2))
-#define l_setbit(x,b) setbits(x, bitmask(b))
-#define resetbit(x,b) resetbits(x, bitmask(b))
-#define testbit(x,b) testbits(x, bitmask(b))
-#define set2bits(x,b1,b2) setbits(x, (bit2mask(b1, b2)))
-#define reset2bits(x,b1,b2) resetbits(x, (bit2mask(b1, b2)))
-#define test2bits(x,b1,b2) testbits(x, (bit2mask(b1, b2)))
-
-
-
-/*
-** Layout for bit use in `marked' field:
-** bit 0 - object is white (type 0)
-** bit 1 - object is white (type 1)
-** bit 2 - object is black
-** bit 3 - for userdata: has been finalized
-** bit 3 - for tables: has weak keys
-** bit 4 - for tables: has weak values
-** bit 5 - object is fixed (should not be collected)
-** bit 6 - object is "super" fixed (only the main thread)
-*/
-
-
-#define WHITE0BIT 0
-#define WHITE1BIT 1
-#define BLACKBIT 2
-#define FINALIZEDBIT 3
-#define KEYWEAKBIT 3
-#define VALUEWEAKBIT 4
-#define FIXEDBIT 5
-#define SFIXEDBIT 6
-#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT)
-
-
-#define iswhite(x) test2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT)
-#define isblack(x) testbit((x)->gch.marked, BLACKBIT)
-#define isgray(x) (!isblack(x) && !iswhite(x))
-
-#define otherwhite(g) (g->currentwhite ^ WHITEBITS)
-#define isdead(g,v) ((v)->gch.marked & otherwhite(g) & WHITEBITS)
-
-#define changewhite(x) ((x)->gch.marked ^= WHITEBITS)
-#define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT)
-
-#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x)))
-
-#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS)
-
-
-#define luaC_checkGC(L) { \
- condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); \
- if (G(L)->totalbytes >= G(L)->GCthreshold) \
- luaC_step(L); }
-
-
-#define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \
- luaC_barrierf(L,obj2gco(p),gcvalue(v)); }
-
-#define luaC_barriert(L,t,v) { if (valiswhite(v) && isblack(obj2gco(t))) \
- luaC_barrierback(L,t); }
-
-#define luaC_objbarrier(L,p,o) \
- { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \
- luaC_barrierf(L,obj2gco(p),obj2gco(o)); }
-
-#define luaC_objbarriert(L,t,o) \
- { if (iswhite(obj2gco(o)) && isblack(obj2gco(t))) luaC_barrierback(L,t); }
-
-LUAI_FUNC size_t luaC_separateudata (lua_State *L, int all);
-LUAI_FUNC void luaC_callGCTM (lua_State *L);
-LUAI_FUNC void luaC_freeall (lua_State *L);
-LUAI_FUNC void luaC_step (lua_State *L);
-LUAI_FUNC void luaC_fullgc (lua_State *L);
-LUAI_FUNC void luaC_link (lua_State *L, GCObject *o, lu_byte tt);
-LUAI_FUNC void luaC_linkupval (lua_State *L, UpVal *uv);
-LUAI_FUNC void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v);
-LUAI_FUNC void luaC_barrierback (lua_State *L, Table *t);
-
-
-#endif
diff --git a/engines/sword25/util/pluto/pdep/llimits.h b/engines/sword25/util/pluto/pdep/llimits.h
deleted file mode 100644
index a31ad160ad..0000000000
--- a/engines/sword25/util/pluto/pdep/llimits.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
-** $Id$
-** Limits, basic types, and some other `installation-dependent' definitions
-** See Copyright Notice in lua.h
-*/
-
-#ifndef llimits_h
-#define llimits_h
-
-
-#include <limits.h>
-#include <stddef.h>
-
-
-#include "lua.h"
-
-
-typedef LUAI_UINT32 lu_int32;
-
-typedef LUAI_UMEM lu_mem;
-
-typedef LUAI_MEM l_mem;
-
-
-
-/* chars used as small naturals (so that `char' is reserved for characters) */
-typedef unsigned char lu_byte;
-
-
-#define MAX_SIZET ((size_t)(~(size_t)0)-2)
-
-#define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2)
-
-
-#define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */
-
-/*
-** conversion of pointer to integer
-** this is for hashing only; there is no problem if the integer
-** cannot hold the whole pointer value
-*/
-#define IntPoint(p) ((unsigned int)(lu_mem)(p))
-
-
-
-/* type to ensure maximum alignment */
-typedef LUAI_USER_ALIGNMENT_T L_Umaxalign;
-
-
-/* result of a `usual argument conversion' over lua_Number */
-typedef LUAI_UACNUMBER l_uacNumber;
-
-
-/* internal assertions for in-house debugging */
-#ifdef lua_assert
-
-#define check_exp(c,e) (lua_assert(c), (e))
-#define api_check(l,e) lua_assert(e)
-
-#else
-
-#define lua_assert(c) ((void)0)
-#define check_exp(c,e) (e)
-#define api_check luai_apicheck
-
-#endif
-
-
-#ifndef UNUSED
-#define UNUSED(x) ((void)(x)) /* to avoid warnings */
-#endif
-
-
-#ifndef cast
-#define cast(t, exp) ((t)(exp))
-#endif
-
-#define cast_byte(i) cast(lu_byte, (i))
-#define cast_num(i) cast(lua_Number, (i))
-#define cast_int(i) cast(int, (i))
-
-
-
-/*
-** type for virtual-machine instructions
-** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h)
-*/
-typedef lu_int32 Instruction;
-
-
-
-/* maximum stack for a Lua function */
-#define MAXSTACK 250
-
-
-
-/* minimum size for the string table (must be power of 2) */
-#ifndef MINSTRTABSIZE
-#define MINSTRTABSIZE 32
-#endif
-
-
-/* minimum size for string buffer */
-#ifndef LUA_MINBUFFER
-#define LUA_MINBUFFER 32
-#endif
-
-
-#ifndef lua_lock
-#define lua_lock(L) ((void) 0)
-#define lua_unlock(L) ((void) 0)
-#endif
-
-#ifndef luai_threadyield
-#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);}
-#endif
-
-
-/*
-** macro to control inclusion of some hard tests on stack reallocation
-*/
-#ifndef HARDSTACKTESTS
-#define condhardstacktests(x) ((void)0)
-#else
-#define condhardstacktests(x) x
-#endif
-
-#endif
diff --git a/engines/sword25/util/pluto/pdep/lobject.h b/engines/sword25/util/pluto/pdep/lobject.h
deleted file mode 100644
index 35aaed028a..0000000000
--- a/engines/sword25/util/pluto/pdep/lobject.h
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
-** $Id$
-** Type definitions for Lua objects
-** See Copyright Notice in lua.h
-*/
-
-
-#ifndef lobject_h
-#define lobject_h
-
-
-#include <stdarg.h>
-
-
-#include "llimits.h"
-#include "lua.h"
-
-
-/* tags for values visible from Lua */
-#define LAST_TAG LUA_TTHREAD
-
-#define NUM_TAGS (LAST_TAG+1)
-
-
-/*
-** Extra tags for non-values
-*/
-#define LUA_TPROTO (LAST_TAG+1)
-#define LUA_TUPVAL (LAST_TAG+2)
-#define LUA_TDEADKEY (LAST_TAG+3)
-
-
-/*
-** Union of all collectable objects
-*/
-typedef union GCObject GCObject;
-
-
-/*
-** Common Header for all collectable objects (in macro form, to be
-** included in other objects)
-*/
-#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked
-
-
-/*
-** Common header in struct form
-*/
-typedef struct GCheader {
- CommonHeader;
-} GCheader;
-
-
-
-
-/*
-** Union of all Lua values
-*/
-typedef union {
- GCObject *gc;
- void *p;
- lua_Number n;
- int b;
-} Value;
-
-
-/*
-** Tagged Values
-*/
-
-#define TValuefields Value value; int tt
-
-typedef struct lua_TValue {
- TValuefields;
-} TValue;
-
-
-/* Macros to test type */
-#define ttisnil(o) (ttype(o) == LUA_TNIL)
-#define ttisnumber(o) (ttype(o) == LUA_TNUMBER)
-#define ttisstring(o) (ttype(o) == LUA_TSTRING)
-#define ttistable(o) (ttype(o) == LUA_TTABLE)
-#define ttisfunction(o) (ttype(o) == LUA_TFUNCTION)
-#define ttisboolean(o) (ttype(o) == LUA_TBOOLEAN)
-#define ttisuserdata(o) (ttype(o) == LUA_TUSERDATA)
-#define ttisthread(o) (ttype(o) == LUA_TTHREAD)
-#define ttislightuserdata(o) (ttype(o) == LUA_TLIGHTUSERDATA)
-
-/* Macros to access values */
-#define ttype(o) ((o)->tt)
-#define gcvalue(o) check_exp(iscollectable(o), (o)->value.gc)
-#define pvalue(o) check_exp(ttislightuserdata(o), (o)->value.p)
-#define nvalue(o) check_exp(ttisnumber(o), (o)->value.n)
-#define rawtsvalue(o) check_exp(ttisstring(o), &(o)->value.gc->ts)
-#define tsvalue(o) (&rawtsvalue(o)->tsv)
-#define rawuvalue(o) check_exp(ttisuserdata(o), &(o)->value.gc->u)
-#define uvalue(o) (&rawuvalue(o)->uv)
-#define clvalue(o) check_exp(ttisfunction(o), &(o)->value.gc->cl)
-#define hvalue(o) check_exp(ttistable(o), &(o)->value.gc->h)
-#define bvalue(o) check_exp(ttisboolean(o), (o)->value.b)
-#define thvalue(o) check_exp(ttisthread(o), &(o)->value.gc->th)
-
-#define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0))
-
-/*
-** for internal debug only
-*/
-#define checkconsistency(obj) \
- lua_assert(!iscollectable(obj) || (ttype(obj) == (obj)->value.gc->gch.tt))
-
-#define checkliveness(g,obj) \
- lua_assert(!iscollectable(obj) || \
- ((ttype(obj) == (obj)->value.gc->gch.tt) && !isdead(g, (obj)->value.gc)))
-
-
-/* Macros to set values */
-#define setnilvalue(obj) ((obj)->tt=LUA_TNIL)
-
-#define setnvalue(obj,x) \
- { TValue *i_o=(obj); i_o->value.n=(x); i_o->tt=LUA_TNUMBER; }
-
-#define setpvalue(obj,x) \
- { TValue *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TLIGHTUSERDATA; }
-
-#define setbvalue(obj,x) \
- { TValue *i_o=(obj); i_o->value.b=(x); i_o->tt=LUA_TBOOLEAN; }
-
-#define setsvalue(L,obj,x) \
- { TValue *i_o=(obj); \
- i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TSTRING; \
- checkliveness(G(L),i_o); }
-
-#define setuvalue(L,obj,x) \
- { TValue *i_o=(obj); \
- i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TUSERDATA; \
- checkliveness(G(L),i_o); }
-
-#define setthvalue(L,obj,x) \
- { TValue *i_o=(obj); \
- i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTHREAD; \
- checkliveness(G(L),i_o); }
-
-#define setclvalue(L,obj,x) \
- { TValue *i_o=(obj); \
- i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TFUNCTION; \
- checkliveness(G(L),i_o); }
-
-#define sethvalue(L,obj,x) \
- { TValue *i_o=(obj); \
- i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TTABLE; \
- checkliveness(G(L),i_o); }
-
-#define setptvalue(L,obj,x) \
- { TValue *i_o=(obj); \
- i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TPROTO; \
- checkliveness(G(L),i_o); }
-
-
-
-
-#define setobj(L,obj1,obj2) \
- { const TValue *o2=(obj2); TValue *o1=(obj1); \
- o1->value = o2->value; o1->tt=o2->tt; \
- checkliveness(G(L),o1); }
-
-
-/*
-** different types of sets, according to destination
-*/
-
-/* from stack to (same) stack */
-#define setobjs2s setobj
-/* to stack (not from same stack) */
-#define setobj2s setobj
-#define setsvalue2s setsvalue
-#define sethvalue2s sethvalue
-#define setptvalue2s setptvalue
-/* from table to same table */
-#define setobjt2t setobj
-/* to table */
-#define setobj2t setobj
-/* to new object */
-#define setobj2n setobj
-#define setsvalue2n setsvalue
-
-#define setttype(obj, tt) (ttype(obj) = (tt))
-
-
-#define iscollectable(o) (ttype(o) >= LUA_TSTRING)
-
-
-
-typedef TValue *StkId; /* index to stack elements */
-
-
-/*
-** String headers for string table
-*/
-typedef union TString {
- L_Umaxalign dummy; /* ensures maximum alignment for strings */
- struct {
- CommonHeader;
- lu_byte reserved;
- unsigned int hash;
- size_t len;
- } tsv;
-} TString;
-
-
-#define getstr(ts) cast(const char *, (ts) + 1)
-#define svalue(o) getstr(tsvalue(o))
-
-
-
-typedef union Udata {
- L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */
- struct {
- CommonHeader;
- struct Table *metatable;
- struct Table *env;
- size_t len;
- } uv;
-} Udata;
-
-
-
-
-/*
-** Function Prototypes
-*/
-typedef struct Proto {
- CommonHeader;
- TValue *k; /* constants used by the function */
- Instruction *code;
- struct Proto **p; /* functions defined inside the function */
- int *lineinfo; /* map from opcodes to source lines */
- struct LocVar *locvars; /* information about local variables */
- TString **upvalues; /* upvalue names */
- TString *source;
- int sizeupvalues;
- int sizek; /* size of `k' */
- int sizecode;
- int sizelineinfo;
- int sizep; /* size of `p' */
- int sizelocvars;
- int linedefined;
- int lastlinedefined;
- GCObject *gclist;
- lu_byte nups; /* number of upvalues */
- lu_byte numparams;
- lu_byte is_vararg;
- lu_byte maxstacksize;
-} Proto;
-
-
-/* masks for new-style vararg */
-#define VARARG_HASARG 1
-#define VARARG_ISVARARG 2
-#define VARARG_NEEDSARG 4
-
-
-typedef struct LocVar {
- TString *varname;
- int startpc; /* first point where variable is active */
- int endpc; /* first point where variable is dead */
-} LocVar;
-
-
-
-/*
-** Upvalues
-*/
-
-typedef struct UpVal {
- CommonHeader;
- TValue *v; /* points to stack or to its own value */
- union {
- TValue value; /* the value (when closed) */
- struct { /* double linked list (when open) */
- struct UpVal *prev;
- struct UpVal *next;
- } l;
- } u;
-} UpVal;
-
-
-/*
-** Closures
-*/
-
-#define ClosureHeader \
- CommonHeader; lu_byte isC; lu_byte nupvalues; GCObject *gclist; \
- struct Table *env
-
-typedef struct CClosure {
- ClosureHeader;
- lua_CFunction f;
- TValue upvalue[1];
-} CClosure;
-
-
-typedef struct LClosure {
- ClosureHeader;
- struct Proto *p;
- UpVal *upvals[1];
-} LClosure;
-
-
-typedef union Closure {
- CClosure c;
- LClosure l;
-} Closure;
-
-
-#define iscfunction(o) (ttype(o) == LUA_TFUNCTION && clvalue(o)->c.isC)
-#define isLfunction(o) (ttype(o) == LUA_TFUNCTION && !clvalue(o)->c.isC)
-
-
-/*
-** Tables
-*/
-
-typedef union TKey {
- struct {
- TValuefields;
- struct Node *next; /* for chaining */
- } nk;
- TValue tvk;
-} TKey;
-
-
-typedef struct Node {
- TValue i_val;
- TKey i_key;
-} Node;
-
-
-typedef struct Table {
- CommonHeader;
- lu_byte flags; /* 1<<p means tagmethod(p) is not present */
- lu_byte lsizenode; /* log2 of size of `node' array */
- struct Table *metatable;
- TValue *array; /* array part */
- Node *node;
- Node *lastfree; /* any free position is before this position */
- GCObject *gclist;
- int sizearray; /* size of `array' array */
-} Table;
-
-
-
-/*
-** `module' operation for hashing (size is always a power of 2)
-*/
-#define lmod(s,size) \
- (check_exp((size&(size-1))==0, (cast(int, (s) & ((size)-1)))))
-
-
-#define twoto(x) (1<<(x))
-#define sizenode(t) (twoto((t)->lsizenode))
-
-
-#define luaO_nilobject (&luaO_nilobject_)
-
-LUAI_DATA const TValue luaO_nilobject_;
-
-#define ceillog2(x) (luaO_log2((x)-1) + 1)
-
-LUAI_FUNC int luaO_log2 (unsigned int x);
-LUAI_FUNC int luaO_int2fb (unsigned int x);
-LUAI_FUNC int luaO_fb2int (int x);
-LUAI_FUNC int luaO_rawequalObj (const TValue *t1, const TValue *t2);
-LUAI_FUNC int luaO_str2d (const char *s, lua_Number *result);
-LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt,
- va_list argp);
-LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...);
-LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len);
-
-
-#endif
-
diff --git a/engines/sword25/util/pluto/pdep/lopcodes.h b/engines/sword25/util/pluto/pdep/lopcodes.h
deleted file mode 100644
index e1aed0f637..0000000000
--- a/engines/sword25/util/pluto/pdep/lopcodes.h
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
-** $Id$
-** Opcodes for Lua virtual machine
-** See Copyright Notice in lua.h
-*/
-
-#ifndef lopcodes_h
-#define lopcodes_h
-
-#include "llimits.h"
-
-
-/*===========================================================================
- We assume that instructions are unsigned numbers.
- All instructions have an opcode in the first 6 bits.
- Instructions can have the following fields:
- `A' : 8 bits
- `B' : 9 bits
- `C' : 9 bits
- `Bx' : 18 bits (`B' and `C' together)
- `sBx' : signed Bx
-
- A signed argument is represented in excess K; that is, the number
- value is the unsigned value minus K. K is exactly the maximum value
- for that argument (so that -max is represented by 0, and +max is
- represented by 2*max), which is half the maximum for the corresponding
- unsigned argument.
-===========================================================================*/
-
-
-enum OpMode {iABC, iABx, iAsBx}; /* basic instruction format */
-
-
-/*
-** size and position of opcode arguments.
-*/
-#define SIZE_C 9
-#define SIZE_B 9
-#define SIZE_Bx (SIZE_C + SIZE_B)
-#define SIZE_A 8
-
-#define SIZE_OP 6
-
-#define POS_OP 0
-#define POS_A (POS_OP + SIZE_OP)
-#define POS_C (POS_A + SIZE_A)
-#define POS_B (POS_C + SIZE_C)
-#define POS_Bx POS_C
-
-
-/*
-** limits for opcode arguments.
-** we use (signed) int to manipulate most arguments,
-** so they must fit in LUAI_BITSINT-1 bits (-1 for sign)
-*/
-#if SIZE_Bx < LUAI_BITSINT-1
-#define MAXARG_Bx ((1<<SIZE_Bx)-1)
-#define MAXARG_sBx (MAXARG_Bx>>1) /* `sBx' is signed */
-#else
-#define MAXARG_Bx MAX_INT
-#define MAXARG_sBx MAX_INT
-#endif
-
-
-#define MAXARG_A ((1<<SIZE_A)-1)
-#define MAXARG_B ((1<<SIZE_B)-1)
-#define MAXARG_C ((1<<SIZE_C)-1)
-
-
-/* creates a mask with `n' 1 bits at position `p' */
-#define MASK1(n,p) ((~((~(Instruction)0)<<n))<<p)
-
-/* creates a mask with `n' 0 bits at position `p' */
-#define MASK0(n,p) (~MASK1(n,p))
-
-/*
-** the following macros help to manipulate instructions
-*/
-
-#define GET_OPCODE(i) (cast(OpCode, ((i)>>POS_OP) & MASK1(SIZE_OP,0)))
-#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \
- ((cast(Instruction, o)<<POS_OP)&MASK1(SIZE_OP,POS_OP))))
-
-#define GETARG_A(i) (cast(int, ((i)>>POS_A) & MASK1(SIZE_A,0)))
-#define SETARG_A(i,u) ((i) = (((i)&MASK0(SIZE_A,POS_A)) | \
- ((cast(Instruction, u)<<POS_A)&MASK1(SIZE_A,POS_A))))
-
-#define GETARG_B(i) (cast(int, ((i)>>POS_B) & MASK1(SIZE_B,0)))
-#define SETARG_B(i,b) ((i) = (((i)&MASK0(SIZE_B,POS_B)) | \
- ((cast(Instruction, b)<<POS_B)&MASK1(SIZE_B,POS_B))))
-
-#define GETARG_C(i) (cast(int, ((i)>>POS_C) & MASK1(SIZE_C,0)))
-#define SETARG_C(i,b) ((i) = (((i)&MASK0(SIZE_C,POS_C)) | \
- ((cast(Instruction, b)<<POS_C)&MASK1(SIZE_C,POS_C))))
-
-#define GETARG_Bx(i) (cast(int, ((i)>>POS_Bx) & MASK1(SIZE_Bx,0)))
-#define SETARG_Bx(i,b) ((i) = (((i)&MASK0(SIZE_Bx,POS_Bx)) | \
- ((cast(Instruction, b)<<POS_Bx)&MASK1(SIZE_Bx,POS_Bx))))
-
-#define GETARG_sBx(i) (GETARG_Bx(i)-MAXARG_sBx)
-#define SETARG_sBx(i,b) SETARG_Bx((i),cast(unsigned int, (b)+MAXARG_sBx))
-
-
-#define CREATE_ABC(o,a,b,c) ((cast(Instruction, o)<<POS_OP) \
- | (cast(Instruction, a)<<POS_A) \
- | (cast(Instruction, b)<<POS_B) \
- | (cast(Instruction, c)<<POS_C))
-
-#define CREATE_ABx(o,a,bc) ((cast(Instruction, o)<<POS_OP) \
- | (cast(Instruction, a)<<POS_A) \
- | (cast(Instruction, bc)<<POS_Bx))
-
-
-/*
-** Macros to operate RK indices
-*/
-
-/* this bit 1 means constant (0 means register) */
-#define BITRK (1 << (SIZE_B - 1))
-
-/* test whether value is a constant */
-#define ISK(x) ((x) & BITRK)
-
-/* gets the index of the constant */
-#define INDEXK(r) ((int)(r) & ~BITRK)
-
-#define MAXINDEXRK (BITRK - 1)
-
-/* code a constant index as a RK value */
-#define RKASK(x) ((x) | BITRK)
-
-
-/*
-** invalid register that fits in 8 bits
-*/
-#define NO_REG MAXARG_A
-
-
-/*
-** R(x) - register
-** Kst(x) - constant (in constant table)
-** RK(x) == if ISK(x) then Kst(INDEXK(x)) else R(x)
-*/
-
-
-/*
-** grep "ORDER OP" if you change these enums
-*/
-
-typedef enum {
-/*----------------------------------------------------------------------
-name args description
-------------------------------------------------------------------------*/
-OP_MOVE,/* A B R(A) := R(B) */
-OP_LOADK,/* A Bx R(A) := Kst(Bx) */
-OP_LOADBOOL,/* A B C R(A) := (Bool)B; if (C) pc++ */
-OP_LOADNIL,/* A B R(A) := ... := R(B) := nil */
-OP_GETUPVAL,/* A B R(A) := UpValue[B] */
-
-OP_GETGLOBAL,/* A Bx R(A) := Gbl[Kst(Bx)] */
-OP_GETTABLE,/* A B C R(A) := R(B)[RK(C)] */
-
-OP_SETGLOBAL,/* A Bx Gbl[Kst(Bx)] := R(A) */
-OP_SETUPVAL,/* A B UpValue[B] := R(A) */
-OP_SETTABLE,/* A B C R(A)[RK(B)] := RK(C) */
-
-OP_NEWTABLE,/* A B C R(A) := {} (size = B,C) */
-
-OP_SELF,/* A B C R(A+1) := R(B); R(A) := R(B)[RK(C)] */
-
-OP_ADD,/* A B C R(A) := RK(B) + RK(C) */
-OP_SUB,/* A B C R(A) := RK(B) - RK(C) */
-OP_MUL,/* A B C R(A) := RK(B) * RK(C) */
-OP_DIV,/* A B C R(A) := RK(B) / RK(C) */
-OP_MOD,/* A B C R(A) := RK(B) % RK(C) */
-OP_POW,/* A B C R(A) := RK(B) ^ RK(C) */
-OP_UNM,/* A B R(A) := -R(B) */
-OP_NOT,/* A B R(A) := not R(B) */
-OP_LEN,/* A B R(A) := length of R(B) */
-
-OP_CONCAT,/* A B C R(A) := R(B).. ... ..R(C) */
-
-OP_JMP,/* sBx pc+=sBx */
-
-OP_EQ,/* A B C if ((RK(B) == RK(C)) ~= A) then pc++ */
-OP_LT,/* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */
-OP_LE,/* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */
-
-OP_TEST,/* A C if not (R(A) <=> C) then pc++ */
-OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */
-
-OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */
-OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */
-OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */
-
-OP_FORLOOP,/* A sBx R(A)+=R(A+2);
- if R(A) <?= R(A+1) then { pc+=sBx; R(A+3)=R(A) }*/
-OP_FORPREP,/* A sBx R(A)-=R(A+2); pc+=sBx */
-
-OP_TFORLOOP,/* A C R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2));
- if R(A+3) ~= nil then R(A+2)=R(A+3) else pc++ */
-OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */
-
-OP_CLOSE,/* A close all variables in the stack up to (>=) R(A)*/
-OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n)) */
-
-OP_VARARG/* A B R(A), R(A+1), ..., R(A+B-1) = vararg */
-} OpCode;
-
-
-#define NUM_OPCODES (cast(int, OP_VARARG) + 1)
-
-
-
-/*===========================================================================
- Notes:
- (*) In OP_CALL, if (B == 0) then B = top. C is the number of returns - 1,
- and can be 0: OP_CALL then sets `top' to last_result+1, so
- next open instruction (OP_CALL, OP_RETURN, OP_SETLIST) may use `top'.
-
- (*) In OP_VARARG, if (B == 0) then use actual number of varargs and
- set top (like in OP_CALL with C == 0).
-
- (*) In OP_RETURN, if (B == 0) then return up to `top'
-
- (*) In OP_SETLIST, if (B == 0) then B = `top';
- if (C == 0) then next `instruction' is real C
-
- (*) For comparisons, A specifies what condition the test should accept
- (true or false).
-
- (*) All `skips' (pc++) assume that next instruction is a jump
-===========================================================================*/
-
-
-/*
-** masks for instruction properties. The format is:
-** bits 0-1: op mode
-** bits 2-3: C arg mode
-** bits 4-5: B arg mode
-** bit 6: instruction set register A
-** bit 7: operator is a test
-*/
-
-enum OpArgMask {
- OpArgN, /* argument is not used */
- OpArgU, /* argument is used */
- OpArgR, /* argument is a register or a jump offset */
- OpArgK /* argument is a constant or register/constant */
-};
-
-LUAI_DATA const lu_byte luaP_opmodes[NUM_OPCODES];
-
-#define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3))
-#define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3))
-#define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3))
-#define testAMode(m) (luaP_opmodes[m] & (1 << 6))
-#define testTMode(m) (luaP_opmodes[m] & (1 << 7))
-
-
-LUAI_DATA const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */
-
-
-/* number of list items to accumulate before a SETLIST instruction */
-#define LFIELDS_PER_FLUSH 50
-
-
-#endif
diff --git a/engines/sword25/util/pluto/pdep/lstate.h b/engines/sword25/util/pluto/pdep/lstate.h
deleted file mode 100644
index 94a6249461..0000000000
--- a/engines/sword25/util/pluto/pdep/lstate.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
-** $Id$
-** Global State
-** See Copyright Notice in lua.h
-*/
-
-#ifndef lstate_h
-#define lstate_h
-
-#include "lua.h"
-
-#include "lobject.h"
-#include "ltm.h"
-#include "lzio.h"
-
-
-
-struct lua_longjmp; /* defined in ldo.c */
-
-
-/* table of globals */
-#define gt(L) (&L->l_gt)
-
-/* registry */
-#define registry(L) (&G(L)->l_registry)
-
-
-/* extra stack space to handle TM calls and some other extras */
-#define EXTRA_STACK 5
-
-
-#define BASIC_CI_SIZE 8
-
-#define BASIC_STACK_SIZE (2*LUA_MINSTACK)
-
-
-
-typedef struct stringtable {
- GCObject **hash;
- lu_int32 nuse; /* number of elements */
- int size;
-} stringtable;
-
-
-/*
-** informations about a call
-*/
-typedef struct CallInfo {
- StkId base; /* base for this function */
- StkId func; /* function index in the stack */
- StkId top; /* top for this function */
- const Instruction *savedpc;
- int nresults; /* expected number of results from this function */
- int tailcalls; /* number of tail calls lost under this entry */
-} CallInfo;
-
-
-
-#define curr_func(L) (clvalue(L->ci->func))
-#define ci_func(ci) (clvalue((ci)->func))
-#define f_isLua(ci) (!ci_func(ci)->c.isC)
-#define isLua(ci) (ttisfunction((ci)->func) && f_isLua(ci))
-
-
-/*
-** `global state', shared by all threads of this state
-*/
-typedef struct global_State {
- stringtable strt; /* hash table for strings */
- lua_Alloc frealloc; /* function to reallocate memory */
- void *ud; /* auxiliary data to `frealloc' */
- lu_byte currentwhite;
- lu_byte gcstate; /* state of garbage collector */
- int sweepstrgc; /* position of sweep in `strt' */
- GCObject *rootgc; /* list of all collectable objects */
- GCObject **sweepgc; /* position of sweep in `rootgc' */
- GCObject *gray; /* list of gray objects */
- GCObject *grayagain; /* list of objects to be traversed atomically */
- GCObject *weak; /* list of weak tables (to be cleared) */
- GCObject *tmudata; /* last element of list of userdata to be GC */
- Mbuffer buff; /* temporary buffer for string concatentation */
- lu_mem GCthreshold;
- lu_mem totalbytes; /* number of bytes currently allocated */
- lu_mem estimate; /* an estimate of number of bytes actually in use */
- lu_mem gcdept; /* how much GC is `behind schedule' */
- int gcpause; /* size of pause between successive GCs */
- int gcstepmul; /* GC `granularity' */
- lua_CFunction panic; /* to be called in unprotected errors */
- TValue l_registry;
- struct lua_State *mainthread;
- UpVal uvhead; /* head of double-linked list of all open upvalues */
- struct Table *mt[NUM_TAGS]; /* metatables for basic types */
- TString *tmname[TM_N]; /* array with tag-method names */
-} global_State;
-
-
-/*
-** `per thread' state
-*/
-struct lua_State {
- CommonHeader;
- lu_byte status;
- StkId top; /* first free slot in the stack */
- StkId base; /* base of current function */
- global_State *l_G;
- CallInfo *ci; /* call info for current function */
- const Instruction *savedpc; /* `savedpc' of current function */
- StkId stack_last; /* last free slot in the stack */
- StkId stack; /* stack base */
- CallInfo *end_ci; /* points after end of ci array*/
- CallInfo *base_ci; /* array of CallInfo's */
- int stacksize;
- int size_ci; /* size of array `base_ci' */
- unsigned short nCcalls; /* number of nested C calls */
- unsigned short baseCcalls; /* nested C calls when resuming coroutine */
- lu_byte hookmask;
- lu_byte allowhook;
- int basehookcount;
- int hookcount;
- lua_Hook hook;
- TValue l_gt; /* table of globals */
- TValue env; /* temporary place for environments */
- GCObject *openupval; /* list of open upvalues in this stack */
- GCObject *gclist;
- struct lua_longjmp *errorJmp; /* current error recover point */
- ptrdiff_t errfunc; /* current error handling function (stack index) */
-};
-
-
-#define G(L) (L->l_G)
-
-
-/*
-** Union of all collectable objects
-*/
-union GCObject {
- GCheader gch;
- union TString ts;
- union Udata u;
- union Closure cl;
- struct Table h;
- struct Proto p;
- struct UpVal uv;
- struct lua_State th; /* thread */
-};
-
-
-/* macros to convert a GCObject into a specific value */
-#define rawgco2ts(o) check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts))
-#define gco2ts(o) (&rawgco2ts(o)->tsv)
-#define rawgco2u(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u))
-#define gco2u(o) (&rawgco2u(o)->uv)
-#define gco2cl(o) check_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl))
-#define gco2h(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h))
-#define gco2p(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p))
-#define gco2uv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv))
-#define ngcotouv(o) \
- check_exp((o) == NULL || (o)->gch.tt == LUA_TUPVAL, &((o)->uv))
-#define gco2th(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th))
-
-/* macro to convert any Lua object into a GCObject */
-#define obj2gco(v) (cast(GCObject *, (v)))
-
-
-LUAI_FUNC lua_State *luaE_newthread (lua_State *L);
-LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1);
-
-#endif
-
diff --git a/engines/sword25/util/pluto/pdep/lstring.h b/engines/sword25/util/pluto/pdep/lstring.h
deleted file mode 100644
index c88e4c12a9..0000000000
--- a/engines/sword25/util/pluto/pdep/lstring.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-** $Id$
-** String table (keep all strings handled by Lua)
-** See Copyright Notice in lua.h
-*/
-
-#ifndef lstring_h
-#define lstring_h
-
-
-#include "lgc.h"
-#include "lobject.h"
-#include "lstate.h"
-
-
-#define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char))
-
-#define sizeudata(u) (sizeof(union Udata)+(u)->len)
-
-#define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s)))
-#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \
- (sizeof(s)/sizeof(char))-1))
-
-#define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT)
-
-LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
-LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e);
-LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
-
-
-#endif
diff --git a/engines/sword25/util/pluto/pdep/ltm.h b/engines/sword25/util/pluto/pdep/ltm.h
deleted file mode 100644
index 1b89683ef3..0000000000
--- a/engines/sword25/util/pluto/pdep/ltm.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-** $Id$
-** Tag methods
-** See Copyright Notice in lua.h
-*/
-
-#ifndef ltm_h
-#define ltm_h
-
-
-#include "lobject.h"
-
-
-/*
-* WARNING: if you change the order of this enumeration,
-* grep "ORDER TM"
-*/
-typedef enum {
- TM_INDEX,
- TM_NEWINDEX,
- TM_GC,
- TM_MODE,
- TM_EQ, /* last tag method with `fast' access */
- TM_ADD,
- TM_SUB,
- TM_MUL,
- TM_DIV,
- TM_MOD,
- TM_POW,
- TM_UNM,
- TM_LEN,
- TM_LT,
- TM_LE,
- TM_CONCAT,
- TM_CALL,
- TM_N /* number of elements in the enum */
-} TMS;
-
-
-
-#define gfasttm(g,et,e) ((et) == NULL ? NULL : \
- ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e]))
-
-#define fasttm(l,et,e) gfasttm(G(l), et, e)
-
-LUAI_DATA const char *const luaT_typenames[];
-
-
-LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename);
-LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o,
- TMS event);
-LUAI_FUNC void luaT_init (lua_State *L);
-
-#endif
diff --git a/engines/sword25/util/pluto/pdep/lua.h b/engines/sword25/util/pluto/pdep/lua.h
deleted file mode 100644
index 68dd887f0f..0000000000
--- a/engines/sword25/util/pluto/pdep/lua.h
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
-** $Id$
-** Lua - An Extensible Extension Language
-** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
-** See Copyright Notice at the end of this file
-*/
-
-
-#ifndef lua_h
-#define lua_h
-
-#include <stdarg.h>
-#include <stddef.h>
-
-
-#include "sword25/util/lua/luaconf.h"
-
-
-#define LUA_VERSION "Lua 5.1"
-#define LUA_RELEASE "Lua 5.1.3"
-#define LUA_VERSION_NUM 501
-#define LUA_COPYRIGHT "Copyright (C) 1994-2008 Lua.org, PUC-Rio"
-#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
-
-
-/* mark for precompiled code (`<esc>Lua') */
-#define LUA_SIGNATURE "\033Lua"
-
-/* option for multiple returns in `lua_pcall' and `lua_call' */
-#define LUA_MULTRET (-1)
-
-
-/*
-** pseudo-indices
-*/
-#define LUA_REGISTRYINDEX (-10000)
-#define LUA_ENVIRONINDEX (-10001)
-#define LUA_GLOBALSINDEX (-10002)
-#define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i))
-
-
-/* thread status; 0 is OK */
-#define LUA_YIELD 1
-#define LUA_ERRRUN 2
-#define LUA_ERRSYNTAX 3
-#define LUA_ERRMEM 4
-#define LUA_ERRERR 5
-
-
-typedef struct lua_State lua_State;
-
-typedef int (*lua_CFunction) (lua_State *L);
-
-
-/*
-** functions that read/write blocks when loading/dumping Lua chunks
-*/
-typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz);
-
-typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud);
-
-
-/*
-** prototype for memory-allocation functions
-*/
-typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);
-
-
-/*
-** basic types
-*/
-#define LUA_TNONE (-1)
-
-#define LUA_TNIL 0
-#define LUA_TBOOLEAN 1
-#define LUA_TLIGHTUSERDATA 2
-#define LUA_TNUMBER 3
-#define LUA_TSTRING 4
-#define LUA_TTABLE 5
-#define LUA_TFUNCTION 6
-#define LUA_TUSERDATA 7
-#define LUA_TTHREAD 8
-
-
-
-/* minimum Lua stack available to a C function */
-#define LUA_MINSTACK 20
-
-
-/*
-** generic extra include file
-*/
-#if defined(LUA_USER_H)
-#include LUA_USER_H
-#endif
-
-
-/* type of numbers in Lua */
-typedef LUA_NUMBER lua_Number;
-
-
-/* type for integer functions */
-typedef LUA_INTEGER lua_Integer;
-
-
-
-/*
-** state manipulation
-*/
-LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud);
-LUA_API void (lua_close) (lua_State *L);
-LUA_API lua_State *(lua_newthread) (lua_State *L);
-
-LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf);
-
-
-/*
-** basic stack manipulation
-*/
-LUA_API int (lua_gettop) (lua_State *L);
-LUA_API void (lua_settop) (lua_State *L, int idx);
-LUA_API void (lua_pushvalue) (lua_State *L, int idx);
-LUA_API void (lua_remove) (lua_State *L, int idx);
-LUA_API void (lua_insert) (lua_State *L, int idx);
-LUA_API void (lua_replace) (lua_State *L, int idx);
-LUA_API int (lua_checkstack) (lua_State *L, int sz);
-
-LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n);
-
-
-/*
-** access functions (stack -> C)
-*/
-
-LUA_API int (lua_isnumber) (lua_State *L, int idx);
-LUA_API int (lua_isstring) (lua_State *L, int idx);
-LUA_API int (lua_iscfunction) (lua_State *L, int idx);
-LUA_API int (lua_isuserdata) (lua_State *L, int idx);
-LUA_API int (lua_type) (lua_State *L, int idx);
-LUA_API const char *(lua_typename) (lua_State *L, int tp);
-
-LUA_API int (lua_equal) (lua_State *L, int idx1, int idx2);
-LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2);
-LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2);
-
-LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx);
-LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx);
-LUA_API int (lua_toboolean) (lua_State *L, int idx);
-LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len);
-LUA_API size_t (lua_objlen) (lua_State *L, int idx);
-LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx);
-LUA_API void *(lua_touserdata) (lua_State *L, int idx);
-LUA_API lua_State *(lua_tothread) (lua_State *L, int idx);
-LUA_API const void *(lua_topointer) (lua_State *L, int idx);
-
-
-/*
-** push functions (C -> stack)
-*/
-LUA_API void (lua_pushnil) (lua_State *L);
-LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n);
-LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n);
-LUA_API void (lua_pushlstring) (lua_State *L, const char *s, size_t l);
-LUA_API void (lua_pushstring) (lua_State *L, const char *s);
-LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt,
- va_list argp);
-LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...);
-LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);
-LUA_API void (lua_pushboolean) (lua_State *L, int b);
-LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p);
-LUA_API int (lua_pushthread) (lua_State *L);
-
-
-/*
-** get functions (Lua -> stack)
-*/
-LUA_API void (lua_gettable) (lua_State *L, int idx);
-LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k);
-LUA_API void (lua_rawget) (lua_State *L, int idx);
-LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n);
-LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec);
-LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);
-LUA_API int (lua_getmetatable) (lua_State *L, int objindex);
-LUA_API void (lua_getfenv) (lua_State *L, int idx);
-
-
-/*
-** set functions (stack -> Lua)
-*/
-LUA_API void (lua_settable) (lua_State *L, int idx);
-LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k);
-LUA_API void (lua_rawset) (lua_State *L, int idx);
-LUA_API void (lua_rawseti) (lua_State *L, int idx, int n);
-LUA_API int (lua_setmetatable) (lua_State *L, int objindex);
-LUA_API int (lua_setfenv) (lua_State *L, int idx);
-
-
-/*
-** `load' and `call' functions (load and run Lua code)
-*/
-LUA_API void (lua_call) (lua_State *L, int nargs, int nresults);
-LUA_API int (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc);
-LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud);
-LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt,
- const char *chunkname);
-
-LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data);
-
-
-/*
-** coroutine functions
-*/
-LUA_API int (lua_yield) (lua_State *L, int nresults);
-LUA_API int (lua_resume) (lua_State *L, int narg);
-LUA_API int (lua_status) (lua_State *L);
-
-/*
-** garbage-collection function and options
-*/
-
-#define LUA_GCSTOP 0
-#define LUA_GCRESTART 1
-#define LUA_GCCOLLECT 2
-#define LUA_GCCOUNT 3
-#define LUA_GCCOUNTB 4
-#define LUA_GCSTEP 5
-#define LUA_GCSETPAUSE 6
-#define LUA_GCSETSTEPMUL 7
-
-LUA_API int (lua_gc) (lua_State *L, int what, int data);
-
-
-/*
-** miscellaneous functions
-*/
-
-LUA_API int (lua_error) (lua_State *L);
-
-LUA_API int (lua_next) (lua_State *L, int idx);
-
-LUA_API void (lua_concat) (lua_State *L, int n);
-
-LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);
-LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);
-
-
-
-/*
-** ===============================================================
-** some useful macros
-** ===============================================================
-*/
-
-#define lua_pop(L,n) lua_settop(L, -(n)-1)
-
-#define lua_newtable(L) lua_createtable(L, 0, 0)
-
-#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n)))
-
-#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0)
-
-#define lua_strlen(L,i) lua_objlen(L, (i))
-
-#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION)
-#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE)
-#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA)
-#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL)
-#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN)
-#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD)
-#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE)
-#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0)
-
-#define lua_pushliteral(L, s) \
- lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1)
-
-#define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, (s))
-#define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, (s))
-
-#define lua_tostring(L,i) lua_tolstring(L, (i), NULL)
-
-
-
-/*
-** compatibility macros and functions
-*/
-
-#define lua_open() luaL_newstate()
-
-#define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX)
-
-#define lua_getgccount(L) lua_gc(L, LUA_GCCOUNT, 0)
-
-#define lua_Chunkreader lua_Reader
-#define lua_Chunkwriter lua_Writer
-
-
-/* hack */
-LUA_API void lua_setlevel (lua_State *from, lua_State *to);
-
-
-/*
-** {======================================================================
-** Debug API
-** =======================================================================
-*/
-
-
-/*
-** Event codes
-*/
-#define LUA_HOOKCALL 0
-#define LUA_HOOKRET 1
-#define LUA_HOOKLINE 2
-#define LUA_HOOKCOUNT 3
-#define LUA_HOOKTAILRET 4
-
-
-/*
-** Event masks
-*/
-#define LUA_MASKCALL (1 << LUA_HOOKCALL)
-#define LUA_MASKRET (1 << LUA_HOOKRET)
-#define LUA_MASKLINE (1 << LUA_HOOKLINE)
-#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT)
-
-typedef struct lua_Debug lua_Debug; /* activation record */
-
-
-/* Functions to be called by the debuger in specific events */
-typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
-
-
-LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar);
-LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);
-LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);
-LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);
-LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n);
-LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n);
-
-LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count);
-LUA_API lua_Hook lua_gethook (lua_State *L);
-LUA_API int lua_gethookmask (lua_State *L);
-LUA_API int lua_gethookcount (lua_State *L);
-
-
-struct lua_Debug {
- int event;
- const char *name; /* (n) */
- const char *namewhat; /* (n) `global', `local', `field', `method' */
- const char *what; /* (S) `Lua', `C', `main', `tail' */
- const char *source; /* (S) */
- int currentline; /* (l) */
- int nups; /* (u) number of upvalues */
- int linedefined; /* (S) */
- int lastlinedefined; /* (S) */
- char short_src[LUA_IDSIZE]; /* (S) */
- /* private part */
- int i_ci; /* active function */
-};
-
-/* }====================================================================== */
-
-
-/******************************************************************************
-* Copyright (C) 1994-2008 Lua.org, PUC-Rio. All rights reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining
-* a copy of this software and associated documentation files (the
-* "Software"), to deal in the Software without restriction, including
-* without limitation the rights to use, copy, modify, merge, publish,
-* distribute, sublicense, and/or sell copies of the Software, and to
-* permit persons to whom the Software is furnished to do so, subject to
-* the following conditions:
-*
-* The above copyright notice and this permission notice shall be
-* included in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-******************************************************************************/
-
-
-#endif
diff --git a/engines/sword25/util/pluto/pdep/lzio.h b/engines/sword25/util/pluto/pdep/lzio.h
index 2f167d7d58..2e37f8d202 100644
--- a/engines/sword25/util/pluto/pdep/lzio.h
+++ b/engines/sword25/util/pluto/pdep/lzio.h
@@ -8,7 +8,7 @@
#ifndef lzio_h
#define lzio_h
-#include "lua.h"
+#include "sword25/util/lua/lua.h"
#define EOZ (-1) /* end of stream */
diff --git a/engines/sword25/util/pluto/pdep/pdep.h b/engines/sword25/util/pluto/pdep/pdep.h
index c26f4566c5..664fc812b5 100644
--- a/engines/sword25/util/pluto/pdep/pdep.h
+++ b/engines/sword25/util/pluto/pdep/pdep.h
@@ -1,16 +1,17 @@
#ifndef PDEP_H
#define PDEP_H
-#include "lua.h"
-#include "ldo.h"
-#include "lfunc.h"
-#include "lgc.h"
-#include "llimits.h"
-#include "lobject.h"
-#include "lopcodes.h"
-#include "lstate.h"
-#include "lstring.h"
-#include "lauxlib.h"
+#include "sword25/util/lua/lua.h"
+#include "sword25/util/pluto/pdep/lzio.h"
+#include "sword25/util/lua/ldo.h"
+#include "sword25/util/lua/lfunc.h"
+#include "sword25/util/lua/lgc.h"
+#include "sword25/util/lua/llimits.h"
+#include "sword25/util/lua/lobject.h"
+#include "sword25/util/lua/lopcodes.h"
+#include "sword25/util/lua/lstate.h"
+#include "sword25/util/lua/lstring.h"
+#include "sword25/util/lua/lauxlib.h"
#define pdep_reallocv(L,b,on,n,e) \
diff --git a/engines/sword25/util/pluto/pptest.cpp b/engines/sword25/util/pluto/pptest.cpp
deleted file mode 100644
index 1bfecf2b75..0000000000
--- a/engines/sword25/util/pluto/pptest.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/* $Id$ */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "lua.h"
-#include "lualib.h"
-#include "lauxlib.h"
-
-static int LUAF_createludata(lua_State *L)
-{
- lua_pushlightuserdata(L, (void*)321);
- return 1;
-}
-
-/* A userdata that may be literally persisted */
-static int LUAF_boxinteger(lua_State *L)
-{
- /* num */
- int* ptr = lua_newuserdata(L, sizeof(int));
- /* num udata */
- *ptr = luaL_checkint(L, 1);
- lua_newtable(L);
- /* num udata mt */
- lua_pushstring(L, "__persist");
- /* num udata mt "__persist" */
- lua_pushboolean(L, 1);
- /* num udata mt "__persist" true */
- lua_rawset(L, 3);
- /* num udata mt */
- lua_setmetatable(L, 2);
- /* num udata */
- return 1;
-}
-
-static int LUAF_boxboolean(lua_State *L)
-{
- /* bool */
- char* ptr = lua_newuserdata(L, sizeof(char));
- /* bool udata */
- *ptr = lua_toboolean(L, 1);
- lua_newtable(L);
- /* num udata mt */
- lua_pushstring(L, "__persist");
- /* num udata mt "__persist" */
- lua_getglobal(L, "booleanpersist");
- /* num udata mt "__persist" booleanpersist */
- lua_rawset(L, 3);
- /* num udata mt */
- lua_setmetatable(L, 2);
- /* num udata */
- return 1;
-}
-
-static int LUAF_unboxboolean(lua_State *L)
-{
- /* udata */
- lua_pushboolean(L, *(char*)lua_touserdata(L, 1));
- /* udata bool */
- return 1;
-}
-
-static int LUAF_onerror(lua_State *L)
-{
-
- const char* str = 0;
- if(lua_gettop(L) != 0)
- {
- str = lua_tostring(L, -1);
- printf("%s\n",str);
- }
- return 0;
-}
-
-int main()
-{
- lua_State* L = lua_open();
-
- luaL_openlibs(L);
- lua_settop(L, 0);
-
- lua_register(L, "createludata", LUAF_createludata);
- lua_register(L, "boxinteger", LUAF_boxinteger);
- lua_register(L, "boxboolean", LUAF_boxboolean);
- lua_register(L, "unboxboolean", LUAF_unboxboolean);
- lua_register(L, "onerror", LUAF_onerror);
-
- lua_pushcfunction(L, LUAF_onerror);
- luaL_loadfile(L, "pptest.lua");
- lua_pcall(L,0,0,1);
-
- lua_close(L);
-
- return 0;
-}
diff --git a/engines/sword25/util/pluto/pptest.lua b/engines/sword25/util/pluto/pptest.lua
deleted file mode 100644
index 144da3ee80..0000000000
--- a/engines/sword25/util/pluto/pptest.lua
+++ /dev/null
@@ -1,168 +0,0 @@
--- $Id$
-
-require "pluto"
-
-permtable = { 1234 }
-
-perms = { [coroutine.yield] = 1, [permtable] = 2 }
-
-twithmt = {}
-setmetatable( twithmt, { __call = function() return 21 end } )
-
-function testfenv()
- return abc
-end
-
-setfenv(testfenv, { abc = 456 })
-
-function fa(i)
- local ia = i + 1
- return fb(ia)
-end
-
-function fb(i)
- local ib = i + 1
- ib = ib + fc(ib)
- return ib
-end
-
-function fc(i)
- local ic = i + 1
- coroutine.yield()
- return ic*2
-end
-
-function func()
- return 4
-end
-
-thr = coroutine.create(fa)
-coroutine.resume(thr, 2)
-
-testtbl = { a = 2, [2] = 4 }
-
-function funcreturningclosure(n)
- return function()
- return n
- end
-end
-
-function nestedfunc(n)
- return (function(m) return m+2 end)(n+3)
-end
-
-testloopa = {}
-testloopb = { testloopa = testloopa }
-testloopa.testloopb = testloopb
-
-sharedref = {}
-refa = {sharedref = sharedref}
-refb = {sharedref = sharedref}
-
-sptable = { a = 3 }
-
-setmetatable(sptable, {
- __persist = function(tbl)
- local a = tbl.a
- return function()
- return { a = a+3 }
- end
- end
-})
-
-literaludata = boxinteger(71)
-
-function booleanpersist(udata)
- local b = unboxboolean(udata)
- return function()
- return boxboolean(b)
- end
-end
-
-function makecounter()
- local a = 0
- return {
- inc = function() a = a + 1 end,
- cur = function() return a end
- }
-end
-
-function uvinthreadfunc()
- local a = 1
- local b = function()
- a = a+1
- coroutine.yield()
- a = a+1
- end
- a = a+1
- b()
- a = a+1
- return a
-end
-
-uvinthread = coroutine.create(uvinthreadfunc)
-coroutine.resume(uvinthread)
-
-niinmt = { a = 3 }
-setmetatable(niinmt, {__newindex = function(key, val) end })
-
-
-
-
-local function GenerateObjects()
- local Table = {}
-
- function Table:Func()
- return { Table, self }
- end
-
- function uvcycle()
- return Table:Func()
- end
-end
-
-GenerateObjects()
-
-
-
-function debuginfo(foo)
- foo = foo + foo
- return debug.getlocal(1,1)
-end
-
-rootobj = {
- testfalse = false,
- testtrue = true,
- testseven = 7,
- testfoobar = "foobar",
- testfuncreturnsfour = func,
- testnil = nil,
- testthread = thr,
- testperm = permtable,
- testmt = twithmt,
- testtbl = testtbl,
- testfenv = testfenv,
- testclosure = funcreturningclosure(11),
- testnilclosure = funcreturningclosure(nil),
- testnest = nestedfunc,
- testludata = createludata(),
- testlooptable = testloopa,
- testsharedrefa = refa,
- testsharedrefb = refb,
- testsptable = sptable,
- testliteraludata = literaludata,
- testspudata1 = boxboolean(true),
- testspudata2 = boxboolean(false),
- testsharedupval = makecounter(),
- testuvinthread = uvinthread,
- testniinmt = niinmt,
- testuvcycle = uvcycle,
- testdebuginfo = debuginfo
-}
-
-buf = pluto.persist(perms, rootobj)
-
-onerror()
-outfile = io.open("test.plh", "wb")
-outfile:write(buf)
-outfile:close()
diff --git a/engines/sword25/util/pluto/puptest.cpp b/engines/sword25/util/pluto/puptest.cpp
deleted file mode 100644
index e9aa7ea305..0000000000
--- a/engines/sword25/util/pluto/puptest.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $Id$ */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "lua.h"
-#include "lualib.h"
-#include "lauxlib.h"
-
-static int LUAF_checkludata(lua_State *L)
-{
- lua_pushboolean(L, lua_touserdata(L, -1) == (void*)321);
- return 1;
-}
-
-static int LUAF_unboxinteger(lua_State *L)
-{
- lua_pushnumber(L, *((int*)lua_touserdata(L, -1)));
- return 1;
-}
-
-static int LUAF_unboxboolean(lua_State *L)
-{
- /* udata */
- lua_pushboolean(L, *(char*)lua_touserdata(L, 1));
- /* udata bool */
- return 1;
-}
-
-static int LUAF_boxboolean(lua_State *L)
-{
- /* bool */
- char* ptr = lua_newuserdata(L, sizeof(char));
- /* bool udata */
- *ptr = lua_toboolean(L, 1);
- lua_newtable(L);
- /* num udata mt */
- lua_pushstring(L, "__persist");
- /* num udata mt "__persist" */
- lua_getglobal(L, "booleanpersist");
- /* num udata mt "__persist" booleanpersist */
- lua_rawset(L, 3);
- /* num udata mt */
- lua_setmetatable(L, 2);
- /* num udata */
- return 1;
-}
-
-static int LUAF_onerror(lua_State *L)
-{
-
- const char* str = 0;
- if(lua_gettop(L) != 0)
- {
- str = lua_tostring(L, -1);
- printf("%s\n",str);
- }
- return 0;
-}
-
-int main()
-{
- lua_State* L = lua_open();
-
- luaL_openlibs(L);
- lua_settop(L, 0);
-
- lua_register(L, "checkludata", LUAF_checkludata);
- lua_register(L, "unboxinteger", LUAF_unboxinteger);
- lua_register(L, "boxboolean", LUAF_boxboolean);
- lua_register(L, "unboxboolean", LUAF_unboxboolean);
- lua_register(L, "onerror", LUAF_onerror);
-
- lua_pushcfunction(L, LUAF_onerror);
- luaL_loadfile(L, "puptest.lua");
- lua_pcall(L,0,0,1);
-
- lua_close(L);
-
- return 0;
-}
diff --git a/engines/sword25/util/pluto/puptest.lua b/engines/sword25/util/pluto/puptest.lua
deleted file mode 100644
index e5ccdd64bd..0000000000
--- a/engines/sword25/util/pluto/puptest.lua
+++ /dev/null
@@ -1,93 +0,0 @@
--- $Id$
-
-require "pluto"
-
-permtable = { 1234 }
-
-perms = { [1] = coroutine.yield, [2] = permtable }
-
-function testcounter(counter)
- local a = counter.cur()
- counter.inc()
- return counter.cur() == a+1
-end
-
-function testuvinthread(func)
- local success, result = coroutine.resume(func)
- return success and result == 5
-end
-
-
-function test(rootobj)
- local passed = 0
- local total = 0
- local dotest = function(name,cond)
- total = total+1
- if cond then
- print(name, " PASSED")
- passed = passed + 1
- else
- print(name, "* FAILED")
- end
- end
-
-
- dotest("Boolean FALSE ", rootobj.testfalse == false)
- dotest("Boolean TRUE ", rootobj.testtrue == true)
- dotest("Number 7 ", rootobj.testseven == 7)
- dotest("String 'foobar' ", rootobj.testfoobar == "foobar")
- dotest("Func returning 4 ", rootobj.testfuncreturnsfour() == 4)
- dotest("Nil value ", rootobj.testnil == nil)
- dotest("Thread resume ", coroutine.resume(rootobj.testthread) == true,14)
- dotest("Table ", rootobj.testtbl.a == 2 and rootobj.testtbl[2] == 4);
- dotest("Permanent table ", rootobj.testperm == permtable)
- dotest("Table metatable ", rootobj.testmt() == 21)
- dotest("Function env ", rootobj.testfenv() == 456)
- dotest("Lua closure ", rootobj.testclosure() == 11)
- dotest("Nil in closure ", rootobj.testnilclosure() == nil)
- dotest("Nested func ", rootobj.testnest(1) == 6)
- dotest("Light userdata ", checkludata(rootobj.testludata))
- dotest("Looped tables ",
- rootobj.testlooptable.testloopb.testloopa ==
- rootobj.testlooptable)
- dotest("Shared reference ", rootobj.testsharedrefa.sharedref ==
- rootobj.testsharedrefb.sharedref)
- dotest("Identical tables ", rootobj.testsharedrefa ~=
- rootobj.testsharedrefb)
- dotest("Table special persist", rootobj.testsptable.a == 6)
- dotest("Udata literal persist",
- unboxinteger(rootobj.testliteraludata) == 71)
- dotest("Udata special persist",
- unboxboolean(rootobj.testspudata1) == true and
- unboxboolean(rootobj.testspudata2) == false)
- dotest("Shared upvalues ",
- testcounter(rootobj.testsharedupval))
- dotest("Open upvalues ",
- testuvinthread(rootobj.testuvinthread))
- dotest("Upvalue cycles ",
- rootobj.testuvcycle()[1] == rootobj.testuvcycle()[2])
- dotest("__newindex metamethod", rootobj.testniinmt.a == 3)
- dotest("Debug info ", (rootobj.testdebuginfo(2)) == "foo")
- print()
- if passed == total then
- print("All tests passed.")
- else
- print(passed .. "/" .. total .. " tests passed.")
- end
-end
-
-infile, err = io.open("test.plh", "rb")
-if infile == nil then
- error("While opening: " .. (err or "no error"))
-end
-
-buf, err = infile:read("*a")
-if buf == nil then
- error("While reading: " .. (err or "no error"))
-end
-
-infile:close()
-
-rootobj = pluto.unpersist(perms, buf)
-
-test(rootobj)
diff --git a/engines/teenagent/actor.cpp b/engines/teenagent/actor.cpp
index 1620aa700c..9dd30f43c3 100644
--- a/engines/teenagent/actor.cpp
+++ b/engines/teenagent/actor.cpp
@@ -27,6 +27,7 @@
#include "teenagent/resources.h"
#include "common/random.h"
+#include "common/textconsole.h"
namespace TeenAgent {
diff --git a/engines/teenagent/animation.cpp b/engines/teenagent/animation.cpp
index 56812001e8..623966f265 100644
--- a/engines/teenagent/animation.cpp
+++ b/engines/teenagent/animation.cpp
@@ -24,6 +24,7 @@
#include "teenagent/animation.h"
#include "common/endian.h"
+#include "common/textconsole.h"
namespace TeenAgent {
diff --git a/engines/teenagent/callbacks.cpp b/engines/teenagent/callbacks.cpp
index d0662a73d6..f4be917eac 100644
--- a/engines/teenagent/callbacks.cpp
+++ b/engines/teenagent/callbacks.cpp
@@ -27,6 +27,8 @@
#include "teenagent/resources.h"
#include "teenagent/dialog.h"
+#include "common/textconsole.h"
+
namespace TeenAgent {
#define CHECK_FLAG(addr, v) (res->dseg.get_byte(addr) == (v))
diff --git a/engines/teenagent/console.h b/engines/teenagent/console.h
index 2aba99428b..d6c24d4d8f 100644
--- a/engines/teenagent/console.h
+++ b/engines/teenagent/console.h
@@ -22,8 +22,8 @@
* $Id$
*/
-#ifndef TEENAGENT_DIALOG_H
-#define TEENAGENT_DIALOG_H
+#ifndef TEENAGENT_CONSOLE_H
+#define TEENAGENT_CONSOLE_H
#include "gui/debugger.h"
diff --git a/engines/teenagent/font.cpp b/engines/teenagent/font.cpp
index 7d252f59e8..2d98ae9de7 100644
--- a/engines/teenagent/font.cpp
+++ b/engines/teenagent/font.cpp
@@ -24,8 +24,12 @@
#include "teenagent/font.h"
#include "teenagent/pack.h"
+#include "common/debug.h"
+#include "common/endian.h"
#include "common/stream.h"
+#include "common/textconsole.h"
#include "common/ptr.h"
+#include "graphics/surface.h"
namespace TeenAgent {
diff --git a/engines/teenagent/font.h b/engines/teenagent/font.h
index e08a3513af..29a8121435 100644
--- a/engines/teenagent/font.h
+++ b/engines/teenagent/font.h
@@ -25,6 +25,7 @@
#ifndef TEENAGENT_FONT_H
#define TEENAGENT_FONT_H
+#include "common/str.h"
#include "graphics/surface.h"
namespace TeenAgent {
diff --git a/engines/teenagent/inventory.cpp b/engines/teenagent/inventory.cpp
index bc4ac24da4..4d18d68502 100644
--- a/engines/teenagent/inventory.cpp
+++ b/engines/teenagent/inventory.cpp
@@ -24,6 +24,7 @@
#include "common/memstream.h"
#include "common/ptr.h"
+#include "common/textconsole.h"
#include "teenagent/inventory.h"
#include "teenagent/resources.h"
diff --git a/engines/teenagent/music.cpp b/engines/teenagent/music.cpp
index 395b2546b9..f0be5165f6 100644
--- a/engines/teenagent/music.cpp
+++ b/engines/teenagent/music.cpp
@@ -25,7 +25,9 @@
#include "teenagent/music.h"
#include "teenagent/resources.h"
+#include "common/debug.h"
#include "common/ptr.h"
+#include "common/textconsole.h"
namespace TeenAgent {
diff --git a/engines/teenagent/resources.cpp b/engines/teenagent/resources.cpp
index 9fe889fa41..69908239ab 100644
--- a/engines/teenagent/resources.cpp
+++ b/engines/teenagent/resources.cpp
@@ -24,6 +24,7 @@
#include "teenagent/resources.h"
#include "teenagent/teenagent.h"
+#include "common/textconsole.h"
#include "common/zlib.h"
namespace TeenAgent {
diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp
index f9756b5b91..ee431b2ab5 100644
--- a/engines/teenagent/scene.cpp
+++ b/engines/teenagent/scene.cpp
@@ -26,6 +26,9 @@
#include "common/debug.h"
#include "common/algorithm.h"
#include "common/ptr.h"
+#include "common/textconsole.h"
+
+#include "graphics/palette.h"
#include "teenagent/scene.h"
#include "teenagent/resources.h"
@@ -379,7 +382,7 @@ void Scene::init(int id, const Common::Point &pos) {
custom_animation[i].free();
if (background.pixels == NULL)
- background.create(320, 200, 1);
+ background.create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
warp(pos);
diff --git a/engines/teenagent/scene.h b/engines/teenagent/scene.h
index 2dc5bc9c83..28def3a064 100644
--- a/engines/teenagent/scene.h
+++ b/engines/teenagent/scene.h
@@ -35,6 +35,10 @@
#include "common/array.h"
#include "common/list.h"
+namespace Common {
+struct Event;
+}
+
namespace TeenAgent {
class TeenAgentEngine;
diff --git a/engines/teenagent/segment.cpp b/engines/teenagent/segment.cpp
index 7ba680907b..829c84765d 100644
--- a/engines/teenagent/segment.cpp
+++ b/engines/teenagent/segment.cpp
@@ -23,6 +23,7 @@
*/
#include "teenagent/segment.h"
+#include "common/textconsole.h"
#include "common/util.h"
namespace TeenAgent {
diff --git a/engines/teenagent/surface.cpp b/engines/teenagent/surface.cpp
index 96672ca1b3..545b0f75f0 100644
--- a/engines/teenagent/surface.cpp
+++ b/engines/teenagent/surface.cpp
@@ -61,7 +61,7 @@ void Surface::load(Common::SeekableReadStream *stream, Type type) {
}
//debug(0, "creating surface %ux%u -> %u,%u", w_, h_, x, y);
- create(w_, h_, 1);
+ create(w_, h_, Graphics::PixelFormat::createFormatCLUT8());
stream->read(pixels, w_ * h_);
}
diff --git a/engines/teenagent/surface.h b/engines/teenagent/surface.h
index b44fd3c21a..82c13c84bd 100644
--- a/engines/teenagent/surface.h
+++ b/engines/teenagent/surface.h
@@ -25,8 +25,12 @@
#ifndef TEENAGENT_SURFACE_H
#define TEENAGENT_SURFACE_H
+#include "common/rect.h"
#include "graphics/surface.h"
-#include "common/stream.h"
+
+namespace Common {
+ class SeekableReadStream;
+}
namespace TeenAgent {
diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp
index e66de70079..ec1e945f8d 100644
--- a/engines/teenagent/teenagent.cpp
+++ b/engines/teenagent/teenagent.cpp
@@ -27,6 +27,7 @@
#include "common/events.h"
#include "common/savefile.h"
#include "common/system.h"
+#include "common/textconsole.h"
#include "backends/audiocd/audiocd.h"
@@ -37,6 +38,7 @@
#include "audio/decoders/raw.h"
#include "graphics/cursorman.h"
+#include "graphics/palette.h"
#include "graphics/thumbnail.h"
#include "teenagent/console.h"
diff --git a/engines/testbed/detection.cpp b/engines/testbed/detection.cpp
index 734ed0c22a..b08cca291a 100644
--- a/engines/testbed/detection.cpp
+++ b/engines/testbed/detection.cpp
@@ -23,10 +23,8 @@
*
*/
-#include "common/config-manager.h"
#include "engines/advancedDetector.h"
#include "common/system.h"
-#include "common/fs.h"
#include "base/plugins.h"
diff --git a/engines/testbed/events.cpp b/engines/testbed/events.cpp
index b0a930172d..37b0a7ead4 100644
--- a/engines/testbed/events.cpp
+++ b/engines/testbed/events.cpp
@@ -24,10 +24,17 @@
#include "common/events.h"
#include "common/keyboard.h"
+#include "common/rect.h"
+#include "common/str.h"
+#include "common/system.h"
+#include "common/util.h"
#include "engines/engine.h"
#include "graphics/cursorman.h"
+#include "graphics/font.h"
+#include "graphics/fontman.h"
+#include "graphics/surface.h"
#include "testbed/events.h"
#include "testbed/graphics.h"
diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp
index 588aad8248..c8558e30f4 100644
--- a/engines/testbed/graphics.cpp
+++ b/engines/testbed/graphics.cpp
@@ -33,6 +33,7 @@
#include "graphics/cursorman.h"
#include "graphics/fontman.h"
+#include "graphics/palette.h"
#include "graphics/surface.h"
#include "graphics/VectorRendererSpec.h"
@@ -606,7 +607,7 @@ TestExitStatus GFXtests::mouseMovements() {
Common::String info = "Testing Automated Mouse movements.\n"
"You should expect cursor hotspot(top-left corner) to automatically move from (0, 0) to (100, 100).\n"
- "There we have a rectangle drawn, finally the cursor would lie centred in that rectangle.";
+ "There we have a rectangle drawn, finally the cursor would lie centered in that rectangle.";
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : Mouse Movements\n");
@@ -637,7 +638,7 @@ TestExitStatus GFXtests::mouseMovements() {
g_system->delayMillis(1500);
CursorMan.showMouse(false);
- if (Testsuite::handleInteractiveInput("Was the cursor centred in the rectangle at (100, 100)?", "Yes", "No", kOptionRight)) {
+ if (Testsuite::handleInteractiveInput("Was the cursor centered in the rectangle at (100, 100)?", "Yes", "No", kOptionRight)) {
return kTestFailed;
}
@@ -654,7 +655,7 @@ TestExitStatus GFXtests::copyRectToScreen() {
Testsuite::clearScreen();
Common::String info = "Testing Blitting a Bitmap to screen.\n"
- "You should expect to see a 20x40 yellow horizontal rectangle centred at the screen.";
+ "You should expect to see a 20x40 yellow horizontal rectangle centered at the screen.";
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : Blitting Bitmap\n");
@@ -1113,7 +1114,7 @@ TestExitStatus GFXtests::pixelFormats() {
Graphics::Surface *screen = g_system->lockScreen();
- // Draw 6 rectangles centred at (50, 160), piled over one another
+ // Draw 6 rectangles centered at (50, 160), piled over one another
// each with color in colors[]
for (int i = 0; i < 6; i++) {
screen->fillRect(Common::Rect::center(160, 20 + i * 10, 100, 10), colors[i]);
diff --git a/engines/testbed/savegame.cpp b/engines/testbed/savegame.cpp
index b91d9fc47c..0ffd3672fa 100644
--- a/engines/testbed/savegame.cpp
+++ b/engines/testbed/savegame.cpp
@@ -138,9 +138,9 @@ TestExitStatus SaveGametests::testListingSavefile() {
Common::Error error = saveFileMan->getError();
- if (error != Common::kNoError) {
+ if (error.getCode() != Common::kNoError) {
// Abort. Some Error in writing files
- Testsuite::logDetailedPrintf("Error while creating savefiles: %s\n", Common::errorToString(error));
+ Testsuite::logDetailedPrintf("Error while creating savefiles: %s\n", error.getDesc().c_str());
return kTestFailed;
}
@@ -177,7 +177,7 @@ TestExitStatus SaveGametests::testErrorMessages() {
readAndVerifyData("tBedSomeNonExistentSaveFile.0", "File doesn't exists!");
Common::Error error = saveFileMan->getError();
- if (error == Common::kNoError) {
+ if (error.getCode() == Common::kNoError) {
// blunder! how come?
Testsuite::logDetailedPrintf("SaveFileMan.getError() failed\n");
return kTestFailed;
diff --git a/engines/testbed/sound.cpp b/engines/testbed/sound.cpp
index 76f9e850c0..dca116368e 100644
--- a/engines/testbed/sound.cpp
+++ b/engines/testbed/sound.cpp
@@ -26,6 +26,8 @@
#include "backends/audiocd/audiocd.h"
+#include "common/config-manager.h"
+
#include "testbed/sound.h"
namespace Testbed {
diff --git a/engines/testbed/testbed.cpp b/engines/testbed/testbed.cpp
index 1ceecb8ebf..179be2bb8b 100644
--- a/engines/testbed/testbed.cpp
+++ b/engines/testbed/testbed.cpp
@@ -24,7 +24,12 @@
#include "common/debug-channels.h"
#include "common/scummsys.h"
-#include "common/system.h"
+#include "common/archive.h"
+#include "common/config-manager.h"
+#include "common/error.h"
+#include "common/fs.h"
+#include "common/rect.h"
+#include "common/str.h"
#include "engines/util.h"
diff --git a/engines/testbed/testbed.h b/engines/testbed/testbed.h
index e0feb52ff5..ca803a4cec 100644
--- a/engines/testbed/testbed.h
+++ b/engines/testbed/testbed.h
@@ -25,9 +25,9 @@
#ifndef TESTBED_H
#define TESTBED_H
-#include "engines/engine.h"
+#include "common/array.h"
-#include "gui/options.h"
+#include "engines/engine.h"
#include "testbed/config.h"
#include "testbed/testsuite.h"
diff --git a/engines/testbed/testsuite.h b/engines/testbed/testsuite.h
index a738f40764..94b3d70fd4 100644
--- a/engines/testbed/testsuite.h
+++ b/engines/testbed/testsuite.h
@@ -25,9 +25,12 @@
#ifndef TESTBED_TESTSUITE_H
#define TESTBED_TESTSUITE_H
+#include "common/array.h"
+#include "common/rect.h"
+#include "common/scummsys.h"
#include "common/system.h"
#include "common/str.h"
-#include "common/array.h"
+#include "graphics/font.h"
#include "graphics/fontman.h"
diff --git a/engines/tinsel/actors.cpp b/engines/tinsel/actors.cpp
index 7a1f9fbf55..9ec253e512 100644
--- a/engines/tinsel/actors.cpp
+++ b/engines/tinsel/actors.cpp
@@ -44,6 +44,7 @@
#include "tinsel/tinsel.h"
#include "tinsel/token.h"
+#include "common/textconsole.h"
#include "common/util.h"
namespace Tinsel {
@@ -108,7 +109,7 @@ struct ACTORINFO {
bool bEscOn;
int escEvent;
- COLORREF textColour; // Text colour
+ COLORREF textColor; // Text color
SCNHANDLE playFilm; // revert to this after talks
SCNHANDLE talkFilm; // this be deleted in the future!
@@ -140,7 +141,7 @@ typedef TAGACTOR *PTAGACTOR;
static ACTORINFO *actorInfo = NULL;
-static COLORREF defaultColour = 0; // Text colour
+static COLORREF defaultColor = 0; // Text color
static bool bActorsOn = false;
@@ -479,13 +480,13 @@ void DropActors() {
for (int i = 0; i < NumActors; i++) {
if (TinselV2) {
- // Save text colour
- COLORREF tColour = actorInfo[i].textColour;
+ // Save text color
+ COLORREF tColor = actorInfo[i].textColor;
memset(&actorInfo[i], 0, sizeof(ACTORINFO));
- // Restor text colour
- actorInfo[i].textColour = tColour;
+ // Restor text color
+ actorInfo[i].textColor = tColor;
// Clear extra arrays
memset(zFactors, 0, NumActors);
@@ -1278,7 +1279,7 @@ void SetMoverZ(PMOVER pMover, int y, int32 zFactor) {
/**
* Stores actor's attributes.
- * Currently only the speech colours.
+ * Currently only the speech colors.
*/
void storeActorAttr(int ano, int r1, int g1, int b1) {
assert((ano > 0 && ano <= NumActors) || ano == -1); // illegal actor number
@@ -1288,36 +1289,36 @@ void storeActorAttr(int ano, int r1, int g1, int b1) {
if (b1 > MAX_INTENSITY) b1 = MAX_INTENSITY; // }
if (ano == -1)
- defaultColour = TINSEL_RGB(r1, g1, b1);
+ defaultColor = TINSEL_RGB(r1, g1, b1);
else
- actorInfo[ano - 1].textColour = TINSEL_RGB(r1, g1, b1);
+ actorInfo[ano - 1].textColor = TINSEL_RGB(r1, g1, b1);
}
/**
- * Called from ActorRGB() - Stores actor's speech colour.
+ * Called from ActorRGB() - Stores actor's speech color.
*/
-void SetActorRGB(int ano, COLORREF colour) {
+void SetActorRGB(int ano, COLORREF color) {
assert(ano >= 0 && ano <= NumActors);
if (ano)
- actorInfo[ano - 1].textColour = TO_LE_32(colour);
+ actorInfo[ano - 1].textColor = TO_LE_32(color);
else
- defaultColour = TO_LE_32(colour);
+ defaultColor = TO_LE_32(color);
}
/**
- * Get the actor's stored speech colour.
+ * Get the actor's stored speech color.
* @param ano Actor Id
*/
COLORREF GetActorRGB(int ano) {
// Not used in JAPAN version
assert((ano >= -1) && (ano <= NumActors)); // illegal actor number
- if ((ano == -1) || !actorInfo[ano - 1].textColour)
- return defaultColour;
+ if ((ano == -1) || !actorInfo[ano - 1].textColor)
+ return defaultColor;
else
- return actorInfo[ano - 1].textColour;
+ return actorInfo[ano - 1].textColor;
}
/**
diff --git a/engines/tinsel/actors.h b/engines/tinsel/actors.h
index fbad5d9955..2be42b00e6 100644
--- a/engines/tinsel/actors.h
+++ b/engines/tinsel/actors.h
@@ -109,7 +109,7 @@ void ActorEvent(int ano, TINSEL_EVENT event, PLR_EVENT be);
void storeActorAttr(int ano, int r1, int g1, int b1);
COLORREF GetActorRGB(int ano);
-void SetActorRGB(int ano, COLORREF colour);
+void SetActorRGB(int ano, COLORREF color);
void SetActorZfactor(int ano, uint32 zFactor);
uint32 GetActorZfactor(int ano);
diff --git a/engines/tinsel/adpcm.cpp b/engines/tinsel/adpcm.cpp
index ec51d150dc..530395d754 100644
--- a/engines/tinsel/adpcm.cpp
+++ b/engines/tinsel/adpcm.cpp
@@ -23,6 +23,9 @@
*
*/
+#include "common/stream.h"
+#include "common/util.h"
+
#include "tinsel/adpcm.h"
namespace Tinsel {
@@ -44,14 +47,14 @@ void Tinsel_ADPCMStream::readBufferTinselHeader() {
// Negate
start = ~(start | 0xC0) + 1;
- _status.predictor = 1 << start;
+ _status.predictor = (unsigned long long int)1 << start;
} else {
// Lower 6 bit are positive
// Truncate
start &= 0x1F;
- _status.predictor = ((double) 1.0) / (1 << start);
+ _status.predictor = ((double) 1.0) / ((unsigned long long int)1 << start);
}
_status.K0 = TinselFilterTable[filterVal][0];
diff --git a/engines/tinsel/anim.cpp b/engines/tinsel/anim.cpp
index 37d8de925e..61c8b67624 100644
--- a/engines/tinsel/anim.cpp
+++ b/engines/tinsel/anim.cpp
@@ -31,6 +31,7 @@
#include "tinsel/sched.h"
#include "tinsel/tinsel.h"
+#include "common/textconsole.h"
#include "common/util.h"
namespace Tinsel {
diff --git a/engines/tinsel/background.cpp b/engines/tinsel/background.cpp
index f895ecd2da..79f051420b 100644
--- a/engines/tinsel/background.cpp
+++ b/engines/tinsel/background.cpp
@@ -51,8 +51,8 @@ void InitBackground(const BACKGND *pBgnd) {
// set current background
pCurBgnd = pBgnd;
- // init background sky colour
- SetBgndColour(pBgnd->rgbSkyColour);
+ // init background sky color
+ SetBgndColor(pBgnd->rgbSkyColor);
// start of playfield array
pPlayfield = pBgnd->fieldArray;
@@ -127,11 +127,11 @@ void PlayfieldGetPos(int which, int *pXpos, int *pYpos) {
}
/**
- * Returns the x position of the centre of the specified playfield
+ * Returns the x position of the center of the specified playfield
* @param which Which playfield
*/
-int PlayfieldGetCentreX(int which) {
+int PlayfieldGetCenterX(int which) {
PLAYFIELD *pPlayfield; // pointer to relavent playfield
// make sure there is a background
@@ -165,7 +165,7 @@ OBJECT *GetPlayfieldList(int which) {
pPlayfield = pCurBgnd->fieldArray + which;
// return the display list pointer for this playfield
- return (OBJECT *)&pPlayfield->pDispList;
+ return pPlayfield->pDispList;
}
/**
@@ -205,10 +205,10 @@ void DrawBackgnd() {
pPlay->bMoved = true;
// sort the display list for this background - just in case somebody has changed object Z positions
- SortObjectList((OBJECT *)&pPlay->pDispList);
+ SortObjectList(pPlay->pDispList);
// generate clipping rects for all objects that have moved etc.
- FindMovingObjects((OBJECT *)&pPlay->pDispList, &ptWin,
+ FindMovingObjects(pPlay->pDispList, &ptWin,
&pPlay->rcClip, false, pPlay->bMoved);
// clear playfield moved flag
@@ -235,7 +235,7 @@ void DrawBackgnd() {
if (IntersectRectangle(rcPlayClip, pPlay->rcClip, *r))
// redraw all objects within this clipping rect
- UpdateClipRect((OBJECT *)&pPlay->pDispList,
+ UpdateClipRect(pPlay->pDispList,
&ptWin, &rcPlayClip);
}
}
diff --git a/engines/tinsel/background.h b/engines/tinsel/background.h
index d0b27e6e40..06789e50bf 100644
--- a/engines/tinsel/background.h
+++ b/engines/tinsel/background.h
@@ -60,7 +60,7 @@ struct PLAYFIELD {
/** multi-playfield background structure - a backgnd is a container of playfields */
struct BACKGND {
- COLORREF rgbSkyColour; ///< background sky colour
+ COLORREF rgbSkyColor; ///< background sky color
Common::Point ptInitWorld; ///< initial world position
Common::Rect rcScrollLimits; ///< scroll limits
int refreshRate; ///< background update process refresh rate
@@ -93,7 +93,7 @@ void PlayfieldGetPos( // Returns the xy position of the specified playfield in
int *pXpos, // returns current x position
int *pYpos); // returns current y position
-int PlayfieldGetCentreX( // Returns the xy position of the specified playfield in the current background
+int PlayfieldGetCenterX( // Returns the xy position of the specified playfield in the current background
int which); // which playfield
OBJECT *GetPlayfieldList( // Returns the display list for the specified playfield
diff --git a/engines/tinsel/bg.cpp b/engines/tinsel/bg.cpp
index 68653b16f4..0e67c3a06e 100644
--- a/engines/tinsel/bg.cpp
+++ b/engines/tinsel/bg.cpp
@@ -40,6 +40,7 @@
#include "tinsel/tinlib.h" // For Control()
#include "tinsel/tinsel.h"
+#include "common/textconsole.h"
#include "common/util.h"
namespace Tinsel {
@@ -158,7 +159,7 @@ static void BGmainProcess(CORO_PARAM, const void *param) {
FadeInFast(NULL);
bDoFadeIn = false;
} else if (TinselV2)
- PokeInTagColour();
+ PokeInTagColor();
for (;;) {
for (int i = 0; i < bgReels; i++) {
diff --git a/engines/tinsel/bmv.cpp b/engines/tinsel/bmv.cpp
index b5b84ceaee..793febdc21 100644
--- a/engines/tinsel/bmv.cpp
+++ b/engines/tinsel/bmv.cpp
@@ -44,6 +44,8 @@
#include "audio/decoders/raw.h"
+#include "common/textconsole.h"
+
namespace Tinsel {
//----------------- LOCAL DEFINES ----------------------------
@@ -81,7 +83,7 @@ namespace Tinsel {
#define BIT0 0x01
#define CD_XSCR 0x04 // Screen has a scroll offset
-#define CD_CMAP 0x08 // Colour map is included
+#define CD_CMAP 0x08 // Color map is included
#define CD_CMND 0x10 // Command is included
#define CD_AUDIO 0x20 // Audio data is included
#define CD_EXTEND 0x40 // Extended modes "A"-"z"
@@ -350,7 +352,7 @@ BMVPlayer::BMVPlayer() {
memset(texts, 0, sizeof(texts));
- talkColour = 0;
+ talkColor = 0;
bigProblemCount = 0;
bIsText = 0;
movieTick = 0;
@@ -382,8 +384,8 @@ void BMVPlayer::MoviePalette(int paletteOffset) {
UpdateDACqueue(1, 255, &moviePal[1]);
// Don't clobber talk
- if (talkColour != 0)
- SetTextPal(talkColour);
+ if (talkColor != 0)
+ SetTextPal(talkColor);
}
void BMVPlayer::InitialiseMovieSound() {
@@ -490,7 +492,7 @@ void BMVPlayer::BmvDrawText(bool bDraw) {
|-------------------------------------------------------|
\*-----------------------------------------------------*/
-void BMVPlayer::MovieText(CORO_PARAM, int stringId, int x, int y, int fontId, COLORREF *pTalkColour, int duration) {
+void BMVPlayer::MovieText(CORO_PARAM, int stringId, int x, int y, int fontId, COLORREF *pTalkColor, int duration) {
SCNHANDLE hFont;
int index;
@@ -502,8 +504,8 @@ void BMVPlayer::MovieText(CORO_PARAM, int stringId, int x, int y, int fontId, CO
} else {
// It's a 'talk'
- if (pTalkColour != NULL)
- SetTextPal(*pTalkColour);
+ if (pTalkColor != NULL)
+ SetTextPal(*pTalkColor);
hFont = GetTalkFontHandle();
index = 1;
}
@@ -519,7 +521,7 @@ void BMVPlayer::MovieText(CORO_PARAM, int stringId, int x, int y, int fontId, CO
0,
x, y,
hFont,
- TXT_CENTRE, 0);
+ TXT_CENTER, 0);
KeepOnScreen(texts[index].pText, &x, &y);
}
@@ -541,13 +543,13 @@ int BMVPlayer::MovieCommand(char cmd, int commandOffset) {
} else {
if (_vm->_config->_useSubtitles) {
TALK_CMD *pCmd = (TALK_CMD *)(bigBuffer + commandOffset);
- talkColour = TINSEL_RGB(pCmd->r, pCmd->g, pCmd->b);
+ talkColor = TINSEL_RGB(pCmd->r, pCmd->g, pCmd->b);
MovieText(nullContext, (int16)READ_LE_UINT16(&pCmd->stringId),
(int16)READ_LE_UINT16(&pCmd->x),
(int16)READ_LE_UINT16(&pCmd->y),
0,
- &talkColour,
+ &talkColor,
pCmd->duration);
}
return sz_CMD_TALK_pkt;
@@ -693,7 +695,7 @@ void BMVPlayer::InitialiseBMV() {
bFileEnd = false;
blobsInBuffer = 0;
memset(texts, 0, sizeof(texts));
- talkColour = 0;
+ talkColor = 0;
bigProblemCount = 0;
movieTick = 0;
diff --git a/engines/tinsel/bmv.h b/engines/tinsel/bmv.h
index 99a43e0740..d90d68fc13 100644
--- a/engines/tinsel/bmv.h
+++ b/engines/tinsel/bmv.h
@@ -96,7 +96,7 @@ class BMVPlayer {
int dieFrame;
} texts[2];
- COLORREF talkColour;
+ COLORREF talkColor;
int bigProblemCount;
@@ -143,7 +143,7 @@ private:
void MovieAudio(int audioOffset, int blobs);
void FettleMovieText();
void BmvDrawText(bool bDraw);
- void MovieText(CORO_PARAM, int stringId, int x, int y, int fontId, COLORREF *pTalkColour, int duration);
+ void MovieText(CORO_PARAM, int stringId, int x, int y, int fontId, COLORREF *pTalkColor, int duration);
int MovieCommand(char cmd, int commandOffset);
int FollowingPacket(int thisPacket, bool bReallyImportant);
void LoadSlots(int number);
diff --git a/engines/tinsel/dialogs.cpp b/engines/tinsel/dialogs.cpp
index 73cad7a68f..281dd2da55 100644
--- a/engines/tinsel/dialogs.cpp
+++ b/engines/tinsel/dialogs.cpp
@@ -62,6 +62,8 @@
#include "tinsel/tinsel.h" // For engine access
#include "tinsel/token.h"
+#include "common/textconsole.h"
+
namespace Tinsel {
//----------------- EXTERNAL GLOBAL DATA --------------------
@@ -259,7 +261,7 @@ enum PARTS_INDEX {
#define MD_XLBUTR (TinselV2 ? 26 : 10)
#define MD_XRBUTL (TinselV2 ? 173 : 105)
#define MD_XRBUTR (TinselV2 ? 195 : 114)
-#define ROTX1 60 // Rotate button's offsets from the centre
+#define ROTX1 60 // Rotate button's offsets from the center
// Number of objects that makes up an empty window
#define MAX_WCOMP 21 // 4 corners + (3+3) sides + (2+2) extra sides
@@ -449,7 +451,7 @@ static bool bMoveOnUnHide; // Set before start of conversation
//----- Data pertinant to configure (incl. load/save game) -----
-#define COL_MAINBOX TBLUE1 // Base blue colour
+#define COL_MAINBOX TBLUE1 // Base blue color
#define COL_BOX TBLUE1
#define COL_HILIGHT TBLUE4
@@ -1639,7 +1641,7 @@ static void Select(int i, bool force) {
switch (cd.box[i].boxType) {
case RGROUP:
iconArray[HL2] = RectangleObject(BgPal(),
- (TinselV2 ? HighlightColour() : COL_HILIGHT), cd.box[i].w, cd.box[i].h);
+ (TinselV2 ? HighlightColor() : COL_HILIGHT), cd.box[i].w, cd.box[i].h);
MultiInsertObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL2]);
MultiSetAniXY(iconArray[HL2],
InvD[ino].inventoryX + cd.box[i].xpos,
@@ -2239,7 +2241,7 @@ static int WhichMenuBox(int curX, int curY, bool bSlides) {
/***/
/**************************************************************************/
-#define ROTX1 60 // Rotate button's offsets from the centre
+#define ROTX1 60 // Rotate button's offsets from the center
/**
* InvBoxes
@@ -2277,7 +2279,7 @@ static void InvBoxes(bool InBody, int curX, int curY) {
cd.box[cd.pointBox].boxType == AATBUT ||
cd.box[cd.pointBox].boxType == AABUT) {
iconArray[HL1] = RectangleObject(BgPal(),
- (TinselV2 ? HighlightColour() : COL_HILIGHT),
+ (TinselV2 ? HighlightColor() : COL_HILIGHT),
cd.box[cd.pointBox].w, cd.box[cd.pointBox].h);
MultiInsertObject(GetPlayfieldList(FIELD_STATUS), iconArray[HL1]);
MultiSetAniXY(iconArray[HL1],
@@ -2638,14 +2640,14 @@ static void AddBackground(OBJECT **rect, OBJECT **title, int extraH, int extraV,
LoadStringRes(InvD[ino].hInvTitle, TextBufferAddr(), TBUFSZ);
*title = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), TextBufferAddr(), 0,
InvD[ino].inventoryX + width/2, InvD[ino].inventoryY + M_TOFF,
- GetTagFontHandle(), TXT_CENTRE);
+ GetTagFontHandle(), TXT_CENTER);
assert(*title); // Inventory title string produced NULL text
MultiSetZPosition(*title, Z_INV_HTEXT);
} else if (textFrom == FROM_STRING && cd.ixHeading != NO_HEADING) {
LoadStringRes(configStrings[cd.ixHeading], TextBufferAddr(), TBUFSZ);
*title = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), TextBufferAddr(), 0,
InvD[ino].inventoryX + width/2, InvD[ino].inventoryY + M_TOFF,
- GetTagFontHandle(), TXT_CENTRE);
+ GetTagFontHandle(), TXT_CENTER);
assert(*title); // Inventory title string produced NULL text
MultiSetZPosition(*title, Z_INV_HTEXT);
}
@@ -2669,7 +2671,7 @@ static void AddTitle(POBJECT *title, int extraH) {
LoadStringRes(InvD[ino].hInvTitle, TextBufferAddr(), TBUFSZ);
*title = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), TextBufferAddr(), 0,
InvD[ino].inventoryX + (width/2)+NM_BG_POS_X, InvD[ino].inventoryY + NM_TOFF,
- GetTagFontHandle(), TXT_CENTRE, 0);
+ GetTagFontHandle(), TXT_CENTER, 0);
assert(*title);
MultiSetZPosition(*title, Z_INV_HTEXT);
}
@@ -2736,7 +2738,7 @@ static void AddBox(int *pi, const int i) {
break;
// Give us a box
- iconArray[*pi] = RectangleObject(BgPal(), TinselV2 ? BoxColour() : COL_BOX,
+ iconArray[*pi] = RectangleObject(BgPal(), TinselV2 ? BoxColor() : COL_BOX,
cd.box[i].w, cd.box[i].h);
MultiInsertObject(GetPlayfieldList(FIELD_STATUS), iconArray[*pi]);
MultiSetAniXY(iconArray[*pi], x, y);
@@ -2758,9 +2760,9 @@ static void AddBox(int *pi, const int i) {
iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), cd.box[i].boxText, 0,
#ifdef JAPAN
// Note: it never seems to go here!
- x + cd.box[i].w/2, y+2, GetTagFontHandle(), TXT_CENTRE);
+ x + cd.box[i].w/2, y+2, GetTagFontHandle(), TXT_CENTER);
#else
- x + cd.box[i].w / 2, y + TYOFF, GetTagFontHandle(), TXT_CENTRE);
+ x + cd.box[i].w / 2, y + TYOFF, GetTagFontHandle(), TXT_CENTER);
#endif
}
@@ -2787,9 +2789,9 @@ static void AddBox(int *pi, const int i) {
iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS),
TextBufferAddr(), 0,
#ifdef JAPAN
- x + cd.box[i].w/2, y+2, GetTagFontHandle(), TXT_CENTRE);
+ x + cd.box[i].w/2, y+2, GetTagFontHandle(), TXT_CENTER);
#else
- x + cd.box[i].w / 2, y + TYOFF, GetTagFontHandle(), TXT_CENTRE);
+ x + cd.box[i].w / 2, y + TYOFF, GetTagFontHandle(), TXT_CENTER);
#endif
MultiSetZPosition(iconArray[*pi], Z_INV_ITEXT);
*pi += 1;
@@ -2870,7 +2872,7 @@ static void AddBox(int *pi, const int i) {
if (cd.box[i].boxType == TOGGLE2) {
iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS),
TextBufferAddr(), 0, x + cd.box[i].w / 2, y + TOG2_YOFF,
- GetTagFontHandle(), TXT_CENTRE, 0);
+ GetTagFontHandle(), TXT_CENTER, 0);
} else {
iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS),
TextBufferAddr(), 0, x + MDTEXT_XOFF, y + MDTEXT_YOFF,
@@ -2934,7 +2936,7 @@ static void AddBox(int *pi, const int i) {
LoadStringRes(SysString(cd.box[i].ixText), TextBufferAddr(), TBUFSZ);
iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS),
TextBufferAddr(), 0, x + cd.box[i].w / 2, y + TOG2_YOFF,
- GetTagFontHandle(), TXT_CENTRE, 0);
+ GetTagFontHandle(), TXT_CENTER, 0);
MultiSetZPosition(iconArray[*pi], Z_INV_ITEXT);
*pi += 1;
}
@@ -2945,7 +2947,7 @@ static void AddBox(int *pi, const int i) {
LoadStringRes(LanguageDesc(displayedLanguage), TextBufferAddr(), TBUFSZ);
iconArray[*pi] = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), TextBufferAddr(), 0,
- x + cd.box[i].w / 2, y + ROT_YOFF, GetTagFontHandle(), TXT_CENTRE, 0);
+ x + cd.box[i].w / 2, y + ROT_YOFF, GetTagFontHandle(), TXT_CENTER, 0);
MultiSetZPosition(iconArray[*pi], Z_INV_ITEXT);
*pi += 1;
@@ -3683,15 +3685,15 @@ extern void HideConversation(bool bHide) {
/*
* First time, position it appropriately
*/
- int left, centre;
+ int left, center;
int x, y, deltay;
// Only do it once per conversation
bMoveOnUnHide = false;
- // Current centre of the window
+ // Current center of the window
left = MultiLeftmost(RectObject);
- centre = (MultiRightmost(RectObject) + left) / 2;
+ center = (MultiRightmost(RectObject) + left) / 2;
// Get the x-offset for the conversation window
if (thisConvActor) {
@@ -3731,12 +3733,12 @@ extern void HideConversation(bool bHide) {
// Move it all
for (i = 0; objArray[i] && i < MAX_WCOMP; i++) {
- MultiMoveRelXY(objArray[i], x - centre, deltay);
+ MultiMoveRelXY(objArray[i], x - center, deltay);
}
for (i = 0; iconArray[i] && i < MAX_ICONS; i++) {
- MultiMoveRelXY(iconArray[i], x - centre, deltay);
+ MultiMoveRelXY(iconArray[i], x - center, deltay);
}
- InvD[INV_CONV].inventoryX += x - centre;
+ InvD[INV_CONV].inventoryX += x - center;
/*
* Now positioned as worked out
diff --git a/engines/tinsel/dialogs.h b/engines/tinsel/dialogs.h
index a256ed73e8..f81a59a0b7 100644
--- a/engines/tinsel/dialogs.h
+++ b/engines/tinsel/dialogs.h
@@ -32,7 +32,7 @@
#include "tinsel/events.h" // for PLR_EVENT, PLR_EVENT
namespace Common {
- class Serializer;
+class Serializer;
}
namespace Tinsel {
diff --git a/engines/tinsel/drives.cpp b/engines/tinsel/drives.cpp
index ab606f3159..d252e45cf5 100644
--- a/engines/tinsel/drives.cpp
+++ b/engines/tinsel/drives.cpp
@@ -24,9 +24,7 @@
* CD/drive handling functions
*/
-#include "common/config-manager.h"
-#include "common/substream.h"
-#include "gui/message.h"
+#include "common/textconsole.h"
#include "tinsel/drives.h"
#include "tinsel/scene.h"
#include "tinsel/tinsel.h"
diff --git a/engines/tinsel/faders.cpp b/engines/tinsel/faders.cpp
index a82285b12f..99a8b9ff14 100644
--- a/engines/tinsel/faders.cpp
+++ b/engines/tinsel/faders.cpp
@@ -37,7 +37,7 @@ namespace Tinsel {
/** structure used by the "FadeProcess" process */
struct FADE {
- const long *pColourMultTable; // list of fixed point colour multipliers - terminated with negative entry
+ const long *pColorMultTable; // list of fixed point color multipliers - terminated with negative entry
PALQ *pPalQ; // palette queue entry to fade
};
@@ -46,42 +46,42 @@ struct FADE {
//const long fadein[] = {0, 0x1000, 0x3000, 0x5000, 0x7000, 0x9000, 0xb000, 0xd000, 0x10000L, -1};
/**
- * Scale 'colour' by the fixed point colour multiplier 'colourMult'
- * @param colour Colour to scale
- * @param colourMult Fixed point multiplier
+ * Scale 'color' by the fixed point color multiplier 'colorMult'
+ * @param color Color to scale
+ * @param colorMult Fixed point multiplier
*/
-static COLORREF ScaleColour(COLORREF colour, uint32 colourMult) {
+static COLORREF ScaleColor(COLORREF color, uint32 colorMult) {
// apply multiplier to RGB components
- uint32 red = ((TINSEL_GetRValue(colour) * colourMult) << 8) >> 24;
- uint32 green = ((TINSEL_GetGValue(colour) * colourMult) << 8) >> 24;
- uint32 blue = ((TINSEL_GetBValue(colour) * colourMult) << 8) >> 24;
+ uint32 red = ((TINSEL_GetRValue(color) * colorMult) << 8) >> 24;
+ uint32 green = ((TINSEL_GetGValue(color) * colorMult) << 8) >> 24;
+ uint32 blue = ((TINSEL_GetBValue(color) * colorMult) << 8) >> 24;
- // return new colour
+ // return new color
return TINSEL_RGB(red, green, blue);
}
/**
- * Applies the fixed point multiplier 'mult' to all colours in
- * 'pOrig' to produce 'pNew'. Each colour in the palette will be
+ * Applies the fixed point multiplier 'mult' to all colors in
+ * 'pOrig' to produce 'pNew'. Each color in the palette will be
* multiplied by 'mult'.
* @param pNew Pointer to new palette
* @param pOrig Pointer to original palette
- * @param numColours Number of colours in the above palettes
+ * @param numColors Number of colors in the above palettes
* @param mult Fixed point multiplier
*/
-static void FadePalette(COLORREF *pNew, COLORREF *pOrig, int numColours, uint32 mult) {
- for (int i = 0; i < numColours; i++, pNew++, pOrig++) {
+static void FadePalette(COLORREF *pNew, COLORREF *pOrig, int numColors, uint32 mult) {
+ for (int i = 0; i < numColors; i++, pNew++, pOrig++) {
if (!TinselV2)
// apply multiplier to RGB components
- *pNew = ScaleColour(*pOrig, mult);
- else if (i == (TalkColour() - 1)) {
- *pNew = GetTalkColourRef();
- *pNew = ScaleColour(*pNew, mult);
- } else if (SysVar(SV_TAGCOLOUR) && i == (SysVar(SV_TAGCOLOUR) - 1)) {
+ *pNew = ScaleColor(*pOrig, mult);
+ else if (i == (TalkColor() - 1)) {
+ *pNew = GetTalkColorRef();
+ *pNew = ScaleColor(*pNew, mult);
+ } else if (SysVar(SV_TAGCOLOR) && i == (SysVar(SV_TAGCOLOR) - 1)) {
*pNew = GetTagColorRef();
- *pNew = ScaleColour(*pNew, mult);
+ *pNew = ScaleColor(*pNew, mult);
} else {
- *pNew = ScaleColour(*pOrig, mult);
+ *pNew = ScaleColor(*pOrig, mult);
}
}
}
@@ -94,8 +94,8 @@ static void FadePalette(COLORREF *pNew, COLORREF *pOrig, int numColours, uint32
static void FadeProcess(CORO_PARAM, const void *param) {
// COROUTINE
CORO_BEGIN_CONTEXT;
- COLORREF fadeRGB[MAX_COLOURS]; // local copy of palette
- const long *pColMult; // pointer to colour multiplier table
+ COLORREF fadeRGB[MAX_COLORS]; // local copy of palette
+ const long *pColMult; // pointer to color multiplier table
PALETTE *pPalette; // pointer to palette
CORO_END_CONTEXT(_ctx);
@@ -111,19 +111,19 @@ static void FadeProcess(CORO_PARAM, const void *param) {
// get pointer to palette - reduce pointer indirection a bit
_ctx->pPalette = (PALETTE *)LockMem(pFade->pPalQ->hPal);
- for (_ctx->pColMult = pFade->pColourMultTable; *_ctx->pColMult >= 0; _ctx->pColMult++) {
+ for (_ctx->pColMult = pFade->pColorMultTable; *_ctx->pColMult >= 0; _ctx->pColMult++) {
// go through all multipliers in table - until a negative entry
// fade palette using next multiplier
if (TinselV2)
FadePalette(_ctx->fadeRGB, pFade->pPalQ->palRGB,
- pFade->pPalQ->numColours, (uint32) *_ctx->pColMult);
+ pFade->pPalQ->numColors, (uint32) *_ctx->pColMult);
else
FadePalette(_ctx->fadeRGB, _ctx->pPalette->palRGB,
- FROM_LE_32(_ctx->pPalette->numColours), (uint32) *_ctx->pColMult);
+ FROM_LE_32(_ctx->pPalette->numColors), (uint32) *_ctx->pColMult);
// send new palette to video DAC
- UpdateDACqueue(pFade->pPalQ->posInDAC, FROM_LE_32(_ctx->pPalette->numColours), _ctx->fadeRGB);
+ UpdateDACqueue(pFade->pPalQ->posInDAC, FROM_LE_32(_ctx->pPalette->numColors), _ctx->fadeRGB);
// allow time for video DAC to be updated
CORO_SLEEP(1);
@@ -139,7 +139,7 @@ static void FadeProcess(CORO_PARAM, const void *param) {
/**
* Generic palette fader/unfader. Creates a 'FadeProcess' process
* for each palette that is to fade.
- * @param multTable Fixed point colour multiplier table
+ * @param multTable Fixed point color multiplier table
* @param noFadeTable List of palettes not to fade
*/
static void Fader(const long multTable[], SCNHANDLE noFadeTable[]) {
@@ -175,7 +175,7 @@ static void Fader(const long multTable[], SCNHANDLE noFadeTable[]) {
FADE fade;
// fill in FADE struct
- fade.pColourMultTable = multTable;
+ fade.pColorMultTable = multTable;
fade.pPalQ = pPal;
// create a fader process for this palette
@@ -210,7 +210,7 @@ void FadeOutFast(SCNHANDLE noFadeTable[]) {
}
/**
- * Fades a list of palettes from black to their current colours.
+ * Fades a list of palettes from black to their current colors.
* 'noFadeTable' is a NULL terminated list of palettes not to fade.
*/
void FadeInMedium(SCNHANDLE noFadeTable[]) {
@@ -223,7 +223,7 @@ void FadeInMedium(SCNHANDLE noFadeTable[]) {
}
/**
- * Fades a list of palettes from black to their current colours.
+ * Fades a list of palettes from black to their current colors.
* @param noFadeTable A NULL terminated list of palettes not to fade.
*/
void FadeInFast(SCNHANDLE noFadeTable[]) {
@@ -234,10 +234,10 @@ void FadeInFast(SCNHANDLE noFadeTable[]) {
Fader(fadein, noFadeTable);
}
-void PokeInTagColour() {
- if (SysVar(SV_TAGCOLOUR)) {
+void PokeInTagColor() {
+ if (SysVar(SV_TAGCOLOR)) {
const COLORREF c = GetActorRGB(-1);
- UpdateDACqueue(SysVar(SV_TAGCOLOUR), c);
+ UpdateDACqueue(SysVar(SV_TAGCOLOR), c);
}
}
diff --git a/engines/tinsel/faders.h b/engines/tinsel/faders.h
index e77bff2661..b30a26d893 100644
--- a/engines/tinsel/faders.h
+++ b/engines/tinsel/faders.h
@@ -50,7 +50,7 @@ void FadeOutMedium(SCNHANDLE noFadeTable[]);
void FadeOutFast(SCNHANDLE noFadeTable[]);
void FadeInMedium(SCNHANDLE noFadeTable[]);
void FadeInFast(SCNHANDLE noFadeTable[]);
-void PokeInTagColour();
+void PokeInTagColor();
} // End of namespace Tinsel
diff --git a/engines/tinsel/font.cpp b/engines/tinsel/font.cpp
index 4c76d12400..f57a6d5d54 100644
--- a/engines/tinsel/font.cpp
+++ b/engines/tinsel/font.cpp
@@ -118,10 +118,10 @@ void FettleFontPal(SCNHANDLE fontPal) {
else
pImg->hImgPal = 0;
- if (TinselV2 && SysVar(SV_TAGCOLOUR)) {
+ if (TinselV2 && SysVar(SV_TAGCOLOR)) {
const COLORREF c = GetActorRGB(-1);
SetTagColorRef(c);
- UpdateDACqueue(SysVar(SV_TAGCOLOUR), c);
+ UpdateDACqueue(SysVar(SV_TAGCOLOR), c);
}
}
diff --git a/engines/tinsel/graphics.cpp b/engines/tinsel/graphics.cpp
index aefc6e6144..bdcd3207f9 100644
--- a/engines/tinsel/graphics.cpp
+++ b/engines/tinsel/graphics.cpp
@@ -32,6 +32,8 @@
#include "tinsel/tinsel.h"
#include "tinsel/scn.h"
+#include "common/textconsole.h"
+
namespace Tinsel {
//----------------- LOCAL DEFINES --------------------
@@ -41,7 +43,7 @@ namespace Tinsel {
#define CHAR_WIDTH 4
#define CHAR_HEIGHT 4
-extern uint8 transPalette[MAX_COLOURS];
+extern uint8 transPalette[MAX_COLORS];
//----------------- SUPPORT FUNCTIONS ---------------------
@@ -175,14 +177,14 @@ static void t0WrtNonZero(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool apply
x += clipAmount;
if (repeatFlag) {
- // Repeat of a given colour
- uint8 colour = (numBytes >> 8) & 0xff;
+ // Repeat of a given color
+ uint8 color = (numBytes >> 8) & 0xff;
int runLength = (numBytes & 0xff) - clipAmount;
int rptLength = MAX(MIN(runLength, pObj->width - rightClip - x), 0);
if (yClip == 0) {
- if (colour != 0)
- memset(tempDest, colour, rptLength);
+ if (color != 0)
+ memset(tempDest, color, rptLength);
tempDest += rptLength;
}
@@ -470,18 +472,18 @@ static void t2WrtNonZero(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool apply
x+= clipAmount;
int runLength = numBytes - clipAmount;
- uint8 colour = *srcP++;
+ uint8 color = *srcP++;
- if ((yClip == 0) && (runLength > 0) && (colour != 0)) {
+ if ((yClip == 0) && (runLength > 0) && (color != 0)) {
runLength = MIN(runLength, pObj->width - rightClip - x);
if (runLength > 0) {
// Non-transparent run length
- colour += pObj->constant;
+ color += pObj->constant;
if (horizFlipped)
- Common::set_to(tempP - runLength + 1, tempP + 1, colour);
+ Common::set_to(tempP - runLength + 1, tempP + 1, color);
else
- Common::set_to(tempP, tempP + runLength, colour);
+ Common::set_to(tempP, tempP + runLength, color);
}
}
@@ -521,7 +523,7 @@ static void t2WrtNonZero(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool apply
}
/**
- * Fill the destination area with a constant colour
+ * Fill the destination area with a constant color
*/
static void WrtConst(DRAWOBJECT *pObj, uint8 *destP, bool applyClipping) {
if (applyClipping) {
@@ -595,11 +597,11 @@ static void WrtAll(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP, bool applyClippi
*/
static void PackedWrtNonZero(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP,
bool applyClipping, bool horizFlipped, int packingType) {
- uint8 numColours = 0;
- uint8 *colourTable = NULL;
+ uint8 numColors = 0;
+ uint8 *colorTable = NULL;
int topClip = 0;
int xOffset = 0;
- int numBytes, colour;
+ int numBytes, color;
int v;
if (_vm->getLanguage() == Common::RU_RUS) {
@@ -625,10 +627,10 @@ static void PackedWrtNonZero(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP,
}
if (packingType == 3) {
- // Variable colours
- numColours = *srcP++;
- colourTable = srcP;
- srcP += numColours;
+ // Variable colors
+ numColors = *srcP++;
+ colorTable = srcP;
+ srcP += numColors;
}
for (int y = 0; y < pObj->height; ++y) {
@@ -646,7 +648,7 @@ static void PackedWrtNonZero(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP,
int x = 0;
while (x < pObj->width) {
- // Get next run size and colour to use
+ // Get next run size and color to use
for (;;) {
if (xOffset > 0) {
x += xOffset;
@@ -663,9 +665,9 @@ static void PackedWrtNonZero(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP,
v = *srcP++;
numBytes = v & 0xf; // No. bytes 1-15
if (packingType == 3)
- colour = colourTable[v >> 4];
+ color = colorTable[v >> 4];
else
- colour = pObj->baseCol + (v >> 4);
+ color = pObj->baseCol + (v >> 4);
if (numBytes != 0)
break;
@@ -693,7 +695,7 @@ static void PackedWrtNonZero(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP,
while (numBytes-- > 0) {
if ((topClip == 0) && (x < (pObj->width - rightClip))) {
- *tempP = colour;
+ *tempP = color;
if (horizFlipped) --tempP; else ++tempP;
}
++x;
@@ -830,7 +832,7 @@ void DrawObject(DRAWOBJECT *pObj) {
int packType = pObj->flags >> 14;
if (packType == 0) {
- // No colour packing
+ // No color packing
switch (typeId) {
case 0x01:
case 0x11:
@@ -865,7 +867,7 @@ void DrawObject(DRAWOBJECT *pObj) {
} else {
// 1 = 16 from 240
// 2 = 16 from 224
- // 3 = variable colour
+ // 3 = variable color
if (packType == 1) pObj->baseCol = 0xF0;
else if (packType == 2) pObj->baseCol = 0xE0;
diff --git a/engines/tinsel/graphics.h b/engines/tinsel/graphics.h
index 8b8bb6488d..de16082441 100644
--- a/engines/tinsel/graphics.h
+++ b/engines/tinsel/graphics.h
@@ -43,7 +43,7 @@ struct DRAWOBJECT {
int transOffset; // transparent character offset
int flags; // object flags - see above for list
PALQ *pPal; // objects palette Q position
- int constant; // which colour in palette for monochrome objects
+ int constant; // which color in palette for monochrome objects
int width; // width of object
int height; // height of object
SCNHANDLE hBits; // image bitmap handle
diff --git a/engines/tinsel/handle.cpp b/engines/tinsel/handle.cpp
index f2db42bede..6f5f92c969 100644
--- a/engines/tinsel/handle.cpp
+++ b/engines/tinsel/handle.cpp
@@ -27,6 +27,7 @@
#define BODGE
#include "common/file.h"
+#include "common/textconsole.h"
#include "tinsel/drives.h"
#include "tinsel/dw.h"
diff --git a/engines/tinsel/mareels.cpp b/engines/tinsel/mareels.cpp
index cf28749e76..5d9672972a 100644
--- a/engines/tinsel/mareels.cpp
+++ b/engines/tinsel/mareels.cpp
@@ -28,6 +28,7 @@
#include "tinsel/pcode.h" // For D_UP, D_DOWN
#include "tinsel/rince.h"
+#include "common/textconsole.h"
#include "common/util.h"
namespace Tinsel {
diff --git a/engines/tinsel/move.cpp b/engines/tinsel/move.cpp
index 5b9e650689..5fc555f9b0 100644
--- a/engines/tinsel/move.cpp
+++ b/engines/tinsel/move.cpp
@@ -584,7 +584,7 @@ static void SetMoverUltDest(PMOVER pActor, int x, int y) {
* If in a neighbouring path to the final destination, if the target path
* is a follow nodes path, head for the end node, otherwise head straight
* for the target.
- * Otherwise, head towards the pseudo-centre or end node of the first
+ * Otherwise, head towards the pseudo-center or end node of the first
* en-route path.
*/
static void SetMoverIntDest(PMOVER pMover, int x, int y) {
@@ -636,7 +636,7 @@ static void SetMoverIntDest(PMOVER pMover, int x, int y) {
} else if (hIpath != NOPOLY) {
/* Head for an en-route path */
if (PolySubtype(hIpath) != NODE) {
- /* En-route path is normal - head for pseudo centre. */
+ /* En-route path is normal - head for pseudo center. */
if (CanGetThere(pMover, x, y) == GT_OK) {
pMover->ItargetX = x;
pMover->ItargetY = y;
@@ -644,8 +644,8 @@ static void SetMoverIntDest(PMOVER pMover, int x, int y) {
// make damn sure that Itarget is in hIpath
pMover->hIpath = InPolygon(x, y, PATH);
} else {
- pMover->ItargetX = PolyCentreX(hIpath);
- pMover->ItargetY = PolyCentreY(hIpath);
+ pMover->ItargetX = PolyCenterX(hIpath);
+ pMover->ItargetY = PolyCenterY(hIpath);
if (TinselV2)
// make damn sure that Itarget is in hIpath
pMover->hIpath = InPolygon(pMover->ItargetX, pMover->ItargetY, PATH);
@@ -943,12 +943,12 @@ static void SetNextDest(PMOVER pMover) {
assert(hPath == pMover->hIpath);
if (pMover->InDifficulty == NO_PROB) {
- x = PolyCentreX(hPath);
- y = PolyCentreY(hPath);
+ x = PolyCenterX(hPath);
+ y = PolyCenterY(hPath);
SetMoverDest(pMover, x, y);
- pMover->InDifficulty = TRY_CENTRE;
+ pMover->InDifficulty = TRY_CENTER;
pMover->over = false;
- } else if (pMover->InDifficulty == TRY_CENTRE) {
+ } else if (pMover->InDifficulty == TRY_CENTER) {
NearestCorner(&x, &y, pMover->hCpath, pMover->hIpath);
SetMoverDest(pMover, x, y);
pMover->InDifficulty = TRY_CORNER;
@@ -986,7 +986,7 @@ static void SetNextDest(PMOVER pMover) {
!IsAdjacentPath(pMover->hCpath, pMover->hIpath)) {
/*----------------------------------------------------------
If just entering a follow nodes polygon, go to first node.|
- Else if just going to pass through, go to pseudo-centre. |
+ Else if just going to pass through, go to pseudo-center. |
----------------------------------------------------------*/
if (PolySubtype(hPath) == NODE && pMover->hFnpath != hPath && pMover->npstatus != LEAVING) {
int node = NearestEndNode(hPath, x, y);
@@ -995,7 +995,7 @@ static void SetNextDest(PMOVER pMover) {
pMover->over = true;
} else if (!IsInPolygon(pMover->ItargetX, pMover->ItargetY, hPath) &&
!IsInPolygon(pMover->ItargetX, pMover->ItargetY, pMover->hCpath)) {
- SetMoverDest(pMover, PolyCentreX(hPath), PolyCentreY(hPath));
+ SetMoverDest(pMover, PolyCenterX(hPath), PolyCenterY(hPath));
pMover->over = true;
} else {
SetMoverDest(pMover, pMover->ItargetX, pMover->ItargetY);
@@ -1258,8 +1258,8 @@ static void SetOffWithinNodePath(PMOVER pMover, HPOLYGON StartPath, HPOLYGON Des
endnode = NearestEndNode(StartPath, targetX, targetY);
} else {
if (PolySubtype(hIpath) != NODE) {
- x = PolyCentreX(hIpath);
- y = PolyCentreY(hIpath);
+ x = PolyCenterX(hIpath);
+ y = PolyCenterY(hIpath);
endnode = NearestEndNode(StartPath, x, y);
} else {
endnode = NearEndNode(StartPath, hIpath);
@@ -1278,7 +1278,7 @@ static void SetOffWithinNodePath(PMOVER pMover, HPOLYGON StartPath, HPOLYGON Des
{
// could go for its end node if it's an NPATH
// but we probably will when we hit it anyway!
- SetMoverDest(pMover, PolyCentreX(hIpath), PolyCentreY(hIpath));
+ SetMoverDest(pMover, PolyCenterX(hIpath), PolyCenterY(hIpath));
}
}
} else
@@ -1500,7 +1500,7 @@ static void EnteringNewPath(PMOVER pMover, HPOLYGON hPath, int x, int y) {
assert(hIpath != NOPOLY); // No path on the way
if (PolySubtype(hIpath) != NODE) {
- lastnode = NearestEndNode(hPath, PolyCentreX(hIpath), PolyCentreY(hIpath));
+ lastnode = NearestEndNode(hPath, PolyCenterX(hIpath), PolyCenterY(hIpath));
} else {
lastnode = NearEndNode(hPath, hIpath);
}
diff --git a/engines/tinsel/object.cpp b/engines/tinsel/object.cpp
index bf31cdfa25..ad02a614a5 100644
--- a/engines/tinsel/object.cpp
+++ b/engines/tinsel/object.cpp
@@ -32,6 +32,8 @@
#include "tinsel/text.h"
#include "tinsel/tinsel.h"
+#include "common/textconsole.h"
+
#define OID_EFFECTS 0x2000 // generic special effects object id
namespace Tinsel {
@@ -482,11 +484,11 @@ void AnimateObject(OBJECT *pAniObj, SCNHANDLE hNewImg) {
* Creates a rectangle object of the given dimensions and returns
* a pointer to the object.
* @param hPal Palette for the rectangle object
- * @param colour Which colour offset from the above palette
+ * @param color Which color offset from the above palette
* @param width Width of rectangle
* @param height Height of rectangle
*/
-OBJECT *RectangleObject(SCNHANDLE hPal, int colour, int width, int height) {
+OBJECT *RectangleObject(SCNHANDLE hPal, int color, int width, int height) {
// template for initialising the rectangle object
static const OBJ_INIT rectObj = {0, DMA_CONST, OID_EFFECTS, 0, 0, 0};
PALQ *pPalQ; // palette queue pointer
@@ -503,8 +505,8 @@ OBJECT *RectangleObject(SCNHANDLE hPal, int colour, int width, int height) {
// assign palette to object
pRect->pPal = pPalQ;
- // set colour in the palette
- pRect->constant = colour;
+ // set color in the palette
+ pRect->constant = color;
// set rectangle width
pRect->width = width;
diff --git a/engines/tinsel/object.h b/engines/tinsel/object.h
index a000dee72c..9f10c06cd2 100644
--- a/engines/tinsel/object.h
+++ b/engines/tinsel/object.h
@@ -87,7 +87,7 @@ struct OBJECT {
Common::Rect rcPrev; ///< previous screen coordinates of object bounding rectangle
int flags; ///< object flags - see above for list
PALQ *pPal; ///< objects palette Q position
- int constant; ///< which colour in palette for monochrome objects
+ int constant; ///< which color in palette for monochrome objects
int width; ///< width of object
int height; ///< height of object
SCNHANDLE hBits; ///< image bitmap handle
@@ -184,7 +184,7 @@ void HideObject( // Hides a object by giving it a "NullImage" image pointer
OBJECT *RectangleObject( // create a rectangle object of the given dimensions
SCNHANDLE hPal, // palette for the rectangle object
- int colour, // which colour offset from the above palette
+ int color, // which color offset from the above palette
int width, // width of rectangle
int height); // height of rectangle
diff --git a/engines/tinsel/palette.cpp b/engines/tinsel/palette.cpp
index a0ceec54eb..0877337603 100644
--- a/engines/tinsel/palette.cpp
+++ b/engines/tinsel/palette.cpp
@@ -32,6 +32,8 @@
#include "tinsel/tinsel.h"
#include "common/system.h"
+#include "common/textconsole.h"
+#include "graphics/palette.h"
namespace Tinsel {
@@ -41,12 +43,12 @@ namespace Tinsel {
struct VIDEO_DAC_Q {
union {
SCNHANDLE hRGBarray; ///< handle of palette or
- COLORREF *pRGBarray; ///< list of palette colours
+ COLORREF *pRGBarray; ///< list of palette colors
COLORREF singleRGB;
} pal;
bool bHandle; ///< when set - use handle of palette
int destDACindex; ///< start index of palette in video DAC
- int numColours; ///< number of colours in "hRGBarray"
+ int numColors; ///< number of colors in "hRGBarray"
};
@@ -67,13 +69,13 @@ static VIDEO_DAC_Q vidDACdata[VDACQLENGTH];
/** video DAC transfer Q head pointer */
static VIDEO_DAC_Q *pDAChead;
-/** colour index of the 4 colours used for the translucent palette */
+/** color index of the 4 colors used for the translucent palette */
#define COL_HILIGHT TBLUE1
/** the translucent palette lookup table */
-uint8 transPalette[MAX_COLOURS]; // used in graphics.cpp
+uint8 transPalette[MAX_COLORS]; // used in graphics.cpp
-uint8 ghostPalette[MAX_COLOURS];
+uint8 ghostPalette[MAX_COLORS];
static int translucentIndex = 228;
@@ -111,7 +113,7 @@ void psxPaletteMapper(PALQ *originalPal, uint8 *psxClut, byte *mapperTable) {
}
// Check for correspondent color
- for (uint i = 0; (i < FROM_LE_32(pal->numColours)) && !colorFound; i++) {
+ for (uint i = 0; (i < FROM_LE_32(pal->numColors)) && !colorFound; i++) {
// get R G B values in the same way as psx format converters
uint16 psxEquivalent = TINSEL_PSX_RGB(TINSEL_GetRValue(pal->palRGB[i]) >> 3, TINSEL_GetGValue(pal->palRGB[i]) >> 3, TINSEL_GetBValue(pal->palRGB[i]) >> 3);
@@ -138,15 +140,15 @@ void PalettesToVideoDAC() {
// while Q is not empty
while (pDAChead != pDACtail) {
const PALETTE *pPalette; // pointer to hardware palette
- const COLORREF *pColours; // pointer to list of RGB triples
+ const COLORREF *pColors; // pointer to list of RGB triples
#ifdef DEBUG
// make sure palette does not overlap
- assert(pDACtail->destDACindex + pDACtail->numColours <= MAX_COLOURS);
+ assert(pDACtail->destDACindex + pDACtail->numColors <= MAX_COLORS);
#else
// make sure palette does not overlap
- if (pDACtail->destDACindex + pDACtail->numColours > MAX_COLOURS)
- pDACtail->numColours = MAX_COLOURS - pDACtail->destDACindex;
+ if (pDACtail->destDACindex + pDACtail->numColors > MAX_COLORS)
+ pDACtail->numColors = MAX_COLORS - pDACtail->destDACindex;
#endif
if (pDACtail->bHandle) {
@@ -156,23 +158,23 @@ void PalettesToVideoDAC() {
pPalette = (const PALETTE *)LockMem(pDACtail->pal.hRGBarray);
// get RGB pointer
- pColours = pPalette->palRGB;
- } else if (pDACtail->numColours == 1) {
+ pColors = pPalette->palRGB;
+ } else if (pDACtail->numColors == 1) {
// we are using a single color palette
- pColours = &pDACtail->pal.singleRGB;
+ pColors = &pDACtail->pal.singleRGB;
} else {
// we are using a palette pointer
- pColours = pDACtail->pal.pRGBarray;
+ pColors = pDACtail->pal.pRGBarray;
}
- for (int i = 0; i < pDACtail->numColours; ++i) {
- pal[i * 3 + 0] = TINSEL_GetRValue(pColours[i]);
- pal[i * 3 + 1] = TINSEL_GetGValue(pColours[i]);
- pal[i * 3 + 2] = TINSEL_GetBValue(pColours[i]);
+ for (int i = 0; i < pDACtail->numColors; ++i) {
+ pal[i * 3 + 0] = TINSEL_GetRValue(pColors[i]);
+ pal[i * 3 + 1] = TINSEL_GetGValue(pColors[i]);
+ pal[i * 3 + 2] = TINSEL_GetBValue(pColors[i]);
}
// update the system palette
- g_system->getPaletteManager()->setPalette(pal, pDACtail->destDACindex, pDACtail->numColours);
+ g_system->getPaletteManager()->setPalette(pal, pDACtail->destDACindex, pDACtail->numColors);
// update tail pointer
pDACtail++;
@@ -216,15 +218,15 @@ void PaletteStats() {
/**
* Places a palette in the video DAC queue.
* @param posInDAC Position in video DAC
- * @param numColours Number of colours in palette
+ * @param numColors Number of colors in palette
* @param hPalette Handle to palette
*/
-void UpdateDACqueueHandle(int posInDAC, int numColours, SCNHANDLE hPalette) {
+void UpdateDACqueueHandle(int posInDAC, int numColors, SCNHANDLE hPalette) {
// check Q overflow
assert(pDAChead < vidDACdata + VDACQLENGTH);
pDAChead->destDACindex = posInDAC & ~PALETTE_MOVED; // set index in video DAC
- pDAChead->numColours = numColours; // set number of colours
+ pDAChead->numColors = numColors; // set number of colors
pDAChead->pal.hRGBarray = hPalette; // set handle of palette
pDAChead->bHandle = true; // we are using a palette handle
@@ -240,19 +242,19 @@ void UpdateDACqueueHandle(int posInDAC, int numColours, SCNHANDLE hPalette) {
/**
* Places a palette in the video DAC queue.
* @param posInDAC Position in video DAC
- * @param numColours Number of colours in palette
- * @param pColours List of RGB triples
+ * @param numColors Number of colors in palette
+ * @param pColors List of RGB triples
*/
-void UpdateDACqueue(int posInDAC, int numColours, COLORREF *pColours) {
+void UpdateDACqueue(int posInDAC, int numColors, COLORREF *pColors) {
// check Q overflow
assert(pDAChead < vidDACdata + NUM_PALETTES);
pDAChead->destDACindex = posInDAC & ~PALETTE_MOVED; // set index in video DAC
- pDAChead->numColours = numColours; // set number of colours
- if (numColours == 1)
- pDAChead->pal.singleRGB = *pColours; // set single color of which the "palette" consists
+ pDAChead->numColors = numColors; // set number of colors
+ if (numColors == 1)
+ pDAChead->pal.singleRGB = *pColors; // set single color of which the "palette" consists
else
- pDAChead->pal.pRGBarray = pColours; // set addr of palette
+ pDAChead->pal.pRGBarray = pColors; // set addr of palette
pDAChead->bHandle = false; // we are not using a palette handle
// update head pointer
@@ -275,7 +277,7 @@ void UpdateDACqueue(int posInDAC, COLORREF color) {
assert(pDAChead < vidDACdata + NUM_PALETTES);
pDAChead->destDACindex = posInDAC & ~PALETTE_MOVED; // set index in video DAC
- pDAChead->numColours = 1; // set number of colours
+ pDAChead->numColors = 1; // set number of colors
pDAChead->pal.singleRGB = color; // set single color of which the "palette" consists
pDAChead->bHandle = false; // we are not using a palette handle
@@ -294,7 +296,7 @@ void UpdateDACqueue(int posInDAC, COLORREF color) {
*/
PALQ *AllocPalette(SCNHANDLE hNewPal) {
PALQ *pPrev, *p; // walks palAllocData
- int iDAC; // colour index in video DAC
+ int iDAC; // color index in video DAC
PALQ *pNxtPal; // next PALQ struct in palette allocator
PALETTE *pNewPal;
@@ -311,7 +313,7 @@ PALQ *AllocPalette(SCNHANDLE hNewPal) {
}
// search all structs in palette allocator - find a free slot
- iDAC = FGND_DAC_INDEX; // init DAC index to first available foreground colour
+ iDAC = FGND_DAC_INDEX; // init DAC index to first available foreground color
for (p = palAllocData; p < palAllocData + NUM_PALETTES; p++) {
if (p->hPal == 0) {
@@ -319,11 +321,11 @@ PALQ *AllocPalette(SCNHANDLE hNewPal) {
p->objCount = 1; // init number of objects using palette
p->posInDAC = iDAC; // set palettes start pos in video DAC
p->hPal = hNewPal; // set hardware palette data
- p->numColours = FROM_LE_32(pNewPal->numColours); // set number of colours in palette
+ p->numColors = FROM_LE_32(pNewPal->numColors); // set number of colors in palette
if (TinselV2)
- // Copy all the colours
- memcpy(p->palRGB, pNewPal->palRGB, p->numColours * sizeof(COLORREF));
+ // Copy all the colors
+ memcpy(p->palRGB, pNewPal->palRGB, p->numColors * sizeof(COLORREF));
#ifdef DEBUG
// one more palette in use
@@ -333,30 +335,30 @@ PALQ *AllocPalette(SCNHANDLE hNewPal) {
// Q the change to the video DAC
if (TinselV2)
- UpdateDACqueue(p->posInDAC, p->numColours, p->palRGB);
+ UpdateDACqueue(p->posInDAC, p->numColors, p->palRGB);
else
- UpdateDACqueueHandle(p->posInDAC, p->numColours, p->hPal);
+ UpdateDACqueueHandle(p->posInDAC, p->numColors, p->hPal);
// move all palettes after this one down (if necessary)
for (pPrev = p, pNxtPal = pPrev + 1; pNxtPal < palAllocData + NUM_PALETTES; pNxtPal++) {
if (pNxtPal->hPal != 0) {
// palette slot is in use
- if (pNxtPal->posInDAC >= pPrev->posInDAC + pPrev->numColours)
+ if (pNxtPal->posInDAC >= pPrev->posInDAC + pPrev->numColors)
// no need to move palettes down
break;
// move palette down - indicate change
pNxtPal->posInDAC = (pPrev->posInDAC
- + pPrev->numColours) | PALETTE_MOVED;
+ + pPrev->numColors) | PALETTE_MOVED;
// Q the palette change in position to the video DAC
if (!TinselV2)
UpdateDACqueueHandle(pNxtPal->posInDAC,
- pNxtPal->numColours,
+ pNxtPal->numColors,
pNxtPal->hPal);
else if (!pNxtPal->bFading)
UpdateDACqueue(pNxtPal->posInDAC,
- pNxtPal->numColours,
+ pNxtPal->numColors,
pNxtPal->palRGB);
// update previous palette to current palette
@@ -369,7 +371,7 @@ PALQ *AllocPalette(SCNHANDLE hNewPal) {
}
// set new DAC index
- iDAC = p->posInDAC + p->numColours;
+ iDAC = p->posInDAC + p->numColors;
}
// no free palettes
@@ -431,43 +433,43 @@ void SwapPalette(PALQ *pPalQ, SCNHANDLE hNewPal) {
// validate palette Q pointer
assert(pPalQ >= palAllocData && pPalQ <= palAllocData + NUM_PALETTES - 1);
- if (pPalQ->numColours >= (int)FROM_LE_32(pNewPal->numColours)) {
+ if (pPalQ->numColors >= (int)FROM_LE_32(pNewPal->numColors)) {
// new palette will fit the slot
// install new palette
pPalQ->hPal = hNewPal;
if (TinselV2) {
- pPalQ->numColours = FROM_LE_32(pNewPal->numColours);
+ pPalQ->numColors = FROM_LE_32(pNewPal->numColors);
- // Copy all the colours
- memcpy(pPalQ->palRGB, pNewPal->palRGB, FROM_LE_32(pNewPal->numColours) * sizeof(COLORREF));
+ // Copy all the colors
+ memcpy(pPalQ->palRGB, pNewPal->palRGB, FROM_LE_32(pNewPal->numColors) * sizeof(COLORREF));
if (!pPalQ->bFading)
// Q the change to the video DAC
- UpdateDACqueue(pPalQ->posInDAC, FROM_LE_32(pNewPal->numColours), pPalQ->palRGB);
+ UpdateDACqueue(pPalQ->posInDAC, FROM_LE_32(pNewPal->numColors), pPalQ->palRGB);
} else {
// Q the change to the video DAC
- UpdateDACqueueHandle(pPalQ->posInDAC, FROM_LE_32(pNewPal->numColours), hNewPal);
+ UpdateDACqueueHandle(pPalQ->posInDAC, FROM_LE_32(pNewPal->numColors), hNewPal);
}
} else {
- // # colours are different - will have to update all following palette entries
+ // # colors are different - will have to update all following palette entries
assert(!TinselV2); // Fatal error for Tinsel 2
PALQ *pNxtPalQ; // next palette queue position
for (pNxtPalQ = pPalQ + 1; pNxtPalQ < palAllocData + NUM_PALETTES; pNxtPalQ++) {
- if (pNxtPalQ->posInDAC >= pPalQ->posInDAC + pPalQ->numColours)
+ if (pNxtPalQ->posInDAC >= pPalQ->posInDAC + pPalQ->numColors)
// no need to move palettes down
break;
// move palette down
pNxtPalQ->posInDAC = (pPalQ->posInDAC
- + pPalQ->numColours) | PALETTE_MOVED;
+ + pPalQ->numColors) | PALETTE_MOVED;
// Q the palette change in position to the video DAC
UpdateDACqueueHandle(pNxtPalQ->posInDAC,
- pNxtPalQ->numColours,
+ pNxtPalQ->numColors,
pNxtPalQ->hPal);
// update previous palette to current palette
@@ -501,12 +503,12 @@ PALQ *GetNextPalette(PALQ *pStrtPal) {
}
/**
- * Sets the current background colour.
- * @param colour Colour to set the background to
+ * Sets the current background color.
+ * @param color Color to set the background to
*/
-void SetBgndColour(COLORREF colour) {
- // update background colour struct by queuing the change to the video DAC
- UpdateDACqueue(BGND_DAC_INDEX, colour);
+void SetBgndColor(COLORREF color) {
+ // update background color struct by queuing the change to the video DAC
+ UpdateDACqueue(BGND_DAC_INDEX, color);
}
/**
@@ -544,23 +546,23 @@ void CreateTranslucentPalette(SCNHANDLE hPalette) {
// get a pointer to the palette
PALETTE *pPal = (PALETTE *)LockMem(hPalette);
- // leave background colour alone
+ // leave background color alone
transPalette[0] = 0;
- for (uint i = 0; i < FROM_LE_32(pPal->numColours); i++) {
- // get the RGB colour model values
+ for (uint i = 0; i < FROM_LE_32(pPal->numColors); i++) {
+ // get the RGB color model values
uint8 red = TINSEL_GetRValue(pPal->palRGB[i]);
uint8 green = TINSEL_GetGValue(pPal->palRGB[i]);
uint8 blue = TINSEL_GetBValue(pPal->palRGB[i]);
- // calculate the Value field of the HSV colour model
+ // calculate the Value field of the HSV color model
unsigned val = (red > green) ? red : green;
val = (val > blue) ? val : blue;
- // map the Value field to one of the 4 colours reserved for the translucent palette
+ // map the Value field to one of the 4 colors reserved for the translucent palette
val /= 63;
transPalette[i + 1] = (uint8)((val == 0) ? 0 : val +
- (TinselV2 ? TranslucentColour() : COL_HILIGHT) - 1);
+ (TinselV2 ? TranslucentColor() : COL_HILIGHT) - 1);
}
}
@@ -572,20 +574,20 @@ void CreateGhostPalette(SCNHANDLE hPalette) {
PALETTE *pPal = (PALETTE *)LockMem(hPalette);
int i;
- // leave background colour alone
+ // leave background color alone
ghostPalette[0] = 0;
- for (i = 0; i < (int)FROM_LE_32(pPal->numColours); i++) {
- // get the RGB colour model values
+ for (i = 0; i < (int)FROM_LE_32(pPal->numColors); i++) {
+ // get the RGB color model values
uint8 red = TINSEL_GetRValue(pPal->palRGB[i]);
uint8 green = TINSEL_GetGValue(pPal->palRGB[i]);
uint8 blue = TINSEL_GetBValue(pPal->palRGB[i]);
- // calculate the Value field of the HSV colour model
+ // calculate the Value field of the HSV color model
unsigned val = (red > green) ? red : green;
val = (val > blue) ? val : blue;
- // map the Value field to one of the 4 colours reserved for the translucent palette
+ // map the Value field to one of the 4 colors reserved for the translucent palette
val /= 64;
assert(/*val >= 0 &&*/ val <= 3);
ghostPalette[i + 1] = (uint8)(val + SysVar(ISV_GHOST_BASE));
@@ -594,25 +596,25 @@ void CreateGhostPalette(SCNHANDLE hPalette) {
/**
- * Returns an adjusted colour RGB
- * @param colour Colour to scale
+ * Returns an adjusted color RGB
+ * @param color Color to scale
*/
-static COLORREF DimColour(COLORREF colour, int factor) {
+static COLORREF DimColor(COLORREF color, int factor) {
uint32 red, green, blue;
if (factor == 10) {
// No change
- return colour;
+ return color;
} else if (factor == 0) {
// No brightness
return 0;
} else {
// apply multiplier to RGB components
- red = TINSEL_GetRValue(colour) * factor / 10;
- green = TINSEL_GetGValue(colour) * factor / 10;
- blue = TINSEL_GetBValue(colour) * factor / 10;
+ red = TINSEL_GetRValue(color) * factor / 10;
+ green = TINSEL_GetGValue(color) * factor / 10;
+ blue = TINSEL_GetBValue(color) * factor / 10;
- // return new colour
+ // return new color
return TINSEL_RGB(red, green, blue);
}
}
@@ -620,10 +622,10 @@ static COLORREF DimColour(COLORREF colour, int factor) {
/**
* DimPartPalette
*/
-void DimPartPalette(SCNHANDLE hDimPal, int startColour, int length, int brightness) {
+void DimPartPalette(SCNHANDLE hDimPal, int startColor, int length, int brightness) {
PALQ *pPalQ;
PALETTE *pDimPal;
- int iColour;
+ int iColor;
pPalQ = FindPalette(hDimPal);
assert(pPalQ);
@@ -631,42 +633,42 @@ void DimPartPalette(SCNHANDLE hDimPal, int startColour, int length, int brightne
// get pointer to dim palette
pDimPal = (PALETTE *)LockMem(hDimPal);
- // Adjust for the fact that palettes don't contain colour 0
- startColour -= 1;
+ // Adjust for the fact that palettes don't contain color 0
+ startColor -= 1;
// Check some other things
- if (startColour + length > pPalQ->numColours)
- error("DimPartPalette(): colour overrun");
+ if (startColor + length > pPalQ->numColors)
+ error("DimPartPalette(): color overrun");
- for (iColour = startColour; iColour < startColour + length; iColour++) {
- pPalQ->palRGB[iColour] = DimColour(pDimPal->palRGB[iColour], brightness);
+ for (iColor = startColor; iColor < startColor + length; iColor++) {
+ pPalQ->palRGB[iColor] = DimColor(pDimPal->palRGB[iColor], brightness);
}
if (!pPalQ->bFading) {
// Q the change to the video DAC
- UpdateDACqueue(pPalQ->posInDAC + startColour, length, &pPalQ->palRGB[startColour]);
+ UpdateDACqueue(pPalQ->posInDAC + startColor, length, &pPalQ->palRGB[startColor]);
}
}
-int TranslucentColour() {
+int TranslucentColor() {
return translucentIndex;
}
-int HighlightColour() {
+int HighlightColor() {
UpdateDACqueue(talkIndex, (COLORREF)SysVar(SYS_HighlightRGB));
return talkIndex;
}
-int TalkColour() {
+int TalkColor() {
return TinselV2 ? talkIndex : TALKFONT_COL;
}
-void SetTalkColourRef(COLORREF colRef) {
+void SetTalkColorRef(COLORREF colRef) {
talkColRef = colRef;
}
-COLORREF GetTalkColourRef() {
+COLORREF GetTalkColorRef() {
return talkColRef;
}
diff --git a/engines/tinsel/palette.h b/engines/tinsel/palette.h
index 9743ee53aa..694eff504d 100644
--- a/engines/tinsel/palette.h
+++ b/engines/tinsel/palette.h
@@ -42,14 +42,14 @@ typedef uint32 COLORREF;
#define TINSEL_PSX_RGB(r,g,b) ((uint16)(((uint8)(r))|((uint16)(g)<<5)|(((uint16)(b))<<10)))
enum {
- MAX_COLOURS = 256, ///< maximum number of colours - for VGA 256
+ MAX_COLORS = 256, ///< maximum number of colors - for VGA 256
BITS_PER_PIXEL = 8, ///< number of bits per pixel for VGA 256
MAX_INTENSITY = 255, ///< the biggest value R, G or B can have
NUM_PALETTES = 32, ///< number of palettes
// Discworld has some fixed apportioned bits in the palette.
- BGND_DAC_INDEX = 0, ///< index of background colour in Video DAC
- FGND_DAC_INDEX = 1, ///< index of first foreground colour in Video DAC
+ BGND_DAC_INDEX = 0, ///< index of background color in Video DAC
+ FGND_DAC_INDEX = 1, ///< index of first foreground color in Video DAC
TBLUE1 = 228, ///< Blue used in translucent rectangles
TBLUE2 = 229, ///< Blue used in translucent rectangles
TBLUE3 = 230, ///< Blue used in translucent rectangles
@@ -57,7 +57,7 @@ enum {
TALKFONT_COL = 233
};
-// some common colours
+// some common colors
#define BLACK (TINSEL_RGB(0, 0, 0))
#define WHITE (TINSEL_RGB(MAX_INTENSITY, MAX_INTENSITY, MAX_INTENSITY))
@@ -73,8 +73,8 @@ enum {
/** hardware palette structure */
struct PALETTE {
- int32 numColours; ///< number of colours in the palette
- COLORREF palRGB[MAX_COLOURS]; ///< actual palette colours
+ int32 numColors; ///< number of colors in the palette
+ COLORREF palRGB[MAX_COLORS]; ///< actual palette colors
} PACKED_STRUCT;
#include "common/pack-end.h" // END STRUCT PACKING
@@ -85,10 +85,10 @@ struct PALQ {
SCNHANDLE hPal; ///< handle to palette data struct
int objCount; ///< number of objects using this palette
int posInDAC; ///< palette position in the video DAC
- int numColours; ///< number of colours in the palette
+ int numColors; ///< number of colors in the palette
// Discworld 2 fields
bool bFading; // Whether or not fading
- COLORREF palRGB[MAX_COLOURS]; // actual palette colours
+ COLORREF palRGB[MAX_COLORS]; // actual palette colors
};
#define PALETTE_MOVED 0x8000 // when this bit is set in the "posInDAC"
@@ -114,13 +114,13 @@ void PalettesToVideoDAC(); // Update the video DAC with palettes currently the t
void UpdateDACqueueHandle(
int posInDAC, // position in video DAC
- int numColours, // number of colours in palette
+ int numColors, // number of colors in palette
SCNHANDLE hPalette); // handle to palette
void UpdateDACqueue( // places a palette in the video DAC queue
int posInDAC, // position in video DAC
- int numColours, // number of colours in palette
- COLORREF *pColours); // list of RGB tripples
+ int numColors, // number of colors in palette
+ COLORREF *pColors); // list of RGB tripples
void UpdateDACqueue(int posInDAC, COLORREF color);
@@ -140,10 +140,10 @@ void SwapPalette( // swaps palettes at the specified palette queue position
PALQ *GetNextPalette( // returns the next palette in the queue
PALQ *pStrtPal); // queue position to start from - when NULL will start from beginning of queue
-COLORREF GetBgndColour(); // returns current background colour
+COLORREF GetBgndColor(); // returns current background color
-void SetBgndColour( // sets current background colour
- COLORREF colour); // colour to set the background to
+void SetBgndColor( // sets current background color
+ COLORREF color); // color to set the background to
void FadingPalette(PALQ *pPalQ, bool bFading);
@@ -155,22 +155,22 @@ void NoFadingPalettes(); // All fading processes have just been killed
void DimPartPalette(
SCNHANDLE hPal,
- int startColour,
+ int startColor,
int length,
int brightness); // 0 = black, 10 == 100%
-int TranslucentColour();
+int TranslucentColor();
-#define BoxColour TranslucentColour
+#define BoxColor TranslucentColor
-int HighlightColour();
+int HighlightColor();
-int TalkColour();
+int TalkColor();
-void SetTalkColourRef(COLORREF colRef);
+void SetTalkColorRef(COLORREF colRef);
-COLORREF GetTalkColourRef();
+COLORREF GetTalkColorRef();
void SetTagColorRef(COLORREF colRef);
diff --git a/engines/tinsel/pcode.cpp b/engines/tinsel/pcode.cpp
index ccd86d7ed7..a1cc02a832 100644
--- a/engines/tinsel/pcode.cpp
+++ b/engines/tinsel/pcode.cpp
@@ -36,6 +36,7 @@
#include "tinsel/tinlib.h" // Library routines
#include "tinsel/tinsel.h"
+#include "common/textconsole.h"
#include "common/util.h"
namespace Tinsel {
diff --git a/engines/tinsel/pcode.h b/engines/tinsel/pcode.h
index f3690e9257..f31f2eb5c6 100644
--- a/engines/tinsel/pcode.h
+++ b/engines/tinsel/pcode.h
@@ -31,7 +31,7 @@
#include "tinsel/sched.h" // for PROCESS
namespace Common {
- class Serializer;
+class Serializer;
}
namespace Tinsel {
diff --git a/engines/tinsel/pdisplay.cpp b/engines/tinsel/pdisplay.cpp
index 38748b703b..5022f4757a 100644
--- a/engines/tinsel/pdisplay.cpp
+++ b/engines/tinsel/pdisplay.cpp
@@ -44,6 +44,8 @@
#include "tinsel/text.h"
#include "tinsel/tinsel.h"
+#include "common/textconsole.h"
+
namespace Tinsel {
//----------------- EXTERNAL GLOBAL DATA --------------------
@@ -59,8 +61,8 @@ extern int newestString; // The overrun counter, in STRRES.C
#define LPOSX 295 // X-co-ord of lead actor's position display
#define CPOSX 24 // X-co-ord of cursor's position display
-#define OPOSX SCRN_CENTRE_X // X-co-ord of overrun counter's display
-#define SPOSX SCRN_CENTRE_X // X-co-ord of string numbner's display
+#define OPOSX SCRN_CENTER_X // X-co-ord of overrun counter's display
+#define SPOSX SCRN_CENTER_X // X-co-ord of string numbner's display
#define POSY 0 // Y-co-ord of these position displays
@@ -158,7 +160,7 @@ void CursorPositionProcess(CORO_PARAM, const void *) {
// New text objects
sprintf(PositionString, "%d %d", aniX + Loffset, aniY + Toffset);
_ctx->cpText = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), PositionString,
- 0, CPOSX, POSY, GetTagFontHandle(), TXT_CENTRE);
+ 0, CPOSX, POSY, GetTagFontHandle(), TXT_CENTER);
if (DispPath) {
HPOLYGON hp = InPolygon(aniX + Loffset, aniY + Toffset, PATH);
if (hp == NOPOLY)
@@ -190,7 +192,7 @@ void CursorPositionProcess(CORO_PARAM, const void *) {
sprintf(PositionString, "%d", Overrun);
_ctx->opText = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), PositionString,
- 0, OPOSX, POSY, GetTagFontHandle(), TXT_CENTRE);
+ 0, OPOSX, POSY, GetTagFontHandle(), TXT_CENTER);
// update previous value
_ctx->prevOver = Overrun;
@@ -216,7 +218,7 @@ void CursorPositionProcess(CORO_PARAM, const void *) {
// create new text object list
sprintf(PositionString, "%d %d", aniX, aniY);
_ctx->rpText = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), PositionString,
- 0, LPOSX, POSY, GetTagFontHandle(), TXT_CENTRE);
+ 0, LPOSX, POSY, GetTagFontHandle(), TXT_CENTER);
// update previous position
_ctx->prevlX = aniX;
@@ -235,7 +237,7 @@ void CursorPositionProcess(CORO_PARAM, const void *) {
sprintf(PositionString, "String: %d", newestString);
_ctx->spText = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), PositionString,
- 0, SPOSX, POSY+10, GetTalkFontHandle(), TXT_CENTRE);
+ 0, SPOSX, POSY+10, GetTalkFontHandle(), TXT_CENTER);
// update previous value
_ctx->prevString = newestString;
@@ -411,7 +413,7 @@ static bool ActorTag(int curX, int curY, HotSpotTag *pTag, OBJECT **ppText) {
// May have buggered cursor
EndCursorFollowed();
*ppText = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), tagBuffer,
- 0, tagX, tagY, GetTagFontHandle(), TXT_CENTRE, 0);
+ 0, tagX, tagY, GetTagFontHandle(), TXT_CENTER, 0);
assert(*ppText);
MultiSetZPosition(*ppText, Z_TAG_TEXT);
} else
@@ -456,7 +458,7 @@ static bool ActorTag(int curX, int curY, HotSpotTag *pTag, OBJECT **ppText) {
PlayfieldGetPos(FIELD_WORLD, &tagX, &tagY);
LoadStringRes(GetActorTag(ano), TextBufferAddr(), TBUFSZ);
*ppText = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), TextBufferAddr(),
- 0, xtext - tagX, ytext - tagY, GetTagFontHandle(), TXT_CENTRE);
+ 0, xtext - tagX, ytext - tagY, GetTagFontHandle(), TXT_CENTER);
assert(*ppText); // Actor tag string produced NULL text
MultiSetZPosition(*ppText, Z_TAG_TEXT);
} else {
@@ -561,7 +563,7 @@ static bool PolyTag(HotSpotTag *pTag, OBJECT **ppText) {
*ppText = ObjectTextOut(GetPlayfieldList(FIELD_STATUS),
TextBufferAddr(), 0, tagx - Loffset, tagy - Toffset,
- GetTagFontHandle(), TXT_CENTRE, 0);
+ GetTagFontHandle(), TXT_CENTER, 0);
} else if (TinselV2) {
// Bugger cursor
const char *tagPtr = TextBufferAddr();
@@ -570,12 +572,12 @@ static bool PolyTag(HotSpotTag *pTag, OBJECT **ppText) {
GetCursorXYNoWait(&curX, &curY, false);
*ppText = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), TextBufferAddr(),
- 0, curX, curY, GetTagFontHandle(), TXT_CENTRE, 0);
+ 0, curX, curY, GetTagFontHandle(), TXT_CENTER, 0);
} else {
// Handle displaying the tag text on-screen
*ppText = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), TextBufferAddr(),
0, tagx - Loffset, tagy - Toffset,
- GetTagFontHandle(), TXT_CENTRE);
+ GetTagFontHandle(), TXT_CENTER);
assert(*ppText); // Polygon tag string produced NULL text
}
diff --git a/engines/tinsel/pid.h b/engines/tinsel/pid.h
index 786ccc6327..d6f87bdf98 100644
--- a/engines/tinsel/pid.h
+++ b/engines/tinsel/pid.h
@@ -32,11 +32,11 @@ namespace Tinsel {
#define PID_DESTROY 0x8000 // process id of any process that is to be destroyed between scenes
#define PID_EFFECTS (0x0010 | PID_DESTROY) // generic special effects process id
-#define PID_FLASH (PID_EFFECTS + 1) // flash colour process
-#define PID_CYCLE (PID_EFFECTS + 2) // cycle colour range process
+#define PID_FLASH (PID_EFFECTS + 1) // flash color process
+#define PID_CYCLE (PID_EFFECTS + 2) // cycle color range process
#define PID_MORPH (PID_EFFECTS + 3) // morph process
#define PID_FADER (PID_EFFECTS + 4) // fader process
-#define PID_FADE_BGND (PID_EFFECTS + 5) // fade background colour process
+#define PID_FADE_BGND (PID_EFFECTS + 5) // fade background color process
#define PID_BACKGND (0x0020 | PID_DESTROY) // background update process id
diff --git a/engines/tinsel/polygons.cpp b/engines/tinsel/polygons.cpp
index 1620881b01..f49dddeef4 100644
--- a/engines/tinsel/polygons.cpp
+++ b/engines/tinsel/polygons.cpp
@@ -34,6 +34,7 @@
#include "tinsel/tinsel.h"
#include "tinsel/token.h"
+#include "common/textconsole.h"
#include "common/util.h"
namespace Tinsel {
@@ -98,10 +99,10 @@ struct POLYGON {
/*
* Internal derived data for speed and conveniance
- * set up by PseudoCentre()
+ * set up by PseudoCenter()
*/
- int pcentrex; // Pseudo-centre
- int pcentrey; //
+ int pcenterx; // Pseudo-center
+ int pcentery; //
/**
* List of adjacent polygons. For Path polygons only.
@@ -1624,34 +1625,34 @@ static PPOLYGON CommonInits(PTYPE polyType, int pno, const Poly &ptp, bool bRest
}
/**
- * Calculate a point approximating to the centre of a polygon.
+ * Calculate a point approximating to the center of a polygon.
* Not very sophisticated.
*/
-static void PseudoCentre(POLYGON *p) {
- p->pcentrex = (p->cx[0] + p->cx[1] + p->cx[2] + p->cx[3])/4;
- p->pcentrey = (p->cy[0] + p->cy[1] + p->cy[2] + p->cy[3])/4;
+static void PseudoCenter(POLYGON *p) {
+ p->pcenterx = (p->cx[0] + p->cx[1] + p->cx[2] + p->cx[3])/4;
+ p->pcentery = (p->cy[0] + p->cy[1] + p->cy[2] + p->cy[3])/4;
- if (!IsInPolygon(p->pcentrex, p->pcentrey, PolygonIndex(p))) {
+ if (!IsInPolygon(p->pcenterx, p->pcentery, PolygonIndex(p))) {
int i, top = 0, bot = 0;
for (i = p->ptop; i <= p->pbottom; i++) {
- if (IsInPolygon(p->pcentrex, i, PolygonIndex(p))) {
+ if (IsInPolygon(p->pcenterx, i, PolygonIndex(p))) {
top = i;
break;
}
}
for (i = p->pbottom; i >= p->ptop; i--) {
- if (IsInPolygon(p->pcentrex, i, PolygonIndex(p))) {
+ if (IsInPolygon(p->pcenterx, i, PolygonIndex(p))) {
bot = i;
break;
}
}
- p->pcentrex = (top+bot)/2;
+ p->pcenterx = (top+bot)/2;
}
#ifdef DEBUG
- // assert(IsInPolygon(p->pcentrex, p->pcentrey, PolygonIndex(p))); // Pseudo-centre is not in path
- if (!IsInPolygon(p->pcentrex, p->pcentrey, PolygonIndex(p))) {
- sprintf(TextBufferAddr(), "Pseudo-centre is not in path (starting (%d, %d)) - polygon reversed?",
+ // assert(IsInPolygon(p->pcenterx, p->pcentery, PolygonIndex(p))); // Pseudo-center is not in path
+ if (!IsInPolygon(p->pcenterx, p->pcentery, PolygonIndex(p))) {
+ sprintf(TextBufferAddr(), "Pseudo-center is not in path (starting (%d, %d)) - polygon reversed?",
p->cx[0], p->cy[0]);
error(TextBufferAddr());
}
@@ -1673,7 +1674,7 @@ static void InitPath(const Poly &ptp, bool NodePath, int pno, bool bRestart) {
p->subtype = NodePath ? NODE : NORMAL;
- PseudoCentre(p);
+ PseudoCenter(p);
}
@@ -1918,16 +1919,16 @@ int PolySubtype(HPOLYGON hp) {
return Polys[hp]->subtype;
}
-int PolyCentreX(HPOLYGON hp) {
+int PolyCenterX(HPOLYGON hp) {
CHECK_HP(hp, "Out of range polygon handle (27)");
- return Polys[hp]->pcentrex;
+ return Polys[hp]->pcenterx;
}
-int PolyCentreY(HPOLYGON hp) {
+int PolyCenterY(HPOLYGON hp) {
CHECK_HP(hp, "Out of range polygon handle (28)");
- return Polys[hp]->pcentrey;
+ return Polys[hp]->pcentery;
}
int PolyCornerX(HPOLYGON hp, int n) {
diff --git a/engines/tinsel/polygons.h b/engines/tinsel/polygons.h
index 4be1dabf98..cf8f9e98c2 100644
--- a/engines/tinsel/polygons.h
+++ b/engines/tinsel/polygons.h
@@ -127,8 +127,8 @@ void RestorePolygonStuff(POLY_VOLATILE *sps);
PTYPE PolyType(HPOLYGON hp); // ->type
int PolySubtype(HPOLYGON hp); // ->subtype
-int PolyCentreX(HPOLYGON hp); // ->pcentrex
-int PolyCentreY(HPOLYGON hp); // ->pcentrey
+int PolyCenterX(HPOLYGON hp); // ->pcenterx
+int PolyCenterY(HPOLYGON hp); // ->pcentery
int PolyCornerX(HPOLYGON hp, int n); // ->cx[n]
int PolyCornerY(HPOLYGON hp, int n); // ->cy[n]
PSTATE PolyPointState(HPOLYGON hp); // ->pointState
diff --git a/engines/tinsel/rince.cpp b/engines/tinsel/rince.cpp
index 6ea1dd7464..38ac0a2ce6 100644
--- a/engines/tinsel/rince.cpp
+++ b/engines/tinsel/rince.cpp
@@ -47,6 +47,7 @@
#include "tinsel/tinsel.h"
#include "tinsel/token.h"
+#include "common/textconsole.h"
#include "common/util.h"
namespace Tinsel {
@@ -60,8 +61,8 @@ static MOVER Movers[MAX_MOVERS]; // FIXME: Avoid non-const global vars
/**
* Called from ActorPalette(), normally once just after the beginning of time.
*/
-void StoreMoverPalette(PMOVER pMover, int startColour, int length) {
- pMover->startColour = startColour;
+void StoreMoverPalette(PMOVER pMover, int startColor, int length) {
+ pMover->startColor = startColor;
pMover->paletteLength = length;
}
@@ -88,7 +89,7 @@ static void CheckBrightness(PMOVER pMover) {
pMover->brightness--; // ramp down
DimPartPalette(BgPal(),
- pMover->startColour,
+ pMover->startColor,
pMover->paletteLength,
pMover->brightness);
}
@@ -107,7 +108,7 @@ void MoverBrightness(PMOVER pMover, int brightness) {
assert(BgPal());
// Do it all immediately
- DimPartPalette(BgPal(), pMover->startColour, pMover->paletteLength, brightness);
+ DimPartPalette(BgPal(), pMover->startColor, pMover->paletteLength, brightness);
// The actor is probably hidden at this point,
pMover->brightness = brightness;
@@ -924,7 +925,7 @@ void SaveMovers(SAVED_MOVER *sMoverInfo) {
if (TinselV2) {
sMoverInfo[i].bHidden = Movers[i].bHidden;
sMoverInfo[i].brightness = Movers[i].brightness;
- sMoverInfo[i].startColour = Movers[i].startColour;
+ sMoverInfo[i].startColor = Movers[i].startColor;
sMoverInfo[i].paletteLength = Movers[i].paletteLength;
}
diff --git a/engines/tinsel/rince.h b/engines/tinsel/rince.h
index 57eac00fa4..5d09a1e945 100644
--- a/engines/tinsel/rince.h
+++ b/engines/tinsel/rince.h
@@ -38,7 +38,7 @@ struct PROCESS;
enum NPS {NOT_IN, GOING_UP, GOING_DOWN, LEAVING, ENTERING};
-enum IND {NO_PROB, TRY_CENTRE, TRY_CORNER, TRY_NEXTCORNER};
+enum IND {NO_PROB, TRY_CENTER, TRY_CORNER, TRY_NEXTCORNER};
enum DIRECTION { LEFTREEL, RIGHTREEL, FORWARD, AWAY };
@@ -119,7 +119,7 @@ struct MOVER {
int32 zOverride;
bool bHidden;
int brightness; // Current brightness
- int startColour;
+ int startColor;
int paletteLength;
HPOLYGON hRpath; // Recent path
};
@@ -140,7 +140,7 @@ void MoverProcessCreate(int X, int Y, int id, PMOVER pMover);
enum AR_FUNCTION { AR_NORMAL, AR_PUSHREEL, AR_POPREEL, AR_WALKREEL };
-void StoreMoverPalette(PMOVER pMover, int startColour, int length);
+void StoreMoverPalette(PMOVER pMover, int startColor, int length);
void MoverBrightness(PMOVER pMover, int brightness);
@@ -204,7 +204,7 @@ struct SAVED_MOVER {
bool bActive;
bool bHidden;
int brightness;
- int startColour;
+ int startColor;
int paletteLength;
};
diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp
index 3182593a88..50f6d8d00b 100644
--- a/engines/tinsel/saveload.cpp
+++ b/engines/tinsel/saveload.cpp
@@ -36,6 +36,7 @@
#include "common/serializer.h"
#include "common/savefile.h"
+#include "common/textconsole.h"
#include "gui/message.h"
@@ -164,8 +165,7 @@ static bool syncSaveGameHeader(Common::Serializer &s, SaveGameHeader &hdr) {
}
static void syncSavedMover(Common::Serializer &s, SAVED_MOVER &sm) {
- SCNHANDLE *pList[3] = { (SCNHANDLE *)&sm.walkReels,
- (SCNHANDLE *)&sm.standReels, (SCNHANDLE *)&sm.talkReels };
+ int i, j;
s.syncAsUint32LE(sm.bActive);
s.syncAsSint32LE(sm.actorID);
@@ -173,17 +173,27 @@ static void syncSavedMover(Common::Serializer &s, SAVED_MOVER &sm) {
s.syncAsSint32LE(sm.objY);
s.syncAsUint32LE(sm.hLastfilm);
- for (int pIndex = 0; pIndex < 3; ++pIndex) {
- SCNHANDLE *p = pList[pIndex];
- for (int i = 0; i < TOTAL_SCALES * 4; ++i)
- s.syncAsUint32LE(*p++);
- }
+ // Sync walk reels
+ for (i = 0; i < TOTAL_SCALES; ++i)
+ for (j = 0; j < 4; ++j)
+ s.syncAsUint32LE(sm.walkReels[i][j]);
+
+ // Sync stand reels
+ for (i = 0; i < TOTAL_SCALES; ++i)
+ for (j = 0; j < 4; ++j)
+ s.syncAsUint32LE(sm.standReels[i][j]);
+
+ // Sync talk reels
+ for (i = 0; i < TOTAL_SCALES; ++i)
+ for (j = 0; j < 4; ++j)
+ s.syncAsUint32LE(sm.talkReels[i][j]);
+
if (TinselV2) {
s.syncAsByte(sm.bHidden);
s.syncAsSint32LE(sm.brightness);
- s.syncAsSint32LE(sm.startColour);
+ s.syncAsSint32LE(sm.startColor);
s.syncAsSint32LE(sm.paletteLength);
}
}
diff --git a/engines/tinsel/savescn.cpp b/engines/tinsel/savescn.cpp
index a3fe393b79..aa359d281f 100644
--- a/engines/tinsel/savescn.cpp
+++ b/engines/tinsel/savescn.cpp
@@ -48,6 +48,8 @@
#include "tinsel/tinlib.h"
#include "tinsel/token.h"
+#include "common/textconsole.h"
+
namespace Tinsel {
//----------------- EXTERN FUNCTIONS --------------------
@@ -226,7 +228,7 @@ static void SortMAProcess(CORO_PARAM, const void *) {
}
ActorPalette(rsd->SavedMoverInfo[_ctx->i].actorID,
- rsd->SavedMoverInfo[_ctx->i].startColour, rsd->SavedMoverInfo[_ctx->i].paletteLength);
+ rsd->SavedMoverInfo[_ctx->i].startColor, rsd->SavedMoverInfo[_ctx->i].paletteLength);
if (rsd->SavedMoverInfo[_ctx->i].brightness != BOGUS_BRIGHTNESS)
ActorBrightness(rsd->SavedMoverInfo[_ctx->i].actorID, rsd->SavedMoverInfo[_ctx->i].brightness);
diff --git a/engines/tinsel/scene.cpp b/engines/tinsel/scene.cpp
index 67e0ea9ffd..b82bac32cc 100644
--- a/engines/tinsel/scene.cpp
+++ b/engines/tinsel/scene.cpp
@@ -51,6 +51,7 @@
#include "tinsel/sysvar.h"
#include "tinsel/token.h"
+#include "common/textconsole.h"
namespace Tinsel {
@@ -381,7 +382,7 @@ void PrimeBackground() {
// structure for background
static const BACKGND backgnd = {
- BLACK, // sky colour
+ BLACK, // sky color
Common::Point(0, 0), // initial world pos
Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), // scroll limits
0, // no background update process
diff --git a/engines/tinsel/sched.cpp b/engines/tinsel/sched.cpp
index 427e28826f..37c04abd22 100644
--- a/engines/tinsel/sched.cpp
+++ b/engines/tinsel/sched.cpp
@@ -30,6 +30,7 @@
#include "tinsel/polygons.h"
#include "tinsel/sched.h"
+#include "common/textconsole.h"
#include "common/util.h"
namespace Tinsel {
diff --git a/engines/tinsel/scn.cpp b/engines/tinsel/scn.cpp
index 17ae7c8687..20d75b6b93 100644
--- a/engines/tinsel/scn.cpp
+++ b/engines/tinsel/scn.cpp
@@ -24,9 +24,6 @@
* A (some would say very) small collection of utility functions.
*/
-#include "common/endian.h"
-#include "common/util.h"
-
#include "tinsel/dw.h"
#include "tinsel/film.h"
#include "tinsel/handle.h"
diff --git a/engines/tinsel/sound.cpp b/engines/tinsel/sound.cpp
index 1fcdb4dcf9..ec42ca5da4 100644
--- a/engines/tinsel/sound.cpp
+++ b/engines/tinsel/sound.cpp
@@ -35,9 +35,7 @@
#include "tinsel/sysvar.h"
#include "tinsel/background.h"
-#include "common/config-manager.h"
#include "common/endian.h"
-#include "common/file.h"
#include "common/memstream.h"
#include "common/system.h"
@@ -131,13 +129,9 @@ bool SoundManager::playSample(int id, Audio::Mixer::SoundType type, Audio::Sound
error(FILE_IS_CORRUPT, _vm->getSampleFile(sampleLanguage));
// FIXME: Should set this in a different place ;)
- bool mute = false;
- if (ConfMan.hasKey("mute"))
- mute = ConfMan.getBool("mute");
-
- _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, mute ? 0 : _vm->_config->_soundVolume);
+ _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, _vm->_config->_soundVolume);
//_vm->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, soundVolumeMusic);
- _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, mute ? 0 : _vm->_config->_voiceVolume);
+ _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, _vm->_config->_voiceVolume);
Audio::AudioStream *sampleStream = 0;
@@ -325,13 +319,9 @@ bool SoundManager::playSample(int id, int sub, bool bLooped, int x, int y, int p
}
// FIXME: Should set this in a different place ;)
- bool mute = false;
- if (ConfMan.hasKey("mute"))
- mute = ConfMan.getBool("mute");
-
- _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, mute ? 0 : _vm->_config->_soundVolume);
+ _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, _vm->_config->_soundVolume);
//_vm->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, soundVolumeMusic);
- _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, mute ? 0 : _vm->_config->_voiceVolume);
+ _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, _vm->_config->_voiceVolume);
curChan->sampleNum = id;
curChan->subSample = sub;
@@ -364,8 +354,8 @@ bool SoundManager::offscreenChecks(int x, int &y) {
if (x == -1)
return true;
- // convert x to offset from screen centre
- x -= PlayfieldGetCentreX(FIELD_WORLD);
+ // convert x to offset from screen center
+ x -= PlayfieldGetCenterX(FIELD_WORLD);
if (x < -SCREEN_WIDTH || x > SCREEN_WIDTH) {
// A long way offscreen, ignore it
@@ -385,7 +375,7 @@ int8 SoundManager::getPan(int x) {
if (x == -1)
return 0;
- x -= PlayfieldGetCentreX(FIELD_WORLD);
+ x -= PlayfieldGetCenterX(FIELD_WORLD);
if (x == 0)
return 0;
diff --git a/engines/tinsel/strres.cpp b/engines/tinsel/strres.cpp
index aa303a5391..2dc0e833d1 100644
--- a/engines/tinsel/strres.cpp
+++ b/engines/tinsel/strres.cpp
@@ -31,6 +31,7 @@
#include "tinsel/scn.h"
#include "common/file.h"
#include "common/endian.h"
+#include "common/textconsole.h"
#include "gui/message.h"
diff --git a/engines/tinsel/sysvar.cpp b/engines/tinsel/sysvar.cpp
index 7003d34feb..ad795fd219 100644
--- a/engines/tinsel/sysvar.cpp
+++ b/engines/tinsel/sysvar.cpp
@@ -31,6 +31,8 @@
#include "tinsel/sysvar.h"
#include "tinsel/tinsel.h"
+#include "common/textconsole.h"
+
namespace Tinsel {
// Return for SYS_Platform
@@ -77,7 +79,7 @@ static int systemVars[SV_TOPVALID] = {
2, // Speech Delay
2, // Music dim factor
- 0, // if set, default actor's text colour gets poked in here
+ 0, // if set, default actor's text color gets poked in here
0, // user 1
0, // user 2
@@ -103,7 +105,7 @@ static int systemVars[SV_TOPVALID] = {
0, // ISV_GHOST_ACTOR
0, // ISV_GHOST_BASE
- 0 // ISV_GHOST_COLOUR
+ 0 // ISV_GHOST_COLOR
};
static SCNHANDLE systemStrings[SS_MAX_VALID]; // FIXME: Avoid non-const global vars
diff --git a/engines/tinsel/sysvar.h b/engines/tinsel/sysvar.h
index e407e6ffa3..4cdb1364b4 100644
--- a/engines/tinsel/sysvar.h
+++ b/engines/tinsel/sysvar.h
@@ -60,7 +60,7 @@ typedef enum { SV_DEFAULT_INV,
SV_SPEECHDELAY, // Delay 'twixt text/animation and sample
SV_MUSICDIMFACTOR, // dimVolume = volume - volume/SV_MDF
- SV_TAGCOLOUR, // if set, default actor's text colour gets poked in here
+ SV_TAGCOLOR, // if set, default actor's text color gets poked in here
SV_USER1,
SV_USER2,
@@ -85,7 +85,7 @@ typedef enum { SV_DEFAULT_INV,
ISV_NO_BLOCKING,
ISV_GHOST_ACTOR,
ISV_GHOST_BASE,
- ISV_GHOST_COLOUR,
+ ISV_GHOST_COLOR,
SV_TOPVALID } SYSVARS;
diff --git a/engines/tinsel/text.cpp b/engines/tinsel/text.cpp
index d2939281eb..3652d6ed3e 100644
--- a/engines/tinsel/text.cpp
+++ b/engines/tinsel/text.cpp
@@ -78,8 +78,8 @@ int StringLengthPix(char *szStr, const FONT *pFont) {
* @param mode Mode flags for the string
*/
int JustifyText(char *szStr, int xPos, const FONT *pFont, int mode) {
- if (mode & TXT_CENTRE) {
- // centre justify the text
+ if (mode & TXT_CENTER) {
+ // center justify the text
// adjust x positioning by half the length of line in pixels
xPos -= StringLengthPix(szStr, pFont) / 2;
@@ -100,14 +100,14 @@ int JustifyText(char *szStr, int xPos, const FONT *pFont, int mode) {
* of the list is returned.
* @param pList Object list to add text to
* @param szStr String to output
- * @param colour Colour for monochrome text
+ * @param color Color for monochrome text
* @param xPos X position of string
* @param yPos Y position of string
* @param hFont Which font to use
* @param mode Mode flags for the string
* @param sleepTime Sleep time between each character (if non-zero)
*/
-OBJECT *ObjectTextOut(OBJECT *pList, char *szStr, int colour,
+OBJECT *ObjectTextOut(OBJECT *pList, char *szStr, int color,
int xPos, int yPos, SCNHANDLE hFont, int mode, int sleepTime) {
int xJustify; // x position of text after justification
int yOffset; // offset to next line of text
@@ -183,8 +183,8 @@ OBJECT *ObjectTextOut(OBJECT *pList, char *szStr, int colour,
if (mode & TXT_ABSOLUTE)
pChar->flags |= DMA_ABS;
- // set characters colour - only effective for mono fonts
- pChar->constant = colour;
+ // set characters color - only effective for mono fonts
+ pChar->constant = color;
// get Y animation offset
GetAniOffset(hImg, pChar->flags, &aniX, &aniY);
diff --git a/engines/tinsel/text.h b/engines/tinsel/text.h
index a849e286ec..ea804f58d7 100644
--- a/engines/tinsel/text.h
+++ b/engines/tinsel/text.h
@@ -34,7 +34,7 @@ namespace Tinsel {
/** text mode flags - defaults to left justify */
enum {
- TXT_CENTRE = 0x0001, ///< centre justify text
+ TXT_CENTER = 0x0001, ///< center justify text
TXT_RIGHT = 0x0002, ///< right justify text
TXT_SHADOW = 0x0004, ///< shadow each character
TXT_ABSOLUTE = 0x0008 ///< position of text is absolute (only for object text)
@@ -72,7 +72,7 @@ struct FONT {
struct TEXTOUT {
OBJECT *pList; ///< object list to add text to
char *szStr; ///< string to output
- int colour; ///< colour for monochrome text
+ int color; ///< color for monochrome text
int xPos; ///< x position of string
int yPos; ///< y position of string
SCNHANDLE hFont; ///< which font to use
@@ -91,14 +91,14 @@ struct TEXTOUT {
* of the list is returned.
* @param pList object list to add text to
* @param szStr string to output
- * @param colour colour for monochrome text
+ * @param color color for monochrome text
* @param xPos x position of string
* @param yPos y position of string
* @param hFont which font to use
* @param mode mode flags for the string
* @param sleepTime Sleep time between each character (if non-zero)
*/
-OBJECT *ObjectTextOut(OBJECT *pList, char *szStr, int colour,
+OBJECT *ObjectTextOut(OBJECT *pList, char *szStr, int color,
int xPos, int yPos, SCNHANDLE hFont, int mode, int sleepTime = 0);
OBJECT *ObjectTextOutIndirect( // output a string of text
diff --git a/engines/tinsel/timers.cpp b/engines/tinsel/timers.cpp
index 5f15cd9d3b..c1a4cd0ff5 100644
--- a/engines/tinsel/timers.cpp
+++ b/engines/tinsel/timers.cpp
@@ -31,7 +31,7 @@
#include "tinsel/timers.h"
#include "tinsel/dw.h"
#include "common/serializer.h"
-
+#include "common/textconsole.h"
#include "common/system.h"
namespace Tinsel {
diff --git a/engines/tinsel/timers.h b/engines/tinsel/timers.h
index 022604b662..1456d9a1d5 100644
--- a/engines/tinsel/timers.h
+++ b/engines/tinsel/timers.h
@@ -31,7 +31,7 @@
#include "tinsel/dw.h"
namespace Common {
- class Serializer;
+class Serializer;
}
namespace Tinsel {
diff --git a/engines/tinsel/tinlib.cpp b/engines/tinsel/tinlib.cpp
index 40418dcc43..afd409ce27 100644
--- a/engines/tinsel/tinlib.cpp
+++ b/engines/tinsel/tinlib.cpp
@@ -70,6 +70,7 @@
#include "tinsel/tinsel.h"
#include "tinsel/token.h"
+#include "common/textconsole.h"
namespace Tinsel {
@@ -84,7 +85,7 @@ extern bool bNoPause;
// In DOS_MAIN.C
// TODO/FIXME: From dos_main.c: "Only used on PSX so far"
-int clRunMode = 0;
+//int clRunMode = 0;
//----------------- EXTERNAL FUNCTIONS ---------------------
@@ -426,11 +427,11 @@ static void ScrollMonitorProcess(CORO_PARAM, const void *param) {
/**
* NOT A LIBRARY FUNCTION
*
- * Poke supplied colour into the DAC queue.
+ * Poke supplied color into the DAC queue.
*/
void SetTextPal(COLORREF col) {
- SetTalkColourRef(col);
- UpdateDACqueue(TalkColour(), col);
+ SetTalkColorRef(col);
+ UpdateDACqueue(TalkColor(), col);
}
/**
@@ -522,7 +523,7 @@ void TinGetVersion(WHICH_VER which, char *buffer, int length) {
/**
* Set actor's attributes.
- * - currently only the text colour.
+ * - currently only the text color.
*/
static void ActorAttr(int actor, int r1, int g1, int b1) {
storeActorAttr(actor, r1, g1, b1);
@@ -553,11 +554,11 @@ static int ActorDirection(int actor) {
/**
* Set actor's palette details for path brightnesses
*/
-void ActorPalette(int actor, int startColour, int length) {
+void ActorPalette(int actor, int startColor, int length) {
PMOVER pMover = GetMover(actor);
assert(pMover);
- StoreMoverPalette(pMover, startColour, length);
+ StoreMoverPalette(pMover, startColor, length);
}
/**
@@ -568,10 +569,10 @@ static void ActorPriority(int actor, int zFactor) {
}
/**
- * Set actor's text colour.
+ * Set actor's text color.
*/
-static void ActorRGB(int actor, COLORREF colour) {
- SetActorRGB(actor, colour);
+static void ActorRGB(int actor, COLORREF color) {
+ SetActorRGB(actor, color);
}
/**
@@ -1196,9 +1197,9 @@ static int GetInvLimit(int invno) {
/**
* Ghost
*/
-static void Ghost(int actor, int tColour, int tPalOffset) {
+static void Ghost(int actor, int tColor, int tPalOffset) {
SetSysVar(ISV_GHOST_ACTOR, actor);
- SetSysVar(ISV_GHOST_COLOUR, tColour);
+ SetSysVar(ISV_GHOST_COLOR, tColor);
SetSysVar(ISV_GHOST_BASE, tPalOffset);
CreateGhostPalette(BgPal());
}
@@ -1952,7 +1953,7 @@ static void Print(CORO_PARAM, int x, int y, SCNHANDLE text, int time, bool bSust
PlayfieldGetPos(FIELD_WORLD, &Loffset, &Toffset);
_ctx->pText = ObjectTextOut(GetPlayfieldList(FIELD_STATUS),
TextBufferAddr(), 0, x - Loffset, y - Toffset, GetTagFontHandle(),
- TXT_CENTRE, 0);
+ TXT_CENTER, 0);
assert(_ctx->pText);
// Adjust x, y, or z if necessary
@@ -1965,7 +1966,7 @@ static void Print(CORO_PARAM, int x, int y, SCNHANDLE text, int time, bool bSust
PlayfieldGetPos(FIELD_WORLD, &Loffset, &Toffset);
_ctx->pText = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), TextBufferAddr(),
0, x - Loffset, y - Toffset,
- TinselV2 ? GetTagFontHandle() : GetTalkFontHandle(), TXT_CENTRE);
+ TinselV2 ? GetTagFontHandle() : GetTalkFontHandle(), TXT_CENTER);
assert(_ctx->pText); // string produced NULL text
if (IsTopWindow())
MultiSetZPosition(_ctx->pText, Z_TOPW_TEXT);
@@ -2128,7 +2129,7 @@ static void PrintObj(CORO_PARAM, const SCNHANDLE hText, const INV_OBJECT *pinvo,
LoadStringRes(hText, TextBufferAddr(), TBUFSZ);
_ctx->pText = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), TextBufferAddr(),
- 0, _ctx->textx, _ctx->texty, GetTagFontHandle(), TXT_CENTRE);
+ 0, _ctx->textx, _ctx->texty, GetTagFontHandle(), TXT_CENTER);
assert(_ctx->pText); // PrintObj() string produced NULL text
MultiSetZPosition(_ctx->pText, Z_INV_ITEXT);
@@ -2181,7 +2182,7 @@ static void PrintObj(CORO_PARAM, const SCNHANDLE hText, const INV_OBJECT *pinvo,
LoadStringRes(hText, TextBufferAddr(), TBUFSZ);
_ctx->pText = ObjectTextOut(GetPlayfieldList(FIELD_STATUS),
TextBufferAddr(), 0, _ctx->textx, _ctx->texty, GetTagFontHandle(),
- TXT_CENTRE, 0);
+ TXT_CENTER, 0);
assert(_ctx->pText);
KeepOnScreen(_ctx->pText, &_ctx->textx, &_ctx->texty);
@@ -2297,7 +2298,7 @@ static void PrintObjPointed(CORO_PARAM, const SCNHANDLE text, const INV_OBJECT *
// Re-display in the same place
LoadStringRes(text, TextBufferAddr(), TBUFSZ);
pText = ObjectTextOut(GetPlayfieldList(FIELD_STATUS), TextBufferAddr(),
- 0, textx, texty, GetTagFontHandle(), TXT_CENTRE);
+ 0, textx, texty, GetTagFontHandle(), TXT_CENTER);
assert(pText); // PrintObj() string produced NULL text
MultiSetZPosition(pText, Z_INV_ITEXT);
}
@@ -2490,7 +2491,7 @@ void ResumeLastGame() {
* Returns the current run mode
*/
static int RunMode() {
- return clRunMode;
+ return 0; //clRunMode;
}
/**
@@ -3367,7 +3368,7 @@ static void TalkOrSay(CORO_PARAM, SPEECH_TYPE speechType, SCNHANDLE hText, int x
_ctx->pText = ObjectTextOut(GetPlayfieldList(FIELD_STATUS),
TextBufferAddr(), 0, _ctx->x - _ctx->Loffset, _ctx->y - _ctx->Toffset,
- GetTalkFontHandle(), TXT_CENTRE);
+ GetTalkFontHandle(), TXT_CENTER);
assert(_ctx->pText); // talk() string produced NULL text;
if (IsTopWindow())
@@ -3595,12 +3596,12 @@ static void TalkPaletteIndex(unsigned index) {
/**
* Set talk font's palette entry.
*/
-static void TalkRGB(COLORREF colour, int myescEvent) {
+static void TalkRGB(COLORREF color, int myescEvent) {
// Don't do it if it's not wanted
if (myescEvent && myescEvent != GetEscEvents())
return;
- SetTextPal(colour);
+ SetTextPal(color);
}
/**
diff --git a/engines/tinsel/tinlib.h b/engines/tinsel/tinlib.h
index 11e59f380d..7bd2a19d55 100644
--- a/engines/tinsel/tinlib.h
+++ b/engines/tinsel/tinlib.h
@@ -48,7 +48,7 @@ void TinGetVersion(WHICH_VER which, char *buffer, int length);
// Library functions in TINLIB.C
void ActorBrightness(int actor, int brightness);
-void ActorPalette(int actor, int startColour, int length);
+void ActorPalette(int actor, int startColor, int length);
void Control(int param);
void HookScene(SCNHANDLE scene, int entrance, int transition);
void NewScene(CORO_PARAM, SCNHANDLE scene, int entrance, int transition);
diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp
index e1396f9715..20d4f1d31a 100644
--- a/engines/tinsel/tinsel.cpp
+++ b/engines/tinsel/tinsel.cpp
@@ -29,22 +29,14 @@
#include "common/events.h"
#include "common/EventRecorder.h"
#include "common/keyboard.h"
-#include "common/file.h"
#include "common/fs.h"
-#include "common/savefile.h"
#include "common/config-manager.h"
#include "common/serializer.h"
-#include "common/stream.h"
#include "backends/audiocd/audiocd.h"
#include "engines/util.h"
-#include "graphics/cursorman.h"
-
-#include "base/plugins.h"
-#include "base/version.h"
-
#include "tinsel/actors.h"
#include "tinsel/background.h"
#include "tinsel/bmv.h"
@@ -911,10 +903,10 @@ Common::Error TinselEngine::run() {
#else
initGraphics(640, 432, true);
#endif
- _screenSurface.create(640, 432, 1);
+ _screenSurface.create(640, 432, Graphics::PixelFormat::createFormatCLUT8());
} else {
initGraphics(320, 200, false);
- _screenSurface.create(320, 200, 1);
+ _screenSurface.create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
}
g_eventRec.registerRandomSource(_random, "tinsel");
@@ -972,7 +964,7 @@ Common::Error TinselEngine::run() {
// errors when loading the save state.
if (ConfMan.hasKey("save_slot")) {
- if (loadGameState(ConfMan.getInt("save_slot")) == Common::kNoError)
+ if (loadGameState(ConfMan.getInt("save_slot")).getCode() == Common::kNoError)
loadingFromGMM = true;
}
diff --git a/engines/tinsel/tinsel.h b/engines/tinsel/tinsel.h
index 5c7a1cdfb2..35ea43074c 100644
--- a/engines/tinsel/tinsel.h
+++ b/engines/tinsel/tinsel.h
@@ -125,8 +125,8 @@ typedef bool (*KEYFPTR)(const Common::KeyState &);
#define SCREEN_WIDTH (_vm->screen().w) // PC screen dimensions
#define SCREEN_HEIGHT (_vm->screen().h)
-#define SCRN_CENTRE_X ((SCREEN_WIDTH - 1) / 2) // screen centre x
-#define SCRN_CENTRE_Y ((SCREEN_HEIGHT - 1) / 2) // screen centre y
+#define SCRN_CENTER_X ((SCREEN_WIDTH - 1) / 2) // screen center x
+#define SCRN_CENTER_Y ((SCREEN_HEIGHT - 1) / 2) // screen center y
#define UNUSED_LINES 48
#define EXTRA_UNUSED_LINES 3
//#define SCREEN_BOX_HEIGHT1 (SCREEN_HEIGHT - UNUSED_LINES)
diff --git a/engines/toon/anim.cpp b/engines/toon/anim.cpp
index 6004aacead..856acbd986 100644
--- a/engines/toon/anim.cpp
+++ b/engines/toon/anim.cpp
@@ -23,6 +23,9 @@
*
*/
+#include "common/debug.h"
+#include "common/rect.h"
+
#include "toon/anim.h"
#include "toon/toon.h"
#include "toon/tools.h"
diff --git a/engines/toon/audio.cpp b/engines/toon/audio.cpp
index c2e0bf7b20..026450d3c9 100644
--- a/engines/toon/audio.cpp
+++ b/engines/toon/audio.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/debug.h"
+
#include "toon/audio.h"
#include "common/memstream.h"
#include "common/substream.h"
diff --git a/engines/toon/character.cpp b/engines/toon/character.cpp
index 69051d45fd..29a61ffd78 100644
--- a/engines/toon/character.cpp
+++ b/engines/toon/character.cpp
@@ -23,6 +23,9 @@
*
*/
+#include "common/debug.h"
+#include "common/system.h"
+
#include "toon/character.h"
#include "toon/drew.h"
#include "toon/flux.h"
@@ -166,8 +169,9 @@ bool Character::walkTo(int32 newPosX, int32 newPosY) {
_vm->getPathFinding()->resetBlockingRects();
- if (_id == 1) {
- int32 sizeX = MAX<int32>(5, 40 * _vm->getDrew()->getScale() / 1024);
+ // don't allow flux to go at the same position as drew
+ if (_id == 1 ) {
+ int32 sizeX = MAX<int32>(5, 30 * _vm->getDrew()->getScale() / 1024);
int32 sizeY = MAX<int32>(2, 20 * _vm->getDrew()->getScale() / 1024);
_vm->getPathFinding()->addBlockingEllipse(_vm->getDrew()->getFinalX(), _vm->getDrew()->getFinalY(), sizeX, sizeY);
}
diff --git a/engines/toon/drew.cpp b/engines/toon/drew.cpp
index 4f8152833b..77333c4a9f 100644
--- a/engines/toon/drew.cpp
+++ b/engines/toon/drew.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/debug.h"
+
#include "toon/drew.h"
namespace Toon {
diff --git a/engines/toon/flux.cpp b/engines/toon/flux.cpp
index 034332af56..833fdbf5ce 100644
--- a/engines/toon/flux.cpp
+++ b/engines/toon/flux.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/debug.h"
+
#include "toon/flux.h"
namespace Toon {
diff --git a/engines/toon/font.cpp b/engines/toon/font.cpp
index 8192a6f6f1..9367d79036 100644
--- a/engines/toon/font.cpp
+++ b/engines/toon/font.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/debug.h"
+
#include "toon/font.h"
namespace Toon {
@@ -81,7 +83,7 @@ void FontRenderer::renderText(int32 x, int32 y, Common::String origText, int32 m
x -= xx / 2;
}
- _vm->addDirtyRect(x, y, x + xx, y + yy);
+ _vm->addDirtyRect(x, y, x + xx + 2, y + yy);
int32 curX = x;
int32 curY = y;
@@ -214,7 +216,7 @@ void FontRenderer::renderMultiLineText(int32 x, int32 y, Common::String origText
curChar = textToFont(curChar);
int width = _currentFont->getFrameWidth(curChar);
- curWidth += width - 2;
+ curWidth += MAX<int32>(width - 2, 0);
it++;
curLetterNr++;
}
@@ -275,12 +277,12 @@ void FontRenderer::renderMultiLineText(int32 x, int32 y, Common::String origText
for (int32 i = 0; i < numLines; i++) {
const byte *line = lines[i];
curX = x - lineSize[i] / 2;
- _vm->addDirtyRect(curX + _vm->state()->_currentScrollValue, y, curX + lineSize[i] + _vm->state()->_currentScrollValue, curY + height);
+ _vm->addDirtyRect(curX + _vm->state()->_currentScrollValue, curY, curX + lineSize[i] + _vm->state()->_currentScrollValue + 2, curY + height);
while (*line) {
byte curChar = textToFont(*line);
if (curChar != 32) _currentFont->drawFontFrame(_vm->getMainSurface(), curChar, curX + _vm->state()->_currentScrollValue, curY, _currentFontColor);
- curX = curX + _currentFont->getFrameWidth(curChar) - 2;
+ curX = curX + MAX<int32>(_currentFont->getFrameWidth(curChar) - 2, 0);
//height = MAX(height, _currentFont->getFrameHeight(curChar));
line++;
}
diff --git a/engines/toon/hotspot.cpp b/engines/toon/hotspot.cpp
index 0573e92fef..1c1e23e39e 100644
--- a/engines/toon/hotspot.cpp
+++ b/engines/toon/hotspot.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/debug.h"
+
#include "toon/hotspot.h"
#include "toon/tools.h"
diff --git a/engines/toon/movie.cpp b/engines/toon/movie.cpp
index 4305abb62b..64b80c29b3 100644
--- a/engines/toon/movie.cpp
+++ b/engines/toon/movie.cpp
@@ -23,7 +23,16 @@
*
*/
+#include "common/debug.h"
+#include "common/events.h"
+#include "common/keyboard.h"
+#include "common/stream.h"
+#include "common/system.h"
+#include "graphics/surface.h"
+
+#include "toon/audio.h"
#include "toon/movie.h"
+#include "toon/toon.h"
namespace Toon {
@@ -50,7 +59,7 @@ bool ToonstruckSmackerDecoder::loadFile(const Common::String &filename) {
delete _surface;
}
_surface = new Graphics::Surface();
- _surface->create(640, 400, 1);
+ _surface->create(640, 400, Graphics::PixelFormat::createFormatCLUT8());
_header.flags = 4;
}
diff --git a/engines/toon/path.cpp b/engines/toon/path.cpp
index e0cdf87502..26355863f6 100644
--- a/engines/toon/path.cpp
+++ b/engines/toon/path.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/debug.h"
+
#include "toon/path.h"
namespace Toon {
@@ -407,7 +409,11 @@ void PathFinding::init(Picture *mask) {
_height = mask->getHeight();
_currentMask = mask;
_heap->unload();
- _heap->init(_width * _height);
+ // In order to reduce memory fragmentation on small devices, we use the maximum
+ // possible size here which is TOON_BACKBUFFER_WIDTH. Even though this is
+ // 1280 as opposed to the possible 640, it actually helps memory allocation on
+ // those devices.
+ _heap->init(TOON_BACKBUFFER_WIDTH * _height); // should really be _width
delete[] _gridTemp;
_gridTemp = new int32[_width*_height];
}
diff --git a/engines/toon/picture.cpp b/engines/toon/picture.cpp
index 1945f0fe45..ce28f9c68b 100644
--- a/engines/toon/picture.cpp
+++ b/engines/toon/picture.cpp
@@ -25,6 +25,9 @@
#include "toon/picture.h"
#include "toon/tools.h"
+
+#include "common/debug.h"
+#include "common/rect.h"
#include "common/stack.h"
namespace Toon {
diff --git a/engines/toon/resource.cpp b/engines/toon/resource.cpp
index b29aa3b72d..f9f65b423b 100644
--- a/engines/toon/resource.cpp
+++ b/engines/toon/resource.cpp
@@ -24,6 +24,7 @@
*/
#include "toon/resource.h"
+#include "common/debug.h"
#include "common/file.h"
#include "common/memstream.h"
#include "common/substream.h"
diff --git a/engines/toon/script.cpp b/engines/toon/script.cpp
index 0242ace7e3..8703666781 100644
--- a/engines/toon/script.cpp
+++ b/engines/toon/script.cpp
@@ -23,10 +23,9 @@
*
*/
+#include "common/debug.h"
#include "common/endian.h"
#include "common/stream.h"
-#include "common/util.h"
-#include "common/system.h"
#include "toon/toon.h"
#include "toon/script.h"
diff --git a/engines/toon/script_func.cpp b/engines/toon/script_func.cpp
index b181591bf0..8f75097bd4 100644
--- a/engines/toon/script_func.cpp
+++ b/engines/toon/script_func.cpp
@@ -23,6 +23,9 @@
*
*/
+#include "common/debug.h"
+#include "common/system.h"
+
#include "toon/script_func.h"
#include "toon/script.h"
#include "toon/state.h"
diff --git a/engines/toon/state.cpp b/engines/toon/state.cpp
index 0d6977842d..af37ea9e68 100644
--- a/engines/toon/state.cpp
+++ b/engines/toon/state.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/debug.h"
+
#include "toon/state.h"
#include "toon/toon.h"
diff --git a/engines/toon/text.cpp b/engines/toon/text.cpp
index f0d17dd34e..94a3ea5aa7 100644
--- a/engines/toon/text.cpp
+++ b/engines/toon/text.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/debug.h"
+
#include "toon/text.h"
namespace Toon {
diff --git a/engines/toon/tools.cpp b/engines/toon/tools.cpp
index da6e0f712e..ff72e69543 100644
--- a/engines/toon/tools.cpp
+++ b/engines/toon/tools.cpp
@@ -23,6 +23,8 @@
*
*/
+#include "common/debug.h"
+
#include "toon/tools.h"
#include "toon/toon.h"
diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp
index 2040668245..81c4d313e4 100644
--- a/engines/toon/toon.cpp
+++ b/engines/toon/toon.cpp
@@ -33,6 +33,7 @@
#include "common/memstream.h"
#include "engines/util.h"
+#include "graphics/palette.h"
#include "graphics/surface.h"
#include "graphics/thumbnail.h"
#include "gui/saveload.h"
@@ -57,7 +58,7 @@ void ToonEngine::init() {
_hotspots = new Hotspots(this);
_mainSurface = new Graphics::Surface();
- _mainSurface->create(TOON_BACKBUFFER_WIDTH, TOON_BACKBUFFER_HEIGHT, 1);
+ _mainSurface->create(TOON_BACKBUFFER_WIDTH, TOON_BACKBUFFER_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
_finalPalette = new uint8[768];
_backupPalette = new uint8[768];
@@ -116,6 +117,8 @@ void ToonEngine::init() {
_drew = _characters[0];
_flux = _characters[1];
+
+
// preload walk anim for flux and drew
_drew->loadWalkAnimation("STNDWALK.CAF");
_drew->setupPalette();
@@ -135,6 +138,9 @@ void ToonEngine::init() {
memset(_sceneAnimations, 0, sizeof(_sceneAnimations));
memset(_sceneAnimationScripts, 0, sizeof(_sceneAnimationScripts));
+ _drew->setVisible(false);
+ _flux->setVisible(false);
+
_gameState->_currentChapter = 1;
initChapter();
loadCursor();
@@ -843,6 +849,7 @@ ToonEngine::ToonEngine(OSystem *syst, const ADGameDescription *gameDescription)
_backupPalette = NULL;
_additionalPalette1 = NULL;
_additionalPalette2 = NULL;
+ _additionalPalette2Present = false;
_cutawayPalette = NULL;
_universalPalette = NULL;
_fluxPalette = NULL;
@@ -1148,6 +1155,7 @@ void ToonEngine::loadScene(int32 SceneId, bool forGameLoad) {
strcat(temp, ".NPP");
loadAdditionalPalette(temp, 0);
+ _additionalPalette2Present = false;
strcpy(temp, state()->_locations[SceneId]._name);
strcat(temp, ".NP2");
loadAdditionalPalette(temp, 1);
@@ -1318,6 +1326,7 @@ void ToonEngine::loadAdditionalPalette(Common::String fileName, int32 mode) {
case 1:
memcpy(_additionalPalette2, palette, 69);
fixPaletteEntries(_additionalPalette2, 23);
+ _additionalPalette2Present = true;
break;
case 2:
memcpy(_cutawayPalette, palette, size);
@@ -1786,7 +1795,8 @@ void ToonEngine::flipScreens() {
if (_gameState->_inCloseUp) {
_gameState->_currentScrollValue = TOON_SCREEN_WIDTH;
setPaletteEntries(_cutawayPalette, 1, 128);
- setPaletteEntries(_additionalPalette2, 232, 23);
+ if (_additionalPalette2Present)
+ setPaletteEntries(_additionalPalette2, 232, 23);
} else {
_gameState->_currentScrollValue = 0;
_currentPicture->setupPalette();
diff --git a/engines/toon/toon.h b/engines/toon/toon.h
index 3554900684..373437d658 100644
--- a/engines/toon/toon.h
+++ b/engines/toon/toon.h
@@ -352,6 +352,7 @@ protected:
uint8 *_backupPalette;
uint8 *_additionalPalette1;
uint8 *_additionalPalette2;
+ bool _additionalPalette2Present;
uint8 *_cutawayPalette;
uint8 *_universalPalette;
uint8 *_fluxPalette;
diff --git a/engines/touche/menu.cpp b/engines/touche/menu.cpp
index 52967c25c7..eb10c61893 100644
--- a/engines/touche/menu.cpp
+++ b/engines/touche/menu.cpp
@@ -331,14 +331,14 @@ void ToucheEngine::handleMenuAction(void *menu, int actionId) {
break;
case kActionPerformSaveLoad:
if (menuData->mode == kMenuLoadStateMode) {
- if (loadGameState(_saveLoadCurrentSlot) == Common::kNoError) {
+ if (loadGameState(_saveLoadCurrentSlot).getCode() == Common::kNoError) {
menuData->quit = true;
}
} else if (menuData->mode == kMenuSaveStateMode) {
_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
const char *description = menuData->saveLoadDescriptionsTable[_saveLoadCurrentSlot];
if (strlen(description) > 0) {
- if (saveGameState(_saveLoadCurrentSlot, description) == Common::kNoError) {
+ if (saveGameState(_saveLoadCurrentSlot, description).getCode() == Common::kNoError) {
menuData->quit = true;
}
}
diff --git a/engines/touche/midi.h b/engines/touche/midi.h
index f0f55e64e6..bde4950b93 100644
--- a/engines/touche/midi.h
+++ b/engines/touche/midi.h
@@ -34,7 +34,7 @@
class MidiParser;
namespace Common {
- class ReadStream;
+class ReadStream;
}
namespace Touche {
diff --git a/engines/touche/resource.cpp b/engines/touche/resource.cpp
index 3c108e2931..93406dcb8b 100644
--- a/engines/touche/resource.cpp
+++ b/engines/touche/resource.cpp
@@ -24,6 +24,7 @@
*/
+#include "common/textconsole.h"
#include "audio/decoders/flac.h"
#include "audio/mixer.h"
diff --git a/engines/touche/saveload.cpp b/engines/touche/saveload.cpp
index 73817a5a1a..42b68d015c 100644
--- a/engines/touche/saveload.cpp
+++ b/engines/touche/saveload.cpp
@@ -24,6 +24,7 @@
*/
+#include "common/textconsole.h"
#include "common/savefile.h"
#include "touche/graphics.h"
diff --git a/engines/touche/touche.cpp b/engines/touche/touche.cpp
index 6b47a7fc4d..15a2b1c53a 100644
--- a/engines/touche/touche.cpp
+++ b/engines/touche/touche.cpp
@@ -28,13 +28,18 @@
#include "common/debug-channels.h"
#include "common/events.h"
#include "common/EventRecorder.h"
-#include "common/file.h"
#include "common/fs.h"
#include "common/system.h"
+#include "common/archive.h"
+#include "common/debug.h"
+#include "common/error.h"
+#include "common/keyboard.h"
+#include "common/textconsole.h"
#include "engines/util.h"
#include "graphics/cursorman.h"
-#include "audio/mididrv.h"
+#include "graphics/palette.h"
+#include "gui/debugger.h"
#include "touche/midi.h"
#include "touche/touche.h"
diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp
index fd1dfe9e9d..789ec8fa8d 100644
--- a/engines/tsage/converse.cpp
+++ b/engines/tsage/converse.cpp
@@ -52,7 +52,10 @@ void SequenceManager::setup() {
_sceneObject = _objectList[0];
}
-void SequenceManager::synchronise(Serialiser &s) {
+void SequenceManager::synchronize(Serializer &s) {
+ if (s.getVersion() >= 2)
+ Action::synchronize(s);
+
s.syncAsSint32LE(_resNum);
s.syncAsSint32LE(_sequenceOffset);
s.syncAsByte(_keepActive);
@@ -150,11 +153,11 @@ void SequenceManager::signal() {
case 10: {
int resNum= getNextValue();
int lineNum = getNextValue();
- int colour = getNextValue();
+ int color = getNextValue();
int xp = getNextValue();
int yp = getNextValue();
int width = getNextValue();
- setMessage(resNum, lineNum, colour, Common::Point(xp, yp), width);
+ setMessage(resNum, lineNum, color, Common::Point(xp, yp), width);
break;
}
case 11:
@@ -181,7 +184,7 @@ void SequenceManager::signal() {
break;
case 15:
v1 = getNextValue();
- _sceneObject->_field7A = v1;
+ _sceneObject->_moveRate = v1;
break;
case 16:
v1 = getNextValue();
@@ -208,7 +211,7 @@ void SequenceManager::signal() {
break;
case 22:
v1 = getNextValue();
- _sceneObject->setPriority2(v1);
+ _sceneObject->fixPriority(v1);
break;
case 23:
v1 = getNextValue();
@@ -244,6 +247,7 @@ void SequenceManager::signal() {
}
case 28:
_objectIndex = getNextValue();
+ assert((_objectIndex >= 0) && (_objectIndex < 6));
_sceneObject = _objectList[_objectIndex];
assert(_sceneObject);
break;
@@ -272,14 +276,15 @@ void SequenceManager::signal() {
case 34: {
v1 = getNextValue();
v2 = getNextValue();
- int objIndex1 = getNextValue();
- int objIndex2 = getNextValue();
- int objIndex3 = getNextValue();
- int objIndex4 = getNextValue();
- int objIndex5 = getNextValue();
+ int objIndex1 = getNextValue() - 1;
+ int objIndex2 = getNextValue() - 1;
+ int objIndex3 = getNextValue() - 1;
+ int objIndex4 = getNextValue() - 1;
+ int objIndex5 = getNextValue() - 1;
+ int objIndex6 = getNextValue() - 1;
setAction(globalManager(), v2 ? this : NULL, v1, _objectList[objIndex1], _objectList[objIndex2],
- _objectList[objIndex3], _objectList[objIndex4], _objectList[objIndex5]);
+ _objectList[objIndex3], _objectList[objIndex4], _objectList[objIndex5], _objectList[objIndex6], NULL);
break;
}
default:
@@ -294,17 +299,19 @@ void SequenceManager::process(Event &event) {
!event.handled && _globals->_sceneObjects->contains(&_sceneText)) {
// Remove the text item
_sceneText.remove();
+ setDelay(2);
+ event.handled = true;
} else {
Action::process(event);
}
}
-void SequenceManager::attached(EventHandler *newOwner, EventHandler *fmt, va_list va) {
+void SequenceManager::attached(EventHandler *newOwner, EventHandler *endHandler, va_list va) {
// Get the sequence number to use
_resNum = va_arg(va, int);
- byte *seqData = _vm->_dataManager->getResource(RES_SEQUENCE, _resNum, 0);
+ byte *seqData = _resourceManager->getResource(RES_SEQUENCE, _resNum, 0);
uint seqSize = _vm->_memoryManager.getSize(seqData);
_sequenceData.resize(seqSize);
@@ -320,12 +327,7 @@ void SequenceManager::attached(EventHandler *newOwner, EventHandler *fmt, va_lis
}
setup();
- // TODO: This is not particulary nice, since dummy is uninitialized.
- // Since the default Action implementation does not access the va_list
- // parameter it should be fine though. Still it would be nice to find
- // a better solution to this.
- va_list dummy;
- Action::attached(newOwner, fmt, dummy);
+ Action::attached(newOwner, endHandler, va);
}
/**
@@ -337,28 +339,30 @@ uint16 SequenceManager::getNextValue() {
return result;
}
-void SequenceManager::setMessage(int resNum, int lineNum, int colour, const Common::Point &pt, int width) {
- _sceneText._colour1 = colour;
- _sceneText._colour2 = 0;
- _sceneText._colour3 = 0;
+void SequenceManager::setMessage(int resNum, int lineNum, int color, const Common::Point &pt, int width) {
+ _sceneText._color1 = color;
+ _sceneText._color2 = 0;
+ _sceneText._color3 = 0;
_sceneText._fontNumber = 2;
_sceneText._width = width;
// Get the display message
- Common::String msg = _vm->_dataManager->getMessage(resNum, lineNum);
+ Common::String msg = _resourceManager->getMessage(resNum, lineNum);
- // Get the needed rect, and move it to the desired position
- Rect textRect;
- _globals->gfxManager().getStringBounds(msg.c_str(), textRect, width);
+ // Set the text message
+ _sceneText.setup(msg);
+
+ // Move the text to the correct position
+ Rect textRect = _sceneText._bounds;
Rect sceneBounds = _globals->_sceneManager._scene->_sceneBounds;
sceneBounds.collapse(4, 2);
textRect.moveTo(pt);
textRect.contain(sceneBounds);
- // Set the text message
- _sceneText.setup(msg);
_sceneText.setPosition(Common::Point(textRect.left, textRect.top));
- _sceneText.setPriority2(255);
+
+ // Draw the text
+ _sceneText.fixPriority(255);
_sceneText.show();
// Set the delay based on the number of words
@@ -379,8 +383,8 @@ SequenceManager *SequenceManager::globalManager() {
/*--------------------------------------------------------------------------*/
ConversationChoiceDialog::ConversationChoiceDialog() {
- _stdColour = 23;
- _highlightColour = _globals->_scenePalette._colours.background;
+ _stdColor = 23;
+ _highlightColor = _globals->_scenePalette._colors.background;
_fontNumber = 1;
}
@@ -443,7 +447,7 @@ int ConversationChoiceDialog::execute(const Common::StringArray &choiceList) {
if (idx != _selectedIndex) {
if (_selectedIndex != _choiceList.size()) {
// De-highlight previously selected item
- _gfxManager._font._colours.foreground = _stdColour;
+ _gfxManager._font._colors.foreground = _stdColor;
_gfxManager._font.writeLines(_choiceList[_selectedIndex]._msg.c_str(),
_choiceList[_selectedIndex]._bounds, ALIGN_LEFT);
}
@@ -452,7 +456,7 @@ int ConversationChoiceDialog::execute(const Common::StringArray &choiceList) {
if (_selectedIndex != _choiceList.size()) {
// Highlight the new item
- _gfxManager._font._colours.foreground = _highlightColour;
+ _gfxManager._font._colors.foreground = _highlightColor;
_gfxManager._font.writeLines(_choiceList[idx]._msg.c_str(), _choiceList[idx]._bounds, ALIGN_LEFT);
}
@@ -477,7 +481,7 @@ void ConversationChoiceDialog::draw() {
drawFrame();
_gfxManager._bounds = tempRect;
- _gfxManager._font._colours.foreground = _stdColour;
+ _gfxManager._font._colors.foreground = _stdColor;
_gfxManager.activate();
// Loop through writing the conversation choices
@@ -510,12 +514,12 @@ void Obj44::load(const byte *dataP) {
_speakerOffset = READ_LE_UINT16(dataP + 0x42);
}
-void Obj44::synchronise(Serialiser &s) {
+void Obj44::synchronize(Serializer &s) {
s.syncAsSint32LE(_id);
- for (int i = 0; i < OBJ44_LIST_SIZE; ++i)
- s.syncAsSint32LE(_field2[i]);
- for (int i = 0; i < OBJ44_LIST_SIZE; ++i)
- _list[OBJ44_LIST_SIZE].synchronise(s);
+ for (int idx = 0; idx < OBJ44_LIST_SIZE; ++idx)
+ s.syncAsSint32LE(_field2[idx]);
+ for (int idx = 0; idx < OBJ44_LIST_SIZE; ++idx)
+ _list[idx].synchronize(s);
s.syncAsUint32LE(_speakerOffset);
}
@@ -535,7 +539,7 @@ void StripManager::start(int stripNum, EventHandler *owner, StripCallback *callb
_stripNum = stripNum;
_callbackObject = callback;
- _sceneNumber = _globals->_sceneManager._sceneNumber;
+ _sceneNumber = _globals->_sceneManager._scene->_screenNumber;
_sceneBounds = _globals->_sceneManager._scene->_sceneBounds;
_script.clear();
@@ -547,7 +551,7 @@ void StripManager::reset() {
_actionIndex = 0;
_delayFrames = 0;
_owner = NULL;
- _fmt = NULL;
+ _endHandler = NULL;
_field2E6 = false;
_stripNum = -1;
_obj44Index = 0;
@@ -565,7 +569,7 @@ void StripManager::reset() {
void StripManager::load() {
// Get the script
- byte *script = _vm->_dataManager->getResource(RES_STRIP, _stripNum, 2);
+ byte *script = _resourceManager->getResource(RES_STRIP, _stripNum, 2);
uint scriptSize = _vm->_memoryManager.getSize(script);
_script.resize(scriptSize);
@@ -574,7 +578,7 @@ void StripManager::load() {
DEALLOCATE(script);
// Get the object list
- byte *obj44List = _vm->_dataManager->getResource(RES_STRIP, _stripNum, 1);
+ byte *obj44List = _resourceManager->getResource(RES_STRIP, _stripNum, 1);
int dataSize = _vm->_memoryManager.getSize(obj44List);
assert((dataSize % 0x44) == 0);
@@ -588,24 +592,27 @@ void StripManager::load() {
DEALLOCATE(obj44List);
}
-void StripManager::synchronise(Serialiser &s) {
+void StripManager::synchronize(Serializer &s) {
+ if (s.getVersion() >= 2)
+ Action::synchronize(s);
+
s.syncAsSint32LE(_stripNum);
s.syncAsSint32LE(_obj44Index);
s.syncAsSint32LE(_field20);
s.syncAsSint32LE(_sceneNumber);
- _sceneBounds.synchronise(s);
+ _sceneBounds.synchronize(s);
SYNC_POINTER(_activeSpeaker);
s.syncAsByte(_textShown);
s.syncAsByte(_field2E6);
s.syncAsSint32LE(_field2E8);
- // Synchronise the item list
+ // Synchronize the item list
int arrSize = _obj44List.size();
s.syncAsUint16LE(arrSize);
if (s.isLoading())
_obj44List.resize(arrSize);
for (int i = 0; i < arrSize; ++i)
- _obj44List[i].synchronise(s);
+ _obj44List[i].synchronize(s);
// Synhcronise script data
int scriptSize = _script.size();
@@ -636,7 +643,7 @@ void StripManager::remove() {
if (_activeSpeaker)
_activeSpeaker->remove();
- if (_sceneNumber != _globals->_sceneManager._scene->_sceneNumber) {
+ if (_sceneNumber != _globals->_sceneManager._scene->_screenNumber) {
_globals->_sceneManager._scene->_sceneBounds = _sceneBounds;
_globals->_sceneManager._scene->loadScene(_sceneNumber);
}
@@ -651,7 +658,7 @@ void StripManager::signal() {
}
if (_obj44Index < 0) {
- EventHandler *owner = _fmt;
+ EventHandler *owner = _endHandler;
int stripNum = ABS(_obj44Index);
remove();
@@ -700,7 +707,7 @@ void StripManager::signal() {
_activeSpeaker->remove();
_activeSpeaker = speakerP;
- if ((_activeSpeaker->_newSceneNumber == -1) && (_globals->_sceneManager._scene->_sceneNumber != _sceneNumber)) {
+ if ((_activeSpeaker->_newSceneNumber == -1) && (_globals->_sceneManager._scene->_screenNumber != _sceneNumber)) {
_globals->_sceneManager._scene->_sceneBounds = _sceneBounds;
_globals->_sceneManager._scene->loadScene(_sceneNumber);
}
@@ -736,8 +743,8 @@ void StripManager::process(Event &event) {
if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_ESCAPE)) {
if (_obj44Index != 10000) {
int currIndex = _obj44Index;
- while (!_obj44List[_obj44Index + 1]._id) {
- _obj44Index = getNewIndex(_obj44List[_obj44Index]._id);
+ while (!_obj44List[_obj44Index]._list[1]._id) {
+ _obj44Index = getNewIndex(_obj44List[_obj44Index]._list[0]._id);
if ((_obj44Index < 0) || (_obj44Index == 10000))
break;
currIndex = _obj44Index;
@@ -795,25 +802,28 @@ Speaker::Speaker() : EventHandler() {
_textPos = Common::Point(10, 20);
_fontNumber = 2;
_textMode = ALIGN_LEFT;
- _colour1 = _colour2 = _colour3 = _globals->_scenePalette._colours.foreground;
+ _color1 = _color2 = _color3 = _globals->_scenePalette._colors.foreground;
_action = NULL;
_speakerName = "SPEAKER";
}
-void Speaker::synchronise(Serialiser &s) {
- _fieldA.synchronise(s);
+void Speaker::synchronize(Serializer &s) {
+ if (s.getVersion() >= 2)
+ EventHandler::synchronize(s);
+
+ _fieldA.synchronize(s);
SYNC_POINTER(_field18);
s.syncString(_speakerName);
s.syncAsSint32LE(_newSceneNumber);
s.syncAsSint32LE(_oldSceneNumber);
- _sceneBounds.synchronise(s);
+ _sceneBounds.synchronize(s);
s.syncAsSint32LE(_textWidth);
s.syncAsSint16LE(_textPos.x); s.syncAsSint16LE(_textPos.y);
s.syncAsSint32LE(_fontNumber);
SYNC_ENUM(_textMode, TextAlign);
- s.syncAsSint16LE(_colour1);
- s.syncAsSint16LE(_colour2);
- s.syncAsSint16LE(_colour3);
+ s.syncAsSint16LE(_color1);
+ s.syncAsSint16LE(_color2);
+ s.syncAsSint16LE(_color3);
s.syncAsByte(_hideObjects);
}
@@ -844,15 +854,15 @@ void Speaker::proc12(Action *action) {
void Speaker::setText(const Common::String &msg) {
_globals->_sceneObjects->draw();
- _sceneText._colour1 = _colour1;
- _sceneText._colour2 = _colour2;
- _sceneText._colour3 = _colour3;
+ _sceneText._color1 = _color1;
+ _sceneText._color2 = _color2;
+ _sceneText._color3 = _color3;
_sceneText._width = _textWidth;
_sceneText._fontNumber = _fontNumber;
_sceneText._textMode = _textMode;
_sceneText.setup(msg);
_sceneText.setPosition(_textPos);
- _sceneText.setPriority2(256);
+ _sceneText.fixPriority(256);
// Count the number of words (by spaces) in the string
const char *msgP = msg.c_str();
@@ -876,8 +886,8 @@ void Speaker::removeText() {
SpeakerGameText::SpeakerGameText() : Speaker() {
_speakerName = "GAMETEXT";
_textPos = Common::Point(40, 40);
- _textMode = ALIGN_CENTRE;
- _colour1 = 7;
+ _textMode = ALIGN_CENTER;
+ _color1 = 7;
_textWidth = 230;
_hideObjects = false;
}
@@ -886,7 +896,7 @@ SpeakerGameText::SpeakerGameText() : Speaker() {
ScreenSpeaker::ScreenSpeaker() : Speaker() {
_npc = NULL;
- _textMode = ALIGN_CENTRE;
+ _textMode = ALIGN_CENTER;
}
void ScreenSpeaker::setText(const Common::String &msg) {
@@ -897,9 +907,9 @@ void ScreenSpeaker::setText(const Common::String &msg) {
_globals->gfxManager().getStringBounds(msg.c_str(), textRect, _textWidth);
if (_npc) {
- textRect.centre(_npc->_position.x, _npc->_bounds.top - (textRect.height() / 2 + 10));
+ textRect.center(_npc->_position.x, _npc->_bounds.top - (textRect.height() / 2 + 10));
} else {
- textRect.centre(_globals->_sceneManager._scene->_sceneBounds.left +
+ textRect.center(_globals->_sceneManager._scene->_sceneBounds.left +
(_globals->_sceneManager._scene->_sceneBounds.width() / 2),
_globals->_sceneManager._scene->_sceneBounds.top);
}
diff --git a/engines/tsage/converse.h b/engines/tsage/converse.h
index 4d6e51a6b8..f8c5bc7b14 100644
--- a/engines/tsage/converse.h
+++ b/engines/tsage/converse.h
@@ -40,7 +40,7 @@ class SequenceManager : public Action {
private:
void setup();
uint16 getNextValue();
- void setMessage(int resNum, int lineNum, int colour, const Common::Point &pt, int width);
+ void setMessage(int resNum, int lineNum, int color, const Common::Point &pt, int width);
SequenceManager *globalManager();
public:
SceneText _sceneText;
@@ -58,11 +58,11 @@ public:
SequenceManager();
virtual Common::String getClassName() { return "SequenceManager"; }
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual void remove();
virtual void signal();
virtual void process(Event &event);
- virtual void attached(EventHandler *newOwner, EventHandler *fmt, va_list va);
+ virtual void attached(EventHandler *newOwner, EventHandler *endHandler, va_list va);
};
@@ -80,13 +80,13 @@ public:
Common::Point _textPos;
int _fontNumber;
TextAlign _textMode;
- int _colour1, _colour2, _colour3;
+ int _color1, _color2, _color3;
bool _hideObjects;
public:
Speaker();
virtual Common::String getClassName() { return "Speaker"; }
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual void remove();
virtual void proc12(Action *action);
virtual void setText(const Common::String &msg);
@@ -143,19 +143,19 @@ public:
class ConversationChoiceDialog : public ModalDialog {
public:
- int _stdColour;
- int _highlightColour;
+ int _stdColor;
+ int _highlightColor;
int _fontNumber;
- int _savedFgColour;
+ int _savedFgColor;
int _savedFontNumber;
Common::Array<ChoiceEntry> _choiceList;
uint _selectedIndex;
public:
ConversationChoiceDialog();
- void setColours(int stdColour, int highlightColour) {
- _stdColour = stdColour;
- _highlightColour = highlightColour;
+ void setColors(int stdColor, int highlightColor) {
+ _stdColor = stdColor;
+ _highlightColor = highlightColor;
}
void setFontNumber(int fontNum) { _fontNumber = fontNum; }
int execute(const Common::StringArray &choiceList);
@@ -168,7 +168,7 @@ public:
int _id;
uint _scriptOffset;
- virtual void synchronise(Serialiser &s) {
+ virtual void synchronize(Serializer &s) {
s.syncAsSint32LE(_id);
s.syncAsUint32LE(_scriptOffset);
}
@@ -184,7 +184,7 @@ public:
uint _speakerOffset;
public:
void load(const byte *dataP);
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
};
class StripManager : public Action {
@@ -212,14 +212,14 @@ public:
StripManager();
virtual ~StripManager();
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual void remove();
virtual void signal();
virtual void process(Event &event);
void start(int stripNum, EventHandler *owner, StripCallback *callback = NULL);
void setCallback(StripCallback *callback) { _callbackObject = callback; }
- void setColours(int stdColour, int highlightColour) { _choiceDialog.setColours(stdColour, highlightColour); }
+ void setColors(int stdColor, int highlightColor) { _choiceDialog.setColors(stdColor, highlightColor); }
void setFontNumber(int fontNum) { _choiceDialog.setFontNumber(fontNum); }
void addSpeaker(Speaker *speaker);
};
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index 81088b4eaa..8ad920e6fd 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -24,10 +24,8 @@
*/
#include "common/system.h"
-#include "common/config-manager.h"
-#include "common/translation.h"
#include "engines/engine.h"
-#include "gui/saveload.h"
+#include "graphics/palette.h"
#include "tsage/tsage.h"
#include "tsage/core.h"
#include "tsage/dialogs.h"
@@ -51,7 +49,7 @@ InvObject::InvObject(int sceneNumber, int rlbNum, int cursorNum, CursorType curs
// Decode the image for the inventory item to get it's display bounds
uint size;
- byte *imgData = _vm->_dataManager->getSubResource(_displayResNum, _rlbNum, _cursorNum, &size);
+ byte *imgData = _resourceManager->getSubResource(_displayResNum, _rlbNum, _cursorNum, &size);
GfxSurface s = surfaceFromRes(imgData);
_bounds = s.getBounds();
@@ -65,87 +63,18 @@ void InvObject::setCursor() {
GfxSurface s = surfaceFromRes(_iconResNum, _rlbNum, _cursorNum);
Graphics::Surface src = s.lockSurface();
- _globals->_events.setCursor(src, s._transColour, s._centroid, _cursorId);
+ _globals->_events.setCursor(src, s._transColor, s._centroid, _cursorId);
}
}
/*--------------------------------------------------------------------------*/
-InvObjectList::InvObjectList() :
- _stunner(2280, 1, 2, OBJECT_STUNNER, "This is your stunner."),
- _scanner(1, 1, 3, OBJECT_SCANNER, "A combination scanner comm unit."),
- _stasisBox(5200, 1, 4, OBJECT_STASIS_BOX, "A stasis box."),
- _infoDisk(40, 1, 1, OBJECT_INFODISK, "The infodisk you took from the assassin."),
- _stasisNegator(0, 2, 2, OBJECT_STASIS_NEGATOR, "The stasis field negator."),
- _keyDevice(4250, 1, 6, OBJECT_KEY_DEVICE, "A magnetic key device."),
- _medkit(2280, 1, 7, OBJECT_MEDKIT, "Your medkit."),
- _ladder(4100, 1, 8, OBJECT_LADDER, "The chief's ladder."),
- _rope(4150, 1, 9, OBJECT_ROPE, "The chief's rope."),
- _key(7700, 1, 11, OBJECT_KEY, "A key."),
- _translator(7700, 1, 13, OBJECT_TRANSLATOR, "The dolphin translator box."),
- _ale(2150, 1, 10, OBJECT_ALE, "A bottle of ale."),
- _paper(7700, 1, 12, OBJECT_PAPER, "A slip of paper with the numbers 2,4, and 3 written on it."),
- _waldos(0, 1, 14, OBJECT_WALDOS, "A pair of waldos from the ruined probe."),
- _stasisBox2(8100, 1, 4, OBJECT_STASIS_BOX2, "A stasis box."),
- _ring(8100, 2, 5, OBJECT_RING, "This is a signet ring sent to you by Louis Wu."),
- _cloak(9850, 2, 6, OBJECT_CLOAK, "A fine silk cloak."),
- _tunic(9450, 2, 7, OBJECT_TUNIC, "The patriarch's soiled tunic."),
- _candle(9500, 2, 8, OBJECT_CANDLE, "A tallow candle."),
- _straw(9400, 2, 9, OBJECT_STRAW, "Clean, dry straw."),
- _scimitar(9850, 1, 18, OBJECT_SCIMITAR, "A scimitar from the Patriarch's closet."),
- _sword(9850, 1, 17, OBJECT_SWORD, "A short sword from the Patriarch's closet."),
- _helmet(9500, 2, 4, OBJECT_HELMET, "Some type of helmet."),
- _items(4300, 2, 10, OBJECT_ITEMS, "Two interesting items from the Tnuctipun vessel."),
- _concentrator(4300, 2, 11, OBJECT_CONCENTRATOR, "The Tnuctipun anti-matter concentrator contained in a stasis field."),
- _nullifier(5200, 2, 12, OBJECT_NULLIFIER, "A purported neural wave nullifier."),
- _peg(4045, 2, 16, OBJECT_PEG, "A peg with a symbol."),
- _vial(5100, 2, 17, OBJECT_VIAL, "A vial of the bat creatures anti-pheromone drug."),
- _jacket(9850, 3, 1, OBJECT_JACKET, "A natty padded jacket."),
- _tunic2(9850, 3, 2, OBJECT_TUNIC2, "A very hairy tunic."),
- _bone(5300, 3, 5, OBJECT_BONE, "A very sharp bone."),
- _jar(7700, 3, 4, OBJECT_JAR, "An jar filled with a green substance."),
- _emptyJar(7700, 3, 3, OBJECT_EMPTY_JAR, "An empty jar.") {
-
- // Add the items to the list
- _itemList.push_back(&_stunner);
- _itemList.push_back(&_scanner);
- _itemList.push_back(&_stasisBox);
- _itemList.push_back(&_infoDisk);
- _itemList.push_back(&_stasisNegator);
- _itemList.push_back(&_keyDevice);
- _itemList.push_back(&_medkit);
- _itemList.push_back(&_ladder);
- _itemList.push_back(&_rope);
- _itemList.push_back(&_key);
- _itemList.push_back(&_translator);
- _itemList.push_back(&_ale);
- _itemList.push_back(&_paper);
- _itemList.push_back(&_waldos);
- _itemList.push_back(&_stasisBox2);
- _itemList.push_back(&_ring);
- _itemList.push_back(&_cloak);
- _itemList.push_back(&_tunic);
- _itemList.push_back(&_candle);
- _itemList.push_back(&_straw);
- _itemList.push_back(&_scimitar);
- _itemList.push_back(&_sword);
- _itemList.push_back(&_helmet);
- _itemList.push_back(&_items);
- _itemList.push_back(&_concentrator);
- _itemList.push_back(&_nullifier);
- _itemList.push_back(&_peg);
- _itemList.push_back(&_vial);
- _itemList.push_back(&_jacket);
- _itemList.push_back(&_tunic2);
- _itemList.push_back(&_bone);
- _itemList.push_back(&_jar);
- _itemList.push_back(&_emptyJar);
-
+InvObjectList::InvObjectList() {
_selectedItem = NULL;
}
-void InvObjectList::synchronise(Serialiser &s) {
- SavedObject::synchronise(s);
+void InvObjectList::synchronize(Serializer &s) {
+ SavedObject::synchronize(s);
SYNC_POINTER(_selectedItem);
}
@@ -155,17 +84,17 @@ void EventHandler::dispatch() {
if (_action) _action->dispatch();
}
-void EventHandler::setAction(Action *action, EventHandler *fmt, ...) {
+void EventHandler::setAction(Action *action, EventHandler *endHandler, ...) {
if (_action) {
- _action->_fmt = NULL;
+ _action->_endHandler = NULL;
_action->remove();
}
_action = action;
if (action) {
va_list va;
- va_start(va, fmt);
- _action->attached(this, fmt, va);
+ va_start(va, endHandler);
+ _action->attached(this, endHandler, va);
va_end(va);
}
}
@@ -175,20 +104,21 @@ void EventHandler::setAction(Action *action, EventHandler *fmt, ...) {
Action::Action() {
_actionIndex = 0;
_owner = NULL;
- _fmt = NULL;
+ _endHandler = NULL;
+ _attached = false;
}
-void Action::synchronise(Serialiser &s) {
- EventHandler::synchronise(s);
- if (s.isLoading())
+void Action::synchronize(Serializer &s) {
+ EventHandler::synchronize(s);
+ if (s.getVersion() == 1)
remove();
SYNC_POINTER(_owner);
s.syncAsSint32LE(_actionIndex);
s.syncAsSint32LE(_delayFrames);
s.syncAsUint32LE(_startFrame);
- s.syncAsSint16LE(_field16);
- SYNC_POINTER(_fmt);
+ s.syncAsByte(_attached);
+ SYNC_POINTER(_endHandler);
}
void Action::remove() {
@@ -202,9 +132,9 @@ void Action::remove() {
_globals->_sceneManager.removeAction(this);
}
- _field16 = 0;
- if (_fmt)
- _fmt->signal();
+ _attached = false;
+ if (_endHandler)
+ _endHandler->signal();
}
void Action::process(Event &event) {
@@ -230,13 +160,13 @@ void Action::dispatch() {
}
}
-void Action::attached(EventHandler *newOwner, EventHandler *fmt, va_list va) {
+void Action::attached(EventHandler *newOwner, EventHandler *endHandler, va_list va) {
_actionIndex = 0;
_delayFrames = 0;
_startFrame = _globals->_events.getFrameNumber();
_owner = newOwner;
- _fmt = fmt;
- _field16 = 1;
+ _endHandler = endHandler;
+ _attached = true;
signal();
}
@@ -252,15 +182,15 @@ ObjectMover::~ObjectMover() {
_sceneObject->_mover = NULL;
}
-void ObjectMover::synchronise(Serialiser &s) {
- EventHandler::synchronise(s);
+void ObjectMover::synchronize(Serializer &s) {
+ EventHandler::synchronize(s);
s.syncAsSint16LE(_destPosition.x); s.syncAsSint16LE(_destPosition.y);
s.syncAsSint16LE(_moveDelta.x); s.syncAsSint16LE(_moveDelta.y);
s.syncAsSint16LE(_moveSign.x); s.syncAsSint16LE(_moveSign.y);
s.syncAsSint32LE(_minorDiff);
s.syncAsSint32LE(_majorDiff);
- s.syncAsSint32LE(_field1A);
+ s.syncAsSint32LE(_changeCtr);
SYNC_POINTER(_action);
SYNC_POINTER(_sceneObject);
}
@@ -294,10 +224,10 @@ void ObjectMover::dispatch() {
ySign = _moveSign.y;
else {
int v = yAmount / yChange;
- _field1A += yAmount % yChange;
- if (_field1A >= yChange) {
+ _changeCtr += yAmount % yChange;
+ if (_changeCtr >= yChange) {
++v;
- _field1A -= yChange;
+ _changeCtr -= yChange;
}
ySign = _moveSign.y * v;
@@ -320,10 +250,10 @@ void ObjectMover::dispatch() {
xSign = _moveSign.x;
else {
int v = xAmount / xChange;
- _field1A += xAmount % xChange;
- if (_field1A >= xChange) {
+ _changeCtr += xAmount % xChange;
+ if (_changeCtr >= xChange) {
++v;
- _field1A -= xChange;
+ _changeCtr -= xChange;
}
xSign = _moveSign.x * v;
@@ -373,7 +303,7 @@ void ObjectMover::setup(const Common::Point &destPos) {
_destPosition = destPos;
_moveDelta = Common::Point(diffX, diffY);
_moveSign = Common::Point(xSign, ySign);
- _field1A = 0;
+ _changeCtr = 0;
if (!diffX && !diffY)
// Object is already at the correct destination
@@ -398,8 +328,8 @@ ObjectMover2::ObjectMover2() : ObjectMover() {
_destObject = NULL;
}
-void ObjectMover2::synchronise(Serialiser &s) {
- ObjectMover::synchronise(s);
+void ObjectMover2::synchronize(Serializer &s) {
+ ObjectMover::synchronize(s);
SYNC_POINTER(_destObject);
s.syncAsSint32LE(_minArea);
@@ -474,8 +404,8 @@ void NpcMover::startMove(SceneObject *sceneObj, va_list va) {
/*--------------------------------------------------------------------------*/
-void PlayerMover::synchronise(Serialiser &s) {
- NpcMover::synchronise(s);
+void PlayerMover::synchronize(Serializer &s) {
+ NpcMover::synchronize(s);
s.syncAsSint16LE(_finalDest.x); s.syncAsSint16LE(_finalDest.y);
s.syncAsSint32LE(_routeIndex);
@@ -627,7 +557,6 @@ void PlayerMover::pathfind(Common::Point *routeList, Common::Point srcPos, Commo
} while (routeRegions[++idx] != destRegion);
tempList[idx] = 1;
- idx = 0;
for (int listIndex = 1; listIndex <= endIndex; ++listIndex) {
int var10 = tempList[listIndex];
int var12 = tempList[listIndex + 1];
@@ -997,9 +926,11 @@ bool PlayerMover::sub_F8E5(const Common::Point &pt1, const Common::Point &pt2, c
/*--------------------------------------------------------------------------*/
-void PlayerMover2::synchronise(Serialiser &s) {
+void PlayerMover2::synchronize(Serializer &s) {
+ if (s.getVersion() >= 2)
+ PlayerMover::synchronize(s);
SYNC_POINTER(_destObject);
- s.syncAsSint16LE(_field7E);
+ s.syncAsSint16LE(_maxArea);
s.syncAsSint16LE(_minArea);
}
@@ -1016,7 +947,7 @@ void PlayerMover2::dispatch() {
void PlayerMover2::startMove(SceneObject *sceneObj, va_list va) {
_sceneObject = sceneObj;
- _field7E = va_arg(va, int);
+ _maxArea = va_arg(va, int);
_minArea = va_arg(va, int);
_destObject = va_arg(va, SceneObject *);
@@ -1036,18 +967,35 @@ PaletteModifier::PaletteModifier() {
/*--------------------------------------------------------------------------*/
-PaletteRotation::PaletteRotation() : PaletteModifier() {
- _disabled = false;
- _delayFrames = 0;
+PaletteModifierCached::PaletteModifierCached(): PaletteModifier() {
+ _step = 0;
+ _percent = 0;
+}
+
+void PaletteModifierCached::setPalette(ScenePalette *palette, int step) {
+ _scenePalette = palette;
+ _step = step;
+ _percent = 100;
+}
+
+void PaletteModifierCached::synchronize(Serializer &s) {
+ PaletteModifier::synchronize(s);
+
+ s.syncAsByte(_step);
+ s.syncAsSint32LE(_percent);
+}
+
+/*--------------------------------------------------------------------------*/
+
+PaletteRotation::PaletteRotation() : PaletteModifierCached() {
+ _percent = 0;
_delayCtr = 0;
_frameNumber = _globals->_events.getFrameNumber();
}
-void PaletteRotation::synchronise(Serialiser &s) {
- PaletteModifier::synchronise(s);
+void PaletteRotation::synchronize(Serializer &s) {
+ PaletteModifierCached::synchronize(s);
- s.syncAsByte(_disabled);
- s.syncAsSint32LE(_delayFrames);
s.syncAsSint32LE(_delayCtr);
s.syncAsUint32LE(_frameNumber);
s.syncAsSint32LE(_currIndex);
@@ -1055,11 +1003,7 @@ void PaletteRotation::synchronise(Serialiser &s) {
s.syncAsSint32LE(_end);
s.syncAsSint32LE(_rotationMode);
s.syncAsSint32LE(_duration);
- for (int i = 0; i < 256; ++i) {
- s.syncAsByte(_palette[i].r);
- s.syncAsByte(_palette[i].g);
- s.syncAsByte(_palette[i].b);
- }
+ s.syncBytes(&_palette[0], 256 * 3);
}
void PaletteRotation::signal() {
@@ -1077,8 +1021,8 @@ void PaletteRotation::signal() {
if (_delayCtr)
return;
- _delayCtr = _delayFrames;
- if (_disabled)
+ _delayCtr = _percent;
+ if (_step)
return;
bool flag = true;
@@ -1120,17 +1064,17 @@ void PaletteRotation::signal() {
if (flag) {
int count2 = _currIndex - _start;
int count = _end - _currIndex;
- g_system->getPaletteManager()->setPalette((const byte *)&_palette[_currIndex], _start, count);
+ g_system->getPaletteManager()->setPalette((const byte *)&_palette[_currIndex * 3], _start, count);
if (count2) {
- g_system->getPaletteManager()->setPalette((const byte *)&_palette[_start], _start + count, count2);
+ g_system->getPaletteManager()->setPalette((const byte *)&_palette[_start * 3], _start + count, count2);
}
}
}
void PaletteRotation::remove() {
Action *action = _action;
- g_system->getPaletteManager()->setPalette((const byte *)&_palette[_start], _start, _end - _start);
+ g_system->getPaletteManager()->setPalette((const byte *)&_palette[_start * 3], _start, _end - _start);
_scenePalette->_listeners.remove(this);
@@ -1141,11 +1085,11 @@ void PaletteRotation::remove() {
void PaletteRotation::set(ScenePalette *palette, int start, int end, int rotationMode, int duration, Action *action) {
_duration = duration;
- _disabled = false;
+ _step = false;
_action = action;
_scenePalette = palette;
- Common::copy(&palette->_palette[0], &palette->_palette[256], &_palette[0]);
+ Common::copy(&palette->_palette[0], &palette->_palette[256 * 3], &_palette[0]);
_start = start;
_end = end + 1;
@@ -1162,12 +1106,6 @@ void PaletteRotation::set(ScenePalette *palette, int start, int end, int rotatio
}
}
-void PaletteRotation::setPalette(ScenePalette *palette, bool disabled) {
- _scenePalette = palette;
- _disabled = disabled;
- _delayFrames = 100;
-}
-
bool PaletteRotation::decDuration() {
if (_duration) {
if (--_duration == 0) {
@@ -1179,26 +1117,20 @@ bool PaletteRotation::decDuration() {
}
void PaletteRotation::setDelay(int amount) {
- _delayFrames = _delayCtr = amount;
+ _percent = _delayCtr = amount;
}
/*--------------------------------------------------------------------------*/
-void PaletteUnknown::synchronise(Serialiser &s) {
- PaletteModifier::synchronise(s);
+void PaletteFader::synchronize(Serializer &s) {
+ PaletteModifierCached::synchronize(s);
s.syncAsSint16LE(_step);
s.syncAsSint16LE(_percent);
- s.syncAsSint16LE(_field12);
- s.syncAsSint16LE(_field14);
- for (int i = 0; i < 256; ++i) {
- s.syncAsByte(_palette[i].r);
- s.syncAsByte(_palette[i].g);
- s.syncAsByte(_palette[i].b);
- }
+ s.syncBytes(&_palette[0], 256 * 3);
}
-void PaletteUnknown::signal() {
+void PaletteFader::signal() {
_percent -= _step;
if (_percent > 0) {
_scenePalette->fade((byte *)_palette, true /* 256 */, _percent);
@@ -1207,35 +1139,43 @@ void PaletteUnknown::signal() {
}
}
-void PaletteUnknown::remove() {
- if (_scenePalette) {
- for (int i = 0; i < 256; i++)
- _scenePalette->_palette[i] = _palette[i];
- _scenePalette->refresh();
- _scenePalette->_listeners.remove(this);
- delete this;
- }
+void PaletteFader::remove() {
+ // Save of a copy of the object's action, since it will be used after the object is destroyed
+ Action *action = _action;
- if (_action)
- _action->signal();
+ Common::copy(&_palette[0], &_palette[256 * 3], &_scenePalette->_palette[0]);
+ _scenePalette->refresh();
+ _scenePalette->_listeners.remove(this);
+ delete this;
+
+ if (action)
+ action->signal();
}
/*--------------------------------------------------------------------------*/
ScenePalette::ScenePalette() {
// Set a default gradiant range
- for (int idx = 0; idx < 256; ++idx)
- _palette[idx].r = _palette[idx].g = _palette[idx].b = idx;
+ byte *palData = &_palette[0];
+ for (int idx = 0; idx < 256; ++idx) {
+ *palData++ = idx;
+ *palData++ = idx;
+ *palData++ = idx;
+ }
_field412 = 0;
}
+ScenePalette::~ScenePalette() {
+ clearListeners();
+}
+
ScenePalette::ScenePalette(int paletteNum) {
loadPalette(paletteNum);
}
bool ScenePalette::loadPalette(int paletteNum) {
- byte *palData = _vm->_dataManager->getResource(RES_PALETTE, paletteNum, 0, true);
+ byte *palData = _resourceManager->getResource(RES_PALETTE, paletteNum, 0, true);
if (!palData)
return false;
@@ -1243,25 +1183,25 @@ bool ScenePalette::loadPalette(int paletteNum) {
int palSize = READ_LE_UINT16(palData + 2);
assert(palSize <= 256);
- RGB8 *destP = &_palette[palStart];
- RGB8 *srcP = (RGB8 *)(palData + 6);
+ byte *destP = &_palette[palStart * 3];
+ byte *srcP = palData + 6;
- Common::copy(&srcP[0], &srcP[palSize], destP);
+ Common::copy(&srcP[0], &srcP[palSize * 3], destP);
DEALLOCATE(palData);
return true;
}
void ScenePalette::refresh() {
- // Set indexes for standard colours to closest colour in the palette
- _colours.background = indexOf(255, 255, 255); // White background
- _colours.foreground = indexOf(0, 0, 0); // Black foreground
- _redColour = indexOf(180, 0, 0); // Red-ish
- _greenColour = indexOf(0, 180, 0); // Green-ish
- _blueColour = indexOf(0, 0, 180); // Blue-ish
- _aquaColour = indexOf(0, 180, 180); // Aqua
- _purpleColour = indexOf(180, 0, 180); // Purple
- _limeColour = indexOf(180, 180, 0); // Lime
+ // Set indexes for standard colors to closest color in the palette
+ _colors.background = indexOf(255, 255, 255); // White background
+ _colors.foreground = indexOf(0, 0, 0); // Black foreground
+ _redColor = indexOf(180, 0, 0); // Red-ish
+ _greenColor = indexOf(0, 180, 0); // Green-ish
+ _blueColor = indexOf(0, 0, 180); // Blue-ish
+ _aquaColor = indexOf(0, 180, 180); // Aqua
+ _purpleColor = indexOf(180, 0, 180); // Purple
+ _limeColor = indexOf(180, 180, 0); // Lime
// Refresh the palette
g_system->getPaletteManager()->setPalette((const byte *)&_palette[0], 0, 256);
@@ -1271,27 +1211,31 @@ void ScenePalette::refresh() {
* Loads a section of the palette into the game palette
*/
void ScenePalette::setPalette(int index, int count) {
- g_system->getPaletteManager()->setPalette((const byte *)&_palette[index], index, count);
+ g_system->getPaletteManager()->setPalette((const byte *)&_palette[index * 3], index, count);
}
/**
- * Returns the palette index with the closest matching colour to that specified
+ * Returns the palette index with the closest matching color to that specified
* @param r R component
* @param g G component
* @param b B component
* @param threshold Closeness threshold.
- * @remarks A threshold may be provided to specify how close the matching colour must be
+ * @remarks A threshold may be provided to specify how close the matching color must be
*/
uint8 ScenePalette::indexOf(uint r, uint g, uint b, int threshold) {
int palIndex = -1;
+ byte *palData = &_palette[0];
for (int i = 0; i < 256; ++i) {
- int rDiff = abs(_palette[i].r - (int)r);
- int gDiff = abs(_palette[i].g - (int)g);
- int bDiff = abs(_palette[i].b - (int)b);
+ byte ir = *palData++;
+ byte ig = *palData++;
+ byte ib = *palData++;
+ int rDiff = abs(ir - (int)r);
+ int gDiff = abs(ig - (int)g);
+ int bDiff = abs(ib - (int)b);
int idxThreshold = rDiff * rDiff + gDiff * gDiff + bDiff * bDiff;
- if (idxThreshold <= threshold) {
+ if (idxThreshold < threshold) {
threshold = idxThreshold;
palIndex = i;
}
@@ -1310,13 +1254,16 @@ void ScenePalette::getPalette(int start, int count) {
}
void ScenePalette::signalListeners() {
- for (SynchronisedList<PaletteModifier *>::iterator i = _listeners.begin(); i != _listeners.end(); ++i) {
- (*i)->signal();
+ SynchronizedList<PaletteModifier *>::iterator i = _listeners.begin();
+ while (i != _listeners.end()) {
+ PaletteModifier *obj = *i;
+ ++i;
+ obj->signal();
}
}
void ScenePalette::clearListeners() {
- SynchronisedList<PaletteModifier *>::iterator i = _listeners.begin();
+ SynchronizedList<PaletteModifier *>::iterator i = _listeners.begin();
while (i != _listeners.end()) {
PaletteModifier *obj = *i;
++i;
@@ -1325,14 +1272,14 @@ void ScenePalette::clearListeners() {
}
void ScenePalette::fade(const byte *adjustData, bool fullAdjust, int percent) {
- RGB8 tempPalette[256];
+ byte tempPalette[256 * 3];
// Ensure the percent adjustment is within 0 - 100%
percent = CLIP(percent, 0, 100);
for (int palIndex = 0; palIndex < 256; ++palIndex) {
- const byte *srcP = (const byte *)&_palette[palIndex];
- byte *destP = (byte *)&tempPalette[palIndex].r;
+ const byte *srcP = (const byte *)&_palette[palIndex * 3];
+ byte *destP = &tempPalette[palIndex * 3];
for (int rgbIndex = 0; rgbIndex < 3; ++rgbIndex, ++srcP, ++destP) {
*destP = *srcP - ((*srcP - adjustData[rgbIndex]) * (100 - percent)) / 100;
@@ -1358,18 +1305,21 @@ PaletteRotation *ScenePalette::addRotation(int start, int end, int rotationMode,
return obj;
}
-PaletteUnknown *ScenePalette::addUnkPal(RGB8 *arrBufferRGB, int unkNumb, bool disabled, Action *action) {
- PaletteUnknown *paletteUnk = new PaletteUnknown();
- paletteUnk->_action = action;
- for (int i = 0; i < 256; i++) {
- if (unkNumb <= 1)
- paletteUnk->_palette[i] = arrBufferRGB[i];
- else
- paletteUnk->_palette[i] = arrBufferRGB[0];
+PaletteFader *ScenePalette::addFader(const byte *arrBufferRGB, int palSize, int percent, Action *action) {
+ PaletteFader *fader = new PaletteFader();
+ fader->_action = action;
+ for (int i = 0; i < 256 * 3; i += 3) {
+ fader->_palette[i] = *(arrBufferRGB + 0);
+ fader->_palette[i + 1] = *(arrBufferRGB + 1);
+ fader->_palette[i + 2] = *(arrBufferRGB + 2);
+
+ if (palSize > 1)
+ arrBufferRGB += 3;
}
-// PaletteRotation::setPalette(this, disabled);
- _globals->_scenePalette._listeners.push_back(paletteUnk);
- return paletteUnk;
+
+ fader->setPalette(this, percent);
+ _globals->_scenePalette._listeners.push_back(fader);
+ return fader;
}
@@ -1397,35 +1347,34 @@ void ScenePalette::changeBackground(const Rect &bounds, FadeMode fadeMode) {
_globals->_screenSurface.copyFrom(_globals->_sceneManager._scene->_backSurface,
bounds, Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), NULL);
- for (SynchronisedList<PaletteModifier *>::iterator i = tempPalette._listeners.begin(); i != tempPalette._listeners.end(); ++i)
+ for (SynchronizedList<PaletteModifier *>::iterator i = tempPalette._listeners.begin(); i != tempPalette._listeners.end(); ++i)
delete *i;
tempPalette._listeners.clear();
}
-void ScenePalette::synchronise(Serialiser &s) {
- for (int i = 0; i < 256; ++i) {
- s.syncAsByte(_palette[i].r);
- s.syncAsByte(_palette[i].g);
- s.syncAsByte(_palette[i].b);
- }
- s.syncAsSint32LE(_colours.foreground);
- s.syncAsSint32LE(_colours.background);
+void ScenePalette::synchronize(Serializer &s) {
+ if (s.getVersion() >= 2)
+ SavedObject::synchronize(s);
+
+ s.syncBytes(_palette, 256 * 3);
+ s.syncAsSint32LE(_colors.foreground);
+ s.syncAsSint32LE(_colors.background);
s.syncAsSint32LE(_field412);
- s.syncAsByte(_redColour);
- s.syncAsByte(_greenColour);
- s.syncAsByte(_blueColour);
- s.syncAsByte(_aquaColour);
- s.syncAsByte(_purpleColour);
- s.syncAsByte(_limeColour);
+ s.syncAsByte(_redColor);
+ s.syncAsByte(_greenColor);
+ s.syncAsByte(_blueColor);
+ s.syncAsByte(_aquaColor);
+ s.syncAsByte(_purpleColor);
+ s.syncAsByte(_limeColor);
}
/*--------------------------------------------------------------------------*/
-void SceneItem::synchronise(Serialiser &s) {
- EventHandler::synchronise(s);
+void SceneItem::synchronize(Serializer &s) {
+ EventHandler::synchronize(s);
- _bounds.synchronise(s);
+ _bounds.synchronize(s);
s.syncString(_msg);
s.syncAsSint32LE(_fieldE);
s.syncAsSint32LE(_field10);
@@ -1473,7 +1422,7 @@ bool SceneItem::contains(const Common::Point &pt) {
}
void SceneItem::display(int resNum, int lineNum, ...) {
- Common::String msg = !resNum ? Common::String() : _vm->_dataManager->getMessage(resNum, lineNum);
+ Common::String msg = !resNum ? Common::String() : _resourceManager->getMessage(resNum, lineNum);
if (_globals->_sceneObjects->contains(&_globals->_sceneText)) {
_globals->_sceneText.remove();
@@ -1485,7 +1434,7 @@ void SceneItem::display(int resNum, int lineNum, ...) {
Rect textRect;
int maxWidth = 120;
bool keepOnscreen = false;
- bool centreText = true;
+ bool centerText = true;
if (resNum) {
va_list va;
@@ -1515,40 +1464,40 @@ void SceneItem::display(int resNum, int lineNum, ...) {
_globals->_sceneText._fontNumber = va_arg(va, int);
_globals->gfxManager()._font.setFontNumber(_globals->_sceneText._fontNumber);
break;
- case SET_BG_COLOUR: {
- // Set the background colour
- int bgColour = va_arg(va, int);
- _globals->gfxManager()._font._colours.background = bgColour;
- if (!bgColour)
+ case SET_BG_COLOR: {
+ // Set the background color
+ int bgColor = va_arg(va, int);
+ _globals->gfxManager()._font._colors.background = bgColor;
+ if (!bgColor)
_globals->gfxManager().setFillFlag(false);
break;
}
- case SET_FG_COLOUR:
- // Set the foreground colour
- _globals->_sceneText._colour1 = va_arg(va, int);
- _globals->gfxManager()._font._colours.foreground = _globals->_sceneText._colour1;
+ case SET_FG_COLOR:
+ // Set the foreground color
+ _globals->_sceneText._color1 = va_arg(va, int);
+ _globals->gfxManager()._font._colors.foreground = _globals->_sceneText._color1;
break;
case SET_KEEP_ONSCREEN:
// Suppresses immediate display
keepOnscreen = va_arg(va, int) != 0;
break;
- case SET_EXT_BGCOLOUR: {
- // Set secondary bg colour
+ case SET_EXT_BGCOLOR: {
+ // Set secondary bg color
int v = va_arg(va, int);
- _globals->_sceneText._colour2 = v;
- _globals->gfxManager()._font._colours2.background = v;
+ _globals->_sceneText._color2 = v;
+ _globals->gfxManager()._font._colors2.background = v;
break;
}
- case SET_EXT_FGCOLOUR: {
- // Set secondary fg colour
+ case SET_EXT_FGCOLOR: {
+ // Set secondary fg color
int v = va_arg(va, int);
- _globals->_sceneText._colour3 = v;
- _globals->gfxManager()._font._colours.foreground = v;
+ _globals->_sceneText._color3 = v;
+ _globals->gfxManager()._font._colors.foreground = v;
break;
}
case SET_POS_MODE:
// Set whether a custom x/y is used
- centreText = va_arg(va, int) != 0;
+ centerText = va_arg(va, int) != 0;
break;
case SET_TEXT_MODE:
// Set the text mode
@@ -1565,17 +1514,17 @@ void SceneItem::display(int resNum, int lineNum, ...) {
if (resNum) {
// Get required bounding size
_globals->gfxManager().getStringBounds(msg.c_str(), textRect, maxWidth);
- textRect.centre(pos.x, pos.y);
+ textRect.center(pos.x, pos.y);
textRect.contain(_globals->gfxManager()._bounds);
- if (centreText) {
- _globals->_sceneText._colour1 = _globals->_sceneText._colour2;
- _globals->_sceneText._colour2 = 0;
- _globals->_sceneText._colour3 = 0;
+ if (centerText) {
+ _globals->_sceneText._color1 = _globals->_sceneText._color2;
+ _globals->_sceneText._color2 = 0;
+ _globals->_sceneText._color3 = 0;
}
_globals->_sceneText.setup(msg);
- if (centreText) {
+ if (centerText) {
_globals->_sceneText.setPosition(Common::Point(
_globals->_sceneManager._scene->_sceneBounds.left + textRect.left,
_globals->_sceneManager._scene->_sceneBounds.top + textRect.top), 0);
@@ -1583,7 +1532,7 @@ void SceneItem::display(int resNum, int lineNum, ...) {
_globals->_sceneText.setPosition(pos, 0);
}
- _globals->_sceneText.setPriority2(255);
+ _globals->_sceneText.fixPriority(255);
_globals->_sceneObjects->draw();
}
@@ -1607,18 +1556,18 @@ void SceneItem::display(int resNum, int lineNum, ...) {
void SceneHotspot::doAction(int action) {
switch ((int)action) {
case CURSOR_LOOK:
- display(1, 0, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ display(1, 0, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
break;
case CURSOR_USE:
- display(1, 5, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ display(1, 5, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
break;
case CURSOR_TALK:
- display(1, 15, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ display(1, 15, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
break;
case CURSOR_WALK:
break;
default:
- display(2, action, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ display(2, action, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
break;
}
}
@@ -1634,13 +1583,13 @@ void NamedHotspot::doAction(int action) {
if (_lookLineNum == -1)
SceneHotspot::doAction(action);
else
- SceneItem::display(_resnum, _lookLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display(_resnum, _lookLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
break;
case CURSOR_USE:
if (_useLineNum == -1)
SceneHotspot::doAction(action);
else
- SceneItem::display(_resnum, _useLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display(_resnum, _useLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
break;
default:
SceneHotspot::doAction(action);
@@ -1648,7 +1597,7 @@ void NamedHotspot::doAction(int action) {
}
}
-void NamedHotspot::setup(const int ys, const int xe, const int ye, const int xs, const int resnum, const int lookLineNum, const int useLineNum) {
+void NamedHotspot::setup(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;
@@ -1656,6 +1605,13 @@ void NamedHotspot::setup(const int ys, const int xe, const int ye, const int xs,
_globals->_sceneItems.addItems(this, NULL);
}
+void NamedHotspot::synchronize(Serializer &s) {
+ SceneHotspot::synchronize(s);
+ s.syncAsSint16LE(_resnum);
+ s.syncAsSint16LE(_lookLineNum);
+ s.syncAsSint16LE(_useLineNum);
+}
+
/*--------------------------------------------------------------------------*/
void SceneObjectWrapper::setSceneObject(SceneObject *so) {
@@ -1664,8 +1620,8 @@ void SceneObjectWrapper::setSceneObject(SceneObject *so) {
so->_flags |= OBJFLAG_PANES;
}
-void SceneObjectWrapper::synchronise(Serialiser &s) {
- EventHandler::synchronise(s);
+void SceneObjectWrapper::synchronize(Serializer &s) {
+ EventHandler::synchronize(s);
SYNC_POINTER(_sceneObject);
}
@@ -1727,7 +1683,7 @@ SceneObject::SceneObject() : SceneHotspot() {
_moveDiff.y = 3;
_numFrames = 10;
_numFrames = 10;
- _field7A = 10;
+ _moveRate = 10;
_regionBitList = 0;
_sceneRegionId = 0;
_percent = 100;
@@ -1857,7 +1813,7 @@ void SceneObject::setPriority(int priority) {
}
}
-void SceneObject::setPriority2(int priority) {
+void SceneObject::fixPriority(int priority) {
if (priority == -1) {
_flags &= ~OBJFLAG_FIXED_PRIORITY;
} else {
@@ -1889,8 +1845,8 @@ void SceneObject::addMover(ObjectMover *mover, ...) {
if (mover) {
// Set up the assigned mover
_walkStartFrame = _globals->_events.getFrameNumber();
- if (_field7A != 0)
- _walkStartFrame = 60 / _field7A;
+ if (_moveRate != 0)
+ _walkStartFrame = 60 / _moveRate;
// Signal the mover that movement is beginning
va_list va;
@@ -1943,7 +1899,7 @@ int SceneObject::checkRegion(const Common::Point &pt) {
}
newY -= _yDiff;
- SynchronisedList<SceneObject *>::iterator i;
+ SynchronizedList<SceneObject *>::iterator i;
for (i = _globals->_sceneObjects->begin(); (regionIndex == 0) && (i != _globals->_sceneObjects->end()); ++i) {
if ((*i) && ((*i)->_flags & OBJFLAG_CHECK_REGION)) {
int objYDiff = (*i)->_position.y - _yDiff;
@@ -2062,8 +2018,8 @@ int SceneObject::getSpliceArea(const SceneObject *obj) {
return (xd * xd + yd) / 2;
}
-void SceneObject::synchronise(Serialiser &s) {
- SceneHotspot::synchronise(s);
+void SceneObject::synchronize(Serializer &s) {
+ SceneHotspot::synchronize(s);
s.syncAsUint32LE(_updateStartFrame);
s.syncAsUint32LE(_walkStartFrame);
@@ -2074,8 +2030,8 @@ void SceneObject::synchronise(Serialiser &s) {
s.syncAsUint32LE(_flags);
s.syncAsSint16LE(_xs);
s.syncAsSint16LE(_xe);
- _paneRects[0].synchronise(s);
- _paneRects[1].synchronise(s);
+ _paneRects[0].synchronize(s);
+ _paneRects[1].synchronize(s);
s.syncAsSint32LE(_visage);
SYNC_POINTER(_objectWrapper);
s.syncAsSint32LE(_strip);
@@ -2088,7 +2044,7 @@ void SceneObject::synchronise(Serialiser &s) {
s.syncAsSint32LE(_regionIndex);
SYNC_POINTER(_mover);
s.syncAsSint16LE(_moveDiff.x); s.syncAsSint16LE(_moveDiff.y);
- s.syncAsSint32LE(_field7A);
+ s.syncAsSint32LE(_moveRate);
SYNC_POINTER(_endAction);
s.syncAsUint32LE(_regionBitList);
}
@@ -2111,7 +2067,7 @@ void SceneObject::postInit(SceneObjectList *OwnerList) {
_yDiff = 0;
_moveDiff.x = 5;
_moveDiff.y = 3;
- _field7A = 10;
+ _moveRate = 10;
_regionIndex = 0x40;
_numFrames = 10;
_regionBitList = 0;
@@ -2138,8 +2094,8 @@ void SceneObject::dispatch() {
_action->dispatch();
if (_mover && (_walkStartFrame <= currTime)) {
- if (_field7A) {
- int frameInc = 60 / _field7A;
+ if (_moveRate) {
+ int frameInc = 60 / _moveRate;
_walkStartFrame = currTime + frameInc;
}
_mover->dispatch();
@@ -2235,7 +2191,6 @@ void SceneObject::removeObject() {
_globals->_sceneObjects->remove(this);
if (_visage) {
- _vm->_memoryManager.deallocate(_visage);
_visage = 0;
}
@@ -2247,8 +2202,9 @@ void SceneObject::removeObject() {
_mover->remove();
_mover = NULL;
}
- if (_flags & 0x800)
- destroy();
+ if (_flags & OBJFLAG_CLONED)
+ // Cloned temporary object, so delete it
+ delete this;
}
GfxSurface SceneObject::getFrame() {
@@ -2301,7 +2257,7 @@ void SceneObject::setup(int visage, int stripFrameNum, int frameNum, int posX, i
setStrip(stripFrameNum);
setFrame(frameNum);
setPosition(Common::Point(posX, posY), 0);
- setPriority2(priority);
+ fixPriority(priority);
}
/*--------------------------------------------------------------------------*/
@@ -2368,7 +2324,7 @@ void SceneObjectList::draw() {
uint32 flagMask = (paneNum == 0) ? OBJFLAG_PANE_0 : OBJFLAG_PANE_1;
// Initial loop to set up object list and update object position, priority, and flags
- for (SynchronisedList<SceneObject *>::iterator i = _globals->_sceneObjects->begin();
+ for (SynchronizedList<SceneObject *>::iterator i = _globals->_sceneObjects->begin();
i != _globals->_sceneObjects->end(); ++i) {
SceneObject *obj = *i;
objList.push_back(obj);
@@ -2381,8 +2337,8 @@ void SceneObjectList::draw() {
// Handle updating object priority
if (!(obj->_flags & OBJFLAG_FIXED_PRIORITY)) {
- obj->_priority = MIN((int)obj->_position.y - 1,
- (int)_globals->_sceneManager._scene->_backgroundBounds.bottom);
+ obj->_priority = MIN((int)obj->_position.y,
+ (int)_globals->_sceneManager._scene->_backgroundBounds.bottom - 1);
}
if ((_globals->_paneRefreshFlag[paneNum] != 0) || !_globals->_paneRegions[paneNum].empty()) {
@@ -2522,7 +2478,7 @@ void SceneObjectList::activate() {
_globals->_sceneObjects_queue.push_front(this);
// Flag all the objects as modified
- SynchronisedList<SceneObject *>::iterator i;
+ SynchronizedList<SceneObject *>::iterator i;
for (i = begin(); i != end(); ++i) {
(*i)->_flags |= OBJFLAG_PANES;
}
@@ -2543,7 +2499,7 @@ void SceneObjectList::deactivate() {
_globals->_sceneObjects_queue.pop_front();
_globals->_sceneObjects = *_globals->_sceneObjects_queue.begin();
- SynchronisedList<SceneObject *>::iterator i;
+ SynchronizedList<SceneObject *>::iterator i;
for (i = objectList->begin(); i != objectList->end(); ++i) {
if (!((*i)->_flags & OBJFLAG_CLONED)) {
SceneObject *sceneObj = (*i)->clone();
@@ -2553,8 +2509,10 @@ void SceneObjectList::deactivate() {
}
}
-void SceneObjectList::synchronise(Serialiser &s) {
- _objList.synchronise(s);
+void SceneObjectList::synchronize(Serializer &s) {
+ if (s.getVersion() >= 2)
+ SavedObject::synchronize(s);
+ _objList.synchronize(s);
}
/*--------------------------------------------------------------------------*/
@@ -2563,8 +2521,8 @@ SceneText::SceneText() : SceneObject() {
_fontNumber = 2;
_width = 160;
_textMode = ALIGN_LEFT;
- _colour2 = 0;
- _colour3 = 0;
+ _color2 = 0;
+ _color3 = 0;
}
SceneText::~SceneText() {
@@ -2576,16 +2534,18 @@ void SceneText::setup(const Common::String &msg) {
Rect textRect;
gfxMan._font.setFontNumber(_fontNumber);
- gfxMan._font._colours.foreground = _colour1;
- gfxMan._font._colours2.background = _colour2;
- gfxMan._font._colours2.foreground = _colour3;
+ gfxMan._font._colors.foreground = _color1;
+ gfxMan._font._colors2.background = _color2;
+ gfxMan._font._colors2.foreground = _color3;
gfxMan.getStringBounds(msg.c_str(), textRect, _width);
+ _bounds.setWidth(textRect.width());
+ _bounds.setHeight(textRect.height());
// Set up a new blank surface to hold the text
_textSurface.create(textRect.width(), textRect.height());
- _textSurface._transColour = 0xff;
- _textSurface.fillRect(textRect, _textSurface._transColour);
+ _textSurface._transColor = 0xff;
+ _textSurface.fillRect(textRect, _textSurface._transColor);
// Write the text to the surface
gfxMan._bounds = textRect;
@@ -2596,14 +2556,14 @@ void SceneText::setup(const Common::String &msg) {
gfxMan.deactivate();
}
-void SceneText::synchronise(Serialiser &s) {
- SceneObject::synchronise(s);
+void SceneText::synchronize(Serializer &s) {
+ SceneObject::synchronize(s);
s.syncAsSint16LE(_fontNumber);
s.syncAsSint16LE(_width);
- s.syncAsSint16LE(_colour1);
- s.syncAsSint16LE(_colour2);
- s.syncAsSint16LE(_colour3);
+ s.syncAsSint16LE(_color1);
+ s.syncAsSint16LE(_color2);
+ s.syncAsSint16LE(_color3);
SYNC_ENUM(_textMode, TextAlign);
}
@@ -2638,7 +2598,7 @@ void Visage::setVisage(int resNum, int rlbNum) {
_resNum = resNum;
_rlbNum = rlbNum;
DEALLOCATE(_data);
- _data = _vm->_dataManager->getResource(RES_VISAGE, resNum, rlbNum);
+ _data = _resourceManager->getResource(RES_VISAGE, resNum, rlbNum);
assert(_data);
}
}
@@ -2654,7 +2614,7 @@ GfxSurface Visage::getFrame(int frameNum) {
if (frameNum > 0)
--frameNum;
- int offset = READ_UINT32(_data + 2 + frameNum * 4);
+ int offset = READ_LE_UINT32(_data + 2 + frameNum * 4);
byte *frameData = _data + offset;
return surfaceFromRes(frameData);
@@ -2666,6 +2626,12 @@ int Visage::getFrameCount() const {
/*--------------------------------------------------------------------------*/
+Player::Player(): SceneObject() {
+ _canWalk = false;
+ _uiEnabled = false;
+ _field8C = 0;
+}
+
void Player::postInit(SceneObjectList *OwnerList) {
SceneObject::postInit();
@@ -2715,8 +2681,8 @@ void Player::process(Event &event) {
}
}
-void Player::synchronise(Serialiser &s) {
- SceneObject::synchronise(s);
+void Player::synchronize(Serializer &s) {
+ SceneObject::synchronize(s);
s.syncAsByte(_canWalk);
s.syncAsByte(_uiEnabled);
@@ -2728,9 +2694,20 @@ void Player::synchronise(Serialiser &s) {
Region::Region(int resNum, int rlbNum, ResourceType ctlType) {
_regionId = rlbNum;
- byte *regionData = _vm->_dataManager->getResource(ctlType, resNum, rlbNum);
+ byte *regionData = _resourceManager->getResource(ctlType, resNum, rlbNum);
assert(regionData);
+ load(regionData);
+
+ DEALLOCATE(regionData);
+}
+
+Region::Region(int regionId, const byte *regionData) {
+ _regionId = regionId;
+ load(regionData);
+}
+
+void Region::load(const byte *regionData) {
// Set the region bounds
_bounds.top = READ_LE_UINT16(regionData + 6);
_bounds.left = READ_LE_UINT16(regionData + 8);
@@ -2753,8 +2730,6 @@ Region::Region(int resNum, int rlbNum, ResourceType ctlType) {
_ySlices.push_back(sliceSet);
}
-
- DEALLOCATE(regionData);
}
/**
@@ -2940,7 +2915,7 @@ void Region::uniteRect(const Rect &rect) {
void SceneRegions::load(int sceneNum) {
clear();
- byte *regionData = _vm->_dataManager->getResource(RES_CONTROL, sceneNum, 9999, true);
+ byte *regionData = _resourceManager->getResource(RES_CONTROL, sceneNum, 9999, true);
if (regionData) {
int regionCount = READ_LE_UINT16(regionData);
@@ -3202,9 +3177,20 @@ void WalkRegions::clear() {
void WalkRegions::load(int sceneNum) {
clear();
-
_resNum = sceneNum;
- byte *regionData = _vm->_dataManager->getResource(RES_WALKRGNS, sceneNum, 1, true);
+
+ if (_vm->getFeatures() & GF_ALT_REGIONS) {
+ loadRevised();
+ } else {
+ loadOriginal();
+ }
+}
+
+/**
+ * This version handles loading walk regions for Ringworld floppy version and Demo #1
+ */
+void WalkRegions::loadOriginal() {
+ byte *regionData = _resourceManager->getResource(RES_WALKRGNS, _resNum, 1, true);
if (!regionData) {
// No data, so return
_resNum = -1;
@@ -3215,7 +3201,7 @@ void WalkRegions::load(int sceneNum) {
int dataSize;
// Load the field 18 list
- dataP = _vm->_dataManager->getResource(RES_WALKRGNS, sceneNum, 2);
+ dataP = _resourceManager->getResource(RES_WALKRGNS, _resNum, 2);
dataSize = _vm->_memoryManager.getSize(dataP);
assert(dataSize % 10 == 0);
@@ -3229,7 +3215,7 @@ void WalkRegions::load(int sceneNum) {
DEALLOCATE(dataP);
// Load the idx list
- dataP = _vm->_dataManager->getResource(RES_WALKRGNS, sceneNum, 3);
+ dataP = _resourceManager->getResource(RES_WALKRGNS, _resNum, 3);
dataSize = _vm->_memoryManager.getSize(dataP);
assert(dataSize % 2 == 0);
@@ -3240,7 +3226,7 @@ void WalkRegions::load(int sceneNum) {
DEALLOCATE(dataP);
// Load the secondary idx list
- dataP = _vm->_dataManager->getResource(RES_WALKRGNS, sceneNum, 4);
+ dataP = _resourceManager->getResource(RES_WALKRGNS, _resNum, 4);
dataSize = _vm->_memoryManager.getSize(dataP);
assert(dataSize % 2 == 0);
@@ -3251,7 +3237,7 @@ void WalkRegions::load(int sceneNum) {
DEALLOCATE(dataP);
// Handle the loading of the actual regions themselves
- dataP = _vm->_dataManager->getResource(RES_WALKRGNS, sceneNum, 5);
+ dataP = _resourceManager->getResource(RES_WALKRGNS, _resNum, 5);
byte *pWalkRegion = regionData + 16;
byte *srcP = dataP;
@@ -3264,7 +3250,7 @@ void WalkRegions::load(int sceneNum) {
wr._idxListIndex = READ_LE_UINT32(pWalkRegion + 4);
wr._idxList2Index = READ_LE_UINT32(pWalkRegion + 8);
- // Region in the region data
+ // Read in the region data
int size = READ_LE_UINT16(srcP);
srcP += 2;
wr.loadRegion(srcP, size);
@@ -3278,13 +3264,81 @@ void WalkRegions::load(int sceneNum) {
}
/**
+ * This version handles loading walk regions for Ringworld CD version and Demo #2. Given it's the newer
+ * version, it may also be used by future game titles
+ */
+void WalkRegions::loadRevised() {
+ byte *regionData = _resourceManager->getResource(RES_WALKRGNS, _resNum, 2, true);
+ if (!regionData) {
+ // No data, so return
+ _resNum = -1;
+ return;
+ }
+
+ byte *data1P = regionData + READ_LE_UINT32(regionData);
+ byte *data2P = regionData + READ_LE_UINT32(regionData + 4);
+ byte *data3P = regionData + READ_LE_UINT32(regionData + 8);
+ byte *data4P = regionData + READ_LE_UINT32(regionData + 12);
+ byte *regionOffset = regionData + 16;
+ int dataSize;
+
+ // Load the field 18 list
+ dataSize = READ_LE_UINT32(regionData + 8) - READ_LE_UINT32(regionData + 4);
+ assert(dataSize % 10 == 0);
+
+ byte *p = data2P;
+ for (int idx = 0; idx < (dataSize / 10); ++idx, p += 10) {
+ WRField18 rec;
+ rec.load(p);
+ _field18.push_back(rec);
+ }
+
+ // Load the idx list
+ dataSize = READ_LE_UINT32(regionData + 12) - READ_LE_UINT32(regionData + 8);
+ assert(dataSize % 2 == 0);
+
+ p = data3P;
+ for (int idx = 0; idx < (dataSize / 2); ++idx, p += 2)
+ _idxList.push_back(READ_LE_UINT16(p));
+
+ // Load the secondary idx list
+ dataSize = READ_LE_UINT32(regionData + 16) - READ_LE_UINT32(regionData + 12);
+ assert(dataSize % 2 == 0);
+
+ p = data4P;
+ for (int idx = 0; idx < (dataSize / 2); ++idx, p += 2)
+ _idxList2.push_back(READ_LE_UINT16(p));
+
+ // Handle the loading of the actual regions themselves
+ byte *pWalkRegion = data1P + 16;
+ for (; (int16)READ_LE_UINT16(pWalkRegion) != -20000; pWalkRegion += 16, regionOffset += 4) {
+ WalkRegion wr;
+ byte *srcP = regionData + READ_LE_UINT32(regionOffset);
+
+ // Set the Walk region specific fields
+ wr._pt.x = (int16)READ_LE_UINT16(pWalkRegion);
+ wr._pt.y = (int16)READ_LE_UINT16(pWalkRegion + 2);
+ wr._idxListIndex = READ_LE_UINT32(pWalkRegion + 4);
+ wr._idxList2Index = READ_LE_UINT32(pWalkRegion + 8);
+
+ // Read in the region data
+ wr._regionId = 0;
+ wr.load(srcP);
+
+ _regionList.push_back(wr);
+ }
+
+ DEALLOCATE(regionData);
+}
+
+/**
* Returns the index of the walk region that contains the given point
* @param pt Point to locate
* @param indexList List of region indexes that should be ignored
*/
int WalkRegions::indexOf(const Common::Point &pt, const Common::List<int> *indexList) {
for (uint idx = 0; idx < _regionList.size(); ++idx) {
- if ((!indexList || contains(*indexList, int(idx + 1))) && _regionList[idx].contains(pt))
+ if ((!indexList || !contains(*indexList, int(idx + 1))) && _regionList[idx].contains(pt))
return idx + 1;
}
@@ -3297,18 +3351,27 @@ void ScenePriorities::load(int resNum) {
_resNum = resNum;
clear();
- byte *regionData = _vm->_dataManager->getResource(RES_PRIORITY, resNum, 9999, true);
+ bool altMode = (_vm->getFeatures() & GF_ALT_REGIONS) != 0;
+ byte *regionData = _resourceManager->getResource(RES_PRIORITY, resNum, altMode ? 1 : 9999, true);
+ if (!regionData)
+ return;
- if (regionData) {
- int regionCount = READ_LE_UINT16(regionData);
- for (int regionCtr = 0; regionCtr < regionCount; ++regionCtr) {
+ int regionCount = READ_LE_UINT16(regionData);
+ for (int regionCtr = 0; regionCtr < regionCount; ++regionCtr) {
+ if (altMode) {
+ // Region data is embedded within the resource
+ uint16 regionId = READ_LE_UINT16(regionData + regionCtr * 6 + 2);
+ uint32 dataOffset = READ_LE_UINT32(regionData + regionCtr * 6 + 4);
+ push_back(Region(regionId, regionData + dataOffset));
+ } else {
+ // The data contains the index of another resource containing the region data
int rlbNum = READ_LE_UINT16(regionData + regionCtr * 6 + 2);
push_back(Region(resNum, rlbNum, RES_PRIORITY));
}
-
- DEALLOCATE(regionData);
}
+
+ DEALLOCATE(regionData);
}
Region *ScenePriorities::find(int priority) {
@@ -3319,7 +3382,7 @@ Region *ScenePriorities::find(int priority) {
if (priority > 255)
priority = 255;
- // Loop through the regions to find the closest for the givne priority level
+ // Loop through the regions to find the closest for the given priority level
int minRegionId = 9998;
Region *region = NULL;
for (ScenePriorities::iterator i = begin(); i != end(); ++i) {
@@ -3368,7 +3431,7 @@ GameHandler::GameHandler() : EventHandler() {
GameHandler::~GameHandler() {
if (_globals)
- _globals->_game.removeHandler(this);
+ _globals->_game->removeHandler(this);
}
void GameHandler::execute() {
@@ -3378,9 +3441,12 @@ void GameHandler::execute() {
}
}
-void GameHandler::synchronise(Serialiser &s) {
- _lockCtr.synchronise(s);
- _waitCtr.synchronise(s);
+void GameHandler::synchronize(Serializer &s) {
+ if (s.getVersion() >= 2)
+ EventHandler::synchronize(s);
+
+ _lockCtr.synchronize(s);
+ _waitCtr.synchronize(s);
s.syncAsSint16LE(_nextWaitCtr);
s.syncAsSint16LE(_field14);
}
@@ -3394,7 +3460,7 @@ SceneHandler::SceneHandler() {
void SceneHandler::registerHandler() {
postInit();
- _globals->_game.addHandler(this);
+ _globals->_game->addHandler(this);
}
void SceneHandler::postInit(SceneObjectList *OwnerList) {
@@ -3406,21 +3472,7 @@ void SceneHandler::postInit(SceneObjectList *OwnerList) {
// TODO: Bunch of other scene related setup goes here
_globals->_soundManager.postInit();
- // Set some default flags and cursor
- _globals->setFlag(12);
- _globals->setFlag(34);
- _globals->_events.setCursor(CURSOR_WALK);
-
- // Set the screen to scroll in response to the player moving off-screen
- _globals->_scrollFollower = &_globals->_player;
-
- // Set the object's that will be in the player's inventory by default
- _globals->_inventory._stunner._sceneNumber = 1;
- _globals->_inventory._scanner._sceneNumber = 1;
- _globals->_inventory._ring._sceneNumber = 1;
-
- // Switch to the title screen
- _globals->_sceneManager.setNewScene(1000);
+ _globals->_game->start();
}
void SceneHandler::process(Event &event) {
@@ -3429,8 +3481,7 @@ void SceneHandler::process(Event &event) {
switch (event.kbd.keycode) {
case Common::KEYCODE_F1:
// F1 - Help
- _globals->_events.setCursor(CURSOR_ARROW);
- MessageDialog::show(HELP_MSG, OK_BTN_STRING);
+ MessageDialog::show((_vm->getFeatures() & GF_DEMO) ? DEMO_HELP_MSG : HELP_MSG, OK_BTN_STRING);
break;
case Common::KEYCODE_F2: {
@@ -3444,19 +3495,19 @@ void SceneHandler::process(Event &event) {
case Common::KEYCODE_F3:
// F3 - Quit
- _globals->_game.quitGame();
+ _globals->_game->quitGame();
event.handled = false;
break;
case Common::KEYCODE_F4:
// F4 - Restart
- _globals->_game.restartGame();
+ _globals->_game->restartGame();
_globals->_events.setCursorFromFlag();
break;
case Common::KEYCODE_F7:
// F7 - Restore
- _globals->_game.restoreGame();
+ _globals->_game->restoreGame();
_globals->_events.setCursorFromFlag();
break;
@@ -3493,7 +3544,7 @@ void SceneHandler::process(Event &event) {
// Separate check for F5 - Save key
if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_F5)) {
// F5 - Save
- _globals->_game.saveGame();
+ _globals->_game->saveGame();
event.handled = true;
_globals->_events.setCursorFromFlag();
}
@@ -3510,7 +3561,7 @@ void SceneHandler::process(Event &event) {
if (_globals->_player._uiEnabled && (event.eventType == EVENT_BUTTON_DOWN) &&
!_globals->_sceneItems.empty()) {
// Scan the item list to find one the mouse is within
- SynchronisedList<SceneItem *>::iterator i = _globals->_sceneItems.begin();
+ SynchronizedList<SceneItem *>::iterator i = _globals->_sceneItems.begin();
while ((i != _globals->_sceneItems.end()) && !(*i)->contains(event.mousePos))
++i;
@@ -3540,7 +3591,10 @@ void SceneHandler::dispatch() {
if (_saveGameSlot != -1) {
int saveSlot = _saveGameSlot;
_saveGameSlot = -1;
- if (_saver->save(saveSlot, _saveName) != Common::kNoError)
+ Common::Error err = _saver->save(saveSlot, _saveName);
+ // FIXME: Make use of the description string in err to enhance
+ // the error reported to the user.
+ if (err.getCode() != Common::kNoError)
GUIErrorMessage(SAVE_ERROR_MSG);
}
if (_loadGameSlot != -1) {
@@ -3585,7 +3639,7 @@ void SceneHandler::dispatchObject(EventHandler *obj) {
obj->dispatch();
}
-void SceneHandler::saveListener(Serialiser &ser) {
+void SceneHandler::saveListener(Serializer &ser) {
warning("TODO: SceneHandler::saveListener");
}
@@ -3597,7 +3651,7 @@ void Game::execute() {
do {
// Process all currently atcive game handlers
activeFlag = false;
- for (SynchronisedList<GameHandler *>::iterator i = _handlers.begin(); i != _handlers.end(); ++i) {
+ for (SynchronizedList<GameHandler *>::iterator i = _handlers.begin(); i != _handlers.end(); ++i) {
GameHandler *gh = *i;
if (gh->_lockCtr.getCtr() == 0) {
gh->execute();
@@ -3607,129 +3661,4 @@ void Game::execute() {
} while (activeFlag && !_vm->getEventManager()->shouldQuit());
}
-void Game::restartGame() {
- if (MessageDialog::show(RESTART_MSG, CANCEL_BTN_STRING, RESTART_BTN_STRING) == 1)
- _globals->_game.restart();
-}
-
-void Game::saveGame() {
- if (_globals->getFlag(50))
- MessageDialog::show(SAVING_NOT_ALLOWED_MSG, OK_BTN_STRING);
- else {
- // Show the save dialog
- handleSaveLoad(true, _globals->_sceneHandler._saveGameSlot, _globals->_sceneHandler._saveName);
- }
-}
-
-void Game::restoreGame() {
- if (_globals->getFlag(50))
- MessageDialog::show(RESTORING_NOT_ALLOWED_MSG, OK_BTN_STRING);
- else {
- // Show the load dialog
- handleSaveLoad(false, _globals->_sceneHandler._loadGameSlot, _globals->_sceneHandler._saveName);
- }
-}
-
-void Game::quitGame() {
- if (MessageDialog::show(QUIT_CONFIRM_MSG, CANCEL_BTN_STRING, QUIT_BTN_STRING) == 1)
- _vm->quitGame();
-}
-
-void Game::handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) {
- const EnginePlugin *plugin = 0;
- EngineMan.findGame(_vm->getGameId(), &plugin);
- GUI::SaveLoadChooser *dialog;
- if (saveFlag)
- dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"));
- else
- dialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"));
-
- dialog->setSaveMode(saveFlag);
-
- saveSlot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
- saveName = dialog->getResultString();
-
- delete dialog;
-}
-
-void Game::restart() {
- _globals->_scenePalette.clearListeners();
- _globals->_soundHandler.proc3();
-
- // Reset the flags
- _globals->reset();
- _globals->setFlag(34);
-
- // Clear save/load slots
- _globals->_sceneHandler._saveGameSlot = -1;
- _globals->_sceneHandler._loadGameSlot = -1;
-
- _globals->_stripNum = 0;
- _globals->_events.setCursor(CURSOR_WALK);
-
- // Reset item properties
- _globals->_inventory._stunner._sceneNumber = 1;
- _globals->_inventory._scanner._sceneNumber = 1;
- _globals->_inventory._stasisBox._sceneNumber = 5200;
- _globals->_inventory._infoDisk._sceneNumber = 40;
- _globals->_inventory._stasisNegator._sceneNumber = 0;
- _globals->_inventory._keyDevice._sceneNumber = 0;
- _globals->_inventory._medkit._sceneNumber = 2280;
- _globals->_inventory._ladder._sceneNumber = 4100;
- _globals->_inventory._rope._sceneNumber = 4150;
- _globals->_inventory._key._sceneNumber = 7700;
- _globals->_inventory._translator._sceneNumber = 2150;
- _globals->_inventory._paper._sceneNumber = 7700;
- _globals->_inventory._waldos._sceneNumber = 0;
- _globals->_inventory._ring._sceneNumber = 1;
- _globals->_inventory._stasisBox2._sceneNumber = 8100;
- _globals->_inventory._cloak._sceneNumber = 9850;
- _globals->_inventory._tunic._sceneNumber = 9450;
- _globals->_inventory._candle._sceneNumber = 9500;
- _globals->_inventory._straw._sceneNumber = 9400;
- _globals->_inventory._scimitar._sceneNumber = 9850;
- _globals->_inventory._sword._sceneNumber = 9850;
- _globals->_inventory._helmet._sceneNumber = 9500;
- _globals->_inventory._items._sceneNumber = 4300;
- _globals->_inventory._concentrator._sceneNumber = 4300;
- _globals->_inventory._nullifier._sceneNumber = 4300;
- _globals->_inventory._peg._sceneNumber = 4045;
- _globals->_inventory._vial._sceneNumber = 5100;
- _globals->_inventory._jacket._sceneNumber = 9850;
- _globals->_inventory._tunic2._sceneNumber = 9850;
- _globals->_inventory._bone._sceneNumber = 5300;
- _globals->_inventory._jar._sceneNumber = 7700;
- _globals->_inventory._emptyJar._sceneNumber = 7700;
-
- // Change to the first game scene
- _globals->_sceneManager.changeScene(30);
-}
-
-void Game::endGame(int resNum, int lineNum) {
- _globals->_events.setCursor(CURSOR_WALK);
- Common::String msg = _vm->_dataManager->getMessage(resNum, lineNum);
- bool savesExist = _saver->savegamesExist();
-
- if (!savesExist) {
- // No savegames exist, so prompt the user to restart or quit
- if (MessageDialog::show(msg, QUIT_BTN_STRING, RESTART_BTN_STRING) == 0)
- _vm->quitGame();
- else
- restart();
- } else {
- // Savegames exist, so prompt for Restore/Restart
- bool breakFlag;
- do {
- if (MessageDialog::show(msg, RESTART_BTN_STRING, RESTORE_BTN_STRING) == 0) {
- breakFlag = true;
- } else {
- handleSaveLoad(false, _globals->_sceneHandler._loadGameSlot, _globals->_sceneHandler._saveName);
- breakFlag = _globals->_sceneHandler._loadGameSlot > 0;
- }
- } while (!breakFlag);
- }
-
- _globals->_events.setCursorFromFlag();
-}
-
} // End of namespace tSage
diff --git a/engines/tsage/core.h b/engines/tsage/core.h
index 77923606d1..001b478fc9 100644
--- a/engines/tsage/core.h
+++ b/engines/tsage/core.h
@@ -47,7 +47,7 @@ class SceneObject;
class SceneObjectList;
class ObjectMover;
class Action;
-class Serialiser;
+class Serializer;
class InvObject : public SavedObject {
public:
@@ -66,54 +66,20 @@ public:
void setCursor();
virtual Common::String getClassName() { return "InvObject"; }
- virtual void synchronise(Serialiser &s) {
+ virtual void synchronize(Serializer &s) {
s.syncAsUint16LE(_sceneNumber);
}
};
class InvObjectList : public SavedObject {
public:
- InvObject _stunner;
- InvObject _scanner;
- InvObject _stasisBox;
- InvObject _infoDisk;
- InvObject _stasisNegator;
- InvObject _keyDevice;
- InvObject _medkit;
- InvObject _ladder;
- InvObject _rope;
- InvObject _key;
- InvObject _translator;
- InvObject _ale;
- InvObject _paper;
- InvObject _waldos;
- InvObject _stasisBox2;
- InvObject _ring;
- InvObject _cloak;
- InvObject _tunic;
- InvObject _candle;
- InvObject _straw;
- InvObject _scimitar;
- InvObject _sword;
- InvObject _helmet;
- InvObject _items;
- InvObject _concentrator;
- InvObject _nullifier;
- InvObject _peg;
- InvObject _vial;
- InvObject _jacket;
- InvObject _tunic2;
- InvObject _bone;
- InvObject _jar;
- InvObject _emptyJar;
-
- SynchronisedList<InvObject *> _itemList;
+ SynchronizedList<InvObject *> _itemList;
InvObject *_selectedItem;
-public:
+
InvObjectList();
virtual Common::String getClassName() { return "InvObjectList"; }
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
};
/*--------------------------------------------------------------------------*/
@@ -139,7 +105,7 @@ public:
int incCtr() { return ++_ctr; }
int getCtr() const { return _ctr; }
- virtual void synchronise(Serialiser &s) { s.syncAsSint16LE(_ctr); }
+ virtual void synchronize(Serializer &s) { s.syncAsSint16LE(_ctr); }
};
class EventHandler : public SavedObject {
@@ -149,7 +115,7 @@ public:
EventHandler() : SavedObject() { _action = NULL; }
virtual ~EventHandler() { destroy(); }
- virtual void synchronise(Serialiser &s) { SYNC_POINTER(_action); }
+ virtual void synchronize(Serializer &s) { SYNC_POINTER(_action); }
virtual Common::String getClassName() { return "EventHandler"; }
virtual void postInit(SceneObjectList *OwnerList = NULL) {}
virtual void remove() {}
@@ -157,7 +123,7 @@ public:
virtual void process(Event &event) {}
virtual void dispatch();
virtual void setAction(Action *action) { setAction(action, NULL); }
- virtual void setAction(Action *action, EventHandler *fmt, ...);
+ virtual void setAction(Action *action, EventHandler *endHandler, ...);
virtual void destroy() {};
};
@@ -167,22 +133,22 @@ public:
int _actionIndex;
int _delayFrames;
uint32 _startFrame;
- int _field16;
- EventHandler *_fmt;
+ bool _attached;
+ EventHandler *_endHandler;
Action();
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual Common::String getClassName() { return "Action"; }
virtual void remove();
virtual void process(Event &event);
virtual void dispatch();
- virtual void attached(EventHandler *newOwner, EventHandler *fmt, va_list va);
+ virtual void attached(EventHandler *newOwner, EventHandler *endHandler, va_list va);
- void attach(EventHandler *newOwner, EventHandler *fmt, ...) {
+ void attach(EventHandler *newOwner, EventHandler *endHandler, ...) {
va_list va;
- va_start(va, fmt);
- attached(newOwner, fmt, va);
+ va_start(va, endHandler);
+ attached(newOwner, endHandler, va);
va_end(va);
}
int getActionIndex() const { return _actionIndex; }
@@ -202,14 +168,14 @@ public:
Common::Point _moveSign;
int _minorDiff;
int _majorDiff;
- int _field1A;
+ int _changeCtr;
Action *_action;
SceneObject *_sceneObject;
public:
ObjectMover() { _action = NULL; _sceneObject = NULL; }
virtual ~ObjectMover();
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual Common::String getClassName() { return "ObjectMover"; }
virtual void remove();
virtual void dispatch();
@@ -228,7 +194,7 @@ public:
ObjectMover2();
virtual ~ObjectMover2() {}
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual Common::String getClassName() { return "ObjectMover2"; }
virtual void dispatch();
virtual void startMove(SceneObject *sceneObj, va_list va);
@@ -278,7 +244,7 @@ public:
Common::Point _routeList[MAX_ROUTE_SIZE];
int _routeIndex;
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual Common::String getClassName() { return "PlayerMover"; }
virtual void startMove(SceneObject *sceneObj, va_list va);
virtual void endMove();
@@ -287,11 +253,11 @@ public:
class PlayerMover2 : public PlayerMover {
public:
SceneObject *_destObject;
- int _field7E;
+ int _maxArea;
int _minArea;
PlayerMover2() : PlayerMover() { _destObject = NULL; }
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual Common::String getClassName() { return "PlayerMover2"; }
virtual void dispatch();
virtual void startMove(SceneObject *sceneObj, va_list va);
@@ -309,7 +275,7 @@ public:
public:
PaletteModifier();
- virtual void synchronise(Serialiser &s) {
+ virtual void synchronize(Serializer &s) {
SYNC_POINTER(_scenePalette);
SYNC_POINTER(_action);
}
@@ -317,10 +283,21 @@ public:
virtual void remove() = 0;
};
-class PaletteRotation : public PaletteModifier {
+class PaletteModifierCached: public PaletteModifier {
+public:
+ byte _palette[256 * 3];
+ int _step;
+ int _percent;
+
+ PaletteModifierCached();
+
+ void setPalette(ScenePalette *palette, int step);
+ virtual Common::String getClassName() { return "PaletteModifierCached"; }
+ virtual void synchronize(Serializer &s);
+};
+
+class PaletteRotation: public PaletteModifierCached {
public:
- bool _disabled;
- int _delayFrames;
int _delayCtr;
uint32 _frameNumber;
int _currIndex;
@@ -328,53 +305,51 @@ public:
int _end;
int _rotationMode;
int _duration;
- RGB8 _palette[256];
public:
PaletteRotation();
virtual Common::String getClassName() { return "PaletteRotation"; }
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual void signal();
virtual void remove();
- void setDisabled(bool v) { _disabled = v; }
+ void setStep(int step) { _step = step; }
void set(ScenePalette *palette, int start, int end, int rotationMode, int duration, Action *action);
- void setPalette(ScenePalette *palette, bool disabled);
bool decDuration();
void setDelay(int amount);
};
-/*--------------------------------------------------------------------------*/
-
-class PaletteUnknown : public PaletteModifier {
+class PaletteFader: public PaletteModifierCached {
public:
- int _step, _percent, _field12, _field14;
- RGB8 _palette[256];
+ byte _palette[256 * 3];
public:
- virtual Common::String getClassName() { return "PaletteUnknown"; }
- virtual void synchronise(Serialiser &s);
+ virtual Common::String getClassName() { return "PaletteFader"; }
+ virtual void synchronize(Serializer &s);
virtual void signal();
virtual void remove();
};
+/*--------------------------------------------------------------------------*/
+
enum FadeMode {FADEMODE_NONE = 0, FADEMODE_GRADUAL = 1, FADEMODE_IMMEDIATE = 2};
class ScenePalette : public SavedObject {
public:
- RGB8 _palette[256];
- GfxColours _colours;
- SynchronisedList<PaletteModifier *> _listeners;
+ byte _palette[256 * 3];
+ GfxColors _colors;
+ SynchronizedList<PaletteModifier *> _listeners;
int _field412;
- uint8 _redColour;
- uint8 _greenColour;
- uint8 _blueColour;
- uint8 _aquaColour;
- uint8 _purpleColour;
- uint8 _limeColour;
+ uint8 _redColor;
+ uint8 _greenColor;
+ uint8 _blueColor;
+ uint8 _aquaColor;
+ uint8 _purpleColor;
+ uint8 _limeColor;
public:
ScenePalette();
ScenePalette(int paletteNum);
+ ~ScenePalette();
bool loadPalette(int paletteNum);
void refresh();
@@ -385,11 +360,11 @@ public:
void clearListeners();
void fade(const byte *adjustData, bool fullAdjust, int percent);
PaletteRotation *addRotation(int start, int end, int rotationMode, int duration = 0, Action *action = NULL);
- PaletteUnknown *addUnkPal(RGB8 *arrBufferRGB, int unkNumb, bool disabled, Action *action);
+ PaletteFader *addFader(const byte *arrBufferRGB, int palSize, int percent, Action *action);
static void changeBackground(const Rect &bounds, FadeMode fadeMode);
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual Common::String getClassName() { return "ScenePalette"; }
};
@@ -398,11 +373,11 @@ const int SET_WIDTH = 0;
const int SET_X = 1;
const int SET_Y = 2;
const int SET_FONT = 3;
-const int SET_BG_COLOUR = 4;
-const int SET_FG_COLOUR = 5;
+const int SET_BG_COLOR = 4;
+const int SET_FG_COLOR = 5;
const int SET_KEEP_ONSCREEN = 6;
-const int SET_EXT_BGCOLOUR = 7;
-const int SET_EXT_FGCOLOUR = 8;
+const int SET_EXT_BGCOLOR = 7;
+const int SET_EXT_FGCOLOR = 8;
const int SET_POS_MODE = 9;
const int SET_TEXT_MODE = 10;
const int LIST_END = -999;
@@ -418,7 +393,7 @@ public:
public:
SceneItem() : EventHandler() { _msg = "Feature"; _action = NULL; _sceneRegionId = 0; }
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual Common::String getClassName() { return "SceneItem"; }
virtual void remove();
virtual void destroy() {}
@@ -430,7 +405,7 @@ public:
void setBounds(const int ys, const int xe, const int ye, const int xs) { _bounds = Rect(MIN(xs, xe), MIN(ys, ye), MAX(xs, xe), MAX(ys, ye)); }
static void display(int resNum, int lineNum, ...);
static void display2(int resNum, int lineNum) {
- display(resNum, lineNum, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ display(resNum, lineNum, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
}
};
@@ -439,8 +414,8 @@ public:
int _state;
virtual Common::String getClassName() { return "SceneItemExt"; }
- virtual void synchronise(Serialiser &s) {
- SceneItem::synchronise(s);
+ virtual void synchronize(Serializer &s) {
+ SceneItem::synchronize(s);
s.syncAsSint16LE(_state);
}
};
@@ -458,9 +433,10 @@ public:
int _resnum, _lookLineNum, _useLineNum;
NamedHotspot() : SceneHotspot() {}
- void setup(const int ys, const int xe, const int ye, const int xs, const int resnum, const int lookLineNum, const int useLineNum);
+ void setup(int ys, int xs, int ye, int xe, const int resnum, const int lookLineNum, const int useLineNum);
virtual void doAction(int action);
virtual Common::String getClassName() { return "NamedHotspot"; }
+ virtual void synchronize(Serializer &s);
};
enum AnimateMode {ANIM_MODE_NONE = 0, ANIM_MODE_1 = 1, ANIM_MODE_2 = 2, ANIM_MODE_3 = 3,
@@ -496,7 +472,7 @@ public:
void setSceneObject(SceneObject *so);
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual Common::String getClassName() { return "SceneObjectWrapper"; }
virtual void remove();
virtual void dispatch();
@@ -538,7 +514,7 @@ public:
int _regionIndex;
EventHandler *_mover;
Common::Point _moveDiff;
- int _field7A;
+ int _moveRate;
Action *_endAction;
uint32 _regionBitList;
public:
@@ -555,7 +531,7 @@ public:
void setFrame(int frameNum);
void setFrame2(int frameNum);
void setPriority(int priority);
- void setPriority2(int priority);
+ void fixPriority(int priority);
void setVisage(int visage);
void setObjectWrapper(SceneObjectWrapper *objWrapper);
void addMover(ObjectMover *mover, ...);
@@ -570,7 +546,7 @@ public:
int getSpliceArea(const SceneObject *obj);
int getFrameCount();
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual Common::String getClassName() { return "SceneObject"; }
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void remove();
@@ -590,8 +566,8 @@ class SceneObjectExt : public SceneObject {
public:
int _state;
- virtual void synchronise(Serialiser &s) {
- SceneObject::synchronise(s);
+ virtual void synchronize(Serializer &s) {
+ SceneObject::synchronize(s);
s.syncAsSint16LE(_state);
}
virtual Common::String getClassName() { return "SceneObjectExt"; }
@@ -602,9 +578,9 @@ public:
int _fontNumber;
int _width;
TextAlign _textMode;
- int _colour1;
- int _colour2;
- int _colour3;
+ int _color1;
+ int _color2;
+ int _color3;
GfxSurface _textSurface;
public:
SceneText();
@@ -612,7 +588,7 @@ public:
void setup(const Common::String &msg);
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual Common::String getClassName() { return "SceneText"; }
virtual GfxSurface getFrame() { return _textSurface; }
};
@@ -623,10 +599,10 @@ public:
bool _uiEnabled;
int _field8C;
public:
- Player() : SceneObject() {}
+ Player();
virtual Common::String getClassName() { return "Player"; }
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void process(Event &event);
@@ -669,7 +645,9 @@ public:
public:
Region() { _regionSize = 0; _regionId = 0; }
Region(int resNum, int rlbNum, ResourceType ctlType = RES_CONTROL);
+ Region(int regionId, const byte *regionData);
+ void load(const byte *regionData);
bool contains(const Common::Point &pt);
bool empty() const;
void clear();
@@ -695,14 +673,14 @@ class SceneObjectList : public SavedObject {
private:
void checkIntersection(Common::Array<SceneObject *> &ObjList, uint ObjIndex, int PaneNum);
- SynchronisedList<SceneObject *> _objList;
+ SynchronizedList<SceneObject *> _objList;
bool _listAltered;
public:
SceneObjectList() { _listAltered = false; }
void sortList(Common::Array<SceneObject *> &ObjList);
virtual Common::String getClassName() { return "SceneObjectList"; }
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
void draw();
void activate();
@@ -712,14 +690,15 @@ public:
void recurse(EventHandlerFn Fn) {
// Loop through each object
_listAltered = false;
- for (SynchronisedList<SceneObject *>::iterator i = _objList.begin(); i != _objList.end() && !_listAltered; ) {
+ for (SynchronizedList<SceneObject *>::iterator i = _objList.begin(); i != _objList.end() && !_listAltered; ) {
SceneObject *o = *i;
++i;
Fn(o);
}
}
- SynchronisedList<SceneObject *>::iterator begin() { return _objList.begin(); }
- SynchronisedList<SceneObject *>::iterator end() { return _objList.end(); }
+ SynchronizedList<SceneObject *>::iterator begin() { return _objList.begin(); }
+ SynchronizedList<SceneObject *>::iterator end() { return _objList.end(); }
+ int size() const { return _objList.size(); }
bool contains(SceneObject *sceneObj) { return tSage::contains(_objList, sceneObj); }
void push_back(SceneObject *sceneObj) { _objList.push_back(sceneObj); }
void push_front(SceneObject *sceneObj) { _objList.push_front(sceneObj); }
@@ -811,7 +790,7 @@ public:
/*--------------------------------------------------------------------------*/
-class SceneItemList : public SynchronisedList<SceneItem *> {
+class SceneItemList : public SynchronizedList<SceneItem *> {
public:
void addItems(SceneItem *first, ...);
};
@@ -861,6 +840,9 @@ public:
};
class WalkRegions {
+private:
+ void loadOriginal();
+ void loadRevised();
public:
int _resNum;
RouteEnds _routeEnds;
@@ -905,7 +887,7 @@ public:
virtual ~GameHandler();
void execute();
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual Common::String getClassName() { return "GameHandler"; }
virtual void postInit(SceneObjectList *OwnerList = NULL) {}
virtual void dispatch() {}
@@ -927,28 +909,31 @@ public:
virtual void dispatch();
static void dispatchObject(EventHandler *obj);
- static void saveListener(Serialiser &ser);
+ static void saveListener(Serializer &ser);
};
/*--------------------------------------------------------------------------*/
class Game {
-private:
- SynchronisedList<GameHandler *> _handlers;
+protected:
+ SynchronizedList<GameHandler *> _handlers;
static bool notLockedFn(GameHandler *g);
- void restart();
- void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName);
+ virtual void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) {}
public:
+ virtual ~Game() {}
+
void addHandler(GameHandler *entry) { _handlers.push_back(entry); }
void removeHandler(GameHandler *entry) { _handlers.remove(entry); }
void execute();
- void restartGame();
- void saveGame();
- void restoreGame();
- void quitGame();
- void endGame(int resNum, int lineNum);
+ virtual void start() = 0;
+ virtual void restart() {}
+ virtual void restartGame() {}
+ virtual void saveGame() {}
+ virtual void restoreGame() {}
+ virtual void quitGame() {}
+ virtual void endGame(int resNum, int lineNum) {}
};
} // End of namespace tSage
diff --git a/engines/tsage/debugger.cpp b/engines/tsage/debugger.cpp
index d04fd71461..7944bad776 100644
--- a/engines/tsage/debugger.cpp
+++ b/engines/tsage/debugger.cpp
@@ -24,11 +24,9 @@
*/
#include "tsage/debugger.h"
-#include "common/config-manager.h"
-#include "common/endian.h"
#include "tsage/globals.h"
#include "tsage/graphics.h"
-
+#include "tsage/ringworld_logic.h"
namespace tSage {
@@ -37,7 +35,12 @@ Debugger::Debugger() : GUI::Debugger() {
DCmd_Register("scene", WRAP_METHOD(Debugger, Cmd_Scene));
DCmd_Register("walk_regions", WRAP_METHOD(Debugger, Cmd_WalkRegions));
DCmd_Register("priority_regions", WRAP_METHOD(Debugger, Cmd_PriorityRegions));
- DCmd_Register("item", WRAP_METHOD(Debugger, Cmd_Item));
+ DCmd_Register("setflag", WRAP_METHOD(Debugger, Cmd_SetFlag));
+ DCmd_Register("getflag", WRAP_METHOD(Debugger, Cmd_GetFlag));
+ DCmd_Register("clearflag", WRAP_METHOD(Debugger, Cmd_ClearFlag));
+ DCmd_Register("listobjects", WRAP_METHOD(Debugger, Cmd_ListObjects));
+ DCmd_Register("moveobject", WRAP_METHOD(Debugger, Cmd_MoveObject));
+ DCmd_Register("hotspots", WRAP_METHOD(Debugger, Cmd_Hotspots));
}
static int strToInt(const char *s) {
@@ -81,14 +84,16 @@ bool Debugger::Cmd_WalkRegions(int argc, const char **argv) {
return true;
}
- // Colour index to use for the first walk region
- int colour = 16;
+ // Color index to use for the first walk region
+ int color = 16;
// Lock the background surface for access
Graphics::Surface destSurface = _globals->_sceneManager._scene->_backSurface.lockSurface();
- // Loop through drawing each walk region in a different colour to the background surface
- for (uint regionIndex = 0; regionIndex < _globals->_walkRegions._regionList.size(); ++regionIndex, ++colour) {
+ // Loop through drawing each walk region in a different color to the background surface
+ Common::String regionsDesc;
+
+ for (uint regionIndex = 0; regionIndex < _globals->_walkRegions._regionList.size(); ++regionIndex, ++color) {
WalkRegion &wr = _globals->_walkRegions._regionList[regionIndex];
for (int yp = wr._bounds.top; yp < wr._bounds.bottom; ++yp) {
@@ -96,8 +101,11 @@ bool Debugger::Cmd_WalkRegions(int argc, const char **argv) {
for (uint idx = 0; idx < sliceSet.items.size(); ++idx)
destSurface.hLine(sliceSet.items[idx].xs - _globals->_sceneOffset.x, yp,
- sliceSet.items[idx].xe - _globals->_sceneOffset.x, colour);
+ sliceSet.items[idx].xe - _globals->_sceneOffset.x, color);
}
+
+ regionsDesc += Common::String::format("Region #%d d bounds=%d,%d,%d,%d\n",
+ regionIndex, wr._bounds.left, wr._bounds.top, wr._bounds.right, wr._bounds.bottom);
}
// Release the surface
@@ -106,6 +114,9 @@ bool Debugger::Cmd_WalkRegions(int argc, const char **argv) {
// Mark the scene as requiring a full redraw
_globals->_paneRefreshFlag[0] = 2;
+ DebugPrintf("Total regions = %d\n", _globals->_walkRegions._regionList.size());
+ DebugPrintf("%s\n", regionsDesc.c_str());
+
return false;
}
@@ -119,8 +130,8 @@ bool Debugger::Cmd_PriorityRegions(int argc, const char **argv) {
if (argc == 2)
regionNum = strToInt(argv[1]);
- // Colour index to use for the first priority region
- int colour = 16;
+ // Color index to use for the first priority region
+ int color = 16;
int count = 0;
// Lock the background surface for access
@@ -129,7 +140,7 @@ bool Debugger::Cmd_PriorityRegions(int argc, const char **argv) {
Common::List<Region>::iterator i = _globals->_sceneManager._scene->_priorities.begin();
Common::String regionsDesc;
- for (; i != _globals->_sceneManager._scene->_priorities.end(); ++i, ++colour, ++count) {
+ for (; i != _globals->_sceneManager._scene->_priorities.end(); ++i, ++color, ++count) {
Region &r = *i;
if ((regionNum == 0) || (regionNum == (count + 1))) {
@@ -139,7 +150,7 @@ bool Debugger::Cmd_PriorityRegions(int argc, const char **argv) {
for (int x = 0; x < destSurface.w; ++x) {
if (r.contains(Common::Point(_globals->_sceneManager._scene->_sceneBounds.left + x,
_globals->_sceneManager._scene->_sceneBounds.top + y)))
- *destP = colour;
+ *destP = color;
++destP;
}
}
@@ -161,12 +172,269 @@ bool Debugger::Cmd_PriorityRegions(int argc, const char **argv) {
return true;
}
-/**
- * Give a specified item to the player
+/*
+ * This command sets a flag
*/
-bool Debugger::Cmd_Item(int argc, const char **argv) {
- _globals->_inventory._infoDisk._sceneNumber = 1;
+bool Debugger::Cmd_SetFlag(int argc, const char **argv) {
+ // Check for a flag to set
+ if (argc != 2) {
+ DebugPrintf("Usage: %s <flag number>\n", argv[0]);
+ return true;
+ }
+
+ int flagNum = strToInt(argv[1]);
+ _globals->setFlag(flagNum);
return true;
}
+/*
+ * This command gets the value of a flag
+ */
+bool Debugger::Cmd_GetFlag(int argc, const char **argv) {
+ // Check for an flag to display
+ if (argc != 2) {
+ DebugPrintf("Usage: %s <flag number>\n", argv[0]);
+ return true;
+ }
+
+ int flagNum = strToInt(argv[1]);
+ DebugPrintf("Value: %d\n", _globals->getFlag(flagNum));
+ return true;
+}
+
+/*
+ * This command clears a flag
+ */
+bool Debugger::Cmd_ClearFlag(int argc, const char **argv) {
+ // Check for a flag to clear
+ if (argc != 2) {
+ DebugPrintf("Usage: %s <flag number>\n", argv[0]);
+ return true;
+ }
+
+ int flagNum = strToInt(argv[1]);
+ _globals->clearFlag(flagNum);
+ return true;
+}
+
+/*
+ * This command lists the objects available, and their ID
+ */
+bool Debugger::Cmd_ListObjects(int argc, const char **argv) {
+ if (argc != 1) {
+ DebugPrintf("Usage: %s\n", argv[0]);
+ return true;
+ }
+
+ DebugPrintf("Available objects for this game are:\n");
+ DebugPrintf("0 - Stunner\n");
+ DebugPrintf("1 - Scanner\n");
+ DebugPrintf("2 - Stasis Box\n");
+ DebugPrintf("3 - Info Disk\n");
+ DebugPrintf("4 - Stasis Negator\n");
+ DebugPrintf("5 - Key Device\n");
+ DebugPrintf("6 - Medkit\n");
+ DebugPrintf("7 - Ladder\n");
+ DebugPrintf("8 - Rope\n");
+ DebugPrintf("9 - Key\n");
+ DebugPrintf("10 - Translator\n");
+ DebugPrintf("11 - Ale\n");
+ DebugPrintf("12 - Paper\n");
+ DebugPrintf("13 - Waldos\n");
+ DebugPrintf("14 - Stasis Box 2\n");
+ DebugPrintf("15 - Ring\n");
+ DebugPrintf("16 - Cloak\n");
+ DebugPrintf("17 - Tunic\n");
+ DebugPrintf("18 - Candle\n");
+ DebugPrintf("19 - Straw\n");
+ DebugPrintf("20 - Scimitar\n");
+ DebugPrintf("21 - Sword\n");
+ DebugPrintf("22 - Helmet\n");
+ DebugPrintf("23 - Items\n");
+ DebugPrintf("24 - Concentrator\n");
+ DebugPrintf("25 - Nullifier\n");
+ DebugPrintf("26 - Peg\n");
+ DebugPrintf("27 - Vial\n");
+ DebugPrintf("28 - Jacket\n");
+ DebugPrintf("29 - Tunic 2\n");
+ DebugPrintf("30 - Bone\n");
+ DebugPrintf("31 - Empty Jar\n");
+ DebugPrintf("32 - Jar\n");
+ return true;
+}
+
+/*
+ * This command gets an item, or move it to a room
+ */
+bool Debugger::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]);
+
+ switch (objNum) {
+ case OBJECT_STUNNER:
+ RING_INVENTORY._stunner._sceneNumber = sceneNum;
+ break;
+ case OBJECT_SCANNER:
+ RING_INVENTORY._scanner._sceneNumber = sceneNum;
+ break;
+ case OBJECT_STASIS_BOX:
+ RING_INVENTORY._stasisBox._sceneNumber = sceneNum;
+ break;
+ case OBJECT_INFODISK:
+ RING_INVENTORY._infoDisk._sceneNumber = sceneNum;
+ break;
+ case OBJECT_STASIS_NEGATOR:
+ RING_INVENTORY._stasisNegator._sceneNumber = sceneNum;
+ break;
+ case OBJECT_KEY_DEVICE:
+ RING_INVENTORY._keyDevice._sceneNumber = sceneNum;
+ break;
+ case OBJECT_MEDKIT:
+ RING_INVENTORY._medkit._sceneNumber = sceneNum;
+ break;
+ case OBJECT_LADDER:
+ RING_INVENTORY._ladder._sceneNumber = sceneNum;
+ break;
+ case OBJECT_ROPE:
+ RING_INVENTORY._rope._sceneNumber = sceneNum;
+ break;
+ case OBJECT_KEY:
+ RING_INVENTORY._key._sceneNumber = sceneNum;
+ break;
+ case OBJECT_TRANSLATOR:
+ RING_INVENTORY._translator._sceneNumber = sceneNum;
+ break;
+ case OBJECT_ALE:
+ RING_INVENTORY._ale._sceneNumber = sceneNum;
+ break;
+ case OBJECT_PAPER:
+ RING_INVENTORY._paper._sceneNumber = sceneNum;
+ break;
+ case OBJECT_WALDOS:
+ RING_INVENTORY._waldos._sceneNumber = sceneNum;
+ break;
+ case OBJECT_STASIS_BOX2:
+ RING_INVENTORY._stasisBox2._sceneNumber = sceneNum;
+ break;
+ case OBJECT_RING:
+ RING_INVENTORY._ring._sceneNumber = sceneNum;
+ break;
+ case OBJECT_CLOAK:
+ RING_INVENTORY._cloak._sceneNumber = sceneNum;
+ break;
+ case OBJECT_TUNIC:
+ RING_INVENTORY._tunic._sceneNumber = sceneNum;
+ break;
+ case OBJECT_CANDLE:
+ RING_INVENTORY._candle._sceneNumber = sceneNum;
+ break;
+ case OBJECT_STRAW:
+ RING_INVENTORY._straw._sceneNumber = sceneNum;
+ break;
+ case OBJECT_SCIMITAR:
+ RING_INVENTORY._scimitar._sceneNumber = sceneNum;
+ break;
+ case OBJECT_SWORD:
+ RING_INVENTORY._sword._sceneNumber = sceneNum;
+ break;
+ case OBJECT_HELMET:
+ RING_INVENTORY._helmet._sceneNumber = sceneNum;
+ break;
+ case OBJECT_ITEMS:
+ RING_INVENTORY._items._sceneNumber = sceneNum;
+ break;
+ case OBJECT_CONCENTRATOR:
+ RING_INVENTORY._concentrator._sceneNumber = sceneNum;
+ break;
+ case OBJECT_NULLIFIER:
+ RING_INVENTORY._nullifier._sceneNumber = sceneNum;
+ break;
+ case OBJECT_PEG:
+ RING_INVENTORY._peg._sceneNumber = sceneNum;
+ break;
+ case OBJECT_VIAL:
+ RING_INVENTORY._vial._sceneNumber = sceneNum;
+ break;
+ case OBJECT_JACKET:
+ RING_INVENTORY._jacket._sceneNumber = sceneNum;
+ break;
+ case OBJECT_TUNIC2:
+ RING_INVENTORY._tunic2._sceneNumber = sceneNum;
+ break;
+ case OBJECT_BONE:
+ RING_INVENTORY._bone._sceneNumber = sceneNum;
+ break;
+ case OBJECT_EMPTY_JAR:
+ RING_INVENTORY._emptyJar._sceneNumber = sceneNum;
+ break;
+ case OBJECT_JAR:
+ RING_INVENTORY._jar._sceneNumber = sceneNum;
+ break;
+ default:
+ DebugPrintf("Invlid object Id %s\n", argv[1]);
+ }
+
+ 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 = _globals->_sceneManager._scene->_sceneBounds;
+
+ // Lock the background surface for access
+ Graphics::Surface destSurface = _globals->_sceneManager._scene->_backSurface.lockSurface();
+
+ // Iterate through the scene items
+ SynchronizedList<SceneItem *>::iterator i;
+ for (i = _globals->_sceneItems.reverse_begin(); i != _globals->_sceneItems.end(); --i, ++colIndex) {
+ SceneItem *o = *i;
+
+ // Draw the contents of the hotspot area
+ if (o->_sceneRegionId == 0) {
+ // Scene item doesn't use a region, so fill in the entire area
+ destSurface.fillRect(Rect(o->_bounds.left - sceneBounds.left, o->_bounds.top - sceneBounds.top,
+ o->_bounds.right - sceneBounds.left - 1, o->_bounds.bottom - sceneBounds.top - 1), colIndex);
+ } else {
+ // Scene uses a region, so get it and use it to fill out only the correct parts
+ SceneRegions::iterator ri = _globals->_sceneRegions.begin();
+ while ((ri != _globals->_sceneRegions.end()) && ((*ri)._regionId != o->_sceneRegionId))
+ ++ri;
+
+ if (ri != _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
+ _globals->_sceneManager._scene->_backSurface.unlockSurface();
+
+ // Mark the scene as requiring a full redraw
+ _globals->_paneRefreshFlag[0] = 2;
+
+ return false;
+}
+
+
} // End of namespace tSage
diff --git a/engines/tsage/debugger.h b/engines/tsage/debugger.h
index c94d77b2ab..eeb5bc86f6 100644
--- a/engines/tsage/debugger.h
+++ b/engines/tsage/debugger.h
@@ -40,7 +40,13 @@ protected:
bool Cmd_Scene(int argc, const char **argv);
bool Cmd_WalkRegions(int argc, const char **argv);
bool Cmd_PriorityRegions(int argc, const char **argv);
- bool Cmd_Item(int argc, const char **argv);
+ bool Cmd_SetFlag(int argc, const char **argv);
+ bool Cmd_GetFlag(int argc, const char **argv);
+ bool Cmd_ClearFlag(int argc, const char **argv);
+ bool Cmd_ListObjects(int argc, const char **argv);
+ bool Cmd_MoveObject(int argc, const char **argv);
+
+ bool Cmd_Hotspots(int argc, const char **argv);
};
} // End of namespace tSage
diff --git a/engines/tsage/detection.cpp b/engines/tsage/detection.cpp
index 371166d782..ba7b459304 100644
--- a/engines/tsage/detection.cpp
+++ b/engines/tsage/detection.cpp
@@ -54,6 +54,10 @@ uint32 TSageEngine::getFeatures() const {
return _gameDescription->features;
}
+Common::String TSageEngine::getPrimaryFilename() const {
+ return Common::String(_gameDescription->desc.filesDescriptions[0].fileName);
+}
+
} // End of namespace tSage
static const PlainGameDescriptor tSageGameTitles[] = {
@@ -122,16 +126,18 @@ public:
virtual SaveStateList listSaves(const char *target) const {
Common::String pattern = target;
- pattern += ".*";
+ pattern += ".???";
Common::StringArray filenames = g_system->getSavefileManager()->listSavefiles(pattern);
+ sort(filenames.begin(), filenames.end());
tSage::tSageSavegameHeader header;
SaveStateList saveList;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
- int slot;
const char *ext = strrchr(file->c_str(), '.');
- if (ext && (slot = atoi(ext + 1)) >= 0 && slot < MAX_SAVES) {
+ int slot = ext ? atoi(ext + 1) : -1;
+
+ if (slot >= 0 && slot < MAX_SAVES) {
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(*file);
if (in) {
diff --git a/engines/tsage/detection_tables.h b/engines/tsage/detection_tables.h
index f932c62367..d165900d55 100644
--- a/engines/tsage/detection_tables.h
+++ b/engines/tsage/detection_tables.h
@@ -39,7 +39,7 @@ static const tSageGameDescription gameDescriptions[] = {
Common::GUIO_NONE
},
GType_Ringworld,
- GF_CD
+ GF_CD | GF_ALT_REGIONS
},
// Ringworld First Wave English CD version
{
@@ -53,7 +53,7 @@ static const tSageGameDescription gameDescriptions[] = {
Common::GUIO_NONE
},
GType_Ringworld,
- GF_CD
+ GF_CD | GF_ALT_REGIONS
},
// Ringworld English Floppy version
{
@@ -69,6 +69,34 @@ static const tSageGameDescription gameDescriptions[] = {
GType_Ringworld,
GF_FLOPPY
},
+ // Ringworld English Floppy Demo #1 version
+ {
+ {
+ "ring",
+ "Floppy Demo",
+ AD_ENTRY1s("tsage.rlb", "bf4e8525d0cab84b08b57126092eeacd", 833453),
+ Common::EN_ANY,
+ Common::kPlatformPC,
+ ADGF_DEMO,
+ Common::GUIO_NONE
+ },
+ GType_Ringworld,
+ GF_FLOPPY | GF_DEMO
+ },
+ // Ringworld English Floppy Demo #2 version
+ {
+ {
+ "ring",
+ "Floppy Demo",
+ AD_ENTRY1s("demoring.rlb", "9ecf48e088a0d475778fab480b3dbdd0", 832206),
+ Common::EN_ANY,
+ Common::kPlatformPC,
+ ADGF_DEMO,
+ Common::GUIO_NONE
+ },
+ GType_Ringworld,
+ GF_FLOPPY | GF_DEMO | GF_ALT_REGIONS
+ },
// Blue Force
{
diff --git a/engines/tsage/dialogs.cpp b/engines/tsage/dialogs.cpp
index b76d60ac48..f8e35f74f9 100644
--- a/engines/tsage/dialogs.cpp
+++ b/engines/tsage/dialogs.cpp
@@ -24,13 +24,16 @@
*/
#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/graphics.h"
-#include "tsage/core.h"
#include "tsage/staticres.h"
#include "tsage/globals.h"
+#include "tsage/ringworld_logic.h"
namespace tSage {
@@ -64,23 +67,18 @@ MessageDialog::MessageDialog(const Common::String &message, const Common::String
// Do post setup for the dialog
setDefaults();
- // Set the dialog's centre
- setCentre(_globals->_dialogCentre.x, _globals->_dialogCentre.y);
+ // Set the dialog's center
+ setCenter(_globals->_dialogCenter.x, _globals->_dialogCenter.y);
}
int MessageDialog::show(const Common::String &message, const Common::String &btn1Message, const Common::String &btn2Message) {
// Ensure that the cursor is the arrow
- CursorType currentCursor = _globals->_events.getCursor();
- if (currentCursor != CURSOR_ARROW)
- _globals->_events.setCursor(CURSOR_ARROW);
+ _globals->_events.pushCursor(CURSOR_ARROW);
_globals->_events.showCursor();
int result = show2(message, btn1Message, btn2Message);
- // If the cursor was changed, change it back
- if (currentCursor != CURSOR_ARROW)
- _globals->_events.setCursor(currentCursor);
-
+ _globals->_events.popCursor();
return result;
}
@@ -95,7 +93,6 @@ int MessageDialog::show2(const Common::String &message, const Common::String &bt
return result;
}
-
/*--------------------------------------------------------------------------*/
ConfigDialog::ConfigDialog() : GUI::OptionsDialog("", "GlobalConfig") {
@@ -139,7 +136,7 @@ void RightClickButton::highlight() {
_savedButton = Surface_getArea(_globals->gfxManager().getSurface(), _bounds);
uint size;
- byte *imgData = _vm->_dataManager->getSubResource(7, 2, _buttonIndex, &size);
+ byte *imgData = _resourceManager->getSubResource(7, 2, _buttonIndex, &size);
GfxSurface btnSelected = surfaceFromRes(imgData);
_globals->gfxManager().copyFrom(btnSelected, _bounds.left, _bounds.top);
@@ -167,7 +164,7 @@ RightClickDialog::RightClickDialog() : GfxDialog(),
// Set the dialog position
dialogRect.resize(_surface, 0, 0, 100);
- dialogRect.centre(_globals->_events._mousePos.x, _globals->_events._mousePos.y);
+ dialogRect.center(_globals->_events._mousePos.x, _globals->_events._mousePos.y);
// Ensure the dialog will be entirely on-screen
Rect screenRect = _globals->gfxManager()._bounds;
@@ -379,36 +376,34 @@ bool GfxInvImage::process(Event &event) {
/*--------------------------------------------------------------------------*/
-void InventoryDialog::show(bool allFlag) {
- if (!allFlag) {
- // Determine how many items are in the player's inventory
- int itemCount = 0;
- SynchronisedList<InvObject *>::iterator i;
- for (i = _globals->_inventory._itemList.begin(); i != _globals->_inventory._itemList.end(); ++i) {
- if ((*i)->inInventory())
- ++itemCount;
- }
+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;
- }
+ if (itemCount == 0) {
+ MessageDialog::show(INV_EMPTY_MSG, OK_BTN_STRING);
+ return;
}
- InventoryDialog *dlg = new InventoryDialog(allFlag);
+ InventoryDialog *dlg = new InventoryDialog();
dlg->draw();
dlg->execute();
delete dlg;
}
-InventoryDialog::InventoryDialog(bool allFlag) {
+InventoryDialog::InventoryDialog() {
// Determine the maximum size of the image of any item in the player's inventory
int imgWidth = 0, imgHeight = 0;
- SynchronisedList<InvObject *>::iterator i;
- for (i = _globals->_inventory._itemList.begin(); i != _globals->_inventory._itemList.end(); ++i) {
+ SynchronizedList<InvObject *>::iterator i;
+ for (i = RING_INVENTORY._itemList.begin(); i != RING_INVENTORY._itemList.end(); ++i) {
InvObject *invObject = *i;
- if (allFlag || invObject->inInventory()) {
+ if (invObject->inInventory()) {
// Get the image for the item
GfxSurface itemSurface = surfaceFromRes(invObject->_displayResNum, invObject->_rlbNum, invObject->_cursorNum);
@@ -417,10 +412,11 @@ InventoryDialog::InventoryDialog(bool allFlag) {
imgHeight = MAX(imgHeight, (int)itemSurface.getBounds().height());
// Add the item to the display list
- _images.push_back(GfxInvImage());
- _images[_images.size() - 1].setDetails(invObject->_displayResNum, invObject->_rlbNum, invObject->_cursorNum);
- _images[_images.size() - 1]._invObject = invObject;
- add(&_images[_images.size() - 1]);
+ 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);
@@ -442,7 +438,7 @@ InventoryDialog::InventoryDialog(bool allFlag) {
cellX = 0;
}
- _images[idx]._bounds.moveTo(pt.x, pt.y);
+ _images[idx]->_bounds.moveTo(pt.x, pt.y);
pt.x += imgWidth + 2;
++cellX;
@@ -457,15 +453,21 @@ InventoryDialog::InventoryDialog(bool allFlag) {
addElements(&_btnLook, &_btnOk, NULL);
frame();
- setCentre(SCREEN_CENTRE_X, SCREEN_CENTRE_Y);
+ setCenter(SCREEN_CENTER_X, SCREEN_CENTER_Y);
+}
+
+InventoryDialog::~InventoryDialog() {
+ for (uint idx = 0; idx < _images.size(); ++idx)
+ delete _images[idx];
}
void InventoryDialog::execute() {
- if ((_globals->_inventory._selectedItem) && _globals->_inventory._selectedItem->inInventory())
- _globals->_inventory._selectedItem->setCursor();
+ if ((RING_INVENTORY._selectedItem) && RING_INVENTORY._selectedItem->inInventory())
+ RING_INVENTORY._selectedItem->setCursor();
GfxElement *hiliteObj;
bool lookFlag = false;
+ _gfxManager.activate();
while (!_vm->getEventManager()->shouldQuit()) {
// Get events
@@ -491,7 +493,7 @@ void InventoryDialog::execute() {
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;
+ //hiliteObj = &_btnOk;
break;
}
}
@@ -513,20 +515,20 @@ void InventoryDialog::execute() {
_globals->_events.setCursor(CURSOR_WALK);
}
- _gfxManager.activate();
hiliteObj->draw();
- _gfxManager.deactivate();
} else if (hiliteObj) {
// Inventory item selected
InvObject *invObject = static_cast<GfxInvImage *>(hiliteObj)->_invObject;
if (lookFlag) {
_globals->_screenSurface.displayText(invObject->_description);
} else {
- _globals->_inventory._selectedItem = invObject;
+ RING_INVENTORY._selectedItem = invObject;
invObject->setCursor();
}
}
}
+
+ _gfxManager.deactivate();
}
/*--------------------------------------------------------------------------*/
@@ -544,15 +546,15 @@ void OptionsDialog::show() {
}
} else if (btn == &dlg->_btnRestart) {
// Restart game
- _globals->_game.restartGame();
+ _globals->_game->restartGame();
} else if (btn == &dlg->_btnSound) {
// Sound dialog
} else if (btn == &dlg->_btnSave) {
// Save button
- _globals->_game.saveGame();
+ _globals->_game->saveGame();
} else if (btn == &dlg->_btnRestore) {
// Restore button
- _globals->_game.restoreGame();
+ _globals->_game->restoreGame();
}
dlg->remove();
@@ -591,7 +593,7 @@ OptionsDialog::OptionsDialog() {
// Set the dialog size and position
frame();
- setCentre(160, 100);
+ setCenter(160, 100);
}
diff --git a/engines/tsage/dialogs.h b/engines/tsage/dialogs.h
index 8e766372b4..c24fa2dd3b 100644
--- a/engines/tsage/dialogs.h
+++ b/engines/tsage/dialogs.h
@@ -105,14 +105,14 @@ public:
class InventoryDialog : public ModalDialog {
private:
- Common::Array<GfxInvImage> _images;
+ Common::Array<GfxInvImage *> _images;
GfxButton _btnOk, _btnLook;
public:
- InventoryDialog(bool allFlag = false);
- virtual ~InventoryDialog() {}
+ InventoryDialog();
+ virtual ~InventoryDialog();
void execute();
- static void show(bool allFlag = false);
+ static void show();
};
/*--------------------------------------------------------------------------*/
diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp
index 4d2a1cce8c..e51c5da479 100644
--- a/engines/tsage/events.cpp
+++ b/engines/tsage/events.cpp
@@ -38,6 +38,7 @@ namespace tSage {
EventsClass::EventsClass() {
_currentCursor = CURSOR_NONE;
+ hideCursor();
_frameNumber = 0;
_priorFrameTime = 0;
_prevDelayFrame = 0;
@@ -127,6 +128,9 @@ bool EventsClass::getEvent(Event &evt, int eventMask) {
return true;
}
+ evt.handled = false;
+ evt.eventType = EVENT_NONE;
+
return false;
}
@@ -154,27 +158,27 @@ void EventsClass::setCursor(CursorType cursorType) {
uint size;
switch (cursorType) {
- case CURSOR_CROSSHAIRS:
- // Crosshairs cursor
- cursor = _vm->_dataManager->getSubResource(4, 1, 6, &size);
+ case OBJECT_STUNNER:
+ // Stunner cursor
+ cursor = _resourceManager->getSubResource(4, 1, 6, &size);
_globals->setFlag(122);
break;
case CURSOR_LOOK:
// Look cursor
- cursor = _vm->_dataManager->getSubResource(4, 1, 5, &size);
+ cursor = _resourceManager->getSubResource(4, 1, 5, &size);
_currentCursor = CURSOR_LOOK;
break;
case CURSOR_USE:
// Use cursor
- cursor = _vm->_dataManager->getSubResource(4, 1, 4, &size);
+ cursor = _resourceManager->getSubResource(4, 1, 4, &size);
_currentCursor = CURSOR_USE;
break;
case CURSOR_TALK:
// Talk cursor
- cursor = _vm->_dataManager->getSubResource(4, 1, 3, &size);
+ cursor = _resourceManager->getSubResource(4, 1, 3, &size);
_currentCursor = CURSOR_TALK;
break;
@@ -198,16 +202,72 @@ void EventsClass::setCursor(CursorType cursorType) {
Graphics::Surface surface = s.lockSurface();
const byte *cursorData = (const byte *)surface.getBasePtr(0, 0);
- CursorMan.replaceCursor(cursorData, surface.w, surface.h, s._centroid.x, s._centroid.y, s._transColour);
+ CursorMan.replaceCursor(cursorData, surface.w, surface.h, s._centroid.x, s._centroid.y, s._transColor);
s.unlockSurface();
if (delFlag)
DEALLOCATE(cursor);
}
-void EventsClass::setCursor(Graphics::Surface &cursor, int transColour, const Common::Point &hotspot, CursorType cursorId) {
+void EventsClass::pushCursor(CursorType cursorType) {
+ const byte *cursor;
+ bool delFlag = true;
+ uint size;
+
+ switch (cursorType) {
+ case CURSOR_CROSSHAIRS:
+ // Crosshairs cursor
+ cursor = _resourceManager->getSubResource(4, 1, 6, &size);
+ break;
+
+ case CURSOR_LOOK:
+ // Look cursor
+ cursor = _resourceManager->getSubResource(4, 1, 5, &size);
+ break;
+
+ case CURSOR_USE:
+ // Use cursor
+ cursor = _resourceManager->getSubResource(4, 1, 4, &size);
+ break;
+
+ case CURSOR_TALK:
+ // Talk cursor
+ cursor = _resourceManager->getSubResource(4, 1, 3, &size);
+ break;
+
+ case CURSOR_ARROW:
+ // Arrow cursor
+ cursor = CURSOR_ARROW_DATA;
+ delFlag = false;
+ break;
+
+ case CURSOR_WALK:
+ default:
+ // Walk cursor
+ cursor = CURSOR_WALK_DATA;
+ delFlag = false;
+ break;
+ }
+
+ // Decode the cursor
+ GfxSurface s = surfaceFromRes(cursor);
+
+ Graphics::Surface surface = s.lockSurface();
+ const byte *cursorData = (const byte *)surface.getBasePtr(0, 0);
+ CursorMan.pushCursor(cursorData, surface.w, surface.h, s._centroid.x, s._centroid.y, s._transColor);
+ s.unlockSurface();
+
+ if (delFlag)
+ DEALLOCATE(cursor);
+}
+
+void EventsClass::popCursor() {
+ CursorMan.popCursor();
+}
+
+void EventsClass::setCursor(Graphics::Surface &cursor, int transColor, const Common::Point &hotspot, CursorType cursorId) {
const byte *cursorData = (const byte *)cursor.getBasePtr(0, 0);
- CursorMan.replaceCursor(cursorData, cursor.w, cursor.h, hotspot.x, hotspot.y, transColour);
+ CursorMan.replaceCursor(cursorData, cursor.w, cursor.h, hotspot.x, hotspot.y, transColor);
_currentCursor = cursorId;
}
@@ -224,6 +284,10 @@ void EventsClass::hideCursor() {
CursorMan.showMouse(false);
}
+bool EventsClass::isCursorVisible() const {
+ return CursorMan.isVisible();
+}
+
/**
* Delays the game for the specified number of frames, if necessary, from the
* previous time the delay method was called
diff --git a/engines/tsage/events.h b/engines/tsage/events.h
index 202ac9ccd2..d2dbd9e058 100644
--- a/engines/tsage/events.h
+++ b/engines/tsage/events.h
@@ -82,11 +82,14 @@ public:
CursorType _currentCursor;
void setCursor(CursorType cursorType);
- void setCursor(Graphics::Surface &cursor, int transColour, const Common::Point &hotspot, CursorType cursorId);
+ void pushCursor(CursorType cursorType);
+ void popCursor();
+ void setCursor(Graphics::Surface &cursor, int transColor, const Common::Point &hotspot, CursorType cursorId);
void setCursorFromFlag();
CursorType getCursor() const { return _currentCursor; }
void showCursor();
void hideCursor();
+ bool isCursorVisible() const;
bool pollEvent();
void waitForPress(int eventMask = EVENT_BUTTON_DOWN | EVENT_KEYPRESS);
@@ -97,10 +100,10 @@ public:
uint32 getFrameNumber() const { return _frameNumber; }
void delay(int numFrames);
- virtual void listenerSynchronise(Serialiser &s) {
+ virtual void listenerSynchronize(Serializer &s) {
s.syncAsUint32LE(_frameNumber);
s.syncAsUint32LE(_prevDelayFrame);
- // TODO: Synchronise unknown stuff
+ // TODO: Synchronize unknown stuff
}
};
diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp
index b9abb9d751..c6e1344714 100644
--- a/engines/tsage/globals.cpp
+++ b/engines/tsage/globals.cpp
@@ -24,10 +24,13 @@
*/
#include "tsage/globals.h"
+#include "tsage/tsage.h"
+#include "tsage/ringworld_logic.h"
namespace tSage {
Globals *_globals = NULL;
+ResourceManager *_resourceManager = NULL;
/*--------------------------------------------------------------------------*/
@@ -40,23 +43,34 @@ static SavedObject *classFactoryProc(const Common::String &className) {
if (className == "ObjectMover2") return new ObjectMover2();
if (className == "ObjectMover3") return new ObjectMover3();
if (className == "PlayerMover") return new PlayerMover();
-
+ if (className == "SceneObjectWrapper") return new SceneObjectWrapper();
+ if (className == "PaletteRotation") return new PaletteRotation();
+ if (className == "PaletteFader") return new PaletteFader();
return NULL;
}
/*--------------------------------------------------------------------------*/
Globals::Globals() :
- _dialogCentre(160, 140),
+ _dialogCenter(160, 140),
_gfxManagerInstance(_screenSurface) {
reset();
_stripNum = 0;
- _gfxFontNumber = 50;
- _gfxColours.background = 53;
- _gfxColours.foreground = 18;
- _fontColours.background = 51;
- _fontColours.foreground = 54;
+ if (_vm->getFeatures() & GF_DEMO) {
+ _gfxFontNumber = 0;
+ _gfxColors.background = 6;
+ _gfxColors.foreground = 0;
+ _fontColors.background = 0;
+ _fontColors.foreground = 0;
+ _dialogCenter.y = 80;
+ } else {
+ _gfxFontNumber = 50;
+ _gfxColors.background = 53;
+ _gfxColors.foreground = 18;
+ _fontColors.background = 51;
+ _fontColors.foreground = 54;
+ }
_screenSurface.setScreenSurface();
_gfxManagers.push_back(&_gfxManagerInstance);
@@ -66,10 +80,22 @@ Globals::Globals() :
_prevSceneOffset = Common::Point(-1, -1);
_sceneListeners.push_back(&_soundHandler);
_sceneListeners.push_back(&_sequenceManager._soundHandler);
+
+ _scrollFollower = NULL;
+ _inventory = NULL;
+
+ if (!(_vm->getFeatures() & GF_DEMO)) {
+ _inventory = new RingworldInvObjectList();
+ _game = new RingworldGame();
+ } else {
+ _game = new RingworldDemoGame();
+ }
}
Globals::~Globals() {
_globals = NULL;
+ delete _inventory;
+ delete _game;
}
void Globals::reset() {
@@ -77,20 +103,22 @@ void Globals::reset() {
_saver->addFactory(classFactoryProc);
}
-void Globals::synchronise(Serialiser &s) {
+void Globals::synchronize(Serializer &s) {
+ if (s.getVersion() >= 2)
+ SavedObject::synchronize(s);
assert(_gfxManagers.size() == 1);
- _sceneItems.synchronise(s);
+ _sceneItems.synchronize(s);
SYNC_POINTER(_sceneObjects);
- _sceneObjects_queue.synchronise(s);
+ _sceneObjects_queue.synchronize(s);
s.syncAsSint32LE(_gfxFontNumber);
- s.syncAsSint32LE(_gfxColours.background);
- s.syncAsSint32LE(_gfxColours.foreground);
- s.syncAsSint32LE(_fontColours.background);
- s.syncAsSint32LE(_fontColours.foreground);
+ s.syncAsSint32LE(_gfxColors.background);
+ s.syncAsSint32LE(_gfxColors.foreground);
+ s.syncAsSint32LE(_fontColors.background);
+ s.syncAsSint32LE(_fontColors.foreground);
- s.syncAsSint16LE(_dialogCentre.x); s.syncAsSint16LE(_dialogCentre.y);
- _sceneListeners.synchronise(s);
+ s.syncAsSint16LE(_dialogCenter.x); s.syncAsSint16LE(_dialogCenter.y);
+ _sceneListeners.synchronize(s);
for (int i = 0; i < 256; ++i)
s.syncAsByte(_flags[i]);
diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h
index 59afe140a0..3a6fab5b70 100644
--- a/engines/tsage/globals.h
+++ b/engines/tsage/globals.h
@@ -41,7 +41,7 @@ public:
GfxManager _gfxManagerInstance;
Common::List<GfxManager *> _gfxManagers;
SceneHandler _sceneHandler;
- Game _game;
+ Game *_game;
EventsClass _events;
SceneManager _sceneManager;
ScenePalette _scenePalette;
@@ -49,19 +49,19 @@ public:
SceneItemList _sceneItems;
SceneObjectList _sceneObjectsInstance;
SceneObjectList *_sceneObjects;
- SynchronisedList<SceneObjectList *> _sceneObjects_queue;
+ SynchronizedList<SceneObjectList *> _sceneObjects_queue;
SceneText _sceneText;
int _gfxFontNumber;
- GfxColours _gfxColours;
- GfxColours _fontColours;
+ GfxColors _gfxColors;
+ GfxColors _fontColors;
SoundManager _soundManager;
- Common::Point _dialogCentre;
+ Common::Point _dialogCenter;
WalkRegions _walkRegions;
- SynchronisedList<EventHandler *> _sceneListeners;
+ SynchronizedList<EventHandler *> _sceneListeners;
bool _flags[256];
Player _player;
SoundHandler _soundHandler;
- InvObjectList _inventory;
+ InvObjectList *_inventory;
Region _paneRegions[2];
int _paneRefreshFlag[2];
Common::Point _sceneOffset;
@@ -90,11 +90,15 @@ public:
GfxManager &gfxManager() { return **_gfxManagers.begin(); }
virtual Common::String getClassName() { return "Globals"; }
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
};
extern Globals *_globals;
+// Note: Currently this can't be part of the _globals structure, since it needs to be constructed
+// prior to many of the fields in Globals execute their constructors
+extern ResourceManager *_resourceManager;
+
} // End of namespace tSage
#endif
diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp
index 641e10b3e9..c50da6beef 100644
--- a/engines/tsage/graphics.cpp
+++ b/engines/tsage/graphics.cpp
@@ -29,6 +29,7 @@
#include "tsage/tsage.h"
#include "tsage/core.h"
#include "common/algorithm.h"
+#include "graphics/palette.h"
#include "graphics/surface.h"
#include "tsage/globals.h"
@@ -72,7 +73,7 @@ GfxSurface surfaceFromRes(const byte *imgData) {
s.create(r.width(), r.height());
s._centroid.x = READ_LE_UINT16(imgData + 4);
s._centroid.y = READ_LE_UINT16(imgData + 6);
- s._transColour = *(imgData + 8);
+ s._transColor = *(imgData + 8);
bool rleEncoded = (imgData[9] & 2) != 0;
@@ -83,7 +84,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._transColour);
+ Common::set_to(destP, destP + (r.width() * r.height()), s._transColor);
for (int yp = 0; yp < r.height(); ++yp) {
int width = r.width();
@@ -122,7 +123,7 @@ GfxSurface surfaceFromRes(const byte *imgData) {
GfxSurface surfaceFromRes(int resNum, int rlbNum, int subNum) {
uint size;
- byte *imgData = _vm->_dataManager->getSubResource(resNum, rlbNum, subNum, &size);
+ byte *imgData = _resourceManager->getSubResource(resNum, rlbNum, subNum, &size);
GfxSurface surface = surfaceFromRes(imgData);
DEALLOCATE(imgData);
@@ -147,22 +148,22 @@ void Rect::collapse(int dx, int dy) {
}
/**
- * Centres the rectangle at a given position
+ * Centers the rectangle at a given position
*
- * @xp x position for new centre
- * @yp y position for new centre
+ * @xp x position for new center
+ * @yp y position for new center
*/
-void Rect::centre(int xp, int yp) {
+void Rect::center(int xp, int yp) {
moveTo(xp - (width() / 2), yp - (height() / 2));
}
/**
- * Centres the rectangle at the centre of a second passed rectangle
+ * Centers the rectangle at the center of a second passed rectangle
*
- * @r Second rectangle whose centre to use
+ * @r Second rectangle whose center to use
*/
-void Rect::centre(const Rect &r) {
- centre(r.left + (r.width() / 2), r.top + (r.height() / 2));
+void Rect::center(const Rect &r) {
+ center(r.left + (r.width() / 2), r.top + (r.height() / 2));
}
/*
@@ -211,7 +212,7 @@ void Rect::expandPanes() {
/**
* Serialises the given rect
*/
-void Rect::synchronise(Serialiser &s) {
+void Rect::synchronize(Serializer &s) {
s.syncAsSint16LE(left);
s.syncAsSint16LE(top);
s.syncAsSint16LE(right);
@@ -226,6 +227,7 @@ GfxSurface::GfxSurface() : _bounds(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) {
_lockSurfaceCtr = 0;
_customSurface = NULL;
_screenSurfaceP = NULL;
+ _transColor = -1;
}
GfxSurface::GfxSurface(const GfxSurface &s) {
@@ -256,8 +258,13 @@ void GfxSurface::setScreenSurface() {
void GfxSurface::create(int width, int height) {
assert((width >= 0) && (height >= 0));
_screenSurface = false;
+ if (_customSurface) {
+ _customSurface->free();
+ delete _customSurface;
+ }
_customSurface = new Graphics::Surface();
- _customSurface->create(width, height, 1);
+ _customSurface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
+ Common::set_to((byte *)_customSurface->pixels, (byte *)_customSurface->pixels + (width * height), 0);
_bounds = Rect(0, 0, width, height);
}
@@ -282,7 +289,7 @@ Graphics::Surface GfxSurface::lockSurface() {
result.w = _bounds.width();
result.h = _bounds.height();
result.pitch = src->pitch;
- result.bytesPerPixel = src->bytesPerPixel;
+ result.format = src->format;
result.pixels = src->getBasePtr(_bounds.left, _bounds.top);
return result;
@@ -301,14 +308,14 @@ void GfxSurface::unlockSurface() {
}
/**
- * Fills a specified rectangle on the surface with the specified colour
+ * Fills a specified rectangle on the surface with the specified color
*
* @bounds Area to fill
- * @colour Colour to use
+ * @color Color to use
*/
-void GfxSurface::fillRect(const Rect &bounds, int colour) {
+void GfxSurface::fillRect(const Rect &bounds, int color) {
Graphics::Surface surface = lockSurface();
- surface.fillRect(bounds, colour);
+ surface.fillRect(bounds, color);
unlockSurface();
}
@@ -326,12 +333,12 @@ GfxSurface &GfxSurface::operator=(const GfxSurface &s) {
_disableUpdates = s._disableUpdates;
_bounds = s._bounds;
_centroid = s._centroid;
- _transColour = s._transColour;
+ _transColor = s._transColor;
if (_customSurface) {
// Surface owns the internal data, so replicate it so new surface owns it's own
_customSurface = new Graphics::Surface();
- _customSurface->create(s._customSurface->w, s._customSurface->h, 1);
+ _customSurface->create(s._customSurface->w, s._customSurface->h, Graphics::PixelFormat::createFormatCLUT8());
const byte *srcP = (const byte *)s._customSurface->getBasePtr(0, 0);
byte *destP = (byte *)_customSurface->getBasePtr(0, 0);
@@ -348,14 +355,14 @@ bool GfxSurface::displayText(const Common::String &msg, const Common::Point &pt)
// Set up a new graphics manager
GfxManager gfxManager;
gfxManager.activate();
- gfxManager._font._colours.background = 0;
- gfxManager._font._colours.foreground = 7;
+ gfxManager._font._colors.background = 0;
+ gfxManager._font._colors.foreground = 7;
gfxManager._font.setFontNumber(2);
// Get the area for text display
Rect textRect;
gfxManager.getStringBounds(msg.c_str(), textRect, 200);
- textRect.centre(pt.x, pt.y);
+ textRect.center(pt.x, pt.y);
// Make a backup copy of the area the text will occupy
Rect saveRect = textRect;
@@ -390,7 +397,7 @@ void GfxSurface::loadScreenSection(Graphics::Surface &dest, int xHalf, int yHalf
if (xSection < xHalfCount && ySection < yHalfCount) {
int rlbNum = xSection * yHalfCount + ySection;
- byte *data = _vm->_dataManager->getResource(RES_BITMAP, screenNum, rlbNum);
+ byte *data = _resourceManager->getResource(RES_BITMAP, screenNum, rlbNum);
for (int y = 0; y < updateRect.height(); ++y) {
byte *pSrc = data + y * 160;
@@ -410,19 +417,20 @@ void GfxSurface::loadScreenSection(Graphics::Surface &dest, int xHalf, int yHalf
* included in a scaled image
*/
static int *scaleLine(int size, int srcSize) {
- int scale = 100 * size / srcSize;
+ const int PRECISION_FACTOR = 1000;
+ int scale = PRECISION_FACTOR * size / srcSize;
assert(scale >= 0);
int *v = new int[size];
- Common::set_to(v, &v[size], 0);
+ Common::set_to(v, &v[size], -1);
- int distCtr = 0;
+ int distCtr = PRECISION_FACTOR / 2;
int *destP = v;
for (int distIndex = 0; distIndex < srcSize; ++distIndex) {
distCtr += scale;
- while (distCtr >= 100) {
+ while (distCtr > PRECISION_FACTOR) {
assert(destP < &v[size]);
*destP++ = distIndex;
- distCtr -= 100;
+ distCtr -= PRECISION_FACTOR;
}
}
@@ -436,7 +444,7 @@ static int *scaleLine(int size, int srcSize) {
* @param NewHeight New height for scaled image
* @remarks Caller is responsible for freeing the returned surface
*/
-static GfxSurface ResizeSurface(GfxSurface &src, int xSize, int ySize) {
+static GfxSurface ResizeSurface(GfxSurface &src, int xSize, int ySize, int transIndex) {
GfxSurface s;
s.create(xSize, ySize);
@@ -448,12 +456,22 @@ static GfxSurface ResizeSurface(GfxSurface &src, int xSize, int ySize) {
// Loop to create scaled version
for (int yp = 0; yp < ySize; ++yp) {
- const byte *srcP = (const byte *)srcImage.getBasePtr(0, vertUsage[yp]);
byte *destP = (byte *)destImage.getBasePtr(0, yp);
- for (int xp = 0; xp < xSize; ++xp) {
- const byte *tempSrcP = srcP + horizUsage[xp];
- *destP++ = *tempSrcP++;
+ if (vertUsage[yp] == -1) {
+ Common::set_to(destP, destP + xSize, transIndex);
+ } else {
+ const byte *srcP = (const byte *)srcImage.getBasePtr(0, vertUsage[yp]);
+
+ for (int xp = 0; xp < xSize; ++xp) {
+ if (horizUsage[xp] != -1) {
+ const byte *tempSrcP = srcP + horizUsage[xp];
+ *destP++ = *tempSrcP++;
+ } else {
+ // Pixel overrun at the end of the line
+ *destP++ = transIndex;
+ }
+ }
}
}
@@ -472,6 +490,8 @@ static GfxSurface ResizeSurface(GfxSurface &src, int xSize, int ySize) {
*/
void GfxSurface::copyFrom(GfxSurface &src, Rect srcBounds, Rect destBounds, Region *priorityRegion) {
GfxSurface srcImage;
+ if (srcBounds.isEmpty())
+ return;
if (srcBounds == src.getBounds())
srcImage = src;
@@ -493,7 +513,7 @@ void GfxSurface::copyFrom(GfxSurface &src, Rect srcBounds, Rect destBounds, Regi
}
if ((destBounds.width() != srcBounds.width()) || (destBounds.height() != srcBounds.height()))
- srcImage = ResizeSurface(srcImage, destBounds.width(), destBounds.height());
+ srcImage = ResizeSurface(srcImage, destBounds.width(), destBounds.height(), src._transColor);
Graphics::Surface srcSurface = srcImage.lockSurface();
Graphics::Surface destSurface = lockSurface();
@@ -519,7 +539,7 @@ void GfxSurface::copyFrom(GfxSurface &src, Rect srcBounds, Rect destBounds, Regi
for (int y = 0; y < destBounds.height(); ++y, pSrc += srcSurface.pitch, pDest += destSurface.pitch) {
- if (!priorityRegion && (src._transColour == -1))
+ if (!priorityRegion && (src._transColor == -1))
Common::copy(pSrc, pSrc + destBounds.width(), pDest);
else {
const byte *tempSrc = pSrc;
@@ -530,7 +550,7 @@ void GfxSurface::copyFrom(GfxSurface &src, Rect srcBounds, Rect destBounds, Regi
if (!priorityRegion || !priorityRegion->contains(Common::Point(
xp + _globals->_sceneManager._scene->_sceneBounds.left,
destBounds.top + y + _globals->_sceneManager._scene->_sceneBounds.top))) {
- if (*tempSrc != src._transColour)
+ if (*tempSrc != src._transColor)
*tempDest = *tempSrc;
}
++tempSrc;
@@ -570,8 +590,8 @@ GfxElement::GfxElement() {
void GfxElement::setDefaults() {
_flags = 0;
_fontNumber = _globals->_gfxFontNumber;
- _colours = _globals->_gfxColours;
- _fontColours = _globals->_fontColours;
+ _colors = _globals->_gfxColors;
+ _fontColors = _globals->_fontColors;
}
/**
@@ -583,15 +603,15 @@ void GfxElement::highlight() {
Graphics::Surface surface = gfxManager.lockSurface();
// Scan through the contents of the element, switching any occurances of the foreground
- // colour with the background colour and vice versa
+ // color with the background color and vice versa
Rect tempRect(_bounds);
tempRect.collapse(2, 2);
for (int yp = tempRect.top; yp < tempRect.bottom; ++yp) {
byte *lineP = (byte *)surface.getBasePtr(tempRect.left, yp);
for (int xp = tempRect.left; xp < tempRect.right; ++xp, ++lineP) {
- if (*lineP == _colours.background) *lineP = _colours.foreground;
- else if (*lineP == _colours.foreground) *lineP = _colours.background;
+ if (*lineP == _colors.background) *lineP = _colors.foreground;
+ else if (*lineP == _colors.foreground) *lineP = _colors.background;
}
}
@@ -607,31 +627,31 @@ void GfxElement::drawFrame() {
GfxManager &gfxManager = _globals->gfxManager();
gfxManager.lockSurface();
- uint8 bgColour, fgColour;
+ uint8 bgColor, fgColor;
if (_flags & GFXFLAG_THICK_FRAME) {
- bgColour = 0;
- fgColour = 0;
+ bgColor = 0;
+ fgColor = 0;
} else {
- bgColour = _fontColours.background;
- fgColour = _fontColours.foreground;
+ bgColor = _fontColors.background;
+ fgColor = _fontColors.foreground;
}
Rect tempRect = _bounds;
tempRect.collapse(3, 3);
tempRect.collapse(-1, -1);
- gfxManager.fillRect(tempRect, _colours.background);
+ gfxManager.fillRect(tempRect, _colors.background);
--tempRect.bottom; --tempRect.right;
- gfxManager.fillArea(tempRect.left, tempRect.top, bgColour);
- gfxManager.fillArea(tempRect.left, tempRect.bottom, fgColour);
- gfxManager.fillArea(tempRect.right, tempRect.top, fgColour);
- gfxManager.fillArea(tempRect.right, tempRect.bottom, fgColour);
+ gfxManager.fillArea(tempRect.left, tempRect.top, bgColor);
+ gfxManager.fillArea(tempRect.left, tempRect.bottom, fgColor);
+ gfxManager.fillArea(tempRect.right, tempRect.top, fgColor);
+ gfxManager.fillArea(tempRect.right, tempRect.bottom, fgColor);
tempRect.collapse(-1, -1);
- gfxManager.fillRect2(tempRect.left + 1, tempRect.top, tempRect.width() - 1, 1, bgColour);
- gfxManager.fillRect2(tempRect.left, tempRect.top + 1, 1, tempRect.height() - 1, bgColour);
- gfxManager.fillRect2(tempRect.left + 1, tempRect.bottom, tempRect.width() - 1, 1, fgColour);
- gfxManager.fillRect2(tempRect.right, tempRect.top + 1, 1, tempRect.height() - 1, fgColour);
+ gfxManager.fillRect2(tempRect.left + 1, tempRect.top, tempRect.width() - 1, 1, bgColor);
+ gfxManager.fillRect2(tempRect.left, tempRect.top + 1, 1, tempRect.height() - 1, bgColor);
+ gfxManager.fillRect2(tempRect.left + 1, tempRect.bottom, tempRect.width() - 1, 1, fgColor);
+ gfxManager.fillRect2(tempRect.right, tempRect.top + 1, 1, tempRect.height() - 1, fgColor);
gfxManager.fillArea(tempRect.left, tempRect.top, 0);
gfxManager.fillArea(tempRect.left, tempRect.bottom, 0);
@@ -702,7 +722,7 @@ void GfxImage::setDefaults() {
// Decode the image
uint size;
- byte *imgData = _vm->_dataManager->getSubResource(_resNum, _rlbNum, _cursorNum, &size);
+ byte *imgData = _resourceManager->getSubResource(_resNum, _rlbNum, _cursorNum, &size);
_surface = surfaceFromRes(imgData);
DEALLOCATE(imgData);
@@ -753,10 +773,10 @@ void GfxMessage::draw() {
GfxFontBackup font;
GfxManager &gfxManager = _globals->gfxManager();
- // Set the font and colour
+ // Set the font and color
gfxManager.setFillFlag(false);
gfxManager._font.setFontNumber(_fontNumber);
- gfxManager._font._colours.foreground = this->_colours.foreground;
+ gfxManager._font._colors.foreground = this->_colors.foreground;
// Display the text
gfxManager._font.writeLines(_message.c_str(), _bounds, _textAlign);
@@ -791,14 +811,14 @@ void GfxButton::draw() {
// Draw a basic frame for the button
drawFrame();
- // Set the font and colour
+ // Set the font and color
gfxManager._font.setFontNumber(_fontNumber);
- gfxManager._font._colours.foreground = this->_colours.foreground;
+ gfxManager._font._colors.foreground = this->_colors.foreground;
// Display the button's text
Rect tempRect(_bounds);
tempRect.collapse(3, 3);
- gfxManager._font.writeLines(_message.c_str(), tempRect, ALIGN_CENTRE);
+ gfxManager._font.writeLines(_message.c_str(), tempRect, ALIGN_CENTER);
gfxManager.unlockSurface();
}
@@ -928,7 +948,7 @@ void GfxDialog::setTopLeft(int xp, int yp) {
_bounds.moveTo(xp - 6, yp - 6);
}
-void GfxDialog::setCentre(int xp, int yp) {
+void GfxDialog::setCenter(int xp, int yp) {
setTopLeft(xp - (_bounds.width() / 2), yp - (_bounds.height() / 2));
}
@@ -986,9 +1006,9 @@ GfxButton *GfxDialog::execute(GfxButton *defaultButton) {
void GfxDialog::setPalette() {
_globals->_scenePalette.loadPalette(0);
_globals->_scenePalette.setPalette(0, 1);
- _globals->_scenePalette.setPalette(_globals->_scenePalette._colours.foreground, 1);
- _globals->_scenePalette.setPalette(_globals->_fontColours.background, 1);
- _globals->_scenePalette.setPalette(_globals->_fontColours.foreground, 1);
+ _globals->_scenePalette.setPalette(_globals->_scenePalette._colors.foreground, 1);
+ _globals->_scenePalette.setPalette(_globals->_fontColors.background, 1);
+ _globals->_scenePalette.setPalette(_globals->_fontColors.foreground, 1);
_globals->_scenePalette.setPalette(255, 1);
}
@@ -1013,7 +1033,7 @@ void GfxManager::setDefaults() {
_pane0Rect4 = screenBounds;
_font._edgeSize = Common::Point(1, 1);
- _font._colours = _globals->_fontColours;
+ _font._colors = _globals->_fontColors;
_font.setFontNumber(_globals->_gfxFontNumber);
}
@@ -1040,20 +1060,20 @@ void GfxManager::getStringBounds(const char *s, Rect &bounds, int maxWidth) {
_font.getStringBounds(s, bounds, maxWidth);
}
-void GfxManager::fillArea(int xp, int yp, int colour) {
+void GfxManager::fillArea(int xp, int yp, int color) {
_surface.setBounds(_bounds);
Rect tempRect(xp, yp, xp + _font._edgeSize.x, yp + _font._edgeSize.y);
- _surface.fillRect(tempRect, colour);
+ _surface.fillRect(tempRect, color);
}
-void GfxManager::fillRect(const Rect &bounds, int colour) {
+void GfxManager::fillRect(const Rect &bounds, int color) {
_surface.setBounds(_bounds);
- _surface.fillRect(bounds, colour);
+ _surface.fillRect(bounds, color);
}
-void GfxManager::fillRect2(int xs, int ys, int width, int height, int colour) {
+void GfxManager::fillRect2(int xs, int ys, int width, int height, int color) {
_surface.setBounds(_bounds);
- _surface.fillRect(Rect(xs, ys, xs + width, ys + height), colour);
+ _surface.fillRect(Rect(xs, ys, xs + width, ys + height), color);
}
/**
@@ -1061,10 +1081,10 @@ void GfxManager::fillRect2(int xs, int ys, int width, int height, int colour) {
*/
void GfxManager::setDialogPalette() {
// Get the main palette information
- RGB8 palData[256];
+ byte palData[256 * 3];
uint count, start;
- _vm->_dataManager->getPalette(0, &palData[0], &start, &count);
- g_system->getPaletteManager()->setPalette((byte *)&palData[0], start, count);
+ _resourceManager->getPalette(0, &palData[0], &start, &count);
+ g_system->getPaletteManager()->setPalette(&palData[0], start, count);
// Miscellaneous
uint32 white = 0xffffffff;
@@ -1098,7 +1118,7 @@ int GfxManager::getAngle(const Common::Point &p1, const Common::Point &p2) {
GfxFont::GfxFont() {
- _fontNumber = 50;
+ _fontNumber = (_vm->getFeatures() & GF_DEMO) ? 0 : 50;
_numChars = 0;
_bpp = 0;
_fontData = NULL;
@@ -1122,9 +1142,9 @@ void GfxFont::setFontNumber(uint32 fontNumber) {
_fontNumber = fontNumber;
- _fontData = _vm->_tSageManager->getResource(RES_FONT, _fontNumber, 0, true);
+ _fontData = _resourceManager->getResource(RES_FONT, _fontNumber, 0, true);
if (!_fontData)
- _fontData = _vm->_dataManager->getResource(RES_FONT, _fontNumber, 0);
+ _fontData = _resourceManager->getResource(RES_FONT, _fontNumber, 0);
_numChars = READ_LE_UINT16(_fontData + 4);
_fontSize.y = READ_LE_UINT16(_fontData + 6);
@@ -1268,7 +1288,7 @@ int GfxFont::writeChar(const char ch) {
charRect.translate(_topLeft.x + _position.x, _topLeft.y + _position.y + yOffset);
if (_fillFlag)
- surfacePtr.fillRect(charRect, _colours.background);
+ surfacePtr.fillRect(charRect, _colors.background);
charRect.bottom = charRect.top + charHeight;
@@ -1279,7 +1299,7 @@ int GfxFont::writeChar(const char ch) {
byte *destP = (byte *)surfacePtr.getBasePtr(charRect.left, yp);
for (int xs = 0; xs < charRect.width(); ++xs, ++destP) {
- // Get the next colour index to use
+ // Get the next color index to use
if ((bitCtr % 8) == 0) v = *dataP++;
int colIndex = 0;
for (int subCtr = 0; subCtr < _bpp; ++subCtr, ++bitCtr) {
@@ -1288,10 +1308,10 @@ int GfxFont::writeChar(const char ch) {
}
switch (colIndex) {
- //case 0: *destP = _colours.background; break;
- case 1: *destP = _colours.foreground; break;
- case 2: *destP = _colours2.background; break;
- case 3: *destP = _colours2.foreground; break;
+ //case 0: *destP = _colors.background; break;
+ case 1: *destP = _colors.foreground; break;
+ case 2: *destP = _colors2.background; break;
+ case 3: *destP = _colors2.foreground; break;
}
}
}
@@ -1355,7 +1375,7 @@ void GfxFont::writeLines(const char *s, const Rect &bounds, TextAlign align) {
writeString(s, numChars);
break;
- case ALIGN_CENTRE:
+ case ALIGN_CENTER:
// Center aligned text
_position.x = bounds.left + (bounds.width() / 2) - (getStringWidth(s, numChars) / 2);
writeString(s, numChars);
@@ -1415,7 +1435,7 @@ void GfxFont::writeLines(const char *s, const Rect &bounds, TextAlign align) {
GfxFontBackup::GfxFontBackup() {
_edgeSize = _globals->gfxManager()._font._edgeSize;
_position = _globals->gfxManager()._font._position;
- _colours = _globals->gfxManager()._font._colours;
+ _colors = _globals->gfxManager()._font._colors;
_fontNumber = _globals->gfxManager()._font._fontNumber;
}
@@ -1423,7 +1443,7 @@ GfxFontBackup::~GfxFontBackup() {
_globals->gfxManager()._font.setFontNumber(_fontNumber);
_globals->gfxManager()._font._edgeSize = _edgeSize;
_globals->gfxManager()._font._position = _position;
- _globals->gfxManager()._font._colours = _colours;
+ _globals->gfxManager()._font._colors = _colors;
}
diff --git a/engines/tsage/graphics.h b/engines/tsage/graphics.h
index 0ad76772b3..8be4629493 100644
--- a/engines/tsage/graphics.h
+++ b/engines/tsage/graphics.h
@@ -48,22 +48,22 @@ public:
void set(int16 x1, int16 y1, int16 x2, int16 y2);
void collapse(int dx, int dy);
- void centre(int dx, int dy);
- void centre(const Rect &r);
- void centre(const Common::Point &pt) { centre(pt.x, pt.y); }
+ void center(int dx, int dy);
+ void center(const Rect &r);
+ void center(const Common::Point &pt) { center(pt.x, pt.y); }
void contain(const Rect &r);
void resize(const GfxSurface &surface, int xp, int yp, int percent);
void expandPanes();
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
};
-class GfxColours {
+class GfxColors {
public:
uint8 foreground;
uint8 background;
- GfxColours() : foreground(0), background(0) {};
+ GfxColors() : foreground(0), background(0) {};
};
class LineSlice {
@@ -85,7 +85,7 @@ private:
Rect _bounds;
public:
Common::Point _centroid;
- int _transColour;
+ int _transColor;
public:
GfxSurface();
GfxSurface(const GfxSurface &s);
@@ -108,14 +108,14 @@ public:
copyFrom(src, tempRect, priorityRegion);
}
void draw(const Common::Point &pt, Rect *rect = NULL);
- void fillRect(const Rect &bounds, int colour);
+ void fillRect(const Rect &bounds, int color);
GfxSurface &operator=(const GfxSurface &s);
static void loadScreenSection(Graphics::Surface &dest, int xHalf, int yHalf, int xSection, int ySection);
static bool displayText(const Common::String &msg, const Common::Point &pt = Common::Point(160, 100));
};
-enum TextAlign {ALIGN_LEFT = 0, ALIGN_CENTRE = 1, ALIGN_RIGHT = 2, ALIGN_JUSTIFIED = 3};
+enum TextAlign {ALIGN_LEFT = 0, ALIGN_CENTER = 1, ALIGN_RIGHT = 2, ALIGN_JUSTIFIED = 3};
class GfxFont {
friend class GfxFontBackup;
@@ -131,8 +131,8 @@ public:
Common::Point _edgeSize;
Common::Point _position;
bool _fillFlag;
- GfxColours _colours;
- GfxColours _colours2;
+ GfxColors _colors;
+ GfxColors _colors2;
uint32 _fontNumber;
Common::Point _topLeft;
public:
@@ -160,7 +160,7 @@ private:
GfxSurface *_surface;
Common::Point _edgeSize;
Common::Point _position;
- GfxColours _colours;
+ GfxColors _colors;
uint32 _fontNumber;
public:
GfxFontBackup();
@@ -177,8 +177,8 @@ public:
Rect _bounds;
uint16 _flags;
uint16 _fontNumber;
- GfxColours _colours;
- GfxColours _fontColours;
+ GfxColors _colors;
+ GfxColors _fontColors;
uint16 _keycode;
public:
GfxElement();
@@ -275,19 +275,19 @@ public:
return _surface.lockSurface();
}
void unlockSurface() { _surface.unlockSurface(); };
- void fillArea(int xp, int yp, int colour);
- void fillRect(const Rect &bounds, int colour);
- void fillRect2(int xs, int ys, int width, int height, int colour);
+ void fillArea(int xp, int yp, int color);
+ void fillRect(const Rect &bounds, int color);
+ void fillRect2(int xs, int ys, int width, int height, int color);
void setFillFlag(bool v) { _font._fillFlag = v; }
static int getAngle(const Common::Point &p1, const Common::Point &p2);
// Virtual method table
- virtual void xorArea(const Common::Rect &r, int colour, int fillMode) {
- //_surface->xorArea(r, colour, fillMode);
+ virtual void xorArea(const Common::Rect &r, int color, int fillMode) {
+ //_surface->xorArea(r, color, fillMode);
}
- virtual void draw(const Common::Rect &r, void *gfxData, int v1, GfxColours *colours) {
- //_surface->draw(r, gfxData, v1, colours);
+ virtual void draw(const Common::Rect &r, void *gfxData, int v1, GfxColors *colors) {
+ //_surface->draw(r, gfxData, v1, colors);
}
virtual void copy(const byte *src, byte *dest, int size) {
Common::copy(src, src + size, dest);
@@ -325,7 +325,7 @@ public:
void add(GfxElement *element);
void addElements(GfxElement *ge, ...);
void setTopLeft(int xp, int yp);
- void setCentre(int xp, int yp);
+ void setCenter(int xp, int yp);
void frame() {
setDefaults();
_bounds.collapse(6, 6);
diff --git a/engines/tsage/module.mk b/engines/tsage/module.mk
index 41a868195b..2f9194a9ba 100644
--- a/engines/tsage/module.mk
+++ b/engines/tsage/module.mk
@@ -10,6 +10,7 @@ MODULE_OBJS := \
globals.o \
graphics.o \
resources.o \
+ ringworld_demo.o \
ringworld_logic.o \
ringworld_scenes1.o \
ringworld_scenes2.o \
diff --git a/engines/tsage/resources.cpp b/engines/tsage/resources.cpp
index c87c3eaf1e..2b678a848a 100644
--- a/engines/tsage/resources.cpp
+++ b/engines/tsage/resources.cpp
@@ -29,6 +29,7 @@
#include "common/stack.h"
#include "common/util.h"
#include "tsage/resources.h"
+#include "tsage/tsage.h"
namespace tSage {
@@ -134,7 +135,7 @@ uint16 BitReader::readToken() {
/*-------------------------------------------------------------------------*/
-RlbManager::RlbManager(MemoryManager &memManager, const Common::String filename) :
+TLib::TLib(MemoryManager &memManager, const Common::String &filename) :
_memoryManager(memManager) {
// If the resource strings list isn't yet loaded, load them
@@ -154,11 +155,11 @@ RlbManager::RlbManager(MemoryManager &memManager, const Common::String filename)
loadIndex();
}
-RlbManager::~RlbManager() {
+TLib::~TLib() {
_resStrings.clear();
}
-void RlbManager::loadSection(uint32 fileOffset) {
+void TLib::loadSection(uint32 fileOffset) {
_resources.clear();
_file.seek(fileOffset);
_sections.fileOffset = fileOffset;
@@ -197,13 +198,13 @@ struct DecodeReference {
/**
* Gets a resource from the currently loaded section
*/
-byte *RlbManager::getResource(uint16 id, bool suppressErrors) {
+byte *TLib::getResource(uint16 id, bool suppressErrors) {
// Scan for an entry for the given Id
- ResourceEntry *re= NULL;
- ResourceList::iterator i;
- for (i = _resources.begin(); i != _resources.end(); ++i) {
- if ((*i).id == id) {
- re = &(*i);
+ ResourceEntry *re = NULL;
+ ResourceList::iterator iter;
+ for (iter = _resources.begin(); iter != _resources.end(); ++iter) {
+ if ((*iter).id == id) {
+ re = &(*iter);
break;
}
}
@@ -238,6 +239,9 @@ byte *RlbManager::getResource(uint16 id, bool suppressErrors) {
uint16 word_48050 = 0, currentToken = 0, word_48054 =0;
byte byte_49068 = 0, byte_49069 = 0;
DecodeReference table[0x1000];
+ for (int i = 0; i < 0x1000; ++i) {
+ table[i].vByte = table[i].vWord = 0;
+ }
Common::Stack<uint16> tokenList;
for (;;) {
@@ -307,7 +311,7 @@ byte *RlbManager::getResource(uint16 id, bool suppressErrors) {
/**
* Finds the correct section and loads the specified resource within it
*/
-byte *RlbManager::getResource(ResourceType resType, uint16 resNum, uint16 rlbNum, bool suppressErrors) {
+byte *TLib::getResource(ResourceType resType, uint16 resNum, uint16 rlbNum, bool suppressErrors) {
SectionList::iterator i = _sections.begin();
while ((i != _sections.end()) && ((*i).resType != resType || (*i).resNum != resNum))
++i;
@@ -322,7 +326,7 @@ byte *RlbManager::getResource(ResourceType resType, uint16 resNum, uint16 rlbNum
return getResource(rlbNum, suppressErrors);
}
-void RlbManager::loadIndex() {
+void TLib::loadIndex() {
uint16 resNum, configId, fileOffset;
// Load the root resources section
@@ -356,26 +360,32 @@ void RlbManager::loadIndex() {
*
* @paletteNum Specefies the palette number
*/
-void RlbManager::getPalette(int paletteNum, RGB8 *palData, uint *startNum, uint *numEntries) {
+bool TLib::getPalette(int paletteNum, byte *palData, uint *startNum, uint *numEntries) {
// Get the specified palette
- byte *dataIn = getResource(RES_PALETTE, 0, paletteNum);
- assert(dataIn);
+ byte *dataIn = getResource(RES_PALETTE, 0, paletteNum, true);
+ if (!dataIn)
+ return false;
*startNum = READ_LE_UINT16(dataIn);
*numEntries = READ_LE_UINT16(dataIn + 2);
- RGB8 *srcPal = (RGB8 *)(dataIn + 6);
assert((*startNum < 256) && ((*startNum + *numEntries) <= 256));
// Copy over the data
- Common::copy(&srcPal[0], &srcPal[*numEntries], palData);
+ Common::copy(&dataIn[6], &dataIn[6 + *numEntries * 3], palData);
_memoryManager.deallocate(dataIn);
+ return true;
}
-byte *RlbManager::getSubResource(int resNum, int rlbNum, int index, uint *size) {
+byte *TLib::getSubResource(int resNum, int rlbNum, int index, uint *size, bool suppressErrors) {
// Get the specified image set
byte *dataIn = getResource(RES_VISAGE, resNum, rlbNum);
- assert(dataIn);
+ if (!dataIn) {
+ if (suppressErrors)
+ return NULL;
+
+ error("Unknown sub resource %d/%d index %d", resNum, rlbNum, index);
+ }
int numEntries = READ_LE_UINT16(dataIn);
uint32 entryOffset = READ_LE_UINT32(dataIn + 2 + (index - 1) * 4);
@@ -394,16 +404,97 @@ byte *RlbManager::getSubResource(int resNum, int rlbNum, int index, uint *size)
/**
* Retrieves a given message resource, and returns the specified message number
*/
-Common::String RlbManager::getMessage(int resNum, int lineNum) {
- byte *msgData = getResource(RES_MESSAGE, resNum, 0);
- assert(msgData);
+bool TLib::getMessage(int resNum, int lineNum, Common::String &result, bool suppressErrors) {
+ byte *msgData = getResource(RES_MESSAGE, resNum, 0, true);
+ if (!msgData) {
+ if (suppressErrors)
+ return false;
+
+ error("Unknown message %d line %d", resNum, lineNum);
+ }
const char *srcP = (const char *)msgData;
while (lineNum-- > 0)
srcP += strlen(srcP) + 1;
- Common::String result(srcP);
+ result = Common::String(srcP);
_memoryManager.deallocate(msgData);
+ return true;
+}
+
+/*--------------------------------------------------------------------------*/
+
+ResourceManager::~ResourceManager() {
+ for (uint idx = 0; idx < _libList.size(); ++idx)
+ delete _libList[idx];
+}
+
+void ResourceManager::addLib(const Common::String &libName) {
+ assert(_libList.size() < 5);
+
+ _libList.push_back(new TLib(_vm->_memoryManager, libName));
+}
+
+byte *ResourceManager::getResource(uint16 id, bool suppressErrors) {
+ byte *result = NULL;
+ for (uint idx = 0; idx < _libList.size(); ++idx) {
+ result = _libList[idx]->getResource(id, true);
+ if (result)
+ return result;
+ }
+
+ if (!result && !suppressErrors)
+ error("Could not find resource Id #%d", id);
+ return NULL;
+}
+
+byte *ResourceManager::getResource(ResourceType resType, uint16 resNum, uint16 rlbNum, bool suppressErrors) {
+ byte *result = NULL;
+ for (uint idx = 0; idx < _libList.size(); ++idx) {
+ result = _libList[idx]->getResource(resType, resNum, rlbNum, true);
+ if (result)
+ return result;
+ }
+
+ if (!result && !suppressErrors)
+ error("Unknown resource type %d num %d", resType, resNum);
+ return NULL;
+}
+
+void ResourceManager::getPalette(int paletteNum, byte *palData, uint *startNum, uint *numEntries, bool suppressErrors) {
+ for (uint idx = 0; idx < _libList.size(); ++idx) {
+ if (_libList[idx]->getPalette(paletteNum, palData, startNum, numEntries))
+ return;
+ }
+
+ if (!suppressErrors)
+ error("Unknown palette resource %d", paletteNum);
+ *numEntries = 0;
+}
+
+byte *ResourceManager::getSubResource(int resNum, int rlbNum, int index, uint *size, bool suppressErrors) {
+ byte *result = NULL;
+ for (uint idx = 0; idx < _libList.size(); ++idx) {
+ result = _libList[idx]->getSubResource(resNum, rlbNum, index, size, true);
+ if (result)
+ return result;
+ }
+
+ if (!result && !suppressErrors)
+ error("Unknown resource %d/%d index %d", resNum, rlbNum, index);
+ return NULL;
+}
+
+Common::String ResourceManager::getMessage(int resNum, int lineNum, bool suppressErrors) {
+ Common::String result;
+
+ for (uint idx = 0; idx < _libList.size(); ++idx) {
+ if (_libList[idx]->getMessage(resNum, lineNum, result, true))
+ return result;
+ }
+
+ if (!suppressErrors)
+ error("Unknown message %d line %d", resNum, lineNum);
return result;
}
diff --git a/engines/tsage/resources.h b/engines/tsage/resources.h
index 1af1bb8d2f..7b518cabd6 100644
--- a/engines/tsage/resources.h
+++ b/engines/tsage/resources.h
@@ -27,10 +27,12 @@
#define RING_RESOURCES_H
#include "common/scummsys.h"
+#include "common/array.h"
#include "common/file.h"
#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"
@@ -45,16 +47,6 @@ enum ResourceType { RES_LIBRARY, RES_STRIP, RES_IMAGE, RES_PALETTE, RES_VISAGE,
RES_FONT, RES_POINTER, RES_BANK, RES_SND_DRIVER, RES_PRIORITY, RES_CONTROL, RES_WALKRGNS,
RES_BITMAP, RES_SAVE, RES_SEQUENCE };
-#include "common/pack-start.h" // START STRUCT PACKING
-
-struct RGB8 {
- uint8 r;
- uint8 g;
- uint8 b;
-} PACKED_STRUCT;
-
-#include "common/pack-end.h" // END STRUCT PACKING
-
class MemoryHeader {
public:
uint32 id;
@@ -127,7 +119,7 @@ public:
byte *lock(uint32 handle);
int indexOf(const byte *p);
void deallocate(const byte *p);
- void deallocate(uint16 handle) { assert("TODO"); }
+ void deallocate(uint16 handle) { warning("TODO: MemoryManager::deallocate(handle)"); }
uint32 getSize(const byte *p);
void incLocks(const byte *p);
};
@@ -148,7 +140,7 @@ public:
int numBits;
};
-class RlbManager {
+class TLib {
private:
Common::StringArray _resStrings;
MemoryManager &_memoryManager;
@@ -160,14 +152,29 @@ private:
void loadSection(uint32 fileOffset);
void loadIndex();
public:
- RlbManager(MemoryManager &memManager, const Common::String filename);
- ~RlbManager();
+ TLib(MemoryManager &memManager, const Common::String &filename);
+ ~TLib();
+
+ byte *getResource(uint16 id, bool suppressErrors = false);
+ byte *getResource(ResourceType resType, uint16 resNum, uint16 rlbNum, bool suppressErrors = false);
+ bool getPalette(int paletteNum, byte *palData, uint *startNum, uint *numEntries);
+ byte *getSubResource(int resNum, int rlbNum, int index, uint *size, bool suppressErrors = false);
+ bool getMessage(int resNum, int lineNum, Common::String &result, bool suppressErrors = false);
+};
+
+class ResourceManager {
+private:
+ Common::Array<TLib *> _libList;
+public:
+ ~ResourceManager();
+
+ void addLib(const Common::String &libName);
byte *getResource(uint16 id, bool suppressErrors = false);
byte *getResource(ResourceType resType, uint16 resNum, uint16 rlbNum, bool suppressErrors = false);
- void getPalette(int paletteNum, RGB8 *palData, uint *startNum, uint *numEntries);
- byte *getSubResource(int resNum, int rlbNum, int index, uint *size);
- Common::String getMessage(int resNum, int lineNum);
+ void getPalette(int paletteNum, byte *palData, uint *startNum, uint *numEntries, bool suppressErrors = false);
+ byte *getSubResource(int resNum, int rlbNum, int index, uint *size, bool suppressErrors = false);
+ Common::String getMessage(int resNum, int lineNum, bool suppressErrors = false);
};
diff --git a/engines/tsage/ringworld_demo.cpp b/engines/tsage/ringworld_demo.cpp
new file mode 100644
index 0000000000..29438c0347
--- /dev/null
+++ b/engines/tsage/ringworld_demo.cpp
@@ -0,0 +1,58 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "tsage/ringworld_demo.h"
+#include "tsage/scenes.h"
+#include "tsage/tsage.h"
+#include "tsage/staticres.h"
+
+namespace tSage {
+
+/*--------------------------------------------------------------------------
+ * Ringworld Demo scene
+ *
+ *--------------------------------------------------------------------------*/
+
+void RingworldDemoScene::postInit(SceneObjectList *OwnerList) {
+ signal();
+}
+
+void RingworldDemoScene::signal() {
+ _soundHandler.startSound(4);
+ _actor1.postInit();
+ _actor2.postInit();
+ _actor3.postInit();
+ _actor4.postInit();
+ _actor5.postInit();
+ _actor6.postInit();
+
+ setAction(&_sequenceManager, this, 22, &_actor1, &_actor2, &_actor3, &_actor4, &_actor5, &_actor6, NULL);
+}
+
+void RingworldDemoScene::process(Event &event) {
+
+}
+
+} // End of namespace tSage
diff --git a/engines/tsage/ringworld_demo.h b/engines/tsage/ringworld_demo.h
new file mode 100644
index 0000000000..63ffe56555
--- /dev/null
+++ b/engines/tsage/ringworld_demo.h
@@ -0,0 +1,52 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef TSAGE_RINGWORLD_DEMO_H
+#define TSAGE_RINGWORLD_DEMO_H
+
+#include "common/scummsys.h"
+#include "tsage/events.h"
+#include "tsage/core.h"
+#include "tsage/scenes.h"
+#include "tsage/globals.h"
+
+namespace tSage {
+
+
+class RingworldDemoScene: public Scene {
+public:
+ SequenceManager _sequenceManager;
+ SceneObject _actor1, _actor2, _actor3;
+ SceneObject _actor4, _actor5, _actor6;
+ SoundHandler _soundHandler;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void process(Event &event);
+ virtual void signal();
+};
+
+} // End of namespace tSage
+
+#endif
diff --git a/engines/tsage/ringworld_logic.cpp b/engines/tsage/ringworld_logic.cpp
index 32f62bea76..d334e0ce1f 100644
--- a/engines/tsage/ringworld_logic.cpp
+++ b/engines/tsage/ringworld_logic.cpp
@@ -23,10 +23,14 @@
*
*/
+#include "common/config-manager.h"
+#include "common/translation.h"
+#include "gui/saveload.h"
#include "tsage/ringworld_logic.h"
#include "tsage/scenes.h"
#include "tsage/tsage.h"
#include "tsage/staticres.h"
+#include "tsage/ringworld_demo.h"
#include "tsage/ringworld_scenes1.h"
#include "tsage/ringworld_scenes2.h"
#include "tsage/ringworld_scenes3.h"
@@ -39,6 +43,9 @@
namespace tSage {
Scene *SceneFactory::createScene(int sceneNumber) {
+ if (_vm->getFeatures() & GF_DEMO)
+ return new RingworldDemoScene();
+
switch (sceneNumber) {
/* Scene group 1 */
// Kziniti Palace (Introduction)
@@ -141,32 +148,47 @@ Scene *SceneFactory::createScene(int sceneNumber) {
case 5300: return new Scene5300();
/* Scene group 8 */
- // Scene 7000: Landing
+ // Landing near beach
case 7000: return new Scene7000();
- // Scene 7100: swimming under water
+ // Underwater: swimming
case 7100: return new Scene7100();
- // Scene 7200: Entering the underwater cave
+ // Underwater: Entering the cave
case 7200: return new Scene7200();
- // Scene 7300: Discussion with Lord Poria
+ // Underwater: Lord Poria
case 7300: return new Scene7300();
+ // Floating Buildings: Outside
case 7600: return new Scene7600();
+ // Floating Buildings: In the lab
case 7700: return new Scene7700();
/* Scene group 10 */
+ // Near beach: Slave washing clothes
case 9100: return new Scene9100();
+ // Castle: Outside the bulwarks
case 9150: return new Scene9150();
+ // Castle: Near the fountain
case 9200: return new Scene9200();
+ // Castle: In front of a large guarded door
case 9300: return new Scene9300();
+ // Castle: In a hallway
case 9350: return new Scene9350();
+ // Castle: In a hallway
case 9360: return new Scene9360();
+ // Castle: Black-Smith room
case 9400: return new Scene9400();
+ // Castle: Dining room
case 9450: return new Scene9450();
+ // Castle: Bedroom
case 9500: return new Scene9500();
+ // Castle: Balcony
case 9700: return new Scene9700();
+ // Castle: In the garden
case 9750: return new Scene9750();
+ // Castle: Dressing room
case 9850: return new Scene9850();
- // Scene 9900: Ending
+ // Ending
case 9900: return new Scene9900();
+ // Space travel
case 9999: return new Scene9999();
default:
@@ -196,7 +218,7 @@ DisplayHotspot::DisplayHotspot(int regionId, ...) {
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_BGCOLOUR, 7, LIST_END);
+ display(_actions[i + 1], _actions[i + 2], SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
return true;
}
}
@@ -223,7 +245,7 @@ DisplayObject::DisplayObject(int firstAction, ...) {
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_BGCOLOUR, 7, LIST_END);
+ display(_actions[i + 1], _actions[i + 2], SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
return true;
}
}
@@ -285,7 +307,7 @@ void SceneArea::wait() {
g_system->delayMillis(10);
}
- SynchronisedList<SceneItem *>::iterator ii;
+ SynchronizedList<SceneItem *>::iterator ii;
for (ii = _globals->_sceneItems.begin(); ii != _globals->_sceneItems.end(); ++ii) {
SceneItem *sceneItem = *ii;
if (sceneItem->contains(event.mousePos)) {
@@ -297,14 +319,17 @@ void SceneArea::wait() {
_globals->_events.setCursor(CURSOR_ARROW);
}
-void SceneArea::synchronise(Serialiser &s) {
+void SceneArea::synchronize(Serializer &s) {
+ if (s.getVersion() >= 2)
+ SavedObject::synchronize(s);
+
s.syncAsSint16LE(_pt.x);
s.syncAsSint16LE(_pt.y);
s.syncAsSint32LE(_resNum);
s.syncAsSint32LE(_rlbNum);
s.syncAsSint32LE(_subNum);
s.syncAsSint32LE(_actionId);
- _bounds.synchronise(s);
+ _bounds.synchronize(s);
}
/*--------------------------------------------------------------------------*/
@@ -313,7 +338,7 @@ SpeakerGText::SpeakerGText() {
_speakerName = "GTEXT";
_textWidth = 160;
_textPos = Common::Point(130, 10);
- _colour1 = 42;
+ _color1 = 42;
_hideObjects = false;
}
@@ -322,7 +347,7 @@ void SpeakerGText::setText(const Common::String &msg) {
_sceneObject.postInit();
_sceneObject.setVisage(9405);
_sceneObject.setStrip2(3);
- _sceneObject.setPriority2(255);
+ _sceneObject.fixPriority(255);
_sceneObject.changeZoom(100);
_sceneObject._frame = 1;
_sceneObject.setPosition(Common::Point(183, 71));
@@ -331,7 +356,7 @@ void SpeakerGText::setText(const Common::String &msg) {
// Set the text
Rect textRect;
_globals->gfxManager()._font.getStringBounds(msg.c_str(), textRect, _textWidth);
- textRect.centre(_sceneObject._position.x, _sceneObject._position.y);
+ textRect.center(_sceneObject._position.x, _sceneObject._position.y);
_textPos.x = textRect.left;
Speaker::setText(msg);
}
@@ -347,7 +372,7 @@ SpeakerPOR::SpeakerPOR() {
_speakerName = "POR";
_newSceneNumber = 7221;
_textPos = Common::Point(10, 30);
- _colour1 = 41;
+ _color1 = 41;
}
void SpeakerPOR::SpeakerAction1::signal(){
@@ -371,19 +396,19 @@ void SpeakerPOR::setText(const Common::String &msg) {
_object1.postInit(&_objectList);
_object1.setVisage(7223);
_object1.setStrip2(2);
- _object1.setPosition(Common::Point(191, 166), 0);
- _object1.animate(ANIM_MODE_7, 0, 0);
+ _object1.setPosition(Common::Point(191, 166));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
_object2.postInit(&_objectList);
_object2.setVisage(7223);
- _object2.setPosition(Common::Point(159, 86), 0);
- _object2.setAction(&_speakerAction, 0);
+ _object2.setPosition(Common::Point(159, 86));
+ _object2.setAction(&_speakerAction, NULL);
_object3.postInit(&_objectList);
_object3.setVisage(7223);
_object3.setStrip(3);
- _object3.setPosition(Common::Point(119, 107), 0);
- _object3.setPriority2(199);
+ _object3.setPosition(Common::Point(119, 107));
+ _object3.fixPriority(199);
_object3.setAction(&_action2);
Speaker::setText(msg);
@@ -395,7 +420,7 @@ SpeakerOR::SpeakerOR() {
_speakerName = "OR";
_newSceneNumber = 9430;
_textPos = Common::Point(8, 36);
- _colour1 = 42;
+ _color1 = 42;
_textWidth = 136;
}
@@ -403,20 +428,20 @@ void SpeakerOR::setText(const Common::String &msg) {
_object1.postInit(&_objectList);
_object1.setVisage(9431);
_object1.setStrip2(2);
- _object1.setPriority2(255);
+ _object1.fixPriority(255);
_object1.changeZoom(100);
_object1._frame = 1;
- _object1.setPosition(Common::Point(202, 147), 0);
- _object1.animate(ANIM_MODE_7, 0, 0);
+ _object1.setPosition(Common::Point(202, 147));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
_object2.postInit(&_objectList);
_object2.setVisage(9431);
_object2.setStrip2(1);
- _object2.setPriority2(255);
+ _object2.fixPriority(255);
_object2.setZoom(100);
_object2._frame = 1;
- _object2.setPosition(Common::Point(199, 85), 0);
- _object2.setAction(&_speakerAction, 0);
+ _object2.setPosition(Common::Point(199, 85));
+ _object2.setAction(&_speakerAction, NULL);
Speaker::setText(msg);
}
@@ -427,7 +452,7 @@ SpeakerOText::SpeakerOText() : SpeakerGText() {
_speakerName = "OTEXT";
_textWidth = 240;
_textPos = Common::Point(130, 10);
- _colour1 = 42;
+ _color1 = 42;
_hideObjects = false;
}
@@ -436,9 +461,9 @@ SpeakerOText::SpeakerOText() : SpeakerGText() {
SpeakerQText::SpeakerQText() : ScreenSpeaker() {
_speakerName = "QTEXT";
_textPos = Common::Point(160, 40);
- _colour1 = 35;
+ _color1 = 35;
_textWidth = 240;
- _textMode = ALIGN_CENTRE;
+ _textMode = ALIGN_CENTER;
_hideObjects = false;
}
@@ -446,9 +471,9 @@ SpeakerQText::SpeakerQText() : ScreenSpeaker() {
SpeakerSText::SpeakerSText() : ScreenSpeaker() {
_speakerName = "STEXT";
- _colour1 = 13;
+ _color1 = 13;
_textWidth = 240;
- _textMode = ALIGN_CENTRE;
+ _textMode = ALIGN_CENTER;
_hideObjects = false;
}
@@ -457,8 +482,8 @@ SpeakerSText::SpeakerSText() : ScreenSpeaker() {
SpeakerPOText::SpeakerPOText() : ScreenSpeaker() {
_speakerName = "POTEXT";
_textWidth = 240;
- _textMode = ALIGN_CENTRE;
- _colour1 = 41;
+ _textMode = ALIGN_CENTER;
+ _color1 = 41;
_hideObjects = false;
}
@@ -466,9 +491,9 @@ SpeakerPOText::SpeakerPOText() : ScreenSpeaker() {
SpeakerMText::SpeakerMText() {
_speakerName = "MTEXT";
- _colour1 = 11;
- _textWidth = 160;
- _textMode = ALIGN_CENTRE;
+ _color1 = 22;
+ _textWidth = 230;
+ _textMode = ALIGN_CENTER;
_hideObjects = false;
}
@@ -476,9 +501,9 @@ SpeakerMText::SpeakerMText() {
SpeakerCText::SpeakerCText() {
_speakerName = "CTEXT";
- _colour1 = 4;
+ _color1 = 4;
_textWidth = 240;
- _textMode = ALIGN_CENTRE;
+ _textMode = ALIGN_CENTER;
_hideObjects = false;
}
@@ -487,18 +512,31 @@ SpeakerCText::SpeakerCText() {
SpeakerEText::SpeakerEText() {
_speakerName = "ETEXT";
_textPos = Common::Point(20, 20);
- _colour1 = 22;
+ _color1 = 22;
_hideObjects = false;
}
/*--------------------------------------------------------------------------*/
-SpeakerGR::SpeakerGR() {
+SpeakerGR::SpeakerGR() : AnimatedSpeaker() {
_speakerName = "GR";
_newSceneNumber = 9220;
_textWidth = 136;
_textPos = Common::Point(168, 36);
- _colour1 = 14;
+ _color1 = 14;
+}
+
+void SpeakerGR::setText(const Common::String &msg) {
+ _object1.postInit(&_objectList);
+ _object1.setVisage(9221);
+ _object1.setStrip2(2);
+ _object1.fixPriority(255);
+ _object1.changeZoom(100);
+ _object1._frame = 1;
+ _object1.setPosition(Common::Point(101, 70));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
+
+ Speaker::setText(msg);
}
/*--------------------------------------------------------------------------*/
@@ -506,7 +544,7 @@ SpeakerGR::SpeakerGR() {
SpeakerHText::SpeakerHText() {
_speakerName = "HTEXT";
_textPos = Common::Point(160, 40);
- _colour1 = 52;
+ _color1 = 52;
_hideObjects = false;
}
@@ -515,8 +553,8 @@ SpeakerHText::SpeakerHText() {
SpeakerSKText::SpeakerSKText() : ScreenSpeaker() {
_speakerName = "SKTEXT";
_textWidth = 240;
- _textMode = ALIGN_CENTRE;
- _colour1 = 5;
+ _textMode = ALIGN_CENTER;
+ _color1 = 9;
_hideObjects = false;
}
@@ -525,8 +563,8 @@ SpeakerSKText::SpeakerSKText() : ScreenSpeaker() {
SpeakerPText::SpeakerPText() {
_speakerName = "PTEXT";
_textWidth = 240;
- _textMode = ALIGN_CENTRE;
- _colour1 = 5;
+ _textMode = ALIGN_CENTER;
+ _color1 = 5;
_hideObjects = false;
}
@@ -535,8 +573,8 @@ SpeakerPText::SpeakerPText() {
SpeakerCHFText::SpeakerCHFText() {
_speakerName = "CHFTEXT";
_textWidth = 240;
- _textMode = ALIGN_CENTRE;
- _colour1 = 56;
+ _textMode = ALIGN_CENTER;
+ _color1 = 56;
_hideObjects = false;
}
@@ -545,8 +583,8 @@ SpeakerCHFText::SpeakerCHFText() {
SpeakerCDRText::SpeakerCDRText() {
_speakerName = "CDRTEXT";
_textWidth = 240;
- _textMode = ALIGN_CENTRE;
- _colour1 = 52;
+ _textMode = ALIGN_CENTER;
+ _color1 = 52;
_hideObjects = false;
}
@@ -555,7 +593,7 @@ SpeakerCDRText::SpeakerCDRText() {
SpeakerFLText::SpeakerFLText() {
_speakerName = "FLTEXT";
_textPos = Common::Point(10, 40);
- _colour1 = 17;
+ _color1 = 17;
_hideObjects = false;
}
@@ -564,8 +602,8 @@ SpeakerFLText::SpeakerFLText() {
SpeakerBatText::SpeakerBatText() {
_speakerName = "BATTEXT";
_textWidth = 240;
- _textMode = ALIGN_CENTRE;
- _colour1 = 3;
+ _textMode = ALIGN_CENTER;
+ _color1 = 3;
_hideObjects = false;
}
@@ -575,23 +613,23 @@ SpeakerSKL::SpeakerSKL() : AnimatedSpeaker() {
_speakerName = "SKL";
_newSceneNumber = 7011;
_textPos = Common::Point(10, 30);
- _colour1 = 10;
+ _color1 = 9;
}
void SpeakerSKL::setText(const Common::String &msg) {
_object1.postInit(&_objectList);
_object1.setVisage(7013);
_object1.setStrip2(2);
- _object1._frame = 1;
- _object1.setPriority2(255);
+ _object1.fixPriority(255);
_object1.changeZoom(100);
+ _object1._frame = 1;
_object1.setPosition(Common::Point(203, 120));
_object1.animate(ANIM_MODE_7, 0, NULL);
_object2.postInit(&_objectList);
_object2.setVisage(7013);
_object2.setStrip2(1);
- _object2.setPriority2(255);
+ _object2.fixPriority(255);
_object2.changeZoom(100);
_object2._frame = 1;
_object2.setPosition(Common::Point(197, 80));
@@ -606,15 +644,15 @@ SpeakerQL::SpeakerQL() : AnimatedSpeaker() {
_speakerName = "QL";
_newSceneNumber = 2610;
_textPos = Common::Point(160, 30);
- _colour1 = 35;
- _textMode = ALIGN_CENTRE;
+ _color1 = 35;
+ _textMode = ALIGN_CENTER;
}
void SpeakerQL::setText(const Common::String &msg) {
_object1.postInit(&_objectList);
_object1.setVisage(2612);
_object1.setStrip2(2);
- _object1.setPriority2(255);
+ _object1.fixPriority(255);
_object1.changeZoom(100);
_object1._frame = 1;
_object1.setPosition(Common::Point(128, 146));
@@ -623,7 +661,7 @@ void SpeakerQL::setText(const Common::String &msg) {
_object2.postInit(&_objectList);
_object2.setVisage(2612);
_object2.setStrip2(1);
- _object2.setPriority2(255);
+ _object2.fixPriority(255);
_object2.changeZoom(100);
_object2._frame = 1;
_object2.setPosition(Common::Point(122, 84));
@@ -635,18 +673,19 @@ void SpeakerQL::setText(const Common::String &msg) {
/*--------------------------------------------------------------------------*/
SpeakerSR::SpeakerSR() {
+ // TODO: check initialization of object3
_speakerName = "SR";
_newSceneNumber = 2811;
_textPos = Common::Point(10, 30);
- _colour1 = 13;
- _textMode = ALIGN_CENTRE;
+ _color1 = 13;
+ _textMode = ALIGN_CENTER;
}
void SpeakerSR::setText(const Common::String &msg) {
_object1.postInit(&_objectList);
_object1.setVisage(2813);
_object1.setStrip2(2);
- _object1.setPriority2(255);
+ _object1.fixPriority(255);
_object1.changeZoom(100);
_object1._frame = 1;
_object1.setPosition(Common::Point(224, 198));
@@ -655,7 +694,7 @@ void SpeakerSR::setText(const Common::String &msg) {
_object2.postInit(&_objectList);
_object2.setVisage(2813);
_object2.setStrip2(1);
- _object2.setPriority2(255);
+ _object2.fixPriority(255);
_object2.changeZoom(100);
_object2._frame = 1;
_object2.setPosition(Common::Point(203, 96));
@@ -665,7 +704,7 @@ void SpeakerSR::setText(const Common::String &msg) {
_object3.setVisage(2813);
_object3.setStrip(3);
_object3.setPosition(Common::Point(204, 91));
- _object3.setPriority2(199);
+ _object3.fixPriority(199);
_object3._numFrames = 3;
_object3.animate(ANIM_MODE_7, 0, NULL);
@@ -679,15 +718,15 @@ SpeakerSL::SpeakerSL() {
_newSceneNumber = 2810;
_textPos = Common::Point(140, 30);
_textWidth = 160;
- _colour1 = 13;
- _textMode = ALIGN_CENTRE;
+ _color1 = 13;
+ _textMode = ALIGN_CENTER;
}
void SpeakerSL::setText(const Common::String &msg) {
_object1.postInit(&_objectList);
_object1.setVisage(2812);
_object1.setStrip2(2);
- _object1.setPriority2(255);
+ _object1.fixPriority(255);
_object1.changeZoom(100);
_object1._frame = 1;
_object1.setPosition(Common::Point(95, 198));
@@ -696,7 +735,7 @@ void SpeakerSL::setText(const Common::String &msg) {
_object2.postInit(&_objectList);
_object2.setVisage(2812);
_object2.setStrip2(1);
- _object2.setPriority2(255);
+ _object2.fixPriority(255);
_object2.changeZoom(100);
_object2._frame = 1;
_object2.setPosition(Common::Point(116, 96));
@@ -711,15 +750,15 @@ SpeakerQR::SpeakerQR() {
_speakerName = "QR";
_newSceneNumber = 2611;
_textPos = Common::Point(10, 30);
- _colour1 = 13;
- _textMode = ALIGN_CENTRE;
+ _color1 = 35;
+ _textMode = ALIGN_CENTER;
}
void SpeakerQR::setText(const Common::String &msg) {
_object1.postInit(&_objectList);
_object1.setVisage(2613);
_object1.setStrip2(2);
- _object1.setPriority2(255);
+ _object1.fixPriority(255);
_object1.changeZoom(100);
_object1._frame = 1;
_object1.setPosition(Common::Point(191, 146));
@@ -728,7 +767,7 @@ void SpeakerQR::setText(const Common::String &msg) {
_object2.postInit(&_objectList);
_object2.setVisage(2613);
_object2.setStrip2(1);
- _object2.setPriority2(255);
+ _object2.fixPriority(255);
_object2.changeZoom(100);
_object2._frame = 1;
_object2.setPosition(Common::Point(197, 84));
@@ -743,28 +782,28 @@ SpeakerQU::SpeakerQU() {
_speakerName = "QU";
_newSceneNumber = 7020;
_textPos = Common::Point(160, 30);
- _colour1 = 35;
- _textMode = ALIGN_CENTRE;
+ _color1 = 35;
+ _textMode = ALIGN_CENTER;
}
void SpeakerQU::setText(const Common::String &msg) {
_object1.postInit(&_objectList);
_object1.setVisage(7021);
_object1.setStrip2(2);
- _object1.setPriority2(255);
+ _object1.fixPriority(255);
_object1.changeZoom(100);
_object1._frame = 1;
- _object1.setPosition(Common::Point(116, 120), 0);
- _object1.animate(ANIM_MODE_7, 0, 0);
+ _object1.setPosition(Common::Point(116, 120));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
_object2.postInit(&_objectList);
_object2.setVisage(7021);
_object2.setStrip2(1);
- _object2.setPriority2(255);
+ _object2.fixPriority(255);
_object2.changeZoom(100);
_object2._frame = 1;
- _object2.setPosition(Common::Point(111, 84), 0);
- _object2.setAction(&_speakerAction, 0);
+ _object2.setPosition(Common::Point(111, 84));
+ _object2.setAction(&_speakerAction, NULL);
Speaker::setText(msg);
}
@@ -775,21 +814,21 @@ SpeakerCR::SpeakerCR() {
_speakerName = "CR";
_newSceneNumber = 9010;
_textPos = Common::Point(20, 40);
- _colour1 = 4;
+ _color1 = 4;
}
void SpeakerCR::setText(const Common::String &msg) {
_object1.postInit(&_objectList);
_object1.setVisage(9011);
_object1.setStrip2(2);
- _object1.setPriority2(255);
+ _object1.fixPriority(255);
_object1.setPosition(Common::Point(219, 168));
_object1.animate(ANIM_MODE_7, 0, NULL);
_object2.postInit(&_objectList);
_object2.setVisage(9011);
_object2.setStrip2(1);
- _object2.setPriority2(255);
+ _object2.fixPriority(255);
_object2.setPosition(Common::Point(232, 81));
_object2.setAction(&_speakerAction, NULL);
@@ -801,15 +840,15 @@ void SpeakerCR::setText(const Common::String &msg) {
SpeakerMR::SpeakerMR() {
_speakerName = "MR";
_newSceneNumber = 2711;
- _textPos = Common::Point(40, 10);
- _colour1 = 22;
+ _textPos = Common::Point(10, 40);
+ _color1 = 22;
}
void SpeakerMR::setText(const Common::String &msg) {
_object1.postInit(&_objectList);
_object1.setVisage(2713);
_object1.setStrip2(2);
- _object1.setPriority2(255);
+ _object1.fixPriority(255);
_object1.changeZoom(100);
_object1._frame = 1;
_object1.setPosition(Common::Point(220, 143));
@@ -818,7 +857,8 @@ void SpeakerMR::setText(const Common::String &msg) {
_object2.postInit(&_objectList);
_object2.setVisage(2713);
_object2.setStrip2(1);
- _object2.setPriority2(255);
+ _object2.fixPriority(255);
+ _object2.changeZoom(100);
_object2._frame = 1;
_object2.setPosition(Common::Point(215, 99));
_object2.setAction(&_speakerAction, NULL);
@@ -832,15 +872,15 @@ SpeakerSAL::SpeakerSAL() {
_speakerName = "SAL";
_newSceneNumber = 2851;
_textPos = Common::Point(10, 30);
- _colour1 = 13;
- _textMode = ALIGN_CENTRE;
+ _color1 = 13;
+ _textMode = ALIGN_CENTER;
}
void SpeakerSAL::setText(const Common::String &msg) {
_object1.postInit(&_objectList);
_object1.setVisage(2853);
_object1.setStrip2(2);
- _object1.setPriority2(255);
+ _object1.fixPriority(255);
_object1.changeZoom(100);
_object1._frame = 1;
_object1.setPosition(Common::Point(185, 200));
@@ -849,7 +889,8 @@ void SpeakerSAL::setText(const Common::String &msg) {
_object2.postInit(&_objectList);
_object2.setVisage(2853);
_object2.setStrip2(1);
- _object2.setPriority2(255);
+ _object2.fixPriority(255);
+ _object2.changeZoom(100);
_object2._frame = 1;
_object2.setPosition(Common::Point(170, 92));
_object2.setAction(&_speakerAction, NULL);
@@ -863,14 +904,14 @@ SpeakerML::SpeakerML() {
_speakerName = "ML";
_newSceneNumber = 2710;
_textPos = Common::Point(160, 40);
- _colour1 = 22;
+ _color1 = 22;
}
void SpeakerML::setText(const Common::String &msg) {
_object1.postInit(&_objectList);
_object1.setVisage(2712);
_object1.setStrip2(2);
- _object1.setPriority2(255);
+ _object1.fixPriority(255);
_object1.changeZoom(100);
_object1._frame = 1;
_object1.setPosition(Common::Point(99, 143));
@@ -879,7 +920,8 @@ void SpeakerML::setText(const Common::String &msg) {
_object2.postInit(&_objectList);
_object2.setVisage(2712);
_object2.setStrip2(1);
- _object2.setPriority2(255);
+ _object2.fixPriority(255);
+ _object2.changeZoom(100);
_object2._frame = 1;
_object2.setPosition(Common::Point(105, 99));
_object2.setAction(&_speakerAction, NULL);
@@ -893,14 +935,14 @@ SpeakerCHFL::SpeakerCHFL() {
_speakerName = "CHFL";
_newSceneNumber = 4111;
_textPos = Common::Point(10, 40);
- _colour1 = 56;
+ _color1 = 56;
}
void SpeakerCHFL::setText(const Common::String &msg) {
_object1.postInit(&_objectList);
_object1.setVisage(4113);
_object1.setStrip2(2);
- _object1.setPriority2(255);
+ _object1.fixPriority(255);
_object1.changeZoom(100);
_object1._frame = 1;
_object1.setPosition(Common::Point(205, 116));
@@ -909,7 +951,8 @@ void SpeakerCHFL::setText(const Common::String &msg) {
_object2.postInit(&_objectList);
_object2.setVisage(4113);
_object2.setStrip2(1);
- _object2.setPriority2(255);
+ _object2.fixPriority(255);
+ _object2.changeZoom(100);
_object2._frame = 1;
_object2.setPosition(Common::Point(202, 71));
_object2.setAction(&_speakerAction, NULL);
@@ -923,14 +966,14 @@ SpeakerCHFR::SpeakerCHFR() {
_speakerName = "CHFR";
_newSceneNumber = 4110;
_textPos = Common::Point(160, 40);
- _colour1 = 56;
+ _color1 = 56;
}
void SpeakerCHFR::setText(const Common::String &msg) {
_object1.postInit(&_objectList);
_object1.setVisage(4112);
_object1.setStrip2(2);
- _object1.setPriority2(255);
+ _object1.fixPriority(255);
_object1.changeZoom(100);
_object1._frame = 1;
_object1.setPosition(Common::Point(103, 116));
@@ -939,7 +982,8 @@ void SpeakerCHFR::setText(const Common::String &msg) {
_object2.postInit(&_objectList);
_object2.setVisage(4112);
_object2.setStrip2(1);
- _object2.setPriority2(255);
+ _object2.fixPriority(255);
+ _object2.changeZoom(100);
_object2._frame = 1;
_object2.setPosition(Common::Point(106, 71));
_object2.setAction(&_speakerAction, NULL);
@@ -953,14 +997,14 @@ SpeakerPL::SpeakerPL() {
_speakerName = "PL";
_newSceneNumber = 4060;
_textPos = Common::Point(160, 40);
- _colour1 = 5;
+ _color1 = 5;
}
void SpeakerPL::setText(const Common::String &msg) {
_object1.postInit(&_objectList);
_object1.setVisage(4062);
_object1.setStrip2(2);
- _object1.setPriority2(255);
+ _object1.fixPriority(255);
_object1.changeZoom(100);
_object1._frame = 1;
_object1.setPosition(Common::Point(107, 117));
@@ -969,7 +1013,8 @@ void SpeakerPL::setText(const Common::String &msg) {
_object2.postInit(&_objectList);
_object2.setVisage(4062);
_object2.setStrip2(1);
- _object2.setPriority2(200);
+ _object2.fixPriority(200);
+ _object2.changeZoom(100);
_object2._frame = 1;
_object2.setPosition(Common::Point(105, 62));
_object2.setAction(&_speakerAction, NULL);
@@ -977,7 +1022,8 @@ void SpeakerPL::setText(const Common::String &msg) {
_object3.postInit(&_objectList);
_object3.setVisage(4062);
_object3.setStrip2(3);
- _object3.setPriority2(255);
+ _object3.fixPriority(255);
+ _object3.changeZoom(100);
_object3._frame = 1;
_object3.setPosition(Common::Point(105, 59));
_object3.setAction(&_speakerAction2, NULL);
@@ -996,14 +1042,14 @@ SpeakerPR::SpeakerPR() {
_speakerName = "PR";
_newSceneNumber = 4061;
_textPos = Common::Point(10, 40);
- _colour1 = 5;
+ _color1 = 5;
}
void SpeakerPR::setText(const Common::String &msg) {
_object1.postInit(&_objectList);
_object1.setVisage(4063);
_object1.setStrip2(1);
- _object1.setPriority2(255);
+ _object1.fixPriority(255);
_object1.changeZoom(100);
_object1._frame = 1;
_object1.setPosition(Common::Point(212, 117));
@@ -1012,7 +1058,7 @@ void SpeakerPR::setText(const Common::String &msg) {
_object2.postInit(&_objectList);
_object2.setVisage(4063);
_object2.setStrip2(2);
- _object2.setPriority2(200);
+ _object2.fixPriority(200);
_object2.changeZoom(100);
_object2._frame = 1;
_object2.setPosition(Common::Point(214, 62));
@@ -1021,7 +1067,7 @@ void SpeakerPR::setText(const Common::String &msg) {
_object3.postInit(&_objectList);
_object3.setVisage(4063);
_object3.setStrip2(3);
- _object3.setPriority2(255);
+ _object3.fixPriority(255);
_object3.changeZoom(100);
_object3._frame = 1;
_object3.setPosition(Common::Point(214, 59));
@@ -1041,14 +1087,14 @@ SpeakerCDR::SpeakerCDR() {
_speakerName = "CDR";
_newSceneNumber = 4161;
_textPos = Common::Point(10, 40);
- _colour1 = 52;
+ _color1 = 52;
}
void SpeakerCDR::setText(const Common::String &msg) {
_object1.postInit(&_objectList);
_object1.setVisage(4163);
_object1.setStrip2(1);
- _object1.setPriority2(255);
+ _object1.fixPriority(255);
_object1.changeZoom(100);
_object1._frame = 1;
_object1.setPosition(Common::Point(208, 97));
@@ -1057,7 +1103,7 @@ void SpeakerCDR::setText(const Common::String &msg) {
_object2.postInit(&_objectList);
_object2.setVisage(4163);
_object2.setStrip2(2);
- _object2.setPriority2(255);
+ _object2.fixPriority(255);
_object2.changeZoom(100);
_object2._frame = 1;
_object2.setPosition(Common::Point(200, 57));
@@ -1072,14 +1118,14 @@ SpeakerCDL::SpeakerCDL() {
_speakerName = "CDL";
_newSceneNumber = 4160;
_textPos = Common::Point(160, 40);
- _colour1 = 52;
+ _color1 = 52;
}
void SpeakerCDL::setText(const Common::String &msg) {
_object1.postInit(&_objectList);
_object1.setVisage(4162);
_object1.setStrip2(1);
- _object1.setPriority2(255);
+ _object1.fixPriority(255);
_object1.changeZoom(100);
_object1._frame = 1;
_object1.setPosition(Common::Point(112, 97));
@@ -1088,7 +1134,7 @@ void SpeakerCDL::setText(const Common::String &msg) {
_object2.postInit(&_objectList);
_object2.setVisage(4162);
_object2.setStrip2(2);
- _object2.setPriority2(255);
+ _object2.fixPriority(255);
_object2.changeZoom(100);
_object2._frame = 1;
_object2.setPosition(Common::Point(115, 57));
@@ -1103,14 +1149,14 @@ SpeakerFLL::SpeakerFLL() {
_speakerName = "FLL";
_newSceneNumber = 5221;
_textPos = Common::Point(10, 40);
- _colour1 = 17;
+ _color1 = 17;
}
void SpeakerFLL::setText(const Common::String &msg) {
_object1.postInit(&_objectList);
_object1.setVisage(5223);
_object1.setStrip2(2);
- _object1.setPriority2(255);
+ _object1.fixPriority(255);
_object1.changeZoom(100);
_object1._frame = 1;
_object1.setPosition(Common::Point(216, 129));
@@ -1119,7 +1165,7 @@ void SpeakerFLL::setText(const Common::String &msg) {
_object2.postInit(&_objectList);
_object2.setVisage(5223);
_object2.setStrip2(1);
- _object2.setPriority2(255);
+ _object2.fixPriority(255);
_object2.changeZoom(100);
_object2._frame = 1;
_object2.setPosition(Common::Point(210, 67));
@@ -1134,14 +1180,14 @@ SpeakerBatR::SpeakerBatR() {
_speakerName = "BATR";
_newSceneNumber = 5360;
_textPos = Common::Point(140, 40);
- _colour1 = 3;
+ _color1 = 3;
}
void SpeakerBatR::setText(const Common::String &msg) {
_object1.postInit(&_objectList);
_object1.setVisage(5361);
_object1.setStrip2(2);
- _object1.setPriority2(255);
+ _object1.fixPriority(255);
_object1.changeZoom(100);
_object1._frame = 1;
_object1.setPosition(Common::Point(137, 122));
@@ -1150,7 +1196,7 @@ void SpeakerBatR::setText(const Common::String &msg) {
_object2.postInit(&_objectList);
_object2.setVisage(5361);
_object2.setStrip2(1);
- _object2.setPriority2(255);
+ _object2.fixPriority(255);
_object2.changeZoom(100);
_object2._frame = 1;
_object2.setPosition(Common::Point(137, 104));
@@ -1159,4 +1205,239 @@ void SpeakerBatR::setText(const Common::String &msg) {
Speaker::setText(msg);
}
+/*--------------------------------------------------------------------------*/
+
+RingworldInvObjectList::RingworldInvObjectList() :
+ _stunner(2280, 1, 2, OBJECT_STUNNER, "This is your stunner."),
+ _scanner(1, 1, 3, OBJECT_SCANNER, "A combination scanner comm unit."),
+ _stasisBox(5200, 1, 4, OBJECT_STASIS_BOX, "A stasis box."),
+ _infoDisk(40, 1, 1, OBJECT_INFODISK, "The infodisk you took from the assassin."),
+ _stasisNegator(0, 2, 2, OBJECT_STASIS_NEGATOR, "The stasis field negator."),
+ _keyDevice(4250, 1, 6, OBJECT_KEY_DEVICE, "A magnetic key device."),
+ _medkit(2280, 1, 7, OBJECT_MEDKIT, "Your medkit."),
+ _ladder(4100, 1, 8, OBJECT_LADDER, "The chief's ladder."),
+ _rope(4150, 1, 9, OBJECT_ROPE, "The chief's rope."),
+ _key(7700, 1, 11, OBJECT_KEY, "A key."),
+ _translator(7700, 1, 13, OBJECT_TRANSLATOR, "The dolphin translator box."),
+ _ale(2150, 1, 10, OBJECT_ALE, "A bottle of ale."),
+ _paper(7700, 1, 12, OBJECT_PAPER, "A slip of paper with the numbers 2,4, and 3 written on it."),
+ _waldos(0, 1, 14, OBJECT_WALDOS, "A pair of waldos from the ruined probe."),
+ _stasisBox2(8100, 1, 4, OBJECT_STASIS_BOX2, "A stasis box."),
+ _ring(8100, 2, 5, OBJECT_RING, "This is a signet ring sent to you by Louis Wu."),
+ _cloak(9850, 2, 6, OBJECT_CLOAK, "A fine silk cloak."),
+ _tunic(9450, 2, 7, OBJECT_TUNIC, "The patriarch's soiled tunic."),
+ _candle(9500, 2, 8, OBJECT_CANDLE, "A tallow candle."),
+ _straw(9400, 2, 9, OBJECT_STRAW, "Clean, dry straw."),
+ _scimitar(9850, 1, 18, OBJECT_SCIMITAR, "A scimitar from the Patriarch's closet."),
+ _sword(9850, 1, 17, OBJECT_SWORD, "A short sword from the Patriarch's closet."),
+ _helmet(9500, 2, 4, OBJECT_HELMET, "Some type of helmet."),
+ _items(4300, 2, 10, OBJECT_ITEMS, "Two interesting items from the Tnuctipun vessel."),
+ _concentrator(4300, 2, 11, OBJECT_CONCENTRATOR, "The Tnuctipun anti-matter concentrator contained in a stasis field."),
+ _nullifier(5200, 2, 12, OBJECT_NULLIFIER, "A purported neural wave nullifier."),
+ _peg(4045, 2, 16, OBJECT_PEG, "A peg with a symbol."),
+ _vial(5100, 2, 17, OBJECT_VIAL, "A vial of the bat creatures anti-pheromone drug."),
+ _jacket(9850, 3, 1, OBJECT_JACKET, "A natty padded jacket."),
+ _tunic2(9850, 3, 2, OBJECT_TUNIC2, "A very hairy tunic."),
+ _bone(5300, 3, 5, OBJECT_BONE, "A very sharp bone."),
+ _jar(7700, 3, 4, OBJECT_JAR, "An jar filled with a green substance."),
+ _emptyJar(7700, 3, 3, OBJECT_EMPTY_JAR, "An empty jar.") {
+
+ // Add the items to the list
+ _itemList.push_back(&_stunner);
+ _itemList.push_back(&_scanner);
+ _itemList.push_back(&_stasisBox);
+ _itemList.push_back(&_infoDisk);
+ _itemList.push_back(&_stasisNegator);
+ _itemList.push_back(&_keyDevice);
+ _itemList.push_back(&_medkit);
+ _itemList.push_back(&_ladder);
+ _itemList.push_back(&_rope);
+ _itemList.push_back(&_key);
+ _itemList.push_back(&_translator);
+ _itemList.push_back(&_ale);
+ _itemList.push_back(&_paper);
+ _itemList.push_back(&_waldos);
+ _itemList.push_back(&_stasisBox2);
+ _itemList.push_back(&_ring);
+ _itemList.push_back(&_cloak);
+ _itemList.push_back(&_tunic);
+ _itemList.push_back(&_candle);
+ _itemList.push_back(&_straw);
+ _itemList.push_back(&_scimitar);
+ _itemList.push_back(&_sword);
+ _itemList.push_back(&_helmet);
+ _itemList.push_back(&_items);
+ _itemList.push_back(&_concentrator);
+ _itemList.push_back(&_nullifier);
+ _itemList.push_back(&_peg);
+ _itemList.push_back(&_vial);
+ _itemList.push_back(&_jacket);
+ _itemList.push_back(&_tunic2);
+ _itemList.push_back(&_bone);
+ _itemList.push_back(&_jar);
+ _itemList.push_back(&_emptyJar);
+
+ _selectedItem = NULL;
+}
+
+/*--------------------------------------------------------------------------*/
+
+void RingworldGame::restartGame() {
+ if (MessageDialog::show(RESTART_MSG, CANCEL_BTN_STRING, RESTART_BTN_STRING) == 1)
+ _globals->_game->restart();
+}
+
+void RingworldGame::saveGame() {
+ if (!_vm->canSaveGameStateCurrently())
+ MessageDialog::show(SAVING_NOT_ALLOWED_MSG, OK_BTN_STRING);
+ else {
+ // Show the save dialog
+ handleSaveLoad(true, _globals->_sceneHandler._saveGameSlot, _globals->_sceneHandler._saveName);
+ }
+}
+
+void RingworldGame::restoreGame() {
+ if (!_vm->canLoadGameStateCurrently())
+ MessageDialog::show(RESTORING_NOT_ALLOWED_MSG, OK_BTN_STRING);
+ else {
+ // Show the load dialog
+ handleSaveLoad(false, _globals->_sceneHandler._loadGameSlot, _globals->_sceneHandler._saveName);
+ }
+}
+
+void RingworldGame::quitGame() {
+ if (MessageDialog::show(QUIT_CONFIRM_MSG, CANCEL_BTN_STRING, QUIT_BTN_STRING) == 1)
+ _vm->quitGame();
+}
+
+void RingworldGame::handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) {
+ const EnginePlugin *plugin = 0;
+ EngineMan.findGame(_vm->getGameId(), &plugin);
+ GUI::SaveLoadChooser *dialog;
+ if (saveFlag)
+ dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"));
+ else
+ dialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"));
+
+ dialog->setSaveMode(saveFlag);
+
+ saveSlot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+ saveName = dialog->getResultString();
+
+ delete dialog;
+}
+
+void RingworldGame::start() {
+ // Set some default flags and cursor
+ _globals->setFlag(12);
+ _globals->setFlag(34);
+ _globals->_events.setCursor(CURSOR_WALK);
+
+ // Set the screen to scroll in response to the player moving off-screen
+ _globals->_scrollFollower = &_globals->_player;
+
+ // Set the object's that will be in the player's inventory by default
+ RING_INVENTORY._stunner._sceneNumber = 1;
+ RING_INVENTORY._scanner._sceneNumber = 1;
+ RING_INVENTORY._ring._sceneNumber = 1;
+
+ // Switch to the title screen
+ _globals->_sceneManager.setNewScene(1000);
+
+ _globals->_events.showCursor();
+}
+
+void RingworldGame::restart() {
+ _globals->_scenePalette.clearListeners();
+ _globals->_soundHandler.proc3();
+
+ // Reset the flags
+ _globals->reset();
+ _globals->setFlag(34);
+
+ // Clear save/load slots
+ _globals->_sceneHandler._saveGameSlot = -1;
+ _globals->_sceneHandler._loadGameSlot = -1;
+
+ _globals->_stripNum = 0;
+ _globals->_events.setCursor(CURSOR_WALK);
+
+ // Reset item properties
+ RING_INVENTORY._stunner._sceneNumber = 1;
+ RING_INVENTORY._scanner._sceneNumber = 1;
+ RING_INVENTORY._stasisBox._sceneNumber = 5200;
+ RING_INVENTORY._infoDisk._sceneNumber = 40;
+ RING_INVENTORY._stasisNegator._sceneNumber = 0;
+ RING_INVENTORY._keyDevice._sceneNumber = 0;
+ RING_INVENTORY._medkit._sceneNumber = 2280;
+ RING_INVENTORY._ladder._sceneNumber = 4100;
+ RING_INVENTORY._rope._sceneNumber = 4150;
+ RING_INVENTORY._key._sceneNumber = 7700;
+ RING_INVENTORY._translator._sceneNumber = 2150;
+ RING_INVENTORY._paper._sceneNumber = 7700;
+ RING_INVENTORY._waldos._sceneNumber = 0;
+ RING_INVENTORY._ring._sceneNumber = 1;
+ RING_INVENTORY._stasisBox2._sceneNumber = 8100;
+ RING_INVENTORY._cloak._sceneNumber = 9850;
+ RING_INVENTORY._tunic._sceneNumber = 9450;
+ RING_INVENTORY._candle._sceneNumber = 9500;
+ RING_INVENTORY._straw._sceneNumber = 9400;
+ RING_INVENTORY._scimitar._sceneNumber = 9850;
+ RING_INVENTORY._sword._sceneNumber = 9850;
+ RING_INVENTORY._helmet._sceneNumber = 9500;
+ RING_INVENTORY._items._sceneNumber = 4300;
+ RING_INVENTORY._concentrator._sceneNumber = 4300;
+ RING_INVENTORY._nullifier._sceneNumber = 4300;
+ RING_INVENTORY._peg._sceneNumber = 4045;
+ RING_INVENTORY._vial._sceneNumber = 5100;
+ RING_INVENTORY._jacket._sceneNumber = 9850;
+ RING_INVENTORY._tunic2._sceneNumber = 9850;
+ RING_INVENTORY._bone._sceneNumber = 5300;
+ RING_INVENTORY._jar._sceneNumber = 7700;
+ RING_INVENTORY._emptyJar._sceneNumber = 7700;
+ RING_INVENTORY._selectedItem = NULL;
+
+ // Change to the first game scene
+ _globals->_sceneManager.changeScene(30);
+}
+
+void RingworldGame::endGame(int resNum, int lineNum) {
+ _globals->_events.setCursor(CURSOR_WALK);
+ Common::String msg = _resourceManager->getMessage(resNum, lineNum);
+ bool savesExist = _saver->savegamesExist();
+
+ if (!savesExist) {
+ // No savegames exist, so prompt the user to restart or quit
+ if (MessageDialog::show(msg, QUIT_BTN_STRING, RESTART_BTN_STRING) == 0)
+ _vm->quitGame();
+ else
+ restart();
+ } else {
+ // Savegames exist, so prompt for Restore/Restart
+ bool breakFlag;
+ do {
+ if (MessageDialog::show(msg, RESTART_BTN_STRING, RESTORE_BTN_STRING) == 0) {
+ breakFlag = true;
+ } else {
+ handleSaveLoad(false, _globals->_sceneHandler._loadGameSlot, _globals->_sceneHandler._saveName);
+ breakFlag = _globals->_sceneHandler._loadGameSlot > 0;
+ }
+ } while (!breakFlag);
+ }
+
+ _globals->_events.setCursorFromFlag();
+}
+
+/*--------------------------------------------------------------------------*/
+
+void RingworldDemoGame::start() {
+ // Start the demo's single scene
+ _globals->_sceneManager.changeScene(1);
+
+ _globals->_events.setCursor(CURSOR_NONE);
+}
+
+void RingworldDemoGame::restart() {
+}
+
} // End of namespace tSage
diff --git a/engines/tsage/ringworld_logic.h b/engines/tsage/ringworld_logic.h
index 66c7bff912..e84779e6ad 100644
--- a/engines/tsage/ringworld_logic.h
+++ b/engines/tsage/ringworld_logic.h
@@ -97,7 +97,7 @@ public:
void display();
void restore();
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual void draw(bool flag);
virtual void wait();
};
@@ -192,6 +192,7 @@ public:
SpeakerGR();
virtual Common::String getClassName() { return "SpeakerGR"; }
+ virtual void setText(const Common::String &msg);
};
class SpeakerHText : public ScreenSpeaker {
@@ -397,6 +398,77 @@ public:
virtual void setText(const Common::String &msg);
};
+/*--------------------------------------------------------------------------*/
+
+class RingworldInvObjectList : public InvObjectList {
+public:
+ InvObject _stunner;
+ InvObject _scanner;
+ InvObject _stasisBox;
+ InvObject _infoDisk;
+ InvObject _stasisNegator;
+ InvObject _keyDevice;
+ InvObject _medkit;
+ InvObject _ladder;
+ InvObject _rope;
+ InvObject _key;
+ InvObject _translator;
+ InvObject _ale;
+ InvObject _paper;
+ InvObject _waldos;
+ InvObject _stasisBox2;
+ InvObject _ring;
+ InvObject _cloak;
+ InvObject _tunic;
+ InvObject _candle;
+ InvObject _straw;
+ InvObject _scimitar;
+ InvObject _sword;
+ InvObject _helmet;
+ InvObject _items;
+ InvObject _concentrator;
+ InvObject _nullifier;
+ InvObject _peg;
+ InvObject _vial;
+ InvObject _jacket;
+ InvObject _tunic2;
+ InvObject _bone;
+ InvObject _jar;
+ InvObject _emptyJar;
+public:
+ RingworldInvObjectList();
+
+ virtual Common::String getClassName() { return "RingworldInvObjectList"; }
+};
+
+#define RING_INVENTORY (*((RingworldInvObjectList *)_globals->_inventory))
+
+class RingworldGame: public Game {
+protected:
+ virtual void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName);
+public:
+ virtual void start();
+ virtual void restart();
+ virtual void restartGame();
+ virtual void saveGame();
+ virtual void restoreGame();
+ virtual void quitGame();
+ virtual void endGame(int resNum, int lineNum);
+};
+
+class RingworldDemoGame: public Game {
+protected:
+ virtual void restart();
+public:
+ virtual void start();
+ virtual void restartGame() {}
+ virtual void saveGame() {}
+ virtual void restoreGame() {}
+ virtual void quitGame() {}
+ virtual void endGame(int resNum, int lineNum) {}
+};
+
+
} // End of namespace tSage
#endif
diff --git a/engines/tsage/ringworld_scenes1.cpp b/engines/tsage/ringworld_scenes1.cpp
index 4497d6af75..e5ec60c690 100644
--- a/engines/tsage/ringworld_scenes1.cpp
+++ b/engines/tsage/ringworld_scenes1.cpp
@@ -48,7 +48,7 @@ void Scene10::Action1::signal() {
break;
case 2:
scene->_speakerSText.setTextPos(Common::Point(20, 20));
- scene->_speakerSText._colour1 = 10;
+ scene->_speakerSText._color1 = 10;
scene->_speakerSText._textWidth = 160;
scene->_stripManager.start(11, this, scene);
break;
@@ -138,10 +138,10 @@ void Scene10::postInit(SceneObjectList *OwnerList) {
_speakerSText._hideObjects = false;
_speakerQText._hideObjects = false;
_speakerQText.setTextPos(Common::Point(140, 120));
- _speakerQText._colour1 = 4;
+ _speakerQText._color1 = 4;
_speakerQText._textWidth = 160;
_speakerSText.setTextPos(Common::Point(20, 20));
- _speakerSText._colour1 = 7;
+ _speakerSText._color1 = 7;
_speakerSText._textWidth = 320;
_stripManager.setCallback(this);
@@ -149,20 +149,20 @@ void Scene10::postInit(SceneObjectList *OwnerList) {
_object1.postInit();
_object1.setVisage(10);
_object1.setPosition(Common::Point(232, 90));
- _object1.setPriority2(1);
+ _object1.fixPriority(1);
_object2.postInit();
_object2.setVisage(10);
_object2.setStrip(4);
_object2.setFrame(1);
_object2.setPosition(Common::Point(204, 59));
- _object2.setPriority2(198);
+ _object2.fixPriority(198);
_object3.postInit();
_object3.setVisage(10);
_object3.setStrip2(5);
_object3.setPosition(Common::Point(180, 87));
- _object3.setPriority2(196);
+ _object3.fixPriority(196);
_object3.setAction(&_action2);
_object4.postInit();
@@ -221,12 +221,12 @@ void Scene15::Action1::signal() {
setDelay(60);
break;
case 1:
- SceneItem::display(15, 0, SET_Y, 20, SET_FONT, 2, SET_BG_COLOUR, -1, SET_EXT_BGCOLOUR, 7,
+ SceneItem::display(15, 0, SET_Y, 20, SET_FONT, 2, SET_BG_COLOR, -1, SET_EXT_BGCOLOR, 7,
SET_WIDTH, 320, SET_KEEP_ONSCREEN, 1, LIST_END);
setDelay(300);
break;
case 2: {
- SceneItem::display(15, 1, SET_Y, 20, SET_FONT, 2, SET_BG_COLOUR, -1, SET_EXT_BGCOLOUR, 7,
+ SceneItem::display(15, 1, SET_Y, 20, SET_FONT, 2, SET_BG_COLOR, -1, SET_EXT_BGCOLOR, 7,
SET_WIDTH, 320, SET_KEEP_ONSCREEN, 1, LIST_END);
scene->_object1.postInit();
scene->_object1.setVisage(15);
@@ -300,7 +300,7 @@ void Scene20::Action2::signal() {
break;
case 1:
SceneItem::display(20, 1, SET_WIDTH, 200, SET_Y, 20, SET_X, 160, SET_KEEP_ONSCREEN, true,
- SET_EXT_BGCOLOUR, 4, LIST_END);
+ SET_EXT_BGCOLOR, 4, LIST_END);
setDelay(120);
break;
case 2: {
@@ -512,7 +512,7 @@ void Scene20::Action4::signal() {
scene->_sound.startSound(77, this, 127);
break;
case 8:
- _globals->_game.endGame(20, 0);
+ _globals->_game->endGame(20, 0);
break;
default:
break;
@@ -533,6 +533,7 @@ void Scene20::postInit(SceneObjectList *OwnerList) {
_speakerQText._npc = &_globals->_player;
if (_globals->_sceneManager._previousScene == 30) {
+ // Cut scene: Assassins are coming
_globals->_player.postInit();
_globals->_player.setVisage(20);
_globals->_player.setPosition(Common::Point(405, 69));
@@ -558,29 +559,13 @@ void Scene20::postInit(SceneObjectList *OwnerList) {
_sceneBounds = Rect(320, 0, 640, 200);
} else if (_globals->_sceneManager._previousScene == 60) {
- _globals->_player.postInit();
- _globals->_player.setVisage(2640);
- _globals->_player.animate(ANIM_MODE_NONE, NULL);
- _globals->_player.setStrip2(1);
- _globals->_player.setFrame2(4);
- _globals->_player.setPriority2(200);
- _globals->_player.setPosition(Common::Point(425, 233));
-
- setAction(&_action1);
- _speakerQText.setTextPos(Common::Point(350, 20));
- _speakerQText._textWidth = 260;
- _speakerGameText.setTextPos(Common::Point(350, 20));
- _speakerGameText._textWidth = 260;
-
- _globals->_soundHandler.startSound(8);
- _sceneBounds = Rect(320, 0, 640, 200);
- } else {
+ // Evasion
_sound.startSound(30);
_globals->_player.postInit();
_globals->_player.setVisage(20);
_globals->_player.setPosition(Common::Point(588, 79));
_globals->_player._moveDiff = Common::Point(5, 5);
- _globals->_player.setPriority2(50);
+ _globals->_player.fixPriority(50);
_globals->_player.animate(ANIM_MODE_1, NULL);
_SceneObjectExt.postInit();
@@ -590,22 +575,41 @@ void Scene20::postInit(SceneObjectList *OwnerList) {
_sceneObject3.postInit();
_sceneObject3.setVisage(20);
- _sceneObject3.setStrip(2);
- _SceneObjectExt.setPosition(Common::Point(595, 79));
- _SceneObjectExt.animate(ANIM_MODE_1, NULL);
+ _sceneObject3.setStrip2(2);
+ _sceneObject3.setPosition(Common::Point(595, 79));
+ _sceneObject3.animate(ANIM_MODE_1, NULL);
if ((_globals->getFlag(120) && _globals->getFlag(116)) ||
(_globals->getFlag(117) && _globals->getFlag(119))) {
+ // Successful evasion
setAction(&_action3);
} else if (_globals->getFlag(104)) {
_sceneMode = 21;
setAction(&_sequenceManager, this, 21, &_globals->_player, &_SceneObjectExt, NULL);
} else {
+ // Failed evasion
_sceneObject3._moveDiff = Common::Point(8, 8);
setAction(&_action4);
}
+ _sceneBounds.center(_globals->_player._position.x, _globals->_player._position.y);
+ } else {
+ // Intro: Quinn looking at the monaster
+ _globals->_player.postInit();
+ _globals->_player.setVisage(2640);
+ _globals->_player.animate(ANIM_MODE_NONE, NULL);
+ _globals->_player.setStrip2(1);
+ _globals->_player.setFrame2(4);
+ _globals->_player.fixPriority(200);
+ _globals->_player.setPosition(Common::Point(425, 233));
- _sceneBounds.centre(_globals->_player._position.x, _globals->_player._position.y);
+ setAction(&_action1);
+ _speakerQText.setTextPos(Common::Point(350, 20));
+ _speakerQText._textWidth = 260;
+ _speakerGameText.setTextPos(Common::Point(350, 20));
+ _speakerGameText._textWidth = 260;
+
+ _globals->_soundHandler.startSound(8);
+ _sceneBounds = Rect(320, 0, 640, 200);
}
_globals->_player.disableControl();
@@ -622,6 +626,29 @@ void Scene20::signal() {
*
*--------------------------------------------------------------------------*/
+void Scene30::BeamObject::doAction(int action) {
+ if (action == OBJECT_SCANNER)
+ display2(30, 14);
+ else if (action == CURSOR_LOOK)
+ display2(30, 2);
+ else if (action == CURSOR_USE) {
+ Scene30 *parent = (Scene30 *)_globals->_sceneManager._scene;
+ parent->setAction(&parent->_beamAction);
+ } else
+ SceneObject::doAction(action);
+}
+
+void Scene30::DoorObject::doAction(int action) {
+ if (action == OBJECT_SCANNER)
+ display2(30, 13);
+ else if (action == CURSOR_LOOK)
+ display2(30, 1);
+ else if (action == CURSOR_USE)
+ display2(30, 7);
+ else
+ SceneObject::doAction(action);
+}
+
void Scene30::BeamAction::signal() {
Scene30 *scene = (Scene30 *)_globals->_sceneManager._scene;
@@ -817,7 +844,7 @@ void Scene30::KzinObject::doAction(int action) {
display2(30, 11);
break;
case OBJECT_RING:
- _globals->_inventory._ring._sceneNumber = 30;
+ RING_INVENTORY._ring._sceneNumber = 30;
scene->setAction(&scene->_ringAction);
break;
case CURSOR_LOOK:
@@ -874,7 +901,7 @@ void Scene30::postInit(SceneObjectList *OwnerList) {
_beam.setVisage(31);
_beam.setStrip(2);
_beam.setPosition(Common::Point(124, 178));
- _beam.setPriority2(188);
+ _beam.fixPriority(188);
// Set up door object
_door.postInit();
@@ -900,7 +927,7 @@ void Scene30::signal() {
_beam.setVisage(31);
_beam.setStrip(2);
_beam.setPosition(Common::Point(124, 178));
- _beam.setPriority2(188);
+ _beam.fixPriority(188);
_globals->_sceneItems.push_front(&_beam);
_globals->_player.enableControl();
} else if (_sceneMode == 32) {
@@ -977,7 +1004,8 @@ void Scene40::Action1::signal() {
break;
case 9: {
scene->_dyingKzin.setStrip(1);
- scene->_dyingKzin.setFrame(1);
+ //Workaround: The original uses setFrame(1) but it's completely wrong.
+ scene->_dyingKzin.setFrame(2);
scene->_dyingKzin._moveDiff.y = 15;
scene->_dyingKzin.animate(ANIM_MODE_5, NULL);
Common::Point pt(223, 186);
@@ -1035,7 +1063,7 @@ void Scene40::Action1::signal() {
_globals->_soundHandler.startSound(77, this);
break;
case 17:
- _globals->_game.endGame(40, 20);
+ _globals->_game->endGame(40, 20);
remove();
break;
}
@@ -1062,10 +1090,10 @@ void Scene40::Action2::signal() {
scene->_doorway.postInit();
scene->_doorway.setVisage(16);
scene->_doorway.setStrip2(6);
- scene->_doorway.setPriority2(200);
+ scene->_doorway.fixPriority(200);
scene->_doorway.setPosition(Common::Point(159, 191));
scene->_doorway._moveDiff = Common::Point(40, 40);
- scene->_doorway._field7A = 60;
+ scene->_doorway._moveRate = 60;
scene->_doorway.animate(ANIM_MODE_5, NULL);
Common::Point pt(271, 165);
@@ -1079,7 +1107,7 @@ void Scene40::Action2::signal() {
scene->_assassin._frame = 1;
scene->_assassin.animate(ANIM_MODE_5, this);
scene->_soundHandler.startSound(29);
- _globals->_inventory._infoDisk._sceneNumber = 40;
+ RING_INVENTORY._infoDisk._sceneNumber = 40;
break;
case 4:
_globals->_player.animate(ANIM_MODE_6, this);
@@ -1146,7 +1174,7 @@ void Scene40::Action3::signal() {
case 2:
scene->_assassin.setStrip(2);
scene->_assassin.setFrame(1);
- _globals->_inventory._infoDisk._sceneNumber = 1;
+ RING_INVENTORY._infoDisk._sceneNumber = 1;
_globals->_player.animate(ANIM_MODE_6, this);
break;
case 3:
@@ -1180,7 +1208,7 @@ void Scene40::Action5::signal() {
switch (_actionIndex++) {
case 0:
- setDelay(_globals->_randomSource.getRandomNumber(120));
+ setDelay(_globals->_randomSource.getRandomNumber(119) + 120);
break;
case 1:
scene->_object2.animate(ANIM_MODE_8, 1, this);
@@ -1196,12 +1224,13 @@ void Scene40::Action6::signal() {
scene->_object1.postInit();
scene->_object1.setVisage(16);
scene->_object1.setStrip2(6);
+ scene->_object1._moveDiff = Common::Point(40, 40);
scene->_object1.setPosition(Common::Point(313, 53));
- scene->_object1._field7A = 60;
+ scene->_object1._moveRate = 60;
Common::Point pt(141, 194);
NpcMover *mover = new NpcMover();
- scene->_object1.addMover(mover, &pt, this);
+ scene->_object1.addMover(mover, &pt, NULL);
scene->_object1.animate(ANIM_MODE_5, NULL);
scene->_doorway.postInit();
@@ -1229,6 +1258,7 @@ void Scene40::Action7::signal() {
switch (_actionIndex++) {
case 0:
+ // TODO: check if it's rand(500) or rand(499)+500
setDelay(_globals->_randomSource.getRandomNumber(500));
break;
case 1:
@@ -1242,6 +1272,8 @@ void Scene40::Action7::signal() {
scene->_object7.setPosition(Common::Point(305, 61));
scene->_object7.setFrame(15);
}
+ scene->_object7.animate(ANIM_MODE_5, this);
+ scene->_soundHandler.startSound(25);
break;
case 2:
scene->_object7.remove();
@@ -1268,11 +1300,11 @@ void Scene40::Action8::signal() {
scene->_doorway.postInit();
scene->_doorway.setVisage(16);
scene->_doorway.setStrip2(6);
- scene->_doorway.setPriority2(200);
- scene->_doorway._field7A = 60;
+ scene->_doorway.fixPriority(200);
+ scene->_doorway._moveRate = 60;
if (_globals->_player._position.x >= 145) {
- scene->_doorway.setPriority2(-1);
+ scene->_doorway.fixPriority(-1);
scene->_doorway.setPosition(Common::Point(6, 157));
} else {
scene->_doorway.setPosition(Common::Point(313, 53));
@@ -1296,7 +1328,7 @@ void Scene40::Action8::signal() {
_globals->_soundHandler.startSound(77, this);
break;
case 4:
- _globals->_game.endGame(40, 45);
+ _globals->_game->endGame(40, 45);
remove();
break;
}
@@ -1307,11 +1339,11 @@ void Scene40::Action8::signal() {
void Scene40::DyingKzin::doAction(int action) {
switch (action) {
case OBJECT_STUNNER:
- SceneItem::display2(40, 43);
- break;
- case CURSOR_CROSSHAIRS:
SceneItem::display2(40, 44);
break;
+ case OBJECT_SCANNER:
+ SceneItem::display2(40, 43);
+ break;
case CURSOR_LOOK:
SceneItem::display2(40, 12);
break;
@@ -1328,7 +1360,7 @@ void Scene40::Assassin::doAction(int action) {
Scene40 *scene = (Scene40 *)_globals->_sceneManager._scene;
switch (action) {
- case CURSOR_CROSSHAIRS:
+ case OBJECT_STUNNER:
if (scene->_assassin._visage == 44)
SceneItem::display2(40, 21);
else {
@@ -1336,6 +1368,7 @@ void Scene40::Assassin::doAction(int action) {
Common::Point pt(230, 187);
NpcMover *mover = new NpcMover();
addMover(mover, &pt, NULL);
+ scene->setAction(&scene->_action2);
}
break;
case OBJECT_SCANNER:
@@ -1345,12 +1378,12 @@ void Scene40::Assassin::doAction(int action) {
if (scene->_assassin._visage != 44)
SceneItem::display2(40, 13);
else
- SceneItem::display2(40, (_globals->_inventory._infoDisk._sceneNumber == 1) ? 19 : 14);
+ SceneItem::display2(40, (RING_INVENTORY._infoDisk._sceneNumber == 1) ? 19 : 14);
break;
case CURSOR_USE:
if (scene->_assassin._visage != 44)
SceneItem::display2(40, 15);
- else if (_globals->_inventory._infoDisk._sceneNumber == 1)
+ else if (RING_INVENTORY._infoDisk._sceneNumber == 1)
SceneItem::display2(40, 19);
else {
_globals->_player.disableControl();
@@ -1370,7 +1403,7 @@ void Scene40::Assassin::doAction(int action) {
void Scene40::Item2::doAction(int action) {
switch (action) {
- case CURSOR_CROSSHAIRS:
+ case OBJECT_STUNNER:
SceneItem::display2(40, 35);
_globals->_events.setCursor(CURSOR_WALK);
break;
@@ -1394,7 +1427,7 @@ void Scene40::Item2::doAction(int action) {
void Scene40::Item6::doAction(int action) {
switch (action) {
- case CURSOR_CROSSHAIRS:
+ case OBJECT_STUNNER:
SceneItem::display2(40, 25);
_globals->_events.setCursor(CURSOR_WALK);
break;
@@ -1416,12 +1449,12 @@ void Scene40::Item6::doAction(int action) {
/*--------------------------------------------------------------------------*/
Scene40::Scene40() :
- _item1(2, OBJECT_SCANNER, 40, 24, CURSOR_CROSSHAIRS, 40, 25, CURSOR_LOOK, 40, 7, CURSOR_USE, 40, 16, LIST_END),
- _item3(5, OBJECT_SCANNER, 40, 26, CURSOR_CROSSHAIRS, 40, 27, CURSOR_LOOK, 40, 9, CURSOR_USE, 40, 17, LIST_END),
- _item4(6, OBJECT_SCANNER, 40, 31, CURSOR_CROSSHAIRS, 40, 32, CURSOR_LOOK, 40, 5, CURSOR_USE, 40, 33, LIST_END),
+ _item1(2, OBJECT_SCANNER, 40, 24, OBJECT_STUNNER, 40, 25, CURSOR_LOOK, 40, 7, CURSOR_USE, 40, 16, LIST_END),
+ _item3(5, OBJECT_SCANNER, 40, 26, OBJECT_STUNNER, 40, 27, CURSOR_LOOK, 40, 9, CURSOR_USE, 40, 17, LIST_END),
+ _item4(6, OBJECT_SCANNER, 40, 31, OBJECT_STUNNER, 40, 32, CURSOR_LOOK, 40, 5, CURSOR_USE, 40, 33, LIST_END),
_item5(0, CURSOR_LOOK, 40, 11, LIST_END),
- _item7(4, OBJECT_SCANNER, 40, 26, CURSOR_CROSSHAIRS, 40, 27, CURSOR_LOOK, 40, 9, CURSOR_USE, 40, 17, LIST_END),
- _item8(8, OBJECT_SCANNER, 40, 39, CURSOR_CROSSHAIRS, 40, 40, CURSOR_LOOK, 40, 3, CURSOR_USE, 40, 41, LIST_END) {
+ _item7(4, OBJECT_SCANNER, 40, 26, OBJECT_STUNNER, 40, 27, CURSOR_LOOK, 40, 9, CURSOR_USE, 40, 17, LIST_END),
+ _item8(8, OBJECT_SCANNER, 40, 39, OBJECT_STUNNER, 40, 40, CURSOR_LOOK, 40, 3, CURSOR_USE, 40, 41, LIST_END) {
}
void Scene40::postInit(SceneObjectList *OwnerList) {
@@ -1437,7 +1470,7 @@ void Scene40::postInit(SceneObjectList *OwnerList) {
_stripManager.addSpeaker(&_speakerSText);
_stripManager.addSpeaker(&_speakerGameText);
- _speakerGameText._colour1 = 9;
+ _speakerGameText._color1 = 9;
_speakerGameText.setTextPos(Common::Point(160, 30));
_speakerQText._npc = &_globals->_player;
_speakerSText._npc = &_object1;
@@ -1459,14 +1492,14 @@ void Scene40::postInit(SceneObjectList *OwnerList) {
_object2.postInit();
_object2.setVisage(41);
_object2.setStrip(6);
- _object2.setPriority2(200);
+ _object2.fixPriority(200);
_object2.setPosition(Common::Point(94, 189));
_object2.setAction(&_action5);
_object3.postInit();
_object3.setVisage(41);
_object3.setStrip(5);
- _object3.setPriority2(205);
+ _object3.fixPriority(205);
_object3.setPosition(Common::Point(110, 186));
_object3._numFrames = 2;
_object3.animate(ANIM_MODE_8, NULL, NULL);
@@ -1479,7 +1512,7 @@ void Scene40::postInit(SceneObjectList *OwnerList) {
_dyingKzin.setVisage(40);
_dyingKzin.setStrip(6);
_dyingKzin.setPosition(Common::Point(-90, 65));
- _dyingKzin.setPriority2(170);
+ _dyingKzin.fixPriority(170);
setAction(&_action1);
} else {
@@ -1492,7 +1525,7 @@ void Scene40::postInit(SceneObjectList *OwnerList) {
_dyingKzin.postInit();
_dyingKzin.setVisage(40);
_dyingKzin.setPosition(Common::Point(205, 183));
- _dyingKzin.setPriority2(170);
+ _dyingKzin.fixPriority(170);
_dyingKzin._frame = 9;
_dyingKzin.setAction(&_action7);
@@ -1501,7 +1534,7 @@ void Scene40::postInit(SceneObjectList *OwnerList) {
_assassin.setPosition(Common::Point(230, 187));
_assassin.setAction(&_action8);
- if (_globals->_inventory._infoDisk._sceneNumber == 40) {
+ if (RING_INVENTORY._infoDisk._sceneNumber == 40) {
_assassin.setStrip(1);
_assassin.setFrame(_assassin.getFrameCount());
} else {
@@ -1759,19 +1792,19 @@ void Scene50::postInit(SceneObjectList *OwnerList) {
_object2.setVisage(2331);
_object2.setStrip(6);
_object2.setPosition(Common::Point(136, 192));
- _object2.setPriority2(200);
+ _object2.fixPriority(200);
_object3.postInit();
_object3.setVisage(2337);
_object3.setStrip(6);
_object3.setPosition(Common::Point(260, 180));
- _object3.setPriority2(200);
+ _object3.fixPriority(200);
_object4.postInit();
_object4.setVisage(2331);
_object4.setStrip(6);
_object4.setPosition(Common::Point(295, 144));
- _object4.setPriority2(178);
+ _object4.fixPriority(178);
_globals->_sceneItems.addItems(&_object2, &_object3, &_object4, NULL);
@@ -1833,33 +1866,33 @@ void Scene60::Action1::signal() {
setDelay(3);
break;
case 1:
- scene->_object9.postInit();
- scene->_object9.setVisage(60);
- scene->_object9.setStrip(7);
- scene->_object9.setPosition(Common::Point(136, 65));
- scene->_object9.animate(ANIM_MODE_5, this);
+ scene->_floppyDrive.postInit();
+ scene->_floppyDrive.setVisage(60);
+ scene->_floppyDrive.setStrip(7);
+ scene->_floppyDrive.setPosition(Common::Point(136, 65));
+ scene->_floppyDrive.animate(ANIM_MODE_5, this);
scene->_soundHandler1.startSound(35);
break;
case 2:
- scene->_object10.postInit();
- scene->_object10.setVisage(60);
- scene->_object10.setPosition(Common::Point(199, 186));
- scene->_object10.animate(ANIM_MODE_8, 0, NULL);
- scene->_object10._numFrames = 5;
+ scene->_redLights.postInit();
+ scene->_redLights.setVisage(60);
+ scene->_redLights.setPosition(Common::Point(199, 186));
+ scene->_redLights.animate(ANIM_MODE_8, 0, NULL);
+ scene->_redLights._numFrames = 5;
- scene->_object6.animate(ANIM_MODE_2, NULL);
+ scene->_controlButton.animate(ANIM_MODE_2, NULL);
if (!_globals->getFlag(83)) {
- scene->_object5.postInit();
- scene->_object5.setVisage(60);
- scene->_object5.setStrip2(3);
- scene->_object5.setFrame(2);
- scene->_object5.setPosition(Common::Point(148, 85));
- scene->_object5.animate(ANIM_MODE_2, NULL);
- scene->_object5._numFrames = 5;
-
- _globals->_sceneItems.push_front(&scene->_object5);
+ scene->_message.postInit();
+ scene->_message.setVisage(60);
+ scene->_message.setStrip2(3);
+ scene->_message.setFrame(2);
+ scene->_message.setPosition(Common::Point(148, 85));
+ scene->_message.animate(ANIM_MODE_2, NULL);
+ scene->_message._numFrames = 5;
+
+ _globals->_sceneItems.push_front(&scene->_message);
scene->_soundHandler2.startSound(38);
}
@@ -1868,40 +1901,40 @@ void Scene60::Action1::signal() {
case 3:
scene->_soundHandler2.startSound(37);
scene->loadScene(65);
- scene->_object5.remove();
+ scene->_message.remove();
- if (_globals->_sceneObjects->contains(&scene->_object10))
- scene->_object10.remove();
+ if (_globals->_sceneObjects->contains(&scene->_redLights))
+ scene->_redLights.remove();
- scene->_object6.remove();
+ scene->_controlButton.remove();
scene->_slaveButton.remove();
- scene->_object8.remove();
+ scene->_masterButton.remove();
scene->_item1.remove();
scene->_item2.remove();
- scene->_object3.postInit();
- scene->_object3.setVisage(65);
- scene->_object3.setPosition(Common::Point(118, 197));
-
- scene->_object2.postInit();
- scene->_object2.setVisage(65);
- scene->_object2.setStrip(2);
- scene->_object2.setPosition(Common::Point(160, 197));
-
- scene->_object4.postInit();
- scene->_object4.setVisage(65);
- scene->_object4.setStrip(3);
- scene->_object4.setPosition(Common::Point(202, 197));
-
- scene->_object1.postInit();
- scene->_object1.setVisage(65);
- scene->_object1.setStrip(4);
- scene->_object1.setFrame(1);
- scene->_object1.setPosition(Common::Point(145, 165));
-
- _globals->_sceneItems.push_front(&scene->_object3);
- _globals->_sceneItems.push_front(&scene->_object2);
- _globals->_sceneItems.push_front(&scene->_object4);
+ scene->_nextButton.postInit();
+ scene->_nextButton.setVisage(65);
+ scene->_nextButton.setPosition(Common::Point(118, 197));
+
+ scene->_prevButton.postInit();
+ scene->_prevButton.setVisage(65);
+ scene->_prevButton.setStrip(2);
+ scene->_prevButton.setPosition(Common::Point(160, 197));
+
+ scene->_exitButton.postInit();
+ scene->_exitButton.setVisage(65);
+ scene->_exitButton.setStrip(3);
+ scene->_exitButton.setPosition(Common::Point(202, 197));
+
+ scene->_rose.postInit();
+ scene->_rose.setVisage(65);
+ scene->_rose.setStrip(4);
+ scene->_rose.setFrame(1);
+ scene->_rose.setPosition(Common::Point(145, 165));
+
+ _globals->_sceneItems.push_front(&scene->_nextButton);
+ _globals->_sceneItems.push_front(&scene->_prevButton);
+ _globals->_sceneItems.push_front(&scene->_exitButton);
setDelay(10);
_globals->_events.setCursor(CURSOR_USE);
@@ -1913,33 +1946,33 @@ void Scene60::Action1::signal() {
case 6:
case 7:
SceneItem::display(60, _actionIndex - 4, SET_Y, 40, SET_X, 25, SET_FONT, 75,
- SET_EXT_BGCOLOUR, -1, SET_FG_COLOUR, 34, SET_POS_MODE, 0,
+ SET_EXT_BGCOLOR, -1, SET_FG_COLOR, 34, SET_POS_MODE, 0,
SET_WIDTH, 280, SET_KEEP_ONSCREEN, 1, LIST_END);
_globals->_events.setCursor(CURSOR_USE);
break;
case 9:
_globals->_player._uiEnabled = false;
- _globals->_inventory._infoDisk._sceneNumber = 1;
+ RING_INVENTORY._infoDisk._sceneNumber = 1;
- if (_globals->_sceneObjects->contains(&scene->_object5))
- scene->_object5.remove();
+ if (_globals->_sceneObjects->contains(&scene->_message))
+ scene->_message.remove();
- scene->_object6.animate(ANIM_MODE_NONE);
- scene->_object6.setFrame(1);
- scene->_object10.remove();
+ scene->_controlButton.animate(ANIM_MODE_NONE);
+ scene->_controlButton.setFrame(1);
+ scene->_redLights.remove();
- scene->_object9.postInit();
- scene->_object9.setVisage(60);
- scene->_object9.setStrip(7);
- scene->_object9.setPosition(Common::Point(136, 65));
- scene->_object9.setFrame(scene->_object9.getFrameCount());
- scene->_object9.animate(ANIM_MODE_6, this);
+ scene->_floppyDrive.postInit();
+ scene->_floppyDrive.setVisage(60);
+ scene->_floppyDrive.setStrip(7);
+ scene->_floppyDrive.setPosition(Common::Point(136, 65));
+ scene->_floppyDrive.setFrame(scene->_floppyDrive.getFrameCount());
+ scene->_floppyDrive.animate(ANIM_MODE_6, this);
scene->_soundHandler1.startSound(35);
scene->_soundHandler3.proc3();
- scene->_object8.setFrame(1);
- scene->_object8._state = 0;
+ scene->_masterButton.setFrame(1);
+ scene->_masterButton._state = 0;
_globals->clearFlag(103);
_globals->clearFlag(!_globals->_stripNum ? 116 : 119);
@@ -1949,9 +1982,10 @@ void Scene60::Action1::signal() {
break;
case 11:
_globals->_player._uiEnabled = true;
- scene->_object9.remove();
+ scene->_floppyDrive.remove();
remove();
break;
+ case 8:
default:
break;
}
@@ -1976,7 +2010,7 @@ void Scene60::Action2::signal() {
/*--------------------------------------------------------------------------*/
-void Scene60::Object2::doAction(int action) {
+void Scene60::PrevObject::doAction(int action) {
Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene;
if (action == CURSOR_LOOK) {
@@ -1994,7 +2028,7 @@ void Scene60::Object2::doAction(int action) {
}
}
-void Scene60::Object3::doAction(int action) {
+void Scene60::NextObject::doAction(int action) {
Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene;
if (action == CURSOR_LOOK) {
@@ -2011,7 +2045,7 @@ void Scene60::Object3::doAction(int action) {
}
}
-void Scene60::Object4::doAction(int action) {
+void Scene60::ExitObject::doAction(int action) {
Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene;
if (action == CURSOR_LOOK) {
@@ -2019,47 +2053,49 @@ void Scene60::Object4::doAction(int action) {
} else if (action == CURSOR_USE) {
scene->_soundHandler3.startSound(36);
animate(ANIM_MODE_8, 1, NULL);
- scene->_object3.remove();
- scene->_object2.remove();
- scene->_object4.remove();
- scene->_object1.remove();
+ scene->_nextButton.remove();
+ scene->_prevButton.remove();
+ scene->_exitButton.remove();
+ scene->_rose.remove();
SceneItem::display(0, 0);
scene->loadScene(60);
- scene->_object6.setVisage(60);
- scene->_object6.setPosition(Common::Point(233, 143));
- scene->_object6.animate(ANIM_MODE_2, NULL);
+ scene->_controlButton.postInit();
+ scene->_controlButton.setVisage(60);
+ scene->_controlButton.setStrip(5);
+ scene->_controlButton.setPosition(Common::Point(233, 143));
+ scene->_controlButton.animate(ANIM_MODE_2, NULL);
scene->_slaveButton.postInit();
scene->_slaveButton.setVisage(60);
scene->_slaveButton.setStrip(8);
scene->_slaveButton.setPosition(Common::Point(143, 125));
- scene->_object8.postInit();
- scene->_object8.setVisage(60);
- scene->_object8.setStrip(8);
- scene->_object8.setPosition(Common::Point(143, 105));
+ scene->_masterButton.postInit();
+ scene->_masterButton.setVisage(60);
+ scene->_masterButton.setStrip(8);
+ scene->_masterButton.setPosition(Common::Point(143, 105));
- _globals->_sceneItems.push_front(&scene->_object8);
+ _globals->_sceneItems.push_front(&scene->_masterButton);
_globals->_sceneItems.push_front(&scene->_slaveButton);
- scene->_object10.postInit();
- scene->_object10.setVisage(60);
- scene->_object10.setPosition(Common::Point(199, 186));
- scene->_object10.animate(ANIM_MODE_8, 0, NULL);
- scene->_object10._numFrames = 5;
- scene->_object10.setAction(&scene->_sequenceManager, scene, 61, NULL);
+ scene->_redLights.postInit();
+ scene->_redLights.setVisage(60);
+ scene->_redLights.setPosition(Common::Point(199, 186));
+ scene->_redLights.animate(ANIM_MODE_8, 0, NULL);
+ scene->_redLights._numFrames = 5;
+ scene->_redLights.setAction(&scene->_sequenceManager, scene, 61, NULL);
if (scene->_slaveButton._state)
scene->_slaveButton.setFrame(2);
- if (scene->_object8._state)
- scene->_object8.setFrame(2);
+ if (scene->_masterButton._state)
+ scene->_masterButton.setFrame(2);
_globals->_sceneItems.push_front(&scene->_item1);
- _globals->_sceneItems.push_front(&scene->_object6);
+ _globals->_sceneItems.push_front(&scene->_controlButton);
_globals->_sceneItems.push_front(&scene->_slaveButton);
- _globals->_sceneItems.push_front(&scene->_object8);
+ _globals->_sceneItems.push_front(&scene->_masterButton);
_globals->_sceneItems.push_back(&scene->_item2);
_globals->gfxManager()._font.setFontNumber(2);
@@ -2074,7 +2110,7 @@ void Scene60::Object4::doAction(int action) {
}
}
-void Scene60::Object5::doAction(int action) {
+void Scene60::MessageObject::doAction(int action) {
Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene;
if (action == CURSOR_LOOK) {
@@ -2087,7 +2123,7 @@ void Scene60::Object5::doAction(int action) {
}
}
-void Scene60::Object6::doAction(int action) {
+void Scene60::ControlObject::doAction(int action) {
Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene;
if (action == CURSOR_LOOK) {
@@ -2114,7 +2150,7 @@ void Scene60::SlaveObject::doAction(int action) {
if (action == CURSOR_LOOK) {
SceneItem::display2(60, 8);
} else if (action == CURSOR_USE) {
- if (scene->_object8._state)
+ if (scene->_masterButton._state)
scene->_sceneMode = 19;
else if (_state) {
scene->_soundHandler3.proc3();
@@ -2138,20 +2174,22 @@ void Scene60::SlaveObject::doAction(int action) {
}
}
-void Scene60::Object8::doAction(int action) {
+void Scene60::MasterObject::doAction(int action) {
Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene;
if (action == CURSOR_LOOK) {
SceneItem::display2(60, 7);
} else if (action == CURSOR_USE) {
- if (!scene->_object8._state)
+ if (!scene->_controlButton._animateMode)
scene->_sceneMode = 14;
+ else if (scene->_slaveButton._state)
+ scene->_sceneMode = 20;
else if (_state) {
scene->_soundHandler3.proc3();
animate(ANIM_MODE_6, NULL);
+ _state = 0;
_globals->clearFlag(103);
_globals->clearFlag(!_globals->_stripNum ? 116 : 119);
- _state = 0;
scene->_sceneMode = 9998;
} else {
scene->_soundHandler3.startSound(39);
@@ -2168,7 +2206,7 @@ void Scene60::Object8::doAction(int action) {
}
}
-void Scene60::Object9::doAction(int action) {
+void Scene60::FloppyDrive::doAction(int action) {
Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene;
if (action == CURSOR_LOOK) {
@@ -2188,7 +2226,7 @@ void Scene60::Item1::doAction(int action) {
switch (action) {
case OBJECT_INFODISK:
- _globals->_inventory._infoDisk._sceneNumber = 60;
+ RING_INVENTORY._infoDisk._sceneNumber = 60;
_globals->setFlag(!_globals->_stripNum ? 118 : 121);
scene->_sceneMode = 0;
scene->setAction(&scene->_action1);
@@ -2197,7 +2235,7 @@ void Scene60::Item1::doAction(int action) {
SceneItem::display2(60, 10);
break;
case CURSOR_USE:
- if (_globals->_inventory._infoDisk._sceneNumber == 60) {
+ if (RING_INVENTORY._infoDisk._sceneNumber == 60) {
if (_globals->getFlag(118) && !_globals->_stripNum) {
_globals->clearFlag(118);
scene->setAction(&scene->_action1);
@@ -2210,7 +2248,7 @@ void Scene60::Item1::doAction(int action) {
scene->_action1.setActionIndex(9);
scene->_action1.setDelay(1);
}
- } else if (_globals->_inventory._infoDisk._sceneNumber == 1) {
+ } else if (RING_INVENTORY._infoDisk._sceneNumber == 1) {
scene->_sceneMode = 0;
setAction(&scene->_sequenceManager, scene, 62, NULL);
} else {
@@ -2264,20 +2302,20 @@ void Scene60::postInit(SceneObjectList *OwnerList) {
_slaveButton.setPosition(Common::Point(143, 125));
_slaveButton._state = 0;
- _object8.postInit();
- _object8.setVisage(60);
- _object8.setStrip(8);
- _object8.setPosition(Common::Point(143, 105));
- _object8._state = 0;
+ _masterButton.postInit();
+ _masterButton.setVisage(60);
+ _masterButton.setStrip(8);
+ _masterButton.setPosition(Common::Point(143, 105));
+ _masterButton._state = 0;
- _globals->_sceneItems.push_back(&_object8);
+ _globals->_sceneItems.push_back(&_masterButton);
_globals->_sceneItems.push_back(&_slaveButton);
- _object6.postInit();
- _object6.setVisage(60);
- _object6.setStrip(5);
- _object6.setPosition(Common::Point(233, 143));
- _globals->_sceneItems.push_back(&_object6);
+ _controlButton.postInit();
+ _controlButton.setVisage(60);
+ _controlButton.setStrip(5);
+ _controlButton.setPosition(Common::Point(233, 143));
+ _globals->_sceneItems.push_back(&_controlButton);
if (_globals->_stripNum == -1) {
_globals->_stripNum = 0;
@@ -2297,29 +2335,29 @@ void Scene60::postInit(SceneObjectList *OwnerList) {
}
if (_globals->getFlag(116)) {
- _object8._state = 1;
- _object8.setFrame(2);
+ _masterButton._state = 1;
+ _masterButton.setFrame(2);
}
if (_globals->getFlag(118)) {
- _object6.animate(ANIM_MODE_2, NULL);
+ _controlButton.animate(ANIM_MODE_2, NULL);
- _object10.postInit();
- _object10.setVisage(60);
- _object10.setPosition(Common::Point(199, 186));
- _object10.animate(ANIM_MODE_8, 0, NULL);
+ _redLights.postInit();
+ _redLights.setVisage(60);
+ _redLights.setPosition(Common::Point(199, 186));
+ _redLights.animate(ANIM_MODE_8, 0, NULL);
_soundHandler1.startSound(35);
if (!_globals->getFlag(83)) {
- _object5.postInit();
- _object5.setVisage(60);
- _object5.setStrip2(3);
- _object5.setFrame(2);
- _object5.setPosition(Common::Point(148, 85));
- _object5.animate(ANIM_MODE_2, NULL);
- _object5._numFrames = 5;
- _globals->_sceneItems.push_front(&_object5);
+ _message.postInit();
+ _message.setVisage(60);
+ _message.setStrip2(3);
+ _message.setFrame(2);
+ _message.setPosition(Common::Point(148, 85));
+ _message.animate(ANIM_MODE_2, NULL);
+ _message._numFrames = 5;
+ _globals->_sceneItems.push_front(&_message);
_soundHandler2.startSound(38);
}
@@ -2331,30 +2369,30 @@ void Scene60::postInit(SceneObjectList *OwnerList) {
}
if (_globals->getFlag(119)) {
- _object8._state = 1;
- _object8.setFrame(2);
+ _masterButton._state = 1;
+ _masterButton.setFrame(2);
}
if (_globals->getFlag(121)) {
- _object6.animate(ANIM_MODE_2, NULL);
+ _controlButton.animate(ANIM_MODE_2, NULL);
- _object10.postInit();
- _object10.setVisage(60);
- _object10.setPosition(Common::Point(199, 186));
- _object10.animate(ANIM_MODE_8, 0, NULL);
- _object10._numFrames = 5;
+ _redLights.postInit();
+ _redLights.setVisage(60);
+ _redLights.setPosition(Common::Point(199, 186));
+ _redLights.animate(ANIM_MODE_8, 0, NULL);
+ _redLights._numFrames = 5;
_soundHandler1.startSound(35);
if (!_globals->getFlag(83)) {
- _object5.postInit();
- _object5.setVisage(60);
- _object5.setStrip2(3);
- _object5.setFrame(2);
- _object5.setPosition(Common::Point(148, 85));
- _object5.animate(ANIM_MODE_2, NULL);
- _object5._numFrames = 5;
- _globals->_sceneItems.push_front(&_object5);
+ _message.postInit();
+ _message.setVisage(60);
+ _message.setStrip2(3);
+ _message.setFrame(2);
+ _message.setPosition(Common::Point(148, 85));
+ _message.animate(ANIM_MODE_2, NULL);
+ _message._numFrames = 5;
+ _globals->_sceneItems.push_front(&_message);
_soundHandler2.startSound(38);
}
@@ -2374,7 +2412,7 @@ void Scene60::signal() {
_globals->_events.setCursor(CURSOR_USE);
_gfxButton.setText(EXIT_MSG);
- _gfxButton._bounds.centre(160, 193);
+ _gfxButton._bounds.center(160, 193);
_gfxButton.draw();
_gfxButton._bounds.expandPanes();
} else {
@@ -2387,7 +2425,7 @@ void Scene60::signal() {
void Scene60::process(Event &event) {
Scene::process(event);
- if (_sceneNumber == 60) {
+ if (_screenNumber == 60) {
if (_gfxButton.process(event))
_globals->_sceneManager.changeScene(50);
}
@@ -2474,7 +2512,7 @@ void Scene90::Action1::signal() {
scene->_object3.animate(ANIM_MODE_6, NULL);
SceneItem::display(90, _globals->getFlag(104) ? 15 : 14,
- SET_EXT_BGCOLOUR, 13, SET_KEEP_ONSCREEN, -1, SET_X, 120, SET_Y, 20, LIST_END);
+ SET_EXT_BGCOLOR, 13, SET_KEEP_ONSCREEN, -1, SET_X, 120, SET_Y, 20, LIST_END);
break;
case 12:
SceneItem::display(0, 0);
@@ -2611,7 +2649,7 @@ void Scene90::postInit(SceneObjectList *OwnerList) {
_object3.setVisage(90);
_object3.animate(ANIM_MODE_1, NULL);
_object3.setPosition(Common::Point(196, 181));
- _object3.setPriority2(175);
+ _object3.fixPriority(175);
_globals->_sceneItems.push_back(&_object3);
_globals->_player.disableControl();
@@ -2636,7 +2674,7 @@ void Scene90::signal() {
break;
case 92:
_globals->_scenePalette.clearListeners();
- _globals->_game.endGame(90, 6);
+ _globals->_game->endGame(90, 6);
break;
case 96:
_globals->_player.enableControl();
@@ -2667,7 +2705,7 @@ void Scene95::Action1::signal() {
case 1:
if (_state) {
SceneItem::display(95, _state % 2, SET_FONT, 2,
- SET_EXT_BGCOLOUR, -1, SET_EXT_BGCOLOUR, 20,
+ SET_EXT_BGCOLOR, -1, SET_EXT_BGCOLOR, 20,
SET_WIDTH, 200, SET_KEEP_ONSCREEN, 1, SET_TEXT_MODE, 1, LIST_END);
--_state;
_actionIndex = 1;
@@ -2701,7 +2739,7 @@ void Scene95::Action1::signal() {
scene->_object1.addMover(mover2, &pt2, NULL);
SceneItem::display(95, 2, SET_Y, 45, SET_FONT, 2,
- SET_BG_COLOUR, -1, SET_EXT_BGCOLOUR, 13, SET_WIDTH, 200,
+ SET_BG_COLOR, -1, SET_EXT_BGCOLOR, 13, SET_WIDTH, 200,
SET_KEEP_ONSCREEN, 1, LIST_END);
setDelay(240);
break;
@@ -2710,13 +2748,13 @@ void Scene95::Action1::signal() {
scene->_object3.remove();
SceneItem::display(95, 3, SET_Y, 45, SET_FONT, 2,
- SET_BG_COLOUR, -1, SET_EXT_BGCOLOUR, 35, SET_WIDTH, 200,
+ SET_BG_COLOR, -1, SET_EXT_BGCOLOR, 35, SET_WIDTH, 200,
SET_KEEP_ONSCREEN, 1, LIST_END);
setDelay(240);
break;
case 5:
SceneItem::display(95, 4, SET_Y, 45, SET_FONT, 2,
- SET_BG_COLOUR, -1, SET_EXT_BGCOLOUR, 35, SET_WIDTH, 200,
+ SET_BG_COLOR, -1, SET_EXT_BGCOLOR, 35, SET_WIDTH, 200,
SET_KEEP_ONSCREEN, 1, LIST_END);
setDelay(240);
break;
@@ -2841,7 +2879,7 @@ void Scene6100::Action3::signal() {
break;
case 1:
_globals->_scenePalette.clearListeners();
- scene->_fadePercent = 0;
+ scene->_fadePercent = 100;
_globals->_scenePalette.refresh();
scene->loadScene(9997);
scene->_object1.hide();
@@ -2852,7 +2890,7 @@ void Scene6100::Action3::signal() {
scene->_sunflower3.hide();
scene->_rocks.hide();
scene->_sceneText.hide();
-
+
_globals->_events.setCursor(CURSOR_WALK);
scene->_stripManager.start(8120, this);
break;
@@ -2957,39 +2995,39 @@ void Scene6100::Action5::dispatch() {
}
scene->_objList[idx]->_flags |= OBJFLAG_PANES;
-/*
+
if ((idx != 3) && (scene->_fadePercent == 100) &&
- (tempSet.sqrt(floatSet) < 150.0)) {
+ (tempSet.sqrt(zeroSet) < 150.0)) {
switch (scene->_hitCount++) {
case 1:
scene->_soundHandler.startSound(233);
- scene->showMessage(0, NULL, 0);
+ scene->showMessage(NULL, 0, NULL);
if (!_globals->getFlag(76))
- scene->_object5.setAction(&scene->_action2);
+ scene->_probe.setAction(&scene->_action2);
+ break;
case 2:
scene->_soundHandler.startSound(234);
- scene->showMessage(0, NULL, 0);
+ scene->showMessage(NULL, 0, NULL);
if (!_globals->getFlag(76))
- scene->_object5.setAction(NULL);
+ scene->_probe.setAction(NULL);
scene->setAction(&scene->_action3);
break;
default:
scene->_soundHandler.startSound(233);
- scene->showMessage(0, NULL, 0);
+ scene->showMessage(NULL, 0, NULL);
if (!_globals->getFlag(76))
- scene->_object5.setAction(&scene->_action1);
+ scene->_probe.setAction(&scene->_action1);
break;
}
_globals->_scenePalette.clearListeners();
scene->_fadePercent = 0;
}
- */
}
}
@@ -3091,6 +3129,7 @@ void Scene6100::postInit(SceneObjectList *OwnerList) {
loadScene(6100);
Scene::postInit();
setZoomPercents(62, 2, 200, 425);
+ _globals->_sceneHandler._delayTicks = 8;
_globals->_player.disableControl();
_globals->_events.setCursor(CURSOR_WALK);
@@ -3102,28 +3141,28 @@ void Scene6100::postInit(SceneObjectList *OwnerList) {
_object1._frame = 1;
_object1._strip = 4;
_object1.setPosition(Common::Point(0, 60));
- _object1.setPriority2(1);
+ _object1.fixPriority(1);
_object2.postInit();
_object2.setVisage(6100);
_object2._frame = 1;
_object2._strip = 4;
_object2.setPosition(Common::Point(160, 60));
- _object2.setPriority2(1);
+ _object2.fixPriority(1);
_object3.postInit();
_object3.setVisage(6100);
_object3._frame = 1;
_object3._strip = 4;
_object3.setPosition(Common::Point(320, 60));
- _object3.setPriority2(1);
+ _object3.fixPriority(1);
_rocks.postInit();
_rocks.setVisage(6100);
_rocks._frame = 1;
_rocks._strip = 3;
_rocks.setPosition(Common::Point(320, 0));
- _rocks.setPriority2(2);
+ _rocks.fixPriority(2);
_rocks.changeZoom(-1);
_rocks._floats._float1 = 320.0;
_rocks._floats._float2 = 25000.0;
@@ -3135,7 +3174,7 @@ void Scene6100::postInit(SceneObjectList *OwnerList) {
_probe._frame = 1;
_probe._strip = 5;
_probe.setPosition(Common::Point(160, 260));
- _probe.setPriority2(3);
+ _probe.fixPriority(3);
_probe._floats._float1 = 320.0;
_probe._floats._float2 = 0.0;
_probe._floats._float3 = 0.0;
@@ -3160,7 +3199,7 @@ void Scene6100::postInit(SceneObjectList *OwnerList) {
_objList[idx]->setPosition(Common::Point(
_globals->_randomSource.getRandomNumber(319), 60));
- _objList[idx]->setPriority2(1);
+ _objList[idx]->fixPriority(1);
_objList[idx]->changeZoom(-1);
}
@@ -3193,9 +3232,9 @@ void Scene6100::process(Event &event) {
if (event.eventType == EVENT_KEYPRESS) {
// Handle incremental turning speeds with arrow keys
if ((event.kbd.keycode == Common::KEYCODE_LEFT) || (event.kbd.keycode == Common::KEYCODE_KP4)) {
- _turnAmount = MAX(_turnAmount - 1, -8);
+ _turnAmount = MIN(_turnAmount + 1, 8);
} else if ((event.kbd.keycode == Common::KEYCODE_RIGHT) || (event.kbd.keycode == Common::KEYCODE_KP6)) {
- _turnAmount = MIN(_turnAmount + 1, -8);
+ _turnAmount = MAX(_turnAmount - 1, -8);
}
}
@@ -3231,7 +3270,7 @@ void Scene6100::dispatch() {
_sceneText.setPosition(Common::Point(24, 160));
_sceneText._fontNumber = 0;
- _sceneText._colour1 = 35;
+ _sceneText._color1 = 35;
_sceneText.setup(s);
}
@@ -3244,7 +3283,7 @@ void Scene6100::dispatch() {
}
}
-void Scene6100::showMessage(const Common::String &msg, int colour, Action *action) {
+void Scene6100::showMessage(const Common::String &msg, int color, Action *action) {
if (_msgActive) {
_msgActive = false;
_speaker1.removeText();
@@ -3254,7 +3293,7 @@ void Scene6100::showMessage(const Common::String &msg, int colour, Action *actio
_msgActive = true;
_speaker1._textPos.x = 20;
_speaker1._textWidth = 280;
- _speaker1._colour1 = colour;
+ _speaker1._color1 = color;
_speaker1._action = action;
_speaker1.setText(msg);
}
diff --git a/engines/tsage/ringworld_scenes1.h b/engines/tsage/ringworld_scenes1.h
index b567aeea2d..be6d8e6337 100644
--- a/engines/tsage/ringworld_scenes1.h
+++ b/engines/tsage/ringworld_scenes1.h
@@ -114,34 +114,13 @@ class Scene30 : public Scene {
// Doorway beam sensor
class BeamObject : public SceneObject {
public:
- virtual void doAction(int action) {
- if (action == OBJECT_SCANNER)
- display(30, 14, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
- else if (action == CURSOR_LOOK)
- display(30, 2, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
- else if (action == CURSOR_USE) {
- Scene30 *parent = (Scene30 *)_globals->_sceneManager._scene;
- parent->setAction(&parent->_beamAction);
- } else
- SceneObject::doAction(action);
- }
+ virtual void doAction(int action);
};
-
// Doorway object
class DoorObject : public SceneObject {
public:
- virtual void doAction(int action) {
- if (action == OBJECT_SCANNER)
- display(30, 13, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
- else if (action == CURSOR_LOOK)
- display(30, 1, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
- else if (action == CURSOR_USE)
- display(30, 7, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
- else
- SceneObject::doAction(action);
- }
+ virtual void doAction(int action);
};
-
// Kzin object
class KzinObject : public SceneObject {
public:
@@ -344,23 +323,23 @@ class Scene60 : public Scene {
public:
virtual void signal();
};
- class Object2 : public SceneObject {
+ class PrevObject : public SceneObject {
public:
virtual void doAction(int action);
};
- class Object3 : public SceneObject {
+ class NextObject : public SceneObject {
public:
virtual void doAction(int action);
};
- class Object4 : public SceneObject {
+ class ExitObject : public SceneObject {
public:
virtual void doAction(int action);
};
- class Object5 : public SceneObject {
+ class MessageObject : public SceneObject {
public:
virtual void doAction(int action);
};
- class Object6 : public SceneObject {
+ class ControlObject : public SceneObject {
public:
virtual void doAction(int action);
};
@@ -368,11 +347,11 @@ class Scene60 : public Scene {
public:
virtual void doAction(int action);
};
- class Object8 : public SceneObjectExt {
+ class MasterObject : public SceneObjectExt {
public:
virtual void doAction(int action);
};
- class Object9 : public SceneObject {
+ class FloppyDrive : public SceneObject {
public:
virtual void doAction(int action);
};
@@ -399,16 +378,16 @@ public:
SpeakerSText _speakerSText;
Action1 _action1;
Action2 _action2;
- SceneObject _object1;
- Object2 _object2;
- Object3 _object3;
- Object4 _object4;
- Object5 _object5;
- Object6 _object6;
+ SceneObject _rose;
+ PrevObject _prevButton;
+ NextObject _nextButton;
+ ExitObject _exitButton;
+ MessageObject _message;
+ ControlObject _controlButton;
SlaveObject _slaveButton;
- Object8 _object8;
- Object9 _object9;
- SceneObject _object10;
+ MasterObject _masterButton;
+ FloppyDrive _floppyDrive;
+ SceneObject _redLights;
Item1 _item1;
Item _item2, _item3, _item4, _item5, _item6;
SoundHandler _soundHandler1;
@@ -548,7 +527,7 @@ public:
virtual void remove();
virtual void process(Event &event);
virtual void dispatch();
- void showMessage(const Common::String &msg, int colour, Action *action);
+ void showMessage(const Common::String &msg, int color, Action *action);
};
diff --git a/engines/tsage/ringworld_scenes10.cpp b/engines/tsage/ringworld_scenes10.cpp
index 30a0ffd34e..65e415748d 100644
--- a/engines/tsage/ringworld_scenes10.cpp
+++ b/engines/tsage/ringworld_scenes10.cpp
@@ -38,7 +38,8 @@ Scene2::Scene2() : Scene() {
/*--------------------------------------------------------------------------*/
void Object9350::postInit(SceneObjectList *OwnerList) {
- _globals->_sceneManager.postInit(&_globals->_sceneManager._altSceneObjects);
+ //SceneObject::postInit(&_globals->_sceneManager._altSceneObjects);
+ SceneObject::postInit(OwnerList);
}
void Object9350::draw() {
@@ -66,7 +67,7 @@ void Scene9100::SceneHotspot1::doAction(int action) {
_globals->_player.disableControl();
scene->_sceneMode = 9105;
}
- scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &_globals->_player, &scene->_object5, &scene->_object6, 0);
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &_globals->_player, &scene->_object5, &scene->_object6, NULL);
} else {
NamedHotspot::doAction(action);
}
@@ -77,16 +78,16 @@ void Scene9100::dispatch() {
if (!_action) {
if (_globals->_player._position.x < 25) {
- if (!_globals->getFlag(11)) {
- scene->_sceneMode = 9106;
- } else {
- scene->_sceneMode = 9108;
+ _globals->_player.disableControl();
+ if (!_globals->getFlag(23) || _globals->getFlag(11))
+ _sceneMode = 9106;
+ else {
+ _sceneMode = 9108;
_globals->setFlag(11);
}
- } else {
- scene->_sceneMode = 9106;
+
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &_globals->_player, NULL);
}
- scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &_globals->_player, 0);
} else {
Scene::dispatch();
}
@@ -102,7 +103,7 @@ void Scene9100::signal() {
_globals->_sceneManager.changeScene(9150);
break;
case 9105:
- _sceneHotspot1.remove();
+ _sceneHotspot3.remove();
// No break on purpose
case 9103:
case 9104:
@@ -115,17 +116,15 @@ void Scene9100::signal() {
}
void Scene9100::postInit(SceneObjectList *OwnerList) {
- Scene9100 *scene = (Scene9100 *)_globals->_sceneManager._scene;
-
Scene::postInit();
setZoomPercents(0, 100, 200, 100);
_object1.postInit();
_object1.setVisage(9100);
_object1._strip = 1;
_object1._numFrames = 6;
- _object1.setPosition(Common::Point(297, 132), 0);
- _object1.animate(ANIM_MODE_2, 0);
- _object1.setPriority2(10);
+ _object1.setPosition(Common::Point(279, 132));
+ _object1.animate(ANIM_MODE_2, NULL);
+ _object1.fixPriority(10);
_globals->_player.postInit();
@@ -146,7 +145,7 @@ void Scene9100::postInit(SceneObjectList *OwnerList) {
_object6.setVisage(9111);
_object6.setStrip(6);
_object6.setFrame(1);
- _object6.setPosition(Common::Point(138, 166), 0);
+ _object6.setPosition(Common::Point(138, 166));
_sceneHotspot3.setup(145, 125, 166, 156, 9100, 40, 43);
}
_sceneHotspot1.setup(140, 176, 185, 215, 9100, 36, 37);
@@ -155,7 +154,7 @@ void Scene9100::postInit(SceneObjectList *OwnerList) {
_sceneHotspot5.setup(69, 36, 121, 272, 9100, 45, 46);
_sceneHotspot6.setup(127, 0, 200, 52, 9100, 47, 48);
- _globals->_soundHandler.startSound(251, 0, 127);
+ _globals->_soundHandler.startSound(251);
if (_globals->_sceneManager._previousScene == 9150) {
if (_globals->getFlag(20)) {
_globals->_player.disableControl();
@@ -163,17 +162,17 @@ void Scene9100::postInit(SceneObjectList *OwnerList) {
_sceneMode = 9107;
else
_sceneMode = 9109;
- setAction(&scene->_sequenceManager, scene, _sceneMode, &_globals->_player, &_object5, 0);
+ setAction(&_sequenceManager, this, _sceneMode, &_globals->_player, &_object5, NULL);
} else {
_sceneMode = 9103;
_globals->_player.disableControl();
- setAction(&scene->_sequenceManager, scene, _sceneMode, &_globals->_player, &_object2, &_object3, &_object4, &_object5, 0);
+ setAction(&_sequenceManager, this, _sceneMode, &_globals->_player, &_object2, &_object3, &_object4, &_object5, NULL);
_globals->setFlag(20);
}
} else {
_sceneMode = 9102;
_globals->_player.disableControl();
- setAction(&scene->_sequenceManager, scene, _sceneMode, &_globals->_player, &_object2, &_object3, &_object4, &_object5, 0);
+ setAction(&_sequenceManager, this, _sceneMode, &_globals->_player, &_object2, &_object3, &_object4, &_object5, NULL);
}
}
@@ -224,7 +223,7 @@ void Scene9150::dispatch() {
if ((_sceneState != 0) && (_sceneBounds.left == 0)) {
_object3._timer = 0;
_sceneState = 0;
- _sceneHotspot3.setAction(&_sequenceManager2, 0, 9154, &_object3, 0);
+ _object3.setAction(&_sequenceManager2, NULL, 9154, &_object3, NULL);
_sceneHotspot10.remove();
}
@@ -235,17 +234,17 @@ void Scene9150::dispatch() {
if (_globals->_player._position.x > 630) {
_globals->_player.disableControl();
_sceneMode = 9157;
- setAction(&_sequenceManager1, this, _sceneMode, &_globals->_player, 0);
+ setAction(&_sequenceManager1, this, _sceneMode, &_globals->_player, NULL);
}
} else {
_globals->_player.disableControl();
if (_globals->getFlag(11)) {
- _globals->_soundHandler.startSound(286, 0, 127);
+ _globals->_soundHandler.startSound(286);
_sceneMode = 9153;
} else {
_sceneMode = 9156;
}
- setAction(&_sequenceManager1, this, _sceneMode, &_globals->_player, 0);
+ setAction(&_sequenceManager1, this, _sceneMode, &_globals->_player, NULL);
}
}
}
@@ -260,7 +259,7 @@ void Scene9150::postInit(SceneObjectList *OwnerList) {
_object3.setVisage(9151);
_object3._strip = 1;
_object3._frame = 1;
- _object3.setPosition(Common::Point(312, 95), 0);
+ _object3.setPosition(Common::Point(312, 95));
_object3.signal();
_sceneHotspot1.setup(0, 0, 200, 94, 9150, 46, -1);
@@ -274,7 +273,7 @@ void Scene9150::postInit(SceneObjectList *OwnerList) {
_sceneHotspot8.setup(133, 584, 142, 640, 9150, 57, -1);
_sceneHotspot10.setup(83, 304, 103, 323, 9150, 58, 59);
- _globals->_soundHandler.startSound(285, 0, 127);
+ _globals->_soundHandler.startSound(285);
_globals->_player.disableControl();
if (_globals->getFlag(20)) {
@@ -286,14 +285,14 @@ void Scene9150::postInit(SceneObjectList *OwnerList) {
else
// Hero wearing Purple suit
_sceneMode = 9152;
- setAction(&_sequenceManager1, this, _sceneMode, &_globals->_player, 0);
+ setAction(&_sequenceManager1, this, _sceneMode, &_globals->_player, NULL);
} else {
// Walking with the tiger
_sceneMode = 9151;
_object2.postInit();
_object2.hide();
_object1.postInit();
- setAction(&_sequenceManager1, this, _sceneMode, &_globals->_player, &_object1, &_object2, 0);
+ setAction(&_sequenceManager1, this, _sceneMode, &_globals->_player, &_object1, &_object2, NULL);
}
}
@@ -308,16 +307,16 @@ void Scene9200::SceneHotspot1::doAction(int action) {
_globals->_player.disableControl();
if (_globals->getFlag(93)) {
scene->_sceneState = 9214;
- setAction(&scene->_sequenceManager, scene, 9214, &_globals->_player, &scene->_object2, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 9214, &_globals->_player, &scene->_object2, NULL);
} else {
_globals->setFlag(93);
scene->_sceneState = 9213;
- setAction(&scene->_sequenceManager, scene, 9213, &_globals->_player, &scene->_object2, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 9213, &_globals->_player, &scene->_object2, NULL);
}
} else if (action <= 100) {
_globals->_player.disableControl();
scene->_sceneState = 9214;
- setAction(&scene->_sequenceManager, scene, 9214, &_globals->_player, &scene->_object2, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 9214, &_globals->_player, &scene->_object2, NULL);
} else {
NamedHotspot::doAction(action);
}
@@ -365,27 +364,27 @@ void Scene9200::dispatch() {
if ( (_globals->_player._position.x <= 0) || ((_globals->_player._position.x < 100) && (_globals->_player._position.y > 199))) {
_globals->_player.disableControl();
_sceneState = 9209;
- setAction(&_sequenceManager, this, 9209, &_globals->_player, &_object2, &_object3, 0);
+ setAction(&_sequenceManager, this, 9209, &_globals->_player, &_object2, &_object3, NULL);
} else {
if (rect9200.contains(_globals->_player._position)) {
if (_globals->getFlag(93)) {
if (_globals->getFlag(86)) {
_sceneState = 9215;
- setAction(&_sequenceManager, this, 9215, &_globals->_player, &_object2, &_object3, 0);
+ setAction(&_sequenceManager, this, 9215, &_globals->_player, &_object2, &_object3, NULL);
} else {
_sceneState = 9208;
- setAction(&_sequenceManager, this, 9208, &_globals->_player, &_object2, &_object3, 0);
+ setAction(&_sequenceManager, this, 9208, &_globals->_player, &_object2, &_object3, NULL);
}
} else {
_globals->_player.disableControl();
_sceneState = 9204;
- setAction(&_sequenceManager, this, 9204, &_globals->_player, &_object2, &_object3, 0);
+ setAction(&_sequenceManager, this, 9204, &_globals->_player, &_object2, &_object3, NULL);
}
} else {
if (_globals->_player._position.y < 140) {
_globals->_player.disableControl();
_sceneState = 9207;
- setAction(&_sequenceManager, this, 9207, &_globals->_player, &_object2, &_object3, 0);
+ setAction(&_sequenceManager, this, 9207, &_globals->_player, &_object2, &_object3, NULL);
}
}
}
@@ -403,10 +402,10 @@ void Scene9200::postInit(SceneObjectList *OwnerList) {
// Water animation
_object1.setVisage(9200);
_object1._strip = 3;
- _object1.animate(ANIM_MODE_2, 0);
- _object1.setPosition(Common::Point(132, 114), 0);
- _object1.setPriority2(140);
- _soundHandler.startSound(297, 0, 127);
+ _object1.animate(ANIM_MODE_2, NULL);
+ _object1.setPosition(Common::Point(132, 114));
+ _object1.fixPriority(140);
+ _soundHandler.startSound(297);
_stripManager.addSpeaker(&_speakerQText);
_stripManager.addSpeaker(&_speakerGR);
_stripManager.addSpeaker(&_speakerGText);
@@ -429,41 +428,45 @@ void Scene9200::postInit(SceneObjectList *OwnerList) {
switch (_globals->_sceneManager._previousScene) {
case 9500:
if (_globals->getFlag(85)) {
- if (_globals->_inventory._helmet._sceneNumber == 1) {
+ if (RING_INVENTORY._helmet._sceneNumber == 1) {
_globals->setFlag(86);
+ _globals->_player.disableControl();
_sceneState = 9210;
- setAction(&_sequenceManager, this, 9210, &_globals->_player, &_object2, &_object3, 0);
+ setAction(&_sequenceManager, this, 9210, &_globals->_player, &_object2, &_object3, NULL);
} else {
+ _globals->_player.disableControl();
_sceneState = 9212;
- setAction(&_sequenceManager, this, 9212, &_globals->_player, &_object2, &_object3, 0);
+ setAction(&_sequenceManager, this, 9212, &_globals->_player, &_object2, &_object3, NULL);
}
} else {
- if (_globals->_inventory._helmet._sceneNumber == 1) {
+ if (RING_INVENTORY._helmet._sceneNumber == 1) {
+ _globals->_player.disableControl();
_sceneState = 9211;
- setAction(&_sequenceManager, this, 9211, &_globals->_player, &_object2, &_object3, 0);
+ setAction(&_sequenceManager, this, 9211, &_globals->_player, &_object2, &_object3, NULL);
} else {
+ _globals->_player.disableControl();
_sceneState = 9202;
- setAction(&_sequenceManager, this, 9202, &_globals->_player, &_object2, &_object3, 0);
+ setAction(&_sequenceManager, this, 9202, &_globals->_player, &_object2, &_object3, NULL);
}
}
break;
case 9700:
if (_globals->getFlag(86)) {
_sceneState = 9206;
- setAction(&_sequenceManager, this, 9206, &_globals->_player, &_object2, &_object3, 0);
+ setAction(&_sequenceManager, this, 9206, &_globals->_player, &_object2, &_object3, NULL);
} else {
_sceneState = 9203;
- setAction(&_sequenceManager, this, 9203, &_globals->_player, &_object2, &_object3, 0);
+ setAction(&_sequenceManager, this, 9203, &_globals->_player, &_object2, &_object3, NULL);
}
break;
case 9360:
default:
if (_globals->getFlag(86)) {
_sceneState = 9205;
- setAction(&_sequenceManager, this, 9205, &_globals->_player, &_object2, &_object3, 0);
+ setAction(&_sequenceManager, this, 9205, &_globals->_player, &_object2, &_object3, NULL);
} else {
_sceneState = 9201;
- setAction(&_sequenceManager, this, 9201, &_globals->_player, &_object2, &_object3, 0);
+ setAction(&_sequenceManager, this, 9201, &_globals->_player, &_object2, &_object3, NULL);
}
break;
}
@@ -479,7 +482,7 @@ void Scene9300::signal() {
_globals->setFlag(84);
// No break on purpose
case 9303:
- _globals->_soundHandler.startSound(295, 0, 127);
+ _globals->_soundHandler.startSound(295);
_globals->_sceneManager.changeScene(9350);
break;
case 9302:
@@ -496,7 +499,7 @@ void Scene9300::dispatch() {
} else if (_globals->_player._position.y < 145) {
_globals->_player.disableControl();
_sceneMode = 9303;
- setAction(&_sequenceManager, this, 9303, &_globals->_player, &_object1, &_object2, 0);
+ setAction(&_sequenceManager, this, 9303, &_globals->_player, &_object1, &_object2, NULL);
}
}
@@ -509,7 +512,7 @@ void Scene9300::postInit(SceneObjectList *OwnerList) {
_globals->_player.changeZoom(-1);
_object1.postInit();
_object2.postInit();
- _globals->_soundHandler.startSound(289, 0, 127);
+ _globals->_soundHandler.startSound(289);
_hotspot1.setup(35, 142, 76, 212, 9300, 0, 1);
_hotspot2.setup(28, 90, 81, 143, 9300, 2, 3);
@@ -528,11 +531,11 @@ void Scene9300::postInit(SceneObjectList *OwnerList) {
if (_globals->_sceneManager._previousScene == 9350) {
_globals->_player.disableControl();
_sceneMode = 9302;
- setAction(&_sequenceManager, this, 9302, &_globals->_player, &_object1, &_object2, 0);
+ setAction(&_sequenceManager, this, 9302, &_globals->_player, &_object1, &_object2, NULL);
} else {
_globals->_player.disableControl();
_sceneMode = 9301;
- setAction(&_sequenceManager, this, 9301, &_globals->_player, &_object1, &_object2, 0);
+ setAction(&_sequenceManager, this, 9301, &_globals->_player, &_object1, &_object2, NULL);
}
}
@@ -569,15 +572,15 @@ void Scene9350::dispatch() {
if ((_globals->_player._position.x > 300) && (_globals->_player._position.y < 160)) {
_globals->_player.disableControl();
_sceneState = 9356;
- setAction(&_sequenceManager, this, 9356, &_globals->_player, &_object2, 0);
+ setAction(&_sequenceManager, this, 9356, &_globals->_player, &_object2, NULL);
} else if ((_globals->_player._position.x > 110) && (_globals->_player._position.y >= 195)) {
_globals->_player.disableControl();
_sceneState = 9357;
- setAction(&_sequenceManager, this, 9357, &_globals->_player, &_object2, 0);
+ setAction(&_sequenceManager, this, 9357, &_globals->_player, &_object2, NULL);
} else if ((_globals->_player._position.x < 10) || ((_globals->_player._position.x <= 110) && (_globals->_player._position.y >= 195))) {
_globals->_player.disableControl();
_sceneState = 9355;
- setAction(&_sequenceManager, this, 9355, &_globals->_player, &_object2, 0);
+ setAction(&_sequenceManager, this, 9355, &_globals->_player, &_object2, NULL);
}
} else {
Scene::dispatch();
@@ -589,7 +592,7 @@ void Scene9350::postInit(SceneObjectList *OwnerList) {
setZoomPercents(95, 80, 200, 100);
_globals->_player.postInit();
- _object1.setup(9350, 1, 3, 139, 97, 0);
+ _object1.setup(9351, 1, 3, 139, 97, 0);
_sceneHotspot1.setup(42, 0, 97, 60, 9350, 0, -1);
_sceneHotspot2.setup(37, 205, 82, 256, 9350, 0, -1);
_sceneHotspot3.setup(29, 93, 92, 174, 9350, 1, -1);
@@ -602,22 +605,22 @@ void Scene9350::postInit(SceneObjectList *OwnerList) {
if (_globals->_sceneManager._previousScene == 9360) {
_globals->_player.disableControl();
_sceneState = 9352;
- setAction(&_sequenceManager, this, 9352, &_globals->_player, &_object2, 0);
+ setAction(&_sequenceManager, this, 9352, &_globals->_player, &_object2, NULL);
} else if (_globals->_sceneManager._previousScene == 9400) {
_globals->_player.disableControl();
_sceneState = 9353;
- setAction(&_sequenceManager, this, 9353, &_globals->_player, &_object2, 0);
+ setAction(&_sequenceManager, this, 9353, &_globals->_player, &_object2, NULL);
} else {
- if (!_globals->getFlag(84)) {
+ if (_globals->getFlag(84)) {
_globals->clearFlag(84);
_object2.postInit();
_globals->_player.disableControl();
_sceneState = 9359;
- setAction(&_sequenceManager, this, 9359, &_globals->_player, &_object2, 0);
+ setAction(&_sequenceManager, this, 9359, &_globals->_player, &_object2, NULL);
} else {
_globals->_player.disableControl();
_sceneState = 9354;
- setAction(&_sequenceManager, this, 9354, &_globals->_player, &_object2, 0);
+ setAction(&_sequenceManager, this, 9354, &_globals->_player, &_object2, NULL);
}
}
}
@@ -654,15 +657,15 @@ void Scene9360::dispatch() {
if ((_globals->_player._position.x > 300) && (_globals->_player._position.y < 160)) {
_globals->_player.disableControl();
_sceneState = 9366;
- setAction(&_sequenceManager, this, 9366, &_globals->_player, 0);
+ setAction(&_sequenceManager, this, 9366, &_globals->_player, NULL);
} else if ((_globals->_player._position.x > 110) && (_globals->_player._position.y >= 195)) {
_globals->_player.disableControl();
_sceneState = 9367;
- setAction(&_sequenceManager, this, 9367, &_globals->_player, 0);
+ setAction(&_sequenceManager, this, 9367, &_globals->_player, NULL);
} else if ((_globals->_player._position.x < 10) || ((_globals->_player._position.x <= 110) && (_globals->_player._position.y >= 195))) {
_globals->_player.disableControl();
_sceneState = 9365;
- setAction(&_sequenceManager, this, 9365, &_globals->_player, 0);
+ setAction(&_sequenceManager, this, 9365, &_globals->_player, NULL);
}
} else {
Scene::dispatch();
@@ -687,15 +690,15 @@ void Scene9360::postInit(SceneObjectList *OwnerList) {
if (_globals->_sceneManager._previousScene == 9350) {
_globals->_player.disableControl();
_sceneState = 9364;
- setAction(&_sequenceManager, this, 9364, &_globals->_player, 0);
+ setAction(&_sequenceManager, this, 9364, &_globals->_player, NULL);
} else if (_globals->_sceneManager._previousScene == 9450) {
_globals->_player.disableControl();
_sceneState = 9363;
- setAction(&_sequenceManager, this, 9363, &_globals->_player, 0);
+ setAction(&_sequenceManager, this, 9363, &_globals->_player, NULL);
} else {
_globals->_player.disableControl();
_sceneState = 9362;
- setAction(&_sequenceManager, this, 9362, &_globals->_player, 0);
+ setAction(&_sequenceManager, this, 9362, &_globals->_player, NULL);
}
_object1.setup(9351, 1, 1, 131, 90, 0);
}
@@ -711,9 +714,10 @@ Scene9400::Scene9400() {
void Scene9400::SceneHotspot7::doAction(int action) {
Scene9400 *scene = (Scene9400 *)_globals->_sceneManager._scene;
- if ((action == CURSOR_USE) && (_globals->_inventory._straw._sceneNumber != 1)) {
+ if ((action == CURSOR_USE) && (RING_INVENTORY._straw._sceneNumber != 1)) {
scene->_sceneState = 1;
- scene->setAction(&scene->_sequenceManager, scene, 9408, &_globals->_player, 0);
+ RING_INVENTORY._straw._sceneNumber = 1;
+ scene->setAction(&scene->_sequenceManager, scene, 9408, &_globals->_player, NULL);
} else {
NamedHotspot::doAction(action);
}
@@ -739,7 +743,7 @@ void Scene9400::signal() {
break;
case 1:
_object1._numFrames = 6;
- _object1.animate(ANIM_MODE_2, 0);
+ _object1.animate(ANIM_MODE_2, NULL);
_globals->_player.enableControl();
break;
case 2:
@@ -763,7 +767,7 @@ void Scene9400::signal() {
void Scene9400::dispatch() {
if ((_object1._animateMode == 2) && (_object1._strip == 1) && (_object1._frame == 4)){
if (_field1032 == 0) {
- _soundHandler.startSound(296, 0, 127);
+ _soundHandler.startSound(296);
_field1032 = 1;
}
} else {
@@ -785,11 +789,11 @@ void Scene9400::dispatch() {
void Scene9400::postInit(SceneObjectList *OwnerList) {
Scene::postInit();
- _sceneNumber = 9400;
+ _screenNumber = 9400;
setZoomPercents(0, 100, 200, 100);
_globals->_player.postInit();
- _object1.postInit(0);
- _object3.postInit(0);
+ _object1.postInit();
+ _object3.postInit();
_speakerQText._textPos.x = 20;
_hotspot7.setup(157, 66, 180, 110, 9400, 21, 23);
@@ -815,7 +819,7 @@ void Scene9400::postInit(SceneObjectList *OwnerList) {
_sceneState = 0;
}
- setAction(&_sequenceManager, this, 9400, &_globals->_player, &_object1, &_object3, 0);
+ setAction(&_sequenceManager, this, 9400, &_globals->_player, &_object1, &_object3, NULL);
}
/*--------------------------------------------------------------------------
@@ -825,7 +829,7 @@ void Scene9400::postInit(SceneObjectList *OwnerList) {
void Scene9450::Object2::signal() {
Scene9450 *scene = (Scene9450 *)_globals->_sceneManager._scene;
- this->setAction(&scene->_sequenceManager3, this, 9458, &scene->_object1, 0);
+ this->setAction(&scene->_sequenceManager3, this, 9458, this, &scene->_object1, NULL);
}
void Scene9450::Object3::dispatch() {
@@ -841,7 +845,7 @@ void Scene9450::Hotspot1::doAction(int action) {
scene->_object2._action->remove();
scene->_sceneMode = 9459;
_globals->_player.disableControl();
- setAction(&scene->_sequenceManager1, scene, 9459, &scene->_object2, &scene->_object1, &scene->_object3, &_globals->_player, 0);
+ scene->setAction(&scene->_sequenceManager1, scene, 9459, &scene->_object2, &scene->_object1, &scene->_object3, &_globals->_player, NULL);
} else {
NamedHotspot::doAction(action);
}
@@ -856,35 +860,35 @@ void Scene9450::Hotspot3::doAction(int action) {
case OBJECT_TUNIC2:
scene->_sceneMode = 9460;
_globals->_player.disableControl();
- setAction(&scene->_sequenceManager1, scene, 9460, &_globals->_player, &scene->_object2, &scene->_object1, 0);
+ scene->setAction(&scene->_sequenceManager1, scene, 9460, &_globals->_player, &scene->_object2, &scene->_object1, NULL);
break;
case OBJECT_TUNIC:
- SceneItem::display(9450, 49, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display(9450, 49, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
break;
case CURSOR_WALK:
// nothing
break;
case CURSOR_LOOK:
- SceneItem::display(9450, 41, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display(9450, 41, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
break;
case CURSOR_USE:
case CURSOR_TALK:
- if (_globals->_inventory._tunic._sceneNumber == 9450) {
+ if (RING_INVENTORY._tunic._sceneNumber == 9450) {
if (scene->_object2._action)
scene->_object2._action->remove();
scene->_sceneMode = 9459;
_globals->_player.disableControl();
- setAction(&scene->_sequenceManager1, scene, 9459, &scene->_object2, &scene->_object1, &scene->_object3, &_globals->_player, 0);
- } else if ((_globals->_inventory._cloak._sceneNumber != 1) && (_globals->_inventory._jacket._sceneNumber != 1) && (_globals->_inventory._tunic2._sceneNumber != 1)) {
- SceneItem::display(9450, 38, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ scene->setAction(&scene->_sequenceManager1, scene, 9459, &scene->_object2, &scene->_object1, &scene->_object3, &_globals->_player, NULL);
+ } else if ((RING_INVENTORY._cloak._sceneNumber != 1) && (RING_INVENTORY._jacket._sceneNumber != 1) && (RING_INVENTORY._tunic2._sceneNumber != 1)) {
+ SceneItem::display(9450, 38, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
} else {
scene->_sceneMode = 9460;
_globals->_player.disableControl();
- setAction(&scene->_sequenceManager1, scene, 9460, &_globals->_player, &scene->_object2, &scene->_object1, 0);
+ scene->setAction(&scene->_sequenceManager1, scene, 9460, &_globals->_player, &scene->_object2, &scene->_object1, NULL);
}
break;
default:
- SceneItem::display(9450, 45, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display(9450, 45, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
break;
}
}
@@ -894,11 +898,11 @@ void Scene9450::signal() {
case 1002:
case 1004:
// Drink
- setAction(&_sequenceManager1, this, 9456, &_object2, &_object1, &_object3, 0);
+ setAction(&_sequenceManager1, this, 9456, &_object2, &_object1, &_object3, NULL);
break;
case 1005:
// Bring me more wine
- setAction(&_sequenceManager1, this, 9457, &_object2, &_object1, &_object3, 0);
+ setAction(&_sequenceManager1, this, 9457, &_object2, &_object1, &_object3, NULL);
break;
case 9451:
if (_globals->getFlag(87)) {
@@ -907,18 +911,22 @@ void Scene9450::signal() {
_sceneMode = 1001;
if (_object2._action)
_object2._action->remove();
+ // Eat
+ setAction(&_sequenceManager1, this, 9455, &_object2, &_object1, &_object3, NULL);
}
- // No break on purpose
+ break;
case 1001:
case 1003:
// Eat
- setAction(&_sequenceManager1, this, 9455, &_object2, &_object1, &_object3, 0);
+ setAction(&_sequenceManager1, this, 9455, &_object2, &_object1, &_object3, NULL);
break;
case 9453:
_globals->_sceneManager.changeScene(9360);
break;
case 9459:
+ RING_INVENTORY._tunic._sceneNumber = 1;
_object2.signal();
+ _globals->_player.enableControl();
_globals->_events.setCursor(CURSOR_WALK);
_hotspot1.remove();
break;
@@ -938,11 +946,11 @@ void Scene9450::dispatch() {
if ((_globals->_player._position.y < 98) && (_globals->_player._position.x > 241) && (_globals->_player._position.x < 282)) {
_globals->_player.disableControl();
_sceneMode = 9452;
- setAction(&_sequenceManager1, this, 9452, &_globals->_player, 0);
+ setAction(&_sequenceManager1, this, 9452, &_globals->_player, NULL);
} else if ((_globals->_player._position.y < 99) && (_globals->_player._position.x > 68) && (_globals->_player._position.x < 103)) {
_globals->_player.disableControl();
_sceneMode = 9453;
- setAction(&_sequenceManager1, this, 9453, &_globals->_player, 0);
+ setAction(&_sequenceManager1, this, 9453, &_globals->_player, NULL);
}
}
}
@@ -959,25 +967,25 @@ void Scene9450::postInit(SceneObjectList *OwnerList) {
_globals->_player.disableControl();
_sceneMode = 9451;
- setAction(&_sequenceManager1, this, 9451, &_globals->_player, 0);
+ setAction(&_sequenceManager1, this, 9451, &_globals->_player, NULL);
if (_globals->getFlag(87)) {
- if (_globals->_inventory._tunic._sceneNumber == 1) {
+ if (RING_INVENTORY._tunic._sceneNumber == 1) {
_object2.signal();
} else {
- _object2.setPosition(Common::Point(184, 144), 0);
+ _object2.setPosition(Common::Point(184, 144));
_object2.setVisage(9451);
- _object2.setPriority2(250);
+ _object2.fixPriority(250);
_object2._strip = 5;
_object2._frame = 10;
}
} else {
_object3.postInit();
_object3.hide();
- _object3.setAction(&_sequenceManager2, 0, 9455, &_object2, &_object1, 0);
+ _object3.setAction(&_sequenceManager2, NULL, 9455, &_object2, &_object1, NULL);
}
- if (_globals->_inventory._tunic._sceneNumber != 1)
+ if (RING_INVENTORY._tunic._sceneNumber != 1)
_hotspot1.setup(123, 139, 138, 170, 9450, 37, -1);
_hotspot2.setup(153, 102, 176, 141, 9450, 39, 40);
@@ -1007,11 +1015,11 @@ void Scene9500::Hotspot1::doAction(int action) {
if (action == OBJECT_SWORD) {
scene->_sceneMode = 9510;
_globals->setFlag(92);
- _globals->_inventory._sword._sceneNumber = 9500;
+ RING_INVENTORY._sword._sceneNumber = 9500;
_globals->_player.disableControl();
_globals->_sceneItems.remove(this);
scene->_hotspot2.setup(87, 294, 104, 314, 9400, 17, -1);
- scene->setAction(&scene->_sequenceManager, scene, 9510, &_globals->_player, &scene->_object2, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 9510, &_globals->_player, &scene->_object2, NULL);
} else {
NamedHotspot::doAction(action);
}
@@ -1024,7 +1032,7 @@ void Scene9500::Hotspot2::doAction(int action) {
scene->_sceneMode = 9511;
_globals->_player.disableControl();
_globals->_sceneItems.remove(this);
- scene->setAction(&scene->_sequenceManager, scene, 9511, &_globals->_player, &scene->_object2, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 9511, &_globals->_player, &scene->_object2, NULL);
} else {
NamedHotspot::doAction(action);
}
@@ -1033,11 +1041,11 @@ void Scene9500::Hotspot2::doAction(int action) {
void Scene9500::Hotspot3::doAction(int action) {
Scene9500 *scene = (Scene9500 *)_globals->_sceneManager._scene;
- if ((action == CURSOR_USE) && (_globals->_inventory._candle._sceneNumber != 1)){
+ if ((action == CURSOR_USE) && (RING_INVENTORY._candle._sceneNumber != 1)){
scene->_sceneMode = 9505;
_globals->_player.disableControl();
_globals->_sceneItems.remove(this);
- scene->setAction(&scene->_sequenceManager, scene, 9505, &_globals->_player, &scene->_candle, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 9505, &_globals->_player, &scene->_candle, NULL);
} else {
NamedHotspot::doAction(action);
}
@@ -1048,21 +1056,21 @@ void Scene9500::Hotspot4::doAction(int action) {
if (action == OBJECT_CANDLE) {
_globals->_player.disableControl();
- if (_globals->_inventory._straw._sceneNumber == 9500) {
+ if (RING_INVENTORY._straw._sceneNumber == 9500) {
scene->_sceneMode = 9506;
_globals->_sceneItems.remove(&scene->_hotspot5);
_globals->_sceneItems.remove(this);
- scene->setAction(&scene->_sequenceManager, scene, 9506, &_globals->_player, &scene->_object3, 0);
- _globals->_inventory._candle._sceneNumber = 9850;
+ scene->setAction(&scene->_sequenceManager, scene, 9506, &_globals->_player, &scene->_object3, NULL);
+ RING_INVENTORY._candle._sceneNumber = 9850;
} else {
scene->_sceneMode = 9507;
- scene->setAction(&scene->_sequenceManager, scene, 9507, &_globals->_player, &scene->_object3, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 9507, &_globals->_player, &scene->_object3, NULL);
}
} else if (action == OBJECT_STRAW) {
scene->_sceneMode = 9512;
_globals->_player.disableControl();
- _globals->_inventory._straw._sceneNumber = 9500;
- scene->setAction(&scene->_sequenceManager, scene, 9512, &_globals->_player, &scene->_object3, 0);
+ RING_INVENTORY._straw._sceneNumber = 9500;
+ scene->setAction(&scene->_sequenceManager, scene, 9512, &_globals->_player, &scene->_object3, NULL);
} else {
NamedHotspot::doAction(action);
}
@@ -1072,13 +1080,14 @@ void Scene9500::signal() {
switch (_sceneMode) {
case 9503:
_globals->_sceneManager.changeScene(9200);
- _globals->_soundHandler.startSound(295, 0, 127);
+ _globals->_soundHandler.startSound(295);
break;
case 9504:
_globals->_sceneManager.changeScene(9850);
break;
case 9505:
_candle.setStrip(2);
+ RING_INVENTORY._candle._sceneNumber = 1;
_globals->_player.enableControl();
break;
case 9506:
@@ -1086,12 +1095,13 @@ void Scene9500::signal() {
_globals->_player.enableControl();
break;
case 9511:
+ RING_INVENTORY._helmet._sceneNumber = 1;
_globals->_player.enableControl();
if (!_globals->getFlag(51)) {
_globals->setFlag(51);
_globals->_player.disableControl();
_sceneMode = 9514;
- setAction(&_sequenceManager, this, 9514, &_globals->_player, 0, 0, 0, 0);
+ setAction(&_sequenceManager, this, 9514, &_globals->_player, NULL, NULL, NULL, NULL);
}
break;
case 0:
@@ -1109,11 +1119,11 @@ void Scene9500::dispatch() {
if (_globals->_player._position.y >= 199) {
_globals->_player.disableControl();
_sceneMode = 9503;
- setAction(&_sequenceManager, this, 9503, &_globals->_player, 0, 0, 0, 0);
+ setAction(&_sequenceManager, this, 9503, &_globals->_player, NULL, NULL, NULL, NULL);
} else if (_globals->_player._position.y < 127) {
_globals->_player.disableControl();
_sceneMode = 9504;
- setAction(&_sequenceManager, this, 9504, &_globals->_player, 0, 0, 0, 0);
+ setAction(&_sequenceManager, this, 9504, &_globals->_player, NULL, NULL, NULL, NULL);
}
}
@@ -1128,21 +1138,21 @@ void Scene9500::postInit(SceneObjectList *OwnerList) {
setZoomPercents(110, 75, 200, 150);
_globals->_player.postInit();
- _globals->_soundHandler.startSound(305, 0, 127);
+ _globals->_soundHandler.startSound(305);
- _candle.postInit(0);
+ _candle.postInit();
_candle.setVisage(9500);
_candle.setStrip(1);
_candle.animate(ANIM_MODE_2);
- _candle.setPosition(Common::Point(30, 105), 0);
- if (_globals->_inventory._candle._sceneNumber != 9500)
+ _candle.setPosition(Common::Point(30, 105));
+ if (RING_INVENTORY._candle._sceneNumber != 9500)
_candle.setStrip(2);
- _object3.postInit(0);
+ _object3.postInit();
_object3.hide();
- _object3.setPriority2(150);
+ _object3.fixPriority(150);
_object3.setPosition(Common::Point(166, 133));
- if (_globals->_inventory._straw._sceneNumber == 9500) {
+ if (RING_INVENTORY._straw._sceneNumber == 9500) {
_object3.show();
_object3.setVisage(5);
_object3._strip = 2;
@@ -1151,12 +1161,12 @@ void Scene9500::postInit(SceneObjectList *OwnerList) {
if (_globals->getFlag(85)) {
_object3.setVisage(9500);
_object3.setStrip(4);
- _object3.animate(ANIM_MODE_8, 0, 0);
+ _object3.animate(ANIM_MODE_8, 0, NULL);
_object3.setPosition(Common::Point(166, 133));
}
}
- _object2.postInit(0);
+ _object2.postInit();
_object2.hide();
if (_globals->getFlag(92)) {
_object2.show();
@@ -1164,8 +1174,8 @@ void Scene9500::postInit(SceneObjectList *OwnerList) {
_object2.setStrip(1);
_object2.setFrame(_object2.getFrameCount());
_object2.setPosition(Common::Point(303, 130));
- _object2.setPriority2(132);
- if (_globals->_inventory._helmet._sceneNumber == 1) {
+ _object2.fixPriority(132);
+ if (RING_INVENTORY._helmet._sceneNumber == 1) {
_hotspot2.setup(87, 294, 104, 314, 9400, 17, -1);
} else {
_object2.setStrip(2);
@@ -1203,16 +1213,16 @@ void Scene9500::postInit(SceneObjectList *OwnerList) {
if ((_globals->_sceneManager._previousScene == 9200) || (_globals->_sceneManager._previousScene != 9850)) {
_sceneMode = 0;
- if (_globals->_inventory._helmet._sceneNumber != 1) {
- setAction(&_sequenceManager, this, 9501, &_globals->_player, &_candle, 0);
+ if (RING_INVENTORY._helmet._sceneNumber != 1) {
+ setAction(&_sequenceManager, this, 9501, &_globals->_player, &_candle, NULL);
} else {
- _globals->_inventory._helmet._sceneNumber = 9500;
+ RING_INVENTORY._helmet._sceneNumber = 9500;
_hotspot2.setup(87, 294, 104, 314, 9400, 17, -1);
- setAction(&_sequenceManager, this, 9513, &_globals->_player, &_object2, 0);
+ setAction(&_sequenceManager, this, 9513, &_globals->_player, &_object2, NULL);
}
} else {
_sceneMode = 0;
- setAction(&_sequenceManager, this, 9502, &_globals->_player, &_candle, 0);
+ setAction(&_sequenceManager, this, 9502, &_globals->_player, &_candle, NULL);
}
}
@@ -1228,34 +1238,35 @@ void Scene9700::signal() {
case 9701:
case 9702:
_gfxButton1.setText(EXIT_MSG);
- _gfxButton1._bounds.centre(50, 190);
+ _gfxButton1._bounds.center(50, 190);
_gfxButton1.draw();
_gfxButton1._bounds.expandPanes();
_globals->_player.enableControl();
- _globals->_player._canWalk = 0;
+ _globals->_player._canWalk = false;
_globals->_events.setCursor(CURSOR_USE);
break;
case 9704:
- _globals->_soundHandler.startSound(323, 0, 127);
+ _globals->_soundHandler.startSound(323);
_globals->_sceneManager.changeScene(9750);
break;
}
}
void Scene9700::process(Event &event) {
- if ((event.eventType == EVENT_BUTTON_DOWN) && (event.kbd.keycode == 0)) {
+ Scene::process(event);
+ if ((event.eventType == EVENT_BUTTON_DOWN) && !_action) {
if (_gfxButton1.process(event)) {
_globals->_sceneManager.changeScene(9200);
} else if (_globals->_events._currentCursor == OBJECT_SCANNER) {
event.handled = true;
- if (_globals->_inventory._helmet._sceneNumber == 1) {
+ if (RING_INVENTORY._helmet._sceneNumber == 1) {
_globals->_player.disableControl();
_sceneMode = 9704;
- setAction(&_sequenceManager, this, 9704, &_globals->_player, &_object1, 0);
+ setAction(&_sequenceManager, this, 9704, &_globals->_player, &_object1, NULL);
} else {
_globals->_player.disableControl();
_sceneMode = 9703;
- setAction(&_sequenceManager, this, 9703, &_globals->_player, &_object1, 0);
+ setAction(&_sequenceManager, this, 9703, &_globals->_player, &_object1, NULL);
}
}
}
@@ -1267,7 +1278,7 @@ void Scene9700::postInit(SceneObjectList *OwnerList) {
_sceneHotspot1.setup(84, 218, 151, 278, 9700, 14, -1);
_sceneHotspot2.setup(89, 11, 151, 121, 9700, 14, -1);
- _sceneHotspot3.setup(69, 119, 138, 218, 9700, 15, 16);
+ _sceneHotspot3.setup(69, 119, 138, 216, 9700, 15, 16);
_sceneHotspot4.setup(34, 13, 88, 116, 9700, 17, -1);
_sceneHotspot5.setup(52, 119, 68, 204, 9700, 17, -1);
_sceneHotspot6.setup(0, 22, 56, 275, 9700, 18, -1);
@@ -1275,15 +1286,15 @@ void Scene9700::postInit(SceneObjectList *OwnerList) {
_object1.postInit();
_object1.hide();
_globals->_player.postInit();
- if (_globals->getFlag(97)) {
+ if (!_globals->getFlag(97)) {
_globals->_player.disableControl();
_sceneMode = 9701;
- setAction(&_sequenceManager, this, 9701, &_globals->_player, &_object1, 0);
+ setAction(&_sequenceManager, this, 9701, &_globals->_player, &_object1, NULL);
_globals->setFlag(97);
} else {
_globals->_player.disableControl();
_sceneMode = 9702;
- setAction(&_sequenceManager, this, 9702, &_globals->_player, &_object1, 0);
+ setAction(&_sequenceManager, this, 9702, &_globals->_player, &_object1, NULL);
}
}
@@ -1319,7 +1330,7 @@ void Scene9750::postInit(SceneObjectList *OwnerList) {
_object2.hide();
_globals->_player.disableControl();
_sceneMode = 9751;
- setAction(&_sequenceManager, this, 9751, &_globals->_player, &_object1, &_object2, 0);
+ setAction(&_sequenceManager, this, 9751, &_globals->_player, &_object1, &_object2, NULL);
}
@@ -1330,9 +1341,9 @@ void Scene9750::postInit(SceneObjectList *OwnerList) {
void Scene9850::Object6::doAction(int action) {
if ((_flags & OBJFLAG_HIDE) == 0) {
if (action == CURSOR_LOOK) {
- SceneItem::display(9850, 27, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display(9850, 27, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
} else if (action == CURSOR_USE) {
- _globals->_inventory._scimitar._sceneNumber = 1;
+ RING_INVENTORY._scimitar._sceneNumber = 1;
hide();
} else {
SceneHotspot::doAction(action);
@@ -1342,9 +1353,9 @@ void Scene9850::Object6::doAction(int action) {
void Scene9850::Object7::doAction(int action) {
if ((_flags & OBJFLAG_HIDE) == 0) {
if (action == CURSOR_LOOK) {
- SceneItem::display(9850, 28, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display(9850, 28, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
} else if (action == CURSOR_USE) {
- _globals->_inventory._sword._sceneNumber = 1;
+ RING_INVENTORY._sword._sceneNumber = 1;
hide();
} else {
SceneHotspot::doAction(action);
@@ -1357,21 +1368,21 @@ void Scene9850::Hotspot12::doAction(int action) {
Scene9850 *scene = (Scene9850 *)_globals->_sceneManager._scene;
if (action == CURSOR_USE) {
- if (_globals->_inventory._tunic2._sceneNumber != 1) {
- _globals->_inventory._tunic2._sceneNumber = 1;
+ if (RING_INVENTORY._tunic2._sceneNumber != 1) {
+ RING_INVENTORY._tunic2._sceneNumber = 1;
_globals->_player.disableControl();
scene->_sceneMode = 9858;
- setAction(&scene->_sequenceManager, scene, 9858, &_globals->_player, &scene->_objTunic2, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 9858, &_globals->_player, &scene->_objTunic2, NULL);
} else {
- _globals->_inventory._tunic2._sceneNumber = 9850;
+ RING_INVENTORY._tunic2._sceneNumber = 9850;
_globals->_player.disableControl();
scene->_sceneMode = 9861;
- setAction(&scene->_sequenceManager, scene, 9861, &_globals->_player, &scene->_objTunic2, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 9861, &_globals->_player, &scene->_objTunic2, NULL);
}
- } else if ((action != CURSOR_LOOK) || (_globals->_inventory._tunic2._sceneNumber != 1)) {
+ } else if ((action != CURSOR_LOOK) || (RING_INVENTORY._tunic2._sceneNumber != 1)) {
NamedHotspot::doAction(action);
} else {
- SceneItem::display(9850, 30, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display(9850, 30, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
}
}
@@ -1379,21 +1390,21 @@ void Scene9850::Hotspot14::doAction(int action) {
Scene9850 *scene = (Scene9850 *)_globals->_sceneManager._scene;
if (action == CURSOR_USE) {
- if (_globals->_inventory._jacket._sceneNumber != 1) {
- _globals->_inventory._jacket._sceneNumber = 1;
+ if (RING_INVENTORY._jacket._sceneNumber != 1) {
+ RING_INVENTORY._jacket._sceneNumber = 1;
_globals->_player.disableControl();
scene->_sceneMode = 9857;
- setAction(&scene->_sequenceManager, scene, 9857, &_globals->_player, &scene->_objJacket, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 9857, &_globals->_player, &scene->_objJacket, NULL);
} else {
- _globals->_inventory._jacket._sceneNumber = 9850;
+ RING_INVENTORY._jacket._sceneNumber = 9850;
_globals->_player.disableControl();
scene->_sceneMode = 9860;
- setAction(&scene->_sequenceManager, scene, 9860, &_globals->_player, &scene->_objJacket, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 9860, &_globals->_player, &scene->_objJacket, NULL);
}
- } else if ((action != CURSOR_LOOK) || (_globals->_inventory._jacket._sceneNumber != 1)) {
+ } else if ((action != CURSOR_LOOK) || (RING_INVENTORY._jacket._sceneNumber != 1)) {
NamedHotspot::doAction(action);
} else {
- SceneItem::display(9850, 30, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display(9850, 30, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
}
}
@@ -1401,21 +1412,21 @@ void Scene9850::Hotspot16::doAction(int action) {
Scene9850 *scene = (Scene9850 *)_globals->_sceneManager._scene;
if (action == CURSOR_USE) {
- if (_globals->_inventory._cloak._sceneNumber != 1) {
- _globals->_inventory._cloak._sceneNumber = 1;
+ if (RING_INVENTORY._cloak._sceneNumber != 1) {
+ RING_INVENTORY._cloak._sceneNumber = 1;
_globals->_player.disableControl();
scene->_sceneMode = 9862;
- setAction(&scene->_sequenceManager, scene, 9862, &_globals->_player, &scene->_objCloak, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 9862, &_globals->_player, &scene->_objCloak, NULL);
} else {
- _globals->_inventory._cloak._sceneNumber = 9850;
+ RING_INVENTORY._cloak._sceneNumber = 9850;
_globals->_player.disableControl();
scene->_sceneMode = 9859;
- setAction(&scene->_sequenceManager, scene, 9859, &_globals->_player, &scene->_objCloak, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 9859, &_globals->_player, &scene->_objCloak, NULL);
}
- } else if ((action != CURSOR_LOOK) || (_globals->_inventory._cloak._sceneNumber != 1)) {
+ } else if ((action != CURSOR_LOOK) || (RING_INVENTORY._cloak._sceneNumber != 1)) {
NamedHotspot::doAction(action);
} else {
- SceneItem::display(9850, 30, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display(9850, 30, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
}
}
@@ -1423,10 +1434,10 @@ void Scene9850::Hotspot17::doAction(int action) {
Scene9850 *scene = (Scene9850 *)_globals->_sceneManager._scene;
if (action == OBJECT_SCANNER) {
- SceneItem::display(9850, 32, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display(9850, 32, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
} else {
if (action == CURSOR_USE)
- scene->_soundHandler.startSound(306, 0, 127);
+ scene->_soundHandler.startSound(306);
NamedHotspot::doAction(action);
}
}
@@ -1435,10 +1446,10 @@ void Scene9850::Hotspot18::doAction(int action) {
Scene9850 *scene = (Scene9850 *)_globals->_sceneManager._scene;
if (action == OBJECT_SCANNER) {
- SceneItem::display(9850, 32, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display(9850, 32, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
} else {
if (action == CURSOR_USE)
- scene->_soundHandler.startSound(306, 0, 127);
+ scene->_soundHandler.startSound(306);
NamedHotspot::doAction(action);
}
}
@@ -1447,10 +1458,10 @@ void Scene9850::Hotspot19::doAction(int action) {
Scene9850 *scene = (Scene9850 *)_globals->_sceneManager._scene;
if (action == OBJECT_SCANNER) {
- SceneItem::display(9850, 31, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display(9850, 31, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
} else {
if (action == CURSOR_USE)
- scene->_soundHandler.startSound(313, 0, 127);
+ scene->_soundHandler.startSound(313);
NamedHotspot::doAction(action);
}
}
@@ -1462,15 +1473,15 @@ void Scene9850::Hotspot20::doAction(int action) {
if (action == CURSOR_USE) {
_globals->_player.disableControl();
if (scene->_objSword._state == 0) {
- if (_globals->_inventory._scimitar._sceneNumber == 9850)
+ if (RING_INVENTORY._scimitar._sceneNumber == 9850)
scene->_objScimitar.show();
- if (_globals->_inventory._sword._sceneNumber == 9850)
+ if (RING_INVENTORY._sword._sceneNumber == 9850)
scene->_objSword.show();
scene->_sceneMode = 11;
- setAction(&scene->_sequenceManager, scene, 9853, &_globals->_player, &scene->_objDoor, &scene->_objLever, 0);
+ setAction(&scene->_sequenceManager, scene, 9853, &_globals->_player, &scene->_objDoor, &scene->_objLever, NULL);
} else {
scene->_sceneMode = 10;
- setAction(&scene->_sequenceManager, scene, 9854, &_globals->_player, &scene->_objDoor, &scene->_objLever, 0);
+ setAction(&scene->_sequenceManager, scene, 9854, &_globals->_player, &scene->_objDoor, &scene->_objLever, NULL);
}
scene->_objSword._state ^= 1;
} else {
@@ -1482,9 +1493,9 @@ void Scene9850::signal() {
switch (_sceneMode ++) {
case 10:
// Hidden closet closed
- if (_globals->_inventory._scimitar._sceneNumber == 9850)
+ if (RING_INVENTORY._scimitar._sceneNumber == 9850)
_objScimitar.hide();
- if (_globals->_inventory._sword._sceneNumber == 9850)
+ if (RING_INVENTORY._sword._sceneNumber == 9850)
_objSword.hide();
_globals->_sceneItems.remove(&_objScimitar);
_globals->_sceneItems.remove(&_objSword);
@@ -1493,15 +1504,15 @@ void Scene9850::signal() {
break;
case 11:
// Hidden closet opened
- if (_globals->_inventory._scimitar._sceneNumber == 9850)
+ if (RING_INVENTORY._scimitar._sceneNumber == 9850)
_globals->_sceneItems.addItems(&_objScimitar, NULL);
- if (_globals->_inventory._sword._sceneNumber == 9850)
+ if (RING_INVENTORY._sword._sceneNumber == 9850)
_globals->_sceneItems.addItems(&_objSword, NULL);
_globals->_sceneItems.remove(&_hotspot19);
_globals->_player.enableControl();
break;
case 9500:
- _globals->_sceneManager.changeScene(9500);
+ _globals->_sceneManager.changeScene(_sceneMode - 1);
break;
case 0:
default:
@@ -1517,10 +1528,10 @@ void Scene9850::process(Event &event) {
_globals->_player.disableControl();
if (_objSword._state == 0) {
_sceneMode = 0;
- setAction(&_sequenceManager, this, 9853, &_objLever, &_objDoor, &_objScimitar, &_objSword, 0);
+ setAction(&_sequenceManager, this, 9853, &_objLever, &_objDoor, &_objScimitar, &_objSword, NULL);
} else {
_sceneMode = 10;
- setAction(&_sequenceManager, this, 9854, &_objLever, &_objDoor, &_objScimitar, &_objSword, 0);
+ setAction(&_sequenceManager, this, 9854, &_objLever, &_objDoor, &_objScimitar, &_objSword, NULL);
}
_objSword._state ^= 1;
}
@@ -1532,7 +1543,7 @@ void Scene9850::dispatch() {
} else if (_globals->_player._position.y >= 198) {
_globals->_player.disableControl();
_sceneMode = 9500;
- setAction(&_sequenceManager, this, 9852, &_globals->_player, 0);
+ setAction(&_sequenceManager, this, 9852, &_globals->_player, NULL);
}
}
@@ -1544,59 +1555,59 @@ void Scene9850::postInit(SceneObjectList *OwnerList) {
_objDoor.setVisage(9850);
_objDoor.setStrip(1);
_objDoor.setFrame(1);
- _objDoor.setPosition(Common::Point(28, 118), 0);
- _objDoor.setPriority2(90);
+ _objDoor.setPosition(Common::Point(28, 118));
+ _objDoor.fixPriority(90);
_objLever.postInit();
_objLever.setVisage(9850);
_objLever.setStrip(4);
_objLever.setFrame(1);
- _objLever.setPosition(Common::Point(256, 35), 0);
+ _objLever.setPosition(Common::Point(256, 35));
_objCloak.postInit();
_objCloak.setVisage(9850);
_objCloak.setStrip(5);
_objCloak.setFrame(1);
- _objCloak.setPriority2(90);
- _objCloak.setPosition(Common::Point(157, 81), 0);
- if (_globals->_inventory._cloak._sceneNumber != 9850)
+ _objCloak.fixPriority(90);
+ _objCloak.setPosition(Common::Point(157, 81));
+ if (RING_INVENTORY._cloak._sceneNumber != 9850)
_objCloak.hide();
_objJacket.postInit();
_objJacket.setVisage(9850);
_objJacket.setStrip(5);
_objJacket.setFrame(2);
- _objJacket.setPriority2(90);
+ _objJacket.fixPriority(90);
_objJacket.setPosition(Common::Point(201, 84));
- if (_globals->_inventory._jacket._sceneNumber != 9850)
+ if (RING_INVENTORY._jacket._sceneNumber != 9850)
_objJacket.hide();
_objTunic2.postInit();
_objTunic2.setVisage(9850);
_objTunic2.setStrip(5);
_objTunic2.setFrame(3);
- _objTunic2.setPriority2(90);
+ _objTunic2.fixPriority(90);
_objTunic2.setPosition(Common::Point(295, 90));
- if (_globals->_inventory._tunic2._sceneNumber != 9850)
+ if (RING_INVENTORY._tunic2._sceneNumber != 9850)
_objTunic2.hide();
- if (_globals->_inventory._scimitar._sceneNumber == 9850) {
+ if (RING_INVENTORY._scimitar._sceneNumber == 9850) {
_objScimitar.postInit();
_objScimitar.setVisage(9850);
_objScimitar.setStrip(2);
_objScimitar.setFrame(1);
- _objScimitar.setPosition(Common::Point(55, 83), 0);
- _objScimitar.setPriority2(80);
+ _objScimitar.setPosition(Common::Point(55, 83));
+ _objScimitar.fixPriority(80);
_objScimitar.hide();
}
- if (_globals->_inventory._sword._sceneNumber == 9850) {
+ if (RING_INVENTORY._sword._sceneNumber == 9850) {
_objSword.postInit();
_objSword.setVisage(9850);
_objSword.setStrip(3);
_objSword.setFrame(1);
- _objSword.setPosition(Common::Point(56, 101), 0);
- _objSword.setPriority2(80);
+ _objSword.setPosition(Common::Point(56, 101));
+ _objSword.fixPriority(80);
_objSword.hide();
}
@@ -1624,7 +1635,7 @@ void Scene9850::postInit(SceneObjectList *OwnerList) {
_globals->_player.postInit();
_globals->_player.disableControl();
_sceneMode = 0;
- setAction(&_sequenceManager, this, 9851, &_globals->_player, 0);
+ setAction(&_sequenceManager, this, 9851, &_globals->_player, NULL);
}
/*--------------------------------------------------------------------------
@@ -1632,38 +1643,38 @@ void Scene9850::postInit(SceneObjectList *OwnerList) {
*
*--------------------------------------------------------------------------*/
void Scene9900::strAction1::signal() {
- RGB8 mask1, mask2;
- mask1.r = mask1.g = mask1.b = 0xff;
- mask2.r = mask2.g = mask2.b = 0;
+ const byte mask1[3] = {0xff, 0xff, 0xff};
+ const byte mask2[3] = {0, 0, 0};
Scene9900 *scene = (Scene9900 *)_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- scene->_soundHandler.startSound(351, 0, 127);
+ scene->_soundHandler.startSound(351);
_object9.postInit();
_object9.setVisage(18);
_object9._frame = 1;
_object9._strip = 6;
+ _object9.fixPriority(250);
_object9.setPosition(Common::Point(171, 59));
- _object9.animate(ANIM_MODE_5, 0);
+ _object9.animate(ANIM_MODE_5, NULL);
_globals->_scenePalette.addRotation(67, 111, 1, 1, this);
scene->_object2.hide();
break;
case 1:
_palette1.getPalette();
- _globals->_scenePalette.addUnkPal(&mask1, 1, true /*10*/, this);
+ _globals->_scenePalette.addFader(&mask1[0], 1, 10, this);
break;
case 2:
_object9.remove();
- _globals->_scenePalette.addUnkPal(&mask2, 1, true /*5*/, this);
+ _globals->_scenePalette.addFader(&mask2[0], 1, 5, this);
break;
case 3:
- _globals->_soundHandler.startSound(377, 0, 127);
+ _globals->_soundHandler.startSound(377);
setDelay(120);
break;
case 4:
- _globals->_scenePalette.addUnkPal(_palette1._palette, 256, 1, this);
+ _globals->_scenePalette.addFader(_palette1._palette, 256, 1, this);
break;
case 5:
remove();
@@ -1676,57 +1687,58 @@ void Scene9900::strAction1::signal() {
void Scene9900::strAction2::signal() {
switch (_actionIndex++) {
case 0:
- var1 = 0;
+ _lineNum = 0;
_txtArray1Index = 0;
_txtArray1[0]._position.y = 200;
- _txtArray1[0]._position.y = 300;
+ _txtArray1[1]._position.y = 300;
_txtArray2[0]._position.y = 400;
- _txtArray2[0]._position.y = 500;
- var3 = 0;
+ _txtArray2[1]._position.y = 500;
+ _var3 = 0;
// No break on purpose
case 1: {
- Common::String msg = _vm->_dataManager->getMessage(8030, var1++);
- if (!msg.compareTo("LASTCREDIT")) {
- if (var3 == 0) {
+ Common::String msg = _resourceManager->getMessage(8030, _lineNum++);
+ if (msg.compareTo("LASTCREDIT")) {
+ if (_var3) {
// Not used?
// int x = _txtArray1[_txtArray1Index].getFrame().getBounds().height();
_txtArray1[_txtArray1Index]._moveDiff.y = 10;
NpcMover *mover = new NpcMover();
- Common::Point pt(_txtArray1[_txtArray1Index]._moveDiff.x, -100);
- _txtArray1[_txtArray1Index].addMover(mover, &pt, 0);
+ Common::Point pt(_txtArray1[_txtArray1Index]._position.x, -100);
+ _txtArray1[_txtArray1Index].addMover(mover, &pt, NULL);
// Not used?
// int x = _txtArray2[_txtArray1Index].getFrame().getBounds().height();
_txtArray2[_txtArray1Index]._moveDiff.y = 10;
_txtArray1Index = (_txtArray1Index + 1) % 2;
}
- var3 = 1;
- _txtArray1[_txtArray1Index]._textMode = ALIGN_CENTRE;
+ _var3 = 1;
+ _txtArray1[_txtArray1Index]._textMode = ALIGN_CENTER;
_txtArray1[_txtArray1Index]._width = 240;
_txtArray1[_txtArray1Index]._fontNumber = 2;
- _txtArray1[_txtArray1Index]._colour1 = 7;
+ _txtArray1[_txtArray1Index]._color1 = 7;
_txtArray1[_txtArray1Index].setup(msg);
- _txtArray1[_txtArray1Index]._field7A = 20;
+ _txtArray1[_txtArray1Index]._moveRate = 20;
_txtArray1[_txtArray1Index]._moveDiff.y = 2;
- _txtArray1[_txtArray1Index].setPriority2(255);
+ _txtArray1[_txtArray1Index].fixPriority(255);
int frameWidth = _txtArray1[_txtArray1Index].getFrame().getBounds().width();
int frameHeight = _txtArray1[_txtArray1Index].getFrame().getBounds().height();
_txtArray1[_txtArray1Index].setPosition(Common::Point((320 - frameWidth) / 2, 200));
+
NpcMover *mover2 = new NpcMover();
Common::Point pt2(_txtArray1[_txtArray1Index]._position.x, 100);
- _txtArray1[_txtArray1Index].addMover(mover2, &pt2, 0);
+ _txtArray1[_txtArray1Index].addMover(mover2, &pt2, this);
- _txtArray2[_txtArray1Index]._textMode = ALIGN_CENTRE;
+ _txtArray2[_txtArray1Index]._textMode = ALIGN_CENTER;
_txtArray2[_txtArray1Index]._width = 240;
_txtArray2[_txtArray1Index]._fontNumber = 2;
- _txtArray2[_txtArray1Index]._colour1 = 23;
+ _txtArray2[_txtArray1Index]._color1 = 23;
- msg = _vm->_dataManager->getMessage(8030, var1++);
+ msg = _resourceManager->getMessage(8030, _lineNum++);
_txtArray2[_txtArray1Index].setup(msg);
- _txtArray2[_txtArray1Index]._field7A = 20;
+ _txtArray2[_txtArray1Index]._moveRate = 20;
_txtArray2[_txtArray1Index]._moveDiff.y = 2;
- _txtArray2[_txtArray1Index].setPriority2(255);
+ _txtArray2[_txtArray1Index].fixPriority(255);
frameWidth = _txtArray2[_txtArray1Index].getFrame().getBounds().width();
_txtArray2[_txtArray1Index].setPosition(Common::Point((320 - frameWidth) / 2, 200 + frameHeight));
} else {
@@ -1769,29 +1781,28 @@ void Scene9900::strAction2::dispatch() {
}
void Scene9900::strAction3::signal() {
- RGB8 mask3, mask4;
- mask3.r = 0xff; mask3.g = mask3.b = 0;
- mask4.r = mask4.g = mask4.b = 0;
+ const byte mask3[3] = {0xff, 0, 0};
+ const byte mask4[3] = {0, 0, 0};
switch (_actionIndex++) {
case 0:
_palette2.getPalette();
_palette3.loadPalette(2003);
- _globals->_scenePalette.addUnkPal(_palette3._palette, 256, true /*5*/, this);
+ _globals->_scenePalette.addFader(_palette3._palette, 256, 5, this);
break;
case 1:
- _globals->_scenePalette.addUnkPal(&mask3, 1, true /*10*/, this);
+ _globals->_scenePalette.addFader(&mask3[0], 1, 10, this);
break;
case 2:
- _globals->_scenePalette.addUnkPal(&mask4, 1, true /*1*/, this);
+ _globals->_scenePalette.addFader(&mask4[0], 1, 1, this);
break;
case 3:
_palette2.loadPalette(17);
_globals->_sceneManager._scene->loadScene(17);
- _globals->_scenePalette.addUnkPal(_palette2._palette, 256, true /*5*/, this);
+ _globals->_scenePalette.addFader(_palette2._palette, 256, 5, this);
break;
case 4:
- _globals->_game.endGame(9900, 61);
+ _globals->_game->endGame(9900, 61);
remove();
default:
break;
@@ -1808,35 +1819,35 @@ void Scene9900::signal() {
_object6.hide();
}
- _object1.animate(ANIM_MODE_NONE, 0);
- _object2.animate(ANIM_MODE_NONE, 0);
- _object3.animate(ANIM_MODE_NONE, 0);
- _object4.animate(ANIM_MODE_NONE, 0);
- _object5.animate(ANIM_MODE_NONE, 0);
- _object6.animate(ANIM_MODE_NONE, 0);
+ _object1.animate(ANIM_MODE_NONE, NULL);
+ _object2.animate(ANIM_MODE_NONE, NULL);
+ _object3.animate(ANIM_MODE_NONE, NULL);
+ _object4.animate(ANIM_MODE_NONE, NULL);
+ _object5.animate(ANIM_MODE_NONE, NULL);
+ _object6.animate(ANIM_MODE_NONE, NULL);
- _object1.setObjectWrapper(0);
- _object2.setObjectWrapper(0);
- _object3.setObjectWrapper(0);
- _object4.setObjectWrapper(0);
- _object5.setObjectWrapper(0);
- _object6.setObjectWrapper(0);
+ _object1.setObjectWrapper(NULL);
+ _object2.setObjectWrapper(NULL);
+ _object3.setObjectWrapper(NULL);
+ _object4.setObjectWrapper(NULL);
+ _object5.setObjectWrapper(NULL);
+ _object6.setObjectWrapper(NULL);
- _object1.addMover(0);
- _object2.addMover(0);
- _object3.addMover(0);
- _object4.addMover(0);
- _object5.addMover(0);
- _object6.addMover(0);
+ _object1.addMover(NULL);
+ _object2.addMover(NULL);
+ _object3.addMover(NULL);
+ _object4.addMover(NULL);
+ _object5.addMover(NULL);
+ _object6.addMover(NULL);
switch (_sceneMode){
case 150:
- _globals->_soundHandler.startSound(380, 0, 127);
- _object8.postInit(0);
+ _globals->_soundHandler.startSound(380);
+ _object8.postInit();
_object8.setVisage(2002);
_object8.setStrip(1);
_object8.setFrame(1);
- _object8.setPriority2(200);
+ _object8.fixPriority(200);
_object8.setPosition(Common::Point(64, 199));
_globals->_player.disableControl();
_sceneMode = 9908;
@@ -1844,7 +1855,7 @@ void Scene9900::signal() {
break;
case 162:
warning("TBC: shutdown();");
- _globals->_game.quitGame();
+ _globals->_game->quitGame();
break;
case 9901:
_globals->_player.disableControl();
@@ -1864,7 +1875,7 @@ void Scene9900::signal() {
setAction(&_sequenceManager, this, 9902, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6);
break;
case 9904:
- _globals->_soundHandler.startSound(390, 0, 127);
+ _globals->_soundHandler.startSound(390);
_sceneMode = 9912;
setAction(&_strAction2, this);
break;
@@ -1895,7 +1906,7 @@ void Scene9900::signal() {
setAction(&_sequenceManager, this, 9904, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6);
break;
case 9909:
- _globals->_soundHandler.startSound(375, 0, 127);
+ _globals->_soundHandler.startSound(375);
_globals->_player.disableControl();
_sceneMode = 9907;
setAction(&_sequenceManager, this, 9907, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6);
@@ -1906,7 +1917,7 @@ void Scene9900::signal() {
setAction(&_sequenceManager, this, 9911, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6);
break;
case 9911:
- _globals->_soundHandler.startSound(367, 0, 127);
+ _globals->_soundHandler.startSound(367);
_globals->_player.disableControl();
_sceneMode = 9909;
setAction(&_sequenceManager, this, 9909, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6);
@@ -1932,10 +1943,10 @@ void Scene9900::process(Event &event) {
if (event.handled)
return;
Scene::process(event);
- if (_sceneMode != 9906) {
+ if (_sceneMode == 9906) {
if ((event.eventType == EVENT_BUTTON_DOWN) && (_globals->_events.getCursor() == OBJECT_ITEMS)) {
_object8._state = 1;
- _globals->_inventory._items._sceneNumber = 9900;
+ RING_INVENTORY._items._sceneNumber = 9900;
_globals->_events.setCursor(CURSOR_USE);
}
}
@@ -1947,25 +1958,25 @@ void Scene9900::dispatch() {
}
void Scene9900::postInit(SceneObjectList *OwnerList) {
- _object1.postInit(0);
+ _object1.postInit();
_object1.hide();
- _object2.postInit(0);
+ _object2.postInit();
_object2.hide();
- _object3.postInit(0);
+ _object3.postInit();
_object3.hide();
- _object4.postInit(0);
+ _object4.postInit();
_object4.hide();
- _object5.postInit(0);
+ _object5.postInit();
_object5.hide();
- _object6.postInit(0);
+ _object6.postInit();
_object6.hide();
_object8._state = 0;
- _globals->_inventory._concentrator._sceneNumber = 9900;
- _globals->_inventory._items._rlbNum = 3;
- _globals->_inventory._items._cursorNum = 6;
- _globals->_inventory._items._description = Common::String("One of the items from the stasis ship. The other is on the Lance's bridge.");
+ RING_INVENTORY._concentrator._sceneNumber = 9900;
+ RING_INVENTORY._items._rlbNum = 3;
+ RING_INVENTORY._items._cursorNum = 6;
+ RING_INVENTORY._items._description = Common::String("One of the items from the stasis ship. The other is on the Lance's bridge.");
_stripManager.addSpeaker(&_speakerMR);
_globals->_player.disableControl();
@@ -1999,7 +2010,7 @@ void Scene9999::Action2::signal() {
setDelay(10);
break;
case 1:
- SceneItem::display(9999, 0, SET_Y, 10, SET_X, 30, SET_FONT, 2, SET_BG_COLOUR, -1, SET_EXT_BGCOLOUR, 23, SET_WIDTH, 260, SET_KEEP_ONSCREEN, 1, LIST_END);
+ SceneItem::display(9999, 0, SET_Y, 10, SET_X, 30, SET_FONT, 2, SET_BG_COLOR, -1, SET_EXT_BGCOLOR, 23, SET_WIDTH, 260, SET_KEEP_ONSCREEN, 1, LIST_END);
setDelay(300);
break;
case 2:
@@ -2018,29 +2029,29 @@ void Scene9999::postInit(SceneObjectList *OwnerList) {
_object1.postInit();
_object1.setVisage(1303);
_object1.setStrip2(3);
- _object1.setPosition(Common::Point(160, 152), 0);
+ _object1.setPosition(Common::Point(160, 152));
_globals->_player.postInit();
_globals->_player.setVisage(1303);
_globals->_player.setStrip2(1);
- _globals->_player.setPriority2(250);
- _globals->_player.animate(ANIM_MODE_2, 0);
- _globals->_player.setPosition(Common::Point(194, 98), 0);
+ _globals->_player.fixPriority(250);
+ _globals->_player.animate(ANIM_MODE_2, NULL);
+ _globals->_player.setPosition(Common::Point(194, 98));
_globals->_player._numFrames = 20;
_globals->_player.disableControl();
_object2.postInit();
_object2.setVisage(1303);
_object2.setStrip2(2);
- _object2.setPriority2(2);
- _object2.setPosition(Common::Point(164, 149), 0);
+ _object2.fixPriority(2);
+ _object2.setPosition(Common::Point(164, 149));
_object3.postInit();
_object3.setVisage(1303);
_object3.setStrip2(2);
- _object3.setPriority2(2);
+ _object3.fixPriority(2);
_object3.setFrame(2);
- _object3.setPosition(Common::Point(292, 149), 0);
+ _object3.setPosition(Common::Point(292, 149));
_object3.setAction(&_action3);
if (_globals->_sceneManager._previousScene == 3500)
@@ -2048,7 +2059,7 @@ void Scene9999::postInit(SceneObjectList *OwnerList) {
else
setAction(&_action1);
- _globals->_sceneManager._scene->_sceneBounds.centre(_globals->_player._position.x, _globals->_player._position.y);
+ _globals->_sceneManager._scene->_sceneBounds.center(_globals->_player._position.x, _globals->_player._position.y);
_globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
_globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
@@ -2057,7 +2068,7 @@ void Scene9999::postInit(SceneObjectList *OwnerList) {
else
_globals->_stripNum = 2121;
- _globals->_soundHandler.startSound(118, 0, 127);
+ _globals->_soundHandler.startSound(118);
}
diff --git a/engines/tsage/ringworld_scenes10.h b/engines/tsage/ringworld_scenes10.h
index a89456e39d..93987aa64b 100644
--- a/engines/tsage/ringworld_scenes10.h
+++ b/engines/tsage/ringworld_scenes10.h
@@ -39,8 +39,8 @@ class SceneObject9150 : public SceneObject {
public:
int _timer, _signalFlag;
- virtual void synchronise(Serialiser &s) {
- SceneObject::synchronise(s);
+ virtual void synchronize(Serializer &s) {
+ SceneObject::synchronize(s);
s.syncAsSint16LE(_timer);
s.syncAsSint16LE(_signalFlag);
}
@@ -52,8 +52,8 @@ public :
int _sceneState;
Scene2();
- virtual void synchronise(Serialiser &s) {
- Scene::synchronise(s);
+ virtual void synchronize(Serializer &s) {
+ Scene::synchronize(s);
s.syncAsSint16LE(_sceneState);
}
};
@@ -467,7 +467,7 @@ class Scene9900 : public Scene {
public:
SceneText _txtArray1[2];
SceneText _txtArray2[2];
- int var1, _txtArray1Index, var3;
+ int _lineNum, _txtArray1Index, _var3;
virtual void signal();
virtual void dispatch();
@@ -482,17 +482,6 @@ class Scene9900 : public Scene {
virtual void signal();
};
- class SceneTextArr1 {
- public:
- SceneText _sceneText[2];
- };
-
- class SceneTextArr2 {
- public:
- SceneText _sceneText[2];
- int _var1, var2, var3;
- };
-
public:
SoundHandler _soundHandler;
SequenceManager _sequenceManager;
diff --git a/engines/tsage/ringworld_scenes2.cpp b/engines/tsage/ringworld_scenes2.cpp
index 8d95460615..6a8db81adf 100644
--- a/engines/tsage/ringworld_scenes2.cpp
+++ b/engines/tsage/ringworld_scenes2.cpp
@@ -23,6 +23,7 @@
*
*/
+#include "common/config-manager.h"
#include "tsage/ringworld_scenes2.h"
#include "tsage/scenes.h"
#include "tsage/tsage.h"
@@ -76,8 +77,8 @@ void Scene1000::Action2::signal() {
setDelay(10);
break;
case 1:
- SceneItem::display(1000, 0, SET_Y, 20, SET_FONT, 2, SET_BG_COLOUR, -1,
- SET_EXT_BGCOLOUR, 35, SET_WIDTH, 200, SET_KEEP_ONSCREEN, 1, LIST_END);
+ SceneItem::display(1000, 0, SET_Y, 20, SET_FONT, 2, SET_BG_COLOR, -1,
+ SET_EXT_BGCOLOR, 35, SET_WIDTH, 200, SET_KEEP_ONSCREEN, 1, LIST_END);
setDelay(180);
break;
case 2:
@@ -112,28 +113,25 @@ void Scene1000::Action3::signal() {
setDelay(240);
break;
case 5: {
- // Intro.txt file presence is used to allow user option to skip the introduction
- _globals->_player.enableControl();
- Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading("Intro.txt");
- if (!in) {
- // File not present, so create it
- Common::OutSaveFile *out = g_system->getSavefileManager()->openForSaving("Intro.txt");
- out->finalize();
- delete out;
+ const char *SEEN_INTRO = "seen_intro";
+ if (!ConfMan.hasKey(SEEN_INTRO) || !ConfMan.getBool(SEEN_INTRO)) {
+ // First time being played, so show the introduction
+ ConfMan.setBool(SEEN_INTRO, true);
+ ConfMan.flushToDisk();
setDelay(1);
} else {
- delete in;
-
// Prompt user for whether to start play or watch introduction
+ _globals->_player.enableControl();
+
if (MessageDialog::show2(WATCH_INTRO_MSG, START_PLAY_BTN_STRING, INTRODUCTION_BTN_STRING) == 0) {
_actionIndex = 20;
_globals->_soundHandler.proc1(this);
} else {
setDelay(1);
}
-
- _globals->_player.disableControl();
}
+
+ _globals->_player.disableControl();
break;
}
case 6: {
@@ -266,7 +264,7 @@ void Scene1000::postInit(SceneObjectList *OwnerList) {
setAction(&_action2);
- _globals->_sceneManager._scene->_sceneBounds.centre(_object1._position.x, _object1._position.y);
+ _globals->_sceneManager._scene->_sceneBounds.center(_object1._position.x, _object1._position.y);
_globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
_globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
@@ -280,7 +278,7 @@ void Scene1000::postInit(SceneObjectList *OwnerList) {
_object1._moveDiff = Common::Point(2, 2);
_object1.setPosition(Common::Point(120, 180));
- _globals->_sceneManager._scene->_sceneBounds.centre(_object1._position.x, _object1._position.y);
+ _globals->_sceneManager._scene->_sceneBounds.center(_object1._position.x, _object1._position.y);
_globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
_globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
@@ -301,7 +299,7 @@ void Scene1000::postInit(SceneObjectList *OwnerList) {
_globals->_player.hide();
_globals->_player.disableControl();
- _globals->_sceneManager._scene->_sceneBounds.centre(_object3._position.x, _object3._position.y);
+ _globals->_sceneManager._scene->_sceneBounds.center(_object3._position.x, _object3._position.y);
setAction(&_action3);
}
@@ -439,7 +437,7 @@ void Scene1001::Action1::signal() {
scene->_object6.setStrip2(6);
scene->_object6.setFrame2(2);
scene->_object6._moveDiff = Common::Point(20, 20);
- scene->_object6.setPriority2(20);
+ scene->_object6.fixPriority(20);
scene->_object6.setPosition(Common::Point(scene->_object2._position.x - 6, scene->_object2._position.y + 7));
scene->_object6.animate(ANIM_MODE_5, NULL);
@@ -458,7 +456,7 @@ void Scene1001::Action1::signal() {
scene->_object7.setFrame2(1);
scene->_object7._moveDiff = Common::Point(20, 20);
scene->_object7.setPosition(Common::Point(scene->_object3._position.x - 28, scene->_object3._position.y - 11));
- scene->_object7.setPriority2(200);
+ scene->_object7.fixPriority(200);
scene->_object7.animate(ANIM_MODE_5, NULL);
Common::Point pt(scene->_object7._position.x - 70, scene->_object7._position.y - 70);
@@ -473,7 +471,7 @@ void Scene1001::Action1::signal() {
scene->_object5.setVisage(16);
scene->_object5.setPosition(Common::Point(306, 93));
scene->_object5._strip = 3;
- scene->_object5.setPriority2(200);
+ scene->_object5.fixPriority(200);
scene->_object5.animate(ANIM_MODE_2, NULL);
setDelay(30);
break;
@@ -521,7 +519,7 @@ void Scene1001::postInit(SceneObjectList *OwnerList) {
_stripManager.addSpeaker(&_speakerCText);
_stripManager.addSpeaker(&_speakerCR);
_stripManager.addSpeaker(&_speakerSL);
- _speakerQText._colour1 = 11;
+ _speakerQText._color1 = 11;
_object3.postInit();
_object3.setVisage(16);
@@ -638,7 +636,7 @@ void Scene1250::postInit(SceneObjectList *OwnerList) {
_object2.setVisage(1250);
_object2.setPosition(Common::Point(126, 69));
_object2.setStrip2(2);
- _object2.setPriority2(255);
+ _object2.fixPriority(255);
_object2._frame = 1;
_object2.setAction(&_action2);
@@ -666,7 +664,7 @@ void Scene1400::Action1::signal() {
setDelay(5);
break;
case 1: {
- SceneItem::display(1400, 0, SET_X, 120, SET_Y, 610, SET_FONT, 2, SET_EXT_BGCOLOUR, 23, SET_KEEP_ONSCREEN, -1, LIST_END);
+ SceneItem::display(1400, 0, SET_X, 120, SET_Y, 610, SET_FONT, 2, SET_EXT_BGCOLOR, 23, SET_KEEP_ONSCREEN, -1, LIST_END);
Common::Point pt(160, 700);
NpcMover *mover = new NpcMover();
@@ -687,7 +685,7 @@ void Scene1400::Action1::signal() {
}
case 3:
SceneItem::display(1400, 2, SET_X, 60, SET_Y, _globals->_sceneManager._scene->_sceneBounds.bottom - 80,
- SET_FONT, 2, SET_FG_COLOUR, 13, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, -1, LIST_END);
+ SET_FONT, 2, SET_FG_COLOR, 13, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, -1, LIST_END);
setDelay(420);
break;
case 4:
@@ -696,7 +694,7 @@ void Scene1400::Action1::signal() {
break;
case 5:
SceneItem::display(1400, 3, SET_X, 60, SET_Y, _globals->_sceneManager._scene->_sceneBounds.bottom - 80,
- SET_FONT, 2, SET_FG_COLOUR, 23, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, -1, LIST_END);
+ SET_FONT, 2, SET_FG_COLOR, 23, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, -1, LIST_END);
setDelay(360);
break;
case 6:
@@ -722,7 +720,7 @@ void Scene1400::Action1::signal() {
_globals->_player.animate(ANIM_MODE_2, NULL);
SceneItem::display(1400, 4, SET_X, 30, SET_Y, _globals->_player._position.y + 10, SET_FONT, 2,
- SET_FG_COLOUR, 13, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, -1, LIST_END);
+ SET_FG_COLOR, 13, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, -1, LIST_END);
setDelay(300);
break;
case 9: {
@@ -771,12 +769,12 @@ void Scene1400::postInit(SceneObjectList *OwnerList) {
_globals->_player.setVisage(1401);
_globals->_player.animate(ANIM_MODE_2, 0);
_globals->_player.setStrip2(4);
- _globals->_player.setPriority2(4);
+ _globals->_player.fixPriority(4);
_globals->_player.disableControl();
_globals->_player._moveDiff = Common::Point(4, 2);
_globals->_player.setPosition(Common::Point(160, 800));
- _globals->_sceneManager._scene->_sceneBounds.centre(_globals->_player._position);
+ _globals->_sceneManager._scene->_sceneBounds.center(_globals->_player._position);
_globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
_globals->_sceneOffset.y = (_globals->_sceneManager._scene->_sceneBounds.top / 100) * 100;
@@ -874,7 +872,7 @@ void Scene1500::Action2::signal() {
case 1: {
scene->_object2.postInit();
scene->_object2.setVisage(1502);
- scene->_object2.setPriority2(255);
+ scene->_object2.fixPriority(255);
scene->_object2.changeZoom(5);
scene->_object2._frame = 1;
scene->_object2._moveDiff = Common::Point(1, 1);
@@ -897,7 +895,7 @@ void Scene1500::Action2::signal() {
case 3:
scene->_soundHandler.proc4();
_globals->_stripNum = 1505;
- _globals->_sceneManager.changeScene(1505);
+ _globals->_sceneManager.changeScene(2400);
break;
}
}
diff --git a/engines/tsage/ringworld_scenes3.cpp b/engines/tsage/ringworld_scenes3.cpp
index b37b156907..f788f9a28b 100644
--- a/engines/tsage/ringworld_scenes3.cpp
+++ b/engines/tsage/ringworld_scenes3.cpp
@@ -226,8 +226,8 @@ void Scene2000::Action10::signal() {
error("Old stuff");
break;
case 2:
- SceneItem::display(2000, 17, SET_Y, 20, SET_X, 110, SET_FONT, 2, SET_BG_COLOUR, -1,
- SET_FG_COLOUR, 17, SET_WIDTH, 200, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, 1, LIST_END);
+ SceneItem::display(2000, 17, SET_Y, 20, SET_X, 110, SET_FONT, 2, SET_BG_COLOR, -1,
+ SET_FG_COLOR, 17, SET_WIDTH, 200, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, 1, LIST_END);
break;
case 3:
SceneItem::display(0, 0);
@@ -405,7 +405,7 @@ void Scene2000::postInit(SceneObjectList *OwnerList) {
_object9.setStrip2(3);
_object9.setFrame(4);
_object9.setPosition(Common::Point(136, 86));
- _object9.setPriority2(190);
+ _object9.fixPriority(190);
_object9.hide();
_object10.postInit();
@@ -413,7 +413,7 @@ void Scene2000::postInit(SceneObjectList *OwnerList) {
_object10.setStrip2(5);
_object10.setFrame(4);
_object10.setPosition(Common::Point(202, 86));
- _object10.setPriority2(195);
+ _object10.fixPriority(195);
_object10.hide();
switch (_globals->_sceneManager._previousScene) {
@@ -519,7 +519,7 @@ void Scene2100::Action1::signal() {
setDelay(3);
break;
case 5:
- _globals->_player.setPriority2(1);
+ _globals->_player.fixPriority(1);
scene->_area1.display();
scene->_area2.display();
scene->_area3.display();
@@ -578,7 +578,7 @@ void Scene2100::Action1::signal() {
}
break;
case 7:
- _globals->_player.setPriority2(-1);
+ _globals->_player.fixPriority(-1);
scene->_soundHandler.startSound(162);
scene->_object1.animate(ANIM_MODE_6, this);
break;
@@ -684,6 +684,7 @@ void Scene2100::Action5::signal() {
}
void Scene2100::Action6::signal() {
+ // Seeker stands up and walks to the elevator
Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
switch (_actionIndex++) {
@@ -699,14 +700,14 @@ void Scene2100::Action6::signal() {
Common::Point pt(130, 116);
NpcMover *mover = new NpcMover();
- scene->_object2.addMover(mover, &pt, NULL);
+ scene->_object2.addMover(mover, &pt, this);
break;
}
case 1: {
- scene->_object2.setPriority2(-1);
+ scene->_object2.fixPriority(-1);
Common::Point pt(153, 67);
NpcMover *mover = new NpcMover();
- scene->_object2.addMover(mover, &pt, NULL);
+ scene->_object2.addMover(mover, &pt, this);
break;
}
case 2:
@@ -752,10 +753,10 @@ void Scene2100::Action8::signal() {
}
case 3:
_globals->_player.checkAngle(&scene->_object3);
- scene->_stripManager.start((_globals->_inventory._translator._sceneNumber == 1) ? 7720 : 7710, this);
+ scene->_stripManager.start((RING_INVENTORY._translator._sceneNumber == 1) ? 7720 : 7710, this);
break;
case 4:
- if (_globals->_inventory._translator._sceneNumber != 1)
+ if (RING_INVENTORY._translator._sceneNumber != 1)
_globals->_sceneManager.changeScene(7600);
else {
_globals->setFlag(24);
@@ -835,7 +836,7 @@ void Scene2100::Action10::signal() {
scene->_object3.setVisage(2705);
scene->_object3.setStrip2(-1);
scene->_object3.changeZoom(-1);
- scene->_object3.setPriority2(-1);
+ scene->_object3.fixPriority(-1);
scene->_object3.setPosition(Common::Point(260, 156));
scene->_object3.setObjectWrapper(new SceneObjectWrapper());
scene->_object3.animate(ANIM_MODE_1, NULL);
@@ -852,30 +853,30 @@ void Scene2100::Action10::signal() {
scene->_object1.animate(ANIM_MODE_5, this);
break;
case 6: {
- _globals->_player.setPriority2(1);
+ _globals->_player.fixPriority(1);
Common::Point pt(144, 54);
NpcMover *mover = new NpcMover();
_globals->_player.addMover(mover, &pt, this);
break;
}
case 7: {
- scene->_object3.setPriority2(2);
+ scene->_object3.fixPriority(2);
Common::Point pt1(163, 55);
NpcMover *mover1 = new NpcMover();
scene->_object3.addMover(mover1, &pt1, NULL);
- scene->_object2.setPriority2(2);
+ scene->_object2.fixPriority(2);
Common::Point pt2(158, 55);
NpcMover *mover2 = new NpcMover();
scene->_object2.addMover(mover2, &pt2, this);
break;
}
case 8:
- _globals->_player.setPriority2(1);
+ _globals->_player.fixPriority(1);
_globals->_player.setStrip(1);
- scene->_object3.setPriority2(1);
+ scene->_object3.fixPriority(1);
scene->_object3.setStrip(2);
- scene->_object2.setPriority2(2);
+ scene->_object2.fixPriority(2);
scene->_object2.setStrip(3);
setDelay(45);
@@ -893,6 +894,7 @@ void Scene2100::Action10::signal() {
}
void Scene2100::Action11::signal() {
+ // Miranda stands up and walks to the elevator
Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
switch (_actionIndex++) {
@@ -911,7 +913,7 @@ void Scene2100::Action11::signal() {
scene->_object3.setVisage(2705);
scene->_object3.setStrip2(-1);
scene->_object3.changeZoom(-1);
- scene->_object3.setPriority2(-1);
+ scene->_object3.fixPriority(-1);
scene->_object3.setPosition(Common::Point(260, 156));
scene->_object3.setObjectWrapper(new SceneObjectWrapper());
scene->_object3.animate(ANIM_MODE_1, NULL);
@@ -928,12 +930,12 @@ void Scene2100::Action11::signal() {
scene->_object1.animate(ANIM_MODE_5, this);
break;
case 4: {
- scene->_object3.setPriority2(1);
+ scene->_object3.fixPriority(1);
Common::Point pt1(163, 55);
NpcMover *mover1 = new NpcMover();
scene->_object3.addMover(mover1, &pt1, NULL);
- scene->_object2.setPriority2(1);
+ scene->_object2.fixPriority(1);
Common::Point pt2(158, 55);
NpcMover *mover2 = new NpcMover();
scene->_object2.addMover(mover2, &pt2, this);
@@ -987,12 +989,12 @@ void Scene2100::Action12::signal() {
scene->_soundHandler.startSound(162);
scene->_object1.animate(ANIM_MODE_6, NULL);
- _globals->_player.setPriority2(-1);
+ _globals->_player.fixPriority(-1);
Common::Point pt1(277, 84);
PlayerMover *mover1 = new PlayerMover();
_globals->_player.addMover(mover1, &pt1, this);
- scene->_object2.setPriority2(-1);
+ scene->_object2.fixPriority(-1);
Common::Point pt2(255, 76);
PlayerMover *mover2 = new PlayerMover();
scene->_object2.addMover(mover2, &pt2, this);
@@ -1020,6 +1022,8 @@ void Scene2100::Action12::signal() {
case 10:
if (_globals->getFlag(74))
setDelay(1);
+ else
+ setAction(&scene->_sequenceManager, this, 2101, &_globals->_player, NULL);
break;
case 11:
scene->_stripManager.start(2170, this);
@@ -1050,7 +1054,7 @@ void Scene2100::Action13::signal() {
setDelay(6);
break;
case 1: {
- scene->_object2.setPriority2(113);
+ scene->_object2.fixPriority(113);
Common::Point pt(178, 116);
PlayerMover *mover = new PlayerMover();
scene->_object2.addMover(mover, &pt, this);
@@ -1123,7 +1127,7 @@ void Scene2100::Action14::signal() {
scene->_object3.setVisage(2705);
scene->_object3.setStrip2(-1);
scene->_object3.changeZoom(-1);
- scene->_object3.setPriority2(-1);
+ scene->_object3.fixPriority(-1);
scene->_object3.setPosition(Common::Point(260, 156));
scene->_object3.setObjectWrapper(new SceneObjectWrapper());
scene->_object3.animate(ANIM_MODE_1, NULL);
@@ -1147,7 +1151,7 @@ void Scene2100::Action14::signal() {
scene->_object3.setStrip(2);
setDelay(30);
case 13:
- scene->_object3.setPriority2(1);
+ scene->_object3.fixPriority(1);
scene->_soundHandler.startSound(162);
scene->_object1.animate(ANIM_MODE_6, this);
break;
@@ -1174,14 +1178,14 @@ void Scene2100::Action15::signal() {
scene->_object3.animate(ANIM_MODE_1, NULL);
scene->_object3.setObjectWrapper(new SceneObjectWrapper());
scene->_object3.setPosition(Common::Point(157, 56));
- scene->_object3.setPriority2(1);
+ scene->_object3.fixPriority(1);
scene->_object3.changeZoom(-1);
scene->_soundHandler.startSound(162);
scene->_object1.animate(ANIM_MODE_5, this);
break;
case 2: {
- scene->_object3.setPriority2(-1);
+ scene->_object3.fixPriority(-1);
Common::Point pt(177, 68);
NpcMover *mover = new NpcMover();
scene->_object3.addMover(mover, &pt, this);
@@ -1203,7 +1207,7 @@ void Scene2100::Action15::signal() {
break;
}
case 5: {
- scene->_object3.setPriority2(156);
+ scene->_object3.fixPriority(156);
Common::Point pt(260, 156);
NpcMover *mover = new NpcMover();
@@ -1258,7 +1262,7 @@ void Scene2100::Action16::signal() {
break;
}
case 7:
- _globals->_player.setPriority2(1);
+ _globals->_player.fixPriority(1);
_globals->_player.setStrip(3);
setDelay(45);
break;
@@ -1311,7 +1315,7 @@ void Scene2100::Action17::signal() {
scene->_stripManager.start(7072, this);
break;
case 8:
- _globals->_inventory._stasisNegator._sceneNumber = 1;
+ RING_INVENTORY._stasisNegator._sceneNumber = 1;
_globals->_sceneManager.changeScene(9100);
remove();
break;
@@ -1342,6 +1346,7 @@ void Scene2100::Hotspot2::doAction(int action) {
}
void Scene2100::Hotspot3::doAction(int action) {
+ // Computer, on the left
Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
switch (action) {
@@ -1442,6 +1447,7 @@ void Scene2100::Hotspot14::doAction(int action) {
}
void Scene2100::Object1::doAction(int action) {
+ // Elevator
Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
switch (action) {
@@ -1555,7 +1561,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
_object1.setVisage(2100);
_object1.animate(ANIM_MODE_NONE, NULL);
_object1.setPosition(Common::Point(157, 57));
- _object1.setPriority(5);
+ _object1.fixPriority(5);
_hotspot3.postInit();
_hotspot3.setVisage(2101);
@@ -1563,7 +1569,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
_hotspot3.animate(ANIM_MODE_2, NULL);
_hotspot3.setPosition(Common::Point(53, 44));
_hotspot3.changeZoom(100);
- _hotspot3.setPriority2(1);
+ _hotspot3.fixPriority(1);
_hotspot4.postInit();
_hotspot4.setVisage(2101);
@@ -1572,7 +1578,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
_hotspot4.animate(ANIM_MODE_8, 0, NULL);
_hotspot4.setPosition(Common::Point(274, 52));
_hotspot4.changeZoom(100);
- _hotspot4.setPriority2(1);
+ _hotspot4.fixPriority(1);
_hotspot5.postInit();
_hotspot5.setVisage(2101);
@@ -1581,13 +1587,13 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
_hotspot5.animate(ANIM_MODE_8, 0, NULL);
_hotspot5.setPosition(Common::Point(219, 141));
_hotspot5.changeZoom(100);
- _hotspot5.setPriority2(160);
+ _hotspot5.fixPriority(160);
_hotspot6.postInit();
_hotspot6.setVisage(2101);
_hotspot6._frame = 1;
_hotspot6._strip = 5;
- _hotspot6.setPriority2(175);
+ _hotspot6.fixPriority(175);
_hotspot6.animate(ANIM_MODE_8, 0, NULL);
_hotspot6.setPosition(Common::Point(97, 142));
_hotspot6.changeZoom(100);
@@ -1599,7 +1605,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
_hotspot7.animate(ANIM_MODE_NONE, NULL);
_hotspot7.setPosition(Common::Point(133, 46));
_hotspot7.changeZoom(100);
- _hotspot7.setPriority2(1);
+ _hotspot7.fixPriority(1);
_hotspot8.postInit();
_hotspot8.setVisage(2101);
@@ -1608,16 +1614,16 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
_hotspot8.animate(ANIM_MODE_8, 0, NULL);
_hotspot8.setPosition(Common::Point(20, 45));
_hotspot8.changeZoom(100);
- _hotspot8.setPriority2(1);
+ _hotspot8.fixPriority(1);
_hotspot2.postInit();
_hotspot2.setVisage(2101);
_hotspot2._frame = 1;
- _hotspot2._strip = 7;
+ _hotspot2._strip = 8;
_hotspot2.animate(ANIM_MODE_8, 0, NULL);
_hotspot2.setPosition(Common::Point(88, 41));
_hotspot2.changeZoom(100);
- _hotspot2.setPriority2(1);
+ _hotspot2.fixPriority(1);
_hotspot11.setBounds(Rect(139, 74, 173, 96));
_hotspot10.setBounds(Rect(71, 100, 91, 135));
@@ -1633,7 +1639,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
_object3.setPosition(Common::Point(246, 156));
_object3.animate(ANIM_MODE_NONE, NULL);
_object3.changeZoom(100);
- _object3.setPriority2(156);
+ _object3.fixPriority(156);
_object3.setVisage(2107);
_object3.setStrip(1);
_object3.setAction(&_action2);
@@ -1647,7 +1653,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
_object2.setPosition(Common::Point(150, 100));
_object2.animate(ANIM_MODE_NONE, NULL);
_object2.changeZoom(100);
- _object2.setPriority2(113);
+ _object2.fixPriority(113);
_object2.setAction(&_action3);
_globals->_sceneItems.push_back(&_object2);
}
@@ -1666,7 +1672,14 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
_area4._pt = Common::Point(237, 77);
_globals->_player.postInit();
- _globals->_player.setVisage(_globals->getFlag(13) ? 2170 : 0);
+ if (_globals->getFlag(13)) {
+ _globals->_player.setVisage(2170);
+ _globals->_player._moveDiff.y = 1;
+ } else {
+ _globals->_player.setVisage(0);
+ _globals->_player._moveDiff.y = 3;
+ }
+
_globals->_player.setObjectWrapper(new SceneObjectWrapper());
_globals->_player.animate(ANIM_MODE_1, NULL);
_globals->_player._moveDiff.x = 4;
@@ -1678,13 +1691,13 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
case 2120:
_globals->_soundHandler.startSound(160);
_globals->_soundHandler.proc5(true);
- _object1.setPriority2(-1);
- _globals->_player.setPriority2(-1);
+ _object1.fixPriority(-1);
+ _globals->_player.fixPriority(-1);
_globals->_player.setPosition(Common::Point(80, 66));
_globals->_player.enableControl();
break;
case 2150:
- _globals->_player.setPriority2(1);
+ _globals->_player.fixPriority(1);
_globals->_player.setPosition(Common::Point(157, 56));
_sceneMode = 2104;
setAction(&_sequenceManager, this, 2104, &_globals->_player, &_object1, NULL);
@@ -1693,13 +1706,13 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
if (_globals->_sceneObjects->contains(&_object3))
_object3.remove();
- _globals->_player.setPriority2(1);
+ _globals->_player.fixPriority(1);
_globals->_player.setPosition(Common::Point(144, 55));
_object2.setVisage(2806);
_object2.changeZoom(-1);
_object2.setPosition(Common::Point(158, 55));
- _object2.setPriority2(1);
+ _object2.fixPriority(1);
_object2.setAction(NULL);
_object2.setObjectWrapper(new SceneObjectWrapper());
_object2.animate(ANIM_MODE_1, NULL);
@@ -1711,7 +1724,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
if (_globals->_sceneObjects->contains(&_object3))
_object3.remove();
- _globals->_player.setPriority2(1);
+ _globals->_player.fixPriority(1);
_globals->_player.setPosition(Common::Point(144, 55));
_object2.postInit();
@@ -1719,7 +1732,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
_object2.setStrip(1);
_object2.changeZoom(-1);
_object2.setPosition(Common::Point(158, 55));
- _object2.setPriority2(1);
+ _object2.fixPriority(1);
_object2.setAction(NULL);
_object2.setObjectWrapper(new SceneObjectWrapper());
_object2.animate(ANIM_MODE_1, NULL);
@@ -1727,7 +1740,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
setAction(&_action12);
} else if (_globals->_stripNum == 6100) {
_globals->_player.setPosition(Common::Point(157, 56));
- _globals->_player.setPriority2(1);
+ _globals->_player.fixPriority(1);
_object4.postInit();
_object4.setVisage(2102);
@@ -1754,11 +1767,11 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
_globals->_player._angle = 225;
_globals->_player.setStrip(6);
_globals->_player.setFrame(1);
- _globals->_player.setPriority2(-1);
+ _globals->_player.fixPriority(-1);
_globals->_player.setPosition(Common::Point(272, 127));
_object3.setPosition(Common::Point(246, 156));
- _object3.setPriority2(156);
+ _object3.fixPriority(156);
_sceneMode = 2105;
setAction(&_sequenceManager, this, 2105, &_object3, NULL);
break;
@@ -1770,7 +1783,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
_globals->_player.setVisage(2104);
_globals->_player.setFrame(1);
_globals->_player.setPosition(Common::Point(65, 149));
- _globals->_player.setPriority2(152);
+ _globals->_player.fixPriority(152);
_globals->_player.setStrip(2);
_object4.postInit();
@@ -1790,11 +1803,11 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
_globals->_player.setStrip(3);
_globals->_player.setFrame(1);
- _globals->_player.setPriority2(1);
+ _globals->_player.fixPriority(1);
_globals->_player.setPosition(Common::Point(157, 56));
_object3.setPosition(Common::Point(246, 156));
- _object3.setPriority2(156);
+ _object3.fixPriority(156);
setAction(&_action5);
break;
@@ -1804,7 +1817,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
_globals->_player.setVisage(2104);
_globals->_player.setFrame(1);
_globals->_player.setPosition(Common::Point(65, 149));
- _globals->_player.setPriority2(152);
+ _globals->_player.fixPriority(152);
_globals->_player.setStrip(2);
_field1800 = 1;
@@ -1814,15 +1827,15 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
_object4.setPosition(Common::Point(160, 199));
_object4.hide();
- _globals->_inventory._stasisBox._sceneNumber = 0;
+ RING_INVENTORY._stasisBox._sceneNumber = 0;
setAction(&_action9);
break;
case 7000:
_globals->_soundHandler.startSound(160);
_globals->_soundHandler.proc5(true);
- if (_globals->_inventory._stasisBox2._sceneNumber == 1) {
- _globals->_player.setPriority2(1);
+ if (RING_INVENTORY._stasisBox2._sceneNumber == 1) {
+ _globals->_player.fixPriority(1);
_globals->_player.setPosition(Common::Point(157, 56));
_object4.postInit();
@@ -1838,7 +1851,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
_globals->_player.setVisage(2104);
_globals->_player.setFrame(1);
_globals->_player.setPosition(Common::Point(65, 149));
- _globals->_player.setPriority2(152);
+ _globals->_player.fixPriority(152);
_globals->_player.setStrip(2);
_field1800 = 1;
@@ -1852,7 +1865,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
if (_globals->_sceneObjects->contains(&_object2))
_object2.remove();
- _globals->_player.setPriority2(1);
+ _globals->_player.fixPriority(1);
_globals->_player.setPosition(Common::Point(157, 56));
setAction(&_action8);
@@ -1864,7 +1877,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
_globals->_player.setVisage(2104);
_globals->_player.setFrame(1);
_globals->_player.setPosition(Common::Point(65, 149));
- _globals->_player.setPriority2(152);
+ _globals->_player.fixPriority(152);
_globals->_player.setStrip(2);
_sceneMode = 2106;
@@ -1877,7 +1890,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
_globals->_player.setVisage(2104);
_globals->_player.setFrame(1);
_globals->_player.setPosition(Common::Point(65, 149));
- _globals->_player.setPriority2(152);
+ _globals->_player.fixPriority(152);
_globals->_player.setStrip(2);
_object4.postInit();
@@ -1995,12 +2008,12 @@ void Scene2120::Action1::signal() {
break;
case 1:
// First page of index
- SceneItem::display(2120, 0, SET_X, 120, SET_FONT, 1, SET_EXT_BGCOLOUR, 7, SET_BG_COLOUR, -1,
+ SceneItem::display(2120, 0, SET_X, 120, SET_FONT, 1, SET_EXT_BGCOLOR, 7, SET_BG_COLOR, -1,
SET_WIDTH, 200, SET_KEEP_ONSCREEN, -1, SET_TEXT_MODE, 0, LIST_END);
break;
case 2:
// Second page of index
- SceneItem::display(2120, 1, SET_X, 120, SET_FONT, 1, SET_EXT_BGCOLOUR, 7, SET_BG_COLOUR, -1,
+ SceneItem::display(2120, 1, SET_X, 120, SET_FONT, 1, SET_EXT_BGCOLOR, 7, SET_BG_COLOR, -1,
SET_WIDTH, 200, SET_KEEP_ONSCREEN, -1, SET_TEXT_MODE, 0, LIST_END);
break;
case 3:
@@ -2016,7 +2029,7 @@ void Scene2120::Action1::signal() {
case 4:
// Display page of text
SceneItem::display(2121, _entries[scene->_subjectIndex]._lineNum + scene->_lineOffset,
- SET_X, 130, SET_FONT, 1, SET_EXT_BGCOLOUR, 7, SET_BG_COLOUR, -1, SET_WIDTH, 200,
+ SET_X, 130, SET_FONT, 1, SET_EXT_BGCOLOR, 7, SET_BG_COLOR, -1, SET_WIDTH, 200,
SET_KEEP_ONSCREEN, -1, SET_TEXT_MODE, 0, LIST_END);
_actionIndex = 4;
break;
@@ -2182,8 +2195,8 @@ void Scene2120::postInit(SceneObjectList *OwnerList) {
_globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
}
-void Scene2120::synchronise(Serialiser &s) {
- Scene::synchronise(s);
+void Scene2120::synchronize(Serializer &s) {
+ Scene::synchronize(s);
s.syncAsSint16LE(_dbMode);
s.syncAsSint16LE(_prevDbMode);
@@ -2318,7 +2331,7 @@ void Scene2150::Action2::signal() {
break;
case 3:
_globals->_events.setCursor(CURSOR_WALK);
- scene->_stripManager.start((_globals->_inventory._ale._sceneNumber == 2150) ? 2151 : 2152, this);
+ scene->_stripManager.start((RING_INVENTORY._ale._sceneNumber == 2150) ? 2151 : 2152, this);
break;
case 4:
scene->_hotspot14.postInit();
@@ -2328,7 +2341,7 @@ void Scene2150::Action2::signal() {
if (scene->_stripManager._field2E8 == 15) {
scene->_hotspot14.setFrame(5);
- _globals->_inventory._ale._sceneNumber = 1;
+ RING_INVENTORY._ale._sceneNumber = 1;
} else {
scene->_hotspot14.setFrame(scene->_stripManager._field2E8 - 5);
}
@@ -2474,7 +2487,7 @@ void Scene2150::postInit(SceneObjectList *OwnerList) {
_hotspot7.animate(ANIM_MODE_8, NULL);
_hotspot7.setPosition(Common::Point(122, 62));
_hotspot7.changeZoom(100);
- _hotspot7.setPriority2(76);
+ _hotspot7.fixPriority(76);
_hotspot2.postInit();
_hotspot2.setVisage(2151);
@@ -2483,7 +2496,7 @@ void Scene2150::postInit(SceneObjectList *OwnerList) {
_hotspot2.animate(ANIM_MODE_NONE, NULL);
_hotspot2.setPosition(Common::Point(257, 67));
_hotspot2.changeZoom(100);
- _hotspot2.setPriority2(60);
+ _hotspot2.fixPriority(60);
_hotspot1.postInit();
_hotspot1.setVisage(2151);
@@ -2492,7 +2505,7 @@ void Scene2150::postInit(SceneObjectList *OwnerList) {
_hotspot1.animate(ANIM_MODE_NONE, NULL);
_hotspot1.setPosition(Common::Point(158, 99));
_hotspot1.changeZoom(100);
- _hotspot1.setPriority2(99);
+ _hotspot1.fixPriority(99);
_hotspot4.postInit();
_hotspot4.setVisage(2150);
@@ -2501,7 +2514,7 @@ void Scene2150::postInit(SceneObjectList *OwnerList) {
_hotspot4.animate(ANIM_MODE_NONE, NULL);
_hotspot4.setPosition(Common::Point(218, 200));
_hotspot4.changeZoom(100);
- _hotspot4.setPriority2(200);
+ _hotspot4.fixPriority(200);
_hotspot10.postInit();
_hotspot10.setVisage(2152);
@@ -2515,7 +2528,7 @@ void Scene2150::postInit(SceneObjectList *OwnerList) {
_globals->_player.setVisage(_globals->getFlag(13) ? 2170 : 0);
_globals->_player.animate(ANIM_MODE_1, NULL);
_globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.setPriority2(-1);
+ _globals->_player.fixPriority(-1);
_globals->_player.changeZoom(-1);
_globals->_player._moveDiff.y = 3;
@@ -2576,10 +2589,10 @@ void Scene2150::postInit(SceneObjectList *OwnerList) {
_globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
}
-void Scene2150::synchronise(Serialiser &s) {
- Scene::synchronise(s);
- _rect1.synchronise(s);
- _rect2.synchronise(s);
+void Scene2150::synchronize(Serializer &s) {
+ Scene::synchronize(s);
+ _rect1.synchronize(s);
+ _rect2.synchronize(s);
}
void Scene2150::signal() {
@@ -2714,7 +2727,7 @@ void Scene2200::Action3::signal() {
_actionIndex = 8;
setDelay(5);
} else {
- for (SynchronisedList<SceneObject *>::iterator i = _globals->_sceneObjects->begin();
+ for (SynchronizedList<SceneObject *>::iterator i = _globals->_sceneObjects->begin();
i != _globals->_sceneObjects->end(); ++i) {
(*i)->hide();
}
@@ -2731,7 +2744,7 @@ void Scene2200::Action3::signal() {
scene->_hotspot7.setFrame(1);
scene->_hotspot7.setPosition(Common::Point(145, 165));
- SceneItem::display(60, 1, SET_Y, 40, SET_X, 25, SET_FONT, 75, SET_BG_COLOUR, -1, SET_FG_COLOUR, 34,
+ SceneItem::display(60, 1, SET_Y, 40, SET_X, 25, SET_FONT, 75, SET_BG_COLOR, -1, SET_FG_COLOR, 34,
SET_POS_MODE, 0, SET_WIDTH, 280, SET_KEEP_ONSCREEN, 1, LIST_END);
_state = 1;
setDelay(1800);
@@ -2740,7 +2753,7 @@ void Scene2200::Action3::signal() {
case 3:
case 4:
case 5:
- SceneItem::display(60, _actionIndex - 2, SET_Y, 40, SET_X, 25, SET_FONT, 75, SET_BG_COLOUR, -1, SET_FG_COLOUR, 34,
+ SceneItem::display(60, _actionIndex - 2, SET_Y, 40, SET_X, 25, SET_FONT, 75, SET_BG_COLOR, -1, SET_FG_COLOR, 34,
SET_POS_MODE, 0, SET_WIDTH, 280, SET_KEEP_ONSCREEN, 1, LIST_END);
setDelay(1800);
break;
@@ -2751,7 +2764,7 @@ void Scene2200::Action3::signal() {
setDelay(5);
break;
case 7:
- for (SynchronisedList<SceneObject *>::iterator i = _globals->_sceneObjects->begin();
+ for (SynchronizedList<SceneObject *>::iterator i = _globals->_sceneObjects->begin();
i != _globals->_sceneObjects->end(); ++i)
(*i)->show();
@@ -2907,7 +2920,7 @@ void Scene2200::postInit(SceneObjectList *OwnerList) {
_hotspot8.setVisage(2840);
_hotspot8.setStrip(2);
_hotspot8.setPosition(Common::Point(96, 184));
- _hotspot8.setPriority2(236);
+ _hotspot8.fixPriority(236);
_globals->_player.postInit();
_globals->_player.setVisage(2640);
@@ -2930,25 +2943,25 @@ void Scene2200::postInit(SceneObjectList *OwnerList) {
_hotspot1.postInit();
_hotspot1.setVisage(2202);
_hotspot1.setPosition(Common::Point(175, 173));
- _hotspot1.setPriority2(99);
+ _hotspot1.fixPriority(99);
_hotspot3.postInit();
_hotspot3.setVisage(2202);
_hotspot3._strip = 2;
_hotspot3.setPosition(Common::Point(152, 76));
- _hotspot3.setPriority2(100);
+ _hotspot3.fixPriority(100);
_hotspot4.postInit();
_hotspot4.setVisage(2202);
_hotspot4._strip = 3;
_hotspot4.setPosition(Common::Point(115, 76));
- _hotspot4.setPriority2(200);
+ _hotspot4.fixPriority(200);
setAction(&_action1);
break;
case 2310:
default:
- _globals->_inventory._infoDisk._sceneNumber = 1;
+ RING_INVENTORY._infoDisk._sceneNumber = 1;
_hotspot3.postInit();
_hotspot3.setVisage(2215);
@@ -2959,7 +2972,7 @@ void Scene2200::postInit(SceneObjectList *OwnerList) {
_hotspot4.setVisage(2215);
_hotspot4._strip = 2;
_hotspot4.setPosition(Common::Point(120, 78));
- _hotspot4.setPriority2(255);
+ _hotspot4.fixPriority(255);
_globals->_sceneItems.push_back(&_hotspot4);
_soundHandler1.startSound(101);
@@ -2993,9 +3006,9 @@ void Scene2200::stripCallback(int v) {
}
}
-void Scene2200::synchronise(Serialiser &s) {
- Scene::synchronise(s);
- _exitRect.synchronise(s);
+void Scene2200::synchronize(Serializer &s) {
+ Scene::synchronize(s);
+ _exitRect.synchronize(s);
}
void Scene2200::signal() {
@@ -3096,7 +3109,7 @@ void Scene2222::postInit(SceneObjectList *OwnerList) {
_hotspot5.postInit();
_hotspot5.setVisage(3401);
_hotspot5.setStrip2(2);
- _hotspot5._frame = 5;
+ _hotspot5.setFrame(5);
_hotspot5.animate(ANIM_MODE_2, 0);
if (_globals->_sceneManager._previousScene == 2100) {
@@ -3118,7 +3131,7 @@ void Scene2222::postInit(SceneObjectList *OwnerList) {
}
_soundHandler.startSound(116);
- _globals->_sceneManager._scene->_sceneBounds.centre(_hotspot1._position);
+ _globals->_sceneManager._scene->_sceneBounds.center(_hotspot1._position);
_globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
_globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
@@ -3197,7 +3210,7 @@ void Scene2230::Action2::signal() {
case 2:
_globals->_player.setVisage(2235);
_globals->_player.setStrip2(1);
- _globals->_player.setPriority2(100);
+ _globals->_player.fixPriority(100);
_globals->_player._frame = 1;
_globals->_player.setPosition(Common::Point(200, 68));
_globals->_player.animate(ANIM_MODE_5, this);
@@ -3241,7 +3254,7 @@ void Scene2230::Action3::signal() {
_globals->_player.setVisage(0);
_globals->_player.setStrip2(-1);
- _globals->_player.setPriority2(-1);
+ _globals->_player.fixPriority(-1);
_globals->_player.setPosition(Common::Point(164, 96));
_globals->_player.animate(ANIM_MODE_1, NULL);
_globals->_player._canWalk = true;
@@ -3284,7 +3297,7 @@ void Scene2230::Action5::signal() {
break;
}
case 2:
- _globals->_player.setPriority2(1430);
+ _globals->_player.fixPriority(1430);
_globals->_player.setVisage(2232);
_globals->_player._strip = 1;
_globals->_player._frame = 1;
@@ -3306,7 +3319,7 @@ void Scene2230::Action6::signal() {
case 0:
_globals->_player._strip = 2;
_globals->_player._frame = 1;
- _globals->_player.setPriority2(-1);
+ _globals->_player.fixPriority(-1);
_globals->_player.animate(ANIM_MODE_5, this);
break;
case 1:
@@ -3359,7 +3372,7 @@ void Scene2230::Action7::signal() {
scene->_hotspot2.setVisage(2231);
scene->_hotspot2._strip = 3;
scene->_hotspot2.setPosition(Common::Point(166, 116));
- scene->_hotspot2.setPriority2(131);
+ scene->_hotspot2.fixPriority(131);
scene->_hotspot2.animate(ANIM_MODE_5, this);
scene->_hotspot8._frame = 2;
@@ -3425,7 +3438,7 @@ void Scene2230::Action8::signal() {
scene->_hotspot2._strip = 3;
scene->_hotspot2._frame = scene->_hotspot2.getFrameCount();
scene->_hotspot2.setPosition(Common::Point(166, 116));
- scene->_hotspot2.setPriority2(131);
+ scene->_hotspot2.fixPriority(131);
scene->_hotspot2.animate(ANIM_MODE_6, this);
break;
case 4: {
@@ -3688,7 +3701,7 @@ void Scene2230::postInit(SceneObjectList *OwnerList) {
_hotspot8.animate(ANIM_MODE_NONE, 0);
_hotspot8.setPosition(Common::Point(164, 133));
_hotspot8.changeZoom(100);
- _hotspot8.setPriority2(129);
+ _hotspot8.fixPriority(129);
_rect1 = Rect(59, 64, 89, 74);
@@ -3720,9 +3733,9 @@ void Scene2230::postInit(SceneObjectList *OwnerList) {
_globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
}
-void Scene2230::synchronise(Serialiser &s) {
- Scene::synchronise(s);
- _rect1.synchronise(s);
+void Scene2230::synchronize(Serializer &s) {
+ Scene::synchronize(s);
+ _rect1.synchronize(s);
s.syncAsSint16LE(_field30A);
}
@@ -3766,7 +3779,7 @@ void Scene2280::Action1::signal() {
setDelay(10);
break;
case 4:
- _globals->_player.setPriority2(1);
+ _globals->_player.fixPriority(1);
scene->_soundHandler.startSound(162);
scene->_hotspot16.animate(ANIM_MODE_6, this);
break;
@@ -3849,7 +3862,7 @@ void Scene2280::Action3::signal() {
scene->_hotspot12._strip = 2;
scene->_hotspot12._frame = 3;
scene->_hotspot12.setPosition(Common::Point(88, 76));
- scene->_hotspot12.setPriority2(1);
+ scene->_hotspot12.fixPriority(1);
_globals->_player.animate(ANIM_MODE_6, this);
break;
@@ -3867,7 +3880,7 @@ void Scene2280::Action3::signal() {
scene->_hotspot8.animate(ANIM_MODE_NONE, NULL);
scene->_hotspot8.setPosition(Common::Point(79, 108));
scene->_hotspot8.changeZoom(100);
- scene->_hotspot8.setPriority2(1);
+ scene->_hotspot8.fixPriority(1);
scene->_hotspot10.postInit();
scene->_hotspot10.setVisage(2280);
@@ -3876,7 +3889,7 @@ void Scene2280::Action3::signal() {
scene->_hotspot10.animate(ANIM_MODE_NONE, NULL);
scene->_hotspot10.setPosition(Common::Point(79, 104));
scene->_hotspot10.changeZoom(100);
- scene->_hotspot10.setPriority2(1);
+ scene->_hotspot10.fixPriority(1);
_globals->clearFlag(13);
@@ -3925,11 +3938,11 @@ void Scene2280::Action4::signal() {
switch (_state) {
case 1:
scene->_hotspot18.remove();
- _globals->_inventory._scanner._sceneNumber = 1;
+ RING_INVENTORY._scanner._sceneNumber = 1;
break;
case 6:
scene->_hotspot17.remove();
- _globals->_inventory._medkit._sceneNumber = 1;
+ RING_INVENTORY._medkit._sceneNumber = 1;
break;
case 50:
scene->_hotspot17.postInit();
@@ -3939,9 +3952,9 @@ void Scene2280::Action4::signal() {
scene->_hotspot17.animate(ANIM_MODE_NONE, NULL);
scene->_hotspot17.setPosition(Common::Point(162, 39));
scene->_hotspot17.changeZoom(100);
- scene->_hotspot17.setPriority2(1);
+ scene->_hotspot17.fixPriority(1);
- _globals->_inventory._medkit._sceneNumber = 2280;
+ RING_INVENTORY._medkit._sceneNumber = 2280;
_globals->_sceneItems.push_front(&scene->_hotspot17);
break;
case 51:
@@ -3952,9 +3965,9 @@ void Scene2280::Action4::signal() {
scene->_hotspot18.animate(ANIM_MODE_NONE, NULL);
scene->_hotspot18.setPosition(Common::Point(152, 43));
scene->_hotspot18.changeZoom(100);
- scene->_hotspot18.setPriority2(1);
+ scene->_hotspot18.fixPriority(1);
- _globals->_inventory._scanner._sceneNumber = 2280;
+ RING_INVENTORY._scanner._sceneNumber = 2280;
_globals->_sceneItems.push_front(&scene->_hotspot18);
break;
}
@@ -4221,25 +4234,25 @@ void Scene2280::postInit(SceneObjectList *OwnerList) {
_hotspot16.postInit();
_hotspot16.setVisage(2281);
_hotspot16.setPosition(Common::Point(208, 90));
- _hotspot16.setPriority2(80);
+ _hotspot16.fixPriority(80);
- if (_globals->_inventory._medkit._sceneNumber == 2280) {
+ if (RING_INVENTORY._medkit._sceneNumber == 2280) {
_hotspot17.postInit();
_hotspot17.setVisage(2161);
_hotspot17._strip = 2;
_hotspot17.setPosition(Common::Point(162, 39));
- _hotspot17.setPriority2(1);
+ _hotspot17.fixPriority(1);
_globals->_sceneItems.push_back(&_hotspot17);
}
- if (_globals->_inventory._scanner._sceneNumber == 2280) {
+ if (RING_INVENTORY._scanner._sceneNumber == 2280) {
_hotspot18.postInit();
_hotspot18.setVisage(2161);
_hotspot18._strip = 2;
_hotspot18._frame = 2;
_hotspot17.setPosition(Common::Point(152, 43));
- _hotspot17.setPriority2(1);
+ _hotspot17.fixPriority(1);
_globals->_sceneItems.push_back(&_hotspot17);
}
@@ -4249,21 +4262,21 @@ void Scene2280::postInit(SceneObjectList *OwnerList) {
_hotspot8.setVisage(2280);
_hotspot8._strip = 2;
_hotspot8.setPosition(Common::Point(79, 108));
- _hotspot8.setPriority2(1);
+ _hotspot8.fixPriority(1);
_hotspot10.postInit();
_hotspot10.setVisage(2280);
_hotspot10._strip = 2;
_hotspot10._frame = 2;
_hotspot10.setPosition(Common::Point(79, 104));
- _hotspot10.setPriority2(2);
+ _hotspot10.fixPriority(2);
_hotspot12.postInit();
_hotspot12.setVisage(2280);
_hotspot12._strip = 2;
_hotspot12._frame = 3;
_hotspot12.setPosition(Common::Point(88, 76));
- _hotspot12.setPriority2(1);
+ _hotspot12.fixPriority(1);
_globals->_sceneItems.addItems(&_hotspot8, &_hotspot10, &_hotspot12, NULL);
}
@@ -4273,19 +4286,19 @@ void Scene2280::postInit(SceneObjectList *OwnerList) {
_hotspot9.postInit();
_hotspot9.setVisage(2280);
_hotspot9.setPosition(Common::Point(104, 96));
- _hotspot9.setPriority2(1);
+ _hotspot9.fixPriority(1);
_hotspot11.postInit();
_hotspot11.setVisage(2280);
_hotspot11._frame = 2;
_hotspot11.setPosition(Common::Point(130, 79));
- _hotspot11.setPriority2(1);
+ _hotspot11.fixPriority(1);
_hotspot13.postInit();
_hotspot13.setVisage(2280);
_hotspot13._frame = 3;
_hotspot13.setPosition(Common::Point(113, 63));
- _hotspot13.setPriority2(1);
+ _hotspot13.fixPriority(1);
_hotspot1.setBounds(Rect(225, 70, 234, 80));
_hotspot2.setBounds(Rect(44, 78, 56, 105));
@@ -4310,7 +4323,7 @@ void Scene2280::postInit(SceneObjectList *OwnerList) {
_globals->_player.enableControl();
} else {
_globals->setFlag(109);
- _globals->_player.setPriority2(76);
+ _globals->_player.fixPriority(76);
_globals->_player.disableControl();
_sceneMode = 2281;
@@ -4329,7 +4342,7 @@ void Scene2280::postInit(SceneObjectList *OwnerList) {
void Scene2280::signal() {
if (_sceneMode == 2281) {
- _globals->_player.setPriority2(-1);
+ _globals->_player.fixPriority(-1);
_globals->_player.enableControl();
}
}
@@ -4342,9 +4355,9 @@ void Scene2280::dispatch() {
}
}
-void Scene2280::synchronise(Serialiser &s) {
- Scene::synchronise(s);
- _exitRect.synchronise(s);
+void Scene2280::synchronize(Serializer &s) {
+ Scene::synchronize(s);
+ _exitRect.synchronize(s);
}
/*--------------------------------------------------------------------------
@@ -4422,7 +4435,7 @@ void Scene2300::Action1::signal() {
_globals->_soundHandler.startSound(77, this);
break;
case 8:
- _globals->_game.endGame(2300, 0);
+ _globals->_game->endGame(2300, 0);
break;
case 9:
if (scene->_hotspot5._mover)
@@ -4454,8 +4467,8 @@ void Scene2300::Action1::signal() {
scene->_hotspot6._frame = 1;
scene->_hotspot5.animate(ANIM_MODE_5, NULL);
scene->_hotspot6.animate(ANIM_MODE_5, NULL);
- scene->_hotspot5.setPriority2(20);
- scene->_hotspot6.setPriority2(20);
+ scene->_hotspot5.fixPriority(20);
+ scene->_hotspot6.fixPriority(20);
_globals->_player.setVisage(2672);
_globals->_player._strip = 5;
@@ -4546,7 +4559,7 @@ void Scene2300::Action2::signal() {
case 7:
scene->_hotspot7._strip = 2;
scene->_hotspot7._frame = 1;
- scene->_hotspot7.animate(ANIM_MODE_7, this);
+ scene->_hotspot7.animate(ANIM_MODE_5, this);
break;
case 8:
scene->_hotspot2.animate(ANIM_MODE_6, this);
@@ -4626,7 +4639,7 @@ void Scene2300::Action4::signal() {
scene->_hotspot9.setStrip2(2);
scene->_hotspot9.setFrame(3);
scene->_hotspot9.setPosition(Common::Point(273, 199));
- scene->_hotspot9.setPriority2(19);
+ scene->_hotspot9.fixPriority(19);
scene->_hotspot9.animate(ANIM_MODE_5, this);
scene->_soundHandler1.startSound(11);
break;
@@ -4672,7 +4685,7 @@ void Scene2300::Hotspot5::doAction(int action) {
}
}
-void Scene2300::Hotspot6::doAction(int action) {
+void Scene2300::Hotspot7::doAction(int action) {
Scene2300 *scene = (Scene2300 *)_globals->_sceneManager._scene;
switch (action) {
@@ -4707,12 +4720,12 @@ void Scene2300::postInit(SceneObjectList *OwnerList) {
setZoomPercents(0, 100, 200, 100);
_stripManager.addSpeaker(&_speakerSL);
- _stripManager.addSpeaker(&_speakerML);
+ _stripManager.addSpeaker(&_speakerMText);
_stripManager.addSpeaker(&_speakerQText);
_stripManager.addSpeaker(&_speakerSText);
- _globals->_inventory._stunner._sceneNumber = 1;
- _globals->_inventory._infoDisk._sceneNumber = 1;
+ RING_INVENTORY._stunner._sceneNumber = 1;
+ RING_INVENTORY._infoDisk._sceneNumber = 1;
_hotspot8.postInit();
_hotspot8.setVisage(2301);
@@ -4727,7 +4740,7 @@ void Scene2300::postInit(SceneObjectList *OwnerList) {
_hotspot9.setStrip2(2);
_hotspot9._frame = _hotspot9.getFrameCount();
_hotspot9.setPosition(Common::Point(273, 199));
- _hotspot9.setPriority2(1);
+ _hotspot9.fixPriority(1);
_hotspot10.postInit();
_hotspot10.setVisage(2301);
@@ -4864,29 +4877,32 @@ void Scene2310::postInit(SceneObjectList *OwnerList) {
_globals->_events.setCursor(CURSOR_WALK);
_wireIndex = 5;
- _pageIndex = _globals->_randomSource.getRandomNumber(19) + 1;
+ if (_vm->getFeatures() & GF_CD)
+ _pageIndex = _globals->_randomSource.getRandomNumber(14) + 2;
+ else
+ _pageIndex = _globals->_randomSource.getRandomNumber(19) + 1;
signal();
}
void Scene2310::signal() {
switch (_sceneMode++) {
case 0: {
- Common::String fmtString = _vm->_dataManager->getMessage(2300, 22);
+ Common::String fmtString = _resourceManager->getMessage(2300, 22);
Common::String msg = Common::String::format(fmtString.c_str(), _pageList[_pageIndex]._pageNumber);
_sceneText._width = 280;
- _sceneText._textMode = ALIGN_CENTRE;
- _sceneText._colour1 = 35;
+ _sceneText._textMode = ALIGN_CENTER;
+ _sceneText._color1 = 35;
_sceneText._fontNumber = 2;
_sceneText.setup(msg);
- _sceneText.setPriority2(255);
+ _sceneText.fixPriority(255);
_sceneText.setPosition(Common::Point(30, 20));
break;
}
case 1: {
- Common::String msg = _vm->_dataManager->getMessage(2300, 23);
+ Common::String msg = _resourceManager->getMessage(2300, 23);
_sceneText.setup(msg);
- _sceneText.setPriority2(255);
+ _sceneText.fixPriority(255);
_sceneText.setPosition(Common::Point(30, 170));
_globals->_sceneObjects->draw();
@@ -4901,8 +4917,8 @@ void Scene2310::signal() {
}
}
-void Scene2310::synchronise(Serialiser &s) {
- Scene::synchronise(s);
+void Scene2310::synchronize(Serializer &s) {
+ Scene::synchronize(s);
s.syncAsSint16LE(_wireIndex);
s.syncAsSint16LE(_pageIndex);
@@ -4966,10 +4982,7 @@ void Scene2310::process(Event &event) {
}
void Scene2310::dispatch() {
- if ((_vm->getFeatures() & GF_CD) && !ConfMan.getBool("copy_protection")) {
- // CD version of Ringworld has the copy protection disabled
- signal();
- } else if (_wireIndex != 5) {
+ if (_wireIndex != 5) {
for (int idx = 0; idx < 5; ++idx) {
if (_rectList[idx].contains(_globals->_events._mousePos)) {
_wireList[_wireIndex].setFrame(idx + 2);
@@ -5033,7 +5046,7 @@ void Scene2320::Action2::signal() {
switch (_actionIndex++) {
case 0: {
scene->_soundHandler.startSound(253);
- scene->_hotspot13.setPriority2(99);
+ scene->_hotspot13.fixPriority(99);
Common::Point pt(scene->_hotspot13._position.x, 200);
NpcMover *mover = new NpcMover();
@@ -5068,7 +5081,7 @@ void Scene2320::Action3::signal() {
break;
}
case 3:
- scene->_hotspot6.setPriority2(scene->_hotspot6._priority - 1);
+ _globals->_player.fixPriority(scene->_hotspot6._priority - 1);
_globals->_player._strip = 3;
setDelay(10);
break;
@@ -5122,7 +5135,7 @@ void Scene2320::Action3::signal() {
break;
case 5: {
if (_state == 2320)
- _globals->_player.setPriority2(-1);
+ _globals->_player.fixPriority(-1);
else
_globals->_sceneManager.changeScene(_state);
@@ -5165,13 +5178,13 @@ void Scene2320::Action4::signal() {
break;
case 3:
_globals->_player.animate(ANIM_MODE_6, NULL);
- scene->setAction(&scene->_action2);
+ setAction(&scene->_action2, this);
break;
case 4: {
scene->_hotspot16.postInit();
scene->_hotspot16.setVisage(2331);
scene->_hotspot16.setStrip(3);
- scene->_hotspot16.setPriority2(149);
+ scene->_hotspot16.fixPriority(149);
scene->_hotspot16.setPosition(Common::Point(320, 202));
scene->_hotspot16.show();
@@ -5181,14 +5194,14 @@ void Scene2320::Action4::signal() {
break;
}
case 5: {
- scene->_hotspot16.setPriority2(200);
+ scene->_hotspot16.fixPriority(200);
Common::Point pt(320, 180);
NpcMover *mover = new NpcMover();
scene->_hotspot16.addMover(mover, &pt, this);
break;
}
case 6: {
- scene->_hotspot16.setPriority2(-1);
+ scene->_hotspot16.fixPriority(-1);
_globals->_player.setVisage(0);
_globals->_player.animate(ANIM_MODE_1, NULL);
@@ -5262,7 +5275,7 @@ void Scene2320::Action4::signal() {
}
case 17: {
_globals->_player.animate(ANIM_MODE_6, NULL);
- scene->_hotspot16.setPriority2(160);
+ scene->_hotspot16.fixPriority(160);
Common::Point pt(320, 121);
NpcMover *mover = new NpcMover();
@@ -5290,7 +5303,7 @@ void Scene2320::Action4::signal() {
_globals->_player.setVisage(0);
_globals->_player.animate(ANIM_MODE_1, NULL);
- scene->_hotspot13.setPriority2(1);
+ scene->_hotspot13.fixPriority(1);
remove();
break;
}
@@ -5320,7 +5333,7 @@ void Scene2320::Action5::signal() {
_globals->_player.setVisage(2347);
_globals->_player.setStrip(1);
_globals->_player.setFrame(1);
- _globals->_player.setPriority2(137);
+ _globals->_player.fixPriority(137);
_globals->_player.animate(ANIM_MODE_5, this);
break;
case 5:
@@ -5333,7 +5346,7 @@ void Scene2320::Action5::signal() {
_globals->_sceneManager.changeScene(7000);
else if (_globals->getFlag(59))
_globals->_sceneManager.changeScene(5000);
- else if (!_globals->getFlag(43) || (_globals->_inventory._ale._sceneNumber != 1))
+ else if (!_globals->getFlag(43) || (RING_INVENTORY._ale._sceneNumber != 1))
setDelay(10);
else {
scene->_hotspot11.setAction(NULL);
@@ -5345,7 +5358,7 @@ void Scene2320::Action5::signal() {
NpcMover *mover = new NpcMover();
scene->_hotspot11.addMover(mover, &pt, NULL);
- _globals->clearFlag(53);
+ _globals->clearFlag(43);
scene->_stripManager.start(2325, this);
}
break;
@@ -5376,7 +5389,7 @@ void Scene2320::Action6::signal() {
case 3:
_globals->_player.setVisage(0);
_globals->_player.setStrip(3);
- _globals->_player.setPriority2(-1);
+ _globals->_player.fixPriority(-1);
_globals->_player.setObjectWrapper(new SceneObjectWrapper());
_globals->_player.animate(ANIM_MODE_1, NULL);
@@ -5432,12 +5445,12 @@ void Scene2320::Action7::signal() {
scene->_hotspot6.animate(ANIM_MODE_5, this);
break;
case 2:
- scene->_hotspot10.setPriority2(-1);
+ scene->_hotspot10.fixPriority(-1);
ADD_MOVER_NULL(scene->_hotspot10, 321, 94);
- scene->_hotspot11.setPriority2(-1);
+ scene->_hotspot11.fixPriority(-1);
ADD_MOVER_NULL(scene->_hotspot11, 346, 85);
- _globals->_player.setPriority2(-1);
+ _globals->_player.fixPriority(-1);
ADD_MOVER(_globals->_player, 297, 89);
break;
case 3:
@@ -5454,10 +5467,6 @@ void Scene2320::Action7::signal() {
case 6:
ADD_MOVER_NULL(scene->_hotspot10, 491, 160);
ADD_MOVER(_globals->_player, 391, 88);
-
- _globals->_player.setStrip(1);
- _globals->_player.setFrame(1);
- _globals->_player.animate(ANIM_MODE_6, this);
break;
case 7:
ADD_PLAYER_MOVER(462, 182);
@@ -5477,7 +5486,7 @@ void Scene2320::Action7::signal() {
break;
case 12:
_globals->_player.enableControl();
- _globals->_inventory._stasisBox._sceneNumber = 2320;
+ RING_INVENTORY._stasisBox._sceneNumber = 2320;
break;
}
}
@@ -5507,7 +5516,7 @@ void Scene2320::Action8::signal() {
_globals->_player.enableControl();
break;
case 5:
- _globals->_inventory._stasisBox._sceneNumber = 2320;
+ RING_INVENTORY._stasisBox._sceneNumber = 2320;
scene->_sceneMode = 2326;
scene->_speakerGameText.setTextPos(Common::Point(_globals->_sceneManager._scene->_sceneBounds.left + 30, 10));
scene->setAction(&scene->_sequenceManager1, scene, 2326, &_globals->_player, &scene->_hotspot11, NULL);
@@ -5622,12 +5631,12 @@ void Scene2320::Hotspot11::doAction(int action) {
} else {
scene->_sceneMode = 2329;
- if (_globals->_inventory._ale._sceneNumber == 1) {
+ if (RING_INVENTORY._ale._sceneNumber == 1) {
scene->setAction(&scene->_sequenceManager1, scene, 2329, NULL);
} else if (!_globals->getFlag(110)) {
_globals->setFlag(110);
scene->setAction(&scene->_sequenceManager1, scene, 2330, NULL);
- } else if (_globals->_inventory._peg._sceneNumber != 1) {
+ } else if (RING_INVENTORY._peg._sceneNumber != 1) {
scene->setAction(&scene->_sequenceManager1, scene, 2331, NULL);
} else if (!_state) {
++_state;
@@ -5683,13 +5692,13 @@ void Scene2320::Hotspot14::doAction(int action) {
scene->_hotspot8.hide();
_globals->_sceneItems.push_front(&scene->_hotspot8);
- _globals->_inventory._waldos._sceneNumber = 2320;
+ RING_INVENTORY._waldos._sceneNumber = 2320;
scene->_hotspot9.postInit();
scene->_hotspot9.setVisage(2345);
scene->_hotspot9._strip = 6;
scene->_hotspot9.setPosition(Common::Point(536, 103));
- scene->_hotspot9.setPriority2(200);
+ scene->_hotspot9.fixPriority(200);
scene->_hotspot9.hide();
scene->_hotspot16.postInit();
@@ -5705,7 +5714,7 @@ void Scene2320::Hotspot14::doAction(int action) {
SceneItem::display2(2320, 24);
} else if (!_globals->getFlag(76)) {
SceneItem::display2(2320, 28);
- } else if (!_globals->_inventory._waldos._sceneNumber) {
+ } else if (!RING_INVENTORY._waldos._sceneNumber) {
SceneItem::display2(2320, 27);
} else {
SceneItem::display2(2320, 29);
@@ -5779,7 +5788,7 @@ void Scene2320::postInit(SceneObjectList *OwnerList) {
_hotspot13.postInit();
_hotspot13.setVisage(2323);
_hotspot13.setPosition(Common::Point(319, 157));
- _hotspot13.setPriority2(1);
+ _hotspot13.fixPriority(1);
_hotspot12.postInit();
_hotspot12.setVisage(2321);
@@ -5787,18 +5796,18 @@ void Scene2320::postInit(SceneObjectList *OwnerList) {
_hotspot12.animate(ANIM_MODE_8, 0, NULL);
_hotspot12.setPosition(Common::Point(412, 46));
- if (_globals->_inventory._waldos._sceneNumber == 2320) {
+ if (RING_INVENTORY._waldos._sceneNumber == 2320) {
_hotspot8.postInit();
_hotspot8.setVisage(2345);
_hotspot8.setStrip(5);
_hotspot8.setFrame(8);
_hotspot8.setPosition(Common::Point(541, 103));
- _hotspot8.setPriority2(201);
+ _hotspot8.fixPriority(201);
_globals->_sceneItems.push_back(&_hotspot8);
}
- _area1.setup(2100, 2, 1, 2150);
+ _area1.setup(2153, 2, 1, 2100);
_area1._pt = Common::Point(200, 31);
_area2.setup(2153, 3, 1, 2150);
_area2._pt = Common::Point(200, 50);
@@ -5812,17 +5821,20 @@ void Scene2320::postInit(SceneObjectList *OwnerList) {
_hotspot11.setVisage(2705);
_hotspot11._strip = 3;
_hotspot11.setPosition(Common::Point(510, 156));
+ _globals->_sceneItems.push_back(&_hotspot11);
_hotspot11._state = 0;
_hotspot11.setAction(&_action1);
-
- _globals->_sceneItems.push_back(&_hotspot11);
}
_globals->_player.postInit();
+ if (_globals->getFlag(13))
+ _globals->_player.setVisage(2170);
+ else
+ _globals->_player.setVisage(0);
_globals->_player.animate(ANIM_MODE_1, NULL);
_globals->_player.setObjectWrapper(new SceneObjectWrapper());
_globals->_player.setPosition(Common::Point(320, 79));
- _globals->_player.setPriority2(10);
+ _globals->_player.fixPriority(10);
_globals->_player.changeZoom(-1);
_globals->_player._moveDiff.y = 3;
_globals->_player.disableControl();
@@ -5857,7 +5869,7 @@ void Scene2320::postInit(SceneObjectList *OwnerList) {
_globals->_soundHandler.startSound(160);
_globals->_soundHandler.proc5(true);
- _globals->_player.setPriority2(-1);
+ _globals->_player.fixPriority(-1);
_globals->_player.setPosition(Common::Point(389, 72));
_globals->_player.enableControl();
break;
@@ -5883,7 +5895,7 @@ void Scene2320::postInit(SceneObjectList *OwnerList) {
_globals->_player.setVisage(2347);
_globals->_player.setStrip(2);
_globals->_player.setFrame(5);
- _globals->_player.setPriority2(137);
+ _globals->_player.fixPriority(137);
_globals->_player.setPosition(Common::Point(165, 132));
setAction(&_action6);
@@ -5909,7 +5921,7 @@ void Scene2320::postInit(SceneObjectList *OwnerList) {
_globals->_player.setStrip(2);
_globals->_player.setFrame(_globals->_player.getFrameCount());
_globals->_player.setPosition(Common::Point(303, 176));
- _globals->_player.setPriority2(-1);
+ _globals->_player.fixPriority(-1);
_globals->_player.disableControl();
_hotspot13.setPosition(Common::Point(319, 199));
@@ -5917,7 +5929,7 @@ void Scene2320::postInit(SceneObjectList *OwnerList) {
_hotspot16.postInit();
_hotspot16.setVisage(2331);
_hotspot16._strip = 3;
- _hotspot16.setPriority2(160);
+ _hotspot16.fixPriority(160);
_hotspot16.setPosition(Common::Point(320, 202));
_hotspot16.hide();
@@ -5934,7 +5946,7 @@ void Scene2320::postInit(SceneObjectList *OwnerList) {
_hotspot11.postInit();
_hotspot11.setVisage(2705);
_hotspot11._strip = 2;
- _hotspot11.setPriority2(10);
+ _hotspot11.fixPriority(10);
_hotspot11.setPosition(Common::Point(322, 80));
_hotspot11.setObjectWrapper(new SceneObjectWrapper());
_hotspot11.animate(ANIM_MODE_1, NULL);
@@ -5943,7 +5955,7 @@ void Scene2320::postInit(SceneObjectList *OwnerList) {
_hotspot10.setVisage(2806);
_hotspot10.setObjectWrapper(new SceneObjectWrapper());
_hotspot10.changeZoom(-1);
- _hotspot10.setPriority2(10);
+ _hotspot10.fixPriority(10);
_hotspot10.setPosition(Common::Point(318, 89));
_hotspot10._strip = 3;
_hotspot10.animate(ANIM_MODE_1, NULL);
@@ -5971,7 +5983,7 @@ void Scene2320::postInit(SceneObjectList *OwnerList) {
}
_globals->_stripNum = 0;
- _globals->_sceneManager._scene->_sceneBounds.centre(_globals->_player._position);
+ _globals->_sceneManager._scene->_sceneBounds.center(_globals->_player._position);
loadScene(2320);
_hotspot14._sceneRegionId = 8;
@@ -5986,8 +5998,8 @@ void Scene2320::postInit(SceneObjectList *OwnerList) {
&_hotspot13, &_hotspot4, &_hotspot3, &_hotspot2, &_hotspot1, NULL);
}
-void Scene2320::synchronise(Serialiser &s) {
- Scene::synchronise(s);
+void Scene2320::synchronize(Serializer &s) {
+ Scene::synchronize(s);
SYNC_POINTER(_hotspotPtr);
}
@@ -6019,13 +6031,13 @@ void Scene2320::signal() {
break;
case 2326:
_globals->clearFlag(70);
- _globals->_inventory._nullifier._sceneNumber = 1;
+ RING_INVENTORY._nullifier._sceneNumber = 1;
_globals->_stripNum = 2321;
_globals->_sceneManager.changeScene(2100);
break;
case 2336:
_globals->setFlag(77);
- _globals->_inventory._waldos._sceneNumber = 1;
+ RING_INVENTORY._waldos._sceneNumber = 1;
_hotspot8.remove();
break;
case 5000:
@@ -6088,7 +6100,7 @@ void Scene2400::postInit(SceneObjectList *OwnerList) {
setAction(&_action1);
- _globals->_sceneManager._scene->_sceneBounds.centre(_globals->_player._position.x, _globals->_player._position.y);
+ _globals->_sceneManager._scene->_sceneBounds.center(_globals->_player._position.x, _globals->_player._position.y);
_globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
_globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
diff --git a/engines/tsage/ringworld_scenes3.h b/engines/tsage/ringworld_scenes3.h
index 61aac522f2..a25bf8834b 100644
--- a/engines/tsage/ringworld_scenes3.h
+++ b/engines/tsage/ringworld_scenes3.h
@@ -324,7 +324,7 @@ public:
int _lineOffset;
virtual void postInit(SceneObjectList *OwnerList = NULL);
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
};
class Scene2150 : public Scene {
@@ -381,7 +381,7 @@ public:
Scene2150();
virtual void postInit(SceneObjectList *OwnerList = NULL);
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual void signal();
virtual void dispatch();
};
@@ -446,7 +446,7 @@ public:
Scene2200();
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void stripCallback(int v);
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual void signal();
virtual void dispatch();
};
@@ -462,8 +462,6 @@ class Scene2222 : public Scene {
virtual void signal();
};
- /* Hotspots */
-
public:
SoundHandler _soundHandler;
SpeakerSText _speakerSText;
@@ -581,7 +579,7 @@ public:
Scene2230();
virtual void postInit(SceneObjectList *OwnerList = NULL);
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual void dispatch();
};
@@ -681,7 +679,7 @@ public:
Scene2280();
virtual void postInit(SceneObjectList *OwnerList = NULL);
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual void signal();
virtual void dispatch();
};
@@ -710,22 +708,14 @@ class Scene2300 : public Scene {
public:
virtual void doAction(int action);
};
- class Hotspot6 : public SceneObject {
- public:
- virtual void doAction(int action);
- };
- class Hotspot12 : public SceneObject {
- public:
- virtual void doAction(int action);
- };
- class Hotspot13 : public SceneObject {
+ class Hotspot7 : public SceneObject {
public:
virtual void doAction(int action);
};
public:
SoundHandler _soundHandler1, _soundHandler2;
SpeakerSL _speakerSL;
- SpeakerML _speakerML;
+ SpeakerMText _speakerMText;
SpeakerQText _speakerQText;
SpeakerSText _speakerSText;
Action1 _action1;
@@ -734,8 +724,9 @@ public:
Action4 _action4;
SceneObject _hotspot1, _hotspot2, _hotspot3, _hotspot4;
Hotspot5 _hotspot5;
- Hotspot6 _hotspot6;
- SceneObject _hotspot7, _hotspot8, _hotspot9, _hotspot10;
+ SceneObject _hotspot6;
+ Hotspot7 _hotspot7;
+ SceneObject _hotspot8, _hotspot9, _hotspot10;
DisplayHotspot _hotspot11, _hotspot12, _hotspot13, _hotspot14, _hotspot15;
Scene2300();
@@ -769,7 +760,7 @@ public:
Scene2310();
virtual void postInit(SceneObjectList *OwnerList = NULL);
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual void signal();
virtual void process(Event &event);
virtual void dispatch();
@@ -882,7 +873,7 @@ public:
Scene2320();
virtual void postInit(SceneObjectList *OwnerList = NULL);
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual void signal();
};
diff --git a/engines/tsage/ringworld_scenes4.cpp b/engines/tsage/ringworld_scenes4.cpp
index 89feb223a1..c42b7819f2 100644
--- a/engines/tsage/ringworld_scenes4.cpp
+++ b/engines/tsage/ringworld_scenes4.cpp
@@ -113,8 +113,8 @@ Scene3700::Viewer::Viewer() {
_percentList[3] = 114;
}
-void Scene3700::Viewer::synchronise(Serialiser &s) {
- SceneObject::synchronise(s);
+void Scene3700::Viewer::synchronize(Serializer &s) {
+ SceneObject::synchronize(s);
s.syncAsByte(_active);
s.syncAsSint16LE(_countdownCtr);
for (int idx = 0; idx < 4; ++idx) {
diff --git a/engines/tsage/ringworld_scenes4.h b/engines/tsage/ringworld_scenes4.h
index f5dac297fc..53ea7be491 100644
--- a/engines/tsage/ringworld_scenes4.h
+++ b/engines/tsage/ringworld_scenes4.h
@@ -67,7 +67,7 @@ class Scene3700 : public Scene {
Viewer();
virtual Common::String getClassName() { return "Viewer"; }
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual void dispatch();
virtual void reposition();
virtual void draw();
diff --git a/engines/tsage/ringworld_scenes5.cpp b/engines/tsage/ringworld_scenes5.cpp
index de29a1cefc..dd9c33f0e5 100644
--- a/engines/tsage/ringworld_scenes5.cpp
+++ b/engines/tsage/ringworld_scenes5.cpp
@@ -47,9 +47,11 @@ void Scene4000::Action1::signal() {
scene->_hotspot5.animate(ANIM_MODE_1, NULL);
scene->_hotspot5.setPosition(Common::Point(116, 160));
- ADD_PLAYER_MOVER_NULL(scene->_hotspot5, 208, 169);
+ Common::Point pt(208, 169);
+ NpcMover *mover = new NpcMover();
+ scene->_hotspot5.addMover(mover, &pt, this);
- _globals->_inventory._ale._sceneNumber = 0;
+ RING_INVENTORY._ale._sceneNumber = 0;
_globals->clearFlag(42);
_globals->clearFlag(36);
_globals->clearFlag(43);
@@ -57,30 +59,33 @@ void Scene4000::Action1::signal() {
break;
}
case 1: {
- scene->_hotspot9.postInit();
- scene->_hotspot9.setVisage(4001);
- scene->_hotspot9.animate(ANIM_MODE_1, NULL);
- scene->_hotspot9.setObjectWrapper(new SceneObjectWrapper());
- scene->_hotspot9.setPosition(Common::Point(314, 132));
+ scene->_guardRock.postInit();
+ scene->_guardRock.setVisage(4001);
+ scene->_guardRock.animate(ANIM_MODE_1, NULL);
+ scene->_guardRock.setObjectWrapper(new SceneObjectWrapper());
+ scene->_guardRock.setPosition(Common::Point(314, 132));
+ scene->_guardRock._moveDiff = Common::Point(4, 2);
- ADD_PLAYER_MOVER_NULL(scene->_hotspot9, 288, 167);
+ ADD_PLAYER_MOVER_NULL(scene->_guardRock, 288, 167);
- scene->_hotspot4.postInit();
- scene->_hotspot4.setVisage(4006);
- scene->_hotspot4.animate(ANIM_MODE_1, NULL);
- scene->_hotspot4.setStrip(1);
- scene->_hotspot4.setPosition(Common::Point(207, 136));
+ scene->_olo.postInit();
+ scene->_olo.setVisage(4006);
+ scene->_olo.animate(ANIM_MODE_1, NULL);
+ scene->_olo.setStrip(1);
+ scene->_olo.setPosition(Common::Point(207, 136));
+
+ ADD_PLAYER_MOVER_NULL(scene->_olo, 220, 151);
- ADD_PLAYER_MOVER_NULL(scene->_hotspot4, 220, 151);
+ scene->_miranda.postInit();
+ scene->_miranda.setVisage(2701);
+ scene->_miranda.animate(ANIM_MODE_1, NULL);
+ scene->_miranda.setObjectWrapper(new SceneObjectWrapper());
+ scene->_miranda._moveDiff = Common::Point(4, 2);
+ scene->_miranda.setPosition(Common::Point(300, 135));
- scene->_hotspot7.postInit();
- scene->_hotspot7.setVisage(2701);
- scene->_hotspot7.animate(ANIM_MODE_1, NULL);
- scene->_hotspot7.setObjectWrapper(new SceneObjectWrapper());
- scene->_hotspot7._moveDiff = Common::Point(4, 2);
- scene->_hotspot7.setPosition(Common::Point(300, 135));
+ ADD_PLAYER_MOVER_THIS(scene->_miranda, 266, 169);
- ADD_PLAYER_MOVER_NULL(_globals->_player, 266, 169);
+ ADD_PLAYER_MOVER_NULL(_globals->_player, 241, 155);
break;
}
case 2:
@@ -89,14 +94,14 @@ void Scene4000::Action1::signal() {
case 3: {
Common::Point pt1(30, 86);
PlayerMover *mover1 = new PlayerMover();
- scene->_hotspot7.addMover(mover1, &pt1, this);
+ scene->_miranda.addMover(mover1, &pt1, this);
ADD_PLAYER_MOVER_NULL(scene->_hotspot5, 3, 86);
break;
}
case 4:
- ADD_MOVER(scene->_hotspot7, -30, 86);
- ADD_MOVER(scene->_hotspot5, -40, 86);
+ ADD_MOVER(scene->_miranda, -30, 86);
+ ADD_MOVER_NULL(scene->_hotspot5, -40, 86);
break;
case 5:
_globals->_soundHandler.startSound(155);
@@ -105,7 +110,7 @@ void Scene4000::Action1::signal() {
scene->_stripManager.start(4430, this);
break;
case 6:
- ADD_PLAYER_MOVER_THIS(scene->_hotspot4, 277, 175);
+ ADD_PLAYER_MOVER_THIS(scene->_olo, 277, 175);
ADD_PLAYER_MOVER_NULL(_globals->_player, 258, 187);
break;
case 7:
@@ -135,19 +140,19 @@ void Scene4000::Action2::signal() {
scene->_hotspot5._moveDiff.x = 5;
scene->_hotspot5.setPosition(Common::Point(-8, 88));
- scene->_hotspot3.setAction(&scene->_sequenceManager3, NULL, 4003, &scene->_hotspot5, NULL);
- scene->_hotspot7.setAction(&scene->_sequenceManager2, NULL, 4002, &scene->_hotspot7, NULL);
+ scene->_lander.setAction(&scene->_sequenceManager3, NULL, 4003, &scene->_hotspot5, NULL);
+ scene->_miranda.setAction(&scene->_sequenceManager2, NULL, 4002, &scene->_miranda, NULL);
break;
case 1:
_globals->_player.disableControl();
- scene->_hotspot3.remove();
- ADD_MOVER(scene->_hotspot9, scene->_hotspot5._position.x + 30, scene->_hotspot5._position.y - 10);
+ scene->_lander.remove();
+ ADD_MOVER(scene->_guardRock, scene->_hotspot5._position.x + 30, scene->_hotspot5._position.y - 10);
break;
case 2:
- _globals->_player.checkAngle(&scene->_hotspot9);
- scene->_hotspot5.checkAngle(&scene->_hotspot9);
- scene->_hotspot7.checkAngle(&scene->_hotspot9);
+ _globals->_player.checkAngle(&scene->_guardRock);
+ scene->_hotspot5.checkAngle(&scene->_guardRock);
+ scene->_miranda.checkAngle(&scene->_guardRock);
scene->_stripManager.start(4000, this);
break;
case 3:
@@ -166,9 +171,9 @@ void Scene4000::Action2::signal() {
scene->_stripManager.start(4010, this);
break;
case 6:
- ADD_PLAYER_MOVER_NULL(scene->_hotspot9, 230, 149);
+ ADD_PLAYER_MOVER_NULL(scene->_guardRock, 230, 149);
ADD_PLAYER_MOVER(210, 136);
- ADD_PLAYER_MOVER_NULL(scene->_hotspot7, 210, 133);
+ ADD_PLAYER_MOVER_NULL(scene->_miranda, 210, 133);
break;
case 7:
_globals->_sceneManager.changeScene(4045);
@@ -203,20 +208,20 @@ void Scene4000::Action4::signal() {
ADD_MOVER(_globals->_player, 257, 57);
break;
case 1:
- _globals->_player.setVisage(4000);
+ _globals->_player.setVisage(4008);
_globals->_player.setPosition(Common::Point(258, 83));
_globals->_player._frame = 1;
_globals->_player._strip = 3;
_globals->_player.animate(ANIM_MODE_4, 2, 1, this);
break;
case 2:
- scene->_hotspot6.postInit();
- scene->_hotspot6.setVisage(4000);
- scene->_hotspot6.setStrip(7);
- scene->_hotspot6.setFrame(3);
- scene->_hotspot6.setPosition(Common::Point(268, 44));
+ scene->_rope.postInit();
+ scene->_rope.setVisage(4000);
+ scene->_rope.setStrip(7);
+ scene->_rope.setFrame(3);
+ scene->_rope.setPosition(Common::Point(268, 44));
- _globals->_inventory._rope._sceneNumber = 4000;
+ RING_INVENTORY._rope._sceneNumber = 4000;
_globals->_events.setCursor(CURSOR_USE);
_globals->_player.animate(ANIM_MODE_6, this);
break;
@@ -270,23 +275,23 @@ void Scene4000::Action6::signal() {
setAction(&scene->_sequenceManager1, this, 4001, &_globals->_player, NULL);
if (!_globals->getFlag(36))
- scene->_hotspot7.setAction(&scene->_sequenceManager2, NULL, 4002, &scene->_hotspot7, NULL);
+ scene->_miranda.setAction(&scene->_sequenceManager2, NULL, 4002, &scene->_miranda, NULL);
break;
case 2:
_globals->_player.disableControl();
- ADD_MOVER(scene->_hotspot9, _globals->_player._position.x + 30, _globals->_player._position.y - 5);
+ ADD_MOVER(scene->_guardRock, _globals->_player._position.x + 30, _globals->_player._position.y - 5);
break;
case 3:
scene->_stripManager.start(_globals->getFlag(35) ? 4500 : 4502, this);
break;
case 4:
_globals->clearFlag(35);
- ADD_MOVER_NULL(scene->_hotspot9, 292, 138);
+ ADD_MOVER_NULL(scene->_guardRock, 292, 138);
ADD_PLAYER_MOVER(283, 147);
- if (!_globals->getFlag(36)) {
- ADD_PLAYER_MOVER_NULL(scene->_hotspot7, 280, 150);
- }
+ if (!_globals->getFlag(36))
+ ADD_PLAYER_MOVER_NULL(scene->_miranda, 280, 150);
+ RING_INVENTORY._ale._sceneNumber = 4100;
break;
case 5:
_globals->_sceneManager.changeScene(4100);
@@ -295,20 +300,21 @@ void Scene4000::Action6::signal() {
}
void Scene4000::Action7::signal() {
+ // Climb down left Chimney using a rope
Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
_globals->_player.disableControl();
- scene->_hotspot6.setFrame(1);
+ scene->_rope.setFrame(1);
ADD_MOVER(_globals->_player, 247, 53);
break;
case 1:
_globals->_player.setVisage(4008);
_globals->_player.setStrip(4);
_globals->_player.setFrame(1);
- _globals->_player.setPriority2(16);
+ _globals->_player.fixPriority(16);
_globals->_player.setPosition(Common::Point(260, 55));
_globals->_player.animate(ANIM_MODE_5, this);
break;
@@ -325,7 +331,7 @@ void Scene4000::Action8::signal() {
case 0:
_globals->_player.disableControl();
if (_globals->getFlag(41))
- scene->_hotspot6.setFrame(2);
+ scene->_rope.setFrame(2);
ADD_MOVER(_globals->_player, 289, 53);
break;
@@ -343,16 +349,16 @@ void Scene4000::Action8::signal() {
break;
case 3:
_globals->_soundHandler.startSound(170);
- scene->_hotspot27.setVisage(4000);
- scene->_hotspot27.setStrip(6);
- scene->_hotspot27.animate(ANIM_MODE_2, NULL);
+ scene->_smoke2.setVisage(4000);
+ scene->_smoke2.setStrip(6);
+ scene->_smoke2.animate(ANIM_MODE_2, NULL);
setDelay(60);
break;
case 4:
_globals->_soundHandler.startSound(77, this);
break;
case 5:
- _globals->_game.endGame(4000, 15);
+ _globals->_game->endGame(4000, 15);
remove();
break;
}
@@ -388,7 +394,7 @@ void Scene4000::Action11::signal() {
switch (_actionIndex++) {
case 0:
_globals->_player.disableControl();
- ADD_MOVER(scene->_hotspot3, -30, 70);
+ ADD_MOVER(scene->_lander, -30, 70);
break;
case 1:
setDelay(60);
@@ -403,23 +409,23 @@ void Scene4000::Action11::signal() {
setAction(&scene->_sequenceManager1, this, 4001, &_globals->_player, NULL);
- scene->_hotspot7.setPosition(Common::Point(-210, 139));
- scene->_hotspot7.setAction(&scene->_sequenceManager2, NULL, 4002, &scene->_hotspot7, NULL);
- scene->_hotspot3.setAction(&scene->_sequenceManager3, NULL, 4003, &scene->_hotspot5, NULL);
+ scene->_miranda.setPosition(Common::Point(-210, 139));
+ scene->_miranda.setAction(&scene->_sequenceManager2, NULL, 4002, &scene->_miranda, NULL);
+ scene->_lander.setAction(&scene->_sequenceManager3, NULL, 4003, &scene->_hotspot5, NULL);
break;
case 3:
scene->_stripManager.start(8000, this);
break;
case 4:
- ADD_MOVER(scene->_hotspot4, 263, 187);
- scene->_hotspot4.animate(ANIM_MODE_1, NULL);
+ ADD_MOVER(scene->_olo, 263, 187);
+ scene->_olo.animate(ANIM_MODE_1, NULL);
break;
case 5:
scene->_soundHandler1.proc3();
- scene->_hotspot11.remove();
+ scene->_forceField.remove();
ADD_MOVER(_globals->_player, 340, 163);
- ADD_MOVER_NULL(scene->_hotspot7, 340, 169);
+ ADD_MOVER_NULL(scene->_miranda, 340, 169);
ADD_MOVER_NULL(scene->_hotspot5, 340, 165);
break;
case 6:
@@ -444,7 +450,7 @@ void Scene4000::Action12::signal() {
_globals->setFlag(32);
if (scene->_stripManager._field2E8 == 275) {
_globals->setFlag(82);
- ADD_MOVER_NULL(scene->_hotspot9, 292, 138);
+ ADD_MOVER_NULL(scene->_guardRock, 292, 138);
ADD_PLAYER_MOVER(283, 147);
} else {
setDelay(30);
@@ -454,11 +460,11 @@ void Scene4000::Action12::signal() {
if (scene->_stripManager._field2E8 == 275) {
_globals->_sceneManager.changeScene(4100);
} else {
- ADD_PLAYER_MOVER_THIS(scene->_hotspot9, 300, 132);
+ ADD_PLAYER_MOVER_THIS(scene->_guardRock, 300, 132);
}
break;
case 4:
- scene->_hotspot9.hide();
+ scene->_guardRock.hide();
scene->_stripManager.start(4020, this);
break;
case 5:
@@ -480,7 +486,7 @@ void Scene4000::Action13::signal() {
case 1:
scene->_soundHandler2.startSound(151);
scene->_soundHandler2.proc5(true);
- ADD_MOVER(scene->_hotspot3, -30, 70);
+ ADD_MOVER(scene->_lander, -30, 70);
break;
case 2:
scene->_soundHandler2.proc4();
@@ -491,7 +497,7 @@ void Scene4000::Action13::signal() {
/*--------------------------------------------------------------------------*/
-void Scene4000::Hotspot7::doAction(int action) {
+void Scene4000::Miranda::doAction(int action) {
Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
switch (action) {
@@ -545,7 +551,7 @@ void Scene4000::Hotspot8::doAction(int action) {
SceneItem::display2(4000, 25);
break;
case CURSOR_TALK:
- if (_globals->_inventory._peg._sceneNumber == 1)
+ if (RING_INVENTORY._peg._sceneNumber == 1)
SceneItem::display2(4000, 34);
else {
switch (_ctr) {
@@ -577,7 +583,7 @@ void Scene4000::Hotspot8::doAction(int action) {
}
}
-void Scene4000::Hotspot9::doAction(int action) {
+void Scene4000::GuardRock::doAction(int action) {
switch (action) {
case OBJECT_STUNNER:
SceneItem::display2(4000, 28);
@@ -594,7 +600,7 @@ void Scene4000::Hotspot9::doAction(int action) {
}
}
-void Scene4000::Hotspot10::doAction(int action) {
+void Scene4000::Ladder::doAction(int action) {
Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
switch (action) {
@@ -608,7 +614,7 @@ void Scene4000::Hotspot10::doAction(int action) {
scene->setAction(&scene->_sequenceManager1, scene, 4005, &_globals->_player, NULL);
} else {
scene->_sceneMode = 4004;
- scene->setAction(&scene->_sequenceManager1, scene, 4004, &_globals->_player, &scene->_hotspot10, NULL);
+ scene->setAction(&scene->_sequenceManager1, scene, 4004, &_globals->_player, &scene->_ladder, NULL);
}
break;
default:
@@ -617,7 +623,7 @@ void Scene4000::Hotspot10::doAction(int action) {
}
}
-void Scene4000::Hotspot12::doAction(int action) {
+void Scene4000::TheTech::doAction(int action) {
Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
switch (action) {
@@ -635,7 +641,7 @@ void Scene4000::Hotspot12::doAction(int action) {
SceneItem::display2(4000, 37);
else {
_globals->_player.disableControl();
- if (_globals->_sceneObjects->contains(&scene->_hotspot7))
+ if (_globals->_sceneObjects->contains(&scene->_miranda))
_globals->clearFlag(96);
scene->_sceneMode = 4012;
@@ -649,6 +655,7 @@ void Scene4000::Hotspot12::doAction(int action) {
}
void Scene4000::Hotspot13::doAction(int action) {
+ // Rock
Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
switch (action) {
@@ -680,24 +687,27 @@ void Scene4000::Hotspot::doAction(int action) {
case OBJECT_STUNNER:
SceneItem::display2(4000, 18);
break;
- case OBJECT_LADDER:
+ case OBJECT_LADDER: {
_globals->_player.disableControl();
- scene->_hotspot10.postInit();
- scene->_hotspot10.setVisage(4000);
- scene->_hotspot10.setStrip(5);
- scene->_hotspot10.setPosition(Common::Point(245, 147));
- scene->_hotspot10.hide();
- _globals->_sceneItems.push_front(&scene->_hotspot10);
+ scene->_ladder.postInit();
+ scene->_ladder.setVisage(4000);
+ scene->_ladder.setStrip(5);
+ scene->_ladder.setPosition(Common::Point(245, 147));
+ scene->_ladder.hide();
+ _globals->_sceneItems.push_front(&scene->_ladder);
if (_globals->_sceneObjects->contains(&scene->_hotspot8)) {
scene->_hotspot8.setAction(NULL);
- ADD_MOVER_NULL(scene->_hotspot8, 118, 145);
+ Common::Point pt(118, 145);
+ NpcMover *mover = new NpcMover();
+ scene->_hotspot18.addMover(mover, &pt, NULL);
}
scene->_sceneMode = 4004;
- scene->setAction(&scene->_sequenceManager1, scene, 4011, &_globals->_player, &scene->_hotspot10, NULL);
+ scene->setAction(&scene->_sequenceManager1, scene, 4011, &_globals->_player, &scene->_ladder, NULL);
break;
+ }
default:
SceneHotspot::doAction(action);
break;
@@ -705,6 +715,7 @@ void Scene4000::Hotspot::doAction(int action) {
}
void Scene4000::Hotspot17::doAction(int action) {
+ // Left Chimney
Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
switch (action) {
@@ -724,6 +735,7 @@ void Scene4000::Hotspot17::doAction(int action) {
}
void Scene4000::Hotspot18::doAction(int action) {
+ // Right Chimney
Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
switch (action) {
@@ -756,7 +768,7 @@ void Scene4000::Hotspot23::doAction(int action) {
/*--------------------------------------------------------------------------*/
Scene4000::Scene4000() :
- _hotspot11(0, CURSOR_LOOK, 4000, 14, CURSOR_USE, 4000, 32, OBJECT_STUNNER, 4000, 33,
+ _forceField(0, CURSOR_LOOK, 4000, 14, CURSOR_USE, 4000, 32, OBJECT_STUNNER, 4000, 33,
OBJECT_SCANNER, 4000, 19, LIST_END),
_hotspot19(0, CURSOR_LOOK, 4000, 7, LIST_END),
_hotspot20(0, CURSOR_LOOK, 4000, 3, LIST_END),
@@ -786,14 +798,14 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
_stripManager.addSpeaker(&_speakerSText);
_stripManager.addSpeaker(&_speakerMText);
- _speakerCHFText._npc = &_hotspot9;
+ _speakerCHFText._npc = &_guardRock;
_speakerSText._npc = &_hotspot5;
- _speakerMText._npc = &_hotspot7;
- _speakerPText._npc = &_hotspot4;
+ _speakerMText._npc = &_miranda;
+ _speakerPText._npc = &_olo;
_speakerQText._npc = &_globals->_player;
_hotspot13.setBounds(Rect(263, 41, 278, 55));
- _hotspot14.setBounds(Rect(140, 177, 140 /*96*/, 204));
+ _hotspot14.setBounds(Rect(96 /*140*/, 177, 140 /*96*/, 204));
_hotspot15.setBounds(Rect(227, 101, 264, 143));
_hotspot16.setBounds(Rect(306, 100, 319, 148));
_hotspot17.setBounds(Rect(231, 53, 254, 60));
@@ -808,22 +820,23 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
_hotspot20._sceneRegionId = 18;
_hotspot25._sceneRegionId = 17;
- _hotspot1.postInit();
- _hotspot1.setVisage(4000);
- _hotspot1.setPriority2(1);
- _hotspot1.setFrame(2);
- _hotspot1.setPosition(Common::Point(242, 59));
- _hotspot1.animate(ANIM_MODE_2, NULL);
-
- _hotspot27.postInit();
- _hotspot27.setVisage(4000);
- _hotspot27.setStrip(2);
- _hotspot27.setPriority2(1);
- _hotspot27.setFrame(2);
- _hotspot27.setPosition(Common::Point(299, 59));
- _hotspot27.animate(ANIM_MODE_2, NULL);
-
- if (_globals->_inventory._ladder._sceneNumber != 4000) {
+ _smoke1.postInit();
+ _smoke1.setVisage(4000);
+ _smoke1.fixPriority(1);
+ _smoke1.setFrame(2);
+ _smoke1.setPosition(Common::Point(242, 59));
+ _smoke1.animate(ANIM_MODE_2, NULL);
+
+ _smoke2.postInit();
+ _smoke2.setVisage(4000);
+ _smoke2.setStrip(2);
+ _smoke2.fixPriority(1);
+ _smoke2.setFrame(2);
+ _smoke2.setPosition(Common::Point(299, 59));
+ _smoke2.animate(ANIM_MODE_2, NULL);
+
+ if (RING_INVENTORY._ladder._sceneNumber != 4000) {
+ // if ladder is not in the scene, activate the hotspot on the wall
_hotspot8.postInit();
_hotspot8.setVisage(4018);
_hotspot8.setObjectWrapper(new SceneObjectWrapper());
@@ -833,24 +846,24 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
_hotspot8.setAction(&_action9);
}
- _hotspot12.postInit();
- _hotspot12.setVisage(4000);
- _hotspot12.setStrip(3);
- _hotspot12.setFrame(3);
- _hotspot12.setPriority2(200);
- _hotspot12.setPosition(Common::Point(281, 176));
+ _theTech.postInit();
+ _theTech.setVisage(4000);
+ _theTech.setStrip(3);
+ _theTech.setFrame(3);
+ _theTech.fixPriority(200);
+ _theTech.setPosition(Common::Point(281, 176));
if (_globals->getFlag(34)) {
_soundHandler1.startSound(156);
- _hotspot11.postInit();
- _hotspot11.setVisage(4000);
- _hotspot11.setStrip(4);
- _hotspot11.setPosition(Common::Point(312, 174));
- _hotspot11.setPriority2(200);
- _hotspot11.animate(ANIM_MODE_8, 0, NULL);
+ _forceField.postInit();
+ _forceField.setVisage(4000);
+ _forceField.setStrip(4);
+ _forceField.setPosition(Common::Point(312, 174));
+ _forceField.fixPriority(200);
+ _forceField.animate(ANIM_MODE_8, 0, NULL);
- _globals->_sceneItems.push_back(&_hotspot11);
+ _globals->_sceneItems.push_back(&_forceField);
}
_globals->_player.postInit();
@@ -860,26 +873,28 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
_globals->_player.setPosition(Common::Point(-28, 86));
if (!_globals->getFlag(36) && !_globals->getFlag(43)) {
- _hotspot7.postInit();
- _hotspot7.setVisage(2701);
- _hotspot7.animate(ANIM_MODE_1, NULL);
- _hotspot7.setObjectWrapper(new SceneObjectWrapper());
- _hotspot7._moveDiff = Common::Point(4, 2);
- _hotspot7.setPosition(Common::Point(-210, 139));
-
- _globals->_sceneItems.push_back(&_hotspot7);
+ _miranda.postInit();
+ _miranda.setVisage(2701);
+ _miranda.animate(ANIM_MODE_1, NULL);
+ _miranda.setObjectWrapper(new SceneObjectWrapper());
+ _miranda._moveDiff = Common::Point(4, 2);
+ _miranda.setPosition(Common::Point(-210, 139));
+
+ _globals->_sceneItems.push_back(&_miranda);
}
+ _globals->clearFlag(40);
+
switch (_globals->_sceneManager._previousScene) {
case 2320:
_globals->_soundHandler.startSound(155);
- if (_globals->_inventory._ale._sceneNumber == 1) {
- _hotspot9.postInit();
- _hotspot9.setVisage(4001);
- _hotspot9.animate(ANIM_MODE_1, NULL);
- _hotspot9.setObjectWrapper(new SceneObjectWrapper());
- _hotspot9.setPosition(Common::Point(314, 132));
+ if (RING_INVENTORY._ale._sceneNumber == 1) {
+ _guardRock.postInit();
+ _guardRock.setVisage(4001);
+ _guardRock.animate(ANIM_MODE_1, NULL);
+ _guardRock.setObjectWrapper(new SceneObjectWrapper());
+ _guardRock.setPosition(Common::Point(314, 132));
setAction(&_action6);
} else {
@@ -888,7 +903,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
setAction(&_sequenceManager1, this, 4001, &_globals->_player, NULL);
if (!_globals->getFlag(36) && !_globals->getFlag(43))
- _hotspot7.setAction(&_sequenceManager2, NULL, 4002, &_hotspot7, NULL);
+ _miranda.setAction(&_sequenceManager2, NULL, 4002, &_miranda, NULL);
}
if (_globals->getFlag(42))
@@ -898,13 +913,13 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
break;
case 4010:
- _hotspot7.setPosition(Common::Point(-210, 139));
+ _miranda.setPosition(Common::Point(-210, 139));
- _hotspot9.postInit();
- _hotspot9.setVisage(4001);
- _hotspot9.animate(ANIM_MODE_1, NULL);
- _hotspot9.setObjectWrapper(new SceneObjectWrapper());
- _hotspot9.setPosition(Common::Point(314, 132));
+ _guardRock.postInit();
+ _guardRock.setVisage(4001);
+ _guardRock.animate(ANIM_MODE_1, NULL);
+ _guardRock.setObjectWrapper(new SceneObjectWrapper());
+ _guardRock.setPosition(Common::Point(314, 132));
_hotspot2.postInit();
_hotspot2.setVisage(4018);
@@ -917,25 +932,25 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
break;
case 4025:
- if (_globals->_inventory._ladder._sceneNumber != 4000)
+ if (RING_INVENTORY._ladder._sceneNumber == 4000)
_hotspot8.remove();
_globals->_player.setPosition(Common::Point(260, 185));
if (!_globals->getFlag(36) && !_globals->getFlag(43))
- _hotspot7.setPosition(Common::Point(246, 146));
+ _miranda.setPosition(Common::Point(246, 146));
if (_globals->getFlag(96)) {
- _hotspot4.postInit();
- _hotspot4.setVisage(4006);
- _hotspot4.animate(ANIM_MODE_1, NULL);
- _hotspot4.setObjectWrapper(new SceneObjectWrapper());
- _hotspot4.setPosition(Common::Point(290, 163));
+ _olo.postInit();
+ _olo.setVisage(4006);
+ _olo.animate(ANIM_MODE_1, NULL);
+ _olo.setObjectWrapper(new SceneObjectWrapper());
+ _olo.setPosition(Common::Point(290, 163));
}
if (_globals->_stripNum == 4025) {
_soundHandler1.startSound(182);
- _hotspot11.remove();
+ _forceField.remove();
_hotspot5.postInit();
_hotspot5.setVisage(2801);
@@ -947,15 +962,15 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
_globals->_player.disableControl();
if (!_globals->getFlag(96)) {
- _hotspot4.postInit();
- _hotspot4.setVisage(4006);
- _hotspot4.animate(ANIM_MODE_1, NULL);
- _hotspot4.setObjectWrapper(new SceneObjectWrapper());
- _hotspot4.setPosition(Common::Point(195, 128));
+ _olo.postInit();
+ _olo.setVisage(4006);
+ _olo.animate(ANIM_MODE_1, NULL);
+ _olo.setObjectWrapper(new SceneObjectWrapper());
+ _olo.setPosition(Common::Point(195, 128));
Common::Point pt(268, 157);
PlayerMover *mover = new PlayerMover();
- _hotspot4.addMover(mover, &pt, NULL);
+ _olo.addMover(mover, &pt, NULL);
}
_sceneMode = 4003;
@@ -963,7 +978,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
} else if (_globals->getFlag(96)) {
_globals->_player.disableControl();
_sceneMode = 4013;
- setAction(&_sequenceManager1, this, 4013, &_hotspot4, NULL);
+ setAction(&_sequenceManager1, this, 4013, &_olo, NULL);
}
_globals->clearFlag(96);
@@ -972,7 +987,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
case 4045:
_globals->_player.enableControl();
- if (_globals->_inventory._ladder._sceneNumber != 4000) {
+ if (RING_INVENTORY._ladder._sceneNumber != 4000) {
_hotspot8.postInit();
_hotspot8.setVisage(4017);
_hotspot8.animate(ANIM_MODE_1, NULL);
@@ -982,16 +997,16 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
_globals->_player.setPosition(Common::Point(208, 153));
if (!_globals->getFlag(36) && !_globals->getFlag(43))
- _hotspot7.setPosition(Common::Point(246, 146));
+ _miranda.setPosition(Common::Point(246, 146));
if (_globals->getFlag(39)) {
_globals->clearFlag(39);
- _hotspot4.postInit();
- _hotspot4.setVisage(4006);
- _hotspot4.animate(ANIM_MODE_1, NULL);
- _hotspot4.setObjectWrapper(new SceneObjectWrapper());
- _hotspot4.setPosition(Common::Point(219, 150));
+ _olo.postInit();
+ _olo.setVisage(4006);
+ _olo.animate(ANIM_MODE_1, NULL);
+ _olo.setObjectWrapper(new SceneObjectWrapper());
+ _olo.setPosition(Common::Point(219, 150));
_globals->_player.disableControl();
setAction(&_sequenceManager1, this, 4010, &_globals->_player, NULL);
@@ -1000,12 +1015,12 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
if (_globals->_stripNum == 4000) {
_globals->_stripNum = 0;
- _hotspot9.postInit();
- _hotspot9.setVisage(4001);
- _hotspot9.animate(ANIM_MODE_1, NULL);
- _hotspot9.setObjectWrapper(new SceneObjectWrapper());
- _hotspot9.setPosition(Common::Point(231, 159));
- _hotspot9.setStrip(4);
+ _guardRock.postInit();
+ _guardRock.setVisage(4001);
+ _guardRock.animate(ANIM_MODE_1, NULL);
+ _guardRock.setObjectWrapper(new SceneObjectWrapper());
+ _guardRock.setPosition(Common::Point(231, 159));
+ _guardRock.setStrip(4);
setAction(&_action12);
}
@@ -1019,7 +1034,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
_globals->_player.setVisage(4008);
_globals->_player.setStrip(4);
_globals->_player.setFrame(_globals->_player.getFrameCount());
- _globals->_player.setPriority2(16);
+ _globals->_player.fixPriority(16);
_globals->_player.setPosition(Common::Point(260, 55));
_sceneMode = 4007;
@@ -1029,7 +1044,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
_globals->_player.enableControl();
}
- if (_globals->_inventory._ladder._sceneNumber != 4000)
+ if (RING_INVENTORY._ladder._sceneNumber != 4000)
_hotspot8.remove();
break;
@@ -1037,7 +1052,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
_globals->_player.enableControl();
_globals->_player.setPosition(Common::Point(270, 155));
- if (_globals->getFlag(42) && (_globals->_inventory._ladder._sceneNumber != 4000)) {
+ if (_globals->getFlag(42) && (RING_INVENTORY._ladder._sceneNumber != 4000)) {
_hotspot8.setVisage(4017);
_hotspot8.animate(ANIM_MODE_1, NULL);
_hotspot8.setPosition(Common::Point(244, 151));
@@ -1045,42 +1060,42 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
}
if (!_globals->getFlag(36) && !_globals->getFlag(43))
- _hotspot7.setPosition(Common::Point(246, 146));
+ _miranda.setPosition(Common::Point(246, 146));
break;
default:
_globals->_soundHandler.startSound(155);
- _hotspot3.postInit();
- _hotspot3.setVisage(4002);
- _hotspot3._moveDiff = Common::Point(10, 10);
- _hotspot3.setPosition(Common::Point(-100, 80));
- _hotspot3.changeZoom(-1);
- _hotspot3.setPosition(Common::Point(130, -1));
- _hotspot3.animate(ANIM_MODE_2, NULL);
+ _lander.postInit();
+ _lander.setVisage(4002);
+ _lander._moveDiff = Common::Point(10, 10);
+ _lander.setPosition(Common::Point(-100, 80));
+ _lander.changeZoom(-1);
+ _lander.setPosition(Common::Point(130, -1));
+ _lander.animate(ANIM_MODE_2, NULL);
if (_globals->_stripNum == 9000) {
- _hotspot4.postInit();
- _hotspot4.setVisage(4006);
- _hotspot4.setPosition(Common::Point(235, 153));
+ _olo.postInit();
+ _olo.setVisage(4006);
+ _olo.setPosition(Common::Point(235, 153));
- _hotspot9.postInit();
- _hotspot9.setVisage(4001);
- _hotspot9.setStrip(3);
- _hotspot9.setPosition(Common::Point(255, 153));
+ _guardRock.postInit();
+ _guardRock.setVisage(4001);
+ _guardRock.setStrip(3);
+ _guardRock.setPosition(Common::Point(255, 153));
setAction(&_action11);
- _globals->_inventory._ladder._sceneNumber = 4100;
- _globals->_inventory._rope._sceneNumber = 4150;
+ RING_INVENTORY._ladder._sceneNumber = 4100;
+ RING_INVENTORY._rope._sceneNumber = 4150;
_soundHandler1.startSound(156);
- _hotspot11.postInit();
- _hotspot11.setVisage(4000);
- _hotspot11.setStrip(4);
- _hotspot11.setPosition(Common::Point(312, 174));
- _hotspot11.setPriority2(200);
- _hotspot11.animate(ANIM_MODE_8, 0, NULL);
+ _forceField.postInit();
+ _forceField.setVisage(4000);
+ _forceField.setStrip(4);
+ _forceField.setPosition(Common::Point(312, 174));
+ _forceField.fixPriority(200);
+ _forceField.animate(ANIM_MODE_8, 0, NULL);
} else {
if (!_globals->getFlag(37)) {
_hotspot2.postInit();
@@ -1090,32 +1105,32 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
_hotspot2.setPosition(Common::Point(182, 146));
_hotspot2.setAction(&_action10);
}
-
- _hotspot7.setPosition(Common::Point(-210, 139));
+ _miranda.setPosition(Common::Point(-210, 139));
setAction(&_action13);
}
+
break;
}
- if (_globals->_inventory._ladder._sceneNumber == 4000) {
- _hotspot10.postInit();
- _hotspot10.setVisage(4000);
- _hotspot10.setStrip(5);
- _hotspot10.setPosition(Common::Point(245, 147));
+ if (RING_INVENTORY._ladder._sceneNumber == 4000) {
+ _ladder.postInit();
+ _ladder.setVisage(4000);
+ _ladder.setStrip(5);
+ _ladder.setPosition(Common::Point(245, 147));
- _globals->_sceneItems.push_back(&_hotspot10);
+ _globals->_sceneItems.push_back(&_ladder);
}
- if (_globals->_inventory._rope._sceneNumber == 4000) {
- _hotspot6.postInit();
- _hotspot6.setVisage(4000);
- _hotspot6.setStrip(7);
- _hotspot6.setPriority2(1);
- _hotspot6.setPosition(Common::Point(268, 44));
+ if (RING_INVENTORY._rope._sceneNumber == 4000) {
+ _rope.postInit();
+ _rope.setVisage(4000);
+ _rope.setStrip(7);
+ _rope.fixPriority(1);
+ _rope.setPosition(Common::Point(268, 44));
}
_globals->_sceneItems.addItems(&_hotspot8, &_hotspot17, &_hotspot18, &_hotspot14, &_hotspot15,
- &_hotspot16, &_hotspot12, &_hotspot13, &_hotspot21, &_hotspot20, &_hotspot22, &_hotspot23,
+ &_hotspot16, &_theTech, &_hotspot13, &_hotspot21, &_hotspot20, &_hotspot22, &_hotspot23,
&_hotspot24, &_hotspot25, &_hotspot19, &_hotspot26, NULL);
}
@@ -1132,9 +1147,10 @@ void Scene4000::signal() {
setAction(&_sequenceManager1, this, 4014, &_globals->_player, &_hotspot5, NULL);
break;
case 4004:
- _globals->_inventory._ladder._sceneNumber = 4000;
+ RING_INVENTORY._ladder._sceneNumber = 4000;
// Deliberate fall-through
case 4007:
+ _globals->_player._uiEnabled = true;
_globals->_events.setCursor(CURSOR_USE);
_globals->setFlag(40);
break;
@@ -1154,21 +1170,21 @@ void Scene4000::signal() {
break;
case 4010:
_globals->setFlag(38);
- _hotspot4.remove();
+ _olo.remove();
break;
case 4012:
- _globals->_player.checkAngle(&_hotspot12);
+ _globals->_player.checkAngle(&_theTech);
_globals->_sceneManager.changeScene(4025);
break;
case 4013:
_globals->_player.enableControl();
- _hotspot4.remove();
+ _olo.remove();
break;
case 4014:
_globals->_sceneManager.changeScene(4250);
break;
case 4015:
- ADD_MOVER_NULL(_hotspot7, 0, _hotspot7._position.y - 5);
+ ADD_MOVER_NULL(_miranda, 0, _miranda._position.y - 5);
break;
}
}
@@ -1177,38 +1193,38 @@ void Scene4000::dispatch() {
Scene::dispatch();
if ((_globals->_player.getRegionIndex() == 10) || (_globals->_player.getRegionIndex() == 6))
- _globals->_player.setPriority2(200);
+ _globals->_player.fixPriority(200);
if (_globals->_player.getRegionIndex() == 11)
- _globals->_player.setPriority2(-1);
+ _globals->_player.fixPriority(-1);
if (_globals->_player.getRegionIndex() == 5)
- _globals->_player.setPriority2(94);
+ _globals->_player.fixPriority(94);
if (_globals->_sceneObjects->contains(&_hotspot5)) {
if ((_hotspot5.getRegionIndex() == 10) || (_hotspot5.getRegionIndex() == 6))
- _hotspot5.setPriority2(200);
+ _hotspot5.fixPriority(200);
if (_hotspot5.getRegionIndex() == 11)
- _hotspot5.setPriority2(-1);
+ _hotspot5.fixPriority(-1);
if (_hotspot5.getRegionIndex() == 5)
- _hotspot5.setPriority2(94);
+ _hotspot5.fixPriority(94);
}
- if (_globals->_sceneObjects->contains(&_hotspot7)) {
- if (!_hotspot7._mover)
- _hotspot7.checkAngle(&_globals->_player);
+ if (_globals->_sceneObjects->contains(&_miranda)) {
+ if (!_miranda._mover)
+ _miranda.checkAngle(&_globals->_player);
if (!_action && _globals->_player.getRegionIndex() == 23) {
- ADD_MOVER_NULL(_hotspot7, 204, 186);
+ ADD_MOVER_NULL(_miranda, 204, 186);
}
- if ((_hotspot7.getRegionIndex() == 10) || (_hotspot7.getRegionIndex() == 6))
- _hotspot7.setPriority2(200);
- if (_hotspot7.getRegionIndex() == 11)
- _hotspot7.setPriority2(-1);
- if (_hotspot7.getRegionIndex() == 5)
- _hotspot7.setPriority2(94);
+ if ((_miranda.getRegionIndex() == 10) || (_miranda.getRegionIndex() == 6))
+ _miranda.fixPriority(200);
+ if (_miranda.getRegionIndex() == 11)
+ _miranda.fixPriority(-1);
+ if (_miranda.getRegionIndex() == 5)
+ _miranda.fixPriority(94);
}
if (!_action) {
- if ((_globals->_inventory._peg._sceneNumber == 1) && _globals->getFlag(34) &&
+ if ((RING_INVENTORY._peg._sceneNumber == 1) && _globals->getFlag(34) &&
_globals->getFlag(37) && !_globals->getFlag(40)) {
_globals->_player.disableControl();
_soundHandler1.startSound(177);
@@ -1222,16 +1238,16 @@ void Scene4000::dispatch() {
if (_globals->_player.getRegionIndex() == 15)
_globals->_sceneManager.changeScene(4100);
- if ((_globals->_player._position.x > 5) && (_globals->_player._position.y < 100)) {
+ if ((_globals->_player._position.x <= 5) && (_globals->_player._position.y < 100)) {
_globals->_player.disableControl();
- if (!_globals->_sceneObjects->contains(&_hotspot7) || (_hotspot7._position.y <= 100)) {
+ if (!_globals->_sceneObjects->contains(&_miranda) || (_miranda._position.y <= 100)) {
_sceneMode = 4008;
setAction(&_sequenceManager1, this, 4008, &_globals->_player, NULL);
} else {
_sceneMode = 4015;
_globals->_player.addMover(NULL);
- setAction(&_sequenceManager1, this, 4015, &_globals->_player, &_hotspot7, NULL);
+ setAction(&_sequenceManager1, this, 4015, &_globals->_player, &_miranda, NULL);
}
}
}
@@ -1398,8 +1414,8 @@ void Scene4025::Action3::signal() {
/*--------------------------------------------------------------------------*/
-void Scene4025::Hole::synchronise(Serialiser &s) {
- SceneObject::synchronise(s);
+void Scene4025::Hole::synchronize(Serializer &s) {
+ SceneObject::synchronize(s);
SYNC_POINTER(_pegPtr);
s.syncAsSint16LE(_armStrip);
s.syncAsSint16LE(_newPosition.x);
@@ -1426,7 +1442,7 @@ void Scene4025::Hole::doAction(int action) {
if (!scene->_pegPtr2) {
_globals->_player.disableControl();
_globals->_events.setCursor(CURSOR_USE);
- _globals->_inventory._peg._sceneNumber = 4025;
+ RING_INVENTORY._peg._sceneNumber = 4025;
scene->_pegPtr = &scene->_peg5;
scene->_holePtr = this;
@@ -1442,8 +1458,8 @@ void Scene4025::Hole::doAction(int action) {
}
}
-void Scene4025::Peg::synchronise(Serialiser &s) {
- SceneObject::synchronise(s);
+void Scene4025::Peg::synchronize(Serializer &s) {
+ SceneObject::synchronize(s);
s.syncAsSint16LE(_field88);
SYNC_POINTER(_armStrip);
}
@@ -1513,6 +1529,7 @@ void Scene4025::postInit(SceneObjectList *OwnerList) {
_peg5.setFrame(5);
_peg5.hide();
+ // Hole N-W
_hole1.postInit();
_hole1.setVisage(4025);
_hole1.setStrip(1);
@@ -1522,6 +1539,7 @@ void Scene4025::postInit(SceneObjectList *OwnerList) {
_hole1._newPosition = Common::Point(123, 44);
_hole1._armStrip = 8;
+ // Hole N-E
_hole2.postInit();
_hole2.setVisage(4025);
_hole2.setStrip(1);
@@ -1531,6 +1549,7 @@ void Scene4025::postInit(SceneObjectList *OwnerList) {
_hole2._newPosition = Common::Point(166, 44);
_hole2._armStrip = 7;
+ // Hole Center
_hole3.postInit();
_hole3.setVisage(4025);
_hole3.setStrip(1);
@@ -1540,15 +1559,17 @@ void Scene4025::postInit(SceneObjectList *OwnerList) {
_hole3._newPosition = Common::Point(145, 60);
_hole3._armStrip = 6;
+ // Hole S-W
_hole4.postInit();
_hole4.setVisage(4025);
_hole4.setStrip(1);
- _hole4.setFrame2(6);
+ _hole4.setFrame2(9);
_hole4.setPosition(Common::Point(123, 87));
_hole4._pegPtr = NULL;
_hole4._newPosition = Common::Point(123, 80);
_hole4._armStrip = 5;
+ // Hole S-E
_hole5.postInit();
_hole5.setVisage(4025);
_hole5.setStrip(1);
@@ -1558,11 +1579,11 @@ void Scene4025::postInit(SceneObjectList *OwnerList) {
_hole5._newPosition = Common::Point(166, 80);
_hole5._armStrip = 4;
- _hole1.setPriority2(1);
- _hole2.setPriority2(1);
- _hole3.setPriority2(1);
- _hole4.setPriority2(1);
- _hole5.setPriority2(1);
+ _hole1.fixPriority(1);
+ _hole2.fixPriority(1);
+ _hole3.fixPriority(1);
+ _hole4.fixPriority(1);
+ _hole5.fixPriority(1);
_armHotspot.postInit();
_armHotspot.setVisage(4025);
@@ -1578,8 +1599,8 @@ void Scene4025::postInit(SceneObjectList *OwnerList) {
setAction(&_sequenceManager, this, 4026, NULL);
}
-void Scene4025::synchronise(Serialiser &s) {
- Scene::synchronise(s);
+void Scene4025::synchronize(Serializer &s) {
+ Scene::synchronize(s);
SYNC_POINTER(_pegPtr);
SYNC_POINTER(_pegPtr2);
SYNC_POINTER(_holePtr);
@@ -1594,7 +1615,7 @@ void Scene4025::signal() {
if (_sceneMode != 4027) {
if (_sceneMode != 4028) {
_gfxButton.setText(EXIT_MSG);
- _gfxButton._bounds.centre(144, 107);
+ _gfxButton._bounds.center(144, 107);
_gfxButton.draw();
_gfxButton._bounds.expandPanes();
}
@@ -1609,8 +1630,8 @@ void Scene4025::process(Event &event) {
Scene::process(event);
if (_gfxButton.process(event)) {
- if (_globals->_inventory._peg._sceneNumber == 4025)
- _globals->_inventory._peg._sceneNumber = 1;
+ if (RING_INVENTORY._peg._sceneNumber == 4025)
+ RING_INVENTORY._peg._sceneNumber = 1;
_globals->_sceneManager.changeScene(4000);
}
@@ -1642,7 +1663,7 @@ void Scene4045::Action1::signal() {
scene->_stripManager.start(4040, this, scene);
break;
case 2:
- scene->_hotspot5.animate(ANIM_MODE_NONE, NULL);
+ scene->_olloFace.animate(ANIM_MODE_NONE, NULL);
scene->_hotspot4.animate(ANIM_MODE_5, this);
break;
case 3:
@@ -1674,7 +1695,7 @@ void Scene4045::Action2::signal() {
scene->_stripManager.start(_globals->_stripNum, this, scene);
break;
case 2:
- scene->_hotspot5.animate(ANIM_MODE_NONE, NULL);
+ scene->_olloFace.animate(ANIM_MODE_NONE, NULL);
setDelay(10);
break;
case 3:
@@ -1705,7 +1726,7 @@ void Scene4045::Action3::signal() {
break;
case 2:
scene->_hotspot4.animate(ANIM_MODE_6, NULL);
- scene->_hotspot5.animate(ANIM_MODE_NONE, NULL);
+ scene->_olloFace.animate(ANIM_MODE_NONE, NULL);
ADD_MOVER(_globals->_player, 91, 1264);
break;
case 3:
@@ -1717,7 +1738,7 @@ void Scene4045::Action3::signal() {
/*--------------------------------------------------------------------------*/
-void Scene4045::Hotspot1::doAction(int action) {
+void Scene4045::OlloStand::doAction(int action) {
Scene4045 *scene = (Scene4045 *)_globals->_sceneManager._scene;
switch (action) {
@@ -1733,7 +1754,7 @@ void Scene4045::Hotspot1::doAction(int action) {
case CURSOR_TALK:
if (_strip == 5) {
setStrip(6);
- animate(ANIM_MODE_NONE, 0);
+ animate(ANIM_MODE_NONE, NULL);
}
if (_globals->_player._position.y < 135) {
scene->_sceneMode = 4046;
@@ -1759,7 +1780,7 @@ void Scene4045::Hotspot1::doAction(int action) {
}
}
-void Scene4045::Hotspot2::doAction(int action) {
+void Scene4045::Miranda::doAction(int action) {
Scene4045 *scene = (Scene4045 *)_globals->_sceneManager._scene;
switch (action) {
@@ -1777,7 +1798,7 @@ void Scene4045::Hotspot2::doAction(int action) {
}
}
-void Scene4045::Hotspot6::doAction(int action) {
+void Scene4045::Necklace::doAction(int action) {
Scene4045 *scene = (Scene4045 *)_globals->_sceneManager._scene;
switch (action) {
@@ -1787,13 +1808,13 @@ void Scene4045::Hotspot6::doAction(int action) {
case CURSOR_USE:
if (_globals->_player._position.y < 135) {
SceneItem::display2(4045, 16);
- _globals->_inventory._peg._sceneNumber = 1;
+ RING_INVENTORY._peg._sceneNumber = 1;
_globals->_events.setCursor(CURSOR_WALK);
remove();
} else {
scene->_sceneMode = 4047;
_globals->_player.disableControl();
- scene->setAction(&scene->_sequenceManager, scene, 4047, &_globals->_player, &scene->_hotspot1, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 4047, &_globals->_player, &scene->_olloStand, NULL);
}
break;
default:
@@ -1805,15 +1826,15 @@ void Scene4045::Hotspot6::doAction(int action) {
/*--------------------------------------------------------------------------*/
Scene4045::Scene4045() :
- _hotspot3(0, CURSOR_LOOK, 4045, 1, CURSOR_USE, 4100, 21, LIST_END),
- _hotspot7(9, CURSOR_LOOK, 4045, 0, CURSOR_USE, 4045, 15, LIST_END),
- _hotspot8(10, CURSOR_LOOK, 4045, 2, LIST_END),
- _hotspot9(11, CURSOR_LOOK, 4045, 3, CURSOR_USE, 4045, 15, LIST_END),
- _hotspot10(12, CURSOR_LOOK, 4045, 4, CURSOR_USE, 4045, 19, LIST_END),
- _hotspot11(13, CURSOR_LOOK, 4045, 6, CURSOR_USE, 4045, 15, LIST_END),
- _hotspot12(14, CURSOR_LOOK, 4045, 7, CURSOR_USE, 4045, 29, LIST_END),
- _hotspot13(15, CURSOR_LOOK, 4045, 8, CURSOR_USE, 4045, 19, LIST_END),
- _hotspot14(0, CURSOR_LOOK, 4045, 10, LIST_END) {
+ _flame(0, CURSOR_LOOK, 4045, 1, CURSOR_USE, 4100, 21, LIST_END),
+ _hotspot7(9, CURSOR_LOOK, 4045, 0, CURSOR_USE, 4045, 15, LIST_END),
+ _hotspot8(10, CURSOR_LOOK, 4045, 2, LIST_END),
+ _hotspot9(11, CURSOR_LOOK, 4045, 3, CURSOR_USE, 4045, 15, LIST_END),
+ _hotspot10(12, CURSOR_LOOK, 4045, 4, CURSOR_USE, 4045, 19, LIST_END),
+ _hotspot11(13, CURSOR_LOOK, 4045, 6, CURSOR_USE, 4045, 15, LIST_END),
+ _hotspot12(14, CURSOR_LOOK, 4045, 7, CURSOR_USE, 4045, 29, LIST_END),
+ _hotspot13(15, CURSOR_LOOK, 4045, 8, CURSOR_USE, 4045, 19, LIST_END),
+ _hotspot14(0, CURSOR_LOOK, 4045, 10, LIST_END) {
_hotspot14.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
}
@@ -1833,12 +1854,12 @@ void Scene4045::postInit(SceneObjectList *OwnerList) {
_speakerQText._textPos.y = 140;
- _hotspot3.postInit();
- _hotspot3.setVisage(4045);
- _hotspot3.setPosition(Common::Point(47, 111));
- _hotspot3.animate(ANIM_MODE_2, NULL);
- _hotspot3.setPriority2(156);
- _globals->_sceneItems.push_back(&_hotspot3);
+ _flame.postInit();
+ _flame.setVisage(4045);
+ _flame.setPosition(Common::Point(47, 111));
+ _flame.animate(ANIM_MODE_2, NULL);
+ _flame.fixPriority(156);
+ _globals->_sceneItems.push_back(&_flame);
_globals->_player.postInit();
_globals->_player.setVisage(4200);
@@ -1846,73 +1867,76 @@ void Scene4045::postInit(SceneObjectList *OwnerList) {
_globals->_player.animate(ANIM_MODE_1, NULL);
_globals->_player._moveDiff = Common::Point(7, 4);
- _hotspot1.postInit();
- _hotspot1.setVisage(4051);
+ _olloStand.postInit();
+ _olloStand.setVisage(4051);
- _hotspot5.postInit();
- _hotspot5.setVisage(4051);
- _hotspot5.setStrip(4);
- _hotspot5.setPriority2(152);
+ _olloFace.postInit();
+ _olloFace.setVisage(4051);
+ _olloFace.setStrip(4);
+ _olloFace.fixPriority(152);
if(_globals->_sceneManager._previousScene == 4050) {
_globals->_soundHandler.startSound(155);
_globals->_player.setPosition(Common::Point(72, 128));
_globals->_player.enableControl();
- _hotspot1.setStrip(5);
- _hotspot1.setPosition(Common::Point(173, 99));
- _hotspot1._numFrames = 1;
- _hotspot1.animate(ANIM_MODE_2, NULL);
+ _olloStand.setStrip(5);
+ _olloStand.setPosition(Common::Point(173, 99));
+ _olloStand._numFrames = 1;
+ _olloStand.animate(ANIM_MODE_2, NULL);
- _hotspot5.setPosition(Common::Point(177, 40));
+ _olloFace.setPosition(Common::Point(177, 40));
- if (_globals->_inventory._peg._sceneNumber == 4045) {
- _hotspot6.postInit();
- _hotspot6.setVisage(4045);
- _hotspot6.setStrip(2);
- _hotspot6.setPosition(Common::Point(108, 82));
- _globals->_sceneItems.push_back(&_hotspot6);
+ if (RING_INVENTORY._peg._sceneNumber == 4045) {
+ _necklace.postInit();
+ _necklace.setVisage(4045);
+ _necklace.setStrip(2);
+ _necklace.setPosition(Common::Point(108, 82));
+ _globals->_sceneItems.push_back(&_necklace);
}
} else {
_globals->_player.setPosition(Common::Point(108, 192));
_globals->_player.setStrip(4);
if (!_globals->getFlag(36) && !_globals->getFlag(43)) {
- _hotspot2.postInit();
- _hotspot2.setVisage(4102);
- _hotspot2.animate(ANIM_MODE_NONE, NULL);
- _hotspot2.setStrip(3);
- _hotspot2.changeZoom(-1);
- _hotspot2.setPosition(Common::Point(66, 209));
- _globals->_sceneItems.push_back(&_hotspot2);
+ _miranda.postInit();
+ _miranda.setVisage(4102);
+ _miranda.animate(ANIM_MODE_NONE, NULL);
+ _miranda.setStrip(3);
+ _miranda.setFrame(2);
+ _miranda.changeZoom(-1);
+
+ _miranda.setPosition(Common::Point(66, 209));
+ _globals->_sceneItems.push_back(&_miranda);
}
if (_globals->getFlag(31)) {
- _hotspot1.setVisage(4051);
- _hotspot1.setStrip(5);
- _hotspot1.setPosition(Common::Point(173, 99));
- _hotspot1._numFrames = 1;
- _hotspot1.animate(ANIM_MODE_2, NULL);
-
- _hotspot5.setPosition(Common::Point(177, 40));
-
- if (_globals->_inventory._peg._sceneNumber == 4045) {
- _hotspot6.postInit();
- _hotspot6.setVisage(4045);
- _hotspot6.setStrip(2);
- _hotspot6.setPosition(Common::Point(108, 82));
- _globals->_sceneItems.push_back(&_hotspot6);
+ // Olo asleep
+ _olloStand.setVisage(4051);
+ _olloStand.setStrip(5);
+ _olloStand.setPosition(Common::Point(173, 99));
+ _olloStand._numFrames = 1;
+ _olloStand.animate(ANIM_MODE_2, NULL);
+
+ _olloFace.setPosition(Common::Point(177, 40));
+
+ if (RING_INVENTORY._peg._sceneNumber == 4045) {
+ _necklace.postInit();
+ _necklace.setVisage(4045);
+ _necklace.setStrip(2);
+ _necklace.setPosition(Common::Point(108, 82));
+ _globals->_sceneItems.push_back(&_necklace);
}
} else {
- _hotspot1.setPosition(Common::Point(186, 149));
+ _olloStand.setPosition(Common::Point(186, 149));
_hotspot4.postInit();
_hotspot4.setVisage(4051);
_hotspot4.setStrip(2);
- _hotspot4.setPriority2(152);
+ _hotspot4.fixPriority(152);
_hotspot4.setPosition(Common::Point(202, 80));
- _hotspot5.setPosition(Common::Point(192, 77));
+ _olloFace.setPosition(Common::Point(192, 77));
_globals->setFlag(31);
setAction(&_action1);
@@ -1920,17 +1944,17 @@ void Scene4045::postInit(SceneObjectList *OwnerList) {
}
}
- _globals->_sceneItems.addItems(&_hotspot1, &_hotspot7, &_hotspot8, &_hotspot9, &_hotspot10,
+ _globals->_sceneItems.addItems(&_olloStand, &_hotspot7, &_hotspot8, &_hotspot9, &_hotspot10,
&_hotspot13, &_hotspot11, &_hotspot12, &_hotspot14, NULL);
}
void Scene4045::stripCallback(int v) {
switch (v) {
case 1:
- _hotspot5.animate(ANIM_MODE_7, 0, NULL);
+ _olloFace.animate(ANIM_MODE_7, 0, NULL);
break;
case 2:
- _hotspot5.animate(ANIM_MODE_NONE, NULL);
+ _olloFace.animate(ANIM_MODE_NONE, NULL);
break;
}
}
@@ -1939,7 +1963,7 @@ void Scene4045::signal() {
switch (_sceneMode) {
case 4046:
case 4047:
- _hotspot5.animate(ANIM_MODE_NONE, NULL);
+ _olloFace.animate(ANIM_MODE_NONE, NULL);
break;
case 4050:
_globals->_sceneManager.changeScene(4000);
@@ -1954,11 +1978,11 @@ void Scene4045::dispatch() {
if (!_action) {
if (_globals->_player.getRegionIndex() == 8) {
_globals->_player.addMover(NULL);
- if (_hotspot1._strip == 1) {
+ if (_olloStand._strip != 1) {
_globals->_player.disableControl();
_sceneMode = 4046;
- _hotspot1._numFrames = 10;
- setAction(&_sequenceManager, this, 4046, &_globals->_player, &_hotspot1, NULL);
+ _olloStand._numFrames = 10;
+ setAction(&_sequenceManager, this, 4046, &_globals->_player, &_olloStand, NULL);
} else {
setAction(&_action3);
}
@@ -1982,6 +2006,7 @@ void Scene4045::dispatch() {
*--------------------------------------------------------------------------*/
void Scene4050::Action1::signal() {
+ // "Map" on the wall
Scene4050 *scene = (Scene4050 *)_globals->_sceneManager._scene;
switch (_actionIndex++) {
@@ -1989,9 +2014,12 @@ void Scene4050::Action1::signal() {
_globals->_player.disableControl();
setDelay(3);
break;
- case 1:
- ADD_PLAYER_MOVER(204, 152);
+ case 1: {
+ Common::Point pt(204, 152);
+ PlayerMover *mover = new PlayerMover();
+ _globals->_player.addMover(mover, &pt, this);
break;
+ }
case 2:
_globals->_player.checkAngle(&scene->_hotspot17);
@@ -1999,7 +2027,8 @@ void Scene4050::Action1::signal() {
scene->_hotspot14.setVisage(4050);
scene->_hotspot14.setStrip(2);
scene->_hotspot14.setPosition(Common::Point(91, 154));
- scene->_hotspot14.setPriority2(200);
+ scene->_hotspot14.fixPriority(200);
+ setDelay(10);
break;
case 3:
_globals->_events.waitForPress();
@@ -2013,6 +2042,7 @@ void Scene4050::Action1::signal() {
}
void Scene4050::Action2::signal() {
+ // Climb down the rope
switch (_actionIndex++) {
case 0:
_globals->_player.disableControl();
@@ -2041,21 +2071,21 @@ void Scene4050::Action2::signal() {
_globals->_player.setVisage(4202);
_globals->_player.animate(ANIM_MODE_1, NULL);
_globals->_player.setPosition(Common::Point(210, 185));
- _globals->_player.setPriority2(-1);
+ _globals->_player.fixPriority(-1);
_globals->_player.enableControl();
-
remove();
break;
}
}
void Scene4050::Action3::signal() {
+ // Climb up the rope
switch (_actionIndex++) {
case 0:
ADD_PLAYER_MOVER(210, 185);
break;
case 1:
- _globals->_player.setPriority2(200);
+ _globals->_player.fixPriority(200);
_globals->_player.setVisage(4052);
_globals->_player.setStrip(5);
_globals->_player.changeZoom(100);
@@ -2084,7 +2114,7 @@ void Scene4050::Action4::signal() {
case 0:
_globals->_player.disableControl();
ADD_MOVER(_globals->_player, 189, 135);
- _globals->_player.setPriority2(200);
+ _globals->_player.fixPriority(200);
break;
case 1:
_globals->_player._moveDiff.y = 3;
@@ -2120,7 +2150,7 @@ void Scene4050::Action4::signal() {
_globals->_player.setStrip(2);
_globals->_player.setFrame(1);
_globals->_player.setPosition(Common::Point(216, 184));
- _globals->_player.setPriority2(-1);
+ _globals->_player.fixPriority(-1);
break;
case 5:
scene->_hotspot16.setStrip2(4);
@@ -2149,7 +2179,7 @@ void Scene4050::Action4::signal() {
/*--------------------------------------------------------------------------*/
-void Scene4050::Hotspot14::doAction(int action) {
+void Scene4050::Hotspot15::doAction(int action) {
Scene4050 *scene = (Scene4050 *)_globals->_sceneManager._scene;
switch (action) {
@@ -2214,6 +2244,7 @@ void Scene4050::postInit(SceneObjectList *OwnerList) {
switch (_globals->_sceneManager._previousScene) {
case 4000:
if (_globals->getFlag(41)) {
+ // Using a rope
_hotspot15.postInit();
_hotspot15.setVisage(4054);
_hotspot15.setPosition(Common::Point(206, 103));
@@ -2222,12 +2253,13 @@ void Scene4050::postInit(SceneObjectList *OwnerList) {
_globals->_player.setVisage(4008);
_globals->_player.setPosition(Common::Point(206, 62));
_globals->_player.changeZoom(130);
- _globals->_player.setPriority2(200);
+ _globals->_player.fixPriority(200);
_globals->_player.setStrip(2);
setAction(&_action2);
_globals->_soundHandler.startSound(175);
} else {
+ // Without the rope
_globals->_player.setVisage(5315);
_globals->_player.setPosition(Common::Point(189, 83));
_globals->_player.changeZoom(130);
@@ -2264,7 +2296,7 @@ void Scene4050::postInit(SceneObjectList *OwnerList) {
_hotspot17.postInit();
_hotspot17.setVisage(4050);
_hotspot17.setPosition(Common::Point(209, 119));
- _hotspot17.setPriority2(2);
+ _hotspot17.fixPriority(2);
_hotspot1.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
_hotspot2.setBounds(Rect(150, 25, 198, 125));
@@ -2285,11 +2317,22 @@ void Scene4050::postInit(SceneObjectList *OwnerList) {
}
void Scene4050::signal() {
-
+ if (_sceneMode == 4050)
+ _globals->_sceneManager.changeScene(4045);
}
void Scene4050::dispatch() {
+ if (!_action) {
+ if ((_globals->_player._canWalk) && (_globals->_player._position.y > 196)) {
+ _sceneMode = 4050;
+ _globals->_player.disableControl();
+ Common::Point pt(160, 275);
+ NpcMover *mover = new NpcMover();
+ _globals->_player.addMover(mover, &pt, this);
+ }
+ }
+ Scene::dispatch();
}
/*--------------------------------------------------------------------------
@@ -2328,7 +2371,7 @@ void Scene4100::Action2::signal() {
scene->_hotspot2.setVisage(4120);
scene->_hotspot2.animate(ANIM_MODE_1, NULL);
scene->_hotspot2.setStrip2(4);
- scene->_hotspot2.setPriority2(100);
+ scene->_hotspot2.fixPriority(100);
scene->_hotspot2.setPosition(Common::Point(214, 119));
setDelay(3);
@@ -2355,14 +2398,15 @@ void Scene4100::Action3::signal() {
switch (_actionIndex++) {
case 0:
_globals->clearFlag(43);
- _globals->clearFlag(36);
+ _globals->setFlag(36);
setDelay(15);
break;
case 1:
scene->_stripManager.start(4505, this);
break;
case 2:
- scene->setAction(&scene->_action2);
+ setAction(&scene->_action2, this);
+ break;
case 3:
scene->_stripManager.start(4510, this);
break;
@@ -2372,10 +2416,13 @@ void Scene4100::Action3::signal() {
case 5:
_globals->_sceneManager.changeScene(4150);
break;
+ default:
+ break;
}
}
void Scene4100::Action4::signal() {
+ // Rock getting drunk
Scene4100 *scene = (Scene4100 *)_globals->_sceneManager._scene;
switch (_actionIndex++) {
@@ -2394,6 +2441,7 @@ void Scene4100::Action4::signal() {
_globals->clearFlag(43);
_globals->setFlag(42);
scene->_stripManager.start(4119, this);
+ break;
case 4:
setDelay(15);
break;
@@ -2413,16 +2461,16 @@ void Scene4100::Action5::signal() {
ADD_PLAYER_MOVER(58, 151);
break;
case 1:
- if (_globals->_inventory._ladder._sceneNumber == 4100) {
- _globals->_inventory._ladder._sceneNumber = 1;
- scene->_hotspot6.remove();
+ if (RING_INVENTORY._ladder._sceneNumber == 4100) {
+ RING_INVENTORY._ladder._sceneNumber = 1;
+ scene->_ladder.remove();
} else {
- scene->_hotspot6.postInit();
- scene->_hotspot6.setVisage(4101);
- scene->_hotspot6.setPosition(Common::Point(49, 144));
+ scene->_ladder.postInit();
+ scene->_ladder.setVisage(4101);
+ scene->_ladder.setPosition(Common::Point(49, 144));
- _globals->_inventory._ladder._sceneNumber = 4100;
- _globals->_sceneItems.push_front(&scene->_hotspot6);
+ RING_INVENTORY._ladder._sceneNumber = 4100;
+ _globals->_sceneItems.push_front(&scene->_ladder);
}
_globals->_player.enableControl();
@@ -2454,20 +2502,26 @@ void Scene4100::Hotspot1::doAction(int action) {
Scene4100 *scene = (Scene4100 *)_globals->_sceneManager._scene;
switch (action) {
- case CURSOR_LOOK:
- SceneItem::display2(4100, _globals->getFlag(42) ? 24 : 12);
- break;
case OBJECT_STUNNER:
SceneItem::display2(4100, 16);
break;
+ case OBJECT_ALE:
+ _globals->_player.disableControl();
+ scene->setAction(&scene->_action3);
+ break;
+ case CURSOR_LOOK:
+ SceneItem::display2(4100, _globals->getFlag(42) ? 24 : 12);
+ break;
case CURSOR_USE:
SceneItem::display2(4100, 22);
break;
case CURSOR_TALK:
- if (_globals->_inventory._peg._sceneNumber == 1) {
+ if (RING_INVENTORY._peg._sceneNumber == 1) {
_globals->_player.disableControl();
+ scene->_sceneMode = 4109;
scene->setAction(&scene->_sequenceManager, scene, 4109, NULL);
} else if (_globals->getFlag(42)) {
+ scene->_sceneMode = 4102;
scene->setAction(&scene->_sequenceManager, scene, 4102, NULL);
} else {
if (_globals->getFlag(33))
@@ -2500,7 +2554,7 @@ void Scene4100::Hotspot2::doAction(int action) {
}
}
-void Scene4100::Hotspot5::doAction(int action) {
+void Scene4100::Miranda::doAction(int action) {
Scene4100 *scene = (Scene4100 *)_globals->_sceneManager._scene;
switch (action) {
@@ -2517,7 +2571,7 @@ void Scene4100::Hotspot5::doAction(int action) {
}
}
-void Scene4100::Hotspot6::doAction(int action) {
+void Scene4100::Ladder::doAction(int action) {
Scene4100 *scene = (Scene4100 *)_globals->_sceneManager._scene;
switch (action) {
@@ -2539,7 +2593,9 @@ void Scene4100::Hotspot6::doAction(int action) {
}
}
-
+/**
+ Exit hotspot, South
+ */
void Scene4100::Hotspot14::doAction(int action) {
Scene4100 *scene = (Scene4100 *)_globals->_sceneManager._scene;
@@ -2595,13 +2651,13 @@ void Scene4100::postInit(SceneObjectList *OwnerList) {
_hotspot1.postInit();
_hotspot1.setVisage(4102);
- _hotspot1.setPriority2(129);
+ _hotspot1.fixPriority(129);
_hotspot1.setPosition(Common::Point(171, 120));
_hotspot3.postInit();
_hotspot3.setVisage(4130);
_hotspot3.animate(ANIM_MODE_2, NULL);
- _hotspot3.setPriority2(200);
+ _hotspot3.fixPriority(200);
_hotspot3.setPosition(Common::Point(272, 110));
_hotspot4.postInit();
@@ -2615,21 +2671,21 @@ void Scene4100::postInit(SceneObjectList *OwnerList) {
_hotspot1.setStrip(1);
_hotspot1.setFrame(4);
} else if (!_globals->getFlag(43)) {
- _hotspot5.postInit();
- _hotspot5.setVisage(4102);
- _hotspot5.setStrip2(3);
- _hotspot5.setFrame(2);
- _hotspot5.setPosition(Common::Point(65, 188));
+ _miranda.postInit();
+ _miranda.setVisage(4102);
+ _miranda.setStrip2(3);
+ _miranda.setFrame(2);
+ _miranda.setPosition(Common::Point(65, 188));
- _globals->_sceneItems.push_back(&_hotspot5);
+ _globals->_sceneItems.push_back(&_miranda);
}
- if (_globals->_inventory._ladder._sceneNumber == 4100) {
- _hotspot6.postInit();
- _hotspot6.setVisage(4101);
- _hotspot6.setPosition(Common::Point(49, 144));
+ if (RING_INVENTORY._ladder._sceneNumber == 4100) {
+ _ladder.postInit();
+ _ladder.setVisage(4101);
+ _ladder.setPosition(Common::Point(49, 144));
- _globals->_sceneItems.push_back(&_hotspot6);
+ _globals->_sceneItems.push_back(&_ladder);
}
_hotspot14.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
@@ -2664,7 +2720,7 @@ void Scene4100::postInit(SceneObjectList *OwnerList) {
_globals->_player.setPosition(Common::Point(252, 139));
_globals->_player.setStrip(2);
} else {
- if ((_globals->_inventory._ale._sceneNumber == 4100) && !_globals->getFlag(42)) {
+ if ((RING_INVENTORY._ale._sceneNumber == 4100) && !_globals->getFlag(42)) {
_globals->_player.disableControl();
setAction(&_action3);
}
@@ -2838,15 +2894,15 @@ void Scene4150::Action3::signal() {
case 1:
_globals->_player.checkAngle(&scene->_hotspot3);
- if (_globals->_inventory._rope._sceneNumber == 1) {
+ if (RING_INVENTORY._rope._sceneNumber == 1) {
scene->_hotspot3.postInit();
scene->_hotspot3.setVisage(4150);
scene->_hotspot3.setPosition(Common::Point(175, 70));
- _globals->_inventory._rope._sceneNumber = 4150;
+ RING_INVENTORY._rope._sceneNumber = 4150;
_globals->_sceneItems.push_front(&scene->_hotspot3);
} else {
- _globals->_inventory._rope._sceneNumber = 1;
+ RING_INVENTORY._rope._sceneNumber = 1;
scene->_hotspot3.remove();
}
@@ -2914,7 +2970,7 @@ void Scene4150::Hotspot3::doAction(int action) {
/*--------------------------------------------------------------------------*/
Scene4150::Scene4150() :
- _hotspot1(0, CURSOR_LOOK, 4000, 17, CURSOR_USE, 4150, 21, CURSOR_TALK, 4150, 21,
+ _hotspot1(0, CURSOR_LOOK, 4150, 17, CURSOR_USE, 4150, 21, CURSOR_TALK, 4150, 21,
OBJECT_SCANNER, 4150, 22, OBJECT_STUNNER, 4150, 23, LIST_END),
_hotspot2(0, CURSOR_LOOK, 4150, 4, CURSOR_USE, 4150, 24, LIST_END),
_hotspot7(0, CURSOR_LOOK, 4150, 1, CURSOR_USE, 4150, 25, OBJECT_ROPE, 4150, 26, LIST_END),
@@ -2947,7 +3003,7 @@ void Scene4150::postInit(SceneObjectList *OwnerList) {
_hotspot2.postInit();
_hotspot2.setVisage(4171);
_hotspot2.animate(ANIM_MODE_2, NULL);
- _hotspot2.setPriority2(100);
+ _hotspot2.fixPriority(100);
_hotspot2.setPosition(Common::Point(76, 147));
_hotspot1.postInit();
@@ -2980,7 +3036,7 @@ void Scene4150::postInit(SceneObjectList *OwnerList) {
_globals->setFlag(44);
}
- if (_globals->_inventory._rope._sceneNumber == 4150) {
+ if (RING_INVENTORY._rope._sceneNumber == 4150) {
_hotspot3.postInit();
_hotspot3.setVisage(4150);
_hotspot3.setPosition(Common::Point(175, 70));
@@ -3071,7 +3127,7 @@ void Scene4250::Action1::signal() {
break;
case 5:
ADD_PLAYER_MOVER(220, 175);
- scene->_hotspot1.setPriority2(105);
+ scene->_hotspot1.fixPriority(105);
ADD_PLAYER_MOVER_NULL(scene->_hotspot1, 197, 173);
break;
case 6:
@@ -3167,7 +3223,7 @@ void Scene4250::Action4::signal() {
break;
case 1:
_globals->_player.addMover(NULL);
- scene->_stripManager.start((_globals->_inventory._helmet._sceneNumber == 4250) ? 4259 : 4256, this);
+ scene->_stripManager.start((RING_INVENTORY._helmet._sceneNumber == 4250) ? 4259 : 4256, this);
break;
case 2:
ADD_PLAYER_MOVER(_globals->_player._position.x + 5, _globals->_player._position.y);
@@ -3188,8 +3244,8 @@ void Scene4250::Action5::signal() {
setDelay(3);
break;
case 1:
- scene->_hotspot4.setPriority2(195);
- scene->_hotspot1.setPriority2(105);
+ scene->_hotspot4.fixPriority(195);
+ scene->_hotspot1.fixPriority(105);
ADD_MOVER_NULL(_globals->_player, 6, 185);
ADD_MOVER_NULL(scene->_hotspot4, 9, 190);
ADD_MOVER(scene->_hotspot1, 12, 180);
@@ -3200,7 +3256,7 @@ void Scene4250::Action5::signal() {
ADD_PLAYER_MOVER_NULL(scene->_hotspot4, 239, 195);
break;
case 3:
- scene->_hotspot4.setPriority2(-1);
+ scene->_hotspot4.fixPriority(-1);
scene->_hotspot1.setStrip(5);
scene->_hotspot4.setStrip(7);
_globals->_player.enableControl();
@@ -3216,7 +3272,7 @@ void Scene4250::Hotspot1::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- SceneItem::display2(4250, (_globals->_inventory._helmet._sceneNumber == 4250) ? 19 : 14);
+ SceneItem::display2(4250, (RING_INVENTORY._helmet._sceneNumber == 4250) ? 19 : 14);
break;
case CURSOR_TALK:
_globals->_player.disableControl();
@@ -3224,7 +3280,7 @@ void Scene4250::Hotspot1::doAction(int action) {
scene->setAction(&scene->_action3);
} else {
scene->_sceneMode = 4260;
- if (_globals->_inventory._helmet._sceneNumber == 4250) {
+ if (RING_INVENTORY._helmet._sceneNumber == 4250) {
scene->_sceneMode = 4265;
scene->setAction(&scene->_sequenceManager, scene, 4265, this, NULL);
} else {
@@ -3234,13 +3290,13 @@ void Scene4250::Hotspot1::doAction(int action) {
}
break;
case OBJECT_SCANNER:
- if (_globals->_inventory._helmet._sceneNumber == 4250)
+ if (RING_INVENTORY._helmet._sceneNumber == 4250)
SceneItem::display2(4250, 21);
else
SceneHotspot::doAction(action);
break;
case OBJECT_STUNNER:
- if (_globals->_inventory._helmet._sceneNumber == 4250)
+ if (RING_INVENTORY._helmet._sceneNumber == 4250)
SceneItem::display2(4250, 22);
else
SceneHotspot::doAction(action);
@@ -3252,6 +3308,7 @@ void Scene4250::Hotspot1::doAction(int action) {
}
void Scene4250::Hotspot2::doAction(int action) {
+ //Ship with stasis field
Scene4250 *scene = (Scene4250 *)_globals->_sceneManager._scene;
switch (action) {
@@ -3285,16 +3342,16 @@ void Scene4250::Hotspot4::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- SceneItem::display2(4250, (_globals->_inventory._helmet._sceneNumber == 4250) ? 18 : 5);
+ SceneItem::display2(4250, (RING_INVENTORY._helmet._sceneNumber == 4250) ? 18 : 5);
break;
case OBJECT_SCANNER:
- if (_globals->_inventory._helmet._sceneNumber == 4250)
+ if (RING_INVENTORY._helmet._sceneNumber == 4250)
SceneItem::display2(4250, 21);
else
SceneHotspot::doAction(action);
break;
case OBJECT_STUNNER:
- if (_globals->_inventory._helmet._sceneNumber == 4250)
+ if (RING_INVENTORY._helmet._sceneNumber == 4250)
SceneItem::display2(4250, 22);
else
SceneHotspot::doAction(action);
@@ -3307,12 +3364,12 @@ void Scene4250::Hotspot4::doAction(int action) {
} else {
scene->_sceneMode = 4254;
- if (_globals->_inventory._helmet._sceneNumber == 4250) {
+ if (RING_INVENTORY._helmet._sceneNumber == 4250) {
scene->_sceneMode = 4266;
scene->setAction(&scene->_sequenceManager, scene, 4266, this, NULL);
} else {
scene->setAction(&scene->_sequenceManager, scene,
- (_globals->_inventory._concentrator._sceneNumber == 1) ? 4255 : 4254, NULL);
+ (RING_INVENTORY._concentrator._sceneNumber == 1) ? 4255 : 4254, NULL);
}
}
break;
@@ -3327,32 +3384,33 @@ void Scene4250::Hotspot6::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- SceneItem::display2(4250, (_globals->_inventory._helmet._sceneNumber == 4250) ? 7 : 6);
+ SceneItem::display2(4250, (RING_INVENTORY._helmet._sceneNumber == 4250) ? 7 : 6);
break;
case OBJECT_SCANNER:
- SceneItem::display2(4250, (_globals->_inventory._helmet._sceneNumber == 4250) ? 1 : 2);
+ SceneItem::display2(4250, (RING_INVENTORY._helmet._sceneNumber == 4250) ? 1 : 2);
break;
case OBJECT_STUNNER:
- SceneItem::display2(4250, (_globals->_inventory._helmet._sceneNumber == 4250) ? 20 : 3);
+ SceneItem::display2(4250, (RING_INVENTORY._helmet._sceneNumber == 4250) ? 20 : 3);
break;
case OBJECT_HELMET:
_globals->_soundHandler.startSound(354);
_globals->_player.disableControl();
- _globals->_inventory._helmet._sceneNumber = 4250;
+ RING_INVENTORY._helmet._sceneNumber = 4250;
- if (_globals->_inventory._concentrator._sceneNumber == 1) {
+ if (RING_INVENTORY._concentrator._sceneNumber == 1) {
if (_globals->getFlag(115)) {
scene->_sceneMode = 4269;
scene->setAction(&scene->_sequenceManager, scene, 4269, this, NULL);
} else {
_globals->setFlag(115);
_globals->_events.setCursor(CURSOR_WALK);
+ scene->_sceneMode = 4256;
scene->setAction(&scene->_sequenceManager, scene, 4256, this, NULL);
}
- } else if (_globals->_inventory._keyDevice._sceneNumber == 1) {
+ } else if (RING_INVENTORY._keyDevice._sceneNumber == 1) {
scene->_sceneMode = 4267;
scene->setAction(&scene->_sequenceManager, scene, 4267, this, NULL);
- } else if (_globals->_inventory._keyDevice._sceneNumber == 4300) {
+ } else if (RING_INVENTORY._keyDevice._sceneNumber == 4300) {
scene->_sceneMode = 4268;
scene->setAction(&scene->_sequenceManager, scene, 4268, this, NULL);
} else {
@@ -3363,10 +3421,10 @@ void Scene4250::Hotspot6::doAction(int action) {
}
break;
case OBJECT_NULLIFIER:
- if (_globals->_inventory._helmet._sceneNumber == 4250) {
+ if (RING_INVENTORY._helmet._sceneNumber == 4250) {
_globals->_soundHandler.startSound(353);
_globals->_player.disableControl();
- _globals->_inventory._helmet._sceneNumber = 1;
+ RING_INVENTORY._helmet._sceneNumber = 1;
scene->_sceneMode = 4257;
scene->setAction(&scene->_sequenceManager, scene, 4257, &_globals->_player, this, NULL);
@@ -3375,7 +3433,7 @@ void Scene4250::Hotspot6::doAction(int action) {
}
break;
case CURSOR_TALK:
- if (_globals->_inventory._helmet._sceneNumber == 4250)
+ if (RING_INVENTORY._helmet._sceneNumber == 4250)
doAction(OBJECT_HELMET);
else {
_globals->_player.disableControl();
@@ -3384,11 +3442,11 @@ void Scene4250::Hotspot6::doAction(int action) {
}
break;
case CURSOR_USE:
- if (_globals->_inventory._helmet._sceneNumber == 4250)
+ if (RING_INVENTORY._helmet._sceneNumber == 4250)
doAction(OBJECT_HELMET);
else {
_globals->_player.disableControl();
- if ((_globals->_inventory._items._sceneNumber != 1) || (_globals->_inventory._concentrator._sceneNumber != 1)) {
+ if ((RING_INVENTORY._items._sceneNumber != 1) || (RING_INVENTORY._concentrator._sceneNumber != 1)) {
scene->_sceneMode = 4258;
scene->setAction(&scene->_sequenceManager, scene, 4258, this, NULL);
} else {
@@ -3427,7 +3485,7 @@ void Scene4250::Hotspot8::doAction(int action) {
_globals->_player.disableControl();
scene->_sceneMode = 4270;
scene->setAction(&scene->_sequenceManager, scene,
- (_globals->_inventory._helmet._sceneNumber == 4250) ? 4270 : 4271, NULL);
+ (RING_INVENTORY._helmet._sceneNumber == 4250) ? 4270 : 4271, NULL);
break;
default:
SceneHotspot::doAction(action);
@@ -3482,7 +3540,7 @@ void Scene4250::postInit(tSage::SceneObjectList *OwnerList) {
_hotspot5.postInit();
_hotspot5.setVisage(4250);
_hotspot5.setPosition(Common::Point(268, 168));
- _hotspot5.setPriority2(1);
+ _hotspot5.fixPriority(1);
_hotspot4.postInit();
_hotspot4.setVisage(2701);
@@ -3497,7 +3555,6 @@ void Scene4250::postInit(tSage::SceneObjectList *OwnerList) {
_hotspot1.setPosition(Common::Point(197, 173));
_hotspot1.changeZoom(70);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
_globals->_player.setPosition(Common::Point(252, 176));
_globals->_player.changeZoom(70);
@@ -3506,10 +3563,10 @@ void Scene4250::postInit(tSage::SceneObjectList *OwnerList) {
_hotspot6.setStrip(4);
_hotspot6.setFrame(3);
_hotspot6.changeZoom(50);
- _hotspot6.setPriority2(70);
+ _hotspot6.fixPriority(70);
_hotspot6.setPosition(Common::Point(261, 175));
- if (_globals->_inventory._helmet._sceneNumber == 4250) {
+ if (RING_INVENTORY._helmet._sceneNumber == 4250) {
_hotspot6.setStrip(6);
_hotspot6.setFrame(_hotspot6.getFrameCount());
}
@@ -3529,7 +3586,7 @@ void Scene4250::postInit(tSage::SceneObjectList *OwnerList) {
_sceneMode = 4253;
_globals->_sceneItems.push_front(&_hotspot6);
- setAction(&_sequenceManager, this, 4253, &_globals->_player, NULL);
+ setAction(&_sequenceManager, this, 4253, &_globals->_player, &_hotspot6, &_hotspot4, NULL);
}
}
} else if (_globals->_stripNum == 9000) {
@@ -3563,7 +3620,7 @@ void Scene4250::postInit(tSage::SceneObjectList *OwnerList) {
_hotspot2.postInit();
_hotspot2.setVisage(4251);
_hotspot2.setStrip2(1);
- _hotspot2.setPriority2(2);
+ _hotspot2.fixPriority(2);
_hotspot2.setFrame(1);
_hotspot2.setPosition(Common::Point(267, 172));
@@ -3583,6 +3640,7 @@ void Scene4250::signal() {
break;
case 4253:
if (_globals->_stripNum == 4301) {
+ _sceneMode = 4261;
ADD_MOVER_NULL(_hotspot1, 241, 169);
setAction(&_sequenceManager, this, 4261, &_globals->_player, &_hotspot6, NULL);
} else {
@@ -3603,18 +3661,19 @@ void Scene4250::signal() {
case 4270:
_globals->_player.enableControl();
break;
- case 4255:
- case 4262:
- case 4263:
- break;
case 4259:
_globals->_soundHandler.startSound(360);
_globals->_sceneManager.changeScene(9900);
break;
case 4261:
- _globals->_inventory._keyDevice._sceneNumber = 1;
+ RING_INVENTORY._keyDevice._sceneNumber = 1;
_globals->_player.enableControl();
break;
+ case 4255:
+ case 4262:
+ case 4263:
+ default:
+ break;
}
}
@@ -3625,7 +3684,7 @@ void Scene4250::dispatch() {
_globals->_player.changeZoom(70);
if (_globals->_player.getRegionIndex() == 15) {
_globals->_player.changeZoom(-1);
- _globals->_player.setPriority2(-1);
+ _globals->_player.fixPriority(-1);
}
if (_hotspot1.getRegionIndex() == 8)
@@ -3634,7 +3693,7 @@ void Scene4250::dispatch() {
_hotspot1.changeZoom(70);
if (_hotspot1.getRegionIndex() == 15) {
_hotspot1.changeZoom(-1);
- _hotspot1.setPriority2(-1);
+ _hotspot1.fixPriority(-1);
}
if (_hotspot4.getRegionIndex() == 8)
@@ -3643,7 +3702,7 @@ void Scene4250::dispatch() {
_hotspot4.changeZoom(70);
if (_hotspot4.getRegionIndex() == 15) {
_hotspot4.changeZoom(-1);
- _hotspot4.setPriority2(-1);
+ _hotspot4.fixPriority(-1);
}
Scene::dispatch();
@@ -3705,7 +3764,7 @@ void Scene4300::Action1::signal() {
setDelay(60);
break;
case 7:
- scene->_hotspot10.setPriority2(250);
+ scene->_hotspot10.fixPriority(250);
scene->_hotspot10.animate(ANIM_MODE_5, this);
break;
case 8:
@@ -3758,7 +3817,7 @@ void Scene4300::Hotspot8::doAction(int action) {
SceneItem::display2(4300, 19);
break;
case OBJECT_KEY_DEVICE:
- _globals->_inventory._keyDevice._sceneNumber = 4300;
+ RING_INVENTORY._keyDevice._sceneNumber = 4300;
_globals->_scenePalette.addRotation(240, 254, -1);
animate(ANIM_MODE_5, NULL);
@@ -3774,15 +3833,15 @@ void Scene4300::Hotspot8::doAction(int action) {
void Scene4300::Hotspot9::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- if ((_globals->_inventory._stasisBox2._sceneNumber == 4300) ||
- (_globals->_inventory._concentrator._sceneNumber == 1))
+ if ((RING_INVENTORY._stasisBox2._sceneNumber == 4300) ||
+ (RING_INVENTORY._concentrator._sceneNumber == 1))
SceneItem::display2(4300, 7);
else
SceneItem::display2(4300, 1);
break;
case CURSOR_USE:
- if ((_globals->_inventory._stasisBox2._sceneNumber == 4300) ||
- (_globals->_inventory._concentrator._sceneNumber == 1))
+ if ((RING_INVENTORY._stasisBox2._sceneNumber == 4300) ||
+ (RING_INVENTORY._concentrator._sceneNumber == 1))
SceneItem::display2(4300, 7);
else
SceneItem::display2(4300, 3);
@@ -3791,8 +3850,8 @@ void Scene4300::Hotspot9::doAction(int action) {
SceneItem::display2(4300, 24);
break;
case OBJECT_SCANNER:
- if ((_globals->_inventory._stasisBox2._sceneNumber == 4300) ||
- (_globals->_inventory._concentrator._sceneNumber != 1))
+ if ((RING_INVENTORY._stasisBox2._sceneNumber == 4300) ||
+ (RING_INVENTORY._concentrator._sceneNumber != 1))
SceneItem::display2(4300, 22);
else
SceneItem::display2(4300, 23);
@@ -3804,6 +3863,7 @@ void Scene4300::Hotspot9::doAction(int action) {
}
void Scene4300::Hotspot10::doAction(int action) {
+ // Alien
Scene4300 *scene = (Scene4300 *)_globals->_sceneManager._scene;
switch (action) {
@@ -3838,8 +3898,8 @@ void Scene4300::Hotspot15::signal() {
scene->_soundHandler2.startSound(345);
_strip = (_globals->_randomSource.getRandomNumber(6) < 2) ? 2 : 1;
- if ((_globals->_inventory._stasisBox2._sceneNumber == 4300) ||
- (_globals->_inventory._concentrator._sceneNumber == 1)) {
+ if ((RING_INVENTORY._stasisBox2._sceneNumber == 4300) ||
+ (RING_INVENTORY._concentrator._sceneNumber == 1)) {
setStrip(1);
setFrame(1);
animate(ANIM_MODE_NONE, NULL);
@@ -3856,8 +3916,8 @@ void Scene4300::Hotspot16::doAction(int action) {
SceneItem::display2(4300, 8);
break;
case CURSOR_USE:
- if ((_globals->_inventory._stasisBox2._sceneNumber != 4300) &&
- (_globals->_inventory._concentrator._sceneNumber != 4300)) {
+ if ((RING_INVENTORY._stasisBox2._sceneNumber != 4300) &&
+ (RING_INVENTORY._concentrator._sceneNumber != 4300)) {
SceneItem::display2(4300, 16);
} else {
scene->_sceneMode = 4302;
@@ -3881,17 +3941,17 @@ void Scene4300::Hotspot17::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- SceneItem::display2(4300, (_globals->_inventory._stasisBox2._sceneNumber == 4300) ? 17 : 11);
+ SceneItem::display2(4300, (RING_INVENTORY._stasisBox2._sceneNumber == 4300) ? 17 : 11);
break;
case CURSOR_USE:
- if (_globals->_inventory._stasisBox2._sceneNumber != 4300)
+ if (RING_INVENTORY._stasisBox2._sceneNumber != 4300)
SceneItem::display2(4300, 13);
else {
_globals->_scenePalette.clearListeners();
remove();
SceneItem::display2(4300, 12);
- _globals->_inventory._concentrator._sceneNumber = 1;
+ RING_INVENTORY._concentrator._sceneNumber = 1;
}
break;
case OBJECT_SCANNER:
@@ -3922,8 +3982,8 @@ void Scene4300::Hotspot19::doAction(int action) {
SceneItem::display2(4300, 24);
break;
case CURSOR_USE:
- if ((_globals->_inventory._stasisBox2._sceneNumber != 4300) &&
- (_globals->_inventory._concentrator._sceneNumber != 4300))
+ if ((RING_INVENTORY._stasisBox2._sceneNumber != 4300) &&
+ (RING_INVENTORY._concentrator._sceneNumber != 4300))
SceneItem::display2(4300, 10);
else
SceneItem::display2(4300, 29);
@@ -3955,7 +4015,7 @@ void Scene4300::postInit(SceneObjectList *OwnerList) {
_hotspot7.postInit();
_hotspot7.setPosition(Common::Point(90, 128));
_hotspot7.setVisage(4303);
- _hotspot7.setPriority2(250);
+ _hotspot7.fixPriority(250);
_globals->_sceneItems.push_back(&_hotspot7);
_hotspot9.setup(120, 49, 174, 91, 4300, -1, -1);
@@ -3973,14 +4033,14 @@ void Scene4300::postInit(SceneObjectList *OwnerList) {
_globals->_sceneItems.push_back(&_hotspot8);
}
- if (_globals->_inventory._concentrator._sceneNumber == 4300) {
+ if (RING_INVENTORY._concentrator._sceneNumber == 4300) {
_hotspot17.postInit();
_hotspot17.setVisage(4300);
_hotspot17.setStrip(6);
- _hotspot17.setPriority2(1);
+ _hotspot17.fixPriority(1);
_hotspot17.setPosition(Common::Point(200, 69));
- if (_globals->_inventory._stasisBox2._sceneNumber == 4300)
+ if (RING_INVENTORY._stasisBox2._sceneNumber == 4300)
_hotspot17.setFrame(_hotspot17.getFrameCount());
_globals->_sceneItems.push_back(&_hotspot17);
@@ -3990,14 +4050,14 @@ void Scene4300::postInit(SceneObjectList *OwnerList) {
_hotspot10.postInit();
_hotspot10.setVisage(4302);
_hotspot10.setPosition(Common::Point(244, 179));
- _hotspot10.setPriority2(100);
+ _hotspot10.fixPriority(100);
_globals->_sceneItems.push_back(&_hotspot10);
_hotspot12.postInit();
_hotspot12.setVisage(4302);
_hotspot12.setStrip2(3);
_hotspot12.setPosition(Common::Point(231, 185));
- _hotspot12.setPriority2(251);
+ _hotspot12.fixPriority(251);
_hotspot12.hide();
_hotspot13.postInit();
@@ -4005,16 +4065,16 @@ void Scene4300::postInit(SceneObjectList *OwnerList) {
_hotspot13.setVisage(4302);
_hotspot13.setStrip2(2);
_hotspot13.setPosition(Common::Point(256, 168));
- _hotspot13.setPriority2(251);
+ _hotspot13.fixPriority(251);
_hotspot13._numFrames = 1;
_hotspot13.animate(ANIM_MODE_8, 0, NULL);
}
- if (_globals->_inventory._items._sceneNumber == 4300) {
+ if (RING_INVENTORY._items._sceneNumber == 4300) {
_hotspot16.postInit();
_hotspot16.setVisage(4300);
_hotspot16.setPosition(Common::Point(169, 141));
- _hotspot16.setPriority2(1);
+ _hotspot16.fixPriority(1);
_hotspot16.setStrip(4);
_globals->_sceneItems.push_back(&_hotspot16);
}
@@ -4025,37 +4085,37 @@ void Scene4300::postInit(SceneObjectList *OwnerList) {
_hotspot1.postInit();
_hotspot1.setVisage(4301);
- _hotspot1.setPriority2(145);
+ _hotspot1.fixPriority(145);
_hotspot1.setPosition(Common::Point(160, 64));
_hotspot2.postInit();
_hotspot2.setVisage(4301);
_hotspot2.setStrip2(2);
- _hotspot2.setPriority2(140);
+ _hotspot2.fixPriority(140);
_hotspot2.setPosition(Common::Point(166, 90));
_hotspot3.postInit();
_hotspot3.setVisage(4301);
_hotspot3.setStrip2(3);
- _hotspot3.setPriority2(135);
+ _hotspot3.fixPriority(135);
_hotspot3.setPosition(Common::Point(173, 114));
_hotspot4.postInit();
_hotspot4.setVisage(4301);
_hotspot4.setStrip2(4);
- _hotspot4.setPriority2(130);
+ _hotspot4.fixPriority(130);
_hotspot4.setPosition(Common::Point(187, 141));
_hotspot5.postInit();
_hotspot5.setVisage(4301);
_hotspot5.setStrip2(5);
- _hotspot5.setPriority2(125);
+ _hotspot5.fixPriority(125);
_hotspot5.setPosition(Common::Point(201, 164));
_hotspot6.postInit();
_hotspot6.setVisage(4301);
_hotspot6.setStrip2(6);
- _hotspot6.setPriority2(120);
+ _hotspot6.fixPriority(120);
_hotspot6.setPosition(Common::Point(219, 186));
setAction(&_action1);
@@ -4091,12 +4151,12 @@ void Scene4300::remove() {
void Scene4300::signal() {
switch (_sceneMode) {
case 4302:
- _globals->_inventory._items._sceneNumber = 1;
+ RING_INVENTORY._items._sceneNumber = 1;
_hotspot16.remove();
_globals->_player.enableControl();
break;
case 4303:
- _globals->_inventory._stasisBox2._sceneNumber = 4300;
+ RING_INVENTORY._stasisBox2._sceneNumber = 4300;
_hotspot15.setStrip(1);
_hotspot15.setFrame(1);
_hotspot15.animate(ANIM_MODE_NONE, NULL);
@@ -4108,7 +4168,7 @@ void Scene4300::signal() {
_hotspot14.setPosition(Common::Point(60, 199));
_gfxButton.setText(EXIT_MSG);
- _gfxButton._bounds.centre(60, 193);
+ _gfxButton._bounds.center(60, 193);
_gfxButton.draw();
_gfxButton._bounds.expandPanes();
@@ -4134,8 +4194,8 @@ void Scene4300::process(Event &event) {
*
*--------------------------------------------------------------------------*/
-void Scene4301::Action1::synchronise(Serialiser &s) {
- Action::synchronise(s);
+void Scene4301::Action1::synchronize(Serializer &s) {
+ Action::synchronize(s);
s.syncAsSint16LE(_field34E);
for (int idx = 0; idx < 6; ++idx)
s.syncAsSint16LE(_indexList[idx]);
@@ -4172,14 +4232,14 @@ void Scene4301::Action1::signal() {
scene->_hotspot2.setStrip(2);
scene->_hotspot2.setFrame(1);
scene->_hotspot2.setPosition(Common::Point(30, 15));
- scene->_hotspot2.setPriority2(255);
+ scene->_hotspot2.fixPriority(255);
scene->_hotspot3.postInit();
scene->_hotspot3.setVisage(4303);
scene->_hotspot3.setStrip(2);
scene->_hotspot3.setFrame(2);
scene->_hotspot3.setPosition(Common::Point(48, 29));
- scene->_hotspot3.setPriority2(255);
+ scene->_hotspot3.fixPriority(255);
scene->_hotspot3.hide();
_field34E = 0;
@@ -4187,6 +4247,7 @@ void Scene4301::Action1::signal() {
_actionIndex = 2;
break;
case 10:
+ // Puzzle: Wrong code
_globals->_events.setCursor(CURSOR_NONE);
scene->_soundHandler.startSound(337);
if (scene->_hotspot3._flags & OBJFLAG_HIDE)
@@ -4211,6 +4272,7 @@ void Scene4301::Action1::signal() {
_globals->_events.setCursor(CURSOR_USE);
break;
case 20:
+ // Puzzle: Correct code
_globals->_player.disableControl();
scene->_soundHandler.startSound(339);
scene->_hotspot3._frame = 3;
@@ -4233,6 +4295,7 @@ void Scene4301::Action1::signal() {
}
void Scene4301::Action1::process(Event &event) {
+ // Puzzle
Scene4301 *scene = (Scene4301 *)_globals->_sceneManager._scene;
Rect buttonsRect;
@@ -4255,7 +4318,7 @@ void Scene4301::Action1::process(Event &event) {
_buttonList[_state].setStrip(buttonIndex + 3);
_buttonList[_state].setFrame(1);
_buttonList[_state].setPosition(Common::Point((_state % 3) * 25 + 55, (_state / 3) * 25 + 121));
- _buttonList[_state].setPriority2(255);
+ _buttonList[_state].fixPriority(255);
_buttonList[_state]._numFrames = 25;
_buttonList[_state].animate(ANIM_MODE_5, NULL);
@@ -4287,6 +4350,7 @@ void Scene4301::Action1::process(Event &event) {
/*--------------------------------------------------------------------------*/
void Scene4301::Hotspot4::doAction(int action) {
+ // Hatch near door
Scene4301 *scene = (Scene4301 *)_globals->_sceneManager._scene;
if (action == CURSOR_USE) {
@@ -4303,7 +4367,7 @@ void Scene4301::Hotspot5::doAction(int action) {
SceneItem::display2(4300, 0);
break;
case CURSOR_USE:
- SceneItem::display(4300, 30);
+ SceneItem::display2(4300, 30);
break;
case OBJECT_SCANNER:
SceneItem::display2(4300, 31);
@@ -4326,15 +4390,15 @@ void Scene4301::postInit(SceneObjectList *OwnerList) {
setZoomPercents(0, 100, 200, 100);
_field68E = false;
- _globals->_inventory._stasisBox2._sceneNumber = 1;
- _hotspot4.setup(76, 97, 102, 127, 4300, 5, 6);
+ RING_INVENTORY._stasisBox2._sceneNumber = 1;
+ _hotspot4.setup(97, 76, 127, 102, 4300, 5, 6);
_hotspot1.postInit();
_hotspot1.setPosition(Common::Point(90, 128));
_hotspot1.setVisage(4303);
_hotspot1._strip = 1;
_hotspot1._frame = 1;
- _hotspot1.setPriority2(250);
+ _hotspot1.fixPriority(250);
_hotspot5.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
_globals->_sceneItems.push_back(&_hotspot5);
diff --git a/engines/tsage/ringworld_scenes5.h b/engines/tsage/ringworld_scenes5.h
index 0def49ebe6..6c44395f9c 100644
--- a/engines/tsage/ringworld_scenes5.h
+++ b/engines/tsage/ringworld_scenes5.h
@@ -89,7 +89,7 @@ class Scene4000 : public Scene {
};
/* Hotspots */
- class Hotspot7 : public SceneObject {
+ class Miranda : public SceneObject {
public:
virtual void doAction(int action);
};
@@ -97,21 +97,21 @@ class Scene4000 : public Scene {
private:
int _ctr;
public:
- virtual void synchronise(Serialiser &s) {
- SceneObject::synchronise(s);
+ virtual void synchronize(Serializer &s) {
+ SceneObject::synchronize(s);
s.syncAsUint16LE(_ctr);
}
virtual void doAction(int action);
};
- class Hotspot9 : public SceneObject {
+ class GuardRock : public SceneObject {
public:
virtual void doAction(int action);
};
- class Hotspot10 : public SceneObject {
+ class Ladder : public SceneObject {
public:
virtual void doAction(int action);
};
- class Hotspot12 : public SceneObject {
+ class TheTech : public SceneObject {
public:
virtual void doAction(int action);
};
@@ -151,13 +151,13 @@ public:
SpeakerCHFR _speakerCHFR;
SpeakerQL _speakerQL;
SpeakerCHFText _speakerCHFText;
- SceneObject _hotspot1, _hotspot2, _hotspot3, _hotspot4, _hotspot5, _hotspot6;
- Hotspot7 _hotspot7;
+ SceneObject _smoke1, _hotspot2, _lander, _olo, _hotspot5, _rope;
+ Miranda _miranda;
Hotspot8 _hotspot8;
- Hotspot9 _hotspot9;
- Hotspot10 _hotspot10;
- DisplayHotspot _hotspot11;
- Hotspot12 _hotspot12;
+ GuardRock _guardRock;
+ Ladder _ladder;
+ DisplayHotspot _forceField;
+ TheTech _theTech;
Hotspot13 _hotspot13;
Hotspot _hotspot14, _hotspot15, _hotspot16;
Hotspot17 _hotspot17;
@@ -165,7 +165,7 @@ public:
DisplayHotspot _hotspot19, _hotspot20, _hotspot21, _hotspot22;
Hotspot23 _hotspot23;
DisplayHotspot _hotspot24, _hotspot25, _hotspot26;
- SceneObject _hotspot27;
+ SceneObject _smoke2;
Action1 _action1;
Action2 _action2;
Action3 _action3;
@@ -208,7 +208,7 @@ class Scene4025 : public Scene {
int _armStrip;
Common::Point _newPosition;
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual void doAction(int action);
};
class Peg : public SceneObject {
@@ -217,7 +217,7 @@ class Scene4025 : public Scene {
int _armStrip;
Peg() : SceneObject() { _field88 = 0; _armStrip = 3; }
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual void doAction(int action);
};
@@ -248,7 +248,7 @@ public:
Scene4025();
virtual void postInit(SceneObjectList *OwnerList = NULL);
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual void remove();
virtual void signal();
virtual void process(Event &event);
@@ -271,15 +271,15 @@ class Scene4045 : public Scene {
};
/* Hotspots */
- class Hotspot1 : public SceneObject {
+ class OlloStand : public SceneObject {
public:
virtual void doAction(int action);
};
- class Hotspot2 : public SceneObject {
+ class Miranda : public SceneObject {
public:
virtual void doAction(int action);
};
- class Hotspot6 : public SceneObject {
+ class Necklace : public SceneObject {
public:
virtual void doAction(int action);
};
@@ -292,11 +292,11 @@ public:
SpeakerPText _speakerPText;
SpeakerQText _speakerQText;
SpeakerQL _speakerQL;
- Hotspot1 _hotspot1;
- Hotspot2 _hotspot2;
- DisplayHotspot _hotspot3;
- SceneObject _hotspot4, _hotspot5;
- Hotspot6 _hotspot6;
+ OlloStand _olloStand;
+ Miranda _miranda;
+ DisplayHotspot _flame;
+ SceneObject _hotspot4, _olloFace;
+ Necklace _necklace;
DisplayHotspot _hotspot7, _hotspot8, _hotspot9, _hotspot10;
DisplayHotspot _hotspot11, _hotspot12, _hotspot13, _hotspot14;
Action1 _action1;
@@ -330,7 +330,7 @@ class Scene4050 : public Scene {
};
/* Hotspots */
- class Hotspot14 : public SceneObject {
+ class Hotspot15 : public SceneObject {
public:
virtual void doAction(int action);
};
@@ -349,8 +349,9 @@ public:
DisplayHotspot _hotspot1, _hotspot2, _hotspot3, _hotspot4, _hotspot5;
DisplayHotspot _hotspot6, _hotspot7, _hotspot8, _hotspot9, _hotspot10;
DisplayHotspot _hotspot11, _hotspot12, _hotspot13;
- Hotspot14 _hotspot14;
- SceneObject _hotspot15, _hotspot16;
+ SceneObject _hotspot14;
+ Hotspot15 _hotspot15;
+ SceneObject _hotspot16;
Hotspot17 _hotspot17;
Scene4050();
@@ -395,11 +396,11 @@ class Scene4100 : public Scene {
public:
virtual void doAction(int action);
};
- class Hotspot5 : public SceneObject {
+ class Miranda : public SceneObject {
public:
virtual void doAction(int action);
};
- class Hotspot6 : public SceneObject {
+ class Ladder : public SceneObject {
public:
virtual void doAction(int action);
};
@@ -425,8 +426,8 @@ public:
Hotspot1 _hotspot1;
Hotspot2 _hotspot2;
DisplayHotspot _hotspot3, _hotspot4;
- Hotspot5 _hotspot5;
- Hotspot6 _hotspot6;
+ Miranda _miranda;
+ Ladder _ladder;
DisplayHotspot _hotspot7, _hotspot8, _hotspot9, _hotspot10;
DisplayHotspot _hotspot11, _hotspot12, _hotspot13;
Hotspot14 _hotspot14;
@@ -655,7 +656,7 @@ class Scene4301 : public Scene {
int _field34E;
int _indexList[6];
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual void remove();
virtual void signal();
virtual void process(Event &event);
@@ -683,8 +684,8 @@ public:
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void dispatch();
- virtual void synchronise(Serialiser &s) {
- Scene::synchronise(s);
+ virtual void synchronize(Serializer &s) {
+ Scene::synchronize(s);
s.syncAsSint16LE(_field68E);
}
};
diff --git a/engines/tsage/ringworld_scenes6.cpp b/engines/tsage/ringworld_scenes6.cpp
index 3ea4d7b279..973104a952 100644
--- a/engines/tsage/ringworld_scenes6.cpp
+++ b/engines/tsage/ringworld_scenes6.cpp
@@ -36,6 +36,7 @@ namespace tSage {
*--------------------------------------------------------------------------*/
void Scene5000::Action1::signal() {
+ // Ship landing
Scene5000 *scene = (Scene5000 *)_globals->_sceneManager._scene;
switch (_actionIndex++) {
@@ -127,7 +128,7 @@ void Scene5000::Action2::signal() {
case 2:
if (!_globals->getFlag(59))
setAction(&scene->_action3, this);
- _globals->_player.setPriority2(15);
+ _globals->_player.fixPriority(15);
ADD_MOVER(_globals->_player, 208, 100);
break;
case 3:
@@ -145,7 +146,7 @@ void Scene5000::Action2::signal() {
break;
case 7:
_globals->_player.changeZoom(-1);
- _globals->_player.setPriority2(35);
+ _globals->_player.fixPriority(35);
ADD_MOVER(_globals->_player, 201, 166);
break;
case 8:
@@ -154,7 +155,7 @@ void Scene5000::Action2::signal() {
break;
case 9:
_globals->_player.changeZoom(-1);
- _globals->_player.setPriority2(50);
+ _globals->_player.fixPriority(50);
ADD_MOVER(_globals->_player, 220, 182);
break;
case 10:
@@ -164,7 +165,7 @@ void Scene5000::Action2::signal() {
case 11:
_globals->_player.changeZoom(-1);
_globals->_player.setStrip2(-1);
- _globals->_player.setPriority2(-1);
+ _globals->_player.fixPriority(-1);
ADD_MOVER(_globals->_player, 208, 175);
break;
case 12:
@@ -200,7 +201,7 @@ void Scene5000::Action3::signal() {
scene->_hotspot7.setPosition(Common::Point(217, 76));
scene->_hotspot7.changeZoom(10);
scene->_hotspot7.setStrip2(3);
- scene->_hotspot7.setPriority2(200);
+ scene->_hotspot7.fixPriority(200);
scene->_hotspot7._moveDiff.y = 2;
scene->_hotspot7.animate(ANIM_MODE_1, NULL);
ADD_MOVER(scene->_hotspot7, 214, 89);
@@ -209,14 +210,14 @@ void Scene5000::Action3::signal() {
break;
case 2:
scene->_hotspot7.changeZoom(-1);
- scene->_hotspot7.setPriority2(14);
+ scene->_hotspot7.fixPriority(14);
ADD_MOVER(scene->_hotspot7, 208, 100);
break;
case 3:
ADD_MOVER(scene->_hotspot7, 213, 98);
break;
case 4:
- scene->_hotspot7.setPriority2(19);
+ scene->_hotspot7.fixPriority(19);
ADD_MOVER(scene->_hotspot7, 213, 98);
break;
case 5:
@@ -228,7 +229,7 @@ void Scene5000::Action3::signal() {
break;
case 7:
scene->_hotspot7.changeZoom(-1);
- scene->_hotspot7.setPriority2(34);
+ scene->_hotspot7.fixPriority(34);
ADD_MOVER(scene->_hotspot7, 201, 166);
break;
case 8:
@@ -237,7 +238,7 @@ void Scene5000::Action3::signal() {
break;
case 9:
scene->_hotspot7.changeZoom(-1);
- scene->_hotspot7.setPriority2(49);
+ scene->_hotspot7.fixPriority(49);
ADD_MOVER(scene->_hotspot7, 210, 182);
break;
case 10:
@@ -247,7 +248,7 @@ void Scene5000::Action3::signal() {
case 11:
scene->_hotspot7.changeZoom(-1);
scene->_hotspot7.setStrip2(-1);
- scene->_hotspot7.setPriority2(-1);
+ scene->_hotspot7.fixPriority(-1);
ADD_MOVER(scene->_hotspot7, 175, 166);
break;
case 12:
@@ -268,7 +269,7 @@ void Scene5000::Action4::signal() {
setDelay(1);
break;
case 1:
- _globals->_player.setPriority2(50);
+ _globals->_player.fixPriority(50);
_globals->_player.setStrip2(4);
ADD_MOVER(_globals->_player, 210, 182);
break;
@@ -276,14 +277,14 @@ void Scene5000::Action4::signal() {
ADD_MOVER(_globals->_player, 205, 146);
break;
case 3:
- _globals->_player.setPriority2(35);
+ _globals->_player.fixPriority(35);
ADD_MOVER(_globals->_player, 201, 166);
break;
case 4:
ADD_MOVER(_globals->_player, 229, 115);
break;
case 5:
- _globals->_player.setPriority2(20);
+ _globals->_player.fixPriority(20);
_globals->_player.changeZoom(47);
ADD_MOVER(_globals->_player, 220, 125);
break;
@@ -295,7 +296,7 @@ void Scene5000::Action4::signal() {
ADD_MOVER(_globals->_player, 213, 98);
break;
case 8:
- _globals->_player.setPriority2(15);
+ _globals->_player.fixPriority(15);
ADD_MOVER(_globals->_player, 208, 100);
break;
case 9:
@@ -345,6 +346,7 @@ void Scene5000::Action5::signal() {
}
void Scene5000::Action6::signal() {
+ // Discussion between the hero and Seeker, then the hero goes back to the lander
Scene5000 *scene = (Scene5000 *)_globals->_sceneManager._scene;
switch (_actionIndex++) {
@@ -364,7 +366,7 @@ void Scene5000::Action6::signal() {
ADD_PLAYER_MOVER(208, 163);
break;
case 4:
- _globals->_player.setPriority2(50);
+ _globals->_player.fixPriority(50);
_globals->_player.setStrip2(4);
ADD_MOVER(_globals->_player, 210, 182);
break;
@@ -384,7 +386,7 @@ void Scene5000::Hotspot7::doAction(int action) {
SceneItem::display2(5000, 12);
break;
case CURSOR_TALK:
- setAction(&scene->_action6);
+ scene->setAction(&scene->_action6);
break;
default:
SceneHotspot::doAction(action);
@@ -393,6 +395,7 @@ void Scene5000::Hotspot7::doAction(int action) {
}
void Scene5000::Hotspot8::doAction(int action) {
+ // Cave
Scene5000 *scene = (Scene5000 *)_globals->_sceneManager._scene;
switch (action) {
@@ -403,7 +406,7 @@ void Scene5000::Hotspot8::doAction(int action) {
SceneItem::display2(5000, 14);
break;
case OBJECT_SCANNER:
- setAction(&scene->_action5);
+ scene->setAction(&scene->_action5);
break;
default:
SceneHotspot::doAction(action);
@@ -455,14 +458,14 @@ void Scene5000::postInit(SceneObjectList *OwnerList) {
_hotspot1.setVisage(5001);
_hotspot1.setFrame2(1);
_hotspot1._moveDiff = Common::Point(5, 5);
- _hotspot1.setPriority2(10);
+ _hotspot1.fixPriority(10);
_hotspot1.changeZoom(10);
_hotspot4.postInit();
_hotspot4.setVisage(5001);
_hotspot4.setStrip2(2);
_hotspot4._moveDiff = Common::Point(5, 1);
- _hotspot4.setPriority2(10);
+ _hotspot4.fixPriority(10);
_hotspot4.changeZoom(100);
_hotspot4.animate(ANIM_MODE_8, 0, NULL);
_hotspot4.hide();
@@ -484,13 +487,13 @@ void Scene5000::postInit(SceneObjectList *OwnerList) {
_hotspot5.setVisage(5001);
_hotspot5.setStrip2(4);
_hotspot5._numFrames = 5;
- _hotspot5.setPriority2(15);
+ _hotspot5.fixPriority(15);
_hotspot5.setPosition(Common::Point(218, 76));
_hotspot5.hide();
_hotspot9.postInit();
_hotspot9.setVisage(5002);
- _hotspot9.setPriority2(80);
+ _hotspot9.fixPriority(80);
_hotspot9.setPosition(Common::Point(71, 174));
_hotspot10.postInit();
@@ -512,7 +515,7 @@ void Scene5000::postInit(SceneObjectList *OwnerList) {
_hotspot13.setBounds(Rect(0, 164, 135, 200));
_hotspot14.setBounds(Rect(0, 0, 105, 140));
_hotspot15.setBounds(Rect(266, 70, 291, 85));
- _hotspot16.setBounds(Rect(0, 86, 3219, 200));
+ _hotspot16.setBounds(Rect(0, 86, 319, 200));
_hotspot12.setBounds(Rect(230, 143, 244, 150));
_globals->_sceneItems.addItems(&_hotspot9, &_hotspot10, &_hotspot11, &_hotspot8, &_hotspot13,
@@ -644,7 +647,7 @@ void Scene5100::Action1::signal() {
scene->_hotspot5.setPosition(Common::Point(1160, 34));
scene->_hotspot5.setStrip2(2);
scene->_hotspot5.animate(ANIM_MODE_1, NULL);
- scene->_hotspot5.setPriority2(10);
+ scene->_hotspot5.fixPriority(10);
_globals->_sceneItems.push_front(&scene->_hotspot5);
ADD_MOVER(scene->_hotspot5, 999, 14);
@@ -689,9 +692,9 @@ void Scene5100::Action2::signal() {
break;
case 3:
if (_globals->_player._position.x >= 966) {
- ADD_PLAYER_MOVER(1215, 155);
+ ADD_PLAYER_MOVER_NULL(scene->_hotspot8, 1215, 155);
} else {
- ADD_PLAYER_MOVER_THIS(scene->_hotspot8, 966, 185);
+ ADD_PLAYER_MOVER_NULL(scene->_hotspot8, 966, 185);
}
if (_globals->_player._position.x >= 966) {
@@ -701,7 +704,7 @@ void Scene5100::Action2::signal() {
}
break;
case 4:
- ADD_PLAYER_MOVER_THIS(scene->_hotspot8, 1215, 155);
+ ADD_PLAYER_MOVER_NULL(scene->_hotspot8, 1215, 155);
ADD_PLAYER_MOVER(1215, 155);
break;
case 5:
@@ -829,6 +832,7 @@ void Scene5100::Action5::signal() {
/*--------------------------------------------------------------------------*/
void Scene5100::HotspotGroup1::doAction(int action) {
+ // Flesh Eaters
Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene;
switch (action) {
@@ -881,11 +885,12 @@ void Scene5100::Hotspot4::doAction(int action) {
}
void Scene5100::HotspotGroup2::doAction(int action) {
+ // Bat
Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
- SceneItem::display2(5100, _globals->getFlag(62) ? 47 : 23);
+ SceneItem::display2(5100, _globals->getFlag(108) ? 47 : 23);
break;
case CURSOR_USE:
SceneItem::display2(5100, 29);
@@ -909,6 +914,7 @@ void Scene5100::HotspotGroup2::doAction(int action) {
}
void Scene5100::Hotspot9::doAction(int action) {
+ // Rope
Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene;
switch (action) {
@@ -929,7 +935,7 @@ void Scene5100::Hotspot9::doAction(int action) {
case OBJECT_BONE:
_globals->_player.disableControl();
scene->_sceneMode = 5116;
- scene->setAction(&scene->_sequenceManager, scene, 5116, &_globals->_player, &scene->_hotspot10,
+ scene->setAction(&scene->_sequenceManager, scene, 5116, &_globals->_player, this, &scene->_hotspot10,
&scene->_hotspot4, NULL);
break;
default:
@@ -1004,6 +1010,7 @@ void Scene5100::Hotspot18::doAction(int action) {
}
void Scene5100::Hotspot19::doAction(int action) {
+ // Pillar
Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene;
switch (action) {
@@ -1082,14 +1089,14 @@ void Scene5100::postInit(SceneObjectList *OwnerList) {
_hotspot14.postInit();
_hotspot14.setVisage(5101);
_hotspot14.setPosition(Common::Point(498, 147));
- _hotspot14.setPriority2(200);
+ _hotspot14.fixPriority(200);
_hotspot14._moveDiff.y = 10;
}
_hotspot17.postInit();
_hotspot17.setVisage(5101);
_hotspot17._strip = 2;
- _hotspot17.setPriority2(200);
+ _hotspot17.fixPriority(200);
if (_globals->getFlag(67))
_hotspot17.setPosition(Common::Point(554, 192));
@@ -1158,7 +1165,7 @@ void Scene5100::postInit(SceneObjectList *OwnerList) {
}
}
- if (_globals->getFlag(60) && (_globals->_inventory._stasisBox._sceneNumber == 1) &&
+ if (_globals->getFlag(60) && (RING_INVENTORY._stasisBox._sceneNumber == 1) &&
_globals->getFlag(107) && _globals->getFlag(67)) {
_hotspot8.postInit();
_hotspot8.setVisage(2806);
@@ -1178,7 +1185,7 @@ void Scene5100::postInit(SceneObjectList *OwnerList) {
case 5200:
if (_globals->_stripNum == 5200) {
_globals->_player.setVisage(5101);
- _globals->_player.setPriority2(200);
+ _globals->_player.fixPriority(200);
_globals->_player.setStrip(5);
_globals->_player.setFrame(1);
_globals->_player.setPosition(Common::Point(513, 199));
@@ -1227,7 +1234,7 @@ void Scene5100::postInit(SceneObjectList *OwnerList) {
_globals->_player.setVisage(5101);
_globals->_player.setStrip(6);
- _globals->_player.setPriority2(170);
+ _globals->_player.fixPriority(170);
_globals->_player.setPosition(Common::Point(1168, 110));
setAction(&_sequenceManager, this, 5111, &_globals->_player, NULL);
@@ -1256,11 +1263,11 @@ void Scene5100::postInit(SceneObjectList *OwnerList) {
_hotspot6.setStrip(6);
_hotspot6.setFrame(1);
_globals->_sceneItems.push_back(&_hotspot6);
- } else if (_globals->_inventory._vial._sceneNumber != 5100) {
+ } else if (RING_INVENTORY._vial._sceneNumber != 5100) {
_hotspot6.postInit();
_hotspot6.setVisage(5362);
_hotspot6.setPosition(Common::Point(1152, 70));
- _hotspot6.setPriority2(170);
+ _hotspot6.fixPriority(170);
_hotspot6.setStrip(6);
_hotspot6.setFrame(1);
_globals->_sceneItems.push_back(&_hotspot6);
@@ -1275,9 +1282,9 @@ void Scene5100::postInit(SceneObjectList *OwnerList) {
_hotspot15.setVisage(5140);
_hotspot15.setStrip(3);
_hotspot15.setPosition(Common::Point(977, 173));
- _hotspot15.setPriority2(1);
+ _hotspot15.fixPriority(1);
- _globals->_sceneManager._scene->_sceneBounds.centre(_globals->_player._position);
+ _globals->_sceneManager._scene->_sceneBounds.center(_globals->_player._position);
loadScene(5100);
_globals->_soundHandler.startSound(205);
}
@@ -1312,7 +1319,7 @@ void Scene5100::signal() {
case 5108:
if (!_globals->getFlag(60))
_globals->_player.enableControl();
- else if (_globals->_inventory._stasisBox._sceneNumber == 1)
+ else if (RING_INVENTORY._stasisBox._sceneNumber == 1)
setAction(&_action2);
else
setAction(&_action5);
@@ -1324,12 +1331,12 @@ void Scene5100::signal() {
break;
case 5111:
_globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.setVisage(6);
+ _globals->_player.setVisage(0);
_globals->_player.setStrip(6);
- _globals->_player.setPriority2(-1);
+ _globals->_player.fixPriority(-1);
_globals->_player.animate(ANIM_MODE_1, NULL);
- if ((_globals->_inventory._vial._sceneNumber != 5100) && !_globals->getFlag(108)) {
+ if ((RING_INVENTORY._vial._sceneNumber != 5100) && !_globals->getFlag(108)) {
_globals->setFlag(108);
_sceneMode = 5130;
_globals->_player.disableControl();
@@ -1344,14 +1351,14 @@ void Scene5100::signal() {
break;
case 5116:
_globals->setFlag(105);
- _globals->_inventory._bone._sceneNumber = 0;
+ RING_INVENTORY._bone._sceneNumber = 0;
_globals->_player.setObjectWrapper(new SceneObjectWrapper());
_globals->_player.setVisage(0);
_globals->_player.setStrip(6);
- _globals->_player.setPriority2(-1);
+ _globals->_player.fixPriority(-1);
_globals->_player.animate(ANIM_MODE_1, NULL);
- break;
+ // No break on purpose
case 5117:
_globals->_player.enableControl();
break;
@@ -1370,6 +1377,7 @@ void Scene5100::signal() {
}
void Scene5100::dispatch() {
+ // Flesheater trap
if (_hotspot15._bounds.contains(_globals->_player._position) && !_globals->_player._visage) {
_globals->_player.disableControl();
_globals->_player.addMover(NULL);
@@ -1388,7 +1396,7 @@ void Scene5100::dispatch() {
_sceneMode = 5150;
_soundHandler.startSound(208);
- if (_globals->_inventory._vial._sceneNumber == 5100) {
+ if (RING_INVENTORY._vial._sceneNumber == 5100) {
_globals->_player.addMover(NULL);
_globals->_player.disableControl();
SceneItem::display2(5100, 39);
@@ -1398,9 +1406,9 @@ void Scene5100::dispatch() {
_hotspot3.setStrip2(2);
ObjectMover3 *mover1 = new ObjectMover3();
- _hotspot2.addMover(mover1, 20, this);
+ _hotspot2.addMover(mover1, &_globals->_player, 20, this);
ObjectMover3 *mover2 = new ObjectMover3();
- _hotspot3.addMover(mover2, 20, this);
+ _hotspot3.addMover(mover2, &_globals->_player, 20, this);
}
if (!_action) {
@@ -1408,8 +1416,9 @@ void Scene5100::dispatch() {
_globals->_player._canWalk = false;
_globals->_player.addMover(NULL);
+ Common::Point pt(20, 25);
PlayerMover2 *mover = new PlayerMover2();
- _hotspot3.addMover(mover, 20, 25, &_globals->_player);
+ _hotspot3.addMover(mover, &pt, &_globals->_player);
setAction(&_action4);
}
@@ -1445,6 +1454,7 @@ void Scene5200::Action1::signal() {
}
void Scene5200::Action2::signal() {
+ // Quinn obtains the stasis box from the flesheater throne room
Scene5200 *scene = (Scene5200 *)_globals->_sceneManager._scene;
switch (_actionIndex++) {
@@ -1462,7 +1472,7 @@ void Scene5200::Action2::signal() {
scene->_soundHandler.proc3();
scene->_hotspot14.remove();
- _globals->_inventory._stasisBox._sceneNumber = 1;
+ RING_INVENTORY._stasisBox._sceneNumber = 1;
_globals->_player.animate(ANIM_MODE_5, this);
break;
case 3:
@@ -1489,6 +1499,7 @@ void Scene5200::Action2::signal() {
void Scene5200::Action3::signal() {
switch (_actionIndex++) {
+ case 0:
_globals->_player.disableControl();
setDelay(5);
break;
@@ -1563,7 +1574,7 @@ void Scene5200::Hotspot10::doAction(int action) {
}
break;
default:
- SceneItem::doAction(action);
+ SceneObject::doAction(action);
break;
}
}
@@ -1578,9 +1589,6 @@ void Scene5200::Hotspot14::doAction(int action) {
case CURSOR_USE:
scene->setAction(&scene->_action2);
break;
- default:
- SceneItem::doAction(action);
- break;
}
}
@@ -1611,7 +1619,7 @@ void Scene5200::postInit(SceneObjectList *OwnerList) {
_speakerFLText._textPos.x = 160;
_speakerQText._textPos.x = 20;
- if (_globals->_inventory._stasisBox._sceneNumber == 5200) {
+ if (RING_INVENTORY._stasisBox._sceneNumber == 5200) {
_soundHandler.startSound(216);
_soundHandler.proc5(true);
@@ -1619,17 +1627,20 @@ void Scene5200::postInit(SceneObjectList *OwnerList) {
_hotspot14.setVisage(5202);
_hotspot14._strip = 3;
_hotspot14.setPosition(Common::Point(105, 52));
- _hotspot14.setPriority2(90);
+ _hotspot14.fixPriority(90);
_hotspot8.postInit();
_hotspot8.setVisage(5202);
_hotspot8._strip = 1;
_hotspot8.setPosition(Common::Point(96, 53));
- _hotspot8.setPriority2(90);
+ _hotspot8.fixPriority(90);
_globals->_sceneItems.push_back(&_hotspot14);
}
- if (_globals->_stripNum == 1111) {
+ if (_globals->_stripNum == 5111) {
+ // Happens when the player enters the throne room via the secret passage,
+ // after talking with the bat. No NPCs are around and the player can
+ // obtain the stasis box.
_globals->_soundHandler.startSound(205);
_globals->_player.disableControl();
@@ -1644,6 +1655,7 @@ void Scene5200::postInit(SceneObjectList *OwnerList) {
setAction(&_action3);
} else {
+ // Happens when the player is captured by the flesh eaters the first time.
_globals->_player.postInit();
_globals->_player.setVisage(2640);
_globals->_player._strip = 1;
@@ -1665,7 +1677,7 @@ void Scene5200::postInit(SceneObjectList *OwnerList) {
_hotspot7.setVisage(5210);
_hotspot7._frame = 1;
_hotspot7._strip = 4;
- _hotspot7.setPriority2(168);
+ _hotspot7.fixPriority(168);
_hotspot7.setPosition(Common::Point(186, 106));
_hotspot1.postInit();
@@ -1677,20 +1689,20 @@ void Scene5200::postInit(SceneObjectList *OwnerList) {
_hotspot2.setVisage(5212);
_hotspot2._strip = 3;
_hotspot2.setPosition(Common::Point(148, 141));
- _hotspot2.setPriority2(90);
+ _hotspot2.fixPriority(90);
_hotspot3.postInit();
_hotspot3.setVisage(5212);
_hotspot3._strip = 2;
_hotspot3.setPosition(Common::Point(62, 109));
- _hotspot3.setPriority2(138);
+ _hotspot3.fixPriority(138);
_hotspot3.setAction(&_action1);
_hotspot4.postInit();
_hotspot4.setVisage(5212);
_hotspot4._strip = 4;
_hotspot4.setPosition(Common::Point(146, 110));
- _hotspot4.setPriority2(90);
+ _hotspot4.fixPriority(90);
_globals->_player.disableControl();
_globals->setFlag(61);
@@ -1701,9 +1713,11 @@ void Scene5200::postInit(SceneObjectList *OwnerList) {
_hotspot11.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
_hotspot9._sceneRegionId = 11;
_hotspot10._sceneRegionId = 9;
+ _hotspot12._sceneRegionId = 10;
+ _hotspot13._sceneRegionId = 8;
_globals->_sceneItems.addItems(&_hotspot12, &_hotspot13, &_hotspot9, &_hotspot10, &_hotspot11, NULL);
- _globals->_sceneManager._scene->_sceneBounds.centre(_globals->_player._position);
+ _globals->_sceneManager._scene->_sceneBounds.center(_globals->_player._position);
loadScene(5200);
}
@@ -1754,7 +1768,7 @@ void Scene5300::Action1::signal() {
ADD_MOVER(_globals->_player, 85, 170);
break;
case 3:
- scene->_hotspot2.setPriority2(-1);
+ scene->_hotspot2.fixPriority(-1);
_globals->_player.checkAngle(&scene->_hotspot2);
setAction(&scene->_sequenceManager, this, 5305, &scene->_hotspot2, NULL);
break;
@@ -1762,7 +1776,7 @@ void Scene5300::Action1::signal() {
scene->_stripManager.start(5316, this);
break;
case 5:
- if (!_globals->getFlag(106) || !_globals->getFlag(107) || (_globals->_inventory._stasisBox._sceneNumber != 1)) {
+ if (!_globals->getFlag(106) || !_globals->getFlag(107) || (RING_INVENTORY._stasisBox._sceneNumber != 1)) {
_globals->_player.enableControl();
remove();
} else {
@@ -1793,7 +1807,7 @@ void Scene5300::Action2::signal() {
scene->_stripManager.start(5328, this);
break;
case 2:
- if (_globals->_inventory._stasisBox._sceneNumber == 1) {
+ if (RING_INVENTORY._stasisBox._sceneNumber == 1) {
_globals->_stripNum = 5303;
setDelay(5);
} else {
@@ -1871,7 +1885,7 @@ void Scene5300::Hotspot2::doAction(int action) {
} else {
_globals->_player.disableControl();
- if (_globals->_inventory._stasisBox._sceneNumber != 1) {
+ if (RING_INVENTORY._stasisBox._sceneNumber != 1) {
scene->setAction(&scene->_sequenceManager, scene, 5316, NULL);
} else {
_globals->setFlag(60);
@@ -1898,7 +1912,7 @@ void Scene5300::Hotspot2::doAction(int action) {
if (_globals->getFlag(107)) {
SceneItem::display2(5300, 8);
} else {
- _globals->_inventory._vial._sceneNumber = 5300;
+ RING_INVENTORY._vial._sceneNumber = 5300;
_globals->setFlag(107);
_globals->_player.disableControl();
scene->_sceneMode = 5304;
@@ -1920,7 +1934,7 @@ void Scene5300::Hotspot5::doAction(int action) {
SceneItem::display2(5300, 27);
break;
case CURSOR_USE:
- _globals->_inventory._bone._sceneNumber = 1;
+ RING_INVENTORY._bone._sceneNumber = 1;
_globals->_player.disableControl();
scene->_sceneMode = 5309;
@@ -1933,24 +1947,25 @@ void Scene5300::Hotspot5::doAction(int action) {
}
void Scene5300::Hotspot6::doAction(int action) {
+ // Left Hole
Scene5300 *scene = (Scene5300 *)_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
- if (!_globals->getFlag(105) || (_globals->_inventory._vial._sceneNumber == 1))
+ if (!_globals->getFlag(105) || (RING_INVENTORY._vial._sceneNumber == 1))
SceneItem::display2(5300, 4);
else
SceneItem::display2(5300, 26);
break;
case CURSOR_USE:
- if (!_globals->getFlag(105) || (_globals->_inventory._vial._sceneNumber != 5100)) {
+ if (!_globals->getFlag(105) || (RING_INVENTORY._vial._sceneNumber != 5100)) {
_globals->_player.disableControl();
scene->_sceneMode = 5301;
scene->setAction(&scene->_sequenceManager, scene, 5301, &_globals->_player, NULL);
} else {
_globals->_player.disableControl();
scene->_sceneMode = 5307;
- _globals->_inventory._vial._sceneNumber = 1;
+ RING_INVENTORY._vial._sceneNumber = 1;
scene->setAction(&scene->_sequenceManager, scene, 5307, &scene->_hotspot1, &_globals->_player,
&scene->_hotspot4, NULL);
@@ -2033,7 +2048,7 @@ void Scene5300::postInit(SceneObjectList *OwnerList) {
_hotspot2.setVisage(5310);
_hotspot2.setPosition(Common::Point(63, 170));
_hotspot2.animate(ANIM_MODE_1, NULL);
- _hotspot2.setPriority2(98);
+ _hotspot2.fixPriority(98);
}
_hotspot1.postInit();
@@ -2075,7 +2090,7 @@ void Scene5300::postInit(SceneObjectList *OwnerList) {
_hotspot3.postInit();
_hotspot3.setVisage(5301);
_hotspot3.setPosition(Common::Point(172, 32));
- _hotspot3.setPriority2(1);
+ _hotspot3.fixPriority(1);
_hotspot3.animate(ANIM_MODE_NONE, NULL);
_globals->_player.postInit();
@@ -2091,7 +2106,7 @@ void Scene5300::postInit(SceneObjectList *OwnerList) {
}
_field1B0A = 1;
- if (_globals->_inventory._bone._sceneNumber == 5300) {
+ if (RING_INVENTORY._bone._sceneNumber == 5300) {
_hotspot5.postInit();
_hotspot5.setVisage(5301);
_hotspot5.setStrip(2);
@@ -2113,6 +2128,9 @@ void Scene5300::signal() {
_globals->_stripNum = 5300;
_globals->_sceneManager.changeScene(5100);
break;
+ case 5307:
+ _soundHandler.proc1(NULL);
+ // No break on purpose
case 5302:
case 5308:
case 5316:
@@ -2143,21 +2161,18 @@ void Scene5300::signal() {
_globals->clearFlag(67);
_globals->_player.setStrip2(-1);
- if ((_globals->_inventory._vial._sceneNumber == 1) || (_globals->_inventory._vial._sceneNumber == 5300))
+ if ((RING_INVENTORY._vial._sceneNumber == 1) || (RING_INVENTORY._vial._sceneNumber == 5300))
_stripManager.start(5303, this);
else
_stripManager.start(5302, this);
_sceneMode = 5302;
break;
- case 5307:
- _soundHandler.proc1(NULL);
- break;
case 5309:
_hotspot5.remove();
_globals->_player.enableControl();
break;
case 5310:
- _hotspot2.setPriority2(41);
+ _hotspot2.fixPriority(41);
_sceneMode = 5315;
setAction(&_sequenceManager, this, 5315, &_hotspot2, NULL);
diff --git a/engines/tsage/ringworld_scenes6.h b/engines/tsage/ringworld_scenes6.h
index 272aea4fe9..0d81bb3b78 100644
--- a/engines/tsage/ringworld_scenes6.h
+++ b/engines/tsage/ringworld_scenes6.h
@@ -216,11 +216,11 @@ class Scene5200 : public Scene {
};
/* Hotspots */
- class Hotspot9 : public SceneItemExt {
+ class Hotspot9 : public SceneObjectExt {
public:
virtual void doAction(int action);
};
- class Hotspot10 : public SceneItemExt {
+ class Hotspot10 : public SceneObjectExt {
public:
virtual void doAction(int action);
};
@@ -321,8 +321,8 @@ public:
Scene5300();
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void signal();
- virtual void synchronise(Serialiser &s) {
- Scene::synchronise(s);
+ virtual void synchronize(Serializer &s) {
+ Scene::synchronize(s);
s.syncAsSint16LE(_field1B0A);
}
};
diff --git a/engines/tsage/ringworld_scenes8.cpp b/engines/tsage/ringworld_scenes8.cpp
index 416b7fe0fd..43bff50b47 100644
--- a/engines/tsage/ringworld_scenes8.cpp
+++ b/engines/tsage/ringworld_scenes8.cpp
@@ -31,6 +31,12 @@
namespace tSage {
+void NamedHotspotMult::synchronize(Serializer &s) {
+ SceneHotspot::synchronize(s);
+ s.syncAsSint16LE(_useLineNum);
+ s.syncAsSint16LE(_lookLineNum);
+}
+
/*--------------------------------------------------------------------------
* Scene 7000
*
@@ -48,22 +54,23 @@ void Scene7000::Action1::signal() {
setAction(&scene->_action6, this);
break;
case 2:
- scene->_soundHandler.startSound(252, 0, 127);
+ scene->_soundHandler.startSound(252);
scene->_object8.remove();
scene->_object1.postInit();
scene->_object1.setVisage(7003);
scene->_object1.animate(ANIM_MODE_5, this);
- scene->_object1.setPosition(Common::Point(151, 182), 0);
- scene->_object1.setPriority2(205);
+ scene->_object1.setPosition(Common::Point(151, 182));
+ scene->_object1.fixPriority(205);
_globals->_sceneItems.push_front(&scene->_object1);
break;
case 3:
- scene->_object1.setStrip(4);
- scene->_object1.animate(ANIM_MODE_8, 0, 0);
+ scene->_object1._numFrames = 4;
+ scene->_object1.setStrip(2);
+ scene->_object1.animate(ANIM_MODE_8, 0, NULL);
scene->_stripManager.start(7005, this);
break;
case 4:
- scene->_object1.animate(ANIM_MODE_2, 0);
+ scene->_object1.animate(ANIM_MODE_2, NULL);
setDelay(3);
break;
case 5:
@@ -84,7 +91,7 @@ void Scene7000::Action2::signal() {
setDelay(3);
break;
case 1:
- _globals->_player.addMover(0, 0);
+ _globals->_player.addMover(NULL);
_globals->_player.setVisage(7006);
_globals->_player.setStrip(1);
_globals->_player.setFrame(1);
@@ -107,7 +114,7 @@ void Scene7000::Action3::dispatch() {
Action::dispatch();
if (_actionIndex == 4)
- scene->_object4.setPosition(Common::Point(scene->_object3._position.x, scene->_object3._position.y));
+ scene->_object4.setPosition(scene->_object3._position);
}
/*--------------------------------------------------------------------------*/
@@ -122,9 +129,9 @@ void Scene7000::Action3::signal() {
scene->_object4.postInit();
scene->_object4.setVisage(5001);
scene->_object4.setStrip2(2);
- scene->_object4.animate(ANIM_MODE_8, 0, 0);
- scene->_object4.setPosition(Common::Point(10, 18), 0);
- scene->_object4.setPriority2(10);
+ scene->_object4.animate(ANIM_MODE_8, 0, NULL);
+ scene->_object4.setPosition(Common::Point(10, 18));
+ scene->_object4.fixPriority(10);
scene->_object4.changeZoom(100);
scene->_object4.hide();
break;
@@ -135,8 +142,9 @@ void Scene7000::Action3::signal() {
break;
}
case 2:
- scene->_object3.setPriority2(10);
- scene->_object4.setPosition(Common::Point(scene->_object3._position.x, scene->_object3._position.y + 15), 0);
+ scene->_object3._moveDiff.y = 1;
+ scene->_object3.fixPriority(10);
+ scene->_object4.setPosition(Common::Point(scene->_object3._position.x, scene->_object3._position.y + 15));
scene->_object4.show();
setDelay(30);
break;
@@ -169,15 +177,15 @@ void Scene7000::Action4::signal() {
setDelay(300);
break;
case 2:
- _globals->_soundHandler.startSound(252, 0, 127);
+ _globals->_soundHandler.startSound(252);
scene->_object1.show();
scene->_object1.setStrip(3);
scene->_object1.setFrame(1);
scene->_object1.animate(ANIM_MODE_5, this);
break;
case 3:
- scene->_object1.setStrip(1);
- scene->_object1.animate(ANIM_MODE_8, 0, 0);
+ scene->_object1.setStrip(4);
+ scene->_object1.animate(ANIM_MODE_8, 0, NULL);
_globals->setFlag(81);
_globals->_player.enableControl();
remove();
@@ -199,7 +207,7 @@ void Scene7000::Action5::signal() {
}
case 1:
_globals->_player.checkAngle(&scene->_object1);
- _globals->_soundHandler.startSound(252, 0, 127);
+ _globals->_soundHandler.startSound(252);
scene->_object1.setStrip(2);
scene->_stripManager.start(7015, this);
break;
@@ -222,7 +230,7 @@ void Scene7000::Action5::signal() {
break;
}
case 5: {
- _globals->_player.setPriority2(10);
+ _globals->_player.fixPriority(10);
NpcMover *mover = new NpcMover();
Common::Point pt(11, 89);
_globals->_player.addMover(mover, &pt, this);
@@ -268,7 +276,7 @@ void Scene7000::Action6::signal() {
NpcMover *mover = new NpcMover();
Common::Point pt(31, 96);
_globals->_player.addMover(mover, &pt, this);
- _globals->_player.setPriority2(-1);
+ _globals->_player.fixPriority(-1);
break;
}
case 4: {
@@ -315,7 +323,7 @@ void Scene7000::Action7::signal() {
break;
}
case 4: {
- _globals->_player.setPriority2(10);
+ _globals->_player.fixPriority(10);
NpcMover *mover = new NpcMover();
Common::Point pt(11, 89);
_globals->_player.addMover(mover, &pt, this);
@@ -338,11 +346,11 @@ void Scene7000::Action7::signal() {
/*--------------------------------------------------------------------------*/
-void Scene7000::SceneItem1::doAction(int action) {
+void Scene7000::Hotspot1::doAction(int action) {
if (action == CURSOR_LOOK)
- SceneItem::display(7000, 2, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
-
- SceneItem::doAction(action);
+ SceneItem::display2(7000, 2);
+ else
+ SceneHotspot::doAction(action);
}
/*--------------------------------------------------------------------------*/
@@ -353,86 +361,84 @@ void Scene7000::Object1::doAction(int action) {
switch (action) {
case OBJECT_TRANSLATOR:
_globals->_player.disableControl();
- _globals->_inventory._translator._sceneNumber = 7000;
- if (_globals->_inventory._waldos._sceneNumber == 7000) {
- if (_globals->_inventory._jar._sceneNumber == 7000) {
- scene->_sceneMode = 7012;
- scene->setAction(&scene->_sequenceManager, scene, 7010, &_globals->_player, &scene->_object1, 0, 0);
- } else {
- scene->_sceneMode = 7015;
- scene->setAction(&scene->_sequenceManager, scene, 7017, &_globals->_player, 0, 0);
- }
+ RING_INVENTORY._translator._sceneNumber = 7000;
+
+ if ((RING_INVENTORY._waldos._sceneNumber != 7000) && (RING_INVENTORY._jar._sceneNumber != 7000)) {
+ scene->_sceneMode = 7004;
+ scene->setAction(&scene->_sequenceManager, scene, 7004, &_globals->_player, this, NULL);
+ } else if (RING_INVENTORY._waldos._sceneNumber != 7000) {
+ scene->_sceneMode = 7011;
+ scene->setAction(&scene->_sequenceManager, scene, 7010, &_globals->_player, &scene->_object1, NULL);
+ } else if (RING_INVENTORY._jar._sceneNumber != 7000) {
+ scene->_sceneMode = 7012;
+ scene->setAction(&scene->_sequenceManager, scene, 7010, &_globals->_player, &scene->_object1, NULL);
} else {
- if (_globals->_inventory._jar._sceneNumber == 7000) {
- scene->_sceneMode = 7011;
- scene->setAction(&scene->_sequenceManager, scene, 7010, &_globals->_player, &scene->_object1, 0, 0);
- } else {
- scene->_sceneMode = 7004;
- scene->setAction(&scene->_sequenceManager, scene, 7004, &_globals->_player, this, 0, 0);
- }
+ scene->_sceneMode = 7015;
+ scene->setAction(&scene->_sequenceManager, scene, 7017, &_globals->_player, NULL);
}
break;
case OBJECT_WALDOS:
_globals->_player.disableControl();
- _globals->_inventory._waldos._sceneNumber = 7000;
- if (_globals->_inventory._translator._sceneNumber == 7000) {
- if (_globals->_inventory._jar._sceneNumber == 7000) {
+ RING_INVENTORY._waldos._sceneNumber = 7000;
+ if (RING_INVENTORY._translator._sceneNumber == 7000) {
+ if (RING_INVENTORY._jar._sceneNumber == 7000) {
scene->_sceneMode = 7015;
- scene->setAction(&scene->_sequenceManager, scene, 7015, &_globals->_player, 0, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 7015, &_globals->_player, NULL);
} else {
scene->_sceneMode = 7006;
- scene->setAction(&scene->_sequenceManager, scene, 7006, &_globals->_player, 0, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 7006, &_globals->_player, NULL);
}
} else {
scene->_sceneMode = 7009;
- scene->setAction(&scene->_sequenceManager, scene, 7009, &_globals->_player, 0, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 7009, &_globals->_player, NULL);
}
break;
case OBJECT_JAR:
_globals->_player.disableControl();
- _globals->_inventory._jar._sceneNumber = 7000;
- if (_globals->_inventory._translator._sceneNumber == 7000) {
- if (_globals->_inventory._waldos._sceneNumber == 7000) {
+ RING_INVENTORY._jar._sceneNumber = 7000;
+
+ if (RING_INVENTORY._translator._sceneNumber == 7000) {
+ if (RING_INVENTORY._waldos._sceneNumber != 7000) {
scene->_sceneMode = 7007;
- scene->setAction(&scene->_sequenceManager, scene, 7007, &_globals->_player, &scene->_object1, 0, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 7007, &_globals->_player, &scene->_object1, NULL);
} else {
scene->_sceneMode = 7015;
- scene->setAction(&scene->_sequenceManager, scene, 7016, &_globals->_player, 0, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 7016, &_globals->_player, NULL);
}
} else {
scene->_sceneMode = 7008;
- scene->setAction(&scene->_sequenceManager, scene, 7008, &_globals->_player, 0, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 7008, &_globals->_player, NULL);
}
break;
case CURSOR_LOOK:
if (_globals->getFlag(81))
- SceneItem::display(7000, 1, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7000, 1);
else
- SceneItem::display(7000, 0, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7000, 0);
break;
case CURSOR_USE:
if (_globals->getFlag(81)) {
- _globals->_inventory._stasisBox._sceneNumber = 1;
+ RING_INVENTORY._stasisBox2._sceneNumber = 1;
_globals->_player.disableControl();
scene->setAction(&scene->_action5);
} else {
- SceneItem::display(7000, 5, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7000, 5);
}
break;
case CURSOR_TALK:
if (_globals->getFlag(81)) {
- _globals->_inventory._stasisBox._sceneNumber = 1;
+ RING_INVENTORY._stasisBox2._sceneNumber = 1;
_globals->_player.disableControl();
scene->setAction(&scene->_action5);
} else if (_globals->getFlag(52)) {
scene->_sceneMode = 7005;
- scene->setAction(&scene->_sequenceManager, scene, 7013, 0, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 7013, NULL);
} else if (_globals->getFlag(13)) {
_globals->_sceneManager._sceneNumber = 7002;
- scene->setAction(&scene->_sequenceManager, scene, 7014, 0, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 7014, NULL);
} else {
_globals->_sceneManager._sceneNumber = 7002;
- scene->setAction(&scene->_sequenceManager, scene, 7002, 0, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 7002, NULL);
}
break;
default:
@@ -450,8 +456,8 @@ void Scene7000::dispatch() {
if (_globals->_sceneRegions.indexOf(_globals->_player._position) == 8) {
if (!_globals->getFlag(13)) {
_globals->_player.disableControl();
- _globals->_player.addMover(0);
- SceneItem::display(7000, 3, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ _globals->_player.addMover(NULL);
+ SceneItem::display2(7000, 3);
_sceneMode = 7001;
setAction(&scene->_sequenceManager, this, 7001, &_globals->_player, NULL);
} else if (!_globals->getFlag(52)) {
@@ -459,7 +465,7 @@ void Scene7000::dispatch() {
} else {
_globals->_player.disableControl();
_sceneMode = 7003;
- setAction(&scene->_sequenceManager, this, 7003, &_globals->_player, 0);
+ setAction(&scene->_sequenceManager, this, 7003, &_globals->_player, NULL);
}
}
if (_globals->_sceneRegions.indexOf(_globals->_player._position) == 9)
@@ -486,39 +492,38 @@ void Scene7000::postInit(SceneObjectList *OwnerList) {
_object5.postInit();
_object5.setVisage(7001);
_object5.setStrip2(1);
- _object5.animate(ANIM_MODE_2, 0);
- _object5.setPosition(Common::Point(49, 147), 0);
- _object5.setPriority2(1);
+ _object5.animate(ANIM_MODE_2, NULL);
+ _object5.setPosition(Common::Point(49, 147));
+ _object5.fixPriority(1);
_object6.postInit();
_object6.setVisage(7001);
_object6.setStrip2(2);
- _object6.animate(ANIM_MODE_2, 0);
- _object6.setPosition(Common::Point(160, 139), 0);
- _object6.setPriority2(1);
+ _object6.animate(ANIM_MODE_2, NULL);
+ _object6.setPosition(Common::Point(160, 139));
+ _object6.fixPriority(1);
_object7.postInit();
_object7.setVisage(7001);
_object7.setStrip2(3);
- _object7.animate(ANIM_MODE_2, 0);
- _object7.setPosition(Common::Point(272, 129), 0);
- _object7.setPriority2(1);
+ _object7.animate(ANIM_MODE_2, NULL);
+ _object7.setPosition(Common::Point(272, 129));
+ _object7.fixPriority(1);
_object8.postInit();
_object8.setVisage(7001);
_object8.setStrip2(4);
- _object8.animate(ANIM_MODE_2, 0);
- _object8.setPosition(Common::Point(176, 175), 0);
- _object8.setPriority2(1);
+ _object8.animate(ANIM_MODE_2, NULL);
+ _object8.setPosition(Common::Point(176, 175));
+ _object8.fixPriority(1);
if (_globals->getFlag(72)) {
_object3.postInit();
_object3.setVisage(5001);
_object3.setStrip2(1);
- _object3.animate(ANIM_MODE_2, 0);
- _object3.setPosition(Common::Point(107, 92), 0);
+ _object3.setPosition(Common::Point(107, 92));
_object3.changeZoom(100);
- _object3.setPriority2(10);
+ _object3.fixPriority(10);
_object1.postInit();
_object1.setVisage(7003);
@@ -526,55 +531,55 @@ void Scene7000::postInit(SceneObjectList *OwnerList) {
_object1.setStrip(4);
else
_object1.setStrip(2);
- _object1.setPosition(Common::Point(87, 129), 0);
+ _object1.setPosition(Common::Point(87, 129));
_object1._numFrames = 4;
_object1.changeZoom(45);
- _object1.animate(ANIM_MODE_8, 0, 0);
- _globals->_sceneItems.addItems(&_object1, 0);
+ _object1.animate(ANIM_MODE_8, 0, NULL);
+ _globals->_sceneItems.push_back(&_object1);
}
- _soundHandler.startSound(251, 0, 127);
+ _soundHandler.startSound(251);
if (_globals->_sceneManager._previousScene == 2100) {
if (_globals->getFlag(72)) {
_globals->_player.postInit();
_globals->_player.setVisage(0);
- _globals->_player.animate(ANIM_MODE_1, 0);
+ _globals->_player.animate(ANIM_MODE_1, NULL);
SceneObjectWrapper *wrapper = new SceneObjectWrapper();
_globals->_player.setObjectWrapper(wrapper);
- _globals->_player.setPosition(Common::Point(57, 94), 0);
+ _globals->_player.setPosition(Common::Point(57, 94));
_globals->_player.changeZoom(-1);
- _globals->_player.setPriority2(10);
+ _globals->_player.fixPriority(10);
if (_globals->getFlag(81)) {
setAction(&_action4);
} else {
- _object1.setPosition(Common::Point(151, 182), 0);
+ _object1.setPosition(Common::Point(151, 182));
+ _object1.changeZoom(100);
setAction(&_action1);
}
} else {
- _globals->_soundHandler.startSound(250, 0, 127);
+ _globals->_soundHandler.startSound(250);
_globals->setFlag(72);
_object3.postInit();
_object3.setVisage(5001);
_object3.setStrip2(1);
- _object3.animate(ANIM_MODE_1, 0);
- _object3.setPosition(Common::Point(307, 0), 0);
+ _object3.animate(ANIM_MODE_1, NULL);
+ _object3.setPosition(Common::Point(307, 0));
_object3.changeZoom(-1);
setAction(&_action3);
}
} else if (_globals->_sceneManager._previousScene == 2280) {
_globals->_player.postInit();
_globals->_player.setVisage(2170);
- _globals->_player.animate(ANIM_MODE_1, 0);
- SceneObjectWrapper *wrapper = new SceneObjectWrapper();
- _globals->_player.setObjectWrapper(wrapper);
- _globals->_player.setPosition(Common::Point(57, 94), 0);
+ _globals->_player.animate(ANIM_MODE_1, NULL);
+ _globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ _globals->_player.setPosition(Common::Point(57, 94));
_globals->_player.changeZoom(-1);
- _globals->_player.setPriority2(10);
+ _globals->_player.fixPriority(10);
_globals->_player.disableControl();
_sceneMode = 7001;
setAction(&_action6, this);
if (!_globals->getFlag(81)) {
- _object1.setPosition(Common::Point(151, 182), 0);
+ _object1.setPosition(Common::Point(151, 182));
_object1.changeZoom(100);
}
_object8.remove();
@@ -582,12 +587,12 @@ void Scene7000::postInit(SceneObjectList *OwnerList) {
} else if (_globals->_sceneManager._previousScene == 2320) {
_globals->_player.postInit();
_globals->_player.setVisage(0);
- _globals->_player.animate(ANIM_MODE_1, 0);
+ _globals->_player.animate(ANIM_MODE_1, NULL);
SceneObjectWrapper *wrapper = new SceneObjectWrapper();
_globals->_player.setObjectWrapper(wrapper);
- _globals->_player.setPosition(Common::Point(57, 94), 0);
+ _globals->_player.setPosition(Common::Point(57, 94));
_globals->_player.changeZoom(-1);
- _globals->_player.setPriority2(10);
+ _globals->_player.fixPriority(10);
_sceneMode = 7001;
setAction(&_action6, this);
} else {
@@ -596,12 +601,15 @@ void Scene7000::postInit(SceneObjectList *OwnerList) {
_object3.postInit();
_object3.setVisage(5001);
_object3.setStrip2(1);
- _object3.setPosition(Common::Point(307, 0), 0);
- _soundHandler.startSound(151, 0, 127);
+ _object3.setPosition(Common::Point(307, 0));
+ _soundHandler.startSound(151);
_soundHandler.proc5(1);
- _globals->_soundHandler.startSound(250, 0, 127);
+ _globals->_soundHandler.startSound(250);
setAction(&_action3);
}
+
+ _hotspot1.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
+ _globals->_sceneItems.push_back(&_hotspot1);
}
/*--------------------------------------------------------------------------*/
@@ -612,6 +620,10 @@ void Scene7000::signal() {
case 7001:
case 7002:
case 7004:
+ case 7005:
+ case 7006:
+ case 7007:
+ case 7008:
case 7009:
_globals->_player.enableControl();
break;
@@ -709,7 +721,7 @@ void Scene7100::Action5::signal() {
}
case 3: {
scene->_object9.setStrip2(2);
- scene->_object9.setPriority2(180);
+ scene->_object9.fixPriority(180);
Common::Point pt(8, 181);
NpcMover *mover = new NpcMover();
scene->_object9.addMover(mover, &pt, this);
@@ -728,14 +740,14 @@ void Scene7100::Action6::signal() {
switch (_actionIndex++) {
case 0:
setDelay(1);
- scene->_object10.setPriority2(8);
- scene->_object10.setPosition(Common::Point(155, 187), 0);
+ scene->_object10.fixPriority(8);
+ scene->_object10.setPosition(Common::Point(155, 187));
- scene->_object11.setPriority2(8);
- scene->_object11.setPosition(Common::Point(155, 190), 0);
+ scene->_object11.fixPriority(8);
+ scene->_object11.setPosition(Common::Point(155, 190));
- scene->_object12.setPriority2(8);
- scene->_object12.setPosition(Common::Point(151, 193), 0);
+ scene->_object12.fixPriority(8);
+ scene->_object12.setPosition(Common::Point(151, 193));
break;
case 1: {
Common::Point pt1(167, 187);
@@ -744,11 +756,11 @@ void Scene7100::Action6::signal() {
Common::Point pt2(165, 185);
NpcMover *mover2 = new NpcMover();
- scene->_object11.addMover(mover2, &pt2, 0);
+ scene->_object11.addMover(mover2, &pt2, NULL);
Common::Point pt3(163, 183);
NpcMover *mover3 = new NpcMover();
- scene->_object12.addMover(mover3, &pt3, 0);
+ scene->_object12.addMover(mover3, &pt3, NULL);
break;
}
case 2: {
@@ -758,16 +770,16 @@ void Scene7100::Action6::signal() {
scene->_object10.addMover(mover1, &pt1, this);
scene->_object11.setStrip2(6);
- scene->_object11.setPriority2(50);
+ scene->_object11.fixPriority(50);
Common::Point pt2(89, 185);
NpcMover *mover2 = new NpcMover();
- scene->_object11.addMover(mover2, &pt2, 0);
+ scene->_object11.addMover(mover2, &pt2, NULL);
scene->_object12.setStrip2(6);
- scene->_object12.setPriority2(50);
+ scene->_object12.fixPriority(50);
Common::Point pt3(87, 183);
NpcMover *mover3 = new NpcMover();
- scene->_object12.addMover(mover3, &pt3, 0);
+ scene->_object12.addMover(mover3, &pt3, NULL);
break;
}
case 3:
@@ -795,7 +807,7 @@ void Scene7100::Action7::signal() {
scene->_object13.setStrip2(2);
Common::Point pt(524, 104);
NpcMover *mover = new NpcMover();
- scene->_object13.addMover(mover, &pt, 0);
+ scene->_object13.addMover(mover, &pt, NULL);
break;
}
case 3:
@@ -823,11 +835,11 @@ void Scene7100::Action8::signal() {
Common::Point pt2(480, 146);
NpcMover *mover2 = new NpcMover();
- scene->_object18.addMover(mover2, &pt2, 0);
+ scene->_object18.addMover(mover2, &pt2, NULL);
Common::Point pt3(470, 153);
NpcMover *mover3 = new NpcMover();
- scene->_object19.addMover(mover3, &pt3, 0);
+ scene->_object19.addMover(mover3, &pt3, NULL);
break;
}
case 2: {
@@ -841,11 +853,11 @@ void Scene7100::Action8::signal() {
Common::Point pt2(502, 179);
NpcMover *mover2 = new NpcMover();
- scene->_object18.addMover(mover2, &pt2, 0);
+ scene->_object18.addMover(mover2, &pt2, NULL);
Common::Point pt3(495, 184);
NpcMover *mover3 = new NpcMover();
- scene->_object19.addMover(mover3, &pt3, 0);
+ scene->_object19.addMover(mover3, &pt3, NULL);
break;
}
case 3: {
@@ -859,11 +871,11 @@ void Scene7100::Action8::signal() {
Common::Point pt2(379, 161);
NpcMover *mover2 = new NpcMover();
- scene->_object18.addMover(mover2, &pt2, 0);
+ scene->_object18.addMover(mover2, &pt2, NULL);
Common::Point pt3(373, 167);
NpcMover *mover3 = new NpcMover();
- scene->_object19.addMover(mover3, &pt3, 0);
+ scene->_object19.addMover(mover3, &pt3, NULL);
break;
}
case 4: {
@@ -877,11 +889,11 @@ void Scene7100::Action8::signal() {
Common::Point pt2(473, 187);
NpcMover *mover2 = new NpcMover();
- scene->_object18.addMover(mover2, &pt2, 0);
+ scene->_object18.addMover(mover2, &pt2, NULL);
Common::Point pt3(466, 192);
NpcMover *mover3 = new NpcMover();
- scene->_object19.addMover(mover3, &pt3, 0);
+ scene->_object19.addMover(mover3, &pt3, NULL);
break;
}
case 5: {
@@ -891,11 +903,11 @@ void Scene7100::Action8::signal() {
Common::Point pt2(552, 178);
NpcMover *mover2 = new NpcMover();
- scene->_object18.addMover(mover2, &pt2, 0);
+ scene->_object18.addMover(mover2, &pt2, NULL);
Common::Point pt3(541, 183);
NpcMover *mover3 = new NpcMover();
- scene->_object19.addMover(mover3, &pt3, 0);
+ scene->_object19.addMover(mover3, &pt3, NULL);
_actionIndex = 0;
break;
@@ -919,7 +931,7 @@ void Scene7100::Action9::signal() {
}
case 2: {
scene->_object24.setStrip2(2);
- scene->_object24.setPriority2(160);
+ scene->_object24.fixPriority(160);
Common::Point pt(34, 159);
NpcMover *mover = new NpcMover();
scene->_object24.addMover(mover, &pt, this);
@@ -934,7 +946,7 @@ void Scene7100::Action9::signal() {
}
case 4: {
scene->_object24.setStrip2(2);
- scene->_object24.setPriority2(180);
+ scene->_object24.fixPriority(180);
Common::Point pt(-12, 182);
NpcMover *mover = new NpcMover();
scene->_object24.addMover(mover, &pt, this);
@@ -1003,68 +1015,68 @@ void Scene7100::postInit(SceneObjectList *OwnerList) {
_object2.postInit();
_object2.setVisage(7161);
- _object2.animate(ANIM_MODE_2, 0);
- _object2.setPosition(Common::Point(10, 140), 0);
+ _object2.animate(ANIM_MODE_2, NULL);
+ _object2.setPosition(Common::Point(10, 140));
_object2._numFrames = 1;
- _object2.setPriority2(180);
- _object2.setAction(&_action1, 0);
+ _object2.fixPriority(180);
+ _object2.setAction(&_action1, NULL);
_object3.postInit();
_object3.setVisage(7161);
- _object3.animate(ANIM_MODE_2, 0);
- _object3.setPosition(Common::Point(34, 115), 0);
+ _object3.animate(ANIM_MODE_2, NULL);
+ _object3.setPosition(Common::Point(34, 115));
_object3._numFrames = 1;
- _object3.setPriority2(180);
- _object3.setAction(&_action2, 0);
+ _object3.fixPriority(180);
+ _object3.setAction(&_action2, NULL);
_object4.postInit();
_object4.setVisage(7164);
- _object4.animate(ANIM_MODE_2, 0);
- _object4.setPosition(Common::Point(-10, 159), 0);
+ _object4.animate(ANIM_MODE_2, NULL);
+ _object4.setPosition(Common::Point(-10, 159));
_object4._numFrames = 2;
- _object4.setPriority2(250);
- _object4.setAction(&_action3, 0);
+ _object4.fixPriority(250);
+ _object4.setAction(&_action3, NULL);
_object5.postInit();
_object5.setVisage(7162);
_object5.setStrip(3);
- _object5.animate(ANIM_MODE_2, 0);
- _object5.setPosition(Common::Point(20, 52), 0);
- _object5.setAction(&_action4, 0);
+ _object5.animate(ANIM_MODE_2, NULL);
+ _object5.setPosition(Common::Point(20, 52));
+ _object5.setAction(&_action4, NULL);
_object9.postInit();
_object9.setVisage(7160);
_object5.setStrip(2);
- _object9.animate(ANIM_MODE_2, 0);
- _object9.setPosition(Common::Point(110, 168), 0);
+ _object9.animate(ANIM_MODE_2, NULL);
+ _object9.setPosition(Common::Point(110, 168));
_object9._numFrames = 2;
- _object9.setPriority2(16);
- _object9.setAction(&_action5, 0);
+ _object9.fixPriority(16);
+ _object9.setAction(&_action5, NULL);
_object13.postInit();
_object13.setVisage(7161);
_object13.setStrip(8);
- _object13.animate(ANIM_MODE_2, 0);
- _object13.setPosition(Common::Point(524, 104), 0);
+ _object13.animate(ANIM_MODE_2, NULL);
+ _object13.setPosition(Common::Point(524, 104));
_object13._numFrames = 5;
- _object13.setPriority2(250);
- _object13.setAction(&_action7, 0);
+ _object13.fixPriority(250);
+ _object13.setAction(&_action7, NULL);
_object17.postInit();
_object17.setVisage(7160);
_object17.setStrip(3);
- _object17.animate(ANIM_MODE_2, 0);
- _object17.setPosition(Common::Point(552, 183), 0);
+ _object17.animate(ANIM_MODE_2, NULL);
+ _object17.setPosition(Common::Point(552, 183));
_object17._numFrames = 4;
_object17._moveDiff.x = 12;
_object17._moveDiff.y = 12;
- _object17.setAction(&_action8, 0);
+ _object17.setAction(&_action8, NULL);
_object18.postInit();
_object18.setVisage(7160);
_object18.setStrip(3);
- _object18.animate(ANIM_MODE_2, 0);
- _object18.setPosition(Common::Point(552, 178), 0);
+ _object18.animate(ANIM_MODE_2, NULL);
+ _object18.setPosition(Common::Point(552, 178));
_object18._numFrames = 4;
_object18._moveDiff.x = 12;
_object18._moveDiff.y = 12;
@@ -1072,8 +1084,8 @@ void Scene7100::postInit(SceneObjectList *OwnerList) {
_object19.postInit();
_object19.setVisage(7160);
_object19.setStrip(3);
- _object19.animate(ANIM_MODE_2, 0);
- _object19.setPosition(Common::Point(541, 183), 0);
+ _object19.animate(ANIM_MODE_2, NULL);
+ _object19.setPosition(Common::Point(541, 183));
_object19._numFrames = 4;
_object19._moveDiff.x = 12;
_object19._moveDiff.y = 12;
@@ -1081,42 +1093,42 @@ void Scene7100::postInit(SceneObjectList *OwnerList) {
_object24.postInit();
_object24.setVisage(7162);
_object24.setStrip(1);
- _object24.animate(ANIM_MODE_2, 0);
- _object24.setPosition(Common::Point(-12, 182), 0);
+ _object24.animate(ANIM_MODE_2, NULL);
+ _object24.setPosition(Common::Point(-12, 182));
_object24._numFrames = 4;
- _object24.setPriority2(180);
- _object24.setAction(&_action9, 0);
+ _object24.fixPriority(180);
+ _object24.setAction(&_action9, NULL);
_object25.postInit();
_object25.setVisage(7163);
- _object25.animate(ANIM_MODE_2, 0);
- _object25.setPosition(Common::Point(551, 145), 0);
+ _object25.animate(ANIM_MODE_2, NULL);
+ _object25.setPosition(Common::Point(551, 145));
_object25._numFrames = 5;
- _object25.setPriority2(160);
- _object25.setAction(&_action10, 0);
+ _object25.fixPriority(160);
+ _object25.setAction(&_action10, NULL);
// Swimmer 1
_globals->_player.postInit();
_globals->_player.setVisage(7101);
- _globals->_player.animate(ANIM_MODE_2, 0);
+ _globals->_player.animate(ANIM_MODE_2, NULL);
_globals->_player._moveDiff.x = 4;
_globals->_player._moveDiff.y = 2;
- _globals->_player.setPosition(Common::Point(135, 135), 0);
- _globals->_player.setPriority2(200);
+ _globals->_player.setPosition(Common::Point(135, 135));
+ _globals->_player.fixPriority(200);
_globals->_player.disableControl();
// Swimmer 2
_object1.postInit();
_object1.setVisage(7110);
- _object1.animate(ANIM_MODE_1, 0);
+ _object1.animate(ANIM_MODE_1, NULL);
_object1._moveDiff.x = 4;
_object1._moveDiff.y = 2;
- _object1.setPosition(Common::Point(100, 100), 0);
+ _object1.setPosition(Common::Point(100, 100));
setAction(&_action11);
- _soundHandler1.startSound(270, 0, 127);
- _soundHandler2.startSound(275, 0, 127);
- _globals->_soundHandler.startSound(270, 0, 127);
+ _soundHandler1.startSound(270);
+ _soundHandler2.startSound(275);
+ _globals->_soundHandler.startSound(270);
}
/*--------------------------------------------------------------------------
* Scene 7200
@@ -1158,9 +1170,9 @@ void Scene7200::Action2::signal() {
setDelay(3);
break;
case 1: {
- scene->_object2.setPriority2(25);
- scene->_object3.setPriority2(25);
- scene->_object4.setPriority2(25);
+ scene->_object2.fixPriority(25);
+ scene->_object3.fixPriority(25);
+ scene->_object4.fixPriority(25);
scene->_object2.setStrip(1);
scene->_object3.setStrip(1);
scene->_object4.setStrip(1);
@@ -1169,16 +1181,16 @@ void Scene7200::Action2::signal() {
scene->_object2.addMover(mover1, &pt1, this);
NpcMover *mover2 = new NpcMover();
Common::Point pt2(56, 85);
- scene->_object3.addMover(mover2, &pt2, 0);
+ scene->_object3.addMover(mover2, &pt2, NULL);
NpcMover *mover3 = new NpcMover();
Common::Point pt3(54, 80);
- scene->_object4.addMover(mover3, &pt3, 0);
+ scene->_object4.addMover(mover3, &pt3, NULL);
break;
}
case 2: {
- scene->_object2.setPriority2(160);
- scene->_object3.setPriority2(160);
- scene->_object4.setPriority2(160);
+ scene->_object2.fixPriority(160);
+ scene->_object3.fixPriority(160);
+ scene->_object4.fixPriority(160);
scene->_object2.setStrip(2);
scene->_object3.setStrip(2);
scene->_object4.setStrip(2);
@@ -1187,10 +1199,10 @@ void Scene7200::Action2::signal() {
scene->_object2.addMover(mover1, &pt1, this);
NpcMover *mover2 = new NpcMover();
Common::Point pt2(12, 84);
- scene->_object3.addMover(mover2, &pt2, 0);
+ scene->_object3.addMover(mover2, &pt2, NULL);
NpcMover *mover3 = new NpcMover();
Common::Point pt3(10, 79);
- scene->_object4.addMover(mover3, &pt3, 0);
+ scene->_object4.addMover(mover3, &pt3, NULL);
break;
}
case 3:
@@ -1208,80 +1220,80 @@ void Scene7200::postInit(SceneObjectList *OwnerList) {
Scene::postInit();
_object2.postInit();
_object2.setVisage(7160);
- _object2.animate(ANIM_MODE_2, 0);
+ _object2.animate(ANIM_MODE_2, NULL);
_object2.setZoom(10);
- _object2.setPosition(Common::Point(53, 88), 0);
+ _object2.setPosition(Common::Point(53, 88));
_object2.setAction(&_action2);
_object3.postInit();
_object3.setVisage(7160);
- _object3.animate(ANIM_MODE_2, 0);
+ _object3.animate(ANIM_MODE_2, NULL);
_object3.setZoom(10);
- _object3.setPosition(Common::Point(55, 83), 0);
+ _object3.setPosition(Common::Point(55, 83));
_object4.postInit();
_object4.setVisage(7160);
- _object4.animate(ANIM_MODE_2, 0);
+ _object4.animate(ANIM_MODE_2, NULL);
_object4.setZoom(10);
- _object4.setPosition(Common::Point(57, 78), 0);
+ _object4.setPosition(Common::Point(57, 78));
_object5.postInit();
_object5.setVisage(7201);
- _object5.setPosition(Common::Point(300, 172), 0);
+ _object5.setPosition(Common::Point(300, 172));
_object5.setPriority(172);
- _object5.animate(ANIM_MODE_2, 0);
+ _object5.animate(ANIM_MODE_2, NULL);
_object5._numFrames = 3;
_object6.postInit();
_object6.setVisage(7201);
_object6.setStrip2(3);
- _object6.setPosition(Common::Point(144, 97), 0);
+ _object6.setPosition(Common::Point(144, 97));
_object6.setPriority(199);
- _object6.animate(ANIM_MODE_2, 0);
+ _object6.animate(ANIM_MODE_2, NULL);
_object6._numFrames = 3;
_object7.postInit();
_object7.setVisage(7201);
_object7.setStrip2(4);
- _object7.setPosition(Common::Point(115, 123), 0);
+ _object7.setPosition(Common::Point(115, 123));
_object7.setPriority(199);
- _object7.animate(ANIM_MODE_2, 0);
+ _object7.animate(ANIM_MODE_2, NULL);
_object7._numFrames = 3;
_object8.postInit();
_object8.setVisage(7201);
_object8.setStrip2(6);
- _object8.setPosition(Common::Point(140, 173), 0);
+ _object8.setPosition(Common::Point(140, 173));
_object8.setPriority(199);
- _object8.animate(ANIM_MODE_2, 0);
+ _object8.animate(ANIM_MODE_2, NULL);
_object8._numFrames = 3;
_object9.postInit();
_object9.setVisage(7201);
_object9.setStrip2(7);
- _object9.setPosition(Common::Point(215, 196), 0);
+ _object9.setPosition(Common::Point(215, 196));
_object9.setPriority(199);
- _object9.animate(ANIM_MODE_2, 0);
+ _object9.animate(ANIM_MODE_2, NULL);
_object9._numFrames = 3;
// Orange swimmer
_globals->_player.postInit();
_globals->_player.setVisage(7110);
- _globals->_player.animate(ANIM_MODE_1, 0);
+ _globals->_player.animate(ANIM_MODE_1, NULL);
_globals->_player.setObjectWrapper(new SceneObjectWrapper());
_globals->_player.setZoom(50);
- _globals->_player.setPosition(Common::Point(-18, 16), 0);
+ _globals->_player.setPosition(Common::Point(-18, 16));
_globals->_player.disableControl();
_swimmer.postInit();
_swimmer.setVisage(7101);
- _swimmer.animate(ANIM_MODE_1, 0);
+ _swimmer.animate(ANIM_MODE_1, NULL);
_swimmer.setObjectWrapper(new SceneObjectWrapper());
_swimmer.setZoom(50);
- _swimmer.setPosition(Common::Point(-8, 16), 0);
+ _swimmer.setPosition(Common::Point(-8, 16));
setAction(&_action1);
- _soundHandler.startSound(271, 0, 127);
+ _soundHandler.startSound(271);
}
/*--------------------------------------------------------------------------
@@ -1316,14 +1328,14 @@ void Scene7300::Action1::signal() {
_globals->_player.setStrip(3);
_globals->_player._numFrames = 5;
_globals->_player.animate(ANIM_MODE_2, this);
- if (_globals->_inventory._translator._sceneNumber == 1)
+ if (RING_INVENTORY._translator._sceneNumber == 1)
scene->_stripManager.start(7310, this);
else
scene->_stripManager.start(7305, this);
break;
case 7:
setDelay(3);
- _globals->_soundHandler.proc1(0);
+ _globals->_soundHandler.proc1(NULL);
break;
case 8:
_globals->_sceneManager.changeScene(2280);
@@ -1342,7 +1354,7 @@ void Scene7300::Action2::signal() {
break;
case 1:
NpcMover *mover1 = new NpcMover();
- Common::Point pt(_globals->_randomSource.getRandomNumber(203), _globals->_randomSource.getRandomNumber(96));
+ Common::Point pt(_globals->_randomSource.getRandomNumber(3) + 203, _globals->_randomSource.getRandomNumber(3) + 96);
scene->_object3.addMover(mover1, &pt, this);
_actionIndex = 0;
break;
@@ -1360,7 +1372,7 @@ void Scene7300::Action3::signal() {
break;
case 1:
NpcMover *mover1 = new NpcMover();
- Common::Point pt(_globals->_randomSource.getRandomNumber(76), _globals->_randomSource.getRandomNumber(78));
+ Common::Point pt(_globals->_randomSource.getRandomNumber(5) + 76, _globals->_randomSource.getRandomNumber(5) + 78);
scene->_object1.addMover(mover1, &pt, this);
_actionIndex = 0;
break;
@@ -1414,69 +1426,69 @@ void Scene7300::postInit(SceneObjectList *OwnerList) {
_object4.setVisage(7311);
_object4.setStrip(1);
_object4.setFrame(1);
- _object4.setPosition(Common::Point(218, 157), 0);
+ _object4.setPosition(Common::Point(218, 157));
_object3.postInit();
_object3.setVisage(7311);
_object3.setStrip(2);
_object3.setFrame(1);
- _object3.setPosition(Common::Point(203, 96), 0);
+ _object3.setPosition(Common::Point(203, 96));
_object3._numFrames = 2;
_object3._moveDiff = Common::Point(1, 1);
- _object3.animate(ANIM_MODE_8, 0, 0);
- _object3._field7A = 2;
+ _object3.animate(ANIM_MODE_8, 0, NULL);
+ _object3._moveRate = 2;
_object3.setAction(&_action2);
_globals->_player.postInit();
_globals->_player.setVisage(7305);
- _globals->_player.animate(ANIM_MODE_1, 0);
- _globals->_player.setPosition(Common::Point(-100, 100), 0);
+ _globals->_player.animate(ANIM_MODE_1, NULL);
+ _globals->_player.setPosition(Common::Point(-100, 100));
_globals->_player.disableControl();
_object1.postInit();
_object1.setVisage(7312);
- _object1.animate(ANIM_MODE_1, 0);
+ _object1.animate(ANIM_MODE_1, NULL);
_object1._moveDiff = Common::Point(1, 1);
- _object1.setPosition(Common::Point(76, 78), 0);
- _object1._field7A = 1;
+ _object1.setPosition(Common::Point(76, 78));
+ _object1._moveRate = 1;
_object1.setAction(&_action3);
_object2.postInit();
_object2.setVisage(7312);
_object2.setStrip(2);
- _object2.animate(ANIM_MODE_2, 0);
- _object2.setPosition(Common::Point(77, 47), 0);
- _object2.setPriority2(190);
+ _object2.animate(ANIM_MODE_2, NULL);
+ _object2.setPosition(Common::Point(77, 47));
+ _object2.fixPriority(190);
_object5.postInit();
_object5.setVisage(7300);
- _object5.setPosition(Common::Point(106, 45), 0);
- _object5.animate(ANIM_MODE_2, 0);
+ _object5.setPosition(Common::Point(106, 45));
+ _object5.animate(ANIM_MODE_2, NULL);
_object5._numFrames = 5;
_object6.postInit();
_object6.setVisage(7300);
_object6.setStrip2(2);
- _object6.setPosition(Common::Point(283, 193), 0);
- _object6.animate(ANIM_MODE_2, 0);
+ _object6.setPosition(Common::Point(283, 193));
+ _object6.animate(ANIM_MODE_2, NULL);
_object6._numFrames = 3;
_object7.postInit();
_object7.setVisage(7300);
_object7.setStrip(4);
- _object7.setPosition(Common::Point(295, 77), 0);
- _object7.animate(ANIM_MODE_2, 0);
+ _object7.setPosition(Common::Point(295, 77));
+ _object7.animate(ANIM_MODE_2, NULL);
_object7._numFrames = 3;
_object8.postInit();
_object8.setVisage(7300);
_object8.setStrip(5);
- _object8.setPosition(Common::Point(1, 147), 0);
- _object8.animate(ANIM_MODE_2, 0);
+ _object8.setPosition(Common::Point(1, 147));
+ _object8.animate(ANIM_MODE_2, NULL);
_object8._numFrames = 2;
setAction(&_action1);
- _globals->_soundHandler.startSound(272, 0, 127);
+ _globals->_soundHandler.startSound(272);
}
/*--------------------------------------------------------------------------
@@ -1530,41 +1542,41 @@ void Scene7600::postInit(SceneObjectList *OwnerList) {
_object2.postInit();
_object2.setVisage(7601);
_object2.setStrip(1);
- _object2.animate(ANIM_MODE_2, 0);
+ _object2.animate(ANIM_MODE_2, NULL);
_object2.setPosition(Common::Point(48, 135));
- _object2.setPriority2(1);
+ _object2.fixPriority(1);
_object3.postInit();
_object3.setVisage(7601);
_object3.setStrip(2);
- _object3.animate(ANIM_MODE_2, 0);
+ _object3.animate(ANIM_MODE_2, NULL);
_object3.setPosition(Common::Point(158, 136));
- _object3.setPriority2(1);
+ _object3.fixPriority(1);
_object4.postInit();
_object4.setVisage(7601);
_object4.setStrip(3);
- _object4.animate(ANIM_MODE_2, 0);
+ _object4.animate(ANIM_MODE_2, NULL);
_object4.setPosition(Common::Point(293, 141));
- _object4.setPriority2(1);
+ _object4.fixPriority(1);
_object5.postInit();
_object5.setVisage(7601);
_object5.setStrip(4);
- _object5.animate(ANIM_MODE_2, 0);
+ _object5.animate(ANIM_MODE_2, NULL);
_object5.setPosition(Common::Point(405, 143));
- _object5.setPriority2(1);
+ _object5.fixPriority(1);
_object6.postInit();
_object6.setVisage(7601);
_object6.setStrip(5);
- _object6.animate(ANIM_MODE_2, 0);
+ _object6.animate(ANIM_MODE_2, NULL);
_object6.setPosition(Common::Point(379, 191));
- _object6.setPriority2(1);
+ _object6.fixPriority(1);
_globals->_player.postInit();
_globals->_player.setVisage(2333);
- _globals->_player.animate(ANIM_MODE_1, 0);
+ _globals->_player.animate(ANIM_MODE_1, NULL);
_globals->_player.setObjectWrapper(new SceneObjectWrapper());
_globals->_player.setStrip(1);
_globals->_player._moveDiff = Common::Point(16, 16);
@@ -1578,7 +1590,7 @@ void Scene7600::postInit(SceneObjectList *OwnerList) {
_globals->_player.setPosition(Common::Point(-50, 195));
setAction(&_action1);
}
- _sceneBounds.centre(_globals->_player._position.x, _globals->_player._position.y);
+ _sceneBounds.center(_globals->_player._position.x, _globals->_player._position.y);
loadScene(7600);
_soundHandler2.startSound(255);
_soundHandler1.startSound(251);
@@ -1590,7 +1602,7 @@ void Scene7600::postInit(SceneObjectList *OwnerList) {
*--------------------------------------------------------------------------*/
void Scene7700::Action1::signal() {
- SceneObject *fmtObj = (SceneObject *) _fmt;
+ SceneObjectExt *fmtObj = (SceneObjectExt *) _endHandler;
switch (_actionIndex++) {
case 0: {
PlayerMover *mover1 = new PlayerMover();
@@ -1600,7 +1612,7 @@ void Scene7700::Action1::signal() {
}
case 1:
_globals->_player.checkAngle(fmtObj);
- if (_globals->_player._field8C == 0)
+ if (fmtObj->_state == 0)
fmtObj->animate(ANIM_MODE_5, this);
else
fmtObj->animate(ANIM_MODE_6, this);
@@ -1619,7 +1631,7 @@ void Scene7700::Action2::signal() {
setDelay(_globals->_randomSource.getRandomNumber(60) + 60);
break;
case 1:
- scene->_prof.animate(ANIM_MODE_7, 0, 0);
+ scene->_prof.animate(ANIM_MODE_7, 0, NULL);
setDelay(20);
break;
case 3:
@@ -1644,9 +1656,9 @@ void Scene7700::Action3::signal() {
setDelay(60);
// No break on purpose!
case 2:
- scene->_soundHandler.startSound(260, 0, 127);
+ scene->_soundHandler.startSound(260);
scene->_object8.setVisage(7703);
- scene->_object8.setPosition(Common::Point(177, 97), 0);
+ scene->_object8.setPosition(Common::Point(177, 97));
scene->_object8.setStrip2(3);
scene->_object8.animate(ANIM_MODE_5, this);
scene->_object8._numFrames = 3;
@@ -1672,12 +1684,12 @@ void Scene7700::Action4::signal() {
scene->_object13.postInit();
scene->_object13.setVisage(7700);
scene->_object13.setStrip2(7);
- scene->_object13.setPosition(Common::Point(151, 33), 0);
+ scene->_object13.setPosition(Common::Point(151, 33));
scene->_object13.animate(ANIM_MODE_5, this);
break;
case 3:
CursorMan.showMouse(true);
- SceneItem::display(7700, 11, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, 11);
_globals->_player.enableControl();
remove();
break;
@@ -1692,7 +1704,7 @@ void Scene7700::Action5::signal() {
break;
case 1: {
scene->_cloud.setFrame(_globals->_randomSource.getRandomNumber(1) + 1);
- scene->_cloud.setPosition(Common::Point(133, 145 + _globals->_randomSource.getRandomNumber(54)), 0);
+ scene->_cloud.setPosition(Common::Point(133, 145 + _globals->_randomSource.getRandomNumber(54)));
Common::Point pt(360, scene->_cloud._position.y);
NpcMover *mover = new NpcMover();
@@ -1717,13 +1729,13 @@ void Scene7700::Action6::signal() {
}
case 2:
scene->_easterEgg1.setStrip(2);
- scene->_easterEgg1.setPosition(Common::Point(43, 65), 0);
+ scene->_easterEgg1.setPosition(Common::Point(43, 65));
scene->_easterEgg2.postInit();
scene->_easterEgg2.setVisage(7708);
scene->_easterEgg2.setStrip(3);
- scene->_easterEgg2.setPosition(Common::Point(116, 54), 0);
- scene->_easterEgg2.animate(ANIM_MODE_2, 0);
+ scene->_easterEgg2.setPosition(Common::Point(116, 54));
+ scene->_easterEgg2.animate(ANIM_MODE_2, NULL);
setDelay(120);
break;
@@ -1737,14 +1749,14 @@ void Scene7700::Action6::signal() {
void Scene7700::SceneHotspot1::doAction(int action) {
if (action == CURSOR_LOOK)
- SceneItem::display(7700, 4, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, 4);
else
SceneHotspot::doAction(action);
}
void Scene7700::SceneHotspot2::doAction(int action) {
if (action == CURSOR_LOOK)
- SceneItem::display(7700, 6, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, 6);
else
SceneHotspot::doAction(action);
}
@@ -1754,23 +1766,23 @@ void Scene7700::SceneHotspot3::doAction(int action) {
switch (action) {
case OBJECT_KEY:
- SceneItem::display(7702, 3, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
- _globals->_inventory._key._sceneNumber = 7700;
+ SceneItem::display2(7702, 3);
+ RING_INVENTORY._key._sceneNumber = 7700;
break;
case CURSOR_LOOK:
- if (_globals->_inventory._key._sceneNumber == 7700)
- scene->setAction(&scene->_action4, 0);
+ if (RING_INVENTORY._key._sceneNumber == 7700)
+ scene->setAction(&scene->_action4, NULL);
else
- SceneItem::display(7700, 53, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, 53);
break;
case CURSOR_USE:
if (!_globals->getFlag(78)) {
scene->_sceneMode = 7712;
- scene->setAction(&scene->_sequenceManager, scene, 7715, 0);
- } else if (_globals->_inventory._key._sceneNumber == 7700) {
+ scene->setAction(&scene->_sequenceManager, scene, 7715, NULL);
+ } else if (RING_INVENTORY._key._sceneNumber == 7700) {
_globals->_player.disableControl();
scene->_sceneMode = 7705;
- scene->setAction(&scene->_sequenceManager, scene, 7705, &_globals->_player, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 7705, &_globals->_player, NULL);
}
break;
default:
@@ -1784,14 +1796,14 @@ void Scene7700::SceneHotspot4::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- SceneItem::display(7700, 12, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, 12);
break;
case CURSOR_USE:
if (!_globals->getFlag(78)) {
scene->_sceneMode = 7712;
- scene->setAction(&scene->_sequenceManager, scene, 7715, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 7715, NULL);
} else {
- SceneItem::display(7700, 12, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, 12);
}
break;
default:
@@ -1805,18 +1817,18 @@ void Scene7700::SceneHotspot5::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- SceneItem::display(7700, 28, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, 28);
break;
case CURSOR_USE:
if (_globals->getFlag(78)) {
- if (_globals->_inventory._paper._sceneNumber == 7700) {
+ if (RING_INVENTORY._paper._sceneNumber == 7700) {
_globals->_player.disableControl();
scene->_sceneMode = 7708;
- scene->setAction(&scene->_sequenceManager, scene, 7708, &_globals->_player, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 7708, &_globals->_player, NULL);
}
} else {
scene->_sceneMode = 7712;
- scene->setAction(&scene->_sequenceManager, scene, 7715, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 7715, NULL);
}
break;
default:
@@ -1828,10 +1840,10 @@ void Scene7700::SceneHotspot5::doAction(int action) {
void Scene7700::SceneHotspot6::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- SceneItem::display(7700, 43, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, 43);
break;
case CURSOR_USE:
- SceneItem::display(7700, 56, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, 56);
break;
default:
SceneHotspot::doAction(action);
@@ -1841,7 +1853,7 @@ void Scene7700::SceneHotspot6::doAction(int action) {
void Scene7700::SceneItem7::doAction(int action) {
if (action == CURSOR_LOOK)
- SceneItem::display(7700, 51, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, 51);
}
void Scene7700::SceneHotspot8::doAction(int action) {
@@ -1849,11 +1861,11 @@ void Scene7700::SceneHotspot8::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- SceneItem::display(7700, 48, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, 48);
break;
case CURSOR_USE:
scene->_sceneMode = 7709;
- scene->_soundHandler.startSound(259, 0, 127);
+ scene->_soundHandler.startSound(259);
scene->_object15.setFrame(scene->_object15.getFrameCount());
scene->_object15.animate(ANIM_MODE_6, scene);
if ((scene->_field977 == 2) && (scene->_field97B == 0)) {
@@ -1875,11 +1887,11 @@ void Scene7700::SceneHotspot9::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- SceneItem::display(7700, 48, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, 48);
break;
case CURSOR_USE:
scene->_sceneMode = 7709;
- scene->_soundHandler.startSound(259, 0, 127);
+ scene->_soundHandler.startSound(259);
scene->_object15.setFrame(1);
scene->_object15.animate(ANIM_MODE_5, scene);
if (scene->_field977 > 2) {
@@ -1917,14 +1929,14 @@ void Scene7700::Object1::doAction(int action) {
Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene;
if (action == CURSOR_LOOK) {
- SceneItem::display(7700, _lookLineNum, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, _lookLineNum);
} else if (action == CURSOR_USE) {
if (_globals->getFlag(78)) {
_globals->_player.disableControl();
scene->setAction(&scene->_action1, this);
} else {
scene->_sceneMode = 7712;
- scene->setAction(&scene->_sequenceManager, scene, 7715, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 7715, NULL);
}
} else {
SceneHotspot::doAction(action);
@@ -1934,10 +1946,10 @@ void Scene7700::Object1::doAction(int action) {
void Scene7700::SceneHotspot11::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- SceneItem::display(7700, _lookLineNum, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, _lookLineNum);
break;
case CURSOR_USE:
- SceneItem::display(7701, _useLineNum, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7701, _useLineNum);
break;
default:
SceneHotspot::doAction(action);
@@ -1948,7 +1960,7 @@ void Scene7700::SceneHotspot11::doAction(int action) {
void Scene7700::Object1::signal() {
if (_state == 0) {
_state = 1;
- SceneItem::display(7701, _defltLineNum, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7701, _defltLineNum);
} else {
_state = 0;
}
@@ -1959,19 +1971,19 @@ void Scene7700::Object3::doAction(int action) {
Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene;
if (action == CURSOR_LOOK) {
- SceneItem::display(7700, 34, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, 34);
} else if (action == CURSOR_USE) {
if (_globals->getFlag(78)) {
if (scene->_object3._frame == 1) {
_globals->_player.disableControl();
scene->_sceneMode = 7707;
- scene->setAction(&scene->_sequenceManager, scene, 7707, &_globals->_player, this, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 7707, &_globals->_player, this, NULL);
} else {
- SceneItem::display(7700, 60, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, 60);
}
} else {
scene->_sceneMode = 7712;
- scene->setAction(&scene->_sequenceManager, scene, 7715, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 7715, NULL);
}
} else {
SceneHotspot::doAction(action);
@@ -1984,30 +1996,30 @@ void Scene7700::Object7::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
if (_globals->getFlag(78))
- SceneItem::display(7700, 45, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, 45);
else
- SceneItem::display(7700, 44, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, 44);
break;
case CURSOR_USE:
if (_globals->getFlag(78)) {
- SceneItem::display(7701, 41, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7701, 41);
} else {
scene->_sceneMode = 7712;
- scene->setAction(&scene->_sequenceManager, scene, 7714, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 7714, NULL);
}
break;
case CURSOR_TALK:
if (_globals->getFlag(78)) {
- SceneItem::display(7702, 1, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7702, 1);
} else {
_globals->_player.disableControl();
if (_state == 0) {
_state = 1;
scene->_sceneMode = 7703;
- scene->setAction(&scene->_sequenceManager, scene, 7703, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 7703, NULL);
} else {
scene->_sceneMode = 7712;
- scene->setAction(&scene->_sequenceManager, scene, 7712, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 7712, NULL);
}
}
break;
@@ -2015,10 +2027,10 @@ void Scene7700::Object7::doAction(int action) {
if (!_globals->getFlag(78)) {
_globals->_soundHandler.proc3();
_globals->setFlag(78);
- setAction(0);
+ setAction(NULL);
_globals->_player.disableControl();
scene->_sceneMode = 7704;
- scene->setAction(&scene->_sequenceManager, scene, 7704, &_globals->_player, this, 0);
+ scene->setAction(&scene->_sequenceManager, scene, 7704, &_globals->_player, this, NULL);
}
break;
default:
@@ -2035,44 +2047,45 @@ void Scene7700::Object8::doAction(int action) {
scene->_object9.postInit();
scene->_object9.setVisage(7701);
scene->_object9.setStrip2(3);
- scene->_object9.setPosition(Common::Point(91, 166), 0);
- scene->_object9.setPriority2(200);
+ scene->_object9.setPosition(Common::Point(91, 166));
+ scene->_object9.fixPriority(200);
scene->_object14.postInit();
scene->_object14.setVisage(7701);
scene->_object14.setStrip(2);
- scene->_object14.setPriority2(250);
- scene->_object14.setPosition(Common::Point(139, 151), 0);
+ scene->_object14.fixPriority(250);
+ scene->_object14.setPosition(Common::Point(139, 151));
scene->_gfxButton.setText(EXIT_MSG);
- scene->_gfxButton._bounds.centre(140, 189);
+ scene->_gfxButton._bounds.center(140, 189);
scene->_gfxButton.draw();
- scene->_gfxButton._bounds.expandPanes();
- _globals->_sceneItems.push_front(&scene->_object10);
+ _globals->_sceneItems.push_front(&scene->_sceneItem10);
_globals->_sceneItems.push_front(&scene->_object9);
_globals->_player._canWalk = false;
- } else {
+ } else if (_globals->getFlag(78)) {
scene->_object15.postInit();
scene->_object15.setVisage(7701);
- scene->_object15.setPosition(Common::Point(140, 165), 0);
- scene->_object15.setPriority2(200);
+ scene->_object15.setPosition(Common::Point(140, 165));
+ scene->_object15.fixPriority(200);
scene->_gfxButton.setText(EXIT_MSG);
- scene->_gfxButton._bounds.centre(140, 186);
+ scene->_gfxButton._bounds.center(140, 186);
scene->_gfxButton.draw();
scene->_gfxButton._bounds.expandPanes();
scene->_object19.postInit();
scene->_object19.setVisage(7700);
scene->_object19.setStrip(6);
- scene->_object19.setPosition(Common::Point(140, 192), 0);
+ scene->_object19.setPosition(Common::Point(140, 192));
- _globals->_sceneItems.push_front(&scene->_object10);
- _globals->_sceneItems.push_front(&scene->_object8);
- _globals->_sceneItems.push_front(&scene->_object9);
+ _globals->_sceneItems.push_front(&scene->_sceneItem10);
+ _globals->_sceneItems.push_front(&scene->_sceneHotspot8);
+ _globals->_sceneItems.push_front(&scene->_sceneHotspot9);
_globals->_events.setCursor(CURSOR_WALK);
_globals->_player._canWalk = false;
+ } else {
+ scene->setAction(&scene->_sequenceManager, scene, 7715, NULL);
}
} else {
SceneHotspot::doAction(action);
@@ -2084,13 +2097,13 @@ void Scene7700::Object9::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- SceneItem::display(7700, 49, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, 49);
break;
case CURSOR_USE:
- SceneItem::display(7701, 42, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7701, 42);
break;
case CURSOR_TALK:
- SceneItem::display(7702, 4, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7702, 4);
break;
case OBJECT_KEY:
if (_frame == 1) {
@@ -2100,10 +2113,10 @@ void Scene7700::Object9::doAction(int action) {
scene->_object10.setStrip(4);
scene->_object10.setPosition(Common::Point(159, 136));
_globals->_sceneItems.push_front(&scene->_object10);
- scene->_object10.setPriority2(240);
+ scene->_object10.fixPriority(240);
}
- scene->_soundHandler.startSound(262, 0, 127);
- scene->_object14.animate(ANIM_MODE_5, 0);
+ scene->_soundHandler.startSound(262);
+ scene->_object14.animate(ANIM_MODE_5, NULL);
}
_globals->_events.setCursor(CURSOR_WALK);
break;
@@ -2116,8 +2129,10 @@ void Scene7700::Object10::doAction(int action) {
Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene;
if (action == CURSOR_LOOK) {
- SceneItem::display(7700, 50, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, 50);
} else if (action == CURSOR_USE) {
+ _globals->_player._canWalk = true;
+ RING_INVENTORY._translator._sceneNumber = 1;
_globals->setFlag(80);
scene->_sceneItem10.remove();
scene->_gfxButton._bounds.expandPanes();
@@ -2135,19 +2150,19 @@ void Scene7700::Object11::doAction(int action) {
switch (action) {
case OBJECT_SCANNER:
if (_frame != 1)
- SceneItem::display(7701, 44, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7701, 44);
else
SceneItem::doAction(action);
break;
case CURSOR_LOOK:
if (_frame != 1)
- SceneItem::display(7700, 9, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, 9);
else
- SceneItem::display(7700, 52, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, 52);
break;
case CURSOR_USE:
if (_frame != 1) {
- SceneItem::display(7701, 8, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7701, 8);
} else {
_globals->setFlag(49);
_globals->_player.disableControl();
@@ -2156,8 +2171,8 @@ void Scene7700::Object11::doAction(int action) {
}
break;
case OBJECT_EMPTY_JAR:
- _globals->_inventory._emptyJar._sceneNumber = 0;
- _globals->_inventory._jar._sceneNumber = 1;
+ RING_INVENTORY._emptyJar._sceneNumber = 0;
+ RING_INVENTORY._jar._sceneNumber = 1;
_globals->_player.disableControl();
scene->_sceneMode = 7710;
scene->setAction(&scene->_sequenceManager, scene, 7710, &_globals->_player, NULL);
@@ -2171,7 +2186,7 @@ void Scene7700::Object12::doAction(int action) {
Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene;
if (action == CURSOR_LOOK) {
- SceneItem::display(7700, 15, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, 15);
} else if (action == CURSOR_USE) {
if (_globals->getFlag(78)) {
scene->_sceneMode = 7713;
@@ -2188,13 +2203,13 @@ void Scene7700::Object12::doAction(int action) {
void Scene7700::signal() {
switch (_sceneMode) {
case 7701:
- _globals->_player.setPriority2(-1);
+ _globals->_player.fixPriority(-1);
_globals->_player.setStrip2(-1);
if (_globals->getFlag(78)) {
_globals->_player.enableControl();
} else {
_sceneMode = 7711;
- setAction(&_sequenceManager, this, 7711, 0);
+ setAction(&_sequenceManager, this, 7711, NULL);
}
break;
case 7702:
@@ -2209,15 +2224,18 @@ void Scene7700::signal() {
_globals->_player.enableControl();
break;
case 7704:
- _globals->_soundHandler.startSound(256, 0, 127);
+ _globals->_soundHandler.startSound(256);
_prof.setStrip2(4);
_prof.setFrame2(1);
- _prof.setPosition(Common::Point(159, 87), 0);
+ _prof.setPosition(Common::Point(159, 87));
_globals->_player.enableControl();
break;
case 7705:
+ RING_INVENTORY._key._sceneNumber = 1;
+ _globals->_player.enableControl();
+ break;
case 7708:
- _globals->_inventory._key._sceneNumber = 1;
+ RING_INVENTORY._paper._sceneNumber = 1;
_globals->_player.enableControl();
break;
case 7709:
@@ -2225,11 +2243,11 @@ void Scene7700::signal() {
break;
case 7710:
_globals->_player.enableControl();
- SceneItem::display(7700, 62, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END);
+ SceneItem::display2(7700, 62);
break;
case 7713:
_emptyJar.remove();
- _globals->_inventory._emptyJar._sceneNumber = 1;
+ RING_INVENTORY._emptyJar._sceneNumber = 1;
break;
default:
break;
@@ -2242,8 +2260,8 @@ void Scene7700::process(Event &event) {
if (contains<SceneItem *>(_globals->_sceneItems, &_sceneItem10)) {
if (_gfxButton.process(event)) {
_sceneItem10.remove();
- _sceneHotspot15.remove();
- _sceneHotspot9.remove();
+ _object15.remove();
+ _object9.remove();
if (_globals->_sceneObjects->contains(&_object10))
_object10.remove();
if (_globals->_sceneObjects->contains(&_object14))
@@ -2258,9 +2276,9 @@ void Scene7700::process(Event &event) {
if (!_globals->_sceneObjects->contains(&_easterEgg1)) {
_easterEgg1.postInit();
_easterEgg1.setVisage(7708);
- _easterEgg1.setPosition(Common::Point(163, 50), 0);
- _easterEgg1.setPriority2(1);
- _easterEgg1.animate(ANIM_MODE_2, 0);
+ _easterEgg1.setPosition(Common::Point(163, 50));
+ _easterEgg1.fixPriority(1);
+ _easterEgg1.animate(ANIM_MODE_2, NULL);
_easterEgg1.setAction(&_action6);
}
}
@@ -2275,7 +2293,7 @@ void Scene7700::dispatch() {
if ((_action == 0) && (_globals->_sceneRegions.indexOf(_globals->_player._position) == 30)) {
_globals->_player.disableControl();
_sceneMode = 7702;
- setAction(&_sequenceManager, this, 7702, &_globals->_player, 0);
+ setAction(&_sequenceManager, this, 7702, &_globals->_player, NULL);
}
Scene::dispatch();
}
@@ -2296,12 +2314,12 @@ void Scene7700::postInit(SceneObjectList *OwnerList) {
_globals->_player.postInit();
_globals->_player.setVisage(4201);
- _globals->_player.animate(ANIM_MODE_1, 0);
+ _globals->_player.animate(ANIM_MODE_1, NULL);
SceneObjectWrapper *wrapper = new SceneObjectWrapper();
_globals->_player.setObjectWrapper(wrapper);
- _globals->_player.setPosition(Common::Point(-19, 68), 0);
+ _globals->_player.setPosition(Common::Point(-19, 68));
_globals->_player.setStrip2(7);
- _globals->_player.setPriority2(95);
+ _globals->_player.fixPriority(95);
_globals->_player.changeZoom(80);
_globals->_player._moveDiff.x = 6;
_globals->_player._moveDiff.y = 3;
@@ -2312,10 +2330,10 @@ void Scene7700::postInit(SceneObjectList *OwnerList) {
if (_globals->getFlag(78)) {
_prof.setStrip2(4);
- _prof.setPriority2(80);
- _prof.setPosition(Common::Point(159, 87), 0);
+ _prof.fixPriority(80);
+ _prof.setPosition(Common::Point(159, 87));
} else {
- _prof.setPosition(Common::Point(203, 87), 0);
+ _prof.setPosition(Common::Point(203, 87));
_prof.setStrip2(2);
_prof._numFrames = 6;
_prof.setAction(&_action2);
@@ -2324,74 +2342,74 @@ void Scene7700::postInit(SceneObjectList *OwnerList) {
_cloud.postInit();
_cloud.setVisage(7700);
_cloud.setStrip2(5);
- _cloud.setPriority2(1);
- _cloud.setPosition(Common::Point(133, 160), 0);
+ _cloud.fixPriority(1);
+ _cloud.setPosition(Common::Point(133, 160));
_cloud._moveDiff.x = 1;
- _cloud._field7A = 7;
+ _cloud._moveRate = 7;
_cloud.setAction(&_action5);
_object1.postInit();
_object1.setVisage(7700);
- _object1.setPosition(Common::Point(184, 61), 0);
+ _object1.setPosition(Common::Point(184, 61));
_object1._lookLineNum = 18;
_object1._defltLineNum = 16;
_object2.postInit();
_object2.setVisage(7700);
- _object2.setPosition(Common::Point(184, 70), 0);
- _object2.setPriority2(60);
+ _object2.setPosition(Common::Point(184, 70));
+ _object2.fixPriority(60);
_object2._lookLineNum = 19;
_object2._defltLineNum = 17;
_object3.postInit();
_object3.setVisage(7703);
- _object3.setPosition(Common::Point(288, 36), 0);
+ _object3.setPosition(Common::Point(288, 36));
_object3.setStrip(2);
_object4.postInit();
_object4.setVisage(7700);
- _object4.setPosition(Common::Point(268, 59), 0);
+ _object4.setPosition(Common::Point(268, 59));
_object4.setStrip(2);
_object4._lookLineNum = 37;
_object4._defltLineNum = 35;
_object5.postInit();
_object5.setVisage(7700);
- _object5.setPosition(Common::Point(268, 67), 0);
- _object5.setPriority2(58);
+ _object5.setPosition(Common::Point(268, 67));
+ _object5.fixPriority(58);
_object5.setStrip2(3);
_object5._lookLineNum = 38;
_object5._defltLineNum = 36;
_object6.postInit();
_object6.setVisage(7700);
- _object6.setPosition(Common::Point(268, 75), 0);
- _object6.setPriority2(57);
+ _object6.setPosition(Common::Point(268, 75));
+ _object6.fixPriority(57);
_object6.setStrip2(4);
_object6._lookLineNum = 40;
_object6._defltLineNum = 43;
_object8.postInit();
_object8.setVisage(7703);
- _object8.setPosition(Common::Point(203, 91), 0);
+ _object8.setPosition(Common::Point(203, 91));
_object8.setStrip2(4);
- _object8.setPriority2(86);
+ _object8.fixPriority(86);
_sceneHotspot8.setBounds(82, 141, 161, 92);
_sceneHotspot9.setBounds(82, 187, 161, 141);
_cork.postInit();
_cork.setVisage(7703);
- _cork.setPosition(Common::Point(32, 128), 0);
+ _cork.setPosition(Common::Point(32, 128));
if (_globals->getFlag(49))
_cork.setFrame(_cork.getFrameCount());
- if (_globals->_inventory._emptyJar._sceneNumber == 7700) {
+ if (RING_INVENTORY._emptyJar._sceneNumber == 7700) {
_emptyJar.postInit();
_emptyJar.setVisage(7700);
_emptyJar.setStrip(8);
- _emptyJar.setPosition(Common::Point(189, 48), 0);
+ _emptyJar.setPosition(Common::Point(189, 48));
_globals->_sceneItems.addItems(&_emptyJar, NULL);
}
_sceneHotspot1._sceneRegionId = 28;
@@ -2420,8 +2438,8 @@ void Scene7700::postInit(SceneObjectList *OwnerList) {
_sceneHotspot15._useLineNum = 6;
_sceneHotspot15._lookLineNum = 7;
_sceneHotspot16.setBounds(0, 130, 34, 103);
- _sceneHotspot16._useLineNum = 8;
- _sceneHotspot16._lookLineNum = 9;
+ _sceneHotspot16._useLineNum = 7;
+ _sceneHotspot16._lookLineNum = 8;
_sceneHotspot17.setBounds(41, 180, 46, 170);
_sceneHotspot17._useLineNum = 11;
_sceneHotspot17._lookLineNum = 13;
@@ -2492,8 +2510,8 @@ void Scene7700::postInit(SceneObjectList *OwnerList) {
_globals->_sceneItems.addItems(&_object6, &_object5, &_object4, &_sceneHotspot6, &_sceneHotspot36, &_sceneItem7, NULL);
_sceneMode = 7701;
- setAction(&_sequenceManager, this, 7701, &_globals->_player, 0);
- _soundHandler.startSound(256, 0, 127);
+ setAction(&_sequenceManager, this, 7701, &_globals->_player, NULL);
+ _soundHandler.startSound(256);
}
Scene7700::Scene7700() {
diff --git a/engines/tsage/ringworld_scenes8.h b/engines/tsage/ringworld_scenes8.h
index 0c39920614..713520c6a0 100644
--- a/engines/tsage/ringworld_scenes8.h
+++ b/engines/tsage/ringworld_scenes8.h
@@ -41,14 +41,15 @@ public:
NamedHotspotMult() : SceneHotspot() {}
virtual Common::String getClassName() { return "NamedHotspotMult"; }
+ virtual void synchronize(Serializer &s);
};
class SceneObject7700 : public SceneObjectExt {
public:
int _lookLineNum, _defltLineNum;
- virtual void synchronise(Serialiser &s) {
- SceneObject::synchronise(s);
+ virtual void synchronize(Serializer &s) {
+ SceneObject::synchronize(s);
s.syncAsSint16LE(_lookLineNum);
s.syncAsSint16LE(_defltLineNum);
}
@@ -94,7 +95,7 @@ class Scene7000 : public Scene {
};
/* Items */
- class SceneItem1 : public SceneItem {
+ class Hotspot1 : public SceneHotspot {
public:
virtual void doAction(int action);
};
@@ -107,7 +108,7 @@ public:
SpeakerQL _speakerQL;
SpeakerQR _speakerQR;
SpeakerQText _speakerQText;
- SceneObject _object1;
+ Object1 _object1;
SceneObject _object2;
SceneObject _object3;
SceneObject _object4;
@@ -124,7 +125,7 @@ public:
Action5 _action5;
Action6 _action6;
Action7 _action7;
- SceneItem1 _sceneItem1;
+ Hotspot1 _hotspot1;
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void signal();
diff --git a/engines/tsage/saveload.cpp b/engines/tsage/saveload.cpp
index 7983e2a34c..a0091bfd6a 100644
--- a/engines/tsage/saveload.cpp
+++ b/engines/tsage/saveload.cpp
@@ -24,6 +24,7 @@
*/
#include "common/savefile.h"
+#include "graphics/palette.h"
#include "graphics/scaler.h"
#include "graphics/thumbnail.h"
#include "tsage/globals.h"
@@ -52,7 +53,7 @@ Saver::Saver() {
Saver::~Saver() {
// Internal validation that no saved object is still present
int totalLost = 0;
- for (SynchronisedList<SavedObject *>::iterator i = _saver->_objList.begin(); i != _saver->_objList.end(); ++i) {
+ for (SynchronizedList<SavedObject *>::iterator i = _saver->_objList.begin(); i != _saver->_objList.end(); ++i) {
SavedObject *so = *i;
if (so)
++totalLost;
@@ -64,7 +65,7 @@ Saver::~Saver() {
/*--------------------------------------------------------------------------*/
-void Serialiser::syncPointer(SavedObject **ptr, Common::Serializer::Version minVersion,
+void Serializer::syncPointer(SavedObject **ptr, Common::Serializer::Version minVersion,
Common::Serializer::Version maxVersion) {
int idx;
assert(ptr);
@@ -88,7 +89,7 @@ void Serialiser::syncPointer(SavedObject **ptr, Common::Serializer::Version minV
}
}
-void Serialiser::validate(const Common::String &s, Common::Serializer::Version minVersion,
+void Serializer::validate(const Common::String &s, Common::Serializer::Version minVersion,
Common::Serializer::Version maxVersion) {
Common::String tempStr = s;
syncString(tempStr, minVersion, maxVersion);
@@ -97,7 +98,7 @@ void Serialiser::validate(const Common::String &s, Common::Serializer::Version m
error("Savegame is corrupt");
}
-void Serialiser::validate(int v, Common::Serializer::Version minVersion,
+void Serializer::validate(int v, Common::Serializer::Version minVersion,
Common::Serializer::Version maxVersion) {
int tempVal = v;
syncAsUint32LE(tempVal, minVersion, maxVersion);
@@ -117,9 +118,10 @@ Common::Error Saver::save(int slot, const Common::String &saveName) {
_macroSaveFlag = true;
_saveSlot = slot;
- // Set up the serialiser
+ // Set up the serializer
Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(_vm->generateSaveName(slot));
- Serialiser serialiser(NULL, saveFile);
+ Serializer serializer(NULL, saveFile);
+ serializer.setSaveVersion(TSAGE_SAVEGAME_VERSION);
// Write out the savegame header
tSageSavegameHeader header;
@@ -128,14 +130,14 @@ Common::Error Saver::save(int slot, const Common::String &saveName) {
writeSavegameHeader(saveFile, header);
// Save out objects that need to come at the start of the savegame
- for (SynchronisedList<SaveListener *>::iterator i = _listeners.begin(); i != _listeners.end(); ++i) {
- (*i)->listenerSynchronise(serialiser);
+ for (SynchronizedList<SaveListener *>::iterator i = _listeners.begin(); i != _listeners.end(); ++i) {
+ (*i)->listenerSynchronize(serializer);
}
// Save each registered SaveObject descendant object into the savegame file
- for (SynchronisedList<SavedObject *>::iterator i = _objList.begin(); i != _objList.end(); ++i) {
- serialiser.validate((*i)->getClassName());
- (*i)->synchronise(serialiser);
+ for (SynchronizedList<SavedObject *>::iterator i = _objList.begin(); i != _objList.end(); ++i) {
+ serializer.validate((*i)->getClassName());
+ (*i)->synchronize(serializer);
}
// Save file complete
@@ -151,34 +153,36 @@ Common::Error Saver::save(int slot, const Common::String &saveName) {
}
Common::Error Saver::restore(int slot) {
- assert(!getMacroSaveFlag());
+ assert(!getMacroRestoreFlag());
// Signal any objects registered for notification
_loadNotifiers.notify(false);
// Set fields
- _macroSaveFlag = true;
+ _macroRestoreFlag = true;
_saveSlot = slot;
_unresolvedPtrs.clear();
- // Set up the serialiser
+ // Set up the serializer
Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(_vm->generateSaveName(slot));
- Serialiser serialiser(saveFile, NULL);
+ Serializer serializer(saveFile, NULL);
// Read in the savegame header
tSageSavegameHeader header;
readSavegameHeader(saveFile, header);
delete header.thumbnail;
+ serializer.setSaveVersion(header.version);
+
// Load in data for objects that need to come at the start of the savegame
for (Common::List<SaveListener *>::iterator i = _listeners.begin(); i != _listeners.end(); ++i) {
- (*i)->listenerSynchronise(serialiser);
+ (*i)->listenerSynchronize(serializer);
}
// Loop through each registered object to load in the data
- for (SynchronisedList<SavedObject *>::iterator i = _objList.begin(); i != _objList.end(); ++i) {
- serialiser.validate((*i)->getClassName());
- (*i)->synchronise(serialiser);
+ for (SynchronizedList<SavedObject *>::iterator i = _objList.begin(); i != _objList.end(); ++i) {
+ serializer.validate((*i)->getClassName());
+ (*i)->synchronize(serializer);
}
// Loop through the remaining data of the file, instantiating new objects.
@@ -186,17 +190,17 @@ Common::Error Saver::restore(int slot) {
// of instantiating a saved object registers it with the saver, and will then be resolved to whatever
// object originally had a pointer to it as part of the post-processing step
Common::String className;
- serialiser.syncString(className);
+ serializer.syncString(className);
while (className != "END") {
SavedObject *savedObject;
if (!_factoryPtr || ((savedObject = _factoryPtr(className)) == NULL))
error("Unknown class name '%s' encountered trying to restore savegame", className.c_str());
// Populate the contents of the object
- savedObject->synchronise(serialiser);
+ savedObject->synchronize(serializer);
// Move to next object
- serialiser.syncString(className);
+ serializer.syncString(className);
}
// Post-process any unresolved pointers to get the correct pointer
@@ -224,7 +228,7 @@ bool Saver::readSavegameHeader(Common::InSaveFile *in, tSageSavegameHeader &head
return false;
header.version = in->readByte();
- if (header.version != TSAGE_SAVEGAME_VERSION)
+ if (header.version > TSAGE_SAVEGAME_VERSION)
return false;
// Read in the string
@@ -261,16 +265,8 @@ void Saver::writeSavegameHeader(Common::OutSaveFile *out, tSageSavegameHeader &h
out->write(header.saveName.c_str(), header.saveName.size() + 1);
// Get the active palette
- uint32 workPal[256];
uint8 thumbPalette[256 * 3];
- const byte *srcP = (const byte *)&workPal[0];
- byte *destP = &thumbPalette[0];
- g_system->getPaletteManager()->grabPalette((byte *)workPal, 0, 256);
- for (int idx = 0; idx < 256; ++idx, ++srcP) {
- *destP++ = *srcP++;
- *destP++ = *srcP++;
- *destP++ = *srcP++;
- }
+ g_system->getPaletteManager()->grabPalette(thumbPalette, 0, 256);
// Create a thumbnail and save it
Graphics::Surface *thumb = new Graphics::Surface();
@@ -343,7 +339,7 @@ bool Saver::savegamesExist() const {
*/
int Saver::blockIndexOf(SavedObject *p) {
int objIndex = 1;
- SynchronisedList<SavedObject *>::iterator iObj;
+ Common::List<SavedObject *>::iterator iObj;
for (iObj = _objList.begin(); iObj != _objList.end(); ++iObj, ++objIndex) {
SavedObject *iObjP = *iObj;
@@ -355,6 +351,25 @@ int Saver::blockIndexOf(SavedObject *p) {
}
/**
+ * Returns the number of objects in the object list registry
+ */
+int Saver::getObjectCount() const {
+ return _objList.size();
+}
+
+/**
+ * List any currently active objects
+ */
+void Saver::listObjects() {
+ Common::List<SavedObject *>::iterator i;
+ int count = 1;
+
+ for (i = _objList.begin(); i != _objList.end(); ++i, ++count)
+ debug("%d - %s", count, (*i)->getClassName().c_str());
+ debugN("\n");
+}
+
+/**
* Returns the pointer associated with the specified object index
*/
void Saver::resolveLoadPointers() {
@@ -364,14 +379,16 @@ void Saver::resolveLoadPointers() {
// Outer loop through the main object list
int objIndex = 1;
- for (SynchronisedList<SavedObject *>::iterator iObj = _objList.begin(); iObj != _objList.end(); ++iObj, ++objIndex) {
+ for (SynchronizedList<SavedObject *>::iterator iObj = _objList.begin(); iObj != _objList.end(); ++iObj, ++objIndex) {
Common::List<SavedObjectRef>::iterator iPtr;
+ SavedObject *pObj = *iObj;
for (iPtr = _unresolvedPtrs.begin(); iPtr != _unresolvedPtrs.end(); ) {
SavedObjectRef &r = *iPtr;
if (r._objIndex == objIndex) {
// Found an unresolved pointer to this object
- *r._savedObject = *iObj;
+ SavedObject **objPP = r._savedObject;
+ *objPP = pObj;
iPtr = _unresolvedPtrs.erase(iPtr);
} else {
++iPtr;
diff --git a/engines/tsage/saveload.h b/engines/tsage/saveload.h
index 83661b8f15..cf7d087e6e 100644
--- a/engines/tsage/saveload.h
+++ b/engines/tsage/saveload.h
@@ -36,7 +36,7 @@ namespace tSage {
typedef void (*SaveNotifierFn)(bool postFlag);
-#define TSAGE_SAVEGAME_VERSION 1
+#define TSAGE_SAVEGAME_VERSION 2
class SavedObject;
@@ -51,16 +51,28 @@ struct tSageSavegameHeader {
/*--------------------------------------------------------------------------*/
-#define SYNC_POINTER(x) s.syncPointer((SavedObject **)&x)
+// FIXME: workaround to supress spurious strict-alias warnings on older GCC
+// versions. this should be resolved with the savegame rewrite
+#define SYNC_POINTER(x) do { \
+ SavedObject **y = (SavedObject **)((void *)&x); \
+ s.syncPointer(y); \
+} while (false)
+
#define SYNC_ENUM(FIELD, TYPE) int v_##FIELD = (int)FIELD; s.syncAsUint16LE(v_##FIELD); \
if (s.isLoading()) FIELD = (TYPE)v_##FIELD;
/**
- * Derived serialiser class with extra synchronisation types
+ * Derived serializer class with extra synchronisation types
*/
-class Serialiser : public Common::Serializer {
+class Serializer : public Common::Serializer {
public:
- Serialiser(Common::SeekableReadStream *in, Common::WriteStream *out) : Common::Serializer(in, out) {}
+ Serializer(Common::SeekableReadStream *in, Common::WriteStream *out) : Common::Serializer(in, out) {}
+
+ // HACK: TSAGE saved games contain a single byte for the savegame version,
+ // thus the normal syncVersion() Serializer member won't work here. In order
+ // to maintain compatibility with older game saves, this method is provided
+ // in order to set the savegame version from a byte
+ void setSaveVersion(byte version) { _version = version; }
void syncPointer(SavedObject **ptr, Common::Serializer::Version minVersion = 0,
Common::Serializer::Version maxVersion = kLastVersion);
@@ -75,13 +87,13 @@ public:
class Serialisable {
public:
virtual ~Serialisable() {}
- virtual void synchronise(Serialiser &s) = 0;
+ virtual void synchronize(Serializer &s) = 0;
};
class SaveListener {
public:
virtual ~SaveListener() {}
- virtual void listenerSynchronise(Serialiser &s) = 0;
+ virtual void listenerSynchronize(Serializer &s) = 0;
};
/*--------------------------------------------------------------------------*/
@@ -92,7 +104,7 @@ public:
virtual ~SavedObject();
virtual Common::String getClassName() { return "SavedObject"; }
- virtual void synchronise(Serialiser &s) {}
+ virtual void synchronize(Serializer &s) {}
static SavedObject *createInstance(const Common::String &className);
};
@@ -103,9 +115,9 @@ public:
* Derived list class with extra functionality
*/
template<typename T>
-class SynchronisedList : public Common::List<T> {
+class SynchronizedList : public Common::List<T> {
public:
- void synchronise(Serialiser &s) {
+ void synchronize(Serializer &s) {
int entryCount;
if (s.isLoading()) {
@@ -170,7 +182,7 @@ typedef SavedObject *(*SavedObjectFactory)(const Common::String &className);
class Saver {
private:
- SynchronisedList<SavedObject *> _objList;
+ Common::List<SavedObject *> _objList;
FunctionList<bool> _saveNotifiers;
FunctionList<bool> _loadNotifiers;
Common::List<SaveListener *> _listeners;
@@ -206,6 +218,8 @@ public:
bool getMacroSaveFlag() const { return _macroSaveFlag; }
bool getMacroRestoreFlag() const { return _macroRestoreFlag; }
int blockIndexOf(SavedObject *p);
+ int getObjectCount() const;
+ void listObjects();
};
extern Saver *_saver;
diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp
index 68320066d7..f554d546f6 100644
--- a/engines/tsage/scenes.cpp
+++ b/engines/tsage/scenes.cpp
@@ -27,6 +27,7 @@
#include "tsage/globals.h"
#include "tsage/ringworld_logic.h"
#include "tsage/tsage.h"
+#include "tsage/saveload.h"
namespace tSage {
@@ -39,6 +40,7 @@ SceneManager::SceneManager() {
_fadeMode = FADEMODE_GRADUAL;
_scrollerRect = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
_saver->addListener(this);
+ _objectCount = 0;
}
SceneManager::~SceneManager() {
@@ -46,6 +48,7 @@ SceneManager::~SceneManager() {
}
void SceneManager::setNewScene(int sceneNumber) {
+ warning("SetNewScene(%d)", sceneNumber);
_nextSceneNumber = sceneNumber;
}
@@ -59,12 +62,16 @@ void SceneManager::checkScene() {
}
void SceneManager::sceneChange() {
+ int activeScreenNumber = 0;
+
// Handle removing the scene
- if (_scene)
+ if (_scene) {
+ activeScreenNumber = _scene->_activeScreenNumber;
_scene->remove();
+ }
// Clear the scene objects
- SynchronisedList<SceneObject *>::iterator io = _globals->_sceneObjects->begin();
+ SynchronizedList<SceneObject *>::iterator io = _globals->_sceneObjects->begin();
while (io != _globals->_sceneObjects->end()) {
SceneObject *sceneObj = *io;
++io;
@@ -80,7 +87,7 @@ void SceneManager::sceneChange() {
}
// Clear the hotspot list
- SynchronisedList<SceneItem *>::iterator ii = _globals->_sceneItems.begin();
+ SynchronizedList<SceneItem *>::iterator ii = _globals->_sceneItems.begin();
while (ii != _globals->_sceneItems.end()) {
SceneItem *sceneItem = *ii;
++ii;
@@ -106,9 +113,20 @@ void SceneManager::sceneChange() {
// Free any regions
disposeRegions();
+ // Ensure that the same number of objects are registered now as when the scene started
+ if (_objectCount > 0) {
+ assert(_objectCount == _saver->getObjectCount());
+ }
+ _objectCount = _saver->getObjectCount();
+ _globals->_sceneHandler._delayTicks = 2;
+
// Instantiate and set the new scene
_scene = getNewScene();
- _scene->postInit();
+
+ if (!_saver->getMacroRestoreFlag())
+ _scene->postInit();
+ else
+ _scene->loadScene(activeScreenNumber);
}
Scene *SceneManager::getNewScene() {
@@ -133,6 +151,7 @@ void SceneManager::fadeInIfNecessary() {
}
void SceneManager::changeScene(int newSceneNumber) {
+ warning("changeScene(%d)", newSceneNumber);
// Fade out the scene
ScenePalette scenePalette;
uint32 adjustData = 0;
@@ -145,7 +164,7 @@ void SceneManager::changeScene(int newSceneNumber) {
}
// Stop any objects that were animating
- SynchronisedList<SceneObject *>::iterator i;
+ SynchronizedList<SceneObject *>::iterator i;
for (i = _globals->_sceneObjects->begin(); i != _globals->_sceneObjects->end(); ++i) {
SceneObject *sceneObj = *i;
Common::Point pt(0, 0);
@@ -208,18 +227,19 @@ void SceneManager::setBgOffset(const Common::Point &pt, int loadCount) {
_sceneLoadCount = loadCount;
}
-void SceneManager::listenerSynchronise(Serialiser &s) {
+void SceneManager::listenerSynchronize(Serializer &s) {
s.validate("SceneManager");
- _altSceneObjects.synchronise(s);
+ _altSceneObjects.synchronize(s);
s.syncAsSint32LE(_sceneNumber);
+ s.syncAsUint16LE(_globals->_sceneManager._scene->_activeScreenNumber);
+
if (s.isLoading()) {
changeScene(_sceneNumber);
checkScene();
}
- s.syncAsUint16LE(_globals->_sceneManager._scene->_activeScreenNumber);
- _globals->_sceneManager._scrollerRect.synchronise(s);
+ _globals->_sceneManager._scrollerRect.synchronize(s);
SYNC_POINTER(_globals->_scrollFollower);
s.syncAsSint16LE(_loadMode);
}
@@ -230,19 +250,23 @@ Scene::Scene() : _sceneBounds(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT),
_backgroundBounds(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) {
_sceneMode = 0;
_oldSceneBounds = Rect(4000, 4000, 4100, 4100);
+ Common::set_to(&_zoomPercents[0], &_zoomPercents[256], 0);
}
Scene::~Scene() {
}
-void Scene::synchronise(Serialiser &s) {
+void Scene::synchronize(Serializer &s) {
+ if (s.getVersion() >= 2)
+ StripCallback::synchronize(s);
+
s.syncAsSint32LE(_field12);
- s.syncAsSint32LE(_sceneNumber);
+ s.syncAsSint32LE(_screenNumber);
s.syncAsSint32LE(_activeScreenNumber);
s.syncAsSint32LE(_sceneMode);
- _backgroundBounds.synchronise(s);
- _sceneBounds.synchronise(s);
- _oldSceneBounds.synchronise(s);
+ _backgroundBounds.synchronize(s);
+ _sceneBounds.synchronize(s);
+ _oldSceneBounds.synchronize(s);
s.syncAsSint16LE(_fieldA);
s.syncAsSint16LE(_fieldE);
@@ -269,7 +293,8 @@ void Scene::dispatch() {
}
void Scene::loadScene(int sceneNum) {
- _sceneNumber = sceneNum;
+ warning("loadScene(%d)", sceneNum);
+ _screenNumber = sceneNum;
if (_globals->_scenePalette.loadPalette(sceneNum))
_globals->_sceneManager._hasPalette = true;
@@ -277,10 +302,10 @@ void Scene::loadScene(int sceneNum) {
}
void Scene::loadSceneData(int sceneNum) {
- _globals->_sceneManager._scene->_activeScreenNumber = sceneNum;
+ _activeScreenNumber = sceneNum;
// Get the basic scene size
- byte *data = _vm->_dataManager->getResource(RES_BITMAP, sceneNum, 9999);
+ byte *data = _resourceManager->getResource(RES_BITMAP, sceneNum, 9999);
_backgroundBounds = Rect(0, 0, READ_LE_UINT16(data), READ_LE_UINT16(data + 2));
_globals->_sceneManager._scene->_sceneBounds.contain(_backgroundBounds);
DEALLOCATE(data);
@@ -411,7 +436,7 @@ void Scene::drawAltObjects() {
Common::Array<SceneObject *> objList;
// Initial loop to set the priority for entries in the list
- for (SynchronisedList<SceneObject *>::iterator i = _globals->_sceneManager._altSceneObjects.begin();
+ for (SynchronizedList<SceneObject *>::iterator i = _globals->_sceneManager._altSceneObjects.begin();
i != _globals->_sceneManager._altSceneObjects.end(); ++i) {
SceneObject *obj = *i;
objList.push_back(obj);
diff --git a/engines/tsage/scenes.h b/engines/tsage/scenes.h
index 1a6f92745d..11637de1a7 100644
--- a/engines/tsage/scenes.h
+++ b/engines/tsage/scenes.h
@@ -39,7 +39,7 @@ private:
void drawAltObjects();
public:
int _field12;
- int _sceneNumber;
+ int _screenNumber;
int _activeScreenNumber;
int _sceneMode;
StripManager _stripManager;
@@ -59,7 +59,7 @@ public:
virtual ~Scene();
virtual Common::String getClassName() { return "Scene"; }
- virtual void synchronise(Serialiser &s);
+ virtual void synchronize(Serializer &s);
virtual void stripCallback(int v) {}
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void process(Event &event);
@@ -88,11 +88,12 @@ public:
int _sceneLoadCount;
Rect _scrollerRect;
SceneObjectList _altSceneObjects;
+ int _objectCount;
public:
SceneManager();
virtual ~SceneManager();
- virtual void listenerSynchronise(Serialiser &s);
+ virtual void listenerSynchronize(Serializer &s);
void setNewScene(int sceneNumber);
void checkScene();
void sceneChange();
diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp
index 7c8325d53e..9d50316baf 100644
--- a/engines/tsage/sound.cpp
+++ b/engines/tsage/sound.cpp
@@ -23,8 +23,6 @@
*
*/
-#include "common/config-manager.h"
-#include "common/endian.h"
#include "tsage/core.h"
#include "tsage/globals.h"
#include "tsage/debugger.h"
@@ -54,9 +52,9 @@ void SoundManager::loadNotifierProc(bool postFlag) {
warning("TODO: SoundManager::loadNotifierProc");
}
-void SoundManager::listenerSynchronise(Serialiser &s) {
+void SoundManager::listenerSynchronize(Serializer &s) {
s.validate("SoundManager");
- warning("TODO: SoundManager listenerSynchronise");
+ warning("TODO: SoundManager listenerSynchronize");
}
} // End of namespace tSage
diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h
index a495344038..45815de69f 100644
--- a/engines/tsage/sound.h
+++ b/engines/tsage/sound.h
@@ -34,7 +34,7 @@ namespace tSage {
class SoundManager : public SaveListener {
public:
void dispatch() {}
- virtual void listenerSynchronise(Serialiser &s);
+ virtual void listenerSynchronize(Serializer &s);
virtual void postInit();
void proc2() {}
diff --git a/engines/tsage/staticres.cpp b/engines/tsage/staticres.cpp
index 46b75e30ea..bc85718035 100644
--- a/engines/tsage/staticres.cpp
+++ b/engines/tsage/staticres.cpp
@@ -114,4 +114,7 @@ const char *SCENE6100_SWEAT = "Humans sweat, Kzin twitch their tail. What's the
const char *SCENE6100_VERY_WELL = "Very well. I will retrieve the stasis box and return the probe. \
Wait for it's return in the lander bay.";
+const char *DEMO_HELP_MSG = " Help...\rF2 - Sound Options\rF3 - Exit demo\r\rPress ENTER\rto continue";
+const char *DEMO_PAUSED_MSG = " demo is paused";
+
} // End of namespace tSage
diff --git a/engines/tsage/staticres.h b/engines/tsage/staticres.h
index cb62272735..0db349f8a7 100644
--- a/engines/tsage/staticres.h
+++ b/engines/tsage/staticres.h
@@ -79,6 +79,10 @@ extern const char *SCENE6100_SURPRISE;
extern const char *SCENE6100_SWEAT;
extern const char *SCENE6100_VERY_WELL;
+// Demo messages
+extern const char *DEMO_HELP_MSG;
+extern const char *DEMO_PAUSED_MSG;
+
} // End of namespace tSage
#endif
diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp
index 1f6442f2ff..8813fc7e45 100644
--- a/engines/tsage/tsage.cpp
+++ b/engines/tsage/tsage.cpp
@@ -23,11 +23,7 @@
*
*/
-#include "common/config-manager.h"
-#include "common/debug.h"
#include "common/debug-channels.h"
-#include "common/system.h"
-#include "common/savefile.h"
#include "engines/util.h"
#include "tsage/tsage.h"
@@ -46,7 +42,6 @@ TSageEngine::TSageEngine(OSystem *system, const tSageGameDescription *gameDesc)
_vm = this;
DebugMan.addDebugChannel(kRingDebugScripts, "scripts", "Scripts debugging");
_debugger = new Debugger();
- _dataManager = NULL;
}
Common::Error TSageEngine::init() {
@@ -69,29 +64,34 @@ bool TSageEngine::hasFeature(EngineFeature f) const {
}
void TSageEngine::initialise() {
- _tSageManager = new RlbManager(_memoryManager, "tsage.rlb");
- _dataManager = new RlbManager(_memoryManager, "ring.rlb");
-
_saver = new Saver();
+
+ // Set up the resource manager
+ _resourceManager = new ResourceManager();
+ if (_vm->getFeatures() & GF_DEMO) {
+ // Add the single library file associated with the demo
+ _resourceManager->addLib(getPrimaryFilename());
+ } else {
+ _resourceManager->addLib("RING.RLB");
+ _resourceManager->addLib("TSAGE.RLB");
+ }
+
_globals = new Globals();
_globals->gfxManager().setDefaults();
}
void TSageEngine::deinitialise() {
delete _globals;
+ delete _resourceManager;
delete _saver;
- delete _tSageManager;
- delete _dataManager;
}
Common::Error TSageEngine::run() {
// Basic initialisation
initialise();
- _globals->_events.showCursor();
-
_globals->_sceneHandler.registerHandler();
- _globals->_game.execute();
+ _globals->_game->execute();
deinitialise();
return Common::kNoError;
@@ -101,14 +101,14 @@ Common::Error TSageEngine::run() {
* Returns true if it is currently okay to restore a game
*/
bool TSageEngine::canLoadGameStateCurrently() {
- return _globals->getFlag(50) == 0;
+ return (_globals->getFlag(50) == 0);
}
/**
* Returns true if it is currently okay to save the game
*/
bool TSageEngine::canSaveGameStateCurrently() {
- return _globals->getFlag(50) == 0;
+ return (_globals->getFlag(50) == 0);
}
/**
diff --git a/engines/tsage/tsage.h b/engines/tsage/tsage.h
index 2a627d80bc..06c66d8f42 100644
--- a/engines/tsage/tsage.h
+++ b/engines/tsage/tsage.h
@@ -50,7 +50,8 @@ enum {
enum {
GF_DEMO = 1 << 0,
GF_CD = 1 << 1,
- GF_FLOPPY = 1 << 2
+ GF_FLOPPY = 1 << 2,
+ GF_ALT_REGIONS = 1 << 3
};
enum {
@@ -61,8 +62,8 @@ struct tSageGameDescription;
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 200
-#define SCREEN_CENTRE_X 160
-#define SCREEN_CENTRE_Y 100
+#define SCREEN_CENTER_X 160
+#define SCREEN_CENTER_Y 100
class TSageEngine : public Engine {
private:
@@ -74,12 +75,11 @@ public:
MemoryManager _memoryManager;
Debugger *_debugger;
- RlbManager *_tSageManager;
- RlbManager *_dataManager;
const char *getGameId() const;
uint32 getGameID() const;
uint32 getFeatures() const;
+ Common::String getPrimaryFilename() const;
virtual Common::Error init();
virtual Common::Error run();
diff --git a/engines/tucker/locations.cpp b/engines/tucker/locations.cpp
index 108c6bcad5..ee117d233d 100644
--- a/engines/tucker/locations.cpp
+++ b/engines/tucker/locations.cpp
@@ -26,6 +26,7 @@
#include "tucker/tucker.h"
#include "tucker/graphics.h"
#include "common/system.h"
+#include "graphics/palette.h"
namespace Tucker {
diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp
index c0f1baae99..aeb4399dee 100644
--- a/engines/tucker/resource.cpp
+++ b/engines/tucker/resource.cpp
@@ -24,6 +24,7 @@
*/
#include "common/file.h"
+#include "common/textconsole.h"
#include "audio/audiostream.h"
#include "audio/decoders/flac.h"
diff --git a/engines/tucker/saveload.cpp b/engines/tucker/saveload.cpp
index 83533a90c3..52c6bf19ce 100644
--- a/engines/tucker/saveload.cpp
+++ b/engines/tucker/saveload.cpp
@@ -24,6 +24,7 @@
*/
#include "common/savefile.h"
+#include "common/textconsole.h"
#include "tucker/tucker.h"
diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp
index 5e99e3ccef..d747b346ee 100644
--- a/engines/tucker/sequences.cpp
+++ b/engines/tucker/sequences.cpp
@@ -24,11 +24,14 @@
*/
#include "common/system.h"
+#include "common/textconsole.h"
#include "audio/audiostream.h"
#include "audio/decoders/raw.h"
#include "audio/decoders/wave.h"
+#include "graphics/palette.h"
+
#include "tucker/tucker.h"
#include "tucker/graphics.h"
diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp
index e41cbfbeef..ed3046867b 100644
--- a/engines/tucker/tucker.cpp
+++ b/engines/tucker/tucker.cpp
@@ -26,10 +26,17 @@
#include "common/config-manager.h"
#include "common/events.h"
#include "common/system.h"
+#include "common/archive.h"
+#include "common/debug.h"
+#include "common/error.h"
+#include "common/keyboard.h"
+#include "common/textconsole.h"
#include "engines/util.h"
#include "graphics/cursorman.h"
+#include "graphics/palette.h"
+#include "gui/debugger.h"
#include "tucker/tucker.h"
#include "tucker/graphics.h"