aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Zbróg2013-11-04 11:40:22 +0000
committerKamil Zbróg2013-11-04 11:40:22 +0000
commit85694ec1f5793eb4025f4153ef4bf71d3769d699 (patch)
treec93fab58eb2f52eca244895a9867d28134dbd7f5
parent026390145b0e947be7cccf3d9ba329eb2270a2ed (diff)
parent9dc35033f523c9c694f24e15ed45ba6194786a25 (diff)
downloadscummvm-rg350-85694ec1f5793eb4025f4153ef4bf71d3769d699.tar.gz
scummvm-rg350-85694ec1f5793eb4025f4153ef4bf71d3769d699.tar.bz2
scummvm-rg350-85694ec1f5793eb4025f4153ef4bf71d3769d699.zip
Merge remote-tracking branch 'own/prince' into prince-malik
Conflicts: engines/prince/debugger.cpp engines/prince/debugger.h engines/prince/detection.cpp engines/prince/font.cpp engines/prince/graphics.cpp engines/prince/prince.cpp engines/prince/prince.h engines/prince/script.cpp engines/prince/script.h
-rw-r--r--AUTHORS390
-rw-r--r--audio/softsynth/mt32.cpp3
-rw-r--r--backends/fs/amigaos4/amigaos4-fs.cpp14
-rw-r--r--backends/platform/sdl/sdl.cpp15
-rw-r--r--common/c++11-compat.h2
-rw-r--r--common/recorderfile.cpp2
-rw-r--r--common/winexe_ne.cpp2
-rw-r--r--common/winexe_ne.h2
-rw-r--r--common/zlib.cpp22
-rw-r--r--devtools/create_mortdat/create_mortdat.cpp2
-rwxr-xr-xdevtools/credits.pl29
-rw-r--r--devtools/extract_mort/extract_mort.cpp4
-rw-r--r--engines/avalanche/animation.cpp40
-rw-r--r--engines/avalanche/animation.h3
-rw-r--r--engines/avalanche/avalanche.cpp86
-rw-r--r--engines/avalanche/avalanche.h5
-rw-r--r--engines/avalanche/avalot.cpp18
-rw-r--r--engines/avalanche/background.cpp1
-rw-r--r--engines/avalanche/detection.cpp4
-rw-r--r--engines/avalanche/dialogs.cpp19
-rw-r--r--engines/avalanche/graphics.cpp1
-rw-r--r--engines/avalanche/menu.cpp14
-rw-r--r--engines/avalanche/menu.h1
-rw-r--r--engines/avalanche/parser.cpp19
-rw-r--r--engines/cge/detection.cpp12
-rw-r--r--engines/cine/sound.cpp4
-rw-r--r--engines/drascula/drascula.cpp26
-rw-r--r--engines/dreamweb/dreamweb.cpp9
-rw-r--r--engines/fullpipe/behavior.cpp6
-rw-r--r--engines/fullpipe/behavior.h2
-rw-r--r--engines/fullpipe/constants.h23
-rw-r--r--engines/fullpipe/fullpipe.cpp2
-rw-r--r--engines/fullpipe/fullpipe.h3
-rw-r--r--engines/fullpipe/gameloader.cpp2
-rw-r--r--engines/fullpipe/input.cpp2
-rw-r--r--engines/fullpipe/lift.cpp4
-rw-r--r--engines/fullpipe/messages.cpp19
-rw-r--r--engines/fullpipe/messages.h2
-rw-r--r--engines/fullpipe/modal.cpp181
-rw-r--r--engines/fullpipe/modal.h30
-rw-r--r--engines/fullpipe/motion.cpp50
-rw-r--r--engines/fullpipe/scene.cpp2
-rw-r--r--engines/fullpipe/scenes.cpp107
-rw-r--r--engines/fullpipe/scenes.h7
-rw-r--r--engines/fullpipe/statics.cpp54
-rw-r--r--engines/fullpipe/statics.h6
-rw-r--r--engines/hopkins/hopkins.cpp6
-rw-r--r--engines/hugo/dialogs.cpp12
-rw-r--r--engines/hugo/display.cpp8
-rw-r--r--engines/hugo/file.cpp6
-rw-r--r--engines/hugo/hugo.cpp46
-rw-r--r--engines/hugo/hugo.h5
-rw-r--r--engines/hugo/intro.cpp4
-rw-r--r--engines/hugo/inventory.cpp4
-rw-r--r--engines/hugo/mouse.cpp6
-rw-r--r--engines/hugo/object.cpp42
-rw-r--r--engines/hugo/parser.cpp26
-rw-r--r--engines/hugo/route.cpp13
-rw-r--r--engines/hugo/route.h4
-rw-r--r--engines/hugo/schedule.cpp62
-rw-r--r--engines/hugo/sound.cpp5
-rw-r--r--engines/hugo/text.cpp31
-rw-r--r--engines/made/made.cpp6
-rw-r--r--engines/mortevielle/utils.cpp3
-rw-r--r--engines/neverhood/detection.cpp12
-rw-r--r--engines/neverhood/klaymen.cpp67
-rw-r--r--engines/neverhood/klaymen.h7
-rw-r--r--engines/neverhood/menumodule.cpp2
-rw-r--r--engines/neverhood/modules/module1000_sprites.cpp229
-rw-r--r--engines/neverhood/modules/module1000_sprites.h5
-rw-r--r--engines/neverhood/modules/module2200.cpp14
-rw-r--r--engines/neverhood/modules/module2800.cpp3
-rw-r--r--engines/neverhood/neverhood.cpp1
-rw-r--r--engines/neverhood/screen.h1
-rw-r--r--engines/parallaction/graphics.cpp2
-rw-r--r--engines/parallaction/graphics.h2
-rw-r--r--engines/parallaction/sound_br.cpp1
-rw-r--r--engines/parallaction/sound_ns.cpp1
-rw-r--r--engines/prince/archive.h1
-rw-r--r--engines/prince/debugger.cpp46
-rw-r--r--engines/prince/debugger.h19
-rw-r--r--engines/prince/detection.cpp292
-rw-r--r--engines/prince/flags.cpp406
-rw-r--r--engines/prince/flags.h416
-rw-r--r--engines/prince/font.cpp58
-rw-r--r--engines/prince/font.h28
-rw-r--r--engines/prince/graphics.cpp51
-rw-r--r--engines/prince/graphics.h23
-rw-r--r--engines/prince/mhwanh.cpp56
-rw-r--r--engines/prince/mhwanh.h28
-rw-r--r--engines/prince/mob.cpp65
-rw-r--r--engines/prince/mob.h53
-rw-r--r--engines/prince/module.mk41
-rw-r--r--engines/prince/musNum.h87
-rw-r--r--engines/prince/object.cpp78
-rw-r--r--engines/prince/object.h48
-rw-r--r--engines/prince/prince.cpp790
-rw-r--r--engines/prince/prince.h255
-rw-r--r--engines/prince/script.cpp1127
-rw-r--r--engines/prince/script.h381
-rw-r--r--engines/prince/sound.cpp216
-rw-r--r--engines/prince/sound.h73
-rw-r--r--engines/prince/variatxt.cpp59
-rw-r--r--engines/prince/variatxt.h44
-rw-r--r--engines/sci/console.cpp13
-rw-r--r--engines/sci/engine/kernel_tables.h2
-rw-r--r--engines/sci/engine/script.cpp2
-rw-r--r--engines/sci/engine/script.h9
-rw-r--r--engines/sci/engine/script_patches.cpp2228
-rw-r--r--engines/sci/engine/seg_manager.cpp10
-rw-r--r--engines/sci/engine/vm.cpp17
-rw-r--r--engines/sci/engine/workarounds.cpp17
-rw-r--r--engines/sci/engine/workarounds.h1
-rw-r--r--engines/sci/sci.cpp23
-rw-r--r--engines/sci/sci.h46
-rw-r--r--engines/scumm/imuse_digi/dimuse_sndmgr.cpp2
-rw-r--r--engines/scumm/module.mk34
-rw-r--r--engines/scumm/players/player_ad.cpp (renamed from engines/scumm/player_ad.cpp)2
-rw-r--r--engines/scumm/players/player_ad.h (renamed from engines/scumm/player_ad.h)4
-rw-r--r--engines/scumm/players/player_apple2.cpp (renamed from engines/scumm/player_apple2.cpp)2
-rw-r--r--engines/scumm/players/player_apple2.h (renamed from engines/scumm/player_apple2.h)4
-rw-r--r--engines/scumm/players/player_mac.cpp (renamed from engines/scumm/player_mac.cpp)2
-rw-r--r--engines/scumm/players/player_mac.h (renamed from engines/scumm/player_mac.h)4
-rw-r--r--engines/scumm/players/player_mod.cpp (renamed from engines/scumm/player_mod.cpp)2
-rw-r--r--engines/scumm/players/player_mod.h (renamed from engines/scumm/player_mod.h)4
-rw-r--r--engines/scumm/players/player_nes.cpp (renamed from engines/scumm/player_nes.cpp)2
-rw-r--r--engines/scumm/players/player_nes.h (renamed from engines/scumm/player_nes.h)4
-rw-r--r--engines/scumm/players/player_pce.cpp (renamed from engines/scumm/player_pce.cpp)2
-rw-r--r--engines/scumm/players/player_pce.h (renamed from engines/scumm/player_pce.h)4
-rw-r--r--engines/scumm/players/player_sid.cpp (renamed from engines/scumm/player_sid.cpp)2
-rw-r--r--engines/scumm/players/player_sid.h (renamed from engines/scumm/player_sid.h)4
-rw-r--r--engines/scumm/players/player_towns.cpp (renamed from engines/scumm/player_towns.cpp)2
-rw-r--r--engines/scumm/players/player_towns.h (renamed from engines/scumm/player_towns.h)4
-rw-r--r--engines/scumm/players/player_v1.cpp (renamed from engines/scumm/player_v1.cpp)2
-rw-r--r--engines/scumm/players/player_v1.h (renamed from engines/scumm/player_v1.h)6
-rw-r--r--engines/scumm/players/player_v2.cpp (renamed from engines/scumm/player_v2.cpp)2
-rw-r--r--engines/scumm/players/player_v2.h (renamed from engines/scumm/player_v2.h)6
-rw-r--r--engines/scumm/players/player_v2a.cpp (renamed from engines/scumm/player_v2a.cpp)2
-rw-r--r--engines/scumm/players/player_v2a.h (renamed from engines/scumm/player_v2a.h)6
-rw-r--r--engines/scumm/players/player_v2base.cpp (renamed from engines/scumm/player_v2base.cpp)2
-rw-r--r--engines/scumm/players/player_v2base.h (renamed from engines/scumm/player_v2base.h)4
-rw-r--r--engines/scumm/players/player_v2cms.cpp (renamed from engines/scumm/player_v2cms.cpp)2
-rw-r--r--engines/scumm/players/player_v2cms.h (renamed from engines/scumm/player_v2cms.h)6
-rw-r--r--engines/scumm/players/player_v3a.cpp (renamed from engines/scumm/player_v3a.cpp)2
-rw-r--r--engines/scumm/players/player_v3a.h (renamed from engines/scumm/player_v3a.h)6
-rw-r--r--engines/scumm/players/player_v3m.cpp (renamed from engines/scumm/player_v3m.cpp)2
-rw-r--r--engines/scumm/players/player_v3m.h (renamed from engines/scumm/player_v3m.h)6
-rw-r--r--engines/scumm/players/player_v4a.cpp (renamed from engines/scumm/player_v4a.cpp)2
-rw-r--r--engines/scumm/players/player_v4a.h (renamed from engines/scumm/player_v4a.h)4
-rw-r--r--engines/scumm/players/player_v5m.cpp (renamed from engines/scumm/player_v5m.cpp)2
-rw-r--r--engines/scumm/players/player_v5m.h (renamed from engines/scumm/player_v5m.h)6
-rw-r--r--engines/scumm/saveload.cpp2
-rw-r--r--engines/scumm/script_v5.cpp2
-rw-r--r--engines/scumm/scumm.cpp28
-rw-r--r--engines/scumm/sound.cpp2
-rw-r--r--engines/sword1/screen.cpp24
-rw-r--r--engines/sword1/sword1.cpp11
-rw-r--r--engines/toon/anim.cpp8
-rw-r--r--engines/toon/audio.cpp2
-rw-r--r--engines/toon/character.cpp1
-rw-r--r--engines/toon/font.cpp5
-rw-r--r--engines/toon/movie.cpp9
-rw-r--r--engines/toon/movie.h3
-rw-r--r--engines/toon/path.cpp2
-rw-r--r--engines/toon/picture.cpp5
-rw-r--r--engines/toon/resource.cpp1
-rw-r--r--engines/toon/resource.h1
-rw-r--r--engines/toon/script.cpp5
-rw-r--r--engines/toon/script_func.cpp6
-rw-r--r--engines/toon/state.cpp4
-rw-r--r--engines/toon/tools.cpp7
-rw-r--r--engines/toon/toon.cpp30
-rw-r--r--engines/touche/touche.cpp25
-rw-r--r--engines/touche/touche.h2
-rw-r--r--engines/tsage/blue_force/blueforce_logic.cpp14
-rw-r--r--engines/tsage/blue_force/blueforce_scenes0.cpp11
-rw-r--r--engines/tsage/blue_force/blueforce_scenes0.h2
-rw-r--r--engines/tsage/blue_force/blueforce_scenes1.cpp18
-rw-r--r--engines/tsage/blue_force/blueforce_scenes2.cpp4
-rw-r--r--engines/tsage/blue_force/blueforce_scenes3.cpp14
-rw-r--r--engines/tsage/blue_force/blueforce_scenes3.h1
-rw-r--r--engines/tsage/blue_force/blueforce_scenes4.cpp60
-rw-r--r--engines/tsage/blue_force/blueforce_scenes4.h7
-rw-r--r--engines/tsage/blue_force/blueforce_scenes5.cpp7
-rw-r--r--engines/tsage/blue_force/blueforce_scenes5.h2
-rw-r--r--engines/tsage/blue_force/blueforce_scenes6.cpp4
-rw-r--r--engines/tsage/blue_force/blueforce_scenes8.cpp11
-rw-r--r--engines/tsage/blue_force/blueforce_scenes9.cpp19
-rw-r--r--engines/tsage/blue_force/blueforce_scenes9.h1
-rw-r--r--engines/tsage/blue_force/blueforce_speakers.cpp4
-rw-r--r--engines/tsage/blue_force/blueforce_speakers.h2
-rw-r--r--engines/tsage/converse.cpp4
-rw-r--r--engines/tsage/converse.h2
-rw-r--r--engines/tsage/core.cpp2
-rw-r--r--engines/tsage/globals.cpp150
-rw-r--r--engines/tsage/globals.h29
-rw-r--r--engines/tsage/graphics.cpp38
-rw-r--r--engines/tsage/graphics.h2
-rw-r--r--engines/tsage/ringworld/ringworld_logic.cpp5
-rw-r--r--engines/tsage/ringworld/ringworld_scenes5.cpp3
-rw-r--r--engines/tsage/ringworld/ringworld_scenes5.h1
-rw-r--r--engines/tsage/ringworld/ringworld_scenes6.cpp11
-rw-r--r--engines/tsage/ringworld/ringworld_scenes6.h6
-rw-r--r--engines/tsage/ringworld/ringworld_scenes8.cpp8
-rw-r--r--engines/tsage/ringworld/ringworld_scenes8.h2
-rw-r--r--engines/tsage/ringworld2/ringworld2_dialogs.cpp2
-rw-r--r--engines/tsage/ringworld2/ringworld2_logic.cpp51
-rw-r--r--engines/tsage/ringworld2/ringworld2_logic.h6
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes0.cpp777
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes0.h56
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes1.cpp1056
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes1.h144
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes2.cpp979
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes2.h165
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes3.cpp1370
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes3.h179
-rw-r--r--engines/tsage/ringworld2/ringworld2_speakers.cpp52
-rw-r--r--engines/tsage/saveload.cpp4
-rw-r--r--engines/tsage/saveload.h7
-rw-r--r--engines/tsage/scenes.cpp6
-rw-r--r--engines/tsage/sound.cpp33
-rw-r--r--engines/tsage/sound.h2
-rw-r--r--engines/tsage/tsage.cpp3
-rw-r--r--engines/tsage/user_interface.cpp24
-rw-r--r--engines/tsage/user_interface.h2
-rw-r--r--engines/wintermute/ad/ad_actor.cpp10
-rw-r--r--engines/wintermute/ad/ad_actor.h2
-rw-r--r--engines/wintermute/ad/ad_entity.cpp2
-rw-r--r--engines/wintermute/ad/ad_entity.h2
-rw-r--r--engines/wintermute/ad/ad_game.cpp10
-rw-r--r--engines/wintermute/ad/ad_inventory_box.cpp8
-rw-r--r--engines/wintermute/ad/ad_item.cpp6
-rw-r--r--engines/wintermute/ad/ad_layer.cpp6
-rw-r--r--engines/wintermute/ad/ad_node_state.cpp2
-rw-r--r--engines/wintermute/ad/ad_object.cpp18
-rw-r--r--engines/wintermute/ad/ad_object.h2
-rw-r--r--engines/wintermute/ad/ad_path.cpp2
-rw-r--r--engines/wintermute/ad/ad_path_point.cpp2
-rw-r--r--engines/wintermute/ad/ad_region.cpp4
-rw-r--r--engines/wintermute/ad/ad_response_box.cpp6
-rw-r--r--engines/wintermute/ad/ad_scene.cpp22
-rw-r--r--engines/wintermute/ad/ad_sentence.cpp8
-rw-r--r--engines/wintermute/ad/ad_talk_node.cpp2
-rw-r--r--engines/wintermute/ad/ad_waypoint_group.cpp2
-rw-r--r--engines/wintermute/base/base.cpp2
-rw-r--r--engines/wintermute/base/base.h2
-rw-r--r--engines/wintermute/base/base_active_rect.cpp4
-rw-r--r--engines/wintermute/base/base_fader.cpp16
-rw-r--r--engines/wintermute/base/base_frame.cpp12
-rw-r--r--engines/wintermute/base/base_game.cpp42
-rw-r--r--engines/wintermute/base/base_game_music.cpp4
-rw-r--r--engines/wintermute/base/base_keyboard_state.cpp8
-rw-r--r--engines/wintermute/base/base_object.cpp38
-rw-r--r--engines/wintermute/base/base_object.h2
-rw-r--r--engines/wintermute/base/base_parser.cpp4
-rw-r--r--engines/wintermute/base/base_persistence_manager.cpp12
-rw-r--r--engines/wintermute/base/base_persistence_manager.h12
-rw-r--r--engines/wintermute/base/base_region.cpp10
-rw-r--r--engines/wintermute/base/base_script_holder.cpp2
-rw-r--r--engines/wintermute/base/base_sprite.cpp24
-rw-r--r--engines/wintermute/base/base_sub_frame.cpp50
-rw-r--r--engines/wintermute/base/base_viewport.cpp7
-rw-r--r--engines/wintermute/base/font/base_font_bitmap.cpp7
-rw-r--r--engines/wintermute/base/font/base_font_truetype.cpp11
-rw-r--r--engines/wintermute/base/gfx/base_renderer.cpp4
-rw-r--r--engines/wintermute/base/particles/part_emitter.cpp23
-rw-r--r--engines/wintermute/base/particles/part_force.cpp4
-rw-r--r--engines/wintermute/base/particles/part_particle.cpp14
-rw-r--r--engines/wintermute/base/scriptables/script.cpp12
-rw-r--r--engines/wintermute/base/scriptables/script_ext_file.cpp2
-rw-r--r--engines/wintermute/base/scriptables/script_value.cpp8
-rw-r--r--engines/wintermute/base/sound/base_sound.cpp10
-rw-r--r--engines/wintermute/graphics/transparent_surface.cpp16
-rw-r--r--engines/wintermute/graphics/transparent_surface.h22
-rw-r--r--engines/wintermute/math/rect32.h12
-rw-r--r--engines/wintermute/platform_osystem.cpp48
-rw-r--r--engines/wintermute/platform_osystem.h6
-rw-r--r--engines/wintermute/ui/ui_button.cpp12
-rw-r--r--engines/wintermute/ui/ui_object.cpp17
-rw-r--r--engines/wintermute/ui/ui_object.h2
-rw-r--r--engines/wintermute/ui/ui_tiled_image.cpp90
-rw-r--r--engines/wintermute/ui/ui_window.cpp32
-rw-r--r--engines/wintermute/video/video_theora_player.cpp5
-rw-r--r--engines/wintermute/video/video_theora_player.h2
-rw-r--r--engines/zvision/animation/rlf_animation.cpp (renamed from engines/zvision/rlf_animation.cpp)2
-rw-r--r--engines/zvision/animation/rlf_animation.h (renamed from engines/zvision/rlf_animation.h)0
-rw-r--r--engines/zvision/archives/zfs_archive.cpp (renamed from engines/zvision/zfs_archive.cpp)2
-rw-r--r--engines/zvision/archives/zfs_archive.h (renamed from engines/zvision/zfs_archive.h)0
-rw-r--r--engines/zvision/core/console.cpp (renamed from engines/zvision/console.cpp)16
-rw-r--r--engines/zvision/core/console.h (renamed from engines/zvision/console.h)0
-rw-r--r--engines/zvision/core/events.cpp (renamed from engines/zvision/events.cpp)10
-rw-r--r--engines/zvision/core/menu.h (renamed from engines/zvision/menu.h)0
-rw-r--r--engines/zvision/core/save_manager.cpp (renamed from engines/zvision/save_manager.cpp)6
-rw-r--r--engines/zvision/core/save_manager.h (renamed from engines/zvision/save_manager.h)0
-rw-r--r--engines/zvision/cursors/cursor.cpp (renamed from engines/zvision/cursor.cpp)2
-rw-r--r--engines/zvision/cursors/cursor.h (renamed from engines/zvision/cursor.h)0
-rw-r--r--engines/zvision/cursors/cursor_manager.cpp (renamed from engines/zvision/cursor_manager.cpp)3
-rw-r--r--engines/zvision/cursors/cursor_manager.h (renamed from engines/zvision/cursor_manager.h)2
-rw-r--r--engines/zvision/detection.cpp2
-rw-r--r--engines/zvision/fonts/truetype_font.cpp (renamed from engines/zvision/truetype_font.cpp)4
-rw-r--r--engines/zvision/fonts/truetype_font.h (renamed from engines/zvision/truetype_font.h)0
-rw-r--r--engines/zvision/graphics/render_manager.cpp (renamed from engines/zvision/render_manager.cpp)4
-rw-r--r--engines/zvision/graphics/render_manager.h (renamed from engines/zvision/render_manager.h)4
-rw-r--r--engines/zvision/graphics/render_table.cpp (renamed from engines/zvision/render_table.cpp)2
-rw-r--r--engines/zvision/graphics/render_table.h (renamed from engines/zvision/render_table.h)0
-rw-r--r--engines/zvision/inventory/inventory_manager.h (renamed from engines/zvision/inventory_manager.h)0
-rw-r--r--engines/zvision/module.mk58
-rw-r--r--engines/zvision/scripting/actions.cpp (renamed from engines/zvision/actions.cpp)29
-rw-r--r--engines/zvision/scripting/actions.h (renamed from engines/zvision/actions.h)0
-rw-r--r--engines/zvision/scripting/control.cpp (renamed from engines/zvision/control.cpp)6
-rw-r--r--engines/zvision/scripting/control.h (renamed from engines/zvision/control.h)0
-rw-r--r--engines/zvision/scripting/controls/animation_control.cpp (renamed from engines/zvision/animation_control.cpp)10
-rw-r--r--engines/zvision/scripting/controls/animation_control.h (renamed from engines/zvision/animation_control.h)2
-rw-r--r--engines/zvision/scripting/controls/input_control.cpp (renamed from engines/zvision/input_control.cpp)10
-rw-r--r--engines/zvision/scripting/controls/input_control.h (renamed from engines/zvision/input_control.h)4
-rw-r--r--engines/zvision/scripting/controls/lever_control.cpp (renamed from engines/zvision/lever_control.cpp)20
-rw-r--r--engines/zvision/scripting/controls/lever_control.h (renamed from engines/zvision/lever_control.h)2
-rw-r--r--engines/zvision/scripting/controls/push_toggle_control.cpp (renamed from engines/zvision/push_toggle_control.cpp)8
-rw-r--r--engines/zvision/scripting/controls/push_toggle_control.h (renamed from engines/zvision/push_toggle_control.h)2
-rw-r--r--engines/zvision/scripting/controls/timer_node.cpp (renamed from engines/zvision/timer_node.cpp)24
-rw-r--r--engines/zvision/scripting/controls/timer_node.h (renamed from engines/zvision/timer_node.h)3
-rw-r--r--engines/zvision/scripting/puzzle.h (renamed from engines/zvision/puzzle.h)11
-rw-r--r--engines/zvision/scripting/scr_file_handling.cpp (renamed from engines/zvision/scr_file_handling.cpp)20
-rw-r--r--engines/zvision/scripting/script_manager.cpp (renamed from engines/zvision/script_manager.cpp)54
-rw-r--r--engines/zvision/scripting/script_manager.h (renamed from engines/zvision/script_manager.h)23
-rw-r--r--engines/zvision/sound/zork_raw.cpp (renamed from engines/zvision/zork_raw.cpp)22
-rw-r--r--engines/zvision/sound/zork_raw.h (renamed from engines/zvision/zork_raw.h)0
-rw-r--r--engines/zvision/strings/string_manager.cpp (renamed from engines/zvision/string_manager.cpp)4
-rw-r--r--engines/zvision/strings/string_manager.h (renamed from engines/zvision/string_manager.h)2
-rw-r--r--engines/zvision/subtitles/subtitles.h (renamed from engines/zvision/subtitles.h)0
-rw-r--r--engines/zvision/utility/clock.cpp (renamed from engines/zvision/clock.cpp)2
-rw-r--r--engines/zvision/utility/clock.h (renamed from engines/zvision/clock.h)0
-rw-r--r--engines/zvision/utility/lzss_read_stream.cpp (renamed from engines/zvision/lzss_read_stream.cpp)2
-rw-r--r--engines/zvision/utility/lzss_read_stream.h (renamed from engines/zvision/lzss_read_stream.h)0
-rw-r--r--engines/zvision/utility/single_value_container.cpp (renamed from engines/zvision/single_value_container.cpp)2
-rw-r--r--engines/zvision/utility/single_value_container.h (renamed from engines/zvision/single_value_container.h)0
-rw-r--r--engines/zvision/utility/utility.cpp (renamed from engines/zvision/utility.cpp)4
-rw-r--r--engines/zvision/utility/utility.h (renamed from engines/zvision/utility.h)0
-rw-r--r--engines/zvision/video/video.cpp (renamed from engines/zvision/video.cpp)6
-rw-r--r--engines/zvision/video/zork_avi_decoder.cpp (renamed from engines/zvision/zork_avi_decoder.cpp)4
-rw-r--r--engines/zvision/video/zork_avi_decoder.h (renamed from engines/zvision/zork_avi_decoder.h)0
-rw-r--r--engines/zvision/zvision.cpp17
-rw-r--r--engines/zvision/zvision.h12
-rw-r--r--graphics/decoders/iff.cpp6
-rw-r--r--graphics/decoders/iff.h4
-rw-r--r--graphics/decoders/image_decoder.h6
-rw-r--r--graphics/decoders/tga.cpp2
-rw-r--r--graphics/decoders/tga.h1
-rw-r--r--gui/credits.h24
-rw-r--r--gui/predictivedialog.cpp3
-rw-r--r--video/avi_decoder.h1
351 files changed, 9895 insertions, 5995 deletions
diff --git a/AUTHORS b/AUTHORS
index d22c69e7e8..947ce5568a 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -6,9 +6,9 @@ ScummVM Team
PR Office
---------
- Arnaud Boutonne - Public Relations Officer, Project
- Administrator
- Eugene Sandulenko - Project Leader
+ Arnaud Boutonne - Public Relations Officer, Project
+ Administrator
+ Eugene Sandulenko - Project Leader
Core Team
---------
@@ -19,30 +19,30 @@ ScummVM Team
Retired Project Leaders
-----------------------
James Brown
- Vincent Hamm - ScummVM co-founder, Original Cruise/CinE
- author
+ Vincent Hamm - ScummVM co-founder, Original Cruise/CinE
+ author
Max Horn
- Ludvig Strigeus - Original ScummVM and SimonVM author
+ Ludvig Strigeus - Original ScummVM and SimonVM author
Engine Teams
------------
SCUMM:
Torbjorn Andersson
- James Brown - (retired)
- Jonathan Gray - (retired)
- Vincent Hamm - (retired)
- Max Horn - (retired)
+ James Brown - (retired)
+ Jonathan Gray - (retired)
+ Vincent Hamm - (retired)
+ Max Horn - (retired)
Travis Howell
- Pawel Kolodziejski - Codecs, iMUSE, Smush, etc.
- Gregory Montoir - (retired)
- Eugene Sandulenko - FT INSANE, MM NES, MM C64, game detection,
- Herc/CGA
- Ludvig Strigeus - (retired)
+ Pawel Kolodziejski - Codecs, iMUSE, Smush, etc.
+ Gregory Montoir - (retired)
+ Eugene Sandulenko - FT INSANE, MM NES, MM C64, game
+ detection, Herc/CGA
+ Ludvig Strigeus - (retired)
HE:
- Jonathan Gray - (retired)
+ Jonathan Gray - (retired)
Travis Howell
- Gregory Montoir - (retired)
+ Gregory Montoir - (retired)
Eugene Sandulenko
AGI:
@@ -50,17 +50,17 @@ ScummVM Team
Matthew Hoops
Filippos Karapetis
Pawel Kolodziejski
- Walter van Niftrik - (retired)
+ Walter van Niftrik - (retired)
Kari Salminen
Eugene Sandulenko
- David Symonds - (retired)
+ David Symonds - (retired)
AGOS:
Torbjorn Andersson
Paul Gilbert
Travis Howell
- Oliver Kiehl - (retired)
- Ludvig Strigeus - (retired)
+ Oliver Kiehl - (retired)
+ Ludvig Strigeus - (retired)
AVALANCHE:
Peter Bozso
@@ -71,9 +71,9 @@ ScummVM Team
Paul Gilbert
Cine:
- Vincent Hamm - (retired)
+ Vincent Hamm - (retired)
Pawel Kolodziejski
- Gregory Montoir - (retired)
+ Gregory Montoir - (retired)
Kari Salminen
Eugene Sandulenko
@@ -82,7 +82,7 @@ ScummVM Team
CruisE:
Paul Gilbert
- Vincent Hamm - (retired)
+ Vincent Hamm - (retired)
Draci:
Denis Kasak
@@ -96,7 +96,7 @@ ScummVM Team
Torbjorn Andersson
Bertrand Augereau
Filippos Karapetis
- Vladimir Menshakov - (retired)
+ Vladimir Menshakov - (retired)
Willem Jan Palenstijn
Gob:
@@ -120,10 +120,10 @@ ScummVM Team
Eugene Sandulenko
Kyra:
- Torbjorn Andersson - VQA Player
+ Torbjorn Andersson - VQA Player
Oystein Eftevaag
Florian Kagerer
- Gregory Montoir - (retired)
+ Gregory Montoir - (retired)
Johannes Schickel
Lastexpress:
@@ -161,14 +161,14 @@ ScummVM Team
Matthew Hoops
Queen:
- David Eriksson - (retired)
- Gregory Montoir - (retired)
+ David Eriksson - (retired)
+ Gregory Montoir - (retired)
Joost Peters
SAGA:
Torbjorn Andersson
- Daniel Balsom - Original engine reimplementation author
- (retired)
+ Daniel Balsom - Original engine reimplementation author
+ (retired)
Filippos Karapetis
Andrew Kurushin
Eugene Sandulenko
@@ -176,46 +176,46 @@ ScummVM Team
SCI:
Greg Frieger
Paul Gilbert
- Max Horn - (retired)
+ Max Horn - (retired)
Filippos Karapetis
Martin Kiewitz
- Walter van Niftrik - (retired)
+ Walter van Niftrik - (retired)
Willem Jan Palenstijn
Jordi Vilalta Prat
Lars Skovlund
Sky:
- Robert Goeffringmann - (retired)
- Oliver Kiehl - (retired)
+ Robert Goeffringmann - (retired)
+ Oliver Kiehl - (retired)
Joost Peters
Sword1:
- Fabio Battaglia - PSX version support
- Thierry Crozat - Mac version support
- Robert Goeffringmann - (retired)
+ Fabio Battaglia - PSX version support
+ Thierry Crozat - Mac version support
+ Robert Goeffringmann - (retired)
Sword2:
Torbjorn Andersson
- Fabio Battaglia - PSX version support
- Jonathan Gray - (retired)
+ Fabio Battaglia - PSX version support
+ Jonathan Gray - (retired)
Sword25:
Torbjorn Andersson
Paul Gilbert
- Max Horn - (retired)
+ Max Horn - (retired)
Filippos Karapetis
Eugene Sandulenko
TeenAgent:
- Robert Megone - Help with callback rewriting
- Vladimir Menshakov - (retired)
+ Robert Megone - Help with callback rewriting
+ Vladimir Menshakov - (retired)
Tinsel:
Torbjorn Andersson
- Fabio Battaglia - PSX version support
+ Fabio Battaglia - PSX version support
Paul Gilbert
Sven Hesse
- Max Horn - (retired)
+ Max Horn - (retired)
Filippos Karapetis
Joost Peters
@@ -232,14 +232,14 @@ ScummVM Team
Sylvain Dupont
Touche:
- Gregory Montoir - (retired)
+ Gregory Montoir - (retired)
TsAGE:
Arnaud Boutonne
Paul Gilbert
Tucker:
- Gregory Montoir - (retired)
+ Gregory Montoir - (retired)
Wintermute:
Einar Johan T. Somaaen
@@ -266,26 +266,26 @@ ScummVM Team
Lubomyr Lisen
Maemo:
- Frantisek Dufka - (retired)
+ Frantisek Dufka - (retired)
Tarek Soliman
Nintendo 64:
Fabio Battaglia
Nintendo DS:
- Bertrand Augereau - HQ software scaler
+ Bertrand Augereau - HQ software scaler
Neil Millstone
OpenPandora:
John Willis
PocketPC / WinCE:
- Nicolas Bacca - (retired)
+ Nicolas Bacca - (retired)
Ismail Khatib
- Kostas Nakos - (retired)
+ Kostas Nakos - (retired)
PlayStation 2:
- Robert Goeffringmann - (retired)
+ Robert Goeffringmann - (retired)
Max Lingua
PSP (PlayStation Portable):
@@ -293,8 +293,8 @@ ScummVM Team
Joost Peters
SDL (Win/Linux/OS X/etc.):
- Max Horn - (retired)
- Eugene Sandulenko - Asm routines, GFX layers
+ Max Horn - (retired)
+ Eugene Sandulenko - Asm routines, GFX layers
SymbianOS:
Jurgen Braam
@@ -312,9 +312,9 @@ ScummVM Team
Other subsystems
----------------
Infrastructure:
- Max Horn - Backend & Engine APIs, file API, sound
- mixer, audiostreams, data structures, etc.
- (retired)
+ Max Horn - Backend & Engine APIs, file API, sound
+ mixer, audiostreams, data structures,
+ etc. (retired)
Eugene Sandulenko
Johannes Schickel
@@ -324,33 +324,35 @@ ScummVM Team
Johannes Schickel
Miscellaneous:
- David Corrales-Lopez - Filesystem access improvements (GSoC 2007
- task) (retired)
- Jerome Fisher - MT-32 emulator
- Benjamin Haisch - Heavily improved de-/encoder for DXA videos
- Jochen Hoenicke - Speaker & PCjr sound support, AdLib work
- (retired)
- Daniel ter Laan - Restoring original Drascula tracks, and
- writing convert_dxa.bat
- Chris Page - Return to launcher, savestate improvements,
- leak fixes, ... (GSoC 2008 task) (retired)
- Robin Watts - ARM assembly routines for nice speedups on
- several ports; improvements to the sound
- mixer
+ David Corrales-Lopez - Filesystem access improvements (GSoC
+ 2007 task) (retired)
+ Jerome Fisher - MT-32 emulator
+ Benjamin Haisch - Heavily improved de-/encoder for DXA
+ videos
+ Jochen Hoenicke - Speaker & PCjr sound support, AdLib
+ work (retired)
+ Daniel ter Laan - Restoring original Drascula tracks, and
+ writing convert_dxa.bat
+ Chris Page - Return to launcher, savestate
+ improvements, leak fixes, ... (GSoC
+ 2008 task) (retired)
+ Robin Watts - ARM assembly routines for nice speedups
+ on several ports; improvements to the
+ sound mixer
Website (code)
--------------
- Fredrik Wendel - (retired)
+ Fredrik Wendel - (retired)
Website (maintenance)
---------------------
- James Brown - IRC Logs maintainer
- Thierry Crozat - Wiki maintainer
- Andre Heider - Buildbot maintainer
- Joost Peters - Doxygen Project Documentation maintainer
- Jordi Vilalta Prat - Wiki maintainer
- Eugene Sandulenko - Forum, IRC channel, Screen Shots and Mailing
- list maintainer
+ James Brown - IRC Logs maintainer
+ Thierry Crozat - Wiki maintainer
+ Andre Heider - Buildbot maintainer
+ Joost Peters - Doxygen Project Documentation maintainer
+ Jordi Vilalta Prat - Wiki maintainer
+ Eugene Sandulenko - Forum, IRC channel, Screen Shots and
+ Mailing list maintainer
John Willis
Website (content)
@@ -359,31 +361,31 @@ ScummVM Team
Documentation
-------------
- Thierry Crozat - Numerous contributions to documentation
- Joachim Eberhard - Numerous contributions to documentation
- (retired)
- Matthew Hoops - Wiki editor
+ Thierry Crozat - Numerous contributions to documentation
+ Joachim Eberhard - Numerous contributions to documentation
+ (retired)
+ Matthew Hoops - Wiki editor
Retired Team Members
--------------------
- Chris Apers - Former PalmOS porter
- Ralph Brorsen - Help with GUI implementation
- Jamieson Christian - iMUSE, MIDI, all things musical
- Felix Jakschitsch - Zak256 reverse engineering
- Mutwin Kraus - Original MacOS porter
- Peter Moraliyski - Port: GP32
- Jeremy Newman - Former webmaster
- Lionel Ulmer - Port: X11
- Won Star - Former GP32 porter
+ Chris Apers - Former PalmOS porter
+ Ralph Brorsen - Help with GUI implementation
+ Jamieson Christian - iMUSE, MIDI, all things musical
+ Felix Jakschitsch - Zak256 reverse engineering
+ Mutwin Kraus - Original MacOS porter
+ Peter Moraliyski - Port: GP32
+ Jeremy Newman - Former webmaster
+ Lionel Ulmer - Port: X11
+ Won Star - Former GP32 porter
Other contributions
*******************
Packages
--------
AmigaOS 4:
- Hans-Joerg Frieden - (retired)
+ Hans-Joerg Frieden - (retired)
Hubert Maier
- Juha Niemimaki - (retired)
+ Juha Niemimaki - (retired)
Atari/FreeMiNT:
Keith Scroggins
@@ -393,22 +395,22 @@ Other contributions
Luc Schrijvers
Debian GNU/Linux:
- Tore Anderson - (retired)
+ Tore Anderson - (retired)
David Weinehall
Fedora / RedHat:
Willem Jan Palenstijn
Mac OS X:
- Max Horn - (retired)
+ Max Horn - (retired)
Oystein Eftevaag
Mandriva:
- Dominik Scherer - (retired)
+ Dominik Scherer - (retired)
MorphOS:
Fabien Coeurjoly
- Ruediger Hanke - (retired)
+ Ruediger Hanke - (retired)
OS/2:
Paul Smedley
@@ -426,12 +428,12 @@ Other contributions
Travis Howell
Win64:
- Chris Gray - (retired)
+ Chris Gray - (retired)
Johannes Schickel
- Translations
- ------------
- Thierry Crozat - Translation Lead
+ GUI Translations
+ ----------------
+ Thierry Crozat - Translation Lead
Basque:
Mikel Iturbe Urretxa
@@ -459,7 +461,7 @@ Other contributions
German:
Simon Sawatzki
- Lothar Serra Mari - (retired)
+ Lothar Serra Mari - (retired)
Hungarian:
Alex Bevilacqua
@@ -493,98 +495,118 @@ Other contributions
Ukrainian:
Lubomyr Lisen
+ Game Translations
+ -----------------
+ CGE:
+ Dan Serban - Soltys English translation
+ Victor Gonzalez - Soltys Spanish translation
+ Alejandro Gomez de la Munoza - Soltys Spanish translation
+
+ Drascula:
+ Thierry Crozat - Improve French translation
+
+ Mortevielle:
+ Hugo Labrande - Improve English translation
+ Thierry Crozat - Improve English translation
+
Websites (design)
-----------------
- Dobo Balazs - Website design
- William Claydon - Skins for doxygen, buildbot and wiki
- Yaroslav Fedevych - HTML/CSS for the website
- Jean Marc Gimenez - ScummVM logo
- David Jensen - SVG logo conversion
- Raina - ScummVM forum buttons
+ Dobo Balazs - Website design
+ William Claydon - Skins for doxygen, buildbot and wiki
+ Yaroslav Fedevych - HTML/CSS for the website
+ Jean Marc Gimenez - ScummVM logo
+ David Jensen - SVG logo conversion
+ Raina - ScummVM forum buttons
Code contributions
------------------
- Ori Avtalion - Subtitle control options in the GUI; BASS GUI
- fixes
- Stuart Caie - Decoders for Amiga and AtariST data files
- (AGOS engine)
- Paolo Costabel - PSP port contributions
- Martin Doucha - CinE engine objectification
- Thomas Fach-Pedersen - ProTracker module player, Smacker video
- decoder
- Tobias Gunkel - Sound support for C64 version of MM/Zak, Loom
- PCE support
- Janne Huttunen - V3 actor mask support, Dig/FT SMUSH audio
- Kovacs Endre Janos - Several fixes for Simon1
- Jeroen Janssen - Numerous readability and bugfix patches
- Keith Kaisershot - Several Pegasus Prime patches
- Andreas Karlsson - Initial port for SymbianOS
- Claudio Matsuoka - Daily Linux builds
- Thomas Mayer - PSP port contributions
- Sean Murray - ScummVM tools GUI application (GSoC 2007 task)
- n0p - Windows CE port aspect ratio correction scaler
- and right click input method
- Mikesch Nepomuk - MI1 VGA floppy patches
- Nicolas Noble - Config file and ALSA support
- Tim Phillips - Initial MI1 CD music support
- Quietust - Sound support for Amiga SCUMM V2/V3 games, MM
- NES support
- Robert Crossfield - Improved support for Apple II/C64 versions of
- MM
- Andreas Roever - Broken Sword I & II MPEG2 cutscene support
- Edward Rudd - Fixes for playing MP3 versions of MI1/Loom
- audio
- Daniel Schepler - Final MI1 CD music support, initial Ogg Vorbis
- support
- Andre Souza - SDL-based OpenGL renderer
- Tom Frost - WebOS port contributions
+ Ori Avtalion - Subtitle control options in the GUI; BASS
+ GUI fixes
+ Stuart Caie - Decoders for Amiga and AtariST data files
+ (AGOS engine)
+ Paolo Costabel - PSP port contributions
+ Martin Doucha - CinE engine objectification
+ Thomas Fach-Pedersen - ProTracker module player, Smacker video
+ decoder
+ Tobias Gunkel - Sound support for C64 version of MM/Zak,
+ Loom PCE support
+ Janne Huttunen - V3 actor mask support, Dig/FT SMUSH audio
+ Kovacs Endre Janos - Several fixes for Simon1
+ Jeroen Janssen - Numerous readability and bugfix patches
+ Keith Kaisershot - Several Pegasus Prime patches
+ Andreas Karlsson - Initial port for SymbianOS
+ Claudio Matsuoka - Daily Linux builds
+ Thomas Mayer - PSP port contributions
+ Sean Murray - ScummVM tools GUI application (GSoC 2007
+ task)
+ n0p - Windows CE port aspect ratio correction
+ scaler and right click input method
+ Mikesch Nepomuk - MI1 VGA floppy patches
+ Nicolas Noble - Config file and ALSA support
+ Tim Phillips - Initial MI1 CD music support
+ Quietust - Sound support for Amiga SCUMM V2/V3
+ games, MM NES support
+ Robert Crossfield - Improved support for Apple II/C64
+ versions of MM
+ Andreas Roever - Broken Sword I & II MPEG2 cutscene
+ support
+ Edward Rudd - Fixes for playing MP3 versions of
+ MI1/Loom audio
+ Daniel Schepler - Final MI1 CD music support, initial Ogg
+ Vorbis support
+ Andre Souza - SDL-based OpenGL renderer
+ Tom Frost - WebOS port contributions
FreeSCI Contributors
--------------------
- Francois-R Boyer - MT-32 information and mapping code
- Rainer Canavan - IRIX MIDI driver and bug fixes
+ Francois-R Boyer - MT-32 information and mapping code
+ Rainer Canavan - IRIX MIDI driver and bug fixes
Xiaojun Chen
- Paul David Doherty - Game version information
- Vyacheslav Dikonov - Config script improvements
- Ruediger Hanke - Port to the MorphOS platform
- Matt Hargett - Clean-ups, bugfixes, Hardcore QA, Win32
- Max Horn - SetJump implementation
- Ravi I. - SCI0 sound resource specification
- Emmanuel Jeandel - Bugfixes and bug reports
- Dmitry Jemerov - Port to the Win32 platform, numerous bugfixes
- Chris Kehler - Makefile enhancements
- Christopher T. Lansdown - Original CVS maintainer, Alpha compatibility
- fixes
- Sergey Lapin - Port of Carl's type 2 decompression code
- Rickard Lind - MT-32->GM MIDI mapping magic, sound research
- Hubert Maier - AmigaOS 4 port
- Johannes Manhave - Document format translation
- Claudio Matsuoka - CVS snapshots, daily builds, BeOS and cygwin
- ports
- Dark Minister - SCI research (bytecode and parser)
- Carl Muckenhoupt - Sources to the SCI resource viewer tools that
- started it all
- Anders Baden Nielsen - PPC testing
- Walter van Niftrik - Ports to the Dreamcast and GP32 platforms
- Rune Orsval - Configuration file editor
- Solomon Peachy - SDL ports and much of the sound subsystem
- Robey Pointer - Bug tracking system hosting
- Magnus Reftel - Heap implementation, Python class viewer,
- bugfixes
- Christoph Reichenbach - UN*X code, VM/Graphics/Sound/other
- infrastructure
- George Reid - FreeBSD package management
- Lars Skovlund - Project maintenance, most documentation,
- bugfixes, SCI1 support
- Rink Springer - Port to the DOS platform, several bug fixes
- Rainer De Temple - SCI research
+ Paul David Doherty - Game version information
+ Vyacheslav Dikonov - Config script improvements
+ Ruediger Hanke - Port to the MorphOS platform
+ Matt Hargett - Clean-ups, bugfixes, Hardcore QA, Win32
+ Max Horn - SetJump implementation
+ Ravi I. - SCI0 sound resource specification
+ Emmanuel Jeandel - Bugfixes and bug reports
+ Dmitry Jemerov - Port to the Win32 platform, numerous
+ bugfixes
+ Chris Kehler - Makefile enhancements
+ Christopher T. Lansdown - Original CVS maintainer, Alpha
+ compatibility fixes
+ Sergey Lapin - Port of Carl's type 2 decompression code
+ Rickard Lind - MT-32->GM MIDI mapping magic, sound
+ research
+ Hubert Maier - AmigaOS 4 port
+ Johannes Manhave - Document format translation
+ Claudio Matsuoka - CVS snapshots, daily builds, BeOS and
+ cygwin ports
+ Dark Minister - SCI research (bytecode and parser)
+ Carl Muckenhoupt - Sources to the SCI resource viewer tools
+ that started it all
+ Anders Baden Nielsen - PPC testing
+ Walter van Niftrik - Ports to the Dreamcast and GP32 platforms
+ Rune Orsval - Configuration file editor
+ Solomon Peachy - SDL ports and much of the sound subsystem
+ Robey Pointer - Bug tracking system hosting
+ Magnus Reftel - Heap implementation, Python class viewer,
+ bugfixes
+ Christoph Reichenbach - UN*X code, VM/Graphics/Sound/other
+ infrastructure
+ George Reid - FreeBSD package management
+ Lars Skovlund - Project maintenance, most documentation,
+ bugfixes, SCI1 support
+ Rink Springer - Port to the DOS platform, several bug
+ fixes
+ Rainer De Temple - SCI research
Sean Terrell
- Hugues Valois - Game selection menu
- Jordi Vilalta - Numerous code and website clean-up patches
- Petr Vyhnak - The DCL-INFLATE algorithm, many Win32
- improvements
- Bas Zoetekouw - Man pages, debian package management, CVS
- maintenance
+ Hugues Valois - Game selection menu
+ Jordi Vilalta - Numerous code and website clean-up
+ patches
+ Petr Vyhnak - The DCL-INFLATE algorithm, many Win32
+ improvements
+ Bas Zoetekouw - Man pages, debian package management, CVS
+ maintenance
Special thanks to Prof. Dr. Gary Nutt for allowing the FreeSCI VM
extension as a course project in his Advanced OS course.
diff --git a/audio/softsynth/mt32.cpp b/audio/softsynth/mt32.cpp
index 29f5e3577c..2a90b583f3 100644
--- a/audio/softsynth/mt32.cpp
+++ b/audio/softsynth/mt32.cpp
@@ -460,9 +460,6 @@ bool MT32EmuMusicPlugin::checkDevice(MidiDriver::DeviceHandle) const {
}
Common::Error MT32EmuMusicPlugin::createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle) const {
- if (ConfMan.hasKey("extrapath"))
- SearchMan.addDirectory("extrapath", ConfMan.get("extrapath"));
-
*mididriver = new MidiDriver_MT32(g_system->getMixer());
return Common::kNoError;
diff --git a/backends/fs/amigaos4/amigaos4-fs.cpp b/backends/fs/amigaos4/amigaos4-fs.cpp
index fe388c2a6e..6d713f10be 100644
--- a/backends/fs/amigaos4/amigaos4-fs.cpp
+++ b/backends/fs/amigaos4/amigaos4-fs.cpp
@@ -335,7 +335,7 @@ bool AmigaOSFilesystemNode::isReadable() const {
// Regular RWED protection flags are low-active or inverted, thus the negation.
// moreover pseudo root filesystem (null _pFileLock) is readable whatever the
// protection says
- bool readable = !(_nProt & EXDF_READ) || _pFileLock == 0;
+ bool readable = !(_nProt & EXDF_OTR_READ) || _pFileLock == 0;
return readable;
}
@@ -344,7 +344,7 @@ bool AmigaOSFilesystemNode::isWritable() const {
// Regular RWED protection flags are low-active or inverted, thus the negation.
// moreover pseudo root filesystem (null _pFileLock) is never writable whatever
// the protection says (because of the pseudo nature)
- bool writable = !(_nProt & EXDF_WRITE) && _pFileLock !=0;
+ bool writable = !(_nProt & EXDF_OTR_WRITE) && _pFileLock !=0;
return writable;
}
@@ -367,8 +367,14 @@ AbstractFSList AmigaOSFilesystemNode::listVolumes() const {
dosList = IDOS->NextDosEntry(dosList, LDF_VOLUMES);
while (dosList) {
if (dosList->dol_Type == DLT_VOLUME &&
- dosList->dol_Name &&
- dosList->dol_Task) {
+ dosList->dol_Name) {
+
+ // Original was
+ // dosList->dol_Name &&
+ // dosList->dol_Task) {
+ // which errored using SDK 53.24 with a 'struct dosList' has no member called 'dol_Task'
+ // I removed dol_Task because it's not used anywhere else
+ // and it neither brought up further errors nor crashes or regressions.
// Copy name to buffer
IDOS->CopyStringBSTRToC(dosList->dol_Name, buffer, MAXPATHLEN);
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index c240727069..bc80d8ad6a 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -392,10 +392,15 @@ Common::String OSystem_SDL::getSystemLanguage() const {
}
#else // WIN32
// Activating current locale settings
- const char *locale = setlocale(LC_ALL, "");
+ const Common::String locale = setlocale(LC_ALL, "");
+
+ // Restore default C locale to prevent issues with
+ // portability of sscanf(), atof(), etc.
+ // See bug #3615148
+ setlocale(LC_ALL, "C");
// Detect the language from the locale
- if (!locale) {
+ if (locale.empty()) {
return ModularBackend::getSystemLanguage();
} else {
int length = 0;
@@ -404,14 +409,14 @@ Common::String OSystem_SDL::getSystemLanguage() const {
// ".UTF-8" or the like. We do this, since
// our translation languages are usually
// specified without any charset information.
- for (int i = 0; locale[i]; ++i, ++length) {
+ for (int size = locale.size(); length < size; ++length) {
// TODO: Check whether "@" should really be checked
// here.
- if (locale[i] == '.' || locale[i] == ' ' || locale[i] == '@')
+ if (locale[length] == '.' || locale[length] == ' ' || locale[length] == '@')
break;
}
- return Common::String(locale, length);
+ return Common::String(locale.c_str(), length);
}
#endif // WIN32
#else // USE_DETECTLANG
diff --git a/common/c++11-compat.h b/common/c++11-compat.h
index 50d79bd79e..f963ba9ac8 100644
--- a/common/c++11-compat.h
+++ b/common/c++11-compat.h
@@ -31,7 +31,9 @@
// Custom nullptr replacement. This is not type safe as the real C++11 nullptr
// though.
//
+#if !defined(nullptr) // XCode 5.0.1 has __cplusplus=199711 but defines this
#define nullptr 0
+#endif
//
// Replacement for the override keyword. This allows compilation of code
diff --git a/common/recorderfile.cpp b/common/recorderfile.cpp
index d08bc599f1..7c438cbf69 100644
--- a/common/recorderfile.cpp
+++ b/common/recorderfile.cpp
@@ -45,6 +45,8 @@ PlaybackFile::PlaybackFile() : _tmpRecordFile(_tmpBuffer, kRecordBuffSize), _tmp
_recordCount = 0;
_eventsSize = 0;
memset(_tmpBuffer, 1, kRecordBuffSize);
+
+ _playbackParseState = kFileStateCheckFormat;
}
PlaybackFile::~PlaybackFile() {
diff --git a/common/winexe_ne.cpp b/common/winexe_ne.cpp
index c3698d5fce..8ab7e707bb 100644
--- a/common/winexe_ne.cpp
+++ b/common/winexe_ne.cpp
@@ -187,7 +187,7 @@ uint32 NEResources::getResourceTableOffset() {
static const char *s_resTypeNames[] = {
"", "cursor", "bitmap", "icon", "menu", "dialog", "string",
"font_dir", "font", "accelerator", "rc_data", "msg_table",
- "group_cursor", "group_icon", "", "", "version", "dlg_include",
+ "group_cursor", "", "group_icon", "", "version", "dlg_include",
"", "plug_play", "vxd", "ani_cursor", "ani_icon", "html",
"manifest"
};
diff --git a/common/winexe_ne.h b/common/winexe_ne.h
index f00941412f..3f50b5cc54 100644
--- a/common/winexe_ne.h
+++ b/common/winexe_ne.h
@@ -46,7 +46,7 @@ enum NEResourceType {
kNERCData = 0x0A,
kNEMessageTable = 0x0B,
kNEGroupCursor = 0x0C,
- kNEGroupIcon = 0x0D,
+ kNEGroupIcon = 0x0E,
kNEVersion = 0x10,
kNEDlgInclude = 0x11,
kNEPlugPlay = 0x13,
diff --git a/common/zlib.cpp b/common/zlib.cpp
index 920338e57e..f1a298a9f1 100644
--- a/common/zlib.cpp
+++ b/common/zlib.cpp
@@ -27,6 +27,7 @@
#include "common/ptr.h"
#include "common/util.h"
#include "common/stream.h"
+#include "common/textconsole.h"
#if defined(USE_ZLIB)
#ifdef __SYMBIAN32__
@@ -158,10 +159,11 @@ protected:
uint32 _pos;
uint32 _origSize;
bool _eos;
+ bool _shownBackwardSeekingWarning;
public:
- GZipReadStream(SeekableReadStream *w, uint32 knownSize = 0) : _wrapped(w), _stream() {
+ GZipReadStream(SeekableReadStream *w, uint32 knownSize = 0) : _wrapped(w), _stream(), _shownBackwardSeekingWarning(false) {
assert(w != 0);
// Verify file header is correct
@@ -241,13 +243,17 @@ public:
}
bool seek(int32 offset, int whence = SEEK_SET) {
int32 newPos = 0;
- assert(whence != SEEK_END); // SEEK_END not supported
switch (whence) {
case SEEK_SET:
newPos = offset;
break;
case SEEK_CUR:
newPos = _pos + offset;
+ break;
+ case SEEK_END:
+ // NOTE: This can be an expensive operation (see below).
+ newPos = size() + offset;
+ break;
}
assert(newPos >= 0);
@@ -256,9 +262,15 @@ public:
// To search backward, we have to restart the whole decompression
// from the start of the file. A rather wasteful operation, best
// to avoid it. :/
-#if DEBUG
- warning("Backward seeking in GZipReadStream detected");
-#endif
+
+ if (!_shownBackwardSeekingWarning) {
+ // We only throw this warning once per stream, to avoid
+ // getting the console swarmed with warnings when consecutive
+ // seeks are made.
+ warning("Backward seeking in GZipReadStream detected");
+ _shownBackwardSeekingWarning = true;
+ }
+
_pos = 0;
_wrapped->seek(0, SEEK_SET);
_zlibErr = inflateReset(&_stream);
diff --git a/devtools/create_mortdat/create_mortdat.cpp b/devtools/create_mortdat/create_mortdat.cpp
index 0065407daa..693e277b91 100644
--- a/devtools/create_mortdat/create_mortdat.cpp
+++ b/devtools/create_mortdat/create_mortdat.cpp
@@ -210,7 +210,7 @@ void writeMenuData(const char *menuData, int languageId) {
outputFile.writeByte(languageId);
// Write each 8-characters block as a byte (one bit per character)
// ' ' -> 0, anything else -> 1
- byte value;
+ byte value = 0;
int valueCpt = 0;
const char* str = menuData;
while (*str != 0) {
diff --git a/devtools/credits.pl b/devtools/credits.pl
index fda6f4782e..03e086ce99 100755
--- a/devtools/credits.pl
+++ b/devtools/credits.pl
@@ -48,7 +48,7 @@ if ($mode eq "") {
$Text::Wrap::unexpand = 0;
if ($mode eq "TEXT") {
$Text::Wrap::columns = 78;
- $max_name_width = 23; # The maximal width of a name.
+ $max_name_width = 28; # The maximal width of a name.
} elsif ($mode eq "CPP") {
$Text::Wrap::columns = 48; # Approx.
}
@@ -60,6 +60,7 @@ sub html_entities_to_ascii {
# For now we hardcode these mappings
# &aacute; -> a
# &eacute; -> e
+ # &iacute; -> i
# &igrave; -> i
# &oacute; -> o
# &oslash; -> o
@@ -72,8 +73,10 @@ sub html_entities_to_ascii {
# &#322; -> l
# &#347; -> s
# &Scaron; -> S
+ # &ntilde; -> n
$text =~ s/&aacute;/a/g;
$text =~ s/&eacute;/e/g;
+ $text =~ s/&iacute;/i/g;
$text =~ s/&igrave;/i/g;
$text =~ s/&oacute;/o/g;
$text =~ s/&oslash;/o/g;
@@ -81,6 +84,7 @@ sub html_entities_to_ascii {
$text =~ s/&#347;/s/g;
$text =~ s/&Scaron;/S/g;
$text =~ s/&aring;/aa/g;
+ $text =~ s/&ntilde;/n/g;
$text =~ s/&auml;/a/g;
$text =~ s/&euml;/e/g;
@@ -101,6 +105,7 @@ sub html_entities_to_cpp {
# The numerical values are octal!
$text =~ s/&aacute;/\\341/g;
$text =~ s/&eacute;/\\351/g;
+ $text =~ s/&iacute;/\\355/g;
$text =~ s/&igrave;/\\354/g;
$text =~ s/&oacute;/\\363/g;
$text =~ s/&oslash;/\\370/g;
@@ -108,6 +113,7 @@ sub html_entities_to_cpp {
$text =~ s/&#347;/s/g;
$text =~ s/&Scaron;/S/g;
$text =~ s/&aring;/\\345/g;
+ $text =~ s/&ntilde;/\\361/g;
$text =~ s/&auml;/\\344/g;
$text =~ s/&euml;/\\353/g;
@@ -126,6 +132,7 @@ sub html_entities_to_rtf {
$text =~ s/&aacute;/\\'87/g;
$text =~ s/&eacute;/\\'8e/g;
+ $text =~ s/&iacute;/\\'92/g;
$text =~ s/&igrave;/\\'93/g;
$text =~ s/&oacute;/\\'97/g;
$text =~ s/&oslash;/\\'bf/g;
@@ -135,6 +142,8 @@ sub html_entities_to_rtf {
$text =~ s/&Scaron;/\\uc0\\u540 /g;
# Back to hex numbers
+ $text =~ s/&ntilde;/\\'96/g;
+
$text =~ s/&auml;/\\'8a/g;
$text =~ s/&euml;/\\'eb/g;
$text =~ s/&ouml;/\\'9a/g;
@@ -151,12 +160,14 @@ sub html_entities_to_tex {
$text =~ s/&aacute;/\\'a/g;
$text =~ s/&eacute;/\\'e/g;
+ $text =~ s/&iacute;/\\'i/g;
$text =~ s/&igrave;/\\`\\i/g;
$text =~ s/&oacute;/\\'o/g;
$text =~ s/&oslash;/{\\o}/g;
$text =~ s/&aring;/\\aa /g;
$text =~ s/&#322;/{\\l}/g;
$text =~ s/&Scaron;/{\\v S}/g;
+ $text =~ s/&ntilde;/\\˜n/g;
$text =~ s/&auml;/\\"a/g;
$text =~ s/&ouml;/\\"o/g;
@@ -984,7 +995,7 @@ begin_credits("Credits");
end_section();
end_section();
- begin_section("Translations");
+ begin_section("GUI Translations");
begin_persons();
add_person("Thierry Crozat", "criezy", "Translation Lead");
end_persons();
@@ -1049,6 +1060,20 @@ begin_credits("Credits");
add_person("Lubomyr Lisen", "", "");
end_section();
end_section();
+ begin_section("Game Translations");
+ begin_section("CGE");
+ add_person("Dan Serban", "nutron", "Soltys English translation");
+ add_person("V&iacute;ctor Gonz&aacute;lez", "IlDucci", "Soltys Spanish translation");
+ add_person("Alejandro G&oacute;mez de la Mu&ntilde;oza", "TheFireRed", "Soltys Spanish translation");
+ end_section();
+ begin_section("Drascula");
+ add_person("Thierry Crozat", "criezy", "Improve French translation");
+ end_section();
+ begin_section("Mortevielle");
+ add_person("Hugo Labrande", "", "Improve English translation");
+ add_person("Thierry Crozat", "criezy", "Improve English translation");
+ end_section();
+ end_section();
begin_section("Websites (design)");
begin_persons();
diff --git a/devtools/extract_mort/extract_mort.cpp b/devtools/extract_mort/extract_mort.cpp
index 4346f1f4bf..a52458f9b2 100644
--- a/devtools/extract_mort/extract_mort.cpp
+++ b/devtools/extract_mort/extract_mort.cpp
@@ -104,9 +104,9 @@ public:
return ftell(f);
}
uint32 size() {
- int position = ftell(f);
+ uint32 position = ftell(f);
fseek (f, 0, SEEK_END);
- int end = ftell (f);
+ uint32 end = ftell(f);
fseek (f, position, SEEK_SET);
return end;
diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp
index ef30faa87c..6bce59ddc0 100644
--- a/engines/avalanche/animation.cpp
+++ b/engines/avalanche/animation.cpp
@@ -48,6 +48,37 @@ const int32 Animation::kCatacombMap[8][8] = {
AnimationType::AnimationType(Animation *anim) {
_anim = anim;
+
+ _xLength = 0;
+ _yLength = 0;
+ for (int i = 0; i < 24; i++) {
+ _mani[i] = nullptr;
+ _sil[i] = nullptr;
+ }
+ _frameNum = 0;
+ _seq = 0;
+ _characterId = 0;
+ _count = 0;
+ _facingDir = kDirNone;
+ _stepNum = 0;
+ _x = 0;
+ _y = 0;
+ _moveX = 0;
+ _moveY = 0;
+ _quick = false;
+ _visible = false;
+ _homing = false;
+ _doCheck = false;
+ _homingX = 0;
+ _homingY = 0;
+ _speedX = 0;
+ _speedY = 0;
+ _vanishIfStill = false;
+ _callEachStepFl = false;
+ _eachStepProc = Animation::kProcNone;
+ _fgBubbleCol = kColorWhite;
+ _bgBubbleCol = kColorBlack;
+ _id = 177;
}
/**
@@ -370,6 +401,13 @@ Animation::Animation(AvalancheEngine *vm) {
for (int16 i = 0; i < kSpriteNumbMax; i++) {
_sprites[i] = new AnimationType(this);
}
+
+ _direction = kDirNone;
+ _oldDirection = kDirNone;
+ _arrowTriggered = false;
+ _geidaSpin = 0;
+ _geidaTime = 0;
+ _sayWhat = 0;
}
Animation::~Animation() {
@@ -1202,6 +1240,8 @@ void Animation::animLink() {
case kProcGeida :
geidaProcs(i);
break;
+ default:
+ break;
}
}
}
diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h
index 33f6ab02a6..3223615985 100644
--- a/engines/avalanche/animation.h
+++ b/engines/avalanche/animation.h
@@ -97,7 +97,8 @@ public:
static const byte kSpriteNumbMax = 5; // current max no. of sprites
enum Proc {
- kProcFollowAvvyY = 1,
+ kProcNone = 0,
+ kProcFollowAvvyY,
kProcBackAndForth,
kProcFaceAvvy,
kProcArrow,
diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp
index 43e99945dc..e373ab58c3 100644
--- a/engines/avalanche/avalanche.cpp
+++ b/engines/avalanche/avalanche.cpp
@@ -41,17 +41,24 @@ AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription *
TimeDate time;
_system->getTimeAndDate(time);
_rnd->setSeed(time.tm_sec + time.tm_min + time.tm_hour);
-
- // Needed because of Lucerna::load_also()
- for (int i = 0; i < 31; i++) {
- for (int j = 0; j < 2; j++)
- _also[i][j] = nullptr;
- }
-
- _totalTime = 0;
_showDebugLines = false;
-
- memset(_fxPal, 0, 16 * 16 * 3);
+
+ _clock = nullptr;
+ _graphics = nullptr;
+ _parser = nullptr;
+ _pingo = nullptr;
+ _dialogs = nullptr;
+ _background = nullptr;
+ _sequence = nullptr;
+ _timer = nullptr;
+ _animation = nullptr;
+ _menu = nullptr;
+ _closing = nullptr;
+ _sound = nullptr;
+
+ _platform = gd->desc.platform;
+
+ initVariables();
}
AvalancheEngine::~AvalancheEngine() {
@@ -82,6 +89,65 @@ AvalancheEngine::~AvalancheEngine() {
}
}
+void AvalancheEngine::initVariables() {
+ resetVariables();
+
+ for (int i = 0; i < 31; i++) {
+ _also[i][0] = nullptr;
+ _also[i][1] = nullptr;
+ }
+
+ _totalTime = 0;
+
+ memset(_fxPal, 0, 16 * 16 * 3);
+
+ for (int i = 0; i < 15; i++) {
+ _peds[i]._direction = kDirNone;
+ _peds[i]._x = 0;
+ _peds[i]._y = 0;
+ _magics[i]._operation = kMagicNothing;
+ _magics[i]._data = 0;
+ }
+
+ for (int i = 0; i < 7; i++) {
+ _portals[i]._operation = kMagicNothing;
+ _portals[i]._data = 0;
+ }
+
+ for (int i = 0; i < 30; i++) {
+ _fields[i]._x1 = 0;
+ _fields[i]._y1 = 0;
+ _fields[i]._x2 = 0;
+ _fields[i]._y2 = 0;
+ }
+
+ _fieldNum = 0;
+ _cp = 0;
+ _ledStatus = 177;
+ _alive = false;
+ _subjectNum = 0;
+ _him = kPeoplePardon;
+ _her = kPeoplePardon;
+ _it = Parser::kPardon;
+ _roomTime = 0;
+ _doingSpriteRun = false;
+ _isLoaded = false;
+ _soundFx = true;
+ _holdTheDawn = false;
+
+ _lineNum = 0;
+ for (int i = 0; i < 50; i++)
+ _lines[i]._color = kColorWhite;
+ _dropsOk = false;
+ _cheat = false;
+ _letMeOut = false;
+ _thinks = 2;
+ _thinkThing = true;
+ _seeScroll = false;
+ _currentMouse = 177;
+ _holdLeftMouse = false;
+}
+
Common::ErrorCode AvalancheEngine::initialize() {
_graphics = new GraphicManager(this);
_parser = new Parser(this);
diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h
index cff0970d22..b6e168f830 100644
--- a/engines/avalanche/avalanche.h
+++ b/engines/avalanche/avalanche.h
@@ -55,7 +55,9 @@ class RandomSource;
namespace Avalanche {
-struct AvalancheGameDescription;
+struct AvalancheGameDescription {
+ ADGameDescription desc;
+};
static const int kSavegameVersion = 1;
@@ -316,6 +318,7 @@ private:
Common::String readAlsoStringFromFile(Common::File &file);
void runAvalot();
void init();
+ void initVariables();
void setup();
void scram(Common::String &str);
void unScramble();
diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp
index 072ad00ed6..36ce16d09c 100644
--- a/engines/avalanche/avalot.cpp
+++ b/engines/avalanche/avalot.cpp
@@ -118,10 +118,13 @@ Room AvalancheEngine::_whereIs[29] = {
Clock::Clock(AvalancheEngine *vm) {
_vm = vm;
+ // Magic value to determine if we just created the instance
_oldHour = _oldHourAngle = _oldMinute = 17717;
+ _hour = _minute = _second = 0;
+ _hourAngle = 0;
}
-void Clock::update() { // TODO: Move variables from Gyro to here (or at least somewhere nearby), rename them.
+void Clock::update() {
TimeDate t;
_vm->_system->getTimeAndDate(t);
_hour = t.tm_hour;
@@ -177,7 +180,9 @@ void Clock::plotHands() {
}
void Clock::chime() {
- if ((_oldHour == 17717) || (!_vm->_soundFx)) // Too high - must be first time around
+ // Too high - must be first time around
+ // Mute - skip the sound generation
+ if ((_oldHour == 17717) || (!_vm->_soundFx))
return;
byte hour = _hour % 12;
@@ -1564,10 +1569,12 @@ Common::String AvalancheEngine::getName(People whose) {
static const char lasses[4][15] = {"Arkata", "Geida", "\0xB1", "the Wise Woman"};
- if (whose < kPeopleArkata)
+ if (whose <= kPeopleJacques)
return Common::String(lads[whose - kPeopleAvalot]);
- else
+ else if ((whose >= kPeopleArkata) && (whose <= kPeopleWisewoman))
return Common::String(lasses[whose - kPeopleArkata]);
+ else
+ error("getName() - Unexpected character id %d", (byte) whose);
}
Common::String AvalancheEngine::getItem(byte which) {
@@ -1674,6 +1681,9 @@ void AvalancheEngine::flipRoom(Room room, byte ped) {
if (_room == kRoomLustiesRoom)
_enterCatacombsFromLustiesRoom = true;
+ if (room > kRoomMap)
+ return;
+
enterRoom(room, ped);
_animation->appearPed(0, ped - 1);
_enterCatacombsFromLustiesRoom = false;
diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp
index c84c049c8f..4d71550213 100644
--- a/engines/avalanche/background.cpp
+++ b/engines/avalanche/background.cpp
@@ -37,6 +37,7 @@ const int16 Background::kOnDisk = -1;
Background::Background(AvalancheEngine *vm) {
_vm = vm;
_spriteNum = 0;
+ _nextBell = 0;
}
Background::~Background() {
diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp
index 428e71f35a..048b0fe148 100644
--- a/engines/avalanche/detection.cpp
+++ b/engines/avalanche/detection.cpp
@@ -35,10 +35,6 @@
namespace Avalanche {
-struct AvalancheGameDescription {
- ADGameDescription desc;
-};
-
uint32 AvalancheEngine::getFeatures() const {
return _gameDescription->desc.flags;
}
diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp
index e121141a2a..4b6cacf569 100644
--- a/engines/avalanche/dialogs.cpp
+++ b/engines/avalanche/dialogs.cpp
@@ -59,6 +59,19 @@ const QuasipedType Dialogs::kQuasipeds[16] = {
Dialogs::Dialogs(AvalancheEngine *vm) {
_vm = vm;
_noError = true;
+
+ _aboutBox = false;
+ _talkX = 0;
+ _talkY = 0;
+ _maxLineNum = 0;
+ _scReturn = false;
+ _currentFont = kFontStyleRoman;
+ _param = 0;
+ _useIcon = 0;
+ _scrollBells = 0;
+ _underScroll = 0;
+ _shadowBoxX = 0;
+ _shadowBoxY = 0;
}
void Dialogs::init() {
@@ -689,6 +702,7 @@ void Dialogs::displayText(Common::String text) {
if (_param == 0)
setBubbleStateNatural();
else if ((1 <= _param) && (_param <= 9)) {
+ assert(_param - 1 < _vm->_animation->kSpriteNumbMax);
AnimationType *spr = _vm->_animation->_sprites[_param - 1];
if ((_param > _vm->_animation->kSpriteNumbMax) || (!spr->_quick)) { // Not valid.
_vm->errorLed();
@@ -699,6 +713,7 @@ void Dialogs::displayText(Common::String text) {
// Quasi-peds. (This routine performs the same
// thing with QPs as triptype.chatter does with the
// sprites.)
+ assert(_param - 10 < 16);
PedType *quasiPed = &_vm->_peds[kQuasipeds[_param - 10]._whichPed];
_talkX = quasiPed->_x;
_talkY = quasiPed->_y; // Position.
@@ -1164,7 +1179,9 @@ void Dialogs::sayThanks(byte thing) {
Common::String tmpStr = personSpeaks();
tmpStr += Common::String::format("Hey, thanks!%c(But now, you've lost it!)", kControlSpeechBubble);
displayText(tmpStr);
- _vm->_objects[thing] = false;
+
+ if (thing < kObjectNum)
+ _vm->_objects[thing] = false;
}
/**
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index 25b01d65f3..d7c32cb1fc 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -49,6 +49,7 @@ const MouseHotspotType GraphicManager::kMouseHotSpots[9] = {
GraphicManager::GraphicManager(AvalancheEngine *vm) {
_vm = vm;
+ setDialogColor(kColorBlack, kColorWhite);
}
GraphicManager::~GraphicManager() {
diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp
index bba8e862a9..7c37b79bc8 100644
--- a/engines/avalanche/menu.cpp
+++ b/engines/avalanche/menu.cpp
@@ -207,6 +207,11 @@ void MenuItem::parseKey(char c) {
_menu->_vm->_sound->blip();
}
+MenuBar::MenuBar() {
+ _menuNum = 0;
+ _menu = nullptr;
+}
+
void MenuBar::init(Menu *menu) {
_menu = menu;
_menuNum = 0;
@@ -261,6 +266,9 @@ Menu::Menu(AvalancheEngine *vm) {
_vm = vm;
_activeMenuItem.init(this);
_menuBar.init(this);
+
+ _menuActive = false;
+ _lastPerson = kPeopleNone;
}
void Menu::findWhatYouCanDoWithIt() {
@@ -782,10 +790,12 @@ byte Menu::getNameChar(People whose) {
static const char ladChar[] = "ASCDMTRwLfgeIyPu";
static const char lassChar[] = "kG\0xB1o";
- if (whose < kPeopleArkata)
+ if (whose <= kPeopleJacques)
return ladChar[whose - kPeopleAvalot];
- else
+ else if ((whose >= kPeopleArkata) && (whose <= kPeopleWisewoman))
return lassChar[whose - kPeopleArkata];
+ else
+ error("getName() - Unexpected character id %d", (byte) whose);
}
Common::String Menu::getThing(byte which) {
diff --git a/engines/avalanche/menu.h b/engines/avalanche/menu.h
index a7ec8bf2db..b7674fbb9d 100644
--- a/engines/avalanche/menu.h
+++ b/engines/avalanche/menu.h
@@ -102,6 +102,7 @@ public:
HeadType _menuItems[8];
byte _menuNum;
+ MenuBar();
void init(Menu *menu);
void createMenuItem(char trig, Common::String title, char altTrig, MenuFunc setupFunc, MenuFunc chooseFunc);
void draw();
diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp
index 297f27ffb8..9b6b841c8a 100644
--- a/engines/avalanche/parser.cpp
+++ b/engines/avalanche/parser.cpp
@@ -37,6 +37,21 @@ const char *Parser::kVersionNum = "1.30";
Parser::Parser(AvalancheEngine *vm) {
_vm = vm;
+
+ _verb = kVerbCodePardon;
+ _thing = kPardon;
+ _person = kPeopleNone;
+ _polite = false;
+ _inputTextPos = 0;
+ _quote = false;
+ _cursorState = false;
+ _weirdWord = false;
+ _wearing = kNothing;
+ _thing2 = 0;
+ _sworeNum = 0;
+ _alcoholLevel = 0;
+ _playedNim = 0;
+ _boughtOnion = false;
}
void Parser::init() {
@@ -1013,7 +1028,7 @@ bool Parser::isHolding() {
bool holdingResult = false;
- if (_thing > 100)
+ if (_thing >= 100)
_vm->_dialogs->displayText("Be reasonable!");
else if (_thing <= kObjectNum) {
if (!_vm->_objects[_thing - 1])
@@ -2457,7 +2472,7 @@ void Parser::doVerb(VerbCode id) {
}
void Parser::resetVariables() {
- _wearing = 0;
+ _wearing = kNothing;
_sworeNum = 0;
_alcoholLevel = 0;
_playedNim = 0;
diff --git a/engines/cge/detection.cpp b/engines/cge/detection.cpp
index 3b01421903..c377970c51 100644
--- a/engines/cge/detection.cpp
+++ b/engines/cge/detection.cpp
@@ -117,6 +117,18 @@ static const CgeGameDescription gameDescriptions[] = {
},
{
{
+ "soltys", "Soltys Freeware v1.0",
+ {
+ {"vol.cat", 0, "fcae86b20eaa5cedec17b24fa5e85eb4", 50176},
+ {"vol.dat", 0, "ff10d54acc2c95696c57e05819b6906f", 8450151},
+ AD_LISTEND
+ },
+ Common::ES_ESP, Common::kPlatformDOS, ADGF_NO_FLAGS , GUIO0()
+ },
+ kGameTypeSoltys
+ },
+ {
+ {
// Polish version, provided by Strangerke
"sfinx", "Sfinx Freeware",
{
diff --git a/engines/cine/sound.cpp b/engines/cine/sound.cpp
index 0df926675e..de6f91d8c3 100644
--- a/engines/cine/sound.cpp
+++ b/engines/cine/sound.cpp
@@ -309,9 +309,7 @@ void AdLibSoundDriver::setupChannel(int channel, const byte *data, int instrumen
volume = 0;
}
volume += volume / 4;
- if (volume > 127) {
- volume = 127;
- }
+
_channelsVolumeTable[channel] = volume;
setupInstrument(data, channel);
}
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp
index 9699dda021..159ceb9bf0 100644
--- a/engines/drascula/drascula.cpp
+++ b/engines/drascula/drascula.cpp
@@ -141,6 +141,32 @@ DrasculaEngine::DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gam
drasculaX = 0;
drasculaY = 0;
trackDrascula = 0;
+ _roomNumber = 0;
+ numRoomObjs = 0;
+ takeObject = 0;
+ pickedObject = 0;
+ _subtitlesDisabled = 0;
+ _menuBar = 0;
+ _menuScreen = 0;
+ _hasName = 0;
+ curExcuseLook = 0;
+ curExcuseAction = 0;
+ frame_y = 0;
+ curX = 0;
+ curY = 0;
+ characterMoved = 0;
+ curDirection = 0;
+ trackProtagonist = 0;
+ _characterFrame = 0;
+ hare_se_ve = 0;
+ roomX = 0;
+ roomY = 0;
+ checkFlags = 0;
+ doBreak = 0;
+ stepX = 0;
+ stepY = 0;
+ curHeight = 0;
+ curWidth = 0;
_color = 0;
blinking = 0;
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp
index 6c6f5296f4..a91e41ea67 100644
--- a/engines/dreamweb/dreamweb.cpp
+++ b/engines/dreamweb/dreamweb.cpp
@@ -232,6 +232,15 @@ DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gam
_hasSpeech = 0;
_roomsSample = 0;
_copyProtection = 0;
+
+ for (uint i = 0; i < 128; i++)
+ memset(&_setDat[i], 0, sizeof(SetObject));
+
+ for (uint i = 0; i < 80; i++)
+ memset(&_freeDat[i], 0, sizeof(DynObject));
+
+ for (uint i = 0; i < kNumExObjects; i++)
+ memset(&_exData[i], 0, sizeof(DynObject));
}
DreamWebEngine::~DreamWebEngine() {
diff --git a/engines/fullpipe/behavior.cpp b/engines/fullpipe/behavior.cpp
index c1fe835b81..c7b526d2c1 100644
--- a/engines/fullpipe/behavior.cpp
+++ b/engines/fullpipe/behavior.cpp
@@ -179,6 +179,12 @@ void BehaviorManager::updateStaticAniBehavior(StaticANIObject *ani, int delay, B
}
}
+bool BehaviorManager::setBehaviorEnabled(StaticANIObject *obj, int aniId, int quId, int flag) {
+ warning("STUB: BehaviorManager::setBehaviorEnabled()");
+
+ return true;
+}
+
void BehaviorInfo::clear() {
_ani = 0;
_staticsId = 0;
diff --git a/engines/fullpipe/behavior.h b/engines/fullpipe/behavior.h
index 83a548f486..4fd1454351 100644
--- a/engines/fullpipe/behavior.h
+++ b/engines/fullpipe/behavior.h
@@ -77,6 +77,8 @@ class BehaviorManager : public CObject {
void updateBehaviors();
void updateBehavior(BehaviorInfo *behaviorInfo, BehaviorEntry *entry);
void updateStaticAniBehavior(StaticANIObject *ani, int delay, BehaviorEntry *beh);
+
+ bool setBehaviorEnabled(StaticANIObject *obj, int aniId, int quId, int flag);
};
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h
index 796764d0a9..c0034e444d 100644
--- a/engines/fullpipe/constants.h
+++ b/engines/fullpipe/constants.h
@@ -26,6 +26,8 @@
namespace Fullpipe {
#define ANI_BOOT_1 4231
+#define ANI_DOMINO_3 2732
+#define ANI_EGGEATER 334
#define ANI_IN1MAN 5110
#define ANI_INV_MAP 5321
#define ANI_LIFTBUTTON 2751
@@ -35,12 +37,17 @@ namespace Fullpipe {
#define MSG_ENABLESAVES 5202
#define MSG_HMRKICK_METAL 4764
#define MSG_HMRKICK_STUCCO 4765
+#define MSG_INTR_ENDINTRO 5139
+#define MSG_INTR_GETUPMAN 5135
+#define MSG_INTR_SWITCHTO1 5145
+#define MSG_INTR_SWITCHTO2 5134
#define MSG_MANSHADOWSOFF 5196
#define MSG_MANSHADOWSON 5197
#define MSG_RESTARTGAME 4767
#define MSG_SC1_SHOWOSK 1019
#define MSG_SC1_SHOWOSK2 468
#define MSG_SC1_UTRUBACLICK 1100
+#define MV_IN1MAN_SLEEP 5111
#define MV_MAN_GOLADDER 451
#define MV_MAN_GOLADDER2 2844
#define MV_MAN_LOOKUP 4773
@@ -84,6 +91,7 @@ namespace Fullpipe {
#define PIC_CSR_ITN_RED 5329
#define PIC_CSR_LIFT 5176
#define PIC_CSR_MAP 5339
+#define PIC_IN1_GAMETITLE 5169
#define PIC_IN1_PIPETITLE 5167
#define PIC_INV_MENU 991
#define PIC_MAP_A13 5275
@@ -92,7 +100,17 @@ namespace Fullpipe {
#define PIC_SC1_LADDER 1091
#define PIC_SC1_OSK 1018
#define PIC_SC1_OSK2 2932
+#define PIC_SC3_DOMIN 5182
#define PIC_SCD_SEL 734
+#define QU_EGTR_MD2_SHOW 4698
+#define QU_EGTR_MD1_SHOW 4697
+#define QU_EGTR_SLIMSHOW 4883
+#define QU_IN2_DO 5144
+#define QU_INTR_FINISH 5138
+#define QU_INTR_GETUPMAN 5136
+#define QU_INTR_STARTINTRO 5133
+#define QU_SC3_ENTERLIFT 2779
+#define QU_SC3_EXITLIFT 2808
#define SC_1 301
#define SC_10 653
#define SC_11 654
@@ -147,6 +165,11 @@ namespace Fullpipe {
#define SC_TITLES 5166
#define SND_CMN_031 3516
#define SND_CMN_070 5199
+#define SND_INTR_019 5220
+#define ST_EGTR_MID1 2863
+#define ST_EGTR_MID2 2869
+#define ST_EGTR_SLIM 336
+#define ST_IN1MAN_SLEEP 5112
#define ST_LBN_0N 2832
#define ST_LBN_0P 2833
#define ST_LBN_1N 2753
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp
index a0db6aa08c..2f49a41c17 100644
--- a/engines/fullpipe/fullpipe.cpp
+++ b/engines/fullpipe/fullpipe.cpp
@@ -80,7 +80,7 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
_gameContinue = true;
_needRestart = false;
- _flgPlayIntro = false;
+ _flgPlayIntro = true;
_gamePaused = false;
_inputArFlag = false;
_recordEvents = false;
diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h
index 22e4f1d8f4..7f1c9baa9b 100644
--- a/engines/fullpipe/fullpipe.h
+++ b/engines/fullpipe/fullpipe.h
@@ -210,7 +210,7 @@ public:
int _objectIdAtCursor;
void setCursor(int id);
- void updateCursorsCommon();
+ void updateCursorCommon();
int getObjectState(const char *objname);
void setObjectState(const char *name, int state);
@@ -231,6 +231,7 @@ public:
void getAllInventory();
int lift_getButtonIdP(int objid);
+ void lift_sub5(Scene *sc, int qu1, int qu2);
public:
diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp
index f8ede5cff2..a2ab71d7e3 100644
--- a/engines/fullpipe/gameloader.cpp
+++ b/engines/fullpipe/gameloader.cpp
@@ -481,7 +481,7 @@ bool PreloadItems::load(MfcArchive &file) {
int count = file.readCount();
- resize(count);
+ clear();
for (int i = 0; i < count; i++) {
PreloadItem *t = new PreloadItem();
diff --git a/engines/fullpipe/input.cpp b/engines/fullpipe/input.cpp
index ee826fd359..e98920c78a 100644
--- a/engines/fullpipe/input.cpp
+++ b/engines/fullpipe/input.cpp
@@ -211,7 +211,7 @@ void FullpipeEngine::winArcade() {
}
-void FullpipeEngine::updateCursorsCommon() {
+void FullpipeEngine::updateCursorCommon() {
GameObject *ani = _currentScene->getStaticANIObjectAtPos(_mouseVirtX, _mouseVirtY);
GameObject *pic = _currentScene->getPictureObjectAtPos(_mouseVirtX, _mouseVirtY);
diff --git a/engines/fullpipe/lift.cpp b/engines/fullpipe/lift.cpp
index 25dd2613fe..8fa6cf744d 100644
--- a/engines/fullpipe/lift.cpp
+++ b/engines/fullpipe/lift.cpp
@@ -64,4 +64,8 @@ int FullpipeEngine::lift_getButtonIdP(int objid) {
}
}
+void FullpipeEngine::lift_sub5(Scene *sc, int qu1, int qu2) {
+ warning("STUB: FullpipeEngine::lift_sub5()");
+}
+
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp
index b5f3c7fa65..cad1934c5f 100644
--- a/engines/fullpipe/messages.cpp
+++ b/engines/fullpipe/messages.cpp
@@ -756,4 +756,23 @@ void updateGlobalMessageQueue(int id, int objid) {
}
}
+bool chainQueue(int queueId, int flags) {
+ MessageQueue *mq = g_fullpipe->_currentScene->getMessageQueueById(queueId);
+
+ if (!mq)
+ return false;
+
+ MessageQueue *nmq = new MessageQueue(mq, 0, 0);
+
+ nmq->_flags |= flags;
+
+ if (!mq->chain(0)) {
+ delete mq;
+
+ return false;
+ }
+
+ return true;
+}
+
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/messages.h b/engines/fullpipe/messages.h
index 5238ba7db3..3e0da292d5 100644
--- a/engines/fullpipe/messages.h
+++ b/engines/fullpipe/messages.h
@@ -173,6 +173,8 @@ void processMessages();
void updateGlobalMessageQueue(int id, int objid);
void clearGlobalMessageQueueList1();
+bool chainQueue(int queueId, int flags);
+
} // End of namespace Fullpipe
#endif /* FULLPIPE_MESSAGEQUEUE_H */
diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp
index 26048ced13..44e7b46184 100644
--- a/engines/fullpipe/modal.cpp
+++ b/engines/fullpipe/modal.cpp
@@ -25,36 +25,15 @@
#include "fullpipe/messages.h"
#include "fullpipe/constants.h"
#include "fullpipe/scenes.h"
+#include "fullpipe/gameloader.h"
namespace Fullpipe {
-bool BaseModalObject::handleMessage(ExCommand *message) {
- warning("STUB: BaseModalObject::handleMessage()");
-
- return true;
-}
-
-bool BaseModalObject::init(int counterdiff) {
- warning("STUB: BaseModalObject::init(%d)", counterdiff);
-
- return true;
-}
-
-bool BaseModalObject::update() {
- warning("STUB: BaseModalObject::update()");
-
- return true;
-}
-
-void BaseModalObject::saveload() {
- warning("STUB: BaseModalObject::saveload()");
-}
-
-
ModalIntro::ModalIntro() {
_field_8 = 0;
_countDown = 0;
- _needRedraw = 0;
+ _stillRunning = 0;
+
if (g_vars->sceneIntro_skipIntro) {
_introFlags = 4;
} else {
@@ -64,6 +43,7 @@ ModalIntro::ModalIntro() {
PictureObject *pict = g_fullpipe->accessScene(SC_INTRO1)->getPictureObjectById(PIC_IN1_PIPETITLE, 0);
pict->setFlags(pict->_flags & 0xFFFB);
}
+
g_vars->sceneIntro_skipIntro = false;
_sfxVolume = g_fullpipe->_sfxVolume;
}
@@ -78,7 +58,7 @@ bool ModalIntro::handleMessage(ExCommand *message) {
if (message->_keyCode != 13 && message->_keyCode != 27 && message->_keyCode != 32)
return false;
- if (_needRedraw) {
+ if (_stillRunning) {
if (!(_introFlags & 0x10)) {
_countDown = 0;
g_vars->sceneIntro_needBlackout = true;
@@ -91,6 +71,157 @@ bool ModalIntro::handleMessage(ExCommand *message) {
return true;
}
+bool ModalIntro::init(int counterdiff) {
+ if (!g_vars->sceneIntro_playing) {
+ if (!_stillRunning) {
+ finish();
+ return false;
+ }
+
+ if (_introFlags & 0x10)
+ g_fullpipe->_gameLoader->updateSystems(42);
+
+ _introFlags |= 2;
+
+ return true;
+ }
+
+ if (_introFlags & 4) {
+ ModalVideoPlayer *player = new ModalVideoPlayer();
+
+ g_fullpipe->_modalObject = player;
+ player->_parentObj = this;
+ player->play("intro.avi");
+
+ _countDown--;
+
+ if (_countDown > 0 )
+ return true;
+
+ if (_stillRunning <= 0) {
+ _countDown = 0;
+ _stillRunning = 0;
+ _introFlags = (_introFlags & 0xfb) | 0x40;
+
+ return true;
+ }
+
+ _introFlags |= 2;
+ return true;
+ }
+
+ if (_introFlags & 0x40) {
+ ModalVideoPlayer *player = new ModalVideoPlayer();
+
+ g_fullpipe->_modalObject = player;
+ player->_parentObj = this;
+ player->play("intro2.avi");
+
+ _countDown--;
+ if (_countDown > 0)
+ return true;
+
+ if (_stillRunning <= 0) {
+ _countDown = 50;
+ _stillRunning = 0;
+ _introFlags = (_introFlags & 0xbf) | 9;
+
+ return true;
+ }
+
+ _introFlags |= 2;
+ return true;
+ }
+
+ if (_introFlags & 8) {
+ _countDown--;
+
+ if (_countDown > 0 )
+ return true;
+
+ if (_stillRunning > 0) {
+ _introFlags |= 2;
+ return true;
+ }
+
+ _countDown = 150;
+ _introFlags = (_introFlags & 0xf7) | 0x21;
+ g_fullpipe->accessScene(SC_INTRO1)->getPictureObjectById(PIC_IN1_PIPETITLE, 0)->_flags &= 0xfffb;
+ }
+
+ if (!(_introFlags & 0x20)) {
+ if (_introFlags & 0x10) {
+ if (!_stillRunning) {
+ _introFlags |= 1;
+
+ g_fullpipe->accessScene(SC_INTRO1)->getPictureObjectById(PIC_IN1_PIPETITLE, 0)->_flags &= 0xfffb;
+ g_fullpipe->accessScene(SC_INTRO1)->getPictureObjectById(PIC_IN1_GAMETITLE, 0)->_flags &= 0xfffb;
+
+ chainQueue(QU_INTR_STARTINTRO, 1);
+ }
+ g_fullpipe->_gameLoader->updateSystems(42);
+ }
+ return true;
+ }
+
+ _countDown--;
+
+ if (_countDown <= 0) {
+ if (_stillRunning > 0) {
+ _introFlags |= 2;
+
+ return true;
+ }
+
+ _introFlags = (_introFlags & 0xdf) | 0x10;
+
+ g_fullpipe->accessScene(SC_INTRO1)->getPictureObjectById(PIC_IN1_GAMETITLE, 0)->_flags &= 0xfffb;
+
+ _stillRunning = 0;
+ }
+
+ return true;
+}
+
+void ModalIntro::update() {
+ if (g_fullpipe->_currentScene) {
+ if (_introFlags & 1) {
+ //sceneFade(virt, g_currentScene, 1);
+ _stillRunning = 255;
+ _introFlags &= 0xfe;
+
+ if (_introFlags & 0x20)
+ g_fullpipe->playSound(SND_INTR_019, 0);
+ } else if (_introFlags & 2) {
+ if (g_vars->sceneIntro_needBlackout) {
+ //vrtRectangle(*(_DWORD *)virt, 0, 0, 0, 800, 600);
+ g_vars->sceneIntro_needBlackout = 0;
+ _stillRunning = 0;
+ _introFlags &= 0xfd;
+ } else {
+ //sceneFade(virt, g_currentScene, 0);
+ _stillRunning = 0;
+ _introFlags &= 0xfd;
+ }
+ } else if (_stillRunning) {
+ g_fullpipe->_currentScene->draw();
+ }
+ }
+}
+
+void ModalIntro::finish() {
+ g_fullpipe->_gameLoader->unloadScene(SC_INTRO2);
+ g_fullpipe->_currentScene = g_fullpipe->accessScene(SC_INTRO1);
+ g_fullpipe->_gameLoader->preloadScene(SC_INTRO1, TrubaDown);
+
+ if (g_fullpipe->_currentScene)
+ g_fullpipe->_gameLoader->updateSystems(42);
+}
+
+void ModalVideoPlayer::play(const char *fname) {
+ warning("STUB: ModalVideoPlayer::play(%s)", fname);
+}
+
void FullpipeEngine::openMap() {
warning("STUB: FullpipeEngine::openMap()");
}
diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h
index 7d98427e20..f3f571e2a9 100644
--- a/engines/fullpipe/modal.h
+++ b/engines/fullpipe/modal.h
@@ -34,24 +34,44 @@ class BaseModalObject {
BaseModalObject() : _parentObj(0) {}
virtual ~BaseModalObject() {}
- virtual bool handleMessage(ExCommand *message);
- virtual bool init(int counterdiff);
- virtual bool update();
- void saveload();
+ virtual bool pollEvent() = 0;
+ virtual bool handleMessage(ExCommand *message) = 0;
+ virtual bool init(int counterdiff) = 0;
+ virtual void update() = 0;
+
+ virtual void saveload() = 0;
};
class ModalIntro : public BaseModalObject {
int _field_8;
int _introFlags;
int _countDown;
- int _needRedraw;
+ int _stillRunning;
int _sfxVolume;
public:
ModalIntro();
+ virtual bool pollEvent() { return true; }
virtual bool handleMessage(ExCommand *message);
+ virtual bool init(int counterdiff);
+ virtual void update();
+ virtual void saveload() {}
+
+ void finish();
+};
+
+class ModalVideoPlayer : public BaseModalObject {
+public:
+
+ virtual bool pollEvent() { return true; }
+ virtual bool handleMessage(ExCommand *message) { return true; }
+ virtual bool init(int counterdiff) { return false; }
+ virtual void update() {}
+ virtual void saveload() {}
+
+ void play(const char *fname);
};
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index 750c2de5ea..8fecd8304e 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -113,7 +113,8 @@ void MctlCompound::initMovGraph2() {
}
void MctlCompound::freeItems() {
- warning("STUB: MctlCompound::freeItems()");
+ for (uint i = 0; i < _motionControllers.size(); i++)
+ _motionControllers[i]->_motionControllerObj->freeItems();
}
MessageQueue *MctlCompound::method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) {
@@ -672,10 +673,45 @@ void MovGraph2::freeItems() {
warning("STUB: MovGraph2::freeItems()");
}
-MessageQueue *MovGraph2::method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) {
- warning("STUB: MovGraph2::method34()");
+MessageQueue *MovGraph2::method34(StaticANIObject *ani, int xpos, int ypos, int fuzzyMatch, int staticsId) {
+ if (!ani->isIdle())
+ return 0;
- return 0;
+ if (ani->_flags & 0x100)
+ return 0;
+
+ MessageQueue *mq = doWalkTo(ani, xpos, ypos, fuzzyMatch, staticsId);
+
+ if (!mq)
+ return 0;
+
+ if (ani->_movement) {
+ if (mq->getCount() <= 1 || mq->getExCommandByIndex(0)->_messageKind != 22) {
+ PicAniInfo picAniInfo;
+
+ ani->getPicAniInfo(&picAniInfo);
+ ani->updateStepPos();
+ MessageQueue *mq1 = doWalkTo(ani, xpos, ypos, fuzzyMatch, staticsId);
+
+ ani->setPicAniInfo(&picAniInfo);
+
+ if (mq1) {
+ delete mq;
+
+ mq = mq1;
+ }
+ } else {
+ ani->_movement = 0;
+ }
+ }
+
+ if (!mq->chain(ani)) {
+ delete mq;
+
+ return 0;
+ }
+
+ return mq;
}
MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int fuzzyMatch, int staticsId) {
@@ -815,7 +851,7 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int
Common::Array<MovGraphLink *> tempLinkList;
double minPath = findMinPath(&linkInfoSource, &linkInfoDest, &tempLinkList);
- debug(0, "MovGraph2::doWalkTo(): path: %lf parts: %d", minPath, tempLinkList.size());
+ debug(0, "MovGraph2::doWalkTo(): path: %g parts: %d", minPath, tempLinkList.size());
if (minPath < 0.0 || ((linkInfoSource.node != linkInfoDest.node || !linkInfoSource.node) && !tempLinkList.size()))
return 0;
@@ -967,7 +1003,7 @@ int MovGraph2::findLink(Common::Array<MovGraphLink *> *linkList, int idx, Common
}
}
node3 = node1;
- } else if (idx != linkList->size() - 1) {
+ } else if (idx != (int)(linkList->size() - 1)) {
MovGraphLink *lnk = (*linkList)[idx + 1];
if (lnk->_movGraphNode1 == node1 || lnk->_movGraphNode1 == node1) {
@@ -1032,7 +1068,7 @@ MovGraphLink *MovGraph2::findLink1(int x, int y, int idx, int fuzzyMatch) {
MovGraphLink *MovGraph2::findLink2(int x, int y) {
double mindist = 1.0e20;
- MovGraphLink *res;
+ MovGraphLink *res = 0;
for (ObList::iterator i = _links.begin(); i != _links.end(); ++i) {
assert(((CObject *)*i)->_objtype == kObjTypeMovGraphLink);
diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp
index cc93363786..3831831866 100644
--- a/engines/fullpipe/scene.cpp
+++ b/engines/fullpipe/scene.cpp
@@ -328,7 +328,7 @@ void Scene::setPictureObjectsFlag4() {
}
PictureObject *Scene::getPictureObjectById(int objId, int flags) {
- for (uint i = 1; i < _picObjList.size(); i++) {
+ for (uint i = 0; i < _picObjList.size(); i++) {
if (((PictureObject *)_picObjList[i])->_id == objId && ((PictureObject *)_picObjList[i])->_okeyCode == flags)
return (PictureObject *)_picObjList[i];
}
diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp
index 40d9f21afb..fdc28e8092 100644
--- a/engines/fullpipe/scenes.cpp
+++ b/engines/fullpipe/scenes.cpp
@@ -53,6 +53,11 @@ void scene01_fixEntrance();
void scene01_initScene(Scene *sc, int entrance);
int sceneHandler01(ExCommand *cmd);
+void scene03_setEaterState();
+int scene03_updateCursor();
+void scene03_initScene(Scene *sc);
+int sceneHandler03(ExCommand *cmd);
+
void sceneDbgMenu_initScene(Scene *sc);
int sceneHandlerDbgMenu(ExCommand *cmd);
@@ -71,6 +76,9 @@ Vars::Vars() {
scene01_picSc01Osk = 0;
scene01_picSc01Osk2 = 0;
+ scene03_eggeater = 0;
+ scene03_domino = 0;
+
selector = 0;
}
@@ -210,6 +218,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
addMessageHandler(sceneHandler02, 2);
_updateCursorCallback = defaultUpdateCursor;
break;
+#endif
case SC_3:
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_3");
@@ -219,10 +228,11 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
scene->initObjectCursors("SC_3");
setSceneMusicParameters(sceneVar);
addMessageHandler(sceneHandler03, 2);
- j_Scene_sc03_sub_40F160(scene);
+ scene03_setEaterState();
_updateCursorCallback = scene03_updateCursor;
break;
+#if 0
case SC_4:
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_4");
scene->preloadMovements(sceneVar);
@@ -1384,7 +1394,7 @@ int MovGraph_messageHandler(ExCommand *cmd) {
}
int defaultUpdateCursor() {
- g_fullpipe->updateCursorsCommon();
+ g_fullpipe->updateCursorCommon();
return g_fullpipe->_cursorId;
}
@@ -1422,8 +1432,57 @@ void sceneIntro_initScene(Scene *sc) {
g_fullpipe->_modalObject = new ModalIntro;
}
-int sceneHandlerIntro(ExCommand *cmd) {
- warning("STUB: sceneHandlerIntro()");
+void sceneHandlerIntro_part1() {
+ g_fullpipe->_currentScene = g_fullpipe->accessScene(SC_INTRO1);
+ chainQueue(QU_INTR_FINISH, 0);
+}
+
+void sceneHandlerIntro_part2() {
+ g_fullpipe->_currentScene = g_fullpipe->accessScene(SC_INTRO2);
+ chainQueue(QU_IN2_DO, 0);
+}
+
+int sceneHandlerIntro(ExCommand *ex) {
+ if (ex->_messageKind != 17)
+ return 0;
+
+ switch (ex->_messageNum) {
+ case MSG_INTR_ENDINTRO:
+ g_vars->sceneIntro_playing = 0;
+ return 0;
+
+ case MSG_INTR_SWITCHTO1:
+ sceneHandlerIntro_part1();
+ return 0;
+
+ case MSG_INTR_GETUPMAN:
+ g_vars->sceneIntro_needSleep = 0;
+ g_vars->sceneIntro_needGetup = 1;
+ return 0;
+
+ case MSG_INTR_SWITCHTO2:
+ sceneHandlerIntro_part2();
+ return 0;
+
+ case 33:
+ // fall through
+ break;
+
+ default:
+ return 0;
+ }
+
+ if (g_vars->sceneIntro_needSleep) {
+ if (!g_vars->sceneIntro_aniin1man->_movement && g_vars->sceneIntro_aniin1man->_statics->_staticsId == ST_IN1MAN_SLEEP)
+ g_vars->sceneIntro_aniin1man->startAnim(MV_IN1MAN_SLEEP, 0, -1);
+ } else if (g_vars->sceneIntro_needGetup && !g_vars->sceneIntro_aniin1man->_movement &&
+ g_vars->sceneIntro_aniin1man->_statics->_staticsId == ST_IN1MAN_SLEEP) {
+ g_vars->sceneIntro_needGetup = 0;
+
+ chainQueue(QU_INTR_GETUPMAN, 0);
+ }
+
+ g_fullpipe->startSceneTrack();
return 0;
}
@@ -1507,6 +1566,46 @@ int sceneHandler01(ExCommand *cmd) {
return res;
}
+void scene03_initScene(Scene *sc) {
+ g_vars->scene03_eggeater = sc->getStaticANIObject1ById(ANI_EGGEATER, -1);
+ g_vars->scene03_domino = sc->getStaticANIObject1ById(ANI_DOMINO_3, -1);
+
+ GameVar *v = g_fullpipe->_gameLoader->_gameVar->getSubVarByName("OBJSTATES")->getSubVarByName(sO_GulpedEggs);
+
+ g_vars->swallowedEgg1 = v->getSubVarByName(sO_Egg1);
+ g_vars->swallowedEgg2 = v->getSubVarByName(sO_Egg2);
+ g_vars->swallowedEgg3 = v->getSubVarByName(sO_Egg3);
+
+ setElevatorButton(sO_Level2, ST_LBN_2N);
+
+ g_fullpipe->lift_sub5(sc, QU_SC3_ENTERLIFT, QU_SC3_EXITLIFT);
+}
+
+void scene03_setEaterState() {
+ if (g_fullpipe->getObjectState(sO_EggGulperGaveCoin) == g_fullpipe->getObjectEnumState(sO_EggGulperGaveCoin, sO_Yes)) {
+ g_fullpipe->_behaviorManager->setBehaviorEnabled(g_vars->scene03_eggeater, ST_EGTR_SLIM, QU_EGTR_SLIMSHOW, 0);
+ g_fullpipe->_behaviorManager->setBehaviorEnabled(g_vars->scene03_eggeater, ST_EGTR_MID1, QU_EGTR_MD1_SHOW, 0);
+ g_fullpipe->_behaviorManager->setBehaviorEnabled(g_vars->scene03_eggeater, ST_EGTR_MID2, QU_EGTR_MD2_SHOW, 0);
+ }
+}
+
+int scene03_updateCursor() {
+ g_fullpipe->updateCursorCommon();
+
+ if (g_fullpipe->_cursorId == PIC_CSR_DEFAULT && g_fullpipe->_objectIdAtCursor == PIC_SC3_DOMIN && g_vars->scene03_domino) {
+ if (g_vars->scene03_domino->_flags & 4)
+ g_fullpipe->_cursorId = PIC_CSR_ITN;
+ }
+
+ return g_fullpipe->_cursorId;
+}
+
+int sceneHandler03(ExCommand *ex) {
+ warning("STUB: sceneHandler03()");
+
+ return 0;
+}
+
void sceneDbgMenu_initScene(Scene *sc) {
g_vars->selector = sc->getPictureObjectById(PIC_SCD_SEL, 0);
getGameLoaderInteractionController()->disableFlag24();
diff --git a/engines/fullpipe/scenes.h b/engines/fullpipe/scenes.h
index 5597612aa6..9d1dbd5e55 100644
--- a/engines/fullpipe/scenes.h
+++ b/engines/fullpipe/scenes.h
@@ -28,7 +28,7 @@ namespace Fullpipe {
class StaticANIObject;
class Vars {
- public:
+public:
Vars();
GameVar *swallowedEgg1;
@@ -45,7 +45,10 @@ class Vars {
PictureObject *scene01_picSc01Osk;
PictureObject *scene01_picSc01Osk2;
- GameObject *selector;
+ StaticANIObject *scene03_eggeater;
+ StaticANIObject *scene03_domino;
+
+ PictureObject *selector;
};
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index 0e9daadd45..0599125269 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -73,6 +73,27 @@ Common::Point *StepArray::getCurrPoint(Common::Point *point) {
return point;
}
+Common::Point *StepArray::getPoint(Common::Point *point, int index, int offset) {
+ if (index == -1)
+ index = _currPointIndex;
+
+ if (index + offset > _maxPointIndex - 1)
+ offset = _maxPointIndex - index;
+
+ point->x = 0;
+ point->y = 0;
+
+ while (offset >= 1) {
+ point->x += _points[index]->x;
+ point->y += _points[index]->y;
+
+ index++;
+ offset--;
+ }
+
+ return point;
+}
+
bool StepArray::gotoNextPoint() {
if (_currPointIndex < _maxPointIndex) {
_currPointIndex++;
@@ -628,6 +649,19 @@ Common::Point *StaticANIObject::getCurrDimensions(Common::Point &p) {
return &p;
}
+Common::Point *StaticANIObject::getSomeXY(Common::Point &p) {
+ if (_movement) {
+ _movement->getCurrDynamicPhaseXY(p);
+
+ return &p;
+ }
+
+ if (_statics)
+ _statics->getSomeXY(p);
+
+ return &p;
+}
+
void StaticANIObject::update(int counterdiff) {
int mqid;
@@ -744,6 +778,26 @@ void StaticANIObject::update(int counterdiff) {
}
}
+void StaticANIObject::updateStepPos() {
+ Common::Point point;
+
+ int ox = _movement->_ox;
+ int oy = _movement->_oy;
+
+ _movement->calcSomeXY(point, 1);
+ int x = point.x;
+ int y = point.y;
+
+ _stepArray.getPoint(&point, -1, _stepArray.getPointsCount());
+ x += point.x;
+ y += point.y;
+
+ _statics = _movement->_staticsObj2;
+ _movement = 0;
+
+ setOXY(ox + x, oy + y);
+}
+
void StaticANIObject::stopAnim_maybe() {
debug(6, "StaticANIObject::stopAnim_maybe()");
diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h
index 2879edd8e1..49ebc8edf7 100644
--- a/engines/fullpipe/statics.h
+++ b/engines/fullpipe/statics.h
@@ -42,7 +42,10 @@ class StepArray : public CObject {
void clear();
int getCurrPointIndex() { return _currPointIndex; }
+ int getPointsCount() { return _maxPointIndex; }
+
Common::Point *getCurrPoint(Common::Point *point);
+ Common::Point *getPoint(Common::Point *point, int index, int offset);
bool gotoNextPoint();
};
@@ -201,6 +204,8 @@ class StaticANIObject : public GameObject {
Movement *getMovementByName(char *name);
Common::Point *getCurrDimensions(Common::Point &p);
+ Common::Point *getSomeXY(Common::Point &p);
+
void clearFlags();
void setFlags40(bool state);
bool isIdle();
@@ -234,6 +239,7 @@ class StaticANIObject : public GameObject {
MovTable *countMovements();
void setSpeed(int speed);
+ void updateStepPos();
void stopAnim_maybe();
MessageQueue *changeStatics1(int msgNum);
diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp
index 96131f2968..9e317804ca 100644
--- a/engines/hopkins/hopkins.cpp
+++ b/engines/hopkins/hopkins.cpp
@@ -166,7 +166,7 @@ bool HopkinsEngine::runWin95Demo() {
_globals->_characterType = CHARACTER_HOPKINS;
_objectsMan->_mapCarPosX = _objectsMan->_mapCarPosY = 0;
- memset(_globals->_saveData, 0, 2000);
+ memset(_globals->_saveData, 0, sizeof(Savegame));
_globals->_exitId = 0;
if (getLanguage() != Common::PL_POL)
@@ -465,7 +465,7 @@ bool HopkinsEngine::runLinuxDemo() {
_globals->_characterSpriteBuf = _fileIO->loadFile("PERSO.SPR");
_globals->_characterType = CHARACTER_HOPKINS;
_objectsMan->_mapCarPosX = _objectsMan->_mapCarPosY = 0;
- memset(_globals->_saveData, 0, 2000);
+ memset(_globals->_saveData, 0, sizeof(Savegame));
_globals->_exitId = 0;
if (_startGameSlot != -1)
@@ -826,7 +826,7 @@ bool HopkinsEngine::runFull() {
_globals->_characterSpriteBuf = _fileIO->loadFile("PERSO.SPR");
_globals->_characterType = CHARACTER_HOPKINS;
_objectsMan->_mapCarPosX = _objectsMan->_mapCarPosY = 0;
- memset(_globals->_saveData, 0, 2000);
+ memset(_globals->_saveData, 0, sizeof(Savegame));
_globals->_exitId = 0;
diff --git a/engines/hugo/dialogs.cpp b/engines/hugo/dialogs.cpp
index 5dcee3ae94..23e04dc479 100644
--- a/engines/hugo/dialogs.cpp
+++ b/engines/hugo/dialogs.cpp
@@ -34,8 +34,10 @@
namespace Hugo {
-TopMenu::TopMenu(HugoEngine *vm) : Dialog(0, 0, kMenuWidth, kMenuHeight), _arrayBmp(0), _arraySize(0),
- _vm(vm) {
+TopMenu::TopMenu(HugoEngine *vm) : Dialog(0, 0, kMenuWidth, kMenuHeight), _vm(vm) {
+ _arrayBmp = nullptr;
+ _arraySize = 0;
+
init();
}
@@ -140,12 +142,10 @@ void TopMenu::loadBmpArr(Common::SeekableReadStream &in) {
_arrayBmp[i * 2] = bitmapSrc->convertTo(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, g_system->getOverlayFormat());
- byte *src = (byte *)_arrayBmp[i * 2]->getPixels();
- byte *dst = (byte *)_arrayBmp[i * 2 + 1]->getPixels();
for (int j = 0; j < _arrayBmp[i * 2]->h; j++) {
- src = (byte *)_arrayBmp[i * 2]->getBasePtr(0, j);
- dst = (byte *)_arrayBmp[i * 2 + 1]->getBasePtr(0, j * 2);
+ byte *src = (byte *)_arrayBmp[i * 2]->getBasePtr(0, j);
+ byte *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]->format.bytesPerPixel; m > 0; m--) {
*dst++ = *src++;
diff --git a/engines/hugo/display.cpp b/engines/hugo/display.cpp
index fbe39b3a0c..3dc9c9a1c3 100644
--- a/engines/hugo/display.cpp
+++ b/engines/hugo/display.cpp
@@ -75,13 +75,13 @@ static const byte stdMouseCursor[] = {
Screen::Screen(HugoEngine *vm) : _vm(vm) {
- _mainPalette = 0;
- _curPalette = 0;
+ _mainPalette = nullptr;
+ _curPalette = nullptr;
_dlAddIndex = 0;
_dlRestoreIndex = 0;
for (int i = 0; i < kNumFonts; i++) {
- _arrayFont[i] = 0;
+ _arrayFont[i] = nullptr;
fontLoadedFl[i] = false;
}
for (int i = 0; i < kBlitListSize; i++) {
@@ -100,6 +100,8 @@ Screen::Screen(HugoEngine *vm) : _vm(vm) {
_dlRestoreList[i]._dx = 0;
_dlRestoreList[i]._dy = 0;
}
+ _fnt = 0;
+ _paletteSize = 0;
}
Screen::~Screen() {
diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp
index e58c2e57d6..aa128048af 100644
--- a/engines/hugo/file.cpp
+++ b/engines/hugo/file.cpp
@@ -246,13 +246,13 @@ SoundPtr FileManager::getSound(const int16 sound, uint16 *size) {
// No more to do if SILENCE (called for cleanup purposes)
if (sound == _vm->_soundSilence)
- return 0;
+ return nullptr;
// Open sounds file
Common::File fp; // Handle to SOUND_FILE
if (!fp.open(getSoundFilename())) {
warning("Hugo Error: File not found %s", getSoundFilename());
- return 0;
+ return nullptr;
}
if (!_hasReadHeader) {
@@ -519,6 +519,7 @@ void FileManager::readBootFile() {
ofp.read(_vm->_boot._pbswitch, sizeof(_vm->_boot._pbswitch));
ofp.read(_vm->_boot._distrib, sizeof(_vm->_boot._distrib));
_vm->_boot._exitLen = ofp.readUint16LE();
+ ofp.close();
byte *p = (byte *)&_vm->_boot;
@@ -527,7 +528,6 @@ void FileManager::readBootFile() {
checksum ^= p[i];
p[i] ^= s_bootCypher[i % s_bootCypherLen];
}
- ofp.close();
if (checksum) {
Utils::notifyBox(Common::String::format("Corrupted startup file '%s'", getBootFilename()));
diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp
index b140cfdba2..88e2e4372b 100644
--- a/engines/hugo/hugo.cpp
+++ b/engines/hugo/hugo.cpp
@@ -46,11 +46,11 @@
namespace Hugo {
-HugoEngine *HugoEngine::s_Engine = 0;
+HugoEngine *HugoEngine::s_Engine = nullptr;
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), _numStates(0), _score(0), _maxscore(0), _lastTime(0), _curTime(0), _episode(0)
+ _hero(nullptr), _heroImage(0), _defltTunes(nullptr), _numScreens(0), _tunesNbr(0), _soundSilence(0), _soundTest(0),
+ _screenStates(nullptr), _numStates(0), _score(0), _maxscore(0), _lastTime(0), _curTime(0), _episode(nullptr)
{
_system = syst;
DebugMan.addDebugChannel(kDebugSchedule, "Schedule", "Script Schedule debug level");
@@ -67,16 +67,16 @@ HugoEngine::HugoEngine(OSystem *syst, const HugoGameDescription *gd) : Engine(sy
_console = new HugoConsole(this);
_rnd = 0;
- _screen = NULL;
- _mouse = NULL;
- _inventory = NULL;
- _parser = NULL;
- _route = NULL;
- _sound = NULL;
- _intro = NULL;
- _object = NULL;
- _text = NULL;
- _topMenu = NULL;
+ _screen = nullptr;
+ _mouse = nullptr;
+ _inventory = nullptr;
+ _parser = nullptr;
+ _route = nullptr;
+ _sound = nullptr;
+ _intro = nullptr;
+ _object = nullptr;
+ _text = nullptr;
+ _topMenu = nullptr;
_status._storyModeFl = false;
_status._gameOverFl = false;
_status._lookFl = false;
@@ -93,6 +93,26 @@ HugoEngine::HugoEngine(OSystem *syst, const HugoGameDescription *gd) : Engine(sy
_gameType = kGameTypeNone;
_platform = Common::kPlatformUnknown;
_packedFl = false;
+
+ _numVariant = 0;
+ _gameVariant = kGameVariantNone;
+ _normalTPS = 0;
+ _screenPtr = nullptr;
+ _config._musicFl = true;
+ _config._soundFl = true;
+ _config._turboFl = false;
+ _look = 0;
+ _take = 0;
+ _drop = 0;
+ _maze._enabledFl = false;
+ _maze._size = 0;
+ _maze._x1 = _maze._y1 = _maze._x2 = _maze._y2 = _maze._x3 = _maze._x4 = 0;
+ _maze._firstScreenIndex = 0;
+ _boot._checksum = 0;
+ _boot._registered = kRegShareware;
+ _boot._exitLen = 0;
+ _file = nullptr;
+ _scheduler = nullptr;
}
HugoEngine::~HugoEngine() {
diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h
index 9f495a9037..6adb5f95d0 100644
--- a/engines/hugo/hugo.h
+++ b/engines/hugo/hugo.h
@@ -106,7 +106,8 @@ enum GameVariant {
kGameVariantH3Win,
kGameVariantH1Dos,
kGameVariantH2Dos,
- kGameVariantH3Dos
+ kGameVariantH3Dos,
+ kGameVariantNone
};
enum HugoDebugChannels {
@@ -259,7 +260,7 @@ public:
// Used by the qsort function
static HugoEngine &get() {
- assert(s_Engine != 0);
+ assert(s_Engine != nullptr);
return *s_Engine;
}
diff --git a/engines/hugo/intro.cpp b/engines/hugo/intro.cpp
index 6f314c8774..5db6c39078 100644
--- a/engines/hugo/intro.cpp
+++ b/engines/hugo/intro.cpp
@@ -39,9 +39,10 @@
namespace Hugo {
-IntroHandler::IntroHandler(HugoEngine *vm) : _vm(vm), _introX(0), _introY(0) {
+IntroHandler::IntroHandler(HugoEngine *vm) : _vm(vm) {
_introXSize = 0;
_introTicks = 0;
+ _introX = _introY = nullptr;
}
IntroHandler::~IntroHandler() {
@@ -74,6 +75,7 @@ void IntroHandler::loadIntroData(Common::SeekableReadStream &in) {
void IntroHandler::freeIntroData() {
free(_introX);
free(_introY);
+ _introX = _introY = nullptr;
}
intro_v1d::intro_v1d(HugoEngine *vm) : IntroHandler(vm) {
diff --git a/engines/hugo/inventory.cpp b/engines/hugo/inventory.cpp
index c2495beadb..03df997866 100644
--- a/engines/hugo/inventory.cpp
+++ b/engines/hugo/inventory.cpp
@@ -44,7 +44,8 @@ namespace Hugo {
static const int kMaxDisp = (kXPix / kInvDx); // Max icons displayable
-InventoryHandler::InventoryHandler(HugoEngine *vm) : _vm(vm), _invent(0) {
+InventoryHandler::InventoryHandler(HugoEngine *vm) : _vm(vm) {
+ _invent = nullptr;
_firstIconId = 0;
_inventoryState = kInventoryOff; // Inventory icon bar state
_inventoryHeight = 0; // Inventory icon bar pos
@@ -62,6 +63,7 @@ void InventoryHandler::setInventoryState(Istate state) {
void InventoryHandler::freeInvent() {
free(_invent);
+ _invent = nullptr;
}
int16 InventoryHandler::getInventoryObjId() const {
diff --git a/engines/hugo/mouse.cpp b/engines/hugo/mouse.cpp
index ae286c8afb..4ef3db3e2b 100644
--- a/engines/hugo/mouse.cpp
+++ b/engines/hugo/mouse.cpp
@@ -45,7 +45,8 @@
namespace Hugo {
-MouseHandler::MouseHandler(HugoEngine *vm) : _vm(vm), _hotspots(0) {
+MouseHandler::MouseHandler(HugoEngine *vm) : _vm(vm) {
+ _hotspots = nullptr;
_leftButtonFl = false;
_rightButtonFl = false;
_jumpExitFl = false; // Can't jump to a screen exit
@@ -83,6 +84,7 @@ void MouseHandler::setMouseY(int y) {
void MouseHandler::freeHotspots() {
free(_hotspots);
+ _hotspots = nullptr;
}
bool MouseHandler::getJumpExitFl() const {
@@ -169,7 +171,7 @@ void MouseHandler::processRightClick(const int16 objId, const int16 cx, const in
_vm->_object->useObject(objId); // Use status.objid on object
} else { // Clicked over viewport object
Object *obj = &_vm->_object->_objects[objId];
- int16 x = 0, y = 0;
+ int16 x, y;
switch (obj->_viewx) { // Where to walk to
case -1: // Walk to object position
if (_vm->_object->findObjectSpace(obj, &x, &y))
diff --git a/engines/hugo/object.cpp b/engines/hugo/object.cpp
index 7b4783e4d8..44f46d2d79 100644
--- a/engines/hugo/object.cpp
+++ b/engines/hugo/object.cpp
@@ -44,7 +44,9 @@
namespace Hugo {
-ObjectHandler::ObjectHandler(HugoEngine *vm) : _vm(vm), _objects(0), _uses(0) {
+ObjectHandler::ObjectHandler(HugoEngine *vm) : _vm(vm) {
+ _uses = nullptr;
+ _objects = nullptr;
_numObj = 0;
_objCount = 0;
_usesSize = 0;
@@ -249,47 +251,49 @@ void ObjectHandler::lookObject(Object *obj) {
void ObjectHandler::freeObjects() {
debugC(1, kDebugObject, "freeObjects");
- if (_vm->_hero != 0 && _vm->_hero->_seqList[0]._seqPtr != 0) {
+ if (_vm->_hero != nullptr && _vm->_hero->_seqList[0]._seqPtr != nullptr) {
// Free all sequence lists and image data
for (int16 i = 0; i < _numObj; i++) {
Object *obj = &_objects[i];
for (int16 j = 0; j < obj->_seqNumb; j++) {
Seq *seq = obj->_seqList[j]._seqPtr;
Seq *next;
- if (seq == 0) // Failure during database load
+ if (seq == nullptr) // Failure during database load
break;
- if (seq->_imagePtr != 0) {
+ if (seq->_imagePtr != nullptr) {
free(seq->_imagePtr);
- seq->_imagePtr = 0;
+ seq->_imagePtr = nullptr;
}
seq = seq->_nextSeqPtr;
while (seq != obj->_seqList[j]._seqPtr) {
- if (seq->_imagePtr != 0) {
+ if (seq->_imagePtr != nullptr) {
free(seq->_imagePtr);
- seq->_imagePtr = 0;
+ seq->_imagePtr = nullptr;
}
next = seq->_nextSeqPtr;
free(seq);
seq = next;
}
free(seq);
+ seq = nullptr;
}
}
}
- if (_uses) {
+ if (_uses != nullptr) {
for (int16 i = 0; i < _usesSize; i++)
free(_uses[i]._targets);
free(_uses);
+ _uses = nullptr;
}
for (int16 i = 0; i < _objCount; i++) {
free(_objects[i]._stateDataIndex);
- _objects[i]._stateDataIndex = 0;
+ _objects[i]._stateDataIndex = nullptr;
}
free(_objects);
- _objects = 0;
+ _objects = nullptr;
}
/**
@@ -358,7 +362,7 @@ void ObjectHandler::showTakeables() {
* Find a clear space around supplied object that hero can walk to
*/
bool ObjectHandler::findObjectSpace(Object *obj, int16 *destx, int16 *desty) {
- debugC(1, kDebugObject, "findObjectSpace(obj, %d, %d)", *destx, *desty);
+ debugC(1, kDebugObject, "findObjectSpace(...)");
Seq *curImage = obj->_currImagePtr;
int16 y = obj->_y + curImage->_y2 - 1;
@@ -414,7 +418,7 @@ void ObjectHandler::readUse(Common::ReadStream &in, Uses &curUse) {
*/
void ObjectHandler::loadObjectUses(Common::ReadStream &in) {
Uses tmpUse;
- tmpUse._targets = 0;
+ tmpUse._targets = nullptr;
//Read _uses
for (int varnt = 0; varnt < _vm->_numVariant; varnt++) {
@@ -430,7 +434,7 @@ void ObjectHandler::loadObjectUses(Common::ReadStream &in) {
else {
readUse(in, tmpUse);
free(tmpUse._targets);
- tmpUse._targets = 0;
+ tmpUse._targets = nullptr;
}
}
}
@@ -442,7 +446,7 @@ void ObjectHandler::readObject(Common::ReadStream &in, Object &curObject) {
uint16 numSubElem = in.readUint16BE();
if (numSubElem == 0)
- curObject._stateDataIndex = 0;
+ curObject._stateDataIndex = nullptr;
else
curObject._stateDataIndex = (uint16 *)malloc(sizeof(uint16) * numSubElem);
for (int j = 0; j < numSubElem; j++)
@@ -453,16 +457,16 @@ void ObjectHandler::readObject(Common::ReadStream &in, Object &curObject) {
curObject._vyPath = in.readSint16BE();
curObject._actIndex = in.readUint16BE();
curObject._seqNumb = in.readByte();
- curObject._currImagePtr = 0;
+ curObject._currImagePtr = nullptr;
if (curObject._seqNumb == 0) {
curObject._seqList[0]._imageNbr = 0;
- curObject._seqList[0]._seqPtr = 0;
+ curObject._seqList[0]._seqPtr = nullptr;
}
for (int j = 0; j < curObject._seqNumb; j++) {
curObject._seqList[j]._imageNbr = in.readUint16BE();
- curObject._seqList[j]._seqPtr = 0;
+ curObject._seqList[j]._seqPtr = nullptr;
}
curObject._cycling = (Cycle)in.readByte();
@@ -498,7 +502,7 @@ void ObjectHandler::readObject(Common::ReadStream &in, Object &curObject) {
void ObjectHandler::loadObjectArr(Common::ReadStream &in) {
debugC(6, kDebugObject, "loadObject(&in)");
Object tmpObject;
- tmpObject._stateDataIndex = 0;
+ tmpObject._stateDataIndex = nullptr;
for (int varnt = 0; varnt < _vm->_numVariant; varnt++) {
uint16 numElem = in.readUint16BE();
@@ -515,7 +519,7 @@ void ObjectHandler::loadObjectArr(Common::ReadStream &in) {
// Skip over uneeded objects.
readObject(in, tmpObject);
free(tmpObject._stateDataIndex);
- tmpObject._stateDataIndex = 0;
+ tmpObject._stateDataIndex = nullptr;
}
}
}
diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp
index 2585c64fd8..57938ec371 100644
--- a/engines/hugo/parser.cpp
+++ b/engines/hugo/parser.cpp
@@ -44,14 +44,20 @@
namespace Hugo {
-Parser::Parser(HugoEngine *vm) : _vm(vm), _putIndex(0), _getIndex(0), _arrayReqs(0), _catchallList(0), _backgroundObjects(0), _cmdList(0) {
+Parser::Parser(HugoEngine *vm) : _vm(vm), _putIndex(0), _getIndex(0) {
+ _catchallList = nullptr;
+ _arrayReqs = nullptr;
+
+ _backgroundObjects = nullptr;
+ _backgroundObjectsSize = 0;
+ _cmdList = nullptr;
+ _cmdListSize = 0;
+
_cmdLineIndex = 0;
_cmdLineTick = 0;
_cmdLineCursor = '_';
_cmdLine[0] = '\0';
- _cmdListSize = 0;
_checkDoubleF1Fl = false;
- _backgroundObjectsSize = 0;
}
Parser::~Parser() {
@@ -172,7 +178,7 @@ const char *Parser::useBG(const char *name) {
return _vm->_text->getVerb(p[i]._verbIndex, 0);
}
- return 0;
+ return nullptr;
}
void Parser::freeParser() {
@@ -180,20 +186,24 @@ void Parser::freeParser() {
for (int i = 0; _arrayReqs[i] != 0; i++)
free(_arrayReqs[i]);
free(_arrayReqs);
+ _arrayReqs = nullptr;
}
free(_catchallList);
+ _catchallList = nullptr;
if (_backgroundObjects) {
for (int i = 0; i < _backgroundObjectsSize; i++)
free(_backgroundObjects[i]);
free(_backgroundObjects);
+ _backgroundObjects = nullptr;
}
if (_cmdList) {
for (int i = 0; i < _cmdListSize; i++)
free(_cmdList[i]);
free(_cmdList);
+ _cmdList = nullptr;
}
}
@@ -398,9 +408,9 @@ void Parser::command(const char *format, ...) {
* Locate any member of object name list appearing in command line
*/
bool Parser::isWordPresent(char **wordArr) const {
- debugC(1, kDebugParser, "isWordPresent(%s)", wordArr[0]);
-
if (wordArr != 0) {
+ debugC(1, kDebugParser, "isWordPresent(%s)", wordArr[0]);
+
for (int i = 0; strlen(wordArr[i]); i++) {
if (strstr(_vm->_line, wordArr[i]))
return true;
@@ -421,7 +431,7 @@ const char *Parser::findNoun() const {
return _vm->_text->getNoun(i, 0);
}
}
- return 0;
+ return nullptr;
}
/**
@@ -436,7 +446,7 @@ const char *Parser::findVerb() const {
return _vm->_text->getVerb(i, 0);
}
}
- return 0;
+ return nullptr;
}
/**
diff --git a/engines/hugo/route.cpp b/engines/hugo/route.cpp
index 54dae88c28..dc3c41de9c 100644
--- a/engines/hugo/route.cpp
+++ b/engines/hugo/route.cpp
@@ -45,6 +45,17 @@ Route::Route(HugoEngine *vm) : _vm(vm) {
_routeIndex = -1; // Hero not following a route
_routeType = kRouteSpace; // Hero walking to space
_routeObjId = -1; // Hero not walking to anything
+
+ for (int i = 0; i < kMaxSeg; i++)
+ _segment[i]._y = _segment[i]._x1 = _segment[i]._x2 = 0;
+
+ _segmentNumb = 0;
+ _routeListIndex = 0;
+ _destX = _destY = 0;
+ _heroWidth = 0;
+ _routeFoundFl = false;
+ _fullStackFl = false;
+ _fullSegmentFl = false;
}
void Route::resetRoute() {
@@ -303,7 +314,7 @@ Common::Point *Route::newNode() {
_routeListIndex++;
if (_routeListIndex >= kMaxNodes) // Too many nodes
- return 0; // Incomplete route - failure
+ return nullptr; // Incomplete route - failure
_route[_routeListIndex] = _route[_routeListIndex - 1]; // Initialize with previous node
return &_route[_routeListIndex];
diff --git a/engines/hugo/route.h b/engines/hugo/route.h
index 716829a201..71db1e2583 100644
--- a/engines/hugo/route.h
+++ b/engines/hugo/route.h
@@ -79,9 +79,11 @@ private:
int16 _destY;
int16 _heroWidth; // Hero width
bool _routeFoundFl; // TRUE when path found
- bool _fullStackFl; // TRUE if stack exhausted
bool _fullSegmentFl; // Segments exhausted
+ // CHECKME: Never set to true, could be removed
+ bool _fullStackFl; // TRUE if stack exhausted
+
void segment(int16 x, int16 y);
bool findRoute(const int16 cx, const int16 cy);
Common::Point *newNode();
diff --git a/engines/hugo/schedule.cpp b/engines/hugo/schedule.cpp
index 32b8a47df7..17ffa9d391 100644
--- a/engines/hugo/schedule.cpp
+++ b/engines/hugo/schedule.cpp
@@ -47,10 +47,23 @@
namespace Hugo {
-Scheduler::Scheduler(HugoEngine *vm) : _vm(vm), _actListArr(0), _curTick(0), _oldTime(0), _refreshTimeout(0), _points(0), _screenActs(0) {
+Scheduler::Scheduler(HugoEngine *vm) : _vm(vm) {
+ _actListArr = nullptr;
+ _curTick = 0;
+ _oldTime = 0;
+ _refreshTimeout = 0;
+ _points = nullptr;
+ _screenActs = nullptr;
+
memset(_events, 0, sizeof(_events));
_numBonuses = 0;
_screenActsSize = 0;
+
+ _actListArrSize = 0;
+ _alNewscrIndex = 0;
+ _freeEvent = nullptr;
+ _headEvent = nullptr;
+ _tailEvent = nullptr;
}
Scheduler::~Scheduler() {
@@ -69,14 +82,14 @@ void Scheduler::initEventQueue() {
// Chain nextEvent from first to last
for (int i = kMaxEvents; --i;)
_events[i - 1]._nextEvent = &_events[i];
- _events[kMaxEvents - 1]._nextEvent = 0;
+ _events[kMaxEvents - 1]._nextEvent = nullptr;
// Chain prevEvent from last to first
for (int i = 1; i < kMaxEvents; i++)
_events[i]._prevEvent = &_events[i - 1];
- _events[0]._prevEvent = 0;
+ _events[0]._prevEvent = nullptr;
- _headEvent = _tailEvent = 0; // Event list is empty
+ _headEvent = _tailEvent = nullptr; // Event list is empty
_freeEvent = _events; // Free list is full
}
@@ -90,7 +103,7 @@ Event *Scheduler::getQueue() {
error("An error has occurred: %s", "getQueue");
Event *resEvent = _freeEvent;
_freeEvent = _freeEvent->_nextEvent;
- resEvent->_nextEvent = 0;
+ resEvent->_nextEvent = nullptr;
return resEvent;
}
@@ -597,7 +610,7 @@ void Scheduler::loadScreenAct(Common::SeekableReadStream &in) {
for (int i = 0; i < numElem; i++) {
uint16 numSubElem = in.readUint16BE();
if (numSubElem == 0) {
- _screenActs[i] = 0;
+ _screenActs[i] = nullptr;
} else {
_screenActs[i] = (uint16 *)malloc(sizeof(uint16) * numSubElem);
for (int j = 0; j < numSubElem; j++)
@@ -617,11 +630,14 @@ void Scheduler::freeScheduler() {
debugC(6, kDebugSchedule, "freeActListArr()");
free(_points);
+ _points = nullptr;
if (_screenActs) {
for (int i = 0; i < _screenActsSize; i++)
free(_screenActs[i]);
free(_screenActs);
+ _screenActs = nullptr;
+ _screenActsSize = 0;
}
if (_actListArr) {
@@ -633,6 +649,8 @@ void Scheduler::freeScheduler() {
free(_actListArr[i]);
}
free(_actListArr);
+ _actListArr = nullptr;
+ _actListArrSize = 0;
}
}
@@ -698,9 +716,9 @@ void Scheduler::saveEvents(Common::WriteStream *f) {
f->writeUint32BE(getTicks());
- int16 freeIndex = (_freeEvent == 0) ? -1 : _freeEvent - _events;
- int16 headIndex = (_headEvent == 0) ? -1 : _headEvent - _events;
- int16 tailIndex = (_tailEvent == 0) ? -1 : _tailEvent - _events;
+ int16 freeIndex = (_freeEvent == nullptr) ? -1 : _freeEvent - _events;
+ int16 headIndex = (_headEvent == nullptr) ? -1 : _headEvent - _events;
+ int16 tailIndex = (_tailEvent == nullptr) ? -1 : _tailEvent - _events;
f->writeSint16BE(freeIndex);
f->writeSint16BE(headIndex);
@@ -717,8 +735,8 @@ void Scheduler::saveEvents(Common::WriteStream *f) {
f->writeSint16BE(subElem);
f->writeByte((wrkEvent->_localActionFl) ? 1 : 0);
f->writeUint32BE(wrkEvent->_time);
- f->writeSint16BE((wrkEvent->_prevEvent == 0) ? -1 : (wrkEvent->_prevEvent - _events));
- f->writeSint16BE((wrkEvent->_nextEvent == 0) ? -1 : (wrkEvent->_nextEvent - _events));
+ f->writeSint16BE((wrkEvent->_prevEvent == nullptr) ? -1 : (wrkEvent->_prevEvent - _events));
+ f->writeSint16BE((wrkEvent->_nextEvent == nullptr) ? -1 : (wrkEvent->_nextEvent - _events));
}
}
@@ -1102,7 +1120,7 @@ void Scheduler::restoreEvents(Common::ReadStream *f) {
// fix up action pointer (to do better)
if ((index == -1) && (subElem == -1))
- _events[i]._action = 0;
+ _events[i]._action = nullptr;
else
_events[i]._action = (Act *)&_actListArr[index][subElem];
@@ -1112,12 +1130,12 @@ void Scheduler::restoreEvents(Common::ReadStream *f) {
int16 prevIndex = f->readSint16BE();
int16 nextIndex = f->readSint16BE();
- _events[i]._prevEvent = (prevIndex == -1) ? (Event *)0 : &_events[prevIndex];
- _events[i]._nextEvent = (nextIndex == -1) ? (Event *)0 : &_events[nextIndex];
+ _events[i]._prevEvent = (prevIndex == -1) ? nullptr : &_events[prevIndex];
+ _events[i]._nextEvent = (nextIndex == -1) ? nullptr : &_events[nextIndex];
}
- _freeEvent = (freeIndex == -1) ? 0 : &_events[freeIndex];
- _headEvent = (headIndex == -1) ? 0 : &_events[headIndex];
- _tailEvent = (tailIndex == -1) ? 0 : &_events[tailIndex];
+ _freeEvent = (freeIndex == -1) ? nullptr : &_events[freeIndex];
+ _headEvent = (headIndex == -1) ? nullptr : &_events[headIndex];
+ _tailEvent = (tailIndex == -1) ? nullptr : &_events[tailIndex];
// Adjust times to fit our time
uint32 curTime = getTicks();
@@ -1156,7 +1174,7 @@ void Scheduler::insertAction(Act *action) {
// Now find the place to insert the event
if (!_tailEvent) { // Empty queue
_tailEvent = _headEvent = curEvent;
- curEvent->_nextEvent = curEvent->_prevEvent = 0;
+ curEvent->_nextEvent = curEvent->_prevEvent = nullptr;
} else {
Event *wrkEvent = _tailEvent; // Search from latest time back
bool found = false;
@@ -1178,7 +1196,7 @@ void Scheduler::insertAction(Act *action) {
if (!found) { // Must be earliest in list
_headEvent->_prevEvent = curEvent; // So insert as new head
curEvent->_nextEvent = _headEvent;
- curEvent->_prevEvent = 0;
+ curEvent->_prevEvent = nullptr;
_headEvent = curEvent;
}
}
@@ -1424,7 +1442,7 @@ Event *Scheduler::doAction(Event *curEvent) {
}
if (action->_a0._actType == NEW_SCREEN) { // New_screen() deletes entire list
- return 0; // nextEvent = 0 since list now empty
+ return nullptr; // nextEvent = nullptr since list now empty
} else {
wrkEvent = curEvent->_nextEvent;
delQueue(curEvent); // Return event to free list
@@ -1455,9 +1473,9 @@ void Scheduler::delQueue(Event *curEvent) {
}
if (_headEvent)
- _headEvent->_prevEvent = 0; // Mark end of list
+ _headEvent->_prevEvent = nullptr; // Mark end of list
else
- _tailEvent = 0; // Empty queue
+ _tailEvent = nullptr; // Empty queue
curEvent->_nextEvent = _freeEvent; // Return p to free list
if (_freeEvent) // Special case, if free list was empty
diff --git a/engines/hugo/sound.cpp b/engines/hugo/sound.cpp
index aefa03cd5e..28dcdc83d6 100644
--- a/engines/hugo/sound.cpp
+++ b/engines/hugo/sound.cpp
@@ -123,11 +123,12 @@ SoundHandler::SoundHandler(HugoEngine *vm) : _vm(vm) {
_speakerStream = new Audio::PCSpeaker(_vm->_mixer->getOutputRate());
_vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle,
_speakerStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
- _DOSSongPtr = 0;
+ _DOSSongPtr = nullptr;
_curPriority = 0;
_pcspkrTimer = 0;
_pcspkrOctave = 3;
_pcspkrNoteDuration = 2;
+ _DOSIntroSong = nullptr;
}
SoundHandler::~SoundHandler() {
@@ -210,7 +211,7 @@ void SoundHandler::playSound(int16 sound, const byte priority) {
_curPriority = priority;
// Get sound data
- if ((soundPtr = _vm->_file->getSound(sound, &size)) == 0)
+ if ((soundPtr = _vm->_file->getSound(sound, &size)) == nullptr)
return;
Audio::AudioStream *stream = Audio::makeRawStream(soundPtr, size, 11025, Audio::FLAG_UNSIGNED);
diff --git a/engines/hugo/text.cpp b/engines/hugo/text.cpp
index f8b02bdf68..538a0341e2 100644
--- a/engines/hugo/text.cpp
+++ b/engines/hugo/text.cpp
@@ -26,9 +26,17 @@
namespace Hugo {
-TextHandler::TextHandler(HugoEngine *vm) : _vm(vm), _textData(0), _stringtData(0),
- _textEngine(0), _textIntro(0), _textMouse(0), _textParser(0), _textUtil(0),
- _screenNames(0), _arrayNouns(0), _arrayVerbs(0) {
+TextHandler::TextHandler(HugoEngine *vm) : _vm(vm) {
+ _textData = nullptr;
+ _stringtData = nullptr;
+ _textEngine = nullptr;
+ _textIntro = nullptr;
+ _textMouse = nullptr;
+ _textParser = nullptr;
+ _textUtil = nullptr;
+ _screenNames = nullptr;
+ _arrayNouns = nullptr;
+ _arrayVerbs = nullptr;
}
TextHandler::~TextHandler() {
@@ -86,9 +94,9 @@ char **TextHandler::loadTextsVariante(Common::ReadStream &in, uint16 *arraySize)
int numTexts;
int entryLen;
int len;
- char **res = 0;
- char *pos = 0;
- char *posBck = 0;
+ char **res = nullptr;
+ char *pos = nullptr;
+ char *posBck = nullptr;
for (int varnt = 0; varnt < _vm->_numVariant; varnt++) {
numTexts = in.readUint16BE();
@@ -126,21 +134,21 @@ char **TextHandler::loadTextsVariante(Common::ReadStream &in, uint16 *arraySize)
}
char ***TextHandler::loadTextsArray(Common::ReadStream &in) {
- char ***resArray = 0;
+ char ***resArray = nullptr;
uint16 arraySize;
for (int varnt = 0; varnt < _vm->_numVariant; varnt++) {
arraySize = in.readUint16BE();
if (varnt == _vm->_gameVariant) {
resArray = (char ***)malloc(sizeof(char **) * (arraySize + 1));
- resArray[arraySize] = 0;
+ resArray[arraySize] = nullptr;
}
for (int i = 0; i < arraySize; i++) {
int numTexts = in.readUint16BE();
int entryLen = in.readUint16BE();
char *pos = (char *)malloc(entryLen);
- char *posBck = 0;
- char **res = 0;
+ char *posBck = nullptr;
+ char **res = nullptr;
if (varnt == _vm->_gameVariant) {
res = (char **)malloc(sizeof(char *) * numTexts);
res[0] = pos;
@@ -232,6 +240,7 @@ void TextHandler::freeTexts(char **ptr) {
free(*ptr - DATAALIGNMENT);
free(ptr);
+ ptr = nullptr;
}
void TextHandler::freeAllTexts() {
@@ -242,12 +251,14 @@ void TextHandler::freeAllTexts() {
for (int i = 0; _arrayNouns[i]; i++)
freeTexts(_arrayNouns[i]);
free(_arrayNouns);
+ _arrayNouns = nullptr;
}
if (_arrayVerbs) {
for (int i = 0; _arrayVerbs[i]; i++)
freeTexts(_arrayVerbs[i]);
free(_arrayVerbs);
+ _arrayVerbs = nullptr;
}
freeTexts(_screenNames);
diff --git a/engines/made/made.cpp b/engines/made/made.cpp
index 3843040961..3e192cb04c 100644
--- a/engines/made/made.cpp
+++ b/engines/made/made.cpp
@@ -85,7 +85,7 @@ MadeEngine::MadeEngine(OSystem *syst, const MadeGameDescription *gameDesc) : Eng
_script = new ScriptInterpreter(this);
- _music = new MusicPlayer();
+ _music = nullptr;
// Set default sound frequency
switch (getGameID()) {
@@ -102,8 +102,6 @@ MadeEngine::MadeEngine(OSystem *syst, const MadeGameDescription *gameDesc) : Eng
// Return to Zork sets it itself via a script funtion
break;
}
-
- syncSoundSettings();
}
MadeEngine::~MadeEngine() {
@@ -277,6 +275,8 @@ void MadeEngine::handleEvents() {
}
Common::Error MadeEngine::run() {
+ _music = new MusicPlayer();
+ syncSoundSettings();
// Initialize backend
initGraphics(320, 200, false);
diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp
index 7809143176..0b13df239c 100644
--- a/engines/mortevielle/utils.cpp
+++ b/engines/mortevielle/utils.cpp
@@ -2364,8 +2364,7 @@ Common::String MortevielleEngine::copy(const Common::String &s, int idx, size_t
// Copy the substring into a temporary buffer
char *tmp = new char[size + 1];
- strncpy(tmp, s.c_str() + idx - 1, size);
- tmp[size] = '\0';
+ Common::strlcpy(tmp, s.c_str() + idx - 1, size + 1);
Common::String result(tmp);
delete[] tmp;
diff --git a/engines/neverhood/detection.cpp b/engines/neverhood/detection.cpp
index 96c87ab3ae..efd0699d58 100644
--- a/engines/neverhood/detection.cpp
+++ b/engines/neverhood/detection.cpp
@@ -152,13 +152,20 @@ static const NeverhoodGameDescription gameDescriptions[] = {
} // End of namespace Neverhood
-static const ExtraGuiOption neverhoodExtraGuiOption = {
+static const ExtraGuiOption neverhoodExtraGuiOption1 = {
_s("Use original save/load screens"),
_s("Use the original save/load screens, instead of the ScummVM ones"),
"originalsaveload",
false
};
+static const ExtraGuiOption neverhoodExtraGuiOption2 = {
+ _s("Skip the Hall of Records storyboard scenes"),
+ _s("Allows the player to skip past the Hall of Records storyboard scenes"),
+ "skiphallofrecordsscenes",
+ false
+};
+
class NeverhoodMetaEngine : public AdvancedMetaEngine {
public:
NeverhoodMetaEngine() : AdvancedMetaEngine(Neverhood::gameDescriptions, sizeof(Neverhood::NeverhoodGameDescription), neverhoodGames) {
@@ -212,7 +219,8 @@ bool NeverhoodMetaEngine::createInstance(OSystem *syst, Engine **engine, const A
const ExtraGuiOptions NeverhoodMetaEngine::getExtraGuiOptions(const Common::String &target) const {
ExtraGuiOptions options;
- options.push_back(neverhoodExtraGuiOption);
+ options.push_back(neverhoodExtraGuiOption1);
+ options.push_back(neverhoodExtraGuiOption2);
return options;
}
diff --git a/engines/neverhood/klaymen.cpp b/engines/neverhood/klaymen.cpp
index 666b20a08a..e1a0d72d50 100644
--- a/engines/neverhood/klaymen.cpp
+++ b/engines/neverhood/klaymen.cpp
@@ -300,7 +300,7 @@ void Klaymen::stSitIdleTeleporterBlink() {
void Klaymen::stSitIdleTeleporterBlinkSecond() {
_busyStatus = 0;
_acceptInput = true;
- startAnimation(0x5C24C018, 0, -1);
+ startAnimation(0x582EC138, 0, -1);
SetUpdateHandler(&Klaymen::upSitIdleTeleporter);
SetMessageHandler(&Klaymen::hmLowLevel);
SetSpriteUpdate(NULL);
@@ -2438,47 +2438,6 @@ uint32 Klaymen::hmStandIdleSpecial(int messageNum, const MessageParam &param, En
return 0;
}
-uint32 Klaymen::hmPressDoorButton(int messageNum, const MessageParam &param, Entity *sender) {
- uint32 messageResult = hmLowLevelAnimation(messageNum, param, sender);
- switch (messageNum) {
- case 0x100D:
- if (param.asInteger() == 0x942D2081) {
- _acceptInput = false;
- sendMessage(_attachedSprite, 0x2003, 0);
- } else if (param.asInteger() == 0xDA600012) {
- stHitByBoxingGlove();
- } else if (param.asInteger() == 0x0D01B294) {
- _acceptInput = false;
- sendMessage(_attachedSprite, 0x480B, 0);
- }
- break;
- }
- return messageResult;
-}
-
-uint32 Klaymen::hmHitByBoxingGlove(int messageNum, const MessageParam &param, Entity *sender) {
- int16 speedUpFrameIndex;
- uint32 messageResult = hmLowLevelAnimation(messageNum, param, sender);
- switch (messageNum) {
- case 0x1008:
- speedUpFrameIndex = getFrameIndex(kKlaymenSpeedUpHash);
- if (_currFrameIndex < speedUpFrameIndex) {
- startAnimation(0x35AA8059, speedUpFrameIndex, -1);
- _y = 435;
- }
- messageResult = 0;
- break;
- case 0x100D:
- if (param.asInteger() == 0x1A1A0785) {
- playSound(0, 0x40F0A342);
- } else if (param.asInteger() == 0x60428026) {
- playSound(0, 0x40608A59);
- }
- break;
- }
- return messageResult;
-}
-
void Klaymen::suFallDown() {
AnimatedSprite::updateDeltaXY();
HitRect *hitRect = _parentScene->findHitRectAtPos(_x, _y + 10);
@@ -2546,30 +2505,6 @@ void Klaymen::stFallTouchdown() {
stTryStandIdle();
}
-void Klaymen::stPressDoorButton() {
- _busyStatus = 2;
- _acceptInput = true;
- setDoDeltaX(0);
- startAnimation(0x1CD89029, 0, -1);
- SetUpdateHandler(&Klaymen::update);
- SetMessageHandler(&Klaymen::hmPressDoorButton);
- SetSpriteUpdate(&Klaymen::suAction);
-}
-
-void Klaymen::stHitByBoxingGlove() {
- _busyStatus = 1;
- _acceptInput = false;
- startAnimation(0x35AA8059, 0, -1);
- SetUpdateHandler(&Klaymen::update);
- SetMessageHandler(&Klaymen::hmHitByBoxingGlove);
- SetSpriteUpdate(&AnimatedSprite::updateDeltaXY);
- FinalizeState(&Klaymen::evHitByBoxingGloveDone);
-}
-
-void Klaymen::evHitByBoxingGloveDone() {
- sendMessage(_parentScene, 0x1024, 1);
-}
-
void Klaymen::suFallSkipJump() {
updateDeltaXY();
HitRect *hitRect = _parentScene->findHitRectAtPos(_x, _y + 10);
diff --git a/engines/neverhood/klaymen.h b/engines/neverhood/klaymen.h
index 524bb9a9f2..a614560fc0 100644
--- a/engines/neverhood/klaymen.h
+++ b/engines/neverhood/klaymen.h
@@ -248,10 +248,6 @@ public:
uint32 hmMoveObject(int messageNum, const MessageParam &param, Entity *sender);
void upMoveObject();
- void stHitByBoxingGlove();
- uint32 hmHitByBoxingGlove(int messageNum, const MessageParam &param, Entity *sender);
- void evHitByBoxingGloveDone();
-
void stStandIdleSmall();
void stWonderAboutSmall();
void stWonderAboutHalfSmall();
@@ -271,9 +267,6 @@ public:
void stStandIdleSpecial();
uint32 hmStandIdleSpecial(int messageNum, const MessageParam &param, Entity *sender);
- void stPressDoorButton();
- uint32 hmPressDoorButton(int messageNum, const MessageParam &param, Entity *sender);
-
void stSpitOutFall0();
void stSpitOutFall2();
void suFallDown();
diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp
index 5ad2dd69d7..6b0635598f 100644
--- a/engines/neverhood/menumodule.cpp
+++ b/engines/neverhood/menumodule.cpp
@@ -405,6 +405,7 @@ CreditsScene::CreditsScene(NeverhoodEngine *vm, Module *parentModule, bool canAb
_ticksTime = _vm->_system->getMillis() + 202100;
+ _vm->toggleSoundUpdate(true);
_musicResource = new MusicResource(_vm);
_musicResource->load(0x30812225);
_musicResource->play(0);
@@ -414,6 +415,7 @@ CreditsScene::CreditsScene(NeverhoodEngine *vm, Module *parentModule, bool canAb
CreditsScene::~CreditsScene() {
_musicResource->unload();
delete _musicResource;
+ _vm->toggleSoundUpdate(false);
}
void CreditsScene::update() {
diff --git a/engines/neverhood/modules/module1000_sprites.cpp b/engines/neverhood/modules/module1000_sprites.cpp
index 55618f0124..573474de02 100644
--- a/engines/neverhood/modules/module1000_sprites.cpp
+++ b/engines/neverhood/modules/module1000_sprites.cpp
@@ -1112,23 +1112,6 @@ KmScene1002::KmScene1002(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16
setKlaymenIdleTable1();
}
-void KmScene1002::setupJumpToRing() {
- _acceptInput = false;
- SetUpdateHandler(&Klaymen::update);
- SetMessageHandler(&KmScene1002::hmJumpToRing);
- SetSpriteUpdate(&Klaymen::suUpdateDestX);
- NextState(&KmScene1002::stHangOnRing);
- sendMessage(_attachedSprite, 0x482B, 0);
-}
-
-void KmScene1002::stJumpToRing1() {
- if (!stStartAction(AnimationCallback(&KmScene1002::stJumpToRing1))) {
- _busyStatus = 0;
- startAnimation(0xD82890BA, 0, -1);
- setupJumpToRing();
- }
-}
-
void KmScene1002::xUpdate() {
if (_x >= 250 && _x <= 435 && _y >= 420) {
if (_idleTableNum == 0) {
@@ -1189,7 +1172,7 @@ uint32 KmScene1002::xHandleMessage(int messageNum, const MessageParam &param) {
break;
case 0x4816:
if (param.asInteger() == 0)
- GotoState(&Klaymen::stPressDoorButton);
+ GotoState(&KmScene1002::stPressDoorButton);
break;
case 0x4817:
setDoDeltaX(param.asInteger());
@@ -1238,70 +1221,13 @@ uint32 KmScene1002::xHandleMessage(int messageNum, const MessageParam &param) {
return 0;
}
-KmScene1004::KmScene1004(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y)
- : Klaymen(vm, parentScene, x, y) {
-
- _dataResource.load(0x01900A04);
-}
-
-uint32 KmScene1004::xHandleMessage(int messageNum, const MessageParam &param) {
- switch (messageNum) {
- case 0x4001:
- case 0x4800:
- startWalkToX(param.asPoint().x, false);
- break;
- case 0x4004:
- GotoState(&Klaymen::stTryStandIdle);
- break;
- case 0x4817:
- setDoDeltaX(param.asInteger());
- gotoNextStateExt();
- break;
- case 0x4818:
- startWalkToX(_dataResource.getPoint(param.asInteger()).x, false);
- break;
- case 0x481E:
- GotoState(&KmScene1004::stReadNote);
- break;
- case 0x4820:
- sendMessage(_parentScene, 0x2000, 0);
- GotoState(&Klaymen::stContinueClimbLadderUp);
- break;
- case 0x4821:
- sendMessage(_parentScene, 0x2000, 0);
- _destY = param.asInteger();
- GotoState(&Klaymen::stStartClimbLadderDown);
- break;
- case 0x4822:
- sendMessage(_parentScene, 0x2000, 0);
- _destY = param.asInteger();
- GotoState(&Klaymen::stStartClimbLadderUp);
- break;
- case 0x4823:
- sendMessage(_parentScene, 0x2001, 0);
- GotoState(&Klaymen::stClimbLadderHalf);
- break;
- case 0x4824:
- sendMessage(_parentScene, 0x2000, 0);
- _destY = _dataResource.getPoint(param.asInteger()).y;
- GotoState(&Klaymen::stStartClimbLadderDown);
- break;
- case 0x4825:
- sendMessage(_parentScene, 0x2000, 0);
- _destY = _dataResource.getPoint(param.asInteger()).y;
- GotoState(&Klaymen::stStartClimbLadderUp);
- break;
- case 0x4828:
- GotoState(&Klaymen::stTurnToBackToUse);
- break;
- case 0x483F:
- startSpecialWalkRight(param.asInteger());
- break;
- case 0x4840:
- startSpecialWalkLeft(param.asInteger());
- break;
- }
- return 0;
+void KmScene1002::setupJumpToRing() {
+ _acceptInput = false;
+ SetUpdateHandler(&Klaymen::update);
+ SetMessageHandler(&KmScene1002::hmJumpToRing);
+ SetSpriteUpdate(&Klaymen::suUpdateDestX);
+ NextState(&KmScene1002::stHangOnRing);
+ sendMessage(_attachedSprite, 0x482B, 0);
}
uint32 KmScene1002::hmJumpToRing(int messageNum, const MessageParam &param, Entity *sender) {
@@ -1332,6 +1258,14 @@ void KmScene1002::stHangOnRing() {
SetSpriteUpdate(NULL);
}
+void KmScene1002::stJumpToRing1() {
+ if (!stStartAction(AnimationCallback(&KmScene1002::stJumpToRing1))) {
+ _busyStatus = 0;
+ startAnimation(0xD82890BA, 0, -1);
+ setupJumpToRing();
+ }
+}
+
void KmScene1002::stJumpToRing2() {
if (!stStartAction(AnimationCallback(&KmScene1002::stJumpToRing2))) {
_busyStatus = 0;
@@ -1542,6 +1476,137 @@ uint32 KmScene1002::hmFirstMoveVenusFlyTrap(int messageNum, const MessageParam &
return messageResult;
}
+void KmScene1002::stPressDoorButton() {
+ _busyStatus = 2;
+ _acceptInput = true;
+ setDoDeltaX(0);
+ startAnimation(0x1CD89029, 0, -1);
+ SetUpdateHandler(&Klaymen::update);
+ SetMessageHandler(&KmScene1002::hmPressDoorButton);
+ SetSpriteUpdate(&Klaymen::suAction);
+}
+
+void KmScene1002::stHitByBoxingGlove() {
+ _busyStatus = 1;
+ _acceptInput = false;
+ startAnimation(0x35AA8059, 0, -1);
+ SetUpdateHandler(&Klaymen::update);
+ SetMessageHandler(&KmScene1002::hmHitByBoxingGlove);
+ SetSpriteUpdate(&AnimatedSprite::updateDeltaXY);
+ FinalizeState(&KmScene1002::evHitByBoxingGloveDone);
+}
+
+void KmScene1002::evHitByBoxingGloveDone() {
+ sendMessage(_parentScene, 0x1024, 1);
+}
+
+uint32 KmScene1002::hmPressDoorButton(int messageNum, const MessageParam &param, Entity *sender) {
+ uint32 messageResult = hmLowLevelAnimation(messageNum, param, sender);
+ switch (messageNum) {
+ case 0x100D:
+ if (param.asInteger() == 0x942D2081) {
+ _acceptInput = false;
+ sendMessage(_attachedSprite, 0x2003, 0);
+ } else if (param.asInteger() == 0xDA600012) {
+ stHitByBoxingGlove();
+ } else if (param.asInteger() == 0x0D01B294) {
+ _acceptInput = false;
+ sendMessage(_attachedSprite, 0x480B, 0);
+ }
+ break;
+ }
+ return messageResult;
+}
+
+uint32 KmScene1002::hmHitByBoxingGlove(int messageNum, const MessageParam &param, Entity *sender) {
+ int16 speedUpFrameIndex;
+ uint32 messageResult = hmLowLevelAnimation(messageNum, param, sender);
+ switch (messageNum) {
+ case 0x1008:
+ speedUpFrameIndex = getFrameIndex(kKlaymenSpeedUpHash);
+ if (_currFrameIndex < speedUpFrameIndex) {
+ startAnimation(0x35AA8059, speedUpFrameIndex, -1);
+ _y = 435;
+ }
+ messageResult = 0;
+ break;
+ case 0x100D:
+ if (param.asInteger() == 0x1A1A0785) {
+ playSound(0, 0x40F0A342);
+ } else if (param.asInteger() == 0x60428026) {
+ playSound(0, 0x40608A59);
+ }
+ break;
+ }
+ return messageResult;
+}
+
+KmScene1004::KmScene1004(NeverhoodEngine *vm, Scene *parentScene, int16 x, int16 y)
+ : Klaymen(vm, parentScene, x, y) {
+
+ _dataResource.load(0x01900A04);
+}
+
+uint32 KmScene1004::xHandleMessage(int messageNum, const MessageParam &param) {
+ switch (messageNum) {
+ case 0x4001:
+ case 0x4800:
+ startWalkToX(param.asPoint().x, false);
+ break;
+ case 0x4004:
+ GotoState(&Klaymen::stTryStandIdle);
+ break;
+ case 0x4817:
+ setDoDeltaX(param.asInteger());
+ gotoNextStateExt();
+ break;
+ case 0x4818:
+ startWalkToX(_dataResource.getPoint(param.asInteger()).x, false);
+ break;
+ case 0x481E:
+ GotoState(&KmScene1004::stReadNote);
+ break;
+ case 0x4820:
+ sendMessage(_parentScene, 0x2000, 0);
+ GotoState(&Klaymen::stContinueClimbLadderUp);
+ break;
+ case 0x4821:
+ sendMessage(_parentScene, 0x2000, 0);
+ _destY = param.asInteger();
+ GotoState(&Klaymen::stStartClimbLadderDown);
+ break;
+ case 0x4822:
+ sendMessage(_parentScene, 0x2000, 0);
+ _destY = param.asInteger();
+ GotoState(&Klaymen::stStartClimbLadderUp);
+ break;
+ case 0x4823:
+ sendMessage(_parentScene, 0x2001, 0);
+ GotoState(&Klaymen::stClimbLadderHalf);
+ break;
+ case 0x4824:
+ sendMessage(_parentScene, 0x2000, 0);
+ _destY = _dataResource.getPoint(param.asInteger()).y;
+ GotoState(&Klaymen::stStartClimbLadderDown);
+ break;
+ case 0x4825:
+ sendMessage(_parentScene, 0x2000, 0);
+ _destY = _dataResource.getPoint(param.asInteger()).y;
+ GotoState(&Klaymen::stStartClimbLadderUp);
+ break;
+ case 0x4828:
+ GotoState(&Klaymen::stTurnToBackToUse);
+ break;
+ case 0x483F:
+ startSpecialWalkRight(param.asInteger());
+ break;
+ case 0x4840:
+ startSpecialWalkLeft(param.asInteger());
+ break;
+ }
+ return 0;
+}
+
uint32 KmScene1004::hmReadNote(int messageNum, const MessageParam &param, Entity *sender) {
uint32 messageResult = hmLowLevelAnimation(messageNum, param, sender);
switch (messageNum) {
diff --git a/engines/neverhood/modules/module1000_sprites.h b/engines/neverhood/modules/module1000_sprites.h
index 540a258ddc..564b3cc335 100644
--- a/engines/neverhood/modules/module1000_sprites.h
+++ b/engines/neverhood/modules/module1000_sprites.h
@@ -230,6 +230,9 @@ protected:
void stMoveVenusFlyTrap();
void stContinueMovingVenusFlyTrap();
void evMoveVenusFlyTrapDone();
+ void stPressDoorButton();
+ void stHitByBoxingGlove();
+ void evHitByBoxingGloveDone();
uint32 hmJumpToRing(int messageNum, const MessageParam &param, Entity *sender);
uint32 hmJumpToRing3(int messageNum, const MessageParam &param, Entity *sender);
@@ -238,6 +241,8 @@ protected:
uint32 hmJumpAndFall(int messageNum, const MessageParam &param, Entity *sender);
uint32 hmMoveVenusFlyTrap(int messageNum, const MessageParam &param, Entity *sender);
uint32 hmFirstMoveVenusFlyTrap(int messageNum, const MessageParam &param, Entity *sender);
+ uint32 hmPressDoorButton(int messageNum, const MessageParam &param, Entity *sender);
+ uint32 hmHitByBoxingGlove(int messageNum, const MessageParam &param, Entity *sender);
void xUpdate();
uint32 xHandleMessage(int messageNum, const MessageParam &param);
diff --git a/engines/neverhood/modules/module2200.cpp b/engines/neverhood/modules/module2200.cpp
index 745af42f72..eecddf904c 100644
--- a/engines/neverhood/modules/module2200.cpp
+++ b/engines/neverhood/modules/module2200.cpp
@@ -20,6 +20,8 @@
*
*/
+#include "common/config-manager.h"
+
#include "neverhood/diskplayerscene.h"
#include "neverhood/gamemodule.h"
#include "neverhood/modules/module1000_sprites.h"
@@ -46,6 +48,18 @@ Module2200::~Module2200() {
}
void Module2200::createScene(int sceneNum, int which) {
+ if (sceneNum == 46 && ConfMan.getBool("skiphallofrecordsscenes")) {
+ // Skip the whole Hall of Records storyboard scenes,
+ // and teleport to the last scene
+ sceneNum = 41;
+ }
+
+ if (sceneNum == 40 && ConfMan.getBool("skiphallofrecordsscenes")) {
+ // Skip the whole Hall of Records storyboard scenes,
+ // and teleport back to the first scene
+ sceneNum = 5;
+ }
+
debug(1, "Module2200::createScene(%d, %d)", sceneNum, which);
_sceneNum = sceneNum;
switch (_sceneNum) {
diff --git a/engines/neverhood/modules/module2800.cpp b/engines/neverhood/modules/module2800.cpp
index 0578a5df2e..d51515ce81 100644
--- a/engines/neverhood/modules/module2800.cpp
+++ b/engines/neverhood/modules/module2800.cpp
@@ -208,6 +208,8 @@ void Module2800::createScene(int sceneNum, int which) {
break;
case 1001:
_vm->_soundMan->stopMusic(0xD2FA4D14, 0, 0);
+ _musicResource->stop(0);
+ _currentMusicFileHash = 0;
createSmackerScene(0x00800801, true, true, false);
break;
}
@@ -354,7 +356,6 @@ void Module2800::updateScene() {
}
void Module2800::updateMusic(bool halfVolume) {
-
uint32 newMusicFileHash = _vm->_gameModule->getCurrRadioMusicFileHash();
if (!_musicResource)
diff --git a/engines/neverhood/neverhood.cpp b/engines/neverhood/neverhood.cpp
index 1fb32a1834..b961bccea7 100644
--- a/engines/neverhood/neverhood.cpp
+++ b/engines/neverhood/neverhood.cpp
@@ -79,6 +79,7 @@ Common::Error NeverhoodEngine::run() {
// Assign default values to the config manager, in case settings are missing
ConfMan.registerDefault("originalsaveload", "false");
+ ConfMan.registerDefault("skiphallofrecordsscenes", "false");
_staticData = new StaticData();
_staticData->load("neverhood.dat");
diff --git a/engines/neverhood/screen.h b/engines/neverhood/screen.h
index c778066152..a9b5af02f6 100644
--- a/engines/neverhood/screen.h
+++ b/engines/neverhood/screen.h
@@ -79,7 +79,6 @@ public:
void drawSurface2(const Graphics::Surface *surface, NDrawRect &drawRect, NRect &clipRect, bool transparent, byte version,
const Graphics::Surface *shadowSurface = NULL);
void drawSurface3(const Graphics::Surface *surface, int16 x, int16 y, NDrawRect &drawRect, NRect &clipRect, bool transparent, byte version);
- void drawShadowSurface(const Graphics::Surface *surface, const Graphics::Surface *shadowSurface, int16 x, int16 y, NDrawRect &drawRect, NRect &clipRect);
void drawDoubleSurface2(const Graphics::Surface *surface, NDrawRect &drawRect);
void drawUnk(const Graphics::Surface *surface, NDrawRect &drawRect, NDrawRect &sysRect, NRect &clipRect, bool transparent, byte version);
void drawSurfaceClipRects(const Graphics::Surface *surface, NDrawRect &drawRect, NRect *clipRects, uint clipRectsCount, bool transparent, byte version);
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index 3f36d56420..dca1870cb7 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -218,7 +218,7 @@ void Palette::rotate(uint first, uint last, bool forward) {
-void Gfx::setPalette(Palette pal) {
+void Gfx::setPalette(Palette &pal) {
byte sysPal[256*3];
uint n = pal.fillRGB(sysPal);
diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h
index 55c1c0c04e..550f9d1dd9 100644
--- a/engines/parallaction/graphics.h
+++ b/engines/parallaction/graphics.h
@@ -465,7 +465,7 @@ public:
void invertBackground(const Common::Rect& r);
// palette
- void setPalette(Palette palette);
+ void setPalette(Palette &palette);
void setBlackPalette();
void animatePalette();
diff --git a/engines/parallaction/sound_br.cpp b/engines/parallaction/sound_br.cpp
index 4a643aaf1d..ea769de9e8 100644
--- a/engines/parallaction/sound_br.cpp
+++ b/engines/parallaction/sound_br.cpp
@@ -207,6 +207,7 @@ public:
void play(Common::SeekableReadStream *stream);
virtual void pause(bool p);
+ virtual void pause() { assert(0); } // overridden
virtual void setVolume(int volume);
virtual void onTimer();
diff --git a/engines/parallaction/sound_ns.cpp b/engines/parallaction/sound_ns.cpp
index 0ee3d73556..ed3031e94e 100644
--- a/engines/parallaction/sound_ns.cpp
+++ b/engines/parallaction/sound_ns.cpp
@@ -43,6 +43,7 @@ public:
void play(Common::SeekableReadStream *stream);
void pause(bool p);
+ virtual void pause() { assert(0); } // overridden
virtual void onTimer();
private:
diff --git a/engines/prince/archive.h b/engines/prince/archive.h
index 3f5c5be4ef..8e106693dc 100644
--- a/engines/prince/archive.h
+++ b/engines/prince/archive.h
@@ -25,6 +25,7 @@
#include "common/archive.h"
+// This is here just as remainder that archive support is missing
namespace Price {
class Archive : public Common::Archive {
diff --git a/engines/prince/debugger.cpp b/engines/prince/debugger.cpp
index 5da11acd88..be9677b99f 100644
--- a/engines/prince/debugger.cpp
+++ b/engines/prince/debugger.cpp
@@ -27,10 +27,13 @@ namespace Prince {
Debugger::Debugger(PrinceEngine *vm) : GUI::Debugger(), _vm(vm) {
DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit));
+ DCmd_Register("level", WRAP_METHOD(Debugger, Cmd_DebugLevel));
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("viewflc", WRAP_METHOD(Debugger, Cmd_ViewFlc));
+ DCmd_Register("initroom", WRAP_METHOD(Debugger, Cmd_InitRoom));
+ DCmd_Register("changecursor", WRAP_METHOD(Debugger, Cmd_ChangeCursor));
}
static int strToInt(const char *s) {
@@ -49,6 +52,22 @@ static int strToInt(const char *s) {
return (int)tmp;
}
+bool Debugger::Cmd_DebugLevel(int argc, const char **argv) {
+ if (argc == 1) {
+ DebugPrintf("Debugging is currently set at level %d\n", gDebugLevel);
+ } else { // set level
+ gDebugLevel = atoi(argv[1]);
+ if (0 <= gDebugLevel && gDebugLevel < 11) {
+ DebugPrintf("Debug level set to level %d\n", gDebugLevel);
+ } else if (gDebugLevel < 0) {
+ DebugPrintf("Debugging is now disabled\n");
+ } else
+ DebugPrintf("Not a valid debug level (0 - 10)\n");
+ }
+
+ return true;
+}
+
/*
* This command sets a flag
*/
@@ -105,7 +124,32 @@ bool Debugger::Cmd_ViewFlc(int argc, const char **argv) {
}
int flagNum = strToInt(argv[1]);
- _vm->loadAnim(flagNum);
+ _vm->loadAnim(flagNum, false);
return true;
}
+
+bool Debugger::Cmd_InitRoom(int argc, const char **argv) {
+ // Check for a flag to clear
+ if (argc != 2) {
+ DebugPrintf("Usage: %s <anim number>\n", argv[0]);
+ return true;
+ }
+
+ int flagNum = strToInt(argv[1]);
+ _vm->loadLocation(flagNum);
+ return true;
+}
+
+bool Debugger::Cmd_ChangeCursor(int argc, const char **argv) {
+ // Check for a flag to clear
+ if (argc != 2) {
+ DebugPrintf("Usage: %s <curId>\n", argv[0]);
+ return true;
+ }
+
+ int flagNum = strToInt(argv[1]);
+ _vm->changeCursor(flagNum);
+ return true;
+}
+
}
diff --git a/engines/prince/debugger.h b/engines/prince/debugger.h
index c5a8be60c6..08b1676fd7 100644
--- a/engines/prince/debugger.h
+++ b/engines/prince/debugger.h
@@ -32,16 +32,19 @@ class PrinceEngine;
class Debugger : public GUI::Debugger {
public:
- Debugger(PrinceEngine *vm);
- virtual ~Debugger() {} // we need this for __SYMBIAN32__ archaic gcc/UIQ
+ Debugger(PrinceEngine *vm);
+ virtual ~Debugger() {} // we need this for __SYMBIAN32__ archaic gcc/UIQ
private:
- 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_ViewFlc(int argc, const char **argv);
-
- PrinceEngine *_vm;
+ bool Cmd_DebugLevel(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_ViewFlc(int argc, const char **argv);
+ bool Cmd_InitRoom(int argc, const char **argv);
+ bool Cmd_ChangeCursor(int argc, const char **argv);
+
+ PrinceEngine *_vm;
};
diff --git a/engines/prince/detection.cpp b/engines/prince/detection.cpp
index c5f6039ca1..fa9df38c90 100644
--- a/engines/prince/detection.cpp
+++ b/engines/prince/detection.cpp
@@ -1,145 +1,147 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "base/plugins.h"
-#include "engines/advancedDetector.h"
-
-#include "prince/prince.h"
-
-namespace Prince {
-
-struct PrinceGameDescription {
- ADGameDescription desc;
-
- int gameType;
-};
-
-int PrinceEngine::getGameType() const {
- return _gameDescription->gameType;
-}
-
-const char *PrinceEngine::getGameId() const {
- return _gameDescription->desc.gameid;
-}
-
-uint32 PrinceEngine::getFeatures() const {
- return _gameDescription->desc.flags;
-}
-
-Common::Language PrinceEngine::getLanguage() const {
- return _gameDescription->desc.language;
-}
-
-}
-
-static const PlainGameDescriptor princeGames[] = {
- {"prince", "Prince Game"},
- {0, 0}
-};
-
-namespace Prince {
-
-static const PrinceGameDescription gameDescriptions[] = {
-
- // German
- {
- {
- "prince",
- "Galador",
- AD_ENTRY1s("databank.ptc", "5fa03833177331214ec1354761b1d2ee", 3565031),
- Common::DE_DEU,
- Common::kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NONE)
- },
- 0
- },
- // Polish
- {
- {
- "prince",
- "Ksiaze i Tchorz",
- AD_ENTRY1s("databank.ptc", "48ec9806bda9d152acbea8ce31c93c49", 3435298),
- Common::PL_POL,
- Common::kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NONE)
- },
- 1
- },
-
-
- { AD_TABLE_END_MARKER, 0 }
-};
-
-} // End of namespace Prince
-
-using namespace Prince;
-
-// we match from data too, to stop detection from a non-top-level directory
-const static char *directoryGlobs[] = {
- "all",
- 0
-};
-
-class PrinceMetaEngine : public AdvancedMetaEngine {
-public:
- PrinceMetaEngine() : AdvancedMetaEngine(Prince::gameDescriptions, sizeof(Prince::PrinceGameDescription), princeGames) {
- _singleid = "prince";
- _maxScanDepth = 2;
- _directoryGlobs = directoryGlobs;
- }
-
- virtual const char *getName() const {
- return "Prince Engine";
- }
-
- virtual const char *getOriginalCopyright() const {
- return "Copyright (C)";
- }
-
- virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
- virtual bool hasFeature(MetaEngineFeature f) const;
-};
-
-bool PrinceMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
- using namespace Prince;
- const PrinceGameDescription *gd = (const PrinceGameDescription *)desc;
- if (gd) {
- *engine = new PrinceEngine(syst, gd);
- }
- return gd != 0;
-}
-
-bool PrinceMetaEngine::hasFeature(MetaEngineFeature f) const {
- return false;
-}
-
-bool Prince::PrinceEngine::hasFeature(EngineFeature f) const {
- return false;//(f == kSupportsRTL);
-}
-
-#if PLUGIN_ENABLED_DYNAMIC(PRINCE)
-REGISTER_PLUGIN_DYNAMIC(PRINCE, PLUGIN_TYPE_ENGINE, PrinceMetaEngine);
-#else
-REGISTER_PLUGIN_STATIC(PRINCE, PLUGIN_TYPE_ENGINE, PrinceMetaEngine);
-#endif
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "base/plugins.h"
+#include "engines/advancedDetector.h"
+
+#include "prince/prince.h"
+
+namespace Prince {
+
+struct PrinceGameDescription {
+ ADGameDescription desc;
+
+ int gameType;
+};
+
+int PrinceEngine::getGameType() const {
+ return _gameDescription->gameType;
+}
+
+const char *PrinceEngine::getGameId() const {
+ return _gameDescription->desc.gameid;
+}
+
+uint32 PrinceEngine::getFeatures() const {
+ return _gameDescription->desc.flags;
+}
+
+Common::Language PrinceEngine::getLanguage() const {
+ return _gameDescription->desc.language;
+}
+
+}
+
+static const PlainGameDescriptor princeGames[] = {
+ {"prince", "Prince Game"},
+ {0, 0}
+};
+
+namespace Prince {
+
+static const PrinceGameDescription gameDescriptions[] = {
+
+ // German
+ {
+ {
+ "prince",
+ "Galador",
+ AD_ENTRY1s("databank.ptc", "5fa03833177331214ec1354761b1d2ee", 3565031),
+ Common::DE_DEU,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NONE)
+ },
+ 0
+ },
+ // Polish
+ {
+ {
+ "prince",
+ "Ksiaze i Tchorz",
+ AD_ENTRY1s("databank.ptc", "48ec9806bda9d152acbea8ce31c93c49", 3435298),
+ Common::PL_POL,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NONE)
+ },
+ 1
+ },
+
+
+ { AD_TABLE_END_MARKER, 0 }
+};
+
+} // End of namespace Prince
+
+using namespace Prince;
+
+// we match from data too, to stop detection from a non-top-level directory
+const static char *directoryGlobs[] = {
+ "all",
+ 0
+};
+
+class PrinceMetaEngine : public AdvancedMetaEngine {
+public:
+ PrinceMetaEngine() : AdvancedMetaEngine(Prince::gameDescriptions, sizeof(Prince::PrinceGameDescription), princeGames) {
+ _singleid = "prince";
+ _maxScanDepth = 2;
+ _directoryGlobs = directoryGlobs;
+ }
+
+ virtual const char *getName() const {
+ return "Prince Engine";
+ }
+
+ virtual const char *getOriginalCopyright() const {
+ return "Copyright (C)";
+ }
+
+ virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
+ virtual bool hasFeature(MetaEngineFeature f) const;
+};
+
+bool PrinceMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
+ using namespace Prince;
+ const PrinceGameDescription *gd = (const PrinceGameDescription *)desc;
+ if (gd) {
+ *engine = new PrinceEngine(syst, gd);
+ }
+ return gd != 0;
+}
+
+bool PrinceMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return false;
+}
+
+bool Prince::PrinceEngine::hasFeature(EngineFeature f) const {
+ return false;//(f == kSupportsRTL);
+}
+
+#if PLUGIN_ENABLED_DYNAMIC(PRINCE)
+REGISTER_PLUGIN_DYNAMIC(PRINCE, PLUGIN_TYPE_ENGINE, PrinceMetaEngine);
+#else
+REGISTER_PLUGIN_STATIC(PRINCE, PLUGIN_TYPE_ENGINE, PrinceMetaEngine);
+#endif
+
+/* vim: set tabstop=4 noexpandtab: */
diff --git a/engines/prince/flags.cpp b/engines/prince/flags.cpp
new file mode 100644
index 0000000000..d6d577a575
--- /dev/null
+++ b/engines/prince/flags.cpp
@@ -0,0 +1,406 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "prince/flags.h"
+
+namespace Prince {
+
+const char * Flags::getFlagName(uint16 flagId)
+{
+ switch (flagId) {
+ default: return "unknown_flag";
+ case FLAGA1: return "FLAGA1";
+ case FLAGA2: return "FLAGA2";
+ case FLAGA3: return "FLAGA3";
+ case DESTX: return "DESTX";
+ case DESTY: return "DESTY";
+ case DESTD: return "DESTD";
+ case DwarfDone: return "DwarfDone";
+ case GRABARZCOUNTER: return "GRABARZCOUNTER";
+ case KIERUNEK: return "KIERUNEK";
+ case BACKFLAG1: return "BACKFLAG1";
+ case BACKFLAG2: return "BACKFLAG2";
+ case BACKFLAG3: return "BACKFLAG3";
+ case BACKFLAG4: return "BACKFLAG4";
+ case MACROFLAG1: return "MACROFLAG1";
+ case MACROFLAG2: return "MACROFLAG2";
+ case MACROFLAG3: return "MACROFLAG3";
+ case HEROLDDONE: return "HEROLDDONE";
+ case BRIDGESET: return "BRIDGESET";
+ case U_BT_1: return "U_BT_1";
+ case U_BT_2: return "U_BT_2";
+ case U_BT_3: return "U_BT_3";
+ case U_BT_4: return "U_BT_4";
+ case U_BT_5: return "U_BT_5";
+ case U_BT_6: return "U_BT_6";
+ case U_BT_7: return "U_BT_7";
+ case U_BT_8: return "U_BT_8";
+ case U_BT_9: return "U_BT_9";
+ case U_BT_COUNTER: return "U_BT_COUNTER";
+ case ARIVALDALIVE: return "ARIVALDALIVE";
+ case TALKCHAR1: return "TALKCHAR1";
+ case TalkType1: return "TalkType1";
+ case TALKROUT1: return "TALKROUT1";
+ case TALKROUT2: return "TALKROUT2";
+ case TALKROUT3: return "TALKROUT3";
+ case TALKROUT4: return "TALKROUT4";
+ case TALKANIM1: return "TALKANIM1";
+ case TALKANIM2: return "TALKANIM2";
+ case TALKCOLOR1: return "TALKCOLOR1";
+ case TALKCOLOR2: return "TALKCOLOR2";
+ case KapciuchTaken: return "KapciuchTaken";
+ case CurrentBeggarA: return "CurrentBeggarA";
+ case TempKapc: return "TempKapc";
+ case HomTaken: return "HomTaken";
+ case WizardTalk: return "WizardTalk";
+ case SunlordTalk: return "SunlordTalk";
+ case HermitTalk: return "HermitTalk";
+ case RunyMode: return "RunyMode";
+ case FatMerchantTalk: return "FatMerchantTalk";
+ case HotDogTalk: return "HotDogTalk";
+ case ThiefTalk: return "ThiefTalk";
+ case BeggarTalk: return "BeggarTalk";
+ case MonkTalk: return "MonkTalk";
+ case BardTalk: return "BardTalk";
+ case BarmanTalk: return "BarmanTalk";
+ case LeftPlayerTalk: return "LeftPlayerTalk";
+ case OczySowy: return "OczySowy";
+ case CzachySpeed1: return "CzachySpeed1";
+ case CzachySpeed2: return "CzachySpeed2";
+ case CzachySpeed3: return "CzachySpeed3";
+ case CzachySlowDown1: return "CzachySlowDown1";
+ case CzachySlowDown2: return "CzachySlowDown2";
+ case CzachySlowDown3: return "CzachySlowDown3";
+ case FjordDane: return "FjordDane";
+ case GKopany1: return "GKopany1";
+ case GKopany2: return "GKopany2";
+ case GKopany3: return "GKopany3";
+ case GKopany4: return "GKopany4";
+ case KnowGodWord: return "KnowGodWord";
+ case TALKROUT21: return "TALKROUT21";
+ case TALKROUT22: return "TALKROUT22";
+ case TALKROUT23: return "TALKROUT23";
+ case TALKROUT24: return "TALKROUT24";
+ case TalkType2: return "TalkType2";
+ case GrabarzTalk: return "GrabarzTalk";
+ case LastTalker: return "LastTalker";
+ case MapaPustelniaEnabled: return "MapaPustelniaEnabled";
+ case MapaTempleEnabled: return "MapaTempleEnabled";
+ case MapaFjordEnabled: return "MapaFjordEnabled";
+ case MapaSilmanionaEnabled: return "MapaSilmanionaEnabled";
+ case MapaKurhanEnabled: return "MapaKurhanEnabled";
+ case MapaDragonEnabled: return "MapaDragonEnabled";
+ case MapaMillEnabled: return "MapaMillEnabled";
+ case DwarfRunning: return "DwarfRunning";
+ case DwarfTalk: return "DwarfTalk";
+ case CurseLift: return "CurseLift";
+ case KosciSwapped: return "KosciSwapped";
+ case BookStolen: return "BookStolen";
+ case MapaUsable: return "MapaUsable";
+ case FjordBoss: return "FjordBoss";
+ case FjordHotDog: return "FjordHotDog";
+ case FjordLewy: return "FjordLewy";
+ case FjordPrawy: return "FjordPrawy";
+ case TalkArivald: return "TalkArivald";
+ case ShootDone: return "ShootDone";
+ case ShootRunning: return "ShootRunning";
+ case ShootKnow: return "ShootKnow";
+ case MirrorKnow: return "MirrorKnow";
+ case Gar1stTime: return "Gar1stTime";
+ case KosciTaken: return "KosciTaken";
+ case ArivGotSpell: return "ArivGotSpell";
+ case BookGiven: return "BookGiven";
+ case Wywieszka: return "Wywieszka";
+ case TalkSheila: return "TalkSheila";
+ case TalkSheila2: return "TalkSheila2";
+ case BackHuman: return "BackHuman";
+ case SkarbiecOpen: return "SkarbiecOpen";
+ case LustroTaken: return "LustroTaken";
+ case GargoyleHom: return "GargoyleHom";
+ case GargoyleBroken: return "GargoyleBroken";
+ case FjordDzien: return "FjordDzien";
+ case GargoyleHom2: return "GargoyleHom2";
+ case RunMonstersRunning: return "RunMonstersRunning";
+ case FoundPaperInCoffin: return "FoundPaperInCoffin";
+ case KnowSunlord: return "KnowSunlord";
+ case KnowSunlordTalk: return "KnowSunlordTalk";
+ case ArivaldCzyta: return "ArivaldCzyta";
+ case TelepX: return "TelepX";
+ case TelepY: return "TelepY";
+ case TelepDir: return "TelepDir";
+ case TelepRoom: return "TelepRoom";
+ case ListStolen: return "ListStolen";
+ case WifeInDoor: return "WifeInDoor";
+ case TalkWifeFlag: return "TalkWifeFlag";
+ case LetterGiven: return "LetterGiven";
+ case LutniaTaken: return "LutniaTaken";
+ case BardHomeOpen: return "BardHomeOpen";
+ case FjordNoMonsters: return "FjordNoMonsters";
+ case ShandriaWallTalking: return "ShandriaWallTalking";
+ case ShandriaWallCounter: return "ShandriaWallCounter";
+ case ShandriaWallDone: return "ShandriaWallDone";
+ case FutureDone: return "FutureDone";
+ case TalkButch: return "TalkButch";
+ case GotSzalik: return "GotSzalik";
+ case GotCzosnek: return "GotCzosnek";
+ case BearDone: return "BearDone";
+ case NekrVisited: return "NekrVisited";
+ case SunRiddle: return "SunRiddle";
+ case PtaszekAway: return "PtaszekAway";
+ case KotGadanie: return "KotGadanie";
+ case SzlafmycaTaken: return "SzlafmycaTaken";
+ case BabkaTalk: return "BabkaTalk";
+ case SellerTalk: return "SellerTalk";
+ case CzosnekDone: return "CzosnekDone";
+ case PriestCounter: return "PriestCounter";
+ case PriestGest1: return "PriestGest1";
+ case PriestGest2: return "PriestGest2";
+ case PriestGest3: return "PriestGest3";
+ case PriestGest4: return "PriestGest4";
+ case PriestAnim: return "PriestAnim";
+ case HolyWaterTaken: return "HolyWaterTaken";
+ case AxeTaken: return "AxeTaken";
+ case BadylTaken1: return "BadylTaken1";
+ case BadylTaken2: return "BadylTaken2";
+ case BadylSharpened: return "BadylSharpened";
+ case PorwanieSmoka: return "PorwanieSmoka";
+ case ShopReOpen: return "ShopReOpen";
+ case LuskaShown: return "LuskaShown";
+ case CudKnow: return "CudKnow";
+ case VampireDead: return "VampireDead";
+ case MapaVisible1: return "MapaVisible1";
+ case MapaVisible2: return "MapaVisible2";
+ case MapaVisible3: return "MapaVisible3";
+ case MapaVisible4: return "MapaVisible4";
+ case MapaVisible5: return "MapaVisible5";
+ case MapaVisible6: return "MapaVisible6";
+ case MapaVisible7: return "MapaVisible7";
+ case MapaVisible8: return "MapaVisible8";
+ case MapaVisible9: return "MapaVisible9";
+ case MapaX: return "MapaX";
+ case MapaY: return "MapaY";
+ case MapaD: return "MapaD";
+ case OldMapaX: return "OldMapaX";
+ case OldMapaY: return "OldMapaY";
+ case OldMapaD: return "OldMapaD";
+ case MovingBack: return "MovingBack";
+ case MapaCount: return "MapaCount";
+ case Pustelnia1st: return "Pustelnia1st";
+ case CzarnePole1st: return "CzarnePole1st";
+ case TalkArivNum: return "TalkArivNum";
+ case Pfui: return "Pfui";
+ case MapaSunlordEnabled:return "MapaSunlordEnabled";
+ case WebDone: return "WebDone";
+ case DragonDone: return "DragonDone";
+ case KanPlay: return "KanPlay";
+ case OldKanPlay: return "OldKanPlay";
+ case LapkiWait: return "LapkiWait";
+ case WebNoCheck: return "WebNoCheck";
+ case Perfumeria: return "Perfumeria";
+ case SmokNoCheck: return "SmokNoCheck";
+ case IluzjaBroken: return "IluzjaBroken";
+ case IluzjaWorking: return "IluzjaWorking";
+ case IluzjaCounter: return "IluzjaCounter";
+ case KurhanOpen1: return "KurhanOpen1";
+ case KastetTaken: return "KastetTaken";
+ case KastetDown: return "KastetDown";
+ case KurhanDone: return "KurhanDone";
+ case SkelCounter: return "SkelCounter";
+ case SkelDial1: return "SkelDial1";
+ case SkelDial2: return "SkelDial2";
+ case SkelDial3: return "SkelDial3";
+ case SkelDial4: return "SkelDial4";
+ case SameTalker: return "SameTalker";
+ case RunMonstersText: return "RunMonstersText";
+ case PiwnicaChecked: return "PiwnicaChecked";
+ case DragonTalked: return "DragonTalked";
+ case ToldAboutBook: return "ToldAboutBook";
+ case SilmanionaDone: return "SilmanionaDone";
+ case ToldBookCount: return "ToldBookCount";
+ case SmrodNoCheck: return "SmrodNoCheck";
+ case RopeTaken: return "RopeTaken";
+ case RopeTime: return "RopeTime";
+ case LaskaFree: return "LaskaFree";
+ case ShanSmokTalked: return "ShanSmokTalked";
+ case SwordTaken: return "SwordTaken";
+ case Mill1st: return "Mill1st";
+ case SawRat: return "SawRat";
+ case KnowRat: return "KnowRat";
+ case DziuraTimer: return "DziuraTimer";
+ case LaskaInside: return "LaskaInside";
+ case HoleBig: return "HoleBig";
+ case EnableWiedzmin: return "EnableWiedzmin";
+ case EnableTrucizna: return "EnableTrucizna";
+ case KnowPoison: return "KnowPoison";
+ case KufelTaken: return "KufelTaken";
+ case BojkaEnabled: return "BojkaEnabled";
+ case BitwaNot1st: return "BitwaNot1st";
+ case BojkaTimer: return "BojkaTimer";
+ case BojkaGirl: return "BojkaGirl";
+ case Look1st: return "Look1st";
+ case RatTaken: return "RatTaken";
+ case LaskaTalkedGr: return "LaskaTalkedGr";
+ case RatusGivus: return "RatusGivus";
+ case MamObole: return "MamObole";
+ case Speed1st: return "Speed1st";
+ case SpeedTimer: return "SpeedTimer";
+ case ProveIt: return "ProveIt";
+ case Proven: return "Proven";
+ case ShowWoalka: return "ShowWoalka";
+ case PoisonTaken: return "PoisonTaken";
+ case HellOpened: return "HellOpened";
+ case HellNoCheck: return "HellNoCheck";
+ case TalAn1: return "TalAn1";
+ case TalAn2: return "TalAn2";
+ case TalAn3: return "TalAn3";
+ case TalkDevilGuard: return "TalkDevilGuard";
+ case Sword1st: return "Sword1st";
+ case IluzjaNoCheck: return "IluzjaNoCheck";
+ case RozdzielniaNumber: return "RozdzielniaNumber";
+ case JailChecked: return "JailChecked";
+ case JailTalked: return "JailTalked";
+ case TrickFailed: return "TrickFailed";
+ case WegielVisible: return "WegielVisible";
+ case WegielTimer1: return "WegielTimer1";
+ case RandomSample: return "RandomSample";
+ case RandomSampleTimer: return "RandomSampleTimer";
+ case SampleTimer: return "SampleTimer";
+ case ZonaSample: return "ZonaSample";
+ case HoleTryAgain: return "HoleTryAgain";
+ case TeleportTimer: return "TeleportTimer";
+ case RozLezy: return "RozLezy";
+ case UdkoTimer: return "UdkoTimer";
+ case ZaworZatkany: return "ZaworZatkany";
+ case ZaworOpened: return "ZaworOpened";
+ case DoorExploded: return "DoorExploded";
+ case SkoraTaken: return "SkoraTaken";
+ case CiezkieByl: return "CiezkieByl";
+ case MamWegiel: return "MamWegiel";
+ case SwiecaAway: return "SwiecaAway";
+ case ITSAVE: return "ITSAVE";
+ case RozpadlSie: return "RozpadlSie";
+ case WegielFullTimer: return "WegielFullTimer";
+ case WegielDown: return "WegielDown";
+ case WegielDownTimer: return "WegielDownTimer";
+ case PaliSie: return "PaliSie";
+ case DiabGuardTalked: return "DiabGuardTalked";
+ case GuardsNoCheck: return "GuardsNoCheck";
+ case TalkedPowloka: return "TalkedPowloka";
+ case JailOpen: return "JailOpen";
+ case PrzytulTimer: return "PrzytulTimer";
+ case JailDone: return "JailDone";
+ case MamMonety: return "MamMonety";
+ case LotTimer: return "LotTimer";
+ case LotObj: return "LotObj";
+ case PtakTimer: return "PtakTimer";
+ case BookTimer: return "BookTimer";
+ case BookGiba: return "BookGiba";
+ case PtakLata: return "PtakLata";
+ case Podej: return "Podej";
+ case GotHint: return "GotHint";
+ case LawaLeci: return "LawaLeci";
+ case PowerKlik: return "PowerKlik";
+ case LucekBad: return "LucekBad";
+ case LucekBad1st: return "LucekBad1st";
+ case IntroDial1: return "IntroDial1";
+ case IntroDial2: return "IntroDial2";
+ case ItsOutro: return "ItsOutro";
+ case KamienComment: return "KamienComment";
+ case KamienSkip: return "KamienSkip";
+ case TesterFlag: return "TesterFlag";
+ case RememberLine: return "RememberLine";
+ case OpisLapek: return "OpisLapek";
+ case TalWait: return "TalWait";
+ case OpisKamienia: return "OpisKamienia";
+ case JumpBox: return "JumpBox";
+ case JumpBox1: return "JumpBox1";
+ case JumpBox2: return "JumpBox2";
+ case JumpBox3: return "JumpBox3";
+ case SpecPiesek: return "SpecPiesek";
+ case SpecPiesekCount: return "SpecPiesekCount";
+ case SpecPiesekGadanie: return "SpecPiesekGadanie";
+ case ZnikaFlag: return "ZnikaFlag";
+ case ZnikaTimer: return "ZnikaTimer";
+ case SowaTimer: return "SowaTimer";
+ case MamrotanieOff: return "MamrotanieOff";
+
+ case CURRMOB: return "CURRMOB";
+ case KOLOR: return "KOLOR";
+ case MBFLAG: return "MBFLAG";
+ case MXFLAG: return "MXFLAG";
+ case MYFLAG: return "MYFLAG";
+ case SCROLLTYPE: return "SCROLLTYPE";
+ case SCROLLVALUE: return "SCROLLVALUE";
+ case SCROLLVALUE2: return "SCROLLVALUE2";
+ case TALKEXITCODE: return "TALKEXITCODE";
+ case SPECROUTFLAG1: return "SPECROUTFLAG1";
+ case SPECROUTFLAG2: return "SPECROUTFLAG2";
+ case SPECROUTFLAG3: return "SPECROUTFLAG3";
+ case TALKFLAGCODE: return "TALKFLAGCODE";
+ case CURRROOM: return "CURRROOM";
+ case Talker1Init: return "Talker1Init";
+ case Talker2Init: return "Talker2Init";
+ case RESTOREROOM: return "RESTOREROOM";
+ case INVALLOWED: return "INVALLOWED";
+ case BOXSEL: return "BOXSEL";
+ case CURSEBLINK: return "CURSEBLINK";
+ case EXACTMOVE: return "EXACTMOVE";
+ case MOVEDESTX: return "MOVEDESTX";
+ case MOVEDESTY: return "MOVEDESTY";
+ case NOANTIALIAS: return "NOANTIALIAS";
+ case ESCAPED: return "ESCAPED";
+ case ALLOW1OPTION: return "ALLOW1OPTION";
+ case VOICE_H_LINE: return "VOICE_H_LINE";
+ case VOICE_A_LINE: return "VOICE_A_LINE";
+ case VOICE_B_LINE: return "VOICE_B_LINE";
+ case VOICE_C_LINE: return "VOICE_C_LINE";
+ case NOHEROATALL: return "NOHEROATALL";
+ case MOUSEENABLED: return "MOUSEENABLED";
+ case DIALINES: return "DIALINES";
+
+ case SHANWALK: return "SHANWALK";
+ case SHANDOG: return "SHANDOG";
+ case GETACTIONBACK: return "GETACTIONBACK";
+ case GETACTIONDATA: return "GETACTIONDATA";
+ case GETACTION: return "GETACTION";
+ case HEROFAST: return "HEROFAST";
+ case SELITEM: return "SELITEM";
+ case LMOUSE: return "LMOUSE";
+ case MINMX: return "MINMX";
+ case MAXMX: return "MAXMX";
+ case MINMY: return "MINMY";
+ case MAXMY: return "MAXMY";
+ case TORX1: return "TORX1";
+ case TORY1: return "TORY1";
+ case TORX2: return "TORX2";
+ case TORY2: return "TORY2";
+ case POWER: return "POWER";
+ case POWERENABLED: return "POWERENABLED";
+ case FLCRESTORE: return "FLCRESTORE";
+ case NOCLSTEXT: return "NOCLSTEXT";
+ case ESCAPED2: return "ESCAPED2";
+ }
+}
+
+}
+
+/* vim: set tabstop=4 noexpandtab: */
diff --git a/engines/prince/flags.h b/engines/prince/flags.h
new file mode 100644
index 0000000000..aa607a01fe
--- /dev/null
+++ b/engines/prince/flags.h
@@ -0,0 +1,416 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PRINCE_FLAGS_H
+#define PRINCE_FLAGS_H
+
+#include "common/scummsys.h"
+
+namespace Prince {
+
+struct Flags {
+
+ // TODO: Remove from release build
+ // useful just for debugging
+ static const char * getFlagName(uint16 flagId);
+
+ enum Id {
+ FLAGA1 = 0x8000,
+ FLAGA2 = 0x8002,
+ FLAGA3 = 0x8004,
+ DESTX = 0x8006,
+ DESTY = 0x8008,
+ DESTD = 0x800A,
+ DwarfDone = 0x800C,
+ GRABARZCOUNTER = 0x800E,
+ KIERUNEK = 0x8010,
+ BACKFLAG1 = 0x8012,
+ BACKFLAG2 = 0x8014,
+ BACKFLAG3 = 0x8016,
+ BACKFLAG4 = 0x8018,
+ MACROFLAG1 = 0x801A,
+ MACROFLAG2 = 0x801C,
+ MACROFLAG3 = 0x801E,
+ HEROLDDONE = 0x8020,
+ BRIDGESET = 0x8022,
+ U_BT_1 = 0x8024,
+ U_BT_2 = 0x8026,
+ U_BT_3 = 0x8028,
+ U_BT_4 = 0x802A,
+ U_BT_5 = 0x802C,
+ U_BT_6 = 0x802E,
+ U_BT_7 = 0x8030,
+ U_BT_8 = 0x8032,
+ U_BT_9 = 0x8034,
+ U_BT_COUNTER = 0x8036,
+ ARIVALDALIVE = 0x8038,
+ TALKCHAR1 = 0x803A,
+ TalkType1 = 0x803C,
+ TALKROUT1 = 0x803E,
+ TALKROUT2 = 0x8042,
+ TALKROUT3 = 0x8046,
+ TALKROUT4 = 0x804A,
+ TALKANIM1 = 0x804E,
+ TALKANIM2 = 0x8050,
+ TALKCOLOR1 = 0x8052,
+ TALKCOLOR2 = 0x8054,
+ KapciuchTaken = 0x8056,
+ CurrentBeggarA = 0x8058,
+ TempKapc = 0x805A,
+ HomTaken = 0x805C,
+ WizardTalk = 0x805E,
+ SunlordTalk = 0x8060,
+ HermitTalk = 0x8062,
+ RunyMode = 0x8064,
+ FatMerchantTalk = 0x8066,
+ HotDogTalk = 0x8068,
+ ThiefTalk = 0x806A,
+ BeggarTalk = 0x806C,
+ // DwarfTalk = 0x806E, // Redefinition
+ MonkTalk = 0x8070,
+ BardTalk = 0x8072,
+ BarmanTalk = 0x8074,
+ LeftPlayerTalk = 0x8076,
+ OczySowy = 0x8078,
+ CzachySpeed1 = 0x807A,
+ CzachySpeed2 = 0x807C,
+ CzachySpeed3 = 0x807E,
+ CzachySlowDown1 = 0x8080,
+ CzachySlowDown2 = 0x8082,
+ CzachySlowDown3 = 0x8084,
+ FjordDane = 0x8086,
+ GKopany1 = 0x8088,
+ GKopany2 = 0x808A,
+ GKopany3 = 0x808C,
+ GKopany4 = 0x808E,
+ KnowGodWord = 0x8090,
+ TALKROUT21 = 0x8092,
+ TALKROUT22 = 0x8096,
+ TALKROUT23 = 0x809A,
+ TALKROUT24 = 0x809E,
+ TalkType2 = 0x80A2,
+ GrabarzTalk = 0x80A4,
+ LastTalker = 0x80A6,
+ MapaPustelniaEnabled = 0x80A8,
+ MapaTempleEnabled = 0x80AA,
+ MapaFjordEnabled = 0x80AC,
+ MapaSilmanionaEnabled = 0x80AE,
+ MapaKurhanEnabled = 0x80B0,
+ MapaDragonEnabled = 0x80B2,
+ MapaMillEnabled = 0x80B4,
+ DwarfRunning = 0x80B6,
+ DwarfTalk = 0x80B8,
+ CurseLift = 0x80BA,
+ KosciSwapped = 0x80BC,
+ BookStolen = 0x80BE,
+ MapaUsable = 0x80C0,
+ FjordBoss = 0x80C2,
+ FjordHotDog = 0x80C4,
+ FjordLewy = 0x80C6,
+ FjordPrawy = 0x80C8,
+ TalkArivald = 0x80CA,
+ ShootDone = 0x80CC,
+ ShootRunning = 0x80CE,
+ ShootKnow = 0x80D0,
+ MirrorKnow = 0x80D2,
+ Gar1stTime = 0x80D4,
+ KosciTaken = 0x80D6,
+ ArivGotSpell = 0x80D8,
+ BookGiven = 0x80DA,
+ Wywieszka = 0x80DC,
+ TalkSheila = 0x80DE,
+ TalkSheila2 = 0x80E0,
+ BackHuman = 0x80E2,
+ SkarbiecOpen = 0x80E4,
+ LustroTaken = 0x80E6,
+ GargoyleHom = 0x80E8,
+ GargoyleBroken = 0x80EA,
+ FjordDzien = 0x80EC,
+ GargoyleHom2 = 0x80EE,
+ RunMonstersRunning = 0x80F0,
+ FoundPaperInCoffin = 0x80F2,
+ KnowSunlord = 0x80F4,
+ KnowSunlordTalk = 0x80F6,
+ ArivaldCzyta = 0x80F8,
+ TelepX = 0x80FA,
+ TelepY = 0x80FC,
+ TelepDir = 0x80FE,
+ TelepRoom = 0x8100,
+ ListStolen = 0x8102,
+ WifeInDoor = 0x8104,
+ TalkWifeFlag = 0x8106,
+ LetterGiven = 0x8108,
+ LutniaTaken = 0x810A,
+ BardHomeOpen = 0x810C,
+ FjordNoMonsters = 0x810E,
+ ShandriaWallTalking = 0x8110,
+ ShandriaWallCounter = 0x8112,
+ ShandriaWallDone = 0x8114,
+ FutureDone = 0x8116,
+ TalkButch = 0x8118,
+ GotSzalik = 0x811A,
+ GotCzosnek = 0x811C,
+ BearDone = 0x811E,
+ NekrVisited = 0x8120,
+ SunRiddle = 0x8122,
+ PtaszekAway = 0x8124,
+ KotGadanie = 0x8126,
+ SzlafmycaTaken = 0x8128,
+ BabkaTalk = 0x812A,
+ SellerTalk = 0x812C,
+ CzosnekDone = 0x812E,
+ PriestCounter = 0x8130,
+ PriestGest1 = 0x8132,
+ PriestGest2 = 0x8134,
+ PriestGest3 = 0x8136,
+ PriestGest4 = 0x8138,
+ PriestAnim = 0x813A,
+ HolyWaterTaken = 0x813C,
+ AxeTaken = 0x813E,
+ BadylTaken1 = 0x8140,
+ BadylTaken2 = 0x8142,
+ BadylSharpened = 0x8144,
+ PorwanieSmoka = 0x8146,
+ ShopReOpen = 0x8148,
+ LuskaShown = 0x814A,
+ CudKnow = 0x814C,
+ VampireDead = 0x814E,
+ MapaVisible1 = 0x8150,
+ MapaVisible2 = 0x8152,
+ MapaVisible3 = 0x8154,
+ MapaVisible4 = 0x8156,
+ MapaVisible5 = 0x8158,
+ MapaVisible6 = 0x815A,
+ MapaVisible7 = 0x815C,
+ MapaVisible8 = 0x815E,
+ MapaVisible9 = 0x8160,
+ MapaX = 0x8162,
+ MapaY = 0x8164,
+ MapaD = 0x8166,
+ OldMapaX = 0x8168,
+ OldMapaY = 0x816A,
+ OldMapaD = 0x816C,
+ MovingBack = 0x816E,
+ MapaCount = 0x8170,
+ Pustelnia1st = 0x8172,
+ CzarnePole1st = 0x8174,
+ TalkArivNum = 0x8176,
+ Pfui = 0x8178,
+ MapaSunlordEnabled = 0x817A,
+ WebDone = 0x817C,
+ DragonDone = 0x817E,
+ KanPlay = 0x8180,
+ OldKanPlay = 0x8182,
+ LapkiWait = 0x8184,
+ WebNoCheck = 0x8186,
+ Perfumeria = 0x8188,
+ SmokNoCheck = 0x818A,
+ IluzjaBroken = 0x818C,
+ IluzjaWorking = 0x818E,
+ IluzjaCounter = 0x8190,
+ KurhanOpen1 = 0x8192,
+ KastetTaken = 0x8194,
+ KastetDown = 0x8196,
+ KurhanDone = 0x8198,
+ SkelCounter = 0x819A,
+ SkelDial1 = 0x819C,
+ SkelDial2 = 0x819E,
+ SkelDial3 = 0x81A0,
+ SkelDial4 = 0x81A2,
+ SameTalker = 0x81A4,
+ RunMonstersText = 0x81A6,
+ PiwnicaChecked = 0x81A8,
+ DragonTalked = 0x81AA,
+ ToldAboutBook = 0x81AC,
+ SilmanionaDone = 0x81AE,
+ ToldBookCount = 0x81B0,
+ SmrodNoCheck = 0x81B2,
+ RopeTaken = 0x81B4,
+ RopeTime = 0x81B6,
+ LaskaFree = 0x81B8,
+ ShanSmokTalked = 0x81BA,
+ SwordTaken = 0x81BC,
+ Mill1st = 0x81BE,
+ SawRat = 0x81C0,
+ KnowRat = 0x81C2,
+ DziuraTimer = 0x81C4,
+ LaskaInside = 0x81C6,
+ HoleBig = 0x81C8,
+ EnableWiedzmin = 0x81CA,
+ EnableTrucizna = 0x81CC,
+ KnowPoison = 0x81CE,
+ KufelTaken = 0x81D0,
+ BojkaEnabled = 0x81D2,
+ BitwaNot1st = 0x81D4,
+ BojkaTimer = 0x81D6,
+ BojkaGirl = 0x81D8,
+ Look1st = 0x81DA,
+ RatTaken = 0x81DC,
+ LaskaTalkedGr = 0x81DE,
+ RatusGivus = 0x81E0,
+ MamObole = 0x81E2,
+ Speed1st = 0x81E4,
+ SpeedTimer = 0x81E6,
+ ProveIt = 0x81E8,
+ Proven = 0x81EA,
+ ShowWoalka = 0x81EC,
+ PoisonTaken = 0x81EE,
+ HellOpened = 0x81F0,
+ HellNoCheck = 0x81F2,
+ TalAn1 = 0x81F4,
+ TalAn2 = 0x81F6,
+ TalAn3 = 0x81F8,
+ TalkDevilGuard = 0x81fA,
+ Sword1st = 0x81FC,
+ IluzjaNoCheck = 0x81FE,
+ RozdzielniaNumber = 0x8200,
+ JailChecked = 0x8202,
+ JailTalked = 0x8204,
+ TrickFailed = 0x8206,
+ WegielVisible = 0x8208,
+ WegielTimer1 = 0x820A,
+ RandomSample = 0x820C,
+ RandomSampleTimer = 0x820E,
+ SampleTimer = 0x8210,
+ ZonaSample = 0x8212,
+ HoleTryAgain = 0x8214,
+ TeleportTimer = 0x8216,
+ RozLezy = 0x8218,
+ UdkoTimer = 0x821A,
+ ZaworZatkany = 0x821C,
+ ZaworOpened = 0x821E,
+ DoorExploded = 0x8220,
+ SkoraTaken = 0x8222,
+ CiezkieByl = 0x8224,
+ MamWegiel = 0x8226,
+ SwiecaAway = 0x8228,
+ ITSAVE = 0x822A,
+ RozpadlSie = 0x822C,
+ WegielFullTimer = 0x822E,
+ WegielDown = 0x8230,
+ WegielDownTimer = 0x8232,
+ PaliSie = 0x8234,
+ DiabGuardTalked = 0x8236,
+ GuardsNoCheck = 0x8238,
+ TalkedPowloka = 0x823A,
+ JailOpen = 0x823C,
+ PrzytulTimer = 0x823E,
+ JailDone = 0x8240,
+ MamMonety = 0x8242,
+ LotTimer = 0x8244,
+ LotObj = 0x8246,
+ PtakTimer = 0x8248,
+ BookTimer = 0x824A,
+ BookGiba = 0x824C,
+ PtakLata = 0x824E,
+ Podej = 0x8250,
+ GotHint = 0x8252,
+ LawaLeci = 0x8254,
+ PowerKlik = 0x8258,
+ LucekBad = 0x825A,
+ LucekBad1st = 0x825C,
+ IntroDial1 = 0x825E,
+ IntroDial2 = 0x8260,
+ ItsOutro = 0x8262,
+ KamienComment = 0x8264,
+ KamienSkip = 0x8266,
+ TesterFlag = 0x8268,
+ RememberLine = 0x826A,
+ OpisLapek = 0x826C,
+ //OpisKamienia = 0x826E, // Redefinition
+ TalWait = 0x8270,
+ OpisKamienia = 0x8272,
+ JumpBox = 0x8274,
+ JumpBox1 = 0x8276,
+ JumpBox2 = 0x8278,
+ JumpBox3 = 0x827A,
+ SpecPiesek = 0x827C,
+ SpecPiesekCount = 0x827E,
+ SpecPiesekGadanie = 0x8282,
+ ZnikaFlag = 0x8284,
+ ZnikaTimer = 0x8286,
+ SowaTimer = 0x8288,
+ MamrotanieOff = 0x828A,
+ // Flagi systemowe do kontroli przez skrypt
+ // System flags controlled by script
+ CURRMOB = 0x8400,
+ KOLOR = 0x8402,
+ MBFLAG = 0x8404,
+ MXFLAG = 0x8406,
+ MYFLAG = 0x8408,
+ SCROLLTYPE = 0x840A,
+ SCROLLVALUE = 0x840C,
+ SCROLLVALUE2 = 0x840E,
+ TALKEXITCODE = 0x8410,
+ SPECROUTFLAG1 = 0x8412,
+ SPECROUTFLAG2 = 0x8414,
+ SPECROUTFLAG3 = 0x8416,
+ TALKFLAGCODE = 0x8418,
+ CURRROOM = 0x841A,
+ Talker1Init = 0x841C,
+ Talker2Init = 0x841E,
+ RESTOREROOM = 0x8420,
+ INVALLOWED = 0x8422,
+ BOXSEL = 0x8424,
+ CURSEBLINK = 0x8426,
+ EXACTMOVE = 0x8428,
+ MOVEDESTX = 0x842A,
+ MOVEDESTY = 0x842C,
+ NOANTIALIAS = 0x842E,
+ ESCAPED = 0x8430,
+ ALLOW1OPTION = 0x8432,
+ VOICE_H_LINE = 0x8434,
+ VOICE_A_LINE = 0x8436,
+ VOICE_B_LINE = 0x8438,
+ VOICE_C_LINE = 0x843A,
+ NOHEROATALL = 0x843C,
+ MOUSEENABLED = 0x843E,
+ DIALINES = 0x8440,
+ //SELITEM = 0x8442, // Redefinition
+ SHANWALK = 0x8444,
+ SHANDOG = 0x8446,
+ GETACTIONBACK = 0x8448,
+ GETACTIONDATA = 0x844C,
+ GETACTION = 0x8450,
+ HEROFAST = 0x8452,
+ SELITEM = 0x8454,
+ LMOUSE = 0x8456,
+ MINMX = 0x8458,
+ MAXMX = 0x845A,
+ MINMY = 0x845C,
+ MAXMY = 0x845E,
+ TORX1 = 0x8460,
+ TORY1 = 0x8462,
+ TORX2 = 0x8464,
+ TORY2 = 0x8466,
+ POWER = 0x8468,
+ POWERENABLED = 0x846A,
+ FLCRESTORE = 0x846C,
+ NOCLSTEXT = 0x846E,
+ ESCAPED2 = 0x8470
+ };
+};
+
+}
+#endif
+/* vim: set tabstop=4 noexpandtab: */
+
diff --git a/engines/prince/font.cpp b/engines/prince/font.cpp
index 8c72f1b912..30e7b5aee2 100644
--- a/engines/prince/font.cpp
+++ b/engines/prince/font.cpp
@@ -35,51 +35,57 @@ Font::Font() {
}
Font::~Font() {
- delete [] _fontData;
+ delete [] _fontData;
}
bool Font::load(Common::SeekableReadStream &stream) {
- stream.seek(0);
- _fontData = new byte[stream.size()];
- stream.read(_fontData, stream.size());
- return true;
+ stream.seek(0);
+ _fontData = new byte[stream.size()];
+ stream.read(_fontData, stream.size());
+ return true;
}
int Font::getFontHeight() const {
- debug("Font::getFontHeight %d", _fontData[5]);
- return _fontData[5];
+ return _fontData[5];
}
int Font::getMaxCharWidth() const {
- return 0;
+ return 0;
}
Font::ChrData Font::getChrData(byte chr) const {
- chr -= 32;
- uint16 chrOffset = 4*chr+6;
+ chr -= 32;
+ uint16 chrOffset = 4*chr+6;
- ChrData chrData;
- chrData._width = _fontData[chrOffset+2];
- chrData._height = _fontData[chrOffset+3];
- chrData._pixels = _fontData + READ_LE_UINT16(_fontData + chrOffset);
+ ChrData chrData;
+ chrData._width = _fontData[chrOffset+2];
+ chrData._height = _fontData[chrOffset+3];
+ chrData._pixels = _fontData + READ_LE_UINT16(_fontData + chrOffset);
- return chrData;
+ return chrData;
}
int Font::getCharWidth(byte chr) const {
- return getChrData(chr)._width;
+ return getChrData(chr)._width;
}
-void Font::drawChar(Graphics::Surface *dst, byte chr, int x, int y, uint32 color) const {
- const ChrData chrData = getChrData(chr);
- const byte *src = chrData._pixels;
- byte *target = (byte *)dst->getBasePtr(x, y);
-
- for (int i = 0; i < chrData._height; i++) {
- memcpy(target, src, chrData._width);
- src += chrData._width;
- target += dst->pitch;
- }
+void Font::drawChar(Graphics::Surface *dst, byte chr, int posX, int posY, uint32 color) const {
+ const ChrData chrData = getChrData(chr);
+
+ for (int y = 0; y < chrData._height; ++y) {
+ for (int x = 0; x < chrData._width; ++x) {
+ byte d = chrData._pixels[x + (chrData._width * y)];
+ if (d == 0) d = 255;
+ else if (d == 1) d = 0;
+ else if (d == 2) d = color;
+ else if (d == 3) d = 0;
+ if (d != 255) {
+ *(byte*)dst->getBasePtr(posX + x, posY + y) = d;
+ }
+ }
+ }
}
}
+
+/* vim: set tabstop=4 expandtab!: */
diff --git a/engines/prince/font.h b/engines/prince/font.h
index 54e6b6b0a5..1afafa3be3 100644
--- a/engines/prince/font.h
+++ b/engines/prince/font.h
@@ -25,21 +25,21 @@
#include "graphics/font.h"
namespace Graphics {
- struct Surface;
+ struct Surface;
}
namespace Common {
- class String;
+ class String;
}
namespace Prince {
class Font : public Graphics::Font {
public:
- Font();
- virtual ~Font();
+ Font();
+ virtual ~Font();
- bool load(Common::SeekableReadStream &stream);
+ bool load(Common::SeekableReadStream &stream);
virtual int getFontHeight() const override;
@@ -49,18 +49,22 @@ public:
virtual void drawChar(Graphics::Surface *dst, byte chr, int x, int y, uint32 color) const override;
+ virtual int getKerningOffset(byte left, byte right) const { return -2; }
+
private:
- struct ChrData {
- byte * _pixels;
- byte _width;
- byte _height;
- };
+ struct ChrData {
+ byte *_pixels;
+ byte _width;
+ byte _height;
+ };
- ChrData getChrData(byte chr) const;
+ ChrData getChrData(byte chr) const;
- byte * _fontData;
+ byte *_fontData;
};
}
#endif
+
+/* vim: set tabstop=4 expandtab!: */
diff --git a/engines/prince/graphics.cpp b/engines/prince/graphics.cpp
index 74b46aad4c..29d3a331df 100644
--- a/engines/prince/graphics.cpp
+++ b/engines/prince/graphics.cpp
@@ -29,46 +29,53 @@
namespace Prince {
GraphicsMan::GraphicsMan(PrinceEngine *vm)
- : _vm(vm), _changed(false) {
- initGraphics(640, 480, true);
- _frontScreen = new Graphics::Surface();
- _frontScreen->create(640, 480, Graphics::PixelFormat::createFormatCLUT8());
+ : _vm(vm), _changed(false) {
+ initGraphics(640, 480, true);
+ _frontScreen = new Graphics::Surface();
+ _frontScreen->create(640, 480, Graphics::PixelFormat::createFormatCLUT8());
}
void GraphicsMan::update() {
- if (_changed) {
- _vm->_system->copyRectToScreen((byte*)_frontScreen->getBasePtr(0,0), 640, 0, 0, 640, 480);
+ if (_changed) {
+ _vm->_system->copyRectToScreen((byte*)_frontScreen->getBasePtr(0,0), 640, 0, 0, 640, 480);
- _vm->_system->updateScreen();
- }
+ _vm->_system->updateScreen();
+ _changed = false;
+ }
}
void GraphicsMan::setPalette(const byte *palette) {
- _vm->_system->getPaletteManager()->setPalette(palette, 0, 256);
+ _vm->_system->getPaletteManager()->setPalette(palette, 0, 256);
}
void GraphicsMan::change() {
- _changed = true;
+ _changed = true;
}
-void GraphicsMan::draw(const Graphics::Surface *s)
+void GraphicsMan::draw(uint16 posX, uint16 posY, const Graphics::Surface *s)
{
- for (uint y = 0; y < 480; y++)
- memcpy((byte*)_frontScreen->getBasePtr(0, y), (byte*)s->getBasePtr(0, y), 640);
- change();
+ uint16 w = MIN(_frontScreen->w, s->w);
+ for (uint y = 0; y < s->h; y++) {
+ if (y < _frontScreen->h) {
+ memcpy((byte*)_frontScreen->getBasePtr(0, y), (byte*)s->getBasePtr(0, y), w);
+ }
+ }
+ change();
}
void GraphicsMan::drawTransparent(const Graphics::Surface *s)
{
- for (uint y = 0; y < 480; ++y) {
- for (uint x = 0; x < 640; ++x) {
- byte pixel = *((byte*)s->getBasePtr(x,y));
- if (pixel != 255) {
- *((byte*)_frontScreen->getBasePtr(x, y)) = pixel;
- }
- }
- }
+ for (uint y = 0; y < s->h; ++y) {
+ for (uint x = 0; x < s->w; ++x) {
+ byte pixel = *((byte*)s->getBasePtr(x,y));
+ if (pixel != 255) {
+ *((byte*)_frontScreen->getBasePtr(x, y)) = pixel;
+ }
+ }
+ }
change();
}
}
+
+/* vim: set tabstop=4 noexpandtab: */
diff --git a/engines/prince/graphics.h b/engines/prince/graphics.h
index 0f12c734c6..3ef768a073 100644
--- a/engines/prince/graphics.h
+++ b/engines/prince/graphics.h
@@ -33,27 +33,26 @@ class PrinceEngine;
class GraphicsMan
{
public:
- GraphicsMan(PrinceEngine *vm);
+ GraphicsMan(PrinceEngine *vm);
- void update();
+ void update();
- void change();
+ void change();
- void setPalette(const byte *palette);
+ void setPalette(const byte *palette);
- void draw(const Graphics::Surface *s);
- void drawTransparent(const Graphics::Surface *s);
+ void draw(uint16 x, uint16 y, const Graphics::Surface *s);
+ void drawTransparent(const Graphics::Surface *s);
- Graphics::Surface *_frontScreen;
- Graphics::Surface *_backScreen;
- const Graphics::Surface *_roomBackground;
+ Graphics::Surface *_frontScreen;
+ Graphics::Surface *_backScreen;
+ const Graphics::Surface *_roomBackground;
private:
- PrinceEngine *_vm;
+ PrinceEngine *_vm;
- bool _changed;
- byte _palette[3 * 256];
+ bool _changed;
};
}
diff --git a/engines/prince/mhwanh.cpp b/engines/prince/mhwanh.cpp
index 4240ed4097..92a6a900f5 100644
--- a/engines/prince/mhwanh.cpp
+++ b/engines/prince/mhwanh.cpp
@@ -29,45 +29,45 @@
namespace Prince {
MhwanhDecoder::MhwanhDecoder()
- : _surface(NULL), _palette(0), _paletteColorCount(0) {
+ : _surface(NULL), _palette(0), _paletteColorCount(0) {
}
MhwanhDecoder::~MhwanhDecoder() {
- destroy();
+ destroy();
}
void MhwanhDecoder::destroy() {
- if (_surface) {
- _surface->free();
- delete _surface; _surface = 0;
- }
+ if (_surface) {
+ _surface->free();
+ delete _surface; _surface = 0;
+ }
- delete [] _palette; _palette = 0;
- _paletteColorCount = 0;
+ delete [] _palette; _palette = 0;
+ _paletteColorCount = 0;
}
bool MhwanhDecoder::loadStream(Common::SeekableReadStream &stream) {
- destroy();
- _paletteColorCount = 256;
- stream.seek(0);
- stream.skip(0x20);
- // Read the palette
- _palette = new byte[_paletteColorCount * 3];
- for (uint16 i = 0; i < _paletteColorCount; i++) {
- _palette[i * 3 + 0] = stream.readByte();
- _palette[i * 3 + 1] = stream.readByte();
- _palette[i * 3 + 2] = stream.readByte();
- }
-
- _surface = new Graphics::Surface();
- _surface->create(640, 480, Graphics::PixelFormat::createFormatCLUT8());
- for (int h = 0; h < 480; ++h) {
- stream.read(_surface->getBasePtr(0, h), 640);
- }
-
- return true;
+ destroy();
+ _paletteColorCount = 256;
+ stream.seek(0);
+ stream.skip(0x20);
+ // Read the palette
+ _palette = new byte[_paletteColorCount * 3];
+ for (uint16 i = 0; i < _paletteColorCount; i++) {
+ _palette[i * 3 + 0] = stream.readByte();
+ _palette[i * 3 + 1] = stream.readByte();
+ _palette[i * 3 + 2] = stream.readByte();
+ }
+
+ _surface = new Graphics::Surface();
+ _surface->create(640, 480, Graphics::PixelFormat::createFormatCLUT8());
+ for (int h = 0; h < 480; ++h) {
+ stream.read(_surface->getBasePtr(0, h), 640);
+ }
+
+ return true;
}
}
-
+/* vim: set tabstop=4 noexpandtab: */
diff --git a/engines/prince/mhwanh.h b/engines/prince/mhwanh.h
index 21822759e8..2b70ae525b 100644
--- a/engines/prince/mhwanh.h
+++ b/engines/prince/mhwanh.h
@@ -28,26 +28,26 @@
namespace Prince {
-class MhwanhDecoder : public Graphics::ImageDecoder
-{
+class MhwanhDecoder : public Graphics::ImageDecoder {
public:
- MhwanhDecoder();
- virtual ~MhwanhDecoder();
+ MhwanhDecoder();
+ virtual ~MhwanhDecoder();
- // ImageDecoder API
- void destroy();
- virtual bool loadStream(Common::SeekableReadStream &stream);
- virtual Graphics::Surface *getSurface() const { return _surface; }
- const byte *getPalette() const { return _palette; }
- uint16 getPaletteCount() const { return _paletteColorCount; }
+ // ImageDecoder API
+ void destroy();
+ virtual bool loadStream(Common::SeekableReadStream &stream);
+ virtual Graphics::Surface *getSurface() const { return _surface; }
+ const byte *getPalette() const { return _palette; }
+ uint16 getPaletteCount() const { return _paletteColorCount; }
private:
- Graphics::Surface *_surface;
- byte *_palette;
- uint16 _paletteColorCount;
+ Graphics::Surface *_surface;
+ byte *_palette;
+ uint16 _paletteColorCount;
};
}
-
#endif
+
+/* vim: set tabstop=4 noexpandtab: */
diff --git a/engines/prince/mob.cpp b/engines/prince/mob.cpp
new file mode 100644
index 0000000000..3df7235d2d
--- /dev/null
+++ b/engines/prince/mob.cpp
@@ -0,0 +1,65 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "prince/mob.h"
+
+#include "common/stream.h"
+
+namespace Prince {
+
+bool Mob::loadFromStream(Common::SeekableReadStream &stream) {
+ int32 pos = stream.pos();
+
+ uint16 visible = stream.readUint16LE();
+
+ if (visible == 0xFFFF)
+ return false;
+
+ _visible = visible;
+ _type = stream.readUint16LE();
+ _rect.left = stream.readUint16LE();
+ _rect.top = stream.readUint16LE();
+ _rect.right = stream.readUint16LE();
+ _rect.bottom = stream.readUint16LE();
+
+ stream.skip(6 * sizeof(uint16));
+ uint32 nameOffset = stream.readUint32LE();
+ uint32 examTextOffset = stream.readUint32LE();
+
+ byte c;
+ stream.seek(nameOffset);
+ _name.clear();
+ while ((c = stream.readByte()))
+ _name += c;
+
+ stream.seek(examTextOffset);
+ _examText.clear();
+ while ((c = stream.readByte()))
+ _examText += c;
+ stream.seek(pos + 32);
+
+ return true;
+}
+
+}
+
+/* vim: set tabstop=4 noexpandtab: */
diff --git a/engines/prince/mob.h b/engines/prince/mob.h
new file mode 100644
index 0000000000..b8208246a1
--- /dev/null
+++ b/engines/prince/mob.h
@@ -0,0 +1,53 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PRINCE_MOB_H
+#define PRINCE_MOB_H
+
+#include "common/scummsys.h"
+#include "common/rect.h"
+#include "common/str.h"
+
+namespace Common {
+ class SeekableReadStream;
+}
+
+namespace Prince {
+
+class Mob {
+public:
+ Mob() {}
+
+ bool loadFromStream(Common::SeekableReadStream &stream);
+
+ bool _visible;
+ uint16 _type;
+ Common::Rect _rect;
+ Common::String _name;
+ Common::String _examText;
+};
+
+}
+
+#endif
+
+/* vim: set tabstop=4 noexpandtab: */
diff --git a/engines/prince/module.mk b/engines/prince/module.mk
index a177e670ed..f8003f834a 100644
--- a/engines/prince/module.mk
+++ b/engines/prince/module.mk
@@ -1,18 +1,23 @@
-MODULE := engines/prince
-
-MODULE_OBJS = \
- debugger.o \
- script.o \
- graphics.o \
- mhwanh.o \
- detection.o \
- font.o \
- prince.o
-
-# This module can be built as a plugin
-ifeq ($(ENABLE_PRINCE), DYNAMIC_PLUGIN)
-PLUGIN := 1
-endif
-
-# Include common rules
-include $(srcdir)/rules.mk
+MODULE := engines/prince
+
+MODULE_OBJS = \
+ debugger.o \
+ script.o \
+ graphics.o \
+ mhwanh.o \
+ detection.o \
+ font.o \
+ mob.o \
+ object.o \
+ sound.o \
+ flags.o \
+ variatxt.o \
+ prince.o
+
+# This module can be built as a plugin
+ifeq ($(ENABLE_PRINCE), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+
+# Include common rules
+include $(srcdir)/rules.mk
diff --git a/engines/prince/musNum.h b/engines/prince/musNum.h
new file mode 100644
index 0000000000..65b31f8175
--- /dev/null
+++ b/engines/prince/musNum.h
@@ -0,0 +1,87 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+namespace Prince {
+
+enum RoomMus {
+ ROOM01MUS = 3,
+ ROOM02MUS = 9,
+ ROOM03MUS = 9,
+ ROOM04MUS = 9,
+ ROOM05MUS = 13,
+ ROOM06MUS = 9,
+ ROOM07MUS = 9,
+ ROOM08MUS = 9,
+ ROOM09MUS = 14,
+ ROOM10MUS = 9,
+ ROOM11MUS = 9,
+ ROOM12MUS = 9,
+ ROOM13MUS = 9,
+ ROOM14MUS = 9,
+ ROOM15MUS = 5,
+ ROOM16MUS = 5,
+ ROOM17MUS = 5,
+ ROOM18MUS = 5,
+ ROOM19MUS = 5,
+ ROOM20MUS = 12,
+ ROOM21MUS = 9,
+ ROOM22MUS = 9,
+ ROOM23MUS = 1,
+ ROOM24MUS = 1,
+ ROOM25MUS = 2,
+ ROOM26MUS = 10,
+ ROOM27MUS = 7,
+ ROOM28MUS = 10,
+ ROOM29MUS = 10,
+ ROOM30MUS = 11,
+ ROOM31MUS = 14,
+ ROOM32MUS = 11,
+ ROOM33MUS = 7,
+ ROOM34MUS = 7,
+ ROOM35MUS = 7,
+ ROOM36MUS = 7,
+ ROOM37MUS = 7,
+ ROOM38MUS = 7,
+ ROOM39MUS = 7,
+ ROOM40MUS = 7,
+ ROOM41MUS = 7,
+ ROOM42MUS = 7,
+ ROOM43MUS = 15,
+ ROOM46MUS = 100,
+ ROOM47MUS = 100,
+ ROOM48MUS = 100,
+ ROOM49MUS = 100,
+ ROOM50MUS = 100,
+ ROOM51MUS = 12,
+ ROOM52MUS = 9,
+ ROOM53MUS = 5,
+ ROOM54MUS = 11,
+ ROOM55MUS = 11,
+ ROOM56MUS = 11,
+ ROOM57MUS = 7,
+ ROOM58MUS = 13,
+ ROOM59MUS = 16,
+ ROOM60MUS = 4,
+ ROOM61MUS = 0
+};
+
+}
diff --git a/engines/prince/object.cpp b/engines/prince/object.cpp
new file mode 100644
index 0000000000..9f7efcfb88
--- /dev/null
+++ b/engines/prince/object.cpp
@@ -0,0 +1,78 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/archive.h"
+#include "common/debug-channels.h"
+#include "common/debug.h"
+#include "common/stream.h"
+
+
+#include "graphics/surface.h"
+
+#include "prince/object.h"
+
+namespace Prince {
+
+Object::Object() : _surface(NULL) {
+}
+
+void Object::loadSurface(Common::SeekableReadStream &stream) {
+ stream.skip(4);
+
+ _surface = new Graphics::Surface();
+ _surface->create(stream.readUint16LE(), stream.readUint16LE(), Graphics::PixelFormat::createFormatCLUT8());
+ for (int h = 0; h < _surface->h; ++h) {
+ stream.read(_surface->getBasePtr(0, h), _surface->w);
+ }
+
+}
+
+bool Object::loadFromStream(Common::SeekableReadStream &stream) {
+
+ int32 pos = stream.pos();
+ uint16 x = stream.readUint16LE();
+ if (x == 0xFFFF)
+ return false;
+ _x = x;
+ _y = stream.readUint16LE();
+
+ const Common::String obStreamName = Common::String::format("OB%02d", stream.readUint16LE());
+ Common::SeekableReadStream *obStream = SearchMan.createReadStreamForMember(obStreamName);
+ if (!obStream) {
+ error("Can't load %s", obStreamName.c_str());
+ return false;
+ }
+
+ loadSurface(*obStream);
+ delete obStream;
+
+ _z = stream.readUint16LE();
+
+ stream.seek(pos + 16);
+
+ debug("Object x %d, y %d, z %d", _x, _y, _z);
+
+ return true;
+}
+
+}
+/* vim: set tabstop=4 noexpandtab: */
diff --git a/engines/prince/object.h b/engines/prince/object.h
new file mode 100644
index 0000000000..2c2dbc9fbf
--- /dev/null
+++ b/engines/prince/object.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PRINCE_OBJECT_H
+#define PRINCE_OBJECT_H
+
+#include "graphics/decoders/image_decoder.h"
+#include "graphics/surface.h"
+
+namespace Prince {
+
+class Object {
+public:
+ Object();
+
+ bool loadFromStream(Common::SeekableReadStream &stream);
+ Graphics::Surface *getSurface() const { return _surface; }
+
+private:
+ void loadSurface(Common::SeekableReadStream &stream);
+
+ Graphics::Surface *_surface;
+ uint16 _x, _y, _z;
+};
+
+}
+
+#endif
+/* vim: set tabstop=4 noexpandtab: */
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp
index 4fb2082baf..6d01cf2017 100644
--- a/engines/prince/prince.cpp
+++ b/engines/prince/prince.cpp
@@ -1,240 +1,550 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "common/scummsys.h"
-
-#include "common/config-manager.h"
-#include "common/debug-channels.h"
-#include "common/debug.h"
-#include "common/events.h"
-#include "common/file.h"
-#include "common/random.h"
-#include "common/fs.h"
-#include "common/keyboard.h"
-#include "common/substream.h"
-
-#include "graphics/cursorman.h"
-#include "graphics/surface.h"
-#include "graphics/palette.h"
-#include "graphics/pixelformat.h"
-
-#include "engines/util.h"
-#include "engines/advancedDetector.h"
-
-#include "audio/audiostream.h"
-
-#include "prince/prince.h"
-#include "prince/font.h"
-#include "prince/graphics.h"
-#include "prince/script.h"
-#include "prince/debugger.h"
-
-#include "video/flic_decoder.h"
-
-namespace Prince {
-
-PrinceEngine::PrinceEngine(OSystem *syst, const PrinceGameDescription *gameDesc) :
- Engine(syst), _gameDescription(gameDesc), _graph(NULL), _script(NULL),
- _locationNr(0), _debugger(NULL) {
- _rnd = new Common::RandomSource("prince");
- _debugger = new Debugger(this);
-
-}
-
-PrinceEngine::~PrinceEngine() {
- DebugMan.clearAllDebugChannels();
-
- delete _rnd;
- delete _debugger;
-}
-
-GUI::Debugger *PrinceEngine::getDebugger() {
- return _debugger;
-}
-
-Common::Error PrinceEngine::run() {
- _graph = new GraphicsMan(this);
-
- const Common::FSNode gameDataDir(ConfMan.get("path"));
-
- debug("Adding all path: %s", gameDataDir.getPath().c_str());
-
- SearchMan.addSubDirectoryMatching(gameDataDir, "all", 0, 2);
-
- Common::SeekableReadStream *font1stream = SearchMan.createReadStreamForMember("font1.raw");
- if (!font1stream)
- return Common::kPathNotFile;
-
- if (_font.load(*font1stream)) {
- _font.getCharWidth(103);
- }
- delete font1stream;
-
- Common::SeekableReadStream * walizka = SearchMan.createReadStreamForMember("walizka");
- if (!walizka)
- return Common::kPathDoesNotExist;
-
- debug("Loading walizka");
- if (!_walizkaBmp.loadStream(*walizka)) {
- return Common::kPathDoesNotExist;
- }
-
- Common::SeekableReadStream * skryptStream = SearchMan.createReadStreamForMember("skrypt.dat");
- if (!skryptStream)
- return Common::kPathNotFile;
-
- debug("Loading skrypt");
- _script = new Script(this);
- _script->loadFromStream(*skryptStream);
-
- delete skryptStream;
-
- Common::SeekableReadStream *logoStrema = SearchMan.createReadStreamForMember("logo.raw");
- if (logoStrema)
- {
- MhwanhDecoder logo;
- logo.loadStream(*logoStrema);
- _graph->setPalette(logo.getPalette());
- _graph->draw(logo.getSurface());
- _graph->update();
- _system->delayMillis(700);
- }
- delete logoStrema;
-
- mainLoop();
-
- return Common::kNoError;
-}
-
-bool PrinceEngine::loadLocation(uint16 locationNr) {
- debug("PrinceEngine::loadLocation %d", locationNr);
- const Common::FSNode gameDataDir(ConfMan.get("path"));
- SearchMan.remove(Common::String::format("%02d", _locationNr));
- _locationNr = locationNr;
-
- const Common::String locationNrStr = Common::String::format("%02d", _locationNr);
- debug("loadLocation %s", locationNrStr.c_str());
- SearchMan.addSubDirectoryMatching(gameDataDir, locationNrStr, 0, 2);
-
- // load location background
- Common::SeekableReadStream *room = SearchMan.createReadStreamForMember("room");
-
- if (!room) {
- error("Can't load room bitmap");
- return false;
- }
-
- if(_roomBmp.loadStream(*room)) {
- debug("Room bitmap loaded");
- _system->getPaletteManager()->setPalette(_roomBmp.getPalette(), 0, 256);
- }
-
- delete room;
-
- return true;
-}
-
-bool PrinceEngine::playNextFrame() {
- const Graphics::Surface *s = _flicPlayer.decodeNextFrame();
- if (s) {
- _graph->drawTransparent(s);
- _graph->change();
- }
-
- return true;
-}
-
-bool PrinceEngine::loadAnim(uint16 animNr) {
- Common::String streamName = Common::String::format("AN%02d", animNr);
- Common::SeekableReadStream * flicStream = SearchMan.createReadStreamForMember(streamName);
-
- if (!flicStream) {
- error("Can't open %s", streamName.c_str());
- return false;
- }
-
- if (!_flicPlayer.loadStream(flicStream)) {
- error("Can't load flic stream %s", streamName.c_str());
- }
-
- debug("%s loaded", streamName.c_str());
- _flicPlayer.start();
- return true;
-}
-
-void PrinceEngine::keyHandler(Common::Event event) {
- uint16 nChar = event.kbd.keycode;
- if (event.kbd.hasFlags(Common::KBD_CTRL)) {
- switch (nChar) {
- case Common::KEYCODE_d:
- getDebugger()->attach();
- getDebugger()->onFrame();
- break;
- }
- }
-}
-
-void PrinceEngine::mainLoop() {
-
- while (!shouldQuit()) {
- Common::Event event;
- Common::EventManager *eventMan = _system->getEventManager();
- while (eventMan->pollEvent(event)) {
- switch (event.type) {
- case Common::EVENT_KEYDOWN:
- keyHandler(event);
- break;
- case Common::EVENT_KEYUP:
- break;
- case Common::EVENT_MOUSEMOVE:
- break;
- case Common::EVENT_LBUTTONDOWN:
- case Common::EVENT_RBUTTONDOWN:
- break;
- case Common::EVENT_LBUTTONUP:
- case Common::EVENT_RBUTTONUP:
- break;
- case Common::EVENT_QUIT:
- break;
- default:
- break;
- }
- }
-
- if (shouldQuit())
- return;
-
- _script->step();
-
- if (_roomBmp.getSurface())
- _graph->draw(_roomBmp.getSurface());
-
- playNextFrame();
-
- _graph->update();
-
- _system->delayMillis(40);
-
- }
-}
-
-} // End of namespace Prince
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/scummsys.h"
+
+#include "common/config-manager.h"
+#include "common/debug-channels.h"
+#include "common/debug.h"
+#include "common/events.h"
+#include "common/file.h"
+#include "common/random.h"
+#include "common/fs.h"
+#include "common/keyboard.h"
+#include "common/substream.h"
+
+#include "graphics/cursorman.h"
+#include "graphics/surface.h"
+#include "graphics/palette.h"
+#include "graphics/pixelformat.h"
+
+#include "engines/util.h"
+#include "engines/advancedDetector.h"
+
+#include "audio/audiostream.h"
+
+#include "prince/prince.h"
+#include "prince/font.h"
+#include "prince/graphics.h"
+#include "prince/script.h"
+#include "prince/debugger.h"
+#include "prince/object.h"
+#include "prince/mob.h"
+#include "prince/sound.h"
+#include "prince/variatxt.h"
+#include "prince/flags.h"
+
+#include "video/flic_decoder.h"
+
+namespace Prince {
+
+Graphics::Surface *loadCursor(const char *curName)
+{
+ Common::SeekableReadStream *curStream = SearchMan.createReadStreamForMember(curName);
+ if (!curStream) {
+ error("Can't load %s", curName);
+ return NULL;
+ }
+
+ curStream->skip(4);
+ uint16 w = curStream->readUint16LE();
+ uint16 h = curStream->readUint16LE();
+
+ debug("Loading cursor %s, w %d, h %d", curName, w, h);
+
+ Graphics::Surface *curSurface = new Graphics::Surface();
+ curSurface->create(w, h, Graphics::PixelFormat::createFormatCLUT8());
+ for (int ih = 0; ih < h; ++ih) {
+ curStream->read(curSurface->getBasePtr(0, ih), w);
+ }
+
+ delete curStream;
+ return curSurface;
+}
+
+
+
+PrinceEngine::PrinceEngine(OSystem *syst, const PrinceGameDescription *gameDesc) :
+ Engine(syst), _gameDescription(gameDesc), _graph(NULL), _script(NULL),
+ _locationNr(0), _debugger(NULL), _objectList(NULL), _mobList(NULL), _midiPlayer(NULL),
+ _cameraX(0), _newCameraX(0), _frameNr(0) {
+
+ // Debug/console setup
+ DebugMan.addDebugChannel(DebugChannel::kScript, "script", "Prince Script debug channel");
+ DebugMan.addDebugChannel(DebugChannel::kEngine, "engine", "Prince Engine debug channel");
+
+ DebugMan.enableDebugChannel("script");
+
+ gDebugLevel = 10;
+
+
+ _rnd = new Common::RandomSource("prince");
+ _debugger = new Debugger(this);
+ _midiPlayer = new MusicPlayer(this);
+
+}
+
+PrinceEngine::~PrinceEngine() {
+ DebugMan.clearAllDebugChannels();
+
+ delete _rnd;
+ delete _debugger;
+ delete _cur1;
+ delete _cur2;
+ delete _midiPlayer;
+}
+
+GUI::Debugger *PrinceEngine::getDebugger() {
+ return _debugger;
+}
+
+Common::Error PrinceEngine::run() {
+ _graph = new GraphicsMan(this);
+
+ const Common::FSNode gameDataDir(ConfMan.get("path"));
+
+ debug("Adding all path: %s", gameDataDir.getPath().c_str());
+
+ SearchMan.addSubDirectoryMatching(gameDataDir, "all", 0, 2);
+ SearchMan.addSubDirectoryMatching(gameDataDir, "data/voices/output", 0, 2);
+
+ Common::SeekableReadStream *font1stream = SearchMan.createReadStreamForMember("font1.raw");
+ if (!font1stream)
+ return Common::kPathNotFile;
+
+ if (_font.load(*font1stream)) {
+ _font.getCharWidth(103);
+ }
+ delete font1stream;
+
+ Common::SeekableReadStream * walizka = SearchMan.createReadStreamForMember("walizka");
+ if (!walizka)
+ return Common::kPathDoesNotExist;
+
+ debug("Loading walizka");
+ if (!_walizkaBmp.loadStream(*walizka)) {
+ return Common::kPathDoesNotExist;
+ }
+
+ Common::SeekableReadStream * skryptStream = SearchMan.createReadStreamForMember("skrypt.dat");
+ if (!skryptStream)
+ return Common::kPathNotFile;
+
+ debug("Loading skrypt");
+ _script = new Script(this);
+ _script->loadFromStream(*skryptStream);
+
+ delete skryptStream;
+
+ Common::SeekableReadStream *variaTxtStream = SearchMan.createReadStreamForMember("variatxt.dat");
+
+ if (!variaTxtStream) {
+ error("Can't load variatxt.dat");
+ return Common::kPathNotFile;
+ }
+
+ _variaTxt = new VariaTxt();
+ _variaTxt->loadFromStream(*variaTxtStream);
+ delete variaTxtStream;
+
+ Common::SeekableReadStream *talkTxtStream = SearchMan.createReadStreamForMember("talktxt.dat");
+ if (!talkTxtStream) {
+ error("Can't load talkTxtStream");
+ return Common::kPathDoesNotExist;
+ }
+
+ _talkTxtSize = talkTxtStream->size();
+ _talkTxt = new byte[_talkTxtSize];
+ talkTxtStream->read(_talkTxt, _talkTxtSize);
+
+ delete talkTxtStream;
+
+
+ _cur1 = loadCursor("mouse1.cur");
+ _cur2 = loadCursor("mouse2.cur");
+#if 0
+ Common::SeekableReadStream *logoStream = SearchMan.createReadStreamForMember("logo.raw");
+ if (logoStream)
+ {
+ MhwanhDecoder logo;
+ logo.loadStream(*logoStream);
+ _graph->setPalette(logo.getPalette());
+ _graph->draw(0, 0, logo.getSurface());
+ _graph->update();
+ _system->delayMillis(700);
+ }
+ delete logoStream;
+#endif
+ mainLoop();
+
+ return Common::kNoError;
+}
+
+class MobList {
+public:
+ bool loadFromStream(Common::SeekableReadStream &stream);
+
+ Common::Array<Mob> _mobList;
+};
+
+bool MobList::loadFromStream(Common::SeekableReadStream &stream)
+{
+ Mob mob;
+ while (mob.loadFromStream(stream))
+ _mobList.push_back(mob);
+
+ return true;
+}
+
+class ObjectList {
+public:
+ bool loadFromStream(Common::SeekableReadStream &stream);
+
+ Common::Array<Object> _objList;
+};
+
+bool ObjectList::loadFromStream(Common::SeekableReadStream &stream)
+{
+ Object obj;
+ while (obj.loadFromStream(stream))
+ _objList.push_back(obj);
+
+ return true;
+}
+
+bool PrinceEngine::loadLocation(uint16 locationNr) {
+ debug("PrinceEngine::loadLocation %d", locationNr);
+ const Common::FSNode gameDataDir(ConfMan.get("path"));
+ SearchMan.remove(Common::String::format("%02d", _locationNr));
+ _locationNr = locationNr;
+
+ const Common::String locationNrStr = Common::String::format("%02d", _locationNr);
+ debug("loadLocation %s", locationNrStr.c_str());
+ SearchMan.addSubDirectoryMatching(gameDataDir, locationNrStr, 0, 2);
+
+ // load location background
+ Common::SeekableReadStream *room = SearchMan.createReadStreamForMember("room");
+
+ if (!room) {
+ error("Can't load room bitmap");
+ return false;
+ }
+
+ if(_roomBmp.loadStream(*room)) {
+ debug("Room bitmap loaded");
+ _sceneWidth = _roomBmp.getSurface()->w;
+ }
+
+ delete room;
+
+ delete _mobList;
+ _mobList = NULL;
+
+ Common::SeekableReadStream *mobListStream = SearchMan.createReadStreamForMember("mob.lst");
+ if (!mobListStream) {
+ error("Can't read mob.lst");
+ return false;
+ }
+
+ _mobList = new MobList();
+ _mobList->loadFromStream(*mobListStream);
+
+ delete mobListStream;
+
+ delete _objectList;
+ _objectList = NULL;
+
+ Common::SeekableReadStream *objListStream = SearchMan.createReadStreamForMember("obj.lst");
+ if (!objListStream) {
+ error("Can't read obj.lst");
+ return false;
+ }
+
+ _objectList = new ObjectList();
+ _objectList->loadFromStream(*objListStream);
+ delete objListStream;
+
+ const char *musName = MusicPlayer::_musTable[MusicPlayer::_musRoomTable[locationNr]];
+ _midiPlayer->loadMidi(musName);
+
+ return true;
+}
+
+void PrinceEngine::changeCursor(uint16 curId)
+{
+ Graphics::Surface *curSurface = NULL;
+
+ uint16 hotspotX = 0;
+ uint16 hotspotY = 0;
+
+ switch(curId) {
+ case 0:
+ CursorMan.showMouse(false);
+ return;
+ case 1:
+ curSurface = _cur1;
+ break;
+ case 2:
+ curSurface = _cur2;
+ hotspotX = curSurface->w >> 1;
+ hotspotY = curSurface->h >> 1;
+ break;
+ }
+
+ CursorMan.replaceCursorPalette(_roomBmp.getPalette(), 0, 255);
+ CursorMan.replaceCursor(
+ curSurface->getBasePtr(0, 0),
+ curSurface->w, curSurface->h,
+ hotspotX, hotspotY,
+ 255, false,
+ &curSurface->format
+ );
+ CursorMan.showMouse(true);
+}
+
+bool PrinceEngine::playNextFrame() {
+ if (!_flicPlayer.isVideoLoaded())
+ return false;
+
+ const Graphics::Surface *s = _flicPlayer.decodeNextFrame();
+ if (s) {
+ _graph->drawTransparent(s);
+ _graph->change();
+ } else if (_flicLooped) {
+ _flicPlayer.rewind();
+ playNextFrame();
+ }
+
+ return true;
+}
+
+bool PrinceEngine::loadAnim(uint16 animNr, bool loop) {
+ Common::String streamName = Common::String::format("AN%02d", animNr);
+ Common::SeekableReadStream * flicStream = SearchMan.createReadStreamForMember(streamName);
+
+ if (!flicStream) {
+ error("Can't open %s", streamName.c_str());
+ return false;
+ }
+
+ if (!_flicPlayer.loadStream(flicStream)) {
+ error("Can't load flic stream %s", streamName.c_str());
+ }
+
+ debug("%s loaded", streamName.c_str());
+ _flicLooped = loop;
+ _flicPlayer.start();
+ playNextFrame();
+ return true;
+}
+
+void PrinceEngine::scrollCameraLeft(int16 delta) {
+ if (_newCameraX > 0) {
+ if (_newCameraX < delta)
+ _newCameraX = 0;
+ else
+ _newCameraX -= delta;
+ }
+}
+
+void PrinceEngine::scrollCameraRight(int16 delta) {
+ if (_newCameraX != _sceneWidth - 640) {
+ if (_sceneWidth - 640 < delta + _newCameraX)
+ delta += (_sceneWidth - 640) - (delta + _newCameraX);
+ _newCameraX += delta;
+ debug(0, "PrinceEngine::scrollCameraRight() _newCameraX = %d; delta = %d", _newCameraX, delta);
+ }
+}
+
+void PrinceEngine::keyHandler(Common::Event event) {
+ uint16 nChar = event.kbd.keycode;
+ switch (nChar) {
+ case Common::KEYCODE_d:
+ if (event.kbd.hasFlags(Common::KBD_CTRL)) {
+ getDebugger()->attach();
+ }
+ break;
+ case Common::KEYCODE_LEFT:
+ scrollCameraLeft(32);
+ break;
+ case Common::KEYCODE_RIGHT:
+ scrollCameraRight(32);
+ break;
+ case Common::KEYCODE_ESCAPE:
+ _script->setFlag(Flags::ESCAPED2, 1);
+ break;
+ }
+}
+
+void PrinceEngine::hotspot() {
+ if (!_mobList)
+ return;
+ Common::Point mousepos = _system->getEventManager()->getMousePos();
+ Common::Point mousePosCamera(mousepos.x + _cameraX, mousepos.y);
+
+ for (Common::Array<Mob>::const_iterator it = _mobList->_mobList.begin()
+ ; it != _mobList->_mobList.end() ; ++it) {
+ if (it->_visible)
+ continue;
+ if (it->_rect.contains(mousePosCamera)) {
+ uint16 textW = 0;
+ for (int i = 0; i < it->_name.size(); ++i)
+ textW += _font.getCharWidth(it->_name[i]);
+
+ uint16 x = mousepos.x - textW/2;
+ if (x > _graph->_frontScreen->w)
+ x = 0;
+
+ if (x + textW > _graph->_frontScreen->w)
+ x = _graph->_frontScreen->w - textW;
+
+ _font.drawString(
+ _graph->_frontScreen,
+ it->_name,
+ x,
+ mousepos.y - _font.getFontHeight(),
+ _graph->_frontScreen->w,
+ 216
+ );
+ break;
+ }
+ }
+}
+
+void PrinceEngine::printAt(uint32 slot, uint8 color, const char *s, uint16 x, uint16 y) {
+
+ debugC(1, DebugChannel::kEngine, "PrinceEngine::printAt slot %d, color %d, x %02d, y %02d, str %s", slot, color, x, y, s);
+
+ Text &text = _textSlots[slot];
+ text._str = s;
+ text._x = x;
+ text._y = y;
+ text._color = color;
+}
+
+uint32 PrinceEngine::getTextWidth(const char *s) {
+ uint16 textW = 0;
+ while (*s) {
+ textW += _font.getCharWidth(*s) + _font.getKerningOffset(0, 0);
+ ++s;
+ }
+ return textW;
+}
+
+void PrinceEngine::showTexts() {
+ for (uint32 slot = 0; slot < MAXTEXTS; ++slot) {
+ Text& text = _textSlots[slot];
+ if (!text._str && !text._time)
+ continue;
+
+ Common::Array<Common::String> lines;
+ _font.wordWrapText(text._str, _graph->_frontScreen->w, lines);
+
+ for (int i = 0; i < lines.size(); ++i) {
+ _font.drawString(
+ _graph->_frontScreen,
+ lines[i],
+ text._x - getTextWidth(lines[i].c_str())/2,
+ text._y - (lines.size() - i) * (_font.getFontHeight()),
+ _graph->_frontScreen->w,
+ text._color
+ );
+ }
+
+ --text._time;
+ if (text._time == 0) {
+ text._str = NULL;
+ }
+ }
+}
+
+void PrinceEngine::drawScreen() {
+ const Graphics::Surface *roomSurface = _roomBmp.getSurface();
+ if (roomSurface) {
+ _graph->setPalette(_roomBmp.getPalette());
+ const Graphics::Surface visiblePart = roomSurface->getSubArea(Common::Rect(_cameraX, 0, roomSurface->w, roomSurface->h));
+ _graph->draw(0, 0, &visiblePart);
+ }
+
+ playNextFrame();
+
+ //if (_objectList)
+ // _graph->drawTransparent(_objectList->getSurface());
+
+ hotspot();
+
+ showTexts();
+
+ getDebugger()->onFrame();
+
+ _graph->update();
+}
+
+void PrinceEngine::mainLoop() {
+
+ while (!shouldQuit()) {
+ uint32 currentTime = _system->getMillis();
+
+ Common::Event event;
+ Common::EventManager *eventMan = _system->getEventManager();
+ while (eventMan->pollEvent(event)) {
+ switch (event.type) {
+ case Common::EVENT_KEYDOWN:
+ keyHandler(event);
+ break;
+ case Common::EVENT_KEYUP:
+ break;
+ case Common::EVENT_MOUSEMOVE:
+ break;
+ case Common::EVENT_LBUTTONDOWN:
+ case Common::EVENT_RBUTTONDOWN:
+ break;
+ case Common::EVENT_LBUTTONUP:
+ case Common::EVENT_RBUTTONUP:
+ break;
+ case Common::EVENT_QUIT:
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (shouldQuit())
+ return;
+
+ _script->step();
+ drawScreen();
+
+ // Calculate the frame delay based off a desired frame time
+ int delay = 1000/15 - int32(_system->getMillis() - currentTime);
+ // Ensure non-negative
+ delay = delay < 0 ? 0 : delay;
+ _system->delayMillis(delay);
+
+ _cameraX = _newCameraX;
+ ++_frameNr;
+ }
+}
+
+} // End of namespace Prince
+
+/* vim: set tabstop=4 expandtab!: */
diff --git a/engines/prince/prince.h b/engines/prince/prince.h
index b289c75553..68a7793157 100644
--- a/engines/prince/prince.h
+++ b/engines/prince/prince.h
@@ -1,100 +1,155 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef PRINCE_H
-#define PRINCE_H
-
-#include "common/random.h"
-#include "common/system.h"
-#include "common/debug.h"
-#include "common/debug-channels.h"
-#include "common/textconsole.h"
-#include "common/rect.h"
-#include "common/events.h"
-
-#include "graphics/decoders/bmp.h"
-
-#include "gui/debugger.h"
-
-#include "engines/engine.h"
-#include "engines/util.h"
-
-#include "audio/mixer.h"
-
-#include "video/flic_decoder.h"
-
-#include "prince/font.h"
-#include "prince/mhwanh.h"
-
-namespace Prince {
-
-struct PrinceGameDescription;
-
-class PrinceEngine;
-class GraphicsMan;
-class Script;
-class Debugger;
-
-class PrinceEngine : public Engine {
-protected:
- Common::Error run();
-
-public:
- PrinceEngine(OSystem *syst, const PrinceGameDescription *gameDesc);
- virtual ~PrinceEngine();
-
- virtual bool hasFeature(EngineFeature f) const;
-
- int getGameType() const;
- const char *getGameId() const;
- uint32 getFeatures() const;
- Common::Language getLanguage() const;
-
- const PrinceGameDescription *_gameDescription;
- Video::FlicDecoder _flicPlayer;
-
- bool loadLocation(uint16 locationNr);
- bool loadAnim(uint16 animNr);
-
- virtual GUI::Debugger *getDebugger();
-
-private:
- bool playNextFrame();
- void keyHandler(Common::Event event);
-
- Common::RandomSource *_rnd;
- Graphics::BitmapDecoder _roomBmp;
- uint16 _locationNr;
- MhwanhDecoder _walizkaBmp;
-
- Debugger *_debugger;
- GraphicsMan *_graph;
- Script *_script;
- Font _font;
-
- void mainLoop();
-
-};
-
-} // End of namespace Prince
-
-#endif
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef PRINCE_H
+#define PRINCE_H
+
+#include "common/random.h"
+#include "common/system.h"
+#include "common/debug.h"
+#include "common/debug-channels.h"
+#include "common/textconsole.h"
+#include "common/rect.h"
+#include "common/events.h"
+
+#include "graphics/decoders/bmp.h"
+
+#include "gui/debugger.h"
+
+#include "engines/engine.h"
+#include "engines/util.h"
+
+#include "audio/mixer.h"
+
+#include "video/flic_decoder.h"
+
+#include "prince/font.h"
+#include "prince/mhwanh.h"
+
+namespace Prince {
+
+struct PrinceGameDescription;
+
+class PrinceEngine;
+class GraphicsMan;
+class Script;
+class Debugger;
+class ObjectList;
+class MobList;
+class MusicPlayer;
+class VariaTxt;
+
+struct Text {
+ const char *_str;
+ uint16 _x, _y;
+ uint16 _time;
+ uint32 _color;
+
+ Text() : _str(NULL), _x(0), _y(0), _time(0), _color(255){
+ }
+};
+
+struct DebugChannel {
+
+enum Type {
+ kScript,
+ kEngine
+};
+
+};
+
+class PrinceEngine : public Engine {
+protected:
+ Common::Error run();
+
+public:
+ PrinceEngine(OSystem *syst, const PrinceGameDescription *gameDesc);
+ virtual ~PrinceEngine();
+
+ virtual bool hasFeature(EngineFeature f) const;
+
+ int getGameType() const;
+ const char *getGameId() const;
+ uint32 getFeatures() const;
+ Common::Language getLanguage() const;
+
+ const PrinceGameDescription *_gameDescription;
+ Video::FlicDecoder _flicPlayer;
+ VariaTxt *_variaTxt;
+
+ uint32 _talkTxtSize;
+ byte *_talkTxt;
+
+ bool loadLocation(uint16 locationNr);
+ bool loadAnim(uint16 animNr, bool loop);
+
+ virtual GUI::Debugger *getDebugger();
+
+ void changeCursor(uint16 curId);
+ void printAt(uint32 slot, uint8 color, const char *s, uint16 x, uint16 y);
+
+ static const uint8 MAXTEXTS = 32;
+ Text _textSlots[MAXTEXTS];
+
+ uint64 _frameNr;
+
+private:
+ bool playNextFrame();
+ void keyHandler(Common::Event event);
+ void hotspot();
+ void scrollCameraRight(int16 delta);
+ void scrollCameraLeft(int16 delta);
+ void drawScreen();
+ void showTexts();
+
+ uint32 getTextWidth(const char *s);
+
+ Common::RandomSource *_rnd;
+ Graphics::BitmapDecoder _roomBmp;
+ uint16 _locationNr;
+ MhwanhDecoder _walizkaBmp;
+
+ Graphics::Surface *_cur1;
+ Graphics::Surface *_cur2;
+
+ Debugger *_debugger;
+ GraphicsMan *_graph;
+ Script *_script;
+ Font _font;
+ ObjectList *_objectList;
+ MobList *_mobList;
+ MusicPlayer *_midiPlayer;
+ uint16 _cameraX;
+ uint16 _newCameraX;
+ uint16 _sceneWidth;
+
+ bool _flicLooped;
+
+ void mainLoop();
+
+};
+
+} // End of namespace Prince
+
+#endif
+
+/* vim: set tabstop=4 noexpandtab: */
diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp
index d790d6d9c3..1aacda4f0b 100644
--- a/engines/prince/script.cpp
+++ b/engines/prince/script.cpp
@@ -22,23 +22,35 @@
#include "prince/script.h"
#include "prince/prince.h"
+#include "prince/flags.h"
+#include "prince/variatxt.h"
+#include "prince/font.h"
#include "common/debug.h"
#include "common/debug-channels.h"
#include "common/stream.h"
+#include "common/archive.h"
+
+#include "audio/decoders/wave.h"
+#include "audio/audiostream.h"
namespace Prince {
static const uint16 NUM_OPCODES = 144;
Script::Script(PrinceEngine *vm) :
- _code(NULL), _stacktop(0), _vm(vm), _opcodeNF(false) {
+ _code(NULL), _stacktop(0), _vm(vm), _opcodeNF(false),
+ _waitFlag(0), _voiceStream(NULL) {
}
Script::~Script() {
delete[] _code;
}
+void Script::setFlag(Flags::Id flagId, uint16 value) {
+ _flags[flagId - 0x8000] = value;
+}
+
bool Script::loadFromStream(Common::SeekableReadStream &stream) {
_codeSize = stream.size();
_code = new byte[_codeSize];
@@ -46,48 +58,69 @@ bool Script::loadFromStream(Common::SeekableReadStream &stream) {
if (!_code)
return false;
- stream.read(_code, _codeSize);
- // Initialize the script
- _currentInstruction = READ_LE_UINT32(_code + 4);
+ stream.read(_code, _codeSize);
+ // Initialize the script
+ _fgOpcodePC = READ_LE_UINT32(_code + 4);
+ _bgOpcodePC = 0;
return true;
}
void Script::debugScript(const char *s, ...) {
- char buf[STRINGBUFLEN];
- va_list va;
+ char buf[STRINGBUFLEN];
+ va_list va;
va_start(va, s);
vsnprintf(buf, STRINGBUFLEN, s, va);
va_end(va);
- Common::String str = Common::String::format("@0x%04X: ", _lastInstruction);
- str += Common::String::format("op %02d: ", _lastOpcode);
- debug("%s %s", str.c_str(), buf);
+ Common::String str = Common::String::format("@0x%04X: ", _lastInstruction);
+ str += Common::String::format("op %04d: ", _lastOpcode);
+ //debugC(10, DebugChannel::kScript, "PrinceEngine::Script %s %s", str.c_str(), buf);
+
+ debug("Prince::Script frame %ld %s %s", _vm->_frameNr, str.c_str(), buf);
}
void Script::step() {
- //while (!_opcodeNF)
- {
- _lastInstruction = _currentInstruction;
- // Prepare the base debug string
- Common::String dstr = Common::String::format("@0x%04X: ", _currentInstruction);
+ if (_bgOpcodePC) {
+ _bgOpcodePC = step(_bgOpcodePC);
+ }
+ if (_fgOpcodePC) {
+ _fgOpcodePC = step(_fgOpcodePC);
+ }
+}
+
+uint32 Script::step(uint32 opcodePC) {
+
+ _currentInstruction = opcodePC;
+ while (!_opcodeNF)
+ {
+ _lastInstruction = _currentInstruction;
+ // Prepare the base debug string
+ Common::String dstr = Common::String::format("@0x%04X: ", _currentInstruction);
- // Get the current opcode
- _lastOpcode = readScript16bits();
+ // Get the current opcode
+ _lastOpcode = readScript16bits();
- dstr += Common::String::format("op %02d: ", _lastOpcode);
+ dstr += Common::String::format("op %02d: ", _lastOpcode);
- if (_lastOpcode > NUM_OPCODES)
- error("Trying to execute unknown opcode %s", dstr.c_str());
+ if (_lastOpcode > NUM_OPCODES)
+ error("Trying to execute unknown opcode %s", dstr.c_str());
- debug("%s", dstr.c_str());
+ debugScript("");
- // Execute the current opcode
- OpcodeFunc op = _opcodes[_lastOpcode];
- (this->*op)();
- }
+ // Execute the current opcode
+ OpcodeFunc op = _opcodes[_lastOpcode];
+ (this->*op)();
+ if (_opcodeNF) {
+
+ _opcodeNF = 0;
+ break;
+ }
+ }
+
+ return _currentInstruction;
}
uint8 Script::getCodeByte(uint32 address) {
@@ -116,258 +149,421 @@ uint32 Script::readScript32bits() {
}
void Script::O_WAITFOREVER() {
- debugScript("O_WAITFOREVER");
- _currentInstruction -= 2;
+ debugScript("O_WAITFOREVER");
+ _opcodeNF = 1;
+ _currentInstruction -= 2;
}
void Script::O_BLACKPALETTE() {
- debugScript("O_BLACKPALETTE");
+ debugScript("O_BLACKPALETTE");
}
void Script::O_SETUPPALETTE() {
- debugScript("O_SETUPPALETTE");
+ debugScript("O_SETUPPALETTE");
}
void Script::O_INITROOM() {
- uint16 roomId = readScript16bits();
- debugScript("O_INITROOM %d", roomId);
- _vm->loadLocation(roomId);
+ uint16 roomId = readScript16bits();
+ debugScript("O_INITROOM %d", roomId);
+ _vm->loadLocation(roomId);
+ _opcodeNF = 1;
}
void Script::O_SETSAMPLE() {
- uint16 sampleId = readScript16bits();
- int32 sampleNameOffset = readScript32bits();
- const char * sampleName = (const char *)_code + _currentInstruction + sampleNameOffset - 4;
- debugScript("O_SETSAMPLE %d %s", sampleId, sampleName);
+ uint16 sampleId = readScript16bits();
+ int32 sampleNameOffset = readScript32bits();
+ const char * sampleName = (const char *)_code + _currentInstruction + sampleNameOffset - 4;
+ debugScript("O_SETSAMPLE %d %s", sampleId, sampleName);
}
void Script::O_FREESAMPLE() {
- uint16 sample = readScript16bits();
- debugScript("O_FREESAMPLE %d", sample);
+ uint16 sample = readScript16bits();
+ debugScript("O_FREESAMPLE %d", sample);
}
void Script::O_PLAYSAMPLE() {
- uint16 sampleId = readScript16bits();
- uint16 loopType = readScript16bits();
- debugScript("O_PLAYSAMPLE sampleId %d loopType %d", sampleId, loopType);
+ uint16 sampleId = readScript16bits();
+ uint16 loopType = readScript16bits();
+ debugScript("O_PLAYSAMPLE sampleId %d loopType %d", sampleId, loopType);
+
+ if (_voiceStream) {
+
+ Audio::RewindableAudioStream *audioStream = Audio::makeWAVStream(_voiceStream, DisposeAfterUse::YES);
+ _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, audioStream, sampleId);
+ }
}
void Script::O_PUTOBJECT() {
- uint16 roomId = readScript16bits();
- uint16 slot = readScript16bits();
- uint16 objectId = readScript16bits();
- debugScript("O_PUTOBJECT roomId %d, slot %d, objectId %d", roomId, slot, objectId);
+ uint16 roomId = readScript16bits();
+ uint16 slot = readScript16bits();
+ uint16 objectId = readScript16bits();
+ debugScript("O_PUTOBJECT roomId %d, slot %d, objectId %d", roomId, slot, objectId);
}
void Script::O_REMOBJECT() {
- uint16 roomId = readScript16bits();
- uint16 objectId = readScript16bits();
+ uint16 roomId = readScript16bits();
+ uint16 objectId = readScript16bits();
- debugScript("O_REMOBJECT roomId %d objectId %d", roomId, objectId);
+ debugScript("O_REMOBJECT roomId %d objectId %d", roomId, objectId);
}
void Script::O_SHOWANIM() {
- uint16 slot = readScript16bits();
- uint16 animId = readScript16bits();
+ uint16 slot = readScript16bits();
+ uint16 animId = readScript16bits();
- debugScript("O_SHOWANIM slot %d, animId %d", slot, animId);
+ debugScript("O_SHOWANIM slot %d, animId %d", slot, animId);
}
void Script::O_CHECKANIMEND() {
- uint16 slot = readScript16bits();
- uint16 frameId = readScript16bits();
+ uint16 slot = readScript16bits();
+ uint16 frameId = readScript16bits();
- debugScript("O_CHECKANIMEND slot %d, frameId %d", slot, frameId);
+ debugScript("O_CHECKANIMEND slot %d, frameId %d", slot, frameId);
+ _opcodeNF = 1;
}
void Script::O_FREEANIM() {
- uint16 slot = readScript16bits();
- debugScript("O_FREEANIM slot %d", slot);
+ uint16 slot = readScript16bits();
+ debugScript("O_FREEANIM slot %d", slot);
}
void Script::O_CHECKANIMFRAME() {
- uint16 slot = readScript16bits();
- uint16 frameId = readScript16bits();
+ uint16 slot = readScript16bits();
+ uint16 frameId = readScript16bits();
- debugScript("O_CHECKANIMFRAME slot %d, frameId %d", slot, frameId);
+ debugScript("O_CHECKANIMFRAME slot %d, frameId %d", slot, frameId);
+ _opcodeNF = 1;
}
void Script::O_PUTBACKANIM() {
- uint16 roomId = readScript16bits();
- uint16 slot = readScript16bits();
- uint32 animId = readScript32bits();
- debugScript("O_PUTBACKANIM roomId %d, slot %d, animId %d", roomId, slot, animId);
+ uint16 roomId = readScript16bits();
+ uint16 slot = readScript16bits();
+ uint32 animId = readScript32bits();
+ debugScript("O_PUTBACKANIM roomId %d, slot %d, animId %d", roomId, slot, animId);
}
void Script::O_REMBACKANIM() {
- uint16 roomId = readScript16bits();
- uint16 slot = readScript16bits();
+ uint16 roomId = readScript16bits();
+ uint16 slot = readScript16bits();
+
+ debugScript("O_REMBACKANIM roomId %d, slot %d", roomId, slot);
+}
- debugScript("O_REMBACKANIM roomId %d, slot %d", roomId, slot);
+void Script::O_CHECKBACKANIMFRAME() {
+ uint16 slotId = readScript16bits();
+ uint16 frameId = readScript16bits();
+
+ debugScript("O_CHECKBACKANIMFRAME slotId %d, frameId %d", slotId, frameId);
+ _opcodeNF = 1;
}
-void Script::O_CHECKBACKANIMFRAME() {}
+void Script::O_FREEALLSAMPLES() {
+ debugScript("O_FREEALLSAMPLES");
+}
-void Script::O_FREEALLSAMPLES() {}
+void Script::O_SETMUSIC() {
+ uint16 musicId = readScript16bits();
-void Script::O_SETMUSIC() {}
+ debugScript("O_SETMUSIC musicId %d", musicId);
+}
-void Script::O_STOPMUSIC() {}
+void Script::O_STOPMUSIC() {
+ debugScript("O_STOPMUSIC");
+}
-void Script::O__WAIT() {}
+void Script::O__WAIT() {
+ uint16 pause = readScript16bits();
-void Script::O_UPDATEOFF() {}
+ debugScript("O__WAIT pause %d", pause);
-void Script::O_UPDATEON() {}
+ if (_waitFlag == 0) {
+ // set new wait flag value and continue
+ _waitFlag = pause;
+ _opcodeNF = 1;
+ _currentInstruction -= 4;
+ return;
+ }
-void Script::O_UPDATE () {}
+ --_waitFlag;
-void Script::O_CLS() {}
+ if (_waitFlag > 0) {
+ _opcodeNF = 1;
+ _currentInstruction -= 4;
+ return;
+ }
+}
+void Script::O_UPDATEOFF() {
+ debugScript("O_UPDATEOFF");
+}
+
+void Script::O_UPDATEON() {
+ debugScript("O_UPDATEON");
+}
+
+void Script::O_UPDATE () {
+ debugScript("O_UPDATE");
+}
+
+void Script::O_CLS() {
+ debugScript("O_CLS");
+}
void Script::O__CALL() {
- int32 address = readScript32bits();
- _stack[_stacktop] = _currentInstruction;
- _stacktop++;
- _currentInstruction += address - 4;
- debugScript("O__CALL 0x%04X", _currentInstruction);
+ int32 address = readScript32bits();
+ _stack[_stacktop] = _currentInstruction;
+ _stacktop++;
+ _currentInstruction += address - 4;
+ debugScript("O__CALL 0x%04X", _currentInstruction);
}
+
void Script::O_RETURN() {
- // Get the return address
- if (_stacktop > 0) {
- _stacktop--;
- _currentInstruction = _stack[_stacktop];
- debugScript("O_RETURN 0x%04X", _currentInstruction);
- } else {
- error("Return: Stack is empty");
- }
+ // Get the return address
+ if (_stacktop > 0) {
+ _stacktop--;
+ _currentInstruction = _stack[_stacktop];
+ debugScript("O_RETURN 0x%04X", _currentInstruction);
+ } else {
+ error("Return: Stack is empty");
+ }
}
+
void Script::O_GO() {
- int32 opPC = readScript32bits();
- debugScript("O_GO 0x%04X", opPC);
- _currentInstruction += opPC - 4;
+ int32 opPC = readScript32bits();
+ debugScript("O_GO 0x%04X", opPC);
+ _currentInstruction += opPC - 4;
+}
+
+void Script::O_BACKANIMUPDATEOFF() {
+ uint16 slotId = readScript32bits();
+ debugScript("O_BACKANIMUPDATEOFF slotId %d", slotId);
}
-void Script::O_BACKANIMUPDATEOFF() {}
void Script::O_BACKANIMUPDATEON() {
- uint16 slot = readScript16bits();
- debugScript("O_BACKANIMUPDATEON %d", slot);
+ uint16 slot = readScript16bits();
+ debugScript("O_BACKANIMUPDATEON %d", slot);
}
void Script::O_CHANGECURSOR() {
- uint16 cursorId = readScript16bits();
- debugScript("O_CHANGECURSOR %x", cursorId);
+ uint16 cursorId = readScript16bits();
+ debugScript("O_CHANGECURSOR %x", cursorId);
}
-void Script::O_CHANGEANIMTYPE() {}
+
+void Script::O_CHANGEANIMTYPE() {
+ // NOT IMPLEMENTED
+}
+
void Script::O__SETFLAG() {
- uint16 flagId = readScript16bits();
- uint16 value = readScript16bits();
- debugScript("O__SETFLAG 0x%04X %d", flagId, value);
- _flags[flagId-0x8000] = value;
+ uint16 flagId = readScript16bits();
+ uint16 value = readScript16bits();
+
+ if (value & 0x8000) {
+ value = _flags[value - 0x8000];
+ }
+
+ debugScript("O__SETFLAG 0x%04X (%s) = %d", flagId, Flags::getFlagName(flagId), value);
+
+ _flags[flagId - 0x8000] = value;
}
void Script::O_COMPARE() {
- uint16 flagId = readScript16bits();
- uint16 value = readScript16bits();
- debugScript("O_COMPARE flagId 0x%04X, value %d", flagId, value);
- _result = (_flags[flagId-0x8000] == value);
+ uint16 flagId = readScript16bits();
+ uint16 value = readScript16bits();
+
+ if (value & 0x8000) {
+ uint16 val = _flags[value - 0x8000];
+ debugScript("GetFlagValue 0x%04X (%s), value %d", value, Flags::getFlagName(value), val);
+
+ value = val;
+ }
+
+ _result = !(_flags[flagId - 0x8000] == value);
+ debugScript("O_COMPARE flagId 0x%04X (%s), value %d == %d (%d)", flagId, Flags::getFlagName(flagId), value, _flags[flagId - 0x8000], _result);
}
void Script::O_JUMPZ() {
- int32 offset = readScript32bits();
- debugScript("O_JUMPZ offset 0x%04X", offset);
- if (_result == 0)
- {
- _currentInstruction += offset - 4;
- }
+ int32 offset = readScript32bits();
+ debugScript("O_JUMPZ offset 0x%04X", offset);
+ if (! _result) {
+ _currentInstruction += offset - 4;
+ }
}
void Script::O_JUMPNZ() {
- int32 offset = readScript32bits();
- debugScript("O_JUMPNZ offset 0x%04X", offset);
- if (_result)
- {
- _currentInstruction += offset - 4;
- }
+ int32 offset = readScript32bits();
+ debugScript("O_JUMPNZ offset 0x%04X", offset);
+ if (_result) {
+ _currentInstruction += offset - 4;
+ }
}
-void Script::O_EXIT() {}
+void Script::O_EXIT() {
+ uint16 exitCode = readScript16bits();
+ debugScript("O_EXIT exitCode %d", exitCode);
+}
void Script::O_ADDFLAG() {
- uint16 flagId = readScript16bits();
- uint16 value = readScript16bits();
+ uint16 flagId = readScript16bits();
+ uint16 value = readScript16bits();
- _flags[flagId-0x8000] += value;
- if (_flags[flagId-0x8000])
- _result = 1;
- else
- _result = 0;
+ if (value & 0x8000) {
+ value = _flags[value - 0x8000];
+ }
- debugScript("O_ADDFLAG flagId %d, value %d", flagId, value);
+ _flags[flagId - 0x8000] += value;
+ if (_flags[flagId - 0x8000])
+ _result = 1;
+ else
+ _result = 0;
+
+ debugScript("O_ADDFLAG flagId %04x (%s), value %d", flagId, Flags::getFlagName(flagId), value);
}
void Script::O_TALKANIM() {
- uint16 animSlot = readScript16bits();
- uint16 slot = readScript16bits();
+ uint16 animSlot = readScript16bits();
+ uint16 slot = readScript16bits();
- debugScript("O_TALKANIM animSlot %d, slot %d", animSlot, slot);
+ debugScript("O_TALKANIM animSlot %d, slot %d", animSlot, slot);
}
void Script::O_SUBFLAG() {
- uint16 flagId = readScript16bits();
- uint16 value = readScript16bits();
+ uint16 flagId = readScript16bits();
+ uint16 value = readScript16bits();
+
+ if (value & 0x8000) {
+ value = _flags[value - 0x8000];
+ }
- _flags[flagId-0x8000] -= value;
- if (_flags[flagId-0x8000])
- _result = 1;
- else
- _result = 0;
+ _flags[flagId - 0x8000] -= value;
+ if (_flags[flagId - 0x8000])
+ _result = 1;
+ else
+ _result = 0;
- debugScript("O_SUBFLAG flagId %d, value %d", flagId, value);
+ debugScript("O_SUBFLAG flagId %d, value %d", flagId, value);
}
void Script::O_SETSTRING() {
- int32 offset = readScript32bits();
+ int32 offset = readScript32bits();
+ _currentString = offset;
+
+ if (offset >= 80000) {
+ debug("GetVaria %s", _vm->_variaTxt->getString(offset - 80000));
+ }
+ else if (offset < 2000) {
+ uint32 of = READ_LE_UINT32(_vm->_talkTxt+offset*4);
+ const char * txt = (const char *)&_vm->_talkTxt[of];
+ _string = &_vm->_talkTxt[of];
+ debug("TalkTxt %d %s", of, txt);
+ }
+
+ debugScript("O_SETSTRING %04d", offset);
+}
+
+void Script::O_ANDFLAG() {
+ uint16 flagId = readScript16bits();
+ uint16 value = readScript16bits();
- debugScript("O_SETSTRING 0x%04X", offset);
+ debugScript("O_ANDFLAG flagId %d, value %d", flagId, value);
+
+ if (value & 0x8000) {
+ value = _flags[value - 0x8000];
+ }
+
+ _flags[flagId - 0x8000] &= value;
+
+ if (_flags[flagId - 0x8000]) {
+ _result = 1;
+ } else {
+ _result = 0;
+ }
}
-void Script::O_ANDFLAG() {}
+void Script::O_GETMOBDATA() {
+ uint16 flagId = readScript16bits();
+ uint16 mobId = readScript16bits();
+ uint16 mobOffset = readScript16bits();
-void Script::O_GETMOBDATA() {}
+ debugScript("O_GETMOBDATA flagId %d, modId %d, mobOffset %d", flagId, mobId, mobOffset);
+}
+
+void Script::O_ORFLAG() {
+ uint16 flagId = readScript16bits();
+ uint16 value = readScript16bits();
+
+ debugScript("O_ORFLAG flagId %d, value %d", flagId, value);
-void Script::O_ORFLAG() {}
+ if (value & 0x8000) {
+ value = _flags[value - 0x8000];
+ }
-void Script::O_SETMOBDATA() {}
+ _flags[flagId - 0x8000] |= value;
-void Script::O_XORFLAG() {}
+ if (_flags[flagId - 0x8000]) {
+ _result = 1;
+ } else {
+ _result = 0;
+ }
+}
-void Script::O_GETMOBTEXT() {}
+void Script::O_SETMOBDATA() {
+ uint16 mobId = readScript16bits();
+ uint16 mobOffset = readScript16bits();
+ uint16 value = readScript16bits();
+
+ debugScript("O_SETMOBDATA mobId %d, mobOffset %d, value %d", mobId, mobOffset, value);
+}
+
+void Script::O_XORFLAG() {
+ uint16 flagId = readScript16bits();
+ uint16 value = readScript16bits();
+
+ debugScript("O_XORFLAG flagId %d, value %d", flagId, value);
+
+ if (value & 0x8000) {
+ value = _flags[value - 0x8000];
+ }
+
+ _flags[flagId - 0x8000] ^= value;
+
+ if (_flags[flagId - 0x8000]) {
+ _result = 1;
+ } else {
+ _result = 0;
+ }
+}
+
+void Script::O_GETMOBTEXT() {
+ uint16 value = readScript16bits();
+
+ debugScript("O_GETMOBTEXT value %d", value);
+}
void Script::O_MOVEHERO() {
- uint16 heroId = readScript16bits();
- uint16 x = readScript16bits();
- uint16 y = readScript16bits();
- uint16 dir = readScript16bits();
-
- debugScript("O_MOVEHERO heroId %d, x %d, y %d, dir %d", heroId, x, y, dir);
+ uint16 heroId = readScript16bits();
+ uint16 x = readScript16bits();
+ uint16 y = readScript16bits();
+ uint16 dir = readScript16bits();
+
+ debugScript("O_MOVEHERO heroId %d, x %d, y %d, dir %d", heroId, x, y, dir);
}
void Script::O_WALKHERO() {
- uint16 heroId = readScript16bits();
+ uint16 heroId = readScript16bits();
- debugScript("O_WALKHERO %d", heroId);
+ debugScript("O_WALKHERO %d", heroId);
+ _opcodeNF = 1;
}
void Script::O_SETHERO() {}
void Script::O_HEROOFF() {
- uint16 heroId = readScript16bits();
- debugScript("O_HEROOFF %d", heroId);
+ uint16 heroId = readScript16bits();
+ debugScript("O_HEROOFF %d", heroId);
}
void Script::O_HEROON() {
- uint16 heroId = readScript16bits();
- debugScript("O_HEROON %d", heroId);
+ uint16 heroId = readScript16bits();
+ debugScript("O_HEROON %d", heroId);
}
void Script::O_CLSTEXT() {}
@@ -382,8 +578,8 @@ void Script::O_REMWALKAREA() {}
void Script::O_RESTOREWALKAREA() {}
void Script::O_WAITFRAME() {
- debugScript("O_WAITFRAME");
- _opcodeNF = true;
+ debugScript("O_WAITFRAME");
+ _opcodeNF = true;
}
void Script::O_SETFRAME() {}
@@ -396,8 +592,15 @@ void Script::O_CHECKINV() {}
void Script::O_TALKHERO() {}
void Script::O_WAITTEXT() {
- uint16 slot = readScript16bits();
- debugScript("O_WAITTEXT slot %d", slot);
+ uint16 slot = readScript16bits();
+ if (slot & 0x8000) {
+ slot = _flags[slot - 0x8000];
+ }
+ Text &text = _vm->_textSlots[slot];
+ if (text._time) {
+ _opcodeNF = 1;
+ _currentInstruction -= 4;
+ }
}
void Script::O_SETHEROANIM() {}
@@ -409,8 +612,9 @@ void Script::O_CHANGEBACKFRAMES() {}
void Script::O_GETBACKANIMDATA() {}
void Script::O_GETANIMDATA() {}
void Script::O_SETBGCODE() {
- int32 bgcode = readScript32bits();
- debugScript("O_SETBGCODE %d", bgcode);
+ int32 bgcode = readScript32bits();
+ debugScript("O_SETBGCODE %d", bgcode);
+ _bgOpcodePC = _currentInstruction + bgcode;
}
void Script::O_SETBACKFRAME() {}
void Script::O_GETRND() {}
@@ -418,418 +622,517 @@ void Script::O_TALKBACKANIM() {}
void Script::O_LOADPATH() {}
void Script::O_GETCHAR() {
- uint16 flagId = readScript16bits();
- debugScript("O_GETCHAR %d", flagId);
+ uint16 flagId = readScript16bits();
+
+ _flags[flagId - 0x8000] = *_string;
+
+ debugScript("O_GETCHAR %04X (%s) %02x", flagId, Flags::getFlagName(flagId), _flags[flagId - 0x8000]);
+
+ ++_string;
}
void Script::O_SETDFLAG() {}
void Script::O_CALLDFLAG() {}
-void Script::O_PRINTAT() {}
+
+void Script::O_PRINTAT() {
+ uint16 slot = readScript16bits();
+ uint16 fr1 = readScript16bits();
+ uint16 fr2 = readScript16bits();
+
+ debugScript("O_PRINTAT slot %d, fr1 %d, fr2 %d", slot, fr1, fr2);
+
+ uint8 color = _flags[Flags::KOLOR - 0x8000];
+
+ _vm->printAt(slot, color, (const char *)_string, fr1, fr2);
+
+ while (*_string) {
+ ++_string;
+ }
+ ++_string;
+}
+
void Script::O_ZOOMIN() {}
+
void Script::O_ZOOMOUT() {}
-void Script::O_SETSTRINGOFFSET() {}
+
+void Script::O_SETSTRINGOFFSET() {
+}
+
void Script::O_GETOBJDATA() {}
+
void Script::O_SETOBJDATA() {}
+
void Script::O_SWAPOBJECTS() {}
-void Script::O_CHANGEHEROSET() {}
+
+void Script::O_CHANGEHEROSET() {
+ uint16 hero = readScript16bits();
+ uint16 heroSet = readScript16bits();
+
+ debugScript("O_CHANGEHEROSET hero %d, heroSet %d", hero, heroSet);
+}
+
void Script::O_ADDSTRING() {}
+
void Script::O_SUBSTRING() {}
+
void Script::O_INITDIALOG() {}
+
void Script::O_ENABLEDIALOGOPT() {}
+
void Script::O_DISABLEDIALOGOPT() {}
+
void Script::O_SHOWDIALOGBOX() {}
void Script::O_STOPSAMPLE() {
- uint16 slot = readScript16bits();
- debugScript("O_STOPSAMPLE slot %d", slot);
+ uint16 slot = readScript16bits();
+ debugScript("O_STOPSAMPLE slot %d", slot);
+
+ _vm->_mixer->stopID(slot);
+ _voiceStream = NULL;
}
void Script::O_BACKANIMRANGE() {
- uint16 slotId = readScript16bits();
- uint16 animId = readScript16bits();
- uint16 low = readScript16bits();
- uint16 high = readScript16bits();
+ uint16 slotId = readScript16bits();
+ uint16 animId = readScript16bits();
+ uint16 low = readScript16bits();
+ uint16 high = readScript16bits();
- debugScript("O_BACKANIMRANGE slotId %d, animId %d, low %d, high %d", slotId, animId, low, high);
+ debugScript("O_BACKANIMRANGE slotId %d, animId %d, low %d, high %d", slotId, animId, low, high);
}
void Script::O_CLEARPATH() {
- debugScript("O_CLEARPATH");
+ debugScript("O_CLEARPATH");
}
void Script::O_SETPATH() {
- debugScript("O_SETPATH");
+ debugScript("O_SETPATH");
}
void Script::O_GETHEROX() {
- uint16 heroId = readScript16bits();
- uint16 flagId = readScript16bits();
+ uint16 heroId = readScript16bits();
+ uint16 flagId = readScript16bits();
- debugScript("O_GETHEROX heroId %d, flagId %d", heroId, flagId);
+ debugScript("O_GETHEROX heroId %d, flagId %d", heroId, flagId);
}
void Script::O_GETHEROY() {
- uint16 heroId = readScript16bits();
- uint16 flagId = readScript16bits();
+ uint16 heroId = readScript16bits();
+ uint16 flagId = readScript16bits();
- debugScript("O_GETHEROY heroId %d, flagId %d", heroId, flagId);
+ debugScript("O_GETHEROY heroId %d, flagId %d", heroId, flagId);
}
void Script::O_GETHEROD() {
- uint16 heroId = readScript16bits();
- uint16 flagId = readScript16bits();
+ uint16 heroId = readScript16bits();
+ uint16 flagId = readScript16bits();
- debugScript("O_GETHEROD heroId %d, flagId %d", heroId, flagId);
+ debugScript("O_GETHEROD heroId %d, flagId %d", heroId, flagId);
}
void Script::O_PUSHSTRING() {
- debugScript("O_PUSHSTRING");
+ debugScript("O_PUSHSTRING");
}
void Script::O_POPSTRING() {
- debugScript("O_POPSTRING");
+ debugScript("O_POPSTRING");
}
void Script::O_SETFGCODE() {
- int32 offset = readScript32bits();
+ int32 offset = readScript32bits();
+
+ debugScript("O_SETFGCODE offset %04X", offset);
- debugScript("O_SETFGCODE offset %04X", offset);
+ _fgOpcodePC = _currentInstruction + offset;
}
void Script::O_STOPHERO() {
- uint16 heroId = readScript16bits();
+ uint16 heroId = readScript16bits();
- debugScript("O_STOPHERO heroId %d", heroId);
+ debugScript("O_STOPHERO heroId %d", heroId);
}
void Script::O_ANIMUPDATEOFF() {
- uint16 slotId = readScript16bits();
- debugScript("O_ANIMUPDATEOFF slotId %d", slotId);
+ uint16 slotId = readScript16bits();
+ debugScript("O_ANIMUPDATEOFF slotId %d", slotId);
}
void Script::O_ANIMUPDATEON() {
- uint16 slotId = readScript16bits();
- debugScript("O_ANIMUPDATEON slotId %d", slotId);
+ uint16 slotId = readScript16bits();
+ debugScript("O_ANIMUPDATEON slotId %d", slotId);
}
void Script::O_FREECURSOR() {
- debugScript("O_FREECURSOR");
+ debugScript("O_FREECURSOR");
}
void Script::O_ADDINVQUIET() {
- uint16 heroId = readScript16bits();
- uint16 itemId = readScript16bits();
+ uint16 heroId = readScript16bits();
+ uint16 itemId = readScript16bits();
- debugScript("O_ADDINVQUIET heorId %d, itemId %d", heroId, itemId);
+ debugScript("O_ADDINVQUIET heorId %d, itemId %d", heroId, itemId);
}
void Script::O_RUNHERO() {
- uint16 heroId = readScript16bits();
- uint16 x = readScript16bits();
- uint16 y = readScript16bits();
- uint16 dir = readScript16bits();
+ uint16 heroId = readScript16bits();
+ uint16 x = readScript16bits();
+ uint16 y = readScript16bits();
+ uint16 dir = readScript16bits();
- debugScript("O_RUNHERO heroId %d, x %d, y %d, dir %d", heroId, x, y, dir);
+ debugScript("O_RUNHERO heroId %d, x %d, y %d, dir %d", heroId, x, y, dir);
}
void Script::O_SETBACKANIMDATA() {
- uint16 animId = readScript16bits();
- uint16 animOffset = readScript16bits();
- uint16 wart = readScript16bits();
+ uint16 animId = readScript16bits();
+ uint16 animOffset = readScript16bits();
+ uint16 wart = readScript16bits();
- debugScript("O_SETBACKANIMDATA animId %d, animOffset %d, wart %d", animId, animOffset, wart);
+ debugScript("O_SETBACKANIMDATA animId %d, animOffset %d, wart %d", animId, animOffset, wart);
}
void Script::O_VIEWFLC() {
- uint16 animNr = readScript16bits();
- debugScript("O_VIEWFLC animNr %d", animNr);
+ uint16 animNr = readScript16bits();
+ debug("O_VIEWFLC animNr %d", animNr);
+ _vm->loadAnim(animNr, false);
}
void Script::O_CHECKFLCFRAME() {
- uint16 frameNr = readScript16bits();
+ uint16 frameNr = readScript16bits();
- debugScript("O_CHECKFLCFRAME frame number %d", frameNr);
+ debugScript("O_CHECKFLCFRAME frame number %d", frameNr);
- const Video::FlicDecoder &flicPlayer = _vm->_flicPlayer;
+ const Video::FlicDecoder &flicPlayer = _vm->_flicPlayer;
- if (flicPlayer.getCurFrame() != frameNr)
- {
- // Move instruction pointer before current instruciton
- // must do this check once again till it's false
- _currentInstruction -= 2;
- }
+ if (flicPlayer.getCurFrame() != frameNr)
+ {
+ // Move instruction pointer before current instruciton
+ // must do this check once again till it's false
+ _currentInstruction -= 2;
+ _opcodeNF = 1;
+ }
}
void Script::O_CHECKFLCEND() {
- debugScript("O_CHECKFLCEND");
+ //debugScript("O_CHECKFLCEND");
- const Video::FlicDecoder &flicPlayer = _vm->_flicPlayer;
+ const Video::FlicDecoder &flicPlayer = _vm->_flicPlayer;
- if (flicPlayer.getFrameCount() - flicPlayer.getCurFrame() <= 1)
- {
- // Move instruction pointer before current instruciton
- // must do this check once again till it's false
- _currentInstruction -= 2;
- }
+ //debug("frameCount %d, currentFrame %d", flicPlayer.getFrameCount(), flicPlayer.getCurFrame());
+
+ if (flicPlayer.getFrameCount() - flicPlayer.getCurFrame() > 1)
+ {
+ // Move instruction pointer before current instruciton
+ // must do this check once again till it's false
+ _currentInstruction -= 2;
+ _opcodeNF = 1;
+ }
}
void Script::O_FREEFLC() {
- debugScript("O_FREEFLC");
+ debugScript("O_FREEFLC");
}
void Script::O_TALKHEROSTOP() {
- uint16 heroId = readScript16bits();
- debugScript("O_TALKHEROSTOP %d", heroId);
+ uint16 heroId = readScript16bits();
+ debugScript("O_TALKHEROSTOP %d", heroId);
}
void Script::O_HEROCOLOR() {
- uint16 heroId = readScript16bits();
- uint16 kolorr = readScript16bits();
- debugScript("O_HEROCOLOR heroId %d, kolorr %d", heroId, kolorr);
+ uint16 heroId = readScript16bits();
+ uint16 kolorr = readScript16bits();
+ debugScript("O_HEROCOLOR heroId %d, kolorr %d", heroId, kolorr);
}
void Script::O_GRABMAPA() {
- debugScript("O_GRABMAPA");
+ debugScript("O_GRABMAPA");
}
void Script::O_ENABLENAK() {
- uint16 nakId = readScript16bits();
- debugScript("O_ENABLENAK nakId %d", nakId);
+ uint16 nakId = readScript16bits();
+ debugScript("O_ENABLENAK nakId %d", nakId);
}
void Script::O_DISABLENAK() {
- uint16 nakId = readScript16bits();
- debugScript("O_DISABLENAK nakId %d", nakId);
+ uint16 nakId = readScript16bits();
+ debugScript("O_DISABLENAK nakId %d", nakId);
}
void Script::O_GETMOBNAME() {
- uint16 war = readScript16bits();
- debugScript("O_GETMOBNAME war %d", war);
+ uint16 war = readScript16bits();
+ debugScript("O_GETMOBNAME war %d", war);
}
void Script::O_SWAPINVENTORY() {
- uint16 heroId = readScript16bits();
- debugScript("O_SWAPINVENTORY heroId %d", heroId);
+ uint16 heroId = readScript16bits();
+ debugScript("O_SWAPINVENTORY heroId %d", heroId);
}
void Script::O_CLEARINVENTORY() {
- uint16 heroId = readScript16bits();
- debugScript("O_CLEARINVENTORY heroId %d", heroId);
+ uint16 heroId = readScript16bits();
+ debugScript("O_CLEARINVENTORY heroId %d", heroId);
}
void Script::O_SKIPTEXT() {
- debugScript("O_SKIPTEXT");
+ debugScript("O_SKIPTEXT");
+}
+
+void Script::SetVoice(uint32 slot) {
+
+ const uint16 VOICE_H_LINE = _flags[Flags::VOICE_H_LINE - 0x8000];
+
+ const Common::String streamName = Common::String::format("%03d-%02d.WAV", _currentString, VOICE_H_LINE);
+ debugScript("Loading wav %s slot %d", streamName.c_str(), slot);
+
+ _voiceStream = SearchMan.createReadStreamForMember(streamName);
+ if (!_voiceStream) {
+ error("Can't open %s", streamName.c_str());
+ }
+ uint32 id = _voiceStream->readUint32LE();
+ if (id != 0x46464952) {
+ error("It's not RIFF file %s", streamName.c_str());
+ return;
+ }
+
+ _voiceStream->skip(0x20);
+ id = _voiceStream->readUint32LE();
+ if (id != 0x61746164) {
+ error("No data section in %s id %04x", streamName.c_str(), id);
+ return;
+ }
+
+ id = _voiceStream->readUint32LE();
+ debugScript("SetVoice slot %d time %04x", slot, id);
+ id <<= 3;
+ id /= 22050;
+ id += 2;
+
+ _vm->_textSlots[slot]._time = id;
+
+ debugScript("SetVoice slot %d time %04x", slot, id);
+ _voiceStream->seek(0);
}
void Script::O_SETVOICEH() {
- uint16 txn = readScript16bits();
- debugScript("O_SETVOICEH txn %d", txn);
+ uint16 txn = readScript16bits();
+ debugScript("O_SETVOICEH txn %d", txn);
+ SetVoice(txn);
}
void Script::O_SETVOICEA() {
- uint16 txn = readScript16bits();
- debugScript("O_SETVOICEA txn %d", txn);
+ uint16 txn = readScript16bits();
+ debugScript("O_SETVOICEA txn %d", txn);
+ SetVoice(txn);
}
void Script::O_SETVOICEB() {
- uint16 txn = readScript16bits();
- debugScript("O_SETVOICEB txn %d", txn);
+ uint16 txn = readScript16bits();
+ debugScript("O_SETVOICEB txn %d", txn);
+ SetVoice(txn);
}
void Script::O_SETVOICEC() {
- uint16 txn = readScript16bits();
- debugScript("O_SETVOICEC txn %d", txn);
+ uint16 txn = readScript16bits();
+ debugScript("O_SETVOICEC txn %d", txn);
+ SetVoice(txn);
}
void Script::O_VIEWFLCLOOP() {
- uint16 animId = readScript16bits();
- debugScript("O_VIEWFLCLOOP animId %d", animId);
+ uint16 value = readScript16bits();
+ debugScript("O_VIEWFLCLOOP animId %d", value);
+
+ if (value & 0x8000) {
+ value = _flags[value - 0x8000];
+ }
+
+ _vm->loadAnim(value, true);
}
void Script::O_FLCSPEED() {
- uint16 speed = readScript16bits();
- debugScript("O_FLCSPEED speed %d", speed);
+ uint16 speed = readScript16bits();
+ debugScript("O_FLCSPEED speed %d", speed);
}
void Script::O_OPENINVENTORY() {
- debugScript("O_OPENINVENTORY");
+ debugScript("O_OPENINVENTORY");
+ _opcodeNF = 1;
}
void Script::O_KRZYWA() {
- debugScript("O_KRZYWA");
+ debugScript("O_KRZYWA");
}
void Script::O_GETKRZYWA() {
- debugScript("O_GETKRZYWA");
+ debugScript("O_GETKRZYWA");
}
void Script::O_GETMOB() {
- uint16 flagId = readScript16bits();
- uint16 mx = readScript16bits();
- uint16 my = readScript16bits();
- debugScript("O_GETMOB flagId %d, mx %d, my %d", flagId, mx, my);
+ uint16 flagId = readScript16bits();
+ uint16 mx = readScript16bits();
+ uint16 my = readScript16bits();
+ debugScript("O_GETMOB flagId %d, mx %d, my %d", flagId, mx, my);
}
void Script::O_INPUTLINE() {
- debugScript("O_INPUTLINE");
+ debugScript("O_INPUTLINE");
}
void Script::O_SETVOICED() {
- uint16 txn = readScript16bits();
- debugScript("O_SETVOICED txn %d", txn);
+ uint16 txn = readScript16bits();
+ debugScript("O_SETVOICED txn %d", txn);
+ SetVoice(txn);
}
void Script::O_BREAK_POINT() {
- debugScript("O_BREAK_POINT");
+ debugScript("O_BREAK_POINT");
}
Script::OpcodeFunc Script::_opcodes[NUM_OPCODES] = {
- &Script::O_WAITFOREVER,
- &Script::O_BLACKPALETTE,
- &Script::O_SETUPPALETTE,
- &Script::O_INITROOM,
- &Script::O_SETSAMPLE,
- &Script::O_FREESAMPLE,
- &Script::O_PLAYSAMPLE,
- &Script::O_PUTOBJECT,
- &Script::O_REMOBJECT,
- &Script::O_SHOWANIM,
- &Script::O_CHECKANIMEND,
- &Script::O_FREEANIM,
- &Script::O_CHECKANIMFRAME,
- &Script::O_PUTBACKANIM,
- &Script::O_REMBACKANIM,
- &Script::O_CHECKBACKANIMFRAME,
- &Script::O_FREEALLSAMPLES,
- &Script::O_SETMUSIC,
- &Script::O_STOPMUSIC,
- &Script::O__WAIT,
- &Script::O_UPDATEOFF,
- &Script::O_UPDATEON,
- &Script::O_UPDATE ,
- &Script::O_CLS,
- &Script::O__CALL,
- &Script::O_RETURN,
- &Script::O_GO,
- &Script::O_BACKANIMUPDATEOFF,
- &Script::O_BACKANIMUPDATEON,
- &Script::O_CHANGECURSOR,
- &Script::O_CHANGEANIMTYPE,
- &Script::O__SETFLAG,
- &Script::O_COMPARE,
- &Script::O_JUMPZ,
- &Script::O_JUMPNZ,
- &Script::O_EXIT,
- &Script::O_ADDFLAG,
- &Script::O_TALKANIM,
- &Script::O_SUBFLAG,
- &Script::O_SETSTRING,
- &Script::O_ANDFLAG,
- &Script::O_GETMOBDATA,
- &Script::O_ORFLAG,
- &Script::O_SETMOBDATA,
- &Script::O_XORFLAG,
- &Script::O_GETMOBTEXT,
- &Script::O_MOVEHERO,
- &Script::O_WALKHERO,
- &Script::O_SETHERO,
- &Script::O_HEROOFF,
- &Script::O_HEROON,
- &Script::O_CLSTEXT,
- &Script::O_CALLTABLE,
- &Script::O_CHANGEMOB,
- &Script::O_ADDINV,
- &Script::O_REMINV,
- &Script::O_REPINV,
- &Script::O_OBSOLETE_GETACTION,
- &Script::O_ADDWALKAREA,
- &Script::O_REMWALKAREA,
- &Script::O_RESTOREWALKAREA,
- &Script::O_WAITFRAME,
- &Script::O_SETFRAME,
- &Script::O_RUNACTION,
- &Script::O_COMPAREHI,
- &Script::O_COMPARELO,
- &Script::O_PRELOADSET,
- &Script::O_FREEPRELOAD,
- &Script::O_CHECKINV,
- &Script::O_TALKHERO,
- &Script::O_WAITTEXT,
- &Script::O_SETHEROANIM,
- &Script::O_WAITHEROANIM,
- &Script::O_GETHERODATA,
- &Script::O_GETMOUSEBUTTON,
- &Script::O_CHANGEFRAMES,
- &Script::O_CHANGEBACKFRAMES,
- &Script::O_GETBACKANIMDATA,
- &Script::O_GETANIMDATA,
- &Script::O_SETBGCODE,
- &Script::O_SETBACKFRAME,
- &Script::O_GETRND,
- &Script::O_TALKBACKANIM,
- &Script::O_LOADPATH,
- &Script::O_GETCHAR,
- &Script::O_SETDFLAG,
- &Script::O_CALLDFLAG,
- &Script::O_PRINTAT,
- &Script::O_ZOOMIN,
- &Script::O_ZOOMOUT,
- &Script::O_SETSTRINGOFFSET,
- &Script::O_GETOBJDATA,
- &Script::O_SETOBJDATA,
- &Script::O_SWAPOBJECTS,
- &Script::O_CHANGEHEROSET,
- &Script::O_ADDSTRING,
- &Script::O_SUBSTRING,
- &Script::O_INITDIALOG,
- &Script::O_ENABLEDIALOGOPT,
- &Script::O_DISABLEDIALOGOPT,
- &Script::O_SHOWDIALOGBOX,
- &Script::O_STOPSAMPLE,
- &Script::O_BACKANIMRANGE,
- &Script::O_CLEARPATH,
- &Script::O_SETPATH,
- &Script::O_GETHEROX,
- &Script::O_GETHEROY,
- &Script::O_GETHEROD,
- &Script::O_PUSHSTRING,
- &Script::O_POPSTRING,
- &Script::O_SETFGCODE,
- &Script::O_STOPHERO,
- &Script::O_ANIMUPDATEOFF,
- &Script::O_ANIMUPDATEON,
- &Script::O_FREECURSOR,
- &Script::O_ADDINVQUIET,
- &Script::O_RUNHERO,
- &Script::O_SETBACKANIMDATA,
- &Script::O_VIEWFLC,
- &Script::O_CHECKFLCFRAME,
- &Script::O_CHECKFLCEND,
- &Script::O_FREEFLC,
- &Script::O_TALKHEROSTOP,
- &Script::O_HEROCOLOR,
- &Script::O_GRABMAPA,
- &Script::O_ENABLENAK,
- &Script::O_DISABLENAK,
- &Script::O_GETMOBNAME,
- &Script::O_SWAPINVENTORY,
- &Script::O_CLEARINVENTORY,
- &Script::O_SKIPTEXT,
- &Script::O_SETVOICEH,
- &Script::O_SETVOICEA,
- &Script::O_SETVOICEB,
- &Script::O_SETVOICEC,
- &Script::O_VIEWFLCLOOP,
- &Script::O_FLCSPEED,
- &Script::O_OPENINVENTORY,
- &Script::O_KRZYWA,
- &Script::O_GETKRZYWA,
- &Script::O_GETMOB,
- &Script::O_INPUTLINE,
- &Script::O_SETVOICED,
- &Script::O_BREAK_POINT,
+ &Script::O_WAITFOREVER,
+ &Script::O_BLACKPALETTE,
+ &Script::O_SETUPPALETTE,
+ &Script::O_INITROOM,
+ &Script::O_SETSAMPLE,
+ &Script::O_FREESAMPLE,
+ &Script::O_PLAYSAMPLE,
+ &Script::O_PUTOBJECT,
+ &Script::O_REMOBJECT,
+ &Script::O_SHOWANIM,
+ &Script::O_CHECKANIMEND,
+ &Script::O_FREEANIM,
+ &Script::O_CHECKANIMFRAME,
+ &Script::O_PUTBACKANIM,
+ &Script::O_REMBACKANIM,
+ &Script::O_CHECKBACKANIMFRAME,
+ &Script::O_FREEALLSAMPLES,
+ &Script::O_SETMUSIC,
+ &Script::O_STOPMUSIC,
+ &Script::O__WAIT,
+ &Script::O_UPDATEOFF,
+ &Script::O_UPDATEON,
+ &Script::O_UPDATE ,
+ &Script::O_CLS,
+ &Script::O__CALL,
+ &Script::O_RETURN,
+ &Script::O_GO,
+ &Script::O_BACKANIMUPDATEOFF,
+ &Script::O_BACKANIMUPDATEON,
+ &Script::O_CHANGECURSOR,
+ &Script::O_CHANGEANIMTYPE,
+ &Script::O__SETFLAG,
+ &Script::O_COMPARE,
+ &Script::O_JUMPZ,
+ &Script::O_JUMPNZ,
+ &Script::O_EXIT,
+ &Script::O_ADDFLAG,
+ &Script::O_TALKANIM,
+ &Script::O_SUBFLAG,
+ &Script::O_SETSTRING,
+ &Script::O_ANDFLAG,
+ &Script::O_GETMOBDATA,
+ &Script::O_ORFLAG,
+ &Script::O_SETMOBDATA,
+ &Script::O_XORFLAG,
+ &Script::O_GETMOBTEXT,
+ &Script::O_MOVEHERO,
+ &Script::O_WALKHERO,
+ &Script::O_SETHERO,
+ &Script::O_HEROOFF,
+ &Script::O_HEROON,
+ &Script::O_CLSTEXT,
+ &Script::O_CALLTABLE,
+ &Script::O_CHANGEMOB,
+ &Script::O_ADDINV,
+ &Script::O_REMINV,
+ &Script::O_REPINV,
+ &Script::O_OBSOLETE_GETACTION,
+ &Script::O_ADDWALKAREA,
+ &Script::O_REMWALKAREA,
+ &Script::O_RESTOREWALKAREA,
+ &Script::O_WAITFRAME,
+ &Script::O_SETFRAME,
+ &Script::O_RUNACTION,
+ &Script::O_COMPAREHI,
+ &Script::O_COMPARELO,
+ &Script::O_PRELOADSET,
+ &Script::O_FREEPRELOAD,
+ &Script::O_CHECKINV,
+ &Script::O_TALKHERO,
+ &Script::O_WAITTEXT,
+ &Script::O_SETHEROANIM,
+ &Script::O_WAITHEROANIM,
+ &Script::O_GETHERODATA,
+ &Script::O_GETMOUSEBUTTON,
+ &Script::O_CHANGEFRAMES,
+ &Script::O_CHANGEBACKFRAMES,
+ &Script::O_GETBACKANIMDATA,
+ &Script::O_GETANIMDATA,
+ &Script::O_SETBGCODE,
+ &Script::O_SETBACKFRAME,
+ &Script::O_GETRND,
+ &Script::O_TALKBACKANIM,
+ &Script::O_LOADPATH,
+ &Script::O_GETCHAR,
+ &Script::O_SETDFLAG,
+ &Script::O_CALLDFLAG,
+ &Script::O_PRINTAT,
+ &Script::O_ZOOMIN,
+ &Script::O_ZOOMOUT,
+ &Script::O_SETSTRINGOFFSET,
+ &Script::O_GETOBJDATA,
+ &Script::O_SETOBJDATA,
+ &Script::O_SWAPOBJECTS,
+ &Script::O_CHANGEHEROSET,
+ &Script::O_ADDSTRING,
+ &Script::O_SUBSTRING,
+ &Script::O_INITDIALOG,
+ &Script::O_ENABLEDIALOGOPT,
+ &Script::O_DISABLEDIALOGOPT,
+ &Script::O_SHOWDIALOGBOX,
+ &Script::O_STOPSAMPLE,
+ &Script::O_BACKANIMRANGE,
+ &Script::O_CLEARPATH,
+ &Script::O_SETPATH,
+ &Script::O_GETHEROX,
+ &Script::O_GETHEROY,
+ &Script::O_GETHEROD,
+ &Script::O_PUSHSTRING,
+ &Script::O_POPSTRING,
+ &Script::O_SETFGCODE,
+ &Script::O_STOPHERO,
+ &Script::O_ANIMUPDATEOFF,
+ &Script::O_ANIMUPDATEON,
+ &Script::O_FREECURSOR,
+ &Script::O_ADDINVQUIET,
+ &Script::O_RUNHERO,
+ &Script::O_SETBACKANIMDATA,
+ &Script::O_VIEWFLC,
+ &Script::O_CHECKFLCFRAME,
+ &Script::O_CHECKFLCEND,
+ &Script::O_FREEFLC,
+ &Script::O_TALKHEROSTOP,
+ &Script::O_HEROCOLOR,
+ &Script::O_GRABMAPA,
+ &Script::O_ENABLENAK,
+ &Script::O_DISABLENAK,
+ &Script::O_GETMOBNAME,
+ &Script::O_SWAPINVENTORY,
+ &Script::O_CLEARINVENTORY,
+ &Script::O_SKIPTEXT,
+ &Script::O_SETVOICEH,
+ &Script::O_SETVOICEA,
+ &Script::O_SETVOICEB,
+ &Script::O_SETVOICEC,
+ &Script::O_VIEWFLCLOOP,
+ &Script::O_FLCSPEED,
+ &Script::O_OPENINVENTORY,
+ &Script::O_KRZYWA,
+ &Script::O_GETKRZYWA,
+ &Script::O_GETMOB,
+ &Script::O_INPUTLINE,
+ &Script::O_SETVOICED,
+ &Script::O_BREAK_POINT,
};
}
+/* vim: set tabstop=4 noexpandtab: */
diff --git a/engines/prince/script.h b/engines/prince/script.h
index 43d5759a0b..984b2d93e9 100644
--- a/engines/prince/script.h
+++ b/engines/prince/script.h
@@ -25,200 +25,221 @@
#include "common/random.h"
+#include "audio/mixer.h"
+
+#include "prince/flags.h"
+
namespace Common {
- class SeekableReadStream;
+ class SeekableReadStream;
}
namespace Prince {
class PrinceEngine;
-class Script
-{
+class Script {
public:
- Script(PrinceEngine *vm);
- virtual ~Script();
+ Script(PrinceEngine *vm);
+ virtual ~Script();
- bool loadFromStream(Common::SeekableReadStream &stream);
+ bool loadFromStream(Common::SeekableReadStream &stream);
- void step();
+ void step();
+ void setFlag(Flags::Id flag, uint16 value);
private:
- PrinceEngine *_vm;
-
- byte *_code;
- uint32 _codeSize;
- uint32 _currentInstruction;
- uint16 _lastOpcode;
- uint32 _lastInstruction;
- byte _result;
- int16 _flags[2000];
- bool _opcodeNF;
-
- // Stack
- static const uint32 _STACK_SIZE = 500;
- uint16 _stack[_STACK_SIZE];
- uint8 _stacktop;
- uint8 _savedStacktop;
-
- // Helper functions
- void checkPC(uint32 address);
- uint8 getCodeByte(uint32 address);
- uint8 readScript8bits();
- uint16 readScript16bits();
- uint32 readScript32bits();
- uint16 readScript8or16bits();
- void debugScript(const char *s, ...);
-
- typedef void (Script::*OpcodeFunc)();
- static OpcodeFunc _opcodes[];
-
- void O_WAITFOREVER();
- void O_BLACKPALETTE();
- void O_SETUPPALETTE();
- void O_INITROOM();
- void O_SETSAMPLE();
- void O_FREESAMPLE();
- void O_PLAYSAMPLE();
- void O_PUTOBJECT();
- void O_REMOBJECT();
- void O_SHOWANIM();
- void O_CHECKANIMEND();
- void O_FREEANIM();
- void O_CHECKANIMFRAME();
- void O_PUTBACKANIM();
- void O_REMBACKANIM();
- void O_CHECKBACKANIMFRAME();
- void O_FREEALLSAMPLES();
- void O_SETMUSIC();
- void O_STOPMUSIC();
- void O__WAIT();
- void O_UPDATEOFF();
- void O_UPDATEON();
- void O_UPDATE ();
- void O_CLS();
- void O__CALL();
- void O_RETURN();
- void O_GO();
- void O_BACKANIMUPDATEOFF();
- void O_BACKANIMUPDATEON();
- void O_CHANGECURSOR();
- void O_CHANGEANIMTYPE();
- void O__SETFLAG();
- void O_COMPARE();
- void O_JUMPZ();
- void O_JUMPNZ();
- void O_EXIT();
- void O_ADDFLAG();
- void O_TALKANIM();
- void O_SUBFLAG();
- void O_SETSTRING();
- void O_ANDFLAG();
- void O_GETMOBDATA();
- void O_ORFLAG();
- void O_SETMOBDATA();
- void O_XORFLAG();
- void O_GETMOBTEXT();
- void O_MOVEHERO();
- void O_WALKHERO();
- void O_SETHERO();
- void O_HEROOFF();
- void O_HEROON();
- void O_CLSTEXT();
- void O_CALLTABLE();
- void O_CHANGEMOB();
- void O_ADDINV();
- void O_REMINV();
- void O_REPINV();
- void O_OBSOLETE_GETACTION();
- void O_ADDWALKAREA();
- void O_REMWALKAREA();
- void O_RESTOREWALKAREA();
- void O_WAITFRAME();
- void O_SETFRAME();
- void O_RUNACTION();
- void O_COMPAREHI();
- void O_COMPARELO();
- void O_PRELOADSET();
- void O_FREEPRELOAD();
- void O_CHECKINV();
- void O_TALKHERO();
- void O_WAITTEXT();
- void O_SETHEROANIM();
- void O_WAITHEROANIM();
- void O_GETHERODATA();
- void O_GETMOUSEBUTTON();
- void O_CHANGEFRAMES();
- void O_CHANGEBACKFRAMES();
- void O_GETBACKANIMDATA();
- void O_GETANIMDATA();
- void O_SETBGCODE();
- void O_SETBACKFRAME();
- void O_GETRND();
- void O_TALKBACKANIM();
- void O_LOADPATH();
- void O_GETCHAR();
- void O_SETDFLAG();
- void O_CALLDFLAG();
- void O_PRINTAT();
- void O_ZOOMIN();
- void O_ZOOMOUT();
- void O_SETSTRINGOFFSET();
- void O_GETOBJDATA();
- void O_SETOBJDATA();
- void O_SWAPOBJECTS();
- void O_CHANGEHEROSET();
- void O_ADDSTRING();
- void O_SUBSTRING();
- void O_INITDIALOG();
- void O_ENABLEDIALOGOPT();
- void O_DISABLEDIALOGOPT();
- void O_SHOWDIALOGBOX();
- void O_STOPSAMPLE();
- void O_BACKANIMRANGE();
- void O_CLEARPATH();
- void O_SETPATH();
- void O_GETHEROX();
- void O_GETHEROY();
- void O_GETHEROD();
- void O_PUSHSTRING();
- void O_POPSTRING();
- void O_SETFGCODE();
- void O_STOPHERO();
- void O_ANIMUPDATEOFF();
- void O_ANIMUPDATEON();
- void O_FREECURSOR();
- void O_ADDINVQUIET();
- void O_RUNHERO();
- void O_SETBACKANIMDATA();
- void O_VIEWFLC();
- void O_CHECKFLCFRAME();
- void O_CHECKFLCEND();
- void O_FREEFLC();
- void O_TALKHEROSTOP();
- void O_HEROCOLOR();
- void O_GRABMAPA();
- void O_ENABLENAK();
- void O_DISABLENAK();
- void O_GETMOBNAME();
- void O_SWAPINVENTORY();
- void O_CLEARINVENTORY();
- void O_SKIPTEXT();
- void O_SETVOICEH();
- void O_SETVOICEA();
- void O_SETVOICEB();
- void O_SETVOICEC();
- void O_VIEWFLCLOOP();
- void O_FLCSPEED();
- void O_OPENINVENTORY();
- void O_KRZYWA();
- void O_GETKRZYWA();
- void O_GETMOB();
- void O_INPUTLINE();
- void O_SETVOICED();
- void O_BREAK_POINT();
+ PrinceEngine *_vm;
+
+ byte *_code;
+ uint32 _codeSize;
+ uint32 _currentInstruction;
+
+ uint32 _bgOpcodePC;
+ uint32 _fgOpcodePC;
+
+ uint16 _lastOpcode;
+ uint32 _lastInstruction;
+ byte _result;
+ int16 _flags[2000];
+ bool _opcodeNF;
+
+
+ // Stack
+ static const uint32 _STACK_SIZE = 500;
+ uint32 _stack[_STACK_SIZE];
+ uint8 _stacktop;
+ uint8 _savedStacktop;
+ uint32 _waitFlag;
+ Audio::SoundHandle _soundHandle;
+
+ const byte * _string;
+ uint32 _currentString;
+ Common::SeekableReadStream *_voiceStream;
+
+ // Helper functions
+ uint32 step(uint32 opcodePC);
+ void checkPC(uint32 address);
+ uint8 getCodeByte(uint32 address);
+ uint8 readScript8bits();
+ uint16 readScript16bits();
+ uint32 readScript32bits();
+ uint16 readScript8or16bits();
+ void debugScript(const char *s, ...);
+ void SetVoice(uint32 slot);
+
+ typedef void (Script::*OpcodeFunc)();
+ static OpcodeFunc _opcodes[];
+
+ // Keep opcode handlers names as they are in original code
+ // it easier to switch back and forth
+ void O_WAITFOREVER();
+ void O_BLACKPALETTE();
+ void O_SETUPPALETTE();
+ void O_INITROOM();
+ void O_SETSAMPLE();
+ void O_FREESAMPLE();
+ void O_PLAYSAMPLE();
+ void O_PUTOBJECT();
+ void O_REMOBJECT();
+ void O_SHOWANIM();
+ void O_CHECKANIMEND();
+ void O_FREEANIM();
+ void O_CHECKANIMFRAME();
+ void O_PUTBACKANIM();
+ void O_REMBACKANIM();
+ void O_CHECKBACKANIMFRAME();
+ void O_FREEALLSAMPLES();
+ void O_SETMUSIC();
+ void O_STOPMUSIC();
+ void O__WAIT();
+ void O_UPDATEOFF();
+ void O_UPDATEON();
+ void O_UPDATE ();
+ void O_CLS();
+ void O__CALL();
+ void O_RETURN();
+ void O_GO();
+ void O_BACKANIMUPDATEOFF();
+ void O_BACKANIMUPDATEON();
+ void O_CHANGECURSOR();
+ void O_CHANGEANIMTYPE();
+ void O__SETFLAG();
+ void O_COMPARE();
+ void O_JUMPZ();
+ void O_JUMPNZ();
+ void O_EXIT();
+ void O_ADDFLAG();
+ void O_TALKANIM();
+ void O_SUBFLAG();
+ void O_SETSTRING();
+ void O_ANDFLAG();
+ void O_GETMOBDATA();
+ void O_ORFLAG();
+ void O_SETMOBDATA();
+ void O_XORFLAG();
+ void O_GETMOBTEXT();
+ void O_MOVEHERO();
+ void O_WALKHERO();
+ void O_SETHERO();
+ void O_HEROOFF();
+ void O_HEROON();
+ void O_CLSTEXT();
+ void O_CALLTABLE();
+ void O_CHANGEMOB();
+ void O_ADDINV();
+ void O_REMINV();
+ void O_REPINV();
+ void O_OBSOLETE_GETACTION();
+ void O_ADDWALKAREA();
+ void O_REMWALKAREA();
+ void O_RESTOREWALKAREA();
+ void O_WAITFRAME();
+ void O_SETFRAME();
+ void O_RUNACTION();
+ void O_COMPAREHI();
+ void O_COMPARELO();
+ void O_PRELOADSET();
+ void O_FREEPRELOAD();
+ void O_CHECKINV();
+ void O_TALKHERO();
+ void O_WAITTEXT();
+ void O_SETHEROANIM();
+ void O_WAITHEROANIM();
+ void O_GETHERODATA();
+ void O_GETMOUSEBUTTON();
+ void O_CHANGEFRAMES();
+ void O_CHANGEBACKFRAMES();
+ void O_GETBACKANIMDATA();
+ void O_GETANIMDATA();
+ void O_SETBGCODE();
+ void O_SETBACKFRAME();
+ void O_GETRND();
+ void O_TALKBACKANIM();
+ void O_LOADPATH();
+ void O_GETCHAR();
+ void O_SETDFLAG();
+ void O_CALLDFLAG();
+ void O_PRINTAT();
+ void O_ZOOMIN();
+ void O_ZOOMOUT();
+ void O_SETSTRINGOFFSET();
+ void O_GETOBJDATA();
+ void O_SETOBJDATA();
+ void O_SWAPOBJECTS();
+ void O_CHANGEHEROSET();
+ void O_ADDSTRING();
+ void O_SUBSTRING();
+ void O_INITDIALOG();
+ void O_ENABLEDIALOGOPT();
+ void O_DISABLEDIALOGOPT();
+ void O_SHOWDIALOGBOX();
+ void O_STOPSAMPLE();
+ void O_BACKANIMRANGE();
+ void O_CLEARPATH();
+ void O_SETPATH();
+ void O_GETHEROX();
+ void O_GETHEROY();
+ void O_GETHEROD();
+ void O_PUSHSTRING();
+ void O_POPSTRING();
+ void O_SETFGCODE();
+ void O_STOPHERO();
+ void O_ANIMUPDATEOFF();
+ void O_ANIMUPDATEON();
+ void O_FREECURSOR();
+ void O_ADDINVQUIET();
+ void O_RUNHERO();
+ void O_SETBACKANIMDATA();
+ void O_VIEWFLC();
+ void O_CHECKFLCFRAME();
+ void O_CHECKFLCEND();
+ void O_FREEFLC();
+ void O_TALKHEROSTOP();
+ void O_HEROCOLOR();
+ void O_GRABMAPA();
+ void O_ENABLENAK();
+ void O_DISABLENAK();
+ void O_GETMOBNAME();
+ void O_SWAPINVENTORY();
+ void O_CLEARINVENTORY();
+ void O_SKIPTEXT();
+ void O_SETVOICEH();
+ void O_SETVOICEA();
+ void O_SETVOICEB();
+ void O_SETVOICEC();
+ void O_VIEWFLCLOOP();
+ void O_FLCSPEED();
+ void O_OPENINVENTORY();
+ void O_KRZYWA();
+ void O_GETKRZYWA();
+ void O_GETMOB();
+ void O_INPUTLINE();
+ void O_SETVOICED();
+ void O_BREAK_POINT();
};
}
#endif
+
+/* vim: set tabstop=4 noexpandtab: */
diff --git a/engines/prince/sound.cpp b/engines/prince/sound.cpp
new file mode 100644
index 0000000000..40f182e630
--- /dev/null
+++ b/engines/prince/sound.cpp
@@ -0,0 +1,216 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+/*
+ * This code is based on original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#include "prince/prince.h"
+#include "prince/sound.h"
+#include "prince/musNum.h"
+
+#include "common/config-manager.h"
+#include "common/memstream.h"
+#include "common/archive.h"
+#include "audio/decoders/raw.h"
+#include "audio/audiostream.h"
+
+namespace Prince {
+
+const char * MusicPlayer::_musTable[] = {
+ "",
+ "Battlfld.mid",
+ "Cave.mid",
+ "Cemetery.mid",
+ "Credits.mid",
+ "Fjord.mid",
+ "Guitar.mid",
+ "Hell.mid",
+ "Jingle.mid",
+ "Main.mid",
+ "Night.mid",
+ "Reality.mid",
+ "Sunlord.mid",
+ "Tavern.mid",
+ "Temple.mid",
+ "Boruta.mid",
+ "Intro.mid"
+};
+
+const uint8 MusicPlayer::_musRoomTable[] = {
+ 0,
+ ROOM01MUS,
+ ROOM02MUS,
+ ROOM03MUS,
+ ROOM04MUS,
+ ROOM05MUS,
+ ROOM06MUS,
+ ROOM07MUS,
+ ROOM08MUS,
+ ROOM09MUS,
+ ROOM10MUS,
+ ROOM11MUS,
+ ROOM12MUS,
+ ROOM13MUS,
+ ROOM14MUS,
+ ROOM15MUS,
+ ROOM16MUS,
+ ROOM17MUS,
+ ROOM18MUS,
+ ROOM19MUS,
+ ROOM20MUS,
+ ROOM21MUS,
+ ROOM22MUS,
+ ROOM23MUS,
+ ROOM24MUS,
+ ROOM25MUS,
+ ROOM26MUS,
+ ROOM27MUS,
+ ROOM28MUS,
+ ROOM29MUS,
+ ROOM30MUS,
+ ROOM31MUS,
+ ROOM32MUS,
+ ROOM33MUS,
+ ROOM34MUS,
+ ROOM35MUS,
+ ROOM36MUS,
+ ROOM37MUS,
+ ROOM38MUS,
+ ROOM39MUS,
+ ROOM40MUS,
+ ROOM41MUS,
+ ROOM42MUS,
+ ROOM43MUS,
+ 0,
+ 0,
+ ROOM46MUS,
+ ROOM47MUS,
+ ROOM48MUS,
+ ROOM49MUS,
+ ROOM50MUS,
+ ROOM51MUS,
+ ROOM52MUS,
+ ROOM53MUS,
+ ROOM54MUS,
+ ROOM55MUS,
+ ROOM56MUS,
+ ROOM57MUS,
+ ROOM58MUS,
+ ROOM59MUS,
+ ROOM60MUS,
+ ROOM61MUS
+};
+
+
+MusicPlayer::MusicPlayer(PrinceEngine *vm) : _vm(vm) {
+ _data = NULL;
+ _isGM = false;
+
+ MidiPlayer::createDriver();
+
+ int ret = _driver->open();
+ if (ret == 0) {
+ if (_nativeMT32)
+ _driver->sendMT32Reset();
+ else
+ _driver->sendGMReset();
+
+ // TODO: Load cmf.ins with the instrument table. It seems that an
+ // interface for such an operation is supported for AdLib. Maybe for
+ // this card, setting instruments is necessary.
+
+ _driver->setTimerCallback(this, &timerCallback);
+ }
+}
+
+MusicPlayer::~MusicPlayer() {
+ killMidi();
+}
+
+void MusicPlayer::killMidi() {
+ Audio::MidiPlayer::stop();
+
+ free(_data);
+ _data = NULL;
+}
+
+void MusicPlayer::loadMidi(const char * name) {
+ Common::SeekableReadStream * stream = SearchMan.createReadStreamForMember(name);
+ if (!stream)
+ return;
+
+ // Stop any currently playing MIDI file
+ killMidi();
+
+ // Read in the data for the file
+ _dataSize = stream->size();
+ _data = (byte *)malloc(_dataSize);
+ stream->read(_data, _dataSize);
+
+ // Start playing the music
+ sndMidiStart();
+}
+
+void MusicPlayer::sndMidiStart() {
+ _isGM = true;
+
+ MidiParser *parser = MidiParser::createParser_SMF();
+ if (parser->loadMusic(_data, _dataSize)) {
+ parser->setTrack(0);
+ parser->setMidiDriver(this);
+ parser->setTimerRate(_driver->getBaseTempo());
+ parser->property(MidiParser::mpCenterPitchWheelOnUnload, 1);
+
+ _parser = parser;
+
+ syncVolume();
+
+ // Al the tracks are supposed to loop
+ _isLooping = true;
+ _isPlaying = true;
+ }
+}
+
+void MusicPlayer::send(uint32 b) {
+ if ((b & 0xF0) == 0xC0 && !_isGM && !_nativeMT32) {
+ b = (b & 0xFFFF00FF) | MidiDriver::_mt32ToGm[(b >> 8) & 0xFF] << 8;
+ }
+
+ Audio::MidiPlayer::send(b);
+}
+
+void MusicPlayer::sendToChannel(byte channel, uint32 b) {
+ if (!_channelsTable[channel]) {
+ _channelsTable[channel] = (channel == 9) ? _driver->getPercussionChannel() : _driver->allocateChannel();
+ // If a new channel is allocated during the playback, make sure
+ // its volume is correctly initialized.
+ if (_channelsTable[channel])
+ _channelsTable[channel]->volume(_channelsVolume[channel] * _masterVolume / 255);
+ }
+
+ if (_channelsTable[channel])
+ _channelsTable[channel]->send(b);
+}
+
+} // End of namespace CGE
diff --git a/engines/prince/sound.h b/engines/prince/sound.h
new file mode 100644
index 0000000000..7219411b36
--- /dev/null
+++ b/engines/prince/sound.h
@@ -0,0 +1,73 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+/*
+ * This code is based on original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#ifndef PRINCE_SOUND_H
+#define PRINCE_SOUND_H
+
+#include "audio/audiostream.h"
+#include "audio/decoders/wave.h"
+#include "audio/fmopl.h"
+#include "audio/mididrv.h"
+#include "audio/midiparser.h"
+#include "audio/midiplayer.h"
+#include "audio/mixer.h"
+#include "common/memstream.h"
+
+namespace Prince {
+
+class PrinceEngine;
+
+class MusicPlayer: public Audio::MidiPlayer {
+private:
+ PrinceEngine *_vm;
+ byte *_data;
+ int _dataSize;
+ bool _isGM;
+
+ // Start MIDI File
+ void sndMidiStart();
+
+ // Stop MIDI File
+ void sndMidiStop();
+public:
+ MusicPlayer(PrinceEngine *vm);
+ ~MusicPlayer();
+
+ void loadMidi(const char *);
+ void killMidi();
+
+ virtual void send(uint32 b);
+ virtual void sendToChannel(byte channel, uint32 b);
+
+ static const char * _musTable[];
+ static const uint8 _musRoomTable[];
+};
+
+} // End of namespace Prince
+
+#endif
+
diff --git a/engines/prince/variatxt.cpp b/engines/prince/variatxt.cpp
new file mode 100644
index 0000000000..0788d449e3
--- /dev/null
+++ b/engines/prince/variatxt.cpp
@@ -0,0 +1,59 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "prince/variatxt.h"
+#include "common/debug.h"
+
+namespace Prince {
+
+VariaTxt::VariaTxt() : _dataSize(0), _data(NULL) {
+}
+
+VariaTxt::~VariaTxt() {
+ _dataSize = 0;
+ delete[] _data;
+ _dataSize = NULL;
+}
+
+
+bool VariaTxt::loadFromStream(Common::SeekableReadStream &stream) {
+ _dataSize = stream.size();
+ _data = new byte [_dataSize];
+ stream.read(_data, _dataSize);
+ return true;
+}
+
+const char * VariaTxt::getString(uint32 stringId) {
+ uint32 stringOffset = READ_LE_UINT32(_data + stringId);
+
+ if (stringOffset > _dataSize) {
+ assert(false);
+ }
+
+ debug("VariaTxt::getString %04X %04X", stringId, stringOffset);
+
+ return (const char *)_data + stringOffset;
+}
+
+}
+
+/* vim: set tabstop=4 noexpandtab: */
diff --git a/engines/prince/variatxt.h b/engines/prince/variatxt.h
new file mode 100644
index 0000000000..dcdba7bd8a
--- /dev/null
+++ b/engines/prince/variatxt.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/stream.h"
+
+namespace Prince {
+
+class VariaTxt {
+public:
+ VariaTxt();
+
+ ~VariaTxt();
+
+ bool loadFromStream(Common::SeekableReadStream &stream);
+
+ const char * getString(uint32 stringId);
+
+private:
+ uint32 _dataSize;
+ byte *_data;
+};
+
+}
+
+/* vim: set tabstop=4 noexpandtab: */
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 50fae61de0..80d8ab8257 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -3840,10 +3840,15 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeV
const char *tmp = Common::find(str_objname.begin(), str_objname.end(), '.');
if (tmp != str_objname.end()) {
index = strtol(tmp + 1, &endptr, 16);
- if (*endptr)
- return -1;
- // Chop off the index
- str_objname = Common::String(str_objname.c_str(), tmp);
+ if (*endptr) {
+ // The characters after the dot do not represent an index.
+ // This can happen if an object contains a dot in its name,
+ // like 'dominoes.opt' in Hoyle 3.
+ index = -1;
+ } else {
+ // Valid index found, chop it off
+ str_objname = Common::String(str_objname.c_str(), tmp);
+ }
}
// Replace all underscores in the name with spaces
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index d7858180f1..39244bd760 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -421,7 +421,7 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_CALL(PrevNode), SIG_EVERYWHERE, "n", NULL, NULL },
{ MAP_CALL(PriCoord), SIG_EVERYWHERE, "i", NULL, NULL },
{ MAP_CALL(Random), SIG_EVERYWHERE, "i(i)(i)", NULL, NULL },
- { MAP_CALL(ReadNumber), SIG_EVERYWHERE, "r", NULL, NULL },
+ { MAP_CALL(ReadNumber), SIG_EVERYWHERE, "r", NULL, kReadNumber_workarounds },
{ MAP_CALL(RemapColors), SIG_SCI11, SIGFOR_ALL, "i(i)(i)(i)(i)", NULL, NULL },
#ifdef ENABLE_SCI32
{ "RemapColors", kRemapColors32, SIG_SCI32, SIGFOR_ALL, "i(i)(i)(i)(i)(i)", NULL, NULL },
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp
index 36d2841b07..6616a0ee13 100644
--- a/engines/sci/engine/script.cpp
+++ b/engines/sci/engine/script.cpp
@@ -136,7 +136,7 @@ void Script::load(int script_nr, ResourceManager *resMan) {
memcpy(_buf, script->data, script->size);
// Check scripts for matching signatures and patch those, if found
- matchSignatureAndPatch(_nr, _buf, script->size);
+ patcherProcessScript(_nr, _buf, script->size);
if (getSciVersion() >= SCI_VERSION_1_1 && getSciVersion() <= SCI_VERSION_2_1) {
Resource *heap = resMan->findResource(ResourceId(kResourceTypeHeap, _nr), 0);
diff --git a/engines/sci/engine/script.h b/engines/sci/engine/script.h
index 0b499203c2..56a9004226 100644
--- a/engines/sci/engine/script.h
+++ b/engines/sci/engine/script.h
@@ -30,7 +30,7 @@ namespace Sci {
struct EngineState;
class ResourceManager;
-struct SciScriptSignature;
+struct SciScriptPatcherEntry;
enum ScriptObjectTypes {
SCI_OBJ_TERMINATOR,
@@ -98,9 +98,10 @@ public:
void freeScript();
void load(int script_nr, ResourceManager *resMan);
- void matchSignatureAndPatch(uint16 scriptNr, byte *scriptData, const uint32 scriptSize);
- int32 findSignature(const SciScriptSignature *signature, const byte *scriptData, const uint32 scriptSize);
- void applyPatch(const uint16 *patch, byte *scriptData, const uint32 scriptSize, int32 signatureOffset);
+ void patcherProcessScript(uint16 scriptNr, byte *scriptData, const uint32 scriptSize);
+ void patcherInitSignature(SciScriptPatcherEntry *patchTable, bool isMacSci11);
+ int32 patcherFindSignature(const SciScriptPatcherEntry *patchEntry, const byte *scriptData, const uint32 scriptSize, bool isMacSci11);
+ void patcherApplyPatch(const SciScriptPatcherEntry *patchEntry, byte *scriptData, const uint32 scriptSize, int32 signatureOffset, bool isMacSci11);
virtual bool isValidOffset(uint16 offset) const;
virtual SegmentRef dereference(reg_t pointer);
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index d2c3356d54..ac42764e5b 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -21,6 +21,7 @@
*/
#include "sci/sci.h"
+#include "sci/engine/kernel.h"
#include "sci/engine/script.h"
#include "sci/engine/state.h"
#include "sci/engine/features.h"
@@ -29,34 +30,88 @@
namespace Sci {
-#define PATCH_END 0xFFFF
-#define PATCH_COMMANDMASK 0xF000
-#define PATCH_VALUEMASK 0x0FFF
-#define PATCH_ADDTOOFFSET 0xE000
-#define PATCH_GETORIGINALBYTE 0xD000
-#define PATCH_ADJUSTWORD 0xC000
-#define PATCH_ADJUSTWORD_NEG 0xB000
-#define PATCH_MAGICDWORD(a, b, c, d) CONSTANT_LE_32(a | (b << 8) | (c << 16) | (d << 24))
+#define SIG_END 0xFFFF
+#define SIG_MISMATCH 0xFFFE
+#define SIG_COMMANDMASK 0xF000
+#define SIG_VALUEMASK 0x0FFF
+#define SIG_BYTEMASK 0x00FF
+#define SIG_MAGICDWORD 0xF000
+#define SIG_ADDTOOFFSET 0xE000
+#define SIG_SELECTOR16 0x9000
+#define SIG_SELECTOR8 0x8000
+#define SIG_UINT16 0x1000
+#define SIG_BYTE 0x0000
+
+#define PATCH_END SIG_END
+#define PATCH_COMMANDMASK SIG_COMMANDMASK
+#define PATCH_VALUEMASK SIG_VALUEMASK
+#define PATCH_BYTEMASK SIG_BYTEMASK
+#define PATCH_ADDTOOFFSET SIG_ADDTOOFFSET
+#define PATCH_GETORIGINALBYTE 0xD000
+#define PATCH_GETORIGINALBYTEADJUST 0xC000
+#define PATCH_SELECTOR16 SIG_SELECTOR16
+#define PATCH_SELECTOR8 SIG_SELECTOR8
+#define PATCH_UINT16 SIG_UINT16
+#define PATCH_BYTE SIG_BYTE
+
+// defines maximum scratch area for getting original bytes from unpatched script data
#define PATCH_VALUELIMIT 4096
-struct SciScriptSignature {
+struct SciScriptPatcherEntry {
uint16 scriptNr;
const char *description;
int16 applyCount;
uint32 magicDWord;
int magicOffset;
- const byte *data;
- const uint16 *patch;
+ const uint16 *signatureData;
+ const uint16 *patchData;
};
#define SCI_SIGNATUREENTRY_TERMINATOR { 0, NULL, 0, 0, 0, NULL, NULL }
-// signatures are built like this:
-// - first a counter of the bytes that follow
-// - then the actual bytes that need to get matched
-// - then another counter of bytes (0 for EOS)
-// - if not EOS, an adjust offset and the actual bytes
-// - rinse and repeat
+struct SciScriptPatcherSelector {
+ const char *name;
+ int16 id;
+};
+
+SciScriptPatcherSelector selectorTable[] = {
+ "cycles", -1, // system selector
+ "seconds", -1, // system selector
+ "init", -1, // system selector
+ "dispose", -1, // system selector
+ "new", -1, // system selector
+ "curEvent", -1, // system selector
+ "disable", -1, // system selector
+ "show", -1, // system selector
+ "x", -1, // system selector
+ "cel", -1, // system selector
+ "setMotion", -1, // system selector
+ "deskSarg", -1, // Gabriel Knight
+ "localize", -1, // Freddy Pharkas
+ "put", -1, // Police Quest 1 VGA
+ "solvePuzzle", -1, // Quest For Glory 3
+ "timesShownID", -1, // Space Quest 1 VGA
+ NULL, -1
+};
+
+enum ScriptPatcherSelectors {
+ SELECTOR_cycles = 0,
+ SELECTOR_seconds,
+ SELECTOR_init,
+ SELECTOR_dispose,
+ SELECTOR_new,
+ SELECTOR_curEvent,
+ SELECTOR_disable,
+ SELECTOR_show,
+ SELECTOR_x,
+ SELECTOR_cel,
+ SELECTOR_setMotion,
+ SELECTOR_deskSarg,
+ SELECTOR_localize,
+ SELECTOR_put,
+ SELECTOR_solvePuzzle,
+ SELECTOR_timesShownID
+};
// ===========================================================================
// Conquests of Camelot
@@ -78,35 +133,32 @@ struct SciScriptSignature {
// We fix the script by patching in a jump to the proper code inside fawaz::doit.
// Responsible method: fawaz::handleEvent
// Fixes bug #3614969
-const byte camelotSignaturePeepingTom[] = {
- 5,
- 0x72, 0x7e, 0x07, // lofsa fawaz <-- start of proper initializion code
- 0xa1, 0xb9, // sag b9h
- +255, 0,
- +255, 0,
- +61, 19, // skip 571 bytes
- 0x39, 0x7a, // pushi 7a <-- initialization code when walking automatically
- 0x78, // push1
- 0x7a, // push2
- 0x38, 0xa9, 0x00, // pushi 00a9 - script 169
- 0x78, // push1
- 0x43, 0x02, 0x04, // call kScriptID
- 0x36, // push
- 0x81, 0x00, // lag 00
- 0x4a, 0x06, // send 06
- 0x32, 0x20, 0x05, // jmp [end of fawaz::handleEvent]
- 0
+const uint16 camelotSignaturePeepingTom[] = {
+ 0x72, SIG_MAGICDWORD, SIG_UINT16 + 0x7e, 0x07, // lofsa fawaz <-- start of proper initializion code
+ 0xa1, 0xb9, // sag b9h
+ SIG_ADDTOOFFSET +571, // skip 571 bytes
+ 0x39, 0x7a, // pushi 7a <-- initialization code when walking automatically
+ 0x78, // push1
+ 0x7a, // push2
+ 0x38, SIG_UINT16 + 0xa9, 0x00, // pushi 00a9 - script 169
+ 0x78, // push1
+ 0x43, 0x02, 0x04, // call kScriptID
+ 0x36, // push
+ 0x81, 0x00, // lag 00
+ 0x4a, 0x06, // send 06
+ 0x32, SIG_UINT16 + 0x20, 0x05, // jmp [end of fawaz::handleEvent]
+ SIG_END
};
const uint16 camelotPatchPeepingTom[] = {
- PATCH_ADDTOOFFSET | +576,
- 0x32, 0xbd, 0xfd, // jmp to fawaz::doit / properly init peepingTom code
+ PATCH_ADDTOOFFSET +576,
+ 0x32, PATCH_UINT16 + 0xbd, 0xfd, // jmp to fawaz::doit / properly init peepingTom code
PATCH_END
};
-// script, description, magic DWORD, adjust
-const SciScriptSignature camelotSignatures[] = {
- { 62, "fix peepingTom Sierra bug", 1, PATCH_MAGICDWORD(0x7e, 0x07, 0xa1, 0xb9), -1, camelotSignaturePeepingTom, camelotPatchPeepingTom },
+// script, description, signature patch
+SciScriptPatcherEntry camelotSignatures[] = {
+ { 62, "fix peepingTom Sierra bug", 1, 0, 0, camelotSignaturePeepingTom, camelotPatchPeepingTom },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -115,64 +167,67 @@ const SciScriptSignature camelotSignatures[] = {
// boundaries of room 660. Normally a textbox is supposed to get on screen
// but the call is wrong, so not only do we get an error message the script
// is also hanging because the cue won't get sent out
-// This also happens in sierra sci - refer to bug #3038387
-const byte ecoquest1SignatureStayAndHelp[] = {
- 40,
- 0x3f, 0x01, // link 01
- 0x87, 0x01, // lap param[1]
- 0x65, 0x14, // aTop state
- 0x36, // push
- 0x3c, // dup
- 0x35, 0x00, // ldi 00
- 0x1a, // eq?
- 0x31, 0x1c, // bnt [next state]
- 0x76, // push0
- 0x45, 0x01, 0x00, // callb export1 from script 0 (switching control off)
- 0x38, 0x22, 0x01, // pushi 0122
- 0x78, // push1
- 0x76, // push0
- 0x81, 0x00, // lag global[0]
- 0x4a, 0x06, // send 06 - call ego::setMotion(0)
- 0x39, 0x6e, // pushi 6e (selector init)
- 0x39, 0x04, // pushi 04
- 0x76, // push0
- 0x76, // push0
- 0x39, 0x17, // pushi 17
- 0x7c, // pushSelf
- 0x51, 0x82, // class EcoNarrator
- 0x4a, 0x0c, // send 0c - call EcoNarrator::init(0, 0, 23, self) (BADLY BROKEN!)
- 0x33, // jmp [end]
- 0
+// This also happens in sierra sci
+// Applies to at least: PC-CD
+// Responsible method: stayAndHelp::changeState
+// Fixes bug: #3038387
+const uint16 ecoquest1SignatureStayAndHelp[] = {
+ 0x3f, 0x01, // link 01
+ 0x87, 0x01, // lap param[1]
+ 0x65, 0x14, // aTop state
+ 0x36, // push
+ 0x3c, // dup
+ 0x35, 0x00, // ldi 00
+ 0x1a, // eq?
+ 0x31, 0x1c, // bnt [next state]
+ 0x76, // push0
+ 0x45, 0x01, 0x00, // callb export1 from script 0 (switching control off)
+ SIG_MAGICDWORD,
+ 0x38, SIG_UINT16 + 0x22, 0x01, // pushi 0122
+ 0x78, // push1
+ 0x76, // push0
+ 0x81, 0x00, // lag global[0]
+ 0x4a, 0x06, // send 06 - call ego::setMotion(0)
+ 0x39, SIG_SELECTOR8 + SELECTOR_init, // pushi "init"
+ 0x39, 0x04, // pushi 04
+ 0x76, // push0
+ 0x76, // push0
+ 0x39, 0x17, // pushi 17
+ 0x7c, // pushSelf
+ 0x51, 0x82, // class EcoNarrator
+ 0x4a, 0x0c, // send 0c - call EcoNarrator::init(0, 0, 23, self) (BADLY BROKEN!)
+ 0x33, // jmp [end]
+ SIG_END
};
const uint16 ecoquest1PatchStayAndHelp[] = {
- 0x87, 0x01, // lap param[1]
- 0x65, 0x14, // aTop state
- 0x36, // push
- 0x2f, 0x22, // bt [next state] (this optimization saves 6 bytes)
- 0x39, 0x00, // pushi 0 (wasting 1 byte here)
- 0x45, 0x01, 0x00, // callb export1 from script 0 (switching control off)
- 0x38, 0x22, 0x01, // pushi 0122
- 0x78, // push1
- 0x76, // push0
- 0x81, 0x00, // lag global[0]
- 0x4a, 0x06, // send 06 - call ego::setMotion(0)
- 0x39, 0x6e, // pushi 6e (selector init)
- 0x39, 0x06, // pushi 06
- 0x39, 0x02, // pushi 02 (additional 2 bytes)
- 0x76, // push0
- 0x76, // push0
- 0x39, 0x17, // pushi 17
- 0x7c, // pushSelf
- 0x38, 0x80, 0x02, // pushi 280 (additional 3 bytes)
- 0x51, 0x82, // class EcoNarrator
- 0x4a, 0x10, // send 10 - call EcoNarrator::init(2, 0, 0, 23, self, 640)
+ 0x87, 0x01, // lap param[1]
+ 0x65, 0x14, // aTop state
+ 0x36, // push
+ 0x2f, 0x22, // bt [next state] (this optimization saves 6 bytes)
+ 0x39, 0x00, // pushi 0 (wasting 1 byte here)
+ 0x45, 0x01, 0x00, // callb export1 from script 0 (switching control off)
+ 0x38, PATCH_UINT16 + 0x22, 0x01, // pushi 0122
+ 0x78, // push1
+ 0x76, // push0
+ 0x81, 0x00, // lag global[0]
+ 0x4a, 0x06, // send 06 - call ego::setMotion(0)
+ 0x39, PATCH_SELECTOR8 + SELECTOR_init, // pushi "init"
+ 0x39, 0x06, // pushi 06
+ 0x39, 0x02, // pushi 02 (additional 2 bytes)
+ 0x76, // push0
+ 0x76, // push0
+ 0x39, 0x17, // pushi 17
+ 0x7c, // pushSelf
+ 0x38, PATCH_UINT16 + 0x80, 0x02, // pushi 280 (additional 3 bytes)
+ 0x51, 0x82, // class EcoNarrator
+ 0x4a, 0x10, // send 10 - call EcoNarrator::init(2, 0, 0, 23, self, 640)
PATCH_END
};
-// script, description, magic DWORD, adjust
-const SciScriptSignature ecoquest1Signatures[] = {
- { 660, "CD: bad messagebox and freeze", 1, PATCH_MAGICDWORD(0x38, 0x22, 0x01, 0x78), -17, ecoquest1SignatureStayAndHelp, ecoquest1PatchStayAndHelp },
+// script, description, signature patch
+SciScriptPatcherEntry ecoquest1Signatures[] = {
+ { 660, "CD: bad messagebox and freeze", 1, 0, 0, ecoquest1SignatureStayAndHelp, ecoquest1PatchStayAndHelp },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -182,53 +237,53 @@ const SciScriptSignature ecoquest1Signatures[] = {
// this worked in sierra sci just by accident. In our sci, the temp space
// is resetted every time, which means the previous text isn't available
// anymore. We have to patch the code because of that - bug #3035386
-const byte ecoquest2SignatureEcorder[] = {
- 35,
- 0x31, 0x22, // bnt [next state]
- 0x39, 0x0a, // pushi 0a
- 0x5b, 0x04, 0x1e, // lea temp[1e]
- 0x36, // push
- 0x39, 0x64, // pushi 64
- 0x39, 0x7d, // pushi 7d
- 0x39, 0x32, // pushi 32
- 0x39, 0x66, // pushi 66
- 0x39, 0x17, // pushi 17
- 0x39, 0x69, // pushi 69
- 0x38, 0x31, 0x26, // pushi 2631
- 0x39, 0x6a, // pushi 6a
- 0x39, 0x64, // pushi 64
- 0x43, 0x1b, 0x14, // call kDisplay
- 0x35, 0x0a, // ldi 0a
- 0x65, 0x20, // aTop ticks
- 0x33, // jmp [end]
- +1, 5, // [skip 1 byte]
- 0x3c, // dup
- 0x35, 0x03, // ldi 03
- 0x1a, // eq?
- 0x31, // bnt [end]
- 0
+const uint16 ecoquest2SignatureEcorder[] = {
+ 0x31, 0x22, // bnt [next state]
+ 0x39, 0x0a, // pushi 0a
+ 0x5b, 0x04, 0x1e, // lea temp[1e]
+ 0x36, // push
+ SIG_MAGICDWORD,
+ 0x39, 0x64, // pushi 64
+ 0x39, 0x7d, // pushi 7d
+ 0x39, 0x32, // pushi 32
+ 0x39, 0x66, // pushi 66
+ 0x39, 0x17, // pushi 17
+ 0x39, 0x69, // pushi 69
+ 0x38, PATCH_UINT16 + 0x31, 0x26, // pushi 2631
+ 0x39, 0x6a, // pushi 6a
+ 0x39, 0x64, // pushi 64
+ 0x43, 0x1b, 0x14, // call kDisplay
+ 0x35, 0x0a, // ldi 0a
+ 0x65, 0x20, // aTop ticks
+ 0x33, // jmp [end]
+ SIG_ADDTOOFFSET +1, // [skip 1 byte]
+ 0x3c, // dup
+ 0x35, 0x03, // ldi 03
+ 0x1a, // eq?
+ 0x31, // bnt [end]
+ SIG_END
};
const uint16 ecoquest2PatchEcorder[] = {
- 0x2f, 0x02, // bt [to pushi 07]
- 0x3a, // toss
- 0x48, // ret
- 0x38, 0x07, 0x00, // pushi 07 (parameter count) (waste 1 byte)
- 0x39, 0x0b, // push (FillBoxAny)
- 0x39, 0x1d, // pushi 29d
- 0x39, 0x73, // pushi 115d
- 0x39, 0x5e, // pushi 94d
- 0x38, 0xd7, 0x00, // pushi 215d
- 0x78, // push1 (visual screen)
- 0x38, 0x17, 0x00, // pushi 17 (color) (waste 1 byte)
- 0x43, 0x6c, 0x0e, // call kGraph
- 0x38, 0x05, 0x00, // pushi 05 (parameter count) (waste 1 byte)
- 0x39, 0x0c, // pushi 12d (UpdateBox)
- 0x39, 0x1d, // pushi 29d
- 0x39, 0x73, // pushi 115d
- 0x39, 0x5e, // pushi 94d
- 0x38, 0xd7, 0x00, // pushi 215d
- 0x43, 0x6c, 0x0a, // call kGraph
+ 0x2f, 0x02, // bt [to pushi 07]
+ 0x3a, // toss
+ 0x48, // ret
+ 0x38, PATCH_UINT16 + 0x07, 0x00, // pushi 07 (parameter count) (waste 1 byte)
+ 0x39, 0x0b, // push (FillBoxAny)
+ 0x39, 0x1d, // pushi 29d
+ 0x39, 0x73, // pushi 115d
+ 0x39, 0x5e, // pushi 94d
+ 0x38, PATCH_UINT16 + 0xd7, 0x00, // pushi 215d
+ 0x78, // push1 (visual screen)
+ 0x38, PATCH_UINT16 + 0x17, 0x00, // pushi 17 (color) (waste 1 byte)
+ 0x43, 0x6c, 0x0e, // call kGraph
+ 0x38, PATCH_UINT16 + 0x05, 0x00, // pushi 05 (parameter count) (waste 1 byte)
+ 0x39, 0x0c, // pushi 12d (UpdateBox)
+ 0x39, 0x1d, // pushi 29d
+ 0x39, 0x73, // pushi 115d
+ 0x39, 0x5e, // pushi 94d
+ 0x38, PATCH_UINT16 + 0xd7, 0x00, // pushi 215d
+ 0x43, 0x6c, 0x0a, // call kGraph
PATCH_END
};
@@ -237,66 +292,66 @@ const uint16 ecoquest2PatchEcorder[] = {
// Two workarounds are needed for this patch in workarounds.cpp (when calling
// kGraphFillBoxAny and kGraphUpdateBox), as there isn't enough space to patch
// the function otherwise.
-const byte ecoquest2SignatureEcorderTutorial[] = {
- 36,
- 0x30, 0x23, 0x00, // bnt [next state]
- 0x39, 0x0a, // pushi 0a
- 0x5b, 0x04, 0x1f, // lea temp[1f]
- 0x36, // push
- 0x39, 0x64, // pushi 64
- 0x39, 0x7d, // pushi 7d
- 0x39, 0x32, // pushi 32
- 0x39, 0x66, // pushi 66
- 0x39, 0x17, // pushi 17
- 0x39, 0x69, // pushi 69
- 0x38, 0x31, 0x26, // pushi 2631
- 0x39, 0x6a, // pushi 6a
- 0x39, 0x64, // pushi 64
- 0x43, 0x1b, 0x14, // call kDisplay
- 0x35, 0x1e, // ldi 1e
- 0x65, 0x20, // aTop ticks
- 0x32, // jmp [end]
+const uint16 ecoquest2SignatureEcorderTutorial[] = {
+ 0x30, SIG_UINT16 + 0x23, 0x00, // bnt [next state]
+ 0x39, 0x0a, // pushi 0a
+ 0x5b, 0x04, 0x1f, // lea temp[1f]
+ 0x36, // push
+ SIG_MAGICDWORD,
+ 0x39, 0x64, // pushi 64
+ 0x39, 0x7d, // pushi 7d
+ 0x39, 0x32, // pushi 32
+ 0x39, 0x66, // pushi 66
+ 0x39, 0x17, // pushi 17
+ 0x39, 0x69, // pushi 69
+ 0x38, SIG_UINT16 + 0x31, 0x26, // pushi 2631
+ 0x39, 0x6a, // pushi 6a
+ 0x39, 0x64, // pushi 64
+ 0x43, 0x1b, 0x14, // call kDisplay
+ 0x35, 0x1e, // ldi 1e
+ 0x65, 0x20, // aTop ticks
+ 0x32, // jmp [end]
// 2 extra bytes, jmp offset
- 0
+ SIG_END
};
const uint16 ecoquest2PatchEcorderTutorial[] = {
- 0x31, 0x23, // bnt [next state] (save 1 byte)
+ 0x31, 0x23, // bnt [next state] (save 1 byte)
// The parameter count below should be 7, but we're out of bytes
// to patch! A workaround has been added because of this
- 0x78, // push1 (parameter count)
- //0x39, 0x07, // pushi 07 (parameter count)
- 0x39, 0x0b, // push (FillBoxAny)
- 0x39, 0x1d, // pushi 29d
- 0x39, 0x73, // pushi 115d
- 0x39, 0x5e, // pushi 94d
- 0x38, 0xd7, 0x00, // pushi 215d
- 0x78, // push1 (visual screen)
- 0x39, 0x17, // pushi 17 (color)
- 0x43, 0x6c, 0x0e, // call kGraph
+ 0x78, // push1 (parameter count)
+ //0x39, 0x07, // pushi 07 (parameter count)
+ 0x39, 0x0b, // push (FillBoxAny)
+ 0x39, 0x1d, // pushi 29d
+ 0x39, 0x73, // pushi 115d
+ 0x39, 0x5e, // pushi 94d
+ 0x38, PATCH_UINT16 + 0xd7, 0x00, // pushi 215d
+ 0x78, // push1 (visual screen)
+ 0x39, 0x17, // pushi 17 (color)
+ 0x43, 0x6c, 0x0e, // call kGraph
// The parameter count below should be 5, but we're out of bytes
// to patch! A workaround has been added because of this
- 0x78, // push1 (parameter count)
- //0x39, 0x05, // pushi 05 (parameter count)
- 0x39, 0x0c, // pushi 12d (UpdateBox)
- 0x39, 0x1d, // pushi 29d
- 0x39, 0x73, // pushi 115d
- 0x39, 0x5e, // pushi 94d
- 0x38, 0xd7, 0x00, // pushi 215d
- 0x43, 0x6c, 0x0a, // call kGraph
+ 0x78, // push1 (parameter count)
+ //0x39, 0x05, // pushi 05 (parameter count)
+ 0x39, 0x0c, // pushi 12d (UpdateBox)
+ 0x39, 0x1d, // pushi 29d
+ 0x39, 0x73, // pushi 115d
+ 0x39, 0x5e, // pushi 94d
+ 0x38, PATCH_UINT16 + 0xd7, 0x00, // pushi 215d
+ 0x43, 0x6c, 0x0a, // call kGraph
// We are out of bytes to patch at this point,
// so we skip 494 (0x1EE) bytes to reuse this code:
// ldi 1e
// aTop 20
// jmp 030e (jump to end)
- 0x32, 0xee, 0x01, // skip 494 (0x1EE) bytes
+ 0x32, PATCH_UINT16 + 0xee, 0x01, // skip 494 (0x1EE) bytes
PATCH_END
};
-// script, description, magic DWORD, adjust
-const SciScriptSignature ecoquest2Signatures[] = {
- { 50, "initial text not removed on ecorder", 1, PATCH_MAGICDWORD(0x39, 0x64, 0x39, 0x7d), -8, ecoquest2SignatureEcorder, ecoquest2PatchEcorder },
- { 333, "initial text not removed on ecorder tutorial",1, PATCH_MAGICDWORD(0x39, 0x64, 0x39, 0x7d), -9, ecoquest2SignatureEcorderTutorial, ecoquest2PatchEcorderTutorial },
+// script, description, signature patch
+SciScriptPatcherEntry ecoquest2Signatures[] = {
+ { 50, "initial text not removed on ecorder", 1, 0, 0, ecoquest2SignatureEcorder, ecoquest2PatchEcorder },
+ { 333, "initial text not removed on ecorder tutorial",1, 0, 0, ecoquest2SignatureEcorderTutorial, ecoquest2PatchEcorderTutorial },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -306,26 +361,26 @@ const SciScriptSignature ecoquest2Signatures[] = {
// infinite loop. This script bug was not apparent in SSCI, probably because
// event handling was slightly different there, so it was never discovered.
// Fixes bug #3038870.
-const byte fanmadeSignatureInfiniteLoop[] = {
- 13,
- 0x38, 0x4c, 0x00, // pushi 004c
- 0x39, 0x00, // pushi 00
- 0x87, 0x01, // lap 01
- 0x4b, 0x04, // send 04
- 0x18, // not
- 0x30, 0x2f, 0x00, // bnt 002f [06a5] --> jmp ffbc [0664] --> BUG! infinite loop
- 0
+const uint16 fanmadeSignatureInfiniteLoop[] = {
+ 0x38, SIG_UINT16 + 0x4c, 0x00, // pushi 004c
+ 0x39, 0x00, // pushi 00
+ 0x87, 0x01, // lap 01
+ 0x4b, 0x04, // send 04
+ SIG_MAGICDWORD,
+ 0x18, // not
+ 0x30, SIG_UINT16 + 0x2f, 0x00, // bnt 002f [06a5] --> jmp ffbc [0664] --> BUG! infinite loop
+ SIG_END
};
const uint16 fanmadePatchInfiniteLoop[] = {
PATCH_ADDTOOFFSET | +10,
- 0x30, 0x32, 0x00, // bnt 0032 [06a8] --> pushi 004c
+ 0x30, SIG_UINT16 + 0x32, 0x00, // bnt 0032 [06a8] --> pushi 004c
PATCH_END
};
-// script, description, magic DWORD, adjust
-const SciScriptSignature fanmadeSignatures[] = {
- { 999, "infinite loop on typo", 1, PATCH_MAGICDWORD(0x18, 0x30, 0x2f, 0x00), -9, fanmadeSignatureInfiniteLoop, fanmadePatchInfiniteLoop },
+// script, description, signature patch
+SciScriptPatcherEntry fanmadeSignatures[] = {
+ { 999, "infinite loop on typo", 1, 0, 0, fanmadeSignatureInfiniteLoop, fanmadePatchInfiniteLoop },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -337,21 +392,23 @@ const SciScriptSignature fanmadeSignatures[] = {
// was already playing in the sound driver. In our case we would also stop
// the sample from playing, so we patch it out
// The "score" code is already buggy and sets volume to 0 when playing
-const byte freddypharkasSignatureScoreDisposal[] = {
- 10,
- 0x67, 0x32, // pTos 32 (selector theAudCount)
- 0x78, // push1
- 0x39, 0x0d, // pushi 0d
- 0x43, 0x75, 0x02, // call kDoAudio
- 0x1c, // ne?
- 0x31, // bnt (-> to skip disposal)
- 0
+// Applies to at least: English PC-CD
+// Responsible method: unknown
+const uint16 freddypharkasSignatureScoreDisposal[] = {
+ 0x67, 0x32, // pTos 32 (selector theAudCount)
+ 0x78, // push1
+ SIG_MAGICDWORD,
+ 0x39, 0x0d, // pushi 0d
+ 0x43, 0x75, 0x02, // call kDoAudio
+ 0x1c, // ne?
+ 0x31, // bnt (-> to skip disposal)
+ SIG_END
};
const uint16 freddypharkasPatchScoreDisposal[] = {
- 0x34, 0x00, 0x00, // ldi 0000
- 0x34, 0x00, 0x00, // ldi 0000
- 0x34, 0x00, 0x00, // ldi 0000
+ 0x34, PATCH_UINT16 + 0x00, 0x00, // ldi 0000
+ 0x34, PATCH_UINT16 + 0x00, 0x00, // ldi 0000
+ 0x34, PATCH_UINT16 + 0x00, 0x00, // ldi 0000
PATCH_END
};
@@ -361,24 +418,26 @@ const uint16 freddypharkasPatchScoreDisposal[] = {
// in IconBar::disable doing endless loops even in sierra sci, because there
// is no enabled icon left. We remove disabling of icon 8 (which is help),
// this fixes the issue.
-const byte freddypharkasSignatureCanisterHang[] = {
- 12,
- 0x38, 0xf1, 0x00, // pushi f1 (selector disable)
- 0x7a, // push2
- 0x39, 0x07, // pushi 07
- 0x39, 0x08, // pushi 08
- 0x81, 0x45, // lag 45
- 0x4a, 0x08, // send 08 - call IconBar::disable(7, 8)
- 0
+// Applies to at least: English PC-CD
+// Responsible method: rm235::init and sEnterFrom500::changeState
+const uint16 freddypharkasSignatureCanisterHang[] = {
+ 0x38, SIG_SELECTOR16 + SELECTOR_disable, // pushi disable
+ 0x7a, // push2
+ SIG_MAGICDWORD,
+ 0x39, 0x07, // pushi 07
+ 0x39, 0x08, // pushi 08
+ 0x81, 0x45, // lag 45
+ 0x4a, 0x08, // send 08 - call IconBar::disable(7, 8)
+ SIG_END
};
const uint16 freddypharkasPatchCanisterHang[] = {
PATCH_ADDTOOFFSET | +3,
- 0x78, // push1
+ 0x78, // push1
PATCH_ADDTOOFFSET | +2,
- 0x33, 0x00, // ldi 00 (waste 2 bytes)
+ 0x33, 0x00, // ldi 00 (waste 2 bytes)
PATCH_ADDTOOFFSET | +3,
- 0x06, // send 06 - call IconBar::disable(7)
+ 0x06, // send 06 - call IconBar::disable(7)
PATCH_END
};
@@ -390,135 +449,132 @@ const uint16 freddypharkasPatchCanisterHang[] = {
// ego, sometimes clicks also won't get registered. Strangely it's not nearly
// as bad as in our sci, but these differences may be caused by timing.
// We just reuse the active event, thus removing the duplicate kGetEvent call.
-const byte freddypharkasSignatureLadderEvent[] = {
- 21,
- 0x39, 0x6d, // pushi 6d (selector new)
- 0x76, // push0
- 0x38, 0xf5, 0x00, // pushi f5 (selector curEvent)
- 0x76, // push0
- 0x81, 0x50, // lag global[50]
- 0x4a, 0x04, // send 04 - read User::curEvent
- 0x4a, 0x04, // send 04 - call curEvent::new
- 0xa5, 0x00, // sat temp[0]
- 0x38, 0x94, 0x00, // pushi 94 (selector localize)
- 0x76, // push0
- 0x4a, 0x04, // send 04 - call curEvent::localize
- 0
+// Applies to at least: English PC-CD, German Floppy, English Mac
+// Responsible method: lowerLadder::doit and highLadder::doit
+const uint16 freddypharkasSignatureLadderEvent[] = {
+ 0x39, SIG_MAGICDWORD,
+ SIG_SELECTOR8 + SELECTOR_new, // pushi new
+ 0x76, // push0
+ 0x38, SIG_SELECTOR16 + SELECTOR_curEvent, // pushi curEvent
+ 0x76, // push0
+ 0x81, 0x50, // lag global[50]
+ 0x4a, 0x04, // send 04 - read User::curEvent
+ 0x4a, 0x04, // send 04 - call curEvent::new
+ 0xa5, 0x00, // sat temp[0]
+ 0x38, SIG_SELECTOR16 + SELECTOR_localize,
+ 0x76, // push0
+ 0x4a, 0x04, // send 04 - call curEvent::localize
+ SIG_END
};
const uint16 freddypharkasPatchLadderEvent[] = {
- 0x34, 0x00, 0x00, // ldi 0000 (waste 3 bytes, overwrites first 2 pushes)
+ 0x34, 0x00, 0x00, // ldi 0000 (waste 3 bytes, overwrites first 2 pushes)
PATCH_ADDTOOFFSET | +8,
- 0xa5, 0x00, // sat temp[0] (waste 2 bytes, overwrites 2nd send)
+ 0xa5, 0x00, // sat temp[0] (waste 2 bytes, overwrites 2nd send)
PATCH_ADDTOOFFSET | +2,
- 0x34, 0x00, 0x00, // ldi 0000
- 0x34, 0x00, 0x00, // ldi 0000 (waste 6 bytes, overwrites last 3 opcodes)
+ 0x34, 0x00, 0x00, // ldi 0000
+ 0x34, 0x00, 0x00, // ldi 0000 (waste 6 bytes, overwrites last 3 opcodes)
PATCH_END
};
// In the Macintosh version of Freddy Pharkas, kRespondsTo is broken for
// property selectors. They hacked the script to work around the issue,
// so we revert the script back to using the values of the DOS script.
-const byte freddypharkasSignatureMacInventory[] = {
- 10,
- 0x39, 0x23, // pushi 23
- 0x39, 0x74, // pushi 74
- 0x78, // push1
- 0x38, 0x01, 0x74, // pushi 0174
- 0x85, 0x15, // lat 15
- 0
+// Applies to at least: English Mac
+// Responsible method: unknown
+const uint16 freddypharkasSignatureMacInventory[] = {
+ SIG_MAGICDWORD,
+ 0x39, 0x23, // pushi 23
+ 0x39, 0x74, // pushi 74
+ 0x78, // push1
+ 0x38, SIG_UINT16 + 0x74, 0x01, // pushi 0174 (on mac it's actually 0x01, 0x74)
+ 0x85, 0x15, // lat 15
+ SIG_END
};
const uint16 freddypharkasPatchMacInventory[] = {
- 0x39, 0x02, // pushi 02 (now matches the DOS version)
- 0x39, 0x74, // pushi 74
- 0x78, // push1
- 0x38, 0x01, 0x74, // pushi 0174
- 0x85, 0x15, // lat 15
- 0x4a, 0x06, // send 06
- 0x31, 0x08, // bnt 08
- 0x38, 0x01, 0x74, // pushi 0174
- 0x76, // push0
- 0x85, 0x15, // lat 15
- 0x4a, 0x04, // send 04
- 0x02, // add
- 0xa5, 0x12, // sat 12
- 0x39, 0x04, // pushi 04 (now matches the DOS version)
+ 0x39, 0x02, // pushi 02 (now matches the DOS version)
+ PATCH_ADDTOOFFSET +23,
+ 0x39, 0x04, // pushi 04 (now matches the DOS version)
PATCH_END
};
-// script, description, magic DWORD, adjust
-const SciScriptSignature freddypharkasSignatures[] = {
- { 0, "CD: score early disposal", 1, PATCH_MAGICDWORD(0x39, 0x0d, 0x43, 0x75), -3, freddypharkasSignatureScoreDisposal, freddypharkasPatchScoreDisposal },
- { 15, "Mac: broken inventory", 1, PATCH_MAGICDWORD(0x39, 0x23, 0x39, 0x74), 0, freddypharkasSignatureMacInventory, freddypharkasPatchMacInventory },
- { 235, "CD: canister pickup hang", 3, PATCH_MAGICDWORD(0x39, 0x07, 0x39, 0x08), -4, freddypharkasSignatureCanisterHang, freddypharkasPatchCanisterHang },
- { 320, "ladder event issue", 2, PATCH_MAGICDWORD(0x6d, 0x76, 0x38, 0xf5), -1, freddypharkasSignatureLadderEvent, freddypharkasPatchLadderEvent },
+// script, description, signature patch
+SciScriptPatcherEntry freddypharkasSignatures[] = {
+ { 0, "CD: score early disposal", 1, 0, 0, freddypharkasSignatureScoreDisposal, freddypharkasPatchScoreDisposal },
+ { 15, "Mac: broken inventory", 1, 0, 0, freddypharkasSignatureMacInventory, freddypharkasPatchMacInventory },
+ { 235, "CD: canister pickup hang", 3, 0, 0, freddypharkasSignatureCanisterHang, freddypharkasPatchCanisterHang },
+ { 320, "ladder event issue", 2, 0, 0, freddypharkasSignatureLadderEvent, freddypharkasPatchLadderEvent },
SCI_SIGNATUREENTRY_TERMINATOR
};
// ===========================================================================
// daySixBeignet::changeState (4) is called when the cop goes out and sets cycles to 220.
// this is not enough time to get to the door, so we patch that to 23 seconds
-const byte gk1SignatureDay6PoliceBeignet[] = {
- 4,
- 0x35, 0x04, // ldi 04
- 0x1a, // eq?
- 0x30, // bnt [next state check]
- +2, 5, // [skip 2 bytes, offset of bnt]
- 0x38, 0x93, 0x00, // pushi 93 (selector dispose)
- 0x76, // push0
- 0x72, // lofsa deskSarg
- +2, 9, // [skip 2 bytes, offset of lofsa]
- 0x4a, 0x04, 0x00, // send 04
- 0x34, 0xdc, 0x00, // ldi 220
- 0x65, 0x1a, // aTop cycles
- 0x32, // jmp [end]
- 0
+// Applies to at least: English PC-CD, German PC-CD, English Mac
+// Responsible method: daySixBeignet::changeState
+const uint16 gk1SignatureDay6PoliceBeignet[] = {
+ 0x35, 0x04, // ldi 04
+ 0x1a, // eq?
+ 0x30, SIG_ADDTOOFFSET +2, // bnt [next state check]
+ 0x38, SIG_SELECTOR16 + SELECTOR_dispose, // pushi dispose
+ 0x76, // push0
+ 0x72, SIG_ADDTOOFFSET +2, // lofsa deskSarg
+ 0x4a, SIG_UINT16 + 0x04, 0x00, // send 04
+ SIG_MAGICDWORD,
+ 0x34, SIG_UINT16 + 0xdc, 0x00, // ldi 220
+ 0x65, SIG_ADDTOOFFSET +1, // aTop cycles (1a for PC, 1c for Mac)
+ 0x32, // jmp [end]
+ SIG_END
};
const uint16 gk1PatchDay6PoliceBeignet[] = {
- PATCH_ADDTOOFFSET | +16,
- 0x34, 0x17, 0x00, // ldi 23
- 0x65, 0x1c, // aTop seconds
+ PATCH_ADDTOOFFSET +16,
+ 0x34, PATCH_UINT16 + 0x17, 0x00, // ldi 23
+ 0x65, PATCH_GETORIGINALBYTEADJUST +20, +2, // aTop seconds (1c for PC, 1e for Mac)
PATCH_END
};
// sargSleeping::changeState (8) is called when the cop falls asleep and sets cycles to 220.
// this is not enough time to get to the door, so we patch it to 42 seconds
-const byte gk1SignatureDay6PoliceSleep[] = {
- 4,
- 0x35, 0x08, // ldi 08
- 0x1a, // eq?
- 0x31, // bnt [next state check]
- +1, 6, // [skip 1 byte, offset of bnt]
- 0x34, 0xdc, 0x00, // ldi 220
- 0x65, 0x1a, // aTop cycles
- 0x32, // jmp [end]
+// Applies to at least: English PC-CD, German PC-CD, English Mac
+// Responsible method: sargSleeping::changeState
+const uint16 gk1SignatureDay6PoliceSleep[] = {
+ 0x35, 0x08, // ldi 08
+ 0x1a, // eq?
+ 0x31, SIG_ADDTOOFFSET +1, // bnt [next state check]
+ SIG_MAGICDWORD,
+ 0x34, SIG_UINT16 + 0xdc, 0x00, // ldi 220
+ 0x65, SIG_ADDTOOFFSET +1, // aTop cycles (1a for PC, 1c for Mac)
+ 0x32, // jmp [end]
0
};
const uint16 gk1PatchDay6PoliceSleep[] = {
- PATCH_ADDTOOFFSET | +5,
- 0x34, 0x2a, 0x00, // ldi 42
- 0x65, 0x1c, // aTop seconds
+ PATCH_ADDTOOFFSET +5,
+ 0x34, SIG_UINT16 + 0x2a, 0x00, // ldi 42
+ 0x65, PATCH_GETORIGINALBYTEADJUST +9, +2, // aTop seconds (1c for PC, 1e for Mac)
PATCH_END
};
// startOfDay5::changeState (20h) - when gabriel goes to the phone the script will hang
-const byte gk1SignatureDay5PhoneFreeze[] = {
- 5,
- 0x35, 0x03, // ldi 03
- 0x65, 0x1a, // aTop cycles
- 0x32, // jmp [end]
- +2, 3, // [skip 2 bytes, offset of jmp]
- 0x3c, // dup
- 0x35, 0x21, // ldi 21
- 0
+// Applies to at least: English PC-CD, German PC-CD, English Mac
+// Responsible method: startOfDay5::changeState
+const uint16 gk1SignatureDay5PhoneFreeze[] = {
+ 0x4a,
+ SIG_MAGICDWORD, SIG_UINT16 + 0x0c, 0x00, // send 0c
+ 0x35, 0x03, // ldi 03
+ 0x65, SIG_ADDTOOFFSET +1, // aTop cycles
+ 0x32, SIG_ADDTOOFFSET +2, // jmp [end]
+ 0x3c, // dup
+ 0x35, 0x21, // ldi 21
+ SIG_END
};
const uint16 gk1PatchDay5PhoneFreeze[] = {
- 0x35, 0x06, // ldi 06
- 0x65, 0x20, // aTop ticks
+ PATCH_ADDTOOFFSET +3,
+ 0x35, 0x06, // ldi 01
+ 0x65, PATCH_GETORIGINALBYTEADJUST +6, +6, // aTop ticks
PATCH_END
};
@@ -530,63 +586,66 @@ const uint16 gk1PatchDay5PhoneFreeze[] = {
// comparison between a number an an object. In the CD version, the checks are
// in the correct order, thus the comparison is correct, thus we use the code
// from the CD version in the floppy one.
-const byte gk1SignatureInterrogationBug[] = {
- 43,
- 0x65, 0x4c, // aTop 4c
- 0x67, 0x50, // pTos 50
- 0x34, 0x10, 0x27, // ldi 2710
- 0x1e, // gt?
- 0x31, 0x08, // bnt 08 [05a0]
- 0x67, 0x50, // pTos 50
- 0x34, 0x10, 0x27, // ldi 2710
- 0x04, // sub
- 0x65, 0x50, // aTop 50
- 0x63, 0x50, // pToa 50
- 0x31, 0x15, // bnt 15 [05b9]
- 0x39, 0x0e, // pushi 0e
- 0x76, // push0
- 0x4a, 0x04, 0x00, // send 0004
- 0xa5, 0x00, // sat 00
- 0x38, 0x93, 0x00, // pushi 0093
- 0x76, // push0
- 0x63, 0x50, // pToa 50
- 0x4a, 0x04, 0x00, // send 0004
- 0x85, 0x00, // lat 00
- 0x65, 0x50, // aTop 50
- 0
+// Applies to at least: English Floppy
+// Responsible method: Interrogation::dispose
+// TODO: Check, if English Mac is affected too and if this patch applies
+const uint16 gk1SignatureInterrogationBug[] = {
+ SIG_MAGICDWORD,
+ 0x65, 0x4c, // aTop 4c
+ 0x67, 0x50, // pTos 50
+ 0x34, SIG_UINT16 + 0x10, 0x27, // ldi 2710
+ 0x1e, // gt?
+ 0x31, 0x08, // bnt 08 [05a0]
+ 0x67, 0x50, // pTos 50
+ 0x34, SIG_UINT16 + 0x10, 0x27, // ldi 2710
+ 0x04, // sub
+ 0x65, 0x50, // aTop 50
+ 0x63, 0x50, // pToa 50
+ 0x31, 0x15, // bnt 15 [05b9]
+ 0x39, 0x0e, // pushi 0e
+ 0x76, // push0
+ 0x4a, SIG_UINT16 + 0x04, 0x00, // send 0004
+ 0xa5, 0x00, // sat 00
+ 0x38, SIG_SELECTOR16 + SELECTOR_dispose, // pushi dispose
+ 0x76, // push0
+ 0x63, 0x50, // pToa 50
+ 0x4a, SIG_UINT16 + 0x04, 0x00, // send 0004
+ 0x85, 0x00, // lat 00
+ 0x65, 0x50, // aTop 50
+ SIG_END
};
const uint16 gk1PatchInterrogationBug[] = {
- 0x65, 0x4c, // aTop 4c
- 0x63, 0x50, // pToa 50
- 0x31, 0x15, // bnt 15 [05b9]
- 0x39, 0x0e, // pushi 0e
- 0x76, // push0
- 0x4a, 0x04, 0x00, // send 0004
- 0xa5, 0x00, // sat 00
- 0x38, 0x93, 0x00, // pushi 0093
- 0x76, // push0
- 0x63, 0x50, // pToa 50
- 0x4a, 0x04, 0x00, // send 0004
- 0x85, 0x00, // lat 00
- 0x65, 0x50, // aTop 50
- 0x67, 0x50, // pTos 50
- 0x34, 0x10, 0x27, // ldi 2710
- 0x1e, // gt?
- 0x31, 0x08, // bnt 08 [05b9]
- 0x67, 0x50, // pTos 50
- 0x34, 0x10, 0x27, // ldi 2710
- 0x04, // sub
- 0x65, 0x50, // aTop 50
+ 0x65, 0x4c, // aTop 4c
+ 0x63, 0x50, // pToa 50
+ 0x31, 0x15, // bnt 15 [05b9]
+ 0x39, 0x0e, // pushi 0e
+ 0x76, // push0
+ 0x4a, 0x04, 0x00, // send 0004
+ 0xa5, 0x00, // sat 00
+ 0x38, SIG_SELECTOR16 + SELECTOR_dispose, // pushi dispose
+ 0x76, // push0
+ 0x63, 0x50, // pToa 50
+ 0x4a, 0x04, 0x00, // send 0004
+ 0x85, 0x00, // lat 00
+ 0x65, 0x50, // aTop 50
+ 0x67, 0x50, // pTos 50
+ 0x34, PATCH_UINT16 + 0x10, 0x27, // ldi 2710
+ 0x1e, // gt?
+ 0x31, 0x08, // bnt 08 [05b9]
+ 0x67, 0x50, // pTos 50
+ 0x34, PATCH_UINT16 + 0x10, 0x27, // ldi 2710
+ 0x04, // sub
+ 0x65, 0x50, // aTop 50
PATCH_END
};
-// script, description, magic DWORD, adjust
-const SciScriptSignature gk1Signatures[] = {
- { 51, "interrogation bug", 1, PATCH_MAGICDWORD(0x65, 0x4c, 0x67, 0x50), 0, gk1SignatureInterrogationBug, gk1PatchInterrogationBug },
- { 212, "day 5 phone freeze", 1, PATCH_MAGICDWORD(0x35, 0x03, 0x65, 0x1a), 0, gk1SignatureDay5PhoneFreeze, gk1PatchDay5PhoneFreeze },
- { 230, "day 6 police beignet timer issue", 1, PATCH_MAGICDWORD(0x34, 0xdc, 0x00, 0x65), -16, gk1SignatureDay6PoliceBeignet, gk1PatchDay6PoliceBeignet },
- { 230, "day 6 police sleep timer issue", 1, PATCH_MAGICDWORD(0x34, 0xdc, 0x00, 0x65), -5, gk1SignatureDay6PoliceSleep, gk1PatchDay6PoliceSleep },
+// script, description, signature patch
+SciScriptPatcherEntry gk1Signatures[] = {
+ { 51, "interrogation bug", 1, 0, 0, gk1SignatureInterrogationBug, gk1PatchInterrogationBug },
+ { 212, "day 5 phone freeze", 1, 0, 0, gk1SignatureDay5PhoneFreeze, gk1PatchDay5PhoneFreeze },
+ { 230, "day 6 police beignet timer issue", 1, 0, 0, gk1SignatureDay6PoliceBeignet, gk1PatchDay6PoliceBeignet },
+ { 230, "day 6 police sleep timer issue", 1, 0, 0, gk1SignatureDay6PoliceSleep, gk1PatchDay6PoliceSleep },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -596,47 +655,47 @@ const SciScriptSignature gk1Signatures[] = {
// is later used to set master volume. This issue makes sierra sci set
// the volume to max. We fix the export, so volume won't get modified in
// those cases.
-const byte kq5SignatureCdHarpyVolume[] = {
- 34,
- 0x80, 0x91, 0x01, // lag global[191h]
- 0x18, // not
- 0x30, 0x2c, 0x00, // bnt [jump further] (jumping, if global 191h is 1)
- 0x35, 0x01, // ldi 01
- 0xa0, 0x91, 0x01, // sag global[191h] (setting global 191h to 1)
- 0x38, 0x7b, 0x01, // pushi 017b
- 0x76, // push0
- 0x81, 0x01, // lag global[1]
- 0x4a, 0x04, // send 04 - read KQ5::masterVolume
- 0xa5, 0x03, // sat temp[3] (store volume in temp 3)
- 0x38, 0x7b, 0x01, // pushi 017b
- 0x76, // push0
- 0x81, 0x01, // lag global[1]
- 0x4a, 0x04, // send 04 - read KQ5::masterVolume
- 0x36, // push
- 0x35, 0x04, // ldi 04
- 0x20, // ge? (followed by bnt)
- 0
+const uint16 kq5SignatureCdHarpyVolume[] = {
+ SIG_MAGICDWORD,
+ 0x80, SIG_UINT16 + 0x91, 0x01, // lag global[191h]
+ 0x18, // not
+ 0x30, SIG_UINT16 + 0x2c, 0x00, // bnt [jump further] (jumping, if global 191h is 1)
+ 0x35, 0x01, // ldi 01
+ 0xa0, SIG_UINT16 + 0x91, 0x01, // sag global[191h] (setting global 191h to 1)
+ 0x38, SIG_UINT16 + 0x7b, 0x01, // pushi 017b
+ 0x76, // push0
+ 0x81, 0x01, // lag global[1]
+ 0x4a, 0x04, // send 04 - read KQ5::masterVolume
+ 0xa5, 0x03, // sat temp[3] (store volume in temp 3)
+ 0x38, SIG_UINT16 + 0x7b, 0x01, // pushi 017b
+ 0x76, // push0
+ 0x81, 0x01, // lag global[1]
+ 0x4a, 0x04, // send 04 - read KQ5::masterVolume
+ 0x36, // push
+ 0x35, 0x04, // ldi 04
+ 0x20, // ge? (followed by bnt)
+ SIG_END
};
const uint16 kq5PatchCdHarpyVolume[] = {
- 0x38, 0x2f, 0x02, // pushi 022f (selector theVol) (3 new bytes)
- 0x76, // push0 (1 new byte)
- 0x51, 0x88, // class SpeakTimer (2 new bytes)
- 0x4a, 0x04, // send 04 (2 new bytes) -> read SpeakTimer::theVol
- 0xa5, 0x03, // sat temp[3] (2 new bytes) -> write to temp 3
- 0x80, 0x91, 0x01, // lag global[191h]
+ 0x38, PATCH_UINT16 + 0x2f, 0x02, // pushi 022f (selector theVol) (3 new bytes)
+ 0x76, // push0 (1 new byte)
+ 0x51, 0x88, // class SpeakTimer (2 new bytes)
+ 0x4a, 0x04, // send 04 (2 new bytes) -> read SpeakTimer::theVol
+ 0xa5, 0x03, // sat temp[3] (2 new bytes) -> write to temp 3
+ 0x80, PATCH_UINT16 + 0x91, 0x01, // lag global[191h]
// saving 1 byte due optimization
- 0x2e, 0x23, 0x00, // bt [jump further] (jumping, if global 191h is 1)
- 0x35, 0x01, // ldi 01
- 0xa0, 0x91, 0x01, // sag global[191h] (setting global 191h to 1)
- 0x38, 0x7b, 0x01, // pushi 017b
- 0x76, // push0
- 0x81, 0x01, // lag global[1]
- 0x4a, 0x04, // send 04 - read KQ5::masterVolume
- 0xa5, 0x03, // sat temp[3] (store volume in temp 3)
+ 0x2e, PATCH_UINT16 + 0x23, 0x00, // bt [jump further] (jumping, if global 191h is 1)
+ 0x35, 0x01, // ldi 01
+ 0xa0, PATCH_UINT16 + 0x91, 0x01, // sag global[191h] (setting global 191h to 1)
+ 0x38, PATCH_UINT16 + 0x7b, 0x01, // pushi 017b
+ 0x76, // push0
+ 0x81, 0x01, // lag global[1]
+ 0x4a, 0x04, // send 04 - read KQ5::masterVolume
+ 0xa5, 0x03, // sat temp[3] (store volume in temp 3)
// saving 8 bytes due removing of duplicate code
- 0x39, 0x04, // pushi 04 (saving 1 byte due swapping)
- 0x22, // lt? (because we switched values)
+ 0x39, 0x04, // pushi 04 (saving 1 byte due swapping)
+ 0x22, // lt? (because we switched values)
PATCH_END
};
@@ -654,24 +713,24 @@ const uint16 kq5PatchCdHarpyVolume[] = {
// of variables effectively hides witchCage::doit, causing this position check
// to be bypassed entirely.
// See also the warning+comment in Object::initBaseObject
-const byte kq5SignatureWitchCageInit[] = {
- 16,
- 0x00, 0x00, // top
- 0x00, 0x00, // left
- 0x00, 0x00, // bottom
- 0x00, 0x00, // right
- 0x00, 0x00, // extra property #1
- 0x7a, 0x00, // extra property #2
- 0xc8, 0x00, // extra property #3
- 0xa3, 0x00, // extra property #4
- 0
+const uint16 kq5SignatureWitchCageInit[] = {
+ SIG_UINT16 + 0x00, 0x00, // top
+ SIG_UINT16 + 0x00, 0x00, // left
+ SIG_UINT16 + 0x00, 0x00, // bottom
+ SIG_UINT16 + 0x00, 0x00, // right
+ SIG_UINT16 + 0x00, 0x00, // extra property #1
+ SIG_MAGICDWORD,
+ SIG_UINT16 + 0x7a, 0x00, // extra property #2
+ SIG_UINT16 + 0xc8, 0x00, // extra property #3
+ SIG_UINT16 + 0xa3, 0x00, // extra property #4
+ SIG_END
};
const uint16 kq5PatchWitchCageInit[] = {
- 0x00, 0x00, // top
- 0x7a, 0x00, // left
- 0xc8, 0x00, // bottom
- 0xa3, 0x00, // right
+ PATCH_UINT16 + 0x00, 0x00, // top
+ PATCH_UINT16 + 0x7a, 0x00, // left
+ PATCH_UINT16 + 0xc8, 0x00, // bottom
+ PATCH_UINT16 + 0xa3, 0x00, // right
PATCH_END
};
@@ -689,31 +748,31 @@ const uint16 kq5PatchWitchCageInit[] = {
// changes to GameFeatures::detectsetCursorType() ) and breaking savegame
// compatibilty between the DOS and Windows CD versions of KQ5.
// TODO: Investigate these side effects more closely.
-const byte kq5SignatureWinGMSignals[] = {
- 9,
- 0x80, 0x90, 0x01, // lag 0x190
- 0x18, // not
- 0x30, 0x1b, 0x00, // bnt +0x001B
- 0x89, 0x57, // lsg 0x57
- 0
+const uint16 kq5SignatureWinGMSignals[] = {
+ SIG_MAGICDWORD,
+ 0x80, SIG_UINT16 + 0x90, 0x01, // lag 0x190
+ 0x18, // not
+ 0x30, SIG_UINT16 + 0x1b, 0x00, // bnt +0x001B
+ 0x89, 0x57, // lsg 0x57
+ SIG_END
};
const uint16 kq5PatchWinGMSignals[] = {
- 0x34, 0x01, 0x00, // ldi 0x0001
+ 0x34, PATCH_UINT16 + 0x01, 0x00, // ldi 0x0001
PATCH_END
};
-// script, description, magic DWORD, adjust
-const SciScriptSignature kq5Signatures[] = {
- { 0, "CD: harpy volume change", 1, PATCH_MAGICDWORD(0x80, 0x91, 0x01, 0x18), 0, kq5SignatureCdHarpyVolume, kq5PatchCdHarpyVolume },
- { 200, "CD: witch cage init", 1, PATCH_MAGICDWORD(0x7a, 0x00, 0xc8, 0x00), -10, kq5SignatureWitchCageInit, kq5PatchWitchCageInit },
+// script, description, signature patch
+SciScriptPatcherEntry kq5Signatures[] = {
+ { 0, "CD: harpy volume change", 1, 0, 0, kq5SignatureCdHarpyVolume, kq5PatchCdHarpyVolume },
+ { 200, "CD: witch cage init", 1, 0, 0, kq5SignatureWitchCageInit, kq5PatchWitchCageInit },
SCI_SIGNATUREENTRY_TERMINATOR
};
-const SciScriptSignature kq5WinGMSignatures[] = {
- { 0, "CD: harpy volume change", 1, PATCH_MAGICDWORD(0x80, 0x91, 0x01, 0x18), 0, kq5SignatureCdHarpyVolume, kq5PatchCdHarpyVolume },
- { 200, "CD: witch cage init", 1, PATCH_MAGICDWORD(0x7a, 0x00, 0xc8, 0x00), -10, kq5SignatureWitchCageInit, kq5PatchWitchCageInit },
- { 124, "Win: GM Music signal checks", 4, PATCH_MAGICDWORD(0x80, 0x90, 0x01, 0x18), 0, kq5SignatureWinGMSignals, kq5PatchWinGMSignals },
+SciScriptPatcherEntry kq5WinGMSignatures[] = {
+ { 0, "CD: harpy volume change", 1, 0, 0, kq5SignatureCdHarpyVolume, kq5PatchCdHarpyVolume },
+ { 200, "CD: witch cage init", 1, 0, 0, kq5SignatureWitchCageInit, kq5PatchWitchCageInit },
+ { 124, "Win: GM Music signal checks", 4, 0, 0, kq5SignatureWinGMSignals, kq5PatchWinGMSignals },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -726,24 +785,95 @@ const SciScriptSignature kq5WinGMSignatures[] = {
// unnecessary cryMusic::check method out, thereby stopping the sound from
// constantly restarting (since it's being looped anyway), thus the normal
// game speech can work while the baby cry sound is heard. Fixes bug #3034579.
-const byte kq6SignatureDuplicateBabyCry[] = {
- 10,
- 0x83, 0x00, // lal 00
- 0x31, 0x1e, // bnt 1e [07f4]
- 0x78, // push1
- 0x39, 0x04, // pushi 04
- 0x43, 0x75, 0x02, // callk DoAudio[75] 02
- 0
+const uint16 kq6SignatureDuplicateBabyCry[] = {
+ SIG_MAGICDWORD,
+ 0x83, 0x00, // lal 00
+ 0x31, 0x1e, // bnt 1e [07f4]
+ 0x78, // push1
+ 0x39, 0x04, // pushi 04
+ 0x43, 0x75, 0x02, // callk DoAudio[75] 02
+ SIG_END
};
const uint16 kq6PatchDuplicateBabyCry[] = {
- 0x48, // ret
+ 0x48, // ret
PATCH_END
};
-// script, description, magic DWORD, adjust
-const SciScriptSignature kq6Signatures[] = {
- { 481, "duplicate baby cry", 1, PATCH_MAGICDWORD(0x83, 0x00, 0x31, 0x1e), 0, kq6SignatureDuplicateBabyCry, kq6PatchDuplicateBabyCry },
+// The inventory of King's Quest 6 is buggy. When it grows too large,
+// it will get split into 2 pages. Switching between those pages will
+// grow the stack, because it's calling itself per switch.
+// Which means after a while ScummVM will bomb out because the stack frame
+// will be too large. This patch fixes the buggy script.
+// Applies to at least: PC-CD, English PC floppy, German PC floppy, English Mac
+// Responsible method: KqInv::showSelf
+// Fixes bug: #3293954
+const uint16 kq6SignatureInventoryStackFix[] = {
+ 0x67, 0x30, // pTos state
+ 0x34, SIG_UINT16 + 0x00, 0x20, // ldi 2000
+ 0x12, // and
+ 0x18, // not
+ 0x31, 0x04, // bnt [not first refresh]
+ 0x35, 0x00, // ldi 00
+ SIG_MAGICDWORD,
+ 0x65, 0x1e, // aTop curIcon
+ 0x67, 0x30, // pTos state
+ 0x34, SIG_UINT16 + 0xff, 0xdf, // ldi dfff
+ 0x12, // and
+ 0x65, 0x30, // aTop state
+ 0x38, SIG_SELECTOR16 + SELECTOR_show, // pushi "show" ("show" is e1h for KQ6CD)
+ 0x78, // push1
+ 0x87, 0x00, // lap param[0]
+ 0x31, 0x04, // bnt [use global for show]
+ 0x87, 0x01, // lap param[1]
+ 0x33, 0x02, // jmp [use param for show]
+ 0x81, 0x00, // lag global[0]
+ 0x36, // push
+ 0x54, 0x06, // self 06 (KqInv::show)
+ 0x31, SIG_ADDTOOFFSET + 1, // bnt [exit menu code] (0x08 for PC, 0x07 for mac)
+ 0x39, 0x39, // pushi 39
+ 0x76, // push0
+ 0x54, 0x04, // self 04 (KqInv::doit)
+ SIG_END // followed by jmp (0x32 for PC, 0x33 for mac)
+};
+
+const uint16 kq6PatchInventoryStackFix[] = {
+ 0x67, 0x30, // pTos state
+ 0x3c, // dup (1 more byte, needed for patch)
+ 0x3c, // dup (1 more byte, saves 1 byte later)
+ 0x34, PATCH_UINT16 + 0x00, 0x20, // ldi 2000
+ 0x12, // and
+ 0x2f, 0x02, // bt [not first refresh] - saves 3 bytes in total
+ 0x65, 0x1e, // aTop curIcon
+ 0x00, // neg (either 2000 or 0000 in acc, this will create dfff or ffff) - saves 2 bytes
+ 0x12, // and
+ 0x65, 0x30, // aTop state
+ 0x38, // pushi "show"
+ PATCH_GETORIGINALBYTE +22,
+ PATCH_GETORIGINALBYTE +23,
+ 0x78, // push1
+ 0x87, 0x00, // lap param[0]
+ 0x31, 0x04, // bnt [call show using global 0]
+ 0x8f, 0x01, // lsp param[1], save 1 byte total with lsg global[0] combined
+ 0x33, 0x02, // jmp [call show using param 1]
+ 0x89, 0x00, // lsg global[0], save 1 byte total, see above
+ 0x54, 0x06, // self 06 (call x::show)
+ 0x31, // bnt [menu exit code]
+ PATCH_GETORIGINALBYTEADJUST +39, +6,// dynamic offset must be 0x0E for PC and 0x0D for mac
+ 0x34, PATCH_UINT16 + 0x00, 0x20, // ldi 2000
+ 0x12, // and
+ 0x2f, 0x05, // bt [to return]
+ 0x39, 0x39, // pushi 39
+ 0x76, // push0
+ 0x54, 0x04, // self 04 (self::doit)
+ 0x48, // ret (saves 2 bytes for PC, 1 byte for mac)
+ PATCH_END
+};
+
+// script, description, signature patch
+SciScriptPatcherEntry kq6Signatures[] = {
+ { 481, "duplicate baby cry", 1, 0, 0, kq6SignatureDuplicateBabyCry, kq6PatchDuplicateBabyCry },
+ { 907, "inventory stack fix", 1, 0, 0, kq6SignatureInventoryStackFix, kq6PatchInventoryStackFix },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -756,40 +886,40 @@ const SciScriptSignature kq6Signatures[] = {
// the function is undefined, thus kStrCat() that is called inside the function
// reads a random pointer and crashes. We patch all of the 5 function calls
// (one for each letter typed from "R", "O", "B", "I", "N") so that they are
-// the same as the English version. Fixes bug #3048054.
-const byte longbowSignatureShowHandCode[] = {
- 3,
- 0x78, // push1
- 0x78, // push1
- 0x72, // lofsa
- +2, 2, // skip 2 bytes, offset of lofsa (the letter typed)
- 0x36, // push
- 0x40, // call
- +2, 3, // skip 2 bytes, offset of call
- 0x02, // perform the call above with 2 parameters
- 0x36, // push
- 0x40, // call
- +2, 8, // skip 2 bytes, offset of call
- 0x02, // perform the call above with 2 parameters
- 0x38, 0x1c, 0x01, // pushi 011c (setMotion)
- 0x39, 0x04, // pushi 04 (x)
- 0x51, 0x1e, // class MoveTo
- 0
+// the same as the English version.
+// Applies to at least: German floppy
+// Responsible method: unknown
+// Fixes bug: #3048054
+const uint16 longbowSignatureShowHandCode[] = {
+ 0x78, // push1
+ 0x78, // push1
+ 0x72, SIG_ADDTOOFFSET +2, // lofsa (letter, that was typed)
+ 0x36, // push
+ 0x40, SIG_ADDTOOFFSET +2, // call
+ 0x02, // perform the call above with 2 parameters
+ 0x36, // push
+ 0x40, SIG_ADDTOOFFSET +2, // call
+ SIG_MAGICDWORD,
+ 0x02, // perform the call above with 2 parameters
+ 0x38, SIG_SELECTOR16 + SELECTOR_setMotion, // pushi "setMotion" (0x11c in Longbow German)
+ 0x39, SIG_SELECTOR8 + SELECTOR_x, // pushi "x" (0x04 in Longbow German)
+ 0x51, 0x1e, // class MoveTo
+ SIG_END
};
const uint16 longbowPatchShowHandCode[] = {
- 0x39, 0x01, // pushi 1 (combine the two push1's in one, like in the English version)
- PATCH_ADDTOOFFSET | +3, // leave the lofsa call untouched
+ 0x39, 0x01, // pushi 1 (combine the two push1's in one, like in the English version)
+ PATCH_ADDTOOFFSET +3, // leave the lofsa call untouched
// The following will remove the duplicate call
- 0x32, 0x02, 0x00, // jmp 02 - skip 2 bytes (the remainder of the first call)
- 0x48, // ret (dummy, should never be reached)
- 0x48, // ret (dummy, should never be reached)
+ 0x32, PATCH_UINT16 + 0x02, 0x00, // jmp 02 - skip 2 bytes (the remainder of the first call)
+ 0x48, // ret (dummy, should never be reached)
+ 0x48, // ret (dummy, should never be reached)
PATCH_END
};
-// script, description, magic DWORD, adjust
-const SciScriptSignature longbowSignatures[] = {
- { 210, "hand code crash", 5, PATCH_MAGICDWORD(0x02, 0x38, 0x1c, 0x01), -14, longbowSignatureShowHandCode, longbowPatchShowHandCode },
+// script, description, signature patch
+SciScriptPatcherEntry longbowSignatures[] = {
+ { 210, "hand code crash", 5, 0, 0, longbowSignatureShowHandCode, longbowPatchShowHandCode },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -807,31 +937,31 @@ const SciScriptSignature longbowSignatures[] = {
// "worked" in SSCI, but ScummVM/SCI doesn't allow that.
// That's why those points weren't granted here at all.
// We patch the script to use global 90, which seems to be unused in the whole game.
+// Applies to at least: English floppy
// Responsible method: rm63Script::handleEvent
-// Fixes bug #3614419
-const byte larry2SignatureWearParachutePoints[] = {
- 16,
- 0x35, 0x01, // ldi 01
- 0xa1, 0x8e, // sag 8e
- 0x80, 0xe0, 0x01, // lag 1e0
- 0x18, // not
- 0x30, 0x0f, 0x00, // bnt [don't give points]
- 0x35, 0x01, // ldi 01
- 0xa0, 0xe0, 0x01, // sag 1e0
- 0
+// Fixes bug: #3614419
+const uint16 larry2SignatureWearParachutePoints[] = {
+ 0x35, 0x01, // ldi 01
+ 0xa1, SIG_MAGICDWORD, 0x8e, // sag 8e
+ 0x80, SIG_UINT16 + 0xe0, 0x01, // lag 1e0
+ 0x18, // not
+ 0x30, SIG_UINT16 + 0x0f, 0x00, // bnt [don't give points]
+ 0x35, 0x01, // ldi 01
+ 0xa0, 0xe0, 0x01, // sag 1e0
+ SIG_END
};
const uint16 larry2PatchWearParachutePoints[] = {
- PATCH_ADDTOOFFSET | +4,
- 0x80, 0x5a, 0x00, // lag 5a (global 90)
- PATCH_ADDTOOFFSET | +6,
- 0xa0, 0x5a, 0x00, // sag 5a (global 90)
+ PATCH_ADDTOOFFSET +4,
+ 0x80, PATCH_UINT16 + 0x5a, 0x00, // lag 5a (global 90)
+ PATCH_ADDTOOFFSET +6,
+ 0xa0, PATCH_UINT16 + 0x5a, 0x00, // sag 5a (global 90)
PATCH_END
};
-// script, description, magic DWORD, adjust
-const SciScriptSignature larry2Signatures[] = {
- { 63, "plane: no points for wearing plane", 1, PATCH_MAGICDWORD(0x8e, 0x80, 0xe0, 0x01), -3, larry2SignatureWearParachutePoints, larry2PatchWearParachutePoints },
+// script, description, signature patch
+SciScriptPatcherEntry larry2Signatures[] = {
+ { 63, "plane: no points for wearing plane", 1, 0, 0, larry2SignatureWearParachutePoints, larry2PatchWearParachutePoints },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -843,77 +973,79 @@ const SciScriptSignature larry2Signatures[] = {
// doesn't happen anymore. We would otherwise get a crash
// calling for invalid views (this happens of course also
// in sierra sci)
-const byte larry6SignatureDeathDialog[] = {
- 7,
- 0x3e, 0x33, 0x01, // link 0133 (offset 0x20)
- 0x35, 0xff, // ldi ff
- 0xa3, 0x00, // sal 00
- +255, 0,
- +255, 0,
- +170, 12, // [skip 680 bytes]
- 0x8f, 0x01, // lsp 01 (offset 0x2cf)
- 0x7a, // push2
- 0x5a, 0x04, 0x00, 0x0e, 0x01, // lea 0004 010e
- 0x36, // push
- 0x43, 0x7c, 0x0e, // kMessage[7c] 0e
- +90, 10, // [skip 90 bytes]
- 0x38, 0xd6, 0x00, // pushi 00d6 (offset 0x335)
- 0x78, // push1
- 0x5a, 0x04, 0x00, 0x0e, 0x01, // lea 0004 010e
- 0x36, // push
- +76, 11, // [skip 76 bytes]
- 0x38, 0xcd, 0x00, // pushi 00cd (offset 0x38b)
- 0x39, 0x03, // pushi 03
- 0x5a, 0x04, 0x00, 0x0e, 0x01, // lea 0004 010e
+// Applies to at least: German PC-CD
+// Responsible method: unknown
+const uint16 larry6SignatureDeathDialog[] = {
+ SIG_MAGICDWORD,
+ 0x3e, SIG_UINT16 + 0x33, 0x01, // link 0133 (offset 0x20)
+ 0x35, 0xff, // ldi ff
+ 0xa3, 0x00, // sal 00
+ SIG_ADDTOOFFSET +680, // [skip 680 bytes]
+ 0x8f, 0x01, // lsp 01 (offset 0x2cf)
+ 0x7a, // push2
+ 0x5a, SIG_UINT16 + 0x04, 0x00, SIG_UINT16 + 0x0e, 0x01, // lea 0004 010e
+ 0x36, // push
+ 0x43, 0x7c, 0x0e, // kMessage[7c] 0e
+ SIG_ADDTOOFFSET +90, // [skip 90 bytes]
+ 0x38, SIG_UINT16 + 0xd6, 0x00, // pushi 00d6 (offset 0x335)
+ 0x78, // push1
+ 0x5a, SIG_UINT16 + 0x04, 0x00, SIG_UINT16 + 0x0e, 0x01, // lea 0004 010e
+ 0x36, // push
+ SIG_ADDTOOFFSET +76, // [skip 76 bytes]
+ 0x38, SIG_UINT16 + 0xcd, 0x00, // pushi 00cd (offset 0x38b)
+ 0x39, 0x03, // pushi 03
+ 0x5a, SIG_UINT16 + 0x04, 0x00, SIG_UINT16 + 0x0e, 0x01, // lea 0004 010e
0x36,
- 0
+ SIG_END
};
const uint16 larry6PatchDeathDialog[] = {
- 0x3e, 0x00, 0x02, // link 0200
- PATCH_ADDTOOFFSET | +687,
- 0x5a, 0x04, 0x00, 0x40, 0x01, // lea 0004 0140
- PATCH_ADDTOOFFSET | +98,
- 0x5a, 0x04, 0x00, 0x40, 0x01, // lea 0004 0140
- PATCH_ADDTOOFFSET | +82,
- 0x5a, 0x04, 0x00, 0x40, 0x01, // lea 0004 0140
+ 0x3e, 0x00, 0x02, // link 0200
+ PATCH_ADDTOOFFSET +687,
+ 0x5a, PATCH_UINT16 + 0x04, 0x00, PATCH_UINT16 + 0x40, 0x01, // lea 0004 0140
+ PATCH_ADDTOOFFSET +98,
+ 0x5a, PATCH_UINT16 + 0x04, 0x00, PATCH_UINT16 + 0x40, 0x01, // lea 0004 0140
+ PATCH_ADDTOOFFSET +82,
+ 0x5a, PATCH_UINT16 + 0x04, 0x00, PATCH_UINT16 + 0x40, 0x01, // lea 0004 0140
PATCH_END
};
-// script, description, magic DWORD, adjust
-const SciScriptSignature larry6Signatures[] = {
- { 82, "death dialog memory corruption", 1, PATCH_MAGICDWORD(0x3e, 0x33, 0x01, 0x35), 0, larry6SignatureDeathDialog, larry6PatchDeathDialog },
+// script, description, signature patch
+SciScriptPatcherEntry larry6Signatures[] = {
+ { 82, "death dialog memory corruption", 1, 0, 0, larry6SignatureDeathDialog, larry6PatchDeathDialog },
SCI_SIGNATUREENTRY_TERMINATOR
};
// ===========================================================================
// rm560::doit was supposed to close the painting, when Heimlich enters the
-// room. The code is buggy, so it actually closes the painting, when heimlich
+// room. The code is buggy. It actually closes the painting, when heimlich
// is not in the room. We fix that.
-const byte laurabow2SignaturePaintingClosing[] = {
- 17,
- 0x4a, 0x04, // send 04 - read aHeimlich::room
- 0x36, // push
- 0x81, 0x0b, // lag global[11d] -> current room
- 0x1c, // ne?
- 0x31, 0x0e, // bnt [don't close]
- 0x35, 0x00, // ldi 00
- 0xa3, 0x00, // sal local[0]
- 0x38, 0x92, 0x00, // pushi 0092
- 0x78, // push1
- 0x72, // lofsa sDumpSafe
- 0
+// Applies to at least: English floppy
+// Responsible method: rm560::doit
+const uint16 laurabow2SignaturePaintingClosing[] = {
+ 0x4a, 0x04, // send 04 - read aHeimlich::room
+ SIG_MAGICDWORD,
+ 0x36, // push
+ 0x81, 0x0b, // lag global[11d] -> current room
+ 0x1c, // ne?
+ 0x31, 0x0e, // bnt [don't close]
+ 0x35, 0x00, // ldi 00
+ 0xa3, 0x00, // sal local[0]
+ 0x38, SIG_UINT16 + 0x92, 0x00, // pushi 0092
+ 0x78, // push1
+ 0x72, // lofsa sDumpSafe
+ SIG_END
};
const uint16 laurabow2PatchPaintingClosing[] = {
- PATCH_ADDTOOFFSET | +6,
+ PATCH_ADDTOOFFSET +6,
0x2f, 0x0e, // bt [don't close]
PATCH_END
};
-// script, description, magic DWORD, adjust
-const SciScriptSignature laurabow2Signatures[] = {
- { 560, "painting closing immediately", 1, PATCH_MAGICDWORD(0x36, 0x81, 0x0b, 0x1c), -2, laurabow2SignaturePaintingClosing, laurabow2PatchPaintingClosing },
+// script, description, signature patch
+SciScriptPatcherEntry laurabow2Signatures[] = {
+ { 560, "painting closing immediately", 1, 0, 0, laurabow2SignaturePaintingClosing, laurabow2PatchPaintingClosing },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -922,29 +1054,27 @@ const SciScriptSignature laurabow2Signatures[] = {
// MG::replay somewhat calculates the savedgame-id used when saving again
// this doesn't work right and we remove the code completely.
// We set the savedgame-id directly right after restoring in kRestoreGame.
-const byte mothergoose256SignatureReplay[] = {
- 6,
- 0x36, // push
- 0x35, 0x20, // ldi 20
- 0x04, // sub
- 0xa1, 0xb3, // sag global[b3]
- 0
+const uint16 mothergoose256SignatureReplay[] = {
+ 0x36, // push
+ 0x35, SIG_MAGICDWORD, 0x20, // ldi 20
+ 0x04, // sub
+ 0xa1, 0xb3, // sag global[b3]
+ SIG_END
};
const uint16 mothergoose256PatchReplay[] = {
- 0x34, 0x00, 0x00, // ldi 0000 (dummy)
- 0x34, 0x00, 0x00, // ldi 0000 (dummy)
+ 0x34, PATCH_UINT16 + 0x00, 0x00, // ldi 0000 (dummy)
+ 0x34, PATCH_UINT16 + 0x00, 0x00, // ldi 0000 (dummy)
PATCH_END
};
// when saving, it also checks if the savegame ID is below 13.
// we change this to check if below 113 instead
-const byte mothergoose256SignatureSaveLimit[] = {
- 5,
- 0x89, 0xb3, // lsg global[b3]
- 0x35, 0x0d, // ldi 0d
- 0x20, // ge?
- 0
+const uint16 mothergoose256SignatureSaveLimit[] = {
+ 0x89, SIG_MAGICDWORD, 0xb3, // lsg global[b3]
+ 0x35, 0x0d, // ldi 0d
+ 0x20, // ge?
+ SIG_END
};
const uint16 mothergoose256PatchSaveLimit[] = {
@@ -953,11 +1083,11 @@ const uint16 mothergoose256PatchSaveLimit[] = {
PATCH_END
};
-// script, description, magic DWORD, adjust
-const SciScriptSignature mothergoose256Signatures[] = {
- { 0, "replay save issue", 1, PATCH_MAGICDWORD(0x20, 0x04, 0xa1, 0xb3), -2, mothergoose256SignatureReplay, mothergoose256PatchReplay },
- { 0, "save limit dialog (SCI1.1)", 1, PATCH_MAGICDWORD(0xb3, 0x35, 0x0d, 0x20), -1, mothergoose256SignatureSaveLimit, mothergoose256PatchSaveLimit },
- { 994, "save limit dialog (SCI1)", 1, PATCH_MAGICDWORD(0xb3, 0x35, 0x0d, 0x20), -1, mothergoose256SignatureSaveLimit, mothergoose256PatchSaveLimit },
+// script, description, signature patch
+SciScriptPatcherEntry mothergoose256Signatures[] = {
+ { 0, "replay save issue", 1, 0, 0, mothergoose256SignatureReplay, mothergoose256PatchReplay },
+ { 0, "save limit dialog (SCI1.1)", 1, 0, 0, mothergoose256SignatureSaveLimit, mothergoose256PatchSaveLimit },
+ { 994, "save limit dialog (SCI1)", 1, 0, 0, mothergoose256SignatureSaveLimit, mothergoose256PatchSaveLimit },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -971,55 +1101,56 @@ const SciScriptSignature mothergoose256Signatures[] = {
// SSCI.
// This patch changes the code, so that the gun is actually given away
// when the 2 seconds have passed and the locker got closed.
+// Applies to at least: English floppy
// Responsible method: putGun::changeState (script 341)
-// Fixes bug #3036933 / #3303802
-const byte pq1vgaSignaturePutGunInLockerBug[] = {
- 5,
- 0x35, 0x00, // ldi 00
- 0x1a, // eq?
- 0x31, 0x25, // bnt [next state check]
- +22, 29, // [skip 22 bytes]
- 0x38, 0x5f, 0x01, // pushi 15fh
- 0x78, // push1
- 0x76, // push0
- 0x81, 0x00, // lag 00
- 0x4a, 0x06, // send 06 - ego::put(0)
- 0x35, 0x02, // ldi 02
- 0x65, 0x1c, // aTop 1c (set timer to 2 seconds)
- 0x33, 0x0e, // jmp [end of method]
- 0x3c, // dup --- next state check target
- 0x35, 0x01, // ldi 01
- 0x1a, // eq?
- 0x31, 0x08, // bnt [end of method]
- 0x39, 0x6f, // pushi 6fh
- 0x76, // push0
- 0x72, 0x88, 0x00, // lofsa 0088
- 0x4a, 0x04, // send 04 - locker::dispose
- 0
+// Fixes bug: #3036933 / #3303802
+const uint16 pq1vgaSignaturePutGunInLockerBug[] = {
+ 0x35, 0x00, // ldi 00
+ 0x1a, // eq?
+ 0x31, 0x25, // bnt [next state check]
+ SIG_ADDTOOFFSET +22, // [skip 22 bytes]
+ SIG_MAGICDWORD,
+ 0x38, SIG_SELECTOR16 + SELECTOR_put, // pushi "put"
+ 0x78, // push1
+ 0x76, // push0
+ 0x81, 0x00, // lag 00
+ 0x4a, 0x06, // send 06 - ego::put(0)
+ 0x35, 0x02, // ldi 02
+ 0x65, 0x1c, // aTop 1c (set timer to 2 seconds)
+ 0x33, 0x0e, // jmp [end of method]
+ 0x3c, // dup --- next state check target
+ 0x35, 0x01, // ldi 01
+ 0x1a, // eq?
+ 0x31, 0x08, // bnt [end of method]
+ 0x39, SIG_SELECTOR8 + SELECTOR_dispose, // pushi "dispose"
+ 0x76, // push0
+ 0x72, SIG_UINT16 + 0x88, 0x00, // lofsa 0088
+ 0x4a, 0x04, // send 04 - locker::dispose
+ SIG_END
};
const uint16 pq1vgaPatchPutGunInLockerBug[] = {
- PATCH_ADDTOOFFSET | +3,
- 0x31, 0x1c, // bnt [next state check]
- PATCH_ADDTOOFFSET | +22,
- 0x35, 0x02, // ldi 02
- 0x65, 0x1c, // aTop 1c (set timer to 2 seconds)
- 0x33, 0x17, // jmp [end of method]
- 0x3c, // dup --- next state check target
- 0x35, 0x01, // ldi 01
- 0x1a, // eq?
- 0x31, 0x11, // bnt [end of method]
- 0x38, 0x5f, 0x01, // pushi 15fh
- 0x78, // push1
- 0x76, // push0
- 0x81, 0x00, // lag 00
- 0x4a, 0x06, // send 06 - ego::put(0)
+ PATCH_ADDTOOFFSET +3,
+ 0x31, 0x1c, // bnt [next state check]
+ PATCH_ADDTOOFFSET +22,
+ 0x35, 0x02, // ldi 02
+ 0x65, 0x1c, // aTop 1c (set timer to 2 seconds)
+ 0x33, 0x17, // jmp [end of method]
+ 0x3c, // dup --- next state check target
+ 0x35, 0x01, // ldi 01
+ 0x1a, // eq?
+ 0x31, 0x11, // bnt [end of method]
+ 0x38, PATCH_SELECTOR16 + SELECTOR_put, // pushi "put"
+ 0x78, // push1
+ 0x76, // push0
+ 0x81, 0x00, // lag 00
+ 0x4a, 0x06, // send 06 - ego::put(0)
PATCH_END
};
-// script, description, magic DWORD, adjust
-const SciScriptSignature pq1vgaSignatures[] = {
- { 341, "put gun in locker bug", 1, PATCH_MAGICDWORD(0x38, 0x5f, 0x01, 0x78), -27, pq1vgaSignaturePutGunInLockerBug, pq1vgaPatchPutGunInLockerBug },
+// script, description, signature patch
+SciScriptPatcherEntry pq1vgaSignatures[] = {
+ { 341, "put gun in locker bug", 1, 0, 0, pq1vgaSignaturePutGunInLockerBug, pq1vgaPatchPutGunInLockerBug },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -1032,43 +1163,45 @@ const SciScriptSignature pq1vgaSignatures[] = {
// not nearly as bad as in our sci, but these differences may be caused by
// timing.
// We just reuse the active event, thus removing the duplicate kGetEvent call.
-const byte qfg1vgaSignatureFightEvents[] = {
- 25,
- 0x39, 0x6d, // pushi 6d (selector new)
- 0x76, // push0
- 0x51, 0x07, // class Event
- 0x4a, 0x04, // send 04 - call Event::new
- 0xa5, 0x00, // sat temp[0]
- 0x78, // push1
- 0x76, // push0
- 0x4a, 0x04, // send 04 - read Event::x
- 0xa5, 0x03, // sat temp[3]
- 0x76, // push0 (selector y)
- 0x76, // push0
- 0x85, 0x00, // lat temp[0]
- 0x4a, 0x04, // send 04 - read Event::y
- 0x36, // push
- 0x35, 0x0a, // ldi 0a
- 0x04, // sub (poor mans localization) ;-)
- 0
+// Applies to at least: English floppy
+// Responsible method: pointBox::doit
+const uint16 qfg1vgaSignatureFightEvents[] = {
+ 0x39, SIG_MAGICDWORD,
+ SIG_SELECTOR8 + SELECTOR_new, // pushi "new"
+ 0x76, // push0
+ 0x51, 0x07, // class Event
+ 0x4a, 0x04, // send 04 - call Event::new
+ 0xa5, 0x00, // sat temp[0]
+ 0x78, // push1
+ 0x76, // push0
+ 0x4a, 0x04, // send 04 - read Event::x
+ 0xa5, 0x03, // sat temp[3]
+ 0x76, // push0 (selector y)
+ 0x76, // push0
+ 0x85, 0x00, // lat temp[0]
+ 0x4a, 0x04, // send 04 - read Event::y
+ 0x36, // push
+ 0x35, 0x0a, // ldi 0a
+ 0x04, // sub (poor mans localization) ;-)
+ SIG_END
};
const uint16 qfg1vgaPatchFightEvents[] = {
- 0x38, 0x5a, 0x01, // pushi 15a (selector curEvent)
- 0x76, // push0
- 0x81, 0x50, // lag global[50]
- 0x4a, 0x04, // send 04 - read User::curEvent -> needs one byte more than previous code
- 0xa5, 0x00, // sat temp[0]
- 0x78, // push1
- 0x76, // push0
- 0x4a, 0x04, // send 04 - read Event::x
- 0xa5, 0x03, // sat temp[3]
- 0x76, // push0 (selector y)
- 0x76, // push0
- 0x85, 0x00, // lat temp[0]
- 0x4a, 0x04, // send 04 - read Event::y
- 0x39, 0x00, // pushi 00
- 0x02, // add (waste 3 bytes) - we don't need localization, User::doit has already done it
+ 0x38, PATCH_SELECTOR16 + SELECTOR_curEvent, // pushi 15a (selector curEvent)
+ 0x76, // push0
+ 0x81, 0x50, // lag global[50]
+ 0x4a, 0x04, // send 04 - read User::curEvent -> needs one byte more than previous code
+ 0xa5, 0x00, // sat temp[0]
+ 0x78, // push1
+ 0x76, // push0
+ 0x4a, 0x04, // send 04 - read Event::x
+ 0xa5, 0x03, // sat temp[3]
+ 0x76, // push0 (selector y)
+ 0x76, // push0
+ 0x85, 0x00, // lat temp[0]
+ 0x4a, 0x04, // send 04 - read Event::y
+ 0x39, 0x00, // pushi 00
+ 0x02, // add (waste 3 bytes) - we don't need localization, User::doit has already done it
PATCH_END
};
@@ -1082,28 +1215,28 @@ const uint16 qfg1vgaPatchFightEvents[] = {
// Fixes bug #3568431.
// Patch 1: Increase temp space
-const byte qfg1vgaSignatureTempSpace[] = {
- 4,
- 0x3f, 0xba, // link 0xba
- 0x87, 0x00, // lap 0
- 0
+const uint16 qfg1vgaSignatureTempSpace[] = {
+ SIG_MAGICDWORD,
+ 0x3f, 0xba, // link 0xba
+ 0x87, 0x00, // lap 0
+ SIG_END
};
const uint16 qfg1vgaPatchTempSpace[] = {
- 0x3f, 0xca, // link 0xca
+ 0x3f, 0xca, // link 0xca
PATCH_END
};
// Patch 2: Move the pointer used for the window header a little bit
-const byte qfg1vgaSignatureDialogHeader[] = {
- 4,
- 0x5b, 0x04, 0x80, // lea temp[0x80]
- 0x36, // push
- 0
+const uint16 qfg1vgaSignatureDialogHeader[] = {
+ SIG_MAGICDWORD,
+ 0x5b, 0x04, 0x80, // lea temp[0x80]
+ 0x36, // push
+ SIG_END
};
const uint16 qfg1vgaPatchDialogHeader[] = {
- 0x5b, 0x04, 0x90, // lea temp[0x90]
+ 0x5b, 0x04, 0x90, // lea temp[0x90]
PATCH_END
};
@@ -1116,62 +1249,63 @@ const uint16 qfg1vgaPatchDialogHeader[] = {
// the crusher, ego is supposed to move close to position 79, 165. We change it
// to 85, 165, which is not an edge case thus the freeze is avoided.
// Fixes bug #3585189.
-const byte qfg1vgaSignatureMoveToCrusher[] = {
- 9,
- 0x51, 0x1f, // class Motion
- 0x36, // push
- 0x39, 0x4f, // pushi 4f (79 - x)
- 0x38, 0xa5, 0x00, // pushi 00a5 (165 - y)
- 0x7c, // pushSelf
- 0
+const uint16 qfg1vgaSignatureMoveToCrusher[] = {
+ SIG_MAGICDWORD,
+ 0x51, 0x1f, // class Motion
+ 0x36, // push
+ 0x39, 0x4f, // pushi 4f (79 - x)
+ 0x38, SIG_UINT16 + 0xa5, 0x00, // pushi 00a5 (165 - y)
+ 0x7c, // pushSelf
+ SIG_END
};
const uint16 qfg1vgaPatchMoveToCrusher[] = {
- PATCH_ADDTOOFFSET | +3,
- 0x39, 0x55, // pushi 55 (85 - x)
+ PATCH_ADDTOOFFSET +3,
+ 0x39, 0x55, // pushi 55 (85 - x)
PATCH_END
};
// Same pathfinding bug as above, where Ego is set to move to an impossible
// spot when sneaking. In GuardsTrumpet::changeState, we change the final
// location where Ego is moved from 111, 111 to 114, 114. Fixes bug #3604939.
-const byte qfg1vgaSignatureMoveToCastleGate[] = {
- 7,
- 0x51, 0x1f, // class MoveTo
- 0x36, // push
- 0x39, 0x6f, // pushi 6f (111 - x)
- 0x3c, // dup (111 - y)
- 0x7c, // pushSelf
- 0
+const uint16 qfg1vgaSignatureMoveToCastleGate[] = {
+ SIG_MAGICDWORD,
+ 0x51, 0x1f, // class MoveTo
+ 0x36, // push
+ 0x39, 0x6f, // pushi 6f (111 - x)
+ 0x3c, // dup (111 - y)
+ 0x7c, // pushSelf
+ SIG_END
};
const uint16 qfg1vgaPatchMoveToCastleGate[] = {
- PATCH_ADDTOOFFSET | +3,
- 0x39, 0x72, // pushi 72 (114 - x)
+ PATCH_ADDTOOFFSET +3,
+ 0x39, 0x72, // pushi 72 (114 - x)
PATCH_END
};
// Typo in the original Sierra scripts
// Looking at a cheetaur resulted in a text about a Saurus Rex
// The code treats both monster types the same.
+// Applies to at least: English floppy
// Responsible method: smallMonster::doVerb
// Fixes bug #3604943.
-const byte qfg1vgaSignatureCheetaurDescription[] = {
- 16,
- 0x34, 0xb8, 0x01, // ldi 01b8
- 0x1a, // eq?
- 0x31, 0x16, // bnt 16
- 0x38, 0x27, 0x01, // pushi 0127
- 0x39, 0x06, // pushi 06
- 0x39, 0x03, // pushi 03
- 0x78, // push1
- 0x39, 0x12, // pushi 12 -> monster type Saurus Rex
- 0
+const uint16 qfg1vgaSignatureCheetaurDescription[] = {
+ SIG_MAGICDWORD,
+ 0x34, SIG_UINT16 + 0xb8, 0x01, // ldi 01b8
+ 0x1a, // eq?
+ 0x31, 0x16, // bnt 16
+ 0x38, SIG_UINT16 + 0x27, 0x01, // pushi 0127
+ 0x39, 0x06, // pushi 06
+ 0x39, 0x03, // pushi 03
+ 0x78, // push1
+ 0x39, 0x12, // pushi 12 -> monster type Saurus Rex
+ SIG_END
};
const uint16 qfg1vgaPatchCheetaurDescription[] = {
- PATCH_ADDTOOFFSET | +14,
- 0x39, 0x11, // pushi 11 -> monster type cheetaur
+ PATCH_ADDTOOFFSET +14,
+ 0x39, 0x11, // pushi 11 -> monster type cheetaur
PATCH_END
};
@@ -1185,41 +1319,42 @@ const uint16 qfg1vgaPatchCheetaurDescription[] = {
// Local 5 of that room is a timer, that closes the door (object door11).
// Setting it to 1 during happyFace::changeState(0) stops door11::doit from
// calling goTo6::init, so the whole issue is stopped from happening.
+// Applies to at least: English floppy
// Responsible method: happyFace::changeState, door11::doit
// Fixes bug #3585793
-const byte qfg1vgaSignatureFunnyRoomFix[] = {
- 14,
- 0x65, 0x14, // aTop 14 (state)
- 0x36, // push
- 0x3c, // dup
- 0x35, 0x00, // ldi 00
- 0x1a, // eq?
- 0x30, 0x25, 0x00, // bnt 0025 [-> next state]
- 0x35, 0x01, // ldi 01
- 0xa3, 0x4e, // sal 4e
- 0
+const uint16 qfg1vgaSignatureFunnyRoomFix[] = {
+ 0x65, 0x14, // aTop 14 (state)
+ 0x36, // push
+ 0x3c, // dup
+ 0x35, 0x00, // ldi 00
+ 0x1a, // eq?
+ 0x30, SIG_UINT16 + 0x25, 0x00, // bnt 0025 [-> next state]
+ SIG_MAGICDWORD,
+ 0x35, 0x01, // ldi 01
+ 0xa3, 0x4e, // sal 4e
+ SIG_END
};
const uint16 qfg1vgaPatchFunnyRoomFix[] = {
- PATCH_ADDTOOFFSET | +3,
- 0x2e, 0x29, 0x00, // bt 0029 [-> next state] - saves 4 bytes
- 0x35, 0x01, // ldi 01
- 0xa3, 0x4e, // sal 4e
- 0xa3, 0x05, // sal 05 (sets local 5 to 1)
- 0xa3, 0x05, // and again to make absolutely sure (actually to waste 2 bytes)
+ PATCH_ADDTOOFFSET +3,
+ 0x2e, PATCH_UINT16 + 0x29, 0x00, // bt 0029 [-> next state] - saves 4 bytes
+ 0x35, 0x01, // ldi 01
+ 0xa3, 0x4e, // sal 4e
+ 0xa3, 0x05, // sal 05 (sets local 5 to 1)
+ 0xa3, 0x05, // and again to make absolutely sure (actually to waste 2 bytes)
PATCH_END
};
-// script, description, magic DWORD, adjust
-const SciScriptSignature qfg1vgaSignatures[] = {
- { 215, "fight event issue", 1, PATCH_MAGICDWORD(0x6d, 0x76, 0x51, 0x07), -1, qfg1vgaSignatureFightEvents, qfg1vgaPatchFightEvents },
- { 216, "weapon master event issue", 1, PATCH_MAGICDWORD(0x6d, 0x76, 0x51, 0x07), -1, qfg1vgaSignatureFightEvents, qfg1vgaPatchFightEvents },
- { 814, "window text temp space", 1, PATCH_MAGICDWORD(0x3f, 0xba, 0x87, 0x00), 0, qfg1vgaSignatureTempSpace, qfg1vgaPatchTempSpace },
- { 814, "dialog header offset", 3, PATCH_MAGICDWORD(0x5b, 0x04, 0x80, 0x36), 0, qfg1vgaSignatureDialogHeader, qfg1vgaPatchDialogHeader },
- { 331, "moving to crusher", 1, PATCH_MAGICDWORD(0x51, 0x1f, 0x36, 0x39), 0, qfg1vgaSignatureMoveToCrusher, qfg1vgaPatchMoveToCrusher },
- { 41, "moving to castle gate", 1, PATCH_MAGICDWORD(0x51, 0x1f, 0x36, 0x39), 0, qfg1vgaSignatureMoveToCastleGate, qfg1vgaPatchMoveToCastleGate },
- { 210, "cheetaur description fixed", 1, PATCH_MAGICDWORD(0x34, 0xb8, 0x01, 0x1a), 0, qfg1vgaSignatureCheetaurDescription, qfg1vgaPatchCheetaurDescription },
- { 96, "funny room script bug fixed", 1, PATCH_MAGICDWORD(0x35, 0x01, 0xa3, 0x4e), -10, qfg1vgaSignatureFunnyRoomFix, qfg1vgaPatchFunnyRoomFix },
+// script, description, signature patch
+SciScriptPatcherEntry qfg1vgaSignatures[] = {
+ { 215, "fight event issue", 1, 0, 0, qfg1vgaSignatureFightEvents, qfg1vgaPatchFightEvents },
+ { 216, "weapon master event issue", 1, 0, 0, qfg1vgaSignatureFightEvents, qfg1vgaPatchFightEvents },
+ { 814, "window text temp space", 1, 0, 0, qfg1vgaSignatureTempSpace, qfg1vgaPatchTempSpace },
+ { 814, "dialog header offset", 3, 0, 0, qfg1vgaSignatureDialogHeader, qfg1vgaPatchDialogHeader },
+ { 331, "moving to crusher", 1, 0, 0, qfg1vgaSignatureMoveToCrusher, qfg1vgaPatchMoveToCrusher },
+ { 41, "moving to castle gate", 1, 0, 0, qfg1vgaSignatureMoveToCastleGate, qfg1vgaPatchMoveToCastleGate },
+ { 210, "cheetaur description fixed", 1, 0, 0, qfg1vgaSignatureCheetaurDescription, qfg1vgaPatchCheetaurDescription },
+ { 96, "funny room script bug fixed", 1, 0, 0, qfg1vgaSignatureFunnyRoomFix, qfg1vgaPatchFunnyRoomFix },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -1237,49 +1372,47 @@ const SciScriptSignature qfg1vgaSignatures[] = {
// and text entry refreshes whenever a button is pressed, and prevent possible
// crashes because of these constant quick object reallocations. Fixes bug
// #3037996.
-const byte qfg2SignatureImportDialog[] = {
- 16,
- 0x63, 0x20, // pToa text
- 0x30, 0x0b, 0x00, // bnt [next state]
- 0x7a, // push2
- 0x39, 0x03, // pushi 03
- 0x36, // push
- 0x43, 0x72, 0x04, // callk Memory 4
- 0x35, 0x00, // ldi 00
- 0x65, 0x20, // aTop text
- 0
+const uint16 qfg2SignatureImportDialog[] = {
+ 0x63, SIG_MAGICDWORD, 0x20, // pToa text
+ 0x30, SIG_UINT16 + 0x0b, 0x00, // bnt [next state]
+ 0x7a, // push2
+ 0x39, 0x03, // pushi 03
+ 0x36, // push
+ 0x43, 0x72, 0x04, // callk Memory 4
+ 0x35, 0x00, // ldi 00
+ 0x65, 0x20, // aTop text
+ SIG_END
};
const uint16 qfg2PatchImportDialog[] = {
- PATCH_ADDTOOFFSET | +5,
- 0x48, // ret
+ PATCH_ADDTOOFFSET +5,
+ 0x48, // ret
PATCH_END
};
-// script, description, magic DWORD, adjust
-const SciScriptSignature qfg2Signatures[] = {
- { 944, "import dialog continuous calls", 1, PATCH_MAGICDWORD(0x20, 0x30, 0x0b, 0x00), -1, qfg2SignatureImportDialog, qfg2PatchImportDialog },
+// script, description, signature patch
+SciScriptPatcherEntry qfg2Signatures[] = {
+ { 944, "import dialog continuous calls", 1, 0, 0, qfg2SignatureImportDialog, qfg2PatchImportDialog },
SCI_SIGNATUREENTRY_TERMINATOR
};
// ===========================================================================
// Patch for the import screen in QFG3, same as the one for QFG2 above
-const byte qfg3SignatureImportDialog[] = {
- 15,
- 0x63, 0x2a, // pToa text
- 0x31, 0x0b, // bnt [next state]
- 0x7a, // push2
- 0x39, 0x03, // pushi 03
- 0x36, // push
- 0x43, 0x72, 0x04, // callk Memory 4
- 0x35, 0x00, // ldi 00
- 0x65, 0x2a, // aTop text
- 0
+const uint16 qfg3SignatureImportDialog[] = {
+ 0x63, SIG_MAGICDWORD, 0x2a, // pToa text
+ 0x31, 0x0b, // bnt [next state]
+ 0x7a, // push2
+ 0x39, 0x03, // pushi 03
+ 0x36, // push
+ 0x43, 0x72, 0x04, // callk Memory 4
+ 0x35, 0x00, // ldi 00
+ 0x65, 0x2a, // aTop text
+ SIG_END
};
const uint16 qfg3PatchImportDialog[] = {
- PATCH_ADDTOOFFSET | +4,
- 0x48, // ret
+ PATCH_ADDTOOFFSET +4,
+ 0x48, // ret
PATCH_END
};
@@ -1298,38 +1431,39 @@ const uint16 qfg3PatchImportDialog[] = {
// hero::solvePuzzle (0xfffc) which does a ret afterwards without going to
// Teller::doChild. We jump to this call of hero::solvePuzzle to get that same
// behaviour.
-
-const byte qfg3SignatureWooDialog[] = {
- 30,
- 0x67, 0x12, // pTos 12 (query)
- 0x35, 0xb6, // ldi b6
- 0x1a, // eq?
- 0x2f, 0x05, // bt 05
- 0x67, 0x12, // pTos 12 (query)
- 0x35, 0x9b, // ldi 9b
- 0x1a, // eq?
- 0x31, 0x0c, // bnt 0c
- 0x38, 0x97, 0x02, // pushi 0297
- 0x7a, // push2
- 0x38, 0x0c, 0x01, // pushi 010c
- 0x7a, // push2
- 0x81, 0x00, // lag 00
- 0x4a, 0x08, // send 08
- 0x67, 0x12, // pTos 12 (query)
- 0x35, 0xb5, // ldi b5
- 0
+// Applies to at least: English, German, Italian, French, Spanish Floppy
+// Responsible method: unknown
+const uint16 qfg3SignatureWooDialog[] = {
+ SIG_MAGICDWORD,
+ 0x67, 0x12, // pTos 12 (query)
+ 0x35, 0xb6, // ldi b6
+ 0x1a, // eq?
+ 0x2f, 0x05, // bt 05
+ 0x67, 0x12, // pTos 12 (query)
+ 0x35, 0x9b, // ldi 9b
+ 0x1a, // eq?
+ 0x31, 0x0c, // bnt 0c
+ 0x38, SIG_SELECTOR16 + SELECTOR_solvePuzzle, // pushi 0297
+ 0x7a, // push2
+ 0x38, SIG_UINT16 + 0x0c, 0x01, // pushi 010c
+ 0x7a, // push2
+ 0x81, 0x00, // lag 00
+ 0x4a, 0x08, // send 08
+ 0x67, 0x12, // pTos 12 (query)
+ 0x35, 0xb5, // ldi b5
+ SIG_END
};
const uint16 qfg3PatchWooDialog[] = {
- PATCH_ADDTOOFFSET | +0x29,
- 0x33, 0x11, // jmp to 0x6a2, the call to hero::solvePuzzle for 0xFFFC
+ PATCH_ADDTOOFFSET +0x29,
+ 0x33, 0x11, // jmp to 0x6a2, the call to hero::solvePuzzle for 0xFFFC
PATCH_END
};
-// script, description, magic DWORD, adjust
-const SciScriptSignature qfg3Signatures[] = {
- { 944, "import dialog continuous calls", 1, PATCH_MAGICDWORD(0x2a, 0x31, 0x0b, 0x7a), -1, qfg3SignatureImportDialog, qfg3PatchImportDialog },
- { 440, "dialog crash when asking about Woo", 1, PATCH_MAGICDWORD(0x67, 0x12, 0x35, 0xb5), -26, qfg3SignatureWooDialog, qfg3PatchWooDialog },
+// script, description, signature patch
+SciScriptPatcherEntry qfg3Signatures[] = {
+ { 944, "import dialog continuous calls", 1, 0, 0, qfg3SignatureImportDialog, qfg3PatchImportDialog },
+ { 440, "dialog crash when asking about Woo", 1, 0, 0, qfg3SignatureWooDialog, qfg3PatchWooDialog },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -1340,30 +1474,19 @@ const SciScriptSignature qfg3Signatures[] = {
// we never reach that of course, so the pterodactyl-flight will go endlessly
// we could either calculate property count differently somehow fixing this
// but I think just patching it out is cleaner (bug #3037938)
-const byte sq4FloppySignatureEndlessFlight[] = {
- 8,
- 0x39, 0x04, // pushi 04 (selector x)
- 0x78, // push1
- 0x67, 0x08, // pTos 08 (property x)
- 0x63, 0x44, // pToa 44 (invalid property)
- 0x02, // add
- 0
-};
-
-// Similar to the above, for the German version (bug #3110215)
-const byte sq4FloppySignatureEndlessFlightGerman[] = {
- 8,
- 0x39, 0x04, // pushi 04 (selector x)
- 0x78, // push1
- 0x67, 0x08, // pTos 08 (property x)
- 0x63, 0x4c, // pToa 4c (invalid property)
- 0x02, // add
- 0
+const uint16 sq4FloppySignatureEndlessFlight[] = {
+ 0x39, 0x04, // pushi 04 (selector x)
+ SIG_MAGICDWORD,
+ 0x78, // push1
+ 0x67, 0x08, // pTos 08 (property x)
+ 0x63, SIG_ADDTOOFFSET + 1, // pToa (invalid property) - 44h for English floppy, 4ch for German floppy
+ 0x02, // add
+ SIG_END
};
const uint16 sq4FloppyPatchEndlessFlight[] = {
- PATCH_ADDTOOFFSET | +5,
- 0x35, 0x03, // ldi 03 (which would be the content of the property)
+ PATCH_ADDTOOFFSET +5,
+ 0x35, 0x03, // ldi 03 (which would be the content of the property)
PATCH_END
};
@@ -1373,40 +1496,40 @@ const uint16 sq4FloppyPatchEndlessFlight[] = {
// Patch 1: iconTextSwitch::show, called when the text options button is shown.
// This is patched to add the "Both" text resource (i.e. we end up with
// "Speech", "Text" and "Both")
-const byte sq4CdSignatureTextOptionsButton[] = {
- 11,
- 0x35, 0x01, // ldi 0x01
- 0xa1, 0x53, // sag 0x53
- 0x39, 0x03, // pushi 0x03
- 0x78, // push1
- 0x39, 0x09, // pushi 0x09
- 0x54, 0x06, // self 0x06
- 0
+const uint16 sq4CdSignatureTextOptionsButton[] = {
+ SIG_MAGICDWORD,
+ 0x35, 0x01, // ldi 0x01
+ 0xa1, 0x53, // sag 0x53
+ 0x39, 0x03, // pushi 0x03
+ 0x78, // push1
+ 0x39, 0x09, // pushi 0x09
+ 0x54, 0x06, // self 0x06
+ SIG_END
};
const uint16 sq4CdPatchTextOptionsButton[] = {
- PATCH_ADDTOOFFSET | +7,
- 0x39, 0x0b, // pushi 0x0b
+ PATCH_ADDTOOFFSET +7,
+ 0x39, 0x0b, // pushi 0x0b
PATCH_END
};
// Patch 2: Adjust a check in babbleIcon::init, which handles the babble icon
// (e.g. the two guys from Andromeda) shown when dying/quitting.
// Fixes bug #3538418.
-const byte sq4CdSignatureBabbleIcon[] = {
- 7,
- 0x89, 0x5a, // lsg 5a
- 0x35, 0x02, // ldi 02
- 0x1a, // eq?
- 0x31, 0x26, // bnt 26 [02a7]
- 0
+const uint16 sq4CdSignatureBabbleIcon[] = {
+ SIG_MAGICDWORD,
+ 0x89, 0x5a, // lsg 5a
+ 0x35, 0x02, // ldi 02
+ 0x1a, // eq?
+ 0x31, 0x26, // bnt 26 [02a7]
+ SIG_END
};
const uint16 sq4CdPatchBabbleIcon[] = {
- 0x89, 0x5a, // lsg 5a
- 0x35, 0x01, // ldi 01
- 0x1a, // eq?
- 0x2f, 0x26, // bt 26 [02a7]
+ 0x89, 0x5a, // lsg 5a
+ 0x35, 0x01, // ldi 01
+ 0x1a, // eq?
+ 0x2f, 0x26, // bt 26 [02a7]
PATCH_END
};
@@ -1414,56 +1537,55 @@ const uint16 sq4CdPatchBabbleIcon[] = {
// when the text options button is clicked: "Speech", "Text" and "Both".
// Refer to the patch above for additional details.
// iconTextSwitch::doit (called when the text options button is clicked)
-const byte sq4CdSignatureTextOptions[] = {
- 32,
- 0x89, 0x5a, // lsg 0x5a (load global 90 to stack)
- 0x3c, // dup
- 0x35, 0x01, // ldi 0x01
- 0x1a, // eq? (global 90 == 1)
- 0x31, 0x06, // bnt 0x06 (0x0691)
- 0x35, 0x02, // ldi 0x02
- 0xa1, 0x5a, // sag 0x5a (save acc to global 90)
- 0x33, 0x0a, // jmp 0x0a (0x69b)
- 0x3c, // dup
- 0x35, 0x02, // ldi 0x02
- 0x1a, // eq? (global 90 == 2)
- 0x31, 0x04, // bnt 0x04 (0x069b)
- 0x35, 0x01, // ldi 0x01
- 0xa1, 0x5a, // sag 0x5a (save acc to global 90)
- 0x3a, // toss
- 0x38, 0xd9, 0x00, // pushi 0x00d9
- 0x76, // push0
- 0x54, 0x04, // self 0x04
- 0x48, // ret
- 0
+const uint16 sq4CdSignatureTextOptions[] = {
+ SIG_MAGICDWORD,
+ 0x89, 0x5a, // lsg 0x5a (load global 90 to stack)
+ 0x3c, // dup
+ 0x35, 0x01, // ldi 0x01
+ 0x1a, // eq? (global 90 == 1)
+ 0x31, 0x06, // bnt 0x06 (0x0691)
+ 0x35, 0x02, // ldi 0x02
+ 0xa1, 0x5a, // sag 0x5a (save acc to global 90)
+ 0x33, 0x0a, // jmp 0x0a (0x69b)
+ 0x3c, // dup
+ 0x35, 0x02, // ldi 0x02
+ 0x1a, // eq? (global 90 == 2)
+ 0x31, 0x04, // bnt 0x04 (0x069b)
+ 0x35, 0x01, // ldi 0x01
+ 0xa1, 0x5a, // sag 0x5a (save acc to global 90)
+ 0x3a, // toss
+ 0x38, SIG_SELECTOR16 + SELECTOR_show, // pushi 0x00d9
+ 0x76, // push0
+ 0x54, 0x04, // self 0x04
+ 0x48, // ret
+ SIG_END
};
const uint16 sq4CdPatchTextOptions[] = {
- 0x89, 0x5a, // lsg 0x5a (load global 90 to stack)
- 0x3c, // dup
- 0x35, 0x03, // ldi 0x03 (acc = 3)
- 0x1a, // eq? (global 90 == 3)
- 0x2f, 0x07, // bt 0x07
- 0x89, 0x5a, // lsg 0x5a (load global 90 to stack again)
- 0x35, 0x01, // ldi 0x01 (acc = 1)
- 0x02, // add: acc = global 90 (on stack) + 1 (previous acc value)
- 0x33, 0x02, // jmp 0x02
- 0x35, 0x01, // ldi 0x01 (reset acc to 1)
- 0xa1, 0x5a, // sag 0x5a (save acc to global 90)
- 0x33, 0x03, // jmp 0x03 (jump over the wasted bytes below)
- 0x34, 0x00, 0x00, // ldi 0x0000 (waste 3 bytes)
- 0x3a, // toss
+ 0x89, 0x5a, // lsg 0x5a (load global 90 to stack)
+ 0x3c, // dup
+ 0x35, 0x03, // ldi 0x03 (acc = 3)
+ 0x1a, // eq? (global 90 == 3)
+ 0x2f, 0x07, // bt 0x07
+ 0x89, 0x5a, // lsg 0x5a (load global 90 to stack again)
+ 0x35, 0x01, // ldi 0x01 (acc = 1)
+ 0x02, // add: acc = global 90 (on stack) + 1 (previous acc value)
+ 0x33, 0x02, // jmp 0x02
+ 0x35, 0x01, // ldi 0x01 (reset acc to 1)
+ 0xa1, 0x5a, // sag 0x5a (save acc to global 90)
+ 0x33, 0x03, // jmp 0x03 (jump over the wasted bytes below)
+ 0x34, PATCH_UINT16 + 0x00, 0x00, // ldi 0x0000 (waste 3 bytes)
+ 0x3a, // toss
// (the rest of the code is the same)
PATCH_END
};
-// script, description, magic DWORD, adjust
-const SciScriptSignature sq4Signatures[] = {
- { 298, "Floppy: endless flight", 1, PATCH_MAGICDWORD(0x67, 0x08, 0x63, 0x44), -3, sq4FloppySignatureEndlessFlight, sq4FloppyPatchEndlessFlight },
- { 298, "Floppy (German): endless flight", 1, PATCH_MAGICDWORD(0x67, 0x08, 0x63, 0x4c), -3, sq4FloppySignatureEndlessFlightGerman, sq4FloppyPatchEndlessFlight },
- { 818, "CD: Speech and subtitles option", 1, PATCH_MAGICDWORD(0x89, 0x5a, 0x3c, 0x35), 0, sq4CdSignatureTextOptions, sq4CdPatchTextOptions },
- { 0, "CD: Babble icon speech and subtitles fix", 1, PATCH_MAGICDWORD(0x89, 0x5a, 0x35, 0x02), 0, sq4CdSignatureBabbleIcon, sq4CdPatchBabbleIcon },
- { 818, "CD: Speech and subtitles option button", 1, PATCH_MAGICDWORD(0x35, 0x01, 0xa1, 0x53), 0, sq4CdSignatureTextOptionsButton, sq4CdPatchTextOptionsButton },
+// script, description, signature patch
+SciScriptPatcherEntry sq4Signatures[] = {
+ { 298, "Floppy: endless flight", 1, 0, 0, sq4FloppySignatureEndlessFlight, sq4FloppyPatchEndlessFlight },
+ { 818, "CD: Speech and subtitles option", 1, 0, 0, sq4CdSignatureTextOptions, sq4CdPatchTextOptions },
+ { 0, "CD: Babble icon speech and subtitles fix", 1, 0, 0, sq4CdSignatureBabbleIcon, sq4CdPatchBabbleIcon },
+ { 818, "CD: Speech and subtitles option button", 1, 0, 0, sq4CdSignatureTextOptionsButton, sq4CdPatchTextOptionsButton },
SCI_SIGNATUREENTRY_TERMINATOR
};
@@ -1478,75 +1600,76 @@ const SciScriptSignature sq4Signatures[] = {
// The same issue happens in Sierra SCI.
// We simply set the correct starting cel number to fix the bug.
// Responsible method: robotIntoShip::changeState(9)
-const byte sq1vgaSignatureUlenceFlatsTimepodGfxGlitch[] = {
- 8,
- 0x39, 0x07, // pushi 07 (ship::cel)
- 0x78, // push1
- 0x39, 0x0a, // pushi 0x0a (set ship::cel to 10)
- 0x38, 0xa0, 0x00, // pushi 0x00a0 (ship::setLoop)
- 0
+const uint16 sq1vgaSignatureUlenceFlatsTimepodGfxGlitch[] = {
+ 0x39,
+ SIG_MAGICDWORD, SIG_SELECTOR8 + SELECTOR_cel, // pushi "cel"
+ 0x78, // push1
+ 0x39, 0x0a, // pushi 0x0a (set ship::cel to 10)
+ 0x38, SIG_UINT16 + 0xa0, 0x00, // pushi 0x00a0 (ship::setLoop)
+ SIG_END
};
const uint16 sq1vgaPatchUlenceFlatsTimepodGfxGlitch[] = {
- PATCH_ADDTOOFFSET | +3,
- 0x39, 0x09, // pushi 0x09 (set ship::cel to 9)
+ PATCH_ADDTOOFFSET +3,
+ 0x39, 0x09, // pushi 0x09 (set ship::cel to 9)
PATCH_END
};
-const byte sq1vgaSignatureEgoShowsCard[] = {
- 25,
- 0x38, 0x46, 0x02, // push 0x246 (set up send frame to set timesShownID)
- 0x78, // push1
- 0x38, 0x46, 0x02, // push 0x246 (set up send frame to get timesShownID)
- 0x76, // push0
- 0x51, 0x7c, // class DeltaurRegion
- 0x4a, 0x04, // send 0x04 (get timesShownID)
- 0x36, // push
- 0x35, 0x01, // ldi 1
- 0x02, // add
- 0x36, // push
- 0x51, 0x7c, // class DeltaurRegion
- 0x4a, 0x06, // send 0x06 (set timesShownID)
- 0x36, // push (wrong, acc clobbered by class, above)
- 0x35, 0x03, // ldi 0x03
- 0x22, // lt?
- 0
+const uint16 sq1vgaSignatureEgoShowsCard[] = {
+ SIG_MAGICDWORD,
+ 0x38, SIG_SELECTOR16 + SELECTOR_timesShownID, // push "timesShownID"
+ 0x78, // push1
+ 0x38, SIG_SELECTOR16 + SELECTOR_timesShownID, // push "timesShownID"
+ 0x76, // push0
+ 0x51, 0x7c, // class DeltaurRegion
+ 0x4a, 0x04, // send 0x04 (get timesShownID)
+ 0x36, // push
+ 0x35, 0x01, // ldi 1
+ 0x02, // add
+ 0x36, // push
+ 0x51, 0x7c, // class DeltaurRegion
+ 0x4a, 0x06, // send 0x06 (set timesShownID)
+ 0x36, // push (wrong, acc clobbered by class, above)
+ 0x35, 0x03, // ldi 0x03
+ 0x22, // lt?
+ SIG_END
};
// Note that this script patch is merely a reordering of the
// instructions in the original script.
const uint16 sq1vgaPatchEgoShowsCard[] = {
- 0x38, 0x46, 0x02, // push 0x246 (set up send frame to get timesShownID)
- 0x76, // push0
- 0x51, 0x7c, // class DeltaurRegion
- 0x4a, 0x04, // send 0x04 (get timesShownID)
- 0x36, // push
- 0x35, 0x01, // ldi 1
- 0x02, // add
- 0x36, // push (this push corresponds to the wrong one above)
- 0x38, 0x46, 0x02, // push 0x246 (set up send frame to set timesShownID)
- 0x78, // push1
- 0x36, // push
- 0x51, 0x7c, // class DeltaurRegion
- 0x4a, 0x06, // send 0x06 (set timesShownID)
- 0x35, 0x03, // ldi 0x03
- 0x22, // lt?
+ 0x38, PATCH_SELECTOR16 + SELECTOR_timesShownID, // push "timesShownID"
+ 0x76, // push0
+ 0x51, 0x7c, // class DeltaurRegion
+ 0x4a, 0x04, // send 0x04 (get timesShownID)
+ 0x36, // push
+ 0x35, 0x01, // ldi 1
+ 0x02, // add
+ 0x36, // push (this push corresponds to the wrong one above)
+ 0x38, PATCH_SELECTOR16 + SELECTOR_timesShownID, // push "timesShownID"
+ 0x78, // push1
+ 0x36, // push
+ 0x51, 0x7c, // class DeltaurRegion
+ 0x4a, 0x06, // send 0x06 (set timesShownID)
+ 0x35, 0x03, // ldi 0x03
+ 0x22, // lt?
PATCH_END
};
-// script, description, magic DWORD, adjust
-const SciScriptSignature sq1vgaSignatures[] = {
- { 45, "Ulence Flats: timepod graphic glitch", 1, PATCH_MAGICDWORD( 0x07, 0x78, 0x39, 0x0a ), -1, sq1vgaSignatureUlenceFlatsTimepodGfxGlitch, sq1vgaPatchUlenceFlatsTimepodGfxGlitch },
- { 58, "Sarien armory droid zapping ego first time", 1, PATCH_MAGICDWORD( 0x72, 0x88, 0x15, 0x36 ), -70, sq1vgaSignatureEgoShowsCard, sq1vgaPatchEgoShowsCard },
-
+// script, description, signature patch
+SciScriptPatcherEntry sq1vgaSignatures[] = {
+ { 45, "Ulence Flats: timepod graphic glitch", 1, 0, 0, sq1vgaSignatureUlenceFlatsTimepodGfxGlitch, sq1vgaPatchUlenceFlatsTimepodGfxGlitch },
+ { 58, "Sarien armory droid zapping ego first time", 1, 0, 0, sq1vgaSignatureEgoShowsCard, sq1vgaPatchEgoShowsCard },
SCI_SIGNATUREENTRY_TERMINATOR};
// will actually patch previously found signature area
-void Script::applyPatch(const uint16 *patch, byte *scriptData, const uint32 scriptSize, int32 signatureOffset) {
+void Script::patcherApplyPatch(const SciScriptPatcherEntry *patchEntry, byte *scriptData, const uint32 scriptSize, int32 signatureOffset, const bool isMacSci11) {
+ const uint16 *patchData = patchEntry->patchData;
byte orgData[PATCH_VALUELIMIT];
int32 offset = signatureOffset;
- uint16 patchWord = *patch;
+ uint16 patchWord = *patchEntry->patchData;
+ uint16 patchSelector = 0;
// Copy over original bytes from script
uint32 orgDataSize = scriptSize - offset;
@@ -1555,74 +1678,179 @@ void Script::applyPatch(const uint16 *patch, byte *scriptData, const uint32 scri
memcpy(&orgData, &scriptData[offset], orgDataSize);
while (patchWord != PATCH_END) {
+ uint16 patchCommand = patchWord & PATCH_COMMANDMASK;
uint16 patchValue = patchWord & PATCH_VALUEMASK;
- switch (patchWord & PATCH_COMMANDMASK) {
- case PATCH_ADDTOOFFSET:
+ switch (patchCommand) {
+ case PATCH_ADDTOOFFSET: {
// add value to offset
- offset += patchValue & ~PATCH_ADDTOOFFSET;
+ offset += patchValue;
break;
- case PATCH_GETORIGINALBYTE:
+ }
+ case PATCH_GETORIGINALBYTE: {
// get original byte from script
if (patchValue >= orgDataSize)
- error("patching: can not get requested original byte from script");
+ error("Script-Patcher: can not get requested original byte from script");
scriptData[offset] = orgData[patchValue];
offset++;
break;
- case PATCH_ADJUSTWORD: {
- // Adjust word right before current position
- byte *adjustPtr = &scriptData[offset - 2];
- uint16 adjustWord = READ_LE_UINT16(adjustPtr);
- adjustWord += patchValue;
- WRITE_LE_UINT16(adjustPtr, adjustWord);
+ }
+ case PATCH_GETORIGINALBYTEADJUST: {
+ // get original byte from script and adjust it
+ if (patchValue >= orgDataSize)
+ error("Script-Patcher: can not get requested original byte from script");
+ byte orgByte = orgData[patchValue];
+ int16 adjustValue;
+ patchData++; adjustValue = (int16)(*patchData);
+ scriptData[offset] = orgByte + adjustValue;
+ offset++;
+ break;
+ }
+ case PATCH_UINT16:
+ case PATCH_SELECTOR16: {
+ byte byte1;
+ byte byte2;
+
+ switch (patchCommand) {
+ case PATCH_UINT16: {
+ byte1 = patchValue & PATCH_BYTEMASK;
+ patchData++; patchWord = *patchData;
+ if (patchWord & PATCH_COMMANDMASK)
+ error("Script-Patcher: Patch inconsistent");
+ byte2 = patchWord & PATCH_BYTEMASK;
+ break;
+ }
+ case PATCH_SELECTOR16: {
+ patchSelector = selectorTable[patchValue].id;
+ byte1 = patchSelector & 0xFF;
+ byte2 = patchSelector >> 8;
+ break;
+ }
+ default:
+ byte1 = 0; byte2 = 0;
+ }
+ if (!isMacSci11) {
+ scriptData[offset++] = byte1;
+ scriptData[offset++] = byte2;
+ } else {
+ // SCI1.1+ on macintosh had uint16s in script in BE-order
+ scriptData[offset++] = byte2;
+ scriptData[offset++] = byte1;
+ }
break;
}
- case PATCH_ADJUSTWORD_NEG: {
- // Adjust word right before current position (negative way)
- byte *adjustPtr = &scriptData[offset - 2];
- uint16 adjustWord = READ_LE_UINT16(adjustPtr);
- adjustWord -= patchValue;
- WRITE_LE_UINT16(adjustPtr, adjustWord);
+ case PATCH_SELECTOR8: {
+ patchSelector = selectorTable[patchValue].id;
+ if (patchSelector & 0xFF00)
+ error("Script-Patcher: 8 bit selector required, game uses 16 bit selector");
+ scriptData[offset] = patchSelector & 0xFF;
+ offset++;
break;
}
- default:
- scriptData[offset] = patchValue & 0xFF;
+ case PATCH_BYTE:
+ scriptData[offset] = patchValue & PATCH_BYTEMASK;
offset++;
}
- patch++;
- patchWord = *patch;
+ patchData++;
+ patchWord = *patchData;
}
}
// will return -1 if no match was found, otherwise an offset to the start of the signature match
-int32 Script::findSignature(const SciScriptSignature *signature, const byte *scriptData, const uint32 scriptSize) {
+int32 Script::patcherFindSignature(const SciScriptPatcherEntry *patchEntry, const byte *scriptData, const uint32 scriptSize, const bool isMacSci11) {
if (scriptSize < 4) // we need to find a DWORD, so less than 4 bytes is not okay
return -1;
- const uint32 magicDWord = signature->magicDWord; // is platform-specific BE/LE form, so that the later match will work
+ const uint32 magicDWord = patchEntry->magicDWord; // is platform-specific BE/LE form, so that the later match will work
const uint32 searchLimit = scriptSize - 3;
uint32 DWordOffset = 0;
// first search for the magic DWORD
while (DWordOffset < searchLimit) {
if (magicDWord == READ_UINT32(scriptData + DWordOffset)) {
// magic DWORD found, check if actual signature matches
- uint32 offset = DWordOffset + signature->magicOffset;
+ uint32 offset = DWordOffset + patchEntry->magicOffset;
uint32 byteOffset = offset;
- const byte *signatureData = signature->data;
- byte matchAdjust = 1;
- while (matchAdjust) {
- byte matchBytesCount = *signatureData++;
- if ((byteOffset + matchBytesCount) > scriptSize) // Out-Of-Bounds?
+ const uint16 *signatureData = patchEntry->signatureData;
+ uint16 sigSelector = 0;
+
+ uint16 sigWord = *signatureData;
+ while (sigWord != SIG_END) {
+ uint16 sigCommand = sigWord & SIG_COMMANDMASK;
+ uint16 sigValue = sigWord & SIG_VALUEMASK;
+ switch (sigCommand) {
+ case SIG_ADDTOOFFSET: {
+ // add value to offset
+ byteOffset += sigValue;
+ break;
+ }
+ case SIG_UINT16:
+ case SIG_SELECTOR16: {
+ if ((byteOffset + 1) < scriptSize) {
+ byte byte1;
+ byte byte2;
+
+ switch (sigCommand) {
+ case SIG_UINT16: {
+ byte1 = sigValue & SIG_BYTEMASK;
+ signatureData++; sigWord = *signatureData;
+ if (sigWord & SIG_COMMANDMASK)
+ error("Script-Patcher: signature inconsistent\nFaulty patch: '%s'", patchEntry->description);
+ byte2 = sigWord & SIG_BYTEMASK;
+ break;
+ }
+ case SIG_SELECTOR16: {
+ sigSelector = selectorTable[sigValue].id;
+ byte1 = sigSelector & 0xFF;
+ byte2 = sigSelector >> 8;
+ break;
+ }
+ default:
+ byte1 = 0; byte2 = 0;
+ }
+ if (!isMacSci11) {
+ if ((scriptData[byteOffset] != byte1) || (scriptData[byteOffset + 1] != byte2))
+ sigWord = SIG_MISMATCH;
+ } else {
+ // SCI1.1+ on macintosh had uint16s in script in BE-order
+ if ((scriptData[byteOffset] != byte2) || (scriptData[byteOffset + 1] != byte1))
+ sigWord = SIG_MISMATCH;
+ }
+ byteOffset += 2;
+ } else {
+ sigWord = SIG_MISMATCH;
+ }
break;
- if (memcmp(signatureData, &scriptData[byteOffset], matchBytesCount)) // Byte-Mismatch?
+ }
+ case SIG_SELECTOR8: {
+ if (byteOffset < scriptSize) {
+ sigSelector = selectorTable[sigValue].id;
+ if (sigSelector & 0xFF00)
+ error("Script-Patcher: 8 bit selector required, game uses 16 bit selector\nFaulty patch: '%s'", patchEntry->description);
+ if (scriptData[byteOffset] != (sigSelector & 0xFF))
+ sigWord = SIG_MISMATCH;
+ byteOffset++;
+ } else {
+ sigWord = SIG_MISMATCH; // out of bounds
+ }
+ break;
+ }
+ case SIG_BYTE:
+ if (byteOffset < scriptSize) {
+ if (scriptData[byteOffset] != sigWord)
+ sigWord = SIG_MISMATCH;
+ byteOffset++;
+ } else {
+ sigWord = SIG_MISMATCH; // out of bounds
+ }
+ }
+
+ if (sigWord == SIG_MISMATCH)
break;
- // those bytes matched, adjust offsets accordingly
- signatureData += matchBytesCount;
- byteOffset += matchBytesCount;
- // get offset...
- matchAdjust = *signatureData++;
- byteOffset += matchAdjust;
+
+ signatureData++;
+ sigWord = *signatureData;
}
- if (!matchAdjust) // all matches worked?
+
+ if (sigWord == SIG_END) // signature fully matched?
return offset;
}
DWordOffset++;
@@ -1631,8 +1859,139 @@ int32 Script::findSignature(const SciScriptSignature *signature, const byte *scr
return -1;
}
-void Script::matchSignatureAndPatch(uint16 scriptNr, byte *scriptData, const uint32 scriptSize) {
- const SciScriptSignature *signatureTable = NULL;
+// This method calculates the magic DWORD for each entry in the signature table
+// and it also initializes the selector table for selectors used in the signatures/patches of the current game
+void Script::patcherInitSignature(SciScriptPatcherEntry *patchTable, bool isMacSci11) {
+ SciScriptPatcherEntry *curEntry = patchTable;
+ SciScriptPatcherSelector *curSelector = NULL;
+ int step;
+ int magicOffset;
+ byte magicDWord[4];
+ int magicDWordLeft = 0;
+ const uint16 *curData;
+ uint16 curWord;
+ uint16 curCommand;
+ uint32 curValue;
+ byte byte1;
+ byte byte2;
+
+ while (curEntry->signatureData) {
+ // process signature
+ memset(magicDWord, 0, sizeof(magicDWord));
+
+ for (step = 0; step < 2; step++) {
+ switch (step) {
+ case 0: curData = curEntry->signatureData; break;
+ case 1: curData = curEntry->patchData; break;
+ }
+
+ curWord = *curData;
+ magicOffset = 0;
+ while (curWord != SIG_END) {
+ curCommand = curWord & SIG_COMMANDMASK;
+ curValue = curWord & SIG_VALUEMASK;
+ switch (curCommand) {
+ case SIG_MAGICDWORD: {
+ if (step == 0) {
+ if ((curEntry->magicDWord) || (magicDWordLeft))
+ error("Script-Patcher: Magic-DWORD specified multiple times in signature\nFaulty patch: '%s'", curEntry->description);
+ magicDWordLeft = 4;
+ curEntry->magicOffset = magicOffset;
+ }
+ break;
+ }
+ case SIG_ADDTOOFFSET: {
+ magicOffset -= curValue;
+ if (magicDWordLeft)
+ error("Script-Patcher: Magic-DWORD contains AddToOffset command\nFaulty patch: '%s'", curEntry->description);
+ break;
+ }
+ case SIG_UINT16:
+ case SIG_SELECTOR16: {
+ // UINT16 or 1
+ switch (curCommand) {
+ case SIG_UINT16: {
+ curData++; curWord = *curData;
+ if (curWord & SIG_COMMANDMASK)
+ error("Script-Patcher: signature entry inconsistent\nFaulty patch: '%s'", curEntry->description);
+ if (!isMacSci11) {
+ byte1 = curValue;
+ byte2 = curWord & SIG_BYTEMASK;
+ } else {
+ byte1 = curWord & SIG_BYTEMASK;
+ byte2 = curValue;
+ }
+ break;
+ }
+ case SIG_SELECTOR16: {
+ curSelector = &selectorTable[curValue];
+ if (curSelector->id == -1)
+ curSelector->id = g_sci->getKernel()->findSelector(curSelector->name);
+ if (!isMacSci11) {
+ byte1 = curSelector->id & 0x00FF;
+ byte2 = curSelector->id >> 8;
+ } else {
+ byte1 = curSelector->id >> 8;
+ byte2 = curSelector->id & 0x00FF;
+ }
+ break;
+ }
+ }
+ magicOffset -= 2;
+ if (magicDWordLeft) {
+ // Remember current word for Magic DWORD
+ magicDWord[4 - magicDWordLeft] = byte1;
+ magicDWordLeft--;
+ if (magicDWordLeft) {
+ magicDWord[4 - magicDWordLeft] = byte2;
+ magicDWordLeft--;
+ }
+ if (!magicDWordLeft) {
+ curEntry->magicDWord = READ_LE_UINT32(magicDWord);
+ }
+ }
+ break;
+ }
+ case SIG_BYTE:
+ case SIG_SELECTOR8: {
+ if (curCommand == SIG_SELECTOR8) {
+ curSelector = &selectorTable[curValue];
+ if (curSelector->id == -1) {
+ curSelector->id = g_sci->getKernel()->findSelector(curSelector->name);
+ if (curSelector->id != -1) {
+ if (curSelector->id & 0xFF00)
+ error("Script-Patcher: 8 bit selector required, game uses 16 bit selector\nFaulty patch: '%s'", curEntry->description);
+ }
+ }
+ curValue = curSelector->id;
+ }
+ magicOffset--;
+ if (magicDWordLeft) {
+ // Remember current byte for Magic DWORD
+ magicDWord[4 - magicDWordLeft] = (byte)curValue;
+ magicDWordLeft--;
+ if (!magicDWordLeft) {
+ curEntry->magicDWord = READ_LE_UINT32(magicDWord);
+ }
+ }
+ }
+ }
+ curData++;
+ curWord = *curData;
+ }
+ }
+ if (magicDWordLeft)
+ error("Script-Patcher: Magic-DWORD beyond End-Of-Signature\nFaulty patch: '%s'", curEntry->description);
+ if (!curEntry->magicDWord)
+ error("Script-Patcher: Magic-DWORD not specified in signature\nFaulty patch: '%s'", curEntry->description);
+
+ curEntry++;
+ }
+}
+
+void Script::patcherProcessScript(uint16 scriptNr, byte *scriptData, const uint32 scriptSize) {
+ SciScriptPatcherEntry *signatureTable = NULL;
+
switch (g_sci->getGameId()) {
case GID_CAMELOT:
signatureTable = camelotSignatures;
@@ -1700,16 +2059,23 @@ void Script::matchSignatureAndPatch(uint16 scriptNr, byte *scriptData, const uin
}
if (signatureTable) {
- while (signatureTable->data) {
+ bool isMacSci11 = (g_sci->getPlatform() == Common::kPlatformMacintosh && getSciVersion() >= SCI_VERSION_1_1);
+
+ if (!signatureTable->magicDWord) {
+ // signature table needs to get initialized (Magic DWORD set, selector table set)
+ patcherInitSignature(signatureTable, isMacSci11);
+ }
+
+ while (signatureTable->signatureData) {
if (scriptNr == signatureTable->scriptNr) {
int32 foundOffset = 0;
int16 applyCount = signatureTable->applyCount;
do {
- foundOffset = findSignature(signatureTable, scriptData, scriptSize);
+ foundOffset = patcherFindSignature(signatureTable, scriptData, scriptSize, isMacSci11);
if (foundOffset != -1) {
// found, so apply the patch
- debugC(kDebugLevelScripts, "matched and patched %s on script %d offset %d", signatureTable->description, scriptNr, foundOffset);
- applyPatch(signatureTable->patch, scriptData, scriptSize, foundOffset);
+ debugC(kDebugLevelScriptPatcher, "Script-Patcher: '%s' on script %d offset %d", signatureTable->description, scriptNr, foundOffset);
+ patcherApplyPatch(signatureTable, scriptData, scriptSize, foundOffset, isMacSci11);
}
applyCount--;
} while ((foundOffset != -1) && (applyCount));
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index 97e33f256b..a059bee74e 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -262,8 +262,14 @@ const char *SegManager::getObjectName(reg_t pos) {
const char *name = 0;
if (nameReg.getSegment())
name = derefString(nameReg);
- if (!name)
- return "<invalid name>";
+ if (!name) {
+ // Crazy Nick Laura Bow is missing some object names needed for the static
+ // selector vocabulary
+ if (g_sci->getGameId() == GID_CNICK_LAURABOW && pos == make_reg(1, 0x2267))
+ return "Character";
+ else
+ return "<invalid name>";
+ }
return name;
}
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index ef8f165084..d7c2fdc0eb 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -200,11 +200,18 @@ static void write_var(EngineState *s, int type, int index, reg_t value) {
s->variables[type][index] = value;
- // If the game is trying to change its speech/subtitle settings, apply the ScummVM audio
- // options first, if they haven't been applied yet
- if (type == VAR_GLOBAL && index == 90 && !g_sci->getEngineState()->_syncedAudioOptions) {
- g_sci->syncIngameAudioOptions();
- g_sci->getEngineState()->_syncedAudioOptions = true;
+ if (type == VAR_GLOBAL && index == 90) {
+ // The game is trying to change its speech/subtitle settings
+ if (!g_sci->getEngineState()->_syncedAudioOptions || s->variables[VAR_GLOBAL][4] == TRUE_REG) {
+ // ScummVM audio options haven't been applied yet, so apply them.
+ // We also force the ScummVM audio options when loading a game from
+ // the launcher.
+ g_sci->syncIngameAudioOptions();
+ g_sci->getEngineState()->_syncedAudioOptions = true;
+ } else {
+ // Update ScummVM's audio options
+ g_sci->updateScummVMAudioOptions();
+ }
}
}
}
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 154ac8f8b4..14fbee8e93 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -55,6 +55,12 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
{ GID_CASTLEBRAIN, 280, 280, 0, "programmer", "dispatchEvent", -1, 0, { WORKAROUND_FAKE, 0xf } }, // pressing 'q' on the computer screen in the robot room, and closing the help dialog that pops up (bug #3039656). Moves the cursor to the view with the ID returned (in this case, the robot hand)
{ GID_CNICK_KQ, -1, 0, 1, "Character", "say", -1, -1, { WORKAROUND_FAKE, 0 } }, // checkers/backgammon, like in hoyle 3 - temps 504 and 505 - bug #3606025
{ GID_CNICK_KQ, -1, 700, 0, "gcWindow", "open", -1, -1, { WORKAROUND_FAKE, 0 } }, // when entering the control menu, like in hoyle 3
+ { GID_CNICK_KQ, 300, 303, 0, "theDoubleCube", "<noname520>", -1, 5, { WORKAROUND_FAKE, 0 } }, // while playing backgammon with doubling enabled - bug #3615121 (same as the theDoubleCube::make workaround for Hoyle 3)
+ { GID_CNICK_KQ, 300, 303, 0, "theDoubleCube", "<noname519>", -1, 9, { WORKAROUND_FAKE, 0 } }, // when accepting a double, while playing backgammon with doubling enabled (same as the theDoubleCube::accept workaround for Hoyle 3)
+ { GID_CNICK_LAURABOW, -1, 0, 1, "Character", "say", -1, -1, { WORKAROUND_FAKE, 0 } }, // Yatch, like in hoyle 3 - temps 504 and 505 - bug #3615119
+ { GID_CNICK_LAURABOW, -1, 700, 0, NULL, "open", -1, -1, { WORKAROUND_FAKE, 0 } }, // when entering control menu - bug #3615118 (same as the gcWindow workaround for Hoyle 3)
+ { GID_CNICK_LAURABOW,100, 100, 0, NULL, "<noname144>", -1, 1, { WORKAROUND_FAKE, 0 } }, // while playing domino - bug #3615129 (same as the dominoHand2 workaround for Hoyle 3)
+ { GID_CNICK_LAURABOW,100, 110, 0, NULL, "doit", -1, -1, { WORKAROUND_FAKE, 0 } }, // when changing the "Dominoes per hand" setting - bug #3615130
{ GID_CNICK_LONGBOW, 0, 0, 0, "RH Budget", "init", -1, 1, { WORKAROUND_FAKE, 0 } }, // when starting the game
{ GID_ECOQUEST, -1, -1, 0, NULL, "doVerb", -1, 0, { WORKAROUND_FAKE, 0 } }, // almost clicking anywhere triggers this in almost all rooms
{ GID_FANMADE, 516, 979, 0, "", "export 0", -1, 20, { WORKAROUND_FAKE, 0 } }, // Happens in Grotesteing after the logos
@@ -73,6 +79,9 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
{ GID_HOYLE3, -1, 0, 1, "Character", "say", -1, -1, { WORKAROUND_FAKE, 0 } }, // when starting checkers or dominoes, first time a character says something - temps 504 and 505
{ GID_HOYLE3, -1, 700, 0, "gcWindow", "open", -1, -1, { WORKAROUND_FAKE, 0 } }, // when entering control menu
{ GID_HOYLE3, 100, 100, 0, "dominoHand2", "cue", -1, 1, { WORKAROUND_FAKE, 0 } }, // while playing domino - bug #3036918
+ { GID_HOYLE3, 100, 110, 0, "OKButton", "doit", -1, -1, { WORKAROUND_FAKE, 0 } }, // when changing the "Dominoes per hand" setting - bug #3615130
+ { GID_HOYLE3, 300, 303, 0, "theDoubleCube", "make", -1, 5, { WORKAROUND_FAKE, 0 } }, // while playing backgammon with doubling enabled
+ { GID_HOYLE3, 300, 303, 0, "theDoubleCube", "accept", -1, 9, { WORKAROUND_FAKE, 0 } }, // when accepting a double, while playing backgammon with doubling enabled
{ 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
@@ -212,6 +221,7 @@ const SciWorkaroundEntry kDeviceInfo_workarounds[] = {
{ GID_FANMADE, -1, 994, 1, "Game", "save", 0xd1c, 0, { WORKAROUND_STILLCALL, 0 } }, // In fanmade games, this is called with one parameter for CurDevice (Cascade Quest)
{ GID_FANMADE, -1, 994, 1, "Game", "save", 0xe55, 0, { WORKAROUND_STILLCALL, 0 } }, // In fanmade games, this is called with one parameter for CurDevice (Demo Quest)
{ GID_FANMADE, -1, 994, 1, "Game", "save", 0xe57, 0, { WORKAROUND_STILLCALL, 0 } }, // In fanmade games, this is called with one parameter for CurDevice (I Want My C64 Back)
+ { GID_FANMADE, -1, 994, 0, "Black", "save", 0xa, 0, { WORKAROUND_IGNORE, 0 } }, // In fanmade games, this is called with one parameter for CurDevice (Black Cauldron Remake)
{ GID_FANMADE, -1, 994, 1, "Game", "save", 0xe5c, 0, { WORKAROUND_STILLCALL, 0 } }, // In fanmade games, this is called with one parameter for CurDevice (Most of them)
{ GID_FANMADE, -1, 994, 1, "Game", "restore", 0xd1c, 0, { WORKAROUND_STILLCALL, 0 } }, // In fanmade games, this is called with one parameter for CurDevice (Cascade Quest)
{ GID_FANMADE, -1, 994, 1, "Game", "restore", 0xe55, 0, { WORKAROUND_STILLCALL, 0 } }, // In fanmade games, this is called with one parameter for CurDevice (Demo Quest)
@@ -364,6 +374,13 @@ const SciWorkaroundEntry kNewWindow_workarounds[] = {
};
// gameID, room,script,lvl, object-name, method-name, call,index, workaround
+const SciWorkaroundEntry kReadNumber_workarounds[] = {
+ { GID_CNICK_LAURABOW,100, 101, 0, "dominoes.opt", "doit", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // When dominoes.opt is present, the game scripts call kReadNumber with an extra integer parameter - bug #3615120
+ { GID_HOYLE3, 100, 101, 0, "dominoes.opt", "doit", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // When dominoes.opt is present, the game scripts call kReadNumber with an extra integer parameter - bug #3615120
+ SCI_WORKAROUNDENTRY_TERMINATOR
+};
+
+// gameID, room,script,lvl, object-name, method-name, call,index, workaround
const SciWorkaroundEntry kPaletteUnsetFlag_workarounds[] = {
{ GID_QFG4, 100, 100, 0, "doMovie", "changeState", -1, 0, { WORKAROUND_IGNORE, 0 } }, // after the Sierra logo, no flags are passed, thus the call is meaningless - bug #3034506
SCI_WORKAROUNDENTRY_TERMINATOR
diff --git a/engines/sci/engine/workarounds.h b/engines/sci/engine/workarounds.h
index 59054ae552..d5e91b70ec 100644
--- a/engines/sci/engine/workarounds.h
+++ b/engines/sci/engine/workarounds.h
@@ -88,6 +88,7 @@ extern const SciWorkaroundEntry kIsObject_workarounds[];
extern const SciWorkaroundEntry kMemory_workarounds[];
extern const SciWorkaroundEntry kMoveCursor_workarounds[];
extern const SciWorkaroundEntry kNewWindow_workarounds[];
+extern const SciWorkaroundEntry kReadNumber_workarounds[];
extern const SciWorkaroundEntry kPaletteUnsetFlag_workarounds[];
extern const SciWorkaroundEntry kSetCursor_workarounds[];
extern const SciWorkaroundEntry kSetPort_workarounds[];
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index c1aadc3622..e24a5f1429 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -112,6 +112,7 @@ SciEngine::SciEngine(OSystem *syst, const ADGameDescription *desc, SciGameId gam
DebugMan.addDebugChannel(kDebugLevelDclInflate, "DCL", "DCL inflate debugging");
DebugMan.addDebugChannel(kDebugLevelVM, "VM", "VM debugging");
DebugMan.addDebugChannel(kDebugLevelScripts, "Scripts", "Notifies when scripts are unloaded");
+ DebugMan.addDebugChannel(kDebugLevelScriptPatcher, "ScriptPatcher", "Notifies when scripts are patched");
DebugMan.addDebugChannel(kDebugLevelGC, "GC", "Garbage Collector debugging");
DebugMan.addDebugChannel(kDebugLevelResMan, "ResMan", "Resource manager debugging");
DebugMan.addDebugChannel(kDebugLevelOnStartup, "OnStartup", "Enter debugger at start of game");
@@ -882,7 +883,7 @@ void SciEngine::syncSoundSettings() {
}
void SciEngine::syncIngameAudioOptions() {
- // Now, sync the in-game speech/subtitles settings for SCI1.1 CD games
+ // Sync the in-game speech/subtitles settings for SCI1.1 CD games
if (isCD() && getSciVersion() == SCI_VERSION_1_1) {
bool subtitlesOn = ConfMan.getBool("subtitles");
bool speechOn = !ConfMan.getBool("speech_mute");
@@ -910,6 +911,26 @@ void SciEngine::syncIngameAudioOptions() {
}
}
+void SciEngine::updateScummVMAudioOptions() {
+ // Update ScummVM's speech/subtitles settings for SCI1.1 CD games,
+ // depending on the in-game settings
+ if (isCD() && getSciVersion() == SCI_VERSION_1_1) {
+ if (_gamestate->variables[VAR_GLOBAL][90] == make_reg(0, 1)) {
+ // subtitles
+ ConfMan.setBool("subtitles", true);
+ ConfMan.setBool("speech_mute", true);
+ } else if (_gamestate->variables[VAR_GLOBAL][90] == make_reg(0, 2)) {
+ // speech
+ ConfMan.setBool("subtitles", false);
+ ConfMan.setBool("speech_mute", false);
+ } else if (_gamestate->variables[VAR_GLOBAL][90] == make_reg(0, 3)) {
+ // speech + subtitles
+ ConfMan.setBool("subtitles", true);
+ ConfMan.setBool("speech_mute", false);
+ }
+ }
+}
+
void SciEngine::loadMacExecutable() {
if (getPlatform() != Common::kPlatformMacintosh || getSciVersion() < SCI_VERSION_1_EARLY || getSciVersion() > SCI_VERSION_1_1)
return;
diff --git a/engines/sci/sci.h b/engines/sci/sci.h
index 0a75e115fd..a487336f54 100644
--- a/engines/sci/sci.h
+++ b/engines/sci/sci.h
@@ -82,28 +82,29 @@ class GfxFrameout;
// our engine debug levels
enum kDebugLevels {
- kDebugLevelError = 1 << 0,
- kDebugLevelNodes = 1 << 1,
- kDebugLevelGraphics = 1 << 2,
- kDebugLevelStrings = 1 << 3,
- kDebugLevelMemory = 1 << 4,
- kDebugLevelFuncCheck = 1 << 5,
- kDebugLevelBresen = 1 << 6,
- kDebugLevelSound = 1 << 7,
- kDebugLevelBaseSetter = 1 << 8,
- kDebugLevelParser = 1 << 9,
- kDebugLevelSaid = 1 << 10,
- kDebugLevelFile = 1 << 11,
- kDebugLevelTime = 1 << 12,
- kDebugLevelRoom = 1 << 13,
- kDebugLevelAvoidPath = 1 << 14,
- kDebugLevelDclInflate = 1 << 15,
- kDebugLevelVM = 1 << 16,
- kDebugLevelScripts = 1 << 17,
- kDebugLevelGC = 1 << 18,
- kDebugLevelResMan = 1 << 19,
- kDebugLevelOnStartup = 1 << 20,
- kDebugLevelDebugMode = 1 << 21
+ kDebugLevelError = 1 << 0,
+ kDebugLevelNodes = 1 << 1,
+ kDebugLevelGraphics = 1 << 2,
+ kDebugLevelStrings = 1 << 3,
+ kDebugLevelMemory = 1 << 4,
+ kDebugLevelFuncCheck = 1 << 5,
+ kDebugLevelBresen = 1 << 6,
+ kDebugLevelSound = 1 << 7,
+ kDebugLevelBaseSetter = 1 << 8,
+ kDebugLevelParser = 1 << 9,
+ kDebugLevelSaid = 1 << 10,
+ kDebugLevelFile = 1 << 11,
+ kDebugLevelTime = 1 << 12,
+ kDebugLevelRoom = 1 << 13,
+ kDebugLevelAvoidPath = 1 << 14,
+ kDebugLevelDclInflate = 1 << 15,
+ kDebugLevelVM = 1 << 16,
+ kDebugLevelScripts = 1 << 17,
+ kDebugLevelGC = 1 << 18,
+ kDebugLevelResMan = 1 << 19,
+ kDebugLevelOnStartup = 1 << 20,
+ kDebugLevelDebugMode = 1 << 21,
+ kDebugLevelScriptPatcher = 1 << 22
};
enum SciGameId {
@@ -251,6 +252,7 @@ public:
* - King's Quest 6 CD
*/
void syncIngameAudioOptions();
+ void updateScummVMAudioOptions();
const SciGameId &getGameId() const { return _gameId; }
const char *getGameIdStr() const;
diff --git a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
index af4f8775f4..26e248fbca 100644
--- a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
+++ b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
@@ -443,11 +443,13 @@ ImuseDigiSndMgr::SoundDesc *ImuseDigiSndMgr::openSound(int32 soundId, const char
} else if (soundName[0] == 0) {
if (sound->bundle->decompressSampleByIndex(soundId, 0, 0x2000, &ptr, 0, header_outside) == 0 || ptr == NULL) {
closeSound(sound);
+ free(ptr);
return NULL;
}
} else {
if (sound->bundle->decompressSampleByName(soundName, 0, 0x2000, &ptr, header_outside) == 0 || ptr == NULL) {
closeSound(sound);
+ free(ptr);
return NULL;
}
}
diff --git a/engines/scumm/module.mk b/engines/scumm/module.mk
index a377ad3dc4..d43db1e5f1 100644
--- a/engines/scumm/module.mk
+++ b/engines/scumm/module.mk
@@ -35,23 +35,23 @@ MODULE_OBJS := \
midiparser_ro.o \
object.o \
palette.o \
- player_ad.o \
- player_apple2.o \
- player_mac.o \
- player_mod.o \
- player_nes.o \
- player_pce.o \
- player_sid.o \
- player_towns.o \
- player_v1.o \
- player_v2.o \
- player_v2a.o \
- player_v2base.o \
- player_v2cms.o \
- player_v3a.o \
- player_v3m.o \
- player_v4a.o \
- player_v5m.o \
+ players/player_ad.o \
+ players/player_apple2.o \
+ players/player_mac.o \
+ players/player_mod.o \
+ players/player_nes.o \
+ players/player_pce.o \
+ players/player_sid.o \
+ players/player_towns.o \
+ players/player_v1.o \
+ players/player_v2.o \
+ players/player_v2a.o \
+ players/player_v2base.o \
+ players/player_v2cms.o \
+ players/player_v3a.o \
+ players/player_v3m.o \
+ players/player_v4a.o \
+ players/player_v5m.o \
resource_v2.o \
resource_v3.o \
resource_v4.o \
diff --git a/engines/scumm/player_ad.cpp b/engines/scumm/players/player_ad.cpp
index ed368afbf6..20630e1cb9 100644
--- a/engines/scumm/player_ad.cpp
+++ b/engines/scumm/players/player_ad.cpp
@@ -20,7 +20,7 @@
*
*/
-#include "scumm/player_ad.h"
+#include "scumm/players/player_ad.h"
#include "scumm/imuse/imuse.h"
#include "scumm/scumm.h"
#include "scumm/resource.h"
diff --git a/engines/scumm/player_ad.h b/engines/scumm/players/player_ad.h
index da6c7177ef..fbb65fbe24 100644
--- a/engines/scumm/player_ad.h
+++ b/engines/scumm/players/player_ad.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef SCUMM_PLAYER_AD_H
-#define SCUMM_PLAYER_AD_H
+#ifndef SCUMM_PLAYERS_PLAYER_AD_H
+#define SCUMM_PLAYERS_PLAYER_AD_H
#include "scumm/music.h"
diff --git a/engines/scumm/player_apple2.cpp b/engines/scumm/players/player_apple2.cpp
index 58e4f78a94..87b8100f22 100644
--- a/engines/scumm/player_apple2.cpp
+++ b/engines/scumm/players/player_apple2.cpp
@@ -21,7 +21,7 @@
*/
#include "engines/engine.h"
-#include "scumm/player_apple2.h"
+#include "scumm/players/player_apple2.h"
#include "scumm/scumm.h"
namespace Scumm {
diff --git a/engines/scumm/player_apple2.h b/engines/scumm/players/player_apple2.h
index e1ec9d8946..9930a4f95d 100644
--- a/engines/scumm/player_apple2.h
+++ b/engines/scumm/players/player_apple2.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef SCUMM_PLAYER_APPLEII_H
-#define SCUMM_PLAYER_APPLEII_H
+#ifndef SCUMM_PLAYERS_PLAYER_APPLEII_H
+#define SCUMM_PLAYERS_PLAYER_APPLEII_H
#include "common/mutex.h"
#include "common/scummsys.h"
diff --git a/engines/scumm/player_mac.cpp b/engines/scumm/players/player_mac.cpp
index a60736df5e..281eec5336 100644
--- a/engines/scumm/player_mac.cpp
+++ b/engines/scumm/players/player_mac.cpp
@@ -24,7 +24,7 @@
#include "common/translation.h"
#include "engines/engine.h"
#include "gui/message.h"
-#include "scumm/player_mac.h"
+#include "scumm/players/player_mac.h"
#include "scumm/resource.h"
#include "scumm/scumm.h"
#include "scumm/imuse/imuse.h"
diff --git a/engines/scumm/player_mac.h b/engines/scumm/players/player_mac.h
index 09307b4e57..7f9f42c34e 100644
--- a/engines/scumm/player_mac.h
+++ b/engines/scumm/players/player_mac.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef SCUMM_PLAYER_MAC_H
-#define SCUMM_PLAYER_MAC_H
+#ifndef SCUMM_PLAYERS_PLAYER_MAC_H
+#define SCUMM_PLAYERS_PLAYER_MAC_H
#include "common/scummsys.h"
#include "common/util.h"
diff --git a/engines/scumm/player_mod.cpp b/engines/scumm/players/player_mod.cpp
index 6411f0a17a..abaa8c1fc5 100644
--- a/engines/scumm/player_mod.cpp
+++ b/engines/scumm/players/player_mod.cpp
@@ -21,7 +21,7 @@
*/
-#include "scumm/player_mod.h"
+#include "scumm/players/player_mod.h"
#include "audio/mixer.h"
#include "audio/rate.h"
#include "audio/decoders/raw.h"
diff --git a/engines/scumm/player_mod.h b/engines/scumm/players/player_mod.h
index 619d83541d..d4a5b16fca 100644
--- a/engines/scumm/player_mod.h
+++ b/engines/scumm/players/player_mod.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef SCUMM_PLAYER_MOD_H
-#define SCUMM_PLAYER_MOD_H
+#ifndef SCUMM_PLAYERS_PLAYER_MOD_H
+#define SCUMM_PLAYERS_PLAYER_MOD_H
#include "scumm/scumm.h"
#include "audio/audiostream.h"
diff --git a/engines/scumm/player_nes.cpp b/engines/scumm/players/player_nes.cpp
index a6ffc9ed86..f55f1f9edd 100644
--- a/engines/scumm/player_nes.cpp
+++ b/engines/scumm/players/player_nes.cpp
@@ -23,7 +23,7 @@
#ifndef DISABLE_NES_APU
#include "engines/engine.h"
-#include "scumm/player_nes.h"
+#include "scumm/players/player_nes.h"
#include "scumm/scumm.h"
#include "audio/mixer.h"
diff --git a/engines/scumm/player_nes.h b/engines/scumm/players/player_nes.h
index be1617e0f6..f0b3e79aad 100644
--- a/engines/scumm/player_nes.h
+++ b/engines/scumm/players/player_nes.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef SCUMM_PLAYER_NES_H
-#define SCUMM_PLAYER_NES_H
+#ifndef SCUMM_PLAYERS_PLAYER_NES_H
+#define SCUMM_PLAYERS_PLAYER_NES_H
#include "common/scummsys.h"
#include "scumm/music.h"
diff --git a/engines/scumm/player_pce.cpp b/engines/scumm/players/player_pce.cpp
index 8d886ee008..6d6e2fcde5 100644
--- a/engines/scumm/player_pce.cpp
+++ b/engines/scumm/players/player_pce.cpp
@@ -29,7 +29,7 @@
*/
#include <math.h>
-#include "player_pce.h"
+#include "scumm/players/player_pce.h"
#include "common/endian.h"
// PCE sound engine is only used by Loom, which requires 16bit color support
diff --git a/engines/scumm/player_pce.h b/engines/scumm/players/player_pce.h
index 427fb1ace6..ca2eddf58c 100644
--- a/engines/scumm/player_pce.h
+++ b/engines/scumm/players/player_pce.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef SCUMM_PLAYER_PCE_H
-#define SCUMM_PLAYER_PCE_H
+#ifndef SCUMM_PLAYERS_PLAYER_PCE_H
+#define SCUMM_PLAYERS_PLAYER_PCE_H
#include "common/scummsys.h"
#include "common/mutex.h"
diff --git a/engines/scumm/player_sid.cpp b/engines/scumm/players/player_sid.cpp
index 7a609364e5..1b97ad16d4 100644
--- a/engines/scumm/player_sid.cpp
+++ b/engines/scumm/players/player_sid.cpp
@@ -23,7 +23,7 @@
#ifndef DISABLE_SID
#include "engines/engine.h"
-#include "scumm/player_sid.h"
+#include "scumm/players/player_sid.h"
#include "scumm/scumm.h"
#include "audio/mixer.h"
diff --git a/engines/scumm/player_sid.h b/engines/scumm/players/player_sid.h
index 12e3573575..a48ec793cd 100644
--- a/engines/scumm/player_sid.h
+++ b/engines/scumm/players/player_sid.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef SCUMM_PLAYER_SID_H
-#define SCUMM_PLAYER_SID_H
+#ifndef SCUMM_PLAYERS_PLAYER_SID_H
+#define SCUMM_PLAYERS_PLAYER_SID_H
#include "common/mutex.h"
#include "common/scummsys.h"
diff --git a/engines/scumm/player_towns.cpp b/engines/scumm/players/player_towns.cpp
index 33e3e40e39..acbdbc7fb6 100644
--- a/engines/scumm/player_towns.cpp
+++ b/engines/scumm/players/player_towns.cpp
@@ -22,7 +22,7 @@
#include "scumm/sound.h"
-#include "scumm/player_towns.h"
+#include "scumm/players/player_towns.h"
namespace Scumm {
diff --git a/engines/scumm/player_towns.h b/engines/scumm/players/player_towns.h
index 5c76d7c6c7..2369b7da5f 100644
--- a/engines/scumm/player_towns.h
+++ b/engines/scumm/players/player_towns.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef SCUMM_PLAYER_TOWNS_H
-#define SCUMM_PLAYER_TOWNS_H
+#ifndef SCUMM_PLAYERS_PLAYER_TOWNS_H
+#define SCUMM_PLAYERS_PLAYER_TOWNS_H
#include "scumm/scumm.h"
#include "scumm/imuse/imuse.h"
diff --git a/engines/scumm/player_v1.cpp b/engines/scumm/players/player_v1.cpp
index 8e784e9866..0fa1ee9361 100644
--- a/engines/scumm/player_v1.cpp
+++ b/engines/scumm/players/player_v1.cpp
@@ -22,7 +22,7 @@
#include "engines/engine.h"
-#include "scumm/player_v1.h"
+#include "scumm/players/player_v1.h"
#include "scumm/scumm.h"
namespace Scumm {
diff --git a/engines/scumm/player_v1.h b/engines/scumm/players/player_v1.h
index 9e6063adc9..ccd24c39df 100644
--- a/engines/scumm/player_v1.h
+++ b/engines/scumm/players/player_v1.h
@@ -20,10 +20,10 @@
*
*/
-#ifndef SCUMM_PLAYER_V1_H
-#define SCUMM_PLAYER_V1_H
+#ifndef SCUMM_PLAYERS_PLAYER_V1_H
+#define SCUMM_PLAYERS_PLAYER_V1_H
-#include "scumm/player_v2.h"
+#include "scumm/players/player_v2.h"
namespace Scumm {
diff --git a/engines/scumm/player_v2.cpp b/engines/scumm/players/player_v2.cpp
index 6910f5e0db..2429af2d8c 100644
--- a/engines/scumm/player_v2.cpp
+++ b/engines/scumm/players/player_v2.cpp
@@ -20,7 +20,7 @@
*
*/
-#include "scumm/player_v2.h"
+#include "scumm/players/player_v2.h"
#include "scumm/scumm.h"
namespace Scumm {
diff --git a/engines/scumm/player_v2.h b/engines/scumm/players/player_v2.h
index d932585b8e..33878ff08b 100644
--- a/engines/scumm/player_v2.h
+++ b/engines/scumm/players/player_v2.h
@@ -20,10 +20,10 @@
*
*/
-#ifndef SCUMM_PLAYER_V2_H
-#define SCUMM_PLAYER_V2_H
+#ifndef SCUMM_PLAYERS_PLAYER_V2_H
+#define SCUMM_PLAYERS_PLAYER_V2_H
-#include "scumm/player_v2base.h"
+#include "scumm/players/player_v2base.h"
namespace Scumm {
diff --git a/engines/scumm/player_v2a.cpp b/engines/scumm/players/player_v2a.cpp
index 07fc77b301..aeccb8b7cb 100644
--- a/engines/scumm/player_v2a.cpp
+++ b/engines/scumm/players/player_v2a.cpp
@@ -21,7 +21,7 @@
*/
#include "engines/engine.h"
-#include "scumm/player_v2a.h"
+#include "scumm/players/player_v2a.h"
#include "scumm/scumm.h"
namespace Scumm {
diff --git a/engines/scumm/player_v2a.h b/engines/scumm/players/player_v2a.h
index fe20b43846..12193635f2 100644
--- a/engines/scumm/player_v2a.h
+++ b/engines/scumm/players/player_v2a.h
@@ -20,12 +20,12 @@
*
*/
-#ifndef SCUMM_PLAYER_V2A_H
-#define SCUMM_PLAYER_V2A_H
+#ifndef SCUMM_PLAYERS_PLAYER_V2A_H
+#define SCUMM_PLAYERS_PLAYER_V2A_H
#include "common/scummsys.h"
#include "scumm/music.h"
-#include "scumm/player_mod.h"
+#include "scumm/players/player_mod.h"
class Mixer;
diff --git a/engines/scumm/player_v2base.cpp b/engines/scumm/players/player_v2base.cpp
index 0d3ad4b1b3..75f1518989 100644
--- a/engines/scumm/player_v2base.cpp
+++ b/engines/scumm/players/player_v2base.cpp
@@ -20,7 +20,7 @@
*
*/
-#include "scumm/player_v2base.h"
+#include "scumm/players/player_v2base.h"
#include "scumm/scumm.h"
#define FREQ_HZ 236 // Don't change!
diff --git a/engines/scumm/player_v2base.h b/engines/scumm/players/player_v2base.h
index eb9ed941ca..32bde95ddc 100644
--- a/engines/scumm/player_v2base.h
+++ b/engines/scumm/players/player_v2base.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef SCUMM_PLAYER_V2BASE_H
-#define SCUMM_PLAYER_V2BASE_H
+#ifndef SCUMM_PLAYERS_PLAYER_V2BASE_H
+#define SCUMM_PLAYERS_PLAYER_V2BASE_H
#include "common/scummsys.h"
#include "common/mutex.h"
diff --git a/engines/scumm/player_v2cms.cpp b/engines/scumm/players/player_v2cms.cpp
index c1242e0645..8e903bf9d2 100644
--- a/engines/scumm/player_v2cms.cpp
+++ b/engines/scumm/players/player_v2cms.cpp
@@ -20,7 +20,7 @@
*
*/
-#include "scumm/player_v2cms.h"
+#include "scumm/players/player_v2cms.h"
#include "scumm/scumm.h"
#include "audio/mididrv.h"
#include "audio/mixer.h"
diff --git a/engines/scumm/player_v2cms.h b/engines/scumm/players/player_v2cms.h
index 905c7c141e..fe42720215 100644
--- a/engines/scumm/player_v2cms.h
+++ b/engines/scumm/players/player_v2cms.h
@@ -20,10 +20,10 @@
*
*/
-#ifndef SCUMM_PLAYER_V2CMS_H
-#define SCUMM_PLAYER_V2CMS_H
+#ifndef SCUMM_PLAYERS_PLAYER_V2CMS_H
+#define SCUMM_PLAYERS_PLAYER_V2CMS_H
-#include "scumm/player_v2base.h" // for channel_data
+#include "scumm/players/player_v2base.h" // for channel_data
class CMSEmulator;
diff --git a/engines/scumm/player_v3a.cpp b/engines/scumm/players/player_v3a.cpp
index 472cd1252b..ca0eedc90a 100644
--- a/engines/scumm/player_v3a.cpp
+++ b/engines/scumm/players/player_v3a.cpp
@@ -22,7 +22,7 @@
#include "engines/engine.h"
-#include "scumm/player_v3a.h"
+#include "scumm/players/player_v3a.h"
#include "scumm/scumm.h"
namespace Scumm {
diff --git a/engines/scumm/player_v3a.h b/engines/scumm/players/player_v3a.h
index 9449664e9b..3f84a74e51 100644
--- a/engines/scumm/player_v3a.h
+++ b/engines/scumm/players/player_v3a.h
@@ -20,12 +20,12 @@
*
*/
-#ifndef SCUMM_PLAYER_V3A_H
-#define SCUMM_PLAYER_V3A_H
+#ifndef SCUMM_PLAYERS_PLAYER_V3A_H
+#define SCUMM_PLAYERS_PLAYER_V3A_H
#include "common/scummsys.h"
#include "scumm/music.h"
-#include "scumm/player_mod.h"
+#include "scumm/players/player_mod.h"
class Mixer;
diff --git a/engines/scumm/player_v3m.cpp b/engines/scumm/players/player_v3m.cpp
index bf65ec797f..e30e31aff9 100644
--- a/engines/scumm/player_v3m.cpp
+++ b/engines/scumm/players/player_v3m.cpp
@@ -91,7 +91,7 @@
#include "common/translation.h"
#include "engines/engine.h"
#include "gui/message.h"
-#include "scumm/player_v3m.h"
+#include "scumm/players/player_v3m.h"
#include "scumm/scumm.h"
namespace Scumm {
diff --git a/engines/scumm/player_v3m.h b/engines/scumm/players/player_v3m.h
index 359bab32a9..615d736035 100644
--- a/engines/scumm/player_v3m.h
+++ b/engines/scumm/players/player_v3m.h
@@ -20,14 +20,14 @@
*
*/
-#ifndef SCUMM_PLAYER_V3M_H
-#define SCUMM_PLAYER_V3M_H
+#ifndef SCUMM_PLAYERS_PLAYER_V3M_H
+#define SCUMM_PLAYERS_PLAYER_V3M_H
#include "common/scummsys.h"
#include "common/util.h"
#include "common/mutex.h"
#include "scumm/music.h"
-#include "scumm/player_mac.h"
+#include "scumm/players/player_mac.h"
#include "audio/audiostream.h"
#include "audio/mixer.h"
diff --git a/engines/scumm/player_v4a.cpp b/engines/scumm/players/player_v4a.cpp
index e791736f0e..59f49625c3 100644
--- a/engines/scumm/player_v4a.cpp
+++ b/engines/scumm/players/player_v4a.cpp
@@ -21,7 +21,7 @@
*/
#include "engines/engine.h"
-#include "scumm/player_v4a.h"
+#include "scumm/players/player_v4a.h"
#include "scumm/scumm.h"
#include "common/file.h"
diff --git a/engines/scumm/player_v4a.h b/engines/scumm/players/player_v4a.h
index d01c70f295..c8c7b63ed2 100644
--- a/engines/scumm/player_v4a.h
+++ b/engines/scumm/players/player_v4a.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef SCUMM_PLAYER_V4A_H
-#define SCUMM_PLAYER_V4A_H
+#ifndef SCUMM_PLAYERS_PLAYER_V4A_H
+#define SCUMM_PLAYERS_PLAYER_V4A_H
#include "common/scummsys.h"
#include "common/util.h"
diff --git a/engines/scumm/player_v5m.cpp b/engines/scumm/players/player_v5m.cpp
index 500f3bbc40..77b6d52a3c 100644
--- a/engines/scumm/player_v5m.cpp
+++ b/engines/scumm/players/player_v5m.cpp
@@ -76,7 +76,7 @@
#include "common/translation.h"
#include "engines/engine.h"
#include "gui/message.h"
-#include "scumm/player_v5m.h"
+#include "scumm/players/player_v5m.h"
#include "scumm/scumm.h"
namespace Scumm {
diff --git a/engines/scumm/player_v5m.h b/engines/scumm/players/player_v5m.h
index b2079ee331..e3a457f8af 100644
--- a/engines/scumm/player_v5m.h
+++ b/engines/scumm/players/player_v5m.h
@@ -20,14 +20,14 @@
*
*/
-#ifndef SCUMM_PLAYER_V5M_H
-#define SCUMM_PLAYER_V5M_H
+#ifndef SCUMM_PLAYERS_PLAYER_V5M_H
+#define SCUMM_PLAYERS_PLAYER_V5M_H
#include "common/scummsys.h"
#include "common/util.h"
#include "common/mutex.h"
#include "scumm/music.h"
-#include "scumm/player_mac.h"
+#include "scumm/players/player_mac.h"
#include "audio/audiostream.h"
#include "audio/mixer.h"
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp
index 3453e53a18..8170a032d9 100644
--- a/engines/scumm/saveload.cpp
+++ b/engines/scumm/saveload.cpp
@@ -30,7 +30,7 @@
#include "scumm/charset.h"
#include "scumm/imuse_digi/dimuse.h"
#include "scumm/imuse/imuse.h"
-#include "scumm/player_towns.h"
+#include "scumm/players/player_towns.h"
#include "scumm/he/intern_he.h"
#include "scumm/object.h"
#include "scumm/resource.h"
diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp
index 2d4c326b68..3da7000ae9 100644
--- a/engines/scumm/script_v5.cpp
+++ b/engines/scumm/script_v5.cpp
@@ -27,7 +27,7 @@
#include "scumm/scumm_v3.h"
#include "scumm/scumm_v5.h"
#include "scumm/sound.h"
-#include "scumm/player_towns.h"
+#include "scumm/players/player_towns.h"
#include "scumm/util.h"
#include "scumm/verbs.h"
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index d1a3de94b8..cc8665e450 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -45,26 +45,26 @@
#include "scumm/imuse_digi/dimuse.h"
#include "scumm/smush/smush_mixer.h"
#include "scumm/smush/smush_player.h"
-#include "scumm/player_towns.h"
+#include "scumm/players/player_towns.h"
#include "scumm/insane/insane.h"
#include "scumm/he/animation_he.h"
#include "scumm/he/intern_he.h"
#include "scumm/he/logic_he.h"
#include "scumm/he/sound_he.h"
#include "scumm/object.h"
-#include "scumm/player_ad.h"
-#include "scumm/player_nes.h"
-#include "scumm/player_sid.h"
-#include "scumm/player_pce.h"
-#include "scumm/player_apple2.h"
-#include "scumm/player_v1.h"
-#include "scumm/player_v2.h"
-#include "scumm/player_v2cms.h"
-#include "scumm/player_v2a.h"
-#include "scumm/player_v3a.h"
-#include "scumm/player_v3m.h"
-#include "scumm/player_v4a.h"
-#include "scumm/player_v5m.h"
+#include "scumm/players/player_ad.h"
+#include "scumm/players/player_nes.h"
+#include "scumm/players/player_sid.h"
+#include "scumm/players/player_pce.h"
+#include "scumm/players/player_apple2.h"
+#include "scumm/players/player_v1.h"
+#include "scumm/players/player_v2.h"
+#include "scumm/players/player_v2cms.h"
+#include "scumm/players/player_v2a.h"
+#include "scumm/players/player_v3a.h"
+#include "scumm/players/player_v3m.h"
+#include "scumm/players/player_v4a.h"
+#include "scumm/players/player_v5m.h"
#include "scumm/resource.h"
#include "scumm/he/resource_he.h"
#include "scumm/scumm_v0.h"
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index aaf7f90aca..071805752b 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -30,7 +30,7 @@
#include "scumm/file.h"
#include "scumm/imuse/imuse.h"
#include "scumm/imuse_digi/dimuse.h"
-#include "scumm/player_towns.h"
+#include "scumm/players/player_towns.h"
#include "scumm/resource.h"
#include "scumm/scumm.h"
#include "scumm/sound.h"
diff --git a/engines/sword1/screen.cpp b/engines/sword1/screen.cpp
index ae128b8c05..76957e0a70 100644
--- a/engines/sword1/screen.cpp
+++ b/engines/sword1/screen.cpp
@@ -57,6 +57,30 @@ Screen::Screen(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan) {
_psxCache.extPlxCache = NULL;
_oldScrollX = 0;
_oldScrollY = 0;
+
+ _textMan = 0;
+
+ for (int i = 0; i < 4; i++)
+ _layerGrid[i] = 0;
+
+ for (int i = 0; i < 4; i++)
+ _layerBlocks[i] = 0;
+
+ _parallax[0] = 0;
+ _parallax[1] = 0;
+
+ _fullRefresh = 0;
+
+ for (int i = 0; i < MAX_SORT; i++) {
+ _sortList[i].id = 0;
+ _sortList[i].y = 0;
+ }
+ _scrnSizeX = 0;
+ _scrnSizeY = 0;
+ _gridSizeX = 0;
+ _gridSizeY = 0;
+ _fadingDirection = 0;
+ _isBlack = 0;
}
Screen::~Screen() {
diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp
index 2d5452778d..5738431dce 100644
--- a/engines/sword1/sword1.cpp
+++ b/engines/sword1/sword1.cpp
@@ -67,6 +67,17 @@ SwordEngine::SwordEngine(OSystem *syst)
SearchMan.addSubDirectoryMatching(gameDataDir, "italian"); // PSX Demo
_console = new SwordConsole(this);
+
+ _mouseState = 0;
+ _resMan = 0;
+ _objectMan = 0;
+ _screen = 0;
+ _mouse = 0;
+ _logic = 0;
+ _sound = 0;
+ _menu = 0;
+ _music = 0;
+ _control = 0;
}
SwordEngine::~SwordEngine() {
diff --git a/engines/toon/anim.cpp b/engines/toon/anim.cpp
index 78d3954325..19e997af34 100644
--- a/engines/toon/anim.cpp
+++ b/engines/toon/anim.cpp
@@ -41,7 +41,7 @@ bool Animation::loadAnimation(const Common::String &file) {
if (strncmp((char *)fileData, "KevinAguilar", 12))
return false;
- strcpy(_name, file.c_str());
+ Common::strlcpy(_name, file.c_str(), 32);
uint32 headerSize = READ_LE_UINT32(fileData + 16);
uint32 uncompressedBytes = READ_LE_UINT32(fileData + 20);
@@ -52,6 +52,7 @@ bool Animation::loadAnimation(const Common::String &file) {
_x2 = READ_LE_UINT32(fileData + 40);
_y2 = READ_LE_UINT32(fileData + 44);
_paletteEntries = READ_LE_UINT32(fileData + 56);
+ // CHECKME: Useless variable _fps
_fps = READ_LE_UINT32(fileData + 60);
uint32 paletteSize = READ_LE_UINT32(fileData + 64);
@@ -119,6 +120,10 @@ Animation::Animation(ToonEngine *vm) : _vm(vm) {
_palette = NULL;
_numFrames = 0;
_frames = NULL;
+
+ _x1 = _y1 = _x2 = _y2 = 0;
+ _fps = 0;
+ _paletteEntries = 0;
}
Animation::~Animation() {
@@ -448,6 +453,7 @@ AnimationInstance::AnimationInstance(ToonEngine *vm, AnimationInstanceType type)
_y = 0;
_z = 0;
_layerZ = 0;
+ _visible = false;
}
void AnimationInstance::render() {
diff --git a/engines/toon/audio.cpp b/engines/toon/audio.cpp
index bc0e051057..50b559ee00 100644
--- a/engines/toon/audio.cpp
+++ b/engines/toon/audio.cpp
@@ -255,6 +255,8 @@ AudioStreamInstance::AudioStreamInstance(AudioManager *man, Audio::Mixer *mixer,
} else {
stopNow();
}
+
+ _soundType = Audio::Mixer::kPlainSoundType;
}
AudioStreamInstance::~AudioStreamInstance() {
diff --git a/engines/toon/character.cpp b/engines/toon/character.cpp
index 83c9e3ec70..baab8888cf 100644
--- a/engines/toon/character.cpp
+++ b/engines/toon/character.cpp
@@ -65,6 +65,7 @@ Character::Character(ToonEngine *vm) : _vm(vm) {
_numPixelToWalk = 0;
_nextIdleTime = _vm->_system->getMillis() + (_vm->randRange(0, 600) + 300) * _vm->getTickLength();
_lineToSayId = 0;
+ _time = 0;
}
Character::~Character(void) {
diff --git a/engines/toon/font.cpp b/engines/toon/font.cpp
index e26ed92f83..2ba4eff652 100644
--- a/engines/toon/font.cpp
+++ b/engines/toon/font.cpp
@@ -32,6 +32,8 @@ FontRenderer::FontRenderer(ToonEngine *vm) : _vm(vm) {
_currentFontColor[1] = 0xc8;
_currentFontColor[2] = 0xcb;
_currentFontColor[3] = 0xce;
+
+ _currentFont = nullptr;
}
FontRenderer::~FontRenderer() {
@@ -195,8 +197,7 @@ void FontRenderer::renderMultiLineText(int16 x, int16 y, const Common::String &o
// divide the text in several lines
// based on number of characters or size of lines.
byte text[1024];
- strncpy((char *)text, origText.c_str(), 1023);
- text[1023] = 0;
+ Common::strlcpy((char *)text, origText.c_str(), 1024);
byte *lines[16];
int32 lineSize[16];
diff --git a/engines/toon/movie.cpp b/engines/toon/movie.cpp
index f0463a52e1..9e8514d0a8 100644
--- a/engines/toon/movie.cpp
+++ b/engines/toon/movie.cpp
@@ -85,7 +85,8 @@ void Movie::play(const Common::String &video, int32 flags) {
_playing = true;
if (flags & 1)
_vm->getAudioManager()->setMusicVolume(0);
- _decoder->loadFile(video.c_str());
+ if (!_decoder->loadFile(video.c_str()))
+ error("Unable to play video %s", video.c_str());
playVideo(isFirstIntroVideo);
_vm->flushPalette(true);
if (flags & 1)
@@ -94,7 +95,7 @@ void Movie::play(const Common::String &video, int32 flags) {
_playing = false;
}
-bool Movie::playVideo(bool isFirstIntroVideo) {
+void Movie::playVideo(bool isFirstIntroVideo) {
debugC(1, kDebugMovie, "playVideo(isFirstIntroVideo: %d)", isFirstIntroVideo);
_decoder->start();
@@ -135,13 +136,13 @@ bool Movie::playVideo(bool isFirstIntroVideo) {
while (_vm->_system->getEventManager()->pollEvent(event))
if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE)) {
_vm->dirtyAllScreen();
- return false;
+ return;
}
_vm->_system->delayMillis(10);
}
_vm->dirtyAllScreen();
- return !_vm->shouldQuit();
+ return;
}
} // End of namespace Toon
diff --git a/engines/toon/movie.h b/engines/toon/movie.h
index 4dd6583bf6..14287d87fd 100644
--- a/engines/toon/movie.h
+++ b/engines/toon/movie.h
@@ -53,9 +53,8 @@ public:
bool isPlaying() { return _playing; }
protected:
- bool playVideo(bool isFirstIntroVideo);
+ void playVideo(bool isFirstIntroVideo);
ToonEngine *_vm;
- Audio::Mixer *_mixer;
ToonstruckSmackerDecoder *_decoder;
bool _playing;
};
diff --git a/engines/toon/path.cpp b/engines/toon/path.cpp
index 7914aed595..336847e73c 100644
--- a/engines/toon/path.cpp
+++ b/engines/toon/path.cpp
@@ -152,6 +152,8 @@ PathFinding::PathFinding() {
_heap = new PathFindingHeap();
_sq = NULL;
_numBlockingRects = 0;
+
+ _currentMask = nullptr;
}
PathFinding::~PathFinding(void) {
diff --git a/engines/toon/picture.cpp b/engines/toon/picture.cpp
index 65cc3a70e1..4927f50e08 100644
--- a/engines/toon/picture.cpp
+++ b/engines/toon/picture.cpp
@@ -134,6 +134,11 @@ bool Picture::loadPicture(const Common::String &file) {
Picture::Picture(ToonEngine *vm) : _vm(vm) {
_data = NULL;
_palette = NULL;
+
+ _width = 0;
+ _height = 0;
+ _paletteEntries = 0;
+ _useFullPalette = false;
}
Picture::~Picture() {
diff --git a/engines/toon/resource.cpp b/engines/toon/resource.cpp
index 2d419ec027..ffcabbd348 100644
--- a/engines/toon/resource.cpp
+++ b/engines/toon/resource.cpp
@@ -285,6 +285,7 @@ void PakFile::close() {
}
PakFile::PakFile() {
+ _numFiles = 0;
}
PakFile::~PakFile() {
diff --git a/engines/toon/resource.h b/engines/toon/resource.h
index c80ac2216e..b432a1d335 100644
--- a/engines/toon/resource.h
+++ b/engines/toon/resource.h
@@ -53,7 +53,6 @@ protected:
uint32 _numFiles;
Common::Array<File> _files;
- Common::File *_fileHandle;
};
class ToonEngine;
diff --git a/engines/toon/script.cpp b/engines/toon/script.cpp
index 69ae727bb5..d752c277db 100644
--- a/engines/toon/script.cpp
+++ b/engines/toon/script.cpp
@@ -59,6 +59,8 @@ EMCInterpreter::EMCInterpreter(ToonEngine *vm) : _vm(vm), _scriptData(0), _filen
};
_opcodes = opcodes;
#undef OPCODE
+
+ _parameter = 0;
}
EMCInterpreter::~EMCInterpreter() {
@@ -132,8 +134,7 @@ bool EMCInterpreter::load(const char *filename, EMCData *scriptData, const Commo
_scriptData->sysFuncs = opcodes;
- strncpy(_scriptData->filename, filename, 13);
- _scriptData->filename[12] = 0;
+ Common::strlcpy(_scriptData->filename, filename, 13);
_scriptData = 0;
_filename = 0;
diff --git a/engines/toon/script_func.cpp b/engines/toon/script_func.cpp
index 1fa4058114..70baaaef22 100644
--- a/engines/toon/script_func.cpp
+++ b/engines/toon/script_func.cpp
@@ -1060,9 +1060,9 @@ int32 ScriptFunc::sys_Cmd_Set_Location_Data(EMCState *state) {
// initial setup of locations
int32 locationId = stackPos(0);
debugC(0, 0, "setlocationdata(%d) %s %x %s %s %d %d", locationId, GetText(1, state), stackPos(2), GetText(3, state), GetText(4, state), stackPos(5), stackPos(6));
- strcpy(_vm->state()->_locations[locationId]._name, GetText(1, state));
- strcpy(_vm->state()->_locations[locationId]._music, GetText(3, state));
- strcpy(_vm->state()->_locations[locationId]._cutaway, GetText(4, state));
+ Common::strlcpy(_vm->state()->_locations[locationId]._name, GetText(1, state), 64);
+ Common::strlcpy(_vm->state()->_locations[locationId]._music, GetText(3, state), 64);
+ Common::strlcpy(_vm->state()->_locations[locationId]._cutaway, GetText(4, state), 64);
_vm->state()->_locations[locationId]._flags = stackPos(2);
_vm->state()->_locations[locationId]._visited = false;
_vm->state()->_locations[locationId]._numSceneAnimations = stackPos(5);
diff --git a/engines/toon/state.cpp b/engines/toon/state.cpp
index 8e4abbd709..fffa8cf529 100644
--- a/engines/toon/state.cpp
+++ b/engines/toon/state.cpp
@@ -115,6 +115,10 @@ State::State(void) {
#endif
memset(_conversationState, 0, sizeof(Conversation) * 60);
+
+ _conversationData = nullptr;
+ _currentConversationId = -1;
+ _exitConversation = true;
}
State::~State(void) {
diff --git a/engines/toon/tools.cpp b/engines/toon/tools.cpp
index added39940..f5c77aca69 100644
--- a/engines/toon/tools.cpp
+++ b/engines/toon/tools.cpp
@@ -136,6 +136,13 @@ uint32 decompressSPCN(byte *src, byte *dst, uint32 dstsize) {
RncDecoder::RncDecoder() {
initCrc();
+
+ _bitBuffl = 0;
+ _bitBuffh = 0;
+ _bitCount = 0;
+ _srcPtr = nullptr;
+ _dstPtr = nullptr;
+ _inputByteLeft = 0;
}
RncDecoder::~RncDecoder() { }
diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp
index 286bcf1941..a97bfd55e8 100644
--- a/engines/toon/toon.cpp
+++ b/engines/toon/toon.cpp
@@ -922,6 +922,36 @@ ToonEngine::ToonEngine(OSystem *syst, const ADGameDescription *gameDescription)
_gameVariant = 0;
break;
}
+
+ for (int i = 0; i < 64; i++) {
+ _sceneAnimationScripts[i]._lastTimer = 0;
+ _sceneAnimationScripts[i]._frozen = false;
+ _sceneAnimationScripts[i]._frozenForConversation = false;
+ _sceneAnimationScripts[i]._active = false;
+ }
+
+ _lastProcessedSceneScript = 0;
+ _animationSceneScriptRunFlag = false;
+ _updatingSceneScriptRunFlag = false;
+ _dirtyAll = false;
+ _cursorOffsetX = 0;
+ _cursorOffsetY = 0;
+ _currentTextLine = 0;
+ _currentTextLineId = 0;
+ _currentTextLineX = 0;
+ _currentTextLineY = 0;
+ _currentTextLineCharacterId = -1;
+ _oldScrollValue = 0;
+ _drew = nullptr;
+ _flux = nullptr;
+ _currentHotspotItem = 0;
+ _shouldQuit = false;
+ _scriptStep = 0;
+ _oldTimer = 0;
+ _oldTimer2 = 0;
+ _lastRenderTime = 0;
+ _firstFrame = false;
+ _needPaletteFlush = true;
}
ToonEngine::~ToonEngine() {
diff --git a/engines/touche/touche.cpp b/engines/touche/touche.cpp
index 89cc1ad5af..6ca17c86a1 100644
--- a/engines/touche/touche.cpp
+++ b/engines/touche/touche.cpp
@@ -110,6 +110,31 @@ ToucheEngine::ToucheEngine(OSystem *system, Common::Language language)
DebugMan.addDebugChannel(kDebugCharset, "Charset", "Charset debug level");
_console = new ToucheConsole(this);
+
+ _newEpisodeNum = 0;
+ _currentEpisodeNum = 0;
+ _currentAmountOfMoney = 0;
+ _giveItemToKeyCharNum = 0;
+ _giveItemToObjectNum = 0;
+ _giveItemToCounter = 0;
+ _currentRoomNum = 0;
+ _waitingSetKeyCharNum1 = 0;
+ _waitingSetKeyCharNum2 = 0;
+ _waitingSetKeyCharNum3 = 0;
+ _script.opcodeNum = 0;
+ _script.dataOffset = 0;
+ _script.keyCharNum = 0;
+ _script.dataPtr = 0;
+ _script.stackDataPtr = 0;
+ _script.stackDataBasePtr = 0;
+ _script.quitFlag = 0;
+ _opcodesTable = 0;
+
+ for (uint i = 0; i < NUM_SPRITES; i++)
+ memset(&_spritesTable[i], 0, sizeof(SpriteData));
+
+ for (uint i = 0; i < NUM_SEQUENCES; i++)
+ memset(&_sequenceEntryTable[i], 0, sizeof(SequenceEntry));
}
ToucheEngine::~ToucheEngine() {
diff --git a/engines/touche/touche.h b/engines/touche/touche.h
index 6ac43e7dfe..9cc42b0c68 100644
--- a/engines/touche/touche.h
+++ b/engines/touche/touche.h
@@ -102,7 +102,7 @@ struct KeyChar {
int16 zPosPrev;
int16 prevWalkDataNum;
uint16 textColor;
- int16 inventoryItems[4];
+ int16 inventoryItems[5];
int16 money;
int16 pointsDataNum;
int16 currentWalkBox;
diff --git a/engines/tsage/blue_force/blueforce_logic.cpp b/engines/tsage/blue_force/blueforce_logic.cpp
index 63f84d25e1..5674773177 100644
--- a/engines/tsage/blue_force/blueforce_logic.cpp
+++ b/engines/tsage/blue_force/blueforce_logic.cpp
@@ -454,9 +454,10 @@ void Timer::dispatch() {
if (_endFrame) {
uint32 frameNumber = BF_GLOBALS._events.getFrameNumber();
- if (frameNumber > _endFrame)
+ if (frameNumber > _endFrame) {
// Timer has expired
signal();
+ }
}
}
@@ -472,7 +473,8 @@ void Timer::set(uint32 delay, EventHandler *endHandler) {
/*--------------------------------------------------------------------------*/
TimerExt::TimerExt(): Timer() {
- _action = NULL;
+ _action = nullptr;
+ _newAction = nullptr;
}
void TimerExt::set(uint32 delay, EventHandler *endHandler, Action *newAction) {
@@ -839,7 +841,7 @@ void SceneExt::startStrip() {
scene->_savedCanWalk = BF_GLOBALS._player._canWalk;
BF_GLOBALS._player.disableControl();
- if (!BF_GLOBALS._v50696 && T2_GLOBALS._uiElements._active)
+ if (T2_GLOBALS._uiElements._active)
T2_GLOBALS._uiElements.hide();
}
}
@@ -853,7 +855,7 @@ void SceneExt::endStrip() {
BF_GLOBALS._player._uiEnabled = scene->_savedUiEnabled;
BF_GLOBALS._player._canWalk = scene->_savedCanWalk;
- if (!BF_GLOBALS._v50696 && T2_GLOBALS._uiElements._active)
+ if (T2_GLOBALS._uiElements._active)
T2_GLOBALS._uiElements.show();
}
}
@@ -888,7 +890,6 @@ void PalettedScene::remove() {
BF_GLOBALS._sceneObjects->draw();
BF_GLOBALS._scenePalette.loadPalette(2);
- BF_GLOBALS._v51C44 = 1;
BF_GLOBALS._sceneManager._hasPalette = true;
}
@@ -909,6 +910,7 @@ void PalettedScene::add2Faders(const byte *arrBufferRGB, int step, int paletteNu
void PalettedScene::transition(const byte *arrBufferRGB, int percent, int paletteNum, Action *action, int fromColor1, int fromColor2, int toColor1, int toColor2, bool flag) {
byte tmpPalette[768];
+ memset(tmpPalette, 0, 768);
_palette.loadPalette(paletteNum);
_palette.loadPalette(2);
@@ -1260,8 +1262,6 @@ void BlueForceInvObjectList::alterInventory(int mode) {
setObjectScene(INV_TICKET_BOOK, 60);
setObjectScene(INV_MIRANDA_CARD, 60);
- BF_GLOBALS._v4CEC4 = 0;
-
switch (mode) {
case 2:
if (hasPrintout)
diff --git a/engines/tsage/blue_force/blueforce_scenes0.cpp b/engines/tsage/blue_force/blueforce_scenes0.cpp
index f1f00599e0..06be605c1a 100644
--- a/engines/tsage/blue_force/blueforce_scenes0.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes0.cpp
@@ -343,7 +343,7 @@ void Scene50::synchronize(Serializer &s) {
void Scene50::postInit(SceneObjectList *OwnerList) {
SceneExt::postInit();
- BF_GLOBALS._interfaceY = 200;
+ BF_GLOBALS._interfaceY = SCREEN_HEIGHT;
T2_GLOBALS._uiElements._active = false;
BF_GLOBALS._player.postInit();
BF_GLOBALS._player.setVisage(830);
@@ -419,6 +419,8 @@ void Scene50::postInit(SceneObjectList *OwnerList) {
tooltip = &_location8;
xp = 75;
break;
+ default:
+ error("Unexpected tooltip value %d", selectedTooltip);
}
_timer.set(240, this);
@@ -940,7 +942,6 @@ void Scene60::Action3::signal() {
scene->_stripManager.start(71, this);
break;
case 2:
- scene->_field1222 = true;
BF_GLOBALS._player.enableControl();
remove();
break;
@@ -954,7 +955,6 @@ Scene60::Scene60(): SceneExt() {
_sceneNumber = 0;
_visage = 0;
_cursorId = CURSOR_NONE;
- _field1222 = false;
}
void Scene60::synchronize(Serializer &s) {
@@ -964,7 +964,10 @@ void Scene60::synchronize(Serializer &s) {
s.syncAsSint16LE(_sceneNumber);
s.syncAsSint16LE(_visage);
s.syncAsSint16LE(_cursorId);
- s.syncAsSint16LE(_field1222);
+ if (s.getVersion() < 11) {
+ int useless = 0;
+ s.syncAsSint16LE(useless);
+ }
}
void Scene60::postInit(SceneObjectList *OwnerList) {
diff --git a/engines/tsage/blue_force/blueforce_scenes0.h b/engines/tsage/blue_force/blueforce_scenes0.h
index dd502c5f30..e7ee06e779 100644
--- a/engines/tsage/blue_force/blueforce_scenes0.h
+++ b/engines/tsage/blue_force/blueforce_scenes0.h
@@ -174,8 +174,6 @@ public:
int _sceneNumber;
int _visage;
CursorType _cursorId;
- // TODO: Check if really useless in original
- bool _field1222;
Scene60();
virtual void synchronize(Serializer &s);
diff --git a/engines/tsage/blue_force/blueforce_scenes1.cpp b/engines/tsage/blue_force/blueforce_scenes1.cpp
index d26e34ae23..fa877ea6c9 100644
--- a/engines/tsage/blue_force/blueforce_scenes1.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes1.cpp
@@ -176,7 +176,6 @@ void Scene100::postInit(SceneObjectList *OwnerList) {
loadScene(101);
}
BF_GLOBALS._scenePalette.loadPalette(2);
- BF_GLOBALS._v51C44 = 1;
BF_GLOBALS._interfaceY = SCREEN_HEIGHT;
g_globals->_player.postInit();
@@ -232,7 +231,6 @@ void Scene109::Action1::signal() {
scene->_text.setup(BF_19840515, this);
break;
case 3:
- BF_GLOBALS._v51C44 = 1;
scene->loadScene(115);
scene->_protaginist2.show();
@@ -246,7 +244,6 @@ void Scene109::Action1::signal() {
scene->_beerSign.show();
scene->_beerSign.setAction(&scene->_action2);
- BF_GLOBALS._v501FC = 170;
setDelay(60);
break;
case 4:
@@ -401,12 +398,10 @@ void Scene110::Action1::signal() {
scene->_object6.show();
scene->_object9.show();
scene->_object10.show();
- BF_GLOBALS._v51C44 = 1;
scene->loadScene(110);
setDelay(10);
break;
case 2:
- BF_GLOBALS._v51C44 = 1;
scene->_object1.animate(ANIM_MODE_5, this);
break;
case 3: {
@@ -1833,8 +1828,6 @@ void Scene125::Action2::signal() {
setDelay(20);
break;
case 2: {
- BF_GLOBALS._v501FA = 10;
- BF_GLOBALS._v51C44 = 1;
Common::Point destPos(202, 94);
NpcMover *mover = new NpcMover();
BF_GLOBALS._player.addMover(mover, &destPos, this);
@@ -2311,7 +2304,6 @@ void Scene140::Action1::signal() {
setDelay(60);
// No break on purpose
case 13:
- BF_GLOBALS._v51C44 = 1;
BF_GLOBALS._sceneManager.changeScene(150);
default:
break;
@@ -2337,9 +2329,6 @@ void Scene140::postInit(SceneObjectList *OwnerList) {
_object1.changeZoom(100);
_object1.hide();
- BF_GLOBALS._v5020C = 0;
- BF_GLOBALS._v501F8 = 300;
- BF_GLOBALS._v501FC = 90;
BF_GLOBALS._sound1.play(7);
_object2.setAction(&_action1);
@@ -2640,7 +2629,6 @@ void Scene160::Action2::signal() {
BF_GLOBALS._sound1.stop();
// End of hack
- BF_GLOBALS._v51C44 = 1;
BF_GLOBALS._sceneManager.changeScene(200);
break;
default:
@@ -2788,9 +2776,6 @@ void Scene180::postInit(SceneObjectList *OwnerList) {
setZoomPercents(121, 60, 125, 70);
if ((BF_GLOBALS._bookmark == bLyleStoppedBy) && (BF_GLOBALS._dayNumber == 1)) {
- BF_GLOBALS._v501FC = 87;
- BF_GLOBALS._v501FA = _sceneBounds.left + 10;
- // CHECKME: BF_GLOBALS._v50206 = 18; ??
_sceneMessage.setup(THE_NEXT_DAY);
_sceneMode = 6;
setAction(&_sceneMessage, this);
@@ -2799,9 +2784,6 @@ void Scene180::postInit(SceneObjectList *OwnerList) {
BF_GLOBALS._mapLocationId = 4;
} else if (((BF_GLOBALS._bookmark == bDroppedOffLyle) && (BF_GLOBALS._dayNumber == 3)) ||
((BF_GLOBALS._bookmark == bDoneAtLyles) && (BF_GLOBALS._dayNumber == 4))) {
- BF_GLOBALS._v501FC = 87;
- BF_GLOBALS._v501FA = _sceneBounds.left + 10;
- // CHECKME: BF_GLOBALS._v50206 = 18; ??
_sceneMessage.setup(THE_NEXT_DAY);
_sceneMode = 6;
setAction(&_sceneMessage, this);
diff --git a/engines/tsage/blue_force/blueforce_scenes2.cpp b/engines/tsage/blue_force/blueforce_scenes2.cpp
index c992afe620..1b0ed2a145 100644
--- a/engines/tsage/blue_force/blueforce_scenes2.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes2.cpp
@@ -1603,7 +1603,6 @@ void Scene271::signal() {
}
break;
case 12:
- BF_GLOBALS._v51C44 = 0;
BF_GLOBALS._sound1.changeSound(67);
BF_GLOBALS._sceneManager.changeScene(280);
break;
@@ -1617,7 +1616,6 @@ void Scene271::signal() {
_field2E16 = 1;
break;
case 2704:
- BF_GLOBALS._v51C44 = 1;
BF_GLOBALS._sound1.fadeOut2(NULL);
BF_GLOBALS._sceneManager.changeScene(690);
break;
@@ -1649,7 +1647,6 @@ void Scene271::signal() {
addFader((const byte *)&black, 2, this);
break;
case 2712:
- BF_GLOBALS._v51C44 = 1;
BF_GLOBALS._sound1.fadeOut2(NULL);
BF_GLOBALS._sceneManager.changeScene(180);
break;
@@ -1657,7 +1654,6 @@ void Scene271::signal() {
BF_GLOBALS._player.enableControl();
break;
case 2714:
- BF_GLOBALS._v51C44 = 1;
BF_GLOBALS._sceneManager.changeScene(560);
break;
case 2715:
diff --git a/engines/tsage/blue_force/blueforce_scenes3.cpp b/engines/tsage/blue_force/blueforce_scenes3.cpp
index 81e4af6e97..5dd795cb39 100644
--- a/engines/tsage/blue_force/blueforce_scenes3.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes3.cpp
@@ -564,7 +564,6 @@ void Scene300::dispatch() {
if ((BF_GLOBALS._player._position.y < 59) && (BF_GLOBALS._player._position.x > 137) &&
(_sceneMode != 6308) && (_sceneMode != 7308)) {
- // The original was setting a useless global variable (removed)
_sceneMode = 6308;
BF_GLOBALS._player.disableControl();
ADD_MOVER(BF_GLOBALS._player, BF_GLOBALS._player._position.x + 20,
@@ -967,7 +966,6 @@ void Scene315::Action1::signal() {
/*--------------------------------------------------------------------------*/
Scene315::Scene315() {
- BF_GLOBALS._v51C44 = 1;
_field1B6C = _field139C = 0;
if (BF_GLOBALS._dayNumber == 0)
BF_GLOBALS._dayNumber = 1;
@@ -977,12 +975,19 @@ Scene315::Scene315() {
_doorOpened = false;
_invGreenCount = _bookGreenCount = 0;
_invGangCount = _bookGangCount = 0;
+
+ _stripNumber = 0;
+ _field1398 = 0;
+ _currentCursor = INV_NONE;
}
void Scene315::synchronize(Serializer &s) {
SceneExt::synchronize(s);
- s.syncAsSint16LE(_field1390);
+ if (s.getVersion() < 11) {
+ int useless = 0;
+ s.syncAsSint16LE(useless);
+ }
s.syncAsSint16LE(_stripNumber);
s.syncAsSint16LE(_field1398);
s.syncAsSint16LE(_invGreenCount);
@@ -1399,7 +1404,7 @@ bool Scene325::Item1::startAction(CursorType action, Event &event) {
void Scene325::postInit(SceneObjectList *OwnerList) {
SceneExt::postInit();
loadScene(325);
- BF_GLOBALS._interfaceY = 200;
+ BF_GLOBALS._interfaceY = SCREEN_HEIGHT;
BF_GLOBALS.clearFlag(fCanDrawGun);
if (BF_GLOBALS._dayNumber == 0)
@@ -4439,7 +4444,6 @@ void Scene360::postInit(SceneObjectList *OwnerList) {
BF_GLOBALS._player.enableControl();
if ((BF_GLOBALS._sceneManager._previousScene == 355) || (BF_GLOBALS._sceneManager._previousScene != 370)) {
- // The original was using there a useless variable (now removed)
BF_GLOBALS._player.setPosition(Common::Point(253, 135));
BF_GLOBALS._player.setStrip(2);
diff --git a/engines/tsage/blue_force/blueforce_scenes3.h b/engines/tsage/blue_force/blueforce_scenes3.h
index ea9d5f7311..d9f0d32edc 100644
--- a/engines/tsage/blue_force/blueforce_scenes3.h
+++ b/engines/tsage/blue_force/blueforce_scenes3.h
@@ -210,7 +210,6 @@ public:
WestExit _westExit;
SouthWestExit _swExit;
Action1 _action1;
- int _field1390;
int _stripNumber;
int _field1398;
int _invGreenCount, _bookGreenCount, _invGangCount;
diff --git a/engines/tsage/blue_force/blueforce_scenes4.cpp b/engines/tsage/blue_force/blueforce_scenes4.cpp
index a10f311791..072761b5ac 100644
--- a/engines/tsage/blue_force/blueforce_scenes4.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes4.cpp
@@ -39,7 +39,7 @@ namespace BlueForce {
void Scene410::Action1::signal() {
Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene;
- switch (scene->_field1FB6++) {
+ switch (scene->_action1Count++) {
case 0:
if (BF_GLOBALS.getFlag(fTalkedDriverNoBkup)) {
setDelay(3);
@@ -136,7 +136,7 @@ void Scene410::Action5::signal() {
switch (_actionIndex++) {
case 0:
- if (scene->_field1FC4 == 0) {
+ if (scene->_harrisonMovedFl == 0) {
ADD_PLAYER_MOVER(114, 133);
} else {
ADD_PLAYER_MOVER(195, 139);
@@ -167,7 +167,7 @@ void Scene410::Action6::signal() {
switch (_actionIndex++) {
case 0:
- if (scene->_field1FC4 == 0) {
+ if (scene->_harrisonMovedFl == 0) {
ADD_PLAYER_MOVER(114, 133);
} else {
ADD_PLAYER_MOVER(126, 99);
@@ -243,7 +243,7 @@ bool Scene410::Motorcycle::startAction(CursorType action, Event &event) {
} else if (BF_GLOBALS.getFlag(fSearchedTruck) && !BF_GLOBALS._sceneObjects->contains(&scene->_harrison)) {
scene->_sceneMode = 4103;
scene->signal();
- } else if (scene->_field1FBC != 0) {
+ } else if (scene->_cuffedDriverFl != 0) {
SceneItem::display2(410, 12);
} else {
scene->_sceneMode = 4103;
@@ -260,7 +260,7 @@ bool Scene410::TruckFront::startAction(CursorType action, Event &event) {
switch (action) {
case CURSOR_USE:
- if ((BF_GLOBALS._bookmark < bStoppedFrankie) && (!scene->_field1FBC || !scene->_field1FBA))
+ if ((BF_GLOBALS._bookmark < bStoppedFrankie) && (!scene->_cuffedDriverFl || !scene->_field1FBA))
break;
else if (BF_GLOBALS.getFlag(fSearchedTruck))
SceneItem::display2(410, 13);
@@ -293,7 +293,7 @@ bool Scene410::Driver::startAction(CursorType action, Event &event) {
} else {
SceneItem::display2(410, 7);
}
- } else if (!scene->_field1FBC) {
+ } else if (!scene->_cuffedDriverFl) {
SceneItem::display2(410, 7);
} else if (!scene->_field1FC0) {
scene->_sceneMode = 4124;
@@ -309,13 +309,13 @@ bool Scene410::Driver::startAction(CursorType action, Event &event) {
return true;
case INV_HANDCUFFS:
if (BF_GLOBALS.getFlag(fCalledBackup)) {
- if ((scene->_talkCount < 5) || (scene->_field1FB6 < 1) || (scene->_field1FBC != 0))
+ if ((scene->_talkCount < 5) || (scene->_action1Count < 1) || (scene->_cuffedDriverFl != 0))
break;
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 4123;
scene->_stripManager.start(4125, scene);
- scene->_field1FBC = 1;
+ scene->_cuffedDriverFl = 1;
T2_GLOBALS._uiElements.addScore(30);
} else {
if (BF_GLOBALS.getFlag(fTalkedDriverNoBkup)) {
@@ -328,11 +328,11 @@ bool Scene410::Driver::startAction(CursorType action, Event &event) {
case INV_TICKET_BOOK:
if (!BF_GLOBALS.getFlag(fDriverOutOfTruck)) {
return startAction(CURSOR_TALK, event);
- } else if (!scene->_field1FC4) {
+ } else if (!scene->_harrisonMovedFl) {
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 2;
scene->setAction(&scene->_sequenceManager1, scene, 4120, &scene->_passenger, &BF_GLOBALS._player, NULL);
- } else if ((scene->_field1FBC != 0) || (scene->_field1FC2 != 0)) {
+ } else if ((scene->_cuffedDriverFl != 0) || (scene->_field1FC2 != 0)) {
break;
} else {
scene->_field1FC2 = 1;
@@ -343,7 +343,7 @@ bool Scene410::Driver::startAction(CursorType action, Event &event) {
}
return true;
case INV_MIRANDA_CARD:
- if (scene->_field1FBC == 0)
+ if (scene->_cuffedDriverFl == 0)
return false;
if (BF_GLOBALS.getFlag(readFrankRights)) {
@@ -455,7 +455,7 @@ bool Scene410::Harrison::startAction(CursorType action, Event &event) {
SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 32, SET_EXT_BGCOLOR, 49,
SET_EXT_FGCOLOR, 13, LIST_END);
}
- } else if ((scene->_field1FBA != 0) && (scene->_field1FBC != 0)) {
+ } else if ((scene->_field1FBA != 0) && (scene->_cuffedDriverFl != 0)) {
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 4112;
scene->_stripManager.start(4113, scene);
@@ -476,13 +476,13 @@ bool Scene410::Harrison::startAction(CursorType action, Event &event) {
BF_GLOBALS._walkRegions.enableRegion(22);
scene->_sceneMode = 4122;
scene->_stripManager.start(4112, scene);
- } else if (scene->_field1FB6 < 1) {
+ } else if (scene->_action1Count < 1) {
break;
- } else if (scene->_field1FBC != 0) {
+ } else if (scene->_cuffedDriverFl != 0) {
error("Error - want to cuff driver, but he's cuffed already");
} else {
BF_GLOBALS._player.disableControl();
- scene->_field1FBC = 1;
+ scene->_cuffedDriverFl = 1;
scene->_field1FC0 = 1;
BF_GLOBALS._walkRegions.enableRegion(22);
scene->_sceneMode = 4109;
@@ -500,20 +500,20 @@ bool Scene410::Harrison::startAction(CursorType action, Event &event) {
/*--------------------------------------------------------------------------*/
Scene410::Scene410(): SceneExt() {
- _field1FB6 = _talkCount = _field1FBA = _field1FBC = 0;
- _field1FBE = _field1FC0 = _field1FC2 = _field1FC4 = 0;
+ _action1Count = _talkCount = _field1FBA = _cuffedDriverFl = 0;
+ _field1FBE = _field1FC0 = _field1FC2 = _harrisonMovedFl = 0;
}
void Scene410::synchronize(Serializer &s) {
SceneExt::synchronize(s);
- s.syncAsSint16LE(_field1FB6);
+ s.syncAsSint16LE(_action1Count);
s.syncAsSint16LE(_talkCount);
s.syncAsSint16LE(_field1FBA);
- s.syncAsSint16LE(_field1FBC);
+ s.syncAsSint16LE(_cuffedDriverFl);
s.syncAsSint16LE(_field1FBE);
s.syncAsSint16LE(_field1FC0);
s.syncAsSint16LE(_field1FC2);
- s.syncAsSint16LE(_field1FC4);
+ s.syncAsSint16LE(_harrisonMovedFl);
}
void Scene410::postInit(SceneObjectList *OwnerList) {
@@ -593,7 +593,7 @@ void Scene410::postInit(SceneObjectList *OwnerList) {
_patrolCar.fixPriority(148);
_patrolCar.setPosition(Common::Point(39, 168));
- _field1FC4 = 1;
+ _harrisonMovedFl = 1;
_sceneMode = 0;
signal();
break;
@@ -603,10 +603,10 @@ void Scene410::postInit(SceneObjectList *OwnerList) {
_driver.remove();
_sceneMode = 0;
} else {
- _field1FC4 = BF_GLOBALS._v50CC8;
+ _harrisonMovedFl = BF_GLOBALS._scene410HarrisonMovedFl;
_field1FBA = BF_GLOBALS._v50CC2;
- _talkCount = BF_GLOBALS._v50CC6;
- _field1FB6 = BF_GLOBALS._v50CC4;
+ _talkCount = BF_GLOBALS._scene410TalkCount;
+ _action1Count = BF_GLOBALS._scene410Action1Count;
_passenger.setVisage(418);
_passenger.setStrip(6);
@@ -651,7 +651,7 @@ void Scene410::postInit(SceneObjectList *OwnerList) {
_patrolCar.setDetails(410, 8, 9, 10, 1, (SceneItem *)NULL);
_patrolCar.fixPriority(148);
- if (_field1FC4) {
+ if (_harrisonMovedFl) {
_harrison.setPosition(Common::Point(108, 112));
_patrolCar.fixPriority(148);
_patrolCar.setPosition(Common::Point(39, 168));
@@ -664,7 +664,7 @@ void Scene410::postInit(SceneObjectList *OwnerList) {
_sceneMode = 0;
}
- _field1FC4 = 1;
+ _harrisonMovedFl = 1;
}
break;
case 50:
@@ -686,10 +686,10 @@ void Scene410::signal() {
BF_GLOBALS.set2Flags(f1097Frankie);
BF_GLOBALS.clearFlag(f1097Marina);
- BF_GLOBALS._v50CC8 = _field1FC4;
+ BF_GLOBALS._scene410HarrisonMovedFl = _harrisonMovedFl;
BF_GLOBALS._v50CC2 = _field1FBA;
- BF_GLOBALS._v50CC6 = _talkCount;
- BF_GLOBALS._v50CC4 = _field1FB6;
+ BF_GLOBALS._scene410TalkCount = _talkCount;
+ BF_GLOBALS._scene410Action1Count = _action1Count;
BF_GLOBALS._sceneManager.changeScene(60);
break;
case 2:
@@ -760,7 +760,7 @@ void Scene410::signal() {
break;
case 4104:
// After call for backup, patrol car is coming
- _field1FC4 = 1;
+ _harrisonMovedFl = 1;
BF_GLOBALS._player.disableControl();
_sceneMode = 0;
setAction(&_sequenceManager1, this, 4104, &_patrolCar, &_harrison, NULL);
diff --git a/engines/tsage/blue_force/blueforce_scenes4.h b/engines/tsage/blue_force/blueforce_scenes4.h
index 937c015a4c..d6d795a44e 100644
--- a/engines/tsage/blue_force/blueforce_scenes4.h
+++ b/engines/tsage/blue_force/blueforce_scenes4.h
@@ -116,9 +116,10 @@ public:
SpeakerDriver _driverSpeaker;
SpeakerShooter _shooterSpeaker;
ASoundExt _sound1;
- int _field1FB6, _talkCount, _field1FBA;
- int _field1FBC, _field1FBE;
- int _field1FC0, _field1FC2, _field1FC4;
+ int _action1Count, _talkCount, _field1FBA;
+ int _cuffedDriverFl, _field1FBE;
+ int _field1FC0;
+ int _field1FC2, _harrisonMovedFl;
Scene410();
virtual void postInit(SceneObjectList *OwnerList = NULL);
diff --git a/engines/tsage/blue_force/blueforce_scenes5.cpp b/engines/tsage/blue_force/blueforce_scenes5.cpp
index 0cf487daa9..ebaa3e372e 100644
--- a/engines/tsage/blue_force/blueforce_scenes5.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes5.cpp
@@ -1772,12 +1772,12 @@ void Scene570::IconManager::refreshList() {
}
void Scene570::IconManager::addItem(Icon *item) {
- item->_mode = _mode;
_list.push_back(item);
}
Scene570::Icon::Icon(): NamedObject() {
_iconId = _folderId = 0;
+ _parentFolderId = 0;
}
void Scene570::Icon::synchronize(Serializer &s) {
@@ -1785,7 +1785,10 @@ void Scene570::Icon::synchronize(Serializer &s) {
s.syncAsSint16LE(_iconId);
s.syncAsSint16LE(_folderId);
s.syncAsSint16LE(_parentFolderId);
- s.syncAsSint16LE(_mode);
+ if (s.getVersion() < 11) {
+ int useless = 0;
+ s.syncAsSint16LE(useless);
+ }
}
void Scene570::Icon::remove() {
diff --git a/engines/tsage/blue_force/blueforce_scenes5.h b/engines/tsage/blue_force/blueforce_scenes5.h
index 56bf20c93b..5337b6426b 100644
--- a/engines/tsage/blue_force/blueforce_scenes5.h
+++ b/engines/tsage/blue_force/blueforce_scenes5.h
@@ -257,7 +257,7 @@ class Scene570: public SceneExt {
class Icon: public NamedObject {
public:
SceneText _sceneText;
- int _iconId, _folderId, _parentFolderId, _mode;
+ int _iconId, _folderId, _parentFolderId;
Common::String _text;
Icon();
diff --git a/engines/tsage/blue_force/blueforce_scenes6.cpp b/engines/tsage/blue_force/blueforce_scenes6.cpp
index 9467df7917..b20092492f 100644
--- a/engines/tsage/blue_force/blueforce_scenes6.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes6.cpp
@@ -79,7 +79,6 @@ void Scene600::Action1::signal() {
}
BF_GLOBALS._screenSurface.fillRect(BF_GLOBALS._screenSurface.getBounds(), 0);
- BF_GLOBALS._v51C44 = 1;
scene->loadScene(999);
setDelay(5);
break;
@@ -88,7 +87,6 @@ void Scene600::Action1::signal() {
setDelay(5);
break;
case 7:
- BF_GLOBALS._v51C44 = 0;
remove();
break;
default:
@@ -275,7 +273,7 @@ bool Scene666::Item1::startAction(CursorType action, Event &event) {
void Scene666::postInit(SceneObjectList *OwnerList) {
BF_GLOBALS._sound1.play(27);
SceneExt::postInit();
- BF_GLOBALS._interfaceY = 200;
+ BF_GLOBALS._interfaceY = SCREEN_HEIGHT;
loadScene(999);
BF_GLOBALS._screenSurface.fillRect(BF_GLOBALS._screenSurface.getBounds(), 0);
diff --git a/engines/tsage/blue_force/blueforce_scenes8.cpp b/engines/tsage/blue_force/blueforce_scenes8.cpp
index 9a20788b6a..867b6a9f6e 100644
--- a/engines/tsage/blue_force/blueforce_scenes8.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes8.cpp
@@ -577,17 +577,15 @@ bool Scene810::Lyle::startAction(CursorType action, Event &event) {
if ((BF_GLOBALS.getFlag(shownLyleRapsheet)) || (BF_GLOBALS.getFlag(shownLyleCrate1))){
scene->_sceneMode = 8141;
} else {
- // Doublecheck on shownLyleCrate1 removed: useless
scene->_sceneMode = 8144;
}
} else {
if ((BF_GLOBALS.getFlag(shownLyleRapsheet)) || (BF_GLOBALS.getFlag(shownLyleCrate1))) {
scene->_sceneMode = 8129;
- } else { // if (BF_GLOBALS.getFlag(shownLyleCrate1)) {
+ } else {
scene->_sceneMode = 8132;
- // doublecheck Present in the original, may hide a bug in the original
- //} else
- // scene->_sceneMode = 8121;
+ // Double check on ShownLyleCrate1 present in the original, may hide a bug in the original
+ // The original was then setting _sceneMode 8121
}
}
}
@@ -1071,7 +1069,6 @@ void Scene810::postInit(SceneObjectList *OwnerList) {
setAction(&_sequenceManager1, this, 8107, &BF_GLOBALS._player, &_lyle, NULL);
break;
case 935:
- BF_GLOBALS._v51C44 = 1;
BF_GLOBALS._scenePalette.loadPalette(2);
_lyle.remove();
@@ -1804,13 +1801,11 @@ void Scene830::signal() {
_sceneMode = 832;
BF_GLOBALS._scenePalette.clearListeners();
addFader((const byte *)&black, 5, this);
- BF_GLOBALS._v51C44 = 0;
break;
case 12:
_sceneMode = 831;
BF_GLOBALS._scenePalette.clearListeners();
addFader((const byte *)&black, 5, this);
- BF_GLOBALS._v51C44 = 0;
break;
case 13:
BF_GLOBALS._sceneManager.changeScene(850);
diff --git a/engines/tsage/blue_force/blueforce_scenes9.cpp b/engines/tsage/blue_force/blueforce_scenes9.cpp
index 52115b95fe..cef9e8135c 100644
--- a/engines/tsage/blue_force/blueforce_scenes9.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes9.cpp
@@ -1422,6 +1422,10 @@ void Scene910::Object13::setupBreaker(int x, int y, int mode, int8 frameNumber)
BF_GLOBALS._sceneItems.push_front(this);
}
+Scene910::Object25::Object25() {
+ _field90 = _field92 = 0;
+}
+
void Scene910::Object25::synchronize(Serializer &s) {
NamedObject::synchronize(s);
s.syncAsSint16LE(_field90);
@@ -1962,7 +1966,6 @@ void Scene910::postInit(SceneObjectList *OwnerList) {
loadScene(910);
BF_GLOBALS._sound1.changeSound(99);
- BF_GLOBALS._v51C44 = 0;
_stripManager.addSpeaker(&_gameTextSpeaker);
_stripManager.addSpeaker(&_jakeJacketSpeaker);
@@ -2273,7 +2276,6 @@ void Scene910::signal() {
break;
case 10:
BF_GLOBALS._player.disableControl();
- BF_GLOBALS._v51C44 = 0;
BF_GLOBALS._sceneManager.changeScene(935);
break;
case 11:
@@ -2312,7 +2314,6 @@ void Scene910::signal() {
setAction(&_sequenceManager1, this, 9121, &_stuart, NULL);
break;
case 14:
- BF_GLOBALS._v51C44 = 1;
BF_GLOBALS._sceneManager.changeScene(940);
break;
case 16:
@@ -2372,7 +2373,6 @@ void Scene910::signal() {
break;
case 19:
BF_GLOBALS._deathReason = 14;
- BF_GLOBALS._v51C44 = 1;
BF_GLOBALS._sceneManager.changeScene(666);
break;
case 20:
@@ -2388,7 +2388,6 @@ void Scene910::signal() {
BF_GLOBALS.clearFlag(fGotPointsForSearchingDA);
else
BF_GLOBALS.setFlag(fGotPointsForSearchingDA);
- BF_GLOBALS._v51C44 = 1;
BF_GLOBALS._sceneManager.changeScene(900);
break;
case 9102:
@@ -2482,7 +2481,6 @@ void Scene910::signal() {
// No break on purpose
case 9137:
BF_GLOBALS._deathReason = 16;
- BF_GLOBALS._v51C44 = 1;
BF_GLOBALS._sceneManager.changeScene(666);
break;
case 9119:
@@ -2622,7 +2620,6 @@ void Scene910::signal() {
// No break on purpose
case 9134:
BF_GLOBALS._deathReason = 17;
- BF_GLOBALS._v51C44 = 1;
BF_GLOBALS._sceneManager.changeScene(666);
break;
case 9130:
@@ -2635,12 +2632,10 @@ void Scene910::signal() {
BF_GLOBALS._player.enableControl();
BF_GLOBALS._v4CEE4 = 4;
BF_GLOBALS._deathReason = 13;
- BF_GLOBALS._v51C44 = 1;
BF_GLOBALS._sceneManager.changeScene(666);
break;
case 9135:
BF_GLOBALS._deathReason = 15;
- BF_GLOBALS._v51C44 = 1;
BF_GLOBALS._sceneManager.changeScene(666);
break;
case 9136:
@@ -2685,7 +2680,6 @@ void Scene910::signal() {
break;
case 9143:
if (BF_GLOBALS._nico910State == 0) {
- BF_GLOBALS._v51C44 = 1;
BF_GLOBALS._sceneManager.changeScene(920);
} else {
SceneItem::display(910, 89, SET_WIDTH, 312,
@@ -2704,7 +2698,6 @@ void Scene910::signal() {
break;
case 9148:
BF_GLOBALS._deathReason = 23;
- BF_GLOBALS._v51C44 = 1;
BF_GLOBALS._sceneManager.changeScene(666);
break;
case 9149:
@@ -3577,7 +3570,7 @@ void Scene935::postInit(SceneObjectList *OwnerList) {
PalettedScene::postInit();
loadScene(935);
- BF_GLOBALS._interfaceY = 200;
+ BF_GLOBALS._interfaceY = SCREEN_HEIGHT;
BF_GLOBALS._player.disableControl();
_visualSpeaker._textMode = ALIGN_CENTER;
_visualSpeaker._hideObjects = false;
@@ -3812,7 +3805,7 @@ void Scene940::postInit(SceneObjectList *OwnerList) {
BF_GLOBALS._sound1.play(115);
BF_GLOBALS._dayNumber = 6;
- BF_GLOBALS._interfaceY = 200;
+ BF_GLOBALS._interfaceY = SCREEN_HEIGHT;
T2_GLOBALS._uiElements._active = false;
_gameTextSpeaker2._speakerName = "SENTTEXT";
diff --git a/engines/tsage/blue_force/blueforce_scenes9.h b/engines/tsage/blue_force/blueforce_scenes9.h
index 74708b94de..8bf7f343a1 100644
--- a/engines/tsage/blue_force/blueforce_scenes9.h
+++ b/engines/tsage/blue_force/blueforce_scenes9.h
@@ -188,6 +188,7 @@ class Scene910: public PalettedScene {
class Object25: public NamedObject {
int _field90, _field92;
public:
+ Object25();
void setupHiddenSwitch(int x, int y, int arg8, int argA);
virtual void synchronize(Serializer &s);
virtual bool startAction(CursorType action, Event &event);
diff --git a/engines/tsage/blue_force/blueforce_speakers.cpp b/engines/tsage/blue_force/blueforce_speakers.cpp
index 2a57616640..b15d2f4716 100644
--- a/engines/tsage/blue_force/blueforce_speakers.cpp
+++ b/engines/tsage/blue_force/blueforce_speakers.cpp
@@ -63,8 +63,8 @@ void VisualSpeaker::synchronize(Serializer &s) {
s.syncAsSint16LE(_offsetPos.y);
}
-void VisualSpeaker::proc12(Action *action) {
- Speaker::proc12(action);
+void VisualSpeaker::startSpeaking(Action *action) {
+ Speaker::startSpeaking(action);
_textPos = Common::Point(_offsetPos.x + BF_GLOBALS._sceneManager._scene->_sceneBounds.left,
_offsetPos.y + BF_GLOBALS._sceneManager._scene->_sceneBounds.top);
_numFrames = 0;
diff --git a/engines/tsage/blue_force/blueforce_speakers.h b/engines/tsage/blue_force/blueforce_speakers.h
index e406a50fbe..e9150df056 100644
--- a/engines/tsage/blue_force/blueforce_speakers.h
+++ b/engines/tsage/blue_force/blueforce_speakers.h
@@ -51,7 +51,7 @@ public:
virtual Common::String getClassName() { return "VisualSpeaker"; }
virtual void synchronize(Serializer &s);
virtual void remove();
- virtual void proc12(Action *action);
+ virtual void startSpeaking(Action *action);
virtual void setText(const Common::String &msg);
};
diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp
index 919ba9f69a..5a4310228d 100644
--- a/engines/tsage/converse.cpp
+++ b/engines/tsage/converse.cpp
@@ -934,7 +934,7 @@ void StripManager::signal() {
g_globals->_sceneManager._scene->loadScene(_sceneNumber);
}
- _activeSpeaker->proc12(this);
+ _activeSpeaker->startSpeaking(this);
}
if (_callbackObject) {
@@ -1088,7 +1088,7 @@ void Speaker::remove() {
SceneObjectList::deactivate();
}
-void Speaker::proc12(Action *action) {
+void Speaker::startSpeaking(Action *action) {
_action = action;
if (_newSceneNumber != -1) {
_oldSceneNumber = g_globals->_sceneManager._sceneNumber;
diff --git a/engines/tsage/converse.h b/engines/tsage/converse.h
index b1cbbeaf2b..7e57199d2f 100644
--- a/engines/tsage/converse.h
+++ b/engines/tsage/converse.h
@@ -91,7 +91,7 @@ public:
virtual Common::String getClassName() { return "Speaker"; }
virtual void synchronize(Serializer &s);
virtual void remove();
- virtual void proc12(Action *action);
+ virtual void startSpeaking(Action *action);
virtual void setText(const Common::String &msg);
virtual void removeText();
virtual void proc16() {}
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index 8021160514..e703b714b2 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -860,6 +860,8 @@ void PlayerMover::doStepsOfNpcMovement(const Common::Point &srcPos, const Common
int PlayerMover::calculateRestOfRoute(int *routeList, int srcRegion, int destRegion, bool &foundRoute) {
// Make a copy of the provided route. The first entry is the size.
int tempList[REGION_LIST_SIZE + 1];
+ memset(tempList, 0, sizeof(tempList));
+
foundRoute = false;
for (int idx = 0; idx <= *routeList; ++idx)
tempList[idx] = routeList[idx];
diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp
index b7724f072c..a8ab145dbb 100644
--- a/engines/tsage/globals.cpp
+++ b/engines/tsage/globals.cpp
@@ -26,6 +26,7 @@
#include "tsage/ringworld/ringworld_demo.h"
#include "tsage/ringworld/ringworld_logic.h"
#include "tsage/ringworld2/ringworld2_logic.h"
+#include "tsage/ringworld2/ringworld2_scenes0.h"
#include "tsage/staticres.h"
namespace TsAGE {
@@ -47,6 +48,11 @@ static SavedObject *classFactoryProc(const Common::String &className) {
if (className == "SceneObjectWrapper") return new SceneObjectWrapper();
if (className == "PaletteRotation") return new PaletteRotation();
if (className == "PaletteFader") return new PaletteFader();
+ if (className == "SceneText") return new SceneText();
+
+ // Return to Ringworld specific classes
+ if (className == "Scene205_Star") return new Ringworld2::Star();
+
return NULL;
}
@@ -119,8 +125,11 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface
_sounds.push_back(&_soundHandler);
_sounds.push_back(&_sequenceManager._soundHandler);
- _scrollFollower = NULL;
- _inventory = NULL;
+ _scrollFollower = nullptr;
+
+ _inventory = nullptr;
+ _game = nullptr;
+ _sceneHandler = nullptr;
switch (g_vm->getGameID()) {
case GType_Ringworld:
@@ -145,6 +154,7 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface
_sceneHandler = new Ringworld2::SceneHandlerExt();
break;
}
+
}
Globals::~Globals() {
@@ -204,6 +214,11 @@ void Globals::dispatchSounds() {
/*--------------------------------------------------------------------------*/
+TsAGE2Globals::TsAGE2Globals() {
+ _onSelectItem = NULL;
+ _interfaceY = 0;
+}
+
void TsAGE2Globals::reset() {
Globals::reset();
@@ -224,15 +239,46 @@ void TsAGE2Globals::synchronize(Serializer &s) {
namespace BlueForce {
BlueForceGlobals::BlueForceGlobals(): TsAGE2Globals() {
+ _hiddenDoorStatus = 0;
+ _nico910State = 0;
+ _v4CEE4 = 0;
+ _v4CEE6 = 0;
+ _v4CEE8 = 0;
+ _deziTopic = 0;
+ _deathReason = 0;
+ _driveFromScene = 300;
+ _driveToScene = 0;
+ _subFlagBitArr1 = 0;
+ _subFlagBitArr2 = 0;
+ _v50CC2 = 0;
+ _scene410Action1Count = 0;
+ _scene410TalkCount = 0;
+ _scene410HarrisonMovedFl = 0;
+ _bookmark = bNone;
+ _mapLocationId = 1;
+ _clip1Bullets = 8;
+ _clip2Bullets = 8;
+
+ _dayNumber = 0;
+ _tonyDialogCtr = 0;
+ _marinaWomanCtr = 0;
+ _kateDialogCtr = 0;
+ _v4CEB6 = 0;
+ _safeCombination = 0;
+ _gateStatus = 0;
+ _greenDay5TalkCtr = 0;
+ _v4CEC8 = 1;
+ _v4CECA = 0;
+ _v4CECC = 0;
}
void BlueForceGlobals::synchronize(Serializer &s) {
TsAGE2Globals::synchronize(s);
+ int16 useless = 0;
s.syncAsSint16LE(_dayNumber);
if (s.getVersion() < 9) {
- int tmpVar = 0;
- s.syncAsSint16LE(tmpVar);
+ s.syncAsSint16LE(useless);
}
s.syncAsSint16LE(_tonyDialogCtr);
s.syncAsSint16LE(_marinaWomanCtr);
@@ -241,7 +287,8 @@ void BlueForceGlobals::synchronize(Serializer &s) {
s.syncAsSint16LE(_safeCombination);
s.syncAsSint16LE(_gateStatus);
s.syncAsSint16LE(_greenDay5TalkCtr);
- s.syncAsSint16LE(_v4CEC4);
+ if (s.getVersion() < 11)
+ s.syncAsSint16LE(useless);
s.syncAsSint16LE(_v4CEC8);
s.syncAsSint16LE(_v4CECA);
s.syncAsSint16LE(_v4CECC);
@@ -256,19 +303,23 @@ void BlueForceGlobals::synchronize(Serializer &s) {
s.syncAsSint16LE(_deathReason);
s.syncAsSint16LE(_driveFromScene);
s.syncAsSint16LE(_driveToScene);
- s.syncAsSint16LE(_v501F8);
- s.syncAsSint16LE(_v501FA);
- s.syncAsSint16LE(_v501FC);
- s.syncAsSint16LE(_v5020C);
- s.syncAsSint16LE(_v50696);
+ if (s.getVersion() < 11) {
+ s.syncAsSint16LE(useless);
+ s.syncAsSint16LE(useless);
+ s.syncAsSint16LE(useless);
+ s.syncAsSint16LE(useless);
+ s.syncAsSint16LE(useless);
+ }
s.syncAsSint16LE(_subFlagBitArr1);
s.syncAsSint16LE(_subFlagBitArr2);
s.syncAsSint16LE(_v50CC2);
- s.syncAsSint16LE(_v50CC4);
- s.syncAsSint16LE(_v50CC6);
- s.syncAsSint16LE(_v50CC8);
- s.syncAsSint16LE(_v51C42);
- s.syncAsSint16LE(_v51C44);
+ s.syncAsSint16LE(_scene410Action1Count);
+ s.syncAsSint16LE(_scene410TalkCount);
+ s.syncAsSint16LE(_scene410HarrisonMovedFl);
+ if (s.getVersion() < 11) {
+ s.syncAsSint16LE(useless);
+ s.syncAsSint16LE(useless);
+ }
s.syncAsSint16LE(_bookmark);
s.syncAsSint16LE(_mapLocationId);
s.syncAsSint16LE(_clip1Bullets);
@@ -298,7 +349,6 @@ void BlueForceGlobals::reset() {
_safeCombination = 0;
_gateStatus = 0;
_greenDay5TalkCtr = 0;
- _v4CEC4 = 0;
_v4CEC8 = 1;
_v4CECA = 0;
_v4CECC = 0;
@@ -327,19 +377,12 @@ void BlueForceGlobals::reset() {
_v4CEE8 = 0;
_deziTopic = 0;
_deathReason = 0;
- _v501F8 = 0;
- _v501FA = 0;
- _v501FC = 0;
- _v5020C = 0;
- _v50696 = 0;
_subFlagBitArr1 = 0;
_subFlagBitArr2 = 0;
_v50CC2 = 0;
- _v50CC4 = 0;
- _v50CC6 = 0;
- _v50CC8 = 0;
- _v51C42 = 0;
- _v51C44 = 1;
+ _scene410Action1Count = 0;
+ _scene410TalkCount = 0;
+ _scene410HarrisonMovedFl = 0;
_clip1Bullets = 8;
_clip2Bullets = 8;
}
@@ -370,6 +413,43 @@ namespace Ringworld2 {
Ringworld2Globals::Ringworld2Globals() {
_scannerDialog = new ScannerDialog();
_speechSubtitles = SPEECH_TEXT;
+
+ _stripModifier = 0;
+ _flubMazeArea = 1;
+ _flubMazeEntryDirection = 0;
+ _maze3800SceneNumb = 3800;
+ _landerSuitNumber = 2;
+ _desertStepsRemaining = 5;
+ _desertCorrectDirection = 0;
+ _desertPreviousDirection = 0;
+ _desertWrongDirCtr = -1;
+ _balloonAltitude = 5;
+ _scene1925CurrLevel = 0;
+ _walkwaySceneNumber = 0;
+ _v56AA0 = 0;
+ _scientistConvIndex = 0;
+ _v56AA6 = 1;
+ _v56AA7 = 1;
+ _v56AA8 = 1;
+ _scene180Mode = -1;
+ _v57709 = 0;
+ _v5780C = 0;
+ _v5780E = 0;
+ _v57810 = 0;
+
+ _fadePaletteFlag = false;
+ _insetUp = 0;
+ _frameEdgeColor = 2;
+ _animationCtr = 0;
+ _electromagnetChangeAmount = 0;
+ _electromagnetZoom = 0;
+ _v565E5 = 0;
+ _v565E7 = 0;
+ _v565E9 = -5;
+ _v565EB = 26;
+ _foodCount = 0;
+ _rimLocation = 0;
+ _rimTransportLocation = 0;
}
Ringworld2Globals::~Ringworld2Globals() {
@@ -400,9 +480,7 @@ void Ringworld2Globals::reset() {
_fadePaletteFlag = false;
_v5589E.set(0, 0, 0, 0);
_v558B6.set(0, 0, 0, 0);
- _v558C2 = 0;
_animationCtr = 0;
- _v5657C = 0;
_electromagnetChangeAmount = 0;
_electromagnetZoom = 0;
_v565E5 = 0;
@@ -412,7 +490,7 @@ void Ringworld2Globals::reset() {
_foodCount = 0;
_rimLocation = 0;
_rimTransportLocation = 0;
- _v565AE = 0;
+ _stripModifier = 0;
_spillLocation[0] = 0;
_spillLocation[1] = 3;
_spillLocation[R2_SEEKER] = 5;
@@ -452,7 +530,7 @@ void Ringworld2Globals::reset() {
_vampireData[16]._shotsRequired = 1;
_vampireData[17]._shotsRequired = 1;
- _v566A6 = 3800;
+ _maze3800SceneNumb = 3800;
_landerSuitNumber = 2;
_flubMazeArea = 1;
_flubMazeEntryDirection = 0;
@@ -471,13 +549,11 @@ void Ringworld2Globals::reset() {
_v56AA6 = 1;
_v56AA7 = 1;
_v56AA8 = 1;
- _v56AAB = 0;
_scene180Mode = -1;
_v57709 = 0;
_v5780C = 0;
_v5780E = 0;
_v57810 = 0;
- _v57C2C = 0;
_s1550PlayerArea[R2_QUINN] = Common::Point(27, 4);
_s1550PlayerArea[R2_SEEKER] = Common::Point(27, 4);
Common::fill(&_scannerFrequencies[0], &_scannerFrequencies[MAX_CHARACTERS], 1);
@@ -513,9 +589,7 @@ void Ringworld2Globals::synchronize(Serializer &s) {
_v5589E.synchronize(s);
_v558B6.synchronize(s);
- s.syncAsSint16LE(_v558C2);
s.syncAsSint16LE(_animationCtr);
- s.syncAsSint16LE(_v5657C);
s.syncAsSint16LE(_electromagnetChangeAmount);
s.syncAsSint16LE(_electromagnetZoom);
s.syncAsSint16LE(_v565E5);
@@ -526,19 +600,17 @@ void Ringworld2Globals::synchronize(Serializer &s) {
s.syncAsSint32LE(_rimLocation);
s.syncAsSint16LE(_rimTransportLocation);
s.syncAsSint16LE(_landerSuitNumber);
- s.syncAsSint16LE(_v566A6);
+ s.syncAsSint16LE(_maze3800SceneNumb);
s.syncAsSint16LE(_desertWrongDirCtr);
s.syncAsSint16LE(_scene1925CurrLevel); // _v56A9C
s.syncAsSint16LE(_walkwaySceneNumber);
s.syncAsSint16LE(_ventCellPos.x);
s.syncAsSint16LE(_ventCellPos.y);
- s.syncAsSint16LE(_v56AAB);
s.syncAsSint16LE(_scene180Mode);
s.syncAsSint16LE(_v57709);
s.syncAsSint16LE(_v5780C);
s.syncAsSint16LE(_v5780E);
s.syncAsSint16LE(_v57810);
- s.syncAsSint16LE(_v57C2C);
s.syncAsByte(_s1550PlayerArea[R2_QUINN].x);
s.syncAsByte(_s1550PlayerArea[R2_SEEKER].x);
@@ -548,7 +620,7 @@ void Ringworld2Globals::synchronize(Serializer &s) {
for (i = 0; i < MAX_CHARACTERS; ++i)
s.syncAsByte(_scannerFrequencies[i]);
- s.syncAsByte(_v565AE);
+ s.syncAsByte(_stripModifier);
s.syncAsByte(_flubMazeArea);
s.syncAsByte(_flubMazeEntryDirection);
s.syncAsByte(_desertStepsRemaining);
@@ -577,7 +649,7 @@ void Ringworld2Globals::synchronize(Serializer &s) {
s.syncAsSint16LE(_balloonPosition.x);
s.syncAsSint16LE(_balloonPosition.y);
- // Synchronise Flub maze vampire data
+ // Synchronize Flub maze vampire data
for (i = 0; i < 18; ++i) {
s.syncAsSint16LE(_vampireData[i]._isAlive);
s.syncAsSint16LE(_vampireData[i]._shotsRequired);
diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h
index ad47f7f620..b9c8076042 100644
--- a/engines/tsage/globals.h
+++ b/engines/tsage/globals.h
@@ -110,7 +110,7 @@ public:
int _interfaceY;
ASoundExt _inventorySound;
- TsAGE2Globals() { _onSelectItem = NULL; }
+ TsAGE2Globals();
virtual void reset();
virtual void synchronize(Serializer &s);
};
@@ -194,7 +194,6 @@ public:
int _safeCombination;
int _gateStatus;
int _greenDay5TalkCtr;
- int _v4CEC4;
int _v4CEC8;
int _v4CECA;
int _v4CECC;
@@ -208,19 +207,12 @@ public:
int _deathReason;
int _driveFromScene;
int _driveToScene;
- int _v501F8;
- int _v501FA;
- int _v501FC;
- int _v5020C;
- int _v50696;
uint8 _subFlagBitArr1;
uint8 _subFlagBitArr2;
int _v50CC2;
- int _v50CC4;
- int _v50CC6;
- int _v50CC8;
- int _v51C42;
- int _v51C44;
+ int _scene410Action1Count;
+ int _scene410TalkCount;
+ int _scene410HarrisonMovedFl;
Bookmark _bookmark;
int _mapLocationId;
int _clip1Bullets, _clip2Bullets;
@@ -259,27 +251,25 @@ public:
byte _fadePaletteMap[10][256];
byte _paletteMap[4096];
int _insetUp;
- int _frameEdgeColor; // _v421e
+ int _frameEdgeColor;
Rect _v5589E;
Rect _v558B6;
- int _v558C2;
int _animationCtr;
int _electromagnetChangeAmount;
int _electromagnetZoom;
int _v565E5;
int _v565E7;
int _v565E9;
- int _v565EB;
+ int _v565EB; // CHECKME: IS it a constant?
int _foodCount;
int _rimLocation;
int _rimTransportLocation;
- int _v5657C;
- byte _v565AE;
+ byte _stripModifier;
byte _spillLocation[14];
VampireData _vampireData[18];
byte _flubMazeArea;
byte _flubMazeEntryDirection;
- int _v566A6;
+ int _maze3800SceneNumb;
byte _landerSuitNumber;
byte _desertStepsRemaining;
byte _desertCorrectDirection;
@@ -292,17 +282,14 @@ public:
byte _v56AA0;
byte _scientistConvIndex;
Common::Point _ventCellPos;
- int _v56AA4;
byte _v56AA6;
byte _v56AA7;
byte _v56AA8;
- int _v56AAB;
int _scene180Mode; // _v575f7
int _v57709;
int _v5780C;
int _v5780E;
int _v57810;
- int _v57C2C;
int _speechSubtitles;
Common::Point _s1550PlayerArea[3]; // only used for Quinn and Seeker
byte _scannerFrequencies[4];
diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp
index 2395cc67ed..32810626e7 100644
--- a/engines/tsage/graphics.cpp
+++ b/engines/tsage/graphics.cpp
@@ -591,20 +591,24 @@ void GfxSurface::copyFrom(GfxSurface &src, Rect srcBounds, Rect destBounds, Regi
Graphics::Surface srcSurface = srcImage.lockSurface();
Graphics::Surface destSurface = lockSurface();
+ // Get clipping area
+ Rect clipRect = !_clipRect.isEmpty() ? _clipRect :
+ Rect(0, 0, destSurface.w, destSurface.h);
+
// Adjust bounds to ensure destination will be on-screen
int srcX = 0, srcY = 0;
- if (destBounds.left < 0) {
- srcX = -destBounds.left;
- destBounds.left = 0;
+ if (destBounds.left < clipRect.left) {
+ srcX = clipRect.left - destBounds.left;
+ destBounds.left = clipRect.left;
}
- if (destBounds.top < 0) {
- srcY = -destBounds.top;
- destBounds.top = 0;
+ if (destBounds.top < clipRect.top) {
+ srcY = clipRect.top - destBounds.top;
+ destBounds.top = clipRect.top;
}
- if (destBounds.right > destSurface.w)
- destBounds.right = destSurface.w;
- if (destBounds.bottom > destSurface.h)
- destBounds.bottom = destSurface.h;
+ if (destBounds.right > clipRect.right)
+ destBounds.right = clipRect.right;
+ if (destBounds.bottom > clipRect.bottom)
+ destBounds.bottom = clipRect.bottom;
if (destBounds.isValidRect() && !((destBounds.right < 0) || (destBounds.bottom < 0)
|| (destBounds.left >= destSurface.w) || (destBounds.top >= destSurface.h))) {
@@ -706,6 +710,11 @@ GfxElement::GfxElement() {
_owner = NULL;
_keycode = 0;
_flags = 0;
+
+ _fontNumber = 0;
+ _color1 = 0;
+ _color2 = 0;
+ _color3 = 0;
}
void GfxElement::setDefaults() {
@@ -1061,9 +1070,16 @@ bool GfxButton::process(Event &event) {
GfxDialog::GfxDialog() {
_savedArea = NULL;
_defaultButton = NULL;
+
+ // For Return to Ringworld 2, backup palette when showing a dialog
+ if (g_vm->getGameID() == GType_Ringworld2)
+ g_system->getPaletteManager()->grabPalette(&_savedPalette[0], 0, 256);
}
GfxDialog::~GfxDialog() {
+ if (g_vm->getGameID() == GType_Ringworld2)
+ g_system->getPaletteManager()->setPalette(&_savedPalette[0], 0, 256);
+
remove();
}
@@ -1363,6 +1379,8 @@ GfxFont::GfxFont() {
_bpp = 0;
_fontData = NULL;
_fillFlag = false;
+
+ _gfxManager = nullptr;
}
GfxFont::~GfxFont() {
diff --git a/engines/tsage/graphics.h b/engines/tsage/graphics.h
index 7239a99a68..497cd76ad6 100644
--- a/engines/tsage/graphics.h
+++ b/engines/tsage/graphics.h
@@ -88,6 +88,7 @@ private:
public:
Common::Point _centroid;
int _transColor;
+ Rect _clipRect;
public:
GfxSurface();
GfxSurface(const GfxSurface &s);
@@ -319,6 +320,7 @@ public:
GfxElementList _elements;
GfxButton *_defaultButton;
GfxSurface *_savedArea;
+ byte _savedPalette[256 * 3];
public:
GfxDialog();
virtual ~GfxDialog();
diff --git a/engines/tsage/ringworld/ringworld_logic.cpp b/engines/tsage/ringworld/ringworld_logic.cpp
index 0584570ac2..1e9d14cdcf 100644
--- a/engines/tsage/ringworld/ringworld_logic.cpp
+++ b/engines/tsage/ringworld/ringworld_logic.cpp
@@ -270,6 +270,11 @@ bool DisplayObject::performAction(int action) {
SceneArea::SceneArea() {
_savedArea = NULL;
_pt.x = _pt.y = 0;
+
+ _resNum = 0;
+ _rlbNum = 0;
+ _subNum = 0;
+ _actionId = 0;
}
SceneArea::~SceneArea() {
diff --git a/engines/tsage/ringworld/ringworld_scenes5.cpp b/engines/tsage/ringworld/ringworld_scenes5.cpp
index 004ccbbb6d..725370c8a4 100644
--- a/engines/tsage/ringworld/ringworld_scenes5.cpp
+++ b/engines/tsage/ringworld/ringworld_scenes5.cpp
@@ -34,6 +34,9 @@ namespace Ringworld {
* Scene 4000 - Village
*
*--------------------------------------------------------------------------*/
+Scene4000::Hotspot8::Hotspot8() : SceneObject() {
+ _ctr = 0;
+}
void Scene4000::Action1::signal() {
// Quinn has the peg. Everybody enter the screen.
diff --git a/engines/tsage/ringworld/ringworld_scenes5.h b/engines/tsage/ringworld/ringworld_scenes5.h
index c93df2a1d8..2fe26d9712 100644
--- a/engines/tsage/ringworld/ringworld_scenes5.h
+++ b/engines/tsage/ringworld/ringworld_scenes5.h
@@ -99,6 +99,7 @@ class Scene4000 : public Scene {
private:
int _ctr;
public:
+ Hotspot8();
virtual void synchronize(Serializer &s) {
SceneObject::synchronize(s);
s.syncAsUint16LE(_ctr);
diff --git a/engines/tsage/ringworld/ringworld_scenes6.cpp b/engines/tsage/ringworld/ringworld_scenes6.cpp
index 30a91b57aa..65c1ed39c6 100644
--- a/engines/tsage/ringworld/ringworld_scenes6.cpp
+++ b/engines/tsage/ringworld/ringworld_scenes6.cpp
@@ -2032,7 +2032,15 @@ void Scene5300::Hotspot8::doAction(int action) {
/*--------------------------------------------------------------------------*/
Scene5300::Scene5300() :
- _hotspot3(0, CURSOR_LOOK, 5300, 3, CURSOR_USE, 5300, 16, LIST_END) {
+ _hotspot3(0, CURSOR_LOOK, 5300, 3, CURSOR_USE, 5300, 16, LIST_END) {
+}
+
+void Scene5300::synchronize(Serializer &s) {
+ Scene::synchronize(s);
+ if (s.getVersion() < 11) {
+ int useless = 0;
+ s.syncAsSint16LE(useless);
+ }
}
void Scene5300::postInit(SceneObjectList *OwnerList) {
@@ -2119,7 +2127,6 @@ void Scene5300::postInit(SceneObjectList *OwnerList) {
setAction(&_sequenceManager, this, 5306, &g_globals->_player, &_hotspot3, NULL);
}
- _field1B0A = 1;
if (RING_INVENTORY._bone._sceneNumber == 5300) {
_hotspot5.postInit();
_hotspot5.setVisage(5301);
diff --git a/engines/tsage/ringworld/ringworld_scenes6.h b/engines/tsage/ringworld/ringworld_scenes6.h
index bf353de415..4c10e4a711 100644
--- a/engines/tsage/ringworld/ringworld_scenes6.h
+++ b/engines/tsage/ringworld/ringworld_scenes6.h
@@ -318,15 +318,11 @@ public:
Hotspot6 _hotspot6;
Hotspot7 _hotspot7;
Hotspot8 _hotspot8;
- int _field1B0A;
Scene5300();
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void signal();
- virtual void synchronize(Serializer &s) {
- Scene::synchronize(s);
- s.syncAsSint16LE(_field1B0A);
- }
+ virtual void synchronize(Serializer &s);
};
} // End of namespace Ringworld
diff --git a/engines/tsage/ringworld/ringworld_scenes8.cpp b/engines/tsage/ringworld/ringworld_scenes8.cpp
index 9cb85a6930..f9156479e5 100644
--- a/engines/tsage/ringworld/ringworld_scenes8.cpp
+++ b/engines/tsage/ringworld/ringworld_scenes8.cpp
@@ -30,6 +30,10 @@ namespace TsAGE {
namespace Ringworld {
+NamedHotspotMult::NamedHotspotMult() : SceneHotspot() {
+ _useLineNum = _lookLineNum = 0;
+}
+
void NamedHotspotMult::synchronize(Serializer &s) {
SceneHotspot::synchronize(s);
s.syncAsSint16LE(_useLineNum);
@@ -2533,6 +2537,10 @@ Scene7700::Scene7700() {
_object5._state = 0;
_object6._state = 0;
_prof._state = 0;
+
+ _seatCountLeft1 = 0;
+ _seatCountLeft2 = 0;
+ _seatCountRight = 0;
}
void Scene7700::synchronize(Serializer &s) {
diff --git a/engines/tsage/ringworld/ringworld_scenes8.h b/engines/tsage/ringworld/ringworld_scenes8.h
index b24f220f8c..fa441f87da 100644
--- a/engines/tsage/ringworld/ringworld_scenes8.h
+++ b/engines/tsage/ringworld/ringworld_scenes8.h
@@ -40,7 +40,7 @@ using namespace TsAGE;
class NamedHotspotMult : public SceneHotspot {
public:
int _useLineNum, _lookLineNum;
- NamedHotspotMult() : SceneHotspot() {}
+ NamedHotspotMult();
virtual Common::String getClassName() { return "NamedHotspotMult"; }
virtual void synchronize(Serializer &s);
diff --git a/engines/tsage/ringworld2/ringworld2_dialogs.cpp b/engines/tsage/ringworld2/ringworld2_dialogs.cpp
index 4ebbdd602d..7c97aa041c 100644
--- a/engines/tsage/ringworld2/ringworld2_dialogs.cpp
+++ b/engines/tsage/ringworld2/ringworld2_dialogs.cpp
@@ -344,7 +344,7 @@ CharacterDialog::CharacterDialog() {
/*--------------------------------------------------------------------------*/
void HelpDialog::show() {
- // Set the palette and change the cursor
+ // change the cursor
R2_GLOBALS._events.setCursor(CURSOR_ARROW);
// Create the dialog and draw it
diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp
index 8e5537f2d1..e5d8b0702b 100644
--- a/engines/tsage/ringworld2/ringworld2_logic.cpp
+++ b/engines/tsage/ringworld2/ringworld2_logic.cpp
@@ -137,6 +137,7 @@ Scene *Ringworld2Game::createScene(int sceneNumber) {
// Spaceport
return new Scene1550();
case 1575:
+ // Spaceport - unused ship scene
return new Scene1575();
case 1580:
// Inside wreck
@@ -179,7 +180,7 @@ Scene *Ringworld2Game::createScene(int sceneNumber) {
// Spill Mountains: Balloon Launch Platform
return new Scene2350();
case 2400:
- // Spill Mountains: Large empty room
+ // Spill Mountains: Unused large empty room
return new Scene2400();
case 2425:
// Spill Mountains: The Hall of Records
@@ -203,7 +204,7 @@ Scene *Ringworld2Game::createScene(int sceneNumber) {
// Spill Mountains: Inside crevasse
return new Scene2455();
case 2500:
- // Spill Mountains: Large Cave
+ // Spill Mountains: Large Ledge
return new Scene2500();
case 2525:
// Spill Mountains: Furnace room
@@ -342,6 +343,9 @@ SceneExt::SceneExt(): Scene() {
_savedCanWalk = false;
_preventSaving = false;
+ // Reset screen clipping area
+ R2_GLOBALS._screenSurface._clipRect = Rect();
+
// WORKAROUND: In the original, playing animations don't reset the global _animationCtr
// counter as scene changes unless the playing animation explicitly finishes. For now,
// to make inter-scene debugging easier, I'm explicitly resetting the _animationCtr
@@ -1204,25 +1208,25 @@ void Ringworld2Game::processEvent(Event &event) {
case Common::KEYCODE_F4:
// F4 - Restart
restartGame();
- g_globals->_events.setCursorFromFlag();
+ R2_GLOBALS._events.setCursorFromFlag();
break;
case Common::KEYCODE_F7:
// F7 - Restore
restoreGame();
- g_globals->_events.setCursorFromFlag();
+ R2_GLOBALS._events.setCursorFromFlag();
break;
case Common::KEYCODE_F8:
// F8 - Credits
- warning("TODO: Show Credits");
+ R2_GLOBALS._sceneManager.changeScene(205);
break;
case Common::KEYCODE_F10:
// F10 - Pause
GfxDialog::setPalette();
MessageDialog::show(GAME_PAUSED_MSG, OK_BTN_STRING);
- g_globals->_events.setCursorFromFlag();
+ R2_GLOBALS._events.setCursorFromFlag();
break;
default:
@@ -1352,6 +1356,7 @@ SceneArea::SceneArea(): SceneItem() {
_insideArea = false;
_savedCursorNum = CURSOR_NONE;
_cursorState = 0;
+ _cursorNum = CURSOR_NONE;
}
void SceneArea::synchronize(Serializer &s) {
@@ -1404,6 +1409,8 @@ void SceneArea::setDetails(const Rect &bounds, CursorType cursor) {
SceneExit::SceneExit(): SceneArea() {
_moving = false;
_destPos = Common::Point(-1, -1);
+
+ _sceneNumber = 0;
}
void SceneExit::synchronize(Serializer &s) {
@@ -1721,6 +1728,12 @@ void AnimationSlice::load(Common::File &f) {
AnimationSlices::AnimationSlices() {
_pixelData = NULL;
+
+ _dataSize = 0;
+ _dataSize2 = 0;
+ _slices->_sliceOffset = 0;
+ _slices->_drawMode = 0;
+ _slices->_secondaryIndex = 0;
}
AnimationSlices::~AnimationSlices() {
@@ -1786,6 +1799,18 @@ AnimationPlayer::AnimationPlayer(): EventHandler() {
_sliceHeight = 1;
_field58 = 1;
_endAction = NULL;
+
+ _sliceCurrent = nullptr;
+ _sliceNext = nullptr;
+ _field38 = 0;
+ _objectMode = ANIMOBJMODE_1;
+ _dataNeeded = 0;
+ _playbackTick = 0;
+ _playbackTickPrior = 0;
+ _position = 0;
+ _nextSlicesPosition = 0;
+ _frameDelay = 0;
+ _gameFrame = 0;
}
AnimationPlayer::~AnimationPlayer() {
@@ -2025,7 +2050,7 @@ void AnimationPlayer::drawFrame(int sliceIndex) {
// Unlock the screen surface
R2_GLOBALS._screenSurface.unlockSurface();
- if (_objectMode == 42) {
+ if (_objectMode == ANIMOBJMODE_42) {
_screenBounds.expandPanes();
// Copy the drawn frame to the back surface
@@ -2094,7 +2119,7 @@ void AnimationPlayer::close() {
// Close the resource file
_resourceFile.close();
- if (_objectMode != 42) {
+ if (_objectMode != ANIMOBJMODE_42) {
// flip screen in original
}
@@ -2205,7 +2230,7 @@ void ModalWindow::process(Event &event) {
}
}
-void ModalWindow::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) {
+void ModalWindow::setup2(int visage, int stripFrameNum, int frameNum, int posX, int posY) {
Scene1200 *scene = (Scene1200 *)R2_GLOBALS._sceneManager._scene;
_object1.postInit();
@@ -2218,7 +2243,7 @@ void ModalWindow::proc12(int visage, int stripFrameNum, int frameNum, int posX,
_insetCount = R2_GLOBALS._insetUp;
}
-void ModalWindow::proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum) {
+void ModalWindow::setup3(int resNum, int lookLineNum, int talkLineNum, int useLineNum) {
_object1.setDetails(resNum, lookLineNum, talkLineNum, useLineNum, 2, (SceneItem *) NULL);
}
@@ -2477,15 +2502,15 @@ void ScannerDialog::remove() {
ModalWindow::remove();
}
-void ScannerDialog::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) {
+void ScannerDialog::setup2(int visage, int stripFrameNum, int frameNum, int posX, int posY) {
// Stop player moving if currently doing so
if (R2_GLOBALS._player._mover)
R2_GLOBALS._player.addMover(NULL);
R2_GLOBALS._events.setCursor(CURSOR_USE);
- ModalWindow::proc12(visage, stripFrameNum, frameNum, posX, posY);
+ ModalWindow::setup2(visage, stripFrameNum, frameNum, posX, posY);
- proc13(100, -1, -1, -1);
+ setup3(100, -1, -1, -1);
_talkButton.setup(1);
_scanButton.setup(2);
_slider.setup(R2_GLOBALS._scannerFrequencies[R2_GLOBALS._player._characterIndex], 142, 124, 35, 5);
diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h
index 5c8af8d884..ff5bfc0b6f 100644
--- a/engines/tsage/ringworld2/ringworld2_logic.h
+++ b/engines/tsage/ringworld2/ringworld2_logic.h
@@ -461,8 +461,8 @@ public:
virtual void synchronize(Serializer &s);
virtual Common::String getClassName() { return "ModalWindow"; }
virtual void process(Event &event);
- virtual void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY);
- virtual void proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum);
+ virtual void setup2(int visage, int stripFrameNum, int frameNum, int posX, int posY);
+ virtual void setup3(int resNum, int lookLineNum, int talkLineNum, int useLineNum);
};
class ScannerDialog: public ModalWindow {
@@ -515,7 +515,7 @@ public:
virtual Common::String getClassName() { return "ScannerDialog"; }
virtual void remove();
- void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY);
+ virtual void setup2(int visage, int stripFrameNum, int frameNum, int posX, int posY);
};
} // End of namespace Ringworld2
diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp
index 5e4b4e4191..aabcd261c7 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp
@@ -116,7 +116,7 @@ bool Scene100::Table::startAction(CursorType action, Event &event) {
R2_GLOBALS._player.disableControl();
if (_strip == 2) {
scene->_sceneMode = 108;
- scene->_object3.postInit();
+ scene->_tableLocker.postInit();
scene->_stasisNegator.postInit();
if (R2_INVENTORY.getObjectScene(R2_NEGATOR_GUN) == 1) {
@@ -126,11 +126,13 @@ bool Scene100::Table::startAction(CursorType action, Event &event) {
scene->_stasisNegator.setDetails(100, 21, 22, 23, 2, (SceneItem *)NULL);
}
- scene->setAction(&scene->_sequenceManager2, scene, 108, this, &scene->_object3,
+ // Open table locker
+ scene->setAction(&scene->_sequenceManager2, scene, 108, this, &scene->_tableLocker,
&scene->_stasisNegator, &R2_GLOBALS._player, NULL);
} else {
scene->_sceneMode = 109;
- scene->setAction(&scene->_sequenceManager2, scene, 109, this, &scene->_object3,
+ // Close table locker
+ scene->setAction(&scene->_sequenceManager2, scene, 109, this, &scene->_tableLocker,
&scene->_stasisNegator, &R2_GLOBALS._player, NULL);
}
return true;
@@ -140,7 +142,7 @@ bool Scene100::Table::startAction(CursorType action, Event &event) {
if (_strip == 2) {
SceneItem::display2(100, 18);
scene->_sceneMode = 102;
- scene->_object3.postInit();
+ scene->_tableLocker.postInit();
scene->_stasisNegator.postInit();
if (R2_INVENTORY.getObjectScene(R2_NEGATOR_GUN) == 1) {
@@ -150,12 +152,12 @@ bool Scene100::Table::startAction(CursorType action, Event &event) {
scene->_stasisNegator.setDetails(100, 21, 22, 23, 2, (SceneItem *)NULL);
}
- scene->setAction(&scene->_sequenceManager2, scene, 102, this, &scene->_object3,
+ scene->setAction(&scene->_sequenceManager2, scene, 102, this, &scene->_tableLocker,
&scene->_stasisNegator, NULL);
} else {
SceneItem::display2(100, 19);
scene->_sceneMode = 103;
- scene->setAction(&scene->_sequenceManager2, scene, 103, this, &scene->_object3,
+ scene->setAction(&scene->_sequenceManager2, scene, 103, this, &scene->_tableLocker,
&scene->_stasisNegator, NULL);
}
return true;
@@ -295,10 +297,10 @@ void Scene100::postInit(SceneObjectList *OwnerList) {
switch (R2_GLOBALS._sceneManager._previousScene) {
case 50:
case 180:
- _object5.postInit();
- _object4.postInit();
+ _wardrobeColorAnim.postInit();
+ _wardrobeTopAnim.postInit();
_sceneMode = 104;
- setAction(&_sequenceManager1, this, 104, &R2_GLOBALS._player, &_wardrobe, &_object4, &_object5, NULL);
+ setAction(&_sequenceManager1, this, 104, &R2_GLOBALS._player, &_wardrobe, &_wardrobeTopAnim, &_wardrobeColorAnim, NULL);
break;
case 125:
_sceneMode = 100;
@@ -331,14 +333,14 @@ void Scene100::signal() {
_table.setStrip(2);
_table.setFrame(3);
- _object3.remove();
+ _tableLocker.remove();
_stasisNegator.remove();
R2_GLOBALS._player.enableControl();
break;
case 104:
_sceneMode = 0;
- _object5.remove();
- _object4.remove();
+ _wardrobeColorAnim.remove();
+ _wardrobeTopAnim.remove();
R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
R2_GLOBALS._player._numFrames = 10;
@@ -387,7 +389,7 @@ void Scene100::dispatch() {
SceneExt::dispatch();
if ((_sceneMode == 101) && (_door._frame == 2) && (_table._strip == 5)) {
- _table.setAction(&_sequenceManager2, NULL, 103, &_table, &_object3, &_stasisNegator, NULL);
+ _table.setAction(&_sequenceManager2, NULL, 103, &_table, &_tableLocker, &_stasisNegator, NULL);
}
}
@@ -414,9 +416,9 @@ Scene125::Icon::Icon(): SceneActor() {
void Scene125::Icon::postInit(SceneObjectList *OwnerList) {
SceneObject::postInit();
- _object1.postInit();
- _object1.fixPriority(255);
- _object1.hide();
+ _glyph.postInit();
+ _glyph.fixPriority(255);
+ _glyph.hide();
_sceneText1._color1 = 92;
_sceneText1._color2 = 0;
@@ -459,15 +461,15 @@ void Scene125::Icon::process(Event &event) {
scene->_sound1.play(14);
setFrame(2);
- switch (_object1._strip) {
+ switch (_glyph._strip) {
case 1:
- _object1.setStrip(2);
+ _glyph.setStrip(2);
break;
case 3:
- _object1.setStrip(4);
+ _glyph.setStrip(4);
break;
case 5:
- _object1.setStrip(6);
+ _glyph.setStrip(6);
break;
default:
break;
@@ -486,15 +488,15 @@ void Scene125::Icon::process(Event &event) {
if ((event.eventType == EVENT_BUTTON_UP) && _pressed) {
setFrame(1);
- switch (_object1._strip) {
+ switch (_glyph._strip) {
case 2:
- _object1.setStrip(1);
+ _glyph.setStrip(1);
break;
case 4:
- _object1.setStrip(3);
+ _glyph.setStrip(3);
break;
case 6:
- _object1.setStrip(5);
+ _glyph.setStrip(5);
break;
default:
break;
@@ -518,8 +520,8 @@ void Scene125::Icon::setIcon(int id) {
if (_lookLineNum) {
showIcon();
- _object1.setup(161, ((id - 1) / 10) * 2 + 1, ((id - 1) % 10) + 1);
- _object1.setPosition(_position);
+ _glyph.setup(161, ((id - 1) / 10) * 2 + 1, ((id - 1) % 10) + 1);
+ _glyph.setPosition(_position);
_sceneText1._fontNumber = scene->_iconFontNumber;
_sceneText1.setup(CONSOLE125_MESSAGES[id]);
@@ -562,16 +564,16 @@ void Scene125::Icon::setIcon(int id) {
void Scene125::Icon::showIcon() {
_sceneText1.show();
_sceneText2.show();
- _object1.show();
- _object2.show();
+ _glyph.show();
+ _horizLine.show();
show();
}
void Scene125::Icon::hideIcon() {
_sceneText1.hide();
_sceneText2.hide();
- _object1.hide();
- _object2.hide();
+ _glyph.hide();
+ _horizLine.hide();
hide();
}
@@ -666,28 +668,28 @@ void Scene125::signal() {
case 2:
_icon1.setup(160, 1, 1);
_icon1.setPosition(Common::Point(65, 17));
- _icon1._object2.postInit();
- _icon1._object2.setup(160, 7, 1);
- _icon1._object2.setPosition(Common::Point(106, 41));
+ _icon1._horizLine.postInit();
+ _icon1._horizLine.setup(160, 7, 1);
+ _icon1._horizLine.setPosition(Common::Point(106, 41));
_icon2.setup(160, 1, 1);
_icon2.setPosition(Common::Point(80, 32));
- _icon2._object2.postInit();
- _icon2._object2.setup(160, 7, 2);
- _icon2._object2.setPosition(Common::Point(106, 56));
+ _icon2._horizLine.postInit();
+ _icon2._horizLine.setup(160, 7, 2);
+ _icon2._horizLine.setPosition(Common::Point(106, 56));
_icon3.setup(160, 1, 1);
_icon3.setPosition(Common::Point(65, 47));
- _icon3._object2.postInit();
- _icon3._object2.setup(160, 7, 1);
- _icon3._object2.setPosition(Common::Point(106, 71));
+ _icon3._horizLine.postInit();
+ _icon3._horizLine.setup(160, 7, 1);
+ _icon3._horizLine.setPosition(Common::Point(106, 71));
_icon4.setup(160, 1, 1);
_icon4.setPosition(Common::Point(80, 62));
_icon4._sceneRegionId = 5;
- _icon4._object2.postInit();
- _icon4._object2.setup(160, 7, 2);
- _icon4._object2.setPosition(Common::Point(106, 86));
+ _icon4._horizLine.postInit();
+ _icon4._horizLine.setup(160, 7, 2);
+ _icon4._horizLine.setPosition(Common::Point(106, 86));
_icon5.postInit();
_icon5.setup(160, 1, 1);
@@ -710,16 +712,19 @@ void Scene125::signal() {
case 12:
_sceneMode = 129;
- _object1.postInit();
- _object2.postInit();
- _object3.postInit();
+ _starchart1.postInit();
+ _starchart2.postInit();
+ _starchart3.postInit();
if (R2_GLOBALS.getFlag(13)) {
- _object4.postInit();
- setAction(&_sequenceManager, this, 130, &R2_GLOBALS._player, &_object1, &_object2,
- &_object3, &_object4, NULL);
+ // Show starchart with Ringworld present
+ _starchart4.postInit();
+ setAction(&_sequenceManager, this, 130, &R2_GLOBALS._player, &_starchart1, &_starchart2,
+ &_starchart3, &_starchart4, NULL);
} else {
- setAction(&_sequenceManager, this, 129, &R2_GLOBALS._player, &_object1, &_object2, &_object3, NULL);
+ // Show starchart without Ringworld
+ setAction(&_sequenceManager, this, 129, &R2_GLOBALS._player, &_starchart1, &_starchart2,
+ &_starchart3, NULL);
}
break;
case 13:
@@ -920,7 +925,7 @@ void Scene125::consoleAction(int id) {
_icon4.setPosition(Common::Point(52, 107));
_icon4._sceneRegionId = 9;
_icon4.setIcon(25);
- _icon4._object2.hide();
+ _icon4._horizLine.hide();
_icon6.setIcon(26);
_sceneMode = 10;
@@ -963,7 +968,7 @@ void Scene125::consoleAction(int id) {
_icon4.setPosition(Common::Point(52, 107));
_icon4._sceneRegionId = 9;
_icon4.setIcon(25);
- _icon4._object2.hide();
+ _icon4._horizLine.hide();
_icon6.setIcon(26);
_sceneMode = 10;
@@ -1047,7 +1052,7 @@ void Scene125::consoleAction(int id) {
break;
case 24:
_icon4.setIcon(25);
- _icon4._object2.hide();
+ _icon4._horizLine.hide();
if (_consoleMode == 10) {
setDetails(127, --_logIndex);
@@ -1059,7 +1064,7 @@ void Scene125::consoleAction(int id) {
break;
case 25:
_icon4.setIcon(25);
- _icon4._object2.hide();
+ _icon4._horizLine.hide();
if (_consoleMode == 10) {
setDetails(127, ++_logIndex);
@@ -1077,10 +1082,10 @@ void Scene125::consoleAction(int id) {
_icon4.hideIcon();
R2_GLOBALS._player.hide();
- _object1.hide();
- _object2.hide();
- _object3.hide();
- _object4.hide();
+ _starchart1.hide();
+ _starchart2.hide();
+ _starchart3.hide();
+ _starchart4.hide();
_sceneMode = 11;
_palette.loadPalette(160);
@@ -1103,7 +1108,7 @@ void Scene125::consoleAction(int id) {
_icon4.setPosition(Common::Point(52, 107));
_icon4._sceneRegionId = 9;
_icon4.setIcon(25);
- _icon4._object2.hide();
+ _icon4._horizLine.hide();
_icon6.setIcon(26);
_sceneMode = 10;
@@ -1425,6 +1430,7 @@ Scene160::Scene160(): SceneExt() {
void Scene160::postInit(SceneObjectList *OwnerList) {
loadScene(4001);
+ R2_GLOBALS._uiElements._active = false;
SceneExt::postInit();
R2_GLOBALS._player._uiEnabled = false;
@@ -1446,6 +1452,8 @@ void Scene160::synchronize(Serializer &s) {
s.syncAsSint16LE(_frameNumber);
s.syncAsSint16LE(_yChange);
s.syncAsSint16LE(_lineNum);
+
+ _creditsList.synchronize(s);
}
void Scene160::remove() {
@@ -1500,11 +1508,9 @@ void Scene180::Action1::signal() {
/*--------------------------------------------------------------------------*/
Scene180::Scene180(): SceneExt() {
- _field412 = 0;
+ _helpEnabled = false;
_frameInc = 0;
_frameNumber = R2_GLOBALS._events.getFrameNumber();
- _field480 = 1;
- _field482 = -1;
_fontNumber = R2_GLOBALS.gfxManager()._font._fontNumber;
GfxFont font;
@@ -1549,9 +1555,7 @@ void Scene180::synchronize(Serializer &s) {
SceneExt::synchronize(s);
s.syncAsSint16LE(_frameNumber);
- s.syncAsSint16LE(_field412);
- s.syncAsSint16LE(_field480);
- s.syncAsSint16LE(_field482);
+ s.syncAsSint16LE(_helpEnabled);
s.syncAsSint16LE(_frameInc);
s.syncAsSint16LE(_fontNumber);
s.syncAsSint16LE(_fontHeight);
@@ -1566,7 +1570,7 @@ void Scene180::signal() {
break;
case 1:
- _field412 = 1;
+ _helpEnabled = true;
R2_GLOBALS._sceneManager._hasPalette = true;
_animationPlayer._paletteMode = ANIMPALMODE_NONE;
_animationPlayer._isActive = true;
@@ -1604,7 +1608,8 @@ void Scene180::signal() {
case 30:
case 43:
case 47:
- _field412 = 0;
+ _helpEnabled = false;
+ R2_GLOBALS._screenSurface.fillRect(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 0);
_palette.loadPalette(0);
_palette.loadPalette(9998);
R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 8, this);
@@ -1617,7 +1622,7 @@ void Scene180::signal() {
R2_GLOBALS._scene180Mode = 2;
_animationPlayer.load(2);
- _field412 = 1;
+ _helpEnabled = true;
R2_GLOBALS._scenePalette.addFader(_animationPlayer._subData._palData, 256, 6, NULL);
R2_GLOBALS._sound1.play(2);
break;
@@ -1654,7 +1659,7 @@ void Scene180::signal() {
break;
case 11:
- _field412 = 1;
+ _helpEnabled = true;
_door.postInit();
_shipDisplay.postInit();
setAction(&_sequenceManager, this, 4000, &_door, &_shipDisplay, NULL);
@@ -1701,21 +1706,21 @@ void Scene180::signal() {
break;
case 27:
- _field412 = 0;
+ _helpEnabled = false;
_door.remove();
_shipDisplay.remove();
setSceneDelay(2);
break;
case 28:
- _field412 = 0;
+ _helpEnabled = false;
_palette.loadPalette(0);
_palette.loadPalette(9998);
R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 100, this);
break;
case 29:
- _field412 = 1;
+ _helpEnabled = true;
_animationPlayer._paletteMode = ANIMPALMODE_REPLACE_PALETTE;
_animationPlayer._isActive = true;
_animationPlayer._objectMode = ANIMOBJMODE_42;
@@ -1744,7 +1749,7 @@ void Scene180::signal() {
break;
case 32:
- _field412 = 1;
+ _helpEnabled = true;
_teal.postInit();
_teal.setPosition(Common::Point(161, 97));
@@ -1794,7 +1799,7 @@ void Scene180::signal() {
break;
case 37:
- _field412 = 0;
+ _helpEnabled = false;
_dutyOfficer.remove();
_palette.loadPalette(9998);
R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 8, this);
@@ -1808,6 +1813,8 @@ void Scene180::signal() {
// TODO: Figure out why end action on sounds aren't firing. For now, I'm
// simply setting up a scene delay to ensure the signal() method gets
// called again after a brief delay
+ _backSurface.fillRect(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 0);
+ R2_GLOBALS._screenSurface.fillRect(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 0);
setSceneDelay(10);
R2_GLOBALS._sound2.fadeOut2(NULL);
R2_GLOBALS._sound1.fadeOut2(NULL /* this */);
@@ -1832,7 +1839,7 @@ void Scene180::signal() {
break;
case 41:
- _field412 = 1;
+ _helpEnabled = true;
_animationPlayer._isActive = true;
break;
@@ -1852,12 +1859,12 @@ void Scene180::signal() {
break;
case 45:
- _field412 = 1;
+ _helpEnabled = true;
_stripManager.start(28, this);
break;
case 48:
- _field412 = 1;
+ _helpEnabled = true;
_animationPlayer._paletteMode = ANIMPALMODE_NONE;
_animationPlayer._isActive = true;
_animationPlayer._objectMode = ANIMOBJMODE_1;
@@ -1871,13 +1878,21 @@ void Scene180::signal() {
case 49:
R2_GLOBALS._scene180Mode = 15;
R2_GLOBALS._paneRefreshFlag[0] = 3;
+
+ _backSurface.fillRect(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 0);
+ R2_GLOBALS._screenSurface.fillRect(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 0);
+
setSceneDelay(1);
break;
case 50:
R2_GLOBALS._scene180Mode = 0;
- _field412 = 0;
- R2_GLOBALS._sceneManager.changeScene(100);
+ _helpEnabled = false;
+
+ // WORKAROUND: The original changed to scene 100 here, Quinn's Bedroom,
+ // but instead we're changing to the previously unused scene 50, which shows
+ // a closeup of Quinn in the floatation bed first
+ R2_GLOBALS._sceneManager.changeScene(50);
break;
}
}
@@ -1889,11 +1904,10 @@ void Scene180::setSceneDelay(int v) {
void Scene180::process(Event &event) {
if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_ESCAPE)) {
- event.handled = 1;
- if (!_field412) {
- if (R2_GLOBALS._scenePalette._listeners.size() == 0) {
+ event.handled = true;
+ if (_helpEnabled) {
+ if (R2_GLOBALS._scenePalette._listeners.size() == 0)
HelpDialog::show();
- }
}
}
@@ -2340,12 +2354,21 @@ Scene205::Scene205(): SceneExt() {
GfxFont font;
font.setFontNumber(4);
_fontHeight = font.getHeight();
+
+ for (int i = 0; i < 3; i++) {
+ _starList1[i] = nullptr;
+ _starList2[i] = nullptr;
+ }
+
+ for (int i = 0; i < 4; i++)
+ _starList3[i] = nullptr;
}
void Scene205::postInit(SceneObjectList *OwnerList) {
loadScene(4000);
+ R2_GLOBALS._uiElements._active = false;
SceneExt::postInit();
- BF_GLOBALS._interfaceY = 200;
+ R2_GLOBALS._interfaceY = SCREEN_HEIGHT;
R2_GLOBALS._player._uiEnabled = false;
R2_GLOBALS._sound1.play(337);
@@ -2360,11 +2383,11 @@ void Scene205::synchronize(Serializer &s) {
SceneExt::synchronize(s);
for (int idx = 0; idx < 3; ++idx)
- SYNC_POINTER(_objList1[idx]);
+ SYNC_POINTER(_starList1[idx]);
for (int idx = 0; idx < 3; ++idx)
- SYNC_POINTER(_objList2[idx]);
+ SYNC_POINTER(_starList2[idx]);
for (int idx = 0; idx < 4; ++idx)
- SYNC_POINTER(_objList3[idx]);
+ SYNC_POINTER(_starList3[idx]);
s.syncAsSint16LE(_textIndex);
s.syncAsSint16LE(_lineNum);
@@ -2386,9 +2409,9 @@ void Scene205::process(Event &event) {
}
void Scene205::dispatch() {
- processList(_objList3, 4, Common::Rect(0, 0, 319, 200), 1, 1, 160, 100);
- processList(_objList2, 3, Common::Rect(0, 0, 319, 200), 2, 2, 160, 100);
- processList(_objList1, 3, Common::Rect(0, 0, 319, 200), 4, 3, 160, 100);
+ processList(_starList3, 4, Common::Rect(0, 0, 319, 200), 1, 1, 160, 100);
+ processList(_starList2, 3, Common::Rect(0, 0, 319, 200), 2, 2, 160, 100);
+ processList(_starList1, 3, Common::Rect(0, 0, 319, 200), 4, 3, 160, 100);
Scene::dispatch();
}
@@ -2400,10 +2423,10 @@ void Scene205::setup() {
Common::Point(140, 149), Common::Point(91, 166), Common::Point(299, 46), Common::Point(314, 10)
};
- // Set up the first object list
+ // Set up the first star list
for (int idx = 0; idx < 3; ++idx) {
- Object *obj = new Object();
- _objList1[idx] = obj;
+ Star *obj = new Star();
+ _starList1[idx] = obj;
obj->postInit();
obj->_flags |= OBJFLAG_CLONED;
@@ -2416,10 +2439,10 @@ void Scene205::setup() {
obj->fixPriority(12);
}
- // Setup the second object list
+ // Setup the second star list
for (int idx = 0; idx < 3; ++idx) {
- Object *obj = new Object();
- _objList2[idx] = obj;
+ Star *obj = new Star();
+ _starList2[idx] = obj;
obj->postInit();
obj->_flags |= OBJFLAG_CLONED;
@@ -2432,10 +2455,10 @@ void Scene205::setup() {
obj->fixPriority(11);
}
- // Setup the third object list
+ // Setup the third star list
for (int idx = 0; idx < 4; ++idx) {
- Object *obj = new Object();
- _objList3[idx] = obj;
+ Star *obj = new Star();
+ _starList3[idx] = obj;
obj->postInit();
obj->_flags |= OBJFLAG_CLONED;
@@ -2452,10 +2475,10 @@ void Scene205::setup() {
/**
* Handles moving a group of stars in the scene background
*/
-void Scene205::processList(Object **ObjList, int count, const Common::Rect &bounds,
+void Scene205::processList(Star **ObjList, int count, const Common::Rect &bounds,
int xMultiply, int yMultiply, int xCenter, int yCenter) {
for (int idx = 0; idx < count; ++idx) {
- Object *obj = ObjList[idx];
+ Star *obj = ObjList[idx];
Common::Point pt(obj->_position.x - xCenter, obj->_position.y - yCenter);
if ((obj->_position.x <= 319) && (obj->_position.x >= 0) &&
@@ -2606,11 +2629,11 @@ void Scene250::synchronize(Serializer &s) {
void Scene250::postInit(SceneObjectList *OwnerList) {
loadScene(250);
+ R2_GLOBALS._uiElements._active = false;
SceneExt::postInit();
- BF_GLOBALS._interfaceY = 200;
+ R2_GLOBALS._interfaceY = SCREEN_HEIGHT;
R2_GLOBALS._player.postInit();
- R2_GLOBALS._uiElements._active = false;
R2_GLOBALS._player.setVisage(10);
R2_GLOBALS._player.hide();
R2_GLOBALS._player.enableControl();
@@ -2888,11 +2911,11 @@ void Scene300::Action4::signal() {
Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene;
if (!R2_GLOBALS._playStream.isPlaying()) {
- scene->_object7.setStrip2(R2_GLOBALS._randomSource.getRandomNumber(2));
- scene->_object7.setFrame(1);
+ scene->_mirandaScreen.setStrip2(R2_GLOBALS._randomSource.getRandomNumber(2));
+ scene->_mirandaScreen.setFrame(1);
- scene->_object9.setStrip2(3);
- scene->_object9.setFrame(1);
+ scene->_quinnScreen.setStrip2(3);
+ scene->_quinnScreen.setFrame(1);
}
setDelay(60 + R2_GLOBALS._randomSource.getRandomNumber(479));
@@ -3223,29 +3246,29 @@ void Scene300::postInit(SceneObjectList *OwnerList) {
_rotation->_countdown = 1;
if (R2_GLOBALS.getFlag(51) && !R2_GLOBALS.getFlag(25)) {
- _object1.postInit();
- _object1.setup(301, 7, 2);
- _object1.setPosition(Common::Point(65, 24));
+ _atmosphereLeftWindow.postInit();
+ _atmosphereLeftWindow.setup(301, 7, 2);
+ _atmosphereLeftWindow.setPosition(Common::Point(65, 24));
- _object2.postInit();
- _object2.setup(301, 8, 2);
- _object2.setPosition(Common::Point(254, 24));
+ _atmosphereRightWindow.postInit();
+ _atmosphereRightWindow.setup(301, 8, 2);
+ _atmosphereRightWindow.setPosition(Common::Point(254, 24));
}
_doorway.postInit();
_doorway.setVisage(300);
_doorway.setPosition(Common::Point(159, 79));
- _object3.postInit();
- _object3.setup(300, 4, 1);
- _object3.setPosition(Common::Point(84, 48));
- _object3.animate(ANIM_MODE_2, NULL);
- _object3._numFrames = 5;
+ _leftVerticalBarsAnim.postInit();
+ _leftVerticalBarsAnim.setup(300, 4, 1);
+ _leftVerticalBarsAnim.setPosition(Common::Point(84, 48));
+ _leftVerticalBarsAnim.animate(ANIM_MODE_2, NULL);
+ _leftVerticalBarsAnim._numFrames = 5;
- _object4.postInit();
- _object4.setup(300, 5, 1);
- _object4.setPosition(Common::Point(236, 48));
- _object4.animate(ANIM_MODE_2, NULL);
+ _rightVerticalBarsAnim.postInit();
+ _rightVerticalBarsAnim.setup(300, 5, 1);
+ _rightVerticalBarsAnim.setPosition(Common::Point(236, 48));
+ _rightVerticalBarsAnim.animate(ANIM_MODE_2, NULL);
_protocolDisplay.postInit();
_protocolDisplay.setup(300, 6, 1);
@@ -3253,32 +3276,32 @@ void Scene300::postInit(SceneObjectList *OwnerList) {
_protocolDisplay.animate(ANIM_MODE_7, 0, NULL);
_protocolDisplay._numFrames = 5;
- _object6.postInit();
- _object6.setup(300, 7, 1);
- _object6.setPosition(Common::Point(214, 37));
- _object6.animate(ANIM_MODE_2, NULL);
- _object6._numFrames = 3;
-
- _object7.postInit();
- _object7.setup(301, 1, 1);
- _object7.setPosition(Common::Point(39, 97));
- _object7.fixPriority(124);
- _object7.animate(ANIM_MODE_2, NULL);
- _object7._numFrames = 5;
- _object7.setAction(&_action4);
-
- _object8.postInit();
- _object8.setup(300, 8, 1);
- _object8.setPosition(Common::Point(105, 37));
- _object8.animate(ANIM_MODE_2, NULL);
- _object8._numFrames = 5;
-
- _object9.postInit();
- _object9.setup(301, 6, 1);
- _object9.setPosition(Common::Point(274, 116));
- _object9.fixPriority(143);
- _object9.animate(ANIM_MODE_2, NULL);
- _object9._numFrames = 5;
+ _rightTextDisplay.postInit();
+ _rightTextDisplay.setup(300, 7, 1);
+ _rightTextDisplay.setPosition(Common::Point(214, 37));
+ _rightTextDisplay.animate(ANIM_MODE_2, NULL);
+ _rightTextDisplay._numFrames = 3;
+
+ _mirandaScreen.postInit();
+ _mirandaScreen.setup(301, 1, 1);
+ _mirandaScreen.setPosition(Common::Point(39, 97));
+ _mirandaScreen.fixPriority(124);
+ _mirandaScreen.animate(ANIM_MODE_2, NULL);
+ _mirandaScreen._numFrames = 5;
+ _mirandaScreen.setAction(&_action4);
+
+ _leftTextDisplay.postInit();
+ _leftTextDisplay.setup(300, 8, 1);
+ _leftTextDisplay.setPosition(Common::Point(105, 37));
+ _leftTextDisplay.animate(ANIM_MODE_2, NULL);
+ _leftTextDisplay._numFrames = 5;
+
+ _quinnScreen.postInit();
+ _quinnScreen.setup(301, 6, 1);
+ _quinnScreen.setPosition(Common::Point(274, 116));
+ _quinnScreen.fixPriority(143);
+ _quinnScreen.animate(ANIM_MODE_2, NULL);
+ _quinnScreen._numFrames = 5;
_quinnWorkstation1.setDetails(Rect(243, 148, 315, 167), 300, 30, 31, 32, 1, NULL);
_mirandaWorkstation1.setDetails(Rect(4, 128, 69, 167), 300, 33, 31, 35, 1, NULL);
@@ -3752,9 +3775,9 @@ Scene325::Icon::Icon(): SceneActor() {
void Scene325::Icon::postInit(SceneObjectList *OwnerList) {
SceneObject::postInit();
- _object1.postInit();
- _object1.fixPriority(21);
- _object1.hide();
+ _glyph.postInit();
+ _glyph.fixPriority(21);
+ _glyph.hide();
_sceneText1._color1 = 92;
_sceneText1._color2 = 0;
@@ -3793,18 +3816,18 @@ void Scene325::Icon::process(Event &event) {
scene->_sound1.play(14);
setFrame(2);
- switch (_object1._strip) {
+ switch (_glyph._strip) {
case 1:
- _object1.setStrip(2);
+ _glyph.setStrip(2);
break;
case 3:
- _object1.setStrip(4);
+ _glyph.setStrip(4);
break;
case 5:
- _object1.setStrip(6);
+ _glyph.setStrip(6);
break;
case 7:
- _object1.setStrip(8);
+ _glyph.setStrip(8);
break;
default:
break;
@@ -3823,15 +3846,15 @@ void Scene325::Icon::process(Event &event) {
if ((event.eventType == EVENT_BUTTON_UP) && _pressed) {
setFrame(1);
- switch (_object1._strip) {
+ switch (_glyph._strip) {
case 2:
- _object1.setStrip(1);
+ _glyph.setStrip(1);
break;
case 4:
- _object1.setStrip(3);
+ _glyph.setStrip(3);
break;
case 6:
- _object1.setStrip(5);
+ _glyph.setStrip(5);
break;
default:
break;
@@ -3855,8 +3878,8 @@ void Scene325::Icon::setIcon(int id) {
if (_lookLineNum) {
showIcon();
- _object1.setup(325, ((id - 1) / 10) * 2 + 1, ((id - 1) % 10) + 1);
- _object1.setPosition(_position);
+ _glyph.setup(325, ((id - 1) / 10) * 2 + 1, ((id - 1) % 10) + 1);
+ _glyph.setPosition(_position);
_sceneText1._fontNumber = scene->_iconFontNumber;
_sceneText1.setup(CONSOLE325_MESSAGES[id]);
@@ -3897,26 +3920,26 @@ void Scene325::Icon::setIcon(int id) {
void Scene325::Icon::showIcon() {
_sceneText1.show();
_sceneText2.show();
- _object1.show();
- _object2.show();
+ _glyph.show();
+ _horizLine.show();
show();
}
void Scene325::Icon::hideIcon() {
_sceneText1.hide();
_sceneText2.hide();
- _object1.hide();
- _object2.hide();
+ _glyph.hide();
+ _horizLine.hide();
hide();
}
/*--------------------------------------------------------------------------*/
Scene325::Scene325(): SceneExt() {
- _field412 = 7;
+ _consoleAction = 7;
_iconFontNumber = 50;
- _field416 = _field418 = 0;
- _field41A = _field41C = _field41E = _scannerLocation = 0;
+ _databasePage = _priorConsoleAction = 0;
+ _moveCounter = _yChange = _yDirection = _scannerLocation = 0;
_soundCount = _soundIndex = 0;
for (int idx = 0; idx < 10; ++idx)
@@ -3944,13 +3967,13 @@ void Scene325::postInit(SceneObjectList *OwnerList) {
void Scene325::synchronize(Serializer &s) {
SceneExt::synchronize(s);
- s.syncAsSint16LE(_field412);
+ s.syncAsSint16LE(_consoleAction);
s.syncAsSint16LE(_iconFontNumber);
- s.syncAsSint16LE(_field416);
- s.syncAsSint16LE(_field418);
- s.syncAsSint16LE(_field41A);
- s.syncAsSint16LE(_field41C);
- s.syncAsSint16LE(_field41E);
+ s.syncAsSint16LE(_databasePage);
+ s.syncAsSint16LE(_priorConsoleAction);
+ s.syncAsSint16LE(_moveCounter);
+ s.syncAsSint16LE(_yChange);
+ s.syncAsSint16LE(_yDirection);
s.syncAsSint16LE(_scannerLocation);
s.syncAsSint16LE(_soundCount);
s.syncAsSint16LE(_soundIndex);
@@ -3983,28 +4006,28 @@ void Scene325::signal() {
case 1:
_icon1.setup(160, 1, 1);
_icon1.setPosition(Common::Point(65, 17));
- _icon1._object2.postInit();
- _icon1._object2.setup(160, 7, 1);
- _icon1._object2.setPosition(Common::Point(106, 41));
+ _icon1._horizLine.postInit();
+ _icon1._horizLine.setup(160, 7, 1);
+ _icon1._horizLine.setPosition(Common::Point(106, 41));
_icon2.setup(160, 1, 1);
_icon2.setPosition(Common::Point(80, 32));
- _icon2._object2.postInit();
- _icon2._object2.setup(160, 7, 2);
- _icon2._object2.setPosition(Common::Point(106, 56));
+ _icon2._horizLine.postInit();
+ _icon2._horizLine.setup(160, 7, 2);
+ _icon2._horizLine.setPosition(Common::Point(106, 56));
_icon3.setup(160, 1, 1);
_icon3.setPosition(Common::Point(65, 47));
- _icon3._object2.postInit();
- _icon3._object2.setup(160, 7, 1);
- _icon3._object2.setPosition(Common::Point(106, 71));
+ _icon3._horizLine.postInit();
+ _icon3._horizLine.setup(160, 7, 1);
+ _icon3._horizLine.setPosition(Common::Point(106, 71));
_icon4.setup(160, 1, 1);
_icon4.setPosition(Common::Point(80, 62));
_icon4._sceneRegionId = 5;
- _icon4._object2.postInit();
- _icon4._object2.setup(160, 7, 2);
- _icon4._object2.setPosition(Common::Point(106, 86));
+ _icon4._horizLine.postInit();
+ _icon4._horizLine.setup(160, 7, 2);
+ _icon4._horizLine.setPosition(Common::Point(106, 86));
_icon5.postInit();
_icon5.setup(160, 1, 1);
@@ -4023,29 +4046,33 @@ void Scene325::signal() {
R2_GLOBALS._player._canWalk = false;
break;
case 9:
- switch (_field412) {
+ // Fade to black for console sub-section: database, or starchart
+ switch (_consoleAction) {
case 3:
+ // Starchart
_sceneMode = 129;
- _object1.postInit();
- _object2.postInit();
- _object3.postInit();
+ _starGrid1.postInit();
+ _starGrid2.postInit();
+ _starGrid3.postInit();
if (R2_GLOBALS.getFlag(13)) {
- _object4.postInit();
- setAction(&_sequenceManager1, this, 130, &R2_GLOBALS._player, &_object1,
- &_object2, &_object3, &_object4, NULL);
+ // Show starchart with Ringworld present
+ _starGrid4.postInit();
+ setAction(&_sequenceManager1, this, 130, &R2_GLOBALS._player, &_starGrid1,
+ &_starGrid2, &_starGrid3, &_starGrid4, NULL);
} else {
- setAction(&_sequenceManager1, this, 129, &R2_GLOBALS._player, &_object1,
- &_object2, &_object3, NULL);
+ // Show starchart without Ringworld
+ setAction(&_sequenceManager1, this, 129, &R2_GLOBALS._player, &_starGrid1,
+ &_starGrid2, &_starGrid3, NULL);
}
break;
case 17:
case 18:
case 19:
case 20: {
- int v = 10 - ((21 - _field412) * 2);
+ int v = 10 - ((21 - _consoleAction) * 2);
if (R2_GLOBALS.getFlag(50))
--v;
- if (_field418 == 5)
+ if (_priorConsoleAction == 5)
v += 8;
if (R2_GLOBALS.getFlag(51) && (v == 2))
R2_GLOBALS.setFlag(57);
@@ -4056,70 +4083,70 @@ void Scene325::signal() {
} else {
_scannerLocation = 864;
- _object12.postInit();
- _object12.setup(326, 4, 1);
- _object12.setPosition(Common::Point(149, 128));
- _object12.fixPriority(20);
-
- _scannerTab.postInit();
- _scannerTab.setup(326, 4, 2);
- _scannerTab.setPosition(Common::Point(149, 22 + (int)(_scannerLocation * ADJUST_FACTOR)));
- _scannerTab.fixPriority(21);
-
- _object10.postInit();
- _object10.setup(326, 1, 1);
- _object10.setPosition(Common::Point(210, 20));
- _object10.fixPriority(10);
-
- _object1.postInit();
- _object1.setup(326, 1, 1);
- _object1.setPosition(Common::Point(210, 32));
- _object1.fixPriority(10);
-
- _object2.postInit();
- _object2.setup(326, 1, 1);
- _object2.setPosition(Common::Point(210, 44));
- _object2.fixPriority(10);
-
- _object3.postInit();
- _object3.setup(326, 1, 1);
- _object3.setPosition(Common::Point(210, 56));
- _object3.fixPriority(10);
-
- _object4.postInit();
- _object4.setup(326, 1, 1);
- _object4.setPosition(Common::Point(210, 68));
- _object4.fixPriority(10);
-
- _object5.postInit();
- _object5.setup(326, 1, 1);
- _object5.setPosition(Common::Point(210, 80));
- _object5.fixPriority(10);
-
- _object6.postInit();
- _object6.setup(326, 1, 1);
- _object6.setPosition(Common::Point(210, 92));
- _object6.fixPriority(10);
-
- _object7.postInit();
- _object7.setup(326, 1, 1);
- _object7.setPosition(Common::Point(210, 104));
- _object7.fixPriority(10);
-
- _object8.postInit();
- _object8.setup(326, 1, 1);
- _object8.setPosition(Common::Point(210, 116));
- _object8.fixPriority(10);
-
- _object9.postInit();
- _object9.setup(326, 1, 1);
- _object9.setPosition(Common::Point(210, 128));
- _object9.fixPriority(10);
-
- _object11.postInit();
- _object11.setup(326, 1, 1);
- _object11.setPosition(Common::Point(210, 150));
- _object11.fixPriority(10);
+ _starGrid12.postInit();
+ _starGrid12.setup(326, 4, 1);
+ _starGrid12.setPosition(Common::Point(149, 128));
+ _starGrid12.fixPriority(20);
+
+ _starGrid13.postInit();
+ _starGrid13.setup(326, 4, 2);
+ _starGrid13.setPosition(Common::Point(149, 22 + (int)(_scannerLocation * ADJUST_FACTOR)));
+ _starGrid13.fixPriority(21);
+
+ _starGrid10.postInit();
+ _starGrid10.setup(326, 1, 1);
+ _starGrid10.setPosition(Common::Point(210, 20));
+ _starGrid10.fixPriority(10);
+
+ _starGrid1.postInit();
+ _starGrid1.setup(326, 1, 1);
+ _starGrid1.setPosition(Common::Point(210, 32));
+ _starGrid1.fixPriority(10);
+
+ _starGrid2.postInit();
+ _starGrid2.setup(326, 1, 1);
+ _starGrid2.setPosition(Common::Point(210, 44));
+ _starGrid2.fixPriority(10);
+
+ _starGrid3.postInit();
+ _starGrid3.setup(326, 1, 1);
+ _starGrid3.setPosition(Common::Point(210, 56));
+ _starGrid3.fixPriority(10);
+
+ _starGrid4.postInit();
+ _starGrid4.setup(326, 1, 1);
+ _starGrid4.setPosition(Common::Point(210, 68));
+ _starGrid4.fixPriority(10);
+
+ _starGrid5.postInit();
+ _starGrid5.setup(326, 1, 1);
+ _starGrid5.setPosition(Common::Point(210, 80));
+ _starGrid5.fixPriority(10);
+
+ _starGrid6.postInit();
+ _starGrid6.setup(326, 1, 1);
+ _starGrid6.setPosition(Common::Point(210, 92));
+ _starGrid6.fixPriority(10);
+
+ _starGrid7.postInit();
+ _starGrid7.setup(326, 1, 1);
+ _starGrid7.setPosition(Common::Point(210, 104));
+ _starGrid7.fixPriority(10);
+
+ _starGrid8.postInit();
+ _starGrid8.setup(326, 1, 1);
+ _starGrid8.setPosition(Common::Point(210, 116));
+ _starGrid8.fixPriority(10);
+
+ _starGrid9.postInit();
+ _starGrid9.setup(326, 1, 1);
+ _starGrid9.setPosition(Common::Point(210, 128));
+ _starGrid9.fixPriority(10);
+
+ _starGrid11.postInit();
+ _starGrid11.setup(326, 1, 1);
+ _starGrid11.setPosition(Common::Point(210, 150));
+ _starGrid11.fixPriority(10);
}
} else if (R2_GLOBALS.getFlag(51)) {
setMessage(329, (v == 12) ? 10 : v);
@@ -4131,41 +4158,42 @@ void Scene325::signal() {
case 21:
_sceneMode = 129;
- _object1.postInit();
- _object1.setup(327, 1, 1);
- _object1.setPosition(Common::Point(170, 80));
- _object1.fixPriority(10);
- _object1.animate(ANIM_MODE_5, NULL);
+ _starGrid1.postInit();
+ _starGrid1.setup(327, 1, 1);
+ _starGrid1.setPosition(Common::Point(170, 80));
+ _starGrid1.fixPriority(10);
+ _starGrid1.animate(ANIM_MODE_5, NULL);
break;
case 22:
_sceneMode = 129;
- _object1.postInit();
- _object1.setup(327, 2, 1);
- _object1.setPosition(Common::Point(160, 80));
- _object1.fixPriority(10);
- _object1.animate(ANIM_MODE_5, NULL);
+ _starGrid1.postInit();
+ _starGrid1.setup(327, 2, 1);
+ _starGrid1.setPosition(Common::Point(160, 80));
+ _starGrid1.fixPriority(10);
+ _starGrid1.animate(ANIM_MODE_5, NULL);
break;
case 24:
R2_GLOBALS._player.enableControl();
R2_GLOBALS._player._canWalk = false;
- _field416 = 37;
- setMessage(128, _field416);
+ _databasePage = 37;
+ setMessage(128, _databasePage);
break;
case 25:
R2_GLOBALS._player.enableControl();
R2_GLOBALS._player._canWalk = false;
- _field416 = 68;
- setMessage(128, _field416);
+ _databasePage = 68;
+ setMessage(128, _databasePage);
break;
case 26:
R2_GLOBALS._player.enableControl();
R2_GLOBALS._player._canWalk = false;
- _field416 = 105;
- setMessage(128, _field416);
+ _databasePage = 105;
+ setMessage(128, _databasePage);
break;
default:
- _field416 = 0;
+ _databasePage = 0;
+ setMessage(128, _databasePage);
break;
}
@@ -4176,7 +4204,7 @@ void Scene325::signal() {
R2_GLOBALS._player.enableControl();
R2_GLOBALS._player._canWalk = false;
- if ((_field412 >= 17) && (_field412 <= 20)) {
+ if ((_consoleAction >= 17) && (_consoleAction <= 20)) {
_icon5.setIcon(8);
consoleAction(4);
} else {
@@ -4227,7 +4255,7 @@ void Scene325::consoleAction(int id) {
if (id == 7)
_icon5.setIcon(9);
- else if ((_field412 != 3) && ((_field412 < 17) || (_field412 > 26)))
+ else if ((_consoleAction != 3) && ((_consoleAction < 17) || (_consoleAction > 26)))
_icon5.setIcon(8);
switch (id - 1) {
@@ -4236,10 +4264,12 @@ void Scene325::consoleAction(int id) {
_icon2.setIcon(11);
break;
case 1:
+ // Database screen
_icon1.setIcon(23);
_icon2.setIcon(24);
_icon3.setIcon(25);
_icon4.setIcon(26);
+ break;
case 2:
case 16:
case 17:
@@ -4253,13 +4283,13 @@ void Scene325::consoleAction(int id) {
_icon2.hideIcon();
_icon3.hideIcon();
- if (id == 2 || (id == 19 && _field418 == 5 && R2_GLOBALS.getFlag(50) &&
+ if (id == 2 || (id == 19 && _priorConsoleAction == 5 && R2_GLOBALS.getFlag(50) &&
R2_GLOBALS.getFlag(44) && !R2_GLOBALS.getFlag(51))) {
_icon5.setIcon(13);
_icon4.setPosition(Common::Point(52, 107));
_icon4._sceneRegionId = 9;
_icon4.setIcon(14);
- _icon4._object2.hide();
+ _icon4._horizLine.hide();
} else {
_icon4.hideIcon();
@@ -4269,16 +4299,17 @@ void Scene325::consoleAction(int id) {
_icon6.setIcon(12);
_sceneMode = 10;
_palette.loadPalette(161);
- BF_GLOBALS._scenePalette.addFader(&_palette._palette[0], 256, 5, this);
+ R2_GLOBALS._scenePalette.addFader(&_palette._palette[0], 256, 5, this);
break;
case 22:
case 23:
case 24:
case 25:
+ // Database sub-sections: A-G, N-O, P-S, T-Z
R2_GLOBALS._player.disableControl();
consoleAction(2);
- _field412 = id;
+ _consoleAction = id;
_icon1.hideIcon();
_icon2.hideIcon();
_icon3.hideIcon();
@@ -4288,12 +4319,12 @@ void Scene325::consoleAction(int id) {
_icon4.setPosition(Common::Point(52, 107));
_icon4._sceneRegionId = 9;
_icon4.setIcon(14);
- _icon4._object2.hide();
+ _icon4._horizLine.hide();
_icon6.setIcon(12);
_sceneMode = 10;
_palette.loadPalette(161);
- BF_GLOBALS._scenePalette.addFader(&_palette._palette[0], 256, 5, this);
+ R2_GLOBALS._scenePalette.addFader(&_palette._palette[0], 256, 5, this);
break;
case 11:
@@ -4311,24 +4342,25 @@ void Scene325::consoleAction(int id) {
_icon4._sceneRegionId = 5;
_icon4.hideIcon();
- _object12.remove();
- _scannerTab.remove();
- _object10.remove();
- _object1.remove();
- _object2.remove();
- _object3.remove();
- _object4.remove();
- _object5.remove();
- _object6.remove();
- _object7.remove();
- _object8.remove();
- _object9.remove();
- _object11.remove();
+ R2_GLOBALS._player.hide();
+ _starGrid1.remove();
+ _starGrid2.remove();
+ _starGrid3.remove();
+ _starGrid4.remove();
+ _starGrid5.remove();
+ _starGrid6.remove();
+ _starGrid7.remove();
+ _starGrid8.remove();
+ _starGrid9.remove();
+ _starGrid10.remove();
+ _starGrid11.remove();
+ _starGrid12.remove();
+ _starGrid13.remove();
_palette.loadPalette(160);
_sceneMode = 11;
- BF_GLOBALS._scenePalette.addFader(&_palette._palette[0], 256, 5, this);
+ R2_GLOBALS._scenePalette.addFader(&_palette._palette[0], 256, 5, this);
}
break;
@@ -4339,58 +4371,66 @@ void Scene325::consoleAction(int id) {
break;
case 4:
case 5:
- _field418 = id;
+ _priorConsoleAction = id;
_icon1.setIcon(17);
_icon2.setIcon(18);
_icon3.setIcon(19);
_icon4.setIcon(20);
break;
case 7:
- consoleAction(((_field412 == 5) || (_field412 == 6) || (_field412 == 15)) ? 4 : 7);
+ consoleAction(((_consoleAction == 5) || (_consoleAction == 6) || (_consoleAction == 15)) ? 4 : 7);
break;
case 8:
R2_GLOBALS._sceneManager.changeScene(300);
+ break;
case 9:
case 10:
+ // Set language: Interworld or Hero's Tongue
_iconFontNumber = (id - 1) == 9 ? 50 : 52;
_text1.remove();
_icon6.setIcon(7);
+ consoleAction(1);
break;
case 12:
+ // Page up button
_icon4.setIcon(14);
- _icon4._object2.hide();
+ _icon4._horizLine.hide();
- switch (_field412) {
+ switch (_consoleAction) {
case 17:
case 18:
case 19:
case 20:
if (_scannerLocation) {
R2_GLOBALS._player.disableControl();
- _field41A = 1296;
- _field41E = 1;
+ _moveCounter = 1296;
+ _yDirection = 1;
}
break;
default:
- setMessage(128, --_field416);
+ setMessage(128, --_databasePage);
break;
}
return;
case 13:
+ // Page down button
_icon4.setIcon(14);
- _icon4._object2.hide();
+ _icon4._horizLine.hide();
- switch (_field412) {
+ switch (_consoleAction) {
case 17:
case 18:
case 19:
case 20:
if (_scannerLocation < 1620) {
R2_GLOBALS._player.disableControl();
- _field41A = 1296;
- _field41E = -1;
+ _moveCounter = 1296;
+ _yDirection = -1;
}
break;
+ default:
+ setMessage(128, ++_databasePage);
+ break;
}
return;
case 14:
@@ -4409,6 +4449,7 @@ void Scene325::consoleAction(int id) {
break;
case 6:
default:
+ // Initial starting screen
_icon1.setIcon(1);
_icon2.setIcon(2);
_icon3.setIcon(3);
@@ -4418,7 +4459,7 @@ void Scene325::consoleAction(int id) {
}
if (id != 8)
- _field412 = id;
+ _consoleAction = id;
}
void Scene325::process(Event &event) {
@@ -4435,48 +4476,48 @@ void Scene325::process(Event &event) {
}
void Scene325::dispatch() {
- if (_field41A) {
- switch (_field41A) {
+ if (_moveCounter) {
+ switch (_moveCounter) {
case 13:
- _field41C = 1;
+ _yChange = 1;
break;
case 1296:
R2_GLOBALS._sound3.play(87);
- _field41C = 1;
+ _yChange = 1;
break;
case 33:
case 1283:
- _field41C = 2;
+ _yChange = 2;
break;
case 63:
case 1263:
- _field41C = 3;
+ _yChange = 3;
break;
case 103:
case 1233:
- _field41C = 4;
+ _yChange = 4;
break;
case 153:
case 1193:
- _field41C = 5;
+ _yChange = 5;
break;
case 213:
case 1143:
- _field41C = 6;
+ _yChange = 6;
break;
case 283:
case 1083:
- _field41C = 7;
+ _yChange = 7;
break;
case 1013:
- _field41C = 8;
+ _yChange = 8;
break;
default:
break;
}
- _field41A -= _field41C;
- int yp = _field41E * _field41C + _object10._position.y;
+ _moveCounter -= _yChange;
+ int yp = _yDirection * _yChange + _starGrid10._position.y;
bool flag = false;
if (yp >= 30) {
@@ -4489,51 +4530,51 @@ void Scene325::dispatch() {
++_scannerLocation;
flag = true;
}
- _scannerTab.setPosition(Common::Point(149, 22 + (int)(_scannerLocation * ADJUST_FACTOR)));
+ _starGrid13.setPosition(Common::Point(149, 22 + (int)(_scannerLocation * ADJUST_FACTOR)));
for (int idx = 0; idx < 4; ++idx)
_objList[idx].remove();
if (flag) {
int v = _scannerLocation - 758;
- _object10.setFrame((v++ <= 0) ? 1 : v);
- _object1.setFrame((v++ <= 0) ? 1 : v);
- _object2.setFrame((v++ <= 0) ? 1 : v);
- _object3.setFrame((v++ <= 0) ? 1 : v);
- _object4.setFrame((v++ <= 0) ? 1 : v);
- _object5.setFrame((v++ <= 0) ? 1 : v);
- _object6.setFrame((v++ <= 0) ? 1 : v);
- _object7.setFrame((v++ <= 0) ? 1 : v);
- _object8.setFrame((v++ <= 0) ? 1 : v);
- _object9.setFrame((v++ <= 0) ? 1 : v);
- _object11.setFrame((v++ <= 0) ? 1 : v);
+ _starGrid10.setFrame((v++ <= 0) ? 1 : v);
+ _starGrid1.setFrame((v++ <= 0) ? 1 : v);
+ _starGrid2.setFrame((v++ <= 0) ? 1 : v);
+ _starGrid3.setFrame((v++ <= 0) ? 1 : v);
+ _starGrid4.setFrame((v++ <= 0) ? 1 : v);
+ _starGrid5.setFrame((v++ <= 0) ? 1 : v);
+ _starGrid6.setFrame((v++ <= 0) ? 1 : v);
+ _starGrid7.setFrame((v++ <= 0) ? 1 : v);
+ _starGrid8.setFrame((v++ <= 0) ? 1 : v);
+ _starGrid9.setFrame((v++ <= 0) ? 1 : v);
+ _starGrid11.setFrame((v++ <= 0) ? 1 : v);
}
- _object10.setPosition(Common::Point(210, yp));
+ _starGrid10.setPosition(Common::Point(210, yp));
yp += 12;
- _object1.setPosition(Common::Point(210, yp));
+ _starGrid1.setPosition(Common::Point(210, yp));
yp += 12;
- _object2.setPosition(Common::Point(210, yp));
+ _starGrid2.setPosition(Common::Point(210, yp));
yp += 12;
- _object3.setPosition(Common::Point(210, yp));
+ _starGrid3.setPosition(Common::Point(210, yp));
yp += 12;
- _object4.setPosition(Common::Point(210, yp));
+ _starGrid4.setPosition(Common::Point(210, yp));
yp += 12;
- _object5.setPosition(Common::Point(210, yp));
+ _starGrid5.setPosition(Common::Point(210, yp));
yp += 12;
- _object6.setPosition(Common::Point(210, yp));
+ _starGrid6.setPosition(Common::Point(210, yp));
yp += 12;
- _object7.setPosition(Common::Point(210, yp));
+ _starGrid7.setPosition(Common::Point(210, yp));
yp += 12;
- _object8.setPosition(Common::Point(210, yp));
+ _starGrid8.setPosition(Common::Point(210, yp));
yp += 12;
- _object9.setPosition(Common::Point(210, yp));
+ _starGrid9.setPosition(Common::Point(210, yp));
yp += 12;
- _object11.setPosition(Common::Point(210, yp));
+ _starGrid11.setPosition(Common::Point(210, yp));
- if (!_field41A) {
+ if (!_moveCounter) {
R2_GLOBALS._sound3.stop();
- _field41C = 0;
+ _yChange = 0;
if (_scannerLocation == 756) {
R2_GLOBALS._player.disableControl();
@@ -4551,9 +4592,11 @@ void Scene325::dispatch() {
}
void Scene325::setMessage(int resNum, int lineNum) {
- Common::String msg = g_resourceManager->getMessage(resNum, lineNum);
+ removeText();
+ Common::String msg = g_resourceManager->getMessage(resNum, lineNum, true);
if (!msg.empty()) {
+ // Found valid database entry to display
Common::String msgText = parseMessage(msg);
_text1._fontNumber = _iconFontNumber;
@@ -4571,7 +4614,9 @@ void Scene325::setMessage(int resNum, int lineNum) {
R2_GLOBALS._playStream.play(_soundQueue[_soundIndex++], this);
}
} else {
- _field412 = 13;
+ // No message for given database index, so we must have passed beyond
+ // the start or end of the database
+ _consoleAction = 13;
R2_GLOBALS._player.disableControl();
R2_GLOBALS._player.hide();
@@ -4581,7 +4626,7 @@ void Scene325::setMessage(int resNum, int lineNum) {
_palette.loadPalette(160);
_sceneMode = 11;
- BF_GLOBALS._scenePalette.addFader(&_palette._palette[0], 256, 5, this);
+ R2_GLOBALS._scenePalette.addFader(&_palette._palette[0], 256, 5, this);
}
}
@@ -4603,6 +4648,7 @@ Common::String Scene325::parseMessage(const Common::String &msg) {
return Common::String(msgP);
}
+
/*--------------------------------------------------------------------------
* Scene 400 - Science Lab
*
@@ -5122,7 +5168,7 @@ void Scene500::PanelDialog::setDetails(int visage, int strip, int frameNumber,
}
void Scene500::PanelDialog::remove() {
- Scene500 *scene = (Scene500 *)BF_GLOBALS._sceneManager._scene;
+ Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene;
scene->_sceneAreas.remove(&_button1);
scene->_sceneAreas.remove(&_button2);
scene->_sceneAreas.remove(&_button3);
@@ -5167,7 +5213,7 @@ void Scene500::PanelDialog::Button::setupButton(int buttonId) {
break;
}
- Scene500 *scene = (Scene500 *)BF_GLOBALS._sceneManager._scene;
+ Scene500 *scene = (Scene500 *)R2_GLOBALS._sceneManager._scene;
scene->_sceneAreas.push_front(this);
}
@@ -5678,7 +5724,7 @@ bool Scene600::Doorway::startAction(CursorType action, Event &event) {
}
if ((R2_GLOBALS.getFlag(9)) && (R2_INVENTORY.getObjectScene(R2_COM_SCANNER) == 600))
- SceneItem::display(600, 31, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(600, 31, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
else {
R2_GLOBALS._player.disableControl();
scene->_sceneMode = 601;
@@ -5696,7 +5742,7 @@ bool Scene600::Laser::startAction(CursorType action, Event &event) {
// If laser is destroyed
if (R2_GLOBALS.getFlag(6)) {
if (R2_GLOBALS.getFlag(8)) {
- SceneItem::display(600, 29, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(600, 29, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
return true;
} else {
R2_GLOBALS._player.disableControl();
@@ -5712,7 +5758,7 @@ bool Scene600::Laser::startAction(CursorType action, Event &event) {
break;
case R2_AEROSOL:
if (R2_GLOBALS.getFlag(5)) {
- SceneItem::display(600, 28, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(600, 28, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
return true;
} else {
R2_GLOBALS._player.disableControl();
@@ -6413,7 +6459,7 @@ void Scene700::signal() {
_sceneMode = 2;
R2_GLOBALS._player.setStrip(4);
if (R2_GLOBALS._player._position.x != 164) {
- SceneItem::display(700, 36, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(700, 36, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
R2_GLOBALS._player.enableControl();
} else {
R2_GLOBALS._sound2.play(19);
@@ -6844,14 +6890,12 @@ void Scene800::signal() {
Scene825::Button::Button(): SceneObject() {
_buttonId = 0;
- _v2 = 0;
_buttonDown = false;
}
void Scene825::Button::synchronize(Serializer &s) {
SceneObject::synchronize(s);
s.syncAsSint16LE(_buttonId);
- s.syncAsSint16LE(_v2);
s.syncAsSint16LE(_buttonDown);
}
@@ -6885,7 +6929,6 @@ bool Scene825::Button::startAction(CursorType action, Event &event) {
void Scene825::Button::setButton(int buttonId) {
SceneObject::postInit();
- _v2 = buttonId;
_buttonDown = 0;
_sceneText._color1 = 92;
_sceneText._color2 = 0;
@@ -6954,11 +6997,11 @@ Scene825::Scene825(): SceneExt() {
void Scene825::postInit(SceneObjectList *OwnerList) {
loadScene(825);
+ R2_GLOBALS._uiElements._active = false;
SceneExt::postInit();
- BF_GLOBALS._interfaceY = 200;
+ R2_GLOBALS._interfaceY = SCREEN_HEIGHT;
R2_GLOBALS._player.postInit();
- R2_GLOBALS._uiElements._active = false;
R2_GLOBALS._player._effect = 0;
R2_GLOBALS._player.setVisage(10);
R2_GLOBALS._player.hide();
@@ -7514,11 +7557,11 @@ bool Scene900::Button::startAction(CursorType action, Event &event) {
return true;
break;
case 8:
- SceneItem::display(5, 11, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(5, 11, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
return true;
break;
case 9:
- SceneItem::display(5, 12, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(5, 12, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
return true;
break;
default:
@@ -7543,7 +7586,7 @@ bool Scene900::Button::startAction(CursorType action, Event &event) {
}
} else if (action == CURSOR_LOOK) {
SceneItem::display(900, ((_buttonId == 2) && (scene->_controlsScreenNumber == 2)) ? 21 : _buttonId + 11,
- SET_WIDTH, 280, SET_X, 160, SET_POS_MODE, 1, SET_Y, 20, SET_EXT_BGCOLOR, 7, -999);
+ SET_WIDTH, 280, SET_X, 160, SET_POS_MODE, 1, SET_Y, 20, SET_EXT_BGCOLOR, 7, LIST_END);
return true;
} else {
return SceneActor::startAction(action, event);
diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h
index fe42f1e33e..2013b041c7 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes0.h
+++ b/engines/tsage/ringworld2/ringworld2_scenes0.h
@@ -85,7 +85,7 @@ class Scene100: public SceneExt {
public:
NamedHotspot _background, _duct, _bed, _desk;
Terminal _terminal;
- SceneActor _bedLights1, _bedLights2, _object3, _object4, _object5;
+ SceneActor _bedLights1, _bedLights2, _tableLocker, _wardrobeTopAnim, _wardrobeColorAnim;
SceneActor _wardrobe;
Door _door;
Table _table;
@@ -111,7 +111,7 @@ class Scene125: public SceneExt {
public:
int _lookLineNum, _iconId;
bool _pressed;
- SceneObject _object1, _object2;
+ SceneObject _glyph, _horizLine;
SceneText _sceneText1, _sceneText2;
Icon();
@@ -136,7 +136,8 @@ public:
ASoundExt _sound1;
NamedHotspot _background, _item2, _item3;
DiskSlot _diskSlot;
- SceneActor _object1, _object2, _object3, _object4, _food, _foodDispenser, _infoDisk;
+ SceneActor _starchart1, _starchart2, _starchart3, _starchart4;
+ SceneActor _food, _foodDispenser, _infoDisk;
Icon _icon1, _icon2, _icon3, _icon4, _icon5, _icon6;
SequenceManager _sequenceManager;
SceneText _sceneText;
@@ -175,7 +176,6 @@ public:
ASound _sound1;
Action1 _action1;
int _frameNumber, _yChange;
- SceneObject _object1, _object2, _object3;
int _lineNum;
SynchronizedList<SceneText *> _creditsList;
public:
@@ -210,10 +210,9 @@ public:
ASoundExt _sound1;
int _frameNumber;
- int _field412, _field480;
- int _field482, _frameInc;
+ bool _helpEnabled;
+ int _frameInc;
int _fontNumber, _fontHeight;
- int _scene180Mode;
public:
Scene180();
@@ -263,6 +262,13 @@ public:
virtual void signal();
};
+class Star: public SceneObject {
+public:
+ int _x100, _y100;
+public:
+ virtual Common::String getClassName() { return "Scene205_Star"; }
+};
+
class Scene205: public SceneExt {
/* Actions */
class Action1: public Action {
@@ -271,26 +277,18 @@ class Scene205: public SceneExt {
public:
virtual void signal();
};
-
- /* Objects */
- class Object: public SceneObject {
- public:
- int _x100, _y100;
- public:
- // TODO: Check if this derives from DataManager? and flesh out
- };
private:
void setup();
- void processList(Object **ObjList, int count, const Common::Rect &bounds,
+ void processList(Star **ObjList, int count, const Common::Rect &bounds,
int xMultiply, int yMultiply, int xCenter, int yCenter);
void handleText();
public:
AnimationPlayer _animationPlayer;
int _fontHeight;
SceneText _textList[15];
- Object *_objList1[3];
- Object *_objList2[3];
- Object *_objList3[4];
+ Star *_starList1[3];
+ Star *_starList2[3];
+ Star *_starList3[4];
ASound _sound1;
Action1 _action1;
int _yp;
@@ -402,8 +400,8 @@ public:
QuinnWorkstation _quinnWorkstation1, _quinnWorkstation2;
SeekerWorkstation _seekerWorkstation;
MirandaWorkstation _mirandaWorkstation1, _mirandaWorkstation2;
- SceneActor _object1, _object2, _object3, _object4, _protocolDisplay;
- SceneActor _object6, _object7, _object8, _object9;
+ SceneActor _atmosphereLeftWindow, _atmosphereRightWindow, _leftVerticalBarsAnim, _rightVerticalBarsAnim, _protocolDisplay;
+ SceneActor _rightTextDisplay, _mirandaScreen, _leftTextDisplay, _quinnScreen;
SceneActor _teal, _soldier, _object12;
Doorway _doorway;
Miranda _miranda;
@@ -430,7 +428,7 @@ class Scene325: public SceneExt {
public:
int _lookLineNum, _iconId;
bool _pressed;
- SceneObject _object1, _object2;
+ SceneObject _glyph, _horizLine;
SceneText _sceneText1, _sceneText2;
Icon();
@@ -450,16 +448,17 @@ private:
void setMessage(int resNum, int lineNum);
Common::String parseMessage(const Common::String &msg);
public:
- int _field412, _iconFontNumber, _field416, _field418;
- int _field41A, _field41C, _field41E, _scannerLocation;
+ int _consoleAction, _iconFontNumber, _databasePage, _priorConsoleAction;
+ int _moveCounter, _yChange, _yDirection, _scannerLocation;
int _soundCount, _soundIndex;
int _soundQueue[10];
SpeakerQuinn _quinnSpeaker;
ScenePalette _palette;
SceneHotspot _background, _terminal;
- SceneObject _object1, _object2, _object3, _object4, _object5;
- SceneObject _object6, _object7, _object8, _object9, _object10;
- SceneObject _object11, _object12, _scannerTab;
+ SceneObject _starGrid1, _starGrid2, _starGrid3; // Both starchart & scan grid objects
+ SceneObject _starGrid4, _starGrid5, _starGrid6, _starGrid7;
+ SceneObject _starGrid8, _starGrid9, _starGrid10, _starGrid11;
+ SceneObject _starGrid12, _starGrid13;
SceneObject _objList[4];
Icon _icon1, _icon2, _icon3, _icon4, _icon5, _icon6;
ASoundExt _sound1;
@@ -628,7 +627,6 @@ public:
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void signal();
-
};
class Scene600 : public SceneExt {
@@ -808,7 +806,7 @@ class Scene825: public SceneExt {
/* Objects */
class Button: public SceneObject {
public:
- int _buttonId, _v2;
+ int _buttonId;
bool _buttonDown;
SceneText _sceneText;
public:
diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
index 0932c70f04..3d99ecd035 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
@@ -479,9 +479,9 @@ void Scene1000::dispatch() {
void Scene1010::postInit(SceneObjectList *OwnerList) {
loadScene(1010);
- SceneExt::postInit();
- R2_GLOBALS._interfaceY = 200;
R2_GLOBALS._uiElements._active = false;
+ SceneExt::postInit();
+ R2_GLOBALS._interfaceY = SCREEN_HEIGHT;
setZoomPercents(100, 1, 160, 100);
R2_GLOBALS._player.postInit();
@@ -540,14 +540,14 @@ void Scene1010::signal() {
void Scene1020::postInit(SceneObjectList *OwnerList) {
loadScene(1020);
+ R2_GLOBALS._uiElements._active = false;
SceneExt::postInit();
if (R2_GLOBALS._sceneManager._previousScene == 1010)
_sceneBounds = Rect(160, 0, SCREEN_WIDTH + 160, 200);
- R2_GLOBALS._interfaceY = 200;
+ R2_GLOBALS._interfaceY = SCREEN_HEIGHT;
R2_GLOBALS._v558B6.set(160, 0, 160, 161);
- R2_GLOBALS._uiElements._active = false;
R2_GLOBALS._player.postInit();
if (R2_GLOBALS._sceneManager._previousScene == 1010) {
@@ -694,13 +694,13 @@ bool Scene1100::Seeker::startAction(CursorType action, Event &event) {
} else {
R2_GLOBALS._player.disableControl();
scene->_sceneMode = 55;
- if (R2_GLOBALS._v565AE >= 3) {
+ if (R2_GLOBALS._stripModifier >= 3) {
if (R2_GLOBALS._player._characterIndex == R2_QUINN)
scene->_stripManager.start3(329, scene, R2_GLOBALS._stripManager_lookupList);
else
scene->_stripManager.start3(330, scene, R2_GLOBALS._stripManager_lookupList);
} else {
- ++R2_GLOBALS._v565AE;
+ ++R2_GLOBALS._stripModifier;
R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
if (R2_GLOBALS._player._characterIndex == R2_QUINN)
scene->_stripManager.start3(304, scene, R2_GLOBALS._stripManager_lookupList);
@@ -878,7 +878,7 @@ void Scene1100::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player._moveDiff = Common::Point(16, 2);
_rightLandslide.setup2(1104, 2, 1, 175, 125, 102, 1);
- _object2.setup2(1102, 5, 1, 216, 167, 1, 0);
+ _purplePlant.setup2(1102, 5, 1, 216, 167, 1, 0);
_leftImpacts.postInit();
_leftImpacts.setup(1113, 2, 1);
@@ -1482,8 +1482,8 @@ void Scene1200::LaserPanel::postInit(SceneObjectList *OwnerList) {
scene->_field41A = 1;
R2_GLOBALS._events.setCursor(CURSOR_USE);
- proc12(1003, 1, 1, 100, 40);
- proc13(1200, 11, -1, -1);
+ setup2(1003, 1, 1, 100, 40);
+ setup3(1200, 11, -1, -1);
R2_GLOBALS._sound2.play(259);
_jumper1.init(1);
_jumper2.init(2);
@@ -1852,10 +1852,10 @@ void Scene1200::process(Event &event) {
if (R2_GLOBALS._scientistConvIndex >= 4)
R2_GLOBALS._sceneManager.changeScene(3250);
else
- SceneItem::display(1200, 6, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ SceneItem::display(1200, 6, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END);
break;
default:
- SceneItem::display(1200, 5, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ SceneItem::display(1200, 5, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END);
break;
}
event.handled = true;
@@ -1868,7 +1868,7 @@ void Scene1200::process(Event &event) {
switch (cellPos.x) {
case 3:
// It was your cell.
- SceneItem::display(1200, 8, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1200, 8, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
break;
case 9:
R2_GLOBALS._sceneManager.changeScene(3240);
@@ -1878,7 +1878,7 @@ void Scene1200::process(Event &event) {
R2_GLOBALS._sceneManager.changeScene(3210);
else
// A vent grill
- SceneItem::display(1200, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1200, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
break;
case 17:
switch (cellPos.y) {
@@ -1893,21 +1893,22 @@ void Scene1200::process(Event &event) {
break;
default:
// A vent grill
- SceneItem::display(1200, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1200, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
break;
}
+ break;
case 33:
R2_GLOBALS._sceneManager.changeScene(3245);
break;
default:
- SceneItem::display(1200, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1200, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
break;
}
}
if (cellId > 36) {
// "An anti-pest laser"
event.handled = true;
- SceneItem::display(1200, 9, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1200, 9, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
}
break;
case CURSOR_TALK:
@@ -2242,6 +2243,11 @@ Scene1337::Scene1337() {
_field424A = 0;
_field424C = 0;
_field424E = 0;
+
+ _unkFctPtr412 = nullptr;
+ _field3EF0 = nullptr;
+ _field3EF4 = nullptr;
+ _field3EF8 = nullptr;
}
void Scene1337::synchronize(Serializer &s) {
@@ -4307,12 +4313,12 @@ void Scene1337::postInit(SceneObjectList *OwnerList) {
// In the original, may be found in subPostInit.
// Without it, enableControl asserts
loadScene(1330);
+ R2_GLOBALS._uiElements._active = false;
SceneExt::postInit();
//
// Hide the user interface
- R2_GLOBALS._uiElements._active = false;
- BF_GLOBALS._interfaceY = 200;
+ BF_GLOBALS._interfaceY = SCREEN_HEIGHT;
R2_GLOBALS._player.enableControl();
R2_GLOBALS._player._canWalk = false;
@@ -4947,7 +4953,7 @@ void Scene1337::subC2C2F() {
if (!found) {
for (int i = 0; i <= 7; i++) {
- if ((_arrunkObj1337[3]._arr2[i]._field34 == 1) && (!subC2687(_arrunkObj1337[3]._arr3[i]._field34))) {
+ if ((_arrunkObj1337[3]._arr2[i]._field34 == 1) && (!subC2687(_arrunkObj1337[3]._arr3[0]._field34))) {
int tmpVal = 0;
for (int j = 0; j <= 7; j++) {
@@ -6900,49 +6906,49 @@ void Scene1500::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player.hide();
R2_GLOBALS._player.disableControl();
- _actor2.postInit();
- _actor2.setup(1401, 1, 1);
- _actor2._effect = 5;
- _actor2.fixPriority(10);
- _actor2._field9C = _field312;
+ _starshipShadow.postInit();
+ _starshipShadow.setup(1401, 1, 1);
+ _starshipShadow._effect = 5;
+ _starshipShadow.fixPriority(10);
+ _starshipShadow._field9C = _field312;
- _actor1.postInit();
- _actor1.setup(1400, 1, 1);
- _actor1._moveDiff = Common::Point(1, 1);
- _actor1._linkedActor = &_actor2;
+ _starship.postInit();
+ _starship.setup(1400, 1, 1);
+ _starship._moveDiff = Common::Point(1, 1);
+ _starship._linkedActor = &_starshipShadow;
if (R2_GLOBALS._sceneManager._previousScene != 1010) {
- _actor4.postInit();
- _actor4.setup(1401, 2, 1);
- _actor4._effect = 5;
- _actor4.fixPriority(10);
- _actor4._field9C = _field312;
+ _smallShipShadow.postInit();
+ _smallShipShadow.setup(1401, 2, 1);
+ _smallShipShadow._effect = 5;
+ _smallShipShadow.fixPriority(10);
+ _smallShipShadow._field9C = _field312;
- _actor3.postInit();
- _actor3._moveRate = 30;
- _actor3._moveDiff = Common::Point(1, 1);
- _actor3._linkedActor = &_actor4;
+ _smallShip.postInit();
+ _smallShip._moveRate = 30;
+ _smallShip._moveDiff = Common::Point(1, 1);
+ _smallShip._linkedActor = &_smallShipShadow;
}
if (R2_GLOBALS._sceneManager._previousScene == 300) {
- _actor1.setPosition(Common::Point(189, 139), 5);
+ _starship.setPosition(Common::Point(189, 139), 5);
- _actor3.setup(1400, 1, 2);
- _actor3.setPosition(Common::Point(148, 108), 0);
+ _smallShip.setup(1400, 1, 2);
+ _smallShip.setPosition(Common::Point(148, 108), 0);
_sceneMode = 20;
R2_GLOBALS._sound1.play(110);
} else if (R2_GLOBALS._sceneManager._previousScene == 1550) {
- _actor1.setPosition(Common::Point(189, 139), 5);
+ _starship.setPosition(Common::Point(189, 139), 5);
- _actor3.setup(1400, 2, 1);
- _actor3.changeZoom(-1);
- _actor3.setPosition(Common::Point(298, 258), 5);
+ _smallShip.setup(1400, 2, 1);
+ _smallShip.changeZoom(-1);
+ _smallShip.setPosition(Common::Point(298, 258), 5);
_sceneMode = 10;
R2_GLOBALS._sound1.play(106);
} else {
- _actor1.setPosition(Common::Point(289, 239), -30);
+ _starship.setPosition(Common::Point(289, 239), -30);
_sceneMode = 0;
R2_GLOBALS._sound1.play(102);
}
@@ -6964,8 +6970,8 @@ void Scene1500::signal() {
setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL);
// No break on purpose
case 1:
- if (_actor1._yDiff < 50) {
- _actor1.setPosition(Common::Point(289, 239), _actor1._yDiff + 1);
+ if (_starship._yDiff < 50) {
+ _starship.setPosition(Common::Point(289, 239), _starship._yDiff + 1);
_sceneMode = 1;
}
setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL);
@@ -6973,12 +6979,12 @@ void Scene1500::signal() {
case 2: {
Common::Point pt(189, 139);
NpcMover *mover = new NpcMover();
- _actor1.addMover(mover, &pt, this);
+ _starship.addMover(mover, &pt, this);
}
break;
case 3:
- if (_actor1._yDiff > 5) {
- _actor1.setPosition(Common::Point(189, 139), _actor1._yDiff - 1);
+ if (_starship._yDiff > 5) {
+ _starship.setPosition(Common::Point(189, 139), _starship._yDiff - 1);
_sceneMode = 3;
}
setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL);
@@ -6997,7 +7003,7 @@ void Scene1500::signal() {
case 11: {
Common::Point pt(148, 108);
NpcMover *mover = new NpcMover();
- _actor3.addMover(mover, &pt, this);
+ _smallShip.addMover(mover, &pt, this);
}
break;
case 12:
@@ -7006,13 +7012,13 @@ void Scene1500::signal() {
case 21: {
Common::Point pt(-2, -42);
NpcMover *mover = new NpcMover();
- _actor3.addMover(mover, &pt, NULL);
+ _smallShip.addMover(mover, &pt, NULL);
signal();
}
break;
case 22:
- if (_actor1._yDiff < 50) {
- _actor1.setPosition(Common::Point(189, 139), _actor1._yDiff + 1);
+ if (_starship._yDiff < 50) {
+ _starship.setPosition(Common::Point(189, 139), _starship._yDiff + 1);
_sceneMode = 22;
}
setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL);
@@ -7020,7 +7026,7 @@ void Scene1500::signal() {
case 23: {
Common::Point pt(-13, -61);
NpcMover *mover = new NpcMover();
- _actor1.addMover(mover, &pt, this);
+ _starship.addMover(mover, &pt, this);
}
break;
case 24:
@@ -7033,9 +7039,9 @@ void Scene1500::signal() {
void Scene1500::dispatch() {
if (_sceneMode > 10) {
- float yDiff = sqrt((float) (_actor3._position.x * _actor3._position.x) + (_actor3._position.y * _actor3._position.y));
+ float yDiff = sqrt((float) (_smallShip._position.x * _smallShip._position.x) + (_smallShip._position.y * _smallShip._position.y));
if (yDiff > 6)
- _actor3.setPosition(_actor3._position, (int) yDiff);
+ _smallShip.setPosition(_smallShip._position, (int) yDiff);
}
Scene::dispatch();
@@ -7122,15 +7128,15 @@ void Scene1530::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player._moveRate = 30;
R2_GLOBALS._player._moveDiff = Common::Point(4, 1);
- _actor2.postInit();
- _actor2.setup(1516, 7, 1);
- _actor2.setPosition(Common::Point(121, 41));
- _actor2.animate(ANIM_MODE_2, NULL);
+ _leftReactor.postInit();
+ _leftReactor.setup(1516, 7, 1);
+ _leftReactor.setPosition(Common::Point(121, 41));
+ _leftReactor.animate(ANIM_MODE_2, NULL);
- _actor3.postInit();
- _actor3.setup(1516, 8, 1);
- _actor3.setPosition(Common::Point(107, 116));
- _actor3.animate(ANIM_MODE_2, NULL);
+ _rightReactor.postInit();
+ _rightReactor.setup(1516, 8, 1);
+ _rightReactor.setPosition(Common::Point(107, 116));
+ _rightReactor.animate(ANIM_MODE_2, NULL);
R2_GLOBALS._player.disableControl();
Common::Point pt(480, 75);
@@ -7140,14 +7146,14 @@ void Scene1530::postInit(SceneObjectList *OwnerList) {
_sceneMode = 1;
} else {
- _actor1.postInit();
- _actor1._effect = 1;
+ _seeker.postInit();
+ _seeker._effect = 1;
R2_GLOBALS._player.postInit();
R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
R2_GLOBALS._player.disableControl();
- setAction(&_sequenceManager, this, 1530, &R2_GLOBALS._player, &_actor1, NULL);
+ setAction(&_sequenceManager, this, 1530, &R2_GLOBALS._player, &_seeker, NULL);
_sceneMode = 2;
}
@@ -7180,8 +7186,8 @@ void Scene1530::dispatch() {
int16 x = R2_GLOBALS._player._position.x;
int16 y = R2_GLOBALS._player._position.y;
- _actor2.setPosition(Common::Point(x - 39, y - 85));
- _actor3.setPosition(Common::Point(x - 53, y - 9));
+ _leftReactor.setPosition(Common::Point(x - 39, y - 85));
+ _rightReactor.setPosition(Common::Point(x - 53, y - 9));
Scene::dispatch();
}
@@ -7221,13 +7227,13 @@ bool Scene1550::Junk::startAction(CursorType action, Event &event) {
if (_visage == 1561) {
switch (_frame) {
case 2:
- SceneItem::display(1550, 23, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1550, 23, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
break;
case 3:
- SceneItem::display(1550, 26, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1550, 26, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
break;
case 4:
- SceneItem::display(1550, 35, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1550, 35, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
break;
default:
break;
@@ -7235,13 +7241,13 @@ bool Scene1550::Junk::startAction(CursorType action, Event &event) {
} else {
switch ((((_strip - 1) * 5) + _frame) % 3) {
case 0:
- SceneItem::display(1550, 62, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1550, 62, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
break;
case 1:
- SceneItem::display(1550, 53, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1550, 53, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
break;
case 2:
- SceneItem::display(1550, 76, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1550, 76, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
break;
default:
break;
@@ -7285,11 +7291,11 @@ bool Scene1550::ShipComponent::startAction(CursorType action, Event &event) {
break;
case CURSOR_LOOK:
if (_componentId == 8)
- SceneItem::display(1550, 75, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1550, 75, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
else if (_frame == 1)
- SceneItem::display(1550, 70, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1550, 70, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
else
- SceneItem::display(1550, 71, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1550, 71, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
return true;
break;
case R2_FUEL_CELL:
@@ -7548,8 +7554,8 @@ void Scene1550::UnkArea1550::process(Event &event) {
}
}
-void Scene1550::UnkArea1550::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) {
- // UnkArea1200::proc12();
+void Scene1550::UnkArea1550::setup2(int visage, int stripFrameNum, int frameNum, int posX, int posY) {
+ // UnkArea1200::setup2();
Scene1550 *scene = (Scene1550 *)R2_GLOBALS._sceneManager._scene;
_areaActor.postInit();
@@ -7562,7 +7568,7 @@ void Scene1550::UnkArea1550::proc12(int visage, int stripFrameNum, int frameNum,
_field20 = R2_GLOBALS._insetUp;
//
- proc13(1550, 67, -1, -1);
+ setup3(1550, 67, -1, -1);
_unkObj155031.postInit();
_unkObj155031._fieldA4 = 1;
if (scene->_actor4._frame == 1)
@@ -7585,7 +7591,7 @@ void Scene1550::UnkArea1550::proc12(int visage, int stripFrameNum, int frameNum,
_unkObj155032.setDetails(1550, 69, -1, -1, 2, (SceneItem *) NULL);
}
-void Scene1550::UnkArea1550::proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum) {
+void Scene1550::UnkArea1550::setup3(int resNum, int lookLineNum, int talkLineNum, int useLineNum) {
// Copy of Scene1200::LaserPanel::proc13
_areaActor.setDetails(resNum, lookLineNum, talkLineNum, useLineNum, 2, (SceneItem *) NULL);
}
@@ -7655,7 +7661,7 @@ bool Scene1550::Actor9::startAction(CursorType action, Event &event) {
return true;
break;
case CURSOR_LOOK:
- SceneItem::display(1550, 41, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1550, 41, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
return true;
break;
default:
@@ -7742,7 +7748,7 @@ bool Scene1550::Actor13::startAction(CursorType action, Event &event) {
scene->_sceneMode = 1564;
scene->setAction(&scene->_sequenceManager1, scene, 1564, &R2_GLOBALS._player, NULL);
} else
- SceneItem::display(1550, 64, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1550, 64, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
return true;
break;
case CURSOR_LOOK:
@@ -7750,9 +7756,9 @@ bool Scene1550::Actor13::startAction(CursorType action, Event &event) {
return SceneActor::startAction(action, event);
if (R2_INVENTORY.getObjectScene(R2_BATTERY) == 1550) {
- SceneItem::display(1550, 74, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1550, 74, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
} else
- SceneItem::display(1550, 64, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1550, 64, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
return true;
break;
default:
@@ -7832,7 +7838,7 @@ void Scene1550::postInit(SceneObjectList *OwnerList) {
switch (R2_GLOBALS._sceneManager._previousScene) {
case 1530:
- R2_GLOBALS._v565AE = 0;
+ R2_GLOBALS._stripModifier = 0;
// No break on purpose
case 300:
// No break on purpose
@@ -7904,7 +7910,6 @@ void Scene1550::signal() {
// No break on purpose
case 7:
_field412 = 0;
- R2_GLOBALS._v56AAB = 0;
R2_GLOBALS._player.enableControl(CURSOR_WALK);
break;
case 20:
@@ -7915,7 +7920,7 @@ void Scene1550::signal() {
// No break on purpose
case 1563:
R2_GLOBALS.clearFlag(20);
- _unkArea1.proc12(1559, 1, 1, 160, 125);
+ _unkArea1.setup2(1559, 1, 1, 160, 125);
R2_GLOBALS._player.enableControl();
_sceneMode = 0;
break;
@@ -8058,33 +8063,33 @@ void Scene1550::signal() {
_sceneMode = 60;
R2_GLOBALS._player.disableControl();
R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
- if (R2_GLOBALS._v565AE >= 3) {
+ if (R2_GLOBALS._stripModifier >= 3) {
if (R2_GLOBALS._player._characterIndex == R2_QUINN)
_stripManager.start(572, this);
else
_stripManager.start(573, this);
} else {
- ++R2_GLOBALS._v565AE;
+ ++R2_GLOBALS._stripModifier;
if (R2_GLOBALS._player._characterIndex == R2_QUINN)
- _stripManager.start(499 + R2_GLOBALS._v565AE, this);
+ _stripManager.start(499 + R2_GLOBALS._stripModifier, this);
else
- _stripManager.start(502 + R2_GLOBALS._v565AE, this);
+ _stripManager.start(502 + R2_GLOBALS._stripModifier, this);
}
} else {
_sceneMode = 60;
R2_GLOBALS._player.disableControl();
R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
- if (R2_GLOBALS._v565AE >= 4) {
+ if (R2_GLOBALS._stripModifier >= 4) {
if (R2_GLOBALS._player._characterIndex == R2_QUINN)
_stripManager.start(572, this);
else
_stripManager.start(573, this);
} else {
- ++R2_GLOBALS._v565AE;
+ ++R2_GLOBALS._stripModifier;
if (R2_GLOBALS._player._characterIndex == R2_QUINN)
- _stripManager.start(563 + R2_GLOBALS._v565AE, this);
+ _stripManager.start(563 + R2_GLOBALS._stripModifier, this);
else
- _stripManager.start(567 + R2_GLOBALS._v565AE, this);
+ _stripManager.start(567 + R2_GLOBALS._stripModifier, this);
}
}
break;
@@ -8116,7 +8121,7 @@ void Scene1550::signal() {
case 1558:
_actor13.fixPriority(124);
_field415 = 1;
- _unkArea1.proc12(1559, 1, 1, 160, 125);
+ _unkArea1.setup2(1559, 1, 1, 160, 125);
R2_GLOBALS._player.enableControl();
break;
case 1559:
@@ -8209,7 +8214,7 @@ void Scene1550::signal() {
R2_GLOBALS._player.enableControl();
break;
case 1585:
- SceneItem::display(1550, 66, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1550, 66, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
R2_GLOBALS._player.enableControl();
break;
case 1586:
@@ -8262,8 +8267,11 @@ void Scene1550::dispatch() {
if ((R2_GLOBALS._s1550PlayerArea[R2_GLOBALS._player._characterIndex].x == 15) && (R2_GLOBALS._s1550PlayerArea[R2_GLOBALS._player._characterIndex].y == 16)) {
R2_GLOBALS._player._shade = 0;
- // Original game contains a switch based on an uninitialized variable.
- // Until we understand what should really happen there, this code is unused on purpose
+
+ // NOTE: Original game contains a switch based on an uninitialized variable.
+ // We're leaving this code here, but ifdef'ed out, in case we can ever figure out
+ // what the original programmers intended the value to come from
+#if 0
int missingVariable = 0;
switch (missingVariable) {
case 144:
@@ -8285,6 +8293,7 @@ void Scene1550::dispatch() {
default:
break;
}
+#endif
}
if (_field412 != 0)
@@ -9289,178 +9298,207 @@ void Scene1550::enterArea() {
}
/*--------------------------------------------------------------------------
- * Scene 1575 -
+ * Scene 1575 - Spaceport - unused ship scene
*
*--------------------------------------------------------------------------*/
-Scene1575::Scene1575() {
- _field412 = 0;
- _field414 = 0;
- _field416 = 0;
- _field418 = 0;
- _field41A = 0;
+Scene1575::Button::Button() {
+ _buttonId = 0;
+ _pressed = false;
}
-void Scene1575::synchronize(Serializer &s) {
- SceneExt::synchronize(s);
+void Scene1575::Button::synchronize(Serializer &s) {
+ NamedHotspot::synchronize(s);
- s.syncAsSint16LE(_field412);
- s.syncAsSint16LE(_field414);
- s.syncAsSint16LE(_field416);
- s.syncAsSint16LE(_field418);
- s.syncAsSint16LE(_field41A);
+ s.syncAsSint16LE(_buttonId);
+ s.syncAsSint16LE(_pressed);
}
-Scene1575::Hotspot1::Hotspot1() {
- _field34 = 0;
- _field36 = 0;
-}
+void Scene1575::Button::process(Event &event) {
+ Scene1575 *scene = (Scene1575 *)R2_GLOBALS._sceneManager._scene;
+ bool isInBounds = _bounds.contains(event.mousePos);
+ CursorType cursor = R2_GLOBALS._events.getCursor();
-void Scene1575::Hotspot1::synchronize(Serializer &s) {
- NamedHotspot::synchronize(s);
+ if ((event.eventType == EVENT_BUTTON_DOWN && cursor == CURSOR_USE && isInBounds) ||
+ (_pressed && _buttonId != 1 && event.eventType == EVENT_BUTTON_UP && isInBounds)) {
+ // Button pressed
+ _pressed = true;
+ Common::Point pos = scene->_actor1._position;
+ event.handled = true;
- s.syncAsSint16LE(_field34);
- s.syncAsSint16LE(_field36);
-}
+ if (!R2_GLOBALS.getFlag(18) || _buttonId <= 1 || _buttonId >= 6) {
+ switch (_buttonId) {
+ case 1:
+ if (R2_GLOBALS.getFlag(18)) {
+ scene->_actor14.hide();
+ scene->_actor15.hide();
+ R2_GLOBALS.clearFlag(18);
+ } else if ((scene->_actor12._position.x == 85) && (scene->_actor12._position.y == 123)) {
+ scene->_actor14.show();
+ scene->_actor15.show();
+ R2_GLOBALS.setFlag(18);
+ } else {
+ SceneItem::display("That's probably not a good thing, ya know!");
+ }
+ break;
+ case 2:
+ if (scene->_field41A < 780) {
+ if (pos.x > 54)
+ pos.x -= 65;
+ pos.x += 2;
+ scene->_field41A += 2;
+
+ for (int i = 0; i < 17; i++)
+ scene->_arrActor[i].setPosition(Common::Point(scene->_arrActor[i]._position.x + 2, scene->_arrActor[i]._position.y));
+
+ scene->_actor13.setPosition(Common::Point(scene->_actor13._position.x + 2, scene->_actor13._position.y));
+ scene->_actor12.setPosition(Common::Point(scene->_actor12._position.x + 2, scene->_actor12._position.y));
+ scene->_actor1.setPosition(Common::Point(pos.x, pos.y));
+ scene->_actor2.setPosition(Common::Point(pos.x + 65, pos.y));
+ scene->_actor3.setPosition(Common::Point(pos.x + 130, pos.y));
+ }
+ break;
+ case 3:
+ if (scene->_field41A > 0) {
+ if (pos.x < -8)
+ pos.x += 65;
+
+ pos.x -= 2;
+ scene->_field41A -= 2;
+ for (int i = 0; i < 17; i++)
+ scene->_arrActor[i].setPosition(Common::Point(scene->_arrActor[i]._position.x - 2, scene->_arrActor[i]._position.y));
+
+ scene->_actor13.setPosition(Common::Point(scene->_actor13._position.x - 2, scene->_actor13._position.y));
+ scene->_actor12.setPosition(Common::Point(scene->_actor12._position.x - 2, scene->_actor12._position.y));
+ scene->_actor1.setPosition(Common::Point(pos.x, pos.y));
+ scene->_actor2.setPosition(Common::Point(pos.x + 65, pos.y));
+ scene->_actor3.setPosition(Common::Point(pos.x + 130, pos.y));
+ }
+ break;
+ case 4: {
+ if (pos.y < 176) {
+ ++pos.y;
+ for (int i = 0; i < 17; ++i)
+ scene->_arrActor[i].setPosition(Common::Point(scene->_arrActor[i]._position.x, scene->_arrActor[i]._position.y + 1));
+
+ scene->_actor13.setPosition(Common::Point(scene->_actor13._position.x, scene->_actor13._position.y + 1));
+ scene->_actor12.setPosition(Common::Point(scene->_actor12._position.x, scene->_actor12._position.y + 1));
+ scene->_actor1.setPosition(Common::Point(pos.x, pos.y));
+ scene->_actor2.setPosition(Common::Point(pos.x + 65, pos.y));
+ scene->_actor3.setPosition(Common::Point(pos.x + 130, pos.y));
+ }
+ }
+ break;
+ case 5: {
+ if (pos.y > 145) {
+ --pos.y;
+ for (int i = 0; i < 17; ++i)
+ scene->_arrActor[i].setPosition(Common::Point(scene->_arrActor[i]._position.x, scene->_arrActor[i]._position.y - 1));
+
+ scene->_actor13.setPosition(Common::Point(scene->_actor13._position.x, scene->_actor13._position.y - 1));
+ scene->_actor12.setPosition(Common::Point(scene->_actor12._position.x, scene->_actor12._position.y - 1));
+ scene->_actor1.setPosition(Common::Point(pos.x, pos.y));
+ scene->_actor2.setPosition(Common::Point(pos.x + 65, pos.y));
+ scene->_actor3.setPosition(Common::Point(pos.x + 130, pos.y));
+ }
+ }
+ break;
+ case 6:
+ R2_GLOBALS._sceneManager.changeScene(1550);
+ break;
+ default:
+ break;
+ }
-void Scene1575::Hotspot1::process(Event &event) {
- if ((event.eventType != EVENT_BUTTON_DOWN) || (R2_GLOBALS._events.getCursor() != R2_STEPPING_DISKS) || (!_bounds.contains(event.mousePos))) {
- if (_field36 == 0)
- return;
- if ((_field34 == 1) || (event.eventType == EVENT_BUTTON_UP) || (!_bounds.contains(event.mousePos))) {
- _field36 = 0;
- return;
- }
- }
- _field36 = 1;
- Scene1575 *scene = (Scene1575 *)R2_GLOBALS._sceneManager._scene;
+ int j = 0;
+ for (int i = 0; i < 17; i++) {
+ if (scene->_arrActor[i]._bounds.contains(85, 116))
+ j = i;
+ }
- event.handled = true;
- if (R2_GLOBALS.getFlag(18) && (_field34 > 1) && (_field34 < 6)) {
- warning("sub1A03B(\"Better not move the laser while it\'s firing!\", 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);");
- return;
- }
- int di = scene->_actor1._position.x;
+ if (scene->_actor13._bounds.contains(85, 116))
+ j = 18;
- switch (_field34 - 1) {
- case 0:
- if (R2_GLOBALS.getFlag(18)) {
- scene->_actor14.hide();
- scene->_actor15.hide();
- R2_GLOBALS.clearFlag(18);
- } else if ((scene->_actor12._position.x == 85) && (scene->_actor12._position.y == 123)) {
- scene->_actor14.show();
- scene->_actor15.show();
- R2_GLOBALS.setFlag(18);
+ if (scene->_actor12._bounds.contains(85, 116))
+ j = 19;
+
+ if (j)
+ scene->_actor11.show();
+ else
+ scene->_actor11.hide();
} else {
- warning("sub1A03B(\"That\'s probably not a good thing, ya know!\", 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);");
+ SceneItem::display("Better not move the laser while it's firing!");
}
- break;
- case 1:
- if (scene->_field41A < 780) {
- if (di > 54)
- di -= 65;
- di += 2;
- scene->_field41A += 2;
+ } else {
+ _pressed = false;
+ }
+}
- for (int i = 0; i < 17; i++)
- scene->_arrActor[i].setPosition(Common::Point(scene->_arrActor[i]._position.x + 2, scene->_arrActor[i]._position.y));
+bool Scene1575::Button::startAction(CursorType action, Event &event) {
+ if (action == CURSOR_USE)
+ return false;
+ return SceneHotspot::startAction(action, event);
+}
- scene->_actor13.setPosition(Common::Point(scene->_actor13._position.x + 2, scene->_actor13._position.y));
- scene->_actor12.setPosition(Common::Point(scene->_actor12._position.x + 2, scene->_actor12._position.y));
- scene->_actor1.setPosition(Common::Point(di, scene->_actor1._position.y));
- scene->_actor2.setPosition(Common::Point(di + 65, scene->_actor1._position.y));
- scene->_actor3.setPosition(Common::Point(di + 130, scene->_actor1._position.y));
- }
+void Scene1575::Button::initButton(int buttonId) {
+ _buttonId = buttonId;
+ _pressed = false;
+ EventHandler::postInit();
+
+ switch (_buttonId) {
+ case 1:
+ setDetails(Rect(53, 165, 117, 190), -1, -1, -1, 2, 1, NULL);
break;
case 2:
- if (scene->_field41A > 0) {
- if (di < -8)
- di += 65;
-
- di -= 2;
- scene->_field41A -= 2;
- for (int i = 0; i < 17; i++)
- scene->_arrActor[i].setPosition(Common::Point(scene->_arrActor[i]._position.x - 2, scene->_arrActor[i]._position.y));
-
- scene->_actor13.setPosition(Common::Point(scene->_actor13._position.x - 2, scene->_actor13._position.y));
- scene->_actor12.setPosition(Common::Point(scene->_actor12._position.x - 2, scene->_actor12._position.y));
- scene->_actor1.setPosition(Common::Point(di, scene->_actor1._position.y));
- scene->_actor2.setPosition(Common::Point(di + 65, scene->_actor1._position.y));
- scene->_actor3.setPosition(Common::Point(di + 130, scene->_actor1._position.y));
- }
+ setDetails(Rect(151, 142, 189, 161), -1, -1, -1, 2, 1, NULL);
break;
- case 3: {
- int tmpPosY = scene->_actor1._position.y;
- if (tmpPosY < 176) {
- ++tmpPosY;
- for (int i = 0; i < 17; ++i)
- scene->_arrActor[i].setPosition(Common::Point(scene->_arrActor[i]._position.x, scene->_arrActor[i]._position.y + 1));
-
- scene->_actor13.setPosition(Common::Point(scene->_actor13._position.x, scene->_actor13._position.y + 1));
- scene->_actor12.setPosition(Common::Point(scene->_actor12._position.x, scene->_actor12._position.y + 1));
- scene->_actor1.setPosition(Common::Point(di, scene->_actor1._position.y));
- scene->_actor2.setPosition(Common::Point(di + 65, scene->_actor1._position.y));
- scene->_actor3.setPosition(Common::Point(di + 130, scene->_actor1._position.y));
- }
- }
+ case 3:
+ setDetails(Rect(225, 142, 263, 161), -1, -1, -1, 2, 1, NULL);
break;
- case 4: {
- int tmpPosY = scene->_actor1._position.y;
- if (tmpPosY > 145) {
- tmpPosY--;
- for (int i = 0; i < 17; ++i)
- scene->_arrActor[i].setPosition(Common::Point(scene->_arrActor[i]._position.x, scene->_arrActor[i]._position.y - 1));
-
- scene->_actor13.setPosition(Common::Point(scene->_actor13._position.x, scene->_actor13._position.y - 1));
- scene->_actor12.setPosition(Common::Point(scene->_actor12._position.x, scene->_actor12._position.y - 1));
- scene->_actor1.setPosition(Common::Point(di, scene->_actor1._position.y));
- scene->_actor2.setPosition(Common::Point(di + 65, scene->_actor1._position.y));
- scene->_actor3.setPosition(Common::Point(di + 130, scene->_actor1._position.y));
- }
- }
+ case 4:
+ setDetails(Rect(188, 122, 226, 140), -1, -1, -1, 2, 1, NULL);
break;
case 5:
- R2_GLOBALS._sceneManager.changeScene(1550);
+ setDetails(Rect(188, 162, 226, 180), -1, -1, -1, 2, 1, NULL);
+ break;
+ case 6:
+ setDetails(Rect(269, 169, 301, 185), -1, -1, -1, 2, 1, NULL);
break;
default:
break;
}
+}
- int j = 0;
- for (int i = 0; i < 17; i++) {
- if (scene->_arrActor[i]._bounds.contains(85, 116))
- j = i;
- }
-
- if (scene->_actor13._bounds.contains(85, 116))
- j = 18;
-
- if (scene->_actor12._bounds.contains(85, 116))
- j = 19;
+/*--------------------------------------------------------------------------*/
- if (j)
- scene->_actor11.show();
- else
- scene->_actor11.hide();
+Scene1575::Scene1575() {
+ _field412 = 0;
+ _field414 = 390;
+ _field416 = 0;
+ _field418 = 0;
+ _field41A = 0;
}
-bool Scene1575::Hotspot1::startAction(CursorType action, Event &event) {
- if (action == CURSOR_USE)
- return false;
- return SceneHotspot::startAction(action, event);
+void Scene1575::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+
+ s.syncAsSint16LE(_field412);
+ s.syncAsSint16LE(_field414);
+ s.syncAsSint16LE(_field416);
+ s.syncAsSint16LE(_field418);
+ s.syncAsSint16LE(_field41A);
}
-void Scene1575::Hotspot1::subA910D(int indx) {
- warning("STUB: Scene1575:Hotspot1::subA910D(%d)", indx);
+// TODO: Remove this method stub with proper sub-method call
+double unk(double v1, double v2) {
+ return sqrt(v1 * v1 + v2 * v2);
}
void Scene1575::postInit(SceneObjectList *OwnerList) {
loadScene(1575);
R2_GLOBALS._uiElements._active = false;
- R2_GLOBALS._v5589E = Rect(0, 0, 320, 200);
SceneExt::postInit();
- _field414 = 390;
+ R2_GLOBALS._interfaceY = SCREEN_HEIGHT;
_actor1.postInit();
_actor1.setup(1575, 1, 1);
@@ -9479,8 +9517,17 @@ void Scene1575::postInit(SceneObjectList *OwnerList) {
for (int i = 0; i < 17; i++) {
_arrActor[i].postInit();
- _arrActor[i].setup(1575, 2, k5A7F6[(3 * i) + 2]);
- warning("TODO: immense pile of floating operations");
+ _arrActor[i].setup(1575, 2, k5A7F6[3 * i + 2]);
+
+ double v1 = unk(2.0, 3 - k5A7F6[3 * i]);
+ v1 += unk(2.0, 3 - k5A7F6[3 * i + 1]);
+ int yp = (int)(sqrt(v1) * 75.0 / 17.0 - 161.0);
+
+ int angle = R2_GLOBALS._gfxManagerInstance.getAngle(
+ Common::Point(3, 16), Common::Point(k5A7F6[3 * i], k5A7F6[3 * i + 1]));
+ int xp = angle * 78 / 9 - 319;
+
+ _arrActor[i].setPosition(Common::Point(xp, yp));
_arrActor[i].fixPriority(6);
}
@@ -9512,12 +9559,13 @@ void Scene1575::postInit(SceneObjectList *OwnerList) {
_actor10.setup(1575, 3, 2);
_actor10.setPosition(Common::Point(287, 91));
- _item1.subA910D(1);
- _item1.subA910D(2);
- _item1.subA910D(3);
- _item1.subA910D(4);
- _item1.subA910D(5);
- _item1.subA910D(6);
+ // Initialise buttons
+ _button1.initButton(1);
+ _button2.initButton(2);
+ _button3.initButton(3);
+ _button4.initButton(4);
+ _button5.initButton(5);
+ _button6.initButton(6);
_actor11.postInit();
_actor11.setup(1575, 4, 2);
@@ -9545,6 +9593,7 @@ void Scene1575::postInit(SceneObjectList *OwnerList) {
_actor13.postInit();
_actor13.setup(1575, 2, 4);
+ // TODO
warning("TODO: another immense pile of floating operations");
_actor12.postInit();
@@ -9684,16 +9733,16 @@ void Scene1580::synchronize(Serializer &s) {
s.syncAsSint16LE(_field412);
}
-bool Scene1580::Hotspot1::startAction(CursorType action, Event &event) {
+bool Scene1580::JoystickPlug::startAction(CursorType action, Event &event) {
Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene;
if (action == R2_JOYSTICK) {
R2_INVENTORY.setObjectScene(R2_JOYSTICK, 1580);
- R2_GLOBALS._sceneItems.remove(&scene->_item1);
- scene->_actor2.postInit();
- scene->_actor2.setup(1580, 1, 4);
- scene->_actor2.setPosition(Common::Point(159, 163));
- scene->_actor2.setDetails(1550, 78, -1, -1, 2, (SceneItem *) NULL);
+ R2_GLOBALS._sceneItems.remove(&scene->_joystickPlug);
+ scene->_joystick.postInit();
+ scene->_joystick.setup(1580, 1, 4);
+ scene->_joystick.setPosition(Common::Point(159, 163));
+ scene->_joystick.setDetails(1550, 78, -1, -1, 2, (SceneItem *) NULL);
scene->_arrActor[5].remove();
@@ -9703,28 +9752,28 @@ bool Scene1580::Hotspot1::startAction(CursorType action, Event &event) {
return SceneHotspot::startAction(action, event);
}
-bool Scene1580::Hotspot2::startAction(CursorType action, Event &event) {
+bool Scene1580::ScreenSlot::startAction(CursorType action, Event &event) {
Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene;
if (action == R2_DIAGNOSTICS_DISPLAY) {
R2_INVENTORY.setObjectScene(R2_DIAGNOSTICS_DISPLAY, 1580);
R2_GLOBALS._player.disableControl();
- R2_GLOBALS._sceneItems.remove(&scene->_item2);
+ R2_GLOBALS._sceneItems.remove(&scene->_screenSlot);
- scene->_actor3.postInit();
- scene->_actor3.setup(1580, 1, 1);
- scene->_actor3.setPosition(Common::Point(124, 108));
- scene->_actor3.fixPriority(10);
+ scene->_screen.postInit();
+ scene->_screen.setup(1580, 1, 1);
+ scene->_screen.setPosition(Common::Point(124, 108));
+ scene->_screen.fixPriority(10);
if (R2_INVENTORY.getObjectScene(R2_JOYSTICK) == 1580)
- scene->_actor3.setDetails(1550, 14, -1, -1, 5, &scene->_actor2);
+ scene->_screen.setDetails(1550, 14, -1, -1, 5, &scene->_joystick);
else
- scene->_actor3.setDetails(1550, 14, -1, -1, 2, (SceneItem *)NULL);
+ scene->_screen.setDetails(1550, 14, -1, -1, 2, (SceneItem *)NULL);
- scene->_actor1.postInit();
- scene->_actor1.setup(1580, 3, 1);
- scene->_actor1.setPosition(Common::Point(124, 109));
- scene->_actor1.fixPriority(20);
+ scene->_screenDisplay.postInit();
+ scene->_screenDisplay.setup(1580, 3, 1);
+ scene->_screenDisplay.setPosition(Common::Point(124, 109));
+ scene->_screenDisplay.fixPriority(20);
scene->_field412 = 1;
scene->_sceneMode = 10;
scene->setAction(&scene->_sequenceManager, scene, 1, &R2_GLOBALS._player, NULL);
@@ -9735,7 +9784,7 @@ bool Scene1580::Hotspot2::startAction(CursorType action, Event &event) {
return SceneHotspot::startAction(action, event);
}
-bool Scene1580::Actor2::startAction(CursorType action, Event &event) {
+bool Scene1580::Joystick::startAction(CursorType action, Event &event) {
if ( (action == CURSOR_USE) && (R2_INVENTORY.getObjectScene(R2_DIAGNOSTICS_DISPLAY) == 1580)
&& (R2_INVENTORY.getObjectScene(R2_FUEL_CELL) == 0) && (R2_INVENTORY.getObjectScene(R2_GUIDANCE_MODULE) == 0)
&& (R2_INVENTORY.getObjectScene(R2_RADAR_MECHANISM) == 0) && (R2_INVENTORY.getObjectScene(R2_GYROSCOPE) == 0)
@@ -9755,13 +9804,13 @@ bool Scene1580::Actor2::startAction(CursorType action, Event &event) {
return SceneActor::startAction(action, event);
}
-bool Scene1580::Actor3::startAction(CursorType action, Event &event) {
+bool Scene1580::Screen::startAction(CursorType action, Event &event) {
if ((action == CURSOR_USE) && (R2_INVENTORY.getObjectScene(R2_BROKEN_DISPLAY) == 1580)) {
Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene;
R2_INVENTORY.setObjectScene(R2_BROKEN_DISPLAY, R2_GLOBALS._player._characterIndex);
- scene->_item2.setDetails(Rect(69, 29, 177, 108), 1550, 82, -1, -1, 2, NULL);
- scene->_actor1.remove();
+ scene->_screenSlot.setDetails(Rect(69, 29, 177, 108), 1550, 82, -1, -1, 2, NULL);
+ scene->_screenDisplay.remove();
remove();
return true;
}
@@ -9769,21 +9818,21 @@ bool Scene1580::Actor3::startAction(CursorType action, Event &event) {
return SceneActor::startAction(action, event);
}
-bool Scene1580::Actor4::startAction(CursorType action, Event &event) {
+bool Scene1580::StorageCompartment::startAction(CursorType action, Event &event) {
if (action != CURSOR_USE)
return SceneActor::startAction(action, event);
Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene;
R2_GLOBALS._player.disableControl();
- R2_GLOBALS._sceneItems.remove(&scene->_actor4);
+ R2_GLOBALS._sceneItems.remove(&scene->_storageCompartment);
scene->_sceneMode = 0;
animate(ANIM_MODE_5, scene);
return true;
}
-bool Scene1580::Actor5::startAction(CursorType action, Event &event) {
+bool Scene1580::HatchButton::startAction(CursorType action, Event &event) {
if (action != CURSOR_USE)
return SceneActor::startAction(action, event);
@@ -9797,7 +9846,7 @@ bool Scene1580::Actor5::startAction(CursorType action, Event &event) {
return true;
}
-bool Scene1580::Actor6::startAction(CursorType action, Event &event) {
+bool Scene1580::ThrusterValve::startAction(CursorType action, Event &event) {
Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene;
switch (action) {
@@ -9829,7 +9878,7 @@ bool Scene1580::Actor6::startAction(CursorType action, Event &event) {
return SceneActor::startAction(action, event);
}
-bool Scene1580::Actor7::startAction(CursorType action, Event &event) {
+bool Scene1580::Ignitor::startAction(CursorType action, Event &event) {
Scene1580 *scene = (Scene1580 *)R2_GLOBALS._sceneManager._scene;
switch (action) {
@@ -9876,89 +9925,90 @@ void Scene1580::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player.disableControl();
if (R2_INVENTORY.getObjectScene(R2_JOYSTICK) == 1580) {
- _actor2.postInit();
- _actor2.setup(1580, 1, 4);
- _actor2.setPosition(Common::Point(159, 163));
- _actor2.setDetails(1550, 78, -1, -1, 1, (SceneItem *) NULL);
+ _joystick.postInit();
+ _joystick.setup(1580, 1, 4);
+ _joystick.setPosition(Common::Point(159, 163));
+ _joystick.setDetails(1550, 78, -1, -1, 1, (SceneItem *) NULL);
} else {
- _item1.setDetails(Rect(141, 148, 179, 167), 1550, 79, -1, -1, 1, NULL);
+ _joystickPlug.setDetails(Rect(141, 148, 179, 167), 1550, 79, -1, -1, 1, NULL);
}
if (R2_INVENTORY.getObjectScene(R2_BROKEN_DISPLAY) == 1580) {
- _actor3.postInit();
- _actor3.setup(1580, 1, 1);
- _actor3.setPosition(Common::Point(124, 108));
- _actor3.fixPriority(10);
- _actor3.setDetails(1550, 13, -1, -1, 1, (SceneItem *) NULL);
-
- _actor1.postInit();
- _actor1.setup(1580, 1, 3);
- _actor1.setPosition(Common::Point(124, 96));
- _actor1.fixPriority(20);
+ _screen.postInit();
+ _screen.setup(1580, 1, 1);
+ _screen.setPosition(Common::Point(124, 108));
+ _screen.fixPriority(10);
+ _screen.setDetails(1550, 13, -1, -1, 1, (SceneItem *) NULL);
+
+ _screenDisplay.postInit();
+ _screenDisplay.setup(1580, 1, 3);
+ _screenDisplay.setPosition(Common::Point(124, 96));
+ _screenDisplay.fixPriority(20);
} else if (R2_INVENTORY.getObjectScene(R2_DIAGNOSTICS_DISPLAY) == 1580) {
- _actor3.postInit();
- _actor3.setup(1580, 1, 1);
- _actor3.setPosition(Common::Point(124, 108));
- _actor3.fixPriority(10);
- _actor3.setDetails(1550, 14, -1, -1, 1, (SceneItem *) NULL);
-
- _actor1.postInit();
- _actor1.setup(1580, 3, 1);
- _actor1.setPosition(Common::Point(124, 109));
- _actor1.fixPriority(20);
+ _screen.postInit();
+ _screen.setup(1580, 1, 1);
+ _screen.setPosition(Common::Point(124, 108));
+ _screen.fixPriority(10);
+ _screen.setDetails(1550, 14, -1, -1, 1, (SceneItem *) NULL);
+
+ _screenDisplay.postInit();
+ _screenDisplay.setup(1580, 3, 1);
+ _screenDisplay.setPosition(Common::Point(124, 109));
+ _screenDisplay.fixPriority(20);
+ _screenDisplay.setZoom(200);
_sceneMode = 10;
} else {
- _item2.setDetails(Rect(69, 29, 177, 108), 1550, 82, -1, -1, 1, NULL);
+ _screenSlot.setDetails(Rect(69, 29, 177, 108), 1550, 82, -1, -1, 1, NULL);
}
- _actor4.postInit();
+ _storageCompartment.postInit();
if (R2_GLOBALS.getFlag(58) == 0) {
- _actor4.setup(1580, 5, 1);
- _actor4.setDetails(1550, 80, -1, -1, 1, (SceneItem *) NULL);
+ _storageCompartment.setup(1580, 5, 1);
+ _storageCompartment.setDetails(1550, 80, -1, -1, 1, (SceneItem *) NULL);
} else {
- _actor4.setup(1580, 5, 6);
+ _storageCompartment.setup(1580, 5, 6);
}
- _actor4.setPosition(Common::Point(216, 108));
- _actor4.fixPriority(100);
+ _storageCompartment.setPosition(Common::Point(216, 108));
+ _storageCompartment.fixPriority(100);
- _actor5.postInit();
- _actor5.setup(1580, 4, 1);
- _actor5.setPosition(Common::Point(291, 147));
- _actor5.fixPriority(100);
- _actor5.setDetails(1550, 81, -1, -1, 1, (SceneItem *) NULL);
+ _hatchButton.postInit();
+ _hatchButton.setup(1580, 4, 1);
+ _hatchButton.setPosition(Common::Point(291, 147));
+ _hatchButton.fixPriority(100);
+ _hatchButton.setDetails(1550, 81, -1, -1, 1, (SceneItem *) NULL);
if (R2_INVENTORY.getObjectScene(R2_THRUSTER_VALVE) == 1580) {
- _actor6.postInit();
- _actor6.setup(1580, 6, 2);
- _actor6.setPosition(Common::Point(222, 108));
- _actor6.fixPriority(50);
- _actor6.setDetails(1550, 32, -1, 34, 1, (SceneItem *) NULL);
+ _thrusterValve.postInit();
+ _thrusterValve.setup(1580, 6, 2);
+ _thrusterValve.setPosition(Common::Point(222, 108));
+ _thrusterValve.fixPriority(50);
+ _thrusterValve.setDetails(1550, 32, -1, 34, 1, (SceneItem *) NULL);
}
if (R2_INVENTORY.getObjectScene(R2_IGNITOR) == 1580) {
- _actor7.postInit();
- _actor7.setup(1580, 6, 1);
- _actor7.setPosition(Common::Point(195, 108));
- _actor7.fixPriority(50);
- _actor7.setDetails(1550, 38, -1, 34, 1, (SceneItem *) NULL);
+ _ignitor.postInit();
+ _ignitor.setup(1580, 6, 1);
+ _ignitor.setPosition(Common::Point(195, 108));
+ _ignitor.fixPriority(50);
+ _ignitor.setDetails(1550, 38, -1, 34, 1, (SceneItem *) NULL);
}
R2_GLOBALS._player.postInit();
R2_GLOBALS._player.hide();
setAction(&_sequenceManager, this, 1, &R2_GLOBALS._player, NULL);
- _item3.setDetails(Rect(0, 0, 320, 200), 1550, 50, -1, -1, 1, NULL);
+ _background.setDetails(Rect(0, 0, 320, 200), 1550, 50, -1, -1, 1, NULL);
}
void Scene1580::signal() {
switch (_sceneMode++) {
case 10:
- _actor1.animate(ANIM_MODE_5, this);
+ _screenDisplay.animate(ANIM_MODE_5, this);
break;
case 11:
- _actor1.setup(1580, 1, 2);
- _actor1.setPosition(Common::Point(124, 94));
+ _screenDisplay.setup(1580, 1, 2);
+ _screenDisplay.setPosition(Common::Point(124, 94));
if (R2_INVENTORY.getObjectScene(R2_GYROSCOPE) != 0) {
_arrActor[0].postInit();
@@ -10037,8 +10087,8 @@ bool Scene1625::Wire::startAction(CursorType action, Event &event) {
R2_GLOBALS._player.disableControl();
scene->_sceneMode = 1631;
- scene->_actor3.postInit();
- scene->setAction(&scene->_sequenceManager, scene, 1631, &scene->_actor3, &scene->_wire, NULL);
+ scene->_mirandaMouth.postInit();
+ scene->setAction(&scene->_sequenceManager, scene, 1631, &scene->_mirandaMouth, &scene->_wire, NULL);
return true;
}
@@ -10069,10 +10119,10 @@ void Scene1625::postInit(SceneObjectList *OwnerList) {
_wire.setPosition(Common::Point(206, 133));
_wire.setDetails(1625, 0, -1, -1, 1, (SceneItem *) NULL);
- _actor5.postInit();
- _actor5.setup(1625, 8, 1);
- _actor5.setPosition(Common::Point(190, 131));
- _actor5.setDetails(1625, 6, -1, 2, 1, (SceneItem *) NULL);
+ _wristRestraints.postInit();
+ _wristRestraints.setup(1625, 8, 1);
+ _wristRestraints.setPosition(Common::Point(190, 131));
+ _wristRestraints.setDetails(1625, 6, -1, 2, 1, (SceneItem *) NULL);
if (R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] == 1625) {
if (!R2_GLOBALS.getFlag(83)) {
@@ -10084,18 +10134,18 @@ void Scene1625::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player.enableControl();
R2_GLOBALS._player._canWalk = false;
} else {
- _actor1.postInit();
- _actor1.fixPriority(10);
+ _teal.postInit();
+ _teal.fixPriority(10);
- _actor6.postInit();
+ _tealRightArm.postInit();
R2_GLOBALS._player.disableControl();
_sceneMode = 1625;
- setAction(&_sequenceManager, this, 1625, &_actor1, &_actor6, NULL);
+ setAction(&_sequenceManager, this, 1625, &_teal, &_tealRightArm, NULL);
}
R2_GLOBALS._sound1.play(245);
- _item1.setDetails(Rect(0, 0, 320, 200), 1625, 12, -1, -1, 1, NULL);
+ _background.setDetails(Rect(0, 0, 320, 200), 1625, 12, -1, -1, 1, NULL);
R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] = 1625;
R2_GLOBALS._player._characterScene[R2_MIRANDA] = 1625;
}
@@ -10130,11 +10180,11 @@ void Scene1625::signal() {
switch (_stripManager._exitMode) {
case 1:
_sceneMode = 1627;
- setAction(&_sequenceManager, this, 1627, &_actor3, &_glass, NULL);
+ setAction(&_sequenceManager, this, 1627, &_mirandaMouth, &_glass, NULL);
break;
case 2:
_sceneMode = 1629;
- setAction(&_sequenceManager, this, 1629, &_tealHead, &_actor5, NULL);
+ setAction(&_sequenceManager, this, 1629, &_tealHead, &_wristRestraints, NULL);
break;
case 4:
R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] = 3150;
@@ -10145,7 +10195,7 @@ void Scene1625::signal() {
case 5:
_sceneMode = 1628;
_tealHead.remove();
- setAction(&_sequenceManager, this, 1628, &_actor3, &_glass, NULL);
+ setAction(&_sequenceManager, this, 1628, &_mirandaMouth, &_glass, NULL);
break;
case 6:
_glass.postInit();
@@ -10159,20 +10209,20 @@ void Scene1625::signal() {
break;
case 8:
_sceneMode = 1635;
- setAction(&_sequenceManager, this, 1635, &_actor3, &_actor5, NULL);
+ setAction(&_sequenceManager, this, 1635, &_mirandaMouth, &_wristRestraints, NULL);
break;
case 9:
_glass.postInit();
_glass.setDetails(1625, -1, -1, -1, 2, (SceneItem *) NULL);
_sceneMode = 1634;
- setAction(&_sequenceManager, this, 1634, &_actor3, &_actor5, NULL);
+ setAction(&_sequenceManager, this, 1634, &_mirandaMouth, &_wristRestraints, NULL);
break;
case 3:
// No break on purpose
default:
_sceneMode = 1630;
_tealHead.remove();
- setAction(&_sequenceManager, this, 1630, &_actor1, &_actor6, NULL);
+ setAction(&_sequenceManager, this, 1630, &_teal, &_tealRightArm, NULL);
break;
}
_field412 = _stripManager._field2E8;
@@ -10191,18 +10241,18 @@ void Scene1625::signal() {
_tealHead.setPosition(Common::Point(68, 68));
_tealHead.show();
- _actor3.postInit();
- _actor3.setup(1627, 3, 1);
- _actor3.setPosition(Common::Point(196, 65));
+ _mirandaMouth.postInit();
+ _mirandaMouth.setup(1627, 3, 1);
+ _mirandaMouth.setPosition(Common::Point(196, 65));
_sceneMode = 99;
R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
_stripManager.start(832, this);
break;
case 1627:
- _actor3.setup(1627, 3, 1);
- _actor3.setPosition(Common::Point(196, 65));
- _actor3.show();
+ _mirandaMouth.setup(1627, 3, 1);
+ _mirandaMouth.setPosition(Common::Point(196, 65));
+ _mirandaMouth.show();
_sceneMode = 99;
R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
@@ -10214,9 +10264,9 @@ void Scene1625::signal() {
_tealHead.setup(1627, 1, 1);
_tealHead.setPosition(Common::Point(68, 68));
- _actor3.setup(1627, 3, 1);
- _actor3.setPosition(Common::Point(196, 65));
- _actor3.show();
+ _mirandaMouth.setup(1627, 3, 1);
+ _mirandaMouth.setPosition(Common::Point(196, 65));
+ _mirandaMouth.show();
_sceneMode = 99;
R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
@@ -10236,21 +10286,21 @@ void Scene1625::signal() {
R2_GLOBALS._player._canWalk = true;
break;
case 1631:
- _actor3.setup(1627, 3, 1);
- _actor3.setPosition(Common::Point(196, 65));
- _actor3.show();
+ _mirandaMouth.setup(1627, 3, 1);
+ _mirandaMouth.setPosition(Common::Point(196, 65));
+ _mirandaMouth.show();
_wire.remove();
- _actor1.postInit();
- _actor1.fixPriority(10);
+ _teal.postInit();
+ _teal.fixPriority(10);
- _actor6.postInit();
+ _tealRightArm.postInit();
R2_INVENTORY.setObjectScene(R2_SUPERCONDUCTOR_WIRE, 3);
_sceneMode = 14;
- setAction(&_sequenceManager, this, 1625, &_actor1, &_actor6, NULL);
+ setAction(&_sequenceManager, this, 1625, &_teal, &_tealRightArm, NULL);
break;
case 1632:
_tealHead.setup(1627, 1, 1);
@@ -10273,9 +10323,9 @@ void Scene1625::signal() {
_stripManager.start(836, this);
break;
case 1635:
- _actor3.setup(1627, 3, 1);
- _actor3.setPosition(Common::Point(196, 65));
- _actor3.show();
+ _mirandaMouth.setup(1627, 3, 1);
+ _mirandaMouth.setPosition(Common::Point(196, 65));
+ _mirandaMouth.show();
_sceneMode = 99;
R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
@@ -10732,7 +10782,6 @@ void Scene1700::signal() {
_stripManager.start(541, this);
break;
case 31:
- R2_GLOBALS._v56AAB = 0;
R2_GLOBALS._player.enableControl(CURSOR_TALK);
break;
case 40:
@@ -10915,6 +10964,8 @@ Scene1750::Scene1750() {
_field419 = 0;
_field41B = 0;
_field41D = 0;
+
+ _rotation = nullptr;
}
void Scene1750::synchronize(Serializer &s) {
@@ -11348,7 +11399,7 @@ void Scene1800::postInit(SceneObjectList *OwnerList) {
_locationMode = 0;
scalePalette(65, 65, 65);
- _exit1.setDetails(Rect(0, 160, 319, 168), EXITCURSOR_S, 1800);
+ _southExit.setDetails(Rect(0, 160, 319, 168), EXITCURSOR_S, 1800);
_background.setDetails(Rect(0, 0, 320, 200), -1, -1, -1, -1, 1, NULL);
_lever.postInit();
@@ -11468,29 +11519,29 @@ void Scene1800::postInit(SceneObjectList *OwnerList) {
}
}
- _actor1.postInit();
- _actor1.fixPriority(10);
+ _playerShadow.postInit();
+ _playerShadow.fixPriority(10);
if (R2_GLOBALS._player._characterIndex == R2_QUINN)
- _actor1.setVisage(1111);
+ _playerShadow.setVisage(1111);
else
- _actor1.setVisage(1110);
+ _playerShadow.setVisage(1110);
- _actor1._effect = 5;
- _actor1._field9C = _field312;
+ _playerShadow._effect = 5;
+ _playerShadow._field9C = _field312;
- R2_GLOBALS._player._linkedActor = &_actor1;
+ R2_GLOBALS._player._linkedActor = &_playerShadow;
- _actor3.postInit();
- _actor3.fixPriority(10);
+ _companionShadow.postInit();
+ _companionShadow.fixPriority(10);
if (R2_GLOBALS._player._characterIndex == R2_QUINN)
- _actor3.setVisage(1110);
+ _companionShadow.setVisage(1110);
else
- _actor3.setVisage(1111);
+ _companionShadow.setVisage(1111);
- _actor3._effect = 5;
- _actor3._field9C = _field312;
+ _companionShadow._effect = 5;
+ _companionShadow._field9C = _field312;
- _companion._linkedActor = &_actor3;
+ _companion._linkedActor = &_companionShadow;
R2_GLOBALS._player._characterScene[R2_QUINN] = 1800;
R2_GLOBALS._player._characterScene[R2_SEEKER] = 1800;
@@ -11501,7 +11552,7 @@ void Scene1800::postInit(SceneObjectList *OwnerList) {
// Original was calling _item3.setDetails(Rect(1800, 11, 24, 23), 25, -1, -1, -1, 1, NULL);
// This is *wrong*. The following statement is a wild guess based on good common sense
_item3.setDetails(11, 1800, 23, 24, 25);
- _item4.setDetails(Rect(0, 0, 320, 200), 1800, 17, -1, 19, 1, NULL);
+ _secBackground.setDetails(Rect(0, 0, 320, 200), 1800, 17, -1, 19, 1, NULL);
R2_GLOBALS._player.disableControl();
if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 1800) {
@@ -11732,9 +11783,9 @@ bool Scene1850::Robot::startAction(CursorType action, Event &event) {
break;
case CURSOR_LOOK:
if (R2_GLOBALS.getFlag(34))
- SceneItem::display(1850, 2, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1850, 2, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
else
- SceneItem::display(1850, 1, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1850, 1, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
return true;
break;
@@ -11799,7 +11850,7 @@ bool Scene1850::Actor6::startAction(CursorType action, Event &event) {
Scene1850 *scene = (Scene1850 *)R2_GLOBALS._sceneManager._scene;
if (R2_GLOBALS.getFlag(32)) {
- SceneItem::display(3240, 4, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(3240, 4, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
return true;
}
@@ -12788,23 +12839,23 @@ void Scene1900::postInit(SceneObjectList *OwnerList) {
_rightDoor.setDetails(1900, 0, 1, -1, 1, (SceneItem *) NULL);
if (R2_GLOBALS._sceneManager._previousScene != 1875) {
- _object1.postInit();
- _object1.setup(1945, 6, 1);
- _object1.setPosition(Common::Point(96, 109));
- _object1.fixPriority(80);
+ _leftDoorFrame.postInit();
+ _leftDoorFrame.setup(1945, 6, 1);
+ _leftDoorFrame.setPosition(Common::Point(96, 109));
+ _leftDoorFrame.fixPriority(80);
- _object2.postInit();
- _object2.setup(1945, 6, 2);
- _object2.setPosition(Common::Point(223, 109));
- _object2.fixPriority(80);
+ _rightDoorFrame.postInit();
+ _rightDoorFrame.setup(1945, 6, 2);
+ _rightDoorFrame.setPosition(Common::Point(223, 109));
+ _rightDoorFrame.fixPriority(80);
}
if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 1875) {
R2_GLOBALS._player._characterIndex = R2_QUINN;
- _actor1.postInit();
+ _companion.postInit();
_sceneMode = 20;
R2_GLOBALS._player.setAction(&_sequenceManager1, NULL, 1901, &R2_GLOBALS._player, &_leftDoor, NULL);
- _actor1.setAction(&_sequenceManager2, this, 1900, &_actor1, &_rightDoor, NULL);
+ _companion.setAction(&_sequenceManager2, this, 1900, &_companion, &_rightDoor, NULL);
} else if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 1925) {
if (R2_GLOBALS.getFlag(29)) {
R2_GLOBALS.clearFlag(29);
@@ -12823,24 +12874,24 @@ void Scene1900::postInit(SceneObjectList *OwnerList) {
}
if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) {
- _actor1.postInit();
- _actor1.setPosition(Common::Point(30, 110));
+ _companion.postInit();
+ _companion.setPosition(Common::Point(30, 110));
R2_GLOBALS._walkRegions.disableRegion(1);
- _actor1.setup(2008, 3, 1);
- _actor1.setDetails(9001, 0, -1, -1, 1, (SceneItem *) NULL);
+ _companion.setup(2008, 3, 1);
+ _companion.setDetails(9001, 0, -1, -1, 1, (SceneItem *) NULL);
}
R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 1900;
} else {
if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) {
- _actor1.postInit();
- _actor1.setPosition(Common::Point(30, 110));
+ _companion.postInit();
+ _companion.setPosition(Common::Point(30, 110));
R2_GLOBALS._walkRegions.disableRegion(1);
if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
- _actor1.setup(20, 3, 1);
- _actor1.setDetails(9002, 1, -1, -1, 1, (SceneItem *) NULL);
+ _companion.setup(20, 3, 1);
+ _companion.setDetails(9002, 1, -1, -1, 1, (SceneItem *) NULL);
} else {
- _actor1.setup(2008, 3, 1);
- _actor1.setDetails(9001, 0, -1, -1, 1, (SceneItem *) NULL);
+ _companion.setup(2008, 3, 1);
+ _companion.setDetails(9001, 0, -1, -1, 1, (SceneItem *) NULL);
}
}
@@ -12903,7 +12954,7 @@ void Scene1900::signal() {
break;
case 22:
_sceneMode = 1910;
- _actor1.setAction(&_sequenceManager2, this, 1910, &_actor1, NULL);
+ _companion.setAction(&_sequenceManager2, this, 1910, &_companion, NULL);
break;
case 1904:
R2_GLOBALS._scene1925CurrLevel = -3;
@@ -12934,7 +12985,7 @@ void Scene1900::signal() {
*--------------------------------------------------------------------------*/
Scene1925::Scene1925() {
- _field9B8 = 0;
+ _newSceneMode = 0;
for (int i = 0; i < 5; i++)
_levelResNum[i] = 0;
}
@@ -12942,7 +12993,7 @@ Scene1925::Scene1925() {
void Scene1925::synchronize(Serializer &s) {
SceneExt::synchronize(s);
- s.syncAsSint16LE(_field9B8);
+ s.syncAsSint16LE(_newSceneMode);
for (int i = 0; i < 5; i++)
s.syncAsSint16LE(_levelResNum[i]);
}
@@ -12964,7 +13015,8 @@ bool Scene1925::Button::startAction(CursorType action, Event &event) {
scene->_sceneMode = 1930;
R2_GLOBALS._player.disableControl(CURSOR_WALK);
- scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player,
+ &scene->_door, NULL);
return true;
}
@@ -12978,9 +13030,10 @@ bool Scene1925::Ladder::startAction(CursorType action, Event &event) {
scene->_sceneMode = 0;
if ((R2_GLOBALS._player._position.x == 110) && (R2_GLOBALS._player._position.y == 100)) {
- scene->_exit3._enabled = false;
+ scene->_westExit._enabled = false;
scene->_sceneMode = 1925;
- scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode,
+ &R2_GLOBALS._player, &scene->_door, NULL);
return true;
}
@@ -13015,10 +13068,11 @@ void Scene1925::ExitUp::changeScene() {
scene->_sceneMode = 0;
if ((R2_GLOBALS._player._position.x == 110) && (R2_GLOBALS._player._position.y == 100)) {
- scene->_exit3._enabled = false;
- scene->_field9B8 = 1927;
+ scene->_westExit._enabled = false;
+ scene->_newSceneMode = 1927;
scene->_sceneMode = 1925;
- scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode,
+ &R2_GLOBALS._player, &scene->_door, NULL);
return;
}
@@ -13037,7 +13091,7 @@ void Scene1925::ExitUp::changeScene() {
}
}
-void Scene1925::Exit2::changeScene() {
+void Scene1925::ExitDown::changeScene() {
Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene;
_moving = false;
@@ -13045,10 +13099,11 @@ void Scene1925::Exit2::changeScene() {
scene->_sceneMode = 0;
if ((R2_GLOBALS._player._position.x == 110) && (R2_GLOBALS._player._position.y == 100)) {
- scene->_exit3._enabled = false;
- scene->_field9B8 = 1926;
+ scene->_westExit._enabled = false;
+ scene->_newSceneMode = 1926;
scene->_sceneMode = 1925;
- scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, &scene->_actor1, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode,
+ &R2_GLOBALS._player, &scene->_door, NULL);
return;
}
@@ -13066,7 +13121,7 @@ void Scene1925::Exit2::changeScene() {
scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL);
}
-void Scene1925::Exit3::changeScene() {
+void Scene1925::WestExit::changeScene() {
Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene;
_moving = false;
@@ -13075,7 +13130,7 @@ void Scene1925::Exit3::changeScene() {
scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &R2_GLOBALS._player, NULL);
}
-void Scene1925::Exit4::changeScene() {
+void Scene1925::EastExit::changeScene() {
Scene1925 *scene = (Scene1925 *)R2_GLOBALS._sceneManager._scene;
_moving = false;
@@ -13106,8 +13161,8 @@ void Scene1925::changeLevel(bool upFlag) {
case 3:
loadScene(_levelResNum[4]);
_button.setDetails(Rect(133, 68, 140, 77), 1925, 3, -1, 5, 2, NULL);
- _actor1.setDetails(1925, 0, 1, 2, 2, (SceneItem *) NULL);
- _actor1.show();
+ _door.setDetails(1925, 0, 1, 2, 2, (SceneItem *) NULL);
+ _door.show();
break;
case 512:
R2_GLOBALS._scene1925CurrLevel = 508;
@@ -13115,8 +13170,8 @@ void Scene1925::changeLevel(bool upFlag) {
default:
loadScene(_levelResNum[(R2_GLOBALS._scene1925CurrLevel % 4)]);
R2_GLOBALS._sceneItems.remove(&_button);
- R2_GLOBALS._sceneItems.remove(&_actor1);
- _actor1.hide();
+ R2_GLOBALS._sceneItems.remove(&_door);
+ _door.hide();
break;
}
@@ -13146,32 +13201,33 @@ void Scene1925::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player.disableControl();
R2_GLOBALS._player._characterScene[R2_SEEKER] = 1925;
R2_GLOBALS._player._characterIndex = R2_SEEKER;
+
switch (R2_GLOBALS._scene1925CurrLevel) {
case -2:
- _exit4.setDetails(Rect(203, 44, 247, 111), EXITCURSOR_E, 1925);
+ _eastExit.setDetails(Rect(203, 44, 247, 111), EXITCURSOR_E, 1925);
_ladder.setDetails(Rect(31, 3, 45, 167), 1925, 6, -1, 8, 1, NULL);
break;
case 3:
- _actor1.setDetails(1925, 0, 1, 2, 1, (SceneItem *) NULL);
+ _door.setDetails(1925, 0, 1, 2, 1, (SceneItem *) NULL);
_button.setDetails(Rect(133, 68, 140, 77), 1925, 3, -1, 5, 1, NULL);
// No break on purpose
case -3:
- _exit3.setDetails(Rect(83, 38, 128, 101), EXITCURSOR_W, 1925);
+ _westExit.setDetails(Rect(83, 38, 128, 101), EXITCURSOR_W, 1925);
// No break on purpose
default:
_exitUp.setDetails(Rect(128, 0, 186, 10), EXITCURSOR_N, 1925);
- _exit2.setDetails(Rect(128, 160, 190, 167), EXITCURSOR_S, 1925);
+ _exitDown.setDetails(Rect(128, 160, 190, 167), EXITCURSOR_S, 1925);
_ladder.setDetails(Rect(141, 11, 167, 159), 1925, 6, -1, -1, 1, NULL);
break;
}
- _actor1.postInit();
- _actor1.setup(1925, 5, 1);
- _actor1.setPosition(Common::Point(128, 35));
- _actor1.hide();
+ _door.postInit();
+ _door.setup(1925, 5, 1);
+ _door.setPosition(Common::Point(128, 35));
+ _door.hide();
if (R2_GLOBALS._scene1925CurrLevel == 3)
- _actor1.show();
+ _door.show();
R2_GLOBALS._player.enableControl(CURSOR_USE);
switch (R2_GLOBALS._scene1925CurrLevel) {
@@ -13181,7 +13237,7 @@ void Scene1925::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player.setPosition(Common::Point(224, 109));
break;
case -3:
- _actor1.hide();
+ _door.hide();
R2_GLOBALS._player.setup(20, 5, 1);
R2_GLOBALS._player.setPosition(Common::Point(110, 100));
break;
@@ -13196,9 +13252,9 @@ void Scene1925::postInit(SceneObjectList *OwnerList) {
}
R2_GLOBALS._player._canWalk = false;
- _field9B8 = 0;
+ _newSceneMode = 0;
R2_GLOBALS._sceneManager._previousScene = 1925;
- _item1.setDetails(Rect(27, 0, 292, 200), 1925, 9, -1, -1, 1, NULL);
+ _background.setDetails(Rect(27, 0, 292, 200), 1925, 9, -1, -1, 1, NULL);
}
void Scene1925::remove() {
@@ -13234,10 +13290,10 @@ void Scene1925::signal() {
changeLevel(true);
break;
case 1925:
- _exit3._enabled = false;
- if (_field9B8 != 0) {
- _sceneMode = _field9B8;
- _field9B8 = 0;
+ _westExit._enabled = false;
+ if (_newSceneMode != 0) {
+ _sceneMode = _newSceneMode;
+ _newSceneMode = 0;
setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL);
}
// No break on purpose
@@ -13432,14 +13488,14 @@ void Scene1945::postInit(SceneObjectList *OwnerList) {
else
_gunpowder.hide();
- _actor1.postInit();
- _actor1.setup(1945, 8, 1);
- _actor1.setPosition(Common::Point(253, 169));
- _actor1.fixPriority(130);
+ _coveringIce.postInit();
+ _coveringIce.setup(1945, 8, 1);
+ _coveringIce.setPosition(Common::Point(253, 169));
+ _coveringIce.fixPriority(130);
- _actor2.postInit();
- _actor2.setup(1945, 3, 1);
- _actor2.hide();
+ _alcoholLamp.postInit();
+ _alcoholLamp.setup(1945, 3, 1);
+ _alcoholLamp.hide();
} else {
_corridorExit._enabled = true;
}
@@ -13468,8 +13524,8 @@ void Scene1945::postInit(SceneObjectList *OwnerList) {
_nextSceneMode2 = 0;
_ice.setDetails(11, 1945, 3, -1, 5);
- _item1.setDetails(Rect(238, 144, 274, 167), 1945, 0, -1, 2, 1, NULL);
- _item2.setDetails(Rect(27, 3, 292, 167), 1945, 3, -1, -1, 1, NULL);
+ _hole.setDetails(Rect(238, 144, 274, 167), 1945, 0, -1, 2, 1, NULL);
+ _ice2.setDetails(Rect(27, 3, 292, 167), 1945, 3, -1, -1, 1, NULL);
}
void Scene1945::remove() {
@@ -13482,7 +13538,7 @@ void Scene1945::signal() {
case 1940:
if (_nextSceneMode1 == 1943) {
_sceneMode = _nextSceneMode1;
- setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, &_actor2, NULL);
+ setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, &_alcoholLamp, NULL);
} else {
_sceneMode = 1946;
setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, NULL);
@@ -13509,7 +13565,7 @@ void Scene1945::signal() {
R2_GLOBALS._sound1.fadeOut2(NULL);
R2_INVENTORY.setObjectScene(_lampUsed, 0);
_sceneMode = 1948;
- setAction(&_sequenceManager1, this, _sceneMode, &_gunpowder, &_actor2, &_actor1, NULL);
+ setAction(&_sequenceManager1, this, _sceneMode, &_gunpowder, &_alcoholLamp, &_coveringIce, NULL);
R2_GLOBALS._player.setAction(&_sequenceManager2, NULL, 1941, &R2_GLOBALS._player, NULL);
return;
case 1944:
@@ -13529,7 +13585,7 @@ void Scene1945::signal() {
if (_nextSceneMode1 == 1943) {
_sceneMode = _nextSceneMode1;
_nextSceneMode1 = 1948;
- setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, &_actor2, NULL);
+ setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, &_alcoholLamp, NULL);
} else {
_sceneMode = 1941;
setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, NULL);
@@ -13548,7 +13604,7 @@ void Scene1945::signal() {
if (_nextSceneMode2 == 1943) {
_nextSceneMode1 = _nextSceneMode2;
_nextSceneMode2 = 0;
- setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, &_actor2, NULL);
+ setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, &_alcoholLamp, NULL);
} else {
_nextSceneMode1 = 0;
setAction(&_sequenceManager1, this, _sceneMode, &R2_GLOBALS._player, NULL);
@@ -13662,24 +13718,24 @@ void Scene1950::KeypadWindow::remove() {
}
}
-void Scene1950::KeypadWindow::proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY) {
+void Scene1950::KeypadWindow::setup2(int visage, int stripFrameNum, int frameNum, int posX, int posY) {
Scene1950 *scene = (Scene1950 *)R2_GLOBALS._sceneManager._scene;
if (R2_GLOBALS._player._mover)
R2_GLOBALS._player.addMover(NULL);
R2_GLOBALS._player._canWalk = false;
- ModalWindow::proc12(visage, stripFrameNum, frameNum, posX, posY);
+ ModalWindow::setup2(visage, stripFrameNum, frameNum, posX, posY);
_object1.fixPriority(248);
scene->_eastExit._enabled = false;
- proc13(1950, 27, 28, 27);
+ setup3(1950, 27, 28, 27);
for (_buttonIndex = 0; _buttonIndex < 16; _buttonIndex++)
_buttons[_buttonIndex].init(_buttonIndex);
}
-void Scene1950::KeypadWindow::proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum) {
+void Scene1950::KeypadWindow::setup3(int resNum, int lookLineNum, int talkLineNum, int useLineNum) {
// Copy of Scene1200::LaserPanel::proc13()
_areaActor.setDetails(resNum, lookLineNum, talkLineNum, useLineNum, 2, (SceneItem *) NULL);
}
@@ -13777,7 +13833,7 @@ void Scene1950::Vampire::signal() {
setStrip(1);
NpcMover *mover = new NpcMover();
- addMover(mover, &scene->_field418, scene);
+ addMover(mover, &scene->_vampireDestPos, scene);
}
break;
case 20: {
@@ -13864,14 +13920,14 @@ void Scene1950::Vampire::signal() {
else
scene->_westExit._enabled = true;
- scene->_field416 = 0;
+ scene->_vampireActive = false;
break;
case 22:
- SceneItem::display(1950, 18, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1950, 18, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
R2_GLOBALS._player.enableControl(CURSOR_WALK);
break;
case 23:
- SceneItem::display(1950, 25, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1950, 25, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
scene->_sceneMode = R2_GLOBALS._flubMazeEntryDirection;
scene->setAction(&scene->_sequenceManager, scene, 1960, &R2_GLOBALS._player, NULL);
break;
@@ -13928,7 +13984,7 @@ void Scene1950::UpExit::changeScene() {
R2_GLOBALS._flubMazeEntryDirection = 2;
scene->_sceneMode = 12;
- if (scene->_field412 == 0) {
+ if (!scene->_upExitStyle) {
if (R2_GLOBALS.getFlag(36))
scene->setAction(&scene->_sequenceManager, scene, 1953, &R2_GLOBALS._player, NULL);
else
@@ -13949,7 +14005,7 @@ void Scene1950::EastExit::changeScene() {
R2_GLOBALS._flubMazeEntryDirection = 3;
scene->_sceneMode = 13;
- if (scene->_field416 != 0)
+ if (scene->_vampireActive)
R2_GLOBALS._player.animate(ANIM_MODE_9);
Common::Point pt(340, 160);
@@ -14000,16 +14056,16 @@ void Scene1950::WestExit::changeScene() {
R2_GLOBALS._player.addMover(mover, &pt, scene);
} else {
if (!R2_GLOBALS.getFlag(36))
- SceneItem::display(1950, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1950, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
if ((R2_INVENTORY.getObjectScene(R2_SAPPHIRE_BLUE) == 1950) || (R2_INVENTORY.getObjectScene(R2_ANCIENT_SCROLLS) == 1950))
- SceneItem::display(1950, 34, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1950, 34, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
scene->_sceneMode = 0;
Common::Point pt(30, 160);
NpcMover *mover = new NpcMover();
R2_GLOBALS._player.addMover(mover, &pt, scene);
}
} else {
- if (scene->_field416 != 0)
+ if (scene->_vampireActive)
R2_GLOBALS._player.animate(ANIM_MODE_9);
scene->_sceneMode = 16;
@@ -14039,7 +14095,7 @@ void Scene1950::DoorExit::changeScene() {
scene->_sceneMode = 1975;
scene->setAction(&scene->_sequenceManager, scene, 1975, &R2_GLOBALS._player, NULL);
} else {
- SceneItem::display(1950, 22, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1950, 22, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
R2_GLOBALS._flubMazeEntryDirection = 0;
scene->_sceneMode = 0;
Common::Point pt(250, 150);
@@ -14052,21 +14108,21 @@ void Scene1950::DoorExit::changeScene() {
/*--------------------------------------------------------------------------*/
Scene1950::Scene1950() {
- _field412 = 0;
- _field414 = 0;
- _field416 = 0;
- _field418 = Common::Point(0, 0);
+ _upExitStyle = false;
+ _removeFlag = false;
+ _vampireActive = false;
+ _vampireDestPos = Common::Point(0, 0);
_vampireIndex = 0;
}
void Scene1950::synchronize(Serializer &s) {
SceneExt::synchronize(s);
- s.syncAsSint16LE(_field412);
- s.syncAsSint16LE(_field414);
- s.syncAsSint16LE(_field416);
- s.syncAsSint16LE(_field418.x);
- s.syncAsSint16LE(_field418.y);
+ s.syncAsSint16LE(_upExitStyle);
+ s.syncAsSint16LE(_removeFlag);
+ s.syncAsSint16LE(_vampireActive);
+ s.syncAsSint16LE(_vampireDestPos.x);
+ s.syncAsSint16LE(_vampireDestPos.y);
s.syncAsSint16LE(_vampireIndex);
}
@@ -14095,7 +14151,7 @@ void Scene1950::initArea() {
_westExit._moving = false;
_shaftExit._moving = false;
_doorExit._moving = false;
- _field412 = 0;
+ _upExitStyle = false;
switch (R2_GLOBALS._flubMazeArea - 1) {
case 0:
@@ -14322,7 +14378,7 @@ void Scene1950::initArea() {
// No break on purpose
case 67:
loadScene(1985);
- _field412 = 1;
+ _upExitStyle = true;
break;
default:
break;
@@ -14769,7 +14825,7 @@ void Scene1950::enterArea() {
_door.remove();
_scrolls.remove();
- _field416 = 0;
+ _vampireActive = false;
_vampireIndex = 0;
// Certain areas have a vampire in them
@@ -14855,7 +14911,7 @@ void Scene1950::enterArea() {
_vampire.setPosition(Common::Point(160, 130));
_vampire.animate(ANIM_MODE_2, NULL);
_vampire.setDetails(1950, 12, -1, 14, 2, (SceneItem *) NULL);
- _field416 = 1;
+ _vampireActive = true;
}
}
if ((R2_GLOBALS._flubMazeArea == 1) && (R2_INVENTORY.getObjectScene(R2_SCRITH_KEY) != 0)) {
@@ -14885,13 +14941,13 @@ void Scene1950::enterArea() {
_cube.setPosition(Common::Point(193, 158));
_cube.setDetails(1950, 3, 4, 5, 2, (SceneItem *) NULL);
- _actor7.postInit();
- _actor7.setVisage(1970);
- _actor7.setStrip(3);
- _actor7.animate(ANIM_MODE_2, NULL);
- _actor7._numFrames = 6;
- _actor7.setPosition(Common::Point(194, 158));
- _actor7.fixPriority(159);
+ _pulsingLights.postInit();
+ _pulsingLights.setVisage(1970);
+ _pulsingLights.setStrip(3);
+ _pulsingLights.animate(ANIM_MODE_2, NULL);
+ _pulsingLights._numFrames = 6;
+ _pulsingLights.setPosition(Common::Point(194, 158));
+ _pulsingLights.fixPriority(159);
_keypad.setDetails(Rect(188, 124, 199, 133), 1950, 27, 28, -1, 2, NULL);
@@ -14931,12 +14987,12 @@ void Scene1950::enterArea() {
else
_scrolls.setFrame(1);
- _field414 = 1;
- } else if (_field414 != 0) {
+ _removeFlag = true;
+ } else if (_removeFlag) {
_cube.remove();
_containmentField.remove();
_gem.remove();
- _actor7.remove();
+ _pulsingLights.remove();
_scrolls.remove();
R2_GLOBALS._sceneItems.remove(&_background);
@@ -14947,7 +15003,6 @@ void Scene1950::enterArea() {
case 0:
_sceneMode = 1950;
if (R2_INVENTORY.getObjectScene(R2_SCRITH_KEY) == 0) {
- R2_GLOBALS._v56AAB = 0;
R2_GLOBALS._player.enableControl(CURSOR_WALK);
} else {
setAction(&_sequenceManager, this, 1950, &R2_GLOBALS._player, NULL);
@@ -14970,7 +15025,7 @@ void Scene1950::enterArea() {
break;
case 3:
// Entering from the left
- if (_field416 == 0) {
+ if (!_vampireActive) {
_sceneMode = R2_GLOBALS._flubMazeEntryDirection;
R2_GLOBALS._player.setPosition(Common::Point(-20, 160));
Common::Point pt(30, 160);
@@ -14979,14 +15034,13 @@ void Scene1950::enterArea() {
} else {
_sceneMode = 18;
_eastExit._enabled = false;
- _field418 = Common::Point(60, 152);
- R2_GLOBALS._v56AAB = 0;
+ _vampireDestPos = Common::Point(60, 152);
R2_GLOBALS._player.enableControl(CURSOR_USE);
R2_GLOBALS._player._canWalk = false;
_vampire.setStrip(2);
NpcMover *mover = new NpcMover();
- _vampire.addMover(mover, &_field418, this);
+ _vampire.addMover(mover, &_vampireDestPos, this);
R2_GLOBALS._player.setPosition(Common::Point(-20, 160));
Common::Point pt2(30, 160);
@@ -14996,7 +15050,7 @@ void Scene1950::enterArea() {
break;
case 4:
_sceneMode = R2_GLOBALS._flubMazeEntryDirection;
- if (_field412 == 0) {
+ if (!_upExitStyle) {
if (R2_GLOBALS.getFlag(36))
setAction(&_sequenceManager, this, 1955, &R2_GLOBALS._player, NULL);
else
@@ -15018,7 +15072,7 @@ void Scene1950::enterArea() {
break;
case 6:
// Entering from the right
- if (_field416 == 0) {
+ if (!_vampireActive) {
_sceneMode = R2_GLOBALS._flubMazeEntryDirection;
if (R2_GLOBALS._flubMazeArea == 1) {
setAction(&_sequenceManager, this, 1961, &R2_GLOBALS._player, NULL);
@@ -15031,15 +15085,14 @@ void Scene1950::enterArea() {
} else {
_sceneMode = 17;
_westExit._enabled = false;
- _field418 = Common::Point(259, 152);
+ _vampireDestPos = Common::Point(259, 152);
- R2_GLOBALS._v56AAB = 0;
R2_GLOBALS._player.enableControl(CURSOR_USE);
R2_GLOBALS._player._canWalk = false;
_vampire.setStrip(1);
NpcMover *mover = new NpcMover();
- _vampire.addMover(mover, &_field418, this);
+ _vampire.addMover(mover, &_vampireDestPos, this);
R2_GLOBALS._player.setPosition(Common::Point(340, 160));
Common::Point pt2(289, 160);
@@ -15134,9 +15187,9 @@ void Scene1950::doButtonPress(int indx) {
}
void Scene1950::postInit(SceneObjectList *OwnerList) {
- _field412 = 0;
- _field414 = 0;
- _field416 = 0;
+ _upExitStyle = false;
+ _removeFlag = false;
+ _vampireActive = false;
_vampireIndex = 0;
if (R2_GLOBALS._sceneManager._previousScene == 300)
R2_GLOBALS._flubMazeArea = 103;
@@ -15233,7 +15286,7 @@ void Scene1950::signal() {
case 17: {
_sceneMode = 13;
R2_GLOBALS._flubMazeEntryDirection = 3;
- _field416 = 0;
+ _vampireActive = false;
R2_GLOBALS._player.disableControl(CURSOR_WALK);
R2_GLOBALS._player._canWalk = true;
R2_GLOBALS._player.setVisage(22);
@@ -15249,7 +15302,7 @@ void Scene1950::signal() {
case 18: {
_sceneMode = 16;
R2_GLOBALS._flubMazeEntryDirection = 6;
- _field416 = 0;
+ _vampireActive = false;
R2_GLOBALS._player.disableControl(CURSOR_WALK);
R2_GLOBALS._player._canWalk = true;
R2_GLOBALS._player.setVisage(22);
@@ -15273,14 +15326,12 @@ void Scene1950::signal() {
R2_GLOBALS._sceneManager.changeScene(1945);
break;
case 1958:
- SceneItem::display(1950, 24, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
- R2_GLOBALS._v56AAB = 0;
+ SceneItem::display(1950, 24, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
R2_GLOBALS._player.enableControl(CURSOR_WALK);
_doorExit._enabled = true;
break;
case 1959:
R2_INVENTORY.setObjectScene(R2_SOAKED_FACEMASK, 0);
- R2_GLOBALS._v56AAB = 0;
R2_GLOBALS._player.enableControl(CURSOR_WALK);
_doorExit._enabled = true;
break;
@@ -15288,13 +15339,13 @@ void Scene1950::signal() {
// No break on purpose
case 1963:
R2_GLOBALS._player.enableControl();
- _KeypadWindow.proc12(1971, 1, 1, 160, 135);
+ _KeypadWindow.setup2(1971, 1, 1, 160, 135);
break;
case 1964:
// No break on purpose
case 1965:
if (!R2_GLOBALS.getFlag(37)) {
- SceneItem::display(1950, 26, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1950, 26, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
}
R2_GLOBALS._player.enableControl();
break;
@@ -15335,7 +15386,6 @@ void Scene1950::signal() {
R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
break;
default:
- R2_GLOBALS._v56AAB = 0;
R2_GLOBALS._player.enableControl(CURSOR_WALK);
break;
}
diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h
index c0088236b4..a663fbe5bc 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes1.h
+++ b/engines/tsage/ringworld2/ringworld2_scenes1.h
@@ -117,7 +117,7 @@ public:
SceneActor _runningGuy2;
SceneActor _runningGuy3;
BackgroundSceneObject _rightLandslide;
- BackgroundSceneObject _object2;
+ BackgroundSceneObject _purplePlant;
Seeker _seeker;
Trooper _trooper;
Chief _chief;
@@ -386,10 +386,10 @@ public:
class Scene1500 : public SceneExt {
public:
- SceneActor _actor1;
- SceneActor _actor2;
- SceneActor _actor3;
- SceneActor _actor4;
+ SceneActor _starship;
+ SceneActor _starshipShadow;
+ SceneActor _smallShip;
+ SceneActor _smallShipShadow;
SequenceManager _sequenceManager;
virtual void postInit(SceneObjectList *OwnerList = NULL);
@@ -410,9 +410,9 @@ class Scene1530 : public SceneExt {
public:
SpeakerQuinn _quinnSpeaker;
SpeakerSeeker _seekerSpeaker;
- SceneActor _actor1;
- SceneActor _actor2;
- SceneActor _actor3;
+ SceneActor _seeker;
+ SceneActor _leftReactor;
+ SceneActor _rightReactor;
SequenceManager _sequenceManager;
@@ -468,8 +468,8 @@ class Scene1550 : public SceneExt {
virtual void remove();
virtual void process(Event &event);
- virtual void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY);
- virtual void proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum);
+ virtual void setup2(int visage, int stripFrameNum, int frameNum, int posX, int posY);
+ virtual void setup3(int resNum, int lookLineNum, int talkLineNum, int useLineNum);
};
class WorkingShip : public NamedHotspot {
@@ -576,14 +576,14 @@ public:
};
class Scene1575 : public SceneExt {
- class Hotspot1 : public NamedHotspot {
+ class Button : public NamedHotspot {
public:
- int _field34;
- int _field36;
+ int _buttonId;
+ bool _pressed;
- Hotspot1();
+ Button();
void synchronize(Serializer &s);
- void subA910D(int indx);
+ void initButton(int buttonId);
virtual void process(Event &event);
virtual bool startAction(CursorType action, Event &event);
@@ -594,12 +594,12 @@ public:
int _field416;
int _field418;
int _field41A;
- Hotspot1 _item1;
- Hotspot1 _item2;
- Hotspot1 _item3;
- Hotspot1 _item4;
- Hotspot1 _item5;
- Hotspot1 _item6;
+ Button _button1;
+ Button _button2;
+ Button _button3;
+ Button _button4;
+ Button _button5;
+ Button _button6;
SceneActor _actor1;
SceneActor _actor2;
SceneActor _actor3;
@@ -629,54 +629,55 @@ public:
};
class Scene1580 : public SceneExt {
- class Hotspot1 : public NamedHotspot {
+ class JoystickPlug : public NamedHotspot {
public:
virtual bool startAction(CursorType action, Event &event);
};
- class Hotspot2 : public NamedHotspot {
+ class ScreenSlot : public NamedHotspot {
public:
virtual bool startAction(CursorType action, Event &event);
};
- class Actor2 : public SceneActor {
+ class Joystick : public SceneActor {
public:
virtual bool startAction(CursorType action, Event &event);
};
- class Actor3 : public SceneActor {
+ class Screen : public SceneActor {
public:
virtual bool startAction(CursorType action, Event &event);
};
- class Actor4 : public SceneActor {
+ class StorageCompartment : public SceneActor {
public:
virtual bool startAction(CursorType action, Event &event);
};
- class Actor5 : public SceneActor {
+ class HatchButton : public SceneActor {
public:
virtual bool startAction(CursorType action, Event &event);
};
- class Actor6 : public SceneActor {
+ class ThrusterValve : public SceneActor {
public:
virtual bool startAction(CursorType action, Event &event);
};
- class Actor7 : public SceneActor {
+ class Ignitor : public SceneActor {
public:
virtual bool startAction(CursorType action, Event &event);
};
public:
+ //CHECKME: Useless variable?
int _field412;
SpeakerQuinn _quinnSpeaker;
SpeakerSeeker _seekerSpeaker;
- Hotspot1 _item1;
- Hotspot2 _item2;
- NamedHotspot _item3;
- SceneActor _actor1;
+ JoystickPlug _joystickPlug;
+ ScreenSlot _screenSlot;
+ NamedHotspot _background;
+ SceneActor _screenDisplay;
SceneActor _arrActor[8];
- Actor2 _actor2;
- Actor3 _actor3;
- Actor4 _actor4;
- Actor5 _actor5;
- Actor6 _actor6;
- Actor7 _actor7;
+ Joystick _joystick;
+ Screen _screen;
+ StorageCompartment _storageCompartment;
+ HatchButton _hatchButton;
+ ThrusterValve _thrusterValve;
+ Ignitor _ignitor;
SequenceManager _sequenceManager;
Scene1580();
@@ -692,17 +693,18 @@ class Scene1625 : public SceneExt {
virtual bool startAction(CursorType action, Event &event);
};
public:
+ //CHECKME: Useless variable
int _field412;
SpeakerMiranda1625 _mirandaSpeaker;
SpeakerTeal1625 _tealSpeaker;
SpeakerSoldier1625 _soldierSpeaker;
- NamedHotspot _item1;
- SceneActor _actor1;
+ NamedHotspot _background;
+ SceneActor _teal;
SceneActor _tealHead;
- SceneActor _actor3;
+ SceneActor _mirandaMouth;
SceneActor _glass;
- SceneActor _actor5;
- SceneActor _actor6;
+ SceneActor _wristRestraints;
+ SceneActor _tealRightArm;
Wire _wire;
SequenceManager _sequenceManager;
@@ -870,18 +872,18 @@ public:
NamedHotspot _item1;
NamedHotspot _item2;
NamedHotspot _item3;
- NamedHotspot _item4;
+ NamedHotspot _secBackground;
Background _background;
- SceneActor _actor1;
+ SceneActor _playerShadow;
SceneActor _companion;
- SceneActor _actor3;
+ SceneActor _companionShadow;
SceneActor _leftStaircase;
SceneActor _rightStaircase;
Lever _lever;
Doors _doors;
PassengerDoor _leftDoor;
PassengerDoor _rightDoor;
- Exit1 _exit1;
+ Exit1 _southExit;
SequenceManager _sequenceManager;
Scene1800();
@@ -996,9 +998,9 @@ public:
SpeakerSeeker1900 _seekerSpeaker;
NamedHotspot _background;
NamedHotspot _elevator;
- SceneActor _actor1;
- BackgroundSceneObject _object1;
- BackgroundSceneObject _object2;
+ SceneActor _companion;
+ BackgroundSceneObject _leftDoorFrame;
+ BackgroundSceneObject _rightDoorFrame;
LiftDoor _leftDoor, _rightDoor;
WestExit _westExit;
EastExit _eastExit;
@@ -1024,30 +1026,30 @@ class Scene1925 : public SceneExt {
public:
virtual void changeScene();
};
- class Exit2 : public SceneExit {
+ class ExitDown : public SceneExit {
public:
virtual void changeScene();
};
- class Exit3 : public SceneExit {
+ class WestExit : public SceneExit {
public:
virtual void changeScene();
};
- class Exit4 : public SceneExit {
+ class EastExit : public SceneExit {
public:
virtual void changeScene();
};
public:
- NamedHotspot _item1;
+ NamedHotspot _background;
Button _button;
Ladder _ladder;
- SceneActor _actor1;
+ SceneActor _door;
ExitUp _exitUp;
- Exit2 _exit2;
- Exit3 _exit3;
- Exit4 _exit4;
+ ExitDown _exitDown;
+ WestExit _westExit;
+ EastExit _eastExit;
SequenceManager _sequenceManager;
- int _field9B8;
+ int _newSceneMode;
int _levelResNum[5];
Scene1925();
@@ -1083,12 +1085,12 @@ class Scene1945 : public SceneExt {
virtual void changeScene();
};
public:
- NamedHotspot _item1;
- NamedHotspot _item2;
+ NamedHotspot _hole;
+ NamedHotspot _ice2;
Ice _ice;
Ladder _ladder;
- SceneActor _actor1;
- SceneActor _actor2;
+ SceneActor _coveringIce;
+ SceneActor _alcoholLamp;
Gunpowder _gunpowder;
ExitUp _exitUp;
CorridorExit _corridorExit;
@@ -1134,8 +1136,8 @@ class Scene1950 : public SceneExt {
KeypadWindow();
virtual void synchronize(Serializer &s);
virtual void remove();
- virtual void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY);
- virtual void proc13(int resNum, int lookLineNum, int talkLineNum, int useLineNum);
+ virtual void setup2(int visage, int stripFrameNum, int frameNum, int posX, int posY);
+ virtual void setup3(int resNum, int lookLineNum, int talkLineNum, int useLineNum);
};
class Keypad : public NamedHotspot {
@@ -1223,7 +1225,7 @@ public:
SceneActor _containmentField;
Gem _gem;
SceneActor _cube;
- SceneActor _actor7;
+ SceneActor _pulsingLights;
Vampire _vampire;
KeypadWindow _KeypadWindow;
NorthExit _northExit;
@@ -1236,10 +1238,10 @@ public:
DoorExit _doorExit;
SequenceManager _sequenceManager;
- int _field412;
- int _field414;
- int _field416;
- Common::Point _field418;
+ bool _upExitStyle;
+ bool _removeFlag;
+ bool _vampireActive;
+ Common::Point _vampireDestPos;
int _vampireIndex;
Scene1950();
diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp
index 510855b162..42df9d6a6a 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp
@@ -132,25 +132,28 @@ void Scene2000::initPlayer() {
}
for (int i = 0; i < 11; i++) {
if (R2_GLOBALS._spillLocation[R2_GLOBALS._player._characterIndex] == R2_GLOBALS._spillLocation[3 + i])
- _objList1[i].show();
+ _persons[i].show();
}
- if ((R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) && (R2_GLOBALS._spillLocation[R2_QUINN] == R2_GLOBALS._spillLocation[R2_SEEKER])) {
- _object1.postInit();
+ if ((R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER])
+ && (R2_GLOBALS._spillLocation[R2_QUINN] == R2_GLOBALS._spillLocation[R2_SEEKER])) {
+ _companion.postInit();
if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
- _object1.setup(20, 5, 1);
- _object1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL);
+ // Seeker is in room with Quinn
+ _companion.setup(20, 5, 1);
+ _companion.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL);
} else {
- _object1.setup(2008, 5, 1);
- _object1.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL);
+ // Quinn is in room with Seeker
+ _companion.setup(2008, 5, 1);
+ _companion.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL);
}
if (_westExit._enabled) {
if (_eastExit._enabled)
- _object1.setPosition(Common::Point(180, 128));
+ _companion.setPosition(Common::Point(180, 128));
else
- _object1.setPosition(Common::Point(75, 128));
+ _companion.setPosition(Common::Point(75, 128));
} else
- _object1.setPosition(Common::Point(300, 128));
+ _companion.setPosition(Common::Point(300, 128));
}
}
@@ -174,9 +177,9 @@ void Scene2000::initExits() {
_doorExit._moving = false;
for (int i = 0; i < 11; i++)
- _objList1[i].hide();
+ _persons[i].hide();
- _object1.remove();
+ _companion.remove();
switch (R2_GLOBALS._spillLocation[R2_GLOBALS._player._characterIndex]) {
case 3:
@@ -393,11 +396,11 @@ void Scene2000::Action1::signal() {
_actionIndex = 1;
Common::Point pt(-20, 127);
NpcMover *mover = new NpcMover();
- scene->_objList1[_state].addMover(mover, &pt, scene);
+ scene->_persons[_state].addMover(mover, &pt, scene);
break;
}
case 1:
- scene->_objList1[_state].setPosition(Common::Point(340, 127));
+ scene->_persons[_state].setPosition(Common::Point(340, 127));
--R2_GLOBALS._spillLocation[4 + _state];
_actionIndex = 0;
switch (_state - 1) {
@@ -426,9 +429,9 @@ void Scene2000::Action1::signal() {
}
if (R2_GLOBALS._spillLocation[3 + _state] == R2_GLOBALS._spillLocation[R2_GLOBALS._player._characterIndex])
- scene->_objList1[_state].show();
+ scene->_persons[_state].show();
else
- scene->_objList1[_state].hide();
+ scene->_persons[_state].hide();
signal();
break;
@@ -436,11 +439,11 @@ void Scene2000::Action1::signal() {
_actionIndex = 6;
Common::Point pt(340, 127);
NpcMover *mover = new NpcMover();
- scene->_objList1[_state].addMover(mover, &pt, this);
+ scene->_persons[_state].addMover(mover, &pt, this);
break;
}
case 6:
- scene->_objList1[_state].setPosition(Common::Point(-20, 127));
+ scene->_persons[_state].setPosition(Common::Point(-20, 127));
++R2_GLOBALS._spillLocation[3 + _state];
_actionIndex = 5;
switch (_state - 1) {
@@ -469,33 +472,33 @@ void Scene2000::Action1::signal() {
}
if (R2_GLOBALS._spillLocation[3 + _state] == R2_GLOBALS._spillLocation[R2_GLOBALS._player._characterIndex])
- scene->_objList1[_state].show();
+ scene->_persons[_state].show();
else
- scene->_objList1[_state].hide();
+ scene->_persons[_state].hide();
signal();
break;
case 10: {
Common::Point pt(290, 127);
NpcMover *mover = new NpcMover();
- scene->_objList1[_state].addMover(mover, &pt, this);
+ scene->_persons[_state].addMover(mover, &pt, this);
_actionIndex = 11;
break;
}
case 11:
if (_state == 1)
- scene->_objList1[0].setStrip(1);
+ scene->_persons[0].setStrip(1);
else if (_state == 5)
- scene->_objList1[4].setStrip(1);
+ scene->_persons[4].setStrip(1);
setDelay(600);
_actionIndex = 12;
break;
case 12:
if (_state == 1)
- scene->_objList1[0].setStrip(2);
+ scene->_persons[0].setStrip(2);
else if (_state == 5)
- scene->_objList1[4].setStrip(2);
- scene->_objList1[_state].setStrip(1);
+ scene->_persons[4].setStrip(2);
+ scene->_persons[_state].setStrip(1);
_actionIndex = 5;
signal();
break;
@@ -503,29 +506,29 @@ void Scene2000::Action1::signal() {
if ((R2_GLOBALS._spillLocation[3 + _state] == 13) || (R2_GLOBALS._spillLocation[3 + _state] == 22) || (R2_GLOBALS._spillLocation[3 + _state] == 27)) {
Common::Point pt(30, 127);
NpcMover *mover = new NpcMover();
- scene->_objList1[_state].addMover(mover, &pt, this);
+ scene->_persons[_state].addMover(mover, &pt, this);
_actionIndex = 16;
} else {
Common::Point pt(120, 127);
NpcMover *mover = new NpcMover();
- scene->_objList1[_state].addMover(mover, &pt, this);
+ scene->_persons[_state].addMover(mover, &pt, this);
_actionIndex = 16;
}
break;
case 16:
if (_state == 1)
- scene->_objList1[2].setStrip(2);
+ scene->_persons[2].setStrip(2);
else if (_state == 8)
- scene->_objList1[9].setStrip(2);
+ scene->_persons[9].setStrip(2);
setDelay(600);
_actionIndex = 17;
break;
case 17:
if (_state == 1)
- scene->_objList1[2].setStrip(1);
+ scene->_persons[2].setStrip(1);
else if (_state == 8)
- scene->_objList1[9].setStrip(1);
- scene->_objList1[_state].setStrip(2);
+ scene->_persons[9].setStrip(1);
+ scene->_persons[_state].setStrip(2);
_actionIndex = 0;
break;
case 99:
@@ -806,57 +809,57 @@ void Scene2000::postInit(SceneObjectList *OwnerList) {
_action5._state = 3;
for (int i = 0; i < 11; i++)
- _objList1[i].postInit();
+ _persons[i].postInit();
- _objList1[0].setVisage(2000);
- _objList1[0].setStrip(2);
- _objList1[0].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL);
+ _persons[0].setVisage(2000);
+ _persons[0].setStrip(2);
+ _persons[0].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL);
- _objList1[1].setVisage(2001);
- _objList1[1].setStrip(2);
- _objList1[1].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL);
+ _persons[1].setVisage(2001);
+ _persons[1].setStrip(2);
+ _persons[1].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL);
- _objList1[2].setVisage(2003);
- _objList1[2].setStrip(1);
- _objList1[2].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL);
+ _persons[2].setVisage(2003);
+ _persons[2].setStrip(1);
+ _persons[2].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL);
- _objList1[3].setVisage(2007);
- _objList1[3].setStrip(2);
- _objList1[3].setDetails(2001, 12, -1, -1, 1, (SceneItem *)NULL);
+ _persons[3].setVisage(2007);
+ _persons[3].setStrip(2);
+ _persons[3].setDetails(2001, 12, -1, -1, 1, (SceneItem *)NULL);
- _objList1[4].setVisage(2004);
- _objList1[4].setStrip(2);
- _objList1[4].setDetails(2001, 19, -1, -1, 1, (SceneItem *)NULL);
+ _persons[4].setVisage(2004);
+ _persons[4].setStrip(2);
+ _persons[4].setDetails(2001, 19, -1, -1, 1, (SceneItem *)NULL);
- _objList1[5].setVisage(2003);
- _objList1[5].setStrip(2);
- _objList1[5].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL);
+ _persons[5].setVisage(2003);
+ _persons[5].setStrip(2);
+ _persons[5].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL);
- _objList1[6].setVisage(2000);
- _objList1[6].setStrip(1);
- _objList1[6].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL);
+ _persons[6].setVisage(2000);
+ _persons[6].setStrip(1);
+ _persons[6].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL);
- _objList1[7].setVisage(2000);
- _objList1[7].setStrip(2);
- _objList1[7].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL);
+ _persons[7].setVisage(2000);
+ _persons[7].setStrip(2);
+ _persons[7].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL);
- _objList1[8].setVisage(2000);
- _objList1[8].setStrip(2);
- _objList1[8].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL);
+ _persons[8].setVisage(2000);
+ _persons[8].setStrip(2);
+ _persons[8].setDetails(2001, 0, -1, -1, 1, (SceneItem *)NULL);
- _objList1[9].setVisage(2006);
- _objList1[9].setStrip(1);
- _objList1[9].setDetails(2001, 6, -1, -1, 1, (SceneItem *)NULL);
+ _persons[9].setVisage(2006);
+ _persons[9].setStrip(1);
+ _persons[9].setDetails(2001, 6, -1, -1, 1, (SceneItem *)NULL);
- _objList1[10].setVisage(2007);
- _objList1[10].setStrip(1);
- _objList1[10].setDetails(2001, 12, -1, -1, 1, (SceneItem *)NULL);
+ _persons[10].setVisage(2007);
+ _persons[10].setStrip(1);
+ _persons[10].setDetails(2001, 12, -1, -1, 1, (SceneItem *)NULL);
for (int i = 0; i < 11; i++) {
- _objList1[i].animate(ANIM_MODE_1, NULL);
- _objList1[i]._moveDiff.x = 3;
- _objList1[i]._moveRate = 8;
- _objList1[i].hide();
+ _persons[i].animate(ANIM_MODE_1, NULL);
+ _persons[i]._moveDiff.x = 3;
+ _persons[i]._moveRate = 8;
+ _persons[i].hide();
switch (i - 1) {
case 0:
if (R2_GLOBALS._spillLocation[3 + i] == 1)
@@ -899,28 +902,28 @@ void Scene2000::postInit(SceneObjectList *OwnerList) {
case 22:
case 27:
case 30:
- _objList1[i].setPosition(Common::Point(265, 127));
+ _persons[i].setPosition(Common::Point(265, 127));
break;
case 5:
case 12:
case 17:
case 21:
case 26:
- _objList1[i].setPosition(Common::Point(55, 127));
+ _persons[i].setPosition(Common::Point(55, 127));
break;
default:
- _objList1[i].setPosition(Common::Point(160, 127));
+ _persons[i].setPosition(Common::Point(160, 127));
break;
}
}
- _objList1[1].setAction(&_action2);
- _objList1[3].setAction(&_action5);
- _objList1[5].setAction(&_action4);
- _objList1[8].setAction(&_action1);
+ _persons[1].setAction(&_action2);
+ _persons[3].setAction(&_action5);
+ _persons[5].setAction(&_action4);
+ _persons[8].setAction(&_action1);
initPlayer();
- _item1.setDetails(Rect(0, 0, 320, 200), 2000, 0, -1, 23, 1, NULL);
+ _background.setDetails(Rect(0, 0, 320, 200), 2000, 0, -1, 23, 1, NULL);
SceneExt::postInit();
}
@@ -997,8 +1000,6 @@ void Scene2000::signal() {
g_globals->_sceneManager.changeScene(2535);
break;
default:
- if (R2_GLOBALS._v56AAB != 0)
- R2_GLOBALS._v56AAB = 0;
R2_GLOBALS._player.enableControl(CURSOR_WALK);
break;
}
@@ -1008,7 +1009,6 @@ void Scene2000::signal() {
g_globals->_sceneManager.changeScene(2350);
break;
default:
- R2_GLOBALS._v56AAB = 0;
R2_GLOBALS._player.enableControl();
break;
}
@@ -1039,20 +1039,20 @@ void Scene2000::synchronize(Serializer &s) {
*
*--------------------------------------------------------------------------*/
-bool Scene2350::Actor2::startAction(CursorType action, Event &event) {
+bool Scene2350::Companion::startAction(CursorType action, Event &event) {
if (action != R2_SENSOR_PROBE)
return(SceneActor::startAction(action, event));
return true;
}
-bool Scene2350::Actor3::startAction(CursorType action, Event &event) {
+bool Scene2350::Balloon::startAction(CursorType action, Event &event) {
Scene2350 *scene = (Scene2350 *)R2_GLOBALS._sceneManager._scene;
if ((action == R2_REBREATHER_TANK) && (R2_GLOBALS.getFlag(74))) {
R2_GLOBALS._player.disableControl();
- scene->_actor1.postInit();
+ scene->_person.postInit();
scene->_sceneMode = 2355;
- scene->setAction(&scene->_sequenceManager, scene, 2355, &R2_GLOBALS._player, &scene->_actor1, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 2355, &R2_GLOBALS._player, &scene->_person, NULL);
return true;
}
@@ -1109,33 +1109,33 @@ void Scene2350::postInit(SceneObjectList *OwnerList) {
}
if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) {
- _actor2.postInit();
+ _companion.postInit();
if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
- _actor2.setup(20, 5, 1);
- _actor2.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL);
+ _companion.setup(20, 5, 1);
+ _companion.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL);
} else {
- _actor2.setup(2008, 5, 1);
- _actor2.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL);
+ _companion.setup(2008, 5, 1);
+ _companion.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL);
}
- _actor2.setPosition(Common::Point(135, 128));
+ _companion.setPosition(Common::Point(135, 128));
}
- _actor3.postInit();
- _actor4.postInit();
+ _balloon.postInit();
+ _harness.postInit();
if (R2_INVENTORY.getObjectScene(R2_REBREATHER_TANK) == 2350) {
- _actor3.hide();
- _actor4.hide();
+ _balloon.hide();
+ _harness.hide();
} else {
- _actor3.setup(2350, 0, 1);
- _actor3.setPosition(Common::Point(197, 101));
- _actor3.setDetails(2000, 12, -1, -1, 1, (SceneItem *)NULL);
- _actor3.fixPriority(10);
- _actor4.setup(2350, 1, 2);
- _actor4.setPosition(Common::Point(199, 129));
- _actor4.setDetails(2000, 12, -1, -1, 1, (SceneItem *)NULL);
- _actor4.fixPriority(10);
- }
- _item1.setDetails(Rect(0, 0, 320, 200), 2000, 9, -1, -1, 1, NULL);
+ _balloon.setup(2350, 0, 1);
+ _balloon.setPosition(Common::Point(197, 101));
+ _balloon.setDetails(2000, 12, -1, -1, 1, (SceneItem *)NULL);
+ _balloon.fixPriority(10);
+ _harness.setup(2350, 1, 2);
+ _harness.setPosition(Common::Point(199, 129));
+ _harness.setDetails(2000, 12, -1, -1, 1, (SceneItem *)NULL);
+ _harness.fixPriority(10);
+ }
+ _background.setDetails(Rect(0, 0, 320, 200), 2000, 9, -1, -1, 1, NULL);
R2_GLOBALS._player.disableControl();
if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2000) {
@@ -1217,7 +1217,7 @@ void Scene2350::process(Event &event) {
*
*--------------------------------------------------------------------------*/
-void Scene2400::Exit1::changeScene() {
+void Scene2400::WestExit::changeScene() {
Scene2400 *scene = (Scene2400 *)R2_GLOBALS._sceneManager._scene;
R2_GLOBALS._player.disableControl();
@@ -1229,7 +1229,7 @@ void Scene2400::Exit1::changeScene() {
}
-void Scene2400::Exit2::changeScene() {
+void Scene2400::EastExit::changeScene() {
Scene2400 *scene = (Scene2400 *)R2_GLOBALS._sceneManager._scene;
R2_GLOBALS._player.disableControl();
@@ -1243,10 +1243,10 @@ void Scene2400::Exit2::changeScene() {
void Scene2400::postInit(SceneObjectList *OwnerList) {
loadScene(2400);
SceneExt::postInit();
- _exit1.setDetails(Rect(0, 125, 14, 165), EXITCURSOR_W, 2000);
- _exit1.setDest(Common::Point(14, 150));
- _exit2.setDetails(Rect(305, 125, 320, 165), EXITCURSOR_E, 2000);
- _exit2.setDest(Common::Point(315, 150));
+ _westExit.setDetails(Rect(0, 125, 14, 165), EXITCURSOR_W, 2000);
+ _westExit.setDest(Common::Point(14, 150));
+ _eastExit.setDetails(Rect(305, 125, 320, 165), EXITCURSOR_E, 2000);
+ _eastExit.setDest(Common::Point(315, 150));
R2_GLOBALS._player.postInit();
R2_GLOBALS._player.disableControl();
@@ -1333,7 +1333,7 @@ bool Scene2425::Crevasse::startAction(CursorType action, Event &event) {
}
}
-bool Scene2425::Item4::startAction(CursorType action, Event &event) {
+bool Scene2425::Background::startAction(CursorType action, Event &event) {
if (action != R2_CURSOR_ROPE)
return NamedHotspot::startAction(action, event);
else {
@@ -1436,7 +1436,7 @@ void Scene2425::postInit(SceneObjectList *OwnerList) {
g_globals->_sceneItems.push_back(&_pictographs2);
_crevasse.setDetails(12, 2425, 7, -1, 9);
- _item4.setDetails(Rect(0, 0, 320, 200), 2425, 0, -1, -1, 1, NULL);
+ _background.setDetails(Rect(0, 0, 320, 200), 2425, 0, -1, -1, 1, NULL);
R2_GLOBALS._player.disableControl();
switch (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex]) {
@@ -1495,7 +1495,7 @@ void Scene2425::signal() {
*
*--------------------------------------------------------------------------*/
-bool Scene2430::Actor1::startAction(CursorType action, Event &event) {
+bool Scene2430::Companion::startAction(CursorType action, Event &event) {
return SceneActor::startAction(action, event);
}
@@ -1568,33 +1568,31 @@ void Scene2430::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player.setPosition(Common::Point(100, 200));
if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) {
- _actor1.postInit();
+ _companion.postInit();
if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
- _actor1.setup(20, 5, 1);
- _actor1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL);
+ _companion.setup(20, 5, 1);
+ _companion.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL);
} else {
- _actor1.setup(2008, 5, 1);
- _actor1.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL);
+ _companion.setup(2008, 5, 1);
+ _companion.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL);
}
- _actor1.setPosition(Common::Point(189, 137));
+ _companion.setPosition(Common::Point(189, 137));
R2_GLOBALS._walkRegions.disableRegion(4);
}
- _item2.setDetails(Rect(11, 30, 37, 45), 2430, 3, -1, 5, 1, NULL);
- _item3.setDetails(Rect(9, 58, 63, 92), 2430, 6, -1, -1, 1, NULL);
- _item4.setDetails(Rect(20, 89, 127, 107), 2430, 9, -1, 11, 1, NULL);
- _item5.setDetails(Rect(49, 7, 60, 27), 2430, 12, 13, 14, 1, NULL);
- _item6.setDetails(Rect(69, 10, 95, 72), 2430, 15, -1, 14, 1, NULL);
- _item10.setDetails(Rect(198, 4, 222, 146), 2430, 30, 31, 32, 1, NULL);
- _item7.setDetails(Rect(155, 40, 304, 120), 2430, 21, -1, 23, 1, NULL);
- _item8.setDetails(Rect(249, 3, 261, 39), 2430, 24, 25, -1, 1, NULL);
- _item9.setDetails(Rect(279, 13, 305, 34), 2430, 33, -1, 18, 1, NULL);
- // CHECKME: initialized for the 2nd time??
- _item2.setDetails(Rect(11, 30, 37, 45), 2430, 33, -1, 18, 1, NULL);
- _item11.setDetails(Rect(116, 104, 148, 111), 2430, 39, -1, -1, 1, NULL);
- _item12.setDetails(Rect(66, 77, 84, 83), 2430, 39, -1, -1, 1, NULL);
- _item13.setDetails(Rect(117, 118, 201, 141), 2430, 9, -1, 11, 1, NULL);
- _item1.setDetails(Rect(0, 0, 320, 200), 2430, 0, -1, -1, 1, NULL);
+ _furnishings.setDetails(Rect(9, 58, 63, 92), 2430, 6, -1, -1, 1, NULL);
+ _rug1.setDetails(Rect(20, 89, 127, 107), 2430, 9, -1, 11, 1, NULL);
+ _mirror.setDetails(Rect(49, 7, 60, 27), 2430, 12, 13, 14, 1, NULL);
+ _garments.setDetails(Rect(69, 10, 95, 72), 2430, 15, -1, 14, 1, NULL);
+ _post.setDetails(Rect(198, 4, 222, 146), 2430, 30, 31, 32, 1, NULL);
+ _bed.setDetails(Rect(155, 40, 304, 120), 2430, 21, -1, 23, 1, NULL);
+ _towel.setDetails(Rect(249, 3, 261, 39), 2430, 24, 25, -1, 1, NULL);
+ _bottles1.setDetails(Rect(279, 13, 305, 34), 2430, 33, -1, 18, 1, NULL);
+ _bottles2.setDetails(Rect(11, 30, 37, 45), 2430, 33, -1, 18, 1, NULL);
+ _clothesPile1.setDetails(Rect(116, 104, 148, 111), 2430, 39, -1, -1, 1, NULL);
+ _clothesPile2.setDetails(Rect(66, 77, 84, 83), 2430, 39, -1, -1, 1, NULL);
+ _rug2.setDetails(Rect(117, 118, 201, 141), 2430, 9, -1, 11, 1, NULL);
+ _background.setDetails(Rect(0, 0, 320, 200), 2430, 0, -1, -1, 1, NULL);
if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2000) {
R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] = 2430;
@@ -1784,6 +1782,7 @@ void Scene2435::signal() {
_sceneMode = 20;
R2_GLOBALS._events.setCursor(CURSOR_ARROW);
_stripManager.start(709, this);
+ break;
default:
R2_GLOBALS._player.enableControl();
break;
@@ -1795,7 +1794,7 @@ void Scene2435::signal() {
*
*--------------------------------------------------------------------------*/
-bool Scene2440::Actor1::startAction(CursorType action, Event &event) {
+bool Scene2440::Companion::startAction(CursorType action, Event &event) {
return SceneActor::startAction(action, event);
}
@@ -1850,24 +1849,24 @@ void Scene2440::postInit(SceneObjectList *OwnerList) {
}
R2_GLOBALS._player.setPosition(Common::Point(210, 200));
if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) {
- _actor1.postInit();
+ _companion.postInit();
if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
- _actor1.setup(20, 5, 1);
- _actor1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL);
+ _companion.setup(20, 5, 1);
+ _companion.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL);
} else {
- _actor1.setup(2008, 5, 1);
- _actor1.setDetails(9002, 0, 5, 3, 1, (SceneItem *)NULL);
+ _companion.setup(2008, 5, 1);
+ _companion.setDetails(9002, 0, 5, 3, 1, (SceneItem *)NULL);
}
- _actor1.setPosition(Common::Point(38, 119));
+ _companion.setPosition(Common::Point(38, 119));
}
- _item2.setDetails(Rect(125, 25, 142, 73), 2430, 15, -1, 14, 1, NULL);
- _item3.setDetails(Rect(124, 78, 237, 120), 2430, 36, -1, 38, 1, NULL);
- _item4.setDetails(Rect(250, 3, 265, 133), 2430, 30, 31, 32, 1, NULL);
- _item5.setDetails(Rect(91, 117, 203, 140), 2430, 9, -1, 11, 1, NULL);
- _item6.setDetails(Rect(48, 78, 103, 112), 2430, 6, -1, -1, 1, NULL);
- _item7.setDetails(Rect(48, 31, 73, 52), 2430, 33, -1, 18, 1, NULL);
- _item1.setDetails(Rect(0, 0, 320, 200), 2430, 0, -1, -1, 1, NULL);
+ _garments.setDetails(Rect(125, 25, 142, 73), 2430, 15, -1, 14, 1, NULL);
+ _bedspread.setDetails(Rect(124, 78, 237, 120), 2430, 36, -1, 38, 1, NULL);
+ _post.setDetails(Rect(250, 3, 265, 133), 2430, 30, 31, 32, 1, NULL);
+ _rug.setDetails(Rect(91, 117, 203, 140), 2430, 9, -1, 11, 1, NULL);
+ _furnishings.setDetails(Rect(48, 78, 103, 112), 2430, 6, -1, -1, 1, NULL);
+ _bottles.setDetails(Rect(48, 31, 73, 52), 2430, 33, -1, 18, 1, NULL);
+ _background.setDetails(Rect(0, 0, 320, 200), 2430, 0, -1, -1, 1, NULL);
R2_GLOBALS._player.disableControl();
@@ -1944,14 +1943,14 @@ bool Scene2450::CareTaker::startAction(CursorType action, Event &event) {
if (action == CURSOR_TALK) {
R2_GLOBALS._player.disableControl();
- if (R2_GLOBALS._v565AE < 3) {
- ++R2_GLOBALS._v565AE;
+ if (R2_GLOBALS._stripModifier < 3) {
+ ++R2_GLOBALS._stripModifier;
scene->_sceneMode = 20;
R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
if (R2_GLOBALS._player._characterIndex == R2_QUINN)
- scene->_stripManager.start(699 + (R2_GLOBALS._v565AE * 2), scene);
+ scene->_stripManager.start(699 + (R2_GLOBALS._stripModifier * 2), scene);
else
- scene->_stripManager.start(700 + (R2_GLOBALS._v565AE * 2), scene);
+ scene->_stripManager.start(700 + (R2_GLOBALS._stripModifier * 2), scene);
}
return true;
} else {
@@ -1972,7 +1971,7 @@ void Scene2450::Exit1::changeScene() {
R2_GLOBALS._player.addMover(mover, &pt, scene);
} else {
_moving = false;
- SceneItem::display(2450, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(2450, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
Common::Point pt(60, 140);
NpcMover *mover = new NpcMover();
R2_GLOBALS._player.addMover(mover, &pt, NULL);
@@ -2009,7 +2008,7 @@ void Scene2450::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player.disableControl();
switch (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex]) {
case 1900:
- R2_GLOBALS._v565AE = 0;
+ R2_GLOBALS._stripModifier = 0;
R2_GLOBALS._player._characterScene[R2_QUINN] = 2450;
R2_GLOBALS._player._characterScene[R2_SEEKER] = 2450;
R2_GLOBALS._player._oldCharacterScene[R2_QUINN] = 2450;
@@ -2145,14 +2144,14 @@ void Scene2450::signal() {
g_globals->_sceneManager.changeScene(2000);
break;
case 20:
- if (R2_GLOBALS._v565AE == 3) {
+ if (R2_GLOBALS._stripModifier == 3) {
R2_GLOBALS._player.disableControl();
- R2_GLOBALS._v565AE = 4;
+ R2_GLOBALS._stripModifier = 4;
_sceneMode = 2454;
setAction(&_sequenceManager, this, 2454, &_careTaker, NULL);
} else {
R2_GLOBALS._player.enableControl(CURSOR_TALK);
- if (R2_GLOBALS._v565AE < 4)
+ if (R2_GLOBALS._stripModifier < 4)
R2_GLOBALS._player._canWalk = false;
}
break;
@@ -2395,7 +2394,7 @@ void Scene2455::signal() {
}
/*--------------------------------------------------------------------------
- * Scene 2500 - Spill Mountains: Large Cave
+ * Scene 2500 - Spill Mountains: Large Ledge
*
*--------------------------------------------------------------------------*/
@@ -2441,19 +2440,19 @@ void Scene2500::postInit(SceneObjectList *OwnerList) {
}
if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) {
- _actor1.postInit();
+ _companion.postInit();
if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
- _actor1.setup(21, 3, 1);
- _actor1.setDetails(9002, 1, -1, -1, 1, (SceneItem *)NULL);
+ _companion.setup(21, 3, 1);
+ _companion.setDetails(9002, 1, -1, -1, 1, (SceneItem *)NULL);
} else {
- _actor1.setup(2008, 3, 1);
- _actor1.changeZoom(50);
- _actor1.setDetails(9001, 0, -1, -1, 1, (SceneItem *)NULL);
+ _companion.setup(2008, 3, 1);
+ _companion.changeZoom(50);
+ _companion.setDetails(9001, 0, -1, -1, 1, (SceneItem *)NULL);
}
- _actor1.setPosition(Common::Point(141, 94));
+ _companion.setPosition(Common::Point(141, 94));
}
- _item1.setDetails(Rect(0, 0, 320, 200), 2430, 0, -1, -1, 1, NULL);
+ _background.setDetails(Rect(0, 0, 320, 200), 2430, 0, -1, -1, 1, NULL);
R2_GLOBALS._player.disableControl();
if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2000) {
@@ -2464,9 +2463,9 @@ void Scene2500::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player.addMover(mover, &pt, this);
} else if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 3100) {
_sceneMode = 2500;
- _actor2.postInit();
- _actor3.postInit();
- setAction(&_sequenceManager, this, 2500, &R2_GLOBALS._player, &_actor2, &_actor3, NULL);
+ _quinn.postInit();
+ _ship.postInit();
+ setAction(&_sequenceManager, this, 2500, &R2_GLOBALS._player, &_quinn, &_ship, NULL);
} else {
R2_GLOBALS._player.setPosition(Common::Point(160, 150));
R2_GLOBALS._player.setStrip(3);
@@ -2483,7 +2482,7 @@ void Scene2500::signal() {
case 20:
R2_GLOBALS._player.disableControl();
_sceneMode = 2501;
- setAction(&_sequenceManager, this, 2501, &R2_GLOBALS._player, &_actor2, &_actor3, NULL);
+ setAction(&_sequenceManager, this, 2501, &R2_GLOBALS._player, &_quinn, &_ship, NULL);
break;
case 2500:
_sceneMode = 20;
@@ -2504,7 +2503,7 @@ void Scene2500::signal() {
*
*--------------------------------------------------------------------------*/
-bool Scene2525::Item5::startAction(CursorType action, Event &event) {
+bool Scene2525::StopCock::startAction(CursorType action, Event &event) {
Scene2525 *scene = (Scene2525 *)R2_GLOBALS._sceneManager._scene;
if ((action == R2_REBREATHER_TANK) && (!R2_GLOBALS.getFlag(74))) {
@@ -2528,7 +2527,7 @@ bool Scene2525::GlassDome::startAction(CursorType action, Event &event) {
scene->_sceneMode = 2525;
scene->setAction(&scene->_sequenceManager, scene, 2525, &R2_GLOBALS._player, &scene->_glassDome, NULL);
} else {
- SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
}
return true;
}
@@ -2562,12 +2561,12 @@ void Scene2525::postInit(SceneObjectList *OwnerList) {
_glassDome.setDetails(2525, 27, -1, -1, 1, (SceneItem *)NULL);
}
- _actor2.postInit();
- _actor2.setup(2525, 1, 1);
- _actor2.setPosition(Common::Point(183, 114));
- _actor2.setDetails(2525, 15, -1, -1, 1, (SceneItem *)NULL);
- _actor2.animate(ANIM_MODE_2, NULL);
- _actor2._numFrames = 3;
+ _compressor.postInit();
+ _compressor.setup(2525, 1, 1);
+ _compressor.setPosition(Common::Point(183, 114));
+ _compressor.setDetails(2525, 15, -1, -1, 1, (SceneItem *)NULL);
+ _compressor.animate(ANIM_MODE_2, NULL);
+ _compressor._numFrames = 3;
R2_GLOBALS._player.postInit();
R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
@@ -2580,24 +2579,24 @@ void Scene2525::postInit(SceneObjectList *OwnerList) {
}
if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) {
- _actor1.postInit();
+ _companion.postInit();
if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
- _actor1.setup(20, 5, 1);
- _actor1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL);
+ _companion.setup(20, 5, 1);
+ _companion.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL);
} else {
- _actor1.setup(2008, 5, 1);
- _actor1.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL);
+ _companion.setup(2008, 5, 1);
+ _companion.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL);
}
- _actor1.setPosition(Common::Point(209, 162));
+ _companion.setPosition(Common::Point(209, 162));
R2_GLOBALS._walkRegions.disableRegion(4);
}
- _item5.setDetails(Rect(125, 73, 140, 86), 2525, 6, -1, -1, 1, NULL);
- _item3.setDetails(Rect(137, 11, 163, 72), 2525, 12, -1, -1, 1, NULL);
- _item4.setDetails(Rect(204, 20, 234, 78), 2525, 12, -1, -1, 1, NULL);
- _item2.setDetails(Rect(102, 62, 230, 134), 2525, 0, -1, -1, 1, NULL);
- _item1.setDetails(Rect(0, 0, 320, 200), 2525, 24, -1, -1, 1, NULL);
+ _stopcock.setDetails(Rect(125, 73, 140, 86), 2525, 6, -1, -1, 1, NULL);
+ _pipes1.setDetails(Rect(137, 11, 163, 72), 2525, 12, -1, -1, 1, NULL);
+ _pipes2.setDetails(Rect(204, 20, 234, 78), 2525, 12, -1, -1, 1, NULL);
+ _machine.setDetails(Rect(102, 62, 230, 134), 2525, 0, -1, -1, 1, NULL);
+ _background.setDetails(Rect(0, 0, 320, 200), 2525, 24, -1, -1, 1, NULL);
R2_GLOBALS._player.disableControl();
@@ -2656,7 +2655,7 @@ bool Scene2530::Flask::startAction(CursorType action, Event &event) {
scene->_sceneMode = 2530;
scene->setAction(&scene->_sequenceManager, scene, 2530, &R2_GLOBALS._player, &scene->_flask, NULL);
} else {
- SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
}
return true;
@@ -2670,7 +2669,7 @@ bool Scene2530::Crank::startAction(CursorType action, Event &event) {
if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
if (R2_GLOBALS.getFlag(73))
- SceneItem::display(2530, 35, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(2530, 35, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
else {
R2_GLOBALS._player.disableControl();
scene->_sceneMode = 2532;
@@ -2742,20 +2741,20 @@ void Scene2530::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player.setPosition(Common::Point(100, 200));
if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) {
- _actor1.postInit();
+ _companion.postInit();
if (R2_GLOBALS._player._characterIndex == R2_QUINN) {
- _actor1.setup(20, 5, 1);
- _actor1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL);
+ _companion.setup(20, 5, 1);
+ _companion.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL);
} else {
- _actor1.setup(2008, 5, 1);
- _actor1.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL);
+ _companion.setup(2008, 5, 1);
+ _companion.setDetails(9001, 0, 5, 3, 1, (SceneItem *)NULL);
}
- _actor1.setPosition(Common::Point(20, 130));
+ _companion.setPosition(Common::Point(20, 130));
R2_GLOBALS._walkRegions.disableRegion(1);
}
- _item2.setDetails(Rect(108, 90, 135, 205), 2530, 22, -1, -1, 1, NULL);
- _item5.setDetails(Rect(115, 112, 206, 130), 2530, 25, -1, 27, 1, NULL);
+ _crank2.setDetails(Rect(108, 90, 135, 205), 2530, 22, -1, -1, 1, NULL);
+ _rope.setDetails(Rect(115, 112, 206, 130), 2530, 25, -1, 27, 1, NULL);
_shelf.setDetails(Rect(256, 64, 311, 85), 2530, 31, -1, 33, 1, NULL);
_background.setDetails(Rect(0, 0, 320, 200), 2530, 0, 1, -1, 1, NULL);
@@ -2817,7 +2816,7 @@ bool Scene2535::RebreatherTank::startAction(CursorType action, Event &event) {
scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode,
&R2_GLOBALS._player, &scene->_rebreatherTank, NULL);
} else {
- SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
}
return true;
@@ -2834,7 +2833,7 @@ bool Scene2535::TannerMask::startAction(CursorType action, Event &event) {
scene->_sceneMode = 2535;
scene->setAction(&scene->_sequenceManager, scene, 2535, &R2_GLOBALS._player, &scene->_tannerMask, NULL);
} else {
- SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(2530, 33, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
}
return true;
@@ -3027,7 +3026,7 @@ void Scene2600::signal() {
*--------------------------------------------------------------------------*/
Scene2700::Scene2700(): SceneExt() {
- _field412 = _field414 = _field416 = 0;
+ _areaMode = _moveMode = _stripNumber = 0;
_walkRect1.set(70, 122, 90, 132);
_walkRect2.set(150, 122, 160, 132);
@@ -3040,9 +3039,9 @@ Scene2700::Scene2700(): SceneExt() {
void Scene2700::synchronize(Serializer &s) {
SceneExt::synchronize(s);
- s.syncAsSint16LE(_field412);
- s.syncAsSint16LE(_field414);
- s.syncAsSint16LE(_field416);
+ s.syncAsSint16LE(_areaMode);
+ s.syncAsSint16LE(_moveMode);
+ s.syncAsSint16LE(_stripNumber);
}
void Scene2700::Action1::signal() {
@@ -3079,8 +3078,8 @@ void Scene2700::Area1::process(Event &event) {
Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene;
R2_GLOBALS._player.disableControl();
scene->_sceneMode = 10;
- scene->_field414 = 2703;
- switch (scene->_field412) {
+ scene->_moveMode = 2703;
+ switch (scene->_areaMode) {
case 0:
// No break on purpose
case 6:
@@ -3129,8 +3128,8 @@ void Scene2700::Area2::process(Event &event) {
Scene2700 *scene = (Scene2700 *)R2_GLOBALS._sceneManager._scene;
R2_GLOBALS._player.disableControl();
scene->_sceneMode = 10;
- scene->_field414 = 2704;
- switch (scene->_field412) {
+ scene->_moveMode = 2704;
+ switch (scene->_areaMode) {
case 0: {
Common::Point pt(140, 162);
NpcMover *mover = new NpcMover();
@@ -3229,10 +3228,10 @@ void Scene2700::postInit(SceneObjectList *OwnerList) {
if (R2_GLOBALS._sceneManager._previousScene == 2750) {
_sceneMode = 2702;
- _field412 = 5;
+ _areaMode = 5;
setAction(&_sequenceManager, this, 2702, &R2_GLOBALS._player, NULL);
} else {
- _field412 = 0;
+ _areaMode = 0;
if (R2_GLOBALS._sceneManager._previousScene == 3900) {
_sceneMode = 2701;
setAction(&_sequenceManager, this, 2701, &R2_GLOBALS._player, NULL);
@@ -3247,26 +3246,26 @@ void Scene2700::postInit(SceneObjectList *OwnerList) {
void Scene2700::signal() {
switch (_sceneMode) {
case 10:
- switch (_field414) {
+ switch (_moveMode) {
case 1:
- switch (_field412) {
+ switch (_areaMode) {
case 0:
case 2:
case 4:
case 6:
- _field412 = 3;
+ _areaMode = 3;
R2_GLOBALS._player.setAction(&_sequenceManager, this, 2705, &R2_GLOBALS._player, NULL);
break;
case 3: {
- _sceneMode = _field414;
- _field412 = 1;
+ _sceneMode = _moveMode;
+ _areaMode = 1;
Common::Point pt(80, 127);
NpcMover *mover = new NpcMover();
R2_GLOBALS._player.addMover(mover, &pt, this);
break;
}
case 5:
- _field412 = 4;
+ _areaMode = 4;
R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL);
break;
default: // includes case 1
@@ -3274,24 +3273,24 @@ void Scene2700::signal() {
}
break;
case 2:
- switch (_field412) {
+ switch (_areaMode) {
case 0:
case 1:
case 6:
- _field412 = 3;
+ _areaMode = 3;
R2_GLOBALS._player.setAction(&_sequenceManager, this, 2706, &R2_GLOBALS._player, NULL);
break;
case 3:
case 4: {
- _sceneMode = _field414;
- _field412 = 2;
+ _sceneMode = _moveMode;
+ _areaMode = 2;
Common::Point pt(155, 127);
NpcMover *mover = new NpcMover();
R2_GLOBALS._player.addMover(mover, &pt, this);
break;
}
case 5:
- _field412 = 4;
+ _areaMode = 4;
R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL);
break;
default: // includes case 2
@@ -3299,21 +3298,21 @@ void Scene2700::signal() {
}
break;
case 3:
- switch (_field412) {
+ switch (_areaMode) {
case 0:
case 1:
case 2:
case 4:
case 6: {
- _sceneMode = _field414;
- _field412 = 3;
+ _sceneMode = _moveMode;
+ _areaMode = 3;
Common::Point pt(115, 152);
NpcMover *mover = new NpcMover();
R2_GLOBALS._player.addMover(mover, &pt, this);
break;
}
case 5:
- _field412 = 4;
+ _areaMode = 4;
R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL);
break;
default: // includes case 3
@@ -3321,21 +3320,21 @@ void Scene2700::signal() {
}
break;
case 4:
- switch (_field412) {
+ switch (_areaMode) {
case 0:
case 1:
case 6:
- _field412 = 3;
+ _areaMode = 3;
R2_GLOBALS._player.setAction(&_sequenceManager, this, 2706, &R2_GLOBALS._player, NULL);
break;
case 2:
case 3:
- _field412 = 4;
+ _areaMode = 4;
R2_GLOBALS._player.setAction(&_sequenceManager, this, 2709, &R2_GLOBALS._player, NULL);
break;
case 4:
case 5:
- _sceneMode = _field414;
+ _sceneMode = _moveMode;
R2_GLOBALS._player.setAction(&_sequenceManager, this, 2704, &R2_GLOBALS._player, NULL);
break;
default:
@@ -3343,21 +3342,21 @@ void Scene2700::signal() {
}
break;
case 5:
- switch (_field412) {
+ switch (_areaMode) {
case 0:
case 1:
case 6:
- _field412 = 3;
+ _areaMode = 3;
R2_GLOBALS._player.setAction(&_sequenceManager, this, 2706, &R2_GLOBALS._player, NULL);
break;
case 2:
case 3:
- _field412 = 4;
+ _areaMode = 4;
R2_GLOBALS._player.setAction(&_sequenceManager, this, 2709, &R2_GLOBALS._player, NULL);
break;
case 4: {
- _sceneMode = _field414;
- _field412 = 5;
+ _sceneMode = _moveMode;
+ _areaMode = 5;
Common::Point pt(285, 132);
NpcMover *mover = new NpcMover();
R2_GLOBALS._player.addMover(mover, &pt, this);
@@ -3368,11 +3367,11 @@ void Scene2700::signal() {
}
break;
case 6:
- switch (_field412) {
+ switch (_areaMode) {
case 0:
case 3: {
- _sceneMode = _field414;
- _field412 = 6;
+ _sceneMode = _moveMode;
+ _areaMode = 6;
Common::Point pt(250, 162);
NpcMover *mover = new NpcMover();
R2_GLOBALS._player.addMover(mover, &pt, this);
@@ -3381,11 +3380,11 @@ void Scene2700::signal() {
case 1:
case 2:
case 4:
- _field412 = 3;
+ _areaMode = 3;
R2_GLOBALS._player.setAction(&_sequenceManager, this, 2707, &R2_GLOBALS._player, NULL);
break;
case 5:
- _field412 = 4;
+ _areaMode = 4;
R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL);
break;
default:
@@ -3393,21 +3392,21 @@ void Scene2700::signal() {
}
break;
case 2703:
- switch (_field412) {
+ switch (_areaMode) {
case 0:
case 3:
case 6:
- _sceneMode = _field414;
+ _sceneMode = _moveMode;
setAction(&_sequenceManager, this, 2703, &R2_GLOBALS._player, NULL);
break;
case 1:
case 2:
case 4:
- _field412 = 3;
+ _areaMode = 3;
R2_GLOBALS._player.setAction(&_sequenceManager, this, 2707, &R2_GLOBALS._player, NULL);
break;
case 5:
- _field412 = 4;
+ _areaMode = 4;
R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL);
break;
default:
@@ -3415,21 +3414,21 @@ void Scene2700::signal() {
}
break;
case 2704:
- switch (_field412) {
+ switch (_areaMode) {
case 0:
case 1:
case 6:
- _field412 = 3;
+ _areaMode = 3;
R2_GLOBALS._player.setAction(&_sequenceManager, this, 2706, &R2_GLOBALS._player, NULL);
break;
case 2:
case 3:
- _field412 = 4;
+ _areaMode = 4;
R2_GLOBALS._player.setAction(&_sequenceManager, this, 2709, &R2_GLOBALS._player, NULL);
break;
case 4:
case 5:
- _sceneMode = _field414;
+ _sceneMode = _moveMode;
R2_GLOBALS._player.setAction(&_sequenceManager, this, 2704, &R2_GLOBALS._player, NULL);
break;
default:
@@ -3437,23 +3436,23 @@ void Scene2700::signal() {
}
break;
case 2710:
- switch (_field412) {
+ switch (_areaMode) {
case 0:
case 1:
case 3:
- _field412 = 3;
+ _areaMode = 3;
R2_GLOBALS._player.setAction(&_sequenceManager, this, 2707, &R2_GLOBALS._player, NULL);
break;
case 2:
case 5: {
- _sceneMode = _field414;
+ _sceneMode = _moveMode;
Common::Point pt(164, 160);
NpcMover *mover = new NpcMover();
R2_GLOBALS._player.addMover(mover, &pt, this);
break;
}
case 4:
- _field412 = 4;
+ _areaMode = 4;
R2_GLOBALS._player.setAction(&_sequenceManager, this, 2708, &R2_GLOBALS._player, NULL);
break;
default:
@@ -3467,7 +3466,7 @@ void Scene2700::signal() {
case 11:
R2_INVENTORY.setObjectScene(R2_FLUTE, 0);
R2_GLOBALS._player.disableControl();
- _field412 = 0;
+ _areaMode = 0;
_sceneMode = 2700;
setAction(&_sequenceManager, this, 2700, &_nej, NULL);
break;
@@ -3475,22 +3474,22 @@ void Scene2700::signal() {
R2_GLOBALS._sound1.play(234);
R2_GLOBALS._events.setCursor(CURSOR_WALK);
_sceneMode = 2711;
- _stripManager.start(_field416, this);
+ _stripManager.start(_stripNumber, this);
break;
case 13:
R2_GLOBALS._events.setCursor(CURSOR_WALK);
_sceneMode = 2712;
- _stripManager.start(_field416, this);
+ _stripManager.start(_stripNumber, this);
break;
case 14:
R2_GLOBALS._events.setCursor(CURSOR_WALK);
_sceneMode = 2713;
- _stripManager.start(_field416, this);
+ _stripManager.start(_stripNumber, this);
break;
case 15:
R2_GLOBALS._events.setCursor(CURSOR_WALK);
_sceneMode = 11;
- _stripManager.start(_field416, this);
+ _stripManager.start(_stripNumber, this);
break;
case 2700:
_nej.remove();
@@ -3504,26 +3503,26 @@ void Scene2700::signal() {
break;
case 2710:
// Start of Nej assault
- _field416 = 1200;
+ _stripNumber = 1200;
_sceneMode = 12;
_nej.postInit();
setAction(&_sequenceManager, this, 2710, &R2_GLOBALS._player, &_nej, NULL);
break;
case 2711:
R2_GLOBALS._player.disableControl();
- _field416 = 1201;
+ _stripNumber = 1201;
_sceneMode = 13;
setAction(&_sequenceManager, this, 2711, &R2_GLOBALS._player, &_nej, NULL);
break;
case 2712:
R2_GLOBALS._player.disableControl();
- _field416 = 1202;
+ _stripNumber = 1202;
_sceneMode = 14;
setAction(&_sequenceManager, this, 2712, &R2_GLOBALS._player, &_nej, NULL);
break;
case 2713:
R2_GLOBALS._player.disableControl();
- _field416 = 1203;
+ _stripNumber = 1203;
_sceneMode = 15;
setAction(&_sequenceManager, this, 2713, &R2_GLOBALS._player, &_nej, NULL);
break;
@@ -3537,11 +3536,11 @@ void Scene2700::process(Event &event) {
if (R2_GLOBALS._events.getCursor() == R2_FLUTE) {
if (R2_GLOBALS._player._bounds.contains(event.mousePos)) {
_sceneMode = 10;
- _field414 = 2710;
+ _moveMode = 2710;
R2_GLOBALS._player.disableControl();
R2_GLOBALS._events.setCursor(CURSOR_WALK);
- switch (_field412) {
+ switch (_areaMode) {
case 0: {
_sceneMode = 2710;
Common::Point pt(164, 160);
@@ -3589,7 +3588,7 @@ void Scene2700::process(Event &event) {
break;
}
} else {
- SceneItem::display(2700, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(2700, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
}
event.handled = true;
@@ -3598,37 +3597,37 @@ void Scene2700::process(Event &event) {
if (!_walkRect1.contains(R2_GLOBALS._player._position)) {
event.handled = true;
_sceneMode = 10;
- _field414 = 1;
+ _moveMode = 1;
}
} else if (_walkRect2.contains(event.mousePos)) {
if (!_walkRect2.contains(R2_GLOBALS._player._position)) {
event.handled = true;
_sceneMode = 10;
- _field414 = 2;
+ _moveMode = 2;
}
} else if (_walkRect3.contains(event.mousePos)) {
if (!_walkRect3.contains(R2_GLOBALS._player._position)) {
event.handled = true;
_sceneMode = 10;
- _field414 = 3;
+ _moveMode = 3;
}
} else if (_walkRect4.contains(event.mousePos)) {
if (!_walkRect4.contains(R2_GLOBALS._player._position)) {
event.handled = true;
_sceneMode = 10;
- _field414 = 4;
+ _moveMode = 4;
}
} else if (_walkRect5.contains(event.mousePos)) {
if (!_walkRect5.contains(R2_GLOBALS._player._position)) {
event.handled = true;
_sceneMode = 10;
- _field414 = 5;
+ _moveMode = 5;
}
} else if (_walkRect6.contains(event.mousePos)) {
if (!_walkRect6.contains(R2_GLOBALS._player._position)) {
event.handled = true;
_sceneMode = 10;
- _field414 = 6;
+ _moveMode = 6;
}
} else {
event.handled = true;
@@ -3636,9 +3635,9 @@ void Scene2700::process(Event &event) {
}
if (_sceneMode == 10) {
R2_GLOBALS._player.disableControl();
- switch (_field412) {
+ switch (_areaMode) {
case 0:
- if (_field414 >= 6) {
+ if (_moveMode >= 6) {
Common::Point pt(205, 162);
NpcMover *mover = new NpcMover();
R2_GLOBALS._player.addMover(mover, &pt, this);
@@ -3661,11 +3660,11 @@ void Scene2700::process(Event &event) {
break;
}
case 3:
- if (_field414 == 1) {
+ if (_moveMode == 1) {
Common::Point pt(80, 137);
NpcMover *mover = new NpcMover();
R2_GLOBALS._player.addMover(mover, &pt, this);
- } else if (_field414 == 6) {
+ } else if (_moveMode == 6) {
Common::Point pt(140, 162);
NpcMover *mover = new NpcMover();
R2_GLOBALS._player.addMover(mover, &pt, this);
@@ -3676,7 +3675,7 @@ void Scene2700::process(Event &event) {
}
break;
case 4:
- if (_field414 == 5) {
+ if (_moveMode == 5) {
Common::Point pt(235, 132);
NpcMover *mover = new NpcMover();
R2_GLOBALS._player.addMover(mover, &pt, this);
@@ -3713,15 +3712,15 @@ void Scene2700::process(Event &event) {
*--------------------------------------------------------------------------*/
Scene2750::Scene2750(): SceneExt() {
- _field412 = _field414 = _field416 = 0;
+ _areaMode = _moveMode = _stripNumber = 0;
}
void Scene2750::synchronize(Serializer &s) {
SceneExt::synchronize(s);
- s.syncAsSint16LE(_field412);
- s.syncAsSint16LE(_field414);
- s.syncAsSint16LE(_field416);
+ s.syncAsSint16LE(_areaMode);
+ s.syncAsSint16LE(_moveMode);
+ s.syncAsSint16LE(_stripNumber);
}
void Scene2750::Action1::signal() {
@@ -3731,20 +3730,20 @@ void Scene2750::Action1::signal() {
case 1:
setDelay(60 + R2_GLOBALS._randomSource.getRandomNumber(240));
_actionIndex = 2;
- scene->_actor5.show();
- scene->_actor5.animate(ANIM_MODE_8, 1, NULL);
+ scene->_bird2.show();
+ scene->_bird2.animate(ANIM_MODE_8, 1, NULL);
break;
case 2:
setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(600));
_actionIndex = 0;
- scene->_actor5.show();
- scene->_actor3.animate(ANIM_MODE_2, NULL);
+ scene->_bird2.show();
+ scene->_bird1.animate(ANIM_MODE_2, NULL);
break;
default:
setDelay(30);
_actionIndex = 1;
- scene->_actor3.animate(ANIM_MODE_6, NULL);
- scene->_actor4.animate(ANIM_MODE_8, 1, NULL);
+ scene->_bird1.animate(ANIM_MODE_6, NULL);
+ scene->_folliage1.animate(ANIM_MODE_8, 1, NULL);
break;
}
}
@@ -3753,20 +3752,20 @@ void Scene2750::Action2::signal() {
Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene;
setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300));
- scene->_actor6.animate(ANIM_MODE_8, 1, NULL);
+ scene->_folliage2.animate(ANIM_MODE_8, 1, NULL);
}
void Scene2750::Action3::signal() {
Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene;
- if (scene->_actor7._position.x <= 320) {
+ if (scene->_folliage3._position.x <= 320) {
setDelay(1800 + R2_GLOBALS._randomSource.getRandomNumber(600));
} else {
setDelay(60);
- scene->_actor7.setPosition(Common::Point(-10, 25));
+ scene->_folliage3.setPosition(Common::Point(-10, 25));
Common::Point pt(330, 45);
NpcMover *mover = new NpcMover();
- scene->_actor7.addMover(mover, &pt, NULL);
+ scene->_folliage3.addMover(mover, &pt, NULL);
}
}
@@ -3774,28 +3773,28 @@ void Scene2750::Action4::signal() {
Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene;
setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300));
- scene->_actor8.animate(ANIM_MODE_8, 1, NULL);
+ scene->_folliage4.animate(ANIM_MODE_8, 1, NULL);
}
void Scene2750::Action5::signal() {
Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene;
setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300));
- scene->_actor9.animate(ANIM_MODE_8, 1, NULL);
+ scene->_folliage5.animate(ANIM_MODE_8, 1, NULL);
}
void Scene2750::Action6::signal() {
Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene;
setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300));
- scene->_actor10.animate(ANIM_MODE_8, 1, NULL);
+ scene->_folliage6.animate(ANIM_MODE_8, 1, NULL);
}
void Scene2750::Action7::signal() {
Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene;
setDelay(600 + R2_GLOBALS._randomSource.getRandomNumber(300));
- scene->_actor11.animate(ANIM_MODE_8, 1, NULL);
+ scene->_folliage7.animate(ANIM_MODE_8, 1, NULL);
}
void Scene2750::Area1::process(Event &event) {
@@ -3804,8 +3803,8 @@ void Scene2750::Area1::process(Event &event) {
Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene;
R2_GLOBALS._player.disableControl();
scene->_sceneMode = 10;
- scene->_field414 = 2752;
- switch (scene->_field412) {
+ scene->_moveMode = 2752;
+ switch (scene->_areaMode) {
case 1: {
scene->_sceneMode = 2752;
scene->setAction(&scene->_sequenceManager, scene, 2752, &R2_GLOBALS._player, NULL);
@@ -3835,8 +3834,8 @@ void Scene2750::Area2::process(Event &event) {
Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene;
R2_GLOBALS._player.disableControl();
scene->_sceneMode = 10;
- scene->_field414 = 2753;
- switch (scene->_field412) {
+ scene->_moveMode = 2753;
+ switch (scene->_areaMode) {
case 1: {
Common::Point pt(140, 142);
NpcMover *mover = new NpcMover();
@@ -3867,73 +3866,73 @@ void Scene2750::postInit(SceneObjectList *OwnerList) {
_area1.setDetails(Rect(0, 90, 20, 135), EXITCURSOR_W);
_area2.setDetails(Rect(300, 90, 320, 135), EXITCURSOR_E);
- _rect1.set(30, 127, 155, 147);
- _rect2.set(130, 142, 210, 167);
- _rect3.set(-1, 137, 290, 147);
+ _walkRect1.set(30, 127, 155, 147);
+ _walkRect2.set(130, 142, 210, 167);
+ _walkRect3.set(-1, 137, 290, 147);
if (R2_INVENTORY.getObjectScene(R2_FLUTE) == 0) {
R2_GLOBALS._sound1.changeSound(235);
- _actor2.postInit();
- _actor2.setup(2751, 1, 1);
- _actor2.setPosition(Common::Point(104, 158));
- _actor2.animate(ANIM_MODE_2, NULL);
- }
-
- _actor3.postInit();
- _actor3.setup(2750, 1, 1);
- _actor3.setPosition(Common::Point(188, 34));
- _actor3.animate(ANIM_MODE_2, NULL);
- _actor3._numFrames = 16;
-
- _actor4.postInit();
- _actor4.setup(2700, 4, 1);
- _actor4.setPosition(Common::Point(188, 37));
- _actor4.fixPriority(26);
-
- _actor5.postInit();
- _actor5.setup(2750, 2, 1);
- _actor5.setPosition(Common::Point(188, 34));
- _actor5.hide();
-
- _actor3.setAction(&_action1);
-
- _actor6.postInit();
- _actor6.setup(2750, 3, 1);
- _actor6.setPosition(Common::Point(9, 167));
- _actor6.fixPriority(252);
- _actor6.setAction(&_action2);
-
- _actor7.postInit();
- _actor7.setup(2750, 4, 1);
- _actor7.setPosition(Common::Point(-10, 25));
- _actor7.animate(ANIM_MODE_1, NULL);
- _actor7.setStrip2(4);
- _actor7._moveRate = 20;
- _actor7.setAction(&_action3);
-
- _actor8.postInit();
- _actor8.fixPriority(26);
- _actor8.setup(2750, 5, 1);
- _actor8.setPosition(Common::Point(258, 33));
- _actor8.setAction(&_action4);
-
- _actor9.postInit();
- _actor9.fixPriority(26);
- _actor9.setup(2750, 6, 1);
- _actor9.setPosition(Common::Point(61, 38));
- _actor9.setAction(&_action5);
-
- _actor10.postInit();
- _actor10.fixPriority(26);
- _actor10.setup(2750, 7, 1);
- _actor10.setPosition(Common::Point(69, 37));
- _actor10.setAction(&_action6);
-
- _actor11.postInit();
- _actor11.fixPriority(26);
- _actor11.setup(2750, 8, 1);
- _actor11.setPosition(Common::Point(80, 35));
- _actor11.setAction(&_action7);
+ _fire.postInit();
+ _fire.setup(2751, 1, 1);
+ _fire.setPosition(Common::Point(104, 158));
+ _fire.animate(ANIM_MODE_2, NULL);
+ }
+
+ _bird1.postInit();
+ _bird1.setup(2750, 1, 1);
+ _bird1.setPosition(Common::Point(188, 34));
+ _bird1.animate(ANIM_MODE_2, NULL);
+ _bird1._numFrames = 16;
+
+ _folliage1.postInit();
+ _folliage1.setup(2700, 4, 1);
+ _folliage1.setPosition(Common::Point(188, 37));
+ _folliage1.fixPriority(26);
+
+ _bird2.postInit();
+ _bird2.setup(2750, 2, 1);
+ _bird2.setPosition(Common::Point(188, 34));
+ _bird2.hide();
+
+ _bird1.setAction(&_action1);
+
+ _folliage2.postInit();
+ _folliage2.setup(2750, 3, 1);
+ _folliage2.setPosition(Common::Point(9, 167));
+ _folliage2.fixPriority(252);
+ _folliage2.setAction(&_action2);
+
+ _folliage3.postInit();
+ _folliage3.setup(2750, 4, 1);
+ _folliage3.setPosition(Common::Point(-10, 25));
+ _folliage3.animate(ANIM_MODE_1, NULL);
+ _folliage3.setStrip2(4);
+ _folliage3._moveRate = 20;
+ _folliage3.setAction(&_action3);
+
+ _folliage4.postInit();
+ _folliage4.fixPriority(26);
+ _folliage4.setup(2750, 5, 1);
+ _folliage4.setPosition(Common::Point(258, 33));
+ _folliage4.setAction(&_action4);
+
+ _folliage5.postInit();
+ _folliage5.fixPriority(26);
+ _folliage5.setup(2750, 6, 1);
+ _folliage5.setPosition(Common::Point(61, 38));
+ _folliage5.setAction(&_action5);
+
+ _folliage6.postInit();
+ _folliage6.fixPriority(26);
+ _folliage6.setup(2750, 7, 1);
+ _folliage6.setPosition(Common::Point(69, 37));
+ _folliage6.setAction(&_action6);
+
+ _folliage7.postInit();
+ _folliage7.fixPriority(26);
+ _folliage7.setup(2750, 8, 1);
+ _folliage7.setPosition(Common::Point(80, 35));
+ _folliage7.setAction(&_action7);
_ghoulHome1.setDetails(Rect(29, 50, 35, 56), 2750, 3, -1, 5, 1, NULL);
_ghoulHome2.setDetails(Rect(47, 36, 54, 42), 2750, 3, -1, 5, 1, NULL);
@@ -3966,20 +3965,20 @@ void Scene2750::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player.animate(ANIM_MODE_NONE, NULL);
R2_GLOBALS._player.setPosition(Common::Point(81, 165));
R2_GLOBALS._events.setCursor(CURSOR_WALK);
- _field416 = 1204;
+ _stripNumber = 1204;
_sceneMode = 11;
- _stripManager.start(_field416, this);
+ _stripManager.start(_stripNumber, this);
} else {
_sceneMode = 2750;
- _field412 = 1;
+ _areaMode = 1;
R2_GLOBALS._player.setAction(&_sequenceManager, this, 2750, &R2_GLOBALS._player, NULL);
}
} else if (R2_GLOBALS._sceneManager._previousScene == 2800) {
_sceneMode = 2751;
- _field412 = 3;
+ _areaMode = 3;
R2_GLOBALS._player.setAction(&_sequenceManager, this, 2751, &R2_GLOBALS._player, NULL);
} else {
- _field412 = 1;
+ _areaMode = 1;
R2_GLOBALS._player.setPosition(Common::Point(90, 137));
R2_GLOBALS._player.setStrip(3);
R2_GLOBALS._player.enableControl();
@@ -3988,19 +3987,19 @@ void Scene2750::postInit(SceneObjectList *OwnerList) {
void Scene2750::signal() {
switch (_sceneMode) {
case 10:
- switch (_field414) {
+ switch (_moveMode) {
case 1:
- switch (_field412) {
+ switch (_areaMode) {
case 2: {
- _sceneMode = _field414;
- _field412 = 1;
+ _sceneMode = _moveMode;
+ _areaMode = 1;
Common::Point pt(90, 137);
NpcMover *mover = new NpcMover();
R2_GLOBALS._player.addMover(mover, &pt, this);
}
break;
case 3: {
- _field412 = 2;
+ _areaMode = 2;
Common::Point pt(140, 142);
NpcMover *mover = new NpcMover();
R2_GLOBALS._player.addMover(mover, &pt, this);
@@ -4011,25 +4010,25 @@ void Scene2750::signal() {
}
break;
case 2: {
- _sceneMode = _field414;
- _field412 = 2;
+ _sceneMode = _moveMode;
+ _areaMode = 2;
Common::Point pt(170, 162);
NpcMover *mover = new NpcMover();
R2_GLOBALS._player.addMover(mover, &pt, this);
}
break;
case 3:
- switch (_field412) {
+ switch (_areaMode) {
case 1: {
- _field412 = 2;
+ _areaMode = 2;
Common::Point pt(210, 142);
NpcMover *mover = new NpcMover();
R2_GLOBALS._player.addMover(mover, &pt, this);
}
break;
case 2: {
- _sceneMode = _field414;
- _field412 = 3;
+ _sceneMode = _moveMode;
+ _areaMode = 3;
Common::Point pt(270, 142);
NpcMover *mover = new NpcMover();
R2_GLOBALS._player.addMover(mover, &pt, this);
@@ -4040,20 +4039,20 @@ void Scene2750::signal() {
}
break;
case 2752:
- switch (_field412) {
+ switch (_areaMode) {
case 1:
- _sceneMode = _field414;
+ _sceneMode = _moveMode;
setAction(&_sequenceManager, this, 2752, &R2_GLOBALS._player, NULL);
break;
case 2: {
- _field412 = 1;
+ _areaMode = 1;
Common::Point pt(20, 132);
NpcMover *mover = new NpcMover();
R2_GLOBALS._player.addMover(mover, &pt, this);
}
break;
case 3: {
- _field412 = 2;
+ _areaMode = 2;
Common::Point pt(140, 142);
NpcMover *mover = new NpcMover();
R2_GLOBALS._player.addMover(mover, &pt, this);
@@ -4064,23 +4063,23 @@ void Scene2750::signal() {
}
break;
case 2753:
- switch (_field412) {
+ switch (_areaMode) {
case 1: {
- _field412 = 2;
+ _areaMode = 2;
Common::Point pt(210, 142);
NpcMover *mover = new NpcMover();
R2_GLOBALS._player.addMover(mover, &pt, this);
}
break;
case 2: {
- _field412 = 3;
+ _areaMode = 3;
Common::Point pt(300, 132);
NpcMover *mover = new NpcMover();
R2_GLOBALS._player.addMover(mover, &pt, this);
}
break;
case 3:
- _sceneMode = _field414;
+ _sceneMode = _moveMode;
setAction(&_sequenceManager, this, 2753, &R2_GLOBALS._player, NULL);
break;
default:
@@ -4106,24 +4105,25 @@ void Scene2750::signal() {
}
void Scene2750::process(Event &event) {
- if ((R2_GLOBALS._player._canWalk) && (event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == R2_NEGATOR_GUN)) {
- if (_rect1.contains(event.mousePos)) {
- if (!_rect1.contains(R2_GLOBALS._player._position)) {
+ if ((R2_GLOBALS._player._canWalk) && (event.eventType == EVENT_BUTTON_DOWN)
+ && (R2_GLOBALS._events.getCursor() == R2_NEGATOR_GUN)) {
+ if (_walkRect1.contains(event.mousePos)) {
+ if (!_walkRect1.contains(R2_GLOBALS._player._position)) {
event.handled = true;
_sceneMode = 10;
- _field414 = 1;
+ _moveMode = 1;
}
- } else if (_rect2.contains(event.mousePos)) {
- if (!_rect2.contains(R2_GLOBALS._player._position)) {
+ } else if (_walkRect2.contains(event.mousePos)) {
+ if (!_walkRect2.contains(R2_GLOBALS._player._position)) {
event.handled = true;
_sceneMode = 10;
- _field414 = 2;
+ _moveMode = 2;
}
- } else if (_rect3.contains(event.mousePos)) {
- if (!_rect3.contains(R2_GLOBALS._player._position)) {
+ } else if (_walkRect3.contains(event.mousePos)) {
+ if (!_walkRect3.contains(R2_GLOBALS._player._position)) {
event.handled = true;
_sceneMode = 10;
- _field414 = 3;
+ _moveMode = 3;
}
} else {
event.handled = true;
@@ -4132,7 +4132,7 @@ void Scene2750::process(Event &event) {
if (_sceneMode == 10) {
R2_GLOBALS._player.disableControl();
- switch (_field412) {
+ switch (_areaMode) {
case 1: {
Common::Point pt(140, 142);
NpcMover *mover = new NpcMover();
@@ -4140,7 +4140,7 @@ void Scene2750::process(Event &event) {
}
break;
case 2:
- if (_field414 == 1) {
+ if (_moveMode == 1) {
Common::Point pt(140, 142);
NpcMover *mover = new NpcMover();
R2_GLOBALS._player.addMover(mover, &pt, this);
@@ -4170,13 +4170,13 @@ void Scene2750::process(Event &event) {
*--------------------------------------------------------------------------*/
Scene2800::Scene2800(): SceneExt() {
- _field412 = 0;
+ _stripNumber = 0;
}
void Scene2800::synchronize(Serializer &s) {
SceneExt::synchronize(s);
- s.syncAsSint16LE(_field412);
+ s.syncAsSint16LE(_stripNumber);
}
bool Scene2800::Outpost::startAction(CursorType action, Event &event) {
@@ -4198,16 +4198,16 @@ bool Scene2800::Guard::startAction(CursorType action, Event &event) {
R2_GLOBALS._player.disableControl();
R2_GLOBALS._events.setCursor(CURSOR_WALK);
R2_GLOBALS.setFlag(47);
- scene->_field412 = 1205;
+ scene->_stripNumber = 1205;
scene->_sceneMode = 2803;
- scene->_stripManager.start(scene->_field412, scene);
+ scene->_stripManager.start(scene->_stripNumber, scene);
return true;
} else if (action == R2_SONIC_STUNNER) {
R2_GLOBALS._events.setCursor(CURSOR_ARROW);
R2_GLOBALS._player.disableControl();
R2_GLOBALS.setFlag(47);
scene->_sceneMode = 10;
- scene->setAction(&scene->_sequenceManager, scene, 2802, &R2_GLOBALS._player, &scene->_actor2, &scene->_guard, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 2802, &R2_GLOBALS._player, &scene->_nej, &scene->_guard, NULL);
return true;
} else
return SceneActor::startAction(action, event);
@@ -4220,10 +4220,10 @@ void Scene2800::Action1::signal() {
setDelay(120);
Common::Point pt(330, 25);
NpcMover *mover = new NpcMover();
- scene->_object1.addMover(mover, &pt, NULL);
+ scene->_bird.addMover(mover, &pt, NULL);
} else {
setDelay(1800 + R2_GLOBALS._randomSource.getRandomNumber(600));
- scene->_object1.setPosition(Common::Point(-10, 45));
+ scene->_bird.setPosition(Common::Point(-10, 45));
}
}
@@ -4364,8 +4364,8 @@ void Scene2800::Action2::signal() {
}
case 13:
R2_GLOBALS._events.setCursor(CURSOR_WALK);
- scene->_field412 = 1207;
- scene->_stripManager.start(scene->_field412, this);
+ scene->_stripNumber = 1207;
+ scene->_stripManager.start(scene->_stripNumber, this);
break;
case 14: {
R2_GLOBALS._player.disableControl();
@@ -4431,20 +4431,20 @@ void Scene2800::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._sound2.stop();
SceneExt::postInit();
- _object1.postInit();
- _object1.setup(2750, 4, 1);
- _object1.setPosition(Common::Point(-10, 25));
- _object1.animate(ANIM_MODE_1, NULL);
- _object1.setStrip2(4);
- _object1._moveRate = 20;
- _object1.setAction(&_action1);
-
- _actor3.postInit();
- _actor3.setup(2802, 1, 1);
- _actor3.setPosition(Common::Point(116, 80));
- _actor3.fixPriority(111);
- _actor3.animate(ANIM_MODE_2, NULL);
- _actor3._numFrames = 6;
+ _bird.postInit();
+ _bird.setup(2750, 4, 1);
+ _bird.setPosition(Common::Point(-10, 25));
+ _bird.animate(ANIM_MODE_1, NULL);
+ _bird.setStrip2(4);
+ _bird._moveRate = 20;
+ _bird.setAction(&_action1);
+
+ _lightBar.postInit();
+ _lightBar.setup(2802, 1, 1);
+ _lightBar.setPosition(Common::Point(116, 80));
+ _lightBar.fixPriority(111);
+ _lightBar.animate(ANIM_MODE_2, NULL);
+ _lightBar._numFrames = 6;
if (!R2_GLOBALS.getFlag(47)) {
_guard.postInit();
@@ -4458,7 +4458,7 @@ void Scene2800::postInit(SceneObjectList *OwnerList) {
_guard.setDetails(2800, -1, -1, -1, 1, (SceneItem *)NULL);
}
- _item1.setDetails(Rect(0, 0, 320, 200), 2800, -1, -1, -1, 1, NULL);
+ _background.setDetails(Rect(0, 0, 320, 200), 2800, -1, -1, -1, 1, NULL);
_stripManager.setColors(60, 255);
_stripManager.setFontNumber(3);
@@ -4471,12 +4471,12 @@ void Scene2800::postInit(SceneObjectList *OwnerList) {
if (R2_GLOBALS.getFlag(47)) {
_outpost.setDetails(Rect(76, 45, 155, 90), 2800, 3, -1, -1, 2, NULL);
} else {
- _actor2.postInit();
- _actor2.setup(2752, 5, 1);
- _actor2.animate(ANIM_MODE_NONE, NULL);
- _actor2.changeZoom(100);
- _actor2._moveDiff = Common::Point(2, 1);
- _actor2.setPosition(Common::Point(101, 148));
+ _nej.postInit();
+ _nej.setup(2752, 5, 1);
+ _nej.animate(ANIM_MODE_NONE, NULL);
+ _nej.changeZoom(100);
+ _nej._moveDiff = Common::Point(2, 1);
+ _nej.setPosition(Common::Point(101, 148));
}
}
@@ -4498,7 +4498,8 @@ void Scene2800::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player.enableControl();
} else {
_sceneMode = 2801;
- R2_GLOBALS._player.setAction(&_sequenceManager, this, 2801, &R2_GLOBALS._player, &_actor2, &_guard, NULL);
+ R2_GLOBALS._player.setAction(&_sequenceManager, this, 2801, &R2_GLOBALS._player,
+ &_nej, &_guard, NULL);
}
}
@@ -4507,13 +4508,13 @@ void Scene2800::signal() {
case 10:
R2_GLOBALS._sound1.play(238);
R2_GLOBALS._events.setCursor(CURSOR_WALK);
- _field412 = 1206;
+ _stripNumber = 1206;
_sceneMode = 2804;
- _stripManager.start(_field412, this);
+ _stripManager.start(_stripNumber, this);
break;
case 11:
- _actor2.remove();
- _object1.setAction(NULL);
+ _nej.remove();
+ _bird.setAction(NULL);
R2_GLOBALS._player.enableControl(CURSOR_WALK);
R2_GLOBALS._player._moveDiff = Common::Point(3, 2);
_outpost.setDetails(Rect(76, 45, 155, 90), 2800, 3, -1, -1, 2, NULL);
@@ -4533,15 +4534,15 @@ void Scene2800::signal() {
case 2803:
R2_GLOBALS._player.disableControl();
_sceneMode = 10;
- setAction(&_sequenceManager, this, 2803, &R2_GLOBALS._player, &_actor2, &_guard, NULL);
+ setAction(&_sequenceManager, this, 2803, &R2_GLOBALS._player, &_nej, &_guard, NULL);
break;
case 2804:
R2_GLOBALS._player.disableControl();
_sceneMode = 11;
- setAction(&_sequenceManager, this, 2804, &R2_GLOBALS._player, &_actor2, NULL);
+ setAction(&_sequenceManager, this, 2804, &R2_GLOBALS._player, &_nej, NULL);
break;
case 2805:
- _object1.remove();
+ _bird.remove();
setAction(&_action2);
break;
default:
@@ -4616,8 +4617,8 @@ bool Scene2900::KnobLeft::startAction(CursorType action, Event &event) {
switch (action) {
case CURSOR_USE:
- if (scene->_field416 || scene->_altitudeChanging ||
- scene->_field425 != scene->_field426) {
+ if (scene->_majorMinorFlag || scene->_altitudeChanging ||
+ scene->_xAmount != scene->_xComparison) {
// Let your altitude stablize first
SceneItem::display2(2900, 17);
} else if (R2_GLOBALS._balloonAltitude / 48 == 0) {
@@ -4628,7 +4629,7 @@ bool Scene2900::KnobLeft::startAction(CursorType action, Event &event) {
R2_GLOBALS._sound2.fadeSound(282);
scene->_altitudeChanging = true;
scene->_altitudeMajorChange = -1;
- scene->_field426 = 100 - ((R2_GLOBALS._balloonAltitude / 48) - 1) * 25;
+ scene->_xComparison = 100 - ((R2_GLOBALS._balloonAltitude / 48) - 1) * 25;
}
break;
@@ -4653,8 +4654,8 @@ bool Scene2900::KnobRight::startAction(CursorType action, Event &event) {
switch (action) {
case CURSOR_USE:
- if (scene->_field416 || scene->_altitudeChanging ||
- scene->_field425 != scene->_field426) {
+ if (scene->_majorMinorFlag || scene->_altitudeChanging ||
+ scene->_xAmount != scene->_xComparison) {
// Let your altitude stablize first
SceneItem::display2(2900, 17);
} else if (R2_GLOBALS._balloonAltitude / 48 >= 3) {
@@ -4665,7 +4666,7 @@ bool Scene2900::KnobRight::startAction(CursorType action, Event &event) {
R2_GLOBALS._sound2.fadeSound(212);
scene->_altitudeChanging = true;
scene->_altitudeMajorChange = 1;
- scene->_field426 = 100 - ((R2_GLOBALS._balloonAltitude / 48) + 1) * 25;
+ scene->_xComparison = 100 - ((R2_GLOBALS._balloonAltitude / 48) + 1) * 25;
}
break;
@@ -4703,22 +4704,22 @@ void Scene2900::Action1::signal() {
Scene2900 *scene = (Scene2900 *)R2_GLOBALS._sceneManager._scene;
setDelay(3);
- if (!scene->_field416 && !scene->_altitudeChanging) {
- scene->_field427 = 2;
- scene->_field412 = 0;
- } else if (scene->_field416) {
+ if (!scene->_majorMinorFlag && !scene->_altitudeChanging) {
+ scene->_fadeCounter = 2;
+ scene->_controlsActiveChanging = false;
+ } else if (scene->_majorMinorFlag) {
R2_GLOBALS._sound2.fadeOut2(NULL);
- } else if (scene->_field427 == 0) {
+ } else if (scene->_fadeCounter == 0) {
R2_GLOBALS._sound2.fadeOut2(NULL);
- } else if (scene->_field412 == 0) {
+ } else if (!scene->_controlsActiveChanging) {
scene->_knobLeftContent.hide();
scene->_knobRightContent.hide();
- scene->_field412 = 1;
+ scene->_controlsActiveChanging = true;
} else {
- --scene->_field427;
+ --scene->_fadeCounter;
scene->_knobLeftContent.show();
scene->_knobRightContent.show();
- scene->_field412 = 0;
+ scene->_controlsActiveChanging = false;
}
}
@@ -4726,10 +4727,6 @@ void Scene2900::Action1::signal() {
Scene2900::Map::Map() {
_mapWidth = _mapHeight = 0;
- _field4 = 0;
- _field6 = 0;
- _field8 = 0;
- _fieldA = 0;
_resNum = 0;
_xV = _yV = 0;
_bounds = Rect(40, 0, 280, 150);
@@ -4935,37 +4932,37 @@ void Scene2900::Map::moveLine(int xpSrc, int ypSrc, int xpDest, int ypDest, int
/*------------------------------------------------------------------------*/
Scene2900::Scene2900(): SceneExt() {
- _field412 = 0;
+ _controlsActiveChanging = false;
_altitudeChanging = false;
- _field416 = false;
+ _majorMinorFlag = false;
_balloonLocation = Common::Point(550, 550);
- _field41C = 0;
+ _altitudeMinorChange = 0;
_altitudeMajorChange = 0;
_balloonScreenPos = Common::Point(160, 100);
_newAltitude = 0;
- _field425 = 100;
- _field426 = 100;
- _field427 = 0;
- _field8F8 = false;
+ _xAmount = 100;
+ _xComparison = 100;
+ _fadeCounter = 0;
+ _paletteReloadNeeded = false;
}
void Scene2900::synchronize(Serializer &s) {
SceneExt::synchronize(s);
- s.syncAsSint16LE(_field412);
+ s.syncAsSint16LE(_controlsActiveChanging);
s.syncAsSint16LE(_altitudeChanging);
- s.syncAsSint16LE(_field416);
- s.syncAsSint16LE(_field41C);
+ s.syncAsSint16LE(_majorMinorFlag);
+ s.syncAsSint16LE(_altitudeMinorChange);
s.syncAsSint16LE(_altitudeMajorChange);
s.syncAsSint16LE(_balloonLocation.x);
s.syncAsSint16LE(_balloonLocation.y);
s.syncAsSint16LE(_balloonScreenPos.x);
s.syncAsSint16LE(_balloonScreenPos.y);
s.syncAsSint16LE(_newAltitude);
- s.syncAsSint16LE(_field425);
- s.syncAsSint16LE(_field426);
- s.syncAsSint16LE(_field427);
- s.syncAsSint16LE(_field8F8);
+ s.syncAsSint16LE(_xAmount);
+ s.syncAsSint16LE(_xComparison);
+ s.syncAsSint16LE(_fadeCounter);
+ s.syncAsSint16LE(_paletteReloadNeeded);
_map.synchronize(s);
}
@@ -5062,16 +5059,16 @@ void Scene2900::postInit(SceneObjectList *OwnerList) {
if (_balloonLocation.y <= 100)
_balloonScreenPos.y = _balloonLocation.y;
- _field425 = _field426 = 100 - (R2_GLOBALS._balloonAltitude / 48) * 25;
+ _xAmount = _xComparison = 100 - (R2_GLOBALS._balloonAltitude / 48) * 25;
_map.setPosition(Common::Point(_balloonLocation.x - 120, _balloonLocation.y - 100));
_sceneMode = 11;
- R2_GLOBALS._player.changeZoom(_field425);
+ R2_GLOBALS._player.changeZoom(_xAmount);
R2_GLOBALS._player.setPosition(_balloonScreenPos);
R2_GLOBALS._player.enableControl();
R2_GLOBALS._player._canWalk = false;
- _altimeterContent.setPosition(Common::Point(109 - _field425, 189));
+ _altimeterContent.setPosition(Common::Point(109 - _xAmount, 189));
}
R2_GLOBALS._sound1.play(211);
@@ -5112,51 +5109,51 @@ void Scene2900::dispatch() {
if (_sceneMode == 11) {
_balloonLocation.x += balloonData[R2_GLOBALS._balloonAltitude].x;
_balloonLocation.y += balloonData[R2_GLOBALS._balloonAltitude].y;
- _field41C = balloonData[R2_GLOBALS._balloonAltitude].v3;
+ _altitudeMinorChange = balloonData[R2_GLOBALS._balloonAltitude].v3;
- if (_field41C == 0) {
- _field416 = false;
+ if (_altitudeMinorChange == 0) {
+ _majorMinorFlag = false;
} else {
- _field416 = true;
+ _majorMinorFlag = true;
_altitudeChanging = false;
- _field426 = 100 - ((R2_GLOBALS._balloonAltitude / 48) + _field41C) * 25;
+ _xComparison = 100 - ((R2_GLOBALS._balloonAltitude / 48) + _altitudeMinorChange) * 25;
}
// Zooming/altitude balloon change
- if (_field425 == _field426) {
- _field416 = false;
+ if (_xAmount == _xComparison) {
+ _majorMinorFlag = false;
} else {
- if (!_field416) {
- _field425 = _field425 - _altitudeMajorChange;
+ if (!_majorMinorFlag) {
+ _xAmount = _xAmount - _altitudeMajorChange;
} else {
- _field425 = _field425 - _field41C;
+ _xAmount = _xAmount - _altitudeMinorChange;
}
- if (_field41C == -1 || _altitudeMajorChange == -1) {
+ if (_altitudeMinorChange == -1 || _altitudeMajorChange == -1) {
if (_altimeterContent._frame == 1) {
_altimeterContent.setFrame2(10);
} else {
_altimeterContent.setFrame2(_altimeterContent._frame - 1);
}
- } else if (_field41C == -1 || _altitudeMajorChange == 1) {
+ } else if (_altitudeMinorChange == -1 || _altitudeMajorChange == 1) {
if (_altimeterContent._frame == 10)
_altimeterContent.setFrame2(1);
else
_altimeterContent.setFrame2(_altimeterContent._frame + 1);
}
- _altimeterContent.setPosition(Common::Point(109 - _field425, 189));
- R2_GLOBALS._player.changeZoom(_field425);
+ _altimeterContent.setPosition(Common::Point(109 - _xAmount, 189));
+ R2_GLOBALS._player.changeZoom(_xAmount);
}
- if (!_field8F8) {
+ if (!_paletteReloadNeeded) {
R2_GLOBALS._scenePalette.loadPalette(2950);
R2_GLOBALS._scenePalette.refresh();
}
R2_GLOBALS._balloonPosition = _map.setPosition(
- Common::Point(_balloonLocation.x - 120, _balloonLocation.y - 100), !_field8F8);
- _field8F8 = true;
+ Common::Point(_balloonLocation.x - 120, _balloonLocation.y - 100), !_paletteReloadNeeded);
+ _paletteReloadNeeded = true;
if (_balloonLocation.x <= 120)
_balloonScreenPos.x = _balloonLocation.x + 40;
@@ -5168,7 +5165,7 @@ void Scene2900::dispatch() {
R2_GLOBALS._player.setPosition(_balloonScreenPos);
- if ((_balloonLocation.x % 100) == 50 && (_balloonLocation.y % 100) == 50 && !_field416) {
+ if ((_balloonLocation.x % 100) == 50 && (_balloonLocation.y % 100) == 50 && !_majorMinorFlag) {
// At an altitude change point, so calculate new altitude
_newAltitude = R2_GLOBALS._balloonAltitude;
if (_altitudeChanging) {
diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.h b/engines/tsage/ringworld2/ringworld2_scenes2.h
index f90126b5a1..1d0cfc41f8 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes2.h
+++ b/engines/tsage/ringworld2/ringworld2_scenes2.h
@@ -69,9 +69,9 @@ public:
bool _exitingFlag;
int _mazePlayerMode;
- NamedHotspot _item1;
- SceneActor _object1;
- SceneActor _objList1[11];
+ NamedHotspot _background;
+ SceneActor _companion;
+ SceneActor _persons[11];
WestExit _westExit;
EastExit _eastExit;
SouthExit _southExit;
@@ -92,10 +92,10 @@ public:
};
class Scene2350 : public SceneExt {
- class Actor2 : public SceneActor {
+ class Companion : public SceneActor {
virtual bool startAction(CursorType action, Event &event);
};
- class Actor3 : public SceneActor {
+ class Balloon : public SceneActor {
virtual bool startAction(CursorType action, Event &event);
};
@@ -106,14 +106,13 @@ class Scene2350 : public SceneExt {
virtual void changeScene();
};
public:
-
SpeakerQuinn _quinnSpeaker;
SpeakerPharisha _pharishaSpeaker;
- NamedHotspot _item1;
- SceneActor _actor1;
- Actor2 _actor2;
- Actor3 _actor3;
- Actor3 _actor4;
+ NamedHotspot _background;
+ SceneActor _person;
+ Companion _companion;
+ Balloon _balloon;
+ Balloon _harness;
ExitUp _exitUp;
ExitWest _exitWest;
SequenceManager _sequenceManager;
@@ -125,15 +124,15 @@ public:
};
class Scene2400 : public SceneExt {
- class Exit1 : public SceneExit {
+ class WestExit : public SceneExit {
virtual void changeScene();
};
- class Exit2 : public SceneExit {
+ class EastExit : public SceneExit {
virtual void changeScene();
};
public:
- Exit1 _exit1;
- Exit2 _exit2;
+ WestExit _westExit;
+ EastExit _eastExit;
SequenceManager _sequenceManager;
virtual void postInit(SceneObjectList *OwnerList = NULL);
@@ -153,7 +152,7 @@ class Scene2425 : public SceneExt {
public:
virtual bool startAction(CursorType action, Event &event);
};
- class Item4 : public NamedHotspot {
+ class Background : public NamedHotspot {
public:
virtual bool startAction(CursorType action, Event &event);
};
@@ -175,7 +174,7 @@ public:
RopeDest1 _ropeDest1;
RopeDest2 _ropeDest2;
Crevasse _crevasse;
- Item4 _item4;
+ Background _background;
Rope _rope;
Pictographs _pictographs1;
Pictographs _pictographs2;
@@ -188,7 +187,7 @@ public:
};
class Scene2430 : public SceneExt {
- class Actor1 : public SceneActor {
+ class Companion : public SceneActor {
public:
bool startAction(CursorType action, Event &event);
};
@@ -206,20 +205,20 @@ class Scene2430 : public SceneExt {
virtual void changeScene();
};
public:
- NamedHotspot _item1;
- NamedHotspot _item2;
- NamedHotspot _item3;
- NamedHotspot _item4;
- NamedHotspot _item5;
- NamedHotspot _item6;
- NamedHotspot _item7;
- NamedHotspot _item8;
- NamedHotspot _item9;
- NamedHotspot _item10;
- NamedHotspot _item11;
- NamedHotspot _item12;
- NamedHotspot _item13;
- Actor1 _actor1;
+ NamedHotspot _background;
+ NamedHotspot _bottles2;
+ NamedHotspot _furnishings;
+ NamedHotspot _rug1;
+ NamedHotspot _mirror;
+ NamedHotspot _garments;
+ NamedHotspot _bed;
+ NamedHotspot _towel;
+ NamedHotspot _bottles1;
+ NamedHotspot _post;
+ NamedHotspot _clothesPile1;
+ NamedHotspot _clothesPile2;
+ NamedHotspot _rug2;
+ Companion _companion;
GunPowder _gunPowder;
OilLamp _oilLamp;
Exit1 _exit1;
@@ -261,7 +260,7 @@ public:
};
class Scene2440 : public SceneExt {
- class Actor1 : public SceneActor {
+ class Companion : public SceneActor {
public:
bool startAction(CursorType action, Event &event);
};
@@ -275,14 +274,14 @@ class Scene2440 : public SceneExt {
virtual void changeScene();
};
public:
- NamedHotspot _item1;
- NamedHotspot _item2;
- NamedHotspot _item3;
- NamedHotspot _item4;
- NamedHotspot _item5;
- NamedHotspot _item6;
- NamedHotspot _item7;
- Actor1 _actor1;
+ NamedHotspot _background;
+ NamedHotspot _garments;
+ NamedHotspot _bedspread;
+ NamedHotspot _post;
+ NamedHotspot _rug;
+ NamedHotspot _furnishings;
+ NamedHotspot _bottles;
+ Companion _companion;
OilLamp _oilLamp;
Exit1 _exit1;
SequenceManager _sequenceManager;
@@ -373,10 +372,10 @@ public:
SpeakerSeeker _seekerSpeaker;
SpeakerMiranda _mirandaSpeaker;
SpeakerWebbster2500 _webbsterSpeaker;
- NamedHotspot _item1;
- SceneActor _actor1;
- SceneActor _actor2;
- SceneActor _actor3;
+ NamedHotspot _background;
+ SceneActor _companion;
+ SceneActor _quinn;
+ SceneActor _ship;
Exit1 _exit1;
SequenceManager _sequenceManager;
@@ -385,7 +384,7 @@ public:
};
class Scene2525 : public SceneExt {
- class Item5 : public NamedHotspot {
+ class StopCock : public NamedHotspot {
public:
virtual bool startAction(CursorType action, Event &event);
};
@@ -400,13 +399,13 @@ class Scene2525 : public SceneExt {
virtual void changeScene();
};
public:
- NamedHotspot _item1;
- NamedHotspot _item2;
- NamedHotspot _item3;
- NamedHotspot _item4;
- Item5 _item5;
- SceneActor _actor1;
- SceneActor _actor2;
+ NamedHotspot _background;
+ NamedHotspot _machine;
+ NamedHotspot _pipes1;
+ NamedHotspot _pipes2;
+ StopCock _stopcock;
+ SceneActor _companion;
+ SceneActor _compressor;
GlassDome _glassDome;
Exit1 _exit1;
SequenceManager _sequenceManager;
@@ -432,11 +431,11 @@ class Scene2530 : public SceneExt {
};
public:
NamedHotspot _background;
- NamedHotspot _item2;
+ NamedHotspot _crank2;
NamedHotspot _shelf;
NamedHotspot _item4;
- NamedHotspot _item5;
- SceneActor _actor1;
+ NamedHotspot _rope;
+ SceneActor _companion;
Flask _flask;
Crank _crank;
Exit1 _exit1;
@@ -540,7 +539,7 @@ public:
Rect _walkRect1, _walkRect2, _walkRect3;
Rect _walkRect4, _walkRect5, _walkRect6;
SequenceManager _sequenceManager;
- int _field412, _field414, _field416;
+ int _areaMode, _moveMode, _stripNumber;
Scene2700();
virtual void synchronize(Serializer &s);
@@ -596,16 +595,16 @@ public:
NamedHotspot _ghoulHome3;
NamedHotspot _ghoulHome4;
SceneActor _nej;
- SceneActor _actor2;
- SceneActor _actor3;
- SceneActor _actor4;
- SceneActor _actor5;
- SceneActor _actor6;
- SceneActor _actor7;
- SceneActor _actor8;
- SceneActor _actor9;
- SceneActor _actor10;
- SceneActor _actor11;
+ SceneActor _fire;
+ SceneActor _bird1;
+ SceneActor _folliage1;
+ SceneActor _bird2;
+ SceneActor _folliage2;
+ SceneActor _folliage3;
+ SceneActor _folliage4;
+ SceneActor _folliage5;
+ SceneActor _folliage6;
+ SceneActor _folliage7;
Action1 _action1;
Action2 _action2;
Action3 _action3;
@@ -615,9 +614,9 @@ public:
Action7 _action7;
Area1 _area1;
Area2 _area2;
- Rect _rect1, _rect2, _rect3;
+ Rect _walkRect1, _walkRect2, _walkRect3;
SequenceManager _sequenceManager;
- int _field412, _field414, _field416;
+ int _areaMode, _moveMode, _stripNumber;
Scene2750();
virtual void synchronize(Serializer &s);
@@ -651,16 +650,16 @@ public:
SpeakerQuinn2800 _quinnSpeaker;
SpeakerNej2800 _nejSpeaker;
SpeakerGuard2800 _guardSpeaker;
- NamedHotspot _item1;
+ NamedHotspot _background;
Outpost _outpost;
Guard _guard;
- SceneActor _actor2;
- SceneActor _actor3;
- SceneObject _object1;
+ SceneActor _nej;
+ SceneActor _lightBar;
+ SceneObject _bird;
Action1 _action1;
Action2 _action2;
SequenceManager _sequenceManager;
- int _field412;
+ int _stripNumber;
Scene2800();
virtual void synchronize(Serializer &s);
@@ -710,10 +709,6 @@ class Scene2900 : public SceneExt {
void drawBlock(const byte *data, int xp, int yp, const Rect &r1, const Rect &r2);
public:
int _mapWidth, _mapHeight;
- int _field4;
- int _field6;
- int _field8;
- int _fieldA;
int _resNum;
int _xV, _yV;
Rect _bounds;
@@ -741,18 +736,18 @@ public:
Map _map;
SceneText _skipText;
- int _field412;
+ bool _controlsActiveChanging;
bool _altitudeChanging;
- bool _field416;
- int _field41C;
+ bool _majorMinorFlag;
+ int _altitudeMinorChange;
int _altitudeMajorChange;
Common::Point _balloonLocation;
Common::Point _balloonScreenPos;
int _newAltitude;
- int _field425;
- int _field426;
- int _field427;
- bool _field8F8;
+ int _xAmount;
+ int _xComparison;
+ int _fadeCounter;
+ bool _paletteReloadNeeded;
Scene2900();
virtual void synchronize(Serializer &s);
diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp
index 5cca1ee483..788b8c77dd 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp
@@ -35,13 +35,13 @@ namespace Ringworld2 {
*--------------------------------------------------------------------------*/
Scene3100::Scene3100() {
- _field412 = 0;
+ _fadeSound = false;
}
void Scene3100::synchronize(Serializer &s) {
SceneExt::synchronize(s);
- s.syncAsSint16LE(_field412);
+ s.syncAsSint16LE(_fadeSound);
}
bool Scene3100::Guard::startAction(CursorType action, Event &event) {
@@ -84,20 +84,21 @@ void Scene3100::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player._characterIndex = R2_QUINN;
R2_GLOBALS._player.disableControl();
- _actor1.postInit();
- _item2.setDetails(Rect(212, 97, 320, 114), 3100, 3, -1, -1, 1, NULL);
- _item1.setDetails(Rect(0, 0, 480, 200), 3100, 0, -1, -1, 1, NULL);
- _field412 = 0;
+ _hammerHead.postInit();
+ _hammerHead2.setDetails(Rect(212, 97, 320, 114), 3100, 3, -1, -1, 1, NULL);
+ _background.setDetails(Rect(0, 0, 480, 200), 3100, 0, -1, -1, 1, NULL);
+ _fadeSound = false;
if (R2_GLOBALS._sceneManager._previousScene == 1000) {
if (R2_GLOBALS._player._oldCharacterScene[R2_QUINN] == 3100) {
_sceneMode = 3102;
- _actor3.postInit();
- _actor4.postInit();
- _actor5.postInit();
+ _ghoul.postInit();
+ _technicians.postInit();
+ _deadBodies.postInit();
R2_GLOBALS._sound1.play(274);
_sound1.fadeSound(130);
- setAction(&_sequenceManager, this, 3102, &_actor1, &R2_GLOBALS._player, &_actor3, &_actor4, &_actor5, NULL);
+ setAction(&_sequenceManager, this, 3102, &_hammerHead, &R2_GLOBALS._player,
+ &_ghoul, &_technicians, &_deadBodies, NULL);
} else {
_guard.postInit();
_guard.setup(3110, 5, 1);
@@ -105,27 +106,28 @@ void Scene3100::postInit(SceneObjectList *OwnerList) {
_guard.setPosition(Common::Point(10, 149));
_guard.setDetails(3100, 6, -1, -1, 2, (SceneItem *)NULL);
- _actor4.postInit();
- _actor4.setup(3103, 1, 1);
- _actor4.setPosition(Common::Point(278, 113));
- _actor4.setDetails(3100, 9, -1, -1, 2, (SceneItem *)NULL);
- _actor4.animate(ANIM_MODE_2, NULL);
+ _technicians.postInit();
+ _technicians.setup(3103, 1, 1);
+ _technicians.setPosition(Common::Point(278, 113));
+ _technicians.setDetails(3100, 9, -1, -1, 2, (SceneItem *)NULL);
+ _technicians.animate(ANIM_MODE_2, NULL);
- _field412 = 1;
- _actor1.setDetails(3100, 3, -1, -1, 2, (SceneItem *)NULL);
+ _fadeSound = true;
+ _hammerHead.setDetails(3100, 3, -1, -1, 2, (SceneItem *)NULL);
R2_GLOBALS._sound1.play(243);
R2_GLOBALS._sound2.play(130);
_sceneMode = 3100;
- setAction(&_sequenceManager, this, 3100, &R2_GLOBALS._player, &_actor1, NULL);
+ setAction(&_sequenceManager, this, 3100, &R2_GLOBALS._player, &_hammerHead, NULL);
}
} else if (R2_GLOBALS._sceneManager._previousScene == 3255) {
_sceneMode = 3101;
- _actor2.postInit();
- _actor3.postInit();
- _field412 = 1;
+ _miranda.postInit();
+ _ghoul.postInit();
+ _fadeSound = true;
- setAction(&_sequenceManager, this, 3101, &R2_GLOBALS._player, &_actor1, &_actor2, &_actor3, NULL);
+ setAction(&_sequenceManager, this, 3101, &R2_GLOBALS._player, &_hammerHead,
+ &_miranda, &_ghoul, NULL);
} else {
_guard.postInit();
_guard.setup(3110, 5, 1);
@@ -133,16 +135,16 @@ void Scene3100::postInit(SceneObjectList *OwnerList) {
_guard.setPosition(Common::Point(10, 149));
_guard.setDetails(3100, 6, -1, -1, 2, (SceneItem *)NULL);
- _actor4.postInit();
- _actor4.setup(3103, 1, 1);
- _actor4.setPosition(Common::Point(278, 113));
- _actor4.setDetails(3100, 9, -1, -1, 2, (SceneItem *)NULL);
- _actor4.animate(ANIM_MODE_2, NULL);
+ _technicians.postInit();
+ _technicians.setup(3103, 1, 1);
+ _technicians.setPosition(Common::Point(278, 113));
+ _technicians.setDetails(3100, 9, -1, -1, 2, (SceneItem *)NULL);
+ _technicians.animate(ANIM_MODE_2, NULL);
- _actor1.postInit();
- _actor1.setup(3104, 4, 1);
- _actor1.setPosition(Common::Point(143, 104));
- _actor1.setDetails(3100, 3, -1, -1, 2, (SceneItem *)NULL);
+ _hammerHead.postInit();
+ _hammerHead.setup(3104, 4, 1);
+ _hammerHead.setPosition(Common::Point(143, 104));
+ _hammerHead.setDetails(3100, 3, -1, -1, 2, (SceneItem *)NULL);
R2_GLOBALS._player.setup(3110, 3, 1);
R2_GLOBALS._player.changeZoom(50);
@@ -189,13 +191,13 @@ void Scene3100::signal() {
}
void Scene3100::dispatch() {
- if ((_sceneMode == 3100) && (_field412 != 0) && (R2_GLOBALS._player._position.y == 104)) {
- _field412 = 0;
+ if ((_sceneMode == 3100) && _fadeSound && (R2_GLOBALS._player._position.y == 104)) {
+ _fadeSound = false;
R2_GLOBALS._sound2.fadeOut2(NULL);
}
- if ((_sceneMode == 3101) && (_field412 != 0) && (R2_GLOBALS._player._position.y < 104)) {
- _field412 = 0;
+ if ((_sceneMode == 3101) && _fadeSound && (R2_GLOBALS._player._position.y < 104)) {
+ _fadeSound = false;
_sound1.fadeSound(130);
}
@@ -208,13 +210,13 @@ void Scene3100::dispatch() {
*--------------------------------------------------------------------------*/
Scene3125::Scene3125() {
- _field412 = 0;
+ _soundPlayed = false;
}
void Scene3125::synchronize(Serializer &s) {
SceneExt::synchronize(s);
- s.syncAsSint16LE(_field412);
+ s.syncAsSint16LE(_soundPlayed);
}
bool Scene3125::Background::startAction(CursorType action, Event &event) {
@@ -223,15 +225,15 @@ bool Scene3125::Background::startAction(CursorType action, Event &event) {
switch (action) {
case CURSOR_USE:
if (_useLineNum != -1)
- SceneItem::display(_resNum, _useLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ SceneItem::display(_resNum, _useLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END);
break;
case CURSOR_LOOK:
if (_lookLineNum != -1)
- SceneItem::display(_resNum, _lookLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ SceneItem::display(_resNum, _lookLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END);
break;
case CURSOR_TALK:
if (_talkLineNum != -1)
- SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END);
break;
default:
return scene->display(action, event);
@@ -248,13 +250,13 @@ bool Scene3125::Table::startAction(CursorType action, Event &event) {
case CURSOR_USE:
R2_GLOBALS._player.disableControl();
scene->_sceneMode = 3125;
- scene->setAction(&scene->_sequenceManager1, scene, 3125, &R2_GLOBALS._player, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 3125, &R2_GLOBALS._player, NULL);
break;
case CURSOR_LOOK:
- SceneItem::display(3125, 15, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ SceneItem::display(3125, 15, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END);
break;
case CURSOR_TALK:
- SceneItem::display(3125, 13, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ SceneItem::display(3125, 13, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END);
break;
default:
return SceneHotspot::startAction(action, event);
@@ -272,15 +274,15 @@ bool Scene3125::Computer::startAction(CursorType action, Event &event) {
R2_GLOBALS._player.disableControl();
scene->_ghoul4.postInit();
scene->_sceneMode = 3126;
- scene->setAction(&scene->_sequenceManager1, scene, 3126, &R2_GLOBALS._player,
+ scene->setAction(&scene->_sequenceManager, scene, 3126, &R2_GLOBALS._player,
&scene->_ghoul1, &scene->_ghoul2, &scene->_ghoul3, &scene->_door,
&scene->_ghoul4, NULL);
break;
case CURSOR_LOOK:
- SceneItem::display(3125, 9, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ SceneItem::display(3125, 9, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END);
break;
case CURSOR_TALK:
- SceneItem::display(3125, 13, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ SceneItem::display(3125, 13, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END);
break;
default:
return SceneHotspot::startAction(action, event);
@@ -298,14 +300,14 @@ bool Scene3125::Door::startAction(CursorType action, Event &event) {
R2_GLOBALS._player.disableControl();
scene->_sceneMode = 3176;
- scene->setAction(&scene->_sequenceManager1, scene, 3176, &R2_GLOBALS._player, &scene->_door, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 3176, &R2_GLOBALS._player, &scene->_door, NULL);
return true;
}
void Scene3125::postInit(SceneObjectList *OwnerList) {
loadScene(3125);
SceneExt::postInit();
- _field412 = 0;
+ _soundPlayed = false;
_door.postInit();
_door.setup(3175, 1, 1);
@@ -336,7 +338,7 @@ void Scene3125::postInit(SceneObjectList *OwnerList) {
if (R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] == 3250) {
_sceneMode = 3175;
- setAction(&_sequenceManager1, this, 3175, &R2_GLOBALS._player, &_door, NULL);
+ setAction(&_sequenceManager, this, 3175, &R2_GLOBALS._player, &_door, NULL);
} else {
R2_GLOBALS._player.setup(30, 5, 1);
R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
@@ -349,9 +351,9 @@ void Scene3125::postInit(SceneObjectList *OwnerList) {
void Scene3125::signal() {
switch (_sceneMode) {
case 3125:
- SceneItem::display(3125, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ SceneItem::display(3125, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END);
_sceneMode = 3127;
- setAction(&_sequenceManager1, this, 3127, &R2_GLOBALS._player, NULL);
+ setAction(&_sequenceManager, this, 3127, &R2_GLOBALS._player, NULL);
break;
case 3126:
R2_GLOBALS.setFlag(79);
@@ -366,9 +368,9 @@ void Scene3125::signal() {
}
void Scene3125::dispatch() {
- if ((_sceneMode == 3126) && (_ghoul1._frame == 2) && (_field412 == 0)) {
- _field412 = 1;
+ if ((_sceneMode == 3126) && (_ghoul1._frame == 2) && !_soundPlayed) {
R2_GLOBALS._sound1.play(265);
+ _soundPlayed = true;
}
Scene::dispatch();
}
@@ -399,7 +401,7 @@ bool Scene3150::LightFixture::startAction(CursorType action, Event &event) {
scene->_sceneMode = 3155;
scene->setAction(&scene->_sequenceManager, scene, 3155, &R2_GLOBALS._player, &scene->_bulbOrWire, NULL);
} else {
- SceneItem::display(3150, 42, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(3150, 42, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
}
return true;
default:
@@ -434,7 +436,7 @@ bool Scene3150::Toilet::startAction(CursorType action, Event &event) {
scene->_sceneMode = 3159;
scene->setAction(&scene->_sequenceManager, scene, 3159, &R2_GLOBALS._player, &scene->_foodTray, NULL);
} else {
- SceneItem::display(3150, 42, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(3150, 42, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
}
return true;
default:
@@ -475,7 +477,7 @@ bool Scene3150::FoodTray::startAction(CursorType action, Event &event) {
return true;
}
-bool Scene3150::Actor6::startAction(CursorType action, Event &event) {
+bool Scene3150::ToiletFlush::startAction(CursorType action, Event &event) {
Scene3150 *scene = (Scene3150 *)R2_GLOBALS._sceneManager._scene;
if (action == CURSOR_USE) {
@@ -490,7 +492,7 @@ bool Scene3150::Actor6::startAction(CursorType action, Event &event) {
scene->setAction(&scene->_sequenceManager, scene, 3152, &R2_GLOBALS._player, &scene->_water, NULL);
}
} else {
- SceneItem::display(3150, 42, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(3150, 42, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
}
} else {
R2_GLOBALS._player.disableControl();
@@ -697,7 +699,7 @@ void Scene3150::postInit(SceneObjectList *OwnerList) {
setAction(&_sequenceManager, this, 3156, &R2_GLOBALS._player, &_guard, &_doorBars, &_foodTray, NULL);
} else {
- if (R2_GLOBALS._v56AA0 != 2)
+ if ((R2_GLOBALS._v56AA0 != 1) && (R2_GLOBALS._v56AA0 != 2))
++R2_GLOBALS._v56AA0;
R2_GLOBALS._player.setup(30, 3, 1);
@@ -804,25 +806,25 @@ void Scene3150::dispatch() {
*
*--------------------------------------------------------------------------*/
-bool Scene3175::Item1::startAction(CursorType action, Event &event) {
+bool Scene3175::RoomItem::startAction(CursorType action, Event &event) {
Scene3175 *scene = (Scene3175 *)R2_GLOBALS._sceneManager._scene;
switch (action) {
case CURSOR_USE:
if (_useLineNum != -1) {
- SceneItem::display(_resNum, _useLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ SceneItem::display(_resNum, _useLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END);
return true;
}
break;
case CURSOR_LOOK:
if (_lookLineNum != -1) {
- SceneItem::display(_resNum, _lookLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ SceneItem::display(_resNum, _lookLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END);
return true;
}
break;
case CURSOR_TALK:
if (_talkLineNum != -1) {
- SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END);
return true;
}
break;
@@ -839,19 +841,19 @@ bool Scene3175::Corpse::startAction(CursorType action, Event &event) {
switch (action) {
case CURSOR_USE:
if (_useLineNum != -1) {
- SceneItem::display(_resNum, _useLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ SceneItem::display(_resNum, _useLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END);
return true;
}
break;
case CURSOR_LOOK:
if (_lookLineNum != -1) {
- SceneItem::display(_resNum, _lookLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ SceneItem::display(_resNum, _lookLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END);
return true;
}
break;
case CURSOR_TALK:
if (_talkLineNum != -1) {
- SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END);
return true;
}
break;
@@ -873,11 +875,11 @@ bool Scene3175::Door::startAction(CursorType action, Event &event) {
return true;
break;
case CURSOR_LOOK:
- SceneItem::display(3175, 9, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ SceneItem::display(3175, 9, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END);
return true;
break;
case CURSOR_TALK:
- SceneItem::display(3175, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ SceneItem::display(3175, 10, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END);
return true;
break;
default:
@@ -895,17 +897,17 @@ void Scene3175::postInit(SceneObjectList *OwnerList) {
_door.setPosition(Common::Point(35, 72));
_door.setDetails(3175, 9, 10, -1, 1, (SceneItem *)NULL);
- _actor2.postInit();
- _actor2.setup(3175, 2, 1);
- _actor2.setPosition(Common::Point(87, 148));
+ _computer.postInit();
+ _computer.setup(3175, 2, 1);
+ _computer.setPosition(Common::Point(87, 148));
_corpse.postInit();
_corpse.setup(3175, 3, 1);
_corpse.setPosition(Common::Point(199, 117));
_corpse.setDetails(3175, 15, 16, 17, 1, (SceneItem *)NULL);
- _item2.setDetails(12, 3175, 3, 1, 5);
- _item3.setDetails(11, 3175, 6, 7, 8);
+ _table.setDetails(12, 3175, 3, 1, 5);
+ _autopsies.setDetails(11, 3175, 6, 7, 8);
_background.setDetails(Rect(0, 0, 320, 200), 3175, 0, 1, 2, 1, NULL);
R2_GLOBALS._player.postInit();
@@ -948,11 +950,12 @@ void Scene3200::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player.hide();
R2_GLOBALS._player.disableControl();
- _actor1.postInit();
- _actor3.postInit();
- _actor2.postInit();
+ _rocko.postInit();
+ _jocko.postInit();
+ _socko.postInit();
- setAction(&_sequenceManager, this, 3200 + R2_GLOBALS._randomSource.getRandomNumber(1), &_actor1, &_actor2, &_actor3, NULL);
+ setAction(&_sequenceManager, this, 3200 + R2_GLOBALS._randomSource.getRandomNumber(1),
+ &_rocko, &_jocko, &_socko, NULL);
}
void Scene3200::signal() {
@@ -976,10 +979,11 @@ void Scene3210::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player.hide();
R2_GLOBALS._player.disableControl();
- _actor1.postInit();
- _actor2.postInit();
+ _captain.postInit();
+ _private.postInit();
- setAction(&_sequenceManager, this, 3210 + R2_GLOBALS._randomSource.getRandomNumber(1), &_actor1, &_actor2, NULL);
+ setAction(&_sequenceManager, this, 3210 + R2_GLOBALS._randomSource.getRandomNumber(1),
+ &_captain, &_private, NULL);
}
void Scene3210::signal() {
@@ -1003,10 +1007,11 @@ void Scene3220::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player.hide();
R2_GLOBALS._player.disableControl();
- _actor1.postInit();
- _actor2.postInit();
+ _rocko.postInit();
+ _jocko.postInit();
- setAction(&_sequenceManager, this, 3220 + R2_GLOBALS._randomSource.getRandomNumber(1), &_actor1, &_actor2, NULL);
+ setAction(&_sequenceManager, this, 3220 + R2_GLOBALS._randomSource.getRandomNumber(1),
+ &_rocko, &_jocko, NULL);
}
void Scene3220::signal() {
@@ -1030,11 +1035,12 @@ void Scene3230::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player.hide();
R2_GLOBALS._player.disableControl();
- _actor1.postInit();
- _actor2.postInit();
- _actor3.postInit();
+ _rocko.postInit();
+ _jocko.postInit();
+ _ghoul.postInit();
- setAction(&_sequenceManager, this, 3230 + R2_GLOBALS._randomSource.getRandomNumber(1), &_actor1, &_actor2, &_actor3, NULL);
+ setAction(&_sequenceManager, this, 3230 + R2_GLOBALS._randomSource.getRandomNumber(1),
+ &_rocko, &_jocko, &_ghoul, NULL);
}
void Scene3230::signal() {
@@ -1059,10 +1065,11 @@ void Scene3240::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player.hide();
R2_GLOBALS._player.disableControl();
- _actor1.postInit();
- _actor2.postInit();
+ _teal.postInit();
+ _webbster.postInit();
- setAction(&_sequenceManager, this, 3240 + R2_GLOBALS._randomSource.getRandomNumber(1), &_actor1, &_actor2, NULL);
+ setAction(&_sequenceManager, this, 3240 + R2_GLOBALS._randomSource.getRandomNumber(1),
+ &_teal, &_webbster, NULL);
}
void Scene3240::signal() {
@@ -1086,17 +1093,18 @@ void Scene3245::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player.hide();
R2_GLOBALS._player.disableControl();
- _actor1.postInit();
- _actor2.postInit();
+ _ralf.postInit();
+ _tomko.postInit();
if (R2_GLOBALS._scientistConvIndex < 4)
++R2_GLOBALS._scientistConvIndex;
if (R2_GLOBALS._scientistConvIndex >= 4) {
- SceneItem::display(1200, 7, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(1200, 7, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
signal();
} else {
- setAction(&_sequenceManager, this, 3244 + R2_GLOBALS._scientistConvIndex, &_actor1, &_actor2, NULL);
+ setAction(&_sequenceManager, this, 3244 + R2_GLOBALS._scientistConvIndex,
+ &_ralf, &_tomko, NULL);
}
}
@@ -1115,19 +1123,19 @@ bool Scene3250::Item::startAction(CursorType action, Event &event) {
switch (action) {
case CURSOR_USE:
if (_useLineNum != -1) {
- SceneItem::display(_resNum, _useLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ SceneItem::display(_resNum, _useLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END);
return true;
}
break;
case CURSOR_LOOK:
if (_lookLineNum != -1) {
- SceneItem::display(_resNum, _lookLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ SceneItem::display(_resNum, _lookLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END);
return true;
}
break;
case CURSOR_TALK:
if (_talkLineNum != -1) {
- SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ SceneItem::display(_resNum, _talkLineNum, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END);
return true;
}
break;
@@ -1202,9 +1210,9 @@ void Scene3250::postInit(SceneObjectList *OwnerList) {
switch (R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA]) {
case 1200:
_sceneMode = 3250;
- _actor4.postInit();
+ _grate.postInit();
R2_GLOBALS._player._effect = 0;
- setAction(&_sequenceManager, this, 3250, &R2_GLOBALS._player, &_actor4, NULL);
+ setAction(&_sequenceManager, this, 3250, &R2_GLOBALS._player, &_grate, NULL);
break;
case 3125:
if (R2_GLOBALS.getFlag(79)) {
@@ -1295,10 +1303,10 @@ void Scene3255::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._sound1.play(267);
R2_GLOBALS._sound2.play(268);
_sceneMode = 3257;
- _actor3.postInit();
+ _door.postInit();
_quinn.postInit();
_quinn._effect = 1;
- setAction(&_sequenceManager, this, 3257, &R2_GLOBALS._player, &_quinn, &_actor3, NULL);
+ setAction(&_sequenceManager, this, 3257, &R2_GLOBALS._player, &_quinn, &_door, NULL);
} else {
_teal.postInit();
_teal.setup(303, 1, 1);
@@ -1320,7 +1328,7 @@ void Scene3255::signal() {
_ghoul2.postInit();
_ghoul3.postInit();
setAction(&_sequenceManager, this, 3258, &R2_GLOBALS._player, &_quinn,
- &_actor3, &_ghoul1, &_ghoul2, &_ghoul3, NULL);
+ &_door, &_ghoul1, &_ghoul2, &_ghoul3, NULL);
break;
case 3256:
R2_GLOBALS._sceneManager.changeScene(3250);
@@ -1334,7 +1342,7 @@ void Scene3255::signal() {
R2_GLOBALS._sceneManager.changeScene(3100);
break;
default:
- SceneItem::display(3255, 0, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ SceneItem::display(3255, 0, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
_sceneMode = 3256;
setAction(&_sequenceManager, this, 3256, &R2_GLOBALS._player, NULL);
}
@@ -1542,7 +1550,7 @@ void Scene3260::signal() {
case 3272:
_sceneMode = 3273;
R2_GLOBALS._events.setCursor(CURSOR_WALK);
- SceneItem::display(3260, 15, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, -999);
+ SceneItem::display(3260, 15, 0, 280, 1, 160, 9, 1, 2, 20, 7, 154, LIST_END);
R2_GLOBALS._player.disableControl();
R2_INVENTORY.setObjectScene(R2_TOOLBOX, 3);
R2_INVENTORY.setObjectScene(R2_LASER_HACKSAW, 3);
@@ -1600,9 +1608,9 @@ void Scene3275::postInit(SceneObjectList *OwnerList) {
_cellExit.setDetails(Rect(398, 60, 439, 118), SHADECURSOR_UP, 3150);
_cellExit.setDest(Common::Point(418, 128));
- _actor1.postInit();
- _actor1.setup(3275, 1, 7);
- _actor1.setPosition(Common::Point(419, 119));
+ _doorFrame.postInit();
+ _doorFrame.setup(3275, 1, 7);
+ _doorFrame.setPosition(Common::Point(419, 119));
_door.postInit();
_door.setup(3275, 2, 1);
@@ -1661,8 +1669,8 @@ void Scene3275::signal() {
void Scene3350::postInit(SceneObjectList *OwnerList) {
loadScene(3350);
- SceneExt::postInit();
R2_GLOBALS._uiElements._active = false;
+ SceneExt::postInit();
R2_GLOBALS._interfaceY = SCREEN_HEIGHT;
R2_GLOBALS._sound2.play(310);
@@ -1673,27 +1681,27 @@ void Scene3350::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player.hide();
R2_GLOBALS._player.disableControl();
- _actor1.postInit();
- _actor1.hide();
- _actor2.postInit();
- _actor2.hide();
- _actor3.postInit();
- _actor3.hide();
- _actor4.postInit();
- _actor4.hide();
- _actor9.postInit();
- _actor9.hide();
- _actor8.postInit();
- _actor8.hide();
- _actor5.postInit();
- _actor5.hide();
- _actor6.postInit();
- _actor6.hide();
- _actor7.postInit();
- _actor7.hide();
+ _miranda.postInit();
+ _miranda.hide();
+ _seeker.postInit();
+ _seeker.hide();
+ _webbster.postInit();
+ _webbster.hide();
+ _seatedPeople.postInit();
+ _seatedPeople.hide();
+ _shipFront.postInit();
+ _shipFront.hide();
+ _canopy.postInit();
+ _canopy.hide();
+ _ship.postInit();
+ _ship.hide();
+ _landedShip.postInit();
+ _landedShip.hide();
+ _shipShadow.postInit();
+ _shipShadow.hide();
_sceneMode = 3350;
- setAction(&_sequenceManager, this, _sceneMode, &_actor5, &_actor6, &_actor7, NULL);
+ setAction(&_sequenceManager, this, _sceneMode, &_ship, &_landedShip, &_shipShadow, NULL);
}
void Scene3350::remove() {
@@ -1705,11 +1713,13 @@ void Scene3350::signal() {
switch (_sceneMode) {
case 3350:
_sceneMode = 3351;
- setAction(&_sequenceManager, this, 3351, &_actor4, &_actor9, &_actor8, NULL);
+ setAction(&_sequenceManager, this, 3351, &_seatedPeople, &_shipFront, &_canopy, NULL);
break;
case 3351:
_sceneMode = 3352;
- setAction(&_sequenceManager, this, 3352, &_actor4, &R2_GLOBALS._player, &_actor1, &_actor2, &_actor3, NULL);
+ setAction(&_sequenceManager, this, 3352, &_seeker, &R2_GLOBALS._player,
+ &_miranda, &_seeker, &_webbster, NULL);
+ break;
case 3352:
R2_GLOBALS._sceneManager.changeScene(3395);
break;
@@ -1727,8 +1737,7 @@ void Scene3350::signal() {
void Scene3375::synchronize(Serializer &s) {
SceneExt::synchronize(s);
- s.syncAsSint16LE(_field1488);
- s.syncAsSint16LE(_field1492);
+ s.syncAsSint16LE(_newSceneMode);
for (int i = 0; i < 4; ++i)
s.syncAsSint16LE(_sceneAreas[i]);
}
@@ -1921,7 +1930,7 @@ void Scene3375::DownExit::changeScene() {
R2_GLOBALS._player.disableControl(CURSOR_ARROW);
scene->_sceneMode = 3377;
- scene->_field1488 = 3381;
+ scene->_newSceneMode = 3381;
if (R2_GLOBALS._walkwaySceneNumber != 0) {
R2_GLOBALS._walkRegions.enableRegion(2);
@@ -1943,7 +1952,7 @@ void Scene3375::RightExit::changeScene() {
R2_GLOBALS._player.disableControl(CURSOR_ARROW);
scene->_sceneMode = 3378;
- scene->_field1488 = 3380;
+ scene->_newSceneMode = 3380;
if (R2_GLOBALS._walkwaySceneNumber != 0) {
R2_GLOBALS._walkRegions.enableRegion(2);
@@ -1957,7 +1966,7 @@ void Scene3375::RightExit::changeScene() {
}
Scene3375::Scene3375() {
- _field1488 = _field1492 = 0;
+ _newSceneMode = 0;
_sceneAreas[0] = 3376;
_sceneAreas[1] = 3377;
@@ -2171,8 +2180,9 @@ void Scene3375::signal() {
case 3377:
// No break on purpose
case 3378:
- _sceneMode = _field1488;
- _field1488 = 0;
+ _sceneMode = _newSceneMode;
+ _newSceneMode = 0;
+
_companion1._effect = 6;
_companion1._shade = 4;
_companion2._effect = 6;
@@ -2190,6 +2200,7 @@ void Scene3375::signal() {
else
R2_GLOBALS._player.setStrip(3);
R2_GLOBALS._player.enableControl(CURSOR_TALK);
+ break;
default:
_companion1.setPriority(130);
_companion2.setPriority(132);
@@ -2229,13 +2240,13 @@ void Scene3375::dispatch() {
*--------------------------------------------------------------------------*/
Scene3385::Scene3385() {
- _field11B2 = 0;
+ _playerStrip = 0;
}
void Scene3385::synchronize(Serializer &s) {
SceneExt::synchronize(s);
- s.syncAsSint16LE(_field11B2);
+ s.syncAsSint16LE(_playerStrip);
}
bool Scene3385::Companion1::startAction(CursorType action, Event &event) {
@@ -2340,9 +2351,9 @@ void Scene3385::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player._characterScene[R2_MIRANDA] = 3385;
if (R2_GLOBALS._sceneManager._previousScene == 3375)
- _field11B2 = 3;
+ _playerStrip = 3;
else
- _field11B2 = 4;
+ _playerStrip = 4;
setZoomPercents(102, 40, 200, 160);
R2_GLOBALS._player.postInit();
@@ -2355,11 +2366,11 @@ void Scene3385::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player.changeZoom(-1);
if (R2_GLOBALS._player._characterIndex == R2_SEEKER)
- R2_GLOBALS._player.setup(20, _field11B2, 1);
+ R2_GLOBALS._player.setup(20, _playerStrip, 1);
else if (R2_GLOBALS._player._characterIndex == R2_MIRANDA)
- R2_GLOBALS._player.setup(30, _field11B2, 1);
+ R2_GLOBALS._player.setup(30, _playerStrip, 1);
else
- R2_GLOBALS._player.setup(10, _field11B2, 1);
+ R2_GLOBALS._player.setup(10, _playerStrip, 1);
R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
R2_GLOBALS._player.disableControl();
@@ -2375,9 +2386,9 @@ void Scene3385::postInit(SceneObjectList *OwnerList) {
_companion1.changeZoom(-1);
_companion1._effect = 1;
if (R2_GLOBALS._player._characterIndex == R2_SEEKER)
- _companion1.setup(10, _field11B2, 1);
+ _companion1.setup(10, _playerStrip, 1);
else
- _companion1.setup(20, _field11B2, 1);
+ _companion1.setup(20, _playerStrip, 1);
_companion1.animate(ANIM_MODE_1, NULL);
_companion1.setDetails(3385, -1, -1, -1, 1, (SceneItem *) NULL);
@@ -2386,9 +2397,9 @@ void Scene3385::postInit(SceneObjectList *OwnerList) {
_companion2.changeZoom(-1);
_companion2._effect = 1;
if (R2_GLOBALS._player._characterIndex == R2_MIRANDA)
- _companion2.setup(10, _field11B2, 1);
+ _companion2.setup(10, _playerStrip, 1);
else
- _companion2.setup(30, _field11B2, 1);
+ _companion2.setup(30, _playerStrip, 1);
_companion2.animate(ANIM_MODE_1, NULL);
_companion2.setDetails(3385, -1, -1, -1, 1, (SceneItem *) NULL);
@@ -2396,7 +2407,7 @@ void Scene3385::postInit(SceneObjectList *OwnerList) {
_webbster._moveDiff = Common::Point(3, 2);
_webbster.changeZoom(-1);
_webbster._effect = 1;
- _webbster.setup(40, _field11B2, 1);
+ _webbster.setup(40, _playerStrip, 1);
_webbster.animate(ANIM_MODE_1, NULL);
_webbster.setDetails(3385, 15, -1, -1, 1, (SceneItem *) NULL);
@@ -2466,13 +2477,13 @@ void Scene3385::signal() {
*--------------------------------------------------------------------------*/
Scene3395::Scene3395() {
- _field142E = 0;
+ _playerStrip = 0;
}
void Scene3395::synchronize(Serializer &s) {
SceneExt::synchronize(s);
- s.syncAsSint16LE(_field142E);
+ s.syncAsSint16LE(_playerStrip);
}
bool Scene3395::Companion1::startAction(CursorType action, Event &event) {
@@ -2563,9 +2574,9 @@ void Scene3395::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player._characterScene[R2_MIRANDA] = 3395;
if (R2_GLOBALS._sceneManager._previousScene == 3385)
- _field142E = 3;
+ _playerStrip = 3;
else
- _field142E = 4;
+ _playerStrip = 4;
setZoomPercents(51, 40, 200, 137);
R2_GLOBALS._player.postInit();
@@ -2578,11 +2589,11 @@ void Scene3395::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player.changeZoom(-1);
if (R2_GLOBALS._player._characterIndex == R2_SEEKER)
- R2_GLOBALS._player.setup(20, _field142E, 1);
+ R2_GLOBALS._player.setup(20, _playerStrip, 1);
else if (R2_GLOBALS._player._characterIndex == R2_MIRANDA)
- R2_GLOBALS._player.setup(30, _field142E, 1);
+ R2_GLOBALS._player.setup(30, _playerStrip, 1);
else
- R2_GLOBALS._player.setup(10, _field142E, 1);
+ R2_GLOBALS._player.setup(10, _playerStrip, 1);
R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
R2_GLOBALS._player.disableControl();
@@ -2598,9 +2609,9 @@ void Scene3395::postInit(SceneObjectList *OwnerList) {
_companion1.changeZoom(-1);
_companion1._effect = 1;
if (R2_GLOBALS._player._characterIndex == R2_SEEKER)
- _companion1.setup(10, _field142E, 1);
+ _companion1.setup(10, _playerStrip, 1);
else
- _companion1.setup(20, _field142E, 1);
+ _companion1.setup(20, _playerStrip, 1);
_companion1.animate(ANIM_MODE_1, NULL);
_companion1.setDetails(3395, -1, -1, -1, 1, (SceneItem *) NULL);
@@ -2609,9 +2620,9 @@ void Scene3395::postInit(SceneObjectList *OwnerList) {
_companion2.changeZoom(-1);
_companion2._effect = 1;
if (R2_GLOBALS._player._characterIndex == R2_MIRANDA)
- _companion2.setup(10, _field142E, 1);
+ _companion2.setup(10, _playerStrip, 1);
else
- _companion2.setup(30, _field142E, 1);
+ _companion2.setup(30, _playerStrip, 1);
_companion2.animate(ANIM_MODE_1, NULL);
_companion2.setDetails(3395, -1, -1, -1, 1, (SceneItem *) NULL);
@@ -2619,7 +2630,7 @@ void Scene3395::postInit(SceneObjectList *OwnerList) {
_webbster._moveDiff = Common::Point(3, 2);
_webbster.changeZoom(-1);
_webbster._effect = 1;
- _webbster.setup(40, _field142E, 1);
+ _webbster.setup(40, _playerStrip, 1);
_webbster.animate(ANIM_MODE_1, NULL);
_webbster.setDetails(3395, 18, -1, -1, 1, (SceneItem *) NULL);
@@ -2689,13 +2700,13 @@ void Scene3395::signal() {
*--------------------------------------------------------------------------*/
Scene3400::Scene3400() {
- _field157C = 0;
+ _soundFaded = false;
}
void Scene3400::synchronize(Serializer &s) {
SceneExt::synchronize(s);
- s.syncAsSint16LE(_field157C);
+ s.syncAsSint16LE(_soundFaded);
}
void Scene3400::postInit(SceneObjectList *OwnerList) {
@@ -2703,7 +2714,7 @@ void Scene3400::postInit(SceneObjectList *OwnerList) {
_sceneBounds = Rect(160, 0, 480, 200);
loadScene(3400);
- _field157C = 0;
+ _soundFaded = false;
R2_GLOBALS._v558B6.set(60, 0, 260, 200);
SceneExt::postInit();
R2_GLOBALS._sound1.play(317);
@@ -2832,9 +2843,9 @@ void Scene3400::signal() {
case 3307:
case 3404:
case 3408:
- if (_field157C == 0) {
+ if (!_soundFaded) {
R2_GLOBALS._sound2.fadeOut2(NULL);
- _field157C = 1;
+ _soundFaded = true;
} else {
_sceneMode = 3308;
_stripManager.start(3308, this);
@@ -3033,7 +3044,7 @@ void Scene3500::Action1::signal() {
switch(_actionIndex++) {
case 0:
R2_GLOBALS._player.disableControl();
- scene->_field1286 = 0;
+ scene->_directionChangesEnabled = false;
if (scene->_field1270 != 0) {
scene->_field1270 = 0;
scene->_mazeChangeAmount = 0;
@@ -3173,7 +3184,7 @@ void Scene3500::Action1::signal() {
case 8: {
R2_GLOBALS._player.enableControl();
R2_GLOBALS._player._canWalk = false;
- scene->_field1286 = 1;
+ scene->_directionChangesEnabled = true;
if ((scene->_actor1._frame % 2) == 0) {
scene->_actor1._frameChange = _field1E;
scene->_actor1.setFrame(scene->_actor1.changeFrame());
@@ -3274,214 +3285,6 @@ void Scene3500::Action2::synchronize(Serializer &s) {
s.syncAsSint16LE(_field1E);
}
-/*--------------------------------------------------------------------------*/
-
-Scene3500::Item4::Item4() {
- _field34 = 0;
-}
-
-void Scene3500::Item4::synchronize(Serializer &s) {
- NamedHotspot::synchronize(s);
-
- s.syncAsSint16LE(_field34);
-}
-
-/*--------------------------------------------------------------------------*/
-
-Scene3500::Actor7::Actor7() {
- _fieldA4 = 0;
- _fieldA6 = 0;
- _fieldA8 = 0;
- _fieldAA = 0;
- _fieldAC = 0;
- _fieldAE = 0;
-}
-
-void Scene3500::Actor7::synchronize(Serializer &s) {
- SceneActor::synchronize(s);
-
- s.syncAsSint16LE(_fieldA4);
- s.syncAsSint16LE(_fieldA6);
- s.syncAsSint16LE(_fieldA8);
- s.syncAsSint16LE(_fieldAA);
- s.syncAsSint16LE(_fieldAC);
- s.syncAsSint16LE(_fieldAE);
-}
-
-void Scene3500::Actor7::sub109466(int arg1, int arg2, int arg3, int arg4, int arg5) {
- _fieldAE = 0;
- _fieldA4 = arg1;
- _fieldA6 = arg2;
- _fieldA8 = arg3;
- _fieldAA = arg4;
- _fieldAC = _fieldAA / _fieldA8;
-
- postInit();
- setup(1050, 3, 1);
- fixPriority(255);
- sub109663(arg5);
-}
-
-void Scene3500::Actor7::sub1094ED() {
- Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene;
-
- scene->_field1270 = _position.x - _fieldA4;
-}
-
-void Scene3500::Actor7::sub109663(int arg1){
- sub109693(Common::Point(_fieldA4 + arg1, _fieldA6 - (_fieldAC * arg1)));
-}
-
-void Scene3500::Actor7::sub109693(Common::Point Pt) {
- setPosition(Pt);
-}
-
-/*--------------------------------------------------------------------------*/
-
-int Scene3500::MazeUI3500::cellFromX(int x) {
- return (_cellSize.x / 2) + x - (x % _cellSize.x);
-}
-
-int Scene3500::MazeUI3500::cellFromY(int y) {
- return (_cellSize.y / 2) + y - (y % _cellSize.y) - 1;
-}
-
-int Scene3500::MazeUI3500::getCellFromMapXY(Common::Point pt) {
- int cellX = pt.x / _cellSize.x;
- int cellY = pt.y / _cellSize.y;
-
- if ((cellX >= 0) && (cellY >= 0) && (cellX < _mapCells.x) && (cellY < _mapCells.y)) {
- return (int16)READ_LE_UINT16(_mapData + (_mapCells.x * cellY + cellX) * 2);
- } else
- return -1;
-}
-
-bool Scene3500::MazeUI3500::setMazePosition2(Common::Point &p) {
- bool retVal = setMazePosition(p);
- p = _mapOffset;
-
- return retVal;
-}
-
-Scene3500::Scene3500() {
- _fieldAF8 = 0;
- _fieldB9E = 0;
- _rotation = NULL;
- _mazeChangeAmount = 0;
- _field1270 = 0;
- _field1272 = 0;
- _field1274 = 0;
- _mazeDirection = MAZEDIR_NONE;
- _field1278 = 0;
- _mazePosition.x = 0;
- _mazePosition.y = 0;
- _field127E = 0;
- _field1280 = 0;
- _field1282 = 0;
- _field1284 = 0;
- _field1286 = 0;
-}
-
-void Scene3500::synchronize(Serializer &s) {
- SceneExt::synchronize(s);
- SYNC_POINTER(_rotation);
-
- s.syncAsSint16LE(_fieldAF8);
- s.syncAsSint16LE(_fieldB9E);
- s.syncAsSint16LE(_mazeChangeAmount);
- s.syncAsSint16LE(_field1270);
- s.syncAsSint16LE(_field1272);
- s.syncAsSint16LE(_field1274);
- s.syncAsSint16LE(_mazeDirection);
- s.syncAsSint16LE(_field1278);
- s.syncAsSint16LE(_mazePosition.x);
- s.syncAsSint16LE(_mazePosition.y);
- s.syncAsSint16LE(_field127E);
- s.syncAsSint16LE(_field1280);
- s.syncAsSint16LE(_field1282);
- s.syncAsSint16LE(_field1284);
- s.syncAsSint16LE(_field1286);
-}
-
-void Scene3500::sub107F71(int arg1) {
- switch (arg1) {
- case -1:
- _actor7.sub1094ED();
- if (_field1270 != 0) {
- _field1270--;
- _actor7.sub109663(_field1270);
- }
- if (_action1._field24 != 0)
- _field1270 = 0;
- break;
- case 1:
- _actor7.sub1094ED();
- if (_field1270 < 16) {
- ++_field1270;
- _actor7.sub109663(_field1270);
- }
- if (_action1._field24 != 0)
- _field1270 = 0;
- break;
- case 88:
- if ((_action == 0) || (_action1._field24 == 0)) {
- // The original makes a second useless check on action, skipped
- _action2.sub10831F(2);
- if ((_action) && ((_action2.getActionIndex() != 0) || (_action2._field1E != 2))) {
- _action2.signal();
- } else {
- _actor9.setAction(&_action2, &_actor9, NULL);
- }
- }
- break;
- case 96:
- if ((_action) && (_action1._field24 != 0) && (_action2._field1E != 1)) {
- _field1278 = 0;
- _action1.sub108732(0);
- } else if ((_action) && (_field1278 == 0) && (_action1._field24 != 0)) {
- _field1278 = arg1;
- } else if ((_action) && (_action1._field24 == 0)) {
- _action1.sub108670(1);
- _action1.signal();
- } else if (_action == 0) {
- _action1.sub108670(1);
- setAction(&_action1, &_actor1, NULL);
- }
- break;
- case 104:
- if ((_action == 0) || (_action1._field24 == 0)) {
- _action2.sub10831F(-1);
- if ((_action) && ((_action2.getActionIndex() != 0) || (_action2._field1E != -1))) {
- _action2.signal();
- } else {
- _actor9.setAction(&_action2, &_actor9, NULL);
- }
- }
- break;
- case 112:
- if ((_action) && (_action1._field24 != 0) && (_action2._field1E != -1)) {
- _field1278 = 0;
- _action1.sub108732(0);
- } else if ((_action) && (_field1278 == 0) && (_action1._field24 != 0)) {
- _field1278 = arg1;
- } else if ((_action) && (_action1._field24 == 0)) {
- _action1.sub108670(-1);
- _action1.signal();
- } else if (_action == 0) {
- _action1.sub108670(-1);
- setAction(&_action1, &_actor1, NULL);
- }
- break;
- default:
- _field1270 = arg1;
- _actor7.sub109663(arg1);
- if (_action1._field24 != 0) {
- _field1270 = 0;
- }
- break;
- }
-}
-
void Scene3500::Action2::sub10831F(int arg1) {
Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene;
@@ -3555,25 +3358,83 @@ void Scene3500::Action2::signal() {
}
}
-bool Scene3500::Item4::startAction(CursorType action, Event &event) {
+/*--------------------------------------------------------------------------*/
+
+Scene3500::DirectionButton::DirectionButton() {
+ _movementId = 0;
+}
+
+void Scene3500::DirectionButton::synchronize(Serializer &s) {
+ NamedHotspot::synchronize(s);
+
+ s.syncAsSint16LE(_movementId);
+}
+
+bool Scene3500::DirectionButton::startAction(CursorType action, Event &event) {
Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene;
- if (scene->_field1286 == 0)
+ if (!scene->_directionChangesEnabled) {
return true;
-
- if (scene->_field1286 != 4)
+ } else if (action == CURSOR_USE) {
+ R2_GLOBALS._sound2.play(14, nullptr, 63);
+ scene->doMovement(_movementId);
+ return true;
+ } else {
return SceneHotspot::startAction(action, event);
+ }
+}
- R2_GLOBALS._sound2.play(14);
- scene->sub107F71(_field34);
+/*--------------------------------------------------------------------------*/
- return true;
+Scene3500::Actor7::Actor7() {
+ _fieldA8 = 0;
+ _fieldAA = 0;
+ _fieldAC = 0;
+ _fieldAE = 0;
+}
+
+void Scene3500::Actor7::synchronize(Serializer &s) {
+ SceneActor::synchronize(s);
+
+ s.syncAsSint16LE(_pos.x);
+ s.syncAsSint16LE(_pos.y);
+ s.syncAsSint16LE(_fieldA8);
+ s.syncAsSint16LE(_fieldAA);
+ s.syncAsSint16LE(_fieldAC);
+ s.syncAsSint16LE(_fieldAE);
+}
+
+void Scene3500::Actor7::sub109466(int xp, int yp, int arg3, int arg4, int arg5) {
+ _fieldAE = 0;
+ _pos = Common::Point(xp, yp);
+ _fieldA8 = arg3;
+ _fieldAA = arg4;
+ _fieldAC = _fieldAA / _fieldA8;
+
+ postInit();
+ setup(1050, 3, 1);
+ fixPriority(255);
+ sub109663(arg5);
+}
+
+void Scene3500::Actor7::sub1094ED() {
+ Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene;
+
+ scene->_field1270 = _position.x - _pos.x;
+}
+
+void Scene3500::Actor7::sub109663(int arg1){
+ changePosition(Common::Point(_pos.x + arg1, _pos.y - (_fieldAC * arg1)));
+}
+
+void Scene3500::Actor7::changePosition(const Common::Point &pt) {
+ setPosition(pt);
}
void Scene3500::Actor7::process(Event &event) {
Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene;
- if (scene->_field1286 == 0)
+ if (!scene->_directionChangesEnabled)
return;
if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == CURSOR_USE) && (_bounds.contains(event.mousePos))) {
@@ -3595,26 +3456,95 @@ void Scene3500::Actor7::process(Event &event) {
event.handled = true;
int cx = event.mousePos.y - _fieldAE + 1;
- if (_fieldA6 >= cx) {
- if (_fieldA6 - _fieldAA <= cx)
- sub109693(Common::Point(((_fieldA6 - cx) / 2) + _fieldA4 + ((_fieldA6 - cx) % 2), cx));
+ if (_pos.y >= cx) {
+ if (_pos.y - _fieldAA <= cx)
+ changePosition(Common::Point(((_pos.y - cx) / 2) + _pos.x + ((_pos.y - cx) % 2), cx));
else
- sub109693(Common::Point(_fieldA4 + _fieldA8, _fieldA6 - _fieldAA));
+ changePosition(Common::Point(_pos.x + _fieldA8, _pos.y - _fieldAA));
} else {
- sub109693(Common::Point(_fieldA4, _fieldA6));
+ changePosition(Common::Point(_pos.x, _pos.y));
}
}
bool Scene3500::Actor7::startAction(CursorType action, Event &event) {
Scene3500 *scene = (Scene3500 *)R2_GLOBALS._sceneManager._scene;
- if (scene->_field1286 == 0)
+ if (!scene->_directionChangesEnabled) {
return true;
-
- if (scene->_field1286 == 4)
+ } else if (action == CURSOR_USE) {
return false;
+ } else {
+ return SceneActor::startAction(action, event);
+ }
+}
- return SceneActor::startAction(action, event);
+/*--------------------------------------------------------------------------*/
+
+int Scene3500::MazeUI3500::cellFromX(int x) {
+ return (_cellSize.x / 2) + x - (x % _cellSize.x);
+}
+
+int Scene3500::MazeUI3500::cellFromY(int y) {
+ return (_cellSize.y / 2) + y - (y % _cellSize.y) - 1;
+}
+
+int Scene3500::MazeUI3500::getCellFromMapXY(Common::Point pt) {
+ int cellX = pt.x / _cellSize.x;
+ int cellY = pt.y / _cellSize.y;
+
+ if ((cellX >= 0) && (cellY >= 0) && (cellX < _mapCells.x) && (cellY < _mapCells.y)) {
+ return (int16)READ_LE_UINT16(_mapData + (_mapCells.x * cellY + cellX) * 2);
+ } else
+ return -1;
+}
+
+bool Scene3500::MazeUI3500::setMazePosition2(Common::Point &p) {
+ bool retVal = setMazePosition(p);
+ p = _mapOffset;
+
+ return retVal;
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene3500::Scene3500() {
+ _fieldAF8 = 0;
+ _fieldB9E = 0;
+ _rotation = NULL;
+ _mazeChangeAmount = 0;
+ _field1270 = 0;
+ _field1272 = 0;
+ _field1274 = 0;
+ _mazeDirection = MAZEDIR_NONE;
+ _field1278 = 0;
+ _mazePosition.x = 0;
+ _mazePosition.y = 0;
+ _field127E = 0;
+ _field1280 = 0;
+ _field1282 = 0;
+ _field1284 = 0;
+ _directionChangesEnabled = false;
+}
+
+void Scene3500::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ SYNC_POINTER(_rotation);
+
+ s.syncAsSint16LE(_fieldAF8);
+ s.syncAsSint16LE(_fieldB9E);
+ s.syncAsSint16LE(_mazeChangeAmount);
+ s.syncAsSint16LE(_field1270);
+ s.syncAsSint16LE(_field1272);
+ s.syncAsSint16LE(_field1274);
+ s.syncAsSint16LE(_mazeDirection);
+ s.syncAsSint16LE(_field1278);
+ s.syncAsSint16LE(_mazePosition.x);
+ s.syncAsSint16LE(_mazePosition.y);
+ s.syncAsSint16LE(_field127E);
+ s.syncAsSint16LE(_field1280);
+ s.syncAsSint16LE(_field1282);
+ s.syncAsSint16LE(_field1284);
+ s.syncAsSint16LE(_directionChangesEnabled);
}
void Scene3500::postInit(SceneObjectList *OwnerList) {
@@ -3622,7 +3552,7 @@ void Scene3500::postInit(SceneObjectList *OwnerList) {
loadScene(1050);
R2_GLOBALS._uiElements._active = false;
- R2_GLOBALS._interfaceY = 200;
+ R2_GLOBALS._interfaceY = SCREEN_HEIGHT;
R2_GLOBALS._v5589E.set(0, 0, 320, 200);
R2_GLOBALS._sound1.play(305);
@@ -3662,17 +3592,17 @@ void Scene3500::postInit(SceneObjectList *OwnerList) {
_actor7.setDetails(3500, 6, 7, -1, 1, (SceneItem *)NULL);
R2_GLOBALS._sound1.play(276);
- _item4._field34 = 88;
- _item4.setDetails(88, 3500, 18, 10, -1);
+ _pitchDown._movementId = 88;
+ _pitchDown.setDetails(88, 3500, 18, 10, -1);
- _item5._field34 = 112;
- _item5.setDetails(112, 3500, 9, 10, -1);
+ _turnLeft._movementId = 112;
+ _turnLeft.setDetails(112, 3500, 9, 10, -1);
- _item6._field34 = 104;
- _item6.setDetails(104, 3500, 15, 10, -1);
+ _pitchUp._movementId = 104;
+ _pitchUp.setDetails(104, 3500, 15, 10, -1);
- _item7._field34 = 96;
- _item7.setDetails(96, 3500, 12, 10, -1);
+ _turnRight._movementId = 96;
+ _turnRight.setDetails(96, 3500, 12, 10, -1);
_actor8.postInit();
_actor8.setup(1050, 1, 1);
@@ -3729,7 +3659,7 @@ void Scene3500::postInit(SceneObjectList *OwnerList) {
_action1._field24 = 0;
_mazeUI.draw();
- _field1286 = 1;
+ _directionChangesEnabled = true;
R2_GLOBALS._player.postInit();
R2_GLOBALS._player.hide();
@@ -3738,6 +3668,85 @@ void Scene3500::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player._canWalk = false;
}
+void Scene3500::doMovement(int id) {
+ switch (id) {
+ case -1:
+ _actor7.sub1094ED();
+ if (_field1270 != 0) {
+ _field1270--;
+ _actor7.sub109663(_field1270);
+ }
+ if (_action1._field24 != 0)
+ _field1270 = 0;
+ break;
+ case 1:
+ _actor7.sub1094ED();
+ if (_field1270 < 16) {
+ ++_field1270;
+ _actor7.sub109663(_field1270);
+ }
+ if (_action1._field24 != 0)
+ _field1270 = 0;
+ break;
+ case 88:
+ if ((_action == 0) || (_action1._field24 == 0)) {
+ // The original makes a second useless check on action, skipped
+ _action2.sub10831F(2);
+ if ((_action) && ((_action2.getActionIndex() != 0) || (_action2._field1E != 2))) {
+ _action2.signal();
+ } else {
+ _actor9.setAction(&_action2, &_actor9, NULL);
+ }
+ }
+ break;
+ case 96:
+ if ((_action) && (_action1._field24 != 0) && (_action2._field1E != 1)) {
+ _field1278 = 0;
+ _action1.sub108732(0);
+ } else if ((_action) && (_field1278 == 0) && (_action1._field24 != 0)) {
+ _field1278 = id;
+ } else if ((_action) && (_action1._field24 == 0)) {
+ _action1.sub108670(1);
+ _action1.signal();
+ } else if (_action == 0) {
+ _action1.sub108670(1);
+ setAction(&_action1, &_actor1, NULL);
+ }
+ break;
+ case 104:
+ if ((_action == 0) || (_action1._field24 == 0)) {
+ _action2.sub10831F(-1);
+ if ((_action) && ((_action2.getActionIndex() != 0) || (_action2._field1E != -1))) {
+ _action2.signal();
+ } else {
+ _actor9.setAction(&_action2, &_actor9, NULL);
+ }
+ }
+ break;
+ case 112:
+ if ((_action) && (_action1._field24 != 0) && (_action2._field1E != -1)) {
+ _field1278 = 0;
+ _action1.sub108732(0);
+ } else if ((_action) && (_field1278 == 0) && (_action1._field24 != 0)) {
+ _field1278 = id;
+ } else if ((_action) && (_action1._field24 == 0)) {
+ _action1.sub108670(-1);
+ _action1.signal();
+ } else if (_action == 0) {
+ _action1.sub108670(-1);
+ setAction(&_action1, &_actor1, NULL);
+ }
+ break;
+ default:
+ _field1270 = id;
+ _actor7.sub109663(id);
+ if (_action1._field24 != 0) {
+ _field1270 = 0;
+ }
+ break;
+ }
+}
+
void Scene3500::remove() {
R2_GLOBALS._sound2.fadeOut2(NULL);
SceneExt::remove();
@@ -3746,69 +3755,69 @@ void Scene3500::remove() {
void Scene3500::signal() {
R2_GLOBALS._player.enableControl(CURSOR_USE);
R2_GLOBALS._player._canWalk = false;
- _field1286 = 1;
+ _directionChangesEnabled = true;
}
void Scene3500::process(Event &event) {
- if (_field1286 == 0)
+ if (!_directionChangesEnabled)
return;
if (event.eventType == EVENT_KEYPRESS) {
switch (event.kbd.keycode) {
case Common::KEYCODE_KP7:
R2_GLOBALS._sound2.play(338);
- sub107F71(16);
+ doMovement(16);
event.handled = true;
break;
case Common::KEYCODE_UP:
case Common::KEYCODE_KP8:
R2_GLOBALS._sound2.play(14, NULL, 63);
- sub107F71(88);
+ doMovement(88);
event.handled = true;
break;
case Common::KEYCODE_KP9:
if (_field1270 < 16)
R2_GLOBALS._sound2.play(338);
- sub107F71(1);
+ doMovement(1);
event.handled = true;
break;
case Common::KEYCODE_KP4:
case Common::KEYCODE_LEFT:
R2_GLOBALS._sound2.play(14, NULL, 63);
- sub107F71(112);
+ doMovement(112);
event.handled = true;
break;
case Common::KEYCODE_KP6:
case Common::KEYCODE_RIGHT:
R2_GLOBALS._sound2.play(14, NULL, 63);
- sub107F71(96);
+ doMovement(96);
event.handled = true;
break;
case Common::KEYCODE_KP1:
R2_GLOBALS._sound2.play(338);
- sub107F71(0);
+ doMovement(0);
event.handled = true;
break;
case Common::KEYCODE_KP2:
case Common::KEYCODE_DOWN:
R2_GLOBALS._sound2.play(14, NULL, 63);
- sub107F71(104);
+ doMovement(104);
event.handled = true;
break;
case Common::KEYCODE_KP3:
if (_field1270 != 0)
R2_GLOBALS._sound2.play(338);
- sub107F71(-1);
+ doMovement(-1);
event.handled = true;
break;
case Common::KEYCODE_KP0:
R2_GLOBALS._sound2.play(338);
- sub107F71(8);
+ doMovement(8);
event.handled = true;
break;
case Common::KEYCODE_KP_PERIOD:
R2_GLOBALS._sound2.play(338);
- sub107F71(4);
+ doMovement(4);
event.handled = true;
break;
default:
@@ -3820,16 +3829,16 @@ void Scene3500::process(Event &event) {
_actor7.process(event);
if (!event.handled)
- _item4.process(event);
+ _pitchDown.process(event);
if (!event.handled)
- _item5.process(event);
+ _turnLeft.process(event);
if (!event.handled)
- _item6.process(event);
+ _pitchUp.process(event);
if (!event.handled)
- _item7.process(event);
+ _turnRight.process(event);
Scene::process(event);
}
@@ -3846,7 +3855,7 @@ void Scene3500::dispatch() {
if ((_field1278 != 0) && (_action1._field24 == 0)) {
oldField1278 = _field1278;
_field1278 = 0;
- sub107F71(oldField1278);
+ doMovement(oldField1278);
}
if (!_rotation)
@@ -4238,19 +4247,15 @@ void Scene3500::dispatch() {
*--------------------------------------------------------------------------*/
Scene3600::Scene3600() {
- _field2548 = 0;
- _field254A = 0;
- _field254C = 0;
- _field254E = 0;
+ _tealDead = false;
+ _lightEntered = false;
_ghoulTeleported = false;
}
void Scene3600::synchronize(Serializer &s) {
SceneExt::synchronize(s);
- s.syncAsSint16LE(_field2548);
- s.syncAsSint16LE(_field254A);
- s.syncAsSint16LE(_field254C);
- s.syncAsSint16LE(_field254E);
+ s.syncAsSint16LE(_tealDead);
+ s.syncAsSint16LE(_lightEntered);
s.syncAsSint16LE(_ghoulTeleported);
}
@@ -4277,7 +4282,7 @@ void Scene3600::Action3600::signal() {
case 1:
if (_field1E == 0) {
_field1E = 1;
- scene->_actor2.setAction(NULL);
+ scene->_steppingDisk.setAction(NULL);
R2_GLOBALS._sound2.play(330, NULL, 0);
R2_GLOBALS._sound2.fade(127, 5, 10, false, NULL);
}
@@ -4327,7 +4332,7 @@ void Scene3600::Action2::signal() {
}
}
-bool Scene3600::Item5::startAction(CursorType action, Event &event) {
+bool Scene3600::LightShaft::startAction(CursorType action, Event &event) {
Scene3600 *scene = (Scene3600 *)R2_GLOBALS._sceneManager._scene;
if ((action != CURSOR_USE) || (scene->_action1._field1E == 0))
@@ -4338,10 +4343,10 @@ bool Scene3600::Item5::startAction(CursorType action, Event &event) {
R2_GLOBALS._player.disableControl();
scene->_sceneMode = 3624;
- scene->_actor10.setStrip2(-1);
- scene->_actor11.setStrip2(-1);
- scene->_actor12.setStrip2(-1);
- scene->_actor4.setStrip2(-1);
+ scene->_quinn.setStrip2(-1);
+ scene->_seeker.setStrip2(-1);
+ scene->_miranda.setStrip2(-1);
+ scene->_webbster.setStrip2(-1);
if (R2_GLOBALS._player._characterIndex == R2_SEEKER)
R2_GLOBALS._player.setAction(&scene->_sequenceManager3, scene, 3611, &R2_GLOBALS._player, NULL);
@@ -4364,14 +4369,14 @@ bool Scene3600::Protector::startAction(CursorType action, Event &event) {
scene->_protectorSpeaker._displayMode = 1;
if (!R2_GLOBALS._player._mover)
R2_GLOBALS._player.addMover(NULL);
- if (!scene->_actor10._mover)
- scene->_actor10.addMover(NULL);
- if (!scene->_actor11._mover)
- scene->_actor11.addMover(NULL);
- if (!scene->_actor12._mover)
- scene->_actor12.addMover(NULL);
- if (!scene->_actor4._mover)
- scene->_actor4.addMover(NULL);
+ if (!scene->_quinn._mover)
+ scene->_quinn.addMover(NULL);
+ if (!scene->_seeker._mover)
+ scene->_seeker.addMover(NULL);
+ if (!scene->_miranda._mover)
+ scene->_miranda.addMover(NULL);
+ if (!scene->_webbster._mover)
+ scene->_webbster.addMover(NULL);
setup(3127, 2, 1);
scene->_sceneMode = 3327;
@@ -4411,14 +4416,13 @@ void Scene3600::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._scrollFollower = &R2_GLOBALS._player;
R2_GLOBALS._v558B6.set(60, 0, 260, 200);
} else {
- R2_GLOBALS._scrollFollower = &_actor2;
+ R2_GLOBALS._scrollFollower = &_steppingDisk;
_sceneBounds = Rect(160, 0, 480, 200);
R2_GLOBALS._v558B6.set(25, 0, 260, 200);
}
loadScene(3600);
SceneExt::postInit();
- _field254C = 0;
_stripManager.setColors(60, 255);
_stripManager.setFontNumber(3);
@@ -4433,62 +4437,61 @@ void Scene3600::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player._characterScene[R2_SEEKER] = 3600;
R2_GLOBALS._player._characterScene[R2_MIRANDA] = 3600;
- _item2.setDetails(33, 3600, 6, -1, -1);
- _item3.setDetails(Rect(3, 3, 22, 45), 3600, 9, -1, -1, 1, NULL);
- _item4.setDetails(Rect(449, 3, 475, 45), 3600, 9, -1, -1, 1, NULL);
+ _console.setDetails(33, 3600, 6, -1, -1);
+ _tapestry1.setDetails(Rect(3, 3, 22, 45), 3600, 9, -1, -1, 1, NULL);
+ _tapestry2.setDetails(Rect(449, 3, 475, 45), 3600, 9, -1, -1, 1, NULL);
- _actor10.postInit();
- _actor10._moveDiff = Common::Point(3, 2);
- _actor10.changeZoom(-1);
- _actor10._effect = 1;
+ _quinn.postInit();
+ _quinn._moveDiff = Common::Point(3, 2);
+ _quinn.changeZoom(-1);
+ _quinn._effect = 1;
if (R2_GLOBALS._player._characterIndex != 1)
- _actor10.setDetails(9001, 0, -1, -1, 1, (SceneItem *) NULL);
+ _quinn.setDetails(9001, 0, -1, -1, 1, (SceneItem *) NULL);
- _actor11.postInit();
- _actor11._numFrames = 7;
- _actor11._moveDiff = Common::Point(5, 3);
- _actor11.changeZoom(-1);
- _actor11._effect = 1;
+ _seeker.postInit();
+ _seeker._numFrames = 7;
+ _seeker._moveDiff = Common::Point(5, 3);
+ _seeker.changeZoom(-1);
+ _seeker._effect = 1;
if (R2_GLOBALS._player._characterIndex != 2)
- _actor11.setDetails(9002, 1, -1, -1, 1, (SceneItem *) NULL);
+ _seeker.setDetails(9002, 1, -1, -1, 1, (SceneItem *) NULL);
- _actor12.postInit();
- _actor12._moveDiff = Common::Point(3, 2);
- _actor12.changeZoom(-1);
- _actor12._effect = 1;
+ _miranda.postInit();
+ _miranda._moveDiff = Common::Point(3, 2);
+ _miranda.changeZoom(-1);
+ _miranda._effect = 1;
if (R2_GLOBALS._player._characterIndex != 3)
- _actor12.setDetails(9003, 1, -1, -1, 1, (SceneItem *) NULL);
+ _miranda.setDetails(9003, 1, -1, -1, 1, (SceneItem *) NULL);
R2_GLOBALS._player.postInit();
R2_GLOBALS._player.changeZoom(-1);
R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
R2_GLOBALS._player.disableControl();
- _actor4.postInit();
- _actor4._numFrames = 7;
- _actor4._moveDiff = Common::Point(5, 3);
- _actor4.changeZoom(-1);
- _actor4._effect = 1;
- _actor4.setDetails(3600, 27, -1, -1, 1, (SceneItem *) NULL);
+ _webbster.postInit();
+ _webbster._numFrames = 7;
+ _webbster._moveDiff = Common::Point(5, 3);
+ _webbster.changeZoom(-1);
+ _webbster._effect = 1;
+ _webbster.setDetails(3600, 27, -1, -1, 1, (SceneItem *) NULL);
- _actor5.postInit();
- _actor5._numFrames = 7;
- _actor5._moveDiff = Common::Point(3, 2);
- _actor5.changeZoom(-1);
- _actor5._effect = 1;
- _actor5.setDetails(3600, 12, -1, -1, 1, (SceneItem *) NULL);
+ _teal.postInit();
+ _teal._numFrames = 7;
+ _teal._moveDiff = Common::Point(3, 2);
+ _teal.changeZoom(-1);
+ _teal._effect = 1;
+ _teal.setDetails(3600, 12, -1, -1, 1, (SceneItem *) NULL);
_palette1.loadPalette(0);
_palette1.loadPalette(3601);
if (R2_GLOBALS._sceneManager._previousScene == 3600) {
- _item5._sceneRegionId = 200;
- _item5.setDetails(3600, 30, -1, -1, 5, &_actor4);
- _field254A = 1;
- _field2548 = 1;
+ _lightShaft._sceneRegionId = 200;
+ _lightShaft.setDetails(3600, 30, -1, -1, 5, &_webbster);
+ _tealDead = true;
R2_GLOBALS._walkRegions.disableRegion(2);
R2_GLOBALS._walkRegions.disableRegion(7);
@@ -4496,46 +4499,46 @@ void Scene3600::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._walkRegions.disableRegion(15);
R2_GLOBALS._walkRegions.disableRegion(16);
- _actor10.setup(10, 5, 11);
- _actor10.animate(ANIM_MODE_1, NULL);
+ _quinn.setup(10, 5, 11);
+ _quinn.animate(ANIM_MODE_1, NULL);
- _actor11.setup(20, 5, 11);
- _actor11.animate(ANIM_MODE_1, NULL);
+ _seeker.setup(20, 5, 11);
+ _seeker.animate(ANIM_MODE_1, NULL);
- _actor12.setup(30, 5, 11);
- _actor12.animate(ANIM_MODE_1, NULL);
+ _miranda.setup(30, 5, 11);
+ _miranda.animate(ANIM_MODE_1, NULL);
if (R2_GLOBALS._player._characterIndex == R2_SEEKER) {
- _actor10.setPosition(Common::Point(76, 148));
- _actor11.setPosition(Common::Point(134, 148));
- _actor12.setPosition(Common::Point(100, 148));
+ _quinn.setPosition(Common::Point(76, 148));
+ _seeker.setPosition(Common::Point(134, 148));
+ _miranda.setPosition(Common::Point(100, 148));
R2_GLOBALS._player._moveDiff = Common::Point(5, 3);
- R2_GLOBALS._player.setup(20, _actor11._strip, 1);
- R2_GLOBALS._player.setPosition(_actor11._position);
- _actor11.hide();
+ R2_GLOBALS._player.setup(20, _seeker._strip, 1);
+ R2_GLOBALS._player.setPosition(_seeker._position);
+ _seeker.hide();
} else if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) {
- _actor10.setPosition(Common::Point(110, 148));
- _actor11.setPosition(Common::Point(76, 148));
- _actor12.setPosition(Common::Point(134, 148));
+ _quinn.setPosition(Common::Point(110, 148));
+ _seeker.setPosition(Common::Point(76, 148));
+ _miranda.setPosition(Common::Point(134, 148));
R2_GLOBALS._player._moveDiff = Common::Point(3, 2);
- R2_GLOBALS._player.setup(30, _actor12._strip, 1);
- R2_GLOBALS._player.setPosition(_actor12._position);
- _actor12.hide();
+ R2_GLOBALS._player.setup(30, _miranda._strip, 1);
+ R2_GLOBALS._player.setPosition(_miranda._position);
+ _miranda.hide();
} else {
- _actor10.setPosition(Common::Point(134, 148));
- _actor11.setPosition(Common::Point(76, 148));
- _actor12.setPosition(Common::Point(110, 148));
+ _quinn.setPosition(Common::Point(134, 148));
+ _seeker.setPosition(Common::Point(76, 148));
+ _miranda.setPosition(Common::Point(110, 148));
R2_GLOBALS._player._moveDiff = Common::Point(3, 2);
- R2_GLOBALS._player.setup(10, _actor10._strip, 1);
- R2_GLOBALS._player.setPosition(_actor10._position);
- _actor10.hide();
+ R2_GLOBALS._player.setup(10, _quinn._strip, 1);
+ R2_GLOBALS._player.setPosition(_quinn._position);
+ _quinn.hide();
}
- _actor4.setPosition(Common::Point(47, 149));
- _actor4.setup(40, 1, 11);
- _actor4.animate(ANIM_MODE_1, NULL);
+ _webbster.setPosition(Common::Point(47, 149));
+ _webbster.setup(40, 1, 11);
+ _webbster.animate(ANIM_MODE_1, NULL);
- _actor5.setPosition(Common::Point(367, 148));
- _actor5.setup(3601, 7, 5);
+ _teal.setPosition(Common::Point(367, 148));
+ _teal.setup(3601, 7, 5);
if (!R2_GLOBALS.getFlag(71)) {
_protector.postInit();
@@ -4549,65 +4552,64 @@ void Scene3600::postInit(SceneObjectList *OwnerList) {
}
R2_GLOBALS._sound2.play(330);
- _actor3.postInit();
- _actor3.setPosition(Common::Point(84, 156));
- _actor3.fixPriority(158);
- _actor3.setup(3601, 5, 1);
- _actor3.animate(ANIM_MODE_2, NULL);
+ _consoleLights.postInit();
+ _consoleLights.setPosition(Common::Point(84, 156));
+ _consoleLights.fixPriority(158);
+ _consoleLights.setup(3601, 5, 1);
+ _consoleLights.animate(ANIM_MODE_2, NULL);
_action1._field1E = 1;
_action1._field20 = 0;
_action1.setActionIndex(1);
- _actor3.setAction(&_action1);
+ _consoleLights.setAction(&_action1);
_sceneMode = 3623;
g_globals->_events.setCursor(CURSOR_ARROW);
R2_GLOBALS._player.enableControl(CURSOR_WALK);
} else {
- _field254A = 0;
- _field2548 = 0;
+ _tealDead = false;
R2_GLOBALS._walkRegions.disableRegion(17);
R2_GLOBALS._walkRegions.disableRegion(18);
- _actor10.setPosition(Common::Point(393, 148));
- _actor11.setPosition(Common::Point(364, 153));
- _actor12.setPosition(Common::Point(413, 164));
+ _quinn.setPosition(Common::Point(393, 148));
+ _seeker.setPosition(Common::Point(364, 153));
+ _miranda.setPosition(Common::Point(413, 164));
R2_GLOBALS._player.hide();
- _actor4.setPosition(Common::Point(373, 164));
+ _webbster.setPosition(Common::Point(373, 164));
- _actor5.setup(3403, 8, 11);
- _actor5.setPosition(Common::Point(403, 155));
+ _teal.setup(3403, 8, 11);
+ _teal.setPosition(Common::Point(403, 155));
_protector.setup(3403, 7, 1);
_protector.setPosition(Common::Point(405, 155));
- _actor2.postInit();
- _actor2.setup(3600, 2, 1);
- _actor2.setPosition(Common::Point(403, 161));
- _actor2.fixPriority(149);
- _actor2.changeZoom(-1);
+ _steppingDisk.postInit();
+ _steppingDisk.setup(3600, 2, 1);
+ _steppingDisk.setPosition(Common::Point(403, 161));
+ _steppingDisk.fixPriority(149);
+ _steppingDisk.changeZoom(-1);
_action1._field1E = 0;
_action1._field20 = 90;
_sceneMode = 3600;
- setAction(&_sequenceManager1, this, 3600, &_actor11, &_actor10, &_actor12, &_actor4, &_actor5, &_actor2, NULL);
- _field254E = 0;
+ setAction(&_sequenceManager1, this, 3600, &_seeker, &_quinn, &_miranda,
+ &_webbster, &_teal, &_steppingDisk, NULL);
}
- _field254E = 0;
+ _lightEntered = false;
_ghoulTeleported = R2_GLOBALS.getFlag(71);
R2_GLOBALS._sound1.play(326);
- _item1.setDetails(Rect(0, 0, 480, 200), 3600, 0, -1, -1, 1, NULL);
+ _background.setDetails(Rect(0, 0, 480, 200), 3600, 0, -1, -1, 1, NULL);
}
void Scene3600::remove() {
- _actor3.animate(ANIM_MODE_NONE, NULL);
- _actor3.setAction(NULL);
+ _consoleLights.animate(ANIM_MODE_NONE, NULL);
+ _consoleLights.setAction(NULL);
R2_GLOBALS._sound2.fadeOut2(NULL);
R2_GLOBALS._sound1.fadeOut2(NULL);
R2_GLOBALS._scrollFollower = &R2_GLOBALS._player;
@@ -4619,27 +4621,29 @@ void Scene3600::signal() {
case 3320:
// TODO: warning("STUB: sub_1D227()");
R2_GLOBALS._walkRegions.disableRegion(14);
- R2_GLOBALS._scrollFollower = &_actor11;
+ R2_GLOBALS._scrollFollower = &_seeker;
_tealSpeaker._object1.hide();
- _actor5.show();
- _actor5.setStrip(2);
+ _teal.show();
+ _teal.setStrip(2);
if (R2_GLOBALS._player._characterIndex == R2_SEEKER)
_sceneMode = 3602;
else if (R2_GLOBALS._player._characterIndex == R2_MIRANDA)
_sceneMode = 3603;
else
_sceneMode = 3601;
- setAction(&_sequenceManager1, this, _sceneMode, &_actor11, &_actor10, &_actor12, &_actor4, &_actor5, NULL);
+ setAction(&_sequenceManager1, this, _sceneMode, &_seeker, &_quinn,
+ &_miranda, &_webbster, &_teal, NULL);
break;
case 3321:
warning("STUB: sub_1D227()");
R2_GLOBALS._scrollFollower = &R2_GLOBALS._player;
_tealSpeaker.proc16();
- _actor5.show();
- _actor5.setStrip(1);
- _actor3.postInit();
+ _teal.show();
+ _teal.setStrip(1);
+ _consoleLights.postInit();
_sceneMode = 3604;
- setAction(&_sequenceManager1, this, _sceneMode, &_actor5, &_actor3, &_actor10, &_actor11, &_actor12, &_actor4, NULL);
+ setAction(&_sequenceManager1, this, _sceneMode, &_teal, &_consoleLights,
+ &_quinn, &_seeker, &_miranda, &_webbster, NULL);
break;
case 3322:
warning("STUB: sub_1D227()");
@@ -4647,13 +4651,13 @@ void Scene3600::signal() {
_quinnSpeaker._displayMode = 1;
_tealSpeaker.proc16();
_tealSpeaker._displayMode = 7;
- R2_GLOBALS._scrollFollower = &_actor5;
+ R2_GLOBALS._scrollFollower = &_teal;
_sceneMode = 3605;
- setAction(&_sequenceManager1, this, _sceneMode, &_actor5, &_protector, &_actor2, NULL);
+ setAction(&_sequenceManager1, this, _sceneMode, &_teal, &_protector, &_steppingDisk, NULL);
break;
case 3323:
- if (_field254A == 0)
- _field254A = 1;
+ if (!_tealDead)
+ _tealDead = true;
else {
warning("STUB: sub_1D227()");
_protectorSpeaker.proc16();
@@ -4663,7 +4667,6 @@ void Scene3600::signal() {
_sceneMode = 3607;
_protector.setAction(&_sequenceManager1, this, _sceneMode, &_protector, NULL);
- R2_GLOBALS._v558C2 = 1;
_protectorSpeaker.proc16();
_protectorSpeaker._displayMode = 1;
_quinnSpeaker._displayMode = 1;
@@ -4678,7 +4681,7 @@ void Scene3600::signal() {
R2_GLOBALS._walkRegions.disableRegion(15);
R2_GLOBALS._walkRegions.disableRegion(16);
- _actor3.setAction(&_action1);
+ _consoleLights.setAction(&_action1);
}
break;
case 3324:
@@ -4688,7 +4691,6 @@ void Scene3600::signal() {
R2_GLOBALS._player.enableControl(CURSOR_WALK);
_protector.fixPriority(-1);
_sceneMode = 3623;
- _field2548 = 1;
break;
case 3327:
g_globals->_events.setCursor(CURSOR_ARROW);
@@ -4697,24 +4699,24 @@ void Scene3600::signal() {
break;
case 3450:
R2_GLOBALS._sound1.stop();
- _actor1.hide();
- _actor6.hide();
+ _protector3400.hide();
+ _door3400.hide();
_sceneBounds = Rect(40, 0, SCREEN_WIDTH + 40, SCREEN_HEIGHT);
setZoomPercents(142, 80, 167, 105);
loadScene(3600);
R2_GLOBALS._uiElements.show();
- _item5._sceneRegionId = 200;
- _item5.setDetails(3600, 30, -1, -1, 5, &_actor4);
-
- _actor3.show();
- _actor10.show();
- _actor11.show();
- _actor12.show();
- _actor4.show();
- _actor5.show();
+ _lightShaft._sceneRegionId = 200;
+ _lightShaft.setDetails(3600, 30, -1, -1, 5, &_webbster);
+
+ _consoleLights.show();
+ _quinn.show();
+ _seeker.show();
+ _miranda.show();
+ _webbster.show();
+ _teal.show();
- _actor5.setPosition(Common::Point(298, 151));
+ _teal.setPosition(Common::Point(298, 151));
_protector.postInit();
_protector._state = 0;
@@ -4726,32 +4728,32 @@ void Scene3600::signal() {
_protector.addMover(NULL);
_protector.animate(ANIM_MODE_NONE);
_protector.hide();
- _protector.setDetails(3600, 15, -1, 17, 5, &_item5);
+ _protector.setDetails(3600, 15, -1, 17, 5, &_lightShaft);
- _actor2.setup(3600, 2, 1);
- _actor2.setPosition(Common::Point(403, 161));
- _actor2.fixPriority(149);
- _actor2.changeZoom(-1);
- _actor2.show();
+ _steppingDisk.setup(3600, 2, 1);
+ _steppingDisk.setPosition(Common::Point(403, 161));
+ _steppingDisk.fixPriority(149);
+ _steppingDisk.changeZoom(-1);
+ _steppingDisk.show();
_quinnSpeaker._displayMode = 2;
_tealSpeaker._displayMode = 2;
if (R2_GLOBALS._player._characterIndex == R2_SEEKER) {
R2_GLOBALS._player._moveDiff = Common::Point(5, 3);
- R2_GLOBALS._player.setup(20, _actor11._strip, 1);
- R2_GLOBALS._player.setPosition(_actor11._position);
- _actor11.hide();
+ R2_GLOBALS._player.setup(20, _seeker._strip, 1);
+ R2_GLOBALS._player.setPosition(_seeker._position);
+ _seeker.hide();
} else if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) {
R2_GLOBALS._player._moveDiff = Common::Point(3, 2);
- R2_GLOBALS._player.setup(30, _actor12._strip, 1);
- R2_GLOBALS._player.setPosition(_actor12._position);
- _actor12.hide();
+ R2_GLOBALS._player.setup(30, _miranda._strip, 1);
+ R2_GLOBALS._player.setPosition(_miranda._position);
+ _miranda.hide();
} else {
R2_GLOBALS._player._moveDiff = Common::Point(3, 2);
- R2_GLOBALS._player.setup(10, _actor10._strip, 1);
- R2_GLOBALS._player.setPosition(_actor10._position);
- _actor10.hide();
+ R2_GLOBALS._player.setup(10, _quinn._strip, 1);
+ R2_GLOBALS._player.setPosition(_quinn._position);
+ _quinn.hide();
}
R2_GLOBALS._player.show();
R2_GLOBALS._sound1.play(326);
@@ -4781,40 +4783,41 @@ void Scene3600::signal() {
R2_GLOBALS._walkRegions.enableRegion(2);
R2_GLOBALS._walkRegions.enableRegion(7);
- _actor2.hide();
- _actor3.hide();
+ _steppingDisk.hide();
+ _consoleLights.hide();
R2_GLOBALS._player.hide();
- _actor10.hide();
- _actor11.hide();
- _actor12.hide();
- _actor4.hide();
- _actor5.hide();
+ _quinn.hide();
+ _seeker.hide();
+ _miranda.hide();
+ _webbster.hide();
+ _teal.hide();
_sceneBounds = Rect(60, 0, SCREEN_WIDTH + 60, SCREEN_HEIGHT);
setZoomPercents(51, 46, 180, 200);
loadScene(3400);
R2_GLOBALS._uiElements.show();
- _actor1.postInit();
+ _protector3400.postInit();
- _actor2.setup(3403, 1, 1);
- _actor2.setPosition(Common::Point(190, 103));
- _actor2.fixPriority(89);
- _actor2.show();
+ _steppingDisk.setup(3403, 1, 1);
+ _steppingDisk.setPosition(Common::Point(190, 103));
+ _steppingDisk.fixPriority(89);
+ _steppingDisk.show();
- _actor6.postInit();
- _actor6.setup(3400, 1, 6);
- _actor6.setPosition(Common::Point(236, 51));
- _actor6.fixPriority(51);
- R2_GLOBALS._scrollFollower = &_actor6;
+ _door3400.postInit();
+ _door3400.setup(3400, 1, 6);
+ _door3400.setPosition(Common::Point(236, 51));
+ _door3400.fixPriority(51);
+ R2_GLOBALS._scrollFollower = &_door3400;
R2_GLOBALS._sound1.play(323);
_sceneMode = 3450;
- setAction(&_sequenceManager1, this, 3450, &_actor1, &_actor6, NULL);
+ setAction(&_sequenceManager1, this, 3450, &_protector3400, &_door3400, NULL);
break;
case 3605:
_protector.setup(3258, 4, 1);
- _protector.setAction(&_sequenceManager1, this, 3606, &_actor5, &_protector, &_actor2, NULL);
+ _protector.setAction(&_sequenceManager1, this, 3606, &_teal, &_protector,
+ &_steppingDisk, NULL);
_sceneMode = 3323;
_stripManager.start(3323, this);
@@ -4833,11 +4836,11 @@ void Scene3600::signal() {
break;
case 3624:
R2_GLOBALS._player.disableControl();
- if ((_field254E != 0) && (_actor10._position.x == 229) && (_actor10._position.y == 154) && (_actor11._position.x == 181) && (_actor11._position.y == 154) && (_actor12._position.x == 207) && (_actor12._position.y == 154) && (_actor4._position.x == 155) && (_actor4._position.y == 154)) {
+ if (_lightEntered && (_quinn._position.x == 229) && (_quinn._position.y == 154) && (_seeker._position.x == 181) && (_seeker._position.y == 154) && (_miranda._position.x == 207) && (_miranda._position.y == 154) && (_webbster._position.x == 155) && (_webbster._position.y == 154)) {
R2_GLOBALS._sound2.stop();
R2_GLOBALS._sound2.play(331);
_sceneMode = 3625;
- setAction(&_sequenceManager1, this, 3625, &_actor10, &_actor11, &_actor12, &_actor4, NULL);
+ setAction(&_sequenceManager1, this, 3625, &_quinn, &_seeker, &_miranda, &_webbster, NULL);
}
break;
case 3625:
@@ -4862,8 +4865,9 @@ void Scene3600::signal() {
}
void Scene3600::process(Event &event) {
- if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == CURSOR_ARROW) && (event.mousePos.x > 237) && (!R2_GLOBALS.getFlag(71))) {
- SceneItem::display(3600, 17, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7 -999);
+ if ((event.eventType == EVENT_BUTTON_DOWN) && (R2_GLOBALS._events.getCursor() == CURSOR_ARROW)
+ && (event.mousePos.x > 237) && (!R2_GLOBALS.getFlag(71))) {
+ SceneItem::display(3600, 17, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
event.handled = true;
}
Scene::process(event);
@@ -4871,7 +4875,7 @@ void Scene3600::process(Event &event) {
void Scene3600::dispatch() {
if ((R2_GLOBALS._player.getRegionIndex() == 200) && (_action1._field1E != 0)
- && (_field254E == 0)) {
+ && !_lightEntered) {
R2_GLOBALS._sound2.fadeOut2(NULL);
if (_protector._mover)
_protector.addMover(NULL);
@@ -4881,8 +4885,7 @@ void Scene3600::dispatch() {
if (R2_GLOBALS._player._mover)
R2_GLOBALS._player.addMover(NULL);
- _field254C = 0;
- _field254E = 1;
+ _lightEntered = true;
R2_GLOBALS._walkRegions.enableRegion(2);
R2_GLOBALS._walkRegions.enableRegion(7);
@@ -4890,27 +4893,27 @@ void Scene3600::dispatch() {
_sceneMode = 3624;
- _actor10.setStrip(-1);
- _actor11.setStrip(-1);
- _actor12.setStrip(-1);
- _actor4.setStrip(-1);
+ _quinn.setStrip(-1);
+ _seeker.setStrip(-1);
+ _miranda.setStrip(-1);
+ _webbster.setStrip(-1);
R2_GLOBALS._player.hide();
if (R2_GLOBALS._player._characterIndex == R2_SEEKER) {
- _actor11.setPosition(R2_GLOBALS._player._position);
- _actor11.show();
+ _seeker.setPosition(R2_GLOBALS._player._position);
+ _seeker.show();
} else if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) {
- _actor12.setPosition(R2_GLOBALS._player._position);
- _actor12.show();
+ _miranda.setPosition(R2_GLOBALS._player._position);
+ _miranda.show();
} else {
- _actor10.setPosition(R2_GLOBALS._player._position);
- _actor10.show();
+ _quinn.setPosition(R2_GLOBALS._player._position);
+ _quinn.show();
}
- _actor10.setAction(&_sequenceManager2, this, 3610, &_actor10, NULL);
- _actor11.setAction(&_sequenceManager3, this, 3611, &_actor11, NULL);
- _actor12.setAction(&_sequenceManager4, this, 3612, &_actor12, NULL);
- _actor4.setAction(&_sequenceManager1, this, 3613, &_actor4, NULL);
+ _quinn.setAction(&_sequenceManager2, this, 3610, &_quinn, NULL);
+ _seeker.setAction(&_sequenceManager3, this, 3611, &_seeker, NULL);
+ _miranda.setAction(&_sequenceManager4, this, 3612, &_miranda, NULL);
+ _webbster.setAction(&_sequenceManager1, this, 3613, &_webbster, NULL);
}
if ((_protector.getRegionIndex() == 200) && (_action1._field1E != 0) && !_ghoulTeleported) {
@@ -4921,14 +4924,14 @@ void Scene3600::dispatch() {
if (R2_GLOBALS._player._mover)
R2_GLOBALS._player.addMover(NULL);
- if (_actor10._mover)
- _actor10.addMover(NULL);
- if (_actor11._mover)
- _actor11.addMover(NULL);
- if (_actor12._mover)
- _actor12.addMover(NULL);
- if (_actor4._mover)
- _actor4.addMover(NULL);
+ if (_quinn._mover)
+ _quinn.addMover(NULL);
+ if (_seeker._mover)
+ _seeker.addMover(NULL);
+ if (_miranda._mover)
+ _miranda.addMover(NULL);
+ if (_webbster._mover)
+ _webbster.addMover(NULL);
}
Scene::dispatch();
@@ -4941,8 +4944,8 @@ void Scene3600::dispatch() {
void Scene3700::postInit(SceneObjectList *OwnerList) {
loadScene(3700);
- SceneExt::postInit();
R2_GLOBALS._uiElements._active = false;
+ SceneExt::postInit();
R2_GLOBALS._interfaceY = SCREEN_HEIGHT;
_stripManager.setColors(60, 255);
@@ -4968,14 +4971,14 @@ void Scene3700::postInit(SceneObjectList *OwnerList) {
_webbster._moveDiff = Common::Point(5, 3);
_webbster.hide();
- _actor5.postInit();
+ _teleportPad.postInit();
R2_GLOBALS._player.disableControl();
R2_GLOBALS._sound1.play(332);
_sceneMode = 3700;
setAction(&_sequenceManager, this, 3700, &_quinn, &_seeker, &_miranda,
- &_webbster, &_actor5, NULL);
+ &_webbster, &_teleportPad, NULL);
}
void Scene3700::remove() {
@@ -5185,7 +5188,7 @@ void Scene3800::initExits() {
_southExit._moving = false;
_westExit._moving = false;
- loadScene(R2_GLOBALS._v566A6);
+ loadScene(R2_GLOBALS._maze3800SceneNumb);
R2_GLOBALS._uiElements.draw();
}
@@ -5201,20 +5204,21 @@ void Scene3800::enterArea() {
R2_GLOBALS._player.setStrip(3);
R2_GLOBALS._player.changeZoom(-1);
R2_GLOBALS._player._moveDiff = Common::Point(3, 2);
- _actor1.postInit();
- _actor1.fixPriority(10);
- _actor1.changeZoom(-1);
- _actor1.setVisage(1110);
- _actor1._effect = 5;
- _actor1._field9C = this->_field312;
- R2_GLOBALS._player._linkedActor = &_actor1;
+ _balloonQuinn.postInit();
+ _balloonQuinn.fixPriority(10);
+ _balloonQuinn.changeZoom(-1);
+ _balloonQuinn.setVisage(1110);
+ _balloonQuinn._effect = 5;
+ _balloonQuinn._field9C = this->_field312;
+ R2_GLOBALS._player._linkedActor = &_balloonQuinn;
switch (R2_GLOBALS._sceneManager._previousScene) {
case 2600:
- _object1.postInit();
- _object2.postInit();
- _actor1.hide();
+ _balloon.postInit();
+ _harness.postInit();
+ _balloonQuinn.hide();
_sceneMode = 3800;
- setAction(&_sequenceManager1, this, 3800, &R2_GLOBALS._player, &_object1, &_object2, NULL);
+ setAction(&_sequenceManager1, this, 3800, &R2_GLOBALS._player,
+ &_balloon, &_harness, NULL);
break;
case 3900:
_sceneMode = 15;
@@ -5250,6 +5254,7 @@ void Scene3800::enterArea() {
default:
break;
}
+ break;
default:
R2_GLOBALS._player.enableControl(CURSOR_WALK);
break;
@@ -5313,7 +5318,7 @@ void Scene3800::postInit(SceneObjectList *OwnerList) {
_westExit.setDetails(Rect(0, 87, 14, 168), EXITCURSOR_W, 3800);
_westExit.setDest(Common::Point(7, 145));
- _rect1.set(0, 0, 320, 87);
+ _skylineRect.set(0, 0, 320, 87);
_background.setDetails(Rect(0, 0, 320, 200), 3800, 0, 1, 2, 1, (SceneItem *) NULL);
enterArea();
@@ -5322,45 +5327,43 @@ void Scene3800::postInit(SceneObjectList *OwnerList) {
void Scene3800::signal() {
switch (_sceneMode) {
case 11:
- R2_GLOBALS._v566A6 += 15;
- if (R2_GLOBALS._v566A6 > 3815)
- R2_GLOBALS._v566A6 -= 20;
+ R2_GLOBALS._maze3800SceneNumb += 15;
+ if (R2_GLOBALS._maze3800SceneNumb > 3815)
+ R2_GLOBALS._maze3800SceneNumb -= 20;
initExits();
enterArea();
break;
case 12:
- R2_GLOBALS._v566A6 += 5;
- if (R2_GLOBALS._v566A6 > 3815)
- R2_GLOBALS._v566A6 = 3800;
+ R2_GLOBALS._maze3800SceneNumb += 5;
+ if (R2_GLOBALS._maze3800SceneNumb > 3815)
+ R2_GLOBALS._maze3800SceneNumb = 3800;
initExits();
enterArea();
break;
case 13:
- R2_GLOBALS._v566A6 -= 15;
- if (R2_GLOBALS._v566A6 < 3800)
- R2_GLOBALS._v566A6 += 20;
+ R2_GLOBALS._maze3800SceneNumb -= 15;
+ if (R2_GLOBALS._maze3800SceneNumb < 3800)
+ R2_GLOBALS._maze3800SceneNumb += 20;
initExits();
enterArea();
break;
case 14:
- R2_GLOBALS._v566A6 -= 5;
- if (R2_GLOBALS._v566A6 < 3800)
- R2_GLOBALS._v566A6 = 3815;
+ R2_GLOBALS._maze3800SceneNumb -= 5;
+ if (R2_GLOBALS._maze3800SceneNumb < 3800)
+ R2_GLOBALS._maze3800SceneNumb = 3815;
initExits();
enterArea();
break;
case 15:
- R2_GLOBALS._v56AAB = 0;
R2_GLOBALS._player.enableControl();
break;
case 16:
g_globals->_sceneManager.changeScene(3900);
break;
case 3800:
- _actor1.show();
- _object1.remove();
- _object2.remove();
- R2_GLOBALS._v56AAB = 0;
+ _balloonQuinn.show();
+ _balloon.remove();
+ _harness.remove();
R2_GLOBALS._player.enableControl();
break;
case 3805:
@@ -5384,18 +5387,19 @@ void Scene3800::signal() {
}
void Scene3800::process(Event &event) {
- if ((R2_GLOBALS._player._uiEnabled) && (event.eventType == EVENT_BUTTON_DOWN) && (_rect1.contains(event.mousePos))) {
+ if ((R2_GLOBALS._player._uiEnabled) && (event.eventType == EVENT_BUTTON_DOWN)
+ && (_skylineRect.contains(event.mousePos))) {
event.handled = true;
switch (R2_GLOBALS._events.getCursor()) {
- case R2_NEGATOR_GUN:
+ case CURSOR_WALK:
R2_GLOBALS._player.addMover(NULL);
R2_GLOBALS._player.updateAngle(event.mousePos);
break;
- case R2_STEPPING_DISKS:
- SceneItem::display(3800, 5, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ case CURSOR_LOOK:
+ SceneItem::display(3800, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
break;
- case R2_ATTRACTOR_UNIT:
- SceneItem::display(3800, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ case CURSOR_USE:
+ SceneItem::display(3800, 5, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
break;
default:
event.handled = false;
@@ -5510,13 +5514,13 @@ void Scene3900::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._player.changeZoom(-1);
R2_GLOBALS._player._moveDiff = Common::Point(3, 2);
- _actor1.postInit();
- _actor1.fixPriority(10);
- _actor1.changeZoom(-1);
- _actor1.setVisage(1110);
- _actor1._effect = 5;
- _actor1._field9C = _field312;
- R2_GLOBALS._player._linkedActor = &_actor1;
+ _linkedQuinn.postInit();
+ _linkedQuinn.fixPriority(10);
+ _linkedQuinn.changeZoom(-1);
+ _linkedQuinn.setVisage(1110);
+ _linkedQuinn._effect = 5;
+ _linkedQuinn._field9C = _field312;
+ R2_GLOBALS._player._linkedActor = &_linkedQuinn;
if ((R2_GLOBALS._desertPreviousDirection == 2) && (R2_GLOBALS._sceneManager._previousScene != 2700)) {
// loadScene(3825);
@@ -5532,8 +5536,8 @@ void Scene3900::postInit(SceneObjectList *OwnerList) {
_westExit._enabled = false;
- _exit5.setDetails(Rect(0, 87, 29, 168), EXITCURSOR_W, 3900);
- _exit5.setDest(Common::Point(24, 135));
+ _westEnterForest.setDetails(Rect(0, 87, 29, 168), EXITCURSOR_W, 3900);
+ _westEnterForest.setDest(Common::Point(24, 135));
} else {
// loadScene(3820);
R2_GLOBALS._desertCorrectDirection = 2;
@@ -5548,12 +5552,12 @@ void Scene3900::postInit(SceneObjectList *OwnerList) {
_westExit._insideArea = false;
_westExit._moving = false;
- _exit5.setDetails(Rect(290, 87, 320, 168), EXITCURSOR_E, 3900);
- _exit5.setDest(Common::Point(295, 135));
+ _westEnterForest.setDetails(Rect(290, 87, 320, 168), EXITCURSOR_E, 3900);
+ _westEnterForest.setDest(Common::Point(295, 135));
}
- _exit5._enabled = true;
- _exit5._insideArea = false;
- _exit5._moving = false;
+ _westEnterForest._enabled = true;
+ _westEnterForest._insideArea = false;
+ _westEnterForest._moving = false;
scalePalette(65, 65, 65);
@@ -5569,8 +5573,8 @@ void Scene3900::postInit(SceneObjectList *OwnerList) {
R2_GLOBALS._uiElements.draw();
- _rect1.set(0, 0, 320, 87);
- _item1.setDetails(Rect(0, 0, 320, 200), 3800, 0, 1, 2, 1, (SceneItem *)NULL);
+ _skylineRect.set(0, 0, 320, 87);
+ _background.setDetails(Rect(0, 0, 320, 200), 3800, 0, 1, 2, 1, (SceneItem *)NULL);
if (R2_GLOBALS._sceneManager._previousScene == 3800) {
_sceneMode = 11;
switch (R2_GLOBALS._desertPreviousDirection) {
@@ -5626,7 +5630,6 @@ void Scene3900::signal() {
case 11:
// No break on purpose
case 12:
- R2_GLOBALS._v56AAB = 0;
R2_GLOBALS._player.enableControl(CURSOR_WALK);
break;
case 13:
@@ -5656,18 +5659,19 @@ void Scene3900::signal() {
}
void Scene3900::process(Event &event) {
- if ((R2_GLOBALS._player._uiEnabled) && (event.eventType == EVENT_BUTTON_DOWN) && (_rect1.contains(event.mousePos))) {
+ if ((R2_GLOBALS._player._uiEnabled) && (event.eventType == EVENT_BUTTON_DOWN)
+ && (_skylineRect.contains(event.mousePos))) {
event.handled = true;
switch (R2_GLOBALS._events.getCursor()) {
- case R2_NEGATOR_GUN:
+ case CURSOR_WALK:
R2_GLOBALS._player.addMover(NULL);
R2_GLOBALS._player.updateAngle(event.mousePos);
break;
- case R2_STEPPING_DISKS:
- SceneItem::display(3800, 5, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ case CURSOR_USE:
+ SceneItem::display(3800, 5, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
break;
- case R2_ATTRACTOR_UNIT:
- SceneItem::display(3800, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
+ case CURSOR_LOOK:
+ SceneItem::display(3800, 3, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, LIST_END);
break;
default:
event.handled = false;
diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.h b/engines/tsage/ringworld2/ringworld2_scenes3.h
index 6c7a594b12..48236ee300 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes3.h
+++ b/engines/tsage/ringworld2/ringworld2_scenes3.h
@@ -45,15 +45,15 @@ class Scene3100 : public SceneExt {
virtual bool startAction(CursorType action, Event &event);
};
public:
- int _field412;
+ bool _fadeSound;
SpeakerGuard _guardSpeaker;
- NamedHotspot _item1;
- NamedHotspot _item2;
- SceneActor _actor1;
- SceneActor _actor2;
- SceneActor _actor3;
- SceneActor _actor4;
- SceneActor _actor5;
+ NamedHotspot _background;
+ NamedHotspot _hammerHead2;
+ SceneActor _hammerHead;
+ SceneActor _miranda;
+ SceneActor _ghoul;
+ SceneActor _technicians;
+ SceneActor _deadBodies;
Guard _guard;
ASoundExt _sound1;
SequenceManager _sequenceManager;
@@ -84,7 +84,7 @@ class Scene3125 : public SceneExt {
virtual bool startAction(CursorType action, Event &event);
};
public:
- int _field412;
+ bool _soundPlayed;
Background _background;
Door _door;
Table _table;
@@ -93,9 +93,7 @@ public:
SceneActor _ghoul2;
SceneActor _ghoul3;
SceneActor _ghoul4;
- SequenceManager _sequenceManager1;
- // Second sequence manager... Unused?
- SequenceManager _sequenceManager2;
+ SequenceManager _sequenceManager;
Scene3125();
virtual void postInit(SceneObjectList *OwnerList = NULL);
@@ -119,7 +117,7 @@ class Scene3150 : public SceneExt {
class FoodTray : public SceneActor {
virtual bool startAction(CursorType action, Event &event);
};
- class Actor6 : public SceneActor {
+ class ToiletFlush : public SceneActor {
virtual bool startAction(CursorType action, Event &event);
};
class AirVent : public SceneActor {
@@ -146,7 +144,7 @@ public:
SceneActor _bulbOrWire;
Water _water;
FoodTray _foodTray;
- Actor6 _toiletFlush;
+ ToiletFlush _toiletFlush;
AirVent _airVent;
DoorExit _doorExit;
VentExit _ventExit;
@@ -158,7 +156,7 @@ public:
};
class Scene3175 : public SceneExt {
- class Item1 : public NamedHotspot {
+ class RoomItem : public NamedHotspot {
public:
virtual bool startAction(CursorType action, Event &event);
};
@@ -170,11 +168,11 @@ class Scene3175 : public SceneExt {
virtual bool startAction(CursorType action, Event &event);
};
public:
- Item1 _background;
- Item1 _item2;
- Item1 _item3;
+ RoomItem _background;
+ RoomItem _table;
+ RoomItem _autopsies;
Door _door;
- SceneActor _actor2;
+ SceneActor _computer;
Corpse _corpse;
SequenceManager _sequenceManager;
@@ -187,9 +185,9 @@ public:
SpeakerRocko3200 _rockoSpeaker;
SpeakerJocko3200 _jockoSpeaker;
SpeakerSocko3200 _sockoSpeaker;
- SceneActor _actor1;
- SceneActor _actor2;
- SceneActor _actor3;
+ SceneActor _rocko;
+ SceneActor _jocko;
+ SceneActor _socko;
SequenceManager _sequenceManager;
virtual void postInit(SceneObjectList *OwnerList = NULL);
@@ -200,8 +198,8 @@ class Scene3210 : public SceneExt {
public:
SpeakerCaptain3210 _captainSpeaker;
SpeakerPrivate3210 _privateSpeaker;
- SceneActor _actor1;
- SceneActor _actor2;
+ SceneActor _captain;
+ SceneActor _private;
SequenceManager _sequenceManager;
virtual void postInit(SceneObjectList *OwnerList = NULL);
@@ -212,8 +210,8 @@ class Scene3220 : public SceneExt {
public:
SpeakerRocko3220 _rockoSpeaker;
SpeakerJocko3220 _jockoSpeaker;
- SceneActor _actor1;
- SceneActor _actor2;
+ SceneActor _rocko;
+ SceneActor _jocko;
SequenceManager _sequenceManager;
virtual void postInit(SceneObjectList *OwnerList = NULL);
@@ -224,9 +222,9 @@ class Scene3230 : public SceneExt {
public:
SpeakerRocko3230 _rockoSpeaker;
SpeakerJocko3230 _jockoSpeaker;
- SceneActor _actor1;
- SceneActor _actor2;
- SceneActor _actor3;
+ SceneActor _rocko;
+ SceneActor _jocko;
+ SceneActor _ghoul;
SequenceManager _sequenceManager;
virtual void postInit(SceneObjectList *OwnerList = NULL);
@@ -238,8 +236,8 @@ public:
SpeakerTeal3240 _tealSpeaker;
SpeakerWebbster3240 _webbsterSpeaker;
SpeakerMiranda _mirandaSpeaker;
- SceneActor _actor1;
- SceneActor _actor2;
+ SceneActor _teal;
+ SceneActor _webbster;
SequenceManager _sequenceManager;
virtual void postInit(SceneObjectList *OwnerList = NULL);
@@ -250,8 +248,8 @@ class Scene3245 : public SceneExt {
public:
SpeakerRalf3245 _ralfSpeaker;
SpeakerTomko3245 _tomkoSpeaker;
- SceneActor _actor1;
- SceneActor _actor2;
+ SceneActor _ralf;
+ SceneActor _tomko;
SequenceManager _sequenceManager;
virtual void postInit(SceneObjectList *OwnerList = NULL);
@@ -275,7 +273,7 @@ public:
Door _leftDoor;
Door _topDoor;
Door _rightDoor;
- Door _actor4;
+ Door _grate;
SceneActor _ghoul1;
SceneActor _ghoul2;
SceneActor _ghoul3;
@@ -290,7 +288,7 @@ class Scene3255 : public SceneExt {
public:
SceneActor _teal;
SceneActor _guard;
- SceneActor _actor3;
+ SceneActor _door;
SceneActor _quinn;
SceneActor _ghoul1;
SceneActor _ghoul2;
@@ -366,7 +364,7 @@ public:
NamedHotspot _emptyCell2;
NamedHotspot _securityBeams1;
NamedHotspot _securityBeams2;
- SceneActor _actor1;
+ SceneActor _doorFrame;
Door _door;
CellExit _cellExit;
SequenceManager _sequenceManager;
@@ -377,15 +375,15 @@ public:
class Scene3350 : public SceneExt {
public:
- SceneActor _actor1;
- SceneActor _actor2;
- SceneActor _actor3;
- SceneActor _actor4;
- SceneActor _actor5;
- SceneActor _actor6;
- SceneActor _actor7;
- SceneActor _actor8;
- SceneActor _actor9;
+ SceneActor _miranda;
+ SceneActor _seeker;
+ SceneActor _webbster;
+ SceneActor _seatedPeople;
+ SceneActor _ship;
+ SceneActor _landedShip;
+ SceneActor _shipShadow;
+ SceneActor _canopy;
+ SceneActor _shipFront;
SequenceManager _sequenceManager;
PaletteRotation *_rotation;
@@ -439,9 +437,8 @@ public:
DownExit _downExit;
RightExit _rightExit;
SequenceManager _sequenceManager;
- int _field1488;
+ int _newSceneMode;
int _sceneAreas[4];
- int _field1492;
Scene3375();
virtual void postInit(SceneObjectList *OwnerList = NULL);
@@ -489,7 +486,7 @@ public:
Action1 _action1;
SequenceManager _sequenceManager;
- int _field11B2;
+ int _playerStrip;
Scene3385();
virtual void postInit(SceneObjectList *OwnerList = NULL);
@@ -531,7 +528,7 @@ public:
Action1 _action1;
SequenceManager _sequenceManager;
- int _field142E;
+ int _playerStrip;
Scene3395();
virtual void postInit(SceneObjectList *OwnerList = NULL);
@@ -556,7 +553,7 @@ public:
SceneActor _actor7;
SceneActor _actor8;
SequenceManager _sequenceManager;
- int16 _field157C;
+ bool _soundFaded;
Scene3400();
virtual void postInit(SceneObjectList *OwnerList = NULL);
@@ -591,11 +588,11 @@ class Scene3500 : public SceneExt {
virtual void signal();
};
- class Item4 : public NamedHotspot {
+ class DirectionButton : public NamedHotspot {
public:
- int _field34;
+ int _movementId;
- Item4();
+ DirectionButton();
virtual void synchronize(Serializer &s);
virtual bool startAction(CursorType action, Event &event);
@@ -603,8 +600,7 @@ class Scene3500 : public SceneExt {
class Actor7 : public SceneActor {
public:
- int _fieldA4;
- int _fieldA6;
+ Common::Point _pos;
int _fieldA8;
int _fieldAA;
int _fieldAC;
@@ -613,10 +609,10 @@ class Scene3500 : public SceneExt {
Actor7();
virtual void synchronize(Serializer &s);
- void sub109466(int arg1, int arg2, int arg3, int arg4, int arg5);
+ void sub109466(int xp, int yp, int arg3, int arg4, int arg5);
void sub1094ED();
void sub109663(int arg1);
- void sub109693(Common::Point Pt);
+ void changePosition(const Common::Point &pt);
virtual void process(Event &event);
virtual bool startAction(CursorType action, Event &event);
@@ -640,10 +636,10 @@ public:
NamedHotspot _item1;
NamedHotspot _item2;
NamedHotspot _item3;
- Item4 _item4;
- Item4 _item5;
- Item4 _item6;
- Item4 _item7;
+ DirectionButton _pitchDown;
+ DirectionButton _turnLeft;
+ DirectionButton _pitchUp;
+ DirectionButton _turnRight;
// Glyph of vessel on top of the maze ui
SceneActor _actor1;
SceneActor _actor2;
@@ -672,10 +668,10 @@ public:
int _field1280;
int _field1282;
int _field1284;
- int _field1286;
+ bool _directionChangesEnabled;
Scene3500();
- void sub107F71(int arg1);
+ void doMovement(int id);
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void remove();
@@ -699,7 +695,7 @@ class Scene3600 : public SceneExt {
virtual void signal();
};
- class Item5 : public NamedHotspot {
+ class LightShaft : public NamedHotspot {
public:
virtual bool startAction(CursorType action, Event &event);
};
@@ -715,23 +711,20 @@ public:
SpeakerMiranda3600 _mirandaSpeaker;
SpeakerTeal3600 _tealSpeaker;
SpeakerProtector3600 _protectorSpeaker;
- NamedHotspot _item1;
- NamedHotspot _item2;
- NamedHotspot _item3;
- NamedHotspot _item4;
- Item5 _item5;
- SceneActor _actor1;
- SceneActor _actor2;
- SceneActor _actor3;
- SceneActor _actor4;
- SceneActor _actor5;
- SceneActor _actor6;
- SceneActor _actor7;
- SceneActor _actor8;
- SceneActor _actor9;
- SceneActor _actor10;
- SceneActor _actor11;
- SceneActor _actor12;
+ NamedHotspot _background;
+ NamedHotspot _console;
+ NamedHotspot _tapestry1;
+ NamedHotspot _tapestry2;
+ LightShaft _lightShaft;
+ SceneActor _protector3400;
+ SceneActor _steppingDisk;
+ SceneActor _consoleLights;
+ SceneActor _webbster;
+ SceneActor _teal;
+ SceneActor _door3400;
+ SceneActor _quinn;
+ SceneActor _seeker;
+ SceneActor _miranda;
Protector _protector;
SequenceManager _sequenceManager1;
SequenceManager _sequenceManager2;
@@ -739,10 +732,8 @@ public:
SequenceManager _sequenceManager4;
ScenePalette _palette1;
- int _field2548;
- int _field254A;
- int _field254C;
- int _field254E;
+ bool _tealDead;
+ bool _lightEntered;
bool _ghoulTeleported;
Scene3600();
@@ -763,7 +754,7 @@ public:
SceneActor _seeker;
SceneActor _miranda;
SceneActor _webbster;
- SceneActor _actor5;
+ SceneActor _teleportPad;
SequenceManager _sequenceManager;
virtual void postInit(SceneObjectList *OwnerList = NULL);
@@ -793,15 +784,15 @@ class Scene3800 : public SceneExt {
};
public:
- SceneObject _object1;
- SceneObject _object2;
- SceneActor _actor1;
+ SceneObject _balloon;
+ SceneObject _harness;
+ SceneActor _balloonQuinn;
NamedHotspot _background;
NorthExit _northExit;
EastExit _eastExit;
SouthExit _southExit;
WestExit _westExit;
- Rect _rect1;
+ Rect _skylineRect;
SequenceManager _sequenceManager1;
int _desertDirection;
@@ -842,14 +833,14 @@ class Scene3900 : public SceneExt {
virtual void changeScene();
};
public:
- SceneActor _actor1;
- NamedHotspot _item1;
+ SceneActor _linkedQuinn;
+ NamedHotspot _background;
NorthExit _northExit;
EastExit _eastExit;
SouthExit _southExit;
WestExit _westExit;
- Exit5 _exit5;
- Rect _rect1;
+ Exit5 _westEnterForest;
+ Rect _skylineRect;
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void signal();
diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp
index 8b6ce4a1f3..a6bfc39e2a 100644
--- a/engines/tsage/ringworld2/ringworld2_speakers.cpp
+++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp
@@ -42,6 +42,13 @@ VisualSpeaker::VisualSpeaker(): Speaker() {
_color2 = 0;
_displayMode = 0;
_speakerMode = 0;
+
+ _object2 = nullptr;
+ _fieldF8 = 0;
+ _soundId = 0;
+ _removeObject = false;
+ _numFrames = 0;
+ _voiceFrameNumber = 0;
}
void VisualSpeaker::remove() {
@@ -92,6 +99,7 @@ void VisualSpeaker::signal() {
void VisualSpeaker::dispatch() {
uint32 frameNumber = R2_GLOBALS._events.getFrameNumber();
+ assert(_action);
// Delay check for character animation
if (_delayAmount) {
@@ -314,7 +322,7 @@ void SpeakerCaptain3210::proc15() {
Scene3210 *scene = (Scene3210 *)R2_GLOBALS._sceneManager._scene;
if (!_object2) {
- _object2 = &scene->_actor1;
+ _object2 = &scene->_captain;
_object2->hide();
_object1.postInit();
_object1.setPosition(_object2->_position);
@@ -467,7 +475,7 @@ void SpeakerJocko3200::proc15() {
Scene3200 *scene = (Scene3200 *)R2_GLOBALS._sceneManager._scene;
if (!_object2) {
- _object2 = &scene->_actor2;
+ _object2 = &scene->_jocko;
_object2->hide();
_object1.postInit();
_object1.setPosition(_object2->_position);
@@ -490,7 +498,7 @@ void SpeakerJocko3220::proc15() {
Scene3220 *scene = (Scene3220 *)R2_GLOBALS._sceneManager._scene;
if (!_object2) {
- _object2 = &scene->_actor2;
+ _object2 = &scene->_jocko;
_object2->hide();
_object1.postInit();
_object1.setPosition(_object2->_position);
@@ -513,7 +521,7 @@ void SpeakerJocko3230::proc15() {
Scene3230 *scene = (Scene3230 *)R2_GLOBALS._sceneManager._scene;
if (!_object2) {
- _object2 = &scene->_actor2;
+ _object2 = &scene->_jocko;
_object2->hide();
_object1.postInit();
_object1.setPosition(_object2->_position);
@@ -592,7 +600,7 @@ void SpeakerMiranda1625::proc15() {
if (!_object2) {
Scene1625 *scene = (Scene1625 *)R2_GLOBALS._sceneManager._scene;
- _object2 = &scene->_actor3;
+ _object2 = &scene->_mirandaMouth;
_object2->hide();
_object1.postInit();
_object1.setPosition(Common::Point(196, 65));
@@ -833,7 +841,7 @@ void SpeakerMiranda3600::proc15() {
if (R2_GLOBALS._player._characterIndex == R2_MIRANDA)
_object2 = &R2_GLOBALS._player;
else
- _object2 = &scene->_actor12;
+ _object2 = &scene->_miranda;
_object2->hide();
_object1.postInit();
@@ -1007,10 +1015,10 @@ void SpeakerNej2750::proc15() {
void SpeakerNej2800::proc15() {
int v = _speakerMode;
- Scene2750 *scene = (Scene2750 *)R2_GLOBALS._sceneManager._scene;
+ Scene2800 *scene = (Scene2800 *)R2_GLOBALS._sceneManager._scene;
if (!_object2) {
- _object2 = &scene->_actor2;
+ _object2 = &scene->_nej;
_object2->hide();
_object1.postInit();
_object1.setPosition(_object2->_position);
@@ -1087,7 +1095,7 @@ void SpeakerPrivate3210::proc15() {
Scene3210 *scene = (Scene3210 *)R2_GLOBALS._sceneManager._scene;
if (!_object2) {
- _object2 = &scene->_actor2;
+ _object2 = &scene->_private;
_object2->hide();
_object1.postInit();
_object1.setPosition(_object2->_position);
@@ -1722,7 +1730,7 @@ void SpeakerQuinn3600::proc15() {
if (R2_GLOBALS._player._characterIndex == R2_QUINN)
_object2 = &R2_GLOBALS._player;
else
- _object2 = &scene->_actor10;
+ _object2 = &scene->_quinn;
_object2->hide();
_object1.postInit();
_object1.setPosition(_object2->_position);
@@ -1869,7 +1877,7 @@ void SpeakerRalf3245::proc15() {
Scene3245 *scene = (Scene3245 *)R2_GLOBALS._sceneManager._scene;
if (!_object2) {
- _object2 = &scene->_actor1;
+ _object2 = &scene->_ralf;
_object2->hide();
_object1.postInit();
_object1.setPosition(_object2->_position);
@@ -1921,7 +1929,7 @@ void SpeakerRocko3200::proc15() {
Scene3200 *scene = (Scene3200 *)R2_GLOBALS._sceneManager._scene;
if (!_object2) {
- _object2 = &scene->_actor1;
+ _object2 = &scene->_rocko;
_object2->hide();
_object1.postInit();
_object1.setPosition(_object2->_position);
@@ -1944,7 +1952,7 @@ void SpeakerRocko3220::proc15() {
Scene3220 *scene = (Scene3220 *)R2_GLOBALS._sceneManager._scene;
if (!_object2) {
- _object2 = &scene->_actor1;
+ _object2 = &scene->_rocko;
_object2->hide();
_object1.postInit();
_object1.setPosition(_object2->_position);
@@ -1967,7 +1975,7 @@ void SpeakerRocko3230::proc15() {
Scene3230 *scene = (Scene3230 *)R2_GLOBALS._sceneManager._scene;
if (!_object2) {
- _object2 = &scene->_actor1;
+ _object2 = &scene->_rocko;
_object2->hide();
_object1.postInit();
_object1.setPosition(_object2->_position);
@@ -2143,7 +2151,7 @@ void SpeakerSeeker1900::proc15() {
} else {
assert(R2_GLOBALS._sceneManager._sceneNumber == 1900);
Scene1900 *scene = (Scene1900 *)R2_GLOBALS._sceneManager._scene;
- _object2 = &scene->_actor1;
+ _object2 = &scene->_companion;
}
_object2->hide();
@@ -2433,7 +2441,7 @@ void SpeakerSeeker3600::proc15() {
if (R2_GLOBALS._player._characterIndex == R2_SEEKER)
_object2 = &R2_GLOBALS._player;
else
- _object2 = &scene->_actor11;
+ _object2 = &scene->_seeker;
_object2->hide();
_object1.postInit();
@@ -2569,7 +2577,7 @@ void SpeakerSocko3200::proc15() {
Scene3200 *scene = (Scene3200 *)R2_GLOBALS._sceneManager._scene;
if (!_object2) {
- _object2 = &scene->_actor3;
+ _object2 = &scene->_socko;
_object2->hide();
_object1.postInit();
_object1.setPosition(_object2->_position);
@@ -2735,7 +2743,7 @@ void SpeakerTeal3240::proc15() {
Scene3240 *scene = (Scene3240 *)R2_GLOBALS._sceneManager._scene;
if (!_object2) {
- _object2 = &scene->_actor1;
+ _object2 = &scene->_teal;
_object2->hide();
_object1.postInit();
_object1.setPosition(_object2->_position);
@@ -2816,7 +2824,7 @@ void SpeakerTeal3600::proc15() {
int v = _speakerMode;
if (!_object2) {
- _object2 = &scene->_actor5;
+ _object2 = &scene->_teal;
_object2->hide();
_object1.postInit();
_object1.setPosition(_object2->_position);
@@ -2887,7 +2895,7 @@ void SpeakerTomko3245::proc15() {
Scene3245 *scene = (Scene3245 *)R2_GLOBALS._sceneManager._scene;
if (!_object2) {
- _object2 = &scene->_actor2;
+ _object2 = &scene->_tomko;
_object2->hide();
_object1.postInit();
_object1.setPosition(_object2->_position);
@@ -2980,7 +2988,7 @@ void SpeakerWebbster3240::proc15() {
Scene3240 *scene = (Scene3240 *)R2_GLOBALS._sceneManager._scene;
if (!_object2) {
- _object2 = &scene->_actor2;
+ _object2 = &scene->_webbster;
_object2->hide();
_object1.postInit();
_object1.setPosition(_object2->_position);
@@ -3209,7 +3217,7 @@ void SpeakerDutyOfficer180::proc15() {
_object1.animate(ANIM_MODE_2, NULL);
break;
case 1:
- _action = NULL;
+ _action->_action = NULL;
_object1.setup(76, 2, 1);
_object1.animate(ANIM_MODE_5, this);
break;
diff --git a/engines/tsage/saveload.cpp b/engines/tsage/saveload.cpp
index dbc122e6e4..f9e84e8913 100644
--- a/engines/tsage/saveload.cpp
+++ b/engines/tsage/saveload.cpp
@@ -47,6 +47,8 @@ SavedObject::~SavedObject() {
Saver::Saver() {
_macroSaveFlag = false;
_macroRestoreFlag = false;
+
+ _factoryPtr = nullptr;
}
Saver::~Saver() {
@@ -127,7 +129,6 @@ Common::Error Saver::save(int slot, const Common::String &saveName) {
// Set fields
_macroSaveFlag = true;
- _saveSlot = slot;
// Try and create the save file
Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(g_vm->generateSaveName(slot));
@@ -177,7 +178,6 @@ Common::Error Saver::restore(int slot) {
// Set fields
_macroRestoreFlag = true;
- _saveSlot = slot;
_unresolvedPtrs.clear();
// Set up the serializer
diff --git a/engines/tsage/saveload.h b/engines/tsage/saveload.h
index d43ef792bc..0d0457981f 100644
--- a/engines/tsage/saveload.h
+++ b/engines/tsage/saveload.h
@@ -33,7 +33,7 @@ namespace TsAGE {
typedef void (*SaveNotifierFn)(bool postFlag);
-#define TSAGE_SAVEGAME_VERSION 10
+#define TSAGE_SAVEGAME_VERSION 11
class SavedObject;
@@ -48,7 +48,7 @@ struct tSageSavegameHeader {
/*--------------------------------------------------------------------------*/
-// FIXME: workaround to supress spurious strict-alias warnings on older GCC
+// FIXME: workaround to suppress 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); \
@@ -59,7 +59,7 @@ struct tSageSavegameHeader {
if (s.isLoading()) FIELD = (TYPE)v_##FIELD;
/**
- * Derived serializer class with extra synchronisation types
+ * Derived serializer class with extra synchronization types
*/
class Serializer : public Common::Serializer {
public:
@@ -212,7 +212,6 @@ private:
bool _macroSaveFlag;
bool _macroRestoreFlag;
- int _saveSlot;
void resolveLoadPointers();
public:
diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp
index 58bb8c4a44..1726d6ad20 100644
--- a/engines/tsage/scenes.cpp
+++ b/engines/tsage/scenes.cpp
@@ -43,6 +43,7 @@ SceneManager::SceneManager() {
g_saver->addListener(this);
_objectCount = 0;
_loadMode = 0;
+ _sceneLoadCount = 0;
}
SceneManager::~SceneManager() {
@@ -273,6 +274,11 @@ Scene::Scene() : _sceneBounds(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT),
_activeScreenNumber = 0;
_oldSceneBounds = Rect(4000, 4000, 4100, 4100);
Common::fill(&_zoomPercents[0], &_zoomPercents[256], 0);
+
+ _field12 = 0;
+ _screenNumber = 0;
+ _fieldA = 0;
+ _fieldE = 0;
}
Scene::~Scene() {
diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp
index 844cfc1d4d..0946b6c419 100644
--- a/engines/tsage/sound.cpp
+++ b/engines/tsage/sound.cpp
@@ -969,7 +969,7 @@ void SoundManager::sfRethinkVoiceTypes() {
int entryIndex = -1;
for (uint idx = 0; idx < vtStruct->_entries.size(); ++idx) {
if (vtStruct->_entries[idx]._voiceNum == foundIndex) {
- foundIndex = true;
+ foundMatch = true;
if (!vtStruct->_entries[idx]._type0._sound2) {
entryIndex = idx;
break;
@@ -2540,6 +2540,11 @@ PlayStream::PlayStream(): EventHandler() {
_index = NULL;
_endAction = NULL;
_audioStream = NULL;
+
+ _resData._fileChunkSize = 0;
+ _resData._indexSize = 0;
+ _resData._chunkSize = 0;
+ _voiceNum = 0;
}
PlayStream::~PlayStream() {
@@ -2616,6 +2621,7 @@ bool PlayStream::play(int voiceNum, EventHandler *endAction) {
g_vm->_mixer->playStream(Audio::Mixer::kSpeechSoundType, &_soundHandle,
_audioStream, DisposeAfterUse::YES);
_voiceNum = voiceNum;
+ _endAction = endAction;
return true;
}
@@ -2700,13 +2706,8 @@ SoundDriver::SoundDriver() {
const byte adlib_group_data[] = { 1, 1, 9, 1, 0xff };
-const byte v440B0[9] = { 0, 1, 2, 6, 7, 8, 12, 13, 14 };
-
-const byte v440B9[9] = { 3, 4, 5, 9, 10, 11, 15, 16, 17 };
-
-const byte v440C2[18] = {
- 0, 1, 2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 16, 17, 18, 19, 20, 21
-};
+const byte adlib_operator1_offset[] = { 0, 1, 2, 8, 9, 10, 16, 17, 18 };
+const byte adlib_operator2_offset[] = { 3, 4, 5, 11, 12, 13, 19, 20, 21 };
const byte v44134[64] = {
0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
@@ -2837,10 +2838,10 @@ void AdlibSoundDriver::playSound(const byte *channelData, int dataOffset, int pr
_v4409E[channel] = dataP + offset - _patchData;
// Set sustain/release
- int portNum = v440C2[v440B0[channel]] + 0x80;
+ int portNum = adlib_operator1_offset[channel] + 0x80;
write(portNum, (_portContents[portNum] & 0xF0) | 0xF);
- portNum = v440C2[v440B9[channel]] + 0x80;
+ portNum = adlib_operator2_offset[channel] + 0x80;
write(portNum, (_portContents[portNum] & 0xF0) | 0xF);
if (_channelVoiced[channel])
@@ -2897,10 +2898,10 @@ void AdlibSoundDriver::updateChannelVolume(int channelNum) {
int level1 = !_v44082[channelNum] ? 63 - _v44070[channelNum] :
63 - v44134[volume * _v44070[channelNum] / 63];
- int portNum = v440C2[v440B0[channelNum]] + 0x40;
+ int portNum = adlib_operator1_offset[channelNum] + 0x40;
write(portNum, (_portContents[portNum] & 0x80) | level1);
- portNum = v440C2[v440B9[channelNum]] + 0x40;
+ portNum = adlib_operator2_offset[channelNum] + 0x40;
write(portNum, (_portContents[portNum] & 0x80) | level2);
}
@@ -2917,7 +2918,7 @@ void AdlibSoundDriver::clearVoice(int channel) {
void AdlibSoundDriver::updateChannel(int channel) {
const byte *dataP = _patchData + _v4409E[channel];
- int portOffset = v440C2[v440B0[channel]];
+ int portOffset = adlib_operator1_offset[channel];
int portNum = portOffset + 0x20;
int portValue = 0;
@@ -2940,7 +2941,7 @@ void AdlibSoundDriver::updateChannel(int channel) {
write(0x80 + portOffset, *(dataP + 14) | (*(dataP + 13) << 4));
write(0xE0 + portOffset, (_portContents[0xE0 + portOffset] & 0xFC) | *(dataP + 15));
- portOffset = v440C2[v440B9[channel]];
+ portOffset = adlib_operator2_offset[channel];
portNum = portOffset + 0x20;
portValue = 0;
if (*(dataP + 17))
@@ -3098,10 +3099,12 @@ void SoundBlasterDriver::playSound(const byte *channelData, int dataOffset, int
updateVoice(channel);
// Set the new channel data
- _channelData = channelData + dataOffset;
+ _channelData = channelData + dataOffset + 18;
// Make a copy of the buffer
int dataSize = g_vm->_memoryManager.getSize(channelData);
+ dataSize -= 18;
+
byte *soundData = (byte *)malloc(dataSize - dataOffset);
Common::copy(_channelData, _channelData + (dataSize - dataOffset), soundData);
diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h
index 95d0337af3..5d0bc92c1f 100644
--- a/engines/tsage/sound.h
+++ b/engines/tsage/sound.h
@@ -98,7 +98,7 @@ public:
virtual const GroupData *getGroupData() { return NULL; } // Method #3
virtual void installPatch(const byte *data, int size) {} // Method #4
virtual void poll() {} // Method #5
- virtual void proc12() {} // Method #6
+ virtual void method6() {} // Method #6
virtual int setMasterVolume(int volume) { return 0; } // Method #7
virtual void proc16() {} // Method #8
virtual void proc18(int al, VoiceType voiceType) {} // Method #9
diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp
index 87697f950b..9956d5c7fb 100644
--- a/engines/tsage/tsage.cpp
+++ b/engines/tsage/tsage.cpp
@@ -38,6 +38,7 @@ TSageEngine::TSageEngine(OSystem *system, const tSageGameDescription *gameDesc)
_gameDescription(gameDesc) {
g_vm = this;
DebugMan.addDebugChannel(kRingDebugScripts, "scripts", "Scripts debugging");
+ _debugger = nullptr;
if (g_vm->getFeatures() & GF_DEMO)
_debugger = new DemoDebugger();
else if (g_vm->getGameID() == GType_Ringworld)
@@ -103,7 +104,7 @@ void TSageEngine::initialize() {
g_globals = new Ringworld2::Ringworld2Globals();
// Setup the user interface
- T2_GLOBALS._uiElements.setup(Common::Point(0, UI_INTERFACE_Y - 2));
+ T2_GLOBALS._uiElements.setup(Common::Point(0, UI_INTERFACE_Y));
// Reset all global variables
R2_GLOBALS.reset();
diff --git a/engines/tsage/user_interface.cpp b/engines/tsage/user_interface.cpp
index 09cc2fd56d..c7053a073d 100644
--- a/engines/tsage/user_interface.cpp
+++ b/engines/tsage/user_interface.cpp
@@ -87,7 +87,7 @@ void UIQuestion::showDescription(CursorType cursor) {
Ringworld2::SceneExt *scene = static_cast<Ringworld2::SceneExt *>
(R2_GLOBALS._sceneManager._scene);
if (!scene->_sceneAreas.contains(R2_GLOBALS._scannerDialog))
- R2_GLOBALS._scannerDialog->proc12(4, 1, 1, 160, 125);
+ R2_GLOBALS._scannerDialog->setup2(4, 1, 1, 160, 125);
} else {
// Show object description
SceneItem::display2(3, (int)cursor);
@@ -276,11 +276,29 @@ void UICollection::draw() {
Rect(0, UI_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT),
Rect(0, UI_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT));
+ if (g_vm->getGameID() == GType_Ringworld2)
+ r2rDrawFrame();
+
_clearScreen = 1;
g_globals->_sceneManager._scene->_sceneBounds = savedBounds;
}
}
+void UICollection::r2rDrawFrame() {
+ Visage visage;
+ visage.setVisage(2, 1);
+ GfxSurface vertLine = visage.getFrame(1);
+ GfxSurface horizLine = visage.getFrame(2);
+
+ GLOBALS._screenSurface.copyFrom(horizLine, 0, 0);
+ GLOBALS._screenSurface.copyFrom(vertLine, 0, 3);
+ GLOBALS._screenSurface.copyFrom(vertLine, SCREEN_WIDTH - 4, 3);
+
+ // Restrict drawing area to exclude the borders at the edge of the screen
+ R2_GLOBALS._screenSurface._clipRect = Rect(4, 4, SCREEN_WIDTH - 4,
+ SCREEN_HEIGHT - 4);
+}
+
/*--------------------------------------------------------------------------*/
UIElements::UIElements(): UICollection() {
@@ -289,6 +307,10 @@ UIElements::UIElements(): UICollection() {
else
_cursorVisage.setVisage(1, 5);
g_saver->addLoadNotifier(&UIElements::loadNotifierProc);
+
+ _slotStart = 0;
+ _scoreValue = 0;
+ _active = false;
}
void UIElements::synchronize(Serializer &s) {
diff --git a/engines/tsage/user_interface.h b/engines/tsage/user_interface.h
index d06dccd9a4..60cefc0751 100644
--- a/engines/tsage/user_interface.h
+++ b/engines/tsage/user_interface.h
@@ -95,6 +95,8 @@ public:
};
class UICollection: public EventHandler {
+private:
+ void r2rDrawFrame();
protected:
void erase();
public:
diff --git a/engines/wintermute/ad/ad_actor.cpp b/engines/wintermute/ad/ad_actor.cpp
index 967270b9bd..590d7c4f01 100644
--- a/engines/wintermute/ad/ad_actor.cpp
+++ b/engines/wintermute/ad/ad_actor.cpp
@@ -1322,10 +1322,10 @@ bool AdActor::persist(BasePersistenceManager *persistMgr) {
persistMgr->transfer(TMEMBER_INT(_dir));
persistMgr->transferPtr(TMEMBER_PTR(_path));
persistMgr->transfer(TMEMBER(_pFCount));
- persistMgr->transfer(TMEMBER(_pFStepX));
- persistMgr->transfer(TMEMBER(_pFStepY));
- persistMgr->transfer(TMEMBER(_pFX));
- persistMgr->transfer(TMEMBER(_pFY));
+ persistMgr->transferDouble(TMEMBER(_pFStepX));
+ persistMgr->transferDouble(TMEMBER(_pFStepY));
+ persistMgr->transferDouble(TMEMBER(_pFX));
+ persistMgr->transferDouble(TMEMBER(_pFY));
persistMgr->transferPtr(TMEMBER_PTR(_standSprite));
_talkSprites.persist(persistMgr);
_talkSpritesEx.persist(persistMgr);
@@ -1376,7 +1376,7 @@ TDirection AdActor::angleToDirection(int angle) {
//////////////////////////////////////////////////////////////////////////
-int AdActor::getHeight() {
+int32 AdActor::getHeight() {
// if no current sprite is set, set some
if (_currentSprite == nullptr) {
if (_standSprite) {
diff --git a/engines/wintermute/ad/ad_actor.h b/engines/wintermute/ad/ad_actor.h
index e836dd72cf..3225eb44ec 100644
--- a/engines/wintermute/ad/ad_actor.h
+++ b/engines/wintermute/ad/ad_actor.h
@@ -47,7 +47,7 @@ class AdActor : public AdTalkHolder {
public:
TDirection angleToDirection(int angle);
DECLARE_PERSISTENT(AdActor, AdTalkHolder)
- virtual int getHeight();
+ virtual int32 getHeight() override;
BaseSprite *getTalkStance(const char *stance);
virtual void goTo(int x, int y, TDirection afterWalkDir = DI_NONE);
BasePoint *_targetPoint;
diff --git a/engines/wintermute/ad/ad_entity.cpp b/engines/wintermute/ad/ad_entity.cpp
index 2c0e13a4dc..e7471a413e 100644
--- a/engines/wintermute/ad/ad_entity.cpp
+++ b/engines/wintermute/ad/ad_entity.cpp
@@ -1067,7 +1067,7 @@ bool AdEntity::saveAsText(BaseDynamicBuffer *buffer, int indent) {
//////////////////////////////////////////////////////////////////////////
-int AdEntity::getHeight() {
+int32 AdEntity::getHeight() {
if (_region && !_sprite) {
return _region->_rect.bottom - _region->_rect.top;
} else {
diff --git a/engines/wintermute/ad/ad_entity.h b/engines/wintermute/ad/ad_entity.h
index c4d60e86f3..c3ed5622e5 100644
--- a/engines/wintermute/ad/ad_entity.h
+++ b/engines/wintermute/ad/ad_entity.h
@@ -40,7 +40,7 @@ public:
void setItem(const char *itemName);
DECLARE_PERSISTENT(AdEntity, AdTalkHolder)
void updatePosition();
- virtual int getHeight();
+ virtual int32 getHeight() override;
BaseRegion *_region;
virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) override;
virtual bool update();
diff --git a/engines/wintermute/ad/ad_game.cpp b/engines/wintermute/ad/ad_game.cpp
index 86f470b8c3..fc5f20164b 100644
--- a/engines/wintermute/ad/ad_game.cpp
+++ b/engines/wintermute/ad/ad_game.cpp
@@ -1425,7 +1425,7 @@ bool AdGame::persist(BasePersistenceManager *persistMgr) {
_responsesGame.persist(persistMgr);
persistMgr->transferPtr(TMEMBER_PTR(_scene));
_sceneStates.persist(persistMgr);
- persistMgr->transfer(TMEMBER(_scheduledFadeIn));
+ persistMgr->transferBool(TMEMBER(_scheduledFadeIn));
persistMgr->transfer(TMEMBER(_scheduledScene));
persistMgr->transferPtr(TMEMBER_PTR(_selectedItem));
persistMgr->transfer(TMEMBER_INT(_talkSkipButton));
@@ -1434,18 +1434,18 @@ bool AdGame::persist(BasePersistenceManager *persistMgr) {
persistMgr->transferPtr(TMEMBER_PTR(_sceneViewport));
persistMgr->transfer(TMEMBER_INT(_stateEx));
- persistMgr->transfer(TMEMBER(_initialScene));
+ persistMgr->transferBool(TMEMBER(_initialScene));
persistMgr->transfer(TMEMBER(_debugStartupScene));
persistMgr->transferPtr(TMEMBER_PTR(_invObject));
persistMgr->transferPtr(TMEMBER_PTR(_inventoryOwner));
- persistMgr->transfer(TMEMBER(_tempDisableSaveState));
+ persistMgr->transferBool(TMEMBER(_tempDisableSaveState));
_items.persist(persistMgr);
persistMgr->transfer(TMEMBER(_itemsFile));
_speechDirs.persist(persistMgr);
- persistMgr->transfer(TMEMBER(_smartItemCursor));
+ persistMgr->transferBool(TMEMBER(_smartItemCursor));
if (!persistMgr->getIsSaving()) {
_initialScene = false;
@@ -2160,7 +2160,6 @@ bool AdGame::onMouseLeftDown() {
_gameRef->_capturedObject = _gameRef->_activeObject;
}
_mouseLeftDown = true;
- BasePlatform::setCapture(/*_renderer->_window*/);
return STATUS_OK;
}
@@ -2171,7 +2170,6 @@ bool AdGame::onMouseLeftUp() {
_activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_LEFT);
}
- BasePlatform::releaseCapture();
_capturedObject = nullptr;
_mouseLeftDown = false;
diff --git a/engines/wintermute/ad/ad_inventory_box.cpp b/engines/wintermute/ad/ad_inventory_box.cpp
index 4c904e78eb..a6e10fee9c 100644
--- a/engines/wintermute/ad/ad_inventory_box.cpp
+++ b/engines/wintermute/ad/ad_inventory_box.cpp
@@ -372,16 +372,16 @@ bool AdInventoryBox::persist(BasePersistenceManager *persistMgr) {
BaseObject::persist(persistMgr);
persistMgr->transferPtr(TMEMBER_PTR(_closeButton));
- persistMgr->transfer(TMEMBER(_hideSelected));
+ persistMgr->transferBool(TMEMBER(_hideSelected));
persistMgr->transfer(TMEMBER(_itemHeight));
- persistMgr->transfer(TMEMBER(_itemsArea));
+ persistMgr->transferRect32(TMEMBER(_itemsArea));
persistMgr->transfer(TMEMBER(_itemWidth));
persistMgr->transfer(TMEMBER(_scrollBy));
persistMgr->transfer(TMEMBER(_scrollOffset));
persistMgr->transfer(TMEMBER(_spacing));
- persistMgr->transfer(TMEMBER(_visible));
+ persistMgr->transferBool(TMEMBER(_visible));
persistMgr->transferPtr(TMEMBER_PTR(_window));
- persistMgr->transfer(TMEMBER(_exclusive));
+ persistMgr->transferBool(TMEMBER(_exclusive));
return STATUS_OK;
}
diff --git a/engines/wintermute/ad/ad_item.cpp b/engines/wintermute/ad/ad_item.cpp
index f9741d1ed2..ae249de819 100644
--- a/engines/wintermute/ad/ad_item.cpp
+++ b/engines/wintermute/ad/ad_item.cpp
@@ -783,12 +783,12 @@ bool AdItem::persist(BasePersistenceManager *persistMgr) {
AdTalkHolder::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_cursorCombined));
+ persistMgr->transferBool(TMEMBER(_cursorCombined));
persistMgr->transferPtr(TMEMBER_PTR(_cursorHover));
persistMgr->transferPtr(TMEMBER_PTR(_cursorNormal));
persistMgr->transferPtr(TMEMBER_PTR(_spriteHover));
- persistMgr->transfer(TMEMBER(_inInventory));
- persistMgr->transfer(TMEMBER(_displayAmount));
+ persistMgr->transferBool(TMEMBER(_inInventory));
+ persistMgr->transferBool(TMEMBER(_displayAmount));
persistMgr->transfer(TMEMBER(_amount));
persistMgr->transfer(TMEMBER(_amountOffsetX));
persistMgr->transfer(TMEMBER(_amountOffsetY));
diff --git a/engines/wintermute/ad/ad_layer.cpp b/engines/wintermute/ad/ad_layer.cpp
index 752700d0d4..7bbdf27cc6 100644
--- a/engines/wintermute/ad/ad_layer.cpp
+++ b/engines/wintermute/ad/ad_layer.cpp
@@ -551,10 +551,10 @@ bool AdLayer::persist(BasePersistenceManager *persistMgr) {
BaseObject::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_active));
- persistMgr->transfer(TMEMBER(_closeUp));
+ persistMgr->transferBool(TMEMBER(_active));
+ persistMgr->transferBool(TMEMBER(_closeUp));
persistMgr->transfer(TMEMBER(_height));
- persistMgr->transfer(TMEMBER(_main));
+ persistMgr->transferBool(TMEMBER(_main));
_nodes.persist(persistMgr);
persistMgr->transfer(TMEMBER(_width));
diff --git a/engines/wintermute/ad/ad_node_state.cpp b/engines/wintermute/ad/ad_node_state.cpp
index 876c5a8bb4..193aa75194 100644
--- a/engines/wintermute/ad/ad_node_state.cpp
+++ b/engines/wintermute/ad/ad_node_state.cpp
@@ -95,7 +95,7 @@ void AdNodeState::setCursor(const char *filename) {
bool AdNodeState::persist(BasePersistenceManager *persistMgr) {
persistMgr->transferPtr(TMEMBER_PTR(_gameRef));
- persistMgr->transfer(TMEMBER(_active));
+ persistMgr->transferBool(TMEMBER(_active));
persistMgr->transfer(TMEMBER(_name));
persistMgr->transfer(TMEMBER(_filename));
persistMgr->transfer(TMEMBER(_cursor));
diff --git a/engines/wintermute/ad/ad_object.cpp b/engines/wintermute/ad/ad_object.cpp
index 0d5011f92d..6ab2e9bc75 100644
--- a/engines/wintermute/ad/ad_object.cpp
+++ b/engines/wintermute/ad/ad_object.cpp
@@ -859,7 +859,7 @@ bool AdObject::setFont(const char *filename) {
//////////////////////////////////////////////////////////////////////////
-int AdObject::getHeight() {
+int32 AdObject::getHeight() {
if (!_currentSprite) {
return 0;
} else {
@@ -1030,29 +1030,29 @@ bool AdObject::reset() {
bool AdObject::persist(BasePersistenceManager *persistMgr) {
BaseObject::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_active));
+ persistMgr->transferBool(TMEMBER(_active));
persistMgr->transferPtr(TMEMBER_PTR(_blockRegion));
persistMgr->transferPtr(TMEMBER_PTR(_currentBlockRegion));
persistMgr->transferPtr(TMEMBER_PTR(_currentWptGroup));
persistMgr->transferPtr(TMEMBER_PTR(_currentSprite));
- persistMgr->transfer(TMEMBER(_drawn));
+ persistMgr->transferBool(TMEMBER(_drawn));
persistMgr->transferPtr(TMEMBER_PTR(_font));
- persistMgr->transfer(TMEMBER(_ignoreItems));
+ persistMgr->transferBool(TMEMBER(_ignoreItems));
persistMgr->transfer(TMEMBER_INT(_nextState));
persistMgr->transferPtr(TMEMBER_PTR(_sentence));
persistMgr->transfer(TMEMBER_INT(_state));
persistMgr->transferPtr(TMEMBER_PTR(_animSprite));
- persistMgr->transfer(TMEMBER(_sceneIndependent));
+ persistMgr->transferBool(TMEMBER(_sceneIndependent));
persistMgr->transfer(TMEMBER(_forcedTalkAnimName));
- persistMgr->transfer(TMEMBER(_forcedTalkAnimUsed));
+ persistMgr->transferBool(TMEMBER(_forcedTalkAnimUsed));
persistMgr->transferPtr(TMEMBER_PTR(_tempSprite2));
persistMgr->transfer(TMEMBER_INT(_type));
persistMgr->transferPtr(TMEMBER_PTR(_wptGroup));
persistMgr->transferPtr(TMEMBER_PTR(_stickRegion));
- persistMgr->transfer(TMEMBER(_subtitlesModRelative));
+ persistMgr->transferBool(TMEMBER(_subtitlesModRelative));
persistMgr->transfer(TMEMBER(_subtitlesModX));
persistMgr->transfer(TMEMBER(_subtitlesModY));
- persistMgr->transfer(TMEMBER(_subtitlesModXCenter));
+ persistMgr->transferBool(TMEMBER(_subtitlesModXCenter));
persistMgr->transfer(TMEMBER(_subtitlesWidth));
persistMgr->transferPtr(TMEMBER_PTR(_inventory));
persistMgr->transferPtr(TMEMBER_PTR(_partEmitter));
@@ -1065,7 +1065,7 @@ bool AdObject::persist(BasePersistenceManager *persistMgr) {
_attachmentsPost.persist(persistMgr);
persistMgr->transferPtr(TMEMBER_PTR(_registerAlias));
- persistMgr->transfer(TMEMBER(_partFollowParent));
+ persistMgr->transferBool(TMEMBER(_partFollowParent));
persistMgr->transfer(TMEMBER(_partOffsetX));
persistMgr->transfer(TMEMBER(_partOffsetY));
diff --git a/engines/wintermute/ad/ad_object.h b/engines/wintermute/ad/ad_object.h
index 9e30f69855..ba984ef8d1 100644
--- a/engines/wintermute/ad/ad_object.h
+++ b/engines/wintermute/ad/ad_object.h
@@ -61,7 +61,7 @@ public:
bool reset();
DECLARE_PERSISTENT(AdObject, BaseObject)
virtual void talk(const char *text, const char *sound = nullptr, uint32 duration = 0, const char *stances = nullptr, TTextAlign align = TAL_CENTER);
- virtual int getHeight() override;
+ virtual int32 getHeight() override;
bool setFont(const char *filename);
virtual bool update() override;
diff --git a/engines/wintermute/ad/ad_path.cpp b/engines/wintermute/ad/ad_path.cpp
index 91a24cbf7d..bdb7eba495 100644
--- a/engines/wintermute/ad/ad_path.cpp
+++ b/engines/wintermute/ad/ad_path.cpp
@@ -112,7 +112,7 @@ bool AdPath::persist(BasePersistenceManager *persistMgr) {
persistMgr->transfer(TMEMBER(_currIndex));
_points.persist(persistMgr);
- persistMgr->transfer(TMEMBER(_ready));
+ persistMgr->transferBool(TMEMBER(_ready));
return STATUS_OK;
}
diff --git a/engines/wintermute/ad/ad_path_point.cpp b/engines/wintermute/ad/ad_path_point.cpp
index d5108ad8c1..3e99d12f5d 100644
--- a/engines/wintermute/ad/ad_path_point.cpp
+++ b/engines/wintermute/ad/ad_path_point.cpp
@@ -66,7 +66,7 @@ bool AdPathPoint::persist(BasePersistenceManager *persistMgr) {
BasePoint::persist(persistMgr);
persistMgr->transfer(TMEMBER(_distance));
- persistMgr->transfer(TMEMBER(_marked));
+ persistMgr->transferBool(TMEMBER(_marked));
persistMgr->transferPtr(TMEMBER_PTR(_origin));
return STATUS_OK;
diff --git a/engines/wintermute/ad/ad_region.cpp b/engines/wintermute/ad/ad_region.cpp
index 1c0cf41e86..215ec495a1 100644
--- a/engines/wintermute/ad/ad_region.cpp
+++ b/engines/wintermute/ad/ad_region.cpp
@@ -402,8 +402,8 @@ bool AdRegion::persist(BasePersistenceManager *persistMgr) {
BaseRegion::persist(persistMgr);
persistMgr->transfer(TMEMBER(_alpha));
- persistMgr->transfer(TMEMBER(_blocked));
- persistMgr->transfer(TMEMBER(_decoration));
+ persistMgr->transferBool(TMEMBER(_blocked));
+ persistMgr->transferBool(TMEMBER(_decoration));
persistMgr->transferFloat(TMEMBER(_zoom));
return STATUS_OK;
diff --git a/engines/wintermute/ad/ad_response_box.cpp b/engines/wintermute/ad/ad_response_box.cpp
index 2a5adb9234..5c0efb547b 100644
--- a/engines/wintermute/ad/ad_response_box.cpp
+++ b/engines/wintermute/ad/ad_response_box.cpp
@@ -58,7 +58,7 @@ AdResponseBox::AdResponseBox(BaseGame *inGame) : BaseObject(inGame) {
_shieldWindow = new UIWindow(_gameRef);
_horizontal = false;
- BasePlatform::setRectEmpty(&_responseArea);
+ _responseArea.setEmpty();
_scrollOffset = 0;
_spacing = 0;
@@ -583,11 +583,11 @@ bool AdResponseBox::persist(BasePersistenceManager *persistMgr) {
persistMgr->transferPtr(TMEMBER_PTR(_font));
persistMgr->transferPtr(TMEMBER_PTR(_fontHover));
- persistMgr->transfer(TMEMBER(_horizontal));
+ persistMgr->transferBool(TMEMBER(_horizontal));
persistMgr->transfer(TMEMBER(_lastResponseText));
persistMgr->transfer(TMEMBER(_lastResponseTextOrig));
_respButtons.persist(persistMgr);
- persistMgr->transfer(TMEMBER(_responseArea));
+ persistMgr->transferRect32(TMEMBER(_responseArea));
_responses.persist(persistMgr);
persistMgr->transfer(TMEMBER(_scrollOffset));
persistMgr->transferPtr(TMEMBER_PTR(_shieldWindow));
diff --git a/engines/wintermute/ad/ad_scene.cpp b/engines/wintermute/ad/ad_scene.cpp
index bc8d9e96d2..296ef430a2 100644
--- a/engines/wintermute/ad/ad_scene.cpp
+++ b/engines/wintermute/ad/ad_scene.cpp
@@ -2300,7 +2300,7 @@ float AdScene::getScaleAt(int Y) {
bool AdScene::persist(BasePersistenceManager *persistMgr) {
BaseObject::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_autoScroll));
+ persistMgr->transferBool(TMEMBER(_autoScroll));
persistMgr->transfer(TMEMBER(_editorColBlocked));
persistMgr->transfer(TMEMBER(_editorColBlockedSel));
persistMgr->transfer(TMEMBER(_editorColDecor));
@@ -2315,14 +2315,14 @@ bool AdScene::persist(BasePersistenceManager *persistMgr) {
persistMgr->transfer(TMEMBER(_editorColWaypointsSel));
persistMgr->transfer(TMEMBER(_editorMarginH));
persistMgr->transfer(TMEMBER(_editorMarginV));
- persistMgr->transfer(TMEMBER(_editorShowBlocked));
- persistMgr->transfer(TMEMBER(_editorShowDecor));
- persistMgr->transfer(TMEMBER(_editorShowEntities));
- persistMgr->transfer(TMEMBER(_editorShowRegions));
- persistMgr->transfer(TMEMBER(_editorShowScale));
+ persistMgr->transferBool(TMEMBER(_editorShowBlocked));
+ persistMgr->transferBool(TMEMBER(_editorShowDecor));
+ persistMgr->transferBool(TMEMBER(_editorShowEntities));
+ persistMgr->transferBool(TMEMBER(_editorShowRegions));
+ persistMgr->transferBool(TMEMBER(_editorShowScale));
persistMgr->transferPtr(TMEMBER_PTR(_fader));
persistMgr->transfer(TMEMBER(_height));
- persistMgr->transfer(TMEMBER(_initialized));
+ persistMgr->transferBool(TMEMBER(_initialized));
persistMgr->transfer(TMEMBER(_lastTimeH));
persistMgr->transfer(TMEMBER(_lastTimeV));
_layers.persist(persistMgr);
@@ -2330,13 +2330,13 @@ bool AdScene::persist(BasePersistenceManager *persistMgr) {
_objects.persist(persistMgr);
persistMgr->transfer(TMEMBER(_offsetLeft));
persistMgr->transfer(TMEMBER(_offsetTop));
- persistMgr->transfer(TMEMBER(_paralaxScrolling));
- persistMgr->transfer(TMEMBER(_persistentState));
- persistMgr->transfer(TMEMBER(_persistentStateSprites));
+ persistMgr->transferBool(TMEMBER(_paralaxScrolling));
+ persistMgr->transferBool(TMEMBER(_persistentState));
+ persistMgr->transferBool(TMEMBER(_persistentStateSprites));
persistMgr->transfer(TMEMBER(_pfMaxTime));
_pfPath.persist(persistMgr);
persistMgr->transfer(TMEMBER(_pfPointsNum));
- persistMgr->transfer(TMEMBER(_pfReady));
+ persistMgr->transferBool(TMEMBER(_pfReady));
persistMgr->transferPtr(TMEMBER_PTR(_pfRequester));
persistMgr->transferPtr(TMEMBER_PTR(_pfTarget));
persistMgr->transferPtr(TMEMBER_PTR(_pfTargetPath));
diff --git a/engines/wintermute/ad/ad_sentence.cpp b/engines/wintermute/ad/ad_sentence.cpp
index d5baa8291f..773181b373 100644
--- a/engines/wintermute/ad/ad_sentence.cpp
+++ b/engines/wintermute/ad/ad_sentence.cpp
@@ -255,17 +255,17 @@ bool AdSentence::persist(BasePersistenceManager *persistMgr) {
persistMgr->transfer(TMEMBER(_currentSkelAnim));
persistMgr->transfer(TMEMBER(_duration));
persistMgr->transferPtr(TMEMBER_PTR(_font));
- persistMgr->transfer(TMEMBER(_pos));
+ persistMgr->transferPoint32(TMEMBER(_pos));
persistMgr->transferPtr(TMEMBER_PTR(_sound));
- persistMgr->transfer(TMEMBER(_soundStarted));
+ persistMgr->transferBool(TMEMBER(_soundStarted));
persistMgr->transfer(TMEMBER(_stances));
persistMgr->transfer(TMEMBER(_startTime));
persistMgr->transferPtr(TMEMBER_PTR(_talkDef));
persistMgr->transfer(TMEMBER(_tempStance));
persistMgr->transfer(TMEMBER(_text));
persistMgr->transfer(TMEMBER(_width));
- persistMgr->transfer(TMEMBER(_fixedPos));
- persistMgr->transfer(TMEMBER(_freezable));
+ persistMgr->transferBool(TMEMBER(_fixedPos));
+ persistMgr->transferBool(TMEMBER(_freezable));
return STATUS_OK;
}
diff --git a/engines/wintermute/ad/ad_talk_node.cpp b/engines/wintermute/ad/ad_talk_node.cpp
index eca4535288..b9be62e581 100644
--- a/engines/wintermute/ad/ad_talk_node.cpp
+++ b/engines/wintermute/ad/ad_talk_node.cpp
@@ -194,7 +194,7 @@ bool AdTalkNode::persist(BasePersistenceManager *persistMgr) {
persistMgr->transfer(TMEMBER(_comment));
persistMgr->transfer(TMEMBER(_startTime));
persistMgr->transfer(TMEMBER(_endTime));
- persistMgr->transfer(TMEMBER(_playToEnd));
+ persistMgr->transferBool(TMEMBER(_playToEnd));
persistMgr->transferPtr(TMEMBER_PTR(_sprite));
persistMgr->transfer(TMEMBER(_spriteFilename));
persistMgr->transferPtr(TMEMBER_PTR(_spriteSet));
diff --git a/engines/wintermute/ad/ad_waypoint_group.cpp b/engines/wintermute/ad/ad_waypoint_group.cpp
index f7735a4d9b..a8d474bf35 100644
--- a/engines/wintermute/ad/ad_waypoint_group.cpp
+++ b/engines/wintermute/ad/ad_waypoint_group.cpp
@@ -194,7 +194,7 @@ bool AdWaypointGroup::persist(BasePersistenceManager *persistMgr) {
BaseObject::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_active));
+ persistMgr->transferBool(TMEMBER(_active));
persistMgr->transfer(TMEMBER(_editorSelectedPoint));
persistMgr->transferFloat(TMEMBER(_lastMimicScale));
persistMgr->transfer(TMEMBER(_lastMimicX));
diff --git a/engines/wintermute/base/base.cpp b/engines/wintermute/base/base.cpp
index 91ca30db70..6a0666b36e 100644
--- a/engines/wintermute/base/base.cpp
+++ b/engines/wintermute/base/base.cpp
@@ -60,7 +60,7 @@ Common::String BaseClass::getEditorProp(const Common::String &propName, const Co
if (_editorPropsIter != _editorProps.end()) {
return _editorPropsIter->_value.c_str();
} else {
- return initVal;
+ return initVal; // Used to be NULL
}
}
diff --git a/engines/wintermute/base/base.h b/engines/wintermute/base/base.h
index f4b0976019..8767cc9bdd 100644
--- a/engines/wintermute/base/base.h
+++ b/engines/wintermute/base/base.h
@@ -44,7 +44,7 @@ class BaseClass {
public:
bool _persistable;
bool setEditorProp(const Common::String &propName, const Common::String &propValue);
- Common::String getEditorProp(const Common::String &propName, const Common::String &initVal = nullptr);
+ Common::String getEditorProp(const Common::String &propName, const Common::String &initVal = Common::String());
BaseClass(TDynamicConstructor, TDynamicConstructor) {}
bool parseEditorProperty(char *buffer, bool complete = true);
virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent = 0);
diff --git a/engines/wintermute/base/base_active_rect.cpp b/engines/wintermute/base/base_active_rect.cpp
index abeaa18d54..69cc7b02b6 100644
--- a/engines/wintermute/base/base_active_rect.cpp
+++ b/engines/wintermute/base/base_active_rect.cpp
@@ -37,7 +37,7 @@ namespace Wintermute {
//////////////////////////////////////////////////////////////////////
BaseActiveRect::BaseActiveRect(BaseGame *inGame) : BaseClass(inGame) {
- BasePlatform::setRectEmpty(&_rect);
+ _rect.setEmpty();
_owner = nullptr;
_frame = nullptr;
_region = nullptr;
@@ -52,7 +52,7 @@ BaseActiveRect::BaseActiveRect(BaseGame *inGame) : BaseClass(inGame) {
BaseActiveRect::BaseActiveRect(BaseGame *inGame, BaseObject *owner, BaseSubFrame *frame, int x, int y, int width, int height, float zoomX, float zoomY, bool precise) : BaseClass(inGame) {
_owner = owner;
_frame = frame;
- BasePlatform::setRect(&_rect, x, y, x + width, y + height);
+ _rect.setRect(x, y, x + width, y + height);
_zoomX = zoomX;
_zoomY = zoomY;
_precise = precise;
diff --git a/engines/wintermute/base/base_fader.cpp b/engines/wintermute/base/base_fader.cpp
index 7978230964..b5590abb08 100644
--- a/engines/wintermute/base/base_fader.cpp
+++ b/engines/wintermute/base/base_fader.cpp
@@ -175,16 +175,16 @@ uint32 BaseFader::getCurrentColor() const {
bool BaseFader::persist(BasePersistenceManager *persistMgr) {
BaseObject::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_active));
- persistMgr->transfer(TMEMBER(_blue));
- persistMgr->transfer(TMEMBER(_currentAlpha));
+ persistMgr->transferBool(TMEMBER(_active));
+ persistMgr->transferByte(TMEMBER(_blue));
+ persistMgr->transferByte(TMEMBER(_currentAlpha));
persistMgr->transfer(TMEMBER(_duration));
- persistMgr->transfer(TMEMBER(_green));
- persistMgr->transfer(TMEMBER(_red));
- persistMgr->transfer(TMEMBER(_sourceAlpha));
+ persistMgr->transferByte(TMEMBER(_green));
+ persistMgr->transferByte(TMEMBER(_red));
+ persistMgr->transferByte(TMEMBER(_sourceAlpha));
persistMgr->transfer(TMEMBER(_startTime));
- persistMgr->transfer(TMEMBER(_targetAlpha));
- persistMgr->transfer(TMEMBER(_system));
+ persistMgr->transferByte(TMEMBER(_targetAlpha));
+ persistMgr->transferBool(TMEMBER(_system));
if (_system && !persistMgr->getIsSaving()) {
_startTime = 0;
diff --git a/engines/wintermute/base/base_frame.cpp b/engines/wintermute/base/base_frame.cpp
index 1af8be02dd..2e371223c8 100644
--- a/engines/wintermute/base/base_frame.cpp
+++ b/engines/wintermute/base/base_frame.cpp
@@ -181,7 +181,7 @@ bool BaseFrame::loadBuffer(char *buffer, int lifeTime, bool keepLoaded) {
bool decoration = false;
bool mirrorX = false;
bool mirrorY = false;
- BasePlatform::setRectEmpty(&rect);
+ rect.setEmpty();
char *surface_file = nullptr;
while ((cmd = parser.getCommand(&buffer, commands, &params)) > 0) {
@@ -325,7 +325,7 @@ bool BaseFrame::loadBuffer(char *buffer, int lifeTime, bool keepLoaded) {
}
}
- if (BasePlatform::isRectEmpty(&rect)) {
+ if (rect.isRectEmpty()) {
sub->setDefaultRect();
} else {
sub->setRect(rect);
@@ -352,7 +352,7 @@ bool BaseFrame::getBoundingRect(Rect32 *rect, int x, int y, float scaleX, float
if (!rect) {
return false;
}
- BasePlatform::setRectEmpty(rect);
+ rect->setEmpty();
Rect32 subRect;
@@ -415,9 +415,9 @@ bool BaseFrame::persist(BasePersistenceManager *persistMgr) {
_applyEvent.persist(persistMgr);
persistMgr->transfer(TMEMBER(_delay));
- persistMgr->transfer(TMEMBER(_editorExpanded));
- persistMgr->transfer(TMEMBER(_keyframe));
- persistMgr->transfer(TMEMBER(_killSound));
+ persistMgr->transferBool(TMEMBER(_editorExpanded));
+ persistMgr->transferBool(TMEMBER(_keyframe));
+ persistMgr->transferBool(TMEMBER(_killSound));
persistMgr->transfer(TMEMBER(_moveX));
persistMgr->transfer(TMEMBER(_moveY));
persistMgr->transferPtr(TMEMBER_PTR(_sound));
diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp
index 0d8af0ce8a..033f019712 100644
--- a/engines/wintermute/base/base_game.cpp
+++ b/engines/wintermute/base/base_game.cpp
@@ -185,7 +185,7 @@ BaseGame::BaseGame(const Common::String &targetName) : BaseObject(this), _target
_lastCursor = nullptr;
- BasePlatform::setRectEmpty(&_mouseLockRect);
+ _mouseLockRect.setEmpty();
_suppressScriptErrors = false;
_lastMiniUpdate = 0;
@@ -1123,7 +1123,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
BaseUtils::swap(&top, &bottom);
}
- BasePlatform::setRect(&_mouseLockRect, left, top, right, bottom);
+ _mouseLockRect.setRect(left, top, right, bottom);
stack->pushNULL();
return STATUS_OK;
@@ -3054,12 +3054,12 @@ bool BaseGame::persist(BasePersistenceManager *persistMgr) {
persistMgr->transferPtr(TMEMBER_PTR(_activeObject));
persistMgr->transferPtr(TMEMBER_PTR(_capturedObject));
persistMgr->transferPtr(TMEMBER_PTR(_cursorNoninteractive));
- persistMgr->transfer(TMEMBER(_editorMode));
+ persistMgr->transferBool(TMEMBER(_editorMode));
persistMgr->transferPtr(TMEMBER_PTR(_fader));
persistMgr->transfer(TMEMBER(_freezeLevel));
persistMgr->transferPtr(TMEMBER_PTR(_focusedWindow));
persistMgr->transferPtr(TMEMBER_PTR(_fontStorage));
- persistMgr->transfer(TMEMBER(_interactive));
+ persistMgr->transferBool(TMEMBER(_interactive));
persistMgr->transferPtr(TMEMBER_PTR(_keyboardState));
persistMgr->transfer(TMEMBER(_lastTime));
persistMgr->transferPtr(TMEMBER_PTR(_mainObject));
@@ -3071,10 +3071,10 @@ bool BaseGame::persist(BasePersistenceManager *persistMgr) {
persistMgr->transferFloat(TMEMBER(_offsetPercentX));
persistMgr->transferFloat(TMEMBER(_offsetPercentY));
- persistMgr->transfer(TMEMBER(_origInteractive));
+ persistMgr->transferBool(TMEMBER(_origInteractive));
persistMgr->transfer(TMEMBER_INT(_origState));
- persistMgr->transfer(TMEMBER(_personalizedSave));
- persistMgr->transfer(TMEMBER(_quitting));
+ persistMgr->transferBool(TMEMBER(_personalizedSave));
+ persistMgr->transferBool(TMEMBER(_quitting));
_regObjects.persist(persistMgr);
@@ -3082,11 +3082,11 @@ bool BaseGame::persist(BasePersistenceManager *persistMgr) {
//persistMgr->transfer(TMEMBER(_soundMgr));
persistMgr->transfer(TMEMBER_INT(_state));
//persistMgr->transfer(TMEMBER(_surfaceStorage));
- persistMgr->transfer(TMEMBER(_subtitles));
+ persistMgr->transferBool(TMEMBER(_subtitles));
persistMgr->transfer(TMEMBER(_subtitlesSpeed));
persistMgr->transferPtr(TMEMBER_PTR(_systemFont));
persistMgr->transferPtr(TMEMBER_PTR(_videoFont));
- persistMgr->transfer(TMEMBER(_videoSubtitles));
+ persistMgr->transferBool(TMEMBER(_videoSubtitles));
_timerNormal.persist(persistMgr);
_timerLive.persist(persistMgr);
@@ -3094,21 +3094,21 @@ bool BaseGame::persist(BasePersistenceManager *persistMgr) {
_renderer->persistSaveLoadImages(persistMgr);
persistMgr->transfer(TMEMBER_INT(_textEncoding));
- persistMgr->transfer(TMEMBER(_textRTL));
+ persistMgr->transferBool(TMEMBER(_textRTL));
persistMgr->transfer(TMEMBER(_soundBufferSizeSec));
- persistMgr->transfer(TMEMBER(_suspendedRendering));
+ persistMgr->transferBool(TMEMBER(_suspendedRendering));
- persistMgr->transfer(TMEMBER(_mouseLockRect));
+ persistMgr->transferRect32(TMEMBER(_mouseLockRect));
_windows.persist(persistMgr);
- persistMgr->transfer(TMEMBER(_suppressScriptErrors));
- persistMgr->transfer(TMEMBER(_autorunDisabled));
+ persistMgr->transferBool(TMEMBER(_suppressScriptErrors));
+ persistMgr->transferBool(TMEMBER(_autorunDisabled));
- persistMgr->transfer(TMEMBER(_autoSaveOnExit));
+ persistMgr->transferBool(TMEMBER(_autoSaveOnExit));
persistMgr->transfer(TMEMBER(_autoSaveSlot));
- persistMgr->transfer(TMEMBER(_cursorHidden));
+ persistMgr->transferBool(TMEMBER(_cursorHidden));
if (!persistMgr->getIsSaving()) {
_quitting = false;
@@ -3361,10 +3361,10 @@ bool BaseGame::getCurrentViewportRect(Rect32 *rect, bool *custom) const {
*custom = true;
}
} else {
- BasePlatform::setRect(rect, _renderer->_drawOffsetX,
- _renderer->_drawOffsetY,
- _renderer->getWidth() + _renderer->_drawOffsetX,
- _renderer->getHeight() + _renderer->_drawOffsetY);
+ rect->setRect(_renderer->_drawOffsetX,
+ _renderer->_drawOffsetY,
+ _renderer->getWidth() + _renderer->_drawOffsetX,
+ _renderer->getHeight() + _renderer->_drawOffsetY);
if (custom) {
*custom = false;
}
@@ -3577,7 +3577,6 @@ bool BaseGame::onMouseLeftDown() {
_capturedObject = _activeObject;
}
_mouseLeftDown = true;
- BasePlatform::setCapture(/*_renderer->_window*/);
return STATUS_OK;
}
@@ -3588,7 +3587,6 @@ bool BaseGame::onMouseLeftUp() {
_activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_LEFT);
}
- BasePlatform::releaseCapture();
_capturedObject = nullptr;
_mouseLeftDown = false;
diff --git a/engines/wintermute/base/base_game_music.cpp b/engines/wintermute/base/base_game_music.cpp
index c50969df76..9462757a8a 100644
--- a/engines/wintermute/base/base_game_music.cpp
+++ b/engines/wintermute/base/base_game_music.cpp
@@ -221,12 +221,12 @@ bool BaseGameMusic::persistChannels(BasePersistenceManager *persistMgr) {
}
bool BaseGameMusic::persistCrossfadeSettings(BasePersistenceManager *persistMgr) {
- persistMgr->transfer(TMEMBER(_musicCrossfadeRunning));
+ persistMgr->transferBool(TMEMBER(_musicCrossfadeRunning));
persistMgr->transfer(TMEMBER(_musicCrossfadeStartTime));
persistMgr->transfer(TMEMBER(_musicCrossfadeLength));
persistMgr->transfer(TMEMBER(_musicCrossfadeChannel1));
persistMgr->transfer(TMEMBER(_musicCrossfadeChannel2));
- persistMgr->transfer(TMEMBER(_musicCrossfadeSwap));
+ persistMgr->transferBool(TMEMBER(_musicCrossfadeSwap));
return true;
}
diff --git a/engines/wintermute/base/base_keyboard_state.cpp b/engines/wintermute/base/base_keyboard_state.cpp
index aeb56ad282..014802d715 100644
--- a/engines/wintermute/base/base_keyboard_state.cpp
+++ b/engines/wintermute/base/base_keyboard_state.cpp
@@ -221,12 +221,12 @@ bool BaseKeyboardState::persist(BasePersistenceManager *persistMgr) {
//if (!persistMgr->getIsSaving()) cleanup();
BaseScriptable::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_currentAlt));
+ persistMgr->transferBool(TMEMBER(_currentAlt));
persistMgr->transfer(TMEMBER(_currentCharCode));
- persistMgr->transfer(TMEMBER(_currentControl));
+ persistMgr->transferBool(TMEMBER(_currentControl));
persistMgr->transfer(TMEMBER(_currentKeyData));
- persistMgr->transfer(TMEMBER(_currentPrintable));
- persistMgr->transfer(TMEMBER(_currentShift));
+ persistMgr->transferBool(TMEMBER(_currentPrintable));
+ persistMgr->transferBool(TMEMBER(_currentShift));
if (!persistMgr->getIsSaving()) {
_keyStates = new uint8[323]; // Hardcoded size for the common/keyboard.h enum
diff --git a/engines/wintermute/base/base_object.cpp b/engines/wintermute/base/base_object.cpp
index ea754f8f23..14e15b7161 100644
--- a/engines/wintermute/base/base_object.cpp
+++ b/engines/wintermute/base/base_object.cpp
@@ -63,7 +63,7 @@ BaseObject::BaseObject(BaseGame *inGame) : BaseScriptHolder(inGame) {
_iD = _gameRef->getSequence();
- BasePlatform::setRectEmpty(&_rect);
+ _rect.setEmpty();
_rectSet = false;
_cursor = nullptr;
@@ -957,40 +957,40 @@ bool BaseObject::persist(BasePersistenceManager *persistMgr) {
}
persistMgr->transferPtr(TMEMBER_PTR(_activeCursor));
persistMgr->transfer(TMEMBER(_alphaColor));
- persistMgr->transfer(TMEMBER(_autoSoundPanning));
+ persistMgr->transferBool(TMEMBER(_autoSoundPanning));
persistMgr->transferPtr(TMEMBER_PTR(_cursor));
- persistMgr->transfer(TMEMBER(_sharedCursors));
- persistMgr->transfer(TMEMBER(_editorAlwaysRegister));
- persistMgr->transfer(TMEMBER(_editorOnly));
- persistMgr->transfer(TMEMBER(_editorSelected));
+ persistMgr->transferBool(TMEMBER(_sharedCursors));
+ persistMgr->transferBool(TMEMBER(_editorAlwaysRegister));
+ persistMgr->transferBool(TMEMBER(_editorOnly));
+ persistMgr->transferBool(TMEMBER(_editorSelected));
persistMgr->transfer(TMEMBER(_iD));
- persistMgr->transfer(TMEMBER(_is3D));
- persistMgr->transfer(TMEMBER(_movable));
+ persistMgr->transferBool(TMEMBER(_is3D));
+ persistMgr->transferBool(TMEMBER(_movable));
persistMgr->transfer(TMEMBER(_posX));
persistMgr->transfer(TMEMBER(_posY));
persistMgr->transferFloat(TMEMBER(_relativeScale));
- persistMgr->transfer(TMEMBER(_rotatable));
+ persistMgr->transferBool(TMEMBER(_rotatable));
persistMgr->transferFloat(TMEMBER(_scale));
persistMgr->transferPtr(TMEMBER_PTR(_sFX));
persistMgr->transfer(TMEMBER(_sFXStart));
persistMgr->transfer(TMEMBER(_sFXVolume));
- persistMgr->transfer(TMEMBER(_ready));
- persistMgr->transfer(TMEMBER(_rect));
- persistMgr->transfer(TMEMBER(_rectSet));
- persistMgr->transfer(TMEMBER(_registrable));
- persistMgr->transfer(TMEMBER(_shadowable));
+ persistMgr->transferBool(TMEMBER(_ready));
+ persistMgr->transferRect32(TMEMBER(_rect));
+ persistMgr->transferBool(TMEMBER(_rectSet));
+ persistMgr->transferBool(TMEMBER(_registrable));
+ persistMgr->transferBool(TMEMBER(_shadowable));
persistMgr->transfer(TMEMBER(_soundEvent));
- persistMgr->transfer(TMEMBER(_zoomable));
+ persistMgr->transferBool(TMEMBER(_zoomable));
persistMgr->transferFloat(TMEMBER(_scaleX));
persistMgr->transferFloat(TMEMBER(_scaleY));
persistMgr->transferFloat(TMEMBER(_rotate));
- persistMgr->transfer(TMEMBER(_rotateValid));
+ persistMgr->transferBool(TMEMBER(_rotateValid));
persistMgr->transferFloat(TMEMBER(_relativeRotate));
- persistMgr->transfer(TMEMBER(_saveState));
- persistMgr->transfer(TMEMBER(_nonIntMouseEvents));
+ persistMgr->transferBool(TMEMBER(_saveState));
+ persistMgr->transferBool(TMEMBER(_nonIntMouseEvents));
persistMgr->transfer(TMEMBER_INT(_sFXType));
persistMgr->transferFloat(TMEMBER(_sFXParam1));
@@ -1039,7 +1039,7 @@ bool BaseObject::setActiveCursor(const char *filename) {
//////////////////////////////////////////////////////////////////////////
-int BaseObject::getHeight() {
+int32 BaseObject::getHeight() {
return 0;
}
diff --git a/engines/wintermute/base/base_object.h b/engines/wintermute/base/base_object.h
index 42041c5e3c..a190b1bcb4 100644
--- a/engines/wintermute/base/base_object.h
+++ b/engines/wintermute/base/base_object.h
@@ -89,7 +89,7 @@ public:
virtual bool handleMouseWheel(int delta);
virtual bool handleMouse(TMouseEvent event, TMouseButton button);
virtual bool handleKeypress(Common::Event *event, bool printable = false);
- virtual int getHeight();
+ virtual int32 getHeight();
bool setCursor(const char *filename);
bool setActiveCursor(const char *filename);
bool cleanup();
diff --git a/engines/wintermute/base/base_parser.cpp b/engines/wintermute/base/base_parser.cpp
index 0b677b6cb2..ff9c6c81b0 100644
--- a/engines/wintermute/base/base_parser.cpp
+++ b/engines/wintermute/base/base_parser.cpp
@@ -250,10 +250,10 @@ Common::String BaseParser::getToken(char **buf) {
*t++ = 0;
} else if (*b == 0) {
*buf = b;
- return nullptr;
+ return Common::String();
} else {
// Error.
- return nullptr;
+ return Common::String();
}
*buf = b;
diff --git a/engines/wintermute/base/base_persistence_manager.cpp b/engines/wintermute/base/base_persistence_manager.cpp
index e5542d96b7..1caa0ad20b 100644
--- a/engines/wintermute/base/base_persistence_manager.cpp
+++ b/engines/wintermute/base/base_persistence_manager.cpp
@@ -587,7 +587,7 @@ double BasePersistenceManager::getDouble() {
//////////////////////////////////////////////////////////////////////////
// bool
-bool BasePersistenceManager::transfer(const char *name, bool *val) {
+bool BasePersistenceManager::transferBool(const char *name, bool *val) {
if (_saving) {
_saveStream->writeByte(*val);
if (_saveStream->err()) {
@@ -663,7 +663,7 @@ bool BasePersistenceManager::transferFloat(const char *name, float *val) {
//////////////////////////////////////////////////////////////////////////
// double
-bool BasePersistenceManager::transfer(const char *name, double *val) {
+bool BasePersistenceManager::transferDouble(const char *name, double *val) {
if (_saving) {
putDouble(*val);
if (_saveStream->err()) {
@@ -769,7 +769,7 @@ bool BasePersistenceManager::transfer(const char *name, AnsiStringArray &val) {
//////////////////////////////////////////////////////////////////////////
// BYTE
-bool BasePersistenceManager::transfer(const char *name, byte *val) {
+bool BasePersistenceManager::transferByte(const char *name, byte *val) {
if (_saving) {
_saveStream->writeByte(*val);
if (_saveStream->err()) {
@@ -788,7 +788,7 @@ bool BasePersistenceManager::transfer(const char *name, byte *val) {
//////////////////////////////////////////////////////////////////////////
// RECT
-bool BasePersistenceManager::transfer(const char *name, Rect32 *val) {
+bool BasePersistenceManager::transferRect32(const char *name, Rect32 *val) {
if (_saving) {
_saveStream->writeSint32LE(val->left);
_saveStream->writeSint32LE(val->top);
@@ -813,7 +813,7 @@ bool BasePersistenceManager::transfer(const char *name, Rect32 *val) {
//////////////////////////////////////////////////////////////////////////
// POINT
-bool BasePersistenceManager::transfer(const char *name, Point32 *val) {
+bool BasePersistenceManager::transferPoint32(const char *name, Point32 *val) {
if (_saving) {
_saveStream->writeSint32LE(val->x);
_saveStream->writeSint32LE(val->y);
@@ -834,7 +834,7 @@ bool BasePersistenceManager::transfer(const char *name, Point32 *val) {
//////////////////////////////////////////////////////////////////////////
// Vector2
-bool BasePersistenceManager::transfer(const char *name, Vector2 *val) {
+bool BasePersistenceManager::transferVector2(const char *name, Vector2 *val) {
if (_saving) {
putFloat(val->x);
putFloat(val->y);
diff --git a/engines/wintermute/base/base_persistence_manager.h b/engines/wintermute/base/base_persistence_manager.h
index 3c0587b362..03316d9d19 100644
--- a/engines/wintermute/base/base_persistence_manager.h
+++ b/engines/wintermute/base/base_persistence_manager.h
@@ -77,15 +77,15 @@ public:
bool transfer(const char *name, int32 *val);
bool transfer(const char *name, uint32 *val);
bool transferFloat(const char *name, float *val);
- bool transfer(const char *name, double *val);
- bool transfer(const char *name, bool *val);
- bool transfer(const char *name, byte *val);
- bool transfer(const char *name, Rect32 *val);
- bool transfer(const char *name, Point32 *val);
+ bool transferDouble(const char *name, double *val);
+ bool transferBool(const char *name, bool *val);
+ bool transferByte(const char *name, byte *val);
+ bool transferRect32(const char *name, Rect32 *val);
+ bool transferPoint32(const char *name, Point32 *val);
bool transfer(const char *name, const char **val);
bool transfer(const char *name, char **val);
bool transfer(const char *name, Common::String *val);
- bool transfer(const char *name, Vector2 *val);
+ bool transferVector2(const char *name, Vector2 *val);
bool transfer(const char *name, AnsiStringArray &Val);
BasePersistenceManager(const char *savePrefix = nullptr, bool deleteSingleton = false);
virtual ~BasePersistenceManager();
diff --git a/engines/wintermute/base/base_region.cpp b/engines/wintermute/base/base_region.cpp
index 581583c922..2953adc8a5 100644
--- a/engines/wintermute/base/base_region.cpp
+++ b/engines/wintermute/base/base_region.cpp
@@ -48,7 +48,7 @@ BaseRegion::BaseRegion(BaseGame *inGame) : BaseObject(inGame) {
_lastMimicScale = -1;
_lastMimicX = _lastMimicY = INT_MIN;
- BasePlatform::setRectEmpty(&_rect);
+ _rect.setEmpty();
}
@@ -65,7 +65,7 @@ void BaseRegion::cleanup() {
}
_points.clear();
- BasePlatform::setRectEmpty(&_rect);
+ _rect.setEmpty();
_editorSelectedPoint = -1;
}
@@ -430,7 +430,7 @@ bool BaseRegion::persist(BasePersistenceManager *persistMgr) {
BaseObject::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_active));
+ persistMgr->transferBool(TMEMBER(_active));
persistMgr->transfer(TMEMBER(_editorSelectedPoint));
persistMgr->transferFloat(TMEMBER(_lastMimicScale));
persistMgr->transfer(TMEMBER(_lastMimicX));
@@ -491,7 +491,7 @@ bool BaseRegion::ptInPolygon(int32 x, int32 y) {
//////////////////////////////////////////////////////////////////////////
bool BaseRegion::getBoundingRect(Rect32 *rect) {
if (_points.size() == 0) {
- BasePlatform::setRectEmpty(rect);
+ rect->setEmpty();
} else {
int32 minX = INT_MAX, minY = INT_MAX, maxX = INT_MIN, maxY = INT_MIN;
@@ -502,7 +502,7 @@ bool BaseRegion::getBoundingRect(Rect32 *rect) {
maxX = MAX(maxX, _points[i]->x);
maxY = MAX(maxY, _points[i]->y);
}
- BasePlatform::setRect(rect, minX, minY, maxX, maxY);
+ rect->setRect(minX, minY, maxX, maxY);
}
return STATUS_OK;
}
diff --git a/engines/wintermute/base/base_script_holder.cpp b/engines/wintermute/base/base_script_holder.cpp
index a670ebf1af..2e21b3e8aa 100644
--- a/engines/wintermute/base/base_script_holder.cpp
+++ b/engines/wintermute/base/base_script_holder.cpp
@@ -281,7 +281,7 @@ bool BaseScriptHolder::persist(BasePersistenceManager *persistMgr) {
BaseScriptable::persist(persistMgr);
persistMgr->transfer(TMEMBER(_filename));
- persistMgr->transfer(TMEMBER(_freezable));
+ persistMgr->transferBool(TMEMBER(_freezable));
if (persistMgr->getIsSaving()) {
const char *name = getName();
persistMgr->transfer(TMEMBER(name));
diff --git a/engines/wintermute/base/base_sprite.cpp b/engines/wintermute/base/base_sprite.cpp
index 383655e0af..df696f21a2 100644
--- a/engines/wintermute/base/base_sprite.cpp
+++ b/engines/wintermute/base/base_sprite.cpp
@@ -462,7 +462,7 @@ bool BaseSprite::getBoundingRect(Rect32 *rect, int x, int y, float scaleX, float
return false;
}
- BasePlatform::setRectEmpty(rect);
+ rect->setEmpty();
for (uint32 i = 0; i < _frames.size(); i++) {
Rect32 frame;
Rect32 temp;
@@ -520,29 +520,29 @@ bool BaseSprite::saveAsText(BaseDynamicBuffer *buffer, int indent) {
bool BaseSprite::persist(BasePersistenceManager *persistMgr) {
BaseScriptHolder::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_canBreak));
- persistMgr->transfer(TMEMBER(_changed));
- persistMgr->transfer(TMEMBER(_paused));
- persistMgr->transfer(TMEMBER(_continuous));
+ persistMgr->transferBool(TMEMBER(_canBreak));
+ persistMgr->transferBool(TMEMBER(_changed));
+ persistMgr->transferBool(TMEMBER(_paused));
+ persistMgr->transferBool(TMEMBER(_continuous));
persistMgr->transfer(TMEMBER(_currentFrame));
- persistMgr->transfer(TMEMBER(_editorAllFrames));
+ persistMgr->transferBool(TMEMBER(_editorAllFrames));
persistMgr->transfer(TMEMBER(_editorBgAlpha));
persistMgr->transfer(TMEMBER(_editorBgFile));
persistMgr->transfer(TMEMBER(_editorBgOffsetX));
persistMgr->transfer(TMEMBER(_editorBgOffsetY));
- persistMgr->transfer(TMEMBER(_editorMuted));
- persistMgr->transfer(TMEMBER(_finished));
+ persistMgr->transferBool(TMEMBER(_editorMuted));
+ persistMgr->transferBool(TMEMBER(_finished));
_frames.persist(persistMgr);
persistMgr->transfer(TMEMBER(_lastFrameTime));
- persistMgr->transfer(TMEMBER(_looping));
+ persistMgr->transferBool(TMEMBER(_looping));
persistMgr->transfer(TMEMBER(_moveX));
persistMgr->transfer(TMEMBER(_moveY));
persistMgr->transferPtr(TMEMBER_PTR(_owner));
- persistMgr->transfer(TMEMBER(_precise));
- persistMgr->transfer(TMEMBER(_streamed));
- persistMgr->transfer(TMEMBER(_streamedKeepLoaded));
+ persistMgr->transferBool(TMEMBER(_precise));
+ persistMgr->transferBool(TMEMBER(_streamed));
+ persistMgr->transferBool(TMEMBER(_streamedKeepLoaded));
return STATUS_OK;
diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp
index 1055987f6b..490a9945db 100644
--- a/engines/wintermute/base/base_sub_frame.cpp
+++ b/engines/wintermute/base/base_sub_frame.cpp
@@ -34,7 +34,6 @@
#include "engines/wintermute/base/base_surface_storage.h"
#include "engines/wintermute/base/base_game.h"
#include "engines/wintermute/base/base_engine.h"
-#include "engines/wintermute/platform_osystem.h"
#include "engines/wintermute/base/gfx/base_renderer.h"
#include "engines/wintermute/base/scriptables/script_value.h"
#include "engines/wintermute/base/scriptables/script_stack.h"
@@ -54,7 +53,7 @@ BaseSubFrame::BaseSubFrame(BaseGame *inGame) : BaseScriptable(inGame, true) {
_transparent = 0xFFFF00FF;
_wantsDefaultRect = false;
- BasePlatform::setRectEmpty(&_rect);
+ _rect.setEmpty();
_editorSelected = false;
@@ -121,7 +120,7 @@ bool BaseSubFrame::loadBuffer(char *buffer, int lifeTime, bool keepLoaded) {
int r = 255, g = 255, b = 255;
int ar = 255, ag = 255, ab = 255, alpha = 255;
bool custoTrans = false;
- BasePlatform::setRectEmpty(&rect);
+ rect.setEmpty();
char *surfaceFile = nullptr;
delete _surface;
@@ -208,7 +207,7 @@ bool BaseSubFrame::loadBuffer(char *buffer, int lifeTime, bool keepLoaded) {
return STATUS_FAILED;
}
*/
- if (BasePlatform::isRectEmpty(&rect)) {
+ if (rect.isRectEmpty()) {
setDefaultRect();
} else {
setRect(rect);
@@ -219,7 +218,7 @@ bool BaseSubFrame::loadBuffer(char *buffer, int lifeTime, bool keepLoaded) {
Rect32 BaseSubFrame::getRect() {
if (_wantsDefaultRect && _surface) {
- BasePlatform::setRect(&_rect, 0, 0, _surface->getWidth(), _surface->getHeight());
+ _rect.setRect(0, 0, _surface->getWidth(), _surface->getHeight());
_wantsDefaultRect = false;
}
return _rect;
@@ -294,11 +293,10 @@ bool BaseSubFrame::getBoundingRect(Rect32 *rect, int x, int y, float scaleX, flo
float ratioX = scaleX / 100.0f;
float ratioY = scaleY / 100.0f;
- BasePlatform::setRect(rect,
- (int)(x - _hotspotX * ratioX),
- (int)(y - _hotspotY * ratioY),
- (int)(x - _hotspotX * ratioX + (getRect().right - getRect().left) * ratioX),
- (int)(y - _hotspotY * ratioY + (getRect().bottom - getRect().top) * ratioY));
+ rect->setRect((int)(x - _hotspotX * ratioX),
+ (int)(y - _hotspotY * ratioY),
+ (int)(x - _hotspotX * ratioX + (getRect().right - getRect().left) * ratioX),
+ (int)(y - _hotspotY * ratioY + (getRect().bottom - getRect().top) * ratioY));
return true;
}
@@ -318,9 +316,9 @@ bool BaseSubFrame::saveAsText(BaseDynamicBuffer *buffer, int indent, bool comple
}
Rect32 rect;
- BasePlatform::setRectEmpty(&rect);
+ rect.setEmpty();
if (_surface) {
- BasePlatform::setRect(&rect, 0, 0, _surface->getWidth(), _surface->getHeight());
+ rect.setRect(0, 0, _surface->getWidth(), _surface->getHeight());
}
if (!(rect == getRect())) {
buffer->putTextIndent(indent + 2, "RECT { %d,%d,%d,%d }\n", getRect().left, getRect().top, getRect().right, getRect().bottom);
@@ -376,7 +374,7 @@ void BaseSubFrame::setDefaultRect() {
_wantsDefaultRect = true;
} else {
_wantsDefaultRect = false;
- BasePlatform::setRectEmpty(&_rect);
+ _rect.setEmpty();
}
}
@@ -386,26 +384,26 @@ bool BaseSubFrame::persist(BasePersistenceManager *persistMgr) {
BaseScriptable::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_2DOnly));
- persistMgr->transfer(TMEMBER(_3DOnly));
+ persistMgr->transferBool(TMEMBER(_2DOnly));
+ persistMgr->transferBool(TMEMBER(_3DOnly));
persistMgr->transfer(TMEMBER(_alpha));
- persistMgr->transfer(TMEMBER(_decoration));
- persistMgr->transfer(TMEMBER(_editorSelected));
+ persistMgr->transferBool(TMEMBER(_decoration));
+ persistMgr->transferBool(TMEMBER(_editorSelected));
persistMgr->transfer(TMEMBER(_hotspotX));
persistMgr->transfer(TMEMBER(_hotspotY));
- persistMgr->transfer(TMEMBER(_rect));
- persistMgr->transfer(TMEMBER(_wantsDefaultRect));
+ persistMgr->transferRect32(TMEMBER(_rect));
+ persistMgr->transferBool(TMEMBER(_wantsDefaultRect));
persistMgr->transfer(TMEMBER(_surfaceFilename));
- persistMgr->transfer(TMEMBER(_cKDefault));
- persistMgr->transfer(TMEMBER(_cKRed));
- persistMgr->transfer(TMEMBER(_cKGreen));
- persistMgr->transfer(TMEMBER(_cKBlue));
+ persistMgr->transferBool(TMEMBER(_cKDefault));
+ persistMgr->transferByte(TMEMBER(_cKRed));
+ persistMgr->transferByte(TMEMBER(_cKGreen));
+ persistMgr->transferByte(TMEMBER(_cKBlue));
persistMgr->transfer(TMEMBER(_lifeTime));
- persistMgr->transfer(TMEMBER(_keepLoaded));
- persistMgr->transfer(TMEMBER(_mirrorX));
- persistMgr->transfer(TMEMBER(_mirrorY));
+ persistMgr->transferBool(TMEMBER(_keepLoaded));
+ persistMgr->transferBool(TMEMBER(_mirrorX));
+ persistMgr->transferBool(TMEMBER(_mirrorY));
persistMgr->transfer(TMEMBER(_transparent));
return STATUS_OK;
diff --git a/engines/wintermute/base/base_viewport.cpp b/engines/wintermute/base/base_viewport.cpp
index 09ac80e9de..acc0ee7561 100644
--- a/engines/wintermute/base/base_viewport.cpp
+++ b/engines/wintermute/base/base_viewport.cpp
@@ -29,7 +29,6 @@
#include "engines/wintermute/base/base_viewport.h"
#include "engines/wintermute/base/base_engine.h"
#include "engines/wintermute/base/base_persistence_manager.h"
-#include "engines/wintermute/platform_osystem.h"
#include "engines/wintermute/base/gfx/base_renderer.h"
namespace Wintermute {
@@ -38,7 +37,7 @@ IMPLEMENT_PERSISTENT(BaseViewport, false)
//////////////////////////////////////////////////////////////////////////
BaseViewport::BaseViewport(BaseGame *inGame) : BaseClass(inGame) {
- BasePlatform::setRectEmpty(&_rect);
+ _rect.setEmpty();
_mainObject = nullptr;
_offsetX = _offsetY = 0;
}
@@ -58,7 +57,7 @@ bool BaseViewport::persist(BasePersistenceManager *persistMgr) {
persistMgr->transferPtr(TMEMBER_PTR(_mainObject));
persistMgr->transfer(TMEMBER(_offsetX));
persistMgr->transfer(TMEMBER(_offsetY));
- persistMgr->transfer(TMEMBER(_rect));
+ persistMgr->transferRect32(TMEMBER(_rect));
return STATUS_OK;
}
@@ -73,7 +72,7 @@ bool BaseViewport::setRect(int32 left, int32 top, int32 right, int32 bottom, boo
bottom = MIN(bottom, BaseEngine::instance().getRenderer()->getHeight());
}
- BasePlatform::setRect(&_rect, left, top, right, bottom);
+ _rect.setRect(left, top, right, bottom);
_offsetX = left;
_offsetY = top;
return STATUS_OK;
diff --git a/engines/wintermute/base/font/base_font_bitmap.cpp b/engines/wintermute/base/font/base_font_bitmap.cpp
index 23a633a5a8..dd54e5eb3f 100644
--- a/engines/wintermute/base/font/base_font_bitmap.cpp
+++ b/engines/wintermute/base/font/base_font_bitmap.cpp
@@ -37,7 +37,6 @@
#include "engines/wintermute/base/base_frame.h"
#include "engines/wintermute/base/base_sprite.h"
#include "engines/wintermute/base/base_file_manager.h"
-#include "engines/wintermute/platform_osystem.h"
namespace Wintermute {
@@ -253,7 +252,7 @@ void BaseFontBitmap::drawChar(byte c, int x, int y) {
tileWidth = _widths[c];
}
- BasePlatform::setRect(&rect, col * _tileWidth, row * _tileHeight, col * _tileWidth + tileWidth, (row + 1)*_tileHeight);
+ rect.setRect(col * _tileWidth, row * _tileHeight, col * _tileWidth + tileWidth, (row + 1) * _tileHeight);
bool handled = false;
if (_sprite) {
_sprite->getCurrentFrame();
@@ -511,8 +510,8 @@ bool BaseFontBitmap::persist(BasePersistenceManager *persistMgr) {
}
- persistMgr->transfer(TMEMBER(_fontextFix));
- persistMgr->transfer(TMEMBER(_wholeCell));
+ persistMgr->transferBool(TMEMBER(_fontextFix));
+ persistMgr->transferBool(TMEMBER(_wholeCell));
return STATUS_OK;
diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp
index bbc66902a1..13e88f5734 100644
--- a/engines/wintermute/base/font/base_font_truetype.cpp
+++ b/engines/wintermute/base/font/base_font_truetype.cpp
@@ -34,7 +34,6 @@
#include "engines/wintermute/base/base_game.h"
#include "engines/wintermute/base/base_file_manager.h"
#include "engines/wintermute/utils/utils.h"
-#include "engines/wintermute/platform_osystem.h"
#include "engines/wintermute/wintermute.h"
#include "graphics/fonts/ttf.h"
#include "graphics/fontman.h"
@@ -227,7 +226,7 @@ void BaseFontTT::drawText(const byte *text, int x, int y, int width, TTextAlign
// and paint it
if (surface) {
Rect32 rc;
- BasePlatform::setRect(&rc, 0, 0, surface->getWidth(), surface->getHeight());
+ rc.setRect(0, 0, surface->getWidth(), surface->getHeight());
for (uint32 i = 0; i < _layers.size(); i++) {
uint32 color = _layers[i]->_color;
uint32 origForceAlpha = renderer->_forceAlphaColor;
@@ -521,10 +520,10 @@ bool BaseFontTT::parseLayer(BaseTTFontLayer *layer, char *buffer) {
bool BaseFontTT::persist(BasePersistenceManager *persistMgr) {
BaseFont::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_isBold));
- persistMgr->transfer(TMEMBER(_isItalic));
- persistMgr->transfer(TMEMBER(_isUnderline));
- persistMgr->transfer(TMEMBER(_isStriked));
+ persistMgr->transferBool(TMEMBER(_isBold));
+ persistMgr->transferBool(TMEMBER(_isItalic));
+ persistMgr->transferBool(TMEMBER(_isUnderline));
+ persistMgr->transferBool(TMEMBER(_isStriked));
persistMgr->transfer(TMEMBER(_fontHeight));
persistMgr->transfer(TMEMBER(_fontFile));
diff --git a/engines/wintermute/base/gfx/base_renderer.cpp b/engines/wintermute/base/gfx/base_renderer.cpp
index 1f171209d7..818010e00e 100644
--- a/engines/wintermute/base/gfx/base_renderer.cpp
+++ b/engines/wintermute/base/gfx/base_renderer.cpp
@@ -65,7 +65,7 @@ BaseRenderer::BaseRenderer(BaseGame *inGame) : BaseClass(inGame) {
_loadImageX = _loadImageY = 0;
_width = _height = _bPP = 0;
- BasePlatform::setRectEmpty(&_monitorRect);
+ _monitorRect.setEmpty();
_realWidth = _realHeight = 0;
_drawOffsetX = _drawOffsetY = 0;
@@ -374,7 +374,7 @@ bool BaseRenderer::displayIndicator() {
}
if (_saveLoadImage && !_hasDrawnSaveLoadImage) {
Rect32 rc;
- BasePlatform::setRect(&rc, 0, 0, _saveLoadImage->getWidth(), _saveLoadImage->getHeight());
+ rc.setRect(0, 0, _saveLoadImage->getWidth(), _saveLoadImage->getHeight());
if (_loadInProgress) {
_saveLoadImage->displayTrans(_loadImageX, _loadImageY, rc);
} else {
diff --git a/engines/wintermute/base/particles/part_emitter.cpp b/engines/wintermute/base/particles/part_emitter.cpp
index aaffa0965a..c5c049a37c 100644
--- a/engines/wintermute/base/particles/part_emitter.cpp
+++ b/engines/wintermute/base/particles/part_emitter.cpp
@@ -38,7 +38,6 @@
#include "engines/wintermute/base/base_file_manager.h"
#include "engines/wintermute/base/gfx/base_renderer.h"
#include "engines/wintermute/utils/utils.h"
-#include "engines/wintermute/platform_osystem.h"
#include "common/str.h"
#include "common/math.h"
@@ -50,7 +49,7 @@ IMPLEMENT_PERSISTENT(PartEmitter, false)
PartEmitter::PartEmitter(BaseGame *inGame, BaseScriptHolder *owner) : BaseObject(inGame) {
_width = _height = 0;
- BasePlatform::setRectEmpty(&_border);
+ _border.setEmpty();
_borderThicknessLeft = _borderThicknessRight = _borderThicknessTop = _borderThicknessBottom = 0;
_angle1 = _angle2 = 0;
@@ -198,7 +197,7 @@ bool PartEmitter::initParticle(PartParticle *particle, uint32 currentTime, uint3
float angVelocity = BaseUtils::randomFloat(_angVelocity1, _angVelocity2);
float growthRate = BaseUtils::randomFloat(_growthRate1, _growthRate2);
- if (!BasePlatform::isRectEmpty(&_border)) {
+ if (!_border.isRectEmpty()) {
int thicknessLeft = (int)(_borderThicknessLeft - (float)_borderThicknessLeft * posZ / 100.0f);
int thicknessRight = (int)(_borderThicknessRight - (float)_borderThicknessRight * posZ / 100.0f);
int thicknessTop = (int)(_borderThicknessTop - (float)_borderThicknessTop * posZ / 100.0f);
@@ -386,7 +385,7 @@ bool PartEmitter::compareZ(const PartParticle *p1, const PartParticle *p2) {
//////////////////////////////////////////////////////////////////////////
bool PartEmitter::setBorder(int x, int y, int width, int height) {
- BasePlatform::setRect(&_border, x, y, x + width, y + height);
+ _border.setRect(x, y, x + width, y + height);
return STATUS_OK;
}
@@ -1165,25 +1164,25 @@ bool PartEmitter::persist(BasePersistenceManager *persistMgr) {
persistMgr->transferFloat(TMEMBER(_velocity1));
persistMgr->transferFloat(TMEMBER(_velocity2));
- persistMgr->transfer(TMEMBER(_velocityZBased));
+ persistMgr->transferBool(TMEMBER(_velocityZBased));
persistMgr->transferFloat(TMEMBER(_scale1));
persistMgr->transferFloat(TMEMBER(_scale2));
- persistMgr->transfer(TMEMBER(_scaleZBased));
+ persistMgr->transferBool(TMEMBER(_scaleZBased));
persistMgr->transfer(TMEMBER(_maxParticles));
persistMgr->transfer(TMEMBER(_lifeTime1));
persistMgr->transfer(TMEMBER(_lifeTime2));
- persistMgr->transfer(TMEMBER(_lifeTimeZBased));
+ persistMgr->transferBool(TMEMBER(_lifeTimeZBased));
persistMgr->transfer(TMEMBER(_genInterval));
persistMgr->transfer(TMEMBER(_genAmount));
- persistMgr->transfer(TMEMBER(_running));
+ persistMgr->transferBool(TMEMBER(_running));
persistMgr->transfer(TMEMBER(_overheadTime));
- persistMgr->transfer(TMEMBER(_border));
+ persistMgr->transferRect32(TMEMBER(_border));
persistMgr->transfer(TMEMBER(_borderThicknessLeft));
persistMgr->transfer(TMEMBER(_borderThicknessRight));
persistMgr->transfer(TMEMBER(_borderThicknessTop));
@@ -1194,7 +1193,7 @@ bool PartEmitter::persist(BasePersistenceManager *persistMgr) {
persistMgr->transfer(TMEMBER(_alpha1));
persistMgr->transfer(TMEMBER(_alpha2));
- persistMgr->transfer(TMEMBER(_alphaTimeBased));
+ persistMgr->transferBool(TMEMBER(_alphaTimeBased));
persistMgr->transferFloat(TMEMBER(_angVelocity1));
persistMgr->transferFloat(TMEMBER(_angVelocity2));
@@ -1204,9 +1203,9 @@ bool PartEmitter::persist(BasePersistenceManager *persistMgr) {
persistMgr->transferFloat(TMEMBER(_growthRate1));
persistMgr->transferFloat(TMEMBER(_growthRate2));
- persistMgr->transfer(TMEMBER(_exponentialGrowth));
+ persistMgr->transferBool(TMEMBER(_exponentialGrowth));
- persistMgr->transfer(TMEMBER(_useRegion));
+ persistMgr->transferBool(TMEMBER(_useRegion));
persistMgr->transfer(TMEMBER_INT(_maxBatches));
persistMgr->transfer(TMEMBER_INT(_batchesGenerated));
diff --git a/engines/wintermute/base/particles/part_force.cpp b/engines/wintermute/base/particles/part_force.cpp
index 122cdf1afe..e7583e554a 100644
--- a/engines/wintermute/base/particles/part_force.cpp
+++ b/engines/wintermute/base/particles/part_force.cpp
@@ -55,8 +55,8 @@ bool PartForce::persist(BasePersistenceManager *persistMgr) {
persistMgr->transfer(TMEMBER(name));
setName(name);
}
- persistMgr->transfer(TMEMBER(_pos));
- persistMgr->transfer(TMEMBER(_direction));
+ persistMgr->transferVector2(TMEMBER(_pos));
+ persistMgr->transferVector2(TMEMBER(_direction));
persistMgr->transfer(TMEMBER_INT(_type));
return STATUS_OK;
diff --git a/engines/wintermute/base/particles/part_particle.cpp b/engines/wintermute/base/particles/part_particle.cpp
index 86cacacb5c..c5bf0f8326 100644
--- a/engines/wintermute/base/particles/part_particle.cpp
+++ b/engines/wintermute/base/particles/part_particle.cpp
@@ -45,7 +45,7 @@ PartParticle::PartParticle(BaseGame *inGame) : BaseClass(inGame) {
_creationTime = 0;
_lifeTime = 0;
_isDead = true;
- BasePlatform::setRectEmpty(&_border);
+ _border.setEmpty();
_state = PARTICLE_NORMAL;
_fadeStart = 0;
@@ -125,7 +125,7 @@ bool PartParticle::update(PartEmitter *emitter, uint32 currentTime, uint32 timer
}
// particle hit the border
- if (!_isDead && !BasePlatform::isRectEmpty(&_border)) {
+ if (!_isDead && !_border.isRectEmpty()) {
Point32 p;
p.x = (int32)_pos.x;
p.y = (int32)_pos.y;
@@ -232,14 +232,14 @@ bool PartParticle::fadeOut(uint32 currentTime, int fadeTime) {
bool PartParticle::persist(BasePersistenceManager *persistMgr) {
persistMgr->transfer(TMEMBER(_alpha1));
persistMgr->transfer(TMEMBER(_alpha2));
- persistMgr->transfer(TMEMBER(_border));
- persistMgr->transfer(TMEMBER(_pos));
+ persistMgr->transferRect32(TMEMBER(_border));
+ persistMgr->transferVector2(TMEMBER(_pos));
persistMgr->transferFloat(TMEMBER(_posZ));
- persistMgr->transfer(TMEMBER(_velocity));
+ persistMgr->transferVector2(TMEMBER(_velocity));
persistMgr->transferFloat(TMEMBER(_scale));
persistMgr->transfer(TMEMBER(_creationTime));
persistMgr->transfer(TMEMBER(_lifeTime));
- persistMgr->transfer(TMEMBER(_isDead));
+ persistMgr->transferBool(TMEMBER(_isDead));
persistMgr->transfer(TMEMBER_INT(_state));
persistMgr->transfer(TMEMBER(_fadeStart));
persistMgr->transfer(TMEMBER(_fadeTime));
@@ -247,7 +247,7 @@ bool PartParticle::persist(BasePersistenceManager *persistMgr) {
persistMgr->transferFloat(TMEMBER(_angVelocity));
persistMgr->transferFloat(TMEMBER(_rotation));
persistMgr->transferFloat(TMEMBER(_growthRate));
- persistMgr->transfer(TMEMBER(_exponentialGrowth));
+ persistMgr->transferBool(TMEMBER(_exponentialGrowth));
persistMgr->transfer(TMEMBER(_fadeStartAlpha));
if (persistMgr->getIsSaving()) {
diff --git a/engines/wintermute/base/scriptables/script.cpp b/engines/wintermute/base/scriptables/script.cpp
index 5aeff78c50..49152eca00 100644
--- a/engines/wintermute/base/scriptables/script.cpp
+++ b/engines/wintermute/base/scriptables/script.cpp
@@ -1273,7 +1273,7 @@ bool ScScript::persist(BasePersistenceManager *persistMgr) {
persistMgr->transfer(TMEMBER(_currentLine));
persistMgr->transferPtr(TMEMBER_PTR(_engine));
persistMgr->transfer(TMEMBER(_filename));
- persistMgr->transfer(TMEMBER(_freezable));
+ persistMgr->transferBool(TMEMBER(_freezable));
persistMgr->transferPtr(TMEMBER_PTR(_globals));
persistMgr->transfer(TMEMBER(_iP));
persistMgr->transferPtr(TMEMBER_PTR(_scopeStack));
@@ -1283,18 +1283,18 @@ bool ScScript::persist(BasePersistenceManager *persistMgr) {
persistMgr->transfer(TMEMBER_INT(_origState));
persistMgr->transferPtr(TMEMBER_PTR(_owner));
persistMgr->transferPtr(TMEMBER_PTR(_reg1));
- persistMgr->transfer(TMEMBER(_thread));
+ persistMgr->transferBool(TMEMBER(_thread));
persistMgr->transfer(TMEMBER(_threadEvent));
persistMgr->transferPtr(TMEMBER_PTR(_thisStack));
persistMgr->transfer(TMEMBER(_timeSlice));
persistMgr->transferPtr(TMEMBER_PTR(_waitObject));
persistMgr->transferPtr(TMEMBER_PTR(_waitScript));
persistMgr->transfer(TMEMBER(_waitTime));
- persistMgr->transfer(TMEMBER(_waitFrozen));
+ persistMgr->transferBool(TMEMBER(_waitFrozen));
- persistMgr->transfer(TMEMBER(_methodThread));
- persistMgr->transfer(TMEMBER(_methodThread));
- persistMgr->transfer(TMEMBER(_unbreakable));
+ persistMgr->transferBool(TMEMBER(_methodThread));
+ persistMgr->transferBool(TMEMBER(_methodThread)); // TODO-SAVE: Deduplicate.
+ persistMgr->transferBool(TMEMBER(_unbreakable));
persistMgr->transferPtr(TMEMBER_PTR(_parentScript));
if (!persistMgr->getIsSaving()) {
diff --git a/engines/wintermute/base/scriptables/script_ext_file.cpp b/engines/wintermute/base/scriptables/script_ext_file.cpp
index 18f7b8213a..5e6f0570ad 100644
--- a/engines/wintermute/base/scriptables/script_ext_file.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_file.cpp
@@ -768,7 +768,7 @@ bool SXFile::persist(BasePersistenceManager *persistMgr) {
persistMgr->transfer(TMEMBER(_filename));
persistMgr->transfer(TMEMBER(_mode));
- persistMgr->transfer(TMEMBER(_textMode));
+ persistMgr->transferBool(TMEMBER(_textMode));
uint32 pos = 0;
if (persistMgr->getIsSaving()) {
diff --git a/engines/wintermute/base/scriptables/script_value.cpp b/engines/wintermute/base/scriptables/script_value.cpp
index 31ec457df1..5b275746c0 100644
--- a/engines/wintermute/base/scriptables/script_value.cpp
+++ b/engines/wintermute/base/scriptables/script_value.cpp
@@ -791,11 +791,11 @@ void ScValue::setValue(ScValue *val) {
bool ScValue::persist(BasePersistenceManager *persistMgr) {
persistMgr->transferPtr(TMEMBER_PTR(_gameRef));
- persistMgr->transfer(TMEMBER(_persistent));
- persistMgr->transfer(TMEMBER(_isConstVar));
+ persistMgr->transferBool(TMEMBER(_persistent));
+ persistMgr->transferBool(TMEMBER(_isConstVar));
persistMgr->transfer(TMEMBER_INT(_type));
- persistMgr->transfer(TMEMBER(_valBool));
- persistMgr->transfer(TMEMBER(_valFloat));
+ persistMgr->transferBool(TMEMBER(_valBool));
+ persistMgr->transferDouble(TMEMBER(_valFloat));
persistMgr->transfer(TMEMBER(_valInt));
persistMgr->transferPtr(TMEMBER_PTR(_valNative));
diff --git a/engines/wintermute/base/sound/base_sound.cpp b/engines/wintermute/base/sound/base_sound.cpp
index c1923b3ca8..c3f2ff0476 100644
--- a/engines/wintermute/base/sound/base_sound.cpp
+++ b/engines/wintermute/base/sound/base_sound.cpp
@@ -167,13 +167,13 @@ bool BaseSound::persist(BasePersistenceManager *persistMgr) {
persistMgr->transferPtr(TMEMBER_PTR(_gameRef));
persistMgr->transfer(TMEMBER(_soundFilename));
- persistMgr->transfer(TMEMBER(_soundLooping));
- persistMgr->transfer(TMEMBER(_soundPaused));
- persistMgr->transfer(TMEMBER(_soundFreezePaused));
- persistMgr->transfer(TMEMBER(_soundPlaying));
+ persistMgr->transferBool(TMEMBER(_soundLooping));
+ persistMgr->transferBool(TMEMBER(_soundPaused));
+ persistMgr->transferBool(TMEMBER(_soundFreezePaused));
+ persistMgr->transferBool(TMEMBER(_soundPlaying));
persistMgr->transfer(TMEMBER(_soundPosition));
persistMgr->transfer(TMEMBER(_soundPrivateVolume));
- persistMgr->transfer(TMEMBER(_soundStreamed));
+ persistMgr->transferBool(TMEMBER(_soundStreamed));
persistMgr->transfer(TMEMBER_INT(_soundType));
persistMgr->transfer(TMEMBER(_soundLoopStart));
diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp
index 43deb62db6..053acf29e9 100644
--- a/engines/wintermute/graphics/transparent_surface.cpp
+++ b/engines/wintermute/graphics/transparent_surface.cpp
@@ -76,7 +76,6 @@ public:
* @param *outa, *outr, *outg, *outb pointer to the output pixel.
* @param *outa, *outr, *outg, *outb pointer to the colormod components.
*/
-
void BlenderAdditive::blendPixel(byte ina, byte inr, byte ing, byte inb, byte *outa, byte *outr, byte *outg, byte *outb, byte *ca, byte *cr, byte *cg, byte *cb) {
if (*ca != 255) {
ina = (ina) * (*ca) >> 8;
@@ -108,7 +107,6 @@ void BlenderAdditive::blendPixel(byte ina, byte inr, byte ing, byte inb, byte *o
* @param *outa, *outr, *outg, *outb pointer to the output pixel.
* @param *outa, *outr, *outg, *outb pointer to the colormod components.
*/
-
void BlenderSubtractive::blendPixel(byte ina, byte inr, byte ing, byte inb, byte *outa, byte *outr, byte *outg, byte *outb, byte *ca, byte *cr, byte *cg, byte *cb) {
//if (*ca != 255) {
// ina = ina * (*ca) >> 8;
@@ -234,7 +232,6 @@ void BlenderNormal::blendPixel(byte ina, byte inr, byte ing, byte inb, byte *out
* @param ina, inr, ing, inb: the input pixel, split into its components.
* @param *outa, *outr, *outg, *outb pointer to the output pixel.
*/
-
void BlenderSubtractive::blendPixel(byte ina, byte inr, byte ing, byte inb, byte *outa, byte *outr, byte *outg, byte *outb) {
if (ina == 0) {
@@ -259,7 +256,6 @@ void BlenderSubtractive::blendPixel(byte ina, byte inr, byte ing, byte inb, byte
* @param ina, inr, ing, inb: the input pixel, split into its components.
* @param *outa, *outr, *outg, *outb pointer to the output pixel.
*/
-
void BlenderAdditive::blendPixel(byte ina, byte inr, byte ing, byte inb, byte *outa, byte *outr, byte *outg, byte *outb) {
if (ina == 0) {
@@ -297,10 +293,11 @@ TransparentSurface::TransparentSurface(const Surface &surf, bool copyData) : Sur
}
}
-void doBlitOpaqueFast(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep) {
/**
* Optimized version of doBlit to be used w/opaque blitting (no alpha).
*/
+void doBlitOpaqueFast(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep) {
+
byte *in;
byte *out;
@@ -320,7 +317,6 @@ void doBlitOpaqueFast(byte *ino, byte *outo, uint32 width, uint32 height, uint32
/**
* Optimized version of doBlit to be used w/binary blitting (blit or no-blit, no blending).
*/
-
void doBlitBinaryFast(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep) {
byte *in;
@@ -350,8 +346,8 @@ void doBlitBinaryFast(byte *ino, byte *outo, uint32 width, uint32 height, uint32
* What we have here is a template method that calls blendPixel() from a different
* class - the one we call it with - thus performing a different type of blending.
*
- * @param *ino a pointer to the input surface
- * @param *outo a pointer to the output surface
+ * @param ino a pointer to the input surface
+ * @param outo a pointer to the output surface
* @param width width of the input surface
* @param height height of the input surface
* @param pitch pitch of the output surface - that is, width in bytes of every row, usually bpp * width of the TARGET surface (the area we are blitting to might be smaller, do the math)
@@ -924,8 +920,4 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight)
}
-
-
-
-
} // End of namespace Wintermute
diff --git a/engines/wintermute/graphics/transparent_surface.h b/engines/wintermute/graphics/transparent_surface.h
index b887c05fa8..1f3827d1a9 100644
--- a/engines/wintermute/graphics/transparent_surface.h
+++ b/engines/wintermute/graphics/transparent_surface.h
@@ -99,32 +99,31 @@ struct TransparentSurface : public Graphics::Surface {
/**
@brief renders the surface to another surface
- @param pDest a pointer to the target image. In most cases this is the framebuffer.
- @param PosX the position on the X-axis in the target image in pixels where the image is supposed to be rendered.<br>
+ @param target a pointer to the target surface. In most cases this is the framebuffer.
+ @param posX the position on the X-axis in the target image in pixels where the image is supposed to be rendered.<br>
The default value is 0.
- @param PosY the position on the Y-axis in the target image in pixels where the image is supposed to be rendered.<br>
+ @param posY the position on the Y-axis in the target image in pixels where the image is supposed to be rendered.<br>
The default value is 0.
- @param Flipping how the the image should be flipped.<br>
+ @param flipping how the the image should be flipped.<br>
The default value is BS_Image::FLIP_NONE (no flipping)
- @param pSrcPartRect Pointer on Common::Rect which specifies the section to be rendered. If the whole image has to be rendered the Pointer is NULL.<br>
+ @param pPartRect Pointer on Common::Rect which specifies the section to be rendered. If the whole image has to be rendered the Pointer is NULL.<br>
This referes to the unflipped and unscaled image.<br>
The default value is NULL.
- @param Color an ARGB color value, which determines the parameters for the color modulation und alpha blending.<br>
+ @param color an ARGB color value, which determines the parameters for the color modulation und alpha blending.<br>
The alpha component of the color determines the alpha blending parameter (0 = no covering, 255 = full covering).<br>
The color components determines the color for color modulation.<br>
The default value is BS_ARGB(255, 255, 255, 255) (full covering, no color modulation).
The macros BS_RGB and BS_ARGB can be used for the creation of the color value.
- @param Width the output width of the screen section.
+ @param width the output width of the screen section.
The images will be scaled if the output width of the screen section differs from the image section.<br>
The value -1 determines that the image should not be scaled.<br>
The default value is -1.
- @param Width the output height of the screen section.
+ @param height the output height of the screen section.
The images will be scaled if the output width of the screen section differs from the image section.<br>
The value -1 determines that the image should not be scaled.<br>
The default value is -1.
@return returns false if the rendering failed.
*/
-
Common::Rect blit(Graphics::Surface &target, int posX = 0, int posY = 0,
int flipping = FLIP_NONE,
Common::Rect *pPartRect = nullptr,
@@ -137,8 +136,9 @@ struct TransparentSurface : public Graphics::Surface {
* @brief Scale function; this returns a transformed version of this surface after rotation and
* scaling. Please do not use this if angle != 0, use rotoscale.
*
- * @param transform a TransformStruct wrapping the required info. @see TransformStruct
- *
+ * @param newWidth the resulting width.
+ * @param newHeight the resulting height.
+ * @see TransformStruct
*/
TransparentSurface *scale(uint16 newWidth, uint16 newHeight) const;
diff --git a/engines/wintermute/math/rect32.h b/engines/wintermute/math/rect32.h
index f522ab3a35..a4a64690e2 100644
--- a/engines/wintermute/math/rect32.h
+++ b/engines/wintermute/math/rect32.h
@@ -94,12 +94,24 @@ struct Rect32 {
left = right = top = bottom = 0;
}
+ bool isRectEmpty() const {
+ return (left >= right) || (top >= bottom);
+ }
+
void offsetRect(int dx, int dy) {
left += dx;
top += dy;
right += dx;
bottom += dy;
}
+
+ void setRect(int32 newLeft, int32 newTop, int32 newRight, int32 newBottom) {
+ this->left = newLeft;
+ this->top = newTop;
+ this->right = newRight;
+ this->bottom = newBottom;
+ }
+
/**
* Check if the given rect is equal to this one.
*
diff --git a/engines/wintermute/platform_osystem.cpp b/engines/wintermute/platform_osystem.cpp
index 87a127d001..9fa23c6074 100644
--- a/engines/wintermute/platform_osystem.cpp
+++ b/engines/wintermute/platform_osystem.cpp
@@ -169,52 +169,16 @@ bool BasePlatform::setCursorPos(int x, int y) {
}
//////////////////////////////////////////////////////////////////////////
-bool BasePlatform::showWindow(int nCmdShow) {
- return false;
-}
-
-//////////////////////////////////////////////////////////////////////////
-void BasePlatform::setCapture() {
- return;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool BasePlatform::releaseCapture() {
- return false;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool BasePlatform::setRectEmpty(Rect32 *lprc) {
- lprc->left = lprc->right = lprc->top = lprc->bottom = 0;
- return true;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool BasePlatform::isRectEmpty(const Rect32 *lprc) {
- return (lprc->left >= lprc->right) || (lprc->top >= lprc->bottom);
-}
-
-//////////////////////////////////////////////////////////////////////////
bool BasePlatform::ptInRect(Rect32 *lprc, Point32 p) {
return (p.x >= lprc->left) && (p.x < lprc->right) && (p.y >= lprc->top) && (p.y < lprc->bottom);
}
//////////////////////////////////////////////////////////////////////////
-bool BasePlatform::setRect(Rect32 *lprc, int left, int top, int right, int bottom) {
- lprc->left = left;
- lprc->top = top;
- lprc->right = right;
- lprc->bottom = bottom;
-
- return true;
-}
-
-//////////////////////////////////////////////////////////////////////////
bool BasePlatform::intersectRect(Rect32 *lprcDst, const Rect32 *lprcSrc1, const Rect32 *lprcSrc2) {
- if (isRectEmpty(lprcSrc1) || isRectEmpty(lprcSrc2) ||
+ if (lprcSrc1->isRectEmpty() || lprcSrc2->isRectEmpty() ||
lprcSrc1->left >= lprcSrc2->right || lprcSrc2->left >= lprcSrc1->right ||
lprcSrc1->top >= lprcSrc2->bottom || lprcSrc2->top >= lprcSrc1->bottom) {
- setRectEmpty(lprcDst);
+ lprcDst->setEmpty();
return false;
}
lprcDst->left = MAX(lprcSrc1->left, lprcSrc2->left);
@@ -227,15 +191,15 @@ bool BasePlatform::intersectRect(Rect32 *lprcDst, const Rect32 *lprcSrc1, const
//////////////////////////////////////////////////////////////////////////
bool BasePlatform::unionRect(Rect32 *lprcDst, Rect32 *lprcSrc1, Rect32 *lprcSrc2) {
- if (isRectEmpty(lprcSrc1)) {
- if (isRectEmpty(lprcSrc2)) {
- setRectEmpty(lprcDst);
+ if (lprcSrc1->isRectEmpty()) {
+ if (lprcSrc2->isRectEmpty()) {
+ lprcDst->setEmpty();
return false;
} else {
*lprcDst = *lprcSrc2;
}
} else {
- if (isRectEmpty(lprcSrc2)) {
+ if (lprcSrc2->isRectEmpty()) {
*lprcDst = *lprcSrc1;
} else {
lprcDst->left = MIN(lprcSrc1->left, lprcSrc2->left);
diff --git a/engines/wintermute/platform_osystem.h b/engines/wintermute/platform_osystem.h
index 46c86df909..16d55745b9 100644
--- a/engines/wintermute/platform_osystem.h
+++ b/engines/wintermute/platform_osystem.h
@@ -48,13 +48,7 @@ public:
// Win32 API bindings
static bool getCursorPos(Point32 *lpPoint);
static bool setCursorPos(int x, int y);
- static bool showWindow(int nCmdShow);
- static void setCapture();
- static bool releaseCapture();
-
- static bool setRectEmpty(Rect32 *lprc);
- static bool isRectEmpty(const Rect32 *lprc);
static bool ptInRect(Rect32 *lprc, Point32 p);
static bool setRect(Rect32 *lprc, int left, int top, int right, int bottom);
static bool intersectRect(Rect32 *lprcDst, const Rect32 *lprcSrc1, const Rect32 *lprcSrc2);
diff --git a/engines/wintermute/ui/ui_button.cpp b/engines/wintermute/ui/ui_button.cpp
index 42a873a0b4..3cc33f2362 100644
--- a/engines/wintermute/ui/ui_button.cpp
+++ b/engines/wintermute/ui/ui_button.cpp
@@ -655,7 +655,7 @@ bool UIButton::display(int offsetX, int offsetY) {
BaseFont *font = 0;
//RECT rect;
- //BasePlatform::setRect(&rect, OffsetX + _posX, OffsetY + _posY, OffsetX+_posX+_width, OffsetY+_posY+_height);
+ //rect.setRect(OffsetX + _posX, OffsetY + _posY, OffsetX+_posX+_width, OffsetY+_posY+_height);
//_hover = (!_disable && BasePlatform::ptInRect(&rect, _gameRef->_mousePos)!=FALSE);
_hover = (!_disable && _gameRef->_activeObject == this && (_gameRef->_interactive || _gameRef->_state == GAME_SEMI_FROZEN));
@@ -1183,20 +1183,20 @@ bool UIButton::persist(BasePersistenceManager *persistMgr) {
persistMgr->transferPtr(TMEMBER_PTR(_backFocus));
persistMgr->transferPtr(TMEMBER_PTR(_backHover));
persistMgr->transferPtr(TMEMBER_PTR(_backPress));
- persistMgr->transfer(TMEMBER(_centerImage));
+ persistMgr->transferBool(TMEMBER(_centerImage));
persistMgr->transferPtr(TMEMBER_PTR(_fontDisable));
persistMgr->transferPtr(TMEMBER_PTR(_fontFocus));
persistMgr->transferPtr(TMEMBER_PTR(_fontHover));
persistMgr->transferPtr(TMEMBER_PTR(_fontPress));
- persistMgr->transfer(TMEMBER(_hover));
+ persistMgr->transferBool(TMEMBER(_hover));
persistMgr->transferPtr(TMEMBER_PTR(_image));
persistMgr->transferPtr(TMEMBER_PTR(_imageDisable));
persistMgr->transferPtr(TMEMBER_PTR(_imageFocus));
persistMgr->transferPtr(TMEMBER_PTR(_imageHover));
persistMgr->transferPtr(TMEMBER_PTR(_imagePress));
- persistMgr->transfer(TMEMBER(_pixelPerfect));
- persistMgr->transfer(TMEMBER(_press));
- persistMgr->transfer(TMEMBER(_stayPressed));
+ persistMgr->transferBool(TMEMBER(_pixelPerfect));
+ persistMgr->transferBool(TMEMBER(_press));
+ persistMgr->transferBool(TMEMBER(_stayPressed));
if (!persistMgr->getIsSaving()) {
_oneTimePress = false;
diff --git a/engines/wintermute/ui/ui_object.cpp b/engines/wintermute/ui/ui_object.cpp
index a8da89b011..a1a89b7b01 100644
--- a/engines/wintermute/ui/ui_object.cpp
+++ b/engines/wintermute/ui/ui_object.cpp
@@ -622,8 +622,8 @@ bool UIObject::persist(BasePersistenceManager *persistMgr) {
BaseObject::persist(persistMgr);
persistMgr->transferPtr(TMEMBER_PTR(_back));
- persistMgr->transfer(TMEMBER(_canFocus));
- persistMgr->transfer(TMEMBER(_disable));
+ persistMgr->transferBool(TMEMBER(_canFocus));
+ persistMgr->transferBool(TMEMBER(_disable));
persistMgr->transferPtr(TMEMBER_PTR(_focusedWidget));
persistMgr->transferPtr(TMEMBER_PTR(_font));
persistMgr->transfer(TMEMBER(_height));
@@ -632,12 +632,12 @@ bool UIObject::persist(BasePersistenceManager *persistMgr) {
persistMgr->transferPtr(TMEMBER_PTR(_listenerParamObject));
persistMgr->transfer(TMEMBER(_listenerParamDWORD));
persistMgr->transferPtr(TMEMBER_PTR(_parent));
- persistMgr->transfer(TMEMBER(_parentNotify));
- persistMgr->transfer(TMEMBER(_sharedFonts));
- persistMgr->transfer(TMEMBER(_sharedImages));
+ persistMgr->transferBool(TMEMBER(_parentNotify));
+ persistMgr->transferBool(TMEMBER(_sharedFonts));
+ persistMgr->transferBool(TMEMBER(_sharedImages));
persistMgr->transfer(TMEMBER(_text));
persistMgr->transfer(TMEMBER_INT(_type));
- persistMgr->transfer(TMEMBER(_visible));
+ persistMgr->transferBool(TMEMBER(_visible));
persistMgr->transfer(TMEMBER(_width));
return STATUS_OK;
@@ -652,7 +652,10 @@ int32 UIObject::getWidth() const {
return _width;
}
-int32 UIObject::getHeight() const {
+// Has to be non-const to allow the virtual override to work,
+// as other getHeight()-functions currently have the potential
+// of having side-effects.
+int32 UIObject::getHeight() {
return _height;
}
diff --git a/engines/wintermute/ui/ui_object.h b/engines/wintermute/ui/ui_object.h
index 8d14d8a6a4..ecbaebcee6 100644
--- a/engines/wintermute/ui/ui_object.h
+++ b/engines/wintermute/ui/ui_object.h
@@ -69,7 +69,7 @@ public:
TUIObjectType _type;
int32 getWidth() const;
- int32 getHeight() const;
+ int32 getHeight() override;
void setHeight(int32 height);
void setWidth(int32 width);
bool isDisabled() const;
diff --git a/engines/wintermute/ui/ui_tiled_image.cpp b/engines/wintermute/ui/ui_tiled_image.cpp
index e647e0d894..e895477a36 100644
--- a/engines/wintermute/ui/ui_tiled_image.cpp
+++ b/engines/wintermute/ui/ui_tiled_image.cpp
@@ -44,15 +44,15 @@ IMPLEMENT_PERSISTENT(UITiledImage, false)
UITiledImage::UITiledImage(BaseGame *inGame) : BaseObject(inGame) {
_image = nullptr;
- BasePlatform::setRectEmpty(&_upLeft);
- BasePlatform::setRectEmpty(&_upMiddle);
- BasePlatform::setRectEmpty(&_upRight);
- BasePlatform::setRectEmpty(&_middleLeft);
- BasePlatform::setRectEmpty(&_middleMiddle);
- BasePlatform::setRectEmpty(&_middleRight);
- BasePlatform::setRectEmpty(&_downLeft);
- BasePlatform::setRectEmpty(&_downMiddle);
- BasePlatform::setRectEmpty(&_downRight);
+ _upLeft.setEmpty();
+ _upMiddle.setEmpty();
+ _upRight.setEmpty();
+ _middleLeft.setEmpty();
+ _middleMiddle.setEmpty();
+ _middleRight.setEmpty();
+ _downLeft.setEmpty();
+ _downMiddle.setEmpty();
+ _downRight.setEmpty();
}
@@ -267,19 +267,19 @@ bool UITiledImage::loadBuffer(char *buffer, bool complete) {
if (vTiles && hTiles) {
// up row
- BasePlatform::setRect(&_upLeft, 0, 0, h1, v1);
- BasePlatform::setRect(&_upMiddle, h1, 0, h1 + h2, v1);
- BasePlatform::setRect(&_upRight, h1 + h2, 0, h1 + h2 + h3, v1);
+ _upLeft.setRect(0, 0, h1, v1);
+ _upMiddle.setRect(h1, 0, h1 + h2, v1);
+ _upRight.setRect(h1 + h2, 0, h1 + h2 + h3, v1);
// middle row
- BasePlatform::setRect(&_middleLeft, 0, v1, h1, v1 + v2);
- BasePlatform::setRect(&_middleMiddle, h1, v1, h1 + h2, v1 + v2);
- BasePlatform::setRect(&_middleRight, h1 + h2, v1, h1 + h2 + h3, v1 + v2);
+ _middleLeft.setRect(0, v1, h1, v1 + v2);
+ _middleMiddle.setRect(h1, v1, h1 + h2, v1 + v2);
+ _middleRight.setRect(h1 + h2, v1, h1 + h2 + h3, v1 + v2);
// down row
- BasePlatform::setRect(&_downLeft, 0, v1 + v2, h1, v1 + v2 + v3);
- BasePlatform::setRect(&_downMiddle, h1, v1 + v2, h1 + h2, v1 + v2 + v3);
- BasePlatform::setRect(&_downRight, h1 + h2, v1 + v2, h1 + h2 + h3, v1 + v2 + v3);
+ _downLeft.setRect(0, v1 + v2, h1, v1 + v2 + v3);
+ _downMiddle.setRect(h1, v1 + v2, h1 + h2, v1 + v2 + v3);
+ _downRight.setRect(h1 + h2, v1 + v2, h1 + h2 + h3, v1 + v2 + v3);
}
// default
@@ -287,34 +287,34 @@ bool UITiledImage::loadBuffer(char *buffer, bool complete) {
int width = _image->_surface->getWidth() / 3;
int height = _image->_surface->getHeight() / 3;
- if (BasePlatform::isRectEmpty(&_upLeft)) {
- BasePlatform::setRect(&_upLeft, 0, 0, width, height);
+ if (_upLeft.isRectEmpty()) {
+ _upLeft.setRect(0, 0, width, height);
}
- if (BasePlatform::isRectEmpty(&_upMiddle)) {
- BasePlatform::setRect(&_upMiddle, width, 0, 2 * width, height);
+ if (_upMiddle.isRectEmpty()) {
+ _upMiddle.setRect(width, 0, 2 * width, height);
}
- if (BasePlatform::isRectEmpty(&_upRight)) {
- BasePlatform::setRect(&_upRight, 2 * width, 0, 3 * width, height);
+ if (_upRight.isRectEmpty()) {
+ _upRight.setRect(2 * width, 0, 3 * width, height);
}
- if (BasePlatform::isRectEmpty(&_middleLeft)) {
- BasePlatform::setRect(&_middleLeft, 0, height, width, 2 * height);
+ if (_middleLeft.isRectEmpty()) {
+ _middleLeft.setRect(0, height, width, 2 * height);
}
- if (BasePlatform::isRectEmpty(&_middleMiddle)) {
- BasePlatform::setRect(&_middleMiddle, width, height, 2 * width, 2 * height);
+ if (_middleMiddle.isRectEmpty()) {
+ _middleMiddle.setRect(width, height, 2 * width, 2 * height);
}
- if (BasePlatform::isRectEmpty(&_middleRight)) {
- BasePlatform::setRect(&_middleRight, 2 * width, height, 3 * width, 2 * height);
+ if (_middleRight.isRectEmpty()) {
+ _middleRight.setRect(2 * width, height, 3 * width, 2 * height);
}
- if (BasePlatform::isRectEmpty(&_downLeft)) {
- BasePlatform::setRect(&_downLeft, 0, 2 * height, width, 3 * height);
+ if (_downLeft.isRectEmpty()) {
+ _downLeft.setRect(0, 2 * height, width, 3 * height);
}
- if (BasePlatform::isRectEmpty(&_downMiddle)) {
- BasePlatform::setRect(&_downMiddle, width, 2 * height, 2 * width, 3 * height);
+ if (_downMiddle.isRectEmpty()) {
+ _downMiddle.setRect(width, 2 * height, 2 * width, 3 * height);
}
- if (BasePlatform::isRectEmpty(&_downRight)) {
- BasePlatform::setRect(&_downRight, 2 * width, 2 * height, 3 * width, 3 * height);
+ if (_downRight.isRectEmpty()) {
+ _downRight.setRect(2 * width, 2 * height, 3 * width, 3 * height);
}
}
@@ -369,16 +369,16 @@ void UITiledImage::correctSize(int32 *width, int32 *height) {
bool UITiledImage::persist(BasePersistenceManager *persistMgr) {
BaseObject::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_downLeft));
- persistMgr->transfer(TMEMBER(_downMiddle));
- persistMgr->transfer(TMEMBER(_downRight));
+ persistMgr->transferRect32(TMEMBER(_downLeft));
+ persistMgr->transferRect32(TMEMBER(_downMiddle));
+ persistMgr->transferRect32(TMEMBER(_downRight));
persistMgr->transferPtr(TMEMBER_PTR(_image));
- persistMgr->transfer(TMEMBER(_middleLeft));
- persistMgr->transfer(TMEMBER(_middleMiddle));
- persistMgr->transfer(TMEMBER(_middleRight));
- persistMgr->transfer(TMEMBER(_upLeft));
- persistMgr->transfer(TMEMBER(_upMiddle));
- persistMgr->transfer(TMEMBER(_upRight));
+ persistMgr->transferRect32(TMEMBER(_middleLeft));
+ persistMgr->transferRect32(TMEMBER(_middleMiddle));
+ persistMgr->transferRect32(TMEMBER(_middleRight));
+ persistMgr->transferRect32(TMEMBER(_upLeft));
+ persistMgr->transferRect32(TMEMBER(_upMiddle));
+ persistMgr->transferRect32(TMEMBER(_upRight));
return STATUS_OK;
}
diff --git a/engines/wintermute/ui/ui_window.cpp b/engines/wintermute/ui/ui_window.cpp
index 9051ce8217..c9262198cf 100644
--- a/engines/wintermute/ui/ui_window.cpp
+++ b/engines/wintermute/ui/ui_window.cpp
@@ -54,8 +54,8 @@ IMPLEMENT_PERSISTENT(UIWindow, false)
//////////////////////////////////////////////////////////////////////////
UIWindow::UIWindow(BaseGame *inGame) : UIObject(inGame) {
- BasePlatform::setRectEmpty(&_titleRect);
- BasePlatform::setRectEmpty(&_dragRect);
+ _titleRect.setEmpty();
+ _dragRect.setEmpty();
_titleAlign = TAL_LEFT;
_transparent = false;
@@ -213,7 +213,7 @@ bool UIWindow::display(int offsetX, int offsetY) {
image->draw(_posX + offsetX, _posY + offsetY, _transparent ? nullptr : this);
}
- if (!BasePlatform::isRectEmpty(&_titleRect) && font && _text) {
+ if (!_titleRect.isRectEmpty() && font && _text) {
font->drawText((byte *)_text, _posX + offsetX + _titleRect.left, _posY + offsetY + _titleRect.top, _titleRect.right - _titleRect.left, _titleAlign, _titleRect.bottom - _titleRect.top);
}
@@ -676,11 +676,11 @@ bool UIWindow::saveAsText(BaseDynamicBuffer *buffer, int indent) {
error("UIWindow::SaveAsText - Unhandled enum-value NUM_TEXT_ALIGN");
}
- if (!BasePlatform::isRectEmpty(&_titleRect)) {
+ if (!_titleRect.isRectEmpty()) {
buffer->putTextIndent(indent + 2, "TITLE_RECT { %d, %d, %d, %d }\n", _titleRect.left, _titleRect.top, _titleRect.right, _titleRect.bottom);
}
- if (!BasePlatform::isRectEmpty(&_dragRect)) {
+ if (!_dragRect.isRectEmpty()) {
buffer->putTextIndent(indent + 2, "DRAG_RECT { %d, %d, %d, %d }\n", _dragRect.left, _dragRect.top, _dragRect.right, _dragRect.bottom);
}
@@ -1227,7 +1227,7 @@ bool UIWindow::handleMouse(TMouseEvent event, TMouseButton button) {
bool res = UIObject::handleMouse(event, button);
// handle window dragging
- if (!BasePlatform::isRectEmpty(&_dragRect)) {
+ if (!_dragRect.isRectEmpty()) {
// start drag
if (event == MOUSE_CLICK && button == MOUSE_BUTTON_LEFT) {
Rect32 dragRect = _dragRect;
@@ -1258,24 +1258,24 @@ bool UIWindow::persist(BasePersistenceManager *persistMgr) {
UIObject::persist(persistMgr);
persistMgr->transferPtr(TMEMBER_PTR(_backInactive));
- persistMgr->transfer(TMEMBER(_clipContents));
- persistMgr->transfer(TMEMBER(_dragFrom));
- persistMgr->transfer(TMEMBER(_dragging));
- persistMgr->transfer(TMEMBER(_dragRect));
- persistMgr->transfer(TMEMBER(_fadeBackground));
+ persistMgr->transferBool(TMEMBER(_clipContents));
+ persistMgr->transferPoint32(TMEMBER(_dragFrom));
+ persistMgr->transferBool(TMEMBER(_dragging));
+ persistMgr->transferRect32(TMEMBER(_dragRect));
+ persistMgr->transferBool(TMEMBER(_fadeBackground));
persistMgr->transfer(TMEMBER(_fadeColor));
persistMgr->transferPtr(TMEMBER_PTR(_fontInactive));
persistMgr->transferPtr(TMEMBER_PTR(_imageInactive));
- persistMgr->transfer(TMEMBER(_inGame));
- persistMgr->transfer(TMEMBER(_isMenu));
+ persistMgr->transferBool(TMEMBER(_inGame));
+ persistMgr->transferBool(TMEMBER(_isMenu));
persistMgr->transfer(TMEMBER_INT(_mode));
persistMgr->transferPtr(TMEMBER_PTR(_shieldButton));
persistMgr->transferPtr(TMEMBER_PTR(_shieldWindow));
persistMgr->transfer(TMEMBER_INT(_titleAlign));
- persistMgr->transfer(TMEMBER(_titleRect));
- persistMgr->transfer(TMEMBER(_transparent));
+ persistMgr->transferRect32(TMEMBER(_titleRect));
+ persistMgr->transferBool(TMEMBER(_transparent));
persistMgr->transferPtr(TMEMBER_PTR(_viewport));
- persistMgr->transfer(TMEMBER(_pauseMusic));
+ persistMgr->transferBool(TMEMBER(_pauseMusic));
_widgets.persist(persistMgr);
diff --git a/engines/wintermute/video/video_theora_player.cpp b/engines/wintermute/video/video_theora_player.cpp
index f3317684b5..5dbb301374 100644
--- a/engines/wintermute/video/video_theora_player.cpp
+++ b/engines/wintermute/video/video_theora_player.cpp
@@ -34,7 +34,6 @@
#include "engines/wintermute/base/gfx/base_image.h"
#include "engines/wintermute/base/gfx/base_renderer.h"
#include "engines/wintermute/base/sound/base_sound_manager.h"
-#include "engines/wintermute/platform_osystem.h"
#include "video/theora_decoder.h"
#include "engines/wintermute/wintermute.h"
#include "common/system.h"
@@ -396,7 +395,7 @@ bool VideoTheoraPlayer::display(uint32 alpha) {
bool res;
if (_texture && _videoFrameReady) {
- BasePlatform::setRect(&rc, 0, 0, _texture->getWidth(), _texture->getHeight());
+ rc.setRect(0, 0, _texture->getWidth(), _texture->getHeight());
if (_playZoom == 100.0f) {
res = _texture->displayTrans(_posX, _posY, rc, alpha);
} else {
@@ -500,7 +499,7 @@ bool VideoTheoraPlayer::persist(BasePersistenceManager *persistMgr) {
persistMgr->transfer(TMEMBER(_posY));
persistMgr->transferFloat(TMEMBER(_playZoom));
persistMgr->transfer(TMEMBER_INT(_playbackType));
- persistMgr->transfer(TMEMBER(_looping));
+ persistMgr->transferBool(TMEMBER(_looping));
persistMgr->transfer(TMEMBER(_volume));
if (!persistMgr->getIsSaving() && (_savedState != THEORA_STATE_NONE)) {
diff --git a/engines/wintermute/video/video_theora_player.h b/engines/wintermute/video/video_theora_player.h
index a4f1b9edd6..7b28a71e17 100644
--- a/engines/wintermute/video/video_theora_player.h
+++ b/engines/wintermute/video/video_theora_player.h
@@ -62,7 +62,7 @@ public:
//CVidSubtitler *_subtitler;
// control methods
- bool initialize(const Common::String &filename, const Common::String &subtitleFile = nullptr);
+ bool initialize(const Common::String &filename, const Common::String &subtitleFile = Common::String());
bool initializeSimple();
bool update();
bool play(TVideoPlayback type = VID_PLAY_CENTER, int x = 0, int y = 0, bool freezeGame = false, bool freezeMusic = true, bool looping = false, uint32 startTime = 0, float forceZoom = -1.0f, int volume = -1);
diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/animation/rlf_animation.cpp
index 5f1d41daae..c7307265c0 100644
--- a/engines/zvision/rlf_animation.cpp
+++ b/engines/zvision/animation/rlf_animation.cpp
@@ -22,7 +22,7 @@
#include "common/scummsys.h"
-#include "zvision/rlf_animation.h"
+#include "zvision/animation/rlf_animation.h"
#include "common/str.h"
#include "common/file.h"
diff --git a/engines/zvision/rlf_animation.h b/engines/zvision/animation/rlf_animation.h
index fe5b0d68b4..fe5b0d68b4 100644
--- a/engines/zvision/rlf_animation.h
+++ b/engines/zvision/animation/rlf_animation.h
diff --git a/engines/zvision/zfs_archive.cpp b/engines/zvision/archives/zfs_archive.cpp
index 24cff27fc4..b8175b4903 100644
--- a/engines/zvision/zfs_archive.cpp
+++ b/engines/zvision/archives/zfs_archive.cpp
@@ -22,7 +22,7 @@
#include "common/scummsys.h"
-#include "zvision/zfs_archive.h"
+#include "zvision/archives/zfs_archive.h"
#include "common/memstream.h"
#include "common/debug.h"
diff --git a/engines/zvision/zfs_archive.h b/engines/zvision/archives/zfs_archive.h
index d7b45e4b47..d7b45e4b47 100644
--- a/engines/zvision/zfs_archive.h
+++ b/engines/zvision/archives/zfs_archive.h
diff --git a/engines/zvision/console.cpp b/engines/zvision/core/console.cpp
index a095d3fa6a..0d325ef7f7 100644
--- a/engines/zvision/console.cpp
+++ b/engines/zvision/core/console.cpp
@@ -22,16 +22,16 @@
#include "common/scummsys.h"
-#include "zvision/console.h"
+#include "zvision/core/console.h"
#include "zvision/zvision.h"
-#include "zvision/script_manager.h"
-#include "zvision/render_manager.h"
-#include "zvision/string_manager.h"
-#include "zvision/zork_avi_decoder.h"
-#include "zvision/zork_raw.h"
-#include "zvision/utility.h"
-#include "zvision/cursor.h"
+#include "zvision/scripting/script_manager.h"
+#include "zvision/graphics/render_manager.h"
+#include "zvision/strings/string_manager.h"
+#include "zvision/video/zork_avi_decoder.h"
+#include "zvision/sound/zork_raw.h"
+#include "zvision/utility/utility.h"
+#include "zvision/cursors/cursor.h"
#include "common/system.h"
#include "common/file.h"
diff --git a/engines/zvision/console.h b/engines/zvision/core/console.h
index 0ca1b8cc70..0ca1b8cc70 100644
--- a/engines/zvision/console.h
+++ b/engines/zvision/core/console.h
diff --git a/engines/zvision/events.cpp b/engines/zvision/core/events.cpp
index 1103dc3000..40bfb879b1 100644
--- a/engines/zvision/events.cpp
+++ b/engines/zvision/core/events.cpp
@@ -24,11 +24,11 @@
#include "zvision/zvision.h"
-#include "zvision/console.h"
-#include "zvision/cursor_manager.h"
-#include "zvision/render_manager.h"
-#include "zvision/script_manager.h"
-#include "zvision/rlf_animation.h"
+#include "zvision/core/console.h"
+#include "zvision/cursors/cursor_manager.h"
+#include "zvision/graphics/render_manager.h"
+#include "zvision/scripting/script_manager.h"
+#include "zvision/animation/rlf_animation.h"
#include "common/events.h"
#include "common/system.h"
diff --git a/engines/zvision/menu.h b/engines/zvision/core/menu.h
index affc69abd5..affc69abd5 100644
--- a/engines/zvision/menu.h
+++ b/engines/zvision/core/menu.h
diff --git a/engines/zvision/save_manager.cpp b/engines/zvision/core/save_manager.cpp
index c3deadd703..b91f8eacad 100644
--- a/engines/zvision/save_manager.cpp
+++ b/engines/zvision/core/save_manager.cpp
@@ -22,11 +22,11 @@
#include "common/scummsys.h"
-#include "zvision/save_manager.h"
+#include "zvision/core/save_manager.h"
#include "zvision/zvision.h"
-#include "zvision/script_manager.h"
-#include "zvision/render_manager.h"
+#include "zvision/scripting/script_manager.h"
+#include "zvision/graphics/render_manager.h"
#include "common/system.h"
diff --git a/engines/zvision/save_manager.h b/engines/zvision/core/save_manager.h
index b4770e68b2..b4770e68b2 100644
--- a/engines/zvision/save_manager.h
+++ b/engines/zvision/core/save_manager.h
diff --git a/engines/zvision/cursor.cpp b/engines/zvision/cursors/cursor.cpp
index 9023d97e0d..be80f6585b 100644
--- a/engines/zvision/cursor.cpp
+++ b/engines/zvision/cursors/cursor.cpp
@@ -22,7 +22,7 @@
#include "common/scummsys.h"
-#include "zvision/cursor.h"
+#include "zvision/cursors/cursor.h"
#include "common/str.h"
#include "common/file.h"
diff --git a/engines/zvision/cursor.h b/engines/zvision/cursors/cursor.h
index 18ac28ce8b..18ac28ce8b 100644
--- a/engines/zvision/cursor.h
+++ b/engines/zvision/cursors/cursor.h
diff --git a/engines/zvision/cursor_manager.cpp b/engines/zvision/cursors/cursor_manager.cpp
index 595e7946dd..671f26ba2d 100644
--- a/engines/zvision/cursor_manager.cpp
+++ b/engines/zvision/cursors/cursor_manager.cpp
@@ -22,7 +22,7 @@
#include "common/scummsys.h"
-#include "zvision/cursor_manager.h"
+#include "zvision/cursors/cursor_manager.h"
#include "zvision/zvision.h"
@@ -102,6 +102,7 @@ void CursorManager::changeCursor(const Common::String &cursorName, bool pushed)
char buffer[25];
strcpy(buffer, _zgiCursorFileNames[i]);
buffer[3] += 2;
+ changeCursor(ZorkCursor(buffer));
}
return;
}
diff --git a/engines/zvision/cursor_manager.h b/engines/zvision/cursors/cursor_manager.h
index 0a369aaf9e..e982a40188 100644
--- a/engines/zvision/cursor_manager.h
+++ b/engines/zvision/cursors/cursor_manager.h
@@ -23,7 +23,7 @@
#ifndef ZVISION_CURSOR_MANAGER_H
#define ZVISION_CURSOR_MANAGER_H
-#include "zvision/cursor.h"
+#include "zvision/cursors/cursor.h"
#include "common/str.h"
diff --git a/engines/zvision/detection.cpp b/engines/zvision/detection.cpp
index 06e921dfa8..49664935e1 100644
--- a/engines/zvision/detection.cpp
+++ b/engines/zvision/detection.cpp
@@ -80,7 +80,7 @@ static const ZVisionGameDescription gameDescriptions[] = {
0,
AD_ENTRY1s("SCRIPTS.ZFS", "81efd40ecc3d22531e211368b779f17f", 8336944),
Common::EN_ANY,
- Common::kPlatformDOS,
+ Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO1(GUIO_NONE)
},
diff --git a/engines/zvision/truetype_font.cpp b/engines/zvision/fonts/truetype_font.cpp
index 289b5fbbaf..f8910bfe06 100644
--- a/engines/zvision/truetype_font.cpp
+++ b/engines/zvision/fonts/truetype_font.cpp
@@ -22,10 +22,10 @@
#include "common/scummsys.h"
-#include "zvision/truetype_font.h"
+#include "zvision/fonts/truetype_font.h"
#include "zvision/zvision.h"
-#include "zvision/render_manager.h"
+#include "zvision/graphics/render_manager.h"
#include "common/debug.h"
#include "common/file.h"
diff --git a/engines/zvision/truetype_font.h b/engines/zvision/fonts/truetype_font.h
index 33f016cffd..33f016cffd 100644
--- a/engines/zvision/truetype_font.h
+++ b/engines/zvision/fonts/truetype_font.h
diff --git a/engines/zvision/render_manager.cpp b/engines/zvision/graphics/render_manager.cpp
index af8ca7fd64..f19df88935 100644
--- a/engines/zvision/render_manager.cpp
+++ b/engines/zvision/graphics/render_manager.cpp
@@ -22,9 +22,9 @@
#include "common/scummsys.h"
-#include "zvision/render_manager.h"
+#include "zvision/graphics/render_manager.h"
-#include "zvision/lzss_read_stream.h"
+#include "zvision/utility/lzss_read_stream.h"
#include "common/file.h"
#include "common/system.h"
diff --git a/engines/zvision/render_manager.h b/engines/zvision/graphics/render_manager.h
index 111bf6276c..cb71308bc3 100644
--- a/engines/zvision/render_manager.h
+++ b/engines/zvision/graphics/render_manager.h
@@ -23,8 +23,8 @@
#ifndef ZVISION_RENDER_MANAGER_H
#define ZVISION_RENDER_MANAGER_H
-#include "zvision/render_table.h"
-#include "zvision/truetype_font.h"
+#include "zvision/graphics/render_table.h"
+#include "zvision/fonts/truetype_font.h"
#include "common/rect.h"
#include "common/hashmap.h"
diff --git a/engines/zvision/render_table.cpp b/engines/zvision/graphics/render_table.cpp
index b6a6a3d2bb..ffd42e6a60 100644
--- a/engines/zvision/render_table.cpp
+++ b/engines/zvision/graphics/render_table.cpp
@@ -22,7 +22,7 @@
#include "common/scummsys.h"
-#include "zvision/render_table.h"
+#include "zvision/graphics/render_table.h"
#include "common/rect.h"
diff --git a/engines/zvision/render_table.h b/engines/zvision/graphics/render_table.h
index 898091193a..898091193a 100644
--- a/engines/zvision/render_table.h
+++ b/engines/zvision/graphics/render_table.h
diff --git a/engines/zvision/inventory_manager.h b/engines/zvision/inventory/inventory_manager.h
index ae6d116b18..ae6d116b18 100644
--- a/engines/zvision/inventory_manager.h
+++ b/engines/zvision/inventory/inventory_manager.h
diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk
index 261168f133..4cf9c989cd 100644
--- a/engines/zvision/module.mk
+++ b/engines/zvision/module.mk
@@ -1,36 +1,36 @@
MODULE := engines/zvision
MODULE_OBJS := \
- actions.o \
- animation_control.o \
- clock.o \
- console.o \
- control.o \
- cursor.o \
- cursor_manager.o \
+ animation/rlf_animation.o \
+ archives/zfs_archive.o \
+ core/console.o \
+ core/events.o \
+ core/save_manager.o \
+ cursors/cursor.o \
+ cursors/cursor_manager.o \
detection.o \
- events.o \
- input_control.o \
- lever_control.o \
- lzss_read_stream.o \
- push_toggle_control.o \
- render_manager.o \
- render_table.o \
- rlf_animation.o \
- save_manager.o \
- scr_file_handling.o \
- script_manager.o \
- single_value_container.o \
- string_manager.o \
- timer_node.o \
- truetype_font.o \
- utility.o \
- video.o \
- zvision.o \
- zfs_archive.o \
- zork_avi_decoder.o \
- zork_raw.o
-
+ fonts/truetype_font.o \
+ graphics/render_manager.o \
+ graphics/render_table.o \
+ scripting/actions.o \
+ scripting/control.o \
+ scripting/controls/animation_control.o \
+ scripting/controls/input_control.o \
+ scripting/controls/lever_control.o \
+ scripting/controls/push_toggle_control.o \
+ scripting/controls/timer_node.o \
+ scripting/scr_file_handling.o \
+ scripting/script_manager.o \
+ sound/zork_raw.o \
+ strings/string_manager.o \
+ utility/clock.o \
+ utility/lzss_read_stream.o \
+ utility/single_value_container.o \
+ utility/utility.o \
+ video/video.o \
+ video/zork_avi_decoder.o \
+ zvision.o
+
MODULE_DIRS += \
engines/zvision
diff --git a/engines/zvision/actions.cpp b/engines/zvision/scripting/actions.cpp
index eae4ec2ed5..878fa752d5 100644
--- a/engines/zvision/actions.cpp
+++ b/engines/zvision/scripting/actions.cpp
@@ -22,15 +22,15 @@
#include "common/scummsys.h"
-#include "zvision/actions.h"
+#include "zvision/scripting/actions.h"
#include "zvision/zvision.h"
-#include "zvision/script_manager.h"
-#include "zvision/render_manager.h"
-#include "zvision/zork_raw.h"
-#include "zvision/zork_avi_decoder.h"
-#include "zvision/timer_node.h"
-#include "zvision/animation_control.h"
+#include "zvision/scripting/script_manager.h"
+#include "zvision/graphics/render_manager.h"
+#include "zvision/sound/zork_raw.h"
+#include "zvision/video/zork_avi_decoder.h"
+#include "zvision/scripting/controls/timer_node.h"
+#include "zvision/scripting/controls/animation_control.h"
#include "common/file.h"
@@ -124,7 +124,8 @@ ActionDisableControl::ActionDisableControl(const Common::String &line) {
bool ActionDisableControl::execute(ZVision *engine) {
debug("Disabling control %u", _key);
- engine->getScriptManager()->disableControl(_key);
+ ScriptManager *scriptManager = engine->getScriptManager();
+ scriptManager->setStateFlags(_key, scriptManager->getStateFlags(_key) | ScriptManager::DISABLED);
return true;
}
@@ -141,7 +142,8 @@ ActionEnableControl::ActionEnableControl(const Common::String &line) {
bool ActionEnableControl::execute(ZVision *engine) {
debug("Enabling control %u", _key);
- engine->getScriptManager()->enableControl(_key);
+ ScriptManager *scriptManager = engine->getScriptManager();
+ scriptManager->setStateFlags(_key, scriptManager->getStateFlags(_key) & ~ScriptManager::DISABLED);
return true;
}
@@ -185,6 +187,9 @@ bool ActionMusic::execute(ZVision *engine) {
Common::File *file = new Common::File();
if (file->open(_fileName)) {
audioStream = Audio::makeWAVStream(file, DisposeAfterUse::YES);
+ } else {
+ warning("Unable to open %s", _fileName.c_str());
+ return false;
}
} else {
audioStream = makeRawZorkStream(_fileName, engine);
@@ -220,8 +225,10 @@ bool ActionPreloadAnimation::execute(ZVision *engine) {
// TODO: Check if the Control already exists
// Create the control, but disable it until PlayPreload is called
- engine->getScriptManager()->addControl(new AnimationControl(engine, _key, _fileName));
- engine->getScriptManager()->disableControl(_key);
+ ScriptManager *scriptManager = engine->getScriptManager();
+ scriptManager->addControl(new AnimationControl(engine, _key, _fileName));
+ scriptManager->setStateFlags(_key, scriptManager->getStateFlags(_key) | ScriptManager::DISABLED);
+
return true;
}
diff --git a/engines/zvision/actions.h b/engines/zvision/scripting/actions.h
index afa3e3a2ac..afa3e3a2ac 100644
--- a/engines/zvision/actions.h
+++ b/engines/zvision/scripting/actions.h
diff --git a/engines/zvision/control.cpp b/engines/zvision/scripting/control.cpp
index bcbdabc143..35c4ea1441 100644
--- a/engines/zvision/control.cpp
+++ b/engines/zvision/scripting/control.cpp
@@ -22,11 +22,11 @@
#include "common/scummsys.h"
-#include "zvision/control.h"
+#include "zvision/scripting/control.h"
#include "zvision/zvision.h"
-#include "zvision/render_manager.h"
-#include "zvision/utility.h"
+#include "zvision/graphics/render_manager.h"
+#include "zvision/utility/utility.h"
#include "common/stream.h"
diff --git a/engines/zvision/control.h b/engines/zvision/scripting/control.h
index 770c540a12..770c540a12 100644
--- a/engines/zvision/control.h
+++ b/engines/zvision/scripting/control.h
diff --git a/engines/zvision/animation_control.cpp b/engines/zvision/scripting/controls/animation_control.cpp
index 1143380501..ec8f7a9647 100644
--- a/engines/zvision/animation_control.cpp
+++ b/engines/zvision/scripting/controls/animation_control.cpp
@@ -22,13 +22,13 @@
#include "common/scummsys.h"
-#include "zvision/animation_control.h"
+#include "zvision/scripting/controls/animation_control.h"
#include "zvision/zvision.h"
-#include "zvision/render_manager.h"
-#include "zvision/script_manager.h"
-#include "zvision/rlf_animation.h"
-#include "zvision/zork_avi_decoder.h"
+#include "zvision/graphics/render_manager.h"
+#include "zvision/scripting/script_manager.h"
+#include "zvision/animation/rlf_animation.h"
+#include "zvision/video/zork_avi_decoder.h"
#include "video/video_decoder.h"
diff --git a/engines/zvision/animation_control.h b/engines/zvision/scripting/controls/animation_control.h
index 2ac3691483..77663aaf1e 100644
--- a/engines/zvision/animation_control.h
+++ b/engines/zvision/scripting/controls/animation_control.h
@@ -23,7 +23,7 @@
#ifndef ZVISION_ANIMATION_CONTROL_H
#define ZVISION_ANIMATION_CONTROL_H
-#include "zvision/control.h"
+#include "zvision/scripting/control.h"
namespace Common {
diff --git a/engines/zvision/input_control.cpp b/engines/zvision/scripting/controls/input_control.cpp
index a445e1aae5..2685b01312 100644
--- a/engines/zvision/input_control.cpp
+++ b/engines/zvision/scripting/controls/input_control.cpp
@@ -22,13 +22,13 @@
#include "common/scummsys.h"
-#include "zvision/input_control.h"
+#include "zvision/scripting/controls/input_control.h"
#include "zvision/zvision.h"
-#include "zvision/script_manager.h"
-#include "zvision/string_manager.h"
-#include "zvision/render_manager.h"
-#include "zvision/utility.h"
+#include "zvision/scripting/script_manager.h"
+#include "zvision/strings/string_manager.h"
+#include "zvision/graphics/render_manager.h"
+#include "zvision/utility/utility.h"
#include "common/str.h"
#include "common/stream.h"
diff --git a/engines/zvision/input_control.h b/engines/zvision/scripting/controls/input_control.h
index aab2c991dc..f0fd8b502d 100644
--- a/engines/zvision/input_control.h
+++ b/engines/zvision/scripting/controls/input_control.h
@@ -23,8 +23,8 @@
#ifndef ZVISION_INPUT_CONTROL_H
#define ZVISION_INPUT_CONTROL_H
-#include "zvision/control.h"
-#include "zvision/string_manager.h"
+#include "zvision/scripting/control.h"
+#include "zvision/strings/string_manager.h"
#include "common/rect.h"
diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/scripting/controls/lever_control.cpp
index 79049b8fcb..e08fdd10f3 100644
--- a/engines/zvision/lever_control.cpp
+++ b/engines/zvision/scripting/controls/lever_control.cpp
@@ -22,15 +22,15 @@
#include "common/scummsys.h"
-#include "zvision/lever_control.h"
+#include "zvision/scripting/controls/lever_control.h"
#include "zvision/zvision.h"
-#include "zvision/script_manager.h"
-#include "zvision/render_manager.h"
-#include "zvision/cursor_manager.h"
-#include "zvision/rlf_animation.h"
-#include "zvision/zork_avi_decoder.h"
-#include "zvision/utility.h"
+#include "zvision/scripting/script_manager.h"
+#include "zvision/graphics/render_manager.h"
+#include "zvision/cursors/cursor_manager.h"
+#include "zvision/animation/rlf_animation.h"
+#include "zvision/video/zork_avi_decoder.h"
+#include "zvision/utility/utility.h"
#include "common/stream.h"
#include "common/file.h"
@@ -377,11 +377,11 @@ void LeverControl::renderFrame(uint frameNumber) {
_lastRenderedFrame = frameNumber;
}
- const uint16 *frameData;
+ const uint16 *frameData = 0;
int x = _animationCoords.left;
int y = _animationCoords.top;
- int width;
- int height;
+ int width = 0;
+ int height = 0;
if (_fileType == RLF) {
// getFrameData() will automatically optimize to getNextFrame() / getPreviousFrame() if it can
diff --git a/engines/zvision/lever_control.h b/engines/zvision/scripting/controls/lever_control.h
index 8ef8f06fec..69473cf119 100644
--- a/engines/zvision/lever_control.h
+++ b/engines/zvision/scripting/controls/lever_control.h
@@ -23,7 +23,7 @@
#ifndef ZVISION_LEVER_CONTROL_H
#define ZVISION_LEVER_CONTROL_H
-#include "zvision/control.h"
+#include "zvision/scripting/control.h"
#include "common/list.h"
#include "common/rect.h"
diff --git a/engines/zvision/push_toggle_control.cpp b/engines/zvision/scripting/controls/push_toggle_control.cpp
index 689311ba5b..11ec4bb73f 100644
--- a/engines/zvision/push_toggle_control.cpp
+++ b/engines/zvision/scripting/controls/push_toggle_control.cpp
@@ -22,12 +22,12 @@
#include "common/scummsys.h"
-#include "zvision/push_toggle_control.h"
+#include "zvision/scripting/controls/push_toggle_control.h"
#include "zvision/zvision.h"
-#include "zvision/script_manager.h"
-#include "zvision/cursor_manager.h"
-#include "zvision/utility.h"
+#include "zvision/scripting/script_manager.h"
+#include "zvision/cursors/cursor_manager.h"
+#include "zvision/utility/utility.h"
#include "common/stream.h"
diff --git a/engines/zvision/push_toggle_control.h b/engines/zvision/scripting/controls/push_toggle_control.h
index 2a407cada9..13dc54a65f 100644
--- a/engines/zvision/push_toggle_control.h
+++ b/engines/zvision/scripting/controls/push_toggle_control.h
@@ -23,7 +23,7 @@
#ifndef ZVISION_PUSH_TOGGLE_CONTROL_H
#define ZVISION_PUSH_TOGGLE_CONTROL_H
-#include "zvision/control.h"
+#include "zvision/scripting/control.h"
#include "common/rect.h"
diff --git a/engines/zvision/timer_node.cpp b/engines/zvision/scripting/controls/timer_node.cpp
index 55dfa51dfe..3b691be275 100644
--- a/engines/zvision/timer_node.cpp
+++ b/engines/zvision/scripting/controls/timer_node.cpp
@@ -22,25 +22,39 @@
#include "common/scummsys.h"
-#include "zvision/timer_node.h"
+#include "zvision/scripting/controls/timer_node.h"
#include "zvision/zvision.h"
-#include "zvision/script_manager.h"
+#include "zvision/scripting/script_manager.h"
#include "common/stream.h"
namespace ZVision {
+
+TimerNode::TimerNode(ZVision *engine, uint32 key, uint timeInSeconds)
+ : Control(engine, key) {
+ if (_engine->getGameId() == GID_NEMESIS) {
+ _timeLeft = timeInSeconds * 1000;
+ } else if (_engine->getGameId() == GID_GRANDINQUISITOR) {
+ _timeLeft = timeInSeconds * 100;
+ }
+
+ _engine->getScriptManager()->setStateValue(_key, 1);
+}
-TimerNode::TimerNode(ZVision *engine, uint32 key, uint timeInSeconds)
- : Control(engine, key), _timeLeft(timeInSeconds * 1000) {
+TimerNode::~TimerNode() {
+ if (_timeLeft <= 0)
+ _engine->getScriptManager()->setStateValue(_key, 2);
+ else
+ _engine->getScriptManager()->setStateValue(_key, _timeLeft); // If timer was stopped by stop or kill
}
bool TimerNode::process(uint32 deltaTimeInMillis) {
_timeLeft -= deltaTimeInMillis;
if (_timeLeft <= 0) {
- _engine->getScriptManager()->setStateValue(_key, 0);
+ // Let the destructor reset the state value
return true;
}
diff --git a/engines/zvision/timer_node.h b/engines/zvision/scripting/controls/timer_node.h
index 32dca71548..a8e579cbe4 100644
--- a/engines/zvision/timer_node.h
+++ b/engines/zvision/scripting/controls/timer_node.h
@@ -23,7 +23,7 @@
#ifndef ZVISION_TIMER_NODE_H
#define ZVISION_TIMER_NODE_H
-#include "zvision/control.h"
+#include "zvision/scripting/control.h"
namespace ZVision {
@@ -32,6 +32,7 @@ class ZVision;
class TimerNode : public Control {
public:
TimerNode(ZVision *engine, uint32 key, uint timeInSeconds);
+ ~TimerNode();
/**
* Decrement the timer by the delta time. If the timer is finished, set the status
diff --git a/engines/zvision/puzzle.h b/engines/zvision/scripting/puzzle.h
index 1e730365dc..0d717f1fa9 100644
--- a/engines/zvision/puzzle.h
+++ b/engines/zvision/scripting/puzzle.h
@@ -23,7 +23,7 @@
#ifndef ZVISION_PUZZLE_H
#define ZVISION_PUZZLE_H
-#include "zvision/actions.h"
+#include "zvision/scripting/actions.h"
#include "common/list.h"
#include "common/ptr.h"
@@ -32,7 +32,7 @@
namespace ZVision {
struct Puzzle {
- Puzzle() : key(0), flags(0) {}
+ Puzzle() : key(0) {}
~Puzzle() {
for (Common::List<ResultAction *>::iterator iter = resultActions.begin(); iter != resultActions.end(); ++iter) {
@@ -63,17 +63,10 @@ struct Puzzle {
bool argumentIsAKey;
};
- enum StateFlags {
- ONCE_PER_INST = 0x01,
- DO_ME_NOW = 0x02, // Somewhat useless flag since anything that needs to be done immediately has no criteria
- DISABLED = 0x04
- };
-
uint32 key;
Common::List<Common::List <CriteriaEntry> > criteriaList;
// This has to be list of pointers because ResultAction is abstract
Common::List<ResultAction *> resultActions;
- uint flags;
};
} // End of namespace ZVision
diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scripting/scr_file_handling.cpp
index e90408cf0d..d93094a3b2 100644
--- a/engines/zvision/scr_file_handling.cpp
+++ b/engines/zvision/scripting/scr_file_handling.cpp
@@ -22,13 +22,13 @@
#include "common/scummsys.h"
-#include "zvision/script_manager.h"
+#include "zvision/scripting/script_manager.h"
-#include "zvision/utility.h"
-#include "zvision/puzzle.h"
-#include "zvision/actions.h"
-#include "zvision/push_toggle_control.h"
-#include "zvision/lever_control.h"
+#include "zvision/utility/utility.h"
+#include "zvision/scripting/puzzle.h"
+#include "zvision/scripting/actions.h"
+#include "zvision/scripting/controls/push_toggle_control.h"
+#include "zvision/scripting/controls/lever_control.h"
#include "common/textconsole.h"
#include "common/file.h"
@@ -81,7 +81,7 @@ void ScriptManager::parsePuzzle(Puzzle *puzzle, Common::SeekableReadStream &stre
} else if (line.matchString("results {", true)) {
parseResults(stream, puzzle->resultActions);
} else if (line.matchString("flags {", true)) {
- puzzle->flags = parseFlags(stream);
+ setStateFlags(puzzle->key, parseFlags(stream));
}
line = stream.readLine();
@@ -259,11 +259,11 @@ uint ScriptManager::parseFlags(Common::SeekableReadStream &stream) const {
while (!stream.eos() && !line.contains('}')) {
if (line.matchString("ONCE_PER_INST", true)) {
- flags |= Puzzle::ONCE_PER_INST;
+ flags |= ONCE_PER_INST;
} else if (line.matchString("DO_ME_NOW", true)) {
- flags |= Puzzle::DO_ME_NOW;
+ flags |= DO_ME_NOW;
} else if (line.matchString("DISABLED", true)) {
- flags |= Puzzle::DISABLED;
+ flags |= DISABLED;
}
line = stream.readLine();
diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/scripting/script_manager.cpp
index 66a54088fd..adcc5c7545 100644
--- a/engines/zvision/script_manager.cpp
+++ b/engines/zvision/scripting/script_manager.cpp
@@ -22,14 +22,14 @@
#include "common/scummsys.h"
-#include "zvision/script_manager.h"
+#include "zvision/scripting/script_manager.h"
#include "zvision/zvision.h"
-#include "zvision/render_manager.h"
-#include "zvision/cursor_manager.h"
-#include "zvision/save_manager.h"
-#include "zvision/actions.h"
-#include "zvision/utility.h"
+#include "zvision/graphics/render_manager.h"
+#include "zvision/cursors/cursor_manager.h"
+#include "zvision/core/save_manager.h"
+#include "zvision/scripting/actions.h"
+#include "zvision/utility/utility.h"
#include "common/algorithm.h"
#include "common/hashmap.h"
@@ -126,8 +126,7 @@ void ScriptManager::checkPuzzleCriteria() {
// Check if the puzzle is already finished
// Also check that the puzzle isn't disabled
- if (getStateValue(puzzle->key) == 1 &&
- (puzzle->flags & Puzzle::DISABLED) == 0) {
+ if (getStateValue(puzzle->key) == 1 && (getStateFlags(puzzle->key) & DISABLED) == 0) {
continue;
}
@@ -223,6 +222,23 @@ void ScriptManager::setStateValue(uint32 key, uint value) {
}
}
+uint ScriptManager::getStateFlags(uint32 key) {
+ if (_globalStateFlags.contains(key))
+ return _globalStateFlags[key];
+ else
+ return 0;
+}
+
+void ScriptManager::setStateFlags(uint32 key, uint flags) {
+ _globalStateFlags[key] = flags;
+
+ if (_referenceTable.contains(key)) {
+ for (Common::Array<Puzzle *>::iterator iter = _referenceTable[key].begin(); iter != _referenceTable[key].end(); ++iter) {
+ _puzzlesToCheck.push((*iter));
+ }
+ }
+}
+
void ScriptManager::addToStateValue(uint32 key, uint valueToAdd) {
_globalState[key] += valueToAdd;
}
@@ -241,24 +257,6 @@ Control *ScriptManager::getControl(uint32 key) {
return nullptr;
}
-void ScriptManager::enableControl(uint32 key) {
- for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) {
- if ((*iter)->getKey() == key) {
- (*iter)->enable();
- break;
- }
- }
-}
-
-void ScriptManager::disableControl(uint32 key) {
- for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) {
- if ((*iter)->getKey() == key) {
- (*iter)->disable();
- break;
- }
- }
-}
-
void ScriptManager::focusControl(uint32 key) {
for (ControlList::iterator iter = _activeControls.begin(); iter != _activeControls.end(); ++iter) {
uint32 controlKey = (*iter)->getKey();
@@ -352,7 +350,7 @@ void ScriptManager::changeLocation(char world, char room, char node, char view,
// Add all the local puzzles to the queue to be checked
for (PuzzleList::iterator iter = _activePuzzles.begin(); iter != _activePuzzles.end(); ++iter) {
// Reset any Puzzles that have the flag ONCE_PER_INST
- if (((*iter)->flags & Puzzle::ONCE_PER_INST) == Puzzle::ONCE_PER_INST) {
+ if ((getStateFlags((*iter)->key) & ONCE_PER_INST) == ONCE_PER_INST) {
setStateValue((*iter)->key, 0);
}
@@ -362,7 +360,7 @@ void ScriptManager::changeLocation(char world, char room, char node, char view,
// Add all the global puzzles to the queue to be checked
for (PuzzleList::iterator iter = _globalPuzzles.begin(); iter != _globalPuzzles.end(); ++iter) {
// Reset any Puzzles that have the flag ONCE_PER_INST
- if (((*iter)->flags & Puzzle::ONCE_PER_INST) == Puzzle::ONCE_PER_INST) {
+ if ((getStateFlags((*iter)->key) & ONCE_PER_INST) == ONCE_PER_INST) {
setStateValue((*iter)->key, 0);
}
diff --git a/engines/zvision/script_manager.h b/engines/zvision/scripting/script_manager.h
index 388d0805e0..ab9b03ed30 100644
--- a/engines/zvision/script_manager.h
+++ b/engines/zvision/scripting/script_manager.h
@@ -23,8 +23,8 @@
#ifndef ZVISION_SCRIPT_MANAGER_H
#define ZVISION_SCRIPT_MANAGER_H
-#include "zvision/puzzle.h"
-#include "zvision/control.h"
+#include "zvision/scripting/puzzle.h"
+#include "zvision/scripting/control.h"
#include "common/hashmap.h"
#include "common/queue.h"
@@ -54,12 +54,20 @@ typedef Common::List<Puzzle *> PuzzleList;
typedef Common::Queue<Puzzle *> PuzzleQueue;
typedef Common::List<Control *> ControlList;
typedef Common::HashMap<uint32, uint32> StateMap;
+typedef Common::HashMap<uint32, uint> StateFlagMap;
class ScriptManager {
public:
ScriptManager(ZVision *engine);
~ScriptManager();
+public:
+ enum StateFlags {
+ ONCE_PER_INST = 0x01,
+ DO_ME_NOW = 0x02, // Somewhat useless flag since anything that needs to be done immediately has no criteria
+ DISABLED = 0x04
+ };
+
private:
ZVision *_engine;
/**
@@ -68,6 +76,11 @@ private:
* particular state key are checked after the key is modified.
*/
StateMap _globalState;
+ /**
+ * Holds the flags for the global states. This is used to enable/disable puzzles and/or
+ * controls as well as which puzzles should are allowed to be re-executed
+ */
+ StateFlagMap _globalStateFlags;
/** References _globalState keys to Puzzles */
PuzzleMap _referenceTable;
/** Holds the Puzzles that should be checked this frame */
@@ -91,12 +104,12 @@ public:
void setStateValue(uint32 key, uint value);
void addToStateValue(uint32 key, uint valueToAdd);
+ uint getStateFlags(uint32 key);
+ void setStateFlags(uint32 key, uint flags);
+
void addControl(Control *control);
Control *getControl(uint32 key);
- void enableControl(uint32 key);
- void disableControl(uint32 key);
-
void focusControl(uint32 key);
/**
diff --git a/engines/zvision/zork_raw.cpp b/engines/zvision/sound/zork_raw.cpp
index 21613d9043..321ac93de2 100644
--- a/engines/zvision/zork_raw.cpp
+++ b/engines/zvision/sound/zork_raw.cpp
@@ -22,11 +22,11 @@
#include "common/scummsys.h"
-#include "zvision/zork_raw.h"
+#include "zvision/sound/zork_raw.h"
#include "zvision/zvision.h"
#include "zvision/detection.h"
-#include "zvision/utility.h"
+#include "zvision/utility/utility.h"
#include "common/file.h"
#include "common/str.h"
@@ -180,21 +180,29 @@ Audio::RewindableAudioStream *makeRawZorkStream(const Common::String &filePath,
Common::String fileName = getFileName(filePath);
fileName.toLowercase();
- SoundParams soundParams;
+ SoundParams soundParams = { ' ', 0, false, false };
+ bool foundParams = false;
+ char fileIdentifier = (engine->getGameId() == GID_NEMESIS) ? fileName[6] : fileName[7];
if (engine->getGameId() == GID_NEMESIS) {
for (int i = 0; i < 6; ++i) {
- if (RawZorkStream::_zNemSoundParamLookupTable[i].identifier == (fileName[6]))
+ if (RawZorkStream::_zNemSoundParamLookupTable[i].identifier == fileIdentifier) {
soundParams = RawZorkStream::_zNemSoundParamLookupTable[i];
+ foundParams = true;
+ }
}
- }
- else if (engine->getGameId() == GID_GRANDINQUISITOR) {
+ } else if (engine->getGameId() == GID_GRANDINQUISITOR) {
for (int i = 0; i < 6; ++i) {
- if (RawZorkStream::_zgiSoundParamLookupTable[i].identifier == (fileName[7]))
+ if (RawZorkStream::_zgiSoundParamLookupTable[i].identifier == fileIdentifier) {
soundParams = RawZorkStream::_zgiSoundParamLookupTable[i];
+ foundParams = true;
+ }
}
}
+ if (!foundParams)
+ error("Unable to find sound params for file '%s'. File identifier is '%c'", filePath.c_str(), fileIdentifier);
+
if (soundParams.packed) {
return makeRawZorkStream(wrapBufferedSeekableReadStream(file, 2048, DisposeAfterUse::YES), soundParams.rate, soundParams.stereo, DisposeAfterUse::YES);
} else {
diff --git a/engines/zvision/zork_raw.h b/engines/zvision/sound/zork_raw.h
index 481ea79f2d..481ea79f2d 100644
--- a/engines/zvision/zork_raw.h
+++ b/engines/zvision/sound/zork_raw.h
diff --git a/engines/zvision/string_manager.cpp b/engines/zvision/strings/string_manager.cpp
index ab42f3d3e0..77ed501672 100644
--- a/engines/zvision/string_manager.cpp
+++ b/engines/zvision/strings/string_manager.cpp
@@ -22,9 +22,9 @@
#include "common/scummsys.h"
-#include "zvision/string_manager.h"
+#include "zvision/strings/string_manager.h"
-#include "zvision/truetype_font.h"
+#include "zvision/fonts/truetype_font.h"
#include "common/file.h"
#include "common/tokenizer.h"
diff --git a/engines/zvision/string_manager.h b/engines/zvision/strings/string_manager.h
index 9cfed5261b..86bb9638d7 100644
--- a/engines/zvision/string_manager.h
+++ b/engines/zvision/strings/string_manager.h
@@ -25,7 +25,7 @@
#define ZVISION_STRING_MANAGER_H
#include "zvision/detection.h"
-#include "zvision/truetype_font.h"
+#include "zvision/fonts/truetype_font.h"
namespace Graphics {
diff --git a/engines/zvision/subtitles.h b/engines/zvision/subtitles/subtitles.h
index 13426e03e4..13426e03e4 100644
--- a/engines/zvision/subtitles.h
+++ b/engines/zvision/subtitles/subtitles.h
diff --git a/engines/zvision/clock.cpp b/engines/zvision/utility/clock.cpp
index c8ee717a33..49e4b32054 100644
--- a/engines/zvision/clock.cpp
+++ b/engines/zvision/utility/clock.cpp
@@ -23,7 +23,7 @@
#include "common/scummsys.h"
-#include "zvision/clock.h"
+#include "zvision/utility/clock.h"
#include "common/system.h"
diff --git a/engines/zvision/clock.h b/engines/zvision/utility/clock.h
index 3939ba1612..3939ba1612 100644
--- a/engines/zvision/clock.h
+++ b/engines/zvision/utility/clock.h
diff --git a/engines/zvision/lzss_read_stream.cpp b/engines/zvision/utility/lzss_read_stream.cpp
index bbbda6f526..dc537cd8ab 100644
--- a/engines/zvision/lzss_read_stream.cpp
+++ b/engines/zvision/utility/lzss_read_stream.cpp
@@ -22,7 +22,7 @@
#include "common/scummsys.h"
-#include "zvision/lzss_read_stream.h"
+#include "zvision/utility/lzss_read_stream.h"
namespace ZVision {
diff --git a/engines/zvision/lzss_read_stream.h b/engines/zvision/utility/lzss_read_stream.h
index f6b1eb1a65..f6b1eb1a65 100644
--- a/engines/zvision/lzss_read_stream.h
+++ b/engines/zvision/utility/lzss_read_stream.h
diff --git a/engines/zvision/single_value_container.cpp b/engines/zvision/utility/single_value_container.cpp
index 837bd8d7fc..2667b27b75 100644
--- a/engines/zvision/single_value_container.cpp
+++ b/engines/zvision/utility/single_value_container.cpp
@@ -22,7 +22,7 @@
#include "common/scummsys.h"
-#include "zvision/single_value_container.h"
+#include "zvision/utility/single_value_container.h"
#include "common/textconsole.h"
#include "common/str.h"
diff --git a/engines/zvision/single_value_container.h b/engines/zvision/utility/single_value_container.h
index 45b5a89e95..45b5a89e95 100644
--- a/engines/zvision/single_value_container.h
+++ b/engines/zvision/utility/single_value_container.h
diff --git a/engines/zvision/utility.cpp b/engines/zvision/utility/utility.cpp
index d973cb2f4c..6471d21e6c 100644
--- a/engines/zvision/utility.cpp
+++ b/engines/zvision/utility/utility.cpp
@@ -22,10 +22,10 @@
#include "common/scummsys.h"
-#include "zvision/utility.h"
+#include "zvision/utility/utility.h"
#include "zvision/zvision.h"
-#include "zvision/zork_raw.h"
+#include "zvision/sound/zork_raw.h"
#include "common/tokenizer.h"
#include "common/file.h"
diff --git a/engines/zvision/utility.h b/engines/zvision/utility/utility.h
index fb571f3fe8..fb571f3fe8 100644
--- a/engines/zvision/utility.h
+++ b/engines/zvision/utility/utility.h
diff --git a/engines/zvision/video.cpp b/engines/zvision/video/video.cpp
index cd11618e67..efaecb5045 100644
--- a/engines/zvision/video.cpp
+++ b/engines/zvision/video/video.cpp
@@ -24,8 +24,8 @@
#include "zvision/zvision.h"
-#include "zvision/clock.h"
-#include "zvision/render_manager.h"
+#include "zvision/utility/clock.h"
+#include "zvision/graphics/render_manager.h"
#include "common/system.h"
@@ -107,7 +107,7 @@ void ZVision::playVideo(Video::VideoDecoder &videoDecoder, const Common::Rect &d
uint16 finalWidth = origWidth * scale;
uint16 finalHeight = origHeight * scale;
- byte *scaledVideoFrameBuffer;
+ byte *scaledVideoFrameBuffer = 0;
if (scale != 1) {
scaledVideoFrameBuffer = new byte[finalWidth * finalHeight * bytesPerPixel];
}
diff --git a/engines/zvision/zork_avi_decoder.cpp b/engines/zvision/video/zork_avi_decoder.cpp
index a614f77bb7..d3db3421af 100644
--- a/engines/zvision/zork_avi_decoder.cpp
+++ b/engines/zvision/video/zork_avi_decoder.cpp
@@ -23,9 +23,9 @@
#include "common/scummsys.h"
-#include "zvision/zork_avi_decoder.h"
+#include "zvision/video/zork_avi_decoder.h"
-#include "zvision/zork_raw.h"
+#include "zvision/sound/zork_raw.h"
#include "common/stream.h"
diff --git a/engines/zvision/zork_avi_decoder.h b/engines/zvision/video/zork_avi_decoder.h
index ec2be1bb13..ec2be1bb13 100644
--- a/engines/zvision/zork_avi_decoder.h
+++ b/engines/zvision/video/zork_avi_decoder.h
diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp
index 6d8ae6d5a7..f57e225ac1 100644
--- a/engines/zvision/zvision.cpp
+++ b/engines/zvision/zvision.cpp
@@ -24,13 +24,13 @@
#include "zvision/zvision.h"
-#include "zvision/console.h"
-#include "zvision/script_manager.h"
-#include "zvision/render_manager.h"
-#include "zvision/cursor_manager.h"
-#include "zvision/save_manager.h"
-#include "zvision/string_manager.h"
-#include "zvision/zfs_archive.h"
+#include "zvision/core/console.h"
+#include "zvision/scripting/script_manager.h"
+#include "zvision/graphics/render_manager.h"
+#include "zvision/cursors/cursor_manager.h"
+#include "zvision/core/save_manager.h"
+#include "zvision/strings/string_manager.h"
+#include "zvision/archives/zfs_archive.h"
#include "zvision/detection.h"
#include "common/config-manager.h"
@@ -51,7 +51,8 @@ namespace ZVision {
ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc)
: Engine(syst),
_gameDescription(gameDesc),
- _workingWindow((WINDOW_WIDTH - WORKING_WINDOW_WIDTH) / 2, (WINDOW_HEIGHT - WORKING_WINDOW_HEIGHT) / 2, ((WINDOW_WIDTH - WORKING_WINDOW_WIDTH) / 2) + WORKING_WINDOW_WIDTH, ((WINDOW_HEIGHT - WORKING_WINDOW_HEIGHT) / 2) + WORKING_WINDOW_HEIGHT),
+ _workingWindow(gameDesc->gameId == GID_NEMESIS ? Common::Rect((WINDOW_WIDTH - ZNEM_WORKING_WINDOW_WIDTH) / 2, (WINDOW_HEIGHT - ZNEM_WORKING_WINDOW_HEIGHT) / 2, ((WINDOW_WIDTH - ZNEM_WORKING_WINDOW_WIDTH) / 2) + ZNEM_WORKING_WINDOW_WIDTH, ((WINDOW_HEIGHT - ZNEM_WORKING_WINDOW_HEIGHT) / 2) + ZNEM_WORKING_WINDOW_HEIGHT) :
+ Common::Rect((WINDOW_WIDTH - ZGI_WORKING_WINDOW_WIDTH) / 2, (WINDOW_HEIGHT - ZGI_WORKING_WINDOW_HEIGHT) / 2, ((WINDOW_WIDTH - ZGI_WORKING_WINDOW_WIDTH) / 2) + ZGI_WORKING_WINDOW_WIDTH, ((WINDOW_HEIGHT - ZGI_WORKING_WINDOW_HEIGHT) / 2) + ZGI_WORKING_WINDOW_HEIGHT)),
_pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0), /*RGB 565*/
_desiredFrameTime(33), /* ~30 fps */
_clock(_system),
diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h
index 84784d9a89..1c525c1fc1 100644
--- a/engines/zvision/zvision.h
+++ b/engines/zvision/zvision.h
@@ -25,7 +25,7 @@
#define ZVISION_ZVISION_H
#include "zvision/detection.h"
-#include "zvision/clock.h"
+#include "zvision/utility/clock.h"
#include "common/random.h"
#include "common/events.h"
@@ -70,8 +70,14 @@ private:
enum {
WINDOW_WIDTH = 640,
WINDOW_HEIGHT = 480,
- WORKING_WINDOW_WIDTH = 512,
- WORKING_WINDOW_HEIGHT = 320,
+
+ //Zork nemesis working window sizes
+ ZNEM_WORKING_WINDOW_WIDTH = 512,
+ ZNEM_WORKING_WINDOW_HEIGHT = 320,
+
+ //ZGI(and default) working window sizes
+ ZGI_WORKING_WINDOW_WIDTH = 640,
+ ZGI_WORKING_WINDOW_HEIGHT = 344,
ROTATION_SCREEN_EDGE_OFFSET = 60,
MAX_ROTATION_SPEED = 400 // Pixels per second
diff --git a/graphics/decoders/iff.cpp b/graphics/decoders/iff.cpp
index 7b37969fc1..fe27258d28 100644
--- a/graphics/decoders/iff.cpp
+++ b/graphics/decoders/iff.cpp
@@ -30,6 +30,10 @@ namespace Graphics {
IFFDecoder::IFFDecoder() {
_surface = 0;
_palette = 0;
+
+ // these 2 properties are not reset by destroy(), so the default is set here.
+ _numRelevantPlanes = 8;
+ _pixelPacking = false;
destroy();
}
@@ -54,8 +58,6 @@ void IFFDecoder::destroy() {
_paletteRanges.clear();
_type = TYPE_UNKNOWN;
_paletteColorCount = 0;
- _numRelevantPlanes = 8;
- _pixelPacking = false;
}
bool IFFDecoder::loadStream(Common::SeekableReadStream &stream) {
diff --git a/graphics/decoders/iff.h b/graphics/decoders/iff.h
index beac62e519..37cb4b38c1 100644
--- a/graphics/decoders/iff.h
+++ b/graphics/decoders/iff.h
@@ -85,6 +85,8 @@ public:
/**
* The number of planes to decode, also determines the pixel packing if _packPixels is true.
* 8 == decode all planes, map 1 pixel in 1 byte. (default, no packing even if _packPixels is true)
+ *
+ * NOTE: this property must be reset manually, and is not reset by a call to destroy().
*/
void setNumRelevantPlanes(const uint8 numRelevantPlanes) { _numRelevantPlanes = numRelevantPlanes; }
@@ -94,6 +96,8 @@ public:
* 2 == decode first 2 planes, pack 4 pixels in 1 byte. This makes _surface->w 1/4th of _header.width
* 4 == decode first 4 planes, pack 2 pixels in 1 byte. This makes _surface->w half of _header.width
* Packed bitmaps won't have a proper surface format since there is no way to tell it to use 1, 2 or 4 bits per pixel
+ *
+ * NOTE: this property must be reset manually, and is not reset by a call to destroy().
*/
void setPixelPacking(const bool pixelPacking) { _pixelPacking = pixelPacking; }
private:
diff --git a/graphics/decoders/image_decoder.h b/graphics/decoders/image_decoder.h
index 49e31c6e3a..a39a9a1493 100644
--- a/graphics/decoders/image_decoder.h
+++ b/graphics/decoders/image_decoder.h
@@ -44,6 +44,9 @@ public:
/**
* Load an image from the specified stream
+ *
+ * loadStream() should implicitly call destroy() to free the memory
+ * of the last loadStream() call.
*
* @param stream the input stream
* @return whether loading the file succeeded
@@ -54,6 +57,9 @@ public:
/**
* Destroy this decoder's surface and palette
+ *
+ * This should be called by a loadStream() implementation as well
+ * as the destructor.
*/
virtual void destroy() = 0;
diff --git a/graphics/decoders/tga.cpp b/graphics/decoders/tga.cpp
index a9f136d238..bc27f18a49 100644
--- a/graphics/decoders/tga.cpp
+++ b/graphics/decoders/tga.cpp
@@ -50,6 +50,8 @@ void TGADecoder::destroy() {
}
bool TGADecoder::loadStream(Common::SeekableReadStream &tga) {
+ destroy();
+
byte imageType, pixelDepth;
bool success;
success = readHeader(tga, imageType, pixelDepth);
diff --git a/graphics/decoders/tga.h b/graphics/decoders/tga.h
index d8ccf8f766..5b1e87d4c5 100644
--- a/graphics/decoders/tga.h
+++ b/graphics/decoders/tga.h
@@ -26,6 +26,7 @@
/*
* TGA decoder used in engines:
* - wintermute
+ * - zvision
*/
#ifndef GRAPHICS_DECODERS_TGA_H
diff --git a/gui/credits.h b/gui/credits.h
index aca3745631..a14622e1b1 100644
--- a/gui/credits.h
+++ b/gui/credits.h
@@ -522,7 +522,7 @@ static const char *credits[] = {
"C0""Johannes Schickel",
"",
"",
-"C1""Translations",
+"C1""GUI Translations",
"C0""Thierry Crozat",
"C2""Translation Lead",
"C1""Basque",
@@ -592,6 +592,28 @@ static const char *credits[] = {
"C0""Lubomyr Lisen",
"",
"",
+"C1""Game Translations",
+"C1""CGE",
+"C0""Dan Serban",
+"C2""Soltys English translation",
+"A0""Victor Gonzalez",
+"C0""V\355ctor Gonz\341lez",
+"C2""Soltys Spanish translation",
+"A0""Alejandro Gomez de la Munoza",
+"C0""Alejandro G\363mez de la Mu\361oza",
+"C2""Soltys Spanish translation",
+"",
+"C1""Drascula",
+"C0""Thierry Crozat",
+"C2""Improve French translation",
+"",
+"C1""Mortevielle",
+"C0""Hugo Labrande",
+"C2""Improve English translation",
+"C0""Thierry Crozat",
+"C2""Improve English translation",
+"",
+"",
"C1""Websites (design)",
"A0""Dobo Balazs",
"C0""Dob\363 Bal\341zs",
diff --git a/gui/predictivedialog.cpp b/gui/predictivedialog.cpp
index ef94ec6d50..5d45a3060e 100644
--- a/gui/predictivedialog.cpp
+++ b/gui/predictivedialog.cpp
@@ -752,7 +752,8 @@ bool PredictiveDialog::matchWord() {
char tmp[kMaxLineLen];
strncpy(tmp, _unitedDict.dictLine[line], kMaxLineLen);
tmp[kMaxLineLen - 1] = 0;
- char *tok = strtok(tmp, " ");
+ char *tok;
+ strtok(tmp, " ");
tok = strtok(NULL, " ");
_currentWord = Common::String(tok, _currentCode.size());
return true;
diff --git a/video/avi_decoder.h b/video/avi_decoder.h
index 80c11b1e09..3bf443a95b 100644
--- a/video/avi_decoder.h
+++ b/video/avi_decoder.h
@@ -54,6 +54,7 @@ class Codec;
* - sci
* - sword1
* - sword2
+ * - zvision
*/
class AVIDecoder : public VideoDecoder {
public: